Skip to content

Commit 0353033

Browse files
authored
api - refine agent property of turn instances (microsoft#205231)
microsoft#199908
1 parent 20859e3 commit 0353033

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

src/vs/workbench/api/common/extHostChatAgents2.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,11 @@ export class ExtHostChatAgents2 implements ExtHostChatAgentsShape2 {
235235
{ ...ehResult, metadata: undefined };
236236

237237
// REQUEST turn
238-
res.push(new extHostTypes.ChatAgentRequestTurn(h.request.message, h.request.command, h.request.variables.variables.map(typeConvert.ChatAgentResolvedVariable.to), { extensionId: '', agentId: h.request.agentId }));
238+
res.push(new extHostTypes.ChatAgentRequestTurn(h.request.message, h.request.command, h.request.variables.variables.map(typeConvert.ChatAgentResolvedVariable.to), { extensionId: '', agent: h.request.agentId, agentId: h.request.agentId }));
239239

240240
// RESPONSE turn
241241
const parts = coalesce(h.response.map(r => typeConvert.ChatResponsePart.from(r, this.commands.converter)));
242-
res.push(new extHostTypes.ChatAgentResponseTurn(parts, result, { extensionId: '', agentId: h.request.agentId }));
242+
res.push(new extHostTypes.ChatAgentResponseTurn(parts, result, { extensionId: '', agent: h.request.agentId, agentId: h.request.agentId }));
243243
}
244244

245245
return res;

src/vs/workbench/api/common/extHostTypes.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4257,28 +4257,21 @@ export class ChatResponseReferencePart {
42574257

42584258

42594259
export class ChatAgentRequestTurn implements vscode.ChatAgentRequestTurn {
4260-
agentId: string;
42614260
constructor(
42624261
readonly prompt: string,
42634262
readonly command: string | undefined,
42644263
readonly variables: vscode.ChatAgentResolvedVariable[],
4265-
readonly agent: { extensionId: string; agentId: string },
4266-
) {
4267-
this.agentId = agent.agentId;
4268-
}
4264+
readonly agent: { extensionId: string; agent: string; agentId: string },
4265+
) { }
42694266
}
42704267

42714268
export class ChatAgentResponseTurn implements vscode.ChatAgentResponseTurn {
42724269

4273-
agentId: string;
4274-
42754270
constructor(
42764271
readonly response: ReadonlyArray<ChatResponseTextPart | ChatResponseMarkdownPart | ChatResponseFileTreePart | ChatResponseAnchorPart | ChatResponseCommandButtonPart>,
42774272
readonly result: vscode.ChatAgentResult2,
4278-
readonly agent: { extensionId: string; agentId: string }
4279-
) {
4280-
this.agentId = agent.agentId;
4281-
}
4273+
readonly agent: { extensionId: string; agent: string; agentId: string }
4274+
) { }
42824275
}
42834276

42844277
export class LanguageModelSystemMessage {

src/vscode-dts/vscode.proposed.chatAgents2.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ declare module 'vscode' {
2222
* The ID of the chat agent to which this request was directed.
2323
*/
2424
// TODO@API NAME: agentId shouldbe agentName or just agent (because it is ChatAgent#name)
25-
readonly agent: { readonly extensionId: string; readonly agentId: string };
25+
readonly agent: { readonly extensionId: string; readonly agent: string; readonly agentId: string };
2626

2727
/**
2828
* The name of the {@link ChatAgentCommand command} that was selected for this request.
@@ -51,7 +51,7 @@ declare module 'vscode' {
5151
readonly result: ChatAgentResult2;
5252

5353
// TODO@API NAME: agentId shouldbe agentName or just agent (because it is ChatAgent#name)
54-
readonly agent: { readonly extensionId: string; readonly agentId: string };
54+
readonly agent: { readonly extensionId: string; readonly agent: string; readonly agentId: string };
5555

5656
private constructor(response: ReadonlyArray<ChatResponseTextPart | ChatResponseMarkdownPart | ChatResponseFileTreePart | ChatResponseAnchorPart | ChatResponseCommandButtonPart>, result: ChatAgentResult2, agentId: { extensionId: string; agentId: string });
5757
}

0 commit comments

Comments
 (0)