import "reflect-metadata"; import { type CommandCallerContext, ExecutionContext } from "../execution/ExecutionContext"; import type { SessionContext } from "../session"; import { PermissionRegistry } from "./PermissionRegistry"; export { addCommandHandler, getManagerMetadata, setManagerNamespace, } from "./CommandMetadata"; /** * CommandRegistry * * Central registry for namespaced command handlers. * Similar to FastAPI's APIRouter pattern - allows multiple managers * to register their own command handlers under namespaces. */ export type CommandHandler = (args: TArgs) => Promise | TResult; export interface CommandMetadata { namespace: string; command: string; handler: CommandHandler; target: object; permission?: string; methodName: string; } interface CommandManager { constructor: object; } export declare class CommandRegistry { private permissionRegistry; private sessionContext; private executionContext; private handlers; constructor(permissionRegistry: PermissionRegistry, sessionContext: SessionContext, executionContext: ExecutionContext); /** * Register a command handler under a namespace * @param namespace - The namespace (e.g., "app", "view") * @param command - The command name (e.g., "launch", "update-bounds") * @param handler - The handler function * @param target - The instance that owns the handler (for proper `this` binding) * @param methodName - The original method name for metadata lookup */ register(namespace: string, command: string, handler: CommandHandler, target: object, methodName?: string): void; /** * Register multiple handlers from a manager instance * @param manager - The manager instance to register handlers from */ registerManager(manager: CommandManager): void; /** * Execute a command by its full name * @param fullCommand - The full command name (e.g., "process/launch") * @param args - The command arguments * @param callerContext - Trusted caller metadata resolved by the transport * @returns The command result */ execute(fullCommand: string, args: unknown, callerContext?: CommandCallerContext): Promise; private resolveCallerContext; private withCallerContext; /** * Check if a command is registered */ has(fullCommand: string): boolean; /** * Get all registered command names */ getCommands(): string[]; /** * Get commands for a specific namespace */ getNamespaceCommands(namespace: string): string[]; /** * Clear all handlers (useful for testing) */ clear(): void; dispose(): void; } //# sourceMappingURL=CommandRegistry.d.ts.map