mirror of
https://github.com/microsoft/vscode.git
synced 2026-02-15 07:28:05 +00:00
Update hook settings (#294732)
This commit is contained in:
@@ -169,6 +169,20 @@
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"key": "chat.useHooks",
|
||||
"name": "ChatHooks",
|
||||
"category": "InteractiveSession",
|
||||
"minimumVersion": "1.109",
|
||||
"localization": {
|
||||
"description": {
|
||||
"key": "chat.useHooks.description",
|
||||
"value": "Controls whether chat hooks are executed at strategic points during an agent's workflow. Hooks are loaded from the files configured in `#chat.hookFilesLocations#`."
|
||||
}
|
||||
},
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"key": "chat.tools.terminal.enableAutoApprove",
|
||||
"name": "ChatToolsTerminalEnableAutoApprove",
|
||||
|
||||
@@ -958,7 +958,7 @@ configurationRegistry.registerConfiguration({
|
||||
patternErrorMessage: nls.localize('chat.hookFilesLocations.invalidPath', "Paths must be relative or start with '~/'. Absolute paths and '\\' separators are not supported."),
|
||||
},
|
||||
restricted: true,
|
||||
tags: ['prompts', 'hooks', 'agent'],
|
||||
tags: ['preview', 'prompts', 'hooks', 'agent'],
|
||||
examples: [
|
||||
{
|
||||
[DEFAULT_HOOK_FILE_PATHS[0].path]: true,
|
||||
@@ -971,12 +971,24 @@ configurationRegistry.registerConfiguration({
|
||||
},
|
||||
[PromptsConfig.USE_CHAT_HOOKS]: {
|
||||
type: 'boolean',
|
||||
title: nls.localize('chat.useChatHooks.title', "Use Chat Hooks",),
|
||||
markdownDescription: nls.localize('chat.useChatHooks.description', "Controls whether chat hooks are executed at strategic points during an agent's workflow. Hooks are loaded from the files configured in `#chat.hookFilesLocations#`.",),
|
||||
title: nls.localize('chat.useHooks.title', "Use Chat Hooks",),
|
||||
markdownDescription: nls.localize('chat.useHooks.description', "Controls whether chat hooks are executed at strategic points during an agent's workflow. Hooks are loaded from the files configured in `#chat.hookFilesLocations#`.",),
|
||||
default: true,
|
||||
restricted: true,
|
||||
disallowConfigurationDefault: true,
|
||||
tags: ['prompts', 'hooks', 'agent']
|
||||
tags: ['preview', 'prompts', 'hooks', 'agent'],
|
||||
policy: {
|
||||
name: 'ChatHooks',
|
||||
category: PolicyCategory.InteractiveSession,
|
||||
minimumVersion: '1.109',
|
||||
value: (policyData) => policyData.chat_preview_features_enabled === false ? false : undefined,
|
||||
localization: {
|
||||
description: {
|
||||
key: 'chat.useHooks.description',
|
||||
value: nls.localize('chat.useHooks.description', "Controls whether chat hooks are executed at strategic points during an agent's workflow. Hooks are loaded from the files configured in `#chat.hookFilesLocations#`.",)
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
[PromptsConfig.PROMPT_FILES_SUGGEST_KEY]: {
|
||||
type: 'object',
|
||||
|
||||
@@ -108,7 +108,7 @@ export namespace PromptsConfig {
|
||||
/**
|
||||
* Configuration key for chat hooks usage.
|
||||
*/
|
||||
export const USE_CHAT_HOOKS = 'chat.useChatHooks';
|
||||
export const USE_CHAT_HOOKS = 'chat.useHooks';
|
||||
|
||||
/**
|
||||
* Configuration key for enabling stronger skill adherence prompt (experimental).
|
||||
|
||||
@@ -177,7 +177,10 @@ export class PromptsService extends Disposable implements IPromptsService {
|
||||
|
||||
this.cachedHooks = this._register(new CachedPromise(
|
||||
(token) => this.computeHooks(token),
|
||||
() => this.getFileLocatorEvent(PromptsType.hook)
|
||||
() => Event.any(
|
||||
this.getFileLocatorEvent(PromptsType.hook),
|
||||
Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration(PromptsConfig.USE_CHAT_HOOKS)),
|
||||
)
|
||||
));
|
||||
|
||||
// Hack: Subscribe to activate caching (CachedPromise only caches when onDidChange has listeners)
|
||||
@@ -1000,6 +1003,11 @@ export class PromptsService extends Disposable implements IPromptsService {
|
||||
}
|
||||
|
||||
private async computeHooks(token: CancellationToken): Promise<IChatRequestHooks | undefined> {
|
||||
const useChatHooks = this.configurationService.getValue(PromptsConfig.USE_CHAT_HOOKS);
|
||||
if (!useChatHooks) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const hookFiles = await this.listPromptFiles(PromptsType.hook, token);
|
||||
|
||||
if (hookFiles.length === 0) {
|
||||
|
||||
@@ -257,7 +257,7 @@ export const tocData: ITOCEntry<string> = {
|
||||
'chat.useNestedAgentsMdFiles',
|
||||
'chat.useAgentSkills',
|
||||
'chat.experimental.useSkillAdherencePrompt',
|
||||
'chat.useChatHooks',
|
||||
'chat.useHooks',
|
||||
'chat.includeApplyingInstructions',
|
||||
'chat.includeReferencedInstructions',
|
||||
'chat.sendElementsToChat.*',
|
||||
|
||||
Reference in New Issue
Block a user