@ken-jo/agent-connector 0.4.6 → 0.4.8

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 (187) hide show
  1. package/dist/{action-EV63GAPY.js → action-RWPRIZIC.js} +10 -10
  2. package/dist/{amazon-q-COAL3764.js → amazon-q-5LJOB5L3.js} +6 -18
  3. package/dist/amazon-q-5LJOB5L3.js.map +1 -0
  4. package/dist/{amp-XJQ4TDAU.js → amp-PU4LFSY6.js} +16 -48
  5. package/dist/amp-PU4LFSY6.js.map +1 -0
  6. package/dist/{antigravity-AMKKKHS4.js → antigravity-DWW35HZO.js} +6 -5
  7. package/dist/{antigravity-cli-XERXEH5W.js → antigravity-cli-VTQ6DNWL.js} +6 -5
  8. package/dist/{antigravity-cli-XERXEH5W.js.map → antigravity-cli-VTQ6DNWL.js.map} +1 -1
  9. package/dist/{chunk-F5RX62T7.js → chunk-7QRUZAUG.js} +2 -2
  10. package/dist/{chunk-G5CQHVQG.js → chunk-7TVBFRVI.js} +12 -15
  11. package/dist/chunk-7TVBFRVI.js.map +1 -0
  12. package/dist/{chunk-QC5A3TFQ.js → chunk-A2T4Q7RM.js} +18 -18
  13. package/dist/{chunk-2X4EH2D7.js → chunk-CDVOBKSG.js} +4 -4
  14. package/dist/{chunk-RQPKL62M.js → chunk-CENEXP7K.js} +9 -38
  15. package/dist/chunk-CENEXP7K.js.map +1 -0
  16. package/dist/chunk-FBJQGRET.js +38 -0
  17. package/dist/chunk-FBJQGRET.js.map +1 -0
  18. package/dist/{chunk-WZA4CSGJ.js → chunk-H53QZQJI.js} +15 -2
  19. package/dist/chunk-H53QZQJI.js.map +1 -0
  20. package/dist/{chunk-DCK5FADX.js → chunk-HOE2MN36.js} +2 -2
  21. package/dist/{chunk-7L6ITC4T.js → chunk-IEGR4TP3.js} +22 -6
  22. package/dist/chunk-IEGR4TP3.js.map +1 -0
  23. package/dist/{chunk-CPLK7GTE.js → chunk-KG6T3YNJ.js} +353 -36
  24. package/dist/chunk-KG6T3YNJ.js.map +1 -0
  25. package/dist/{chunk-MZF2YCXX.js → chunk-MOW2RKHX.js} +2 -2
  26. package/dist/{chunk-EXLS7BSI.js → chunk-NLFPH4S2.js} +10 -2
  27. package/dist/chunk-NLFPH4S2.js.map +1 -0
  28. package/dist/{chunk-EROJDXMW.js → chunk-NYR55UT7.js} +2 -2
  29. package/dist/{chunk-SRVAA2VN.js → chunk-OZ5EXXQV.js} +2 -2
  30. package/dist/{chunk-I5MLE6S7.js → chunk-TO57WYBB.js} +15 -1
  31. package/dist/chunk-TO57WYBB.js.map +1 -0
  32. package/dist/chunk-UM5S7DKK.js +33 -0
  33. package/dist/chunk-UM5S7DKK.js.map +1 -0
  34. package/dist/{chunk-5G4EPJ4Y.js → chunk-VRKTVCYJ.js} +7 -7
  35. package/dist/{chunk-QOGMDOUX.js → chunk-WI6YSXOC.js} +3 -3
  36. package/dist/{chunk-BMD7ANKF.js → chunk-XQUUNAGC.js} +36 -36
  37. package/dist/{chunk-LQRAPXS4.js → chunk-YS2NYJ6R.js} +15 -49
  38. package/dist/chunk-YS2NYJ6R.js.map +1 -0
  39. package/dist/{chunk-H67V7DEL.js → chunk-YYISBXOM.js} +7 -7
  40. package/dist/{claude-code-T2LPFNC3.js → claude-code-64X6RR2S.js} +46 -133
  41. package/dist/claude-code-64X6RR2S.js.map +1 -0
  42. package/dist/cli/sdk.js +4 -4
  43. package/dist/cli.js +1 -1
  44. package/dist/{cline-WRYMNS7Z.js → cline-T7ZDJYZQ.js} +15 -47
  45. package/dist/cline-T7ZDJYZQ.js.map +1 -0
  46. package/dist/{codebuff-PODYPOOP.js → codebuff-PPPY3SJV.js} +9 -40
  47. package/dist/codebuff-PPPY3SJV.js.map +1 -0
  48. package/dist/{codex-O4G7D7KK.js → codex-EEVN43C2.js} +115 -172
  49. package/dist/codex-EEVN43C2.js.map +1 -0
  50. package/dist/{continue-K43SUHLQ.js → continue-VLLZO4PM.js} +12 -33
  51. package/dist/continue-VLLZO4PM.js.map +1 -0
  52. package/dist/{copilot-cli-Q3SSPT4V.js → copilot-cli-A7G5WB4N.js} +17 -64
  53. package/dist/copilot-cli-A7G5WB4N.js.map +1 -0
  54. package/dist/{crush-MBEH2R3I.js → crush-AH24GDDB.js} +17 -42
  55. package/dist/crush-AH24GDDB.js.map +1 -0
  56. package/dist/{cursor-TMBXDYR4.js → cursor-GJBSMXI6.js} +61 -183
  57. package/dist/cursor-GJBSMXI6.js.map +1 -0
  58. package/dist/{detect-AHJIUMBO.js → detect-YDCZNV4W.js} +4 -4
  59. package/dist/{doctor-G5MLCPAB.js → doctor-DGC7P3P7.js} +13 -12
  60. package/dist/{doctor-G5MLCPAB.js.map → doctor-DGC7P3P7.js.map} +1 -1
  61. package/dist/{droid-JC2NT6S4.js → droid-RBWCFKL3.js} +63 -144
  62. package/dist/droid-RBWCFKL3.js.map +1 -0
  63. package/dist/{gemini-cli-ILR7M5X3.js → gemini-cli-CFPFEJEA.js} +20 -63
  64. package/dist/gemini-cli-CFPFEJEA.js.map +1 -0
  65. package/dist/{goose-SFO5BBGW.js → goose-UBJVQFUE.js} +107 -183
  66. package/dist/goose-UBJVQFUE.js.map +1 -0
  67. package/dist/{hermes-3N7WN4WS.js → hermes-6FXGXLNL.js} +41 -83
  68. package/dist/hermes-6FXGXLNL.js.map +1 -0
  69. package/dist/{hook-76JBKTUX.js → hook-CDGSCASQ.js} +10 -10
  70. package/dist/index.js +2 -2
  71. package/dist/{install-R7252QFH.js → install-2D3UKEME.js} +13 -12
  72. package/dist/{install-R7252QFH.js.map → install-2D3UKEME.js.map} +1 -1
  73. package/dist/{jetbrains-copilot-NRZHI5PC.js → jetbrains-copilot-K26KMA3U.js} +12 -37
  74. package/dist/jetbrains-copilot-K26KMA3U.js.map +1 -0
  75. package/dist/{kilo-IX4T3OHJ.js → kilo-BKZJ26RM.js} +26 -90
  76. package/dist/kilo-BKZJ26RM.js.map +1 -0
  77. package/dist/{kilo-cli-2AYCXBQD.js → kilo-cli-6UVWCXQD.js} +17 -48
  78. package/dist/kilo-cli-6UVWCXQD.js.map +1 -0
  79. package/dist/{kimi-2YFK2GBA.js → kimi-QALYPSRR.js} +20 -31
  80. package/dist/kimi-QALYPSRR.js.map +1 -0
  81. package/dist/{kiro-YL6AWUYG.js → kiro-J5J42I5Z.js} +12 -31
  82. package/dist/kiro-J5J42I5Z.js.map +1 -0
  83. package/dist/{leaderboard-V6VWA5ZV.js → leaderboard-VZQXNWTX.js} +2 -2
  84. package/dist/{mimo-code-FTMGSKMQ.js → mimo-code-BEE622P2.js} +22 -87
  85. package/dist/mimo-code-BEE622P2.js.map +1 -0
  86. package/dist/{mux-5XZFB44C.js → mux-5HTNKK4K.js} +10 -54
  87. package/dist/mux-5HTNKK4K.js.map +1 -0
  88. package/dist/{nemoclaw-CQYXZVQN.js → nemoclaw-DNFIZFDF.js} +5 -5
  89. package/dist/{omp-2QMEY6HD.js → omp-I3UTRBNP.js} +16 -48
  90. package/dist/omp-I3UTRBNP.js.map +1 -0
  91. package/dist/{openclaw-UZC437RW.js → openclaw-QE2LMWIF.js} +5 -5
  92. package/dist/{opencode-L4BGFP25.js → opencode-ZFSUYJXI.js} +22 -88
  93. package/dist/opencode-ZFSUYJXI.js.map +1 -0
  94. package/dist/{package-DNLQTPNN.js → package-BSCCMW4E.js} +8 -8
  95. package/dist/{pi-PVVPVWKG.js → pi-H2KBBDDJ.js} +4 -4
  96. package/dist/{qwen-code-G4CXKUHR.js → qwen-code-5LE34FNE.js} +63 -152
  97. package/dist/qwen-code-5LE34FNE.js.map +1 -0
  98. package/dist/{roo-code-67TYJIQR.js → roo-code-XH4GCYIS.js} +15 -52
  99. package/dist/roo-code-XH4GCYIS.js.map +1 -0
  100. package/dist/runtime/index.js +8 -8
  101. package/dist/sdk/index.js +3 -3
  102. package/dist/sdk/test.js +5 -5
  103. package/dist/{serve-EOVWYBGZ.js → serve-MQNGPY2H.js} +10 -10
  104. package/dist/{status-VTD6XXLW.js → status-MRHVRDFY.js} +8 -7
  105. package/dist/{status-VTD6XXLW.js.map → status-MRHVRDFY.js.map} +1 -1
  106. package/dist/{statusline-3ET5YPQ5.js → statusline-IYWA75TR.js} +9 -9
  107. package/dist/{telemetry-QCTMKDBQ.js → telemetry-IONIOMLC.js} +5 -5
  108. package/dist/{trae-7CZZGOGI.js → trae-RVNRSV7X.js} +10 -39
  109. package/dist/trae-RVNRSV7X.js.map +1 -0
  110. package/dist/{uninstall-FL3SH2DT.js → uninstall-ESLSVCLE.js} +13 -12
  111. package/dist/{uninstall-FL3SH2DT.js.map → uninstall-ESLSVCLE.js.map} +1 -1
  112. package/dist/{upgrade-SLFG2FCT.js → upgrade-VICY5T64.js} +13 -12
  113. package/dist/{upgrade-SLFG2FCT.js.map → upgrade-VICY5T64.js.map} +1 -1
  114. package/dist/{usage-IRBLVUZM.js → usage-TCUWV2YZ.js} +2 -2
  115. package/dist/{usage-event-VFF77WYY.js → usage-event-CBZZP37Q.js} +9 -9
  116. package/dist/{vscode-copilot-MF2CDNMT.js → vscode-copilot-B2QBBHJW.js} +17 -65
  117. package/dist/vscode-copilot-B2QBBHJW.js.map +1 -0
  118. package/dist/{warp-VKG55TAT.js → warp-5R54ST3N.js} +7 -19
  119. package/dist/warp-5R54ST3N.js.map +1 -0
  120. package/dist/{windsurf-FU5G4SHF.js → windsurf-L32UEOLY.js} +6 -18
  121. package/dist/windsurf-L32UEOLY.js.map +1 -0
  122. package/dist/{zed-SFUHL3GS.js → zed-FDJHJZKD.js} +11 -21
  123. package/dist/zed-FDJHJZKD.js.map +1 -0
  124. package/package.json +1 -1
  125. package/dist/amazon-q-COAL3764.js.map +0 -1
  126. package/dist/amp-XJQ4TDAU.js.map +0 -1
  127. package/dist/chunk-7L6ITC4T.js.map +0 -1
  128. package/dist/chunk-CPLK7GTE.js.map +0 -1
  129. package/dist/chunk-EXLS7BSI.js.map +0 -1
  130. package/dist/chunk-G5CQHVQG.js.map +0 -1
  131. package/dist/chunk-I5MLE6S7.js.map +0 -1
  132. package/dist/chunk-LQRAPXS4.js.map +0 -1
  133. package/dist/chunk-RQPKL62M.js.map +0 -1
  134. package/dist/chunk-WZA4CSGJ.js.map +0 -1
  135. package/dist/claude-code-T2LPFNC3.js.map +0 -1
  136. package/dist/cline-WRYMNS7Z.js.map +0 -1
  137. package/dist/codebuff-PODYPOOP.js.map +0 -1
  138. package/dist/codex-O4G7D7KK.js.map +0 -1
  139. package/dist/continue-K43SUHLQ.js.map +0 -1
  140. package/dist/copilot-cli-Q3SSPT4V.js.map +0 -1
  141. package/dist/crush-MBEH2R3I.js.map +0 -1
  142. package/dist/cursor-TMBXDYR4.js.map +0 -1
  143. package/dist/droid-JC2NT6S4.js.map +0 -1
  144. package/dist/gemini-cli-ILR7M5X3.js.map +0 -1
  145. package/dist/goose-SFO5BBGW.js.map +0 -1
  146. package/dist/hermes-3N7WN4WS.js.map +0 -1
  147. package/dist/jetbrains-copilot-NRZHI5PC.js.map +0 -1
  148. package/dist/kilo-IX4T3OHJ.js.map +0 -1
  149. package/dist/kilo-cli-2AYCXBQD.js.map +0 -1
  150. package/dist/kimi-2YFK2GBA.js.map +0 -1
  151. package/dist/kiro-YL6AWUYG.js.map +0 -1
  152. package/dist/mimo-code-FTMGSKMQ.js.map +0 -1
  153. package/dist/mux-5XZFB44C.js.map +0 -1
  154. package/dist/omp-2QMEY6HD.js.map +0 -1
  155. package/dist/opencode-L4BGFP25.js.map +0 -1
  156. package/dist/qwen-code-G4CXKUHR.js.map +0 -1
  157. package/dist/roo-code-67TYJIQR.js.map +0 -1
  158. package/dist/trae-7CZZGOGI.js.map +0 -1
  159. package/dist/vscode-copilot-MF2CDNMT.js.map +0 -1
  160. package/dist/warp-VKG55TAT.js.map +0 -1
  161. package/dist/windsurf-FU5G4SHF.js.map +0 -1
  162. package/dist/zed-SFUHL3GS.js.map +0 -1
  163. /package/dist/{action-EV63GAPY.js.map → action-RWPRIZIC.js.map} +0 -0
  164. /package/dist/{antigravity-AMKKKHS4.js.map → antigravity-DWW35HZO.js.map} +0 -0
  165. /package/dist/{chunk-F5RX62T7.js.map → chunk-7QRUZAUG.js.map} +0 -0
  166. /package/dist/{chunk-QC5A3TFQ.js.map → chunk-A2T4Q7RM.js.map} +0 -0
  167. /package/dist/{chunk-2X4EH2D7.js.map → chunk-CDVOBKSG.js.map} +0 -0
  168. /package/dist/{chunk-DCK5FADX.js.map → chunk-HOE2MN36.js.map} +0 -0
  169. /package/dist/{chunk-MZF2YCXX.js.map → chunk-MOW2RKHX.js.map} +0 -0
  170. /package/dist/{chunk-EROJDXMW.js.map → chunk-NYR55UT7.js.map} +0 -0
  171. /package/dist/{chunk-SRVAA2VN.js.map → chunk-OZ5EXXQV.js.map} +0 -0
  172. /package/dist/{chunk-5G4EPJ4Y.js.map → chunk-VRKTVCYJ.js.map} +0 -0
  173. /package/dist/{chunk-QOGMDOUX.js.map → chunk-WI6YSXOC.js.map} +0 -0
  174. /package/dist/{chunk-BMD7ANKF.js.map → chunk-XQUUNAGC.js.map} +0 -0
  175. /package/dist/{chunk-H67V7DEL.js.map → chunk-YYISBXOM.js.map} +0 -0
  176. /package/dist/{detect-AHJIUMBO.js.map → detect-YDCZNV4W.js.map} +0 -0
  177. /package/dist/{hook-76JBKTUX.js.map → hook-CDGSCASQ.js.map} +0 -0
  178. /package/dist/{leaderboard-V6VWA5ZV.js.map → leaderboard-VZQXNWTX.js.map} +0 -0
  179. /package/dist/{nemoclaw-CQYXZVQN.js.map → nemoclaw-DNFIZFDF.js.map} +0 -0
  180. /package/dist/{openclaw-UZC437RW.js.map → openclaw-QE2LMWIF.js.map} +0 -0
  181. /package/dist/{package-DNLQTPNN.js.map → package-BSCCMW4E.js.map} +0 -0
  182. /package/dist/{pi-PVVPVWKG.js.map → pi-H2KBBDDJ.js.map} +0 -0
  183. /package/dist/{serve-EOVWYBGZ.js.map → serve-MQNGPY2H.js.map} +0 -0
  184. /package/dist/{statusline-3ET5YPQ5.js.map → statusline-IYWA75TR.js.map} +0 -0
  185. /package/dist/{telemetry-QCTMKDBQ.js.map → telemetry-IONIOMLC.js.map} +0 -0
  186. /package/dist/{usage-IRBLVUZM.js.map → usage-TCUWV2YZ.js.map} +0 -0
  187. /package/dist/{usage-event-VFF77WYY.js.map → usage-event-CBZZP37Q.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/jsonc.ts","../src/core/object-map.ts","../src/adapters/base.ts","../src/core/hook-array.ts"],"sourcesContent":["/**\n * core/jsonc — tolerant JSONC / JSON5-lite parsing.\n *\n * Many hosts document their config file as JSONC (or JSON5): // line comments,\n * /* *\\/ block comments, and trailing commas are all legal. A strict JSON.parse\n * false-fails such a perfectly valid file → null → and a careless `?? {}` then\n * OVERWRITES the user's entire config with just our entry (data loss). To avoid\n * that, every JSON/JSONC adapter parses through `parseJsonc`, which strips\n * comments + trailing commas in ONE string-aware pass before JSON.parse.\n *\n * The single pass is deliberately string-literal aware: a // or /* inside a\n * quoted value (e.g. \"http://x//y\") is NOT a comment, and a comma inside a\n * string (e.g. \"a,]\") is NOT a trailing comma — both must survive verbatim.\n */\n\n/**\n * Strip // line comments, /* *\\/ block comments, and trailing commas from JSONC\n * text in a SINGLE string-aware pass.\n *\n * Rules:\n * - While inside a string literal, every character (including //, /*, and ,)\n * is copied verbatim; backslash escapes the next character.\n * - Outside a string, // … runs to end-of-line and /* … *\\/ to its close.\n * - A comma is dropped ONLY when the next non-whitespace, non-comment token is\n * a closing `}` or `]` (a trailing comma). A comma followed by another value\n * or by end-of-input is preserved (the latter lets JSON.parse report the\n * real syntax error instead of us masking it).\n */\nexport function stripJsonc(text: string): string {\n const n = text.length;\n let out = \"\";\n let i = 0;\n let inString = false;\n let quote = \"\";\n\n while (i < n) {\n const ch = text[i] as string;\n\n if (inString) {\n out += ch;\n if (ch === \"\\\\\") {\n // Copy the escaped character verbatim (covers \\\" \\\\ \\/ etc.).\n if (i + 1 < n) {\n out += text[i + 1] as string;\n i += 2;\n continue;\n }\n } else if (ch === quote) {\n inString = false;\n }\n i += 1;\n continue;\n }\n\n const next = i + 1 < n ? (text[i + 1] as string) : \"\";\n\n // Enter a string literal.\n if (ch === '\"' || ch === \"'\") {\n inString = true;\n quote = ch;\n out += ch;\n i += 1;\n continue;\n }\n\n // Line comment — skip to end of line (keep the newline for line tracking).\n if (ch === \"/\" && next === \"/\") {\n i += 2;\n while (i < n && text[i] !== \"\\n\") i += 1;\n continue;\n }\n\n // Block comment — skip to the closing */.\n if (ch === \"/\" && next === \"*\") {\n i += 2;\n while (i < n && !(text[i] === \"*\" && text[i + 1] === \"/\")) i += 1;\n i += 2; // consume the closing */\n continue;\n }\n\n // Trailing comma — drop it only when the next significant token (skipping\n // whitespace AND comments) is a closing } or ]. This stays string-aware\n // because we only reach here outside a string.\n if (ch === \",\") {\n const closer = nextSignificant(text, i + 1);\n if (closer === \"}\" || closer === \"]\") {\n i += 1; // drop the trailing comma\n continue;\n }\n }\n\n out += ch;\n i += 1;\n }\n\n return out;\n}\n\n/**\n * Peek the next significant (non-whitespace, non-comment) character at/after\n * `from`, returning \"\" at end-of-input. Used only outside string literals.\n */\nfunction nextSignificant(text: string, from: number): string {\n const n = text.length;\n let i = from;\n while (i < n) {\n const ch = text[i] as string;\n if (ch === \" \" || ch === \"\\t\" || ch === \"\\r\" || ch === \"\\n\") {\n i += 1;\n continue;\n }\n const next = i + 1 < n ? (text[i + 1] as string) : \"\";\n if (ch === \"/\" && next === \"/\") {\n i += 2;\n while (i < n && text[i] !== \"\\n\") i += 1;\n continue;\n }\n if (ch === \"/\" && next === \"*\") {\n i += 2;\n while (i < n && !(text[i] === \"*\" && text[i + 1] === \"/\")) i += 1;\n i += 2;\n continue;\n }\n return ch;\n }\n return \"\";\n}\n\n/**\n * Parse JSONC text tolerantly: strip comments + trailing commas, then JSON.parse.\n * Throws (like JSON.parse) on genuinely malformed input — callers that want a\n * fail-soft null should wrap in try/catch (BaseAdapter.readJson does).\n */\nexport function parseJsonc<T = unknown>(text: string): T {\n return JSON.parse(stripJsonc(text)) as T;\n}\n","import type { ChangeRecord } from \"./types.js\";\n\n/**\n * Format-agnostic upsert/remove for a config that stores entries in an object\n * map at config[rootKey][entryId]. Extracted from BaseAdapter.upsertServerInJson\n * / removeServerFromJson so JSON today (and other formats via a Codec later)\n * share ONE create/skip/update + overwrite/malformed-guard orchestration. The\n * JSON binding in BaseAdapter is a byte-identical wrapper over this.\n */\n\n/** The only format-specific surface: parse a config file to a record and\n * serialize it back. parse() fail-softs to null (absent or unparseable). */\nexport interface ObjectMapCodec {\n parse(path: string): Record<string, unknown> | null;\n serialize(path: string, data: Record<string, unknown>, dryRun: boolean): void;\n /** Detection half of the overwrite guard: present, non-empty, still unparseable. */\n isPresentButUnparseable(path: string): boolean;\n}\n\n/** What to do when config[rootKey] is present but the wrong type (hand-edited to\n * an array / primitive). \"warn-skip\" leaves the user's value untouched (the JSON\n * server/hook policy); \"coerce\" replaces it with a fresh {} and proceeds (the\n * TOML/YAML host policy, used by a later follow-up). */\nexport type MalformedRootPolicy = \"warn-skip\" | \"coerce\";\n\n/** True when a PRESENT value is not a plain object map (array / primitive).\n * null/undefined is NOT malformed — that is the well-formed \"absent\" case the\n * engine creates fresh. */\nexport function isMalformedRootValue(value: unknown): boolean {\n return value != null && (typeof value !== \"object\" || Array.isArray(value));\n}\n\nexport interface ObjectMapUpsertOptions {\n codec: ObjectMapCodec;\n rootKey: string;\n platform: string;\n configPath: string;\n entryId: string;\n entry: unknown;\n dryRun?: boolean;\n policy?: MalformedRootPolicy;\n}\n\nexport interface ObjectMapRemoveOptions {\n codec: ObjectMapCodec;\n rootKey: string;\n platform: string;\n configPath: string;\n entryId: string;\n dryRun?: boolean;\n policy?: MalformedRootPolicy;\n}\n\nfunction unparseableWarn(platform: string, configPath: string): ChangeRecord {\n return {\n platform: platform as ChangeRecord[\"platform\"],\n action: \"warn\",\n path: configPath,\n detail: `existing ${configPath} is not parseable; left untouched (back it up / fix it, then re-run)`,\n };\n}\n\nfunction malformedWarn(platform: string, rootKey: string, configPath: string): ChangeRecord {\n return {\n platform: platform as ChangeRecord[\"platform\"],\n action: \"warn\",\n path: configPath,\n detail: `existing \"${rootKey}\" in ${configPath} is not an object map; left untouched (fix it, then re-run)`,\n };\n}\n\nexport function upsertInObjectMap(o: ObjectMapUpsertOptions): ChangeRecord {\n const policy = o.policy ?? \"warn-skip\";\n if (o.codec.isPresentButUnparseable(o.configPath)) {\n return unparseableWarn(o.platform, o.configPath);\n }\n const cfg = o.codec.parse(o.configPath) ?? {};\n if (isMalformedRootValue(cfg[o.rootKey])) {\n if (policy === \"warn-skip\") return malformedWarn(o.platform, o.rootKey, o.configPath);\n cfg[o.rootKey] = {}; // coerce\n }\n const bucket = (cfg[o.rootKey] ?? (cfg[o.rootKey] = {})) as Record<string, unknown>;\n const before = JSON.stringify(bucket[o.entryId]);\n const after = JSON.stringify(o.entry);\n let action: ChangeRecord[\"action\"];\n if (before === undefined) action = \"create\";\n else if (before === after) action = \"skip\";\n else action = \"update\";\n if (action !== \"skip\") {\n bucket[o.entryId] = o.entry;\n o.codec.serialize(o.configPath, cfg, o.dryRun ?? false);\n }\n return {\n platform: o.platform as ChangeRecord[\"platform\"],\n action,\n path: o.configPath,\n detail: `${o.rootKey}.${o.entryId}`,\n };\n}\n\nexport function removeFromObjectMap(o: ObjectMapRemoveOptions): ChangeRecord {\n const policy = o.policy ?? \"warn-skip\";\n if (o.codec.isPresentButUnparseable(o.configPath)) {\n return unparseableWarn(o.platform, o.configPath);\n }\n const cfg = o.codec.parse(o.configPath);\n if (cfg && isMalformedRootValue(cfg[o.rootKey])) {\n if (policy === \"warn-skip\") return malformedWarn(o.platform, o.rootKey, o.configPath);\n // coerce: a malformed root holds nothing of ours to remove → absent skip\n return {\n platform: o.platform as ChangeRecord[\"platform\"],\n action: \"skip\",\n path: o.configPath,\n detail: `${o.rootKey}.${o.entryId} absent`,\n };\n }\n const bucket = cfg?.[o.rootKey] as Record<string, unknown> | undefined;\n if (!cfg || !bucket || !(o.entryId in bucket)) {\n return {\n platform: o.platform as ChangeRecord[\"platform\"],\n action: \"skip\",\n path: o.configPath,\n detail: `${o.rootKey}.${o.entryId} absent`,\n };\n }\n delete bucket[o.entryId];\n o.codec.serialize(o.configPath, cfg, o.dryRun ?? false);\n return {\n platform: o.platform as ChangeRecord[\"platform\"],\n action: \"remove\",\n path: o.configPath,\n detail: `${o.rootKey}.${o.entryId}`,\n };\n}\n","/**\n * adapters/base — shared adapter foundation.\n *\n * Provides JSON config IO, settings backup, and a default doctor. Per-platform\n * specifics (paths, capabilities, native render format, runtime parse/format)\n * are abstract and implemented by each adapter. TOML/YAML adapters override the\n * JSON helpers entirely.\n */\n\nimport {\n copyFileSync,\n existsSync,\n readdirSync,\n readFileSync,\n rmSync,\n statSync,\n writeFileSync,\n} from \"node:fs\";\nimport type { Dirent } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { basename, dirname, isAbsolute, join, relative, resolve, sep } from \"node:path\";\n\nimport type {\n ChangeRecord,\n DetectedPlatform,\n DiagnosticResult,\n HealthCheck,\n HookParadigm,\n PlatformCapabilities,\n PlatformId,\n PlatformMemoryOverride,\n} from \"../core/types.js\";\nimport { backupsDir, ensureDir } from \"../core/paths.js\";\nimport { parseJsonc } from \"../core/jsonc.js\";\nimport {\n isMalformedRootValue as isMalformedRootValueFn,\n removeFromObjectMap,\n upsertInObjectMap,\n type ObjectMapCodec,\n} from \"../core/object-map.js\";\nimport { removeFromArray, upsertInArray } from \"../core/hook-array.js\";\nimport { buildHomeBinActionCommand, buildHomeBinHookCommand } from \"../core/spawn.js\";\nimport {\n MEMORY_CONTENT_SOFT_BUDGET_BYTES,\n listManagedBlocks,\n loadMemoryLedger,\n recordMemoryTarget,\n removeManagedBlocksFile,\n saveMemoryLedger,\n upsertManagedBlockFile,\n} from \"../core/managed-block.js\";\nimport { renderFrontmatterMd } from \"./claude-code/render.js\";\nimport type { Adapter, InstallContext, MemoryTarget } from \"./spi.js\";\n\n/** Content-surface kinds with BaseAdapter default install/uninstall handling. */\ntype ContentSurface =\n | \"commands\"\n | \"skills\"\n | \"subagents\"\n | \"memory\"\n | \"statusline\"\n | \"actions\";\n\n/**\n * Per-host policy + observables for the shared object-map hook-array merge\n * engine ({@link BaseAdapter.upsertHookEntries} / {@link BaseAdapter.removeHookEntries}).\n * `E` is the host's per-event array element type (e.g. claude-code's\n * `{ matcher, hooks: [...] }`). EVERY observable string + ownership predicate\n * is carried here so the engine body hardcodes none of them and per-host\n * wording never drifts; a future host needing divergent details overrides only\n * its descriptor, not the engine.\n */\nexport interface HookMergeDescriptor<E> {\n /**\n * How to handle a present-but-malformed `hooks` root (an array / primitive\n * instead of an object map) on install:\n * - \"warn-skip\" (DEFAULT): route through {@link BaseAdapter.malformedHookRootSkip}\n * — surface a `warn`, write nothing, leave the user's value untouched. This\n * is byte-identical to the pre-axis engine, so existing hosts that omit the\n * field are unchanged.\n * - \"coerce\": replace a malformed root (and any non-array event bucket) with a\n * fresh object map / array, then proceed — matching the container hosts\n * (codex, goose) whose server path already coerces a malformed root.\n */\n malformedPolicy?: \"warn-skip\" | \"coerce\";\n /**\n * Canonical → host event name. `undefined` = the host has no equivalent for\n * this event → the engine emits a warn (via unmappedWarnDetail) and skips it.\n * Omit the field entirely for identity hosts (claude-code) — no warn path.\n */\n mapEvent?(event: string): string | undefined;\n /** Warn detail for an event mapEvent returns undefined for. Required iff mapEvent can return undefined. */\n unmappedWarnDetail?(event: string): string;\n /** Render one host entry from the event name, declared matcher, and home-bin command. */\n renderEntry(event: string, matcher: string, command: string): E;\n /** Upsert find: does `entry` already carry THIS specific command (idempotency check)? */\n entryOwnsCommand(entry: E, command: string): boolean;\n /**\n * Uninstall whole-entry predicate (FLAT hosts): does `entry` belong to us?\n * NESTED hosts supplying {@link stripInner} may return a never-true predicate —\n * the engine then only ever invokes `stripInner`. Bound to `ctx` because\n * ownership is connector-generic (ANY of our commands), wider than the\n * install-time specific-command check. The `event` param lets EVENT-SPECIFIC\n * hosts (codex, whose ownership is per-event by construction) match the\n * canonical event being stripped; hosts whose ownership is event-independent\n * (claude-code/droid/cursor/qwen) ignore it — a `(ctx) => …` arrow is assignable\n * to this 2-param type (fewer params is fine in TS), so they need no change.\n */\n ownsEntryForRemove(ctx: InstallContext, event: string): (entry: E) => boolean;\n /**\n * Uninstall inner-strip (NESTED hosts): strip our owned inner commands from\n * `entry`, returning the rebuilt entry (`null` when fully emptied) and the\n * count of inner commands removed. Omit for FLAT hosts.\n */\n stripInner?(ctx: InstallContext): (entry: E) => { next: E | null; removed: number };\n /** Idempotent-reinstall skip detail, e.g. `hooks.<event> already registered`. */\n skipDetail(event: string): string;\n /** Uninstall remove detail, e.g. `hooks.<event> (<n>)`. */\n removeDetail(event: string, removed: number): string;\n /** Uninstall skip detail when no hooks section is present at all. */\n absentDetail: string;\n /** Uninstall skip detail when a hooks section exists but nothing matched. */\n noMatchDetail: string;\n /**\n * Uninstall: the exact event keys to scan, in order. Omit (default) to scan\n * every key actually present (`Object.keys(hooks)`). EVENT-SPECIFIC hosts whose\n * ownership predicate rebuilds a per-event command (codex) MUST pin their fixed\n * event set here so a home-bin command hand-placed under a foreign event key is\n * left untouched — byte-identical to a fixed-event-list uninstall loop.\n */\n removeEventKeys?: readonly string[];\n /** Optional post-mutation hook on the whole parsed file, before the single write. */\n onMutate?(file: Record<string, unknown>): void;\n /**\n * Native-pass ownership find (EXACT command match, vs the normalized\n * entryOwnsCommand). Set only when a `native` list is passed.\n */\n nativeOwnsCommand?(entry: E, command: string): boolean;\n /** Native-pass skip detail, e.g. `hooks.<event> (native) already registered`. */\n nativeSkipDetail?(event: string): string;\n /** Native-pass create/update detail, e.g. `hooks.<event> (native)`. */\n nativeMutateDetail?(event: string): string;\n}\n\n/**\n * One resolved action trigger for an EMITTER adapter: the host-native trigger\n * the adapter writes runs `command`, which re-enters the home binary at the\n * `action` verb. `label`/`description` fall back to the action id when the\n * connector declared none. Produced by {@link BaseAdapter.actionTriggers}.\n */\nexport interface ActionTrigger {\n /** The action id — also the per-action file/key name on most hosts. */\n id: string;\n /** Display label (action.description ?? action.id). */\n label: string;\n /** One-line description (action.description ?? action.id). */\n description: string;\n /** `<homeBin> action <host> <id> --connector <connectorId>` (the verb the host runs). */\n command: string;\n}\n\n/**\n * Documented USER-scope AGENTS.md locations, per host (the AGENTS.md-first\n * research matrix). Only hosts with a REAL user/global AGENTS.md file are\n * listed. Hosts whose documented user-scope memory lives in a DIFFERENT file\n * (qwen-code ~/.qwen/QWEN.md, goose .goosehints, kilo/roo/kiro rules dirs,\n * copilot-cli copilot-instructions.md) override memoryTargets in-adapter;\n * hosts whose user rules are app/UI/cloud-managed (warp Drive, trae,\n * jetbrains/cursor settings UI) deliberately have no row — user-scope memory\n * there reports the standard skip-warn (the JetBrains-MCP precedent), never a\n * write into a file the host ignores.\n */\nconst AGENTS_MD_USER_PATHS: Partial<Record<PlatformId, () => MemoryTarget>> = {\n // codex resolves its own user path in-adapter ($CODEX_HOME with ~ expansion\n // + the AGENTS.override.md shadow probe) — deliberately no row here.\n zed: () => ({\n path:\n process.platform === \"win32\" && process.env.APPDATA\n ? join(process.env.APPDATA, \"Zed\", \"AGENTS.md\")\n : join(homedir(), \".config\", \"zed\", \"AGENTS.md\"),\n reason: \"zed personal instructions file\",\n }),\n amp: () => ({\n path: join(homedir(), \".config\", \"amp\", \"AGENTS.md\"),\n reason: \"amp user-scope AGENTS.md\",\n }),\n mux: () => ({\n path: join(homedir(), \".mux\", \"AGENTS.md\"),\n reason: \"mux global AGENTS.md\",\n }),\n pi: () => ({\n path: join(homedir(), \".pi\", \"agent\", \"AGENTS.md\"),\n reason: \"pi global AGENTS.md\",\n }),\n droid: () => ({\n path: join(homedir(), \".factory\", \"AGENTS.md\"),\n reason: \"droid (Factory) personal AGENTS.md\",\n }),\n opencode: () => ({\n path: join(homedir(), \".config\", \"opencode\", \"AGENTS.md\"),\n reason: \"opencode global AGENTS.md\",\n }),\n antigravity: () => ({\n path: join(homedir(), \".gemini\", \"AGENTS.md\"),\n reason: \"antigravity global rules (~/.gemini/AGENTS.md, shared tree)\",\n }),\n \"antigravity-cli\": () => ({\n path: join(homedir(), \".gemini\", \"AGENTS.md\"),\n reason: \"agy shares the IDE's ~/.gemini tree (idempotent upsert dedupes)\",\n }),\n omp: () => ({\n path: join(homedir(), \".omp\", \"agent\", \"AGENTS.md\"),\n reason: \"omp global AGENTS.md (pi-parity; verify for your version)\",\n }),\n};\n\nexport abstract class BaseAdapter implements Adapter {\n abstract readonly id: PlatformId;\n abstract readonly name: string;\n abstract readonly paradigm: HookParadigm;\n abstract readonly capabilities: PlatformCapabilities;\n\n abstract detectInstalled(projectDir: string): DetectedPlatform;\n abstract getConfigDir(ctx: InstallContext): string;\n abstract getServerConfigPath(ctx: InstallContext): string;\n abstract getHookConfigPath(ctx: InstallContext): string;\n abstract installServer(ctx: InstallContext): ChangeRecord[];\n abstract uninstallServer(ctx: InstallContext): ChangeRecord[];\n abstract installHooks(ctx: InstallContext): ChangeRecord[];\n abstract uninstallHooks(ctx: InstallContext): ChangeRecord[];\n\n // ── Content surfaces (commands / skills / subagents) ─────────────────────\n // CONCRETE (overridable) defaults so every adapter inherits all six methods\n // and the installer can call them without optional-chaining. Each returns a\n // single skip when the connector declares no entries of that surface, else a\n // single \"warn\" — mirroring the mcp-only hook handling. Supporting adapters\n // override only the surfaces they honor.\n\n installCommands(ctx: InstallContext): ChangeRecord[] {\n return this.unsupportedSurface(ctx, \"commands\", ctx.connector.commands.length);\n }\n uninstallCommands(ctx: InstallContext): ChangeRecord[] {\n return this.unsupportedSurface(ctx, \"commands\", ctx.connector.commands.length);\n }\n installSkills(ctx: InstallContext): ChangeRecord[] {\n return this.unsupportedSurface(ctx, \"skills\", ctx.connector.skills.length);\n }\n uninstallSkills(ctx: InstallContext): ChangeRecord[] {\n return this.unsupportedSurface(ctx, \"skills\", ctx.connector.skills.length);\n }\n installSubagents(ctx: InstallContext): ChangeRecord[] {\n return this.unsupportedSurface(ctx, \"subagents\", ctx.connector.subagents.length);\n }\n uninstallSubagents(ctx: InstallContext): ChangeRecord[] {\n return this.unsupportedSurface(ctx, \"subagents\", ctx.connector.subagents.length);\n }\n\n // ── Memory surface (managed marker blocks; AGENTS.md-first) ───────────────\n // ONE generic implementation for every supporting host: the per-adapter\n // `memoryTargets()` hook resolves WHERE to write (AGENTS.md defaults below;\n // claude-code → CLAUDE.md and gemini-cli → GEMINI.md override it), and the\n // core/managed-block engine performs the surgical, hash-stamped block edit.\n // Unlike commands/skills/subagents these files are SHARED and user-authored —\n // bytes outside this connector's own marker pair are never touched.\n\n /**\n * Resolve the memory/rules file(s) this host actually reads at ctx.scope.\n * Base default (AGENTS.md-first, owner mandate):\n * - an explicit `platforms[<id>].memory.path` override wins;\n * - project scope → `<projectDir>/AGENTS.md` (the agents.md standard);\n * - user scope → the host's documented user-scope AGENTS.md, when one\n * exists ({@link AGENTS_MD_USER_PATHS}); otherwise [] → skip-warn.\n * Exception hosts (claude-code, gemini-cli) override this hook.\n */\n protected memoryTargets(ctx: InstallContext): MemoryTarget[] {\n const override = this.memoryOverride(ctx);\n if (override?.path) {\n const base = ctx.scope === \"project\" ? ctx.projectDir : homedir();\n return [\n {\n path: isAbsolute(override.path) ? override.path : join(base, override.path),\n reason: `platforms.${this.id}.memory.path override`,\n },\n ];\n }\n if (ctx.scope === \"project\") {\n return [\n { path: join(ctx.projectDir, \"AGENTS.md\"), reason: \"AGENTS.md standard (project root)\" },\n ];\n }\n if (ctx.scope === \"user\") {\n const user = AGENTS_MD_USER_PATHS[this.id]?.();\n return user ? [user] : [];\n }\n return [];\n }\n\n /** The per-platform memory override object, when one is declared. */\n protected memoryOverride(ctx: InstallContext): PlatformMemoryOverride | undefined {\n const o = ctx.connector.platforms[this.id]?.memory;\n return o && typeof o === \"object\" ? o : undefined;\n }\n\n installMemory(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n // `?? []` tolerates pre-resolved connectors from versions before the\n // memory surface existed (the installer applies the same guard).\n const entries = connector.memory ?? [];\n if (connector.platforms[this.id]?.memory === false) {\n return [{ platform: this.id, action: \"skip\", detail: `memory disabled for ${this.id}` }];\n }\n if (entries.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no memory\" }];\n }\n if (!(this.capabilities.supportsMemory ?? false)) {\n return this.unsupportedSurface(ctx, \"memory\", entries.length);\n }\n\n const changes: ChangeRecord[] = [];\n const override = this.memoryOverride(ctx);\n if (override?.mode && this.id !== \"claude-code\") {\n changes.push({\n platform: this.id,\n action: \"warn\",\n detail: `memory.mode is claude-code-only; ignored on ${this.id}`,\n });\n }\n if (ctx.scope !== \"project\" && ctx.scope !== \"user\") {\n // system/profile/managed memory files are admin-owned — out of scope (v1).\n changes.push({\n platform: this.id,\n action: \"warn\",\n detail:\n `memory not supported at ${ctx.scope} scope on ${this.id} ` +\n `(managed/admin memory files are out of scope); ${entries.length} skipped`,\n });\n return changes;\n }\n const targets = this.memoryTargets(ctx);\n if (targets.length === 0) {\n changes.push({\n platform: this.id,\n action: \"warn\",\n detail:\n `no ${ctx.scope}-scope memory file on ${this.id} ` +\n `(user rules are app/UI-managed or undocumented); ${entries.length} skipped`,\n });\n return changes;\n }\n changes.push(...this.writeMemoryBlocks(ctx, targets));\n return changes;\n }\n\n /**\n * Upsert every declared memory entry's block into every resolved target and\n * record the ownership ledger rows (`connectorDir(id)/memory-state.json`).\n * Shared by the base implementation and the exception-host overrides.\n */\n protected writeMemoryBlocks(ctx: InstallContext, targets: MemoryTarget[]): ChangeRecord[] {\n const changes: ChangeRecord[] = [];\n const ledger = loadMemoryLedger(ctx.connector.id);\n let ledgerMutated = false;\n\n for (const target of targets) {\n for (const entry of ctx.connector.memory ?? []) {\n const blockId = `${ctx.connector.id}/${entry.name ?? \"memory\"}`;\n const res = upsertManagedBlockFile(target.path, {\n blockId,\n connectorId: ctx.connector.id,\n content: entry.content,\n ...(target.commentStyle ? { commentStyle: target.commentStyle } : {}),\n force: ctx.force ?? false,\n dryRun: ctx.dryRun,\n });\n changes.push({\n platform: this.id,\n action: res.action,\n path: target.path,\n detail: `memory: ${res.detail} — ${target.reason}`,\n });\n if (res.backupPath) {\n changes.push({\n platform: this.id,\n action: \"create\",\n path: res.backupPath,\n detail: \"backed up memory file before destructive change\",\n });\n }\n const bytes = Buffer.byteLength(entry.content, \"utf8\");\n if (bytes > MEMORY_CONTENT_SOFT_BUDGET_BYTES) {\n changes.push({\n platform: this.id,\n action: \"warn\",\n path: target.path,\n detail:\n `memory entry \"${entry.name ?? \"memory\"}\" is ${bytes} bytes ` +\n `(soft budget ${MEMORY_CONTENT_SOFT_BUDGET_BYTES}); this file is injected into ` +\n `every prompt — keep guidance terse`,\n });\n }\n if (res.action !== \"warn\") {\n recordMemoryTarget(ledger, {\n platform: this.id,\n scope: ctx.scope,\n path: target.path,\n blockId,\n createdFile: res.createdFile,\n hash: res.hash,\n });\n ledgerMutated = true;\n }\n }\n // Per-FILE budget (e.g. codex caps combined project docs at 32 KiB —\n // budgetBytes ≈ 28 KiB leaves headroom): warn when the whole target file\n // (user content + every block) outgrows what the host will actually load.\n if (target.budgetBytes !== undefined && !ctx.dryRun && existsSync(target.path)) {\n const fileBytes = statSync(target.path).size;\n if (fileBytes > target.budgetBytes) {\n changes.push({\n platform: this.id,\n action: \"warn\",\n path: target.path,\n detail:\n `memory file is ${fileBytes} bytes — over this host's ~${target.budgetBytes}-byte ` +\n `budget; the host may truncate or drop it`,\n });\n }\n }\n }\n\n if (ledgerMutated && !ctx.dryRun) saveMemoryLedger(ctx.connector.id, ledger);\n return changes;\n }\n\n uninstallMemory(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (!(this.capabilities.supportsMemory ?? false)) {\n // Nothing could ever have been written by a non-supporting adapter.\n return this.unsupportedSurface(ctx, \"memory\", (connector.memory ?? []).length);\n }\n\n // Candidate files = union of (a) memoryTargets recomputed NOW (probe re-run\n // — catches teammate machines with no ledger; the markers in the committed\n // file are the source of truth) and (b) ledger rows for this platform from\n // EVERY scope (catches a scope flag that differs from install time).\n const ledger = loadMemoryLedger(connector.id);\n const mine = ledger.targets.filter((t) => t.platform === this.id);\n const candidates = new Map<string, { createdFile: boolean }>();\n if (ctx.scope === \"project\" || ctx.scope === \"user\") {\n for (const t of this.memoryTargets(ctx)) {\n candidates.set(t.path, { createdFile: false });\n }\n }\n for (const row of mine) {\n const existing = candidates.get(row.path);\n candidates.set(row.path, { createdFile: (existing?.createdFile ?? false) || row.createdFile });\n }\n if (candidates.size === 0) {\n return [\n { platform: this.id, action: \"skip\", detail: `no memory targets to clean on ${this.id}` },\n ];\n }\n\n // Prefix scan (`<connectorId>/`), NOT the declared entry list: renamed or\n // removed entries and stale blocks from older versions are reclaimed too.\n const changes: ChangeRecord[] = [];\n for (const [path, { createdFile }] of candidates) {\n const results = removeManagedBlocksFile(\n path,\n { blockIdPrefix: `${connector.id}/` },\n { dryRun: ctx.dryRun, deleteFileIfCreated: createdFile },\n );\n for (const r of results) {\n changes.push({\n platform: this.id,\n action: r.action,\n path: r.path,\n detail: `memory: ${r.detail}`,\n });\n if (r.backupPath) {\n changes.push({\n platform: this.id,\n action: \"create\",\n path: r.backupPath,\n detail: \"backed up memory file before block removal\",\n });\n }\n }\n }\n\n // Prune this connector's ledger rows for this platform (the file itself is\n // deleted when no rows remain). Markers stay the uninstall source of truth.\n if (!ctx.dryRun && mine.length > 0) {\n ledger.targets = ledger.targets.filter((t) => t.platform !== this.id);\n saveMemoryLedger(connector.id, ledger);\n }\n return changes;\n }\n\n /**\n * Doctor: per-ledger-row memory state for this platform — file present,\n * block present, and recorded-vs-actual inner hash (drift → warn, the\n * user edited inside our block; sync reports the same drift and never\n * clobbers it without --force).\n */\n protected memoryDiagnostics(ctx: InstallContext): DiagnosticResult[] {\n const results: DiagnosticResult[] = [];\n const rows = loadMemoryLedger(ctx.connector.id).targets.filter(\n (t) => t.platform === this.id,\n );\n for (const row of rows) {\n const check = `${this.name}: memory block ${row.blockId}`;\n if (!existsSync(row.path)) {\n results.push({\n check,\n status: \"warn\",\n message: `memory file missing: ${row.path}`,\n fix: \"agent-connector install (sync) will re-create the block\",\n fixable: true,\n });\n continue;\n }\n let raw: string;\n try {\n raw = readFileSync(row.path, \"utf8\");\n } catch {\n results.push({ check, status: \"warn\", message: `cannot read ${row.path}` });\n continue;\n }\n const block = listManagedBlocks(raw).find((b) => b.blockId === row.blockId);\n if (!block) {\n results.push({\n check,\n status: \"warn\",\n message: `managed block not found in ${row.path}`,\n fix: \"agent-connector install (sync) will re-append it\",\n fixable: true,\n });\n } else if (block.drifted) {\n results.push({\n check,\n status: \"warn\",\n message:\n `user-edited: inner content hash ${block.actualHash} differs from recorded ` +\n `${block.recordedHash} in ${row.path}; sync leaves it intact (use --force to overwrite)`,\n });\n } else {\n results.push({ check, status: \"pass\", message: `intact in ${row.path}` });\n }\n // Shadow-flip probe: re-run memoryTargets NOW for the row's scope — if\n // the host's resolution moved (a WARP.md / AGENTS.override.md / .rules /\n // .hermes.md appeared, gemini context.fileName changed), the written\n // block sits in a file the host no longer reads. The #1 wrong-file\n // risk; doctor is the detection layer.\n // (`_shared/` bridge rows deliberately live OUTSIDE memoryTargets —\n // e.g. claude-code's @AGENTS.md import in CLAUDE.md — skip those.)\n if (\n !row.blockId.startsWith(\"_shared/\") &&\n row.scope === ctx.scope &&\n (ctx.scope === \"project\" || ctx.scope === \"user\")\n ) {\n const current = this.memoryTargets(ctx);\n if (current.length > 0 && !current.some((t) => t.path === row.path)) {\n results.push({\n check,\n status: \"warn\",\n message:\n `${this.id} now resolves its ${row.scope}-scope memory file to ` +\n `${current[0]!.path} (${current[0]!.reason}) — the block in ${row.path} ` +\n `may no longer be read`,\n fix: \"agent-connector install (sync) re-probes and writes the file the host reads now\",\n fixable: true,\n });\n }\n }\n }\n return results;\n }\n\n // ── Declarative host-config key patches (configPatch) ─────────────────────\n // CONCRETE (overridable) defaults, mirroring the content surfaces above: the\n // installer additionally guards these behind capabilities.supportsConfigPatch\n // (the nativeHooks precedent), so these defaults only fire if a capability-\n // flagged adapter forgot to override them — still skip-warn, never silent.\n\n installConfigPatches(ctx: InstallContext): ChangeRecord[] {\n const count = (ctx.connector.platforms[this.id]?.configPatch ?? []).length;\n if (count === 0) {\n return [\n { platform: this.id, action: \"skip\", detail: \"connector declares no configPatch entries\" },\n ];\n }\n return [\n {\n platform: this.id,\n action: \"warn\",\n detail: `configPatch not supported on ${this.id}; ${count} skipped`,\n },\n ];\n }\n\n uninstallConfigPatches(_ctx: InstallContext): ChangeRecord[] {\n // Nothing was ever applied by a non-supporting adapter → nothing to release.\n return [];\n }\n\n // ── Statusline surface (a HUD/status line) ────────────────────────────────\n // CONCRETE (overridable) defaults, mirroring the content surfaces: the\n // installer calls these unconditionally (BaseAdapter defines them), and they\n // self-skip when the connector declares no statusline, else skip-warn on a\n // non-supporting host. Only claude-code overrides them today.\n\n installStatusline(ctx: InstallContext): ChangeRecord[] {\n if (ctx.connector.statusline == null) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no statusline\" }];\n }\n if (ctx.connector.platforms[this.id]?.statusline === false) {\n return [{ platform: this.id, action: \"skip\", detail: `statusline disabled for ${this.id}` }];\n }\n if (!(this.capabilities.supportsStatusline ?? false)) {\n return this.unsupportedSurface(ctx, \"statusline\", 1);\n }\n // A supporting adapter must override this; the default is the same skip-warn\n // safety net the configPatch defaults provide (never silent).\n return this.unsupportedSurface(ctx, \"statusline\", 1);\n }\n\n uninstallStatusline(ctx: InstallContext): ChangeRecord[] {\n if (ctx.connector.statusline == null) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no statusline\" }];\n }\n if (!(this.capabilities.supportsStatusline ?? false)) {\n // Nothing could ever have been written by a non-supporting adapter.\n return this.unsupportedSurface(ctx, \"statusline\", 1);\n }\n return this.unsupportedSurface(ctx, \"statusline\", 1);\n }\n\n // ── Action surface (a user-invokable action) ──────────────────────────────\n // CONCRETE (overridable) defaults, mirroring the statusline pair. v1 ships\n // ONLY the dispatch backbone: there is no verifiable host affordance to emit,\n // so EVERY host honestly skip-warns and NO adapter overrides these. (`?? []`\n // tolerates pre-resolved connectors from versions before the action surface\n // existed, exactly like installMemory.)\n\n installActions(ctx: InstallContext): ChangeRecord[] {\n return this.unsupportedSurface(ctx, \"actions\", (ctx.connector.actions ?? []).length);\n }\n uninstallActions(ctx: InstallContext): ChangeRecord[] {\n return this.unsupportedSurface(ctx, \"actions\", (ctx.connector.actions ?? []).length);\n }\n\n /**\n * Shared, surface-agnostic helper for the action EMITTERS: yield one\n * {@link ActionTrigger} per declared action, each carrying the home-bin verb\n * command the host trigger must run\n * (`<homeBin> action <host> <actionId> --connector <id>`, via\n * {@link buildHomeBinActionCommand}) plus a `label`/`description` that fall\n * back to the action id. Each supporting adapter iterates this and writes its\n * host-native trigger (hermes quick_commands / warp workflow / droid exec\n * file) — the per-host file shape is NOT this helper's concern, only the\n * common (id, label, description, command) tuple. Callers own the standard\n * guards (platforms[id].actions === false / empty actions).\n */\n protected actionTriggers(ctx: InstallContext): ActionTrigger[] {\n return (ctx.connector.actions ?? []).map((action) => ({\n id: action.id,\n label: action.description ?? action.id,\n description: action.description ?? action.id,\n command: buildHomeBinActionCommand(\n ctx.homeBinPath,\n this.id,\n action.id,\n ctx.connector.id,\n ),\n }));\n }\n\n /**\n * Default response for a content surface this platform cannot honor: a single\n * skip when the connector declares none of that surface, else a single \"warn\"\n * ChangeRecord noting how many were skipped. Mirrors mcp-only hook handling.\n */\n protected unsupportedSurface(\n _ctx: InstallContext,\n surface: ContentSurface,\n count: number,\n ): ChangeRecord[] {\n if (count === 0) {\n return [{ platform: this.id, action: \"skip\", detail: `connector declares no ${surface}` }];\n }\n return [\n {\n platform: this.id,\n action: \"warn\",\n detail: `${surface} not supported on ${this.id}; ${count} skipped`,\n },\n ];\n }\n\n // ── Content-file helpers (used by surface-supporting adapters) ────────────\n\n /**\n * Write a content file idempotently: \"skip\" when the existing bytes are\n * already identical, else \"create\"/\"update\". Creates parent dirs (mkdir -p).\n * Honors dryRun (computes the action but writes nothing).\n */\n protected writeContentFile(path: string, contents: string, dryRun: boolean): ChangeRecord {\n let action: ChangeRecord[\"action\"];\n if (!existsSync(path)) {\n action = \"create\";\n } else {\n let current: string | null = null;\n try {\n current = readFileSync(path, \"utf8\");\n } catch {\n current = null;\n }\n action = current === contents ? \"skip\" : \"update\";\n }\n if (action !== \"skip\" && !dryRun) {\n ensureDir(dirname(path));\n writeFileSync(path, contents, \"utf8\");\n }\n return { platform: this.id, action, path, detail: basename(path) };\n }\n\n /**\n * Remove a content file we wrote; \"skip\" when already absent. Honors dryRun.\n * Uses rmSync with `force` to also tolerate a path that is a directory tree\n * (e.g. a skill folder removed by the supporting adapter).\n */\n protected removeContentFile(path: string, dryRun: boolean): ChangeRecord {\n if (!existsSync(path)) {\n return { platform: this.id, action: \"skip\", path, detail: `${basename(path)} absent` };\n }\n if (!dryRun) {\n rmSync(path, { recursive: true, force: true });\n }\n return { platform: this.id, action: \"remove\", path, detail: basename(path) };\n }\n\n /**\n * Defense-in-depth path containment: resolve `rel` against `baseDir` and\n * return the absolute path ONLY when it stays inside `baseDir`. Returns null\n * when `rel` escapes (absolute path, `..` traversal, etc.) so a caller can\n * skip-and-warn rather than write/delete outside the surface dir. This is the\n * runtime backstop behind the config-time validation in normalizeSkills.\n */\n protected resolveWithin(baseDir: string, rel: string): string | null {\n const base = resolve(baseDir);\n const target = resolve(base, rel);\n if (target === base) return null; // rel resolved to the dir itself (e.g. \"\" / \".\")\n const rind = relative(base, target);\n // Outside when the relative path climbs out (`..`) or is itself absolute.\n if (rind === \"\" || rind.startsWith(\"..\") || resolve(base, rind) !== target) {\n return null;\n }\n if (rind === \"..\" || rind.startsWith(`..${sep}`)) return null;\n return target;\n }\n\n /**\n * Recursively report whether a directory tree contains any regular FILE (vs\n * only empty/nested-empty subdirectories). Symlinks count as files (we never\n * recurse through them). Used by removeDirIfEmpty to decide if a tree is safe\n * to drop. An unreadable entry is treated as \"a file is present\" (conservative).\n */\n private dirTreeHasFile(dir: string): boolean {\n let entries: Dirent[];\n try {\n entries = readdirSync(dir, { withFileTypes: true });\n } catch {\n return true; // unreadable → assume it holds data; do not remove\n }\n for (const e of entries) {\n if (e.isDirectory()) {\n if (this.dirTreeHasFile(join(dir, e.name))) return true;\n } else {\n return true; // a file / symlink / special → the tree is not \"empty\"\n }\n }\n return false;\n }\n\n /**\n * Remove a directory ONLY when its tree holds NO regular files — i.e. it is\n * empty or contains only (nested) empty directories, such as the intermediate\n * dirs our own nested skill resources created. Replaces the unconditional\n * `rm -rf <dir>` that uninstallSkills used to call, which destroyed user-added\n * files / sibling-tool files / shared skill dirs the connector never wrote.\n * When ANY file remains (at any depth) the whole tree is left in place and the\n * skip is noted. Honors dryRun (computes the action but removes nothing). A\n * missing dir is a no-op \"skip\".\n */\n protected removeDirIfEmpty(dir: string, dryRun: boolean): ChangeRecord {\n if (!existsSync(dir)) {\n return { platform: this.id, action: \"skip\", path: dir, detail: `${basename(dir)} absent` };\n }\n let stat: ReturnType<typeof statSync>;\n try {\n stat = statSync(dir);\n } catch {\n return {\n platform: this.id,\n action: \"skip\",\n path: dir,\n detail: `${basename(dir)} unreadable; left in place`,\n };\n }\n if (!stat.isDirectory()) {\n return {\n platform: this.id,\n action: \"skip\",\n path: dir,\n detail: `${basename(dir)} not a directory; left in place`,\n };\n }\n if (this.dirTreeHasFile(dir)) {\n return {\n platform: this.id,\n action: \"skip\",\n path: dir,\n detail: `${basename(dir)} still holds files we did not write; left in place`,\n };\n }\n if (!dryRun) {\n try {\n // The tree is files-free: only (possibly nested) empty dirs remain, which\n // are ours / inert. A recursive remove drops them without touching data.\n rmSync(dir, { recursive: true, force: true });\n } catch {\n // Lost a race or perms — non-fatal; report as a skip.\n return {\n platform: this.id,\n action: \"skip\",\n path: dir,\n detail: `${basename(dir)} could not be removed; left in place`,\n };\n }\n }\n return { platform: this.id, action: \"remove\", path: dir, detail: basename(dir) };\n }\n\n /**\n * Render a YAML-frontmatter + markdown body document:\n * \"---\\n\" + <yaml> + \"---\\n\\n\" + <body> + \"\\n\".\n * Delegates to the shared renderer (adapters/claude-code/render) so every\n * content-file path — adapters AND the plugin packager — emits identical bytes.\n */\n protected renderFrontmatterMd(\n frontmatter: Record<string, unknown>,\n body: string,\n ): string {\n return renderFrontmatterMd(frontmatter, body);\n }\n\n // ── JSON config helpers (used by JSON-format adapters) ───────────────────\n\n /**\n * Read + parse a JSON/JSONC config file, returning null when it is absent OR\n * unparseable. Parses TOLERANTLY via parseJsonc (strips // and /* *\\/ comments\n * and trailing commas) so a perfectly valid JSONC file never false-fails to\n * null — that null is what `?? {}` would otherwise turn into a clobbering\n * overwrite of the user's whole config.\n */\n protected readJson<T = Record<string, unknown>>(path: string): T | null {\n if (!existsSync(path)) return null;\n try {\n return parseJsonc<T>(readFileSync(path, \"utf8\"));\n } catch {\n return null;\n }\n }\n\n /**\n * True when `path` exists and holds non-whitespace content but readJson cannot\n * parse it (even after JSONC stripping). The overwrite guard: writing a\n * `{}`-based config over a present-but-broken settings file would silently\n * destroy the user's data, so callers warn-and-skip instead.\n */\n protected isPresentButUnparseable(path: string): boolean {\n if (!existsSync(path)) return false;\n let raw: string;\n try {\n if (statSync(path).size === 0) return false;\n raw = readFileSync(path, \"utf8\");\n } catch {\n return false;\n }\n if (raw.trim() === \"\") return false;\n return this.readJson(path) === null;\n }\n\n protected writeJson(path: string, data: unknown, dryRun = false): void {\n if (dryRun) return;\n ensureDir(dirname(path));\n writeFileSync(path, `${JSON.stringify(data, null, 2)}\\n`, \"utf8\");\n }\n\n /**\n * True when a PRESENT rootKey value is not a plain object map (the user\n * hand-edited it to an array / string / number / boolean). Assigning a server\n * entry into such a value would corrupt the file silently (a named property on\n * an Array is dropped by JSON.stringify) or throw under strict mode (a property\n * write / `in` operator against a primitive), so callers warn-and-skip. A\n * `null`/`undefined` value is NOT malformed — it is the well-formed \"absent\"\n * case the helpers create fresh.\n */\n protected isMalformedRootValue(value: unknown): boolean {\n return isMalformedRootValueFn(value);\n }\n\n /**\n * Warn-skip ChangeRecord when an existing JSON `hooks` config is present-but-\n * malformed (root hand-edited to an array/primitive, or an existing event\n * bucket is a non-array) — installing a hook into it would silently drop the\n * entry (a named property on an Array is dropped by JSON.stringify) or throw\n * under strict mode (a `.push`/property write against a primitive or non-array\n * bucket). Returns null when the hooks config is well-formed, including the\n * absent case the installers create fresh (proceed normally). Mirrors the\n * server-root guard (isMalformedRootValue). All targeted hosts use the Claude-\n * style `{ Event: Matcher[] }` shape, so every present event bucket must be an\n * array; a non-array bucket is the same malformed class as a wrong-typed root.\n */\n protected malformedHookRootSkip(configPath: string, hooksRoot: unknown): ChangeRecord | null {\n if (hooksRoot == null) return null; // absent → installer creates fresh\n if (this.isMalformedRootValue(hooksRoot)) {\n // array / primitive root\n return {\n platform: this.id,\n action: \"warn\",\n path: configPath,\n detail: `existing \"hooks\" in ${configPath} is not an object map; left untouched (fix it, then re-run)`,\n };\n }\n for (const v of Object.values(hooksRoot as Record<string, unknown>)) {\n if (v !== undefined && !Array.isArray(v)) {\n // an existing event bucket is a non-array\n return {\n platform: this.id,\n action: \"warn\",\n path: configPath,\n detail: `existing \"hooks\" in ${configPath} has a non-array event bucket; left untouched (fix it, then re-run)`,\n };\n }\n }\n return null;\n }\n\n // ── Shared object-map hook-array merge engine ────────────────────────────\n // installHooks/uninstallHooks for every json-stdio host that stores hooks as\n // `{ <event>: HookEntry[] }` share ONE create/update/skip + strip/remove\n // orchestration. The host supplies a {@link HookMergeDescriptor} carrying\n // EVERY observable string and ownership predicate — the engine body hardcodes\n // none of them, so per-host wording (skip/remove/absent/no-match details) and\n // FLAT-vs-NESTED removal stay host-controlled and never drift to a lowest-\n // common-denominator phrasing the suites (which assert by action) would miss.\n // The write-gate is the `mutated` bool, matching the migrated host exactly.\n\n /**\n * Install: upsert each `{ event, matcher }` in `pending` into the object-map\n * `hooks` root at `configPath`. Reproduces the canonical host's loop: read\n * `?? {}`, warn-skip on a malformed `hooks` root, then per pending item render\n * the entry, find the owned slot, and create/update/skip. Writes once at the\n * end iff anything mutated.\n *\n * Hosts that fold their `nativeHooks` surface into `pending` (claude-code) pass\n * no `native` arg. Hosts that keep the native surface SEPARATE — verbatim\n * event keys, EXACT-command ownership, a distinct `(native)` detail — pass it\n * as the optional `native` list (cursor); that pass runs after the normalized\n * loop and before the single write. Omitting it is byte-identical to before.\n */\n /**\n * Resolve the per-event hook bucket. With \"coerce\" policy a present-but-non-\n * array bucket (hand-edited) is replaced by a fresh array; otherwise `??=` is\n * used (the warn-skip path already rejected any non-array bucket via\n * malformedHookRootSkip, so `??=` only ever fills the absent case).\n */\n private coerceHookBucket<E>(\n hooks: Record<string, E[]>,\n event: string,\n coerce: boolean,\n ): E[] {\n if (coerce) {\n return Array.isArray(hooks[event]) ? hooks[event] : (hooks[event] = []);\n }\n return (hooks[event] ??= []);\n }\n\n protected upsertHookEntries<E>(\n ctx: InstallContext,\n configPath: string,\n pending: ReadonlyArray<{ event: string; matcher: string }>,\n descriptor: HookMergeDescriptor<E>,\n native?: ReadonlyArray<{ event: string; matcher: string }>,\n ): ChangeRecord[] {\n const file = this.readJson<Record<string, unknown>>(configPath) ?? {};\n const coerce = descriptor.malformedPolicy === \"coerce\";\n let hooks: Record<string, E[]>;\n if (coerce) {\n // COERCE policy: a present-but-malformed `hooks` root (array / primitive,\n // hand-edited) is replaced by a fresh object map; a well-formed object map\n // is kept as-is. Never warn, never throw — matches the container hosts'\n // server-path policy.\n const existing = file.hooks;\n hooks =\n existing && typeof existing === \"object\" && !Array.isArray(existing)\n ? (existing as Record<string, E[]>)\n : ((file.hooks = {}) as Record<string, E[]>);\n } else {\n const skip = this.malformedHookRootSkip(configPath, file.hooks);\n if (skip) return [skip];\n hooks = (file.hooks ??= {}) as Record<string, E[]>;\n }\n\n const changes: ChangeRecord[] = [];\n let mutated = false;\n\n for (const { event, matcher } of pending) {\n const hostEvent = descriptor.mapEvent ? descriptor.mapEvent(event) : event;\n if (hostEvent === undefined) {\n changes.push({\n platform: this.id,\n action: \"warn\",\n path: configPath,\n detail: descriptor.unmappedWarnDetail!(event),\n });\n continue;\n }\n // Command is built from the CANONICAL `event` (NOT hostEvent) — the home\n // binary dispatches on the canonical name; only the host's bucket key,\n // detail, and skipDetail use the mapped `hostEvent`.\n const command = buildHomeBinHookCommand(\n ctx.homeBinPath,\n this.id,\n event,\n ctx.connector.id,\n );\n const entry = descriptor.renderEntry(hostEvent, matcher, command);\n const bucket = this.coerceHookBucket(hooks, hostEvent, coerce);\n const r = upsertInArray(bucket, entry, (e) =>\n descriptor.entryOwnsCommand(e, command),\n );\n\n if (r.action !== \"skip\") {\n hooks[hostEvent] = r.array;\n mutated = true;\n }\n changes.push({\n platform: this.id,\n action: r.action,\n path: configPath,\n detail:\n r.action === \"skip\"\n ? descriptor.skipDetail(hostEvent)\n : `hooks.${hostEvent}`,\n });\n }\n\n // Native pass (json-stdio hosts with a verbatim `nativeHooks` surface):\n // native event-name keys are NOT mapEvent-mapped, are found by EXACT command\n // (so a native key coinciding with a normalized event's mapped key adds a\n // SECOND distinct command rather than clobbering it), and carry the `(native)`\n // detail. Hosts passing no `native` list skip this loop entirely → the\n // normalized-only behavior is byte-identical.\n for (const { event, matcher } of native ?? []) {\n const command = buildHomeBinHookCommand(\n ctx.homeBinPath,\n this.id,\n event,\n ctx.connector.id,\n );\n const entry = descriptor.renderEntry(event, matcher, command);\n const bucket = this.coerceHookBucket(hooks, event, coerce);\n const r = upsertInArray(bucket, entry, (e) =>\n descriptor.nativeOwnsCommand!(e, command),\n );\n if (r.action !== \"skip\") {\n hooks[event] = r.array;\n mutated = true;\n }\n changes.push({\n platform: this.id,\n action: r.action,\n path: configPath,\n detail:\n r.action === \"skip\"\n ? descriptor.nativeSkipDetail!(event)\n : descriptor.nativeMutateDetail!(event),\n });\n }\n\n if (mutated) {\n descriptor.onMutate?.(file);\n this.writeJson(configPath, file, ctx.dryRun);\n }\n return changes;\n }\n\n /**\n * Uninstall: strip owned content from every event bucket in the object-map\n * `hooks` root at `configPath`. NESTED hosts pass `descriptor.stripInner`\n * (strip owned inner commands, drop emptied entries; `removed` = inner\n * commands); FLAT hosts omit it (drop whole owned entries). Reproduces the\n * canonical host: read (NO `?? {}`), `[skip]` (absentDetail) when no hooks\n * section, per-event remove → delete-or-replace bucket, write once iff\n * mutated, and a single `[skip]` (noMatchDetail) when nothing matched.\n */\n protected removeHookEntries<E>(\n ctx: InstallContext,\n configPath: string,\n descriptor: HookMergeDescriptor<E>,\n ): ChangeRecord[] {\n const file = this.readJson<Record<string, unknown>>(configPath);\n const hooks = file?.hooks as Record<string, E[]> | undefined;\n if (!file || !hooks) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n path: configPath,\n detail: descriptor.absentDetail,\n },\n ];\n }\n\n const changes: ChangeRecord[] = [];\n let mutated = false;\n // stripInner is event-independent for current hosts → computed once. The\n // whole-entry ownership predicate is rebuilt PER EVENT so EVENT-SPECIFIC\n // hosts (codex) can match the canonical event being stripped; event-agnostic\n // hosts simply ignore the param.\n const stripInner = descriptor.stripInner?.(ctx);\n\n // Default: scan every present key. EVENT-SPECIFIC hosts pin a fixed event set\n // (descriptor.removeEventKeys) so a foreign-key bucket is never inspected —\n // matching their original fixed-event-list uninstall loop byte-for-byte.\n for (const event of descriptor.removeEventKeys ?? Object.keys(hooks)) {\n const bucket = hooks[event];\n if (!Array.isArray(bucket)) continue;\n\n const ownsEntry = descriptor.ownsEntryForRemove(ctx, event);\n const r = removeFromArray(bucket, ownsEntry, stripInner);\n if (r.removed > 0) {\n if (r.array.length > 0) hooks[event] = r.array;\n else delete hooks[event];\n changes.push({\n platform: this.id,\n action: \"remove\",\n path: configPath,\n detail: descriptor.removeDetail(event, r.removed),\n });\n mutated = true;\n }\n }\n\n if (mutated) this.writeJson(configPath, file, ctx.dryRun);\n if (changes.length === 0) {\n changes.push({\n platform: this.id,\n action: \"skip\",\n path: configPath,\n detail: descriptor.noMatchDetail,\n });\n }\n return changes;\n }\n\n /** Bind BaseAdapter's JSON leaf IO (readJson/writeJson + the unparseable\n * overwrite guard) as a Codec for the object-map engine. */\n private jsonObjectMapCodec(): ObjectMapCodec {\n return {\n parse: (path) => this.readJson<Record<string, unknown>>(path),\n serialize: (path, data, dryRun) => this.writeJson(path, data, dryRun),\n isPresentButUnparseable: (path) => this.isPresentButUnparseable(path),\n };\n }\n\n /**\n * Upsert `entry` at `config[rootKey][serverId]` in a JSON file, creating the\n * file/object as needed. Returns a ChangeRecord describing create/update/skip.\n * Idempotent: an identical entry yields \"skip\".\n */\n protected upsertServerInJson(\n configPath: string,\n rootKey: string,\n serverId: string,\n entry: unknown,\n dryRun = false,\n ): ChangeRecord {\n return upsertInObjectMap({\n codec: this.jsonObjectMapCodec(),\n rootKey,\n platform: this.id,\n configPath,\n entryId: serverId,\n entry,\n dryRun,\n });\n }\n\n /** Remove `config[rootKey][serverId]` from a JSON file. */\n protected removeServerFromJson(\n configPath: string,\n rootKey: string,\n serverId: string,\n dryRun = false,\n ): ChangeRecord {\n return removeFromObjectMap({\n codec: this.jsonObjectMapCodec(),\n rootKey,\n platform: this.id,\n configPath,\n entryId: serverId,\n dryRun,\n });\n }\n\n // ── Backup ───────────────────────────────────────────────────────────────\n\n backupSettings(ctx: InstallContext): string | null {\n const files = [...new Set([this.getServerConfigPath(ctx), this.getHookConfigPath(ctx)])].filter(\n (f) => existsSync(f),\n );\n if (files.length === 0) return null;\n if (ctx.dryRun) return null;\n ensureDir(backupsDir());\n const stamp = new Date().toISOString().replace(/[:.]/g, \"-\");\n let last: string | null = null;\n for (const f of files) {\n const dest = join(backupsDir(), `${this.id}-${stamp}-${basename(f)}`);\n copyFileSync(f, dest);\n last = dest;\n }\n return last;\n }\n\n // ── Diagnostics ─────────────────────────────────────────────────────────\n\n getHealthChecks?(ctx: InstallContext): readonly HealthCheck[];\n\n doctor(ctx: InstallContext): DiagnosticResult[] {\n const results: DiagnosticResult[] = [];\n const cfg = this.getServerConfigPath(ctx);\n results.push(\n existsSync(cfg)\n ? { check: `${this.name}: config present`, status: \"pass\", message: cfg }\n : {\n check: `${this.name}: config present`,\n status: \"warn\",\n message: `not found: ${cfg}`,\n fix: `agent-connector install --targets ${this.id}`,\n // Only sync-recoverable when the connector actually declares a\n // server — a re-sync writes the config file only then. For a\n // serverless (memory/configPatch-only) connector the file is never\n // created, so marking it fixable would loop it into \"still failing\".\n fixable: !!ctx.connector.server,\n },\n );\n for (const hc of this.getHealthChecks?.(ctx) ?? []) {\n const r = hc.check();\n results.push({\n check: hc.name,\n status: r.status === \"OK\" ? \"pass\" : \"fail\",\n message: r.detail ?? r.status,\n });\n }\n // Memory-surface checks are ledger-driven: no installed memory → no rows →\n // no noise. Shared by every adapter (the overrides call super.doctor()).\n results.push(...this.memoryDiagnostics(ctx));\n return results;\n }\n}\n","/** Decision for one inner-array upsert. */\nexport type ArrayUpsertAction = \"create\" | \"update\" | \"skip\";\n\nexport interface ArrayUpsertResult<E> {\n array: E[];\n action: ArrayUpsertAction;\n}\n\n/**\n * Upsert one rendered `candidate` into a per-event hook array.\n * - find the FIRST entry the caller OWNS via `ownsEntry`;\n * - hit + JSON-equal → skip (array returned unchanged);\n * - hit + differs → update (replace that slot);\n * - miss → create (push).\n */\nexport function upsertInArray<E>(\n array: E[],\n candidate: E,\n ownsEntry: (entry: E) => boolean,\n): ArrayUpsertResult<E> {\n const idx = array.findIndex(ownsEntry);\n if (idx >= 0) {\n if (JSON.stringify(array[idx]) === JSON.stringify(candidate)) {\n return { array, action: \"skip\" };\n }\n const next = array.slice();\n next[idx] = candidate;\n return { array: next, action: \"update\" };\n }\n return { array: [...array, candidate], action: \"create\" };\n}\n\nexport interface ArrayRemoveResult<E> {\n array: E[];\n removed: number;\n}\n\n/**\n * Remove owned content from a per-event hook array.\n * - FLAT hosts: omit `stripInner` → drop whole entries matching `ownsEntry`;\n * `removed` = whole entries dropped.\n * - NESTED hosts: pass `stripInner` → strip owned inner commands and rebuild,\n * dropping entries left empty; `removed` = inner commands removed.\n */\nexport function removeFromArray<E>(\n array: E[],\n ownsEntry: (entry: E) => boolean,\n stripInner?: (entry: E) => { next: E | null; removed: number },\n): ArrayRemoveResult<E> {\n if (!stripInner) {\n const kept = array.filter((e) => !ownsEntry(e));\n return { array: kept, removed: array.length - kept.length };\n }\n const kept: E[] = [];\n let removed = 0;\n for (const e of array) {\n const r = stripInner(e);\n removed += r.removed;\n if (r.next !== null) kept.push(r.next);\n }\n return { array: kept, removed };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA4BO,SAAS,WAAW,MAAsB;AAC/C,QAAM,IAAI,KAAK;AACf,MAAI,MAAM;AACV,MAAI,IAAI;AACR,MAAI,WAAW;AACf,MAAI,QAAQ;AAEZ,SAAO,IAAI,GAAG;AACZ,UAAM,KAAK,KAAK,CAAC;AAEjB,QAAI,UAAU;AACZ,aAAO;AACP,UAAI,OAAO,MAAM;AAEf,YAAI,IAAI,IAAI,GAAG;AACb,iBAAO,KAAK,IAAI,CAAC;AACjB,eAAK;AACL;AAAA,QACF;AAAA,MACF,WAAW,OAAO,OAAO;AACvB,mBAAW;AAAA,MACb;AACA,WAAK;AACL;AAAA,IACF;AAEA,UAAM,OAAO,IAAI,IAAI,IAAK,KAAK,IAAI,CAAC,IAAe;AAGnD,QAAI,OAAO,OAAO,OAAO,KAAK;AAC5B,iBAAW;AACX,cAAQ;AACR,aAAO;AACP,WAAK;AACL;AAAA,IACF;AAGA,QAAI,OAAO,OAAO,SAAS,KAAK;AAC9B,WAAK;AACL,aAAO,IAAI,KAAK,KAAK,CAAC,MAAM,KAAM,MAAK;AACvC;AAAA,IACF;AAGA,QAAI,OAAO,OAAO,SAAS,KAAK;AAC9B,WAAK;AACL,aAAO,IAAI,KAAK,EAAE,KAAK,CAAC,MAAM,OAAO,KAAK,IAAI,CAAC,MAAM,KAAM,MAAK;AAChE,WAAK;AACL;AAAA,IACF;AAKA,QAAI,OAAO,KAAK;AACd,YAAM,SAAS,gBAAgB,MAAM,IAAI,CAAC;AAC1C,UAAI,WAAW,OAAO,WAAW,KAAK;AACpC,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AAI,oBAAoB,QAAQ,QAAQ,SAAS,IAAI,IACtE;AAAA,QACE,OAAO,GAAG,KAAK,IAAI;AAAA,QACnB,QAAQ;AAAA,QACR,SAAS,cAAc,GAAG;AAAA,QAC1B,KAAK,qCAAqC,KAAK,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA,QAKjD,SAAS,CAAC,CAAC,IAAI,UAAU;AAAA,MAC3B;AAAA,IACN;AACA,eAAW,MAAM,KAAK,kBAAkB,GAAG,KAAK,CAAC,GAAG;AAClD,YAAM,IAAI,GAAG,MAAM;AACnB,cAAQ,KAAK;AAAA,QACX,OAAO,GAAG;AAAA,QACV,QAAQ,EAAE,WAAW,OAAO,SAAS;AAAA,QACrC,SAAS,EAAE,UAAU,EAAE;AAAA,MACzB,CAAC;AAAA,IACH;AAGA,YAAQ,KAAK,GAAG,KAAK,kBAAkB,GAAG,CAAC;AAC3C,WAAO;AAAA,EACT;AACF;","names":["kept"]}
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  defineConnector
4
- } from "./chunk-DCK5FADX.js";
4
+ } from "./chunk-HOE2MN36.js";
5
5
  import {
6
6
  connectorDir,
7
7
  connectorsDir,
@@ -174,4 +174,4 @@ export {
174
174
  connectorFromMeta,
175
175
  listRegisteredConnectors
176
176
  };
177
- //# sourceMappingURL=chunk-MZF2YCXX.js.map
177
+ //# sourceMappingURL=chunk-MOW2RKHX.js.map
@@ -21,9 +21,17 @@ function writeYaml(path, data, dryRun = false) {
21
21
  ensureDir(dirname(path));
22
22
  writeFileSync(path, stringify(data), "utf8");
23
23
  }
24
+ function yamlObjectMapCodec() {
25
+ return {
26
+ parse: (path) => readYaml(path),
27
+ serialize: (path, data, dryRun) => writeYaml(path, data, dryRun),
28
+ isPresentButUnparseable: () => false
29
+ };
30
+ }
24
31
 
25
32
  export {
26
33
  readYaml,
27
- writeYaml
34
+ writeYaml,
35
+ yamlObjectMapCodec
28
36
  };
29
- //# sourceMappingURL=chunk-EXLS7BSI.js.map
37
+ //# sourceMappingURL=chunk-NLFPH4S2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/yaml.ts"],"sourcesContent":["/**\n * core/yaml — minimal YAML config IO.\n *\n * The YAML analog of BaseAdapter's JSON helpers (readJson/writeJson). Adapters\n * whose native config is YAML (Goose's config.yaml, Hermes's config.yaml) cannot\n * use the JSON helpers, so they reach for these two functions instead — same\n * existsSync-guard / parse-failure-tolerant / dryRun-respecting contract, just\n * over the `yaml` package's parse()/stringify() rather than JSON.parse/stringify.\n *\n * Deliberately tiny: read-or-null and ensureDir+write. All merge/upsert/idempotency\n * logic lives in each adapter (the shapes differ per platform), exactly as the\n * JSON adapters layer their own upsert on top of writeJson.\n */\n\nimport { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { dirname } from \"node:path\";\n\nimport { parse, stringify } from \"yaml\";\n\nimport type { ObjectMapCodec } from \"./object-map.js\";\nimport { ensureDir } from \"./paths.js\";\n\n/**\n * Read and parse a YAML file. Returns `null` when the file is missing OR when it\n * fails to parse (mirrors BaseAdapter.readJson's fail-soft behavior so a corrupt\n * file degrades to \"treat as absent\" rather than throwing mid-install).\n */\nexport function readYaml<T = Record<string, unknown>>(path: string): T | null {\n if (!existsSync(path)) return null;\n try {\n const parsed = parse(readFileSync(path, \"utf8\")) as T | null | undefined;\n // An empty YAML document parses to null/undefined — normalize to null.\n return parsed == null ? null : parsed;\n } catch {\n return null;\n }\n}\n\n/**\n * Serialize `data` to YAML and write it to `path`, creating parent dirs as\n * needed. Honors `dryRun` (no write). Mirrors BaseAdapter.writeJson's signature.\n */\nexport function writeYaml(path: string, data: unknown, dryRun = false): void {\n if (dryRun) return;\n ensureDir(dirname(path));\n writeFileSync(path, stringify(data), \"utf8\");\n}\n\n/**\n * An ObjectMapCodec over YAML for the core/object-map engine. Shared by the YAML\n * object-map server hosts (Goose's `extensions`, Hermes's `mcp_servers`) and any\n * future YAML host. `isPresentButUnparseable` is `() => false`: YAML server hosts\n * historically coerce/overwrite (readYaml(path) ?? {}) rather than warn-skip on an\n * unparseable file — preserved here for byte-identical behavior.\n */\nexport function yamlObjectMapCodec(): ObjectMapCodec {\n return {\n parse: (path) => readYaml<Record<string, unknown>>(path),\n serialize: (path, data, dryRun) => writeYaml(path, data, dryRun),\n isPresentButUnparseable: () => false,\n };\n}\n"],"mappings":";;;;;;AAcA,SAAS,YAAY,cAAc,qBAAqB;AACxD,SAAS,eAAe;AAExB,SAAS,OAAO,iBAAiB;AAU1B,SAAS,SAAsC,MAAwB;AAC5E,MAAI,CAAC,WAAW,IAAI,EAAG,QAAO;AAC9B,MAAI;AACF,UAAM,SAAS,MAAM,aAAa,MAAM,MAAM,CAAC;AAE/C,WAAO,UAAU,OAAO,OAAO;AAAA,EACjC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAMO,SAAS,UAAU,MAAc,MAAe,SAAS,OAAa;AAC3E,MAAI,OAAQ;AACZ,YAAU,QAAQ,IAAI,CAAC;AACvB,gBAAc,MAAM,UAAU,IAAI,GAAG,MAAM;AAC7C;AASO,SAAS,qBAAqC;AACnD,SAAO;AAAA,IACL,OAAO,CAAC,SAAS,SAAkC,IAAI;AAAA,IACvD,WAAW,CAAC,MAAM,MAAM,WAAW,UAAU,MAAM,MAAM,MAAM;AAAA,IAC/D,yBAAyB,MAAM;AAAA,EACjC;AACF;","names":[]}
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ADAPTER_REGISTRY
4
- } from "./chunk-BMD7ANKF.js";
4
+ } from "./chunk-XQUUNAGC.js";
5
5
 
