@ken-jo/agent-connector 0.4.43 → 0.4.61

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 (186) hide show
  1. package/README.md +17 -4
  2. package/dist/{action-ZUHMOGLV.js → action-AIB2W4DU.js} +12 -12
  3. package/dist/{amazon-q-UFLBUSHG.js → amazon-q-PH7OFPJD.js} +7 -11
  4. package/dist/amazon-q-PH7OFPJD.js.map +1 -0
  5. package/dist/{amp-5DJK7VAL.js → amp-ZYRC2VCH.js} +38 -63
  6. package/dist/amp-ZYRC2VCH.js.map +1 -0
  7. package/dist/{antigravity-NWP2TUG6.js → antigravity-PM5NMS2J.js} +5 -5
  8. package/dist/{antigravity-cli-KPNLE7X4.js → antigravity-cli-LN25XGWX.js} +5 -5
  9. package/dist/{chunk-LETB5HCK.js → chunk-3QCDVSMX.js} +2 -2
  10. package/dist/{chunk-ERV4TKRV.js → chunk-4K5HEGVE.js} +2 -2
  11. package/dist/{chunk-H3BATOBP.js → chunk-AAOYOAQT.js} +2 -2
  12. package/dist/{chunk-2RPHDVHW.js → chunk-AEQRMVRB.js} +2 -2
  13. package/dist/{chunk-L7ESV37V.js → chunk-BZOOVTFG.js} +4 -2
  14. package/dist/chunk-BZOOVTFG.js.map +1 -0
  15. package/dist/{chunk-3Q6YEDCG.js → chunk-C3TFA4CJ.js} +17 -45
  16. package/dist/chunk-C3TFA4CJ.js.map +1 -0
  17. package/dist/{chunk-QY42WGBX.js → chunk-D65GIBCG.js} +34 -3
  18. package/dist/chunk-D65GIBCG.js.map +1 -0
  19. package/dist/{chunk-RAJBLK2V.js → chunk-FVARNRCE.js} +26 -10
  20. package/dist/chunk-FVARNRCE.js.map +1 -0
  21. package/dist/{chunk-A767JFHW.js → chunk-GI4FDVWI.js} +65 -35
  22. package/dist/chunk-GI4FDVWI.js.map +1 -0
  23. package/dist/{chunk-5HSLICR3.js → chunk-IDKI42JW.js} +36 -36
  24. package/dist/{chunk-54B5HAVT.js → chunk-JZIM33C2.js} +10 -7
  25. package/dist/chunk-JZIM33C2.js.map +1 -0
  26. package/dist/{chunk-3ZZK4KXG.js → chunk-KAEYJGK7.js} +18 -18
  27. package/dist/{chunk-ZY25RG4Y.js → chunk-LBOGRZGY.js} +4 -2
  28. package/dist/chunk-LBOGRZGY.js.map +1 -0
  29. package/dist/{chunk-VDSXVNEH.js → chunk-NFMHYIN2.js} +5 -5
  30. package/dist/{chunk-XW46WVR2.js → chunk-O3HIYTBK.js} +10 -5
  31. package/dist/chunk-O3HIYTBK.js.map +1 -0
  32. package/dist/{chunk-AQ53TOH4.js → chunk-O4BKQSPP.js} +7 -4
  33. package/dist/chunk-O4BKQSPP.js.map +1 -0
  34. package/dist/{chunk-YG3KFOOQ.js → chunk-QP35SRUZ.js} +2 -2
  35. package/dist/{chunk-4CBHYWUG.js → chunk-RFYQXT7C.js} +7 -7
  36. package/dist/{chunk-5TMIJ7AY.js → chunk-RGQTN7K3.js} +5 -5
  37. package/dist/{chunk-M3H7PQWT.js → chunk-WOUGWPZQ.js} +4 -2
  38. package/dist/chunk-WOUGWPZQ.js.map +1 -0
  39. package/dist/{chunk-F4DSMVZ7.js → chunk-ZQCT63JU.js} +2 -2
  40. package/dist/{claude-code-YNNKQCCR.js → claude-code-GCXXEWUN.js} +15 -8
  41. package/dist/claude-code-GCXXEWUN.js.map +1 -0
  42. package/dist/cli/sdk.js +7 -7
  43. package/dist/cli.js +1 -1
  44. package/dist/{cline-AGFJF4AC.js → cline-KHZLG7CU.js} +4 -4
  45. package/dist/{codebuff-YUQ4PN7G.js → codebuff-EQGWZEP4.js} +4 -4
  46. package/dist/{codex-FLU37DV3.js → codex-7X7RC6JJ.js} +32 -6
  47. package/dist/codex-7X7RC6JJ.js.map +1 -0
  48. package/dist/{continue-ZMI4YN75.js → continue-V4MB3WQ3.js} +9 -5
  49. package/dist/continue-V4MB3WQ3.js.map +1 -0
  50. package/dist/{copilot-cli-XPRJ5MQB.js → copilot-cli-7EPIJHFM.js} +12 -32
  51. package/dist/copilot-cli-7EPIJHFM.js.map +1 -0
  52. package/dist/{crush-3OB5ZTCC.js → crush-3AAA75C5.js} +4 -4
  53. package/dist/{cursor-F4HYO2FP.js → cursor-DTYZROKS.js} +5 -5
  54. package/dist/{detect-FXGBSNQU.js → detect-LWZEM7SN.js} +4 -4
  55. package/dist/{doctor-2O65SAPG.js → doctor-54P4JFA6.js} +14 -14
  56. package/dist/{droid-NZCKYKOV.js → droid-QMNO5WZ2.js} +6 -12
  57. package/dist/droid-QMNO5WZ2.js.map +1 -0
  58. package/dist/{gemini-cli-3ZGCXUDD.js → gemini-cli-7JU7ZWQL.js} +19 -6
  59. package/dist/gemini-cli-7JU7ZWQL.js.map +1 -0
  60. package/dist/{goose-MGGNVXJP.js → goose-36TJNDKD.js} +16 -22
  61. package/dist/goose-36TJNDKD.js.map +1 -0
  62. package/dist/{hermes-L3CBJ37L.js → hermes-S4JZ6H42.js} +44 -22
  63. package/dist/hermes-S4JZ6H42.js.map +1 -0
  64. package/dist/{hook-D3PY6TDK.js → hook-UT3Q43AB.js} +12 -12
  65. package/dist/index.d.ts +2 -2
  66. package/dist/index.js +5 -5
  67. package/dist/{install-SVBIK4VJ.js → install-F4OIDYAK.js} +14 -14
  68. package/dist/{introspect-B164-hj3.d.ts → introspect-BFcXpfUp.d.ts} +1 -1
  69. package/dist/{jetbrains-copilot-M2LHJBAW.js → jetbrains-copilot-6QLKUCAY.js} +17 -12
  70. package/dist/jetbrains-copilot-6QLKUCAY.js.map +1 -0
  71. package/dist/{kilo-RMRP2EL7.js → kilo-WLZOYKZK.js} +18 -55
  72. package/dist/kilo-WLZOYKZK.js.map +1 -0
  73. package/dist/{kilo-cli-6ITBNHTH.js → kilo-cli-FBX4OFIZ.js} +18 -55
  74. package/dist/kilo-cli-FBX4OFIZ.js.map +1 -0
  75. package/dist/{kimi-I35VOOY4.js → kimi-7YXRAQ6Z.js} +28 -14
  76. package/dist/kimi-7YXRAQ6Z.js.map +1 -0
  77. package/dist/{kiro-2K5UJVGC.js → kiro-CSBQA6EX.js} +5 -5
  78. package/dist/kiro-CSBQA6EX.js.map +1 -0
  79. package/dist/{leaderboard-ZMZST52G.js → leaderboard-ZIAXBUWD.js} +5 -5
  80. package/dist/{mimo-code-K7AMX2QW.js → mimo-code-GYJNEULG.js} +21 -56
  81. package/dist/mimo-code-GYJNEULG.js.map +1 -0
  82. package/dist/{mux-GT7FWVLH.js → mux-DAIC3VY7.js} +4 -4
  83. package/dist/{nemoclaw-GQMS6CUM.js → nemoclaw-GS3XA7V2.js} +5 -5
  84. package/dist/{omp-2RPYIZUF.js → omp-O6KNB4MM.js} +17 -46
  85. package/dist/omp-O6KNB4MM.js.map +1 -0
  86. package/dist/{openclaw-P5GMEEGC.js → openclaw-344VBMLY.js} +5 -5
  87. package/dist/{opencode-5D2SK3EX.js → opencode-JPHRZPDQ.js} +21 -56
  88. package/dist/opencode-JPHRZPDQ.js.map +1 -0
  89. package/dist/{package-EDYQF6C6.js → package-5FRMSWRT.js} +11 -11
  90. package/dist/{pi-ZMM4KJTO.js → pi-EFBTBI2B.js} +4 -4
  91. package/dist/{qwen-code-4ZLVGN2C.js → qwen-code-CLSMTMHX.js} +12 -5
  92. package/dist/qwen-code-CLSMTMHX.js.map +1 -0
  93. package/dist/{roo-code-67QGLQRM.js → roo-code-YIX3RPR2.js} +4 -4
  94. package/dist/runtime/index.d.ts +1 -1
  95. package/dist/runtime/index.js +10 -10
  96. package/dist/sdk/index.d.ts +3 -3
  97. package/dist/sdk/index.js +6 -6
  98. package/dist/sdk/test.d.ts +2 -2
  99. package/dist/sdk/test.js +9 -9
  100. package/dist/{serve-427CCEYA.js → serve-NQBXN4FG.js} +12 -12
  101. package/dist/{status-6IHRW6PI.js → status-5ZM6LXHV.js} +10 -10
  102. package/dist/{statusline-2CKH5RHO.js → statusline-O76BCBUK.js} +11 -11
  103. package/dist/{telemetry-WNVKL7HW.js → telemetry-NO7UUUSJ.js} +10 -10
  104. package/dist/{trae-TMJPHWZ5.js → trae-JESXQKAF.js} +4 -4
  105. package/dist/{types-COSBYpKs.d.ts → types-ChUrvw0j.d.ts} +8 -8
  106. package/dist/{uninstall-QFCDXGKR.js → uninstall-QCROBR6A.js} +14 -14
  107. package/dist/{upgrade-PP46DURC.js → upgrade-KJ4QRZDZ.js} +14 -14
  108. package/dist/{usage-VDORZJPT.js → usage-UY6DCND6.js} +2 -2
  109. package/dist/{usage-event-4533OURF.js → usage-event-T4HWQDZF.js} +11 -11
  110. package/dist/{vscode-copilot-H7JKUKLZ.js → vscode-copilot-56USZ5X4.js} +26 -19
  111. package/dist/vscode-copilot-56USZ5X4.js.map +1 -0
  112. package/dist/{warp-SVDVKQQI.js → warp-Y6JNLLGR.js} +4 -4
  113. package/dist/{windsurf-H36YKOMR.js → windsurf-X7QCJ3XR.js} +4 -4
  114. package/dist/{zed-LHWJALLZ.js → zed-L3ML5MHF.js} +4 -4
  115. package/package.json +2 -1
  116. package/dist/amazon-q-UFLBUSHG.js.map +0 -1
  117. package/dist/amp-5DJK7VAL.js.map +0 -1
  118. package/dist/chunk-3Q6YEDCG.js.map +0 -1
  119. package/dist/chunk-54B5HAVT.js.map +0 -1
  120. package/dist/chunk-A767JFHW.js.map +0 -1
  121. package/dist/chunk-AQ53TOH4.js.map +0 -1
  122. package/dist/chunk-L7ESV37V.js.map +0 -1
  123. package/dist/chunk-M3H7PQWT.js.map +0 -1
  124. package/dist/chunk-QY42WGBX.js.map +0 -1
  125. package/dist/chunk-RAJBLK2V.js.map +0 -1
  126. package/dist/chunk-XW46WVR2.js.map +0 -1
  127. package/dist/chunk-ZY25RG4Y.js.map +0 -1
  128. package/dist/claude-code-YNNKQCCR.js.map +0 -1
  129. package/dist/codex-FLU37DV3.js.map +0 -1
  130. package/dist/continue-ZMI4YN75.js.map +0 -1
  131. package/dist/copilot-cli-XPRJ5MQB.js.map +0 -1
  132. package/dist/droid-NZCKYKOV.js.map +0 -1
  133. package/dist/gemini-cli-3ZGCXUDD.js.map +0 -1
  134. package/dist/goose-MGGNVXJP.js.map +0 -1
  135. package/dist/hermes-L3CBJ37L.js.map +0 -1
  136. package/dist/jetbrains-copilot-M2LHJBAW.js.map +0 -1
  137. package/dist/kilo-RMRP2EL7.js.map +0 -1
  138. package/dist/kilo-cli-6ITBNHTH.js.map +0 -1
  139. package/dist/kimi-I35VOOY4.js.map +0 -1
  140. package/dist/kiro-2K5UJVGC.js.map +0 -1
  141. package/dist/mimo-code-K7AMX2QW.js.map +0 -1
  142. package/dist/omp-2RPYIZUF.js.map +0 -1
  143. package/dist/opencode-5D2SK3EX.js.map +0 -1
  144. package/dist/qwen-code-4ZLVGN2C.js.map +0 -1
  145. package/dist/vscode-copilot-H7JKUKLZ.js.map +0 -1
  146. /package/dist/{action-ZUHMOGLV.js.map → action-AIB2W4DU.js.map} +0 -0
  147. /package/dist/{antigravity-NWP2TUG6.js.map → antigravity-PM5NMS2J.js.map} +0 -0
  148. /package/dist/{antigravity-cli-KPNLE7X4.js.map → antigravity-cli-LN25XGWX.js.map} +0 -0
  149. /package/dist/{chunk-LETB5HCK.js.map → chunk-3QCDVSMX.js.map} +0 -0
  150. /package/dist/{chunk-ERV4TKRV.js.map → chunk-4K5HEGVE.js.map} +0 -0
  151. /package/dist/{chunk-H3BATOBP.js.map → chunk-AAOYOAQT.js.map} +0 -0
  152. /package/dist/{chunk-2RPHDVHW.js.map → chunk-AEQRMVRB.js.map} +0 -0
  153. /package/dist/{chunk-5HSLICR3.js.map → chunk-IDKI42JW.js.map} +0 -0
  154. /package/dist/{chunk-3ZZK4KXG.js.map → chunk-KAEYJGK7.js.map} +0 -0
  155. /package/dist/{chunk-VDSXVNEH.js.map → chunk-NFMHYIN2.js.map} +0 -0
  156. /package/dist/{chunk-YG3KFOOQ.js.map → chunk-QP35SRUZ.js.map} +0 -0
  157. /package/dist/{chunk-4CBHYWUG.js.map → chunk-RFYQXT7C.js.map} +0 -0
  158. /package/dist/{chunk-5TMIJ7AY.js.map → chunk-RGQTN7K3.js.map} +0 -0
  159. /package/dist/{chunk-F4DSMVZ7.js.map → chunk-ZQCT63JU.js.map} +0 -0
  160. /package/dist/{cline-AGFJF4AC.js.map → cline-KHZLG7CU.js.map} +0 -0
  161. /package/dist/{codebuff-YUQ4PN7G.js.map → codebuff-EQGWZEP4.js.map} +0 -0
  162. /package/dist/{crush-3OB5ZTCC.js.map → crush-3AAA75C5.js.map} +0 -0
  163. /package/dist/{cursor-F4HYO2FP.js.map → cursor-DTYZROKS.js.map} +0 -0
  164. /package/dist/{detect-FXGBSNQU.js.map → detect-LWZEM7SN.js.map} +0 -0
  165. /package/dist/{doctor-2O65SAPG.js.map → doctor-54P4JFA6.js.map} +0 -0
  166. /package/dist/{hook-D3PY6TDK.js.map → hook-UT3Q43AB.js.map} +0 -0
  167. /package/dist/{install-SVBIK4VJ.js.map → install-F4OIDYAK.js.map} +0 -0
  168. /package/dist/{leaderboard-ZMZST52G.js.map → leaderboard-ZIAXBUWD.js.map} +0 -0
  169. /package/dist/{mux-GT7FWVLH.js.map → mux-DAIC3VY7.js.map} +0 -0
  170. /package/dist/{nemoclaw-GQMS6CUM.js.map → nemoclaw-GS3XA7V2.js.map} +0 -0
  171. /package/dist/{openclaw-P5GMEEGC.js.map → openclaw-344VBMLY.js.map} +0 -0
  172. /package/dist/{package-EDYQF6C6.js.map → package-5FRMSWRT.js.map} +0 -0
  173. /package/dist/{pi-ZMM4KJTO.js.map → pi-EFBTBI2B.js.map} +0 -0
  174. /package/dist/{roo-code-67QGLQRM.js.map → roo-code-YIX3RPR2.js.map} +0 -0
  175. /package/dist/{serve-427CCEYA.js.map → serve-NQBXN4FG.js.map} +0 -0
  176. /package/dist/{status-6IHRW6PI.js.map → status-5ZM6LXHV.js.map} +0 -0
  177. /package/dist/{statusline-2CKH5RHO.js.map → statusline-O76BCBUK.js.map} +0 -0
  178. /package/dist/{telemetry-WNVKL7HW.js.map → telemetry-NO7UUUSJ.js.map} +0 -0
  179. /package/dist/{trae-TMJPHWZ5.js.map → trae-JESXQKAF.js.map} +0 -0
  180. /package/dist/{uninstall-QFCDXGKR.js.map → uninstall-QCROBR6A.js.map} +0 -0
  181. /package/dist/{upgrade-PP46DURC.js.map → upgrade-KJ4QRZDZ.js.map} +0 -0
  182. /package/dist/{usage-VDORZJPT.js.map → usage-UY6DCND6.js.map} +0 -0
  183. /package/dist/{usage-event-4533OURF.js.map → usage-event-T4HWQDZF.js.map} +0 -0
  184. /package/dist/{warp-SVDVKQQI.js.map → warp-Y6JNLLGR.js.map} +0 -0
  185. /package/dist/{windsurf-H36YKOMR.js.map → windsurf-X7QCJ3XR.js.map} +0 -0
  186. /package/dist/{zed-LHWJALLZ.js.map → zed-L3ML5MHF.js.map} +0 -0
