From dfba89f60236d7d36bde621674c9f975e1c3331b Mon Sep 17 00:00:00 2001 From: Matt Bierner <12821956+mjbvz@users.noreply.github.com> Date: Wed, 7 Jan 2026 09:32:04 -0800 Subject: [PATCH] Remove `provideNewChatSessionItem` Fixes #282763 --- .../workbench/api/common/extHost.protocol.ts | 1 - .../api/common/extHostChatSessions.ts | 36 ------------------- .../browser/mainThreadChatSessions.test.ts | 6 +--- .../vscode.proposed.chatSessionsProvider.d.ts | 20 ----------- 4 files changed, 1 insertion(+), 62 deletions(-) diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 4a46bbaa532..fa015c3f912 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -3332,7 +3332,6 @@ export interface MainThreadChatSessionsShape extends IDisposable { export interface ExtHostChatSessionsShape { $provideChatSessionItems(providerHandle: number, token: CancellationToken): Promise[]>; - $provideNewChatSessionItem(providerHandle: number, options: { request: IChatAgentRequest; metadata?: any }, token: CancellationToken): Promise>; $provideChatSessionContent(providerHandle: number, sessionResource: UriComponents, token: CancellationToken): Promise; $interruptChatSessionActiveResponse(providerHandle: number, sessionResource: UriComponents, requestId: string): Promise; diff --git a/src/vs/workbench/api/common/extHostChatSessions.ts b/src/vs/workbench/api/common/extHostChatSessions.ts index 54c6ba4248d..260627104c1 100644 --- a/src/vs/workbench/api/common/extHostChatSessions.ts +++ b/src/vs/workbench/api/common/extHostChatSessions.ts @@ -9,7 +9,6 @@ import { CancellationToken, CancellationTokenSource } from '../../../base/common import { CancellationError } from '../../../base/common/errors.js'; import { Disposable, DisposableStore } from '../../../base/common/lifecycle.js'; import { ResourceMap } from '../../../base/common/map.js'; -import { revive } from '../../../base/common/marshalling.js'; import { MarshalledId } from '../../../base/common/marshallingIds.js'; import { URI, UriComponents } from '../../../base/common/uri.js'; import { IExtensionDescription } from '../../../platform/extensions/common/extensions.js'; @@ -204,41 +203,6 @@ export class ExtHostChatSessions extends Disposable implements ExtHostChatSessio }; } - async $provideNewChatSessionItem(handle: number, options: { request: IChatAgentRequest; metadata?: any }, token: CancellationToken): Promise { - const entry = this._chatSessionItemProviders.get(handle); - if (!entry || !entry.provider.provideNewChatSessionItem) { - throw new Error(`No provider registered for handle ${handle} or provider does not support creating sessions`); - } - - try { - const model = await this.getModelForRequest(options.request, entry.extension); - const vscodeRequest = typeConvert.ChatAgentRequest.to( - revive(options.request), - undefined, - model, - [], - new Map(), - entry.extension, - this._logService); - - const vscodeOptions = { - request: vscodeRequest, - metadata: options.metadata - }; - - const chatSessionItem = await entry.provider.provideNewChatSessionItem(vscodeOptions, token); - if (!chatSessionItem) { - throw new Error('Provider did not create session'); - } - - this._sessionItems.set(chatSessionItem.resource, chatSessionItem); - return this.convertChatSessionItem(entry.sessionType, chatSessionItem); - } catch (error) { - this._logService.error(`Error creating chat session: ${error}`); - throw error; - } - } - async $provideChatSessionItems(handle: number, token: vscode.CancellationToken): Promise { const entry = this._chatSessionItemProviders.get(handle); if (!entry) { diff --git a/src/vs/workbench/api/test/browser/mainThreadChatSessions.test.ts b/src/vs/workbench/api/test/browser/mainThreadChatSessions.test.ts index 90c8acb7583..e3e315bcb7e 100644 --- a/src/vs/workbench/api/test/browser/mainThreadChatSessions.test.ts +++ b/src/vs/workbench/api/test/browser/mainThreadChatSessions.test.ts @@ -19,7 +19,7 @@ import { ILogService, NullLogService } from '../../../../platform/log/common/log import { ChatSessionsService } from '../../../contrib/chat/browser/chatSessions/chatSessions.contribution.js'; import { IChatAgentRequest } from '../../../contrib/chat/common/participants/chatAgents.js'; import { IChatProgress, IChatProgressMessage, IChatService } from '../../../contrib/chat/common/chatService/chatService.js'; -import { IChatSessionItem, IChatSessionProviderOptionGroup, IChatSessionsService } from '../../../contrib/chat/common/chatSessionsService.js'; +import { IChatSessionProviderOptionGroup, IChatSessionsService } from '../../../contrib/chat/common/chatSessionsService.js'; import { LocalChatSessionUri } from '../../../contrib/chat/common/model/chatUri.js'; import { ChatAgentLocation } from '../../../contrib/chat/common/constants.js'; import { IEditorService } from '../../../services/editor/common/editorService.js'; @@ -57,7 +57,6 @@ suite('ObservableChatSession', function () { $invokeChatSessionRequestHandler: sinon.stub(), $disposeChatSessionContent: sinon.stub(), $provideChatSessionItems: sinon.stub(), - $provideNewChatSessionItem: sinon.stub().resolves({ label: 'New Session' } as IChatSessionItem) }; }); @@ -341,8 +340,6 @@ suite('MainThreadChatSessions', function () { let chatSessionsService: IChatSessionsService; let disposables: DisposableStore; - const exampleSessionResource = LocalChatSessionUri.forSession('new-session-id'); - setup(function () { disposables = new DisposableStore(); instantiationService = new TestInstantiationService(); @@ -355,7 +352,6 @@ suite('MainThreadChatSessions', function () { $invokeChatSessionRequestHandler: sinon.stub(), $disposeChatSessionContent: sinon.stub(), $provideChatSessionItems: sinon.stub(), - $provideNewChatSessionItem: sinon.stub().resolves({ resource: exampleSessionResource, label: 'New Session' } as IChatSessionItem) }; const extHostContext = new class implements IExtHostContext { diff --git a/src/vscode-dts/vscode.proposed.chatSessionsProvider.d.ts b/src/vscode-dts/vscode.proposed.chatSessionsProvider.d.ts index a90c9ecde7c..2ec68c1731e 100644 --- a/src/vscode-dts/vscode.proposed.chatSessionsProvider.d.ts +++ b/src/vscode-dts/vscode.proposed.chatSessionsProvider.d.ts @@ -49,26 +49,6 @@ declare module 'vscode' { */ readonly onDidCommitChatSessionItem: Event<{ original: ChatSessionItem /** untitled */; modified: ChatSessionItem /** newly created */ }>; - /** - * DEPRECATED: Will be removed! - * Creates a new chat session. - * - * @param options Options for the new session including an optional initial prompt and history - * @param token A cancellation token - * @returns Metadata for the chat session - */ - provideNewChatSessionItem?(options: { - /** - * The chat request that initiated the session creation - */ - readonly request: ChatRequest; - - /** - * Additional metadata to use for session creation - */ - metadata?: any; - }, token: CancellationToken): ProviderResult; - // #endregion }