Path: blob/main/extensions/copilot/src/extension/chatSessions/claude/common/claudeToolPermissionRegistry.ts
13405 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { IClaudeToolPermissionHandlerCtor } from './claudeToolPermission';6import { ClaudeToolNames } from './claudeTools';78/**9* Registry entry for tool permission handlers10*/11export interface IToolPermissionHandlerRegistration {12readonly toolNames: readonly ClaudeToolNames[];13readonly ctor: IClaudeToolPermissionHandlerCtor;14}1516/**17* Registry of tool permission handlers.18* Handlers can register from common/, node/, or vscode-node/ folders.19*/20const handlerRegistry: IToolPermissionHandlerRegistration[] = [];2122/**23* Register a tool permission handler for one or more tools.24* Handlers are instantiated lazily via the instantiation service.25*26* @param toolNames The tool name(s) to register the handler for27* @param ctor The handler constructor28*/29export function registerToolPermissionHandler<T extends ClaudeToolNames>(30toolNames: readonly T[],31ctor: IClaudeToolPermissionHandlerCtor<T>32): void {33handlerRegistry.push({ toolNames, ctor });34}3536/**37* Get all registered tool permission handlers.38* Used by ClaudeToolPermissionService to look up handlers.39*/40export function getToolPermissionHandlerRegistry(): readonly IToolPermissionHandlerRegistration[] {41return handlerRegistry;42}434445