@@ -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 StopEvent,\n SubagentStartEvent,\n SubagentStopEvent,\n Transport,\n UserPromptSubmitEvent,\n} from \"../../core/types.js\";\nimport { resolveEnvRefsDeep } from \"../../core/interpolate.js\";\nimport {\n buildHomeBinHookCommand,\n buildWrappedStdio,\n isHomeBinHookCommand,\n} from \"../../core/spawn.js\";\nimport { renderSkillMd, renderSubagentMd } from \"../claude-code/render.js\";\nimport { normalizeSessionSource } from \"../claude-code/wire.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/**\n * CAPABILITY FILTER for installHooks — maps each canonical HookEventName to the\n * `capabilities` flag that gates it. The adapter's `capabilities` literal is the\n * single source of truth for what Copilot CLI's runtime actually fires; declared\n * events (connector.hookEvents is the connector-level set, NOT pre-filtered by\n * host) are screened through this map so an unsupported event — Copilot CLI has\n * NO post-compaction hook, so `postCompact` stays unset — is reported as a\n * graceful warn/skip instead of being written as a dead `hooks.PostCompact` the\n * host would never fire. Same shape as the goose adapter's EVENT_CAPABILITY.\n */\nconst EVENT_CAPABILITY: Record<HookEventName, keyof PlatformCapabilities> = {\n SessionStart: \"sessionStart\",\n SessionEnd: \"sessionEnd\",\n UserPromptSubmit: \"userPromptSubmit\",\n PreToolUse: \"preToolUse\",\n PostToolUse: \"postToolUse\",\n PreCompact: \"preCompact\",\n Stop: \"stop\",\n Notification: \"notification\",\n PermissionRequest: \"permissionRequest\",\n PostToolUseFailure: \"postToolUseFailure\",\n SubagentStart: \"subagentStart\",\n SubagentStop: \"subagentStop\",\n // Copilot CLI has no post-compaction hook — postCompact stays unset on\n // `capabilities`, so a declared PostCompact warn-skips at install.\n PostCompact: \"postCompact\",\n};\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 // PostToolUse (VS Code-compatible dialect): the tool result rides under\n // `tool_result`, NOT `tool_response`. PostToolUse fires success-only, so\n // result_type is always \"success\" (hooks-reference.md:397-400).\n tool_result?: { result_type?: string; text_result_for_llm?: string };\n\n // SessionStart\n source?: string;\n // SessionEnd\n reason?: string;\n // UserPromptSubmit\n prompt?: string;\n // PreCompact\n trigger?: string;\n // Notification\n message?: string;\n\n // PostToolUseFailure — payload is {tool_name, tool_input, error} + base\n // (hooks-reference.md:421-430). No tool_use_id/is_interrupt/duration_ms.\n error?: string;\n\n // SubagentStart / SubagentStop — VS Code dialect identity is `agent_name`\n // (+ optional `agent_display_name`); there is no agent_id/agent_type\n // (hooks-reference.md:467-476,497-507).\n agent_name?: string;\n agent_display_name?: 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 ({ command, args } = buildWrappedStdio(ctx, server, this.id, command, args));\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 // CAPABILITY FILTER: an event Copilot CLI's runtime does not deliver (e.g.\n // PostCompact — postCompact unset on `capabilities`) must NOT be written as\n // a dead hook the host never fires; report a graceful warn/skip instead.\n if (this.capabilities[EVENT_CAPABILITY[event]] !== true) {\n changes.push({\n platform: this.id,\n action: \"warn\",\n path: hooksPath,\n detail: `${event} unsupported on copilot-cli — skipped`,\n });\n continue;\n }\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\"), renderSkillMd(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 // ── 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 renderSubagentMd(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 // ── 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 // PostToolUse fires success-only and carries the result under\n // `tool_result.text_result_for_llm` (VS Code dialect). Failures arrive\n // via the separate PostToolUseFailure event, so isError is never set\n // here (hooks-reference.md:219,397-400).\n const toolOutput = input.tool_result?.text_result_for_llm;\n const ev: PostToolUseEvent = {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n ...(typeof toolOutput === \"string\" ? { 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 // The host signals completion via stop_reason:\"end_turn\", not the\n // stopHookActive loop-guard boolean, so nothing maps onto StopEvent\n // beyond base (hooks-reference.md:449-457).\n const ev: StopEvent = { ...base };\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 // permissionRequest uses the PreToolUse shape (tool_name + tool_input\n // only); the host emits no permission_suggestions payload\n // (hooks-reference.md:218,627-649).\n const ev: PermissionRequestEvent = {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n };\n return ev;\n }\n case \"PostToolUseFailure\": {\n // Host payload is {tool_name, tool_input, error} + base; it carries no\n // tool_use_id / is_interrupt / duration_ms correlation fields\n // (hooks-reference.md:421-430).\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 };\n return ev;\n }\n case \"SubagentStart\": {\n // The host's subagent identity field is `agent_name`; there is no\n // agent_id or agent_type (agent_display_name is a human label, not a\n // type), so agentType stays unset (hooks-reference.md:467-476).\n const ev: SubagentStartEvent = {\n ...base,\n ...(typeof input.agent_name === \"string\" ? { agentId: input.agent_name } : {}),\n };\n return ev;\n }\n case \"SubagentStop\": {\n // VS Code dialect: identity is `agent_name`, the subagent transcript is\n // the BASE `transcript_path` (not agent_transcript_path), and there is\n // no agent_type / last_assistant_message / stop_hook_active — the final\n // response is reachable only via transcript_path, and completion is\n // signalled by stop_reason (hooks-reference.md:497-507).\n const ev: SubagentStopEvent = {\n ...base,\n ...(typeof input.agent_name === \"string\" ? { agentId: input.agent_name } : {}),\n ...(typeof input.transcript_path === \"string\"\n ? { agentTranscriptPath: input.transcript_path }\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\nexport const adapter = new CopilotCliAdapter();\nexport default adapter;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6CA,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,S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,OAAO;AACtB,aAAO,KAAK,OAAO;AAAA,QACjB,oBAAoB;AAAA,UAClB;AAAA,UACA,oBAAoB;AAAA,UACpB,0BAA0B,SAAS,UAAU;AAAA,QAC/C;AAAA,MACF,CAAC;AAAA,IACH;AAGA,QAAI,aAAa,UAAU;AACzB,UAAI,UAAU,gBAAgB,SAAS,cAAc;AACnD,eAAO,KAAK,OAAO;AAAA,UACjB,oBAAoB,EAAE,eAAe,cAAc,SAAS,aAAa;AAAA,QAC3E,CAAC;AAAA,MACH;AAAA,IAEF;AAGA,QAAI,aAAa,aAAa,SAAS,mBAAmB;AACxD,aAAO,KAAK,OAAO;AAAA,QACjB,oBAAoB,EAAE,eAAe,mBAAmB,SAAS,kBAAkB;AAAA,MACrF,CAAC;AAAA,IACH;AAGA,WAAO,EAAE,UAAU,EAAE;AAAA,EACvB;AAAA,EAEQ,OAAO,SAA6B;AAC1C,WAAO,EAAE,UAAU,GAAG,QAAQ,KAAK,UAAU,OAAO,EAAE;AAAA,EACxD;AACF;AAMA,SAAS,iBAAiB,OAAiC;AACzD,MAAI,OAAO,MAAM,oBAAoB,UAAU;AAC7C,UAAM,IAAI,MAAM,gBAAgB,MAAM,yBAAyB;AAC/D,QAAI,KAAK,EAAE,CAAC,EAAG,QAAO,EAAE,CAAC;AAAA,EAC3B;AACA,MAAI,OAAO,MAAM,eAAe,YAAY,MAAM,eAAe,IAAI;AACnE,WAAO,MAAM;AAAA,EACf;AACA,SAAO;AACT;AAEO,IAAM,UAAU,IAAI,kBAAkB;AAC7C,IAAO,sBAAQ;","names":["entry"]}
@@ -9,14 +9,14 @@ import {
9
9
  import {
10
10
  BaseAdapter,
11
11
  renderSkillMd
12
- } from "./chunk-A767JFHW.js";
12
+ } from "./chunk-GI4FDVWI.js";
13
13
  import {
14
14
  buildHomeBinHookCommand,
15
15
  buildWrappedStdio,
16
16
  isHomeBinHookCommand
17
17
  } from "./chunk-TO57WYBB.js";
