@@ -65,6 +65,29 @@ declare module 'vscode' {
6565 constructor ( uri : Uri , edits : NotebookEdit | NotebookEdit [ ] ) ;
6666 }
6767
68+ /**
69+ * Represents a file-level edit (creation, deletion, or rename).
70+ */
71+ export interface ChatWorkspaceFileEdit {
72+ /**
73+ * The original file URI (undefined for new files).
74+ */
75+ oldResource ?: Uri ;
76+
77+ /**
78+ * The new file URI (undefined for deleted files).
79+ */
80+ newResource ?: Uri ;
81+ }
82+
83+ /**
84+ * Represents a workspace edit containing file-level operations.
85+ */
86+ export class ChatResponseWorkspaceEditPart {
87+ edits : ChatWorkspaceFileEdit [ ] ;
88+ constructor ( edits : ChatWorkspaceFileEdit [ ] ) ;
89+ }
90+
6891 export class ChatResponseConfirmationPart {
6992 title : string ;
7093 message : string | MarkdownString ;
@@ -95,6 +118,48 @@ declare module 'vscode' {
95118 toolEdited ?: string ;
96119 } ;
97120 language : string ;
121+
122+ /**
123+ * Terminal command output. Displayed when the terminal is no longer available.
124+ */
125+ output ?: {
126+ /** The raw output text, may include ANSI escape codes. */
127+ text : string ;
128+ } ;
129+
130+ /**
131+ * Command execution state.
132+ */
133+ state ?: {
134+ /** Exit code of the command. */
135+ exitCode ?: number ;
136+ /** Duration of execution in milliseconds. */
137+ duration ?: number ;
138+ } ;
139+ }
140+
141+ export class McpToolInvocationContentData {
142+ /**
143+ * The mime type which determines how the data property is interpreted.
144+ */
145+ mimeType : string ;
146+
147+ /**
148+ * The byte data for this part.
149+ */
150+ data : Uint8Array ;
151+
152+ /**
153+ * Construct a generic data part with the given content.
154+ * @param data The byte data for this part.
155+ * @param mimeType The mime type of the data.
156+ */
157+ constructor ( data : Uint8Array , mimeType : string ) ;
158+ }
159+
160+ export interface ChatMcpToolInvocationData {
161+ input : string ;
162+ output : McpToolInvocationContentData [ ] ;
98163 }
99164
100165 export class ChatToolInvocationPart {
@@ -107,7 +172,7 @@ declare module 'vscode' {
107172 isConfirmed ?: boolean ;
108173 isComplete ?: boolean ;
109174 toolSpecificData ?: ChatTerminalToolInvocationData ;
110- subAgentInvocationId ?: string ;
175+ fromSubAgent ?: boolean ;
111176 presentation ?: 'hidden' | 'hiddenAfterComplete' | undefined ;
112177
113178 constructor ( toolName : string , toolCallId : string , isError ?: boolean ) ;
@@ -179,7 +244,7 @@ declare module 'vscode' {
179244 constructor ( uris : Uri [ ] , callback : ( ) => Thenable < unknown > ) ;
180245 }
181246
182- export type ExtendedChatResponsePart = ChatResponsePart | ChatResponseTextEditPart | ChatResponseNotebookEditPart | ChatResponseConfirmationPart | ChatResponseCodeCitationPart | ChatResponseReferencePart2 | ChatResponseMovePart | ChatResponseExtensionsPart | ChatResponsePullRequestPart | ChatToolInvocationPart | ChatResponseMultiDiffPart | ChatResponseThinkingProgressPart | ChatResponseExternalEditPart ;
247+ export type ExtendedChatResponsePart = ChatResponsePart | ChatResponseTextEditPart | ChatResponseNotebookEditPart | ChatResponseConfirmationPart | ChatResponseCodeCitationPart | ChatResponseReferencePart2 | ChatResponseMovePart | ChatResponseExtensionsPart | ChatResponsePullRequestPart | ChatPrepareToolInvocationPart | ChatToolInvocationPart | ChatResponseMultiDiffPart | ChatResponseThinkingProgressPart | ChatResponseExternalEditPart ;
183248 export class ChatResponseWarningPart {
184249 value : MarkdownString ;
185250 constructor ( value : string | MarkdownString ) ;
@@ -313,6 +378,12 @@ declare module 'vscode' {
313378
314379 notebookEdit ( target : Uri , isDone : true ) : void ;
315380
381+ /**
382+ * Push a workspace edit containing file-level operations (create, delete, rename).
383+ * @param edits Array of file-level edits to apply
384+ */
385+ workspaceEdit ( edits : ChatWorkspaceFileEdit [ ] ) : void ;
386+
316387 /**
317388 * Makes an external edit to one or more resources. Changes to the
318389 * resources made within the `callback` and before it resolves will be
@@ -421,7 +492,7 @@ declare module 'vscode' {
421492 /**
422493 * A map of all tools that should (`true`) and should not (`false`) be used in this request.
423494 */
424- readonly tools : Map < string , boolean > ;
495+ readonly tools : Map < LanguageModelToolInformation , boolean > ;
425496 }
426497
427498 export namespace lm {
@@ -511,6 +582,47 @@ declare module 'vscode' {
511582
512583 export type ChatExtendedRequestHandler = ( request : ChatRequest , context : ChatContext , response : ChatResponseStream , token : CancellationToken ) => ProviderResult < ChatResult | void > ;
513584
585+ /**
586+ * Details about the prompt token usage by category and label.
587+ */
588+ export interface ChatResultPromptTokenDetail {
589+ /**
590+ * The category this token usage belongs to (e.g., "System", "Context", "Conversation").
591+ */
592+ readonly category : string ;
593+
594+ /**
595+ * The label for this specific token usage (e.g., "System prompt", "Attached files").
596+ */
597+ readonly label : string ;
598+
599+ /**
600+ * The percentage of the total prompt tokens this represents (0-100).
601+ */
602+ readonly percentageOfPrompt : number ;
603+ }
604+
605+ /**
606+ * Token usage information for a chat request.
607+ */
608+ export interface ChatResultUsage {
609+ /**
610+ * The number of prompt tokens used in this request.
611+ */
612+ readonly promptTokens : number ;
613+
614+ /**
615+ * The number of completion tokens generated in this response.
616+ */
617+ readonly completionTokens : number ;
618+
619+ /**
620+ * Optional breakdown of prompt token usage by category and label.
621+ * If the percentages do not sum to 100%, the remaining will be shown as "Uncategorized".
622+ */
623+ readonly promptTokenDetails ?: readonly ChatResultPromptTokenDetail [ ] ;
624+ }
625+
514626 export interface ChatResult {
515627 nextQuestion ?: {
516628 prompt : string ;
@@ -521,6 +633,12 @@ declare module 'vscode' {
521633 * An optional detail string that will be rendered at the end of the response in certain UI contexts.
522634 */
523635 details ?: string ;
636+
637+ /**
638+ * Token usage information for this request, if available.
639+ * This is typically provided by the underlying language model.
640+ */
641+ readonly usage ?: ChatResultUsage ;
524642 }
525643
526644 export namespace chat {
0 commit comments