From ac06186ae14632e9c8fae9b60fc3f6e595d3f0bc Mon Sep 17 00:00:00 2001 From: Matt Bierner <12821956+mjbvz@users.noreply.github.com> Date: Tue, 20 Jan 2026 15:09:30 -0800 Subject: [PATCH] Add `sessionResource` to proposed apis For #274403 Replacing chatSessionId in a few API proposals. Keeping around the old fields for now until we can adopt this everywhere --- .../api/common/extHostLanguageModelTools.ts | 4 ++++ .../workbench/api/common/extHostTypeConverters.ts | 1 + .../chat/common/tools/languageModelToolsService.ts | 2 ++ .../vscode.proposed.chatParticipantAdditions.d.ts | 2 ++ .../vscode.proposed.chatParticipantPrivate.d.ts | 13 ++++++++++++- 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/api/common/extHostLanguageModelTools.ts b/src/vs/workbench/api/common/extHostLanguageModelTools.ts index f59cbb25ec5..9970d364349 100644 --- a/src/vs/workbench/api/common/extHostLanguageModelTools.ts +++ b/src/vs/workbench/api/common/extHostLanguageModelTools.ts @@ -20,6 +20,7 @@ import { Dto, SerializableObjectWithBuffers } from '../../services/extensions/co import { ExtHostLanguageModelToolsShape, IMainContext, IToolDataDto, MainContext, MainThreadLanguageModelToolsShape } from './extHost.protocol.js'; import { ExtHostLanguageModels } from './extHostLanguageModels.js'; import * as typeConvert from './extHostTypeConverters.js'; +import { URI } from '../../../base/common/uri.js'; class Tool { @@ -184,6 +185,7 @@ export class ExtHostLanguageModelTools implements ExtHostLanguageModelToolsShape options.chatRequestId = dto.chatRequestId; options.chatInteractionId = dto.chatInteractionId; options.chatSessionId = dto.context?.sessionId; + options.chatSessionResource = URI.revive(dto.context?.sessionResource); options.subAgentInvocationId = dto.subAgentInvocationId; } @@ -262,6 +264,7 @@ export class ExtHostLanguageModelTools implements ExtHostLanguageModelToolsShape rawInput: context.rawInput, chatRequestId: context.chatRequestId, chatSessionId: context.chatSessionId, + chatSessionResource: context.chatSessionResource, chatInteractionId: context.chatInteractionId }; @@ -285,6 +288,7 @@ export class ExtHostLanguageModelTools implements ExtHostLanguageModelToolsShape input: context.parameters, chatRequestId: context.chatRequestId, chatSessionId: context.chatSessionId, + chatSessionResource: context.chatSessionResource, chatInteractionId: context.chatInteractionId }; if (item.tool.prepareInvocation) { diff --git a/src/vs/workbench/api/common/extHostTypeConverters.ts b/src/vs/workbench/api/common/extHostTypeConverters.ts index 0ef0f0979e2..b49df82b3bb 100644 --- a/src/vs/workbench/api/common/extHostTypeConverters.ts +++ b/src/vs/workbench/api/common/extHostTypeConverters.ts @@ -3148,6 +3148,7 @@ export namespace ChatAgentRequest { enableCommandDetection: request.enableCommandDetection ?? true, isParticipantDetected: request.isParticipantDetected ?? false, sessionId, + sessionResource: request.sessionResource, references: variableReferences .map(v => ChatPromptReference.to(v, diagnostics, logService)) .filter(isDefined), diff --git a/src/vs/workbench/contrib/chat/common/tools/languageModelToolsService.ts b/src/vs/workbench/contrib/chat/common/tools/languageModelToolsService.ts index a153f3b8425..f1fc3f1d8ef 100644 --- a/src/vs/workbench/contrib/chat/common/tools/languageModelToolsService.ts +++ b/src/vs/workbench/contrib/chat/common/tools/languageModelToolsService.ts @@ -294,7 +294,9 @@ export interface IToolInvocationStreamContext { toolCallId: string; rawInput: unknown; chatRequestId?: string; + /** @deprecated Use {@link chatSessionResource} instead */ chatSessionId?: string; + chatSessionResource?: URI; chatInteractionId?: string; } diff --git a/src/vscode-dts/vscode.proposed.chatParticipantAdditions.d.ts b/src/vscode-dts/vscode.proposed.chatParticipantAdditions.d.ts index 83235b8fea7..6dbf88c6895 100644 --- a/src/vscode-dts/vscode.proposed.chatParticipantAdditions.d.ts +++ b/src/vscode-dts/vscode.proposed.chatParticipantAdditions.d.ts @@ -695,7 +695,9 @@ declare module 'vscode' { readonly rawInput?: unknown; readonly chatRequestId?: string; + /** @deprecated Use {@link chatSessionResource} instead */ readonly chatSessionId?: string; + readonly chatSessionResource?: Uri; readonly chatInteractionId?: string; } diff --git a/src/vscode-dts/vscode.proposed.chatParticipantPrivate.d.ts b/src/vscode-dts/vscode.proposed.chatParticipantPrivate.d.ts index 4196e31d903..4ab722c122e 100644 --- a/src/vscode-dts/vscode.proposed.chatParticipantPrivate.d.ts +++ b/src/vscode-dts/vscode.proposed.chatParticipantPrivate.d.ts @@ -61,10 +61,17 @@ declare module 'vscode' { readonly attempt: number; /** - * The session identifier for this chat request + * The session identifier for this chat request. + * + * @deprecated Use {@link chatSessionResource} instead. */ readonly sessionId: string; + /** + * The resource URI for the chat session this request belongs to. + */ + readonly sessionResource: Uri; + /** * If automatic command detection is enabled. */ @@ -239,7 +246,9 @@ declare module 'vscode' { export interface LanguageModelToolInvocationOptions { chatRequestId?: string; + /** @deprecated Use {@link chatSessionResource} instead */ chatSessionId?: string; + chatSessionResource?: Uri; chatInteractionId?: string; terminalCommand?: string; /** @@ -254,7 +263,9 @@ declare module 'vscode' { */ input: T; chatRequestId?: string; + /** @deprecated Use {@link chatSessionResource} instead */ chatSessionId?: string; + chatSessionResource?: Uri; chatInteractionId?: string; }