6
6
  // src/adapters/detect.ts
7
7
  async function detectInstalledPlatforms(projectDir) {
@@ -80,4 +80,4 @@ export {
80
80
  detectInstalledPlatforms,
81
81
  detectRuntimeHost
82
82
  };
83
- //# sourceMappingURL=chunk-EROJDXMW.js.map
83
+ //# sourceMappingURL=chunk-NYR55UT7.js.map
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  allAdapters,
4
4
  loadAdapter
5
- } from "./chunk-BMD7ANKF.js";
5
+ } from "./chunk-XQUUNAGC.js";
6
6
 
7
7
  // src/sdk/introspect.ts
8
8
  var SURFACE_PREDICATES = {
@@ -41,4 +41,4 @@ export {
41
41
  hostsSupporting,
42
42
  surfaceSupport
43
43
  };
44
- //# sourceMappingURL=chunk-SRVAA2VN.js.map
44
+ //# sourceMappingURL=chunk-OZ5EXXQV.js.map
@@ -79,6 +79,19 @@ function buildServeWrapperCommand(homeBinPath, connectorId, realCommand, realArg
79
79
  args: [...flags, "--", realCommand, ...realArgs]
80
80
  };
81
81
  }
82
+ function buildWrappedStdio(ctx, server, platformId, command, args) {
83
+ if (!shouldWrapForTelemetry(server, ctx.connector.telemetry)) {
84
+ return { command, args };
85
+ }
86
+ return buildServeWrapperCommand(
87
+ ctx.homeBinPath,
88
+ ctx.connector.id,
89
+ command,
90
+ args,
91
+ ctx.scope,
92
+ platformId
93
+ );
94
+ }
82
95
  function resolveSpawnCommand(command, deps = {}) {
83
96
  const platform = deps.platform ?? process.platform;
84
97
  if (platform !== "win32") return { file: command, needsShell: false };
@@ -135,7 +148,8 @@ export {
135
148
  isHostNativeUsageEnabled,
136
149
  shouldWrapForTelemetry,
137
150
  buildServeWrapperCommand,
151
+ buildWrappedStdio,
138
152
  resolveSpawnCommand,
139
153
  detectLaunchMethod
140
154
  };
141
- //# sourceMappingURL=chunk-I5MLE6S7.js.map
155
+ //# sourceMappingURL=chunk-TO57WYBB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/spawn.ts"],"sourcesContent":["/**\n * core/spawn — cross-platform command construction.\n *\n * Borrowed from context-mode (issues #369/#372/#548/#738): bare `node` is\n * unreliable on Windows Git Bash (MSYS) and MSYS rewrites absolute paths on\n * non-C: drives. Always use the resolved runtime path, forward slashes, and\n * double-quoting. No-ops on macOS/Linux.\n */\n\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nimport type { InstallScope, PlatformId, ServerDef } from \"./types.js\";\nimport type { InstallContext } from \"../adapters/spi.js\";\nimport type {\n LaunchMethod,\n TelemetryInstallScope,\n} from \"../telemetry/types.js\";\n\n/**\n * Narrow the framework's 5-value {@link InstallScope} down to the two telemetry\n * slicing buckets: only a `project`-local install is `project`; everything else\n * (system/user/profile/managed) is global and reads as `user`.\n */\nexport function narrowInstallScope(scope: InstallScope): TelemetryInstallScope {\n return scope === \"project\" ? \"project\" : \"user\";\n}\n\n/** Build `\"<nodePath>\" \"<scriptPath>\"`. */\nexport function buildNodeCommand(\n scriptPath: string,\n opts?: { nodePath?: string },\n): string {\n const nodePath = (opts?.nodePath ?? process.execPath).replace(/\\\\/g, \"/\");\n const safe = scriptPath.replace(/\\\\/g, \"/\");\n return `\"${nodePath}\" \"${safe}\"`;\n}\n\n/**\n * Strict inverse of buildNodeCommand. Returns the two quoted tokens, or null if\n * `cmd` was not produced by buildNodeCommand (no fragile last-whitespace tail\n * grabbing — that was the #548 doubled-path bug when paths contained spaces).\n */\nexport function parseNodeCommand(\n cmd: string,\n): { nodePath: string; scriptPath: string } | null {\n if (typeof cmd !== \"string\" || cmd.length === 0) return null;\n const m = cmd.match(/^\"([^\"]+)\"\\s+\"([^\"]+)\"\\s*$/);\n if (!m || !m[1] || !m[2]) return null;\n return { nodePath: m[1], scriptPath: m[2] };\n}\n\n/** Quote a single argument for inclusion in a host hook command string. */\nexport function quoteArg(arg: string): string {\n return `\"${arg.replace(/\\\\/g, \"/\")}\"`;\n}\n\n/**\n * True when `hay` (slash-normalized) has the quoted home-bin path IMMEDIATELY\n * followed by `verb` — i.e. the verb sits in its command SLOT (right after the\n * home binary), not merely somewhere in the argument list. This distinguishes\n * `\"<bin>\" statusline …` from `\"<bin>\" action … statusline …`: the action verb\n * takes a free-form `actionId` positional that can legitimately equal another\n * verb's name (`statusline` / `usage-event` / `hook`), and only the SLOT\n * position identifies the real verb. `homeBinNorm` is the slash-normalized\n * home-bin path the caller already derived.\n */\nfunction hasVerbSlot(hay: string, homeBinNorm: string, verb: string): boolean {\n return hay.includes(`\"${homeBinNorm}\" ${verb} `);\n}\n\n/**\n * Build the universal hook command a host config points at:\n * \"<homeBin>\" hook <platformId> <event> --connector <id>\n * Pointing every host at the one stable home binary is how a single update\n * propagates everywhere (docs/ARCHITECTURE.md §3 R1).\n */\nexport function buildHomeBinHookCommand(\n homeBinPath: string,\n platformId: string,\n event: string,\n connectorId: string,\n): string {\n return `${quoteArg(homeBinPath)} hook ${platformId} ${event} --connector ${connectorId}`;\n}\n\n/**\n * True when `command` is a home-bin hook command for exactly `connectorId`.\n *\n * Critical: the connector id is the LAST token of the hook command\n * (`... --connector <id>`), so a naive `command.includes(\"--connector \" + id)`\n * collides on shared-prefix ids — `--connector acme-db` contains\n * `--connector acme`, which would let uninstalling `acme` strip `acme-db`'s\n * hooks. We anchor the id token: the character after it must be end-of-string,\n * whitespace, or a closing double-quote (the JSON-embedded case). Connector ids\n * are kebab-case (ID_RE) so they never contain whitespace or quotes themselves.\n */\nexport function isHomeBinHookCommand(\n command: string | undefined,\n homeBinPath: string,\n connectorId: string,\n): boolean {\n if (!command) return false;\n // The stored command was forward-slashed by quoteArg(); homeBinPath() yields\n // NATIVE (back)slashes on Windows (node:path join). Normalize BOTH sides so the\n // ownership substring test holds on win32 (without this, detection always\n // returns false there → duplicate hooks on re-install + orphans on uninstall).\n // No-op on POSIX.\n const hay = command.replace(/\\\\/g, \"/\");\n if (!hay.includes(homeBinPath.replace(/\\\\/g, \"/\"))) return false;\n const token = `--connector ${connectorId}`;\n let from = 0;\n for (;;) {\n const idx = hay.indexOf(token, from);\n if (idx < 0) return false;\n const after = hay.charAt(idx + token.length);\n if (after === \"\" || after === '\"' || /\\s/.test(after)) return true;\n from = idx + token.length;\n }\n}\n\n/**\n * Build the OPT-IN host-native usage-event command an AfterModel / PostInvocation\n * hook points at:\n * \"<homeBin>\" usage-event <platformId> --connector <id>\n * Mirrors {@link buildHomeBinHookCommand} (same anchoring rules apply) but routes\n * to the hidden `usage-event` entrypoint, which records a DISTINCT `model_turn`\n * row instead of dispatching a connector handler.\n */\nexport function buildUsageEventCommand(\n homeBinPath: string,\n platformId: string,\n connectorId: string,\n): string {\n return `${quoteArg(homeBinPath)} usage-event ${platformId} --connector ${connectorId}`;\n}\n\n/**\n * True when `command` is OUR host-native usage-event command for exactly\n * `connectorId`. Same end-of-token anchoring as {@link isHomeBinHookCommand} so a\n * shared-prefix id can't collide; additionally requires the ` usage-event ` verb\n * so it is never confused with a plain `hook` command during uninstall.\n */\nexport function isUsageEventCommand(\n command: string | undefined,\n homeBinPath: string,\n connectorId: string,\n): boolean {\n if (!command) return false;\n // Normalize separators like isHomeBinHookCommand (win32 ownership detection).\n const hay = command.replace(/\\\\/g, \"/\");\n const homeBinNorm = homeBinPath.replace(/\\\\/g, \"/\");\n if (!hay.includes(homeBinNorm)) return false;\n if (!hasVerbSlot(hay, homeBinNorm, \"usage-event\")) return false;\n return isHomeBinHookCommand(command, homeBinPath, connectorId);\n}\n\n/**\n * Build the home-bin statusline command a host's status line config points at:\n * \"<homeBin>\" statusline <platformId> --connector <id>\n * Mirrors {@link buildHomeBinHookCommand} / {@link buildUsageEventCommand} (the\n * same single-home-binary indirection) but routes to the `statusline`\n * entrypoint, which renders the connector's HUD line for the host.\n */\nexport function buildHomeBinStatuslineCommand(\n homeBinPath: string,\n platformId: string,\n connectorId: string,\n): string {\n return `${quoteArg(homeBinPath)} statusline ${platformId} --connector ${connectorId}`;\n}\n\n/**\n * True when `command` is OUR home-bin statusline command for exactly\n * `connectorId`. Same end-of-token anchoring as {@link isHomeBinHookCommand} so a\n * shared-prefix id can't collide; additionally requires the ` statusline ` verb\n * so it is never confused with a plain `hook` / `usage-event` command.\n */\nexport function isHomeBinStatuslineCommand(\n command: string | undefined,\n homeBinPath: string,\n connectorId: string,\n): boolean {\n if (!command) return false;\n // Normalize separators like isHomeBinHookCommand (win32 ownership detection).\n const hay = command.replace(/\\\\/g, \"/\");\n const homeBinNorm = homeBinPath.replace(/\\\\/g, \"/\");\n if (!hay.includes(homeBinNorm)) return false;\n if (!hasVerbSlot(hay, homeBinNorm, \"statusline\")) return false;\n return isHomeBinHookCommand(command, homeBinPath, connectorId);\n}\n\n/**\n * Build the home-bin action command a future host affordance (slash command /\n * keybinding) points at:\n * \"<homeBin>\" action <platformId> <actionId> --connector <id>\n * Mirrors {@link buildHomeBinStatuslineCommand} (the same single-home-binary\n * indirection) but routes to the `action` entrypoint, which re-imports the\n * connector and runs the named action's run(ctx). v1 ships only this command\n * builder + the runtime verb; no adapter EMITS the affordance yet.\n */\nexport function buildHomeBinActionCommand(\n homeBinPath: string,\n platformId: string,\n actionId: string,\n connectorId: string,\n): string {\n return `${quoteArg(homeBinPath)} action ${platformId} ${actionId} --connector ${connectorId}`;\n}\n\n/**\n * True when `command` is OUR home-bin action command for exactly `connectorId`.\n * Same end-of-token anchoring as {@link isHomeBinHookCommand} so a shared-prefix\n * id can't collide; additionally requires the ` action ` verb so it is never\n * confused with a plain `hook` / `usage-event` / `statusline` command.\n */\nexport function isHomeBinActionCommand(\n command: string | undefined,\n homeBinPath: string,\n connectorId: string,\n): boolean {\n if (!command) return false;\n // Normalize separators like isHomeBinHookCommand (win32 ownership detection).\n const hay = command.replace(/\\\\/g, \"/\");\n const homeBinNorm = homeBinPath.replace(/\\\\/g, \"/\");\n if (!hay.includes(homeBinNorm)) return false;\n if (!hasVerbSlot(hay, homeBinNorm, \"action\")) return false;\n return isHomeBinHookCommand(command, homeBinPath, connectorId);\n}\n\n/**\n * Single source of truth for \"is OPT-IN host-native turn-usage capture enabled\n * for this connector?\" — read by the Gemini / Antigravity adapters at install\n * time to decide whether to ALSO write the AfterModel / PostInvocation usage hook.\n * Enabled when the connector opts in via telemetry.hostNativeUsage OR when the\n * install-time env switch AGENT_CONNECTOR_HOST_NATIVE=1 forces it on. Off by\n * default (privacy: host-native capture is never installed silently).\n */\nexport function isHostNativeUsageEnabled(\n telemetry: { enabled: boolean; hostNativeUsage?: boolean },\n env: NodeJS.ProcessEnv = process.env,\n): boolean {\n if (telemetry.enabled !== true) return false;\n if (env.AGENT_CONNECTOR_HOST_NATIVE === \"1\") return true;\n return telemetry.hostNativeUsage === true;\n}\n\n/**\n * Single source of truth for \"should this server be wrapped by `serve` for\n * telemetry?\" — so every adapter behaves identically even for a server that\n * skipped normalizeServer (e.g. a per-platform override). On by default for an\n * stdio server with a command, unless explicitly disabled or telemetry is off.\n */\nexport function shouldWrapForTelemetry(\n server: ServerDef,\n telemetry: { enabled: boolean },\n): boolean {\n return (\n server.wrapForTelemetry !== false &&\n telemetry.enabled === true &&\n server.transport === \"stdio\" &&\n typeof server.command === \"string\" &&\n server.command !== \"\"\n );\n}\n\n/**\n * Build the telemetry-wrapping server command:\n * \"<homeBin>\" serve --connector <id> --scope <scope> --host <platformId> -- <realCommand> <realArgs...>\n * Used when a stdio server opts into transparent telemetry capture.\n *\n * `scope` records the install dimension (global user vs project-local) on every\n * telemetry row so usage can be sliced by it later. It is OPTIONAL for backward\n * compatibility: when omitted, the `--scope` flag is not emitted and the runtime\n * treats the scope as \"unknown\".\n *\n * `platformId` bakes the install TARGET platform into the wrapper so the proxy\n * stamps `hostPlatform` correctly even under a headless spawn where runtime env\n * markers are absent (detectRuntimeHost only knows claude-code/cursor/codex and\n * otherwise mis-attributes). Emitted as `--host <platformId>` in the FLAG\n * section (before `--`). It is OPTIONAL + backward-compatible: when omitted the\n * `--host` flag is not emitted and the runtime falls back to env detection.\n */\nexport function buildServeWrapperCommand(\n homeBinPath: string,\n connectorId: string,\n realCommand: string,\n realArgs: string[],\n scope?: InstallScope,\n platformId?: PlatformId,\n): { command: string; args: string[] } {\n const flags = [\"serve\", \"--connector\", connectorId];\n if (scope !== undefined) flags.push(\"--scope\", narrowInstallScope(scope));\n if (platformId !== undefined) flags.push(\"--host\", platformId);\n return {\n command: homeBinPath,\n args: [...flags, \"--\", realCommand, ...realArgs],\n };\n}\n\n/**\n * Telemetry serve-wrap for a stdio command: when the connector opts in, route\n * `command`/`args` through `<homeBin> serve --connector <id> -- …`; otherwise\n * return them unchanged. Consolidates the per-host wrap snippet — the caller\n * keeps its own command/args seeding + downstream env-resolution + entry shaping.\n */\nexport function buildWrappedStdio(\n ctx: Pick<InstallContext, \"homeBinPath\" | \"connector\" | \"scope\">,\n server: ServerDef,\n platformId: PlatformId,\n command: string,\n args: string[],\n): { command: string; args: string[] } {\n if (!shouldWrapForTelemetry(server, ctx.connector.telemetry)) {\n return { command, args };\n }\n return buildServeWrapperCommand(\n ctx.homeBinPath,\n ctx.connector.id,\n command,\n args,\n ctx.scope,\n platformId,\n );\n}\n\n/** Injectable deps for {@link resolveSpawnCommand} (so the win32 branch is unit-testable on POSIX). */\nexport interface SpawnResolveDeps {\n platform?: NodeJS.Platform;\n /** PATH value (`;`-separated on Windows). */\n pathEnv?: string;\n /** PATHEXT value (`;`-separated). */\n pathExt?: string;\n /** File-existence probe (defaults to fs.existsSync). */\n exists?: (p: string) => boolean;\n}\n\n/** How a child command should be handed to spawn() on this platform. */\nexport interface SpawnResolution {\n /** The command to pass to spawn() (an absolute path on win32 when resolved). */\n file: string;\n /**\n * Whether spawn() MUST use `shell: true`. On native Windows a `.cmd`/`.bat`\n * shim (npx.cmd, pnpm.cmd, the agent-connector.cmd launcher) cannot be run by\n * raw CreateProcess — Node throws EINVAL since the 2024 security fix unless a\n * shell is used. `.exe` resolves directly with no shell.\n */\n needsShell: boolean;\n}\n\n/**\n * Resolve a child command for spawn() across platforms. NO-OP on macOS/Linux\n * (returns the command unchanged, no shell). On native Windows it fixes the two\n * spawn failure modes for bare package runners:\n * 1. raw CreateProcess ignores PATHEXT, so spawn(\"npx\") → ENOENT even though\n * `npx.cmd` is on PATH. We search PATH × PATHEXT and return the resolved\n * absolute path.\n * 2. a resolved `.cmd`/`.bat` still cannot be launched without a shell, so we\n * flag `needsShell` for those (and `.exe`/`.com` run directly).\n * A bare name that PATH search misses falls back to `{ file: command,\n * needsShell: true }` so cmd.exe's own PATHEXT lookup still finds it.\n */\nexport function resolveSpawnCommand(\n command: string,\n deps: SpawnResolveDeps = {},\n): SpawnResolution {\n const platform = deps.platform ?? process.platform;\n if (platform !== \"win32\") return { file: command, needsShell: false };\n\n const isBatch = (s: string): boolean => /\\.(cmd|bat)$/i.test(s);\n\n // Already a path or already has an extension → don't search; only decide shell.\n if (/[\\\\/]/.test(command) || /\\.[a-z0-9]+$/i.test(command)) {\n return { file: command, needsShell: isBatch(command) };\n }\n\n const exists = deps.exists ?? existsSync;\n const pathEnv = deps.pathEnv ?? process.env.PATH ?? process.env.Path ?? \"\";\n const pathExt = deps.pathExt ?? process.env.PATHEXT ?? \".COM;.EXE;.BAT;.CMD\";\n const dirs = pathEnv.split(\";\").filter((d) => d !== \"\");\n const exts = pathExt.split(\";\").filter((e) => e !== \"\");\n for (const dir of dirs) {\n for (const ext of exts) {\n const candidate = join(dir, command + ext);\n if (exists(candidate)) return { file: candidate, needsShell: isBatch(ext) };\n }\n }\n // Not found on PATH — let cmd.exe resolve it (handles shim dirs we may miss).\n return { file: command, needsShell: true };\n}\n\n/** Basenames (case-insensitive, sans common extensions) of the ephemeral package runners. */\nconst PACKAGE_RUNNERS: Record<string, Extract<LaunchMethod, \"npx\" | \"bunx\" | \"uvx\">> = {\n npx: \"npx\",\n bunx: \"bunx\",\n uvx: \"uvx\",\n};\n\n/** Basenames of language interpreters that launch a local script. */\nconst INTERPRETERS: ReadonlySet<string> = new Set([\"node\", \"bun\", \"deno\"]);\n\n/**\n * Strip a directory prefix and a trailing executable extension to get the bare\n * program name. Tolerates both POSIX and Windows separators (the wrapped command\n * may be an absolute Windows path) and lowercases for case-insensitive matching.\n */\nfunction commandBasename(realCommand: string): string {\n const noDir = realCommand.replace(/\\\\/g, \"/\").split(\"/\").pop() ?? realCommand;\n return noDir.replace(/\\.(exe|cmd|bat|com)$/i, \"\").toLowerCase();\n}\n\n/**\n * Classify how the real MCP server is launched, for the \"launch-method\" slicing\n * dimension. Package runners (npx/bunx/uvx) and interpreters (node/bun/deno) are\n * detected by the command basename. A remote (http) server is not launched\n * locally, so the caller — which alone knows the transport — passes\n * `isRemote: true` to force \"http\". Anything else resolves to \"binary\".\n */\nexport function detectLaunchMethod(\n realCommand: string,\n realArgs: string[],\n opts?: { isRemote?: boolean },\n): LaunchMethod {\n void realArgs; // reserved: args may later refine node-vs-script heuristics\n if (opts?.isRemote === true) return \"http\";\n if (typeof realCommand !== \"string\" || realCommand.trim() === \"\") {\n return \"unknown\";\n }\n const base = commandBasename(realCommand);\n if (base === \"\") return \"unknown\";\n const runner = PACKAGE_RUNNERS[base];\n if (runner !== undefined) return runner;\n if (INTERPRETERS.has(base)) return \"node\";\n return \"binary\";\n}\n"],"mappings":";;;AASA,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AAcd,SAAS,mBAAmB,OAA4C;AAC7E,SAAO,UAAU,YAAY,YAAY;AAC3C;AA2BO,SAAS,SAAS,KAAqB;AAC5C,SAAO,IAAI,IAAI,QAAQ,OAAO,GAAG,CAAC;AACpC;AAYA,SAAS,YAAY,KAAa,aAAqB,MAAuB;AAC5E,SAAO,IAAI,SAAS,IAAI,WAAW,KAAK,IAAI,GAAG;AACjD;AAQO,SAAS,wBACd,aACA,YACA,OACA,aACQ;AACR,SAAO,GAAG,SAAS,WAAW,CAAC,SAAS,UAAU,IAAI,KAAK,gBAAgB,WAAW;AACxF;AAaO,SAAS,qBACd,SACA,aACA,aACS;AACT,MAAI,CAAC,QAAS,QAAO;AAMrB,QAAM,MAAM,QAAQ,QAAQ,OAAO,GAAG;AACtC,MAAI,CAAC,IAAI,SAAS,YAAY,QAAQ,OAAO,GAAG,CAAC,EAAG,QAAO;AAC3D,QAAM,QAAQ,eAAe,WAAW;AACxC,MAAI,OAAO;AACX,aAAS;AACP,UAAM,MAAM,IAAI,QAAQ,OAAO,IAAI;AACnC,QAAI,MAAM,EAAG,QAAO;AACpB,UAAM,QAAQ,IAAI,OAAO,MAAM,MAAM,MAAM;AAC3C,QAAI,UAAU,MAA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,0 +1,33 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/core/host-paths.ts
4
+ import { homedir } from "os";
5
+ import { join, resolve } from "path";
6
+ function xdgConfigHome() {
7
+ const xdg = process.env.XDG_CONFIG_HOME;
8
+ return xdg && xdg.trim() !== "" ? resolve(xdg) : join(homedir(), ".config");
9
+ }
10
+ function roamingAppData() {
11
+ const appData = process.env.APPDATA;
12
+ return appData && appData.trim() !== "" ? resolve(appData) : join(homedir(), "AppData", "Roaming");
13
+ }
14
+ function localAppData() {
15
+ const local = process.env.LOCALAPPDATA;
16
+ return local && local.trim() !== "" ? resolve(local) : join(homedir(), "AppData", "Local");
17
+ }
18
+ function codexConfigHome() {
19
+ const env = process.env.CODEX_HOME;
20
+ if (env && env.trim() !== "") {
21
+ if (env.startsWith("~")) return join(homedir(), env.replace(/^~[/\\]?/, ""));
22
+ return resolve(env);
23
+ }
24
+ return join(homedir(), ".codex");
25
+ }
26
+
27
+ export {
28
+ xdgConfigHome,
29
+ roamingAppData,
30
+ localAppData,
31
+ codexConfigHome
32
+ };
33
+ //# sourceMappingURL=chunk-UM5S7DKK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/host-paths.ts"],"sourcesContent":["// ─────────────────────────────────────────────────────────────────────────\n// host-paths.ts — shared OS user-config-dir base resolvers\n//\n// Several adapters resolve the SAME per-OS \"user config base\" directory with\n// the same logic (XDG on posix; %APPDATA%/%LOCALAPPDATA% on Windows, each with\n// a ~/AppData fallback). These helpers consolidate that resolution so the\n// per-host adapters only carry their host-specific SUFFIX. The result is\n// byte-identical for absolute/clean config-dir inputs (the realistic case);\n// a non-canonical env value (relative, trailing slash, `..`) is normalized via\n// `resolve()` rather than passed through bare — a safe canonicalization.\n//\n// Scope note: these are the USER-CONFIG-DIR bases (where a host keeps its\n// settings/config files). The agent-connector *data-root* paths (our own\n// per-project state) live in core/paths.ts — do NOT conflate the two.\n//\n// Host-specific config-home resolvers that are SHARED across modules (e.g.\n// `codexConfigHome`, used by BOTH the codex adapter and marketplace detection)\n// DO live here, so the writer and the probe can never disagree on the dir.\n// Single-caller host envs (PI_CODING_AGENT_DIR, OPENCLAW_*) stay in their own\n// adapter.\n// ─────────────────────────────────────────────────────────────────────────\n\nimport { homedir } from \"node:os\";\nimport { join, resolve } from \"node:path\";\n\n/** $XDG_CONFIG_HOME when set & non-empty, else ~/.config. */\nexport function xdgConfigHome(): string {\n const xdg = process.env.XDG_CONFIG_HOME;\n return xdg && xdg.trim() !== \"\" ? resolve(xdg) : join(homedir(), \".config\");\n}\n\n/** %APPDATA% (Roaming) when set & non-empty, else ~/AppData/Roaming. */\nexport function roamingAppData(): string {\n const appData = process.env.APPDATA;\n return appData && appData.trim() !== \"\"\n ? resolve(appData)\n : join(homedir(), \"AppData\", \"Roaming\");\n}\n\n/** %LOCALAPPDATA% when set & non-empty, else ~/AppData/Local. */\nexport function localAppData(): string {\n const local = process.env.LOCALAPPDATA;\n return local && local.trim() !== \"\"\n ? resolve(local)\n : join(homedir(), \"AppData\", \"Local\");\n}\n\n/** Codex's config home: $CODEX_HOME (tilde-expanded, then resolved) when set\n * & non-empty, else ~/.codex. Shared by the codex adapter (writer) and the\n * marketplace detection probe so they never disagree on the config dir. */\nexport function codexConfigHome(): string {\n const env = process.env.CODEX_HOME;\n if (env && env.trim() !== \"\") {\n if (env.startsWith(\"~\")) return join(homedir(), env.replace(/^~[/\\\\]?/, \"\"));\n return resolve(env);\n }\n return join(homedir(), \".codex\");\n}\n"],"mappings":";;;AAsBA,SAAS,eAAe;AACxB,SAAS,MAAM,eAAe;AAGvB,SAAS,gBAAwB;AACtC,QAAM,MAAM,QAAQ,IAAI;AACxB,SAAO,OAAO,IAAI,KAAK,MAAM,KAAK,QAAQ,GAAG,IAAI,KAAK,QAAQ,GAAG,SAAS;AAC5E;AAGO,SAAS,iBAAyB;AACvC,QAAM,UAAU,QAAQ,IAAI;AAC5B,SAAO,WAAW,QAAQ,KAAK,MAAM,KACjC,QAAQ,OAAO,IACf,KAAK,QAAQ,GAAG,WAAW,SAAS;AAC1C;AAGO,SAAS,eAAuB;AACrC,QAAM,QAAQ,QAAQ,IAAI;AAC1B,SAAO,SAAS,MAAM,KAAK,MAAM,KAC7B,QAAQ,KAAK,IACb,KAAK,QAAQ,GAAG,WAAW,OAAO;AACxC;AAKO,SAAS,kBAA0B;AACxC,QAAM,MAAM,QAAQ,IAAI;AACxB,MAAI,OAAO,IAAI,KAAK,MAAM,IAAI;AAC5B,QAAI,IAAI,WAAW,GAAG,EAAG,QAAO,KAAK,QAAQ,GAAG,IAAI,QAAQ,YAAY,EAAE,CAAC;AAC3E,WAAO,QAAQ,GAAG;AAAA,EACpB;AACA,SAAO,KAAK,QAAQ,GAAG,QAAQ;AACjC;","names":[]}
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  installInstructions,
4
4
  packageConnector
5
- } from "./chunk-2X4EH2D7.js";
5
+ } from "./chunk-CDVOBKSG.js";
6
6
  import {
7
7
  MARKETPLACE_NAME,
8
8
  agyPluginInstalled,
@@ -38,13 +38,13 @@ import {
38
38
  readMarketplaceInstalls,
39
39
  readNpmConfig,
40
40
  writeMarketplaceInstalls
41
- } from "./chunk-G5CQHVQG.js";
41
+ } from "./chunk-7TVBFRVI.js";
42
42
  import {
43
43
  spawnChild
44
- } from "./chunk-F5RX62T7.js";
44
+ } from "./chunk-7QRUZAUG.js";
45
45
  import {
46
46
  detectInstalledPlatforms
47
- } from "./chunk-EROJDXMW.js";
47
+ } from "./chunk-NYR55UT7.js";
48
48
  import {
49
49
  log
50
50
  } from "./chunk-KHO5WNTP.js";
