diff --git a/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.ts b/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.ts index e4fc306046d98..991a81197d2eb 100644 --- a/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.ts +++ b/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.ts @@ -1777,8 +1777,19 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer other.kind === content.kind); + if (isResponseVM(context.element)) { + const request = context.element.model.request; + let isAgent = false; + if (request) { + if (request.modeInfo) { + isAgent = request.modeInfo.modeId === ChatModeKind.Agent; + } else { + isAgent = this.delegate.currentChatMode() === ChatModeKind.Agent; + } + } + if (isAgent) { + return this.renderNoContent(other => other.kind === content.kind); + } } return this.renderContentReferencesListData(content, undefined, context, templateData); } else if (content.kind === 'codeCitations') { diff --git a/src/vs/workbench/contrib/chat/common/model/chatModel.ts b/src/vs/workbench/contrib/chat/common/model/chatModel.ts index 6b322748eed0d..8748cb47d4c1d 100644 --- a/src/vs/workbench/contrib/chat/common/model/chatModel.ts +++ b/src/vs/workbench/contrib/chat/common/model/chatModel.ts @@ -1446,6 +1446,17 @@ export interface ISerializableChatRequestData extends ISerializableChatResponseD confirmation?: string; editedFileEvents?: IChatAgentEditedFileEvent[]; modelId?: string; + modeInfo?: ISerializableModeInfo; +} + +/** + * Reduced shape of {@link IChatRequestModeInfo} for serialization. + * Only persists fields needed for UI decisions, avoiding large modeInstructions content. + */ +export interface ISerializableModeInfo { + modeId: IChatRequestModeInfo['modeId']; + kind: ChatModeKind | undefined; + isBuiltin: boolean; } export interface ISerializableMarkdownInfo { @@ -2297,6 +2308,13 @@ export class ChatModel extends Disposable implements IChatModel { confirmation: raw.confirmation, editedFileEvents: raw.editedFileEvents, modelId: raw.modelId, + modeInfo: raw.modeInfo ? { + modeId: raw.modeInfo.modeId, + kind: raw.modeInfo.kind, + isBuiltin: raw.modeInfo.isBuiltin, + modeInstructions: undefined, + applyCodeBlockSuggestionId: undefined, + } : undefined, }); request.shouldBeRemovedOnSend = raw.isHidden ? { requestId: raw.requestId } : raw.shouldBeRemovedOnSend; // eslint-disable-next-line @typescript-eslint/no-explicit-any, local/code-no-any-casts @@ -2639,6 +2657,11 @@ export class ChatModel extends Disposable implements IChatModel { confirmation: r.confirmation, editedFileEvents: r.editedFileEvents, modelId: r.modelId, + modeInfo: r.modeInfo ? { + modeId: r.modeInfo.modeId, + kind: r.modeInfo.kind, + isBuiltin: r.modeInfo.isBuiltin, + } : undefined, ...r.response?.toJSON(), }; }), diff --git a/src/vs/workbench/contrib/chat/common/model/chatSessionOperationLog.ts b/src/vs/workbench/contrib/chat/common/model/chatSessionOperationLog.ts index 767cb087be6a4..d626e03b2ff95 100644 --- a/src/vs/workbench/contrib/chat/common/model/chatSessionOperationLog.ts +++ b/src/vs/workbench/contrib/chat/common/model/chatSessionOperationLog.ts @@ -126,6 +126,7 @@ const requestSchema = Adapt.object m.shouldBeRemovedOnSend, objectsEqual), agent: Adapt.v(m => m.response?.agent, (a, b) => a?.id === b?.id), modelId: Adapt.v(m => m.modelId), + modeInfo: Adapt.v(m => m.modeInfo ? { modeId: m.modeInfo.modeId, kind: m.modeInfo.kind, isBuiltin: m.modeInfo.isBuiltin } : undefined, objectsEqual), editedFileEvents: Adapt.t(m => m.editedFileEvents, Adapt.array(agentEditedFileEventSchema)), variableData: Adapt.t(m => m.variableData, chatVariableSchema), isHidden: Adapt.v(() => undefined), // deprecated, always undefined for new data