18
- import "./chunk-ZY25RG4Y.js";
19
- import "./chunk-QY42WGBX.js";
18
+ import "./chunk-LBOGRZGY.js";
19
+ import "./chunk-D65GIBCG.js";
20
20
 
21
21
  // src/adapters/crush/index.ts
22
22
  import { existsSync, statSync } from "fs";
@@ -485,4 +485,4 @@ export {
485
485
  adapter,
486
486
  crush_default as default
487
487
  };
488
- //# sourceMappingURL=crush-3OB5ZTCC.js.map
488
+ //# sourceMappingURL=crush-3AAA75C5.js.map
@@ -5,13 +5,13 @@ import {
5
5
  CursorAdapter,
6
6
  adapter,
7
7
  cursor_default
8
- } from "./chunk-XW46WVR2.js";
8
+ } from "./chunk-O3HIYTBK.js";
9
9
  import "./chunk-H53QZQJI.js";
10
10
  import "./chunk-DBQMX75U.js";
11
- import "./chunk-A767JFHW.js";
11
+ import "./chunk-GI4FDVWI.js";
12
12
  import "./chunk-TO57WYBB.js";
13
- import "./chunk-ZY25RG4Y.js";
14
- import "./chunk-QY42WGBX.js";
13
+ import "./chunk-LBOGRZGY.js";
14
+ import "./chunk-D65GIBCG.js";
15
15
  export {
16
16
  CURSOR_EVENT_MAP,
17
17
  CURSOR_HOOKS_VERSION,
@@ -19,4 +19,4 @@ export {
19
19
  adapter,
20
20
  cursor_default as default
21
21
  };
22
- //# sourceMappingURL=cursor-F4HYO2FP.js.map
22
+ //# sourceMappingURL=cursor-DTYZROKS.js.map
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  print
4
- } from "./chunk-3ZZK4KXG.js";
4
+ } from "./chunk-KAEYJGK7.js";
5
5
  import {
6
6
  detectInstalledPlatforms
7
- } from "./chunk-YG3KFOOQ.js";
8
- import "./chunk-5HSLICR3.js";
7
+ } from "./chunk-QP35SRUZ.js";
8
+ import "./chunk-IDKI42JW.js";
9
9
 
