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
This commit is contained in:
Rob Lourens
2026-02-10 22:59:11 +00:00
committed by GitHub
parent 9f6e415379
commit 11bbecdc9c
21 changed files with 67 additions and 1572 deletions

View File

@@ -65,7 +65,6 @@ import { IExtHostConsumerFileSystem } from './extHostFileSystemConsumer.js';
import { ExtHostFileSystemEventService, FileSystemWatcherCreateOptions } from './extHostFileSystemEventService.js';
import { IExtHostFileSystemInfo } from './extHostFileSystemInfo.js';
import { IExtHostInitDataService } from './extHostInitDataService.js';
import { IExtHostHooks } from './extHostHooks.js';
import { ExtHostInteractive } from './extHostInteractive.js';
import { ExtHostLabelService } from './extHostLabelService.js';
import { ExtHostLanguageFeatures } from './extHostLanguageFeatures.js';
@@ -245,7 +244,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
const extHostEmbeddings = rpcProtocol.set(ExtHostContext.ExtHostEmbeddings, new ExtHostEmbeddings(rpcProtocol));
rpcProtocol.set(ExtHostContext.ExtHostMcp, accessor.get(IExtHostMpcService));
rpcProtocol.set(ExtHostContext.ExtHostHooks, accessor.get(IExtHostHooks));
// Check that no named customers are missing
const expected = Object.values<ProxyIdentifier<any>>(ExtHostContext);
@@ -257,7 +255,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
const extHostMessageService = new ExtHostMessageService(rpcProtocol, extHostLogService);
const extHostDialogs = new ExtHostDialogs(rpcProtocol);
const extHostChatStatus = new ExtHostChatStatus(rpcProtocol);
const extHostHooks = accessor.get(IExtHostHooks);
// Register API-ish commands
ExtHostApiCommands.register(extHostCommands);
@@ -1661,10 +1658,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
checkProposedApiEnabled(extension, 'chatPromptFiles');
return extHostChatAgents2.registerPromptFileProvider(extension, PromptsType.skill, provider);
},
async executeHook(hookType: vscode.ChatHookType, options: vscode.ChatHookExecutionOptions, token?: vscode.CancellationToken): Promise<vscode.ChatHookResult[]> {
checkProposedApiEnabled(extension, 'chatHooks');
return extHostHooks.executeHook(hookType, options, token);
},
};
// namespace: lm