Skip to content

Commit 1558530

Browse files
Copilotrebornix
andcommitted
Update CHANGELOG.md for timeout-based polling improvements
Co-authored-by: rebornix <876920+rebornix@users.noreply.github.com>
1 parent 1326aaa commit 1558530

6 files changed

+188
-21
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [Unreleased]
4+
5+
### Fixes
6+
7+
- Refactor timeline event polling to use timeout-based approach for Copilot sessions. Prevents indefinite waiting by enforcing appropriate timeouts (1 minute for timeline events, 1 hour for coding sessions) to improve user experience.
8+
39
## 0.114.2
410

511
### Fixes

src/@types/vscode.proposed.chatParticipantAdditions.d.ts

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,16 @@ declare module 'vscode' {
125125
* Optional URI to navigate to when clicking on the file.
126126
*/
127127
goToFileUri?: Uri;
128+
129+
/**
130+
* Added data (e.g. line numbers) to show in the UI
131+
*/
132+
added?: number;
133+
134+
/**
135+
* Removed data (e.g. line numbers) to show in the UI
136+
*/
137+
removed?: number;
128138
}
129139

130140
/**
@@ -149,7 +159,7 @@ declare module 'vscode' {
149159
constructor(value: ChatResponseDiffEntry[], title: string);
150160
}
151161

152-
export type ExtendedChatResponsePart = ChatResponsePart | ChatResponseTextEditPart | ChatResponseNotebookEditPart | ChatResponseConfirmationPart | ChatResponseCodeCitationPart | ChatResponseReferencePart2 | ChatResponseMovePart | ChatResponseExtensionsPart | ChatResponsePullRequestPart | ChatPrepareToolInvocationPart | ChatToolInvocationPart | ChatResponseMultiDiffPart;
162+
export type ExtendedChatResponsePart = ChatResponsePart | ChatResponseTextEditPart | ChatResponseNotebookEditPart | ChatResponseConfirmationPart | ChatResponseCodeCitationPart | ChatResponseReferencePart2 | ChatResponseMovePart | ChatResponseExtensionsPart | ChatResponsePullRequestPart | ChatPrepareToolInvocationPart | ChatToolInvocationPart | ChatResponseMultiDiffPart | ChatResponseThinkingProgressPart;
153163
export class ChatResponseWarningPart {
154164
value: MarkdownString;
155165
constructor(value: string | MarkdownString);
@@ -161,6 +171,23 @@ declare module 'vscode' {
161171
constructor(value: string, task?: (progress: Progress<ChatResponseWarningPart | ChatResponseReferencePart>) => Thenable<string | void>);
162172
}
163173

174+
/**
175+
* A specialized progress part for displaying thinking/reasoning steps.
176+
*/
177+
export class ChatResponseThinkingProgressPart {
178+
value: string | string[];
179+
id?: string;
180+
metadata?: { readonly [key: string]: any };
181+
task?: (progress: Progress<LanguageModelThinkingPart>) => Thenable<string | void>;
182+
183+
/**
184+
* Creates a new thinking progress part.
185+
* @param value An initial progress message
186+
* @param task A task that will emit thinking parts during its execution
187+
*/
188+
constructor(value: string | string[], id?: string, metadata?: { readonly [key: string]: any }, task?: (progress: Progress<LanguageModelThinkingPart>) => Thenable<string | void>);
189+
}
190+
164191
export class ChatResponseReferencePart2 {
165192
/**
166193
* The reference target.
@@ -256,6 +283,8 @@ declare module 'vscode' {
256283
*/
257284
progress(value: string, task?: (progress: Progress<ChatResponseWarningPart | ChatResponseReferencePart>) => Thenable<string | void>): void;
258285

286+
thinkingProgress(thinkingDelta: ThinkingDelta): void;
287+
259288
textEdit(target: Uri, edits: TextEdit | TextEdit[]): void;
260289

261290
textEdit(target: Uri, isDone: true): void;
@@ -298,6 +327,8 @@ declare module 'vscode' {
298327
prepareToolInvocation(toolName: string): void;
299328

300329
push(part: ExtendedChatResponsePart): void;
330+
331+
clearToPreviousToolInvocation(reason: ChatResponseClearToPreviousToolInvocationReason): void;
301332
}
302333

303334
export enum ChatResponseReferencePartStatusKind {
@@ -306,6 +337,26 @@ declare module 'vscode' {
306337
Omitted = 3
307338
}
308339

340+
export type ThinkingDelta = {
341+
text?: string | string[];
342+
id: string;
343+
metadata?: { readonly [key: string]: any };
344+
} | {
345+
text?: string | string[];
346+
id?: string;
347+
metadata: { readonly [key: string]: any };
348+
} |
349+
{
350+
text: string | string[];
351+
id?: string;
352+
metadata?: { readonly [key: string]: any };
353+
};
354+
355+
export enum ChatResponseClearToPreviousToolInvocationReason {
356+
NoReason = 0,
357+
FilteredContentRetry = 1,
358+
CopyrightContentRetry = 2,
359+
}
309360

310361
/**
311362
* Does this piggy-back on the existing ChatRequest, or is it a different type of request entirely?
@@ -527,6 +578,8 @@ declare module 'vscode' {
527578
kind: 'chatEditingHunkAction';
528579
uri: Uri;
529580
lineCount: number;
581+
linesAdded: number;
582+
linesRemoved: number;
530583
outcome: ChatEditingSessionActionOutcome;
531584
hasRemainingEdits: boolean;
532585
}
@@ -547,6 +600,11 @@ declare module 'vscode' {
547600
* TODO Needed for now to drive the variableName-type reference, but probably both of these should go away in the future.
548601
*/
549602
readonly name: string;
603+
604+
/**
605+
* The list of tools were referenced in the value of the reference
606+
*/
607+
readonly toolReferences?: readonly ChatLanguageModelToolReference[];
550608
}
551609

552610
export interface ChatResultFeedback {
@@ -589,5 +647,6 @@ declare module 'vscode' {
589647

590648
export interface ChatRequest {
591649
modeInstructions?: string;
650+
modeInstructionsToolReferences?: readonly ChatLanguageModelToolReference[];
592651
}
593652
}

src/@types/vscode.proposed.chatParticipantPrivate.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
// version: 9
6+
// version: 10
77

88
declare module 'vscode' {
99

@@ -183,6 +183,8 @@ declare module 'vscode' {
183183
isQuotaExceeded?: boolean;
184184

185185
level?: ChatErrorLevel;
186+
187+
code?: string;
186188
}
187189

188190
export namespace chat {

src/@types/vscode.proposed.chatSessionsProvider.d.ts

Lines changed: 101 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,26 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
declare module 'vscode' {
7+
/**
8+
* Represents the status of a chat session.
9+
*/
10+
export enum ChatSessionStatus {
11+
/**
12+
* The chat session failed to complete.
13+
*/
14+
Failed = 0,
15+
16+
/**
17+
* The chat session completed successfully.
18+
*/
19+
Completed = 1,
20+
21+
/**
22+
* The chat session is currently in progress.
23+
*/
24+
InProgress = 2
25+
}
26+
727
/**
828
* Provides a list of information about chat sessions.
929
*/
@@ -13,16 +33,34 @@ declare module 'vscode' {
1333
*/
1434
readonly onDidChangeChatSessionItems: Event<void>;
1535

16-
// /**
17-
// * Create a new chat session item
18-
// */
19-
// provideNewChatSessionItem(context: {
20-
// // This interface should be extracted
21-
// readonly triggerChat?: {
22-
// readonly prompt: string;
23-
// readonly history: ReadonlyArray<ChatRequestTurn | ChatResponseTurn>;
24-
// };
25-
// }, token: CancellationToken): Thenable<ChatSessionItem> | ChatSessionItem;
36+
/**
37+
* Creates a new chat session.
38+
*
39+
* @param options Options for the new session including an optional initial prompt and history
40+
* @param token A cancellation token
41+
* @returns Metadata for the chat session
42+
*/
43+
provideNewChatSessionItem?(options: {
44+
/**
45+
* The chat request that initiated the session creation
46+
*/
47+
readonly request: ChatRequest;
48+
49+
/**
50+
* Initial prompt to initiate the session
51+
*/
52+
readonly prompt?: string;
53+
54+
/**
55+
* History to initialize the session with
56+
*/
57+
readonly history?: ReadonlyArray<ChatRequestTurn | ChatResponseTurn>;
58+
59+
/**
60+
* Additional metadata to use for session creation
61+
*/
62+
metadata?: any;
63+
}, token: CancellationToken): ProviderResult<ChatSessionItem>;
2664

2765
/**
2866
* Provides a list of chat sessions.
@@ -46,10 +84,53 @@ declare module 'vscode' {
4684
* An icon for the participant shown in UI.
4785
*/
4886
iconPath?: IconPath;
87+
88+
/**
89+
* An optional description that provides additional context about the chat session.
90+
*/
91+
description?: string | MarkdownString;
92+
93+
/**
94+
* An optional status indicating the current state of the session.
95+
*/
96+
status?: ChatSessionStatus;
97+
98+
/**
99+
* The tooltip text when you hover over this item.
100+
*/
101+
tooltip?: string | MarkdownString;
102+
103+
/**
104+
* The times at which session started and ended
105+
*/
106+
timing?: {
107+
/**
108+
* Session start timestamp in milliseconds elapsed since January 1, 1970 00:00:00 UTC.
109+
*/
110+
startTime: number;
111+
/**
112+
* Session end timestamp in milliseconds elapsed since January 1, 1970 00:00:00 UTC.
113+
*/
114+
endTime?: number;
115+
};
116+
117+
/**
118+
* Statistics about the chat session.
119+
*/
120+
statistics?: {
121+
/**
122+
* Number of insertions made during the session.
123+
*/
124+
insertions: number;
125+
126+
/**
127+
* Number of deletions made during the session.
128+
*/
129+
deletions: number;
130+
};
49131
}
50132

51133
export interface ChatSession {
52-
53134
/**
54135
* The full history of the session
55136
*
@@ -74,6 +155,7 @@ declare module 'vscode' {
74155
* If not set, then the session will be considered read-only and no requests can be made.
75156
*/
76157
// TODO: Should we introduce our own type for `ChatRequestHandler` since not all field apply to chat sessions?
158+
// TODO: Revisit this to align with code.
77159
readonly requestHandler: ChatRequestHandler | undefined;
78160
}
79161

@@ -108,7 +190,14 @@ declare module 'vscode' {
108190
*
109191
* @returns A disposable that unregisters the provider when disposed.
110192
*/
111-
export function registerChatSessionContentProvider(chatSessionType: string, provider: ChatSessionContentProvider): Disposable;
193+
export function registerChatSessionContentProvider(chatSessionType: string, provider: ChatSessionContentProvider, capabilities?: ChatSessionCapabilities): Disposable;
194+
}
195+
196+
export interface ChatSessionCapabilities {
197+
/**
198+
* Whether sessions can be interrupted and resumed without side-effects.
199+
*/
200+
supportsInterruptions?: boolean;
112201
}
113202

114203
export interface ChatSessionShowOptions {

src/@types/vscode.proposed.languageModelDataPart.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ declare module 'vscode' {
4242
* A string or heterogeneous array of things that a message can contain as content. Some parts may be message-type
4343
* specific for some models.
4444
*/
45-
content: Array<LanguageModelTextPart | LanguageModelToolResultPart2 | LanguageModelToolCallPart | LanguageModelDataPart>;
45+
content: Array<LanguageModelTextPart | LanguageModelToolResultPart2 | LanguageModelToolCallPart | LanguageModelDataPart | LanguageModelThinkingPart>;
4646

4747
/**
4848
* The optional name of a user for this message.
@@ -56,7 +56,7 @@ declare module 'vscode' {
5656
* @param content The content of the message.
5757
* @param name The optional name of a user for the message.
5858
*/
59-
constructor(role: LanguageModelChatMessageRole, content: string | Array<LanguageModelTextPart | LanguageModelToolResultPart2 | LanguageModelToolCallPart | LanguageModelDataPart>, name?: string);
59+
constructor(role: LanguageModelChatMessageRole, content: string | Array<LanguageModelTextPart | LanguageModelToolResultPart2 | LanguageModelToolCallPart | LanguageModelDataPart | LanguageModelThinkingPart>, name?: string);
6060
}
6161

6262
/**

src/@types/vscode.proposed.languageModelToolResultAudience.d.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,32 @@
55

66
declare module 'vscode' {
77

8-
export enum ToolResultAudience {
8+
export enum LanguageModelPartAudience {
9+
/**
10+
* The part should be shown to the language model.
11+
*/
912
Assistant = 0,
13+
/**
14+
* The part should be shown to the user.
15+
*/
1016
User = 1,
17+
/**
18+
* The part should should be retained for internal bookkeeping within
19+
* extensions.
20+
*/
21+
Extension = 2,
1122
}
1223

1324
/**
1425
* A language model response part containing a piece of text, returned from a {@link LanguageModelChatResponse}.
1526
*/
1627
export class LanguageModelTextPart2 extends LanguageModelTextPart {
17-
audience: ToolResultAudience[] | undefined;
18-
constructor(value: string, audience?: ToolResultAudience[]);
28+
audience: LanguageModelPartAudience[] | undefined;
29+
constructor(value: string, audience?: LanguageModelPartAudience[]);
1930
}
2031

2132
export class LanguageModelDataPart2 extends LanguageModelDataPart {
22-
audience: ToolResultAudience[] | undefined;
23-
constructor(data: Uint8Array, mimeType: string, audience?: ToolResultAudience[]);
33+
audience: LanguageModelPartAudience[] | undefined;
34+
constructor(data: Uint8Array, mimeType: string, audience?: LanguageModelPartAudience[]);
2435
}
2536
}

0 commit comments

Comments
 (0)