diff --git a/src/vs/workbench/api/browser/mainThreadChatAgents2.ts b/src/vs/workbench/api/browser/mainThreadChatAgents2.ts index 57f98dd25bf..385f5ac4e93 100644 --- a/src/vs/workbench/api/browser/mainThreadChatAgents2.ts +++ b/src/vs/workbench/api/browser/mainThreadChatAgents2.ts @@ -18,7 +18,7 @@ import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeat import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { ILogService } from 'vs/platform/log/common/log'; -import { ExtHostChatAgentsShape2, ExtHostContext, IChatProgressDto, IExtensionChatAgentMetadata, MainContext, MainThreadChatAgentsShape2 } from 'vs/workbench/api/common/extHost.protocol'; +import { ExtHostChatAgentsShape2, ExtHostContext, IChatProgressDto, IDynamicChatAgentProps, IExtensionChatAgentMetadata, MainContext, MainThreadChatAgentsShape2 } from 'vs/workbench/api/common/extHost.protocol'; import { IChatWidgetService } from 'vs/workbench/contrib/chat/browser/chat'; import { ChatInputPart } from 'vs/workbench/contrib/chat/browser/chatInputPart'; import { AddDynamicVariableAction, IAddDynamicVariableContext } from 'vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables'; @@ -96,7 +96,7 @@ export class MainThreadChatAgents2 extends Disposable implements MainThreadChatA this._chatService.transferChatSession({ sessionId, inputValue }, URI.revive(toWorkspace)); } - $registerAgent(handle: number, extension: ExtensionIdentifier, id: string, metadata: IExtensionChatAgentMetadata, dynamicProps: { name: string; description: string; publisherDisplayName: string } | undefined): void { + $registerAgent(handle: number, extension: ExtensionIdentifier, id: string, metadata: IExtensionChatAgentMetadata, dynamicProps: IDynamicChatAgentProps | undefined): void { const staticAgentRegistration = this._chatAgentService.getAgent(id); if (!staticAgentRegistration && !dynamicProps) { if (this._chatAgentService.getAgentsByName(id).length) { @@ -143,7 +143,8 @@ export class MainThreadChatAgents2 extends Disposable implements MainThreadChatA extensionId: extension, extensionDisplayName: extensionDescription?.displayName ?? extension.value, extensionPublisherId: extensionDescription?.publisher ?? '', - publisherDisplayName: dynamicProps.publisherDisplayName, + publisherDisplayName: dynamicProps.publisherName, + fullName: dynamicProps.fullName, metadata: revive(metadata), slashCommands: [], locations: [ChatAgentLocation.Panel] // TODO all dynamic participants are panel only? diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index 0a622e4d95a..186d496596b 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -1420,9 +1420,9 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I checkProposedApiEnabled(extension, 'chatParticipant'); return extHostChatAgents2.createChatAgent(extension, id, handler); }, - createDynamicChatParticipant(id: string, name: string, publisherName: string, description: string, handler: vscode.ChatExtendedRequestHandler): vscode.ChatParticipant { + createDynamicChatParticipant(id: string, dynamicProps: vscode.DynamicChatParticipantProps, handler: vscode.ChatExtendedRequestHandler): vscode.ChatParticipant { checkProposedApiEnabled(extension, 'chatParticipantAdditions'); - return extHostChatAgents2.createDynamicChatAgent(extension, id, name, publisherName, description, handler); + return extHostChatAgents2.createDynamicChatAgent(extension, id, dynamicProps, handler); } }; diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 190e7c4b45e..a8750532975 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -1232,8 +1232,15 @@ export interface IExtensionChatAgentMetadata extends Dto { hasFollowups?: boolean; } +export interface IDynamicChatAgentProps { + name: string; + publisherName: string; + description?: string; + fullName?: string; +} + export interface MainThreadChatAgentsShape2 extends IDisposable { - $registerAgent(handle: number, extension: ExtensionIdentifier, id: string, metadata: IExtensionChatAgentMetadata, dynamicProps: { name: string; description: string; publisherDisplayName: string } | undefined): void; + $registerAgent(handle: number, extension: ExtensionIdentifier, id: string, metadata: IExtensionChatAgentMetadata, dynamicProps: IDynamicChatAgentProps | undefined): void; $registerAgentCompletionsProvider(handle: number, triggerCharacters: string[]): void; $unregisterAgentCompletionsProvider(handle: number): void; $updateAgent(handle: number, metadataUpdate: IExtensionChatAgentMetadata): void; diff --git a/src/vs/workbench/api/common/extHostChatAgents2.ts b/src/vs/workbench/api/common/extHostChatAgents2.ts index 78a4076d962..11fcd8875c6 100644 --- a/src/vs/workbench/api/common/extHostChatAgents2.ts +++ b/src/vs/workbench/api/common/extHostChatAgents2.ts @@ -258,12 +258,12 @@ export class ExtHostChatAgents2 extends Disposable implements ExtHostChatAgentsS return agent.apiAgent; } - createDynamicChatAgent(extension: IExtensionDescription, id: string, name: string, publisherName: string, description: string, handler: vscode.ChatExtendedRequestHandler): vscode.ChatParticipant { + createDynamicChatAgent(extension: IExtensionDescription, id: string, dynamicProps: vscode.DynamicChatParticipantProps, handler: vscode.ChatExtendedRequestHandler): vscode.ChatParticipant { const handle = ExtHostChatAgents2._idPool++; const agent = new ExtHostChatAgent(extension, id, this._proxy, handle, handler); this._agents.set(handle, agent); - this._proxy.$registerAgent(handle, extension.identifier, id, { isSticky: true } satisfies IExtensionChatAgentMetadata, { name, description, publisherDisplayName: publisherName }); + this._proxy.$registerAgent(handle, extension.identifier, id, { isSticky: true } satisfies IExtensionChatAgentMetadata, dynamicProps); return agent.apiAgent; } @@ -439,7 +439,6 @@ export class ExtHostChatAgents2 extends Disposable implements ExtHostChatAgentsS class ExtHostChatAgent { private _followupProvider: vscode.ChatFollowupProvider | undefined; - private _fullName: string | undefined; private _iconPath: vscode.Uri | { light: vscode.Uri; dark: vscode.Uri } | vscode.ThemeIcon | undefined; private _isDefault: boolean | undefined; private _helpTextPrefix: string | vscode.MarkdownString | undefined; @@ -535,7 +534,6 @@ class ExtHostChatAgent { updateScheduled = true; queueMicrotask(() => { this._proxy.$updateAgent(this._handle, { - fullName: this._fullName, icon: !this._iconPath ? undefined : this._iconPath instanceof URI ? this._iconPath : 'light' in this._iconPath ? this._iconPath.light : @@ -561,15 +559,6 @@ class ExtHostChatAgent { get id() { return that.id; }, - get fullName() { - checkProposedApiEnabled(that.extension, 'defaultChatParticipant'); - return that._fullName ?? that.extension.displayName ?? that.extension.name; - }, - set fullName(v) { - checkProposedApiEnabled(that.extension, 'defaultChatParticipant'); - that._fullName = v; - updateMetadataSoon(); - }, get iconPath() { return that._iconPath; }, diff --git a/src/vs/workbench/contrib/chat/browser/chatListRenderer.ts b/src/vs/workbench/contrib/chat/browser/chatListRenderer.ts index ca31e35b677..e4d158b307f 100644 --- a/src/vs/workbench/contrib/chat/browser/chatListRenderer.ts +++ b/src/vs/workbench/contrib/chat/browser/chatListRenderer.ts @@ -16,7 +16,6 @@ import { ICompressibleTreeRenderer } from 'vs/base/browser/ui/tree/objectTree'; import { IAsyncDataSource, ITreeNode, ITreeRenderer } from 'vs/base/browser/ui/tree/tree'; import { IAction } from 'vs/base/common/actions'; import { distinct } from 'vs/base/common/arrays'; -import { disposableTimeout } from 'vs/base/common/async'; import { CancellationTokenSource } from 'vs/base/common/cancellation'; import { Codicon } from 'vs/base/common/codicons'; import { Emitter, Event } from 'vs/base/common/event'; @@ -26,12 +25,11 @@ import { Disposable, DisposableStore, IDisposable, toDisposable } from 'vs/base/ import { ResourceMap } from 'vs/base/common/map'; import { FileAccess, Schemas, matchesSomeScheme } from 'vs/base/common/network'; import { clamp } from 'vs/base/common/numbers'; -import { IObservable, autorun, constObservable } from 'vs/base/common/observable'; +import { autorun } from 'vs/base/common/observable'; import { basename } from 'vs/base/common/path'; import { basenameOrAuthority } from 'vs/base/common/resources'; import { equalsIgnoreCase } from 'vs/base/common/strings'; import { ThemeIcon } from 'vs/base/common/themables'; -import { isUndefined } from 'vs/base/common/types'; import { URI } from 'vs/base/common/uri'; import { generateUuid } from 'vs/base/common/uuid'; import { IMarkdownRenderResult, MarkdownRenderer } from 'vs/editor/browser/widget/markdownRenderer/browser/markdownRenderer'; @@ -66,10 +64,10 @@ import { ChatFollowups } from 'vs/workbench/contrib/chat/browser/chatFollowups'; import { ChatMarkdownDecorationsRenderer } from 'vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer'; import { ChatEditorOptions } from 'vs/workbench/contrib/chat/browser/chatOptions'; import { ChatCodeBlockContentProvider, CodeBlockPart, CodeCompareBlockPart, ICodeBlockData, ICodeCompareBlockData, ICodeCompareBlockDiffData, localFileLanguageId, parseLocalFileData } from 'vs/workbench/contrib/chat/browser/codeBlockPart'; -import { ChatAgentLocation, IChatAgentMetadata, IChatAgentNameService } from 'vs/workbench/contrib/chat/common/chatAgents'; +import { ChatAgentLocation, IChatAgentMetadata } from 'vs/workbench/contrib/chat/common/chatAgents'; import { CONTEXT_CHAT_RESPONSE_SUPPORT_ISSUE_REPORTING, CONTEXT_REQUEST, CONTEXT_RESPONSE, CONTEXT_RESPONSE_DETECTED_AGENT_COMMAND, CONTEXT_RESPONSE_FILTERED, CONTEXT_RESPONSE_VOTE } from 'vs/workbench/contrib/chat/common/chatContextKeys'; import { IChatProgressRenderableResponseContent, IChatTextEditGroup } from 'vs/workbench/contrib/chat/common/chatModel'; -import { chatAgentLeader, chatSubcommandLeader } from 'vs/workbench/contrib/chat/common/chatParserTypes'; +import { chatSubcommandLeader } from 'vs/workbench/contrib/chat/common/chatParserTypes'; import { IChatCommandButton, IChatConfirmation, IChatContentReference, IChatFollowup, IChatProgressMessage, IChatResponseProgressFileTreeData, IChatSendRequestOptions, IChatService, IChatTask, IChatWarningMessage, InteractiveSessionVoteDirection } from 'vs/workbench/contrib/chat/common/chatService'; import { IChatVariablesService } from 'vs/workbench/contrib/chat/common/chatVariables'; import { IChatProgressMessageRenderData, IChatRenderData, IChatResponseMarkdownRenderData, IChatResponseViewModel, IChatTaskRenderData, IChatWelcomeMessageViewModel, isRequestVM, isResponseVM, isWelcomeVM } from 'vs/workbench/contrib/chat/common/chatViewModel'; @@ -88,7 +86,6 @@ interface IChatListItemTemplate { readonly rowContainer: HTMLElement; readonly titleToolbar?: MenuWorkbenchToolBar; readonly avatarContainer: HTMLElement; - readonly agentAvatarContainer: HTMLElement; readonly username: HTMLElement; readonly detail: HTMLElement; readonly value: HTMLElement; @@ -159,7 +156,6 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer = constObservable(undefined); - - if (element.agent && !element.agent.isDefault) { - const name = element.agent.name; - agentName = this.chatAgentNameService.getAgentNameRestriction(element.agent) - .map(allowed => allowed ? name : name); // TODO - } - templateData.elementDisposables.add(autorun(reader => { - this._renderDetail(element, agentName.read(reader), templateData); + this._renderDetail(element, templateData); })); } - private _renderDetail(element: IChatResponseViewModel, agentName: string | undefined, templateData: IChatListItemTemplate): void { + private _renderDetail(element: IChatResponseViewModel, templateData: IChatListItemTemplate): void { let progressMsg: string = ''; - if (!isUndefined(agentName)) { - let usingMsg = chatAgentLeader + agentName; - if (element.slashCommand) { - usingMsg += ` ${chatSubcommandLeader}${element.slashCommand.name}`; - } - + if (element.slashCommand && element.agentOrSlashCommandDetected) { + const usingMsg = `${chatSubcommandLeader}${element.slashCommand.name}`; if (element.isComplete) { progressMsg = localize('usedAgent', "used {0}", usingMsg); } else { progressMsg = localize('usingAgent', "using {0}", usingMsg); } - } else if (element.agentOrSlashCommandDetected) { - const usingMsg: string[] = []; - if (!isUndefined(agentName)) { - usingMsg.push(chatAgentLeader + agentName); - } - if (element.slashCommand) { - usingMsg.push(chatSubcommandLeader + element.slashCommand.name); - } - if (usingMsg.length) { - if (element.isComplete) { - progressMsg = localize('usedAgent', "used {0}", usingMsg.join(' ')); - } else { - progressMsg = localize('usingAgent', "using {0}", usingMsg.join(' ')); - } - } } else if (!element.isComplete) { progressMsg = GeneratingPhrase; } @@ -444,53 +412,28 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer('img.icon'); - avatarImgIcon.src = FileAccess.uriToBrowserUri(element.avatarIcon).toString(true); - templateData.avatarContainer.replaceChildren(dom.$('.avatar', undefined, avatarImgIcon)); + const icon = isResponseVM(element) ? + this.getAgentIcon(element.agent?.metadata) : + (element.avatarIcon ?? Codicon.account); + if (icon instanceof URI) { + const avatarIcon = dom.$('img.icon'); + avatarIcon.src = FileAccess.uriToBrowserUri(icon).toString(true); + templateData.avatarContainer.replaceChildren(dom.$('.avatar', undefined, avatarIcon)); } else { - const defaultIcon = isRequestVM(element) ? Codicon.account : Codicon.copilot; - const icon = element.avatarIcon ?? defaultIcon; const avatarIcon = dom.$(ThemeIcon.asCSSSelector(icon)); templateData.avatarContainer.replaceChildren(dom.$('.avatar.codicon-avatar', undefined, avatarIcon)); } - - if (isResponseVM(element) && element.agent && !element.agent.isDefault) { - dom.show(templateData.agentAvatarContainer); - const icon = this.getAgentIcon(element.agent.metadata); - if (icon instanceof URI) { - const avatarIcon = dom.$('img.icon'); - avatarIcon.src = FileAccess.uriToBrowserUri(icon).toString(true); - templateData.agentAvatarContainer.replaceChildren(dom.$('.avatar', undefined, avatarIcon)); - } else if (icon) { - const avatarIcon = dom.$(ThemeIcon.asCSSSelector(icon)); - templateData.agentAvatarContainer.replaceChildren(dom.$('.avatar.codicon-avatar', undefined, avatarIcon)); - } else { - dom.hide(templateData.agentAvatarContainer); - return; - } - - templateData.agentAvatarContainer.classList.toggle('complete', element.isComplete); - if (!element.agentAvatarHasBeenRendered && !element.isComplete) { - element.agentAvatarHasBeenRendered = true; - templateData.agentAvatarContainer.classList.remove('loading'); - templateData.elementDisposables.add(disposableTimeout(() => { - templateData.agentAvatarContainer.classList.toggle('loading', !element.isComplete); - }, 100)); - } else { - templateData.agentAvatarContainer.classList.toggle('loading', !element.isComplete); - } - } else { - dom.hide(templateData.agentAvatarContainer); - } } - private getAgentIcon(agent: IChatAgentMetadata): URI | ThemeIcon | undefined { - if (agent.themeIcon) { + private getAgentIcon(agent: IChatAgentMetadata | undefined): URI | ThemeIcon { + if (agent?.themeIcon) { return agent.themeIcon; + } else if (agent?.iconDark && this.themeService.getColorTheme().type === ColorScheme.DARK) { + return agent.iconDark; + } else if (agent?.icon) { + return agent.icon; } else { - return this.themeService.getColorTheme().type === ColorScheme.DARK && agent.iconDark ? agent.iconDark : - agent.icon; + return Codicon.copilot; } } diff --git a/src/vs/workbench/contrib/chat/browser/chatParticipantContributions.ts b/src/vs/workbench/contrib/chat/browser/chatParticipantContributions.ts index c50724ba6d1..f5132a7ab55 100644 --- a/src/vs/workbench/contrib/chat/browser/chatParticipantContributions.ts +++ b/src/vs/workbench/contrib/chat/browser/chatParticipantContributions.ts @@ -39,7 +39,12 @@ const chatParticipantExtensionPoint = extensionsRegistry.ExtensionsRegistry.regi type: 'string' }, name: { - description: localize('chatParticipantName', "User-facing display name for this chat participant. The user will use '@' with this name to invoke the participant."), + description: localize('chatParticipantName', "User-facing name for this chat participant. The user will use '@' with this name to invoke the participant."), + type: 'string', + pattern: '^[\w0-9_-]+$' + }, + fullName: { + markdownDescription: localize('chatParticipantFullName', "The full name of this chat participant, which is shown as the label for responses coming from this participant. If not provided, {0} is used.", '`name`'), type: 'string' }, description: { @@ -216,6 +221,7 @@ export class ChatExtensionPointHandler implements IWorkbenchContribution { sampleRequest: providerDescriptor.sampleRequest, }, name: providerDescriptor.name, + fullName: providerDescriptor.fullName, isDefault: providerDescriptor.isDefault, defaultImplicitVariables: providerDescriptor.defaultImplicitVariables, locations: isNonEmptyArray(providerDescriptor.locations) ? diff --git a/src/vs/workbench/contrib/chat/browser/media/chat.css b/src/vs/workbench/contrib/chat/browser/media/chat.css index 15de8a3352b..b6c75bca71e 100644 --- a/src/vs/workbench/contrib/chat/browser/media/chat.css +++ b/src/vs/workbench/contrib/chat/browser/media/chat.css @@ -124,23 +124,6 @@ font-size: 14px; } -.interactive-item-container .header .agent-avatar-container { - margin-left: -30px; - transition: margin 0.15s ease-out; - transition-delay: 0.5s; - z-index: -1; -} - -.interactive-item-container .header .agent-avatar-container.loading { - margin-left: 0px; - z-index: 1; -} - -.interactive-item-container .header .agent-avatar-container.complete { - margin-left: -12px; - z-index: 1; -} - .monaco-list-row:not(.focused) .interactive-item-container:not(:hover) .header .monaco-toolbar, .monaco-list:not(:focus-within) .monaco-list-row .interactive-item-container:not(:hover) .header .monaco-toolbar, .monaco-list-row:not(.focused) .interactive-item-container:not(:hover) .header .monaco-toolbar .action-label, diff --git a/src/vs/workbench/contrib/chat/common/chatAgents.ts b/src/vs/workbench/contrib/chat/common/chatAgents.ts index 9bf43b3db5c..2fd60cfb727 100644 --- a/src/vs/workbench/contrib/chat/common/chatAgents.ts +++ b/src/vs/workbench/contrib/chat/common/chatAgents.ts @@ -57,6 +57,7 @@ export namespace ChatAgentLocation { export interface IChatAgentData { id: string; name: string; + fullName?: string; description?: string; extensionId: ExtensionIdentifier; extensionPublisherId: string; @@ -100,7 +101,6 @@ export interface IChatAgentMetadata { helpTextVariablesPrefix?: string | IMarkdownString; helpTextPostfix?: string | IMarkdownString; isSecondary?: boolean; // Invoked by ctrl/cmd+enter - fullName?: string; icon?: URI; iconDark?: URI; themeIcon?: ThemeIcon; diff --git a/src/vs/workbench/contrib/chat/common/chatModel.ts b/src/vs/workbench/contrib/chat/common/chatModel.ts index 31fb8e81f3f..d4649b0acd7 100644 --- a/src/vs/workbench/contrib/chat/common/chatModel.ts +++ b/src/vs/workbench/contrib/chat/common/chatModel.ts @@ -580,7 +580,7 @@ export class ChatModel extends Disposable implements IChatModel { get responderUsername(): string { return (this._defaultAgent ? - this._defaultAgent.metadata.fullName : + this._defaultAgent.fullName : this.initialData?.responderUsername) ?? ''; } @@ -956,7 +956,7 @@ export class ChatWelcomeMessageModel implements IChatWelcomeMessageModel { } public get username(): string { - return this.chatAgentService.getDefaultAgent(ChatAgentLocation.Panel)?.metadata.fullName ?? ''; + return this.chatAgentService.getDefaultAgent(ChatAgentLocation.Panel)?.fullName ?? ''; } public get avatarIcon(): ThemeIcon | undefined { diff --git a/src/vs/workbench/contrib/chat/common/chatParticipantContribTypes.ts b/src/vs/workbench/contrib/chat/common/chatParticipantContribTypes.ts index 4c4449bbaf9..e6d695c3824 100644 --- a/src/vs/workbench/contrib/chat/common/chatParticipantContribTypes.ts +++ b/src/vs/workbench/contrib/chat/common/chatParticipantContribTypes.ts @@ -17,6 +17,7 @@ export type RawChatParticipantLocation = 'panel' | 'terminal' | 'notebook'; export interface IRawChatParticipantContribution { id: string; name: string; + fullName: string; description?: string; isDefault?: boolean; isSticky?: boolean; diff --git a/src/vs/workbench/contrib/chat/common/chatViewModel.ts b/src/vs/workbench/contrib/chat/common/chatViewModel.ts index 3f34f8f239d..96b4ef6d464 100644 --- a/src/vs/workbench/contrib/chat/common/chatViewModel.ts +++ b/src/vs/workbench/contrib/chat/common/chatViewModel.ts @@ -137,7 +137,6 @@ export interface IChatResponseViewModel { readonly result?: IChatAgentResult; readonly contentUpdateTimings?: IChatLiveUpdateData; renderData?: IChatResponseRenderData; - agentAvatarHasBeenRendered?: boolean; currentRenderedHeight: number | undefined; setVote(vote: InteractiveSessionVoteDirection): void; usedReferencesExpanded?: boolean; @@ -375,7 +374,9 @@ export class ChatResponseViewModel extends Disposable implements IChatResponseVi } get username() { - return this._model.username; + return this.agent ? + (this.agent.fullName || this.agent.name) : + this._model.username; } get avatarIcon() { @@ -443,7 +444,6 @@ export class ChatResponseViewModel extends Disposable implements IChatResponseVi } renderData: IChatResponseRenderData | undefined = undefined; - agentAvatarHasBeenRendered?: boolean; currentRenderedHeight: number | undefined; private _usedReferencesExpanded: boolean | undefined; diff --git a/src/vs/workbench/contrib/chat/test/common/__snapshots__/ChatService_can_deserialize.0.snap b/src/vs/workbench/contrib/chat/test/common/__snapshots__/ChatService_can_deserialize.0.snap index 83ff5c45284..383288306cb 100644 --- a/src/vs/workbench/contrib/chat/test/common/__snapshots__/ChatService_can_deserialize.0.snap +++ b/src/vs/workbench/contrib/chat/test/common/__snapshots__/ChatService_can_deserialize.0.snap @@ -1,7 +1,7 @@ { requesterUsername: "test", requesterAvatarIconUri: undefined, - responderUsername: "test", + responderUsername: "", responderAvatarIconUri: undefined, initialLocation: "panel", welcomeMessage: undefined, diff --git a/src/vs/workbench/contrib/chat/test/common/__snapshots__/ChatService_can_serialize.0.snap b/src/vs/workbench/contrib/chat/test/common/__snapshots__/ChatService_can_serialize.0.snap index 75fe21b2b15..a0e87754398 100644 --- a/src/vs/workbench/contrib/chat/test/common/__snapshots__/ChatService_can_serialize.0.snap +++ b/src/vs/workbench/contrib/chat/test/common/__snapshots__/ChatService_can_serialize.0.snap @@ -1,7 +1,7 @@ { requesterUsername: "test", requesterAvatarIconUri: undefined, - responderUsername: "test", + responderUsername: "", responderAvatarIconUri: undefined, initialLocation: "panel", welcomeMessage: undefined, diff --git a/src/vs/workbench/contrib/chat/test/common/__snapshots__/ChatService_can_serialize.1.snap b/src/vs/workbench/contrib/chat/test/common/__snapshots__/ChatService_can_serialize.1.snap index c4e365a2a54..cf9cc42dfc6 100644 --- a/src/vs/workbench/contrib/chat/test/common/__snapshots__/ChatService_can_serialize.1.snap +++ b/src/vs/workbench/contrib/chat/test/common/__snapshots__/ChatService_can_serialize.1.snap @@ -1,7 +1,7 @@ { requesterUsername: "test", requesterAvatarIconUri: undefined, - responderUsername: "test", + responderUsername: "", responderAvatarIconUri: undefined, initialLocation: "panel", welcomeMessage: undefined, @@ -31,10 +31,7 @@ publisherDisplayName: "", extensionDisplayName: "", locations: [ "panel" ], - metadata: { - requester: { name: "test" }, - fullName: "test" - }, + metadata: { requester: { name: "test" } }, slashCommands: [ ] }, kind: "agent" @@ -73,10 +70,7 @@ publisherDisplayName: "", extensionDisplayName: "", locations: [ "panel" ], - metadata: { - requester: { name: "test" }, - fullName: "test" - }, + metadata: { requester: { name: "test" } }, slashCommands: [ ] }, slashCommand: undefined, diff --git a/src/vs/workbench/contrib/chat/test/common/chatService.test.ts b/src/vs/workbench/contrib/chat/test/common/chatService.test.ts index bcca1f9bc98..513f786bb59 100644 --- a/src/vs/workbench/contrib/chat/test/common/chatService.test.ts +++ b/src/vs/workbench/contrib/chat/test/common/chatService.test.ts @@ -95,7 +95,7 @@ suite('ChatService', () => { testDisposables.add(chatAgentService.registerAgent('testAgent', { name: 'testAgent', id: 'testAgent', isDefault: true, extensionId: nullExtensionDescription.identifier, extensionPublisherId: '', publisherDisplayName: '', extensionDisplayName: '', locations: [ChatAgentLocation.Panel], metadata: {}, slashCommands: [] })); testDisposables.add(chatAgentService.registerAgent(chatAgentWithUsedContextId, { name: chatAgentWithUsedContextId, id: chatAgentWithUsedContextId, extensionId: nullExtensionDescription.identifier, extensionPublisherId: '', publisherDisplayName: '', extensionDisplayName: '', locations: [ChatAgentLocation.Panel], metadata: {}, slashCommands: [] })); testDisposables.add(chatAgentService.registerAgentImplementation('testAgent', agent)); - chatAgentService.updateAgent('testAgent', { requester: { name: 'test' }, fullName: 'test' }); + chatAgentService.updateAgent('testAgent', { requester: { name: 'test' } }); }); test('retrieveSession', async () => { @@ -132,7 +132,7 @@ suite('ChatService', () => { test('can serialize', async () => { testDisposables.add(chatAgentService.registerAgentImplementation(chatAgentWithUsedContextId, chatAgentWithUsedContext)); - chatAgentService.updateAgent(chatAgentWithUsedContextId, { requester: { name: 'test' }, fullName: 'test' }); + chatAgentService.updateAgent(chatAgentWithUsedContextId, { requester: { name: 'test' } }); const testService = testDisposables.add(instantiationService.createInstance(ChatService)); const model = testDisposables.add(testService.startSession(ChatAgentLocation.Panel, CancellationToken.None)); diff --git a/src/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.ts b/src/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.ts index 59ec31d81d6..17b7b7ac490 100644 --- a/src/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.ts +++ b/src/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.ts @@ -176,7 +176,7 @@ export class CommandsQuickAccessProvider extends AbstractEditorCommandsQuickAcce const defaultAgent = this.chatAgentService.getDefaultAgent(ChatAgentLocation.Panel); if (defaultAgent) { additionalPicks.push({ - label: localize('askXInChat', "Ask {0}: {1}", defaultAgent.metadata.fullName, filter), + label: localize('askXInChat', "Ask {0}: {1}", defaultAgent.fullName, filter), commandId: this.configuration.experimental.askChatLocation === 'quickChat' ? ASK_QUICK_QUESTION_ACTION_ID : CHAT_OPEN_ACTION_ID, args: [filter] }); diff --git a/src/vscode-dts/vscode.proposed.chatParticipantAdditions.d.ts b/src/vscode-dts/vscode.proposed.chatParticipantAdditions.d.ts index d062407d47a..260c84c94a2 100644 --- a/src/vscode-dts/vscode.proposed.chatParticipantAdditions.d.ts +++ b/src/vscode-dts/vscode.proposed.chatParticipantAdditions.d.ts @@ -214,7 +214,17 @@ declare module 'vscode' { */ export function createChatParticipant(id: string, handler: ChatExtendedRequestHandler): ChatParticipant; - export function createDynamicChatParticipant(id: string, name: string, publisherName: string, description: string, handler: ChatExtendedRequestHandler): ChatParticipant; + export function createDynamicChatParticipant(id: string, dynamicProps: DynamicChatParticipantProps, handler: ChatExtendedRequestHandler): ChatParticipant; + } + + /** + * These don't get set on the ChatParticipant after creation, like other props, because they are typically defined in package.json and we want them at the time of creation. + */ + export interface DynamicChatParticipantProps { + name: string; + publisherName: string; + description?: string; + fullName?: string; } /* diff --git a/src/vscode-dts/vscode.proposed.defaultChatParticipant.d.ts b/src/vscode-dts/vscode.proposed.defaultChatParticipant.d.ts index d600adb0fee..f4261b5b6fb 100644 --- a/src/vscode-dts/vscode.proposed.defaultChatParticipant.d.ts +++ b/src/vscode-dts/vscode.proposed.defaultChatParticipant.d.ts @@ -27,11 +27,6 @@ declare module 'vscode' { */ isDefault?: boolean; - /** - * The full name of this participant. - */ - fullName?: string; - /** * When true, this participant is invoked when the user submits their query using ctrl/cmd+enter * TODO@API name