From 1c4df3b0f4019987ac956d6b2b800f08da3fcddc Mon Sep 17 00:00:00 2001 From: Johannes Date: Thu, 14 Nov 2024 17:34:35 +0100 Subject: [PATCH] share full history results between agents of the same extension fyi @roblourens --- src/vs/workbench/api/common/extHostChatAgents2.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/api/common/extHostChatAgents2.ts b/src/vs/workbench/api/common/extHostChatAgents2.ts index 108de1f9cf4..14c1e0e027d 100644 --- a/src/vs/workbench/api/common/extHostChatAgents2.ts +++ b/src/vs/workbench/api/common/extHostChatAgents2.ts @@ -515,9 +515,10 @@ export class ExtHostChatAgents2 extends Disposable implements ExtHostChatAgentsS for (const h of context.history) { const ehResult = typeConvert.ChatAgentResult.to(h.result); - const result: vscode.ChatResult = agentId === h.request.agentId ? - ehResult : - { ...ehResult, metadata: undefined }; + // get full result when agent is the same or agent is from the same extension + const result: vscode.ChatResult = agentId === h.request.agentId || ExtensionIdentifier.equals(this.getChatAgentById(agentId)?.extension.identifier, this.getChatAgentById(h.request.agentId)?.extension.identifier) + ? ehResult + : { ...ehResult, metadata: undefined }; // REQUEST turn const varsWithoutTools = h.request.variables.variables @@ -537,6 +538,10 @@ export class ExtHostChatAgents2 extends Disposable implements ExtHostChatAgentsS return res; } + private getChatAgentById(id: string) { + return Iterable.find(this._agents.values(), a => a.id === id); + } + $releaseSession(sessionId: string): void { this._sessionDisposables.deleteAndDispose(sessionId); }