@@ -52,11 +52,11 @@ import {
52
52
  deregisterConnector,
53
53
  loadRegisteredConnector,
54
54
  registerConnector
55
- } from "./chunk-MZF2YCXX.js";
55
+ } from "./chunk-MOW2RKHX.js";
56
56
  import {
57
57
  REGISTERED_PLATFORM_IDS,
58
58
  loadAdapter
59
- } from "./chunk-BMD7ANKF.js";
59
+ } from "./chunk-XQUUNAGC.js";
60
60
  import {
61
61
  configPatchManualEdit
62
62
  } from "./chunk-FAHIMJRU.js";
@@ -3032,4 +3032,4 @@ export {
3032
3032
  upgradeViaMarketplace,
3033
3033
  marketplaceDoctorChecks
3034
3034
  };
3035
- //# sourceMappingURL=chunk-5G4EPJ4Y.js.map
3035
+ //# sourceMappingURL=chunk-VRKTVCYJ.js.map
@@ -12,11 +12,11 @@ import {
12
12
  import {
13
13
  loadRegisteredConnector,
14
14
  readRegisteredMeta
15
- } from "./chunk-MZF2YCXX.js";
15
+ } from "./chunk-MOW2RKHX.js";
16
16
  import {
17
17
  REGISTERED_PLATFORM_IDS,
18
18
  loadAdapter
19
- } from "./chunk-BMD7ANKF.js";
19
+ } from "./chunk-XQUUNAGC.js";
20
20
  import {
21
21
  projectIdentity
22
22
  } from "./chunk-TRQKHP7D.js";
@@ -348,4 +348,4 @@ export {
348
348
  isNativeHookDeclared,
349
349
  runNativeHook
350
350
  };
351
- //# sourceMappingURL=chunk-QOGMDOUX.js.map
351
+ //# sourceMappingURL=chunk-WI6YSXOC.js.map