Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Introduces initial “chat hooks” support, including a hooks.json schema + discovery, UI entry points to create/manage hook files, and a proposed API (vscode.chat.executeHook) with main-thread ↔ extension-host plumbing to execute configured hook commands.
Changes:
- Add hook configuration parsing/schema (Copilot hooks.json + Claude settings compatibility) and hook discovery via
IPromptsService.getHooks(). - Surface hook configuration in the workbench (new hook file action + “Configure Hooks” picker) and plumb collected hooks into chat agent requests.
- Implement proposed API + RPC wiring + Node extension-host execution for hook commands, with tests for parsing/compat and ext-host execution.
Reviewed changes
Copilot reviewed 35 out of 36 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vscode-dts/vscode.proposed.chatHooks.d.ts | Adds proposed chatHooks API typings (hook types, execution, result). |
| src/vs/workbench/contrib/chat/test/common/promptSyntax/service/mockPromptsService.ts | Updates prompts service mock to satisfy new getHooks API. |
| src/vs/workbench/contrib/chat/test/common/promptSyntax/hookSchema.test.ts | Unit tests for hook type normalization + hook command resolution. |
| src/vs/workbench/contrib/chat/test/common/promptSyntax/hookClaudeCompat.test.ts | Unit tests for Claude hook compatibility parsing/mapping. |
| src/vs/workbench/contrib/chat/test/common/chatService/chatService.test.ts | Stubs IPromptsService for chat service tests after DI change. |
| src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.ts | Implements hook file discovery/parsing + caching via getHooks(). |
| src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.ts | Extends IPromptsService with getHooks(). |
| src/vs/workbench/contrib/chat/common/promptSyntax/promptTypes.ts | Adds hook docs URL + language-id mapping for hook prompt type. |
| src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.ts | Updates validator attribute sets to handle new hook prompt type. |
| src/vs/workbench/contrib/chat/common/promptSyntax/hookSchema.ts | Defines hook schema/types and helpers for command resolution/labels. |
| src/vs/workbench/contrib/chat/common/promptSyntax/hookCompatibility.ts | Adds format detection + parsing dispatch across supported formats. |
| src/vs/workbench/contrib/chat/common/promptSyntax/hookClaudeCompat.ts | Implements Claude settings.json hook parsing compatibility. |
| src/vs/workbench/contrib/chat/common/promptSyntax/config/promptFileLocations.ts | Adds hook file locations/types (hooks.json + .claude settings). |
| src/vs/workbench/contrib/chat/common/promptSyntax/config/config.ts | Introduces settings keys for hook file locations + enablement. |
| src/vs/workbench/contrib/chat/common/promptSyntax/chatPromptFilesContribution.ts | Extends prompt file listing command to include hooks. |
| src/vs/workbench/contrib/chat/common/participants/chatAgents.ts | Plumbs collected hooks into IChatAgentRequest. |
| src/vs/workbench/contrib/chat/common/hooksExecutionService.ts | Adds main-thread service abstraction for executing hooks via proxy. |
| src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts | Collects hooks via prompts service and attaches to chat requests. |
| src/vs/workbench/contrib/chat/browser/promptSyntax/promptFileActions.ts | Registers hook-related actions alongside other prompt actions. |
| src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/promptFilePickers.ts | Adds hook help button support in prompt pickers. |
| src/vs/workbench/contrib/chat/browser/promptSyntax/pickers/askForPromptSourceFolder.ts | Adds hook-related picker strings + disallows copy/move for hooks. |
| src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.ts | Adds “New Hook File…” command to create/extend hooks.json. |
| src/vs/workbench/contrib/chat/browser/promptSyntax/hookUtils.ts | Adds helper to select newly-added hook command in JSON content. |
| src/vs/workbench/contrib/chat/browser/promptSyntax/hookActions.ts | Adds “Configure Hooks…” action and quick pick UI for hook entries. |
| src/vs/workbench/contrib/chat/browser/chat.contribution.ts | Registers hook JSON schema + hook-related configuration + service singleton. |
| src/vs/workbench/api/test/node/extHostHooks.test.ts | Adds tests for extension-host hook execution behavior. |
| src/vs/workbench/api/node/extHostHooksNode.ts | Implements Node extension-host hook execution via child_process. |
| src/vs/workbench/api/node/extHost.node.services.ts | Registers IExtHostHooks singleton for node extension host. |
| src/vs/workbench/api/common/extHostTypes.ts | Adds ChatHookResultKind to ext host types. |
| src/vs/workbench/api/common/extHostHooks.ts | Defines ext-host hooks service interface + RPC shape. |
| src/vs/workbench/api/common/extHostChatAgents2.ts | Stores hooks on in-flight requests + exposes getHooksForSession. |
| src/vs/workbench/api/common/extHost.protocol.ts | Adds RPC identifiers and DTO for hook execution results. |
| src/vs/workbench/api/common/extHost.api.impl.ts | Wires proposed vscode.chat.executeHook to ext-host implementation. |
| src/vs/workbench/api/browser/mainThreadHooks.ts | Main-thread customer that forwards executions to the extension host. |
| src/vs/workbench/api/browser/extensionHost.contribution.ts | Registers main-thread hooks customer. |
| src/vs/platform/extensions/common/extensionsApiProposals.ts | Registers chatHooks proposal + version. |
Comments suppressed due to low confidence (1)
src/vs/workbench/contrib/chat/browser/promptSyntax/hookUtils.ts:69
- Related to the above: treating any '}' while bracketDepth===1 as the end of the target object can trigger on nested object closures (like the end of an
envobject), causing early termination and incorrect/undefined selections. This should be based on proper JSON structure rather than character scanning.
} else if (char === '}' && inTargetObject && bracketDepth === 1) {
// End of the target object, search for field within this object
for (let j = targetObjectStartLine; j <= i; j++) {
src/vs/workbench/contrib/chat/browser/promptSyntax/hookUtils.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/chat/browser/promptSyntax/newPromptFileActions.ts
Show resolved
Hide resolved
src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.ts
Show resolved
Hide resolved
src/vs/workbench/contrib/chat/common/promptSyntax/config/promptFileLocations.ts
Show resolved
Hide resolved
dmitrivMS
approved these changes
Feb 4, 2026
pwang347
added a commit
that referenced
this pull request
Feb 10, 2026
sbatten
pushed a commit
that referenced
this pull request
Feb 11, 2026
* Add initial hooks support (#292699) * Restructure hook execution to always go through the renderer process (#292763) * Restructure hook execution to always go through the renderer process Add output channel * cleanup * Fixes * Hooks format cleanup (#292928) * Add diagnostics for hooks (#292912) * preToolUse hook supporting "deny" (#292890) * preToolUse hook supporting "deny" * Fix tests * Simplify tests * Fix test * Add common output hook types and reorganize related code (#292961) * Add common output hook types, reorganize a bit more * test fixes * Fix extHostHooks for web (#292968) * Rename and clarify internal vs external chat hook types (#292979) * Make explicit chat hook "internal" vs "external" types * Renames * Avoid types re-export * Move to hooks/ * This * Updates for chat extension hooks (#292991) * Enhance preToolUse hook and clean up code (#293265) * Flesh out preToolUse hook * Cleanup * cleanups * Cleanup * String update (#293298) * PostToolUse hook (#293282) * Add onDidExecuteHook event to HooksExecutionService (#293279) * Add onDidExecuteHook event to HooksExecutionService * Fix MockHooksExecutionService to include onDidExecuteHook event * Extend Disposable instead of using DisposableStore * Fire onDidExecuteHook event even when no hooks are registered * Fixes * Handle multiple post/preToolUse hooks more correctly (#293517) * Improve tests * Handle multiple post/preToolUse hooks more correctly * Support OS-specific commands for hooks (#293530) * hook streaming first pass (#293514) * hooks streaming first pass * Update src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatHookContentPart.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * update styling * modify api shape * address some comments + do not render for now * new icons + no more continue * make sure we render right, some comments addressed * uncomment that stuffs --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Support transcript_path on hooks (#293567) * updatedInput for PreToolUse (#293575) * Support PreCompact hook (#293581) * Support PreCompact hook * add this * Handle remote OS for hook detection (#293596) * Add common blocking behaviour for hooks (#293543) * Add /hooks slash command (#293583) * Add /hooks slash command * await * Build fix * Update configure hooks flow and supported paths (#293643) * update * updates * Update src/vs/workbench/contrib/chat/browser/promptSyntax/hookActions.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * update handling * PR * test * fix test * cleanup * nit * cleanup * clean --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Don't fail hooks when missing token (#293811) * Make chatHooks proposal self contained * Add support for continue, stopReason and systemMessage for tool hooks (#294016) * Add back button to configure hooks menu (#294043) * Move PreToolUse to extension (#294042) * Move PreToolUse to extension * Migrate PostToolUse * Update handling of claude hooks config (#294187) * Add more configuration slash commands (#294231) * Move hook execution to extension (#294215) * Refactor hook execution * Fix compilation: add IExtHostHooks import, remove unused IHookResult, inline ChatRequestHooks type * Move hooks property to chatHooks proposal, sync DTS * cleanup * Remove dead hook execution code: proxy, RPC, output channel, progress events All hook execution now happens in the extension via NodeHookExecutor. HooksExecutionService is now a pure registry (registerHooks/getHooksForSession). Removed: - executeHook, setProxy, onDidHookProgress from service - IHooksExecutionProxy, IHookProgressEvent, HookAbortError, formatHookErrorMessage - hooksCommandTypes.ts, hooksTypes.ts (dead type files) - mainThreadHooks proxy setup - extHostHooksNode., extHostHooksWorker. - ExtHostHooksShape. protocol - IExtHostHooks DI registrations - ChatHooksProgressContribution - All associated test files * Remove HooksExecutionService entirely The service was only a registry for session hooks, but hooks are already passed directly on the chat request DTO. The registerHooks/getHooksForSession pattern was redundant. * Restore modelName support in chatSubagentContentPart that was accidentally removed during merge * Revert unrelated tabIndex change on chatSubagentContentPart * Remove empty hooks ext host infrastructure Delete IExtHostHooks, NodeExtHostHooks, WorkerExtHostHooks, MainThreadHooks, ExtHostHooksShape, MainThreadHooksShape - all were empty stubs after hook execution moved to extension. * Remove mainThreadHooks import from extensionHost.contribution * Fix DTS comments: env and timeoutSec are values, not implementation promises * Update hook timeout format (#294266) * Add support for disabling all hooks and use JSONC (#294234) * fix for moving hooks to extension (#294441) * fix for moving hooks to extension * fix hygiene * address comments --------- Co-authored-by: Rob Lourens <roblourens@gmail.com> Co-authored-by: Justin Chen <54879025+justschen@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Matt Bierner <12821956+mjbvz@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Initial config handling/API work for hooks support