Skip to content

Commit 746c874

Browse files
authored
Update github copilot npm package (#4809)
1 parent 42e6219 commit 746c874

4 files changed

Lines changed: 41 additions & 39 deletions

File tree

package-lock.json

Lines changed: 28 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6359,7 +6359,7 @@
63596359
"@anthropic-ai/claude-agent-sdk": "^0.2.81",
63606360
"@anthropic-ai/sdk": "^0.80.0",
63616361
"@github/blackbird-external-ingest-utils": "^0.3.0",
6362-
"@github/copilot": "^1.0.11",
6362+
"@github/copilot": "^1.0.12",
63636363
"@google/genai": "^1.22.0",
63646364
"@humanwhocodes/gitignore-to-minimatch": "1.0.2",
63656365
"@microsoft/tiktokenizer": "^1.0.10",

src/extension/chatSessions/copilotcli/node/copilotcliSession.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -269,17 +269,16 @@ export class CopilotCLISession extends DisposableStore implements ICopilotCLISes
269269
this.logService.info(`[CopilotCLISession] Steering session ${this.sessionId}`);
270270
const disposables = new DisposableStore();
271271
const logStartTime = Date.now();
272-
const abortController = new AbortController();
273272
disposables.add(token.onCancellationRequested(() => {
274-
abortController.abort();
273+
this._sdkSession.abort();
275274
}));
276-
disposables.add(toDisposable(() => abortController.abort()));
275+
disposables.add(toDisposable(() => this._sdkSession.abort()));
277276

278277
try {
279278
// Send the steering prompt (completes quickly) and also wait for the
280279
// previous request to finish, so this promise settles only once all
281280
// in-flight work is done.
282-
await Promise.all([previousRequestPromise, this.sendRequestInternal(input, attachments, true, logStartTime, abortController)]);
281+
await Promise.all([previousRequestPromise, this.sendRequestInternal(input, attachments, true, logStartTime)]);
283282
this._logConversation(prompt, '', modelId || '', attachments, logStartTime, 'Completed');
284283
} catch (error) {
285284
this._logConversation(prompt, '', modelId || '', attachments, logStartTime, 'Failed', error instanceof Error ? error.message : String(error));
@@ -350,11 +349,10 @@ export class CopilotCLISession extends DisposableStore implements ICopilotCLISes
350349
this.logService.info(`[CopilotCLISession] Invoking session ${this.sessionId}`);
351350
const disposables = new DisposableStore();
352351
const logStartTime = Date.now();
353-
const abortController = new AbortController();
354352
disposables.add(token.onCancellationRequested(() => {
355-
abortController.abort();
353+
this._sdkSession.abort();
356354
}));
357-
disposables.add(toDisposable(() => abortController.abort()));
355+
disposables.add(toDisposable(() => this._sdkSession.abort()));
358356

359357
this._status = ChatSessionStatus.InProgress;
360358
this._statusChange.fire(this._status);
@@ -657,7 +655,7 @@ export class CopilotCLISession extends DisposableStore implements ICopilotCLISes
657655
})));
658656

659657
if (!token.isCancellationRequested) {
660-
await this.sendRequestInternal(input, attachments, false, logStartTime, abortController);
658+
await this.sendRequestInternal(input, attachments, false, logStartTime);
661659
}
662660
this.logService.trace(`[CopilotCLISession] Invoking session (completed) ${this.sessionId}`);
663661

@@ -736,7 +734,7 @@ export class CopilotCLISession extends DisposableStore implements ICopilotCLISes
736734
* prompt is injected into the already-running conversation rather than
737735
* starting a new turn. This is the mechanism behind session steering.
738736
*/
739-
private async sendRequestInternal(input: CopilotCLISessionInput, attachments: Attachment[], steering = false, logStartTime: number, abortController: AbortController): Promise<void> {
737+
private async sendRequestInternal(input: CopilotCLISessionInput, attachments: Attachment[], steering = false, logStartTime: number): Promise<void> {
740738
const prompt = getPromptLabel(input);
741739
this._logRequest(prompt, this._lastUsedModel || '', attachments, logStartTime);
742740

@@ -763,7 +761,7 @@ export class CopilotCLISession extends DisposableStore implements ICopilotCLISes
763761
} else {
764762
this._sdkSession.currentMode = 'interactive';
765763
}
766-
const sendOptions: SendOptions = { prompt: input.prompt, attachments, abortController, agentMode: this._sdkSession.currentMode };
764+
const sendOptions: SendOptions = { prompt: input.prompt, attachments, agentMode: this._sdkSession.currentMode };
767765
if (steering) {
768766
sendOptions.mode = 'immediate';
769767
}

src/extension/chatSessions/copilotcli/node/test/copilotcliSession.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ class MockSdkSession {
123123

124124
async compactHistory() { return { success: true }; }
125125

126+
async abort() { }
127+
128+
isAbortable(): boolean { return true; }
129+
126130
async initializeAndValidateTools() { }
127131
getCurrentToolMetadata(): unknown[] | undefined { return this._toolMetadata; }
128132
private _toolMetadata: unknown[] | undefined;

0 commit comments

Comments
 (0)