mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-17 15:24:40 +01:00
feat: add autoAttachReferences option to chat session extension point (#302508)
* feat: add autoAttachReferences option to chat session extension point This allows us to opt-in/out in to auto-attaching references. Some external agents will manage auto attaching references by themselves, this allows them to do so without Core injecting stuff automatically. * fix: treat autoAttachReferences as enabled by default, fix description Address PR review feedback: - Only skip instruction auto-attachment when autoAttachReferences is explicitly false, preserving existing behavior for session types that don't specify the flag. - Update schema description to accurately reflect what the flag controls (instruction files only, not implicit context) and correct the default. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update autoAttachReferences default to false and improve description
This commit is contained in:
committed by
GitHub
parent
b97d411665
commit
874449ab44
@@ -216,6 +216,11 @@ const extensionPoint = ExtensionsRegistry.registerExtensionPoint<IChatSessionsEx
|
||||
description: localize('chatSessionsExtPoint.requiresCustomModels', 'When set, the chat session will show a filtered model picker that prefers custom models. This enables the use of standard model picker with contributed sessions.'),
|
||||
type: 'boolean',
|
||||
default: false
|
||||
},
|
||||
autoAttachReferences: {
|
||||
description: localize('chatSessionsExtPoint.autoAttachReferences', 'Whether to automatically attach instruction files to chat requests for this session type.'),
|
||||
type: 'boolean',
|
||||
default: false
|
||||
}
|
||||
},
|
||||
required: ['type', 'name', 'displayName', 'description'],
|
||||
|
||||
@@ -2714,6 +2714,11 @@ export class ChatWidget extends Disposable implements IChatWidget {
|
||||
* - instructions referenced in an already included instruction file
|
||||
*/
|
||||
private async _autoAttachInstructions({ attachedContext }: IChatRequestInputOptions): Promise<void> {
|
||||
const contribution = this._lockedAgent ? this.chatSessionsService.getChatSessionContribution(this._lockedAgent.id) : undefined;
|
||||
if (!contribution?.autoAttachReferences) {
|
||||
this.logService.debug(`ChatWidget#_autoAttachInstructions: skipped, autoAttachReferences is disabled`);
|
||||
return;
|
||||
}
|
||||
this.logService.debug(`ChatWidget#_autoAttachInstructions: prompt files are always enabled`);
|
||||
const enabledTools = this.input.currentModeKind === ChatModeKind.Agent ? this.input.selectedToolsModel.userSelectedTools.get() : undefined;
|
||||
const enabledSubAgents = this.input.currentModeKind === ChatModeKind.Agent ? this.input.currentModeObs.get().agents?.get() : undefined;
|
||||
|
||||
@@ -94,6 +94,11 @@ export interface IChatSessionsExtensionPoint {
|
||||
*/
|
||||
readonly customAgentTarget?: Target;
|
||||
readonly requiresCustomModels?: boolean;
|
||||
/**
|
||||
* Decides whether to automatically attach instruction files to chat requests
|
||||
* for this session type. Defaults to false when not specified.
|
||||
*/
|
||||
readonly autoAttachReferences?: boolean;
|
||||
}
|
||||
|
||||
export interface IChatSessionItem {
|
||||
|
||||
Reference in New Issue
Block a user