/** * adapters/vscode-copilot — VS Code Copilot platform adapter. * * Implements HookAdapter for VS Code Copilot's JSON stdin/stdout hook paradigm. * * VS Code Copilot hook specifics: * - I/O: JSON on stdin, JSON on stdout (same paradigm as Claude Code) * - Hook names: PreToolUse, PostToolUse, PreCompact, SessionStart (PascalCase) * - Additional hooks: Stop, SubagentStart, SubagentStop (unique to VS Code) * - Arg modification: `updatedInput` in hookSpecificOutput wrapper (NOT flat) * - Blocking: `permissionDecision: "deny"` (same as Claude Code) * - Output modification: `additionalContext` in hookSpecificOutput, * `decision: "block"` + reason * - Tool input fields: tool_name, tool_input (snake_case, same as Claude Code) * - But tool input PROPERTY names are camelCase (filePath not file_path) * - Session ID: sessionId (camelCase, NOT session_id) * - MCP tool prefix: f1e_ (not mcp__server__tool) * - CRITICAL: matchers are parsed but IGNORED (all hooks fire on all tools) * - Config: .github/hooks/*.json (primary), also reads .claude/settings.json * - Env detection: VSCODE_PID, TERM_PROGRAM=vscode * - Session dir: ~/.vscode/context-mode/sessions/ (fallback) * - Preview status — API may change */ import type { HookAdapter, HookParadigm, PlatformCapabilities, DiagnosticResult, PreToolUseEvent, PostToolUseEvent, PreCompactEvent, SessionStartEvent, PreToolUseResponse, PostToolUseResponse, PreCompactResponse, SessionStartResponse, HookRegistration } from "../types.js"; export declare class VSCodeCopilotAdapter implements HookAdapter { readonly name = "VS Code Copilot"; readonly paradigm: HookParadigm; readonly capabilities: PlatformCapabilities; parsePreToolUseInput(raw: unknown): PreToolUseEvent; parsePostToolUseInput(raw: unknown): PostToolUseEvent; parsePreCompactInput(raw: unknown): PreCompactEvent; parseSessionStartInput(raw: unknown): SessionStartEvent; formatPreToolUseResponse(response: PreToolUseResponse): unknown; formatPostToolUseResponse(response: PostToolUseResponse): unknown; formatPreCompactResponse(response: PreCompactResponse): unknown; formatSessionStartResponse(response: SessionStartResponse): unknown; getSettingsPath(): string; getSessionDir(): string; getSessionDBPath(projectDir: string): string; getSessionEventsPath(projectDir: string): string; generateHookConfig(pluginRoot: string): HookRegistration; readSettings(): Record | null; writeSettings(settings: Record): void; validateHooks(pluginRoot: string): DiagnosticResult[]; checkPluginRegistration(): DiagnosticResult; getInstalledVersion(): string; configureAllHooks(pluginRoot: string): string[]; backupSettings(): string | null; setHookPermissions(pluginRoot: string): string[]; updatePluginRegistry(_pluginRoot: string, _version: string): void; /** * Extract session ID from VS Code Copilot hook input. * VS Code Copilot uses camelCase sessionId (NOT session_id). */ private extractSessionId; }