fix: expose abort signal to extensions closes #2660

This commit is contained in:
Mario Zechner
2026-03-28 22:25:06 +01:00
parent e773527b3a
commit 7d4faa080d
10 changed files with 76 additions and 0 deletions

View File

@@ -208,6 +208,7 @@ export class ExtensionRunner {
private errorListeners: Set<ExtensionErrorListener> = new Set();
private getModel: () => Model<any> | undefined = () => undefined;
private isIdleFn: () => boolean = () => true;
private getSignalFn: () => AbortSignal | undefined = () => undefined;
private waitForIdleFn: () => Promise<void> = async () => {};
private abortFn: () => void = () => {};
private hasPendingMessagesFn: () => boolean = () => false;
@@ -265,6 +266,7 @@ export class ExtensionRunner {
// Context actions (required)
this.getModel = contextActions.getModel;
this.isIdleFn = contextActions.isIdle;
this.getSignalFn = contextActions.getSignal;
this.abortFn = contextActions.abort;
this.hasPendingMessagesFn = contextActions.hasPendingMessages;
this.shutdownHandler = contextActions.shutdown;
@@ -541,6 +543,7 @@ export class ExtensionRunner {
return getModel();
},
isIdle: () => this.isIdleFn(),
signal: this.getSignalFn(),
abort: () => this.abortFn(),
hasPendingMessages: () => this.hasPendingMessagesFn(),
shutdown: () => this.shutdownHandler(),