Add initial hooks support (#292699)

This commit is contained in:
Paul
2026-02-03 17:32:57 -08:00
committed by GitHub
parent f4ce567e5d
commit dd69bcaa41
41 changed files with 3359 additions and 17 deletions

View File

@@ -65,6 +65,7 @@ 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';
@@ -238,6 +239,7 @@ 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);
@@ -249,6 +251,8 @@ 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);
extHostHooks.initialize(extHostChatAgents2);
// Register API-ish commands
ExtHostApiCommands.register(extHostCommands);
@@ -1591,6 +1595,12 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
checkProposedApiEnabled(extension, 'chatPromptFiles');
return extHostChatAgents2.registerPromptFileProvider(extension, PromptsType.skill, provider);
},
executeHook(hookType: vscode.ChatHookType, options: vscode.ChatHookExecutionOptions, token?: vscode.CancellationToken): Thenable<vscode.ChatHookResult[]> {
checkProposedApiEnabled(extension, 'chatHooks');
return extHostHooks.executeHook(hookType, options, token).then(results =>
results.map(r => ({ kind: r.kind as unknown as vscode.ChatHookResultKind, result: r.result }))
);
},
};
// namespace: lm
@@ -2013,7 +2023,8 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
McpToolAvailability: extHostTypes.McpToolAvailability,
McpToolInvocationContentData: extHostTypes.McpToolInvocationContentData,
SettingsSearchResultKind: extHostTypes.SettingsSearchResultKind,
ChatTodoStatus: extHostTypes.ChatTodoStatus
ChatHookResultKind: extHostTypes.ChatHookResultKind,
ChatTodoStatus: extHostTypes.ChatTodoStatus,
};
};
}