Skip to content

Commit 78a1609

Browse files
authored
Coding Agent followup (microsoft#253100)
* add followUpRegex * look at responses
1 parent 25a8dd4 commit 78a1609

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,7 @@ export class CreateRemoteAgentJobAction extends Action2 {
574574
}
575575

576576
let summary: string | undefined;
577+
let followup: string | undefined;
577578
if (defaultAgent && chatRequests.length > 0) {
578579
chatModel.acceptResponseProgress(addedRequest, {
579580
kind: 'progressMessage',
@@ -583,6 +584,15 @@ export class CreateRemoteAgentJobAction extends Action2 {
583584
)
584585
});
585586

587+
// Forward useful metadata about conversation to the implementing extension
588+
if (agent.followUpRegex) {
589+
const regex = new RegExp(agent.followUpRegex);
590+
followup = chatRequests
591+
.map(req => req.response?.response.toString() ?? '')
592+
.reverse()
593+
.find(text => regex.test(text));
594+
}
595+
586596
const historyEntries: IChatAgentHistoryEntry[] = chatRequests
587597
.map(req => ({
588598
request: {
@@ -614,7 +624,8 @@ export class CreateRemoteAgentJobAction extends Action2 {
614624
// Execute the remote command
615625
const resultMarkdown: string | undefined = await commandService.executeCommand(agent.command, {
616626
userPrompt,
617-
summary: summary || userPrompt
627+
summary: summary || userPrompt,
628+
followup,
618629
});
619630

620631
let content = new MarkdownString(

src/vs/workbench/contrib/remoteCodingAgents/browser/remoteCodingAgents.contribution.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ interface IRemoteCodingAgentExtensionPoint {
1919
command: string;
2020
displayName: string;
2121
description?: string;
22+
followUpRegex?: string;
2223
when?: string;
2324
}
2425

@@ -46,6 +47,10 @@ const extensionPoint = ExtensionsRegistry.registerExtensionPoint<IRemoteCodingAg
4647
description: localize('remoteCodingAgentsExtPoint.description', 'Description of the remote agent for use in menus and tooltips.'),
4748
type: 'string'
4849
},
50+
followUpRegex: {
51+
description: localize('remoteCodingAgentsExtPoint.followUpRegex', 'The last occurrence of pattern in an existing chat conversation is sent to the contributing extension to facilitate follow-up responses.'),
52+
type: 'string',
53+
},
4954
when: {
5055
description: localize('remoteCodingAgentsExtPoint.when', 'Condition which must be true to show this item.'),
5156
type: 'string'
@@ -81,6 +86,7 @@ export class RemoteCodingAgentsContribution extends Disposable implements IWorkb
8186
command: contribution.command,
8287
displayName: contribution.displayName,
8388
description: contribution.description,
89+
followUpRegex: contribution.followUpRegex,
8490
when: contribution.when
8591
};
8692
this.logService.info(`Registering remote coding agent: ${agent.displayName} (${agent.command})`);

src/vs/workbench/contrib/remoteCodingAgents/common/remoteCodingAgentsService.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export interface IRemoteCodingAgent {
1515
command: string;
1616
displayName: string;
1717
description?: string;
18+
followUpRegex?: string;
1819
when?: string;
1920
}
2021

0 commit comments

Comments
 (0)