10
10
  // src/cli/commands/detect.ts
11
11
  import { parseArgs } from "util";
@@ -71,4 +71,4 @@ async function run(argv) {
71
71
  export {
72
72
  run
73
73
  };
74
- //# sourceMappingURL=detect-FXGBSNQU.js.map
74
+ //# sourceMappingURL=detect-LWZEM7SN.js.map
@@ -2,18 +2,18 @@
2
2
  import {
3
3
  marketplaceDoctorChecks,
4
4
  syncConnector
5
- } from "./chunk-RAJBLK2V.js";
6
- import "./chunk-5TMIJ7AY.js";
5
+ } from "./chunk-FVARNRCE.js";
6
+ import "./chunk-RGQTN7K3.js";
7
7
  import {
8
8
  readMarketplaceInstalls
9
- } from "./chunk-M3H7PQWT.js";
10
- import "./chunk-XW46WVR2.js";
9
+ } from "./chunk-WOUGWPZQ.js";
10
+ import "./chunk-O3HIYTBK.js";
11
11
  import {
12
12
  fail,
13
13
  parseScope,
14
14
  parseTargets,
15
15
  print
16
- } from "./chunk-3ZZK4KXG.js";
16
+ } from "./chunk-KAEYJGK7.js";
17
17
  import {
18
18
  LineBuffer,
19
19
  idKey,
@@ -24,33 +24,33 @@ import {
24
24
  } from "./chunk-7QRUZAUG.js";
25
25
  import {
26
26
  detectInstalledPlatforms
27
- } from "./chunk-YG3KFOOQ.js";
27
+ } from "./chunk-QP35SRUZ.js";
28
28
  import "./chunk-KHO5WNTP.js";
29
29
  import {
30
30
  findConnectorConfig,
31
31
  listRegisteredConnectors,
32
32
  loadConnectorFromPath,
33
33
  readRegisteredMeta
34
- } from "./chunk-AQ53TOH4.js";
34
+ } from "./chunk-O4BKQSPP.js";
35
35
  import {
36
36
  MCP_PROTOCOL_VERSION
37
- } from "./chunk-54B5HAVT.js";
37
+ } from "./chunk-JZIM33C2.js";
38
38
  import {
39
39
  REGISTERED_PLATFORM_IDS,
40
40
  loadAdapter
41
- } from "./chunk-5HSLICR3.js";
42
- import "./chunk-L7ESV37V.js";
41
+ } from "./chunk-IDKI42JW.js";
42
+ import "./chunk-BZOOVTFG.js";
43
43
  import "./chunk-OPXAP3AC.js";
44
44
  import "./chunk-UM5S7DKK.js";
45
45
  import "./chunk-H53QZQJI.js";
46
46
  import "./chunk-DBQMX75U.js";
47
- import "./chunk-A767JFHW.js";
47
+ import "./chunk-GI4FDVWI.js";
48
48
  import "./chunk-TO57WYBB.js";
49
- import "./chunk-ZY25RG4Y.js";
49
+ import "./chunk-LBOGRZGY.js";
50
50
  import {
51
51
  dataRoot,
52
52
  homeBinPath
53
- } from "./chunk-QY42WGBX.js";
53
+ } from "./chunk-D65GIBCG.js";
54
54
 
55
55
  // src/cli/commands/doctor.ts
56
56
  import { parseArgs } from "util";
@@ -541,4 +541,4 @@ async function run(argv) {
541
541
  export {
542
542
  run
543
543
  };
544
- //# sourceMappingURL=doctor-2O65SAPG.js.map
544
+ //# sourceMappingURL=doctor-54P4JFA6.js.map
@@ -8,16 +8,16 @@ import {
8
8
  import {
9
9
  BaseAdapter,
10
10
  renderCommandMd
11
- } from "./chunk-A767JFHW.js";
11
+ } from "./chunk-GI4FDVWI.js";
12
12
  import {
13
13
  buildWrappedStdio,
14
14
  isHomeBinHookCommand
15
15
  } from "./chunk-TO57WYBB.js";
16
- import "./chunk-ZY25RG4Y.js";
17
- import "./chunk-QY42WGBX.js";
16
+ import "./chunk-LBOGRZGY.js";
17
+ import "./chunk-D65GIBCG.js";
18
18
 
19
19
  // src/adapters/droid/index.ts
20
- import { chmodSync, existsSync } from "fs";
20
+ import { existsSync } from "fs";
21
21
  import { homedir } from "os";
22
22
  import { join } from "path";
23
23
  var HOST = "droid";
@@ -438,9 +438,7 @@ var DroidAdapter = class extends BaseAdapter {
438
438
  }
439
439
  return triggers.map((trigger) => {
440
440
  const path = this.actionPath(ctx, trigger.id);
441
- const record = this.writeContentFile(path, this.renderActionScript(trigger.command), ctx.dryRun);
442
- if (record.action !== "skip" && !ctx.dryRun) chmodSync(path, 493);
443
- return record;
441
+ return this.writeManagedFile(path, this.renderActionScript(trigger.command), ctx.dryRun, void 0, true);
444
442
  });
445
443
  }
446
444
  uninstallActions(ctx) {
@@ -556,10 +554,6 @@ exec ${command} "$@"
556
554
  case "SubagentStop": {
557
555
  const ev = {
558
556
  ...base,
559
- ...typeof input.agent_id === "string" ? { agentId: input.agent_id } : {},
560
- ...typeof input.agent_type === "string" ? { agentType: input.agent_type } : {},
561
- ...typeof input.agent_transcript_path === "string" ? { agentTranscriptPath: input.agent_transcript_path } : {},
562
- ...typeof input.last_assistant_message === "string" ? { lastAssistantMessage: input.last_assistant_message } : {},
563
557
  ...typeof input.stop_hook_active === "boolean" ? { stopHookActive: input.stop_hook_active } : {}
564
558
  };
565
559
  return ev;
@@ -655,4 +649,4 @@ export {
655
649
  adapter,
656
650
  droid_default as default
657
651
  };
658
- //# sourceMappingURL=droid-NZCKYKOV.js.map
652
+ //# sourceMappingURL=droid-QMNO5WZ2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/adapters/droid/index.ts"],"sourcesContent":["/**\n * adapters/droid — Droid (Factory AI) platform adapter for agent-connector.\n *\n * Droid is a **json-stdio** host with TWO native config surfaces that live in\n * DIFFERENT files (so getServerConfigPath ≠ getHookConfigPath):\n *\n * 1. MCP servers — `mcp.json` (root key `mcpServers`):\n * - user scope → ~/.factory/mcp.json\n * - project scope → <projectDir>/.factory/mcp.json\n * Native stdio entry shape: { type:\"stdio\", command, args, env, disabled };\n * a remote server registers a URL ({ type:\"http\", url, headers, disabled }).\n *\n * 2. Hooks — a SEPARATE `hooks.json` (root key `hooks`) under the same\n * `.factory` dir. Droid ships a FULL Claude-compatible lifecycle hook\n * system (live-confirmed): PascalCase event names, Claude snake_case stdin\n * wire fields, and a Claude-shaped `hookSpecificOutput` reply. Hook\n * registrations use the Claude NESTED-rule shape:\n * { hooks: { <Event>: [ { matcher?, hooks:[{ type:\"command\", command }] } ] } }\n *\n * Supported events (Claude-compatible): PreToolUse, PostToolUse,\n * UserPromptSubmit, Stop, SubagentStop (stop-only — no SubagentStart), plus the\n * full lifecycle set Notification, PreCompact, SessionStart, SessionEnd\n * (docs.factory.ai/reference/hooks-reference — Claude-identical PascalCase 1:1\n * with the same snake_case stdin wire). Droid exposes no PermissionRequest /\n * PostToolUseFailure / SubagentStart, so those degrade to a warn/skip at\n * install time.\n *\n * Reply protocol is Claude-shaped JSON on stdout (exit 0 + `hookSpecificOutput`\n * with permissionDecision allow|deny|ask, plus additionalContext). Droid cannot\n * rewrite already-emitted tool output, so canModifyOutput is false; it CAN\n * inject session context (additionalContext) so canInjectSessionContext is true\n * (SessionStart honors hookSpecificOutput.additionalContext per the same docs).\n *\n * Env handling: env/header/url refs are resolved to literals at install time via\n * resolveEnvRefsDeep — the safe default matching the Kiro/Qwen adapters. Droid\n * also accepts native ${VAR}, but resolve-to-literal avoids surprises.\n */\n\nimport { existsSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\n\nimport { BaseAdapter, type HookMergeDescriptor } from \"../base.js\";\nimport { renderCommandMd } from \"../claude-code/render.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 PlatformCapabilities,\n PlatformId,\n PostToolUseEvent,\n PreCompactEvent,\n PreToolUseEvent,\n ServerDef,\n SessionEndEvent,\n SessionStartEvent,\n SkillDef,\n StopEvent,\n SubagentDef,\n SubagentStopEvent,\n Transport,\n UserPromptSubmitEvent,\n} from \"../../core/types.js\";\nimport { resolveEnvRefsDeep } from \"../../core/interpolate.js\";\nimport {\n buildWrappedStdio,\n isHomeBinHookCommand,\n} from \"../../core/spawn.js\";\nimport { normalizeSessionSource } from \"../claude-code/wire.js\";\n\nconst HOST: PlatformId = \"droid\";\nconst MCP_ROOT_KEY = \"mcpServers\";\n\n/**\n * Canonical events Droid actually fires. Droid's hook event names are\n * Claude-identical (PascalCase), so the canonical name is registered directly.\n * Notification / PreCompact / SessionStart / SessionEnd are all documented\n * Droid lifecycle hooks (docs.factory.ai/reference/hooks-reference) and so are\n * wired here too.\n *\n * Droid is a STOP-ONLY subagent host: its live hooks-reference lists\n * SubagentStop but NO SubagentStart, and it has no permission-dialog\n * (PermissionRequest) or tool-failure (PostToolUseFailure) events — those\n * three warn/skip at install time.\n */\nconst SUPPORTED_EVENTS: ReadonlySet<HookEventName> = new Set<HookEventName>([\n \"PreToolUse\",\n \"PostToolUse\",\n \"UserPromptSubmit\",\n \"Stop\",\n \"SubagentStop\",\n \"Notification\",\n \"PreCompact\",\n \"SessionStart\",\n \"SessionEnd\",\n]);\n\n/**\n * Native MCP server entry shapes Droid accepts under `mcpServers`.\n * A stdio entry carries an explicit `type: \"stdio\"` discriminator and a\n * `disabled` flag; remote transports register a URL.\n */\ninterface DroidStdioServer {\n type: \"stdio\";\n command: string;\n args?: string[];\n env?: Record<string, string>;\n disabled: boolean;\n}\ninterface DroidHttpServer {\n type: \"http\";\n url: string;\n headers?: Record<string, string>;\n disabled: boolean;\n}\n\n/** A single Droid native hook registration entry (Claude-shaped, nested). */\ninterface DroidHookEntry {\n matcher: string;\n hooks: Array<{ type: \"command\"; command: string }>;\n}\n\n/** The shape of Droid's hooks.json (only the parts we touch). */\ninterface DroidHooksFile {\n hooks?: Record<string, DroidHookEntry[]>;\n [key: string]: unknown;\n}\n\n/** Raw Droid CLI hook stdin payload (Claude-compatible snake_case wire fields). */\ninterface DroidWireInput {\n session_id?: string;\n transcript_path?: string;\n cwd?: string;\n hook_event_name?: string;\n tool_name?: string;\n tool_input?: Record<string, unknown>;\n tool_response?: unknown;\n prompt?: string;\n /** Notification — the user-facing notification text. */\n message?: string;\n /** PreCompact — compaction trigger (manual = /compact, auto = full context). */\n trigger?: \"auto\" | \"manual\";\n /** SessionStart — startup | resume | clear | compact (matcher source). */\n source?: string;\n /** SessionEnd — clear | logout | prompt_input_exit | other. */\n reason?: string;\n /** Stop / SubagentStop loop guard. */\n stop_hook_active?: boolean;\n // NO SubagentStop agent_id / agent_type / agent_transcript_path /\n // last_assistant_message: Factory documents a SINGLE shared \"Stop and\n // SubagentStop Input\" whose COMPLETE shape is { session_id, transcript_path,\n // cwd, permission_mode, hook_event_name, stop_hook_active } — there is no\n // per-subagent identity, no subagent transcript, and no final-response field\n // on the wire (the final response is reachable only via transcript_path). We\n // previously read all four; they were false-friends that never populated.\n // Primary source: docs.factory.ai/reference/hooks-reference\n // (Stop and SubagentStop Input — verified zero occurrences of each field).\n /** Injected by the entrypoint so the runtime knows which connector to dispatch. */\n connector?: unknown;\n}\n\nexport class DroidAdapter extends BaseAdapter implements Adapter {\n readonly id: PlatformId = HOST;\n readonly name = \"Droid (Factory)\";\n readonly paradigm: HookParadigm = \"json-stdio\";\n\n readonly capabilities: PlatformCapabilities = {\n // Memory surface: AGENTS.md-first managed block via the BaseAdapter default\n // (memoryTargets: project <projectDir>/AGENTS.md; user scope where documented).\n supportsMemory: true,\n preToolUse: true,\n postToolUse: true,\n // Notification / PreCompact / SessionStart / SessionEnd are documented Droid\n // lifecycle hooks (docs.factory.ai/reference/hooks-reference) with the same\n // Claude-shaped snake_case stdin wire — all four fire natively.\n preCompact: true,\n sessionStart: true,\n sessionEnd: true,\n userPromptSubmit: true,\n stop: true,\n notification: true,\n // Newer events: Droid ships SubagentStop (stop-only — no SubagentStart).\n // permissionRequest / postToolUseFailure / subagentStart stay unset (no\n // Droid analog); install reports the standard skip-warn for them.\n subagentStop: true,\n // Droid's PreToolUse can deny/ask (Claude-shaped), but it cannot rewrite\n // already-emitted tool output. canModifyArgs left false until confirmed.\n canModifyArgs: false,\n canModifyOutput: false,\n // Droid honors additionalContext on the stdout reply.\n canInjectSessionContext: true,\n // Droid registers stdio and Streamable HTTP MCP servers.\n transports: [\"stdio\", \"http\"],\n // Droid HAS a confirmed command-driven status line: `statusLine.command`\n // (object {command, padding?, maxRows?}) in ~/.factory/settings.json, stdout\n // rendered above the input (docs.factory.ai/cli/configuration/settings). BUT\n // Factory publishes NO statusline stdin payload schema (the model/cost/\n // context_window fields circulating online are Claude Code's, not\n // Factory-captured), so the payload→StatuslineContext mapping can't be\n // authored without a live stdin capture (blocked: needs an authenticated\n // droid session). NOT a permanent gap — supportsStatusline stays unset until\n // the payload is captured (set statusLine.command to a stdin-dumping script\n // on a real droid box to confirm).\n // Content surfaces: Droid implements all three (live-confirmed Factory dirs).\n // command → <configDir>/commands/<name>.md (md+frontmatter: description, argument-hint)\n // skill → <configDir>/skills/<name>/SKILL.md (+ resources)\n // subagent → <configDir>/droids/<name>.md (MARKDOWN — folder is droids/, NOT agents/)\n supportsCommands: true,\n supportsSkills: true,\n supportsSubagents: true,\n // Actions: Droid runs EXECUTABLE files placed at <configDir>/commands/<id>\n // (NO .md extension) via `/<id>` — \"Executable files must start with a valid\n // shebang so the CLI can call the interpreter\" and stdout is returned to the\n // transcript (docs.factory.ai/cli/configuration/custom-slash-commands). We\n // write a POSIX shebang script that execs the home-bin action verb. The\n // exec-file interpreter resolution is UNVERIFIED on win32, so the emitter\n // skip-warns there (see installActions).\n supportsActions: true,\n };\n\n // ── Detection ────────────────────────────────────────────────────────────\n\n detectInstalled(projectDir: string): DetectedPlatform {\n const userDir = join(homedir(), \".factory\");\n const userMcp = join(userDir, \"mcp.json\");\n const projDir = join(projectDir, \".factory\");\n const projMcp = join(projDir, \"mcp.json\");\n\n const userInstalled = existsSync(userDir) || existsSync(userMcp);\n const projInstalled = existsSync(projDir) || existsSync(projMcp);\n const installed = userInstalled || projInstalled;\n const scope = projInstalled && !userInstalled ? \"project\" : \"user\";\n const configPath = scope === \"project\" ? projMcp : userMcp;\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 Droid config (${scope}) at ${configPath}`\n : `no .factory config at ${userDir} or ${projDir}`,\n confidence: installed ? \"high\" : \"low\",\n };\n }\n\n // ── Native paths ─────────────────────────────────────────────────────────\n\n getConfigDir(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? join(ctx.projectDir, \".factory\")\n : join(homedir(), \".factory\");\n }\n\n getServerConfigPath(ctx: InstallContext): string {\n return join(this.getConfigDir(ctx), \"mcp.json\");\n }\n\n /** Hooks live in a SEPARATE hooks.json under the same `.factory` dir. */\n getHookConfigPath(ctx: InstallContext): string {\n return join(this.getConfigDir(ctx), \"hooks.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 droid\"\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 Droid's native mcpServers entry. */\n private renderServerEntry(\n ctx: InstallContext,\n server: ServerDef,\n ): DroidStdioServer | DroidHttpServer {\n const transport: Transport = server.transport;\n const disabled = server.enabled === false;\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 ({ command, args } = buildWrappedStdio(ctx, server, this.id, command, args));\n\n // Resolve every ${env:VAR} to a literal at install time (safe path).\n const entry: DroidStdioServer = {\n type: \"stdio\",\n command: resolveEnvRefsDeep(command),\n disabled,\n };\n if (args.length > 0) entry.args = resolveEnvRefsDeep(args);\n const env = this.renderEnv(server.env);\n if (env) entry.env = env;\n return entry;\n }\n\n // http (and any other remote transport) — Droid registers a URL.\n const entry: DroidHttpServer = {\n type: \"http\",\n url: resolveEnvRefsDeep(server.url ?? \"\"),\n disabled,\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. Resolve `${env:VAR}` references to literals at\n * install time (the safe path; Droid would also accept native ${VAR}).\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 // ── Hook install / uninstall (separate hooks.json, nested-rule shape) ─────\n\n installHooks(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[HOST]?.hooks === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"hooks disabled for droid\" }];\n }\n if (connector.hookEvents.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no hooks\" }];\n }\n\n const pending = connector.hookEvents.map((event) => ({\n event,\n matcher: connector.hooks[event]?.matcher ?? \"\",\n }));\n return this.upsertHookEntries(\n ctx,\n this.getHookConfigPath(ctx),\n pending,\n this.hookDescriptor(ctx),\n );\n }\n\n uninstallHooks(ctx: InstallContext): ChangeRecord[] {\n return this.removeHookEntries(ctx, this.getHookConfigPath(ctx), this.hookDescriptor(ctx));\n }\n\n /**\n * Droid's hook-merge descriptor (NESTED shape `{ matcher, hooks: [...] }`).\n * Bound to `ctx` because droid's ownership is CONNECTOR-GENERIC (ANY of our\n * commands in the entry's inner `hooks`, not a specific-command match):\n * - mapEvent = drop events outside SUPPORTED_EVENTS (Droid has no equivalent\n * for PermissionRequest / PostToolUseFailure / SubagentStart / PostCompact);\n * droid's event names are Claude-identical, so supported events map 1:1.\n * - entryOwnsCommand ignores the specific command — it reuses isOurCommand\n * over the inner commands (the old entryHasOurCommand, folded in here).\n * - uninstall = inner-strip ONLY (ownsEntryForRemove never-true); every detail\n * string is the literal droid wording.\n */\n private hookDescriptor(ctx: InstallContext): HookMergeDescriptor<DroidHookEntry> {\n return {\n mapEvent: (e) => (SUPPORTED_EVENTS.has(e as HookEventName) ? e : undefined),\n unmappedWarnDetail: (e) => `${e} has no Droid hook equivalent — skipped`,\n renderEntry: (_event, matcher, command) => ({\n matcher,\n hooks: [{ type: \"command\", command }],\n }),\n entryOwnsCommand: (entry, _command) =>\n (entry.hooks ?? []).some((h) => this.isOurCommand(h.command, ctx)),\n ownsEntryForRemove: () => () => false,\n stripInner: (c) => (entry) => {\n const innerBefore = entry.hooks?.length ?? 0;\n const inner = (entry.hooks ?? []).filter((h) => !this.isOurCommand(h.command, c));\n return {\n next: inner.length > 0 ? { matcher: entry.matcher ?? \"\", hooks: inner } : null,\n removed: innerBefore - inner.length,\n };\n },\n skipDetail: (event) => `hooks.${event} already registered`,\n removeDetail: (event, removed) => `hooks.${event} (${removed})`,\n absentDetail: \"no hooks section present\",\n noMatchDetail: \"no matching hook entries\",\n };\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: commands / skills / subagents ──────────────────────\n // CONTENT-ONLY: pure native-file writers under <configDir>/{commands,skills,\n // droids}. No runtime dispatch, no home-bin pointer, no telemetry wrap. Each\n // method is idempotent (byte-identical → skip) via writeContentFile and\n // reversible via removeContentFile. Honors platforms[\"droid\"] per-surface\n // false to skip. Both user and project scope (getConfigDir resolves either).\n //\n // Native locations (live-confirmed Factory dirs):\n // command → <configDir>/commands/<name>.md md+frontmatter(description, argument-hint)\n // skill → <configDir>/skills/<name>/SKILL.md (+ resources)\n // subagent → <configDir>/droids/<name>.md MARKDOWN — folder is droids/, NOT agents/\n\n /** Native command file path: <configDir>/commands/<name>.md. */\n private commandPath(ctx: InstallContext, name: string): string {\n return join(this.getConfigDir(ctx), \"commands\", `${name}.md`);\n }\n /** Native skill dir: <configDir>/skills/<name>. */\n private skillDir(ctx: InstallContext, name: string): string {\n return join(this.getConfigDir(ctx), \"skills\", name);\n }\n /** Native subagent file path: <configDir>/droids/<name>.md (folder droids/, NOT agents/). */\n private subagentPath(ctx: InstallContext, name: string): string {\n return join(this.getConfigDir(ctx), \"droids\", `${name}.md`);\n }\n\n // ── Commands ──────────────────────────────────────────────────────────────\n\n override installCommands(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[HOST]?.commands === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"commands disabled for droid\" }];\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(\n this.commandPath(ctx, cmd.name),\n renderCommandMd(cmd, { includeToolsAndModel: false }),\n ctx.dryRun,\n ),\n );\n }\n\n override uninstallCommands(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\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(ctx, cmd.name), ctx.dryRun),\n );\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 droid\" }];\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\n * disable-model-invocation) + body. Droid documents disable-model-invocation\n * as a skill field; it has NO model/allowed-tools skill field, so those are\n * never emitted (unlike the uniform claude/codex renderer).\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.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 (MARKDOWN — folder droids/, NOT agents/) ────────────────────\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 droid\" }];\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 /**\n * Render a Droid subagent to a MARKDOWN file (NOT TOML — codex emits TOML,\n * which is wrong for droid): YAML frontmatter { name, description?, model? }\n * then the prompt as the markdown body.\n */\n private renderSubagent(agent: SubagentDef): string {\n const frontmatter: Record<string, unknown> = { name: agent.name };\n if (agent.description !== undefined) frontmatter.description = agent.description;\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 // ── Action surface (executable command file, NO .md extension) ────────────\n // Each action emits an EXECUTABLE script at <configDir>/commands/<id> (no\n // extension) whose shebang lets Droid's CLI exec it; it execs the home-bin\n // action verb and forwards \"$@\". Invoked via `/<id>`, stdout → transcript\n // (docs.factory.ai/cli/configuration/custom-slash-commands). chmod 0o755.\n //\n // COLLISION NOTE: the COMMAND surface writes commands/<name>.md; actions write\n // commands/<id> (no extension) — different filenames, both register `/<name>`.\n // A connector reusing one id for a command AND an action is the author's call.\n //\n // CROSS-OS: the shebang exec-file is POSIX. On win32 Droid's exec-file\n // interpreter resolution is UNVERIFIED, so we skip-warn there and write nothing\n // (honest degradation, like other Windows caveats in the codebase).\n\n /** Native action file path: <configDir>/commands/<id> (NO .md extension). */\n private actionPath(ctx: InstallContext, id: string): string {\n return join(this.getConfigDir(ctx), \"commands\", id);\n }\n\n override installActions(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[HOST]?.actions === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"actions disabled for droid\" }];\n }\n const triggers = this.actionTriggers(ctx);\n if (triggers.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no actions\" }];\n }\n if (process.platform === \"win32\") {\n return [\n {\n platform: this.id,\n action: \"warn\",\n detail: `droid action exec-files are unverified on Windows; ${triggers.length} skipped`,\n },\n ];\n }\n return triggers.map((trigger) => {\n const path = this.actionPath(ctx, trigger.id);\n return this.writeManagedFile(path, this.renderActionScript(trigger.command), ctx.dryRun, undefined, true);\n });\n }\n\n override uninstallActions(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.actions.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no actions\" }];\n }\n return connector.actions.map((action) =>\n this.removeContentFile(this.actionPath(ctx, action.id), ctx.dryRun),\n );\n }\n\n /** Render the POSIX exec-file: shebang + `exec <action verb> \"$@\"`. */\n private renderActionScript(command: string): string {\n return `#!/usr/bin/env sh\\nexec ${command} \"$@\"\\n`;\n }\n\n // ── Diagnostics ──────────────────────────────────────────────────────────\n\n override getHealthChecks(ctx: InstallContext): readonly HealthCheck[] {\n const mcpPath = this.getServerConfigPath(ctx);\n const hookPath = this.getHookConfigPath(ctx);\n const connectorId = ctx.connector.id;\n const homeBin = ctx.homeBinPath;\n const hookEvents = ctx.connector.hookEvents;\n return [\n {\n name: `${this.name}: mcp.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}: server entry registered`,\n check: () => {\n if (!ctx.connector.server) {\n return { status: \"OK\", detail: \"no MCP server declared\" };\n }\n const cfg = this.readJson<{ [k: string]: Record<string, unknown> }>(mcpPath);\n const bucket = cfg?.[MCP_ROOT_KEY];\n if (!cfg || !bucket) {\n return { status: \"FAIL\", detail: `no ${MCP_ROOT_KEY} in ${mcpPath}` };\n }\n return connectorId in bucket\n ? { status: \"OK\", detail: `${MCP_ROOT_KEY}.${connectorId} present` }\n : {\n status: \"FAIL\",\n detail: `no ${MCP_ROOT_KEY}.${connectorId} in ${mcpPath}`,\n };\n },\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<DroidHooksFile>(hookPath);\n if (!file) return { status: \"FAIL\", detail: `cannot read ${hookPath}` };\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 ${hookPath}` };\n },\n },\n ];\n }\n\n // ── Runtime: parse Droid stdin JSON → normalized event ────────────────────\n\n parseEvent(event: HookEventName, raw: unknown): NormalizedEvent {\n const input = (raw ?? {}) as DroidWireInput;\n const connectorId = typeof input.connector === \"string\" ? input.connector : \"\";\n const sessionId = typeof input.session_id === \"string\" ? input.session_id : \"\";\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 \"UserPromptSubmit\": {\n const ev: UserPromptSubmitEvent = {\n ...base,\n prompt: typeof input.prompt === \"string\" ? input.prompt : \"\",\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 \"SubagentStop\": {\n // Droid sends ONLY the documented Stop/SubagentStop wire:\n // { session_id, transcript_path, cwd, permission_mode, hook_event_name,\n // stop_hook_active }. It emits NO agent_id / agent_type /\n // agent_transcript_path / last_assistant_message — reading those was a\n // false-friend (they never populated). The subagent's final response is\n // reachable only through transcript_path, which rides on base.raw.\n // Primary source: docs.factory.ai/reference/hooks-reference\n // (Stop and SubagentStop Input).\n const ev: SubagentStopEvent = {\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 // Droid Notification: { …, hook_event_name:\"Notification\", message }\n // (docs.factory.ai/reference/hooks-reference). Only `message` maps.\n const ev: NotificationEvent = {\n ...base,\n message: typeof input.message === \"string\" ? input.message : \"\",\n };\n return ev;\n }\n case \"PreCompact\": {\n // Droid PreCompact: { …, trigger:\"manual\"|\"auto\", custom_instructions }.\n // Only the documented `trigger` enum maps; custom_instructions rides on\n // base.raw (no normalized field).\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 \"SessionStart\": {\n // Droid SessionStart: { …, source:\"startup\"|\"resume\"|\"clear\"|\"compact\" }.\n // Coerce the documented matcher source onto the normalized enum.\n const ev: SessionStartEvent = {\n ...base,\n source: normalizeSessionSource(input.source),\n };\n return ev;\n }\n case \"SessionEnd\": {\n // Droid SessionEnd: { …, reason:\"clear\"|\"logout\"|\"prompt_input_exit\"|\n // \"other\" }. Only the documented `reason` maps.\n const ev: SessionEndEvent = {\n ...base,\n ...(typeof input.reason === \"string\" ? { reason: input.reason } : {}),\n };\n return ev;\n }\n default: {\n // Droid never delivers PermissionRequest / PostToolUseFailure /\n // SubagentStart (no native equivalent — see SUPPORTED_EVENTS). If the\n // runtime dispatches one anyway, surface it loudly rather than silently\n // mis-parse.\n throw new Error(`unsupported droid hook event: ${String(event)}`);\n }\n }\n }\n\n // ── Runtime: normalized response → Droid native (Claude-shaped) hook reply ─\n\n formatReply(event: HookEventName, response: HookResponse): HookReply {\n const hookEventName = event;\n const decision = response.decision ?? \"allow\";\n\n // Notification / PreCompact / SessionEnd are observe-only: per\n // docs.factory.ai/reference/hooks-reference their Decision Control is \"N/A\"\n // (cannot block) and they carry no context-injection surface, so every\n // decision is an unconditional no-op passthrough (mirrors Stop). SessionStart\n // is deliberately NOT here — it honors hookSpecificOutput.additionalContext,\n // so it falls through to the generic `context` branch below.\n if (event === \"Notification\" || event === \"PreCompact\" || event === \"SessionEnd\") {\n return { exitCode: 0 };\n }\n\n // deny → block the action with a reason (exit 0; JSON carries the decision).\n if (decision === \"deny\") {\n // SubagentStop deny carries Stop semantics — it keeps the subagent\n // running with `reason` as its next instruction — and (Claude-compatible)\n // is honored only as the TOP-LEVEL {\"decision\":\"block\",\"reason\"}, not as\n // a permissionDecision envelope.\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 // context → inject soft guidance (Droid honors additionalContext).\n if (decision === \"context\" && response.additionalContext) {\n return this.stdout({\n hookSpecificOutput: { hookEventName, additionalContext: response.additionalContext },\n });\n }\n\n // allow / modify (unsupported — exit-code/decision protocol only) / void →\n // 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/** Coerce a Droid 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\nexport const adapter = new DroidAdapter();\nexport default adapter;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsCA,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,YAAY;AAmCrB,IAAM,OAAmB;AACzB,IAAM,eAAe;AAcrB,IAAM,mBAA+C,oBAAI,IAAmB;AAAA,EAC1E;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAkEM,IAAM,eAAN,cAA2B,YAA+B;AAAA,EACtD,KAAiB;AAAA,EACjB,OAAO;AAAA,EACP,WAAyB;AAAA,EAEzB,eAAqC;AAAA;AAAA;AAAA,IAG5C,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,aAAa;AAAA;AAAA;AAAA;AAAA,IAIb,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,YAAY;AAAA,IACZ,kBAAkB;AAAA,IAClB,MAAM;AAAA,IACN,cAAc;AAAA;AAAA;AAAA;AAAA,IAId,cAAc;AAAA;AAAA;AAAA,IAGd,eAAe;AAAA,IACf,iBAAiB;AAAA;AAAA,IAEjB,yBAAyB;AAAA;AAAA,IAEzB,YAAY,CAAC,SAAS,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAe5B,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,IAChB,mBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQnB,iBAAiB;AAAA,EACnB;AAAA;AAAA,EAIA,gBAAgB,YAAsC;AACpD,UAAM,UAAU,KAAK,QAAQ,GAAG,UAAU;AAC1C,UAAM,UAAU,K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AU,KAAK;AAAA,EAC7B,QAAQ;AACN,WAAO,OAAO,KAAK;AAAA,EACrB;AACF;AAEO,IAAM,UAAU,IAAI,aAAa;AACxC,IAAO,gBAAQ;","names":["entry"]}
@@ -12,7 +12,7 @@ import {
12
12
  BaseAdapter,
13
13
  renderSkillMd,
14
14
  renderSubagentMd
15
- } from "./chunk-A767JFHW.js";
15
+ } from "./chunk-GI4FDVWI.js";
16
16
  import {
17
17
  buildHomeBinHookCommand,
18
18
  buildUsageEventCommand,
@@ -21,8 +21,8 @@ import {
21
21
  isHostNativeUsageEnabled,
22
22
  isUsageEventCommand
23
23
  } from "./chunk-TO57WYBB.js";
24
- import "./chunk-ZY25RG4Y.js";
25
- import "./chunk-QY42WGBX.js";
24
+ import "./chunk-LBOGRZGY.js";
25
+ import "./chunk-D65GIBCG.js";
26
26
 
27
27
  // src/adapters/gemini-cli/index.ts
28
28
  import { existsSync } from "fs";
@@ -50,6 +50,18 @@ var EVENT_MAP = {
50
50
  UserPromptSubmit: GEMINI_EVENT.BeforeAgent,
51
51
  Notification: GEMINI_EVENT.Notification
52
52
  };
53
+ function extractToolOutput(toolResponse) {
54
+ if (typeof toolResponse === "string") return toolResponse;
55
+ if (toolResponse === null || typeof toolResponse !== "object") return void 0;
56
+ const obj = toolResponse;
57
+ const value = obj.llmContent ?? obj.returnDisplay;
58
+ if (value === void 0 || value === null) return void 0;
59
+ return typeof value === "string" ? value : JSON.stringify(value);
60
+ }
61
+ function hasToolError(toolResponse) {
62
+ if (toolResponse === null || typeof toolResponse !== "object") return false;
63
+ return toolResponse.error != null;
64
+ }
53
65
  var GeminiCliAdapter = class extends BaseAdapter {
54
66
  id = HOST;
55
67
  name = "Gemini CLI";
@@ -665,12 +677,13 @@ var GeminiCliAdapter = class extends BaseAdapter {
665
677
  return ev;
666
678
  }
667
679
  case "PostToolUse": {
680
+ const toolOutput = extractToolOutput(input.tool_response);
668
681
  const ev = {
669
682
  ...base,
670
683
  toolName: input.tool_name ?? "",
671
684
  toolInput: input.tool_input ?? {},
672
- ...input.tool_output !== void 0 ? { toolOutput: input.tool_output } : {},
673
- ...input.is_error === true ? { isError: true } : {}
685
+ ...toolOutput !== void 0 ? { toolOutput } : {},
686
+ ...hasToolError(input.tool_response) ? { isError: true } : {}
674
687
  };
675
688
  return ev;
676
689
  }
@@ -757,4 +770,4 @@ export {
757
770
  adapter,
758
771
  gemini_cli_default as default
759
772
  };
760
- //# sourceMappingURL=gemini-cli-3ZGCXUDD.js.map
773
+ //# sourceMappingURL=gemini-cli-7JU7ZWQL.js.map