Skip to content

Commit c8c44a3

Browse files
authored
tool invocation polish (#7063)
* remove remote from name * Tool invocation polish (#7053)
1 parent 1033e7b commit c8c44a3

File tree

3 files changed

+263
-3
lines changed

3 files changed

+263
-3
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"enabledApiProposals": [
1414
"activeComment",
1515
"chatParticipantAdditions",
16+
"chatParticipantPrivate",
1617
"codiconDecoration",
1718
"codeActionRanges",
1819
"commentingRangeHint",
@@ -35,7 +36,7 @@
3536
"version": "0.112.0",
3637
"publisher": "GitHub",
3738
"engines": {
38-
"vscode": "^1.100.0"
39+
"vscode": "^1.102.0"
3940
},
4041
"categories": [
4142
"Other",
Lines changed: 258 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,258 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
// version: 9
7+
8+
declare module 'vscode' {
9+
10+
/**
11+
* The location at which the chat is happening.
12+
*/
13+
export enum ChatLocation {
14+
/**
15+
* The chat panel
16+
*/
17+
Panel = 1,
18+
/**
19+
* Terminal inline chat
20+
*/
21+
Terminal = 2,
22+
/**
23+
* Notebook inline chat
24+
*/
25+
Notebook = 3,
26+
/**
27+
* Code editor inline chat
28+
*/
29+
Editor = 4,
30+
}
31+
32+
export class ChatRequestEditorData {
33+
//TODO@API should be the editor
34+
document: TextDocument;
35+
selection: Selection;
36+
wholeRange: Range;
37+
38+
constructor(document: TextDocument, selection: Selection, wholeRange: Range);
39+
}
40+
41+
export class ChatRequestNotebookData {
42+
//TODO@API should be the editor
43+
readonly cell: TextDocument;
44+
45+
constructor(cell: TextDocument);
46+
}
47+
48+
export interface ChatRequest {
49+
/**
50+
* The id of the chat request. Used to identity an interaction with any of the chat surfaces.
51+
*/
52+
readonly id: string;
53+
/**
54+
* The attempt number of the request. The first request has attempt number 0.
55+
*/
56+
readonly attempt: number;
57+
58+
/**
59+
* If automatic command detection is enabled.
60+
*/
61+
readonly enableCommandDetection: boolean;
62+
63+
/**
64+
* If the chat participant or command was automatically assigned.
65+
*/
66+
readonly isParticipantDetected: boolean;
67+
68+
/**
69+
* The location at which the chat is happening. This will always be one of the supported values
70+
*
71+
* @deprecated
72+
*/
73+
readonly location: ChatLocation;
74+
75+
/**
76+
* Information that is specific to the location at which chat is happening, e.g within a document, notebook,
77+
* or terminal. Will be `undefined` for the chat panel.
78+
*/
79+
readonly location2: ChatRequestEditorData | ChatRequestNotebookData | undefined;
80+
81+
/**
82+
* Events for edited files in this session collected since the last request.
83+
*/
84+
readonly editedFileEvents?: ChatRequestEditedFileEvent[];
85+
}
86+
87+
export enum ChatRequestEditedFileEventKind {
88+
Keep = 1,
89+
Undo = 2,
90+
UserModification = 3,
91+
}
92+
93+
export interface ChatRequestEditedFileEvent {
94+
readonly uri: Uri;
95+
readonly eventKind: ChatRequestEditedFileEventKind;
96+
}
97+
98+
/**
99+
* ChatRequestTurn + private additions. Note- at runtime this is the SAME as ChatRequestTurn and instanceof is safe.
100+
*/
101+
export class ChatRequestTurn2 {
102+
/**
103+
* The prompt as entered by the user.
104+
*
105+
* Information about references used in this request is stored in {@link ChatRequestTurn.references}.
106+
*
107+
* *Note* that the {@link ChatParticipant.name name} of the participant and the {@link ChatCommand.name command}
108+
* are not part of the prompt.
109+
*/
110+
readonly prompt: string;
111+
112+
/**
113+
* The id of the chat participant to which this request was directed.
114+
*/
115+
readonly participant: string;
116+
117+
/**
118+
* The name of the {@link ChatCommand command} that was selected for this request.
119+
*/
120+
readonly command?: string;
121+
122+
/**
123+
* The references that were used in this message.
124+
*/
125+
readonly references: ChatPromptReference[];
126+
127+
/**
128+
* The list of tools were attached to this request.
129+
*/
130+
readonly toolReferences: readonly ChatLanguageModelToolReference[];
131+
132+
/**
133+
* Events for edited files in this session collected between the previous request and this one.
134+
*/
135+
readonly editedFileEvents?: ChatRequestEditedFileEvent[];
136+
137+
/**
138+
* @hidden
139+
*/
140+
private constructor(prompt: string, command: string | undefined, references: ChatPromptReference[], participant: string, toolReferences: ChatLanguageModelToolReference[], editedFileEvents: ChatRequestEditedFileEvent[] | undefined);
141+
}
142+
143+
export interface ChatParticipant {
144+
supportIssueReporting?: boolean;
145+
}
146+
147+
export enum ChatErrorLevel {
148+
Info = 0,
149+
Warning = 1,
150+
Error = 2,
151+
}
152+
153+
export interface ChatErrorDetails {
154+
/**
155+
* If set to true, the message content is completely hidden. Only ChatErrorDetails#message will be shown.
156+
*/
157+
responseIsRedacted?: boolean;
158+
159+
isQuotaExceeded?: boolean;
160+
161+
level?: ChatErrorLevel;
162+
}
163+
164+
export namespace chat {
165+
export function createDynamicChatParticipant(id: string, dynamicProps: DynamicChatParticipantProps, handler: ChatExtendedRequestHandler): ChatParticipant;
166+
}
167+
168+
/**
169+
* These don't get set on the ChatParticipant after creation, like other props, because they are typically defined in package.json and we want them at the time of creation.
170+
*/
171+
export interface DynamicChatParticipantProps {
172+
name: string;
173+
publisherName: string;
174+
description?: string;
175+
fullName?: string;
176+
}
177+
178+
export namespace lm {
179+
export function registerIgnoredFileProvider(provider: LanguageModelIgnoredFileProvider): Disposable;
180+
}
181+
182+
export interface LanguageModelIgnoredFileProvider {
183+
provideFileIgnored(uri: Uri, token: CancellationToken): ProviderResult<boolean>;
184+
}
185+
186+
export interface LanguageModelToolInvocationOptions<T> {
187+
chatRequestId?: string;
188+
chatSessionId?: string;
189+
chatInteractionId?: string;
190+
terminalCommand?: string;
191+
}
192+
193+
export interface PreparedToolInvocation {
194+
pastTenseMessage?: string | MarkdownString;
195+
presentation?: 'hidden' | undefined;
196+
}
197+
198+
export interface LanguageModelTool<T> {
199+
prepareInvocation2?(options: LanguageModelToolInvocationPrepareOptions<T>, token: CancellationToken): ProviderResult<PreparedTerminalToolInvocation>;
200+
}
201+
202+
export class PreparedTerminalToolInvocation {
203+
readonly command: string;
204+
readonly language: string;
205+
readonly confirmationMessages?: LanguageModelToolConfirmationMessages;
206+
readonly presentation?: 'hidden' | undefined;
207+
208+
constructor(
209+
command: string,
210+
language: string,
211+
confirmationMessages?: LanguageModelToolConfirmationMessages,
212+
presentation?: 'hidden'
213+
);
214+
}
215+
216+
export class ExtendedLanguageModelToolResult extends LanguageModelToolResult {
217+
toolResultMessage?: string | MarkdownString;
218+
toolResultDetails?: Array<Uri | Location>;
219+
}
220+
221+
// #region Chat participant detection
222+
223+
export interface ChatParticipantMetadata {
224+
participant: string;
225+
command?: string;
226+
disambiguation: { category: string; description: string; examples: string[] }[];
227+
}
228+
229+
export interface ChatParticipantDetectionResult {
230+
participant: string;
231+
command?: string;
232+
}
233+
234+
export interface ChatParticipantDetectionProvider {
235+
provideParticipantDetection(chatRequest: ChatRequest, context: ChatContext, options: { participants?: ChatParticipantMetadata[]; location: ChatLocation }, token: CancellationToken): ProviderResult<ChatParticipantDetectionResult>;
236+
}
237+
238+
export namespace chat {
239+
export function registerChatParticipantDetectionProvider(participantDetectionProvider: ChatParticipantDetectionProvider): Disposable;
240+
241+
export const onDidDisposeChatSession: Event<string>;
242+
}
243+
244+
// #endregion
245+
246+
// #region ChatErrorDetailsWithConfirmation
247+
248+
export interface ChatErrorDetails {
249+
confirmationButtons?: ChatErrorDetailsConfirmationButton[];
250+
}
251+
252+
export interface ChatErrorDetailsConfirmationButton {
253+
data: any;
254+
label: string;
255+
}
256+
257+
// #endregion
258+
}

src/lm/tools/copilotRemoteAgentTool.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ export class CopilotRemoteAgentTool implements vscode.LanguageModelTool<CopilotR
2828
const targetRepo = await this.manager.repoInfo();
2929
const autoPushEnabled = this.manager.autoCommitAndPushEnabled();
3030
return {
31-
invocationMessage: vscode.l10n.t('Launching remote coding agent...'),
31+
pastTenseMessage: vscode.l10n.t('Launched coding agent'),
32+
invocationMessage: vscode.l10n.t('Launching coding agent'),
3233
confirmationMessages: {
3334
message: targetRepo && autoPushEnabled
3435
? vscode.l10n.t('The coding agent will continue work on "**{0}**" in a new branch on "**{1}/{2}**". Any uncommitted changes will be **automatically pushed to your default remote ({3})** and included.', title, targetRepo.owner, targetRepo.repo, targetRepo.remote)
3536
: vscode.l10n.t('The coding agent will start working on "**{0}**"', title),
36-
title: vscode.l10n.t('Start remote coding agent?'),
37+
title: vscode.l10n.t('Start coding agent?'),
3738
}
3839
};
3940
}

0 commit comments

Comments
 (0)