Merge pull request #286399 from mjbvz/dev/mjbvz/sensible-wildebeest

Remove `provideNewChatSessionItem`
This commit is contained in:
Matt Bierner
2026-01-07 10:03:22 -08:00
committed by GitHub
4 changed files with 1 additions and 62 deletions

View File

@@ -3332,7 +3332,6 @@ export interface MainThreadChatSessionsShape extends IDisposable {
export interface ExtHostChatSessionsShape {
$provideChatSessionItems(providerHandle: number, token: CancellationToken): Promise<Dto<IChatSessionItem>[]>;
$provideNewChatSessionItem(providerHandle: number, options: { request: IChatAgentRequest; metadata?: any }, token: CancellationToken): Promise<Dto<IChatSessionItem>>;
$provideChatSessionContent(providerHandle: number, sessionResource: UriComponents, token: CancellationToken): Promise<ChatSessionDto>;
$interruptChatSessionActiveResponse(providerHandle: number, sessionResource: UriComponents, requestId: string): Promise<void>;

View File

@@ -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<IChatSessionItem> {
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<IChatSessionItem[]> {
const entry = this._chatSessionItemProviders.get(handle);
if (!entry) {

View File

@@ -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 {

View File

@@ -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<ChatSessionItem>;
// #endregion
}