@ken-jo/agent-connector 0.4.6 → 0.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/dist/{action-EV63GAPY.js → action-YCU53FNE.js} +8 -8
  2. package/dist/{amazon-q-COAL3764.js → amazon-q-W574ZX35.js} +2 -2
  3. package/dist/{amp-XJQ4TDAU.js → amp-JPBQJJVM.js} +2 -2
  4. package/dist/{antigravity-AMKKKHS4.js → antigravity-VK2Y3FGV.js} +3 -3
  5. package/dist/{antigravity-cli-XERXEH5W.js → antigravity-cli-D4PCCUG2.js} +3 -3
  6. package/dist/{chunk-BMD7ANKF.js → chunk-2F5QH3D4.js} +36 -36
  7. package/dist/{chunk-5G4EPJ4Y.js → chunk-6RYPUR6O.js} +5 -5
  8. package/dist/{chunk-2X4EH2D7.js → chunk-7ECYDK5T.js} +2 -2
  9. package/dist/{chunk-QC5A3TFQ.js → chunk-CYOAH23F.js} +18 -18
  10. package/dist/{chunk-RQPKL62M.js → chunk-DT6Y7XBI.js} +2 -2
  11. package/dist/{chunk-QOGMDOUX.js → chunk-HAIMYUEY.js} +3 -3
  12. package/dist/{chunk-DCK5FADX.js → chunk-MDNX7HTN.js} +2 -2
  13. package/dist/{chunk-EXLS7BSI.js → chunk-NLFPH4S2.js} +10 -2
  14. package/dist/chunk-NLFPH4S2.js.map +1 -0
  15. package/dist/{chunk-CPLK7GTE.js → chunk-PFDUGDOA.js} +351 -34
  16. package/dist/chunk-PFDUGDOA.js.map +1 -0
  17. package/dist/{chunk-EROJDXMW.js → chunk-SDPIT4HW.js} +2 -2
  18. package/dist/{chunk-H67V7DEL.js → chunk-SPWFUHHK.js} +5 -5
  19. package/dist/{chunk-LQRAPXS4.js → chunk-TZQBASI7.js} +4 -2
  20. package/dist/chunk-TZQBASI7.js.map +1 -0
  21. package/dist/{chunk-SRVAA2VN.js → chunk-WFXWJITA.js} +2 -2
  22. package/dist/{chunk-MZF2YCXX.js → chunk-YQLQJZ7S.js} +2 -2
  23. package/dist/{claude-code-T2LPFNC3.js → claude-code-ROSIILTM.js} +36 -100
  24. package/dist/claude-code-ROSIILTM.js.map +1 -0
  25. package/dist/cli/sdk.js +4 -4
  26. package/dist/cli.js +1 -1
  27. package/dist/{cline-WRYMNS7Z.js → cline-JUTO4V27.js} +2 -2
  28. package/dist/{codebuff-PODYPOOP.js → codebuff-2QUHL6HO.js} +2 -2
  29. package/dist/{codex-O4G7D7KK.js → codex-YBBTIDD4.js} +91 -112
  30. package/dist/codex-YBBTIDD4.js.map +1 -0
  31. package/dist/{continue-K43SUHLQ.js → continue-W4TU4JSB.js} +5 -3
  32. package/dist/continue-W4TU4JSB.js.map +1 -0
  33. package/dist/{copilot-cli-Q3SSPT4V.js → copilot-cli-Y74SOP5G.js} +4 -2
  34. package/dist/copilot-cli-Y74SOP5G.js.map +1 -0
  35. package/dist/{crush-MBEH2R3I.js → crush-GMEWLXK5.js} +4 -2
  36. package/dist/{crush-MBEH2R3I.js.map → crush-GMEWLXK5.js.map} +1 -1
  37. package/dist/{cursor-TMBXDYR4.js → cursor-JBS4B3Q4.js} +50 -134
  38. package/dist/cursor-JBS4B3Q4.js.map +1 -0
  39. package/dist/{detect-AHJIUMBO.js → detect-2NIXILMZ.js} +4 -4
  40. package/dist/{doctor-G5MLCPAB.js → doctor-QWJBWALA.js} +8 -8
  41. package/dist/{droid-JC2NT6S4.js → droid-TJMTNCQE.js} +48 -106
  42. package/dist/droid-TJMTNCQE.js.map +1 -0
  43. package/dist/{gemini-cli-ILR7M5X3.js → gemini-cli-RAONGZRG.js} +7 -2
  44. package/dist/gemini-cli-RAONGZRG.js.map +1 -0
  45. package/dist/{goose-SFO5BBGW.js → goose-G4KKM6YU.js} +91 -131
  46. package/dist/goose-G4KKM6YU.js.map +1 -0
  47. package/dist/{hermes-3N7WN4WS.js → hermes-PJDTJE6F.js} +29 -33
  48. package/dist/hermes-PJDTJE6F.js.map +1 -0
  49. package/dist/{hook-76JBKTUX.js → hook-FDGIQPRC.js} +8 -8
  50. package/dist/index.js +2 -2
  51. package/dist/{install-R7252QFH.js → install-TLG3QVP3.js} +8 -8
  52. package/dist/{jetbrains-copilot-NRZHI5PC.js → jetbrains-copilot-DNXSLQE5.js} +4 -2
  53. package/dist/jetbrains-copilot-DNXSLQE5.js.map +1 -0
  54. package/dist/{kilo-IX4T3OHJ.js → kilo-FERJ3X46.js} +2 -2
  55. package/dist/{kilo-cli-2AYCXBQD.js → kilo-cli-TDCONH5G.js} +2 -2
  56. package/dist/{kimi-2YFK2GBA.js → kimi-RIRD4J5J.js} +12 -2
  57. package/dist/kimi-RIRD4J5J.js.map +1 -0
  58. package/dist/{kiro-YL6AWUYG.js → kiro-X7JVLAN7.js} +4 -2
  59. package/dist/kiro-X7JVLAN7.js.map +1 -0
  60. package/dist/{leaderboard-V6VWA5ZV.js → leaderboard-MXGENYXN.js} +2 -2
  61. package/dist/{mimo-code-FTMGSKMQ.js → mimo-code-RFLQ727H.js} +2 -2
  62. package/dist/{mux-5XZFB44C.js → mux-D77HBSBU.js} +3 -17
  63. package/dist/mux-D77HBSBU.js.map +1 -0
  64. package/dist/{nemoclaw-CQYXZVQN.js → nemoclaw-LXUTMR56.js} +3 -3
  65. package/dist/{omp-2QMEY6HD.js → omp-CO7IXURG.js} +2 -2
  66. package/dist/{openclaw-UZC437RW.js → openclaw-XWJLEW35.js} +3 -3
  67. package/dist/{opencode-L4BGFP25.js → opencode-QKZ5EIYU.js} +2 -2
  68. package/dist/{package-DNLQTPNN.js → package-IA56LSC3.js} +6 -6
  69. package/dist/{pi-PVVPVWKG.js → pi-YGBXYWY5.js} +2 -2
  70. package/dist/{qwen-code-G4CXKUHR.js → qwen-code-E2MSEZK6.js} +55 -123
  71. package/dist/qwen-code-E2MSEZK6.js.map +1 -0
  72. package/dist/{roo-code-67TYJIQR.js → roo-code-AGGJ473T.js} +2 -2
  73. package/dist/runtime/index.js +6 -6
  74. package/dist/sdk/index.js +3 -3
  75. package/dist/sdk/test.js +5 -5
  76. package/dist/{serve-EOVWYBGZ.js → serve-RNUCK5F7.js} +8 -8
  77. package/dist/{status-VTD6XXLW.js → status-JOX6RLJU.js} +6 -6
  78. package/dist/{statusline-3ET5YPQ5.js → statusline-ZVFI5DRT.js} +7 -7
  79. package/dist/{telemetry-QCTMKDBQ.js → telemetry-3FN6HDVU.js} +5 -5
  80. package/dist/{trae-7CZZGOGI.js → trae-6L226ZDU.js} +2 -2
  81. package/dist/{uninstall-FL3SH2DT.js → uninstall-SCKZYB4J.js} +8 -8
  82. package/dist/{upgrade-SLFG2FCT.js → upgrade-WU3KZWR4.js} +8 -8
  83. package/dist/{usage-IRBLVUZM.js → usage-G72SF7JG.js} +2 -2
  84. package/dist/{usage-event-VFF77WYY.js → usage-event-DHSEBO5T.js} +7 -7
  85. package/dist/{vscode-copilot-MF2CDNMT.js → vscode-copilot-6EOZDLXC.js} +4 -2
  86. package/dist/vscode-copilot-6EOZDLXC.js.map +1 -0
  87. package/dist/{warp-VKG55TAT.js → warp-N5YYN5BF.js} +2 -2
  88. package/dist/{windsurf-FU5G4SHF.js → windsurf-4TGSJIVV.js} +2 -2
  89. package/dist/{zed-SFUHL3GS.js → zed-6P2UFWXU.js} +2 -2
  90. package/package.json +1 -1
  91. package/dist/chunk-CPLK7GTE.js.map +0 -1
  92. package/dist/chunk-EXLS7BSI.js.map +0 -1
  93. package/dist/chunk-LQRAPXS4.js.map +0 -1
  94. package/dist/claude-code-T2LPFNC3.js.map +0 -1
  95. package/dist/codex-O4G7D7KK.js.map +0 -1
  96. package/dist/continue-K43SUHLQ.js.map +0 -1
  97. package/dist/copilot-cli-Q3SSPT4V.js.map +0 -1
  98. package/dist/cursor-TMBXDYR4.js.map +0 -1
  99. package/dist/droid-JC2NT6S4.js.map +0 -1
  100. package/dist/gemini-cli-ILR7M5X3.js.map +0 -1
  101. package/dist/goose-SFO5BBGW.js.map +0 -1
  102. package/dist/hermes-3N7WN4WS.js.map +0 -1
  103. package/dist/jetbrains-copilot-NRZHI5PC.js.map +0 -1
  104. package/dist/kimi-2YFK2GBA.js.map +0 -1
  105. package/dist/kiro-YL6AWUYG.js.map +0 -1
  106. package/dist/mux-5XZFB44C.js.map +0 -1
  107. package/dist/qwen-code-G4CXKUHR.js.map +0 -1
  108. package/dist/vscode-copilot-MF2CDNMT.js.map +0 -1
  109. /package/dist/{action-EV63GAPY.js.map → action-YCU53FNE.js.map} +0 -0
  110. /package/dist/{amazon-q-COAL3764.js.map → amazon-q-W574ZX35.js.map} +0 -0
  111. /package/dist/{amp-XJQ4TDAU.js.map → amp-JPBQJJVM.js.map} +0 -0
  112. /package/dist/{antigravity-AMKKKHS4.js.map → antigravity-VK2Y3FGV.js.map} +0 -0
  113. /package/dist/{antigravity-cli-XERXEH5W.js.map → antigravity-cli-D4PCCUG2.js.map} +0 -0
  114. /package/dist/{chunk-BMD7ANKF.js.map → chunk-2F5QH3D4.js.map} +0 -0
  115. /package/dist/{chunk-5G4EPJ4Y.js.map → chunk-6RYPUR6O.js.map} +0 -0
  116. /package/dist/{chunk-2X4EH2D7.js.map → chunk-7ECYDK5T.js.map} +0 -0
  117. /package/dist/{chunk-QC5A3TFQ.js.map → chunk-CYOAH23F.js.map} +0 -0
  118. /package/dist/{chunk-RQPKL62M.js.map → chunk-DT6Y7XBI.js.map} +0 -0
  119. /package/dist/{chunk-QOGMDOUX.js.map → chunk-HAIMYUEY.js.map} +0 -0
  120. /package/dist/{chunk-DCK5FADX.js.map → chunk-MDNX7HTN.js.map} +0 -0
  121. /package/dist/{chunk-EROJDXMW.js.map → chunk-SDPIT4HW.js.map} +0 -0
  122. /package/dist/{chunk-H67V7DEL.js.map → chunk-SPWFUHHK.js.map} +0 -0
  123. /package/dist/{chunk-SRVAA2VN.js.map → chunk-WFXWJITA.js.map} +0 -0
  124. /package/dist/{chunk-MZF2YCXX.js.map → chunk-YQLQJZ7S.js.map} +0 -0
  125. /package/dist/{cline-WRYMNS7Z.js.map → cline-JUTO4V27.js.map} +0 -0
  126. /package/dist/{codebuff-PODYPOOP.js.map → codebuff-2QUHL6HO.js.map} +0 -0
  127. /package/dist/{detect-AHJIUMBO.js.map → detect-2NIXILMZ.js.map} +0 -0
  128. /package/dist/{doctor-G5MLCPAB.js.map → doctor-QWJBWALA.js.map} +0 -0
  129. /package/dist/{hook-76JBKTUX.js.map → hook-FDGIQPRC.js.map} +0 -0
  130. /package/dist/{install-R7252QFH.js.map → install-TLG3QVP3.js.map} +0 -0
  131. /package/dist/{kilo-IX4T3OHJ.js.map → kilo-FERJ3X46.js.map} +0 -0
  132. /package/dist/{kilo-cli-2AYCXBQD.js.map → kilo-cli-TDCONH5G.js.map} +0 -0
  133. /package/dist/{leaderboard-V6VWA5ZV.js.map → leaderboard-MXGENYXN.js.map} +0 -0
  134. /package/dist/{mimo-code-FTMGSKMQ.js.map → mimo-code-RFLQ727H.js.map} +0 -0
  135. /package/dist/{nemoclaw-CQYXZVQN.js.map → nemoclaw-LXUTMR56.js.map} +0 -0
  136. /package/dist/{omp-2QMEY6HD.js.map → omp-CO7IXURG.js.map} +0 -0
  137. /package/dist/{openclaw-UZC437RW.js.map → openclaw-XWJLEW35.js.map} +0 -0
  138. /package/dist/{opencode-L4BGFP25.js.map → opencode-QKZ5EIYU.js.map} +0 -0
  139. /package/dist/{package-DNLQTPNN.js.map → package-IA56LSC3.js.map} +0 -0
  140. /package/dist/{pi-PVVPVWKG.js.map → pi-YGBXYWY5.js.map} +0 -0
  141. /package/dist/{roo-code-67TYJIQR.js.map → roo-code-AGGJ473T.js.map} +0 -0
  142. /package/dist/{serve-EOVWYBGZ.js.map → serve-RNUCK5F7.js.map} +0 -0
  143. /package/dist/{status-VTD6XXLW.js.map → status-JOX6RLJU.js.map} +0 -0
  144. /package/dist/{statusline-3ET5YPQ5.js.map → statusline-ZVFI5DRT.js.map} +0 -0
  145. /package/dist/{telemetry-QCTMKDBQ.js.map → telemetry-3FN6HDVU.js.map} +0 -0
  146. /package/dist/{trae-7CZZGOGI.js.map → trae-6L226ZDU.js.map} +0 -0
  147. /package/dist/{uninstall-FL3SH2DT.js.map → uninstall-SCKZYB4J.js.map} +0 -0
  148. /package/dist/{upgrade-SLFG2FCT.js.map → upgrade-WU3KZWR4.js.map} +0 -0
  149. /package/dist/{usage-IRBLVUZM.js.map → usage-G72SF7JG.js.map} +0 -0
  150. /package/dist/{usage-event-VFF77WYY.js.map → usage-event-DHSEBO5T.js.map} +0 -0
  151. /package/dist/{warp-VKG55TAT.js.map → warp-N5YYN5BF.js.map} +0 -0
  152. /package/dist/{windsurf-FU5G4SHF.js.map → windsurf-4TGSJIVV.js.map} +0 -0
  153. /package/dist/{zed-SFUHL3GS.js.map → zed-6P2UFWXU.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/adapters/codex/index.ts"],"sourcesContent":["/**\n * adapters/codex — Codex CLI platform adapter for agent-connector.\n *\n * Codex CLI hook paradigm is \"json-stdio\": the host pipes a JSON payload to a\n * command on stdin and reads JSON/exit-code back — the same wire protocol as\n * Claude Code (PascalCase fields, `hookSpecificOutput` reply wrapper).\n *\n * Two native config files live under the Codex config dir\n * (`$CODEX_HOME` || `~/.codex`, mirrored to `<projectDir>/.codex` for project\n * scope):\n * - config.toml → `[mcp_servers.<id>]` MCP registration (TOML, NO native\n * interpolation, so env-refs are resolved to literals at install time).\n * - hooks.json → Claude-compatible hook registration ({ matcher, hooks }).\n *\n * Grounded in context-mode's proven Codex adapter (configs/codex/{config.toml,\n * hooks.json}, src/adapters/codex/*) — exact TOML MCP shape + hook JSON schema.\n *\n * Known Codex limitations (upstream): PreToolUse deny works but updatedInput is\n * not yet honored (openai/codex#18491); PostToolUse updatedMCPToolOutput is\n * parsed-but-unsupported — hence canModifyArgs / canModifyOutput are false.\n *\n * E1 extension events (verified against developers.openai.com/codex/hooks):\n * - PermissionRequest — native, decision-capable via the nested\n * hookSpecificOutput.decision{behavior:\"allow\"|\"deny\", message?} envelope.\n * Codex docs: updatedInput / updatedPermissions / interrupt FAIL CLOSED on\n * this event, so they are never emitted here.\n * - SubagentStart — native; hookSpecificOutput.additionalContext is injected\n * as developer context for the subagent (not blockable).\n * - SubagentStop — native; the documented continuation shape is the TOP-LEVEL\n * {\"decision\":\"block\",\"reason\"} (Stop semantics: keeps the subagent going).\n * - PostToolUseFailure — NO Codex analog (PostToolUse only); declared hooks\n * for it warn-skip at install and the capability flag stays unset.\n * - PostCompact — native (Codex's hook system fires both PreCompact and\n * PostCompact); observe-only, normalizing the `trigger` (manual|auto)\n * exactly like PreCompact, with a passthrough formatReply.\n */\n\nimport { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\n\nimport TOML from \"@iarna/toml\";\n\nimport type {\n ChangeRecord,\n CommandDef,\n DetectedPlatform,\n HealthCheck,\n HookEventName,\n HookParadigm,\n HookResponse,\n PlatformCapabilities,\n PlatformId,\n ServerDef,\n SkillDef,\n SubagentDef,\n} from \"../../core/types.js\";\nimport { ensureDir } from \"../../core/paths.js\";\nimport { resolveEnvRefsDeep } from \"../../core/interpolate.js\";\nimport {\n removeFromObjectMap,\n upsertInObjectMap,\n type ObjectMapCodec,\n} from \"../../core/object-map.js\";\nimport { writeTomlString } from \"../../core/toml.js\";\nimport {\n buildHomeBinHookCommand,\n buildServeWrapperCommand,\n shouldWrapForTelemetry,\n} from \"../../core/spawn.js\";\nimport { BaseAdapter, type HookMergeDescriptor } from \"../base.js\";\nimport type {\n HookReply,\n InstallContext,\n MemoryTarget,\n NormalizedEvent,\n} from \"../spi.js\";\n\n// ─────────────────────────────────────────────────────────────────────────\n// Native shapes\n// ─────────────────────────────────────────────────────────────────────────\n\n/** Raw Codex hook payload (PascalCase event, snake_case fields — Claude-style). */\ninterface CodexHookInput {\n tool_name?: string;\n tool_input?: Record<string, unknown>;\n tool_response?: string;\n session_id?: string;\n cwd?: string;\n hook_event_name?: string;\n source?: string;\n prompt?: string;\n is_error?: boolean;\n stop_hook_active?: boolean;\n trigger?: string;\n message?: string;\n // PostToolUseFailure-style failure field. Codex has NO failure event today;\n // parsed defensively only (the Claude-compatible wire would carry it).\n error?: string;\n // SubagentStart / SubagentStop (agent_type is the matcher subject).\n agent_id?: string;\n agent_type?: string;\n // SubagentStop only — the subagent's own transcript + final message.\n agent_transcript_path?: string;\n last_assistant_message?: string;\n}\n\n/** One hook entry inside hooks.json (Claude-compatible). */\ninterface CodexHookEntry {\n matcher?: string;\n hooks: Array<{ type: \"command\"; command: string }>;\n}\n\n/** Rendered `[mcp_servers.<id>]` table — string env table, no interpolation. */\ninterface CodexMcpEntry {\n // stdio transport\n command?: string;\n args?: string[];\n env?: Record<string, string>;\n // streamable HTTP transport (remote): codex infers the transport from `url`\n // (no explicit transport key). Verified against codex-cli 0.139.0.\n url?: string;\n bearer_token_env_var?: string;\n http_headers?: Record<string, string>;\n}\n\n/**\n * Codex hook events agent-connector registers, in the canonical → native order.\n * Codex uses the same PascalCase event names as Claude Code; the home-binary\n * hook command receives the lowercased event token.\n */\nconst CODEX_HOOK_EVENTS = [\n \"SessionStart\",\n \"PreToolUse\",\n \"PostToolUse\",\n \"PreCompact\",\n \"UserPromptSubmit\",\n \"Stop\",\n \"PermissionRequest\",\n \"SubagentStart\",\n \"SubagentStop\",\n \"PostCompact\",\n] as const;\n\ntype CodexHookEventName = (typeof CODEX_HOOK_EVENTS)[number];\n\n/**\n * Newer canonical events with NO Codex analog: Codex ships PostToolUse only —\n * there is no failure event on the live hooks page. Declared hooks for these\n * warn-skip at install so the degradation is reported, never silent. (The\n * legacy SessionEnd / Notification silent filter predates this convention and\n * is deliberately left untouched.)\n */\nconst WARN_SKIP_EVENTS: ReadonlySet<HookEventName> = new Set([\"PostToolUseFailure\"]);\n\n/**\n * PreToolUse matcher — canonical Codex tool names + bare MCP tool names +\n * external MCP catch-all literal. Charset-clean ([A-Za-z0-9_|] only) so Codex's\n * Rust `regex` exact-matcher short-circuits (no look-around, which Codex\n * rejects at boot). Copied from context-mode's proven matcher.\n */\nconst PRE_TOOL_USE_MATCHER =\n \"local_shell|shell|shell_command|exec_command|Bash|Shell|apply_patch|Edit|Write|grep_files|mcp__\";\n\n// ─────────────────────────────────────────────────────────────────────────\n// Adapter\n// ─────────────────────────────────────────────────────────────────────────\n\nexport class CodexAdapter extends BaseAdapter {\n readonly id: PlatformId = \"codex\";\n readonly name = \"Codex CLI\";\n readonly paradigm: HookParadigm = \"json-stdio\";\n\n readonly capabilities: PlatformCapabilities = {\n // Memory surface: AGENTS.md-first managed block. memoryTargets below probes\n // AGENTS.override.md first (it shadows AGENTS.md per directory on codex).\n supportsMemory: true,\n preToolUse: true,\n postToolUse: true,\n preCompact: true,\n sessionStart: true,\n sessionEnd: false,\n userPromptSubmit: true,\n stop: true,\n notification: false,\n // E1 events: PermissionRequest (decision-capable) + SubagentStart/Stop are\n // Codex-native. postToolUseFailure stays unset — Codex has no failure event,\n // so a declared hook for it warn-skips at install.\n permissionRequest: true,\n subagentStart: true,\n subagentStop: true,\n // PostCompact: Codex's hook system fires both PreCompact and PostCompact\n // (developers.openai.com/codex/hooks). Observational only — the reply\n // contract mirrors PreCompact (cannot block/modify a completed compaction).\n postCompact: true,\n canModifyArgs: false,\n canModifyOutput: false,\n canInjectSessionContext: true,\n transports: [\"stdio\", \"http\"],\n // Content surfaces: Codex implements all three.\n // command → ~/.codex/prompts/<name>.md (md+frontmatter, USER SCOPE ONLY)\n // skill → project: .codex/skills/<name>/SKILL.md · user: ~/.agents/skills/<name>/SKILL.md\n // subagent → <codexDir>/agents/<name>.toml (TOML)\n supportsCommands: true,\n supportsSkills: true,\n supportsSubagents: true,\n };\n\n // ── Detection ──────────────────────────────────────────────────────────\n\n detectInstalled(projectDir: string): DetectedPlatform {\n const userDir = this.userConfigDir();\n const projDir = join(projectDir, \".codex\");\n const userCfg = join(userDir, \"config.toml\");\n const projCfg = join(projDir, \"config.toml\");\n\n const userInstalled = existsSync(userDir) || existsSync(userCfg);\n const projInstalled = existsSync(projDir) || existsSync(projCfg);\n const installed = userInstalled || projInstalled;\n const scope = projInstalled && !userInstalled ? \"project\" : \"user\";\n const configPath = scope === \"project\" ? projCfg : userCfg;\n\n return {\n id: this.id,\n name: this.name,\n installed,\n paradigm: this.paradigm,\n capabilities: this.capabilities,\n configPath,\n scope,\n reason: installed\n ? `Found Codex config dir (${scope})`\n : `No .codex config dir at ${userDir} or ${projDir}`,\n confidence: installed ? \"high\" : \"low\",\n };\n }\n\n // ── Native paths ───────────────────────────────────────────────────────\n\n override getConfigDir(ctx: InstallContext): string {\n if (ctx.scope === \"project\") return join(ctx.projectDir, \".codex\");\n return this.userConfigDir();\n }\n\n override getServerConfigPath(ctx: InstallContext): string {\n return join(this.getConfigDir(ctx), \"config.toml\");\n }\n\n override getHookConfigPath(ctx: InstallContext): string {\n return join(this.getConfigDir(ctx), \"hooks.json\");\n }\n\n // ── Memory surface: AGENTS.override.md probe + 32 KiB doc-cap budget ─────\n // Codex reads AGENTS.override.md > AGENTS.md per directory (one file per\n // directory), so when the override file exists OUR block must live there or\n // it is never loaded. Combined project docs are capped at 32 KiB\n // (`project_doc_max_bytes`), hence the ~28 KiB per-file budget warn.\n protected override memoryTargets(ctx: InstallContext): MemoryTarget[] {\n // An explicit path override keeps the base resolution (escape hatch wins).\n if (this.memoryOverride(ctx)?.path) return super.memoryTargets(ctx);\n if (ctx.scope !== \"project\" && ctx.scope !== \"user\") return [];\n const budgetBytes = 28 * 1024;\n const dir = ctx.scope === \"project\" ? ctx.projectDir : this.userConfigDir();\n const overrideMd = join(dir, \"AGENTS.override.md\");\n if (existsSync(overrideMd)) {\n return [\n {\n path: overrideMd,\n reason: \"AGENTS.override.md shadows AGENTS.md on codex (one doc per directory)\",\n budgetBytes,\n },\n ];\n }\n return [\n {\n path: join(dir, \"AGENTS.md\"),\n reason:\n ctx.scope === \"project\"\n ? \"AGENTS.md standard (project root; codex is the format's originator)\"\n : \"codex global guidance ($CODEX_HOME/AGENTS.md)\",\n budgetBytes,\n },\n ];\n }\n\n /** `$CODEX_HOME` || `~/.codex` for user scope. */\n private userConfigDir(): string {\n const env = process.env.CODEX_HOME;\n if (env && env.trim() !== \"\") {\n if (env.startsWith(\"~\")) {\n return join(homedir(), env.replace(/^~[/\\\\]?/, \"\"));\n }\n return env;\n }\n return join(homedir(), \".codex\");\n }\n\n // ── TOML config IO (override JSON helpers — config.toml is TOML) ─────────\n\n private readToml(path: string): Record<string, unknown> {\n if (!existsSync(path)) return {};\n try {\n return TOML.parse(readFileSync(path, \"utf8\")) as Record<string, unknown>;\n } catch {\n return {};\n }\n }\n\n private writeToml(path: string, data: Record<string, unknown>, dryRun: boolean): void {\n if (dryRun) return;\n ensureDir(dirname(path));\n // @iarna/toml's stringify type wants its JsonMap; our object is structurally compatible.\n writeFileSync(path, TOML.stringify(data as never), \"utf8\");\n }\n\n /** An ObjectMapCodec over config.toml for the core/object-map engine.\n * `isPresentButUnparseable` is `() => false`: readToml fail-softs to {} and the\n * server path has historically coerced/overwritten rather than warn-skip on an\n * unparseable file — preserved here for byte-identical behavior. */\n private tomlObjectMapCodec(): ObjectMapCodec {\n return {\n parse: (path) => this.readToml(path),\n serialize: (path, data, dryRun) => this.writeToml(path, data, dryRun),\n isPresentButUnparseable: () => false,\n };\n }\n\n // ── Install server (config.toml → [mcp_servers.<id>]) ───────────────────\n\n override installServer(ctx: InstallContext): ChangeRecord[] {\n const { connector, dryRun } = ctx;\n const server = this.effectiveServer(ctx);\n const path = this.getServerConfigPath(ctx);\n\n if (!server) {\n return [{ platform: this.id, action: \"skip\", path, detail: \"no server declared\" }];\n }\n const isStdio = server.transport === \"stdio\" && !!server.command;\n const isHttp = server.transport === \"http\" && !!server.url;\n if (!isStdio && !isHttp) {\n // Codex config.toml [mcp_servers] supports stdio (command) + streamable\n // HTTP (url). Other remote transports (sse/ws) have no codex analog.\n return [\n {\n platform: this.id,\n action: \"skip\",\n path,\n detail: `transport \"${server.transport}\" not registrable in config.toml (stdio + streamable-http only)`,\n },\n ];\n }\n\n const entry = this.renderMcpEntry(ctx, server);\n\n return [\n upsertInObjectMap({\n codec: this.tomlObjectMapCodec(),\n rootKey: \"mcp_servers\",\n policy: \"coerce\",\n platform: this.id,\n configPath: path,\n entryId: connector.id,\n entry,\n dryRun,\n }),\n ];\n }\n\n override uninstallServer(ctx: InstallContext): ChangeRecord[] {\n const { connector, dryRun } = ctx;\n const path = this.getServerConfigPath(ctx);\n return [\n removeFromObjectMap({\n codec: this.tomlObjectMapCodec(),\n rootKey: \"mcp_servers\",\n policy: \"coerce\",\n platform: this.id,\n configPath: path,\n entryId: connector.id,\n dryRun,\n }),\n ];\n }\n\n // ── Install hooks (hooks.json) ──────────────────────────────────────────\n\n override installHooks(ctx: InstallContext): ChangeRecord[] {\n const path = this.getHookConfigPath(ctx);\n const events = this.effectiveHookEvents(ctx);\n const dropped = this.warnSkipHookEvents(ctx);\n\n if (events.length === 0 && dropped.length === 0) {\n return [{ platform: this.id, action: \"skip\", path, detail: \"no hooks declared\" }];\n }\n\n // HOST-ORDERED pending: warn-skip events (mapEvent → undefined → warn) FIRST,\n // then the supported events in CODEX_HOOK_EVENTS order. Events neither\n // supported nor in WARN_SKIP_EVENTS are never enqueued → silently dropped, as\n // before. matcher is \"\" for every item; renderEntry derives the real matcher\n // from the event (PreToolUse/PermissionRequest), never from this field.\n const pending = [\n ...dropped.map((event) => ({ event: event as string, matcher: \"\" })),\n ...events.map((event) => ({ event: event as string, matcher: \"\" })),\n ];\n return this.upsertHookEntries(ctx, path, pending, this.hookDescriptor(ctx));\n }\n\n override uninstallHooks(ctx: InstallContext): ChangeRecord[] {\n return this.removeHookEntries(ctx, this.getHookConfigPath(ctx), this.hookDescriptor(ctx));\n }\n\n /**\n * Codex hook-merge policy for the shared object-map engine. EVENT-SPECIFIC by\n * construction: every observable (coerce root + bucket, the path-normalized\n * per-event ownership find, the event-derived matcher with `hooks`-then-\n * `matcher` key order, the BARE `hooks.<event>` skip/remove details with NO\n * count, the warn wording, and the absent/no-match skips) is carried here so\n * the engine reproduces the prior in-adapter loop byte-for-byte.\n */\n private hookDescriptor(ctx: InstallContext): HookMergeDescriptor<CodexHookEntry> {\n return {\n // Codex's server path coerces a malformed root; the hook path matches it.\n malformedPolicy: \"coerce\",\n // Supported event → identity; a WARN_SKIP event (PostToolUseFailure, which\n // is the only thing `dropped` ever contains) → undefined → warn.\n mapEvent: (e) =>\n (CODEX_HOOK_EVENTS as readonly string[]).includes(e) ? e : undefined,\n unmappedWarnDetail: (e) => `${e} has no Codex hook equivalent — skipped`,\n renderEntry: (event, _matcher, command) => {\n const entry: CodexHookEntry = { hooks: [{ type: \"command\", command }] };\n // KEY ORDER: hooks THEN matcher. Matcher is EVENT-derived, not from the\n // connector's declared matcher: PermissionRequest matches tool names like\n // PreToolUse (charset-clean), everything else registers \"\" (all).\n entry.matcher =\n event === \"PreToolUse\" || event === \"PermissionRequest\" ? PRE_TOOL_USE_MATCHER : \"\";\n return entry;\n },\n // Idempotency find for the CANONICAL event the engine built `command` from —\n // path-normalized, exact-command, the body of isOurEntry's command check.\n entryOwnsCommand: (entry, command) =>\n Array.isArray(entry.hooks) &&\n entry.hooks.some(\n (h) => (h.command ?? \"\").replace(/\\\\/g, \"/\") === command.replace(/\\\\/g, \"/\"),\n ),\n // FLAT whole-entry removal, EVENT-SPECIFIC: isOurEntry rebuilds our command\n // from the event key being stripped, so a SubagentStop entry is never matched\n // while iterating the PreToolUse bucket.\n ownsEntryForRemove: (c, event) => (entry) =>\n this.isOurEntry(c, event as CodexHookEventName, entry),\n skipDetail: (e) => `hooks.${e}`,\n removeDetail: (e, _n) => `hooks.${e}`,\n absentDetail: \"no hooks.json\",\n noMatchDetail: \"no agent-connector hooks present\",\n // Uninstall scans EXACTLY codex's fixed event set (not Object.keys), so a\n // home-bin command hand-placed under a foreign event key is left untouched —\n // byte-identical to the prior `for (const event of CODEX_HOOK_EVENTS)` loop.\n removeEventKeys: CODEX_HOOK_EVENTS,\n };\n }\n\n // ── Health checks (default doctor renders these) ────────────────────────\n\n override getHealthChecks(ctx: InstallContext): readonly HealthCheck[] {\n const path = this.getServerConfigPath(ctx);\n const id = ctx.connector.id;\n const checks: HealthCheck[] = [\n {\n name: `${this.name}: config.toml exists`,\n check: () =>\n existsSync(path)\n ? { status: \"OK\", detail: path }\n : { status: \"FAIL\", detail: `not found: ${path}` },\n },\n {\n name: `${this.name}: mcp_servers.${id} registered`,\n check: () => {\n // Only assert what the connector declares (same rule as the\n // content-surface checks below): a server-less connector — e.g. a\n // catalog-only bundle of agents/skills/commands — never writes an\n // [mcp_servers.<id>] table, so its absence is healthy.\n if (!ctx.connector.server) {\n return { status: \"OK\", detail: \"no MCP server declared\" };\n }\n const cfg = this.readToml(path);\n const bucket = cfg[\"mcp_servers\"];\n const present =\n typeof bucket === \"object\" &&\n bucket !== null &&\n id in (bucket as Record<string, unknown>);\n return present\n ? { status: \"OK\", detail: `mcp_servers.${id}` }\n : { status: \"FAIL\", detail: `mcp_servers.${id} not found in ${path}` };\n },\n },\n ];\n\n // Content-surface checks: assert presence only for surfaces this connector\n // declares. Codex commands are user-scope only, so a project-scope install\n // won't have written them — only check command files in user scope.\n if (ctx.scope !== \"project\") {\n for (const cmd of ctx.connector.commands) {\n const p = this.commandPath(cmd.name);\n checks.push({\n name: `${this.name}: command ${cmd.name} present`,\n check: () =>\n existsSync(p) ? { status: \"OK\", detail: p } : { status: \"FAIL\", detail: `not found: ${p}` },\n });\n }\n }\n for (const skill of ctx.connector.skills) {\n const p = join(this.skillDir(ctx, skill.name), \"SKILL.md\");\n checks.push({\n name: `${this.name}: skill ${skill.name} present`,\n check: () =>\n existsSync(p) ? { status: \"OK\", detail: p } : { status: \"FAIL\", detail: `not found: ${p}` },\n });\n }\n for (const agent of ctx.connector.subagents) {\n const p = this.subagentPath(ctx, agent.name);\n checks.push({\n name: `${this.name}: subagent ${agent.name} present`,\n check: () =>\n existsSync(p) ? { status: \"OK\", detail: p } : { status: \"FAIL\", detail: `not found: ${p}` },\n });\n }\n return checks;\n }\n\n // ── Content surfaces: commands / skills / subagents ──────────────────────\n // CONTENT-ONLY: pure native-file writers. No runtime dispatch, no home-bin\n // pointer, no telemetry wrap. Each method is idempotent (byte-identical →\n // skip) via writeContentFile and reversible via removeContentFile. Honors\n // platforms[\"codex\"] per-surface false to skip.\n //\n // Native locations:\n // command → ~/.codex/prompts/<name>.md md+frontmatter(description,argument-hint)\n // USER SCOPE ONLY — project scope yields a single \"warn\".\n // skill → project: <projectDir>/.codex/skills/<name>/SKILL.md (+ resources)\n // user: ~/.agents/skills/<name>/SKILL.md (~/.codex/skills is deprecated)\n // subagent → <codexDir>/agents/<name>.toml TOML via writeTomlString\n\n /** Command files always live under the USER codex dir: ~/.codex/prompts. */\n private commandPath(name: string): string {\n return join(this.userConfigDir(), \"prompts\", `${name}.md`);\n }\n private skillDir(ctx: InstallContext, name: string): string {\n // Project scope: <projectDir>/.codex/skills/<name> — the Project config-layer\n // skills root (codex-rs/core-skills/src/loader.rs, ConfigLayerSource::Project),\n // NOT deprecated. User scope: $HOME/.agents/skills/<name> — codex's CURRENT\n // user skills root. The older $CODEX_HOME/skills (~/.codex/skills) is still\n // read but the loader labels it a \"Deprecated user skills location, kept for\n // backward compatibility\". .agents is anchored to the OS home (home_dir), NOT\n // $CODEX_HOME — so use homedir() here, never userConfigDir() (which honors\n // CODEX_HOME).\n if (ctx.scope === \"project\") return join(this.getConfigDir(ctx), \"skills\", name);\n return join(homedir(), \".agents\", \"skills\", name);\n }\n private subagentPath(ctx: InstallContext, name: string): string {\n return join(this.getConfigDir(ctx), \"agents\", `${name}.toml`);\n }\n\n // ── Commands (USER SCOPE ONLY) ───────────────────────────────────────────\n\n override installCommands(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[this.id]?.commands === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"commands disabled for codex\" }];\n }\n if (ctx.scope === \"project\") {\n return [{ platform: this.id, action: \"warn\", detail: \"codex commands are user-scope only\" }];\n }\n if (connector.commands.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no commands\" }];\n }\n return connector.commands.map((cmd) =>\n this.writeContentFile(this.commandPath(cmd.name), this.renderCommand(cmd), ctx.dryRun),\n );\n }\n\n override uninstallCommands(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (ctx.scope === \"project\") {\n return [{ platform: this.id, action: \"warn\", detail: \"codex commands are user-scope only\" }];\n }\n if (connector.commands.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no commands\" }];\n }\n return connector.commands.map((cmd) =>\n this.removeContentFile(this.commandPath(cmd.name), ctx.dryRun),\n );\n }\n\n /** Render a command to md+frontmatter (description, argument-hint). */\n private renderCommand(cmd: CommandDef): string {\n const frontmatter: Record<string, unknown> = {};\n if (cmd.description !== undefined) frontmatter.description = cmd.description;\n if (cmd.argumentHint !== undefined) frontmatter[\"argument-hint\"] = cmd.argumentHint;\n if (cmd.extra) Object.assign(frontmatter, cmd.extra);\n return this.renderFrontmatterMd(frontmatter, cmd.prompt);\n }\n\n // ── Skills ───────────────────────────────────────────────────────────────\n\n override installSkills(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[this.id]?.skills === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"skills disabled for codex\" }];\n }\n if (connector.skills.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no skills\" }];\n }\n const changes: ChangeRecord[] = [];\n for (const skill of connector.skills) {\n const dir = this.skillDir(ctx, skill.name);\n const rendered = this.renderSkill(skill);\n changes.push(this.writeContentFile(join(dir, \"SKILL.md\"), rendered, ctx.dryRun));\n // Bundle any resource files beside SKILL.md (relative path → contents).\n // Defense-in-depth: skip+warn on any key that escapes the skill dir\n // (config-time validation already rejects these, but never trust input).\n for (const [rel, contents] of Object.entries(skill.resources ?? {})) {\n const target = this.resolveWithin(dir, rel);\n if (target === null) {\n changes.push({\n platform: this.id,\n action: \"warn\",\n detail: `skill resource \"${rel}\" escapes the skill dir; skipped`,\n });\n continue;\n }\n changes.push(this.writeContentFile(target, contents, ctx.dryRun));\n }\n // Migrate away an AC-owned copy at the deprecated user skills root so the\n // skill is not double-registered after the move to ~/.agents/skills.\n changes.push(...this.migrateDeprecatedUserSkill(ctx, skill, rendered));\n }\n return changes;\n }\n\n /**\n * One-time, opt-out-safe migration: prior AC versions wrote user-scope skills\n * to the now-deprecated $CODEX_HOME/skills/<name> root, which codex STILL reads\n * (kept for backward compatibility). Once we write the same skill to the current\n * ~/.agents/skills root, codex would register it TWICE (same frontmatter name,\n * two User-scope roots). If a SKILL.md exists at the deprecated path AND is\n * byte-identical to what we render — i.e. AC-owned, not hand-authored — remove\n * it (and its now-empty dir). The content-equality guard guarantees we never\n * delete a skill a user placed there by hand. No-op for project scope (where\n * .codex/skills is the valid, non-deprecated Project config-layer path) and when\n * a custom CODEX_HOME would make the deprecated path coincide with the new one.\n */\n private migrateDeprecatedUserSkill(\n ctx: InstallContext,\n skill: SkillDef,\n rendered: string,\n ): ChangeRecord[] {\n if (ctx.scope === \"project\") return [];\n const deprecated = join(this.userConfigDir(), \"skills\", skill.name, \"SKILL.md\");\n // Never touch the file we just wrote (pathological CODEX_HOME === ~/.agents).\n if (deprecated === join(this.skillDir(ctx, skill.name), \"SKILL.md\")) return [];\n if (!existsSync(deprecated)) return [];\n if (readFileSync(deprecated, \"utf8\") !== rendered) return []; // hand-authored — leave it\n return [\n this.removeContentFile(deprecated, ctx.dryRun),\n this.removeDirIfEmpty(dirname(deprecated), ctx.dryRun),\n ];\n }\n\n override uninstallSkills(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.skills.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no skills\" }];\n }\n const changes: ChangeRecord[] = [];\n for (const skill of connector.skills) {\n const dir = this.skillDir(ctx, skill.name);\n // Remove only the files we wrote (SKILL.md + declared resources), then the\n // skill dir itself when we own its full contents.\n changes.push(this.removeContentFile(join(dir, \"SKILL.md\"), ctx.dryRun));\n for (const rel of Object.keys(skill.resources ?? {})) {\n const target = this.resolveWithin(dir, rel);\n if (target === null) continue; // never delete outside the skill dir\n changes.push(this.removeContentFile(target, ctx.dryRun));\n }\n // Only remove the skill dir when WE own its full contents — never rm -rf a\n // dir that still holds user-added / sibling-tool / shared files.\n changes.push(this.removeDirIfEmpty(dir, ctx.dryRun));\n }\n return changes;\n }\n\n /**\n * Render a skill's SKILL.md: frontmatter (name, description + optional model,\n * allowed-tools, disable-model-invocation) + body. UNIFORM with every other\n * skill-supporting platform — only the parent dir differs.\n */\n private renderSkill(skill: SkillDef): string {\n const frontmatter: Record<string, unknown> = {\n name: skill.name,\n description: skill.description,\n };\n if (skill.model !== undefined) frontmatter.model = skill.model;\n const allow = skill.tools?.allow;\n if (allow && allow.length > 0) frontmatter[\"allowed-tools\"] = allow.join(\", \");\n if (skill.disableModelInvocation !== undefined) {\n frontmatter[\"disable-model-invocation\"] = skill.disableModelInvocation;\n }\n if (skill.extra) Object.assign(frontmatter, skill.extra);\n return this.renderFrontmatterMd(frontmatter, skill.body);\n }\n\n // ── Subagents (TOML) ─────────────────────────────────────────────────────\n\n override installSubagents(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[this.id]?.subagents === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"subagents disabled for codex\" }];\n }\n if (connector.subagents.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no subagents\" }];\n }\n return connector.subagents.map((agent) =>\n this.writeContentFile(this.subagentPath(ctx, agent.name), this.renderSubagent(agent), ctx.dryRun),\n );\n }\n\n override uninstallSubagents(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.subagents.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no subagents\" }];\n }\n return connector.subagents.map((agent) =>\n this.removeContentFile(this.subagentPath(ctx, agent.name), ctx.dryRun),\n );\n }\n\n /**\n * Render a subagent to a Codex agent TOML file:\n * { name, description, developer_instructions: prompt, model }.\n * model is omitted when undefined so Codex applies its default.\n */\n private renderSubagent(agent: SubagentDef): string {\n const table: Record<string, unknown> = {\n name: agent.name,\n description: agent.description,\n developer_instructions: agent.prompt,\n };\n if (agent.model !== undefined) table.model = agent.model;\n if (agent.extra) Object.assign(table, agent.extra);\n return writeTomlString(table);\n }\n\n // ── Runtime dispatch ────────────────────────────────────────────────────\n\n parseEvent(event: HookEventName, raw: unknown): NormalizedEvent {\n const input = (raw ?? {}) as CodexHookInput;\n const base = {\n hostPlatform: this.id,\n connectorId: \"\",\n sessionId: input.session_id ?? `pid-${process.ppid}`,\n projectDir: input.cwd ?? process.env.CODEX_PROJECT_DIR ?? process.cwd(),\n raw,\n };\n\n switch (event) {\n case \"PreToolUse\":\n return {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n };\n case \"PostToolUse\":\n return {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n toolOutput: input.tool_response,\n isError: input.is_error ?? false,\n };\n case \"SessionStart\":\n return { ...base, source: this.normalizeSource(input.source) };\n case \"SessionEnd\":\n return { ...base, reason: input.message };\n case \"UserPromptSubmit\":\n return { ...base, prompt: input.prompt ?? \"\" };\n case \"PreCompact\":\n return { ...base, trigger: input.trigger === \"manual\" ? \"manual\" : \"auto\" };\n case \"PostCompact\":\n // Post-compaction sibling of PreCompact — same `trigger` normalization\n // (manual|auto), observe-only. Codex's PostCompact payload mirrors\n // PreCompact's; everything else rides on `raw`.\n return { ...base, trigger: input.trigger === \"manual\" ? \"manual\" : \"auto\" };\n case \"Stop\":\n return { ...base, stopHookActive: input.stop_hook_active ?? false };\n case \"Notification\":\n return { ...base, message: input.message ?? \"\" };\n case \"PermissionRequest\":\n // Codex documents tool_name/tool_input (+tool_input.description); it has\n // no permission_suggestions field, so the normalized optional stays unset.\n return {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n };\n case \"PostToolUseFailure\":\n // No Codex analog — never fired natively. Parsed defensively (Claude-\n // compatible wire) so a manual `hook codex PostToolUseFailure` invocation\n // still normalizes instead of throwing.\n return {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n error: input.error ?? \"\",\n };\n case \"SubagentStart\":\n return {\n ...base,\n ...(typeof input.agent_id === \"string\" ? { agentId: input.agent_id } : {}),\n ...(typeof input.agent_type === \"string\" ? { agentType: input.agent_type } : {}),\n };\n case \"SubagentStop\":\n // agent_id/agent_type stay optional — never depend on hosts populating\n // them on stop (the Claude-family SDK quirk).\n return {\n ...base,\n ...(typeof input.agent_id === \"string\" ? { agentId: input.agent_id } : {}),\n ...(typeof input.agent_type === \"string\" ? { agentType: input.agent_type } : {}),\n ...(typeof input.agent_transcript_path === \"string\"\n ? { agentTranscriptPath: input.agent_transcript_path }\n : {}),\n ...(typeof input.last_assistant_message === \"string\"\n ? { lastAssistantMessage: input.last_assistant_message }\n : {}),\n ...(typeof input.stop_hook_active === \"boolean\"\n ? { stopHookActive: input.stop_hook_active }\n : {}),\n };\n }\n }\n\n formatReply(event: HookEventName, response: HookResponse): HookReply {\n // Codex (like Claude Code) reads a `hookSpecificOutput` JSON wrapper from\n // stdout; exit code 0 = allow. Fields the host cannot honor are dropped.\n\n // PermissionRequest uses Codex's nested decision{behavior} envelope and is\n // the ONE event where an EXPLICIT \"allow\" is an ACTIVE grant (suppresses the\n // approval prompt). ask/context/void → NO decision output: fall through to\n // the normal approval flow (the prompt IS the ask). Codex docs: updatedInput\n // / updatedPermissions / interrupt FAIL CLOSED on this event, so \"modify\"\n // also falls through — emitting a bare allow would grant the ORIGINAL input\n // the handler wanted rewritten.\n if (event === \"PermissionRequest\") {\n if (response.decision === \"deny\") {\n return {\n exitCode: 0,\n stdout: JSON.stringify({\n hookSpecificOutput: {\n hookEventName: \"PermissionRequest\",\n decision: {\n behavior: \"deny\",\n message: response.reason ?? \"Blocked by hook\",\n },\n },\n }),\n };\n }\n if (response.decision === \"allow\") {\n return {\n exitCode: 0,\n stdout: JSON.stringify({\n hookSpecificOutput: {\n hookEventName: \"PermissionRequest\",\n decision: { behavior: \"allow\" },\n },\n }),\n };\n }\n return { exitCode: 0 };\n }\n\n // SubagentStart is observe/context-only on Codex (continue:false is parsed\n // but does not stop the subagent): \"context\" injects additionalContext as\n // developer context for the SUBAGENT, and a \"deny\" DEGRADES to the same\n // shape carrying the reason.\n if (event === \"SubagentStart\") {\n const context =\n response.decision === \"context\"\n ? response.additionalContext\n : response.decision === \"deny\"\n ? response.reason ?? response.additionalContext\n : undefined;\n if (context) {\n return {\n exitCode: 0,\n stdout: JSON.stringify({\n hookSpecificOutput: {\n hookEventName: \"SubagentStart\",\n additionalContext: context,\n },\n }),\n };\n }\n return { exitCode: 0 };\n }\n\n if (response.decision === \"deny\") {\n // PreToolUse deny is honored; other events fail-open to allow.\n if (event === \"PreToolUse\") {\n return {\n exitCode: 0,\n stdout: JSON.stringify({\n hookSpecificOutput: {\n hookEventName: \"PreToolUse\",\n permissionDecision: \"deny\",\n permissionDecisionReason: response.reason ?? \"Blocked by hook\",\n },\n }),\n };\n }\n // SubagentStop deny = Stop semantics: the documented continuation shape is\n // the TOP-LEVEL {\"decision\":\"block\",\"reason\"} (keeps the subagent going\n // with `reason` as its next instruction).\n if (event === \"SubagentStop\") {\n return {\n exitCode: 0,\n stdout: JSON.stringify({\n decision: \"block\",\n reason: response.reason ?? \"Blocked by hook\",\n }),\n };\n }\n return { exitCode: 0 };\n }\n\n // Context injection: honored on SessionStart and PostToolUse (additionalContext).\n // (SubagentStop accepts only the common output fields — no additionalContext.)\n if (response.additionalContext && (event === \"SessionStart\" || event === \"PostToolUse\")) {\n return {\n exitCode: 0,\n stdout: JSON.stringify({\n hookSpecificOutput: {\n hookEventName: event,\n additionalContext: response.additionalContext,\n },\n }),\n };\n }\n\n // \"allow\" / unsupported-on-Codex (modify, ask) → passthrough.\n return { exitCode: 0 };\n }\n\n // ── Internal helpers ────────────────────────────────────────────────────\n\n /** Resolve the per-platform server override into an effective ServerDef. */\n private effectiveServer(ctx: InstallContext): ServerDef | undefined {\n const override = ctx.connector.platforms[this.id]?.server;\n if (override === false) return undefined;\n const base = ctx.connector.server;\n if (!base) return undefined;\n return override ? { ...base, ...override } : base;\n }\n\n /** Which canonical hook events to register for Codex, honoring overrides. */\n private effectiveHookEvents(ctx: InstallContext): CodexHookEventName[] {\n const override = ctx.connector.platforms[this.id]?.hooks;\n if (override === false) return [];\n return CODEX_HOOK_EVENTS.filter((e) => ctx.connector.hookEvents.includes(e));\n }\n\n /** Declared events Codex has no analog for — install reports a warn-skip. */\n private warnSkipHookEvents(ctx: InstallContext): HookEventName[] {\n const override = ctx.connector.platforms[this.id]?.hooks;\n if (override === false) return [];\n return ctx.connector.hookEvents.filter((e) => WARN_SKIP_EVENTS.has(e));\n }\n\n /**\n * Render the `[mcp_servers.<id>]` table. TOML has NO interpolation, so every\n * `${env:VAR}` is resolved to a literal at install time. The env table is a\n * plain string→string map. Honors the telemetry serve-wrapper.\n */\n private renderMcpEntry(ctx: InstallContext, server: ServerDef): CodexMcpEntry {\n // Streamable HTTP server: codex infers the transport from `url` (no explicit\n // transport key). VERIFIED against codex-cli 0.139.0 — `codex mcp add <id>\n // --url <U> --bearer-token-env-var <E>` writes:\n // [mcp_servers.<id>]\n // url = \"…\"\n // bearer_token_env_var = \"…\" (only with bearerEnv auth)\n // Telemetry serve-wrapping is stdio-only (remote cannot be intercepted).\n // installServer's guard only lets stdio+command or http+url reach here, so\n // this branch is exactly the streamable-HTTP case (lock-step with the guard).\n if (server.transport === \"http\") {\n const remote: CodexMcpEntry = { url: resolveEnvRefsDeep(server.url ?? \"\") };\n if (server.auth?.type === \"bearerEnv\" && server.auth.bearerEnvVar) {\n remote.bearer_token_env_var = server.auth.bearerEnvVar;\n }\n if (server.headers && Object.keys(server.headers).length > 0) {\n const headers: Record<string, string> = {};\n for (const [k, v] of Object.entries(resolveEnvRefsDeep(server.headers))) {\n headers[k] = String(v);\n }\n remote.http_headers = headers;\n }\n return remote;\n }\n let command = server.command as string;\n let args = [...(server.args ?? [])];\n\n if (shouldWrapForTelemetry(server, ctx.connector.telemetry)) {\n const wrapped = buildServeWrapperCommand(ctx.homeBinPath, ctx.connector.id, command, args, ctx.scope, this.id);\n command = wrapped.command;\n args = wrapped.args;\n }\n\n // Resolve env-refs to literals (TOML cannot interpolate).\n command = resolveEnvRefsDeep(command);\n args = resolveEnvRefsDeep(args);\n\n const entry: CodexMcpEntry = { command };\n if (args.length > 0) entry.args = args;\n\n if (server.env && Object.keys(server.env).length > 0) {\n const env: Record<string, string> = {};\n for (const [k, v] of Object.entries(resolveEnvRefsDeep(server.env))) {\n env[k] = String(v);\n }\n entry.env = env;\n }\n return entry;\n }\n\n /**\n * Does this hooks.json entry belong to this connector for `event`? EVENT-\n * SPECIFIC + path-normalized exact-command match. The engine binds this per\n * event in the uninstall (whole-entry FLAT removal) and the install idempotency\n * find reuses its command body via the descriptor's entryOwnsCommand.\n */\n private isOurEntry(ctx: InstallContext, event: CodexHookEventName, entry: CodexHookEntry): boolean {\n if (!entry || typeof entry !== \"object\" || !Array.isArray(entry.hooks)) return false;\n const ours = buildHomeBinHookCommand(ctx.homeBinPath, \"codex\", event, ctx.connector.id);\n const needle = ours.replace(/\\\\/g, \"/\");\n return entry.hooks.some((h) => (h.command ?? \"\").replace(/\\\\/g, \"/\") === needle);\n }\n\n private normalizeSource(raw: string | undefined): \"startup\" | \"compact\" | \"resume\" | \"clear\" {\n switch (raw) {\n case \"compact\":\n return \"compact\";\n case \"resume\":\n return \"resume\";\n case \"clear\":\n return \"clear\";\n default:\n return \"startup\";\n }\n }\n}\n\nexport const adapter = new CodexAdapter();\nexport default adapter;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAqCA,SAAS,YAAY,cAAc,qBAAqB;AACxD,SAAS,eAAe;AACxB,SAAS,SAAS,YAAY;AAE9B,OAAO,UAAU;A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";
6
6
  import {
7
7
  extractSessionId,
8
8
  toolResponseToString
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-DBQMX75U.js";
13
13
  import {
14
14
  BaseAdapter
15
- } from "./chunk-CPLK7GTE.js";
15
+ } from "./chunk-PFDUGDOA.js";
16
16
  import "./chunk-7L6ITC4T.js";
17
17
  import {
18
18
  buildHomeBinHookCommand,
@@ -371,6 +371,8 @@ var ContinueAdapter = class extends BaseAdapter {
371
371
  }
372
372
  const hookPath = this.getHookConfigPath(ctx);
373
373
  const file = this.readJson(hookPath) ?? {};
374
+ const __skip = this.malformedHookRootSkip(hookPath, file.hooks);
375
+ if (__skip) return [__skip];
374
376
  const hooks = file.hooks ??= {};
375
377
  const changes = [];
376
378
  let mutated = false;
@@ -787,4 +789,4 @@ export {
787
789
  adapter,
788
790
  continue_default as default
789
791
  };
790
- //# sourceMappingURL=continue-K43SUHLQ.js.map
792
+ //# sourceMappingURL=continue-W4TU4JSB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/adapters/continue/index.ts"],"sourcesContent":["/**\n * adapters/continue — Continue (the `cn` terminal agent / Continue.dev) adapter.\n *\n * Continue is a **json-stdio** host: its `cn` CLI ships a Claude-Code-COMPATIBLE\n * hooks system (primary-verified — continuedev/continue PR #11029,\n * extensions/cli/src/hooks/{types.ts,hookConfig.ts}). The hooks live in a\n * SEPARATE settings.json file (NOT the YAML config.yaml that holds MCP servers),\n * so getServerConfigPath ≠ getHookConfigPath:\n *\n * - MCP servers → config.yaml `mcpServers` (a YAML ARRAY — see below). UNCHANGED.\n * - Hooks → settings.json under `hooks`, keyed by PascalCase event name,\n * each value an array of { matcher?, hooks:[{ type:\"command\",\n * command }] } — BYTE-IDENTICAL to Claude Code's shape.\n *\n * Hook config path (hookConfig.ts getSettingsFilePaths):\n * - user-global → ~/.continue/settings.json (honor CONTINUE_GLOBAL_DIR env if\n * set, else ~/.continue);\n * - project → <projectDir>/.continue/settings.json.\n *\n * Supported events (continue's HOOK_EVENT_NAMES ∩ AC canonical): PreToolUse,\n * PostToolUse, PostToolUseFailure, UserPromptSubmit, SessionStart, SessionEnd,\n * Stop, Notification, SubagentStart, SubagentStop, PermissionRequest, PreCompact\n * — all PascalCase 1:1 with the canonical name. Continue has NO PostCompact (not\n * in HOOK_EVENT_NAMES), so that one warn-skips at install.\n *\n * Continue's HOOK_EVENT_NAMES ALSO carries five host-specific events with no\n * canonical analog (ConfigChange, TeammateIdle, TaskCompleted, WorktreeCreate,\n * WorktreeRemove — each a real HookInput member). They sit below the ≥3-host\n * promotion bar, so they are reachable via the nativeHooks passthrough\n * (supportsNativeHooks: true) rather than the normalized API — the SAME proven\n * pattern as copilot-cli / hermes / jetbrains-copilot.\n *\n * Output contract is Claude-identical (HookOutput): blocking = exit code 2 OR\n * top-level { decision:\"block\", reason }; PreToolUse permission via\n * hookSpecificOutput.permissionDecision (allow|deny|ask) + updatedInput; context\n * injection via hookSpecificOutput.additionalContext; PermissionRequest via the\n * nested decision{ behavior }. So parseEvent/formatReply MIRROR the claude-code\n * adapter exactly (the install layout mirrors droid's separate-hooks-file host).\n *\n * MCP config is YAML (primary-verified — docs.continue.dev/customize/deep-dives/\n * mcp + /reference + /customize/mcp-tools + /guides/cli):\n * - user/global scope → ~/.continue/config.yaml\n * (Windows %USERPROFILE%\\.continue\\config.yaml — covered\n * by homedir())\n * - project scope → <projectDir>/.continue/config.yaml (workspace root)\n *\n * Root key `mcpServers` is a YAML **ARRAY** of server objects (NOT a keyed\n * object/map like the JSON hosts). Each entry:\n * { name (required — the server's display id), command (required for stdio),\n * type? (stdio|sse|streamable-http; defaults to stdio), args? (string[]),\n * env? (map), cwd? (string), url (required for sse/streamable-http remote) }.\n * The connector id is written as the entry's `name`; install is set-if-absent by\n * name (append when missing; leave a present entry untouched unless it differs →\n * update), preserving every sibling entry. Uninstall removes ONLY the entry whose\n * name === connector id.\n *\n * Because the file is YAML, the BaseAdapter JSON helpers do not apply; this\n * adapter merges via core/yaml's readYaml/writeYaml (same lib as goose/hermes),\n * preserving any unrelated config the user authored.\n *\n * NOT primary-verified → deliberately NOT emitted: `apiKey`, `requestOptions`,\n * `connectionTimeout`. Per-server block files (.continue/mcpServers/*.yaml)\n * auto-discovery for the `cn` CLI is also unverified — both scopes use the\n * verified config.yaml `mcpServers` array.\n *\n * Memory / rules (primary-verified — docs.continue.dev/customize/deep-dives/\n * rules): a `.continue/rules` folder at the WORKSPACE ROOT holds `.md` rule\n * files; each carries a YAML frontmatter whose `alwaysApply: true` field makes\n * the rule \"always included, regardless of file context\" (the docs' literal\n * Activation behavior table). AC owns a DEDICATED file there\n * (`.continue/rules/agent-connector.md`) — unlike the cline/amazon-q memory\n * targets (which use the base managed-block engine), this file MUST LEAD with\n * the always-on frontmatter, so we write the WHOLE file (frontmatter + body) via\n * the content-file writers and own it end-to-end (install creates, uninstall\n * deletes). The connector's memory `content` is host-agnostic (no frontmatter of\n * its own — MemoryDef forbids it), so the always-on directive is an adapter-level\n * wrapper, not part of the connector payload. PROJECT SCOPE ONLY (the `cn` CLI's\n * user/global rules directory is not primary-verified → user scope skip-warns).\n */\n\nimport { existsSync, statSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { basename, join } from \"node:path\";\n\nimport { BaseAdapter } from \"../base.js\";\nimport type { Adapter, HookReply, InstallContext, NormalizedEvent } from \"../spi.js\";\nimport type {\n ChangeRecord,\n DetectedPlatform,\n HealthCheck,\n HookEventName,\n HookParadigm,\n HookResponse,\n NotificationEvent,\n PermissionRequestEvent,\n PlatformCapabilities,\n PlatformId,\n PostToolUseEvent,\n PostToolUseFailureEvent,\n PreCompactEvent,\n PreToolUseEvent,\n ServerDef,\n SessionEndEvent,\n SessionStartEvent,\n StopEvent,\n SubagentStartEvent,\n SubagentStopEvent,\n Transport,\n UserPromptSubmitEvent,\n} from \"../../core/types.js\";\nimport { readYaml, writeYaml } from \"../../core/yaml.js\";\nimport { resolveEnvRefsDeep } from \"../../core/interpolate.js\";\nimport {\n buildHomeBinHookCommand,\n buildServeWrapperCommand,\n isHomeBinHookCommand,\n shouldWrapForTelemetry,\n} from \"../../core/spawn.js\";\nimport {\n type ClaudeHookEvent,\n type ClaudeWireInput,\n extractSessionId,\n toolResponseToString,\n} from \"../claude-code/wire.js\";\n\nconst HOST: PlatformId = \"continue\";\n/** Root key under which Continue stores MCP servers in config.yaml — a YAML ARRAY. */\nconst MCP_ROOT_KEY = \"mcpServers\";\n\n/**\n * Canonical events Continue actually fires (continue's HOOK_EVENT_NAMES ∩ the AC\n * canonical set; PR #11029 extensions/cli/src/hooks/types.ts). Names are\n * Claude-identical PascalCase, registered directly. Continue ships PreCompact\n * (PreCompactInput in the HookInput union) but NOT PostCompact — that one\n * warn-skips at install time.\n */\nconst SUPPORTED_EVENTS: ReadonlySet<HookEventName> = new Set<HookEventName>([\n \"PreToolUse\",\n \"PostToolUse\",\n \"PostToolUseFailure\",\n \"UserPromptSubmit\",\n \"SessionStart\",\n \"SessionEnd\",\n \"Stop\",\n \"Notification\",\n \"SubagentStart\",\n \"SubagentStop\",\n \"PermissionRequest\",\n \"PreCompact\",\n]);\n\n/** A single Continue native hook registration entry (Claude-shaped, nested). */\ninterface ContinueHookEntry {\n matcher: string;\n hooks: Array<{ type: \"command\"; command: string }>;\n}\n\n/** The shape of Continue's settings.json (only the parts the hook install touches). */\ninterface ContinueSettingsFile {\n hooks?: Record<string, ContinueHookEntry[]>;\n [key: string]: unknown;\n}\n\n/**\n * Native Continue MCP server entry shapes. `name` is the required display id (we\n * key on it). stdio omits `type` (the documented default); remote emits an\n * explicit `type` + `url` and carries no command. NO apiKey/requestOptions/\n * connectionTimeout (not primary-verified → never emitted).\n */\ninterface ContinueStdioServer {\n name: string;\n command: string;\n args?: string[];\n env?: Record<string, string>;\n cwd?: string;\n}\ninterface ContinueRemoteServer {\n name: string;\n type: \"sse\" | \"streamable-http\";\n url: string;\n}\ntype ContinueServer = ContinueStdioServer | ContinueRemoteServer;\n\nexport class ContinueAdapter extends BaseAdapter implements Adapter {\n readonly id: PlatformId = HOST;\n readonly name = \"Continue\";\n readonly paradigm: HookParadigm = \"json-stdio\";\n\n readonly capabilities: PlatformCapabilities = {\n // Memory surface: WIRED. Continue reads `.continue/rules/*.md` (NOT\n // AGENTS.md), so the AGENTS.md-first BaseAdapter default does not apply — the\n // installMemory/uninstallMemory overrides below write a DEDICATED\n // agent-connector-owned file (<projectDir>/.continue/rules/agent-connector.md)\n // that LEADS with `alwaysApply: true` frontmatter (always-included). Project\n // scope only; user scope skip-warns (no verified user/global rules dir).\n supportsMemory: true,\n //\n // json-stdio: the `cn` CLI ships a Claude-Code-COMPATIBLE hooks system (PR\n // #11029). Every event in HOOK_EVENT_NAMES ∩ canonical fires natively; the\n // names are PascalCase 1:1 with Claude. PreCompact IS in continue's set\n // (PreCompactInput); only PostCompact is absent → that stays false (install\n // warn-skips it).\n preToolUse: true,\n postToolUse: true,\n postToolUseFailure: true,\n preCompact: true,\n sessionStart: true,\n sessionEnd: true,\n userPromptSubmit: true,\n stop: true,\n notification: true,\n subagentStart: true,\n subagentStop: true,\n permissionRequest: true,\n // Continue's PreToolUse output carries updatedInput (HookOutput\n // PreToolUseHookOutput.updatedInput) → it CAN rewrite tool input. It cannot\n // rewrite already-emitted tool output (PostToolUse exposes updatedMCPToolOutput,\n // but — matching the claude-code adapter's conservative stance — we do not\n // wire output rewrite). It honors hookSpecificOutput.additionalContext.\n canModifyArgs: true,\n canModifyOutput: false,\n canInjectSessionContext: true,\n // Continue registers stdio + remote (SSE / Streamable HTTP) MCP servers\n // (primary-verified: type ∈ stdio|sse|streamable-http). Mapped to the\n // framework's transport enum: stdio + sse + http (http = streamable-http).\n transports: [\"stdio\", \"sse\", \"http\"],\n // Native (passthrough) hooks: continue's HOOK_EVENT_NAMES carries five\n // host-specific events with NO canonical analog — ConfigChange, TeammateIdle,\n // TaskCompleted, WorktreeCreate, WorktreeRemove (each a real HookInput\n // member, types.ts:214-241). They sit below the ≥3-host promotion bar, so a\n // connector reaches them via platforms.continue.nativeHooks; installHooks\n // files the event-name key VERBATIM and the generic uninstallHooks reverses\n // it by connector-id ownership (same proven pattern as copilot-cli/hermes/\n // jetbrains-copilot).\n supportsNativeHooks: true,\n // Content surfaces: Continue's Rules/prompts are NOT wired here. Leave the\n // supports* flags UNSET (base skip-warns).\n };\n\n // ── Detection ────────────────────────────────────────────────────────────\n\n detectInstalled(projectDir: string): DetectedPlatform {\n const userDir = this.userConfigDir();\n const userCfg = join(userDir, \"config.yaml\");\n const projCfg = join(projectDir, \".continue\", \"config.yaml\");\n\n const userInstalled = existsSync(userDir) || existsSync(userCfg);\n const projInstalled = existsSync(projCfg);\n const installed = userInstalled || projInstalled;\n const scope = projInstalled && !userInstalled ? \"project\" : \"user\";\n const configPath = scope === \"project\" ? projCfg : userCfg;\n\n return {\n id: this.id,\n name: this.name,\n installed,\n paradigm: this.paradigm,\n capabilities: this.capabilities,\n configPath,\n scope,\n reason: installed\n ? `found Continue config (${scope}) at ${configPath}`\n : `no Continue config at ${userCfg} or ${projCfg}`,\n confidence: installed ? \"high\" : \"low\",\n };\n }\n\n // ── Native paths ─────────────────────────────────────────────────────────\n\n /** ~/.continue (user) or <projectDir>/.continue (project). */\n override getConfigDir(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? join(ctx.projectDir, \".continue\")\n : this.userConfigDir();\n }\n\n /** MCP config: config.yaml under the per-scope .continue dir. */\n override getServerConfigPath(ctx: InstallContext): string {\n return join(this.getConfigDir(ctx), \"config.yaml\");\n }\n\n /**\n * Hooks live in a SEPARATE settings.json (NOT the YAML config.yaml that holds\n * MCP servers): user-global → <CONTINUE_GLOBAL_DIR|~/.continue>/settings.json;\n * project → <projectDir>/.continue/settings.json (hookConfig.ts\n * getSettingsFilePaths). The user-scope dir honors CONTINUE_GLOBAL_DIR exactly\n * as the `cn` CLI's hook loader does — this is INTENTIONALLY independent of\n * getConfigDir/userConfigDir (the MCP path), which the hook env must not perturb.\n */\n override getHookConfigPath(ctx: InstallContext): string {\n const dir =\n ctx.scope === \"project\"\n ? join(ctx.projectDir, \".continue\")\n : process.env.CONTINUE_GLOBAL_DIR || join(homedir(), \".continue\");\n return join(dir, \"settings.json\");\n }\n\n /** ~/.continue — homedir() covers %USERPROFILE% on Windows. */\n private userConfigDir(): string {\n return join(homedir(), \".continue\");\n }\n\n // ── Memory surface: the `.continue/rules` content tree ────────────────────\n // A DEDICATED agent-connector-owned file that MUST LEAD with `alwaysApply:\n // true` frontmatter (always-included). Because of that leading frontmatter we\n // do NOT use the base managed-block engine (it appends a block at EOF and\n // cannot guarantee a leading frontmatter, nor delete a file that retains\n // frontmatter on uninstall) — instead we own the whole file via the\n // content-file writers: install writes/updates it idempotently, uninstall\n // deletes it. PROJECT SCOPE ONLY (the user/global rules dir is unverified).\n\n /** <projectDir>/.continue/rules/agent-connector.md — the dedicated owned file. */\n private memoryFilePath(ctx: InstallContext): string {\n return join(ctx.projectDir, \".continue\", \"rules\", \"agent-connector.md\");\n }\n\n /** True when `<projectDir>/.continue/rules` exists and is a regular FILE. */\n private rulesDirIsFile(ctx: InstallContext): boolean {\n const p = join(ctx.projectDir, \".continue\", \"rules\");\n if (!existsSync(p)) return false;\n try {\n return statSync(p).isFile();\n } catch {\n return false;\n }\n }\n\n /**\n * Compose the dedicated rule file: `alwaysApply: true` frontmatter (the\n * always-on activation directive) + every declared memory entry's content,\n * joined with a blank line. The connector's content is host-agnostic markdown\n * (MemoryDef forbids its own frontmatter), so the directive is ours to add.\n */\n private renderMemoryFile(ctx: InstallContext): string {\n const body = (ctx.connector.memory ?? [])\n .map((m) => m.content.trim())\n .filter((c) => c.length > 0)\n .join(\"\\n\\n\");\n return this.renderFrontmatterMd({ alwaysApply: true }, body);\n }\n\n override installMemory(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n const entries = connector.memory ?? [];\n if (connector.platforms[this.id]?.memory === false) {\n return [{ platform: this.id, action: \"skip\", detail: `memory disabled for ${this.id}` }];\n }\n if (entries.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no memory\" }];\n }\n // Continue's verified rules dir is PROJECT scope only.\n if (ctx.scope !== \"project\") {\n return [\n {\n platform: this.id,\n action: \"warn\",\n detail:\n `no ${ctx.scope}-scope rules dir verified for continue ` +\n `(.continue/rules is project-scope); ${entries.length} skipped`,\n },\n ];\n }\n // Rules-path collision: never write under a `.continue/rules` that is a FILE.\n if (this.rulesDirIsFile(ctx)) {\n return [\n {\n platform: this.id,\n action: \"warn\",\n path: join(ctx.projectDir, \".continue\", \"rules\"),\n detail:\n \"existing .continue/rules is a file, not a directory; left untouched — \" +\n \"convert it to a .continue/rules/ directory to receive agent-connector memory\",\n },\n ];\n }\n return [this.writeContentFile(this.memoryFilePath(ctx), this.renderMemoryFile(ctx), ctx.dryRun)];\n }\n\n override uninstallMemory(ctx: InstallContext): ChangeRecord[] {\n // Only the project-scope dedicated file was ever written; a `.continue/rules`\n // that is a FILE was never ours (installMemory warned), so leave it.\n if (ctx.scope !== \"project\" || this.rulesDirIsFile(ctx)) {\n const path = this.memoryFilePath(ctx);\n return [\n { platform: this.id, action: \"skip\", path, detail: `${basename(path)} absent` },\n ];\n }\n return [this.removeContentFile(this.memoryFilePath(ctx), ctx.dryRun)];\n }\n\n // ── MCP server install / uninstall (YAML — ARRAY merge) ───────────────────\n\n override installServer(ctx: InstallContext): ChangeRecord[] {\n const { connector, dryRun } = ctx;\n const path = this.getServerConfigPath(ctx);\n const server = this.effectiveServer(ctx);\n\n if (!server) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n path,\n detail: connector.server\n ? \"server registration disabled for continue\"\n : \"connector declares no MCP server\",\n },\n ];\n }\n\n const entry = this.renderServerEntry(ctx, server);\n\n // Merge into existing YAML, preserving every other config key + sibling\n // mcpServers entry. mcpServers is a YAML ARRAY; we key on `name`.\n const cfg = readYaml<Record<string, unknown>>(path) ?? {};\n // NEVER clobber a malformed `mcpServers`: if it exists and is not an array,\n // skip-and-warn (symmetric with uninstallServer) rather than silently\n // replacing the user's hand-written value.\n const existingRoot = cfg[MCP_ROOT_KEY];\n if (existingRoot !== undefined && !Array.isArray(existingRoot)) {\n return [{ platform: this.id, action: \"skip\", path, detail: `${MCP_ROOT_KEY} is not a YAML array — left untouched (manual fix needed)` }];\n }\n const list = this.serverArray(cfg);\n const idx = list.findIndex((e) => this.entryName(e) === connector.id);\n\n let action: ChangeRecord[\"action\"];\n if (idx < 0) {\n list.push(entry);\n action = \"create\";\n } else if (JSON.stringify(list[idx]) === JSON.stringify(entry)) {\n action = \"skip\";\n } else {\n list[idx] = entry;\n action = \"update\";\n }\n\n if (action !== \"skip\") {\n cfg[MCP_ROOT_KEY] = list;\n writeYaml(path, cfg, dryRun);\n }\n return [{ platform: this.id, action, path, detail: `${MCP_ROOT_KEY}[name=${connector.id}]` }];\n }\n\n override uninstallServer(ctx: InstallContext): ChangeRecord[] {\n const { connector, dryRun } = ctx;\n const path = this.getServerConfigPath(ctx);\n const cfg = readYaml<Record<string, unknown>>(path);\n const rawList = cfg?.[MCP_ROOT_KEY];\n if (!cfg || !Array.isArray(rawList)) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n path,\n detail: `${MCP_ROOT_KEY}[name=${connector.id}] absent`,\n },\n ];\n }\n\n const list = rawList as ContinueServer[];\n const kept = list.filter((e) => this.entryName(e) !== connector.id);\n if (kept.length === list.length) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n path,\n detail: `${MCP_ROOT_KEY}[name=${connector.id}] absent`,\n },\n ];\n }\n\n cfg[MCP_ROOT_KEY] = kept;\n writeYaml(path, cfg, dryRun);\n return [\n { platform: this.id, action: \"remove\", path, detail: `${MCP_ROOT_KEY}[name=${connector.id}]` },\n ];\n }\n\n /**\n * Render a normalized ServerDef into Continue's native mcpServers entry.\n * Continue has no documented native ${env:VAR} token — resolve every reference\n * to a literal at install time (the safe path, matching amazon-q/goose/hermes).\n * Honors the telemetry serve-wrapper for stdio.\n */\n private renderServerEntry(ctx: InstallContext, server: ServerDef): ContinueServer {\n const transport: Transport = server.transport;\n\n if (transport === \"stdio\") {\n let command = server.command ?? \"\";\n let args = [...(server.args ?? [])];\n\n if (shouldWrapForTelemetry(server, ctx.connector.telemetry)) {\n const wrapped = buildServeWrapperCommand(\n ctx.homeBinPath,\n ctx.connector.id,\n command,\n args,\n ctx.scope,\n this.id,\n );\n command = wrapped.command;\n args = wrapped.args;\n }\n\n command = resolveEnvRefsDeep(command);\n args = resolveEnvRefsDeep(args);\n\n // stdio omits `type` (Continue's documented default).\n const entry: ContinueStdioServer = {\n name: ctx.connector.id,\n command,\n };\n if (args.length > 0) entry.args = args;\n const env = this.renderEnv(server.env);\n if (env) entry.env = env;\n if (typeof server.cwd === \"string\" && server.cwd.length > 0) {\n entry.cwd = resolveEnvRefsDeep(server.cwd);\n }\n return entry;\n }\n\n // Remote (sse / http / ws) — Continue registers an explicit type + url. The\n // framework's `http` transport maps to Continue's \"streamable-http\"; `sse`\n // maps to \"sse\". (ws has no Continue analog → fall through to streamable-http\n // URL form, which is the closest documented remote shape.)\n const type: ContinueRemoteServer[\"type\"] = transport === \"sse\" ? \"sse\" : \"streamable-http\";\n return {\n name: ctx.connector.id,\n type,\n url: resolveEnvRefsDeep(server.url ?? \"\"),\n };\n }\n\n /**\n * Render stdio env values. Continue has no documented native interpolation\n * token, so resolve `${env:VAR}` references to literals at install time.\n */\n private renderEnv(\n env: Record<string, string> | undefined,\n ): Record<string, string> | undefined {\n if (!env || Object.keys(env).length === 0) return undefined;\n const out: Record<string, string> = {};\n for (const [k, v] of Object.entries(resolveEnvRefsDeep({ ...env }))) {\n out[k] = String(v);\n }\n return out;\n }\n\n // ── Hook install / uninstall (separate settings.json, Claude-shaped) ──────\n // Continue's hooks live in settings.json (NOT the YAML config.yaml that holds\n // MCP servers), under `hooks` keyed by PascalCase event, each value an array\n // of { matcher?, hooks:[{ type:\"command\", command }] } — BYTE-IDENTICAL to\n // Claude Code. Events outside SUPPORTED_EVENTS (PostCompact) warn-skip; the\n // five host-specific events with no canonical analog (ConfigChange,\n // TeammateIdle, TaskCompleted, WorktreeCreate, WorktreeRemove) ride the\n // nativeHooks passthrough below. Merge-preserving: the user's own hooks + any\n // sibling connector's hooks survive; uninstall strips ONLY this connector's\n // home-bin command (anchored).\n\n override installHooks(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n const override = connector.platforms[HOST];\n const hooksDisabled = override?.hooks === false;\n // `hooks: false` disables only the NORMALIZED events; nativeHooks is a\n // sibling, continue-scoped declaration that installs regardless.\n const normalizedEvents = hooksDisabled ? [] : connector.hookEvents;\n const nativeHooks = override?.nativeHooks ?? {};\n const nativeEvents = Object.keys(nativeHooks);\n\n if (normalizedEvents.length === 0 && nativeEvents.length === 0) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n detail: hooksDisabled\n ? \"hooks disabled for continue\"\n : \"connector declares no hooks\",\n },\n ];\n }\n\n const hookPath = this.getHookConfigPath(ctx);\n // Merge into any existing settings.json so the user's own hooks survive.\n const file = this.readJson<ContinueSettingsFile>(hookPath) ?? {};\n const __skip = this.malformedHookRootSkip(hookPath, (file as Record<string, unknown>).hooks);\n if (__skip) return [__skip];\n const hooks = (file.hooks ??= {});\n\n const changes: ChangeRecord[] = [];\n let mutated = false;\n\n for (const event of normalizedEvents) {\n if (!SUPPORTED_EVENTS.has(event)) {\n changes.push({\n platform: this.id,\n action: \"warn\",\n path: hookPath,\n detail: `${event} has no Continue hook equivalent — skipped`,\n });\n continue;\n }\n\n // Continue's event names are Claude-identical (PascalCase) — register the\n // canonical event name directly.\n const command = buildHomeBinHookCommand(ctx.homeBinPath, HOST, event, connector.id);\n const matcher = connector.hooks[event]?.matcher ?? \"\";\n const entry: ContinueHookEntry = {\n matcher,\n hooks: [{ type: \"command\", command }],\n };\n\n const bucket = (hooks[event] ??= []);\n const existingIdx = bucket.findIndex((e) => this.entryHasOurCommand(e, ctx));\n\n if (existingIdx >= 0) {\n if (JSON.stringify(bucket[existingIdx]) === JSON.stringify(entry)) {\n changes.push({\n platform: this.id,\n action: \"skip\",\n path: hookPath,\n detail: `hooks.${event} already registered`,\n });\n continue;\n }\n bucket[existingIdx] = entry;\n changes.push({\n platform: this.id,\n action: \"update\",\n path: hookPath,\n detail: `hooks.${event}`,\n });\n } else {\n bucket.push(entry);\n changes.push({\n platform: this.id,\n action: \"create\",\n path: hookPath,\n detail: `hooks.${event}`,\n });\n }\n mutated = true;\n }\n\n // NATIVE passthrough events: continue-native event-name keys (ConfigChange,\n // TeammateIdle, TaskCompleted, WorktreeCreate, WorktreeRemove) filed VERBATIM\n // into the hooks map — no SUPPORTED_EVENTS gate, since they ARE continue\n // events. Same Claude-shaped nested { matcher, hooks:[{type,command}] } entry;\n // matched by EXACT command so a native key that coincides with a normalized\n // one never clobbers it.\n for (const nativeEvent of nativeEvents) {\n const command = buildHomeBinHookCommand(ctx.homeBinPath, HOST, nativeEvent, connector.id);\n const entry: ContinueHookEntry = {\n matcher: nativeHooks[nativeEvent]?.matcher ?? \"\",\n hooks: [{ type: \"command\", command }],\n };\n const bucket = (hooks[nativeEvent] ??= []);\n const existingIdx = bucket.findIndex((e) => e.hooks?.[0]?.command === command);\n if (existingIdx >= 0) {\n if (JSON.stringify(bucket[existingIdx]) === JSON.stringify(entry)) {\n changes.push({\n platform: this.id,\n action: \"skip\",\n path: hookPath,\n detail: `hooks.${nativeEvent} (native) already registered`,\n });\n continue;\n }\n bucket[existingIdx] = entry;\n changes.push({\n platform: this.id,\n action: \"update\",\n path: hookPath,\n detail: `hooks.${nativeEvent} (native)`,\n });\n } else {\n bucket.push(entry);\n changes.push({\n platform: this.id,\n action: \"create\",\n path: hookPath,\n detail: `hooks.${nativeEvent} (native)`,\n });\n }\n mutated = true;\n }\n\n if (mutated) this.writeJson(hookPath, file, ctx.dryRun);\n return changes;\n }\n\n override uninstallHooks(ctx: InstallContext): ChangeRecord[] {\n const hookPath = this.getHookConfigPath(ctx);\n const file = this.readJson<ContinueSettingsFile>(hookPath);\n const hooks = file?.hooks;\n if (!file || !hooks) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n path: hookPath,\n detail: \"no hooks section present\",\n },\n ];\n }\n\n const changes: ChangeRecord[] = [];\n let mutated = false;\n\n for (const event of Object.keys(hooks)) {\n const bucket = hooks[event];\n if (!Array.isArray(bucket)) continue;\n\n // Strip our hook command from each entry; drop entries left empty so we\n // never remove another connector's (or the user's own) hook commands. The\n // id token is anchored (isHomeBinHookCommand) so a shared-prefix connector\n // id is never affected.\n const next: ContinueHookEntry[] = [];\n let removed = 0;\n for (const e of bucket) {\n const innerBefore = e.hooks?.length ?? 0;\n const inner = (e.hooks ?? []).filter((h) => !this.isOurCommand(h.command, ctx));\n removed += innerBefore - inner.length;\n if (inner.length > 0) next.push({ matcher: e.matcher ?? \"\", hooks: inner });\n }\n\n if (removed > 0) {\n if (next.length > 0) hooks[event] = next;\n else delete hooks[event];\n changes.push({\n platform: this.id,\n action: \"remove\",\n path: hookPath,\n detail: `hooks.${event} (${removed})`,\n });\n mutated = true;\n }\n }\n\n if (mutated) this.writeJson(hookPath, file, ctx.dryRun);\n if (changes.length === 0) {\n changes.push({\n platform: this.id,\n action: \"skip\",\n path: hookPath,\n detail: \"no matching hook entries\",\n });\n }\n return changes;\n }\n\n private entryHasOurCommand(entry: ContinueHookEntry, ctx: InstallContext): boolean {\n return (entry.hooks ?? []).some((h) => this.isOurCommand(h.command, ctx));\n }\n\n /** True when a hook command references our home binary AND this connector id\n * (anchored so a shared-prefix id can't collide — see isHomeBinHookCommand). */\n private isOurCommand(command: string | undefined, ctx: InstallContext): boolean {\n return isHomeBinHookCommand(command, ctx.homeBinPath, ctx.connector.id);\n }\n\n // ── Runtime: parse Continue stdin JSON → normalized event ────────────────\n // Continue's stdin wire is Claude-identical snake_case (PR #11029 types.ts\n // HookInput), so the claude-code wire helpers (ClaudeWireInput / extractSessionId\n // / toolResponseToString) apply verbatim.\n\n parseEvent(event: HookEventName, raw: unknown): NormalizedEvent {\n const input = (raw ?? {}) as ClaudeWireInput;\n const connectorId = typeof input.connector === \"string\" ? input.connector : \"\";\n const sessionId = extractSessionId(input);\n const projectDir = typeof input.cwd === \"string\" ? input.cwd : undefined;\n\n const base = {\n hostPlatform: HOST,\n connectorId,\n sessionId,\n raw,\n ...(projectDir !== undefined ? { projectDir } : {}),\n } as const;\n\n switch (event) {\n case \"PreToolUse\": {\n const ev: PreToolUseEvent = {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n };\n return ev;\n }\n case \"PostToolUse\": {\n const ev: PostToolUseEvent = {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n ...(toolResponseToString(input.tool_response) !== undefined\n ? { toolOutput: toolResponseToString(input.tool_response) }\n : {}),\n };\n return ev;\n }\n case \"PostToolUseFailure\": {\n const ev: PostToolUseFailureEvent = {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n error: typeof input.error === \"string\" ? input.error : \"\",\n ...(typeof input.tool_use_id === \"string\" ? { toolUseId: input.tool_use_id } : {}),\n ...(typeof input.is_interrupt === \"boolean\" ? { isInterrupt: input.is_interrupt } : {}),\n ...(typeof input.duration_ms === \"number\" ? { durationMs: input.duration_ms } : {}),\n };\n return ev;\n }\n case \"UserPromptSubmit\": {\n const ev: UserPromptSubmitEvent = {\n ...base,\n prompt: typeof input.prompt === \"string\" ? input.prompt : \"\",\n };\n return ev;\n }\n case \"SessionStart\": {\n const ev: SessionStartEvent = {\n ...base,\n source: normalizeSessionSource(input.source),\n };\n return ev;\n }\n case \"SessionEnd\": {\n const ev: SessionEndEvent = {\n ...base,\n ...(typeof input.reason === \"string\" ? { reason: input.reason } : {}),\n };\n return ev;\n }\n case \"Stop\": {\n const ev: StopEvent = {\n ...base,\n ...(typeof input.stop_hook_active === \"boolean\"\n ? { stopHookActive: input.stop_hook_active }\n : {}),\n };\n return ev;\n }\n case \"Notification\": {\n const ev: NotificationEvent = {\n ...base,\n message: typeof input.message === \"string\" ? input.message : \"\",\n };\n return ev;\n }\n case \"PermissionRequest\": {\n const ev: PermissionRequestEvent = {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n ...(Array.isArray(input.permission_suggestions)\n ? { permissionSuggestions: input.permission_suggestions }\n : {}),\n };\n return ev;\n }\n case \"SubagentStart\": {\n const ev: SubagentStartEvent = {\n ...base,\n ...(typeof input.agent_id === \"string\" ? { agentId: input.agent_id } : {}),\n ...(typeof input.agent_type === \"string\" ? { agentType: input.agent_type } : {}),\n };\n return ev;\n }\n case \"SubagentStop\": {\n // agent_id/agent_type stay optional — hosts do not reliably populate\n // agent_type on SubagentStop (Claude-compatible quirk).\n const ev: SubagentStopEvent = {\n ...base,\n ...(typeof input.agent_id === \"string\" ? { agentId: input.agent_id } : {}),\n ...(typeof input.agent_type === \"string\" ? { agentType: input.agent_type } : {}),\n ...(typeof input.agent_transcript_path === \"string\"\n ? { agentTranscriptPath: input.agent_transcript_path }\n : {}),\n ...(typeof input.last_assistant_message === \"string\"\n ? { lastAssistantMessage: input.last_assistant_message }\n : {}),\n ...(typeof input.stop_hook_active === \"boolean\"\n ? { stopHookActive: input.stop_hook_active }\n : {}),\n };\n return ev;\n }\n case \"PreCompact\": {\n // Observe/context event — continue's PreCompactInput is HookInputBase +\n // trigger (\"manual\"|\"auto\") + custom_instructions. Mirror the claude-code\n // adapter exactly: keep only the normalized `trigger`; everything else\n // rides on `raw`.\n const ev: PreCompactEvent = {\n ...base,\n ...(input.trigger === \"auto\" || input.trigger === \"manual\"\n ? { trigger: input.trigger }\n : {}),\n };\n return ev;\n }\n default: {\n // Continue never delivers PostCompact (not in HOOK_EVENT_NAMES — see\n // SUPPORTED_EVENTS). If the runtime dispatches one anyway, surface it\n // loudly rather than silently mis-parse.\n throw new Error(`unsupported continue hook event: ${String(event)}`);\n }\n }\n }\n\n // ── Runtime: normalized response → Continue native (Claude-shaped) reply ──\n // Continue's HookOutput is Claude-identical, so this mirrors the claude-code\n // adapter's formatReply byte-for-byte:\n // PermissionRequest → nested decision{ behavior:\"allow\"|\"deny\" } envelope;\n // PostToolUseFailure / SubagentStart → context-only (deny degrades to\n // additionalContext carrying the reason);\n // Stop / SubagentStop / UserPromptSubmit / PostToolUse deny → TOP-LEVEL\n // { decision:\"block\", reason };\n // other deny → hookSpecificOutput.permissionDecision:\"deny\"; ask → \"ask\";\n // modify (PreToolUse) → updatedInput; context → additionalContext.\n\n formatReply(event: HookEventName, response: HookResponse): HookReply {\n const hookEventName = event as ClaudeHookEvent;\n const decision = response.decision ?? \"allow\";\n\n // PermissionRequest: nested decision{behavior} envelope. An EXPLICIT allow is\n // an active grant; ask/context/void fall through to the native dialog.\n if (event === \"PermissionRequest\") {\n if (response.decision === \"deny\") {\n return this.stdout({\n hookSpecificOutput: {\n hookEventName,\n decision: { behavior: \"deny\", message: response.reason ?? \"Blocked by hook\" },\n },\n });\n }\n if (\n response.decision === \"allow\" ||\n (response.decision === \"modify\" && response.updatedInput)\n ) {\n return this.stdout({\n hookSpecificOutput: {\n hookEventName,\n decision: {\n behavior: \"allow\",\n ...(response.updatedInput ? { updatedInput: response.updatedInput } : {}),\n },\n },\n });\n }\n return { exitCode: 0 };\n }\n\n // PostToolUseFailure (feedback beside the error) and SubagentStart (context\n // at the start of the subagent's conversation) are observe/context-only:\n // \"context\" emits additionalContext, \"deny\" degrades to the same carrying\n // the reason. Everything else passes through.\n if (event === \"PostToolUseFailure\" || event === \"SubagentStart\") {\n const context =\n decision === \"context\"\n ? response.additionalContext\n : decision === \"deny\"\n ? response.reason ?? response.additionalContext\n : undefined;\n if (context) {\n return this.stdout({\n hookSpecificOutput: { hookEventName, additionalContext: context },\n });\n }\n return { exitCode: 0 };\n }\n\n // deny → block the action with a reason (exit 0; JSON carries the decision).\n // The deny shape is EVENT-SPECIFIC: Stop / SubagentStop / UserPromptSubmit /\n // PostToolUse honor only the TOP-LEVEL { decision:\"block\", reason }; the rest\n // use hookSpecificOutput.permissionDecision. (A SubagentStop block keeps the\n // subagent running with `reason` as its next instruction — Stop semantics.)\n if (decision === \"deny\") {\n if (\n event === \"Stop\" ||\n event === \"SubagentStop\" ||\n event === \"UserPromptSubmit\" ||\n event === \"PostToolUse\"\n ) {\n return this.stdout({\n decision: \"block\",\n reason: response.reason ?? \"Blocked by hook\",\n });\n }\n return this.stdout({\n hookSpecificOutput: {\n hookEventName,\n permissionDecision: \"deny\",\n permissionDecisionReason: response.reason ?? \"Blocked by hook\",\n },\n });\n }\n\n // ask → prompt the user to confirm.\n if (decision === \"ask\") {\n return this.stdout({\n hookSpecificOutput: {\n hookEventName,\n permissionDecision: \"ask\",\n permissionDecisionReason: response.reason ?? \"Confirmation required by hook\",\n },\n });\n }\n\n // modify → rewrite PreToolUse input (only where Continue supports it).\n if (decision === \"modify\") {\n if (event === \"PreToolUse\" && response.updatedInput) {\n return this.stdout({\n hookSpecificOutput: { hookEventName, updatedInput: response.updatedInput },\n });\n }\n // Output rewrite is unsupported; fall through to allow.\n }\n\n // context → inject soft guidance (also the SessionStart context path).\n if (decision === \"context\" && response.additionalContext) {\n return this.stdout({\n hookSpecificOutput: { hookEventName, additionalContext: response.additionalContext },\n });\n }\n\n // allow / void / unsupported-degradation → pass through with exit 0.\n return { exitCode: 0 };\n }\n\n private stdout(payload: unknown): HookReply {\n return { exitCode: 0, stdout: JSON.stringify(payload) };\n }\n\n // ── Diagnostics ──────────────────────────────────────────────────────────\n\n override getHealthChecks(ctx: InstallContext): readonly HealthCheck[] {\n const path = this.getServerConfigPath(ctx);\n const id = ctx.connector.id;\n return [\n {\n name: `${this.name}: config.yaml present`,\n check: () =>\n existsSync(path)\n ? { status: \"OK\", detail: path }\n : { status: \"FAIL\", detail: `not found: ${path}` },\n },\n {\n name: `${this.name}: ${MCP_ROOT_KEY}[name=${id}] registered`,\n check: () => {\n if (!ctx.connector.server) return { status: \"OK\", detail: \"no MCP server declared\" };\n const cfg = readYaml<Record<string, unknown>>(path);\n const list = cfg?.[MCP_ROOT_KEY];\n const present =\n Array.isArray(list) &&\n (list as ContinueServer[]).some((e) => this.entryName(e) === id);\n return present\n ? { status: \"OK\", detail: `${MCP_ROOT_KEY}[name=${id}]` }\n : { status: \"FAIL\", detail: `${MCP_ROOT_KEY}[name=${id}] not found in ${path}` };\n },\n },\n ];\n }\n\n // ── Internal helpers ──────────────────────────────────────────────────────\n\n /** Get-or-create the mcpServers ARRAY at `cfg.mcpServers` (tolerate non-array). */\n private serverArray(cfg: Record<string, unknown>): ContinueServer[] {\n const existing = cfg[MCP_ROOT_KEY];\n if (Array.isArray(existing)) return existing as ContinueServer[];\n const fresh: ContinueServer[] = [];\n cfg[MCP_ROOT_KEY] = fresh;\n return fresh;\n }\n\n /** The `name` of an array entry, or undefined when it is not a named object. */\n private entryName(entry: unknown): string | undefined {\n if (!entry || typeof entry !== \"object\" || Array.isArray(entry)) return undefined;\n const name = (entry as { name?: unknown }).name;\n return typeof name === \"string\" ? name : undefined;\n }\n\n /** Resolve the per-platform server override into an effective ServerDef. */\n private effectiveServer(ctx: InstallContext): ServerDef | undefined {\n const override = ctx.connector.platforms[this.id]?.server;\n if (override === false) return undefined;\n const base = ctx.connector.server;\n if (!base) return undefined;\n return override && typeof override === \"object\" ? { ...base, ...override } : base;\n }\n}\n\n/**\n * Coerce Continue's SessionStart `source` matcher value onto the normalized\n * SessionStartEvent enum. Continue documents startup | resume | clear | compact\n * (PR #11029 types.ts SessionStartSource); anything else defaults to startup.\n */\nfunction normalizeSessionSource(source: string | undefined): SessionStartEvent[\"source\"] {\n switch (source) {\n case \"compact\":\n return \"compact\";\n case \"resume\":\n return \"resume\";\n case \"clear\":\n return \"clear\";\n default:\n return \"startup\";\n }\n}\n\nexport const adapter = new ContinueAdapter();\nexport default adapter;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAgFA,SAAS,YAAY,gBAAgB;AACrC,SAAS,eAAe;AACxB,SAAS,UAAU,YAAY;AA2C/B,IAAM,OAAmB;AAEzB,IAAM,eAA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AAAA,EACX;AACF;AAEO,IAAM,UAAU,IAAI,gBAAgB;AAC3C,IAAO,mBAAQ;","names":[]}
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-DBQMX75U.js";
5
5
  import {
6
6
  BaseAdapter
7
- } from "./chunk-CPLK7GTE.js";
7
+ } from "./chunk-PFDUGDOA.js";
8
8
  import "./chunk-7L6ITC4T.js";
9
9
  import {
10
10
  buildHomeBinHookCommand,
@@ -216,6 +216,8 @@ var CopilotCliAdapter = class extends BaseAdapter {
216
216
  }
217
217
  const hooksPath = this.getHookConfigPath(ctx);
218
218
  const file = this.readJson(hooksPath) ?? {};
219
+ const __skip = this.malformedHookRootSkip(hooksPath, file.hooks);
220
+ if (__skip) return [__skip];
219
221
  const hooks = file.hooks ??= {};
220
222
  const changes = [];
221
223
  let mutated = false;
@@ -784,4 +786,4 @@ export {
784
786
  adapter,
785
787
  copilot_cli_default as default
786
788
  };
787
- //# sourceMappingURL=copilot-cli-Q3SSPT4V.js.map
789
+ //# sourceMappingURL=copilot-cli-Y74SOP5G.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/adapters/copilot-cli/index.ts"],"sourcesContent":["/**\n * adapters/copilot-cli — GitHub Copilot CLI platform adapter for agent-connector.\n *\n * GitHub Copilot CLI is a json-stdio host: the host pipes a JSON payload to a\n * hook command on stdin and reads JSON/exit-code back. Its hook event names and\n * reply shape are Claude-compatible (PascalCase events, `hookSpecificOutput`\n * reply wrapper), so the normalized HookEventName values map 1:1 — no event\n * rename table is needed.\n *\n * Native config (user/global only — Copilot CLI has no project-scoped config):\n * - MCP servers: ~/.copilot/mcp-config.json, root key \"mcpServers\". An stdio\n * server is written with type \"local\" (the host also accepts \"stdio\") plus\n * `tools: [\"*\"]`. Remote servers use type \"http\".\n * - Hooks: a Claude-compatible hooks file shaped `{ version: 1, hooks: { … } }`\n * discovered from ~/.copilot/hooks/*.json. We write a single dedicated file,\n * ~/.copilot/hooks/agent-connector.json, so we never disturb a user's own\n * hook files and removal is a clean, scoped operation. Each event maps to an\n * array of flat command entries `{ matcher?, hooks: [{ type:\"command\", command }] }`\n * — the Claude shape, which Copilot CLI reads.\n * - Reply: a `hookSpecificOutput` object keyed by `hookEventName` carrying\n * `permissionDecision` (allow|deny|ask) + `permissionDecisionReason`,\n * `additionalContext`, and (PreToolUse) `updatedInput`. PreToolUse is\n * fail-closed on the host side; exit 0 + JSON refines the decision.\n *\n * Env handling: the host is not documented to support `${env:VAR}` interpolation\n * inside mcp-config.json, so env/header/url refs are resolved to literals at\n * install time via resolveEnvRefsDeep (the safe default for a no-native-interp\n * host, matching the Codex adapter's approach).\n *\n * Content surfaces (surfaces-design §4-5): Copilot CLI exposes skills and\n * subagents but NO prompt-file command surface, so commands inherit the\n * BaseAdapter skip/warn default (supportsCommands stays false).\n * - skills: folder-per-skill `<dir>/skills/<name>/SKILL.md` (+ resource files).\n * user scope → ~/.copilot/skills; project scope → <projectDir>/.github/skills.\n * - subagents: user scope → ~/.copilot/agents/<name>.agent.md; project scope →\n * <projectDir>/.github/agents/<name>.agent.md (md + frontmatter:\n * name, description, tools, model).\n * The .github/ tree is shared with the vscode-copilot and jetbrains-copilot\n * connectors; we write identical, idempotent content and on uninstall remove\n * only the files this connector wrote.\n *\n * Grounded in docs/research/understand-report.md §2 (Platform Integration\n * Matrix, \"GitHub Copilot CLI\" row).\n */\n\nimport { existsSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\n\nimport { BaseAdapter } from \"../base.js\";\nimport type { Adapter, HookReply, InstallContext, MemoryTarget, NormalizedEvent } from \"../spi.js\";\nimport type {\n ChangeRecord,\n DetectedPlatform,\n HealthCheck,\n HookEventName,\n HookParadigm,\n HookResponse,\n NotificationEvent,\n PermissionRequestEvent,\n PlatformCapabilities,\n PlatformId,\n PostToolUseEvent,\n PostToolUseFailureEvent,\n PostCompactEvent,\n PreCompactEvent,\n PreToolUseEvent,\n ServerDef,\n SessionEndEvent,\n SessionStartEvent,\n SkillDef,\n StopEvent,\n SubagentDef,\n SubagentStartEvent,\n SubagentStopEvent,\n Transport,\n UserPromptSubmitEvent,\n} from \"../../core/types.js\";\nimport { resolveEnvRefsDeep } from \"../../core/interpolate.js\";\nimport {\n buildHomeBinHookCommand,\n buildServeWrapperCommand,\n isHomeBinHookCommand,\n shouldWrapForTelemetry,\n} from \"../../core/spawn.js\";\n\nconst HOST: PlatformId = \"copilot-cli\";\nconst MCP_ROOT_KEY = \"mcpServers\";\n\n/** Native hooks-file version Copilot CLI expects (`{ version: 1, hooks: {…} }`). */\nconst COPILOT_HOOKS_VERSION = 1;\n\n/**\n * Copilot CLI accepts both camelCase and PascalCase hook event names; PascalCase\n * is the portable, Claude/VS Code-compatible form (and selects the snake_case\n * payload dialect), so we emit it directly. Our normalized HookEventName values\n * are already PascalCase and match 1:1, hence no rename table — every declared\n * event has a native equivalent, including the newer four: subagentStart\n * (additionalContext only, matcher on agent name), subagentStop (can block and\n * force continuation), permissionRequest (decision control), and\n * postToolUseFailure (recovery guidance; the host also has a broader\n * errorOccurred event with no normalized analog — reachable via\n * platforms[\"copilot-cli\"].nativeHooks, see capabilities.supportsNativeHooks).\n */\ntype CopilotHookEvent = HookEventName;\n\n/** A single Copilot CLI hook registration entry (Claude-shaped). */\ninterface CopilotHookEntry {\n matcher: string;\n hooks: Array<{ type: \"command\"; command: string }>;\n}\n\n/** The shape of the Copilot CLI hooks file we own. */\ninterface CopilotHooksFile {\n version?: number;\n hooks?: Record<string, CopilotHookEntry[]>;\n}\n\n/** Native MCP server entry shapes Copilot CLI accepts under `mcpServers`. */\ninterface CopilotLocalServer {\n /** stdio transport is registered as type \"local\" (host also accepts \"stdio\"). */\n type: \"local\";\n command: string;\n args?: string[];\n env?: Record<string, string>;\n cwd?: string;\n tools: string[];\n}\ninterface CopilotHttpServer {\n /** Remote transport: \"http\" (Streamable HTTP) or \"sse\" (legacy). */\n type: \"http\" | \"sse\";\n url: string;\n headers?: Record<string, string>;\n tools: string[];\n}\n\n/** Raw Copilot CLI hook stdin payload (Claude-style: PascalCase event, snake_case fields). */\ninterface CopilotWireInput {\n connector?: unknown;\n session_id?: string;\n transcript_path?: string;\n cwd?: string;\n hook_event_name?: string;\n\n // tool events\n tool_name?: string;\n tool_input?: Record<string, unknown>;\n tool_response?: unknown;\n\n // SessionStart\n source?: string;\n // SessionEnd\n reason?: string;\n // UserPromptSubmit\n prompt?: string;\n // PreCompact\n trigger?: string;\n // Stop / SubagentStop\n stop_hook_active?: boolean;\n // Notification\n message?: string;\n\n // PermissionRequest — permission-update entries the dialog would offer.\n permission_suggestions?: unknown[];\n\n // PostToolUseFailure\n tool_use_id?: string;\n error?: string;\n is_interrupt?: boolean;\n duration_ms?: number;\n\n // SubagentStart / SubagentStop — agent_type is unreliable on SubagentStop\n // (Claude-compatible quirk); treat both as optional everywhere.\n agent_id?: string;\n agent_type?: string;\n // SubagentStop — the subagent's OWN transcript + its final response text.\n agent_transcript_path?: string;\n last_assistant_message?: string;\n}\n\nexport class CopilotCliAdapter extends BaseAdapter implements Adapter {\n readonly id: PlatformId = HOST;\n readonly name = \"GitHub Copilot CLI\";\n readonly paradigm: HookParadigm = \"json-stdio\";\n\n readonly capabilities: PlatformCapabilities = {\n // Memory surface: AGENTS.md-first managed block (project <projectDir>/AGENTS.md\n // via the base default; user scope → ~/.copilot/copilot-instructions.md below).\n supportsMemory: true,\n // Copilot CLI delivers the full Claude-compatible lifecycle event set.\n preToolUse: true,\n postToolUse: true,\n preCompact: true,\n sessionStart: true,\n sessionEnd: true,\n userPromptSubmit: true,\n stop: true,\n notification: true,\n // Newer events — Copilot CLI has native analogs for all four:\n // permissionRequest (decision control), postToolUseFailure (recovery\n // guidance), subagentStart (context-only), subagentStop (blockable).\n permissionRequest: true,\n postToolUseFailure: true,\n subagentStart: true,\n subagentStop: true,\n // PreToolUse is fail-closed and can rewrite tool input (updatedInput); a\n // PostToolUse hook cannot rewrite already-emitted tool output.\n canModifyArgs: true,\n canModifyOutput: false,\n canInjectSessionContext: true,\n // Copilot CLI's mcp-config.json `type` accepts stdio (written \"local\"),\n // http (Streamable HTTP), and sse (legacy) — per GitHub's add-mcp-servers docs.\n transports: [\"stdio\", \"http\", \"sse\"],\n // Content surfaces: Copilot CLI exposes skills + subagents, but has no\n // prompt-file command surface, so commands stay false (inherits BaseAdapter\n // skip/warn).\n supportsCommands: false,\n supportsSkills: true,\n supportsSubagents: true,\n // Native passthrough: Copilot CLI documents an `errorOccurred` lifecycle\n // event (plus camelCase aliases) with NO canonical HookEventName analog —\n // below the >=3-host core bar (docs/research/host-specific-hook-events-design.md).\n // A connector reaches it via platforms[\"copilot-cli\"].nativeHooks; installHooks\n // files the event-name key VERBATIM with the same home-bin command shape, and\n // the generic uninstall reverses it.\n supportsNativeHooks: true,\n };\n\n // ── Detection ────────────────────────────────────────────────────────────\n\n detectInstalled(_projectDir: string): DetectedPlatform {\n const userDir = join(homedir(), \".copilot\");\n const mcpConfig = join(userDir, \"mcp-config.json\");\n const hooksDir = join(userDir, \"hooks\");\n const installed =\n existsSync(userDir) || existsSync(mcpConfig) || existsSync(hooksDir);\n return {\n id: this.id,\n name: this.name,\n installed,\n paradigm: this.paradigm,\n capabilities: this.capabilities,\n configPath: mcpConfig,\n scope: \"user\",\n reason: installed\n ? `found GitHub Copilot CLI config under ${userDir}`\n : `no GitHub Copilot CLI config at ${userDir}`,\n confidence: installed ? \"high\" : \"low\",\n };\n }\n\n // ── Memory surface: user-scope global instructions file ─────────────────\n // Project scope stays on the AGENTS.md base default (root AGENTS.md is the\n // primary instructions file). User scope targets Copilot CLI's documented\n // $HOME/.copilot/copilot-instructions.md — a markdown file shared with other\n // writers, so the managed block (not whole-file ownership) applies as usual.\n protected override memoryTargets(ctx: InstallContext): MemoryTarget[] {\n if (this.memoryOverride(ctx)?.path || ctx.scope !== \"user\") {\n return super.memoryTargets(ctx);\n }\n return [\n {\n path: join(homedir(), \".copilot\", \"copilot-instructions.md\"),\n reason: \"copilot-cli global instructions (~/.copilot/copilot-instructions.md)\",\n },\n ];\n }\n\n // ── Native paths ─────────────────────────────────────────────────────────\n\n /** Copilot CLI is user/global only — scope is ignored. */\n getConfigDir(_ctx: InstallContext): string {\n return join(homedir(), \".copilot\");\n }\n\n getServerConfigPath(ctx: InstallContext): string {\n return join(this.getConfigDir(ctx), \"mcp-config.json\");\n }\n\n /**\n * Copilot CLI discovers hooks from any `~/.copilot/hooks/*.json`. We write a\n * single dedicated file so we never disturb the user's own hook files and\n * uninstall is a clean, scoped operation.\n */\n getHookConfigPath(ctx: InstallContext): string {\n return join(this.getConfigDir(ctx), \"hooks\", \"agent-connector.json\");\n }\n\n // ── MCP server install / uninstall ───────────────────────────────────────\n\n installServer(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n const override = connector.platforms[HOST]?.server;\n if (!connector.server || override === false) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n detail: connector.server\n ? \"server registration disabled for copilot-cli\"\n : \"connector declares no MCP server\",\n },\n ];\n }\n\n // Shallow-merge any per-platform server override into the base ServerDef.\n const server: ServerDef =\n override && typeof override === \"object\"\n ? { ...connector.server, ...override }\n : connector.server;\n\n const serverPath = this.getServerConfigPath(ctx);\n const entry = this.renderServerEntry(ctx, server);\n\n return [\n this.upsertServerInJson(serverPath, MCP_ROOT_KEY, connector.id, entry, ctx.dryRun),\n ];\n }\n\n uninstallServer(ctx: InstallContext): ChangeRecord[] {\n const serverPath = this.getServerConfigPath(ctx);\n return [\n this.removeServerFromJson(serverPath, MCP_ROOT_KEY, ctx.connector.id, ctx.dryRun),\n ];\n }\n\n /** Render a normalized ServerDef into Copilot CLI's native mcpServers entry. */\n private renderServerEntry(\n ctx: InstallContext,\n server: ServerDef,\n ): CopilotLocalServer | CopilotHttpServer {\n const transport: Transport = server.transport;\n const tools = this.renderTools(server);\n\n if (transport === \"stdio\") {\n let command = server.command ?? \"\";\n let args = [...(server.args ?? [])];\n\n // Transparent telemetry wrapping: route the real command through\n // `<homeBin> serve --connector <id> -- <command> <args...>`.\n if (shouldWrapForTelemetry(server, ctx.connector.telemetry)) {\n const wrapped = buildServeWrapperCommand(\n ctx.homeBinPath,\n ctx.connector.id,\n command,\n args,\n ctx.scope,\n this.id,\n );\n command = wrapped.command;\n args = wrapped.args;\n }\n\n const entry: CopilotLocalServer = {\n type: \"local\",\n command: resolveEnvRefsDeep(command),\n tools,\n };\n if (args.length > 0) entry.args = args.map((a) => resolveEnvRefsDeep(a));\n const env = this.renderEnv(server.env);\n if (env) entry.env = env;\n if (server.cwd) entry.cwd = resolveEnvRefsDeep(server.cwd);\n return entry;\n }\n\n // remote (Streamable http / legacy sse) — Copilot registers a URL keyed by\n // its `type`. AC's canonical \"sse\" → \"sse\"; everything else → \"http\".\n const entry: CopilotHttpServer = {\n type: server.transport === \"sse\" ? \"sse\" : \"http\",\n url: resolveEnvRefsDeep(server.url ?? \"\"),\n tools,\n };\n const headers = this.renderEnv(server.headers);\n if (headers) entry.headers = headers;\n return entry;\n }\n\n /**\n * Render env/header values. Copilot CLI is not documented to support native\n * `${env:VAR}` interpolation in mcp-config.json, so refs resolve to literals\n * at install time (the safe default for a no-native-interp host).\n */\n private renderEnv(\n env: Record<string, string> | undefined,\n ): Record<string, string> | undefined {\n if (!env || Object.keys(env).length === 0) return undefined;\n return resolveEnvRefsDeep({ ...env });\n }\n\n /** Render the tool allow-list. Copilot CLI expects `tools` on every entry; default [\"*\"]. */\n private renderTools(server: ServerDef): string[] {\n const include = server.tools?.include;\n return include && include.length > 0 ? [...include] : [\"*\"];\n }\n\n // ── Hook install / uninstall ─────────────────────────────────────────────\n\n installHooks(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n const override = connector.platforms[HOST];\n const hooksDisabled = override?.hooks === false;\n // `hooks: false` disables only the NORMALIZED events; nativeHooks is a\n // sibling, copilot-cli-scoped declaration that installs regardless.\n const normalizedEvents = hooksDisabled ? [] : connector.hookEvents;\n const nativeHooks = override?.nativeHooks ?? {};\n const nativeEvents = Object.keys(nativeHooks);\n\n if (normalizedEvents.length === 0 && nativeEvents.length === 0) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n detail: hooksDisabled\n ? \"hooks disabled for copilot-cli\"\n : \"connector declares no hooks\",\n },\n ];\n }\n\n const hooksPath = this.getHookConfigPath(ctx);\n const file = this.readJson<CopilotHooksFile>(hooksPath) ?? {};\n const __skip = this.malformedHookRootSkip(hooksPath, (file as Record<string, unknown>).hooks);\n if (__skip) return [__skip];\n const hooks = (file.hooks ??= {});\n\n const changes: ChangeRecord[] = [];\n let mutated = false;\n\n for (const event of normalizedEvents) {\n // PascalCase events map 1:1 to Copilot CLI's native event names.\n const copilotEvent: CopilotHookEvent = event;\n const command = buildHomeBinHookCommand(ctx.homeBinPath, HOST, event, connector.id);\n const matcher = connector.hooks[event]?.matcher ?? \"\";\n const entry: CopilotHookEntry = {\n matcher,\n hooks: [{ type: \"command\", command }],\n };\n\n const bucket = (hooks[copilotEvent] ??= []);\n const existingIdx = bucket.findIndex((e) => this.entryHasOurCommand(e, ctx));\n\n if (existingIdx >= 0) {\n if (JSON.stringify(bucket[existingIdx]) === JSON.stringify(entry)) {\n changes.push({\n platform: this.id,\n action: \"skip\",\n path: hooksPath,\n detail: `hooks.${copilotEvent} already registered`,\n });\n continue;\n }\n bucket[existingIdx] = entry;\n changes.push({\n platform: this.id,\n action: \"update\",\n path: hooksPath,\n detail: `hooks.${copilotEvent}`,\n });\n } else {\n bucket.push(entry);\n changes.push({\n platform: this.id,\n action: \"create\",\n path: hooksPath,\n detail: `hooks.${copilotEvent}`,\n });\n }\n mutated = true;\n }\n\n // NATIVE passthrough events: copilot-cli-native event-name keys (e.g.\n // ErrorOccurred) filed VERBATIM into the hooks map — no EVENT_MAP, since they\n // ARE Copilot events. The command keeps the native token; matched by EXACT\n // command so a native key coinciding with a normalized one never clobbers it.\n for (const nativeEvent of nativeEvents) {\n const command = buildHomeBinHookCommand(ctx.homeBinPath, HOST, nativeEvent, connector.id);\n const entry: CopilotHookEntry = {\n matcher: nativeHooks[nativeEvent]?.matcher ?? \"\",\n hooks: [{ type: \"command\", command }],\n };\n const bucket = (hooks[nativeEvent] ??= []);\n const existingIdx = bucket.findIndex((e) => e.hooks?.[0]?.command === command);\n if (existingIdx >= 0) {\n if (JSON.stringify(bucket[existingIdx]) === JSON.stringify(entry)) {\n changes.push({\n platform: this.id,\n action: \"skip\",\n path: hooksPath,\n detail: `hooks.${nativeEvent} (native) already registered`,\n });\n continue;\n }\n bucket[existingIdx] = entry;\n changes.push({\n platform: this.id,\n action: \"update\",\n path: hooksPath,\n detail: `hooks.${nativeEvent} (native)`,\n });\n } else {\n bucket.push(entry);\n changes.push({\n platform: this.id,\n action: \"create\",\n path: hooksPath,\n detail: `hooks.${nativeEvent} (native)`,\n });\n }\n mutated = true;\n }\n\n if (mutated) {\n file.version = COPILOT_HOOKS_VERSION;\n this.writeJson(hooksPath, file, ctx.dryRun);\n }\n return changes;\n }\n\n uninstallHooks(ctx: InstallContext): ChangeRecord[] {\n const hooksPath = this.getHookConfigPath(ctx);\n const file = this.readJson<CopilotHooksFile>(hooksPath);\n const hooks = file?.hooks;\n if (!file || !hooks) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n path: hooksPath,\n detail: \"no hooks section present\",\n },\n ];\n }\n\n const changes: ChangeRecord[] = [];\n let mutated = false;\n\n for (const copilotEvent of Object.keys(hooks)) {\n const bucket = hooks[copilotEvent];\n if (!Array.isArray(bucket)) continue;\n\n // Strip our hook command from each entry; drop entries left empty so we\n // never remove another connector's (or the user's own) hook commands.\n const next: CopilotHookEntry[] = [];\n let removed = 0;\n for (const e of bucket) {\n const innerBefore = e.hooks?.length ?? 0;\n const inner = (e.hooks ?? []).filter((h) => !this.isOurCommand(h.command, ctx));\n removed += innerBefore - inner.length;\n if (inner.length > 0) next.push({ matcher: e.matcher ?? \"\", hooks: inner });\n }\n\n if (removed > 0) {\n if (next.length > 0) hooks[copilotEvent] = next;\n else delete hooks[copilotEvent];\n changes.push({\n platform: this.id,\n action: \"remove\",\n path: hooksPath,\n detail: `hooks.${copilotEvent} (${removed})`,\n });\n mutated = true;\n }\n }\n\n if (mutated) this.writeJson(hooksPath, file, ctx.dryRun);\n if (changes.length === 0) {\n changes.push({\n platform: this.id,\n action: \"skip\",\n path: hooksPath,\n detail: \"no matching hook entries\",\n });\n }\n return changes;\n }\n\n private entryHasOurCommand(entry: CopilotHookEntry, ctx: InstallContext): boolean {\n return (entry.hooks ?? []).some((h) => this.isOurCommand(h.command, ctx));\n }\n\n /** True when a hook command references our home binary AND this connector id\n * (anchored so a shared-prefix id can't collide — see isHomeBinHookCommand). */\n private isOurCommand(command: string | undefined, ctx: InstallContext): boolean {\n return isHomeBinHookCommand(command, ctx.homeBinPath, ctx.connector.id);\n }\n\n // ── Content surfaces: skills / subagents ─────────────────────────────────\n // CONTENT-ONLY: pure native-file writers. No runtime dispatch, no home-bin\n // pointer, no telemetry wrap. Each method is idempotent (byte-identical →\n // skip) via BaseAdapter.writeContentFile and reversible via removeContentFile.\n // Honors platforms[\"copilot-cli\"] per-surface false to skip. Commands are\n // unsupported here — they inherit the BaseAdapter skip/warn default.\n //\n // Path scoping: user scope lives under ~/.copilot (getConfigDir); project\n // scope lives under the shared <projectDir>/.github tree (the same files\n // vscode-copilot / jetbrains-copilot would write). We write identical content\n // and on uninstall remove only the files this connector wrote.\n\n /** Root dir for content surfaces: ~/.copilot (user) or <projectDir>/.github (project). */\n private contentDir(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? join(ctx.projectDir, \".github\")\n : this.getConfigDir(ctx);\n }\n\n private skillsDir(ctx: InstallContext): string {\n return join(this.contentDir(ctx), \"skills\");\n }\n private agentsDir(ctx: InstallContext): string {\n return join(this.contentDir(ctx), \"agents\");\n }\n\n /** Native skill dir: <contentDir>/skills/<name>. */\n private skillDir(ctx: InstallContext, name: string): string {\n return join(this.skillsDir(ctx), name);\n }\n /** Native subagent file path: <contentDir>/agents/<name>.agent.md. */\n private subagentPath(ctx: InstallContext, name: string): string {\n return join(this.agentsDir(ctx), `${name}.agent.md`);\n }\n\n // ── Skills ────────────────────────────────────────────────────────────────\n\n override installSkills(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[HOST]?.skills === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"skills disabled for copilot-cli\" }];\n }\n if (connector.skills.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no skills\" }];\n }\n const changes: ChangeRecord[] = [];\n for (const skill of connector.skills) {\n const dir = this.skillDir(ctx, skill.name);\n changes.push(\n this.writeContentFile(join(dir, \"SKILL.md\"), this.renderSkill(skill), ctx.dryRun),\n );\n // Bundle any resource files beside SKILL.md (relative path → contents).\n // Defense-in-depth: skip+warn on any key that escapes the skill dir\n // (config-time validation already rejects these, but never trust input).\n for (const [rel, contents] of Object.entries(skill.resources ?? {})) {\n const target = this.resolveWithin(dir, rel);\n if (target === null) {\n changes.push({\n platform: this.id,\n action: \"warn\",\n detail: `skill resource \"${rel}\" escapes the skill dir; skipped`,\n });\n continue;\n }\n changes.push(this.writeContentFile(target, contents, ctx.dryRun));\n }\n }\n return changes;\n }\n\n override uninstallSkills(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.skills.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no skills\" }];\n }\n const changes: ChangeRecord[] = [];\n for (const skill of connector.skills) {\n const dir = this.skillDir(ctx, skill.name);\n // Remove only the files we wrote (SKILL.md + declared resources), then the\n // skill dir itself when we own its full contents.\n changes.push(this.removeContentFile(join(dir, \"SKILL.md\"), ctx.dryRun));\n for (const rel of Object.keys(skill.resources ?? {})) {\n const target = this.resolveWithin(dir, rel);\n if (target === null) continue; // never delete outside the skill dir\n changes.push(this.removeContentFile(target, ctx.dryRun));\n }\n // Only remove the skill dir when WE own its full contents — never rm -rf a\n // dir that still holds user-added / sibling-tool / shared files.\n changes.push(this.removeDirIfEmpty(dir, ctx.dryRun));\n }\n return changes;\n }\n\n /**\n * Render a skill's SKILL.md: frontmatter (name, description + optional model,\n * allowed-tools, disable-model-invocation) + body. Uniform Agent Skills shape\n * shared across every skill-supporting connector.\n */\n private renderSkill(skill: SkillDef): string {\n const frontmatter: Record<string, unknown> = {\n name: skill.name,\n description: skill.description,\n };\n if (skill.model !== undefined) frontmatter.model = skill.model;\n const allow = skill.tools?.allow;\n if (allow && allow.length > 0) frontmatter[\"allowed-tools\"] = allow.join(\", \");\n if (skill.disableModelInvocation !== undefined) {\n frontmatter[\"disable-model-invocation\"] = skill.disableModelInvocation;\n }\n if (skill.extra) Object.assign(frontmatter, skill.extra);\n return this.renderFrontmatterMd(frontmatter, skill.body);\n }\n\n // ── Subagents ───────────────────────────────────────────────────────────────\n\n override installSubagents(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[HOST]?.subagents === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"subagents disabled for copilot-cli\" }];\n }\n if (connector.subagents.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no subagents\" }];\n }\n return connector.subagents.map((agent) =>\n this.writeContentFile(\n this.subagentPath(ctx, agent.name),\n this.renderSubagent(agent),\n ctx.dryRun,\n ),\n );\n }\n\n override uninstallSubagents(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.subagents.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no subagents\" }];\n }\n return connector.subagents.map((agent) =>\n this.removeContentFile(this.subagentPath(ctx, agent.name), ctx.dryRun),\n );\n }\n\n /** Render a subagent to md+frontmatter (name, description, tools, model) + prompt body. */\n private renderSubagent(agent: SubagentDef): string {\n const frontmatter: Record<string, unknown> = {\n name: agent.name,\n description: agent.description,\n };\n const allow = agent.tools?.allow;\n if (allow && allow.length > 0) frontmatter.tools = allow.join(\", \");\n if (agent.model !== undefined) frontmatter.model = agent.model;\n if (agent.extra) Object.assign(frontmatter, agent.extra);\n return this.renderFrontmatterMd(frontmatter, agent.prompt);\n }\n\n // ── Diagnostics ──────────────────────────────────────────────────────────\n\n override getHealthChecks(ctx: InstallContext): readonly HealthCheck[] {\n const mcpPath = this.getServerConfigPath(ctx);\n const hooksPath = this.getHookConfigPath(ctx);\n const connectorId = ctx.connector.id;\n const homeBin = ctx.homeBinPath;\n const hookEvents = ctx.connector.hookEvents;\n const checks: HealthCheck[] = [\n {\n name: `${this.name}: mcp-config.json present`,\n check: () =>\n existsSync(mcpPath)\n ? { status: \"OK\", detail: mcpPath }\n : { status: \"FAIL\", detail: `not found: ${mcpPath}` },\n },\n {\n name: `${this.name}: hook command registered`,\n check: () => {\n if (hookEvents.length === 0) {\n return { status: \"OK\", detail: \"no hooks declared\" };\n }\n const file = this.readJson<CopilotHooksFile>(hooksPath);\n if (!file) return { status: \"FAIL\", detail: `cannot read ${hooksPath}` };\n const hooks = file.hooks ?? {};\n const registered = Object.values(hooks).some((entries) =>\n (entries ?? []).some((e) =>\n (e.hooks ?? []).some((h) =>\n isHomeBinHookCommand(h.command, homeBin, connectorId),\n ),\n ),\n );\n return registered\n ? { status: \"OK\", detail: \"hook command present\" }\n : { status: \"FAIL\", detail: `no hook for ${connectorId} in ${hooksPath}` };\n },\n },\n ];\n\n // Content-surface checks: only assert presence of the surfaces this\n // connector declares (skip silently for surfaces it never asked for).\n // Commands are unsupported on Copilot CLI, so no command check.\n for (const skill of ctx.connector.skills) {\n const p = join(this.skillDir(ctx, skill.name), \"SKILL.md\");\n checks.push({\n name: `${this.name}: skill ${skill.name} present`,\n check: () =>\n existsSync(p) ? { status: \"OK\", detail: p } : { status: \"FAIL\", detail: `not found: ${p}` },\n });\n }\n for (const agent of ctx.connector.subagents) {\n const p = this.subagentPath(ctx, agent.name);\n checks.push({\n name: `${this.name}: subagent ${agent.name} present`,\n check: () =>\n existsSync(p) ? { status: \"OK\", detail: p } : { status: \"FAIL\", detail: `not found: ${p}` },\n });\n }\n return checks;\n }\n\n // ── Runtime: parse Copilot CLI stdin JSON → normalized event ─────────────\n\n parseEvent(event: HookEventName, raw: unknown): NormalizedEvent {\n const input = (raw ?? {}) as CopilotWireInput;\n const connectorId = typeof input.connector === \"string\" ? input.connector : \"\";\n const sessionId = extractSessionId(input);\n const projectDir = typeof input.cwd === \"string\" ? input.cwd : undefined;\n\n const base = {\n hostPlatform: HOST,\n connectorId,\n sessionId,\n raw,\n ...(projectDir !== undefined ? { projectDir } : {}),\n } as const;\n\n switch (event) {\n case \"PreToolUse\": {\n const ev: PreToolUseEvent = {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n };\n return ev;\n }\n case \"PostToolUse\": {\n const toolOutput = toolResponseToString(input.tool_response);\n const ev: PostToolUseEvent = {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n ...(toolOutput !== undefined ? { toolOutput } : {}),\n };\n return ev;\n }\n case \"SessionStart\": {\n const ev: SessionStartEvent = {\n ...base,\n source: normalizeSessionSource(input.source),\n };\n return ev;\n }\n case \"SessionEnd\": {\n const ev: SessionEndEvent = {\n ...base,\n ...(typeof input.reason === \"string\" ? { reason: input.reason } : {}),\n };\n return ev;\n }\n case \"UserPromptSubmit\": {\n const ev: UserPromptSubmitEvent = {\n ...base,\n prompt: typeof input.prompt === \"string\" ? input.prompt : \"\",\n };\n return ev;\n }\n case \"PreCompact\": {\n const ev: PreCompactEvent = {\n ...base,\n ...(input.trigger === \"auto\" || input.trigger === \"manual\"\n ? { trigger: input.trigger }\n : {}),\n };\n return ev;\n }\n case \"PostCompact\": {\n // Copilot CLI does not fire PostCompact natively (postCompact unset →\n // warn-skip at install). Parsed defensively, mirroring PreCompact, so a\n // manual/mis-routed dispatch normalizes instead of hitting the guard.\n const ev: PostCompactEvent = {\n ...base,\n ...(input.trigger === \"auto\" || input.trigger === \"manual\"\n ? { trigger: input.trigger }\n : {}),\n };\n return ev;\n }\n case \"Stop\": {\n const ev: StopEvent = {\n ...base,\n ...(typeof input.stop_hook_active === \"boolean\"\n ? { stopHookActive: input.stop_hook_active }\n : {}),\n };\n return ev;\n }\n case \"Notification\": {\n const ev: NotificationEvent = {\n ...base,\n message: typeof input.message === \"string\" ? input.message : \"\",\n };\n return ev;\n }\n case \"PermissionRequest\": {\n const ev: PermissionRequestEvent = {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n ...(Array.isArray(input.permission_suggestions)\n ? { permissionSuggestions: input.permission_suggestions }\n : {}),\n };\n return ev;\n }\n case \"PostToolUseFailure\": {\n const ev: PostToolUseFailureEvent = {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n error: typeof input.error === \"string\" ? input.error : \"\",\n ...(typeof input.tool_use_id === \"string\"\n ? { toolUseId: input.tool_use_id }\n : {}),\n ...(typeof input.is_interrupt === \"boolean\"\n ? { isInterrupt: input.is_interrupt }\n : {}),\n ...(typeof input.duration_ms === \"number\"\n ? { durationMs: input.duration_ms }\n : {}),\n };\n return ev;\n }\n case \"SubagentStart\": {\n const ev: SubagentStartEvent = {\n ...base,\n ...(typeof input.agent_id === \"string\" ? { agentId: input.agent_id } : {}),\n ...(typeof input.agent_type === \"string\"\n ? { agentType: input.agent_type }\n : {}),\n };\n return ev;\n }\n case \"SubagentStop\": {\n // agent_id/agent_type stay optional — hosts do not reliably populate\n // agent_type on SubagentStop (Claude-compatible quirk).\n const ev: SubagentStopEvent = {\n ...base,\n ...(typeof input.agent_id === \"string\" ? { agentId: input.agent_id } : {}),\n ...(typeof input.agent_type === \"string\"\n ? { agentType: input.agent_type }\n : {}),\n ...(typeof input.agent_transcript_path === \"string\"\n ? { agentTranscriptPath: input.agent_transcript_path }\n : {}),\n ...(typeof input.last_assistant_message === \"string\"\n ? { lastAssistantMessage: input.last_assistant_message }\n : {}),\n ...(typeof input.stop_hook_active === \"boolean\"\n ? { stopHookActive: input.stop_hook_active }\n : {}),\n };\n return ev;\n }\n default: {\n // Exhaustive guard — every HookEventName is handled above.\n const _never: never = event;\n throw new Error(`unsupported copilot-cli hook event: ${String(_never)}`);\n }\n }\n }\n\n // ── Runtime: normalized response → Copilot CLI native hook reply ─────────\n\n formatReply(event: HookEventName, response: HookResponse): HookReply {\n const hookEventName = event;\n const decision = response.decision ?? \"allow\";\n\n // PermissionRequest replies use the Claude-compatible nested\n // decision{behavior} envelope and are the ONE event where an EXPLICIT\n // \"allow\" is an ACTIVE grant (it suppresses the permission dialog) rather\n // than passthrough:\n // allow → decision{behavior:\"allow\"} (+updatedInput when set);\n // the host still enforces its own deny rules.\n // modify → an allow grant carrying updatedInput.\n // deny → decision{behavior:\"deny\", message}.\n // ask/context/void → NO decision output: fall through to the native\n // dialog (the dialog IS the ask).\n if (event === \"PermissionRequest\") {\n if (response.decision === \"deny\") {\n return this.stdout({\n hookSpecificOutput: {\n hookEventName,\n decision: {\n behavior: \"deny\",\n message: response.reason ?? \"Blocked by hook\",\n },\n },\n });\n }\n if (\n response.decision === \"allow\" ||\n (response.decision === \"modify\" && response.updatedInput)\n ) {\n return this.stdout({\n hookSpecificOutput: {\n hookEventName,\n decision: {\n behavior: \"allow\",\n ...(response.updatedInput\n ? { updatedInput: response.updatedInput }\n : {}),\n },\n },\n });\n }\n return { exitCode: 0 };\n }\n\n // PostToolUseFailure (recovery guidance beside the error) and SubagentStart\n // (context prepended to the SUBAGENT's conversation — creation is not\n // blockable on Copilot CLI) are observe/context-only: \"context\" emits\n // additionalContext, and a \"deny\" DEGRADES to the same shape carrying the\n // reason. Everything else passes through.\n if (event === \"PostToolUseFailure\" || event === \"SubagentStart\") {\n const context =\n decision === \"context\"\n ? response.additionalContext\n : decision === \"deny\"\n ? response.reason ?? response.additionalContext\n : undefined;\n if (context) {\n return this.stdout({\n hookSpecificOutput: { hookEventName, additionalContext: context },\n });\n }\n return { exitCode: 0 };\n }\n\n // deny → block the action with a reason (exit 0; JSON carries the decision).\n // SubagentStop is the Stop-semantics exception: like Claude, the block is\n // the TOP-LEVEL {\"decision\":\"block\",\"reason\"} — it keeps the subagent\n // running with `reason` as its next instruction (the host \"can block and\n // force continuation\").\n if (decision === \"deny\") {\n if (event === \"SubagentStop\") {\n return this.stdout({\n decision: \"block\",\n reason: response.reason ?? \"Blocked by hook\",\n });\n }\n return this.stdout({\n hookSpecificOutput: {\n hookEventName,\n permissionDecision: \"deny\",\n permissionDecisionReason: response.reason ?? \"Blocked by hook\",\n },\n });\n }\n\n // ask → prompt the user to confirm.\n if (decision === \"ask\") {\n return this.stdout({\n hookSpecificOutput: {\n hookEventName,\n permissionDecision: \"ask\",\n permissionDecisionReason: response.reason ?? \"Confirmation required by hook\",\n },\n });\n }\n\n // modify → rewrite PreToolUse input (only where Copilot CLI supports it).\n if (decision === \"modify\") {\n if (event === \"PreToolUse\" && response.updatedInput) {\n return this.stdout({\n hookSpecificOutput: { hookEventName, updatedInput: response.updatedInput },\n });\n }\n // Output rewrite is unsupported on Copilot CLI; fall through to allow.\n }\n\n // context → inject soft guidance (also the SessionStart context path).\n if (decision === \"context\" && response.additionalContext) {\n return this.stdout({\n hookSpecificOutput: { hookEventName, additionalContext: response.additionalContext },\n });\n }\n\n // allow / void / unsupported-degradation → pass through with exit 0.\n return { exitCode: 0 };\n }\n\n private stdout(payload: unknown): HookReply {\n return { exitCode: 0, stdout: JSON.stringify(payload) };\n }\n}\n\n/**\n * Extract a stable session id from a Copilot CLI wire payload.\n * Priority mirrors the Claude wire protocol: transcript UUID > session_id > \"\".\n */\nfunction extractSessionId(input: CopilotWireInput): string {\n if (typeof input.transcript_path === \"string\") {\n const m = input.transcript_path.match(/([a-f0-9-]{36})\\.jsonl$/);\n if (m && m[1]) return m[1];\n }\n if (typeof input.session_id === \"string\" && input.session_id !== \"\") {\n return input.session_id;\n }\n return \"\";\n}\n\n/** Coerce a Copilot PostToolUse `tool_response` into a string for the normalized event. */\nfunction toolResponseToString(value: unknown): string | undefined {\n if (value == null) return undefined;\n if (typeof value === \"string\") return value;\n try {\n return JSON.stringify(value);\n } catch {\n return String(value);\n }\n}\n\nfunction normalizeSessionSource(source: string | undefined): SessionStartEvent[\"source\"] {\n switch (source) {\n case \"compact\":\n return \"compact\";\n case \"resume\":\n return \"resume\";\n case \"clear\":\n return \"clear\";\n default:\n return \"startup\";\n }\n}\n\nexport const adapter = new CopilotCliAdapter();\nexport default adapter;\n"],"mappings":";;;;;;;;;;;;;;;;;;AA6CA,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,YAAY;AAuCrB,IAAM,OAAmB;AACzB,IAAM,eAAe;AAGrB,IAAM,wBAAwB;AA0FvB,IAAM,oBAAN,cAAgC,YAA+B;AAAA,EAC3D,KAAiB;AAAA,EACjB,OAAO;AAAA,EACP,WAAyB;AAAA,EAEzB,eAAqC;AAAA;AAAA;AAAA,IAG5C,gBAAgB;AAAA;AAAA,IAEhB,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,YAAY;AAAA,IACZ,kBAAkB;AAAA,IAClB,MAAM;AAAA,IACN,cAAc;AAAA;AAAA;AAAA;AAAA,IAId,mBAAmB;AAAA,IACnB,oBAAoB;AAAA,IACpB,eAAe;AAAA,IACf,cAAc;AAAA;AAAA;AAAA,IAGd,eAAe;AAAA,IACf,iBAAiB;AAAA,IACjB,yBAAyB;AAAA;AAAA;AAAA,IAGzB,YAAY,CAAC,SAAS,QAAQ,KAAK;AAAA;AAAA;AAAA;AAAA,IAInC,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,IAChB,mBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOnB,qBAAqB;AAAA,EACvB;AAAA;AAAA,EAIA,gBAAgB,aAAuC;AACrD,UAAM,UAAU,KAAK,QAAQ,GAAG,UAAU;AAC1C,UAAM,YAAY,KAAK,SAAS,iBAAiB;AACjD,UAAM,WAAW,KAAK,SAAS,OAAO;AACtC,UAAM,YACJ,WAAW,OAAO,KAAK,WAAW,SAAS,KAAK,WAAW,QAAQ;A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;AACT;AAGA,SAAS,qBAAqB,OAAoC;AAChE,MAAI,SAAS,KAAM,QAAO;AAC1B,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,MAAI;AACF,WAAO,KAAK,UAAU,KAAK;AAAA,EAC7B,QAAQ;AACN,WAAO,OAAO,KAAK;AAAA,EACrB;AACF;AAEA,SAAS,uBAAuB,QAAyD;AACvF,UAAQ,QAAQ;AAAA,IACd,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAEO,IAAM,UAAU,IAAI,kBAAkB;AAC7C,IAAO,sBAAQ;","names":["entry"]}
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-DBQMX75U.js";
5
5
  import {
6
6
  BaseAdapter
7
- } from "./chunk-CPLK7GTE.js";
7
+ } from "./chunk-PFDUGDOA.js";
8
8
  import "./chunk-7L6ITC4T.js";
9
9
  import {
10
10
  buildHomeBinHookCommand,
@@ -214,6 +214,8 @@ var CrushAdapter = class extends BaseAdapter {
214
214
  return [{ platform: this.id, action: "skip", path, detail: "no hooks declared" }];
215
215
  }
216
216
  const cfg = this.readJson(path) ?? {};
217
+ const __skip = this.malformedHookRootSkip(path, cfg.hooks);
218
+ if (__skip) return [__skip];
217
219
  const hooks = cfg.hooks ??= {};
218
220
  const changes = [];
219
221
  let mutated = false;
@@ -509,4 +511,4 @@ export {
509
511
  adapter,
510
512
  crush_default as default
511
513
  };
512
- //# sourceMappingURL=crush-MBEH2R3I.js.map
514
+ //# sourceMappingURL=crush-GMEWLXK5.js.map