@ken-jo/agent-connector 0.1.0 → 0.3.0

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 (174) hide show
  1. package/README.md +183 -24
  2. package/dist/{amp-QSFH2V7Y.js → amp-YGV66GJT.js} +9 -2
  3. package/dist/amp-YGV66GJT.js.map +1 -0
  4. package/dist/{antigravity-CX2YLSY7.js → antigravity-7IBYFO6P.js} +4 -3
  5. package/dist/{antigravity-cli-YQDFVV4U.js → antigravity-cli-JEOUP2VN.js} +4 -3
  6. package/dist/{antigravity-cli-YQDFVV4U.js.map → antigravity-cli-JEOUP2VN.js.map} +1 -1
  7. package/dist/{chunk-LTT56GI3.js → chunk-3JCRUROU.js} +18 -5
  8. package/dist/chunk-3JCRUROU.js.map +1 -0
  9. package/dist/chunk-44HUXXC6.js +284 -0
  10. package/dist/chunk-44HUXXC6.js.map +1 -0
  11. package/dist/{chunk-54EMKTTX.js → chunk-DS3LUFVN.js} +21 -21
  12. package/dist/chunk-DS3LUFVN.js.map +1 -0
  13. package/dist/chunk-GSGDG2BV.js +568 -0
  14. package/dist/chunk-GSGDG2BV.js.map +1 -0
  15. package/dist/{chunk-TRKWUNO4.js → chunk-KQSNDFBN.js} +13 -2
  16. package/dist/chunk-KQSNDFBN.js.map +1 -0
  17. package/dist/{chunk-KHO5WNTP.js → chunk-KVAAFYRR.js} +18 -2
  18. package/dist/chunk-KVAAFYRR.js.map +1 -0
  19. package/dist/chunk-N6HH7K6P.js +494 -0
  20. package/dist/chunk-N6HH7K6P.js.map +1 -0
  21. package/dist/{chunk-XUCWLJY5.js → chunk-NJU275US.js} +30 -30
  22. package/dist/{chunk-WCETQWWK.js → chunk-OP4KBXUO.js} +1 -17
  23. package/dist/chunk-OP4KBXUO.js.map +1 -0
  24. package/dist/{chunk-TIIP3RG2.js → chunk-PD4VFEBY.js} +342 -2
  25. package/dist/chunk-PD4VFEBY.js.map +1 -0
  26. package/dist/chunk-QADSG2JY.js +1989 -0
  27. package/dist/chunk-QADSG2JY.js.map +1 -0
  28. package/dist/{chunk-WV63X7IK.js → chunk-SCVBYSF7.js} +2 -2
  29. package/dist/chunk-SCVBYSF7.js.map +1 -0
  30. package/dist/{package-DLOVE2E4.js → chunk-WNREHWKL.js} +26 -115
  31. package/dist/chunk-WNREHWKL.js.map +1 -0
  32. package/dist/{chunk-YNZU6PAV.js → chunk-ZAM4M7LI.js} +74 -21
  33. package/dist/chunk-ZAM4M7LI.js.map +1 -0
  34. package/dist/claude-code-4275HQU4.js +1432 -0
  35. package/dist/claude-code-4275HQU4.js.map +1 -0
  36. package/dist/cli/sdk.js +4 -3
  37. package/dist/cli/sdk.js.map +1 -1
  38. package/dist/cli.js +1 -1
  39. package/dist/{codebuff-QX57FJDN.js → codebuff-LE3KBZGM.js} +9 -2
  40. package/dist/codebuff-LE3KBZGM.js.map +1 -0
  41. package/dist/{codex-JFQTS6LU.js → codex-4BY2ZJIW.js} +148 -7
  42. package/dist/codex-4BY2ZJIW.js.map +1 -0
  43. package/dist/{copilot-cli-MTCGHZ2T.js → copilot-cli-IPISKO3V.js} +109 -2
  44. package/dist/copilot-cli-IPISKO3V.js.map +1 -0
  45. package/dist/{crush-I7PK3FGI.js → crush-X3E25EQG.js} +31 -3
  46. package/dist/crush-X3E25EQG.js.map +1 -0
  47. package/dist/{cursor-4TMXKJOZ.js → cursor-UH3W622V.js} +66 -5
  48. package/dist/cursor-UH3W622V.js.map +1 -0
  49. package/dist/{detect-WIAGVYS4.js → detect-MNDHGLSV.js} +7 -3
  50. package/dist/detect-MNDHGLSV.js.map +1 -0
  51. package/dist/{doctor-EZW2K4NI.js → doctor-N5KZDD55.js} +45 -7
  52. package/dist/doctor-N5KZDD55.js.map +1 -0
  53. package/dist/{droid-KN6VRMMT.js → droid-T5VBRXZF.js} +32 -3
  54. package/dist/droid-T5VBRXZF.js.map +1 -0
  55. package/dist/{gemini-cli-Y35FFK4M.js → gemini-cli-ZSUK55UA.js} +51 -3
  56. package/dist/gemini-cli-ZSUK55UA.js.map +1 -0
  57. package/dist/{goose-ZTGTSUFJ.js → goose-M3RR3CZG.js} +63 -4
  58. package/dist/goose-M3RR3CZG.js.map +1 -0
  59. package/dist/{hermes-H2KV44GK.js → hermes-CUNKIAR5.js} +76 -3
  60. package/dist/hermes-CUNKIAR5.js.map +1 -0
  61. package/dist/{hook-YVDILAMZ.js → hook-7LUOKIXH.js} +28 -13
  62. package/dist/hook-7LUOKIXH.js.map +1 -0
  63. package/dist/index.d.ts +2 -2
  64. package/dist/index.js +3 -1
  65. package/dist/install-TQTT4F3I.js +89 -0
  66. package/dist/install-TQTT4F3I.js.map +1 -0
  67. package/dist/{jetbrains-copilot-HWA3DMH7.js → jetbrains-copilot-C3HDGGML.js} +16 -2
  68. package/dist/jetbrains-copilot-C3HDGGML.js.map +1 -0
  69. package/dist/kilo-PKAJCWPX.js +852 -0
  70. package/dist/kilo-PKAJCWPX.js.map +1 -0
  71. package/dist/{kilo-cli-EAQTHXUW.js → kilo-cli-QWUVXG2O.js} +186 -7
  72. package/dist/kilo-cli-QWUVXG2O.js.map +1 -0
  73. package/dist/{kimi-GQ7VXNYT.js → kimi-EVD7YKXS.js} +167 -9
  74. package/dist/kimi-EVD7YKXS.js.map +1 -0
  75. package/dist/{kiro-VQTT6LO2.js → kiro-UQRY6EIO.js} +98 -4
  76. package/dist/kiro-UQRY6EIO.js.map +1 -0
  77. package/dist/{leaderboard-K6ON3SWW.js → leaderboard-MUJ7DURM.js} +3 -3
  78. package/dist/{mux-T2TV4CIQ.js → mux-5CI5FP2W.js} +9 -2
  79. package/dist/mux-5CI5FP2W.js.map +1 -0
  80. package/dist/{omp-PB4VDKS6.js → omp-AXA7XY22.js} +13 -2
  81. package/dist/omp-AXA7XY22.js.map +1 -0
  82. package/dist/{openclaw-ETN2M63O.js → openclaw-UZ5BMCGQ.js} +101 -4
  83. package/dist/openclaw-UZ5BMCGQ.js.map +1 -0
  84. package/dist/{opencode-FZ33JKUZ.js → opencode-NZBRLJN3.js} +53 -7
  85. package/dist/opencode-NZBRLJN3.js.map +1 -0
  86. package/dist/package-SYPA5POO.js +130 -0
  87. package/dist/package-SYPA5POO.js.map +1 -0
  88. package/dist/{pi-CIU2QHT4.js → pi-WMTUX6ES.js} +106 -23
  89. package/dist/pi-WMTUX6ES.js.map +1 -0
  90. package/dist/{qwen-code-5POCNU6P.js → qwen-code-MRRIUQ3P.js} +187 -6
  91. package/dist/qwen-code-MRRIUQ3P.js.map +1 -0
  92. package/dist/{roo-code-IOIUXRDE.js → roo-code-NI5UU6JB.js} +26 -2
  93. package/dist/roo-code-NI5UU6JB.js.map +1 -0
  94. package/dist/runtime/index.d.ts +38 -4
  95. package/dist/runtime/index.js +11 -6
  96. package/dist/{serve-HVWWY4B6.js → serve-XJOSA7BY.js} +9 -8
  97. package/dist/{serve-HVWWY4B6.js.map → serve-XJOSA7BY.js.map} +1 -1
  98. package/dist/{status-FE7TECZD.js → status-DYSS6BOR.js} +19 -9
  99. package/dist/status-DYSS6BOR.js.map +1 -0
  100. package/dist/{telemetry-36GESKQQ.js → telemetry-IJ4GP2Q3.js} +5 -4
  101. package/dist/{telemetry-36GESKQQ.js.map → telemetry-IJ4GP2Q3.js.map} +1 -1
  102. package/dist/{trae-JSNDZFKL.js → trae-CQC72RHH.js} +9 -2
  103. package/dist/trae-CQC72RHH.js.map +1 -0
  104. package/dist/types-CNigfEuR.d.ts +757 -0
  105. package/dist/uninstall-3DXIBRCV.js +162 -0
  106. package/dist/uninstall-3DXIBRCV.js.map +1 -0
  107. package/dist/{upgrade-JV2VK242.js → upgrade-GJEB3ITY.js} +29 -10
  108. package/dist/upgrade-GJEB3ITY.js.map +1 -0
  109. package/dist/{usage-6ER6EMEY.js → usage-2BJLM3GJ.js} +3 -3
  110. package/dist/{usage-event-JKBI6XCF.js → usage-event-472X3DOY.js} +8 -7
  111. package/dist/{usage-event-JKBI6XCF.js.map → usage-event-472X3DOY.js.map} +1 -1
  112. package/dist/{vscode-copilot-CK3NO54M.js → vscode-copilot-4RVRTCKV.js} +53 -4
  113. package/dist/vscode-copilot-4RVRTCKV.js.map +1 -0
  114. package/dist/{warp-QNVDXOG4.js → warp-X6MB67NT.js} +110 -4
  115. package/dist/warp-X6MB67NT.js.map +1 -0
  116. package/dist/{zed-VRJKWYUR.js → zed-NTCYW4V2.js} +120 -5
  117. package/dist/zed-NTCYW4V2.js.map +1 -0
  118. package/package.json +4 -3
  119. package/dist/amp-QSFH2V7Y.js.map +0 -1
  120. package/dist/chunk-54EMKTTX.js.map +0 -1
  121. package/dist/chunk-7MSDGHJW.js +0 -316
  122. package/dist/chunk-7MSDGHJW.js.map +0 -1
  123. package/dist/chunk-KHO5WNTP.js.map +0 -1
  124. package/dist/chunk-LTT56GI3.js.map +0 -1
  125. package/dist/chunk-TIIP3RG2.js.map +0 -1
  126. package/dist/chunk-TRKWUNO4.js.map +0 -1
  127. package/dist/chunk-WCETQWWK.js.map +0 -1
  128. package/dist/chunk-WV63X7IK.js.map +0 -1
  129. package/dist/chunk-XNAM7F35.js +0 -276
  130. package/dist/chunk-XNAM7F35.js.map +0 -1
  131. package/dist/chunk-YNZU6PAV.js.map +0 -1
  132. package/dist/claude-code-HKDV7T32.js +0 -637
  133. package/dist/claude-code-HKDV7T32.js.map +0 -1
  134. package/dist/codebuff-QX57FJDN.js.map +0 -1
  135. package/dist/codex-JFQTS6LU.js.map +0 -1
  136. package/dist/copilot-cli-MTCGHZ2T.js.map +0 -1
  137. package/dist/crush-I7PK3FGI.js.map +0 -1
  138. package/dist/cursor-4TMXKJOZ.js.map +0 -1
  139. package/dist/detect-WIAGVYS4.js.map +0 -1
  140. package/dist/doctor-EZW2K4NI.js.map +0 -1
  141. package/dist/droid-KN6VRMMT.js.map +0 -1
  142. package/dist/gemini-cli-Y35FFK4M.js.map +0 -1
  143. package/dist/goose-ZTGTSUFJ.js.map +0 -1
  144. package/dist/hermes-H2KV44GK.js.map +0 -1
  145. package/dist/hook-YVDILAMZ.js.map +0 -1
  146. package/dist/install-HQRYZOQ2.js +0 -60
  147. package/dist/install-HQRYZOQ2.js.map +0 -1
  148. package/dist/jetbrains-copilot-HWA3DMH7.js.map +0 -1
  149. package/dist/kilo-QXJRCSLT.js +0 -384
  150. package/dist/kilo-QXJRCSLT.js.map +0 -1
  151. package/dist/kilo-cli-EAQTHXUW.js.map +0 -1
  152. package/dist/kimi-GQ7VXNYT.js.map +0 -1
  153. package/dist/kiro-VQTT6LO2.js.map +0 -1
  154. package/dist/mux-T2TV4CIQ.js.map +0 -1
  155. package/dist/omp-PB4VDKS6.js.map +0 -1
  156. package/dist/openclaw-ETN2M63O.js.map +0 -1
  157. package/dist/opencode-FZ33JKUZ.js.map +0 -1
  158. package/dist/package-DLOVE2E4.js.map +0 -1
  159. package/dist/pi-CIU2QHT4.js.map +0 -1
  160. package/dist/qwen-code-5POCNU6P.js.map +0 -1
  161. package/dist/roo-code-IOIUXRDE.js.map +0 -1
  162. package/dist/status-FE7TECZD.js.map +0 -1
  163. package/dist/trae-JSNDZFKL.js.map +0 -1
  164. package/dist/types-CYUB1OTr.d.ts +0 -427
  165. package/dist/uninstall-IGCKNOSF.js +0 -72
  166. package/dist/uninstall-IGCKNOSF.js.map +0 -1
  167. package/dist/upgrade-JV2VK242.js.map +0 -1
  168. package/dist/vscode-copilot-CK3NO54M.js.map +0 -1
  169. package/dist/warp-QNVDXOG4.js.map +0 -1
  170. package/dist/zed-VRJKWYUR.js.map +0 -1
  171. /package/dist/{antigravity-CX2YLSY7.js.map → antigravity-7IBYFO6P.js.map} +0 -0
  172. /package/dist/{chunk-XUCWLJY5.js.map → chunk-NJU275US.js.map} +0 -0
  173. /package/dist/{leaderboard-K6ON3SWW.js.map → leaderboard-MUJ7DURM.js.map} +0 -0
  174. /package/dist/{usage-6ER6EMEY.js.map → usage-2BJLM3GJ.js.map} +0 -0
@@ -4,39 +4,39 @@
4
4
  var ADAPTER_REGISTRY = [
5
5
  {
6
6
  id: "claude-code",
7
- load: () => import("./claude-code-HKDV7T32.js").then((m) => m.default)
7
+ load: () => import("./claude-code-4275HQU4.js").then((m) => m.default)
8
8
  },
9
9
  {
10
10
  id: "codex",
11
- load: () => import("./codex-JFQTS6LU.js").then((m) => m.default)
11
+ load: () => import("./codex-4BY2ZJIW.js").then((m) => m.default)
12
12
  },
13
13
  {
14
14
  id: "cursor",
15
- load: () => import("./cursor-4TMXKJOZ.js").then((m) => m.default)
15
+ load: () => import("./cursor-UH3W622V.js").then((m) => m.default)
16
16
  },
17
17
  // vscode-copilot after cursor: cursor is a VS Code fork, so the fork's runtime
18
18
  // markers must be checked first during host detection.
19
19
  {
20
20
  id: "vscode-copilot",
21
- load: () => import("./vscode-copilot-CK3NO54M.js").then((m) => m.default)
21
+ load: () => import("./vscode-copilot-4RVRTCKV.js").then((m) => m.default)
22
22
  },
23
23
  {
24
24
  id: "copilot-cli",
25
- load: () => import("./copilot-cli-MTCGHZ2T.js").then((m) => m.default)
25
+ load: () => import("./copilot-cli-IPISKO3V.js").then((m) => m.default)
26
26
  },
27
27
  {
28
28
  id: "gemini-cli",
29
- load: () => import("./gemini-cli-Y35FFK4M.js").then((m) => m.default)
29
+ load: () => import("./gemini-cli-ZSUK55UA.js").then((m) => m.default)
30
30
  },
31
31
  {
32
32
  id: "warp",
33
- load: () => import("./warp-QNVDXOG4.js").then((m) => m.default)
33
+ load: () => import("./warp-X6MB67NT.js").then((m) => m.default)
34
34
  },
35
35
  // ts-plugin paradigm: OpenCode loads a generated plugin module that bridges
36
36
  // its in-process events to the universal hook entrypoint.
37
37
  {
38
38
  id: "opencode",
39
- load: () => import("./opencode-FZ33JKUZ.js").then((m) => m.default)
39
+ load: () => import("./opencode-NZBRLJN3.js").then((m) => m.default)
40
40
  },
41
41
  // kilo-cli is the SQLite-backed OpenCode FORK command-line product (ts-plugin,
42
42
  // loads @kilocode/plugin modules registered in kilo.jsonc's "plugin" array;
@@ -45,27 +45,27 @@ var ADAPTER_REGISTRY = [
45
45
  // the "kilo" extension so there is no fork-ordering constraint between them.
46
46
  {
47
47
  id: "kilo-cli",
48
- load: () => import("./kilo-cli-EAQTHXUW.js").then((m) => m.default)
48
+ load: () => import("./kilo-cli-QWUVXG2O.js").then((m) => m.default)
49
49
  },
50
50
  // Wave 1 — mcp-only adapters (no lifecycle hooks; MCP registration only).
51
51
  {
52
52
  id: "droid",
53
- load: () => import("./droid-KN6VRMMT.js").then((m) => m.default)
53
+ load: () => import("./droid-T5VBRXZF.js").then((m) => m.default)
54
54
  },
55
55
  {
56
56
  id: "roo-code",
57
- load: () => import("./roo-code-IOIUXRDE.js").then((m) => m.default)
57
+ load: () => import("./roo-code-NI5UU6JB.js").then((m) => m.default)
58
58
  },
59
59
  // kilo is the Kilo Code VS Code extension (kilocode.kilo-code) — a Roo/Cline
60
60
  // fork, so it sits beside roo-code (mcp-only, root key "mcpServers", VS Code
61
61
  // globalStorage / .kilocode project scope). Distinct host from "kilo-cli".
62
62
  {
63
63
  id: "kilo",
64
- load: () => import("./kilo-QXJRCSLT.js").then((m) => m.default)
64
+ load: () => import("./kilo-PKAJCWPX.js").then((m) => m.default)
65
65
  },
66
66
  {
67
67
  id: "trae",
68
- load: () => import("./trae-JSNDZFKL.js").then((m) => m.default)
68
+ load: () => import("./trae-CQC72RHH.js").then((m) => m.default)
69
69
  },
70
70
  // antigravity-cli BEFORE antigravity: the `agy` CLI is a fork of the IDE
71
71
  // adapter with its own runtime markers (the universal hook command tags the
@@ -73,73 +73,73 @@ var ADAPTER_REGISTRY = [
73
73
  // before the IDE/parent during host detection.
74
74
  {
75
75
  id: "antigravity-cli",
76
- load: () => import("./antigravity-cli-YQDFVV4U.js").then((m) => m.default)
76
+ load: () => import("./antigravity-cli-JEOUP2VN.js").then((m) => m.default)
77
77
  },
78
78
  {
79
79
  id: "antigravity",
80
- load: () => import("./antigravity-CX2YLSY7.js").then((m) => m.default)
80
+ load: () => import("./antigravity-7IBYFO6P.js").then((m) => m.default)
81
81
  },
82
82
  {
83
83
  id: "zed",
84
- load: () => import("./zed-VRJKWYUR.js").then((m) => m.default)
84
+ load: () => import("./zed-NTCYW4V2.js").then((m) => m.default)
85
85
  },
86
86
  {
87
87
  id: "amp",
88
- load: () => import("./amp-QSFH2V7Y.js").then((m) => m.default)
88
+ load: () => import("./amp-YGV66GJT.js").then((m) => m.default)
89
89
  },
90
90
  {
91
91
  id: "codebuff",
92
- load: () => import("./codebuff-QX57FJDN.js").then((m) => m.default)
92
+ load: () => import("./codebuff-LE3KBZGM.js").then((m) => m.default)
93
93
  },
94
94
  {
95
95
  id: "mux",
96
- load: () => import("./mux-T2TV4CIQ.js").then((m) => m.default)
96
+ load: () => import("./mux-5CI5FP2W.js").then((m) => m.default)
97
97
  },
98
98
  // Pi — mcp-only host with no writable MCP config; drives the Agent Skills
99
99
  // surface only (writes <piDir>/skills/<name>/SKILL.md).
100
100
  {
101
101
  id: "pi",
102
- load: () => import("./pi-CIU2QHT4.js").then((m) => m.default)
102
+ load: () => import("./pi-WMTUX6ES.js").then((m) => m.default)
103
103
  },
104
104
  // Wave 2 — json-stdio adapters (full hook dispatch via the universal entrypoint).
105
105
  // jetbrains-copilot before vscode-copilot is unnecessary (distinct hosts); grouped here.
106
106
  {
107
107
  id: "jetbrains-copilot",
108
- load: () => import("./jetbrains-copilot-HWA3DMH7.js").then((m) => m.default)
108
+ load: () => import("./jetbrains-copilot-C3HDGGML.js").then((m) => m.default)
109
109
  },
110
110
  {
111
111
  id: "qwen-code",
112
- load: () => import("./qwen-code-5POCNU6P.js").then((m) => m.default)
112
+ load: () => import("./qwen-code-MRRIUQ3P.js").then((m) => m.default)
113
113
  },
114
114
  {
115
115
  id: "kiro",
116
- load: () => import("./kiro-VQTT6LO2.js").then((m) => m.default)
116
+ load: () => import("./kiro-UQRY6EIO.js").then((m) => m.default)
117
117
  },
118
118
  {
119
119
  id: "kimi",
120
- load: () => import("./kimi-GQ7VXNYT.js").then((m) => m.default)
120
+ load: () => import("./kimi-EVD7YKXS.js").then((m) => m.default)
121
121
  },
122
122
  {
123
123
  id: "crush",
124
- load: () => import("./crush-I7PK3FGI.js").then((m) => m.default)
124
+ load: () => import("./crush-X3E25EQG.js").then((m) => m.default)
125
125
  },
126
126
  // Wave 3 — json-stdio adapters with YAML config (MCP in YAML; hooks per host).
127
127
  {
128
128
  id: "goose",
129
- load: () => import("./goose-ZTGTSUFJ.js").then((m) => m.default)
129
+ load: () => import("./goose-M3RR3CZG.js").then((m) => m.default)
130
130
  },
131
131
  {
132
132
  id: "hermes",
133
- load: () => import("./hermes-H2KV44GK.js").then((m) => m.default)
133
+ load: () => import("./hermes-CUNKIAR5.js").then((m) => m.default)
134
134
  },
135
135
  // Wave 4 — ts-plugin adapters (generate a bridge module to the universal entrypoint).
136
136
  {
137
137
  id: "omp",
138
- load: () => import("./omp-PB4VDKS6.js").then((m) => m.default)
138
+ load: () => import("./omp-AXA7XY22.js").then((m) => m.default)
139
139
  },
140
140
  {
141
141
  id: "openclaw",
142
- load: () => import("./openclaw-ETN2M63O.js").then((m) => m.default)
142
+ load: () => import("./openclaw-UZ5BMCGQ.js").then((m) => m.default)
143
143
  }
144
144
  ];
145
145
  var REGISTRY_BY_ID = new Map(
@@ -235,4 +235,4 @@ export {
235
235
  detectInstalledPlatforms,
236
236
  detectRuntimeHost
237
237
  };
238
- //# sourceMappingURL=chunk-XUCWLJY5.js.map
238
+ //# sourceMappingURL=chunk-NJU275US.js.map
@@ -1,19 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- resolveSpawnCommand
4
- } from "./chunk-MEH7GC7R.js";
5
-
6
- // src/core/spawn-child.ts
7
- import { spawn } from "child_process";
8
- function winQuoteArg(s) {
9
- return `"${s.replace(/"/g, '""')}"`;
10
- }
11
- function spawnChild(command, args, options) {
12
- const resolved = resolveSpawnCommand(command);
13
- if (!resolved.needsShell) return spawn(resolved.file, args, options);
14
- const line = [resolved.file, ...args].map(winQuoteArg).join(" ");
15
- return spawn(line, { ...options, shell: true });
16
- }
17
2
 
18
3
  // src/telemetry/jsonrpc.ts
19
4
  import { StringDecoder } from "string_decoder";
@@ -51,9 +36,8 @@ var LineBuffer = class {
51
36
  };
52
37
 
53
38
  export {
54
- spawnChild,
55
39
  isObject,
56
40
  idKey,
57
41
  LineBuffer
58
42
  };
59
- //# sourceMappingURL=chunk-WCETQWWK.js.map
43
+ //# sourceMappingURL=chunk-OP4KBXUO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/telemetry/jsonrpc.ts"],"sourcesContent":["/**\n * telemetry/jsonrpc — shared MCP stdio wire primitives.\n *\n * The MCP stdio transport is NEWLINE-DELIMITED JSON-RPC: one single-line JSON\n * object per message, terminated by `\\n` (no Content-Length framing). These\n * primitives — the message shape, the id key, the line buffer — are used by BOTH\n * the telemetry proxy (which tees + measures) and `doctor --probe` (which sends\n * a real initialize/ping/tools-list handshake), so framing + id-correlation are\n * byte-identical across the two paths. Extracted here rather than duplicated.\n */\n\nimport { StringDecoder } from \"node:string_decoder\";\n\n/** Any newline-delimited JSON-RPC message — request, response, or notification. */\nexport interface JsonRpcMessage {\n jsonrpc?: unknown;\n id?: unknown;\n method?: unknown;\n params?: unknown;\n result?: unknown;\n error?: unknown;\n}\n\nexport function isObject(v: unknown): v is Record<string, unknown> {\n return typeof v === \"object\" && v !== null;\n}\n\n/** JSON-RPC ids are number | string; normalize to a Map key. `null` → no key. */\nexport function idKey(id: unknown): string | null {\n if (typeof id === \"string\") return `s:${id}`;\n if (typeof id === \"number\") return `n:${id}`;\n return null;\n}\n\n/**\n * Buffer a byte stream into complete `\\n`-terminated lines and invoke `onLine`\n * for each. Carriage returns are tolerated (some hosts emit CRLF). This is a\n * pure side-channel: it never owns or mutates the bytes being forwarded — the\n * caller has already written the original chunk downstream verbatim.\n */\nexport class LineBuffer {\n private buf = \"\";\n private readonly onLine: (line: string) => void;\n // Incremental UTF-8 decoder: `data` events split on arbitrary byte\n // boundaries, so a multi-byte sequence (emoji/CJK in a tool arg or result)\n // can straddle two chunks. StringDecoder holds back a trailing partial\n // sequence until it completes, keeping the measured copy byte-accurate.\n // (The forwarded stream is untouched — this is only the tee copy.)\n private readonly decoder = new StringDecoder(\"utf8\");\n\n constructor(onLine: (line: string) => void) {\n this.onLine = onLine;\n }\n\n push(chunk: Buffer): void {\n this.buf += this.decoder.write(chunk);\n let nl = this.buf.indexOf(\"\\n\");\n while (nl !== -1) {\n // Slice off one line (without the newline), tolerate a trailing CR.\n let line = this.buf.slice(0, nl);\n if (line.endsWith(\"\\r\")) line = line.slice(0, -1);\n if (line.length > 0) this.onLine(line);\n this.buf = this.buf.slice(nl + 1);\n nl = this.buf.indexOf(\"\\n\");\n }\n }\n}\n"],"mappings":";;;AAWA,SAAS,qBAAqB;AAYvB,SAAS,SAAS,GAA0C;AACjE,SAAO,OAAO,MAAM,YAAY,MAAM;AACxC;AAGO,SAAS,MAAM,IAA4B;AAChD,MAAI,OAAO,OAAO,SAAU,QAAO,KAAK,EAAE;AAC1C,MAAI,OAAO,OAAO,SAAU,QAAO,KAAK,EAAE;AAC1C,SAAO;AACT;AAQO,IAAM,aAAN,MAAiB;AAAA,EACd,MAAM;AAAA,EACG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,UAAU,IAAI,cAAc,MAAM;AAAA,EAEnD,YAAY,QAAgC;AAC1C,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,KAAK,OAAqB;AACxB,SAAK,OAAO,KAAK,QAAQ,MAAM,KAAK;AACpC,QAAI,KAAK,KAAK,IAAI,QAAQ,IAAI;AAC9B,WAAO,OAAO,IAAI;AAEhB,UAAI,OAAO,KAAK,IAAI,MAAM,GAAG,EAAE;AAC/B,UAAI,KAAK,SAAS,IAAI,EAAG,QAAO,KAAK,MAAM,GAAG,EAAE;AAChD,UAAI,KAAK,SAAS,EAAG,MAAK,OAAO,IAAI;AACrC,WAAK,MAAM,KAAK,IAAI,MAAM,KAAK,CAAC;AAChC,WAAK,KAAK,IAAI,QAAQ,IAAI;AAAA,IAC5B;AAAA,EACF;AACF;","names":[]}
@@ -2,6 +2,15 @@
2
2
  import {
3
3
  renderFrontmatterMd
4
4
  } from "./chunk-7L6ITC4T.js";
5
+ import {
6
+ MEMORY_CONTENT_SOFT_BUDGET_BYTES,
7
+ listManagedBlocks,
8
+ loadMemoryLedger,
9
+ recordMemoryTarget,
10
+ removeManagedBlocksFile,
11
+ saveMemoryLedger,
12
+ upsertManagedBlockFile
13
+ } from "./chunk-N6HH7K6P.js";
5
14
  import {
6
15
  backupsDir,
7
16
  ensureDir
@@ -100,7 +109,48 @@ import {
100
109
  statSync,
101
110
  writeFileSync
102
111
  } from "fs";
103
- import { basename, dirname, join, relative, resolve, sep } from "path";
112
+ import { homedir } from "os";
113
+ import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "path";
114
+ var AGENTS_MD_USER_PATHS = {
115
+ // codex resolves its own user path in-adapter ($CODEX_HOME with ~ expansion
116
+ // + the AGENTS.override.md shadow probe) — deliberately no row here.
117
+ zed: () => ({
118
+ path: process.platform === "win32" && process.env.APPDATA ? join(process.env.APPDATA, "Zed", "AGENTS.md") : join(homedir(), ".config", "zed", "AGENTS.md"),
119
+ reason: "zed personal instructions file"
120
+ }),
121
+ amp: () => ({
122
+ path: join(homedir(), ".config", "amp", "AGENTS.md"),
123
+ reason: "amp user-scope AGENTS.md"
124
+ }),
125
+ mux: () => ({
126
+ path: join(homedir(), ".mux", "AGENTS.md"),
127
+ reason: "mux global AGENTS.md"
128
+ }),
129
+ pi: () => ({
130
+ path: join(homedir(), ".pi", "agent", "AGENTS.md"),
131
+ reason: "pi global AGENTS.md"
132
+ }),
133
+ droid: () => ({
134
+ path: join(homedir(), ".factory", "AGENTS.md"),
135
+ reason: "droid (Factory) personal AGENTS.md"
136
+ }),
137
+ opencode: () => ({
138
+ path: join(homedir(), ".config", "opencode", "AGENTS.md"),
139
+ reason: "opencode global AGENTS.md"
140
+ }),
141
+ antigravity: () => ({
142
+ path: join(homedir(), ".gemini", "AGENTS.md"),
143
+ reason: "antigravity global rules (~/.gemini/AGENTS.md, shared tree)"
144
+ }),
145
+ "antigravity-cli": () => ({
146
+ path: join(homedir(), ".gemini", "AGENTS.md"),
147
+ reason: "agy shares the IDE's ~/.gemini tree (idempotent upsert dedupes)"
148
+ }),
149
+ omp: () => ({
150
+ path: join(homedir(), ".omp", "agent", "AGENTS.md"),
151
+ reason: "omp global AGENTS.md (pi-parity; verify for your version)"
152
+ })
153
+ };
104
154
  var BaseAdapter = class {
105
155
  // ── Content surfaces (commands / skills / subagents) ─────────────────────
106
156
  // CONCRETE (overridable) defaults so every adapter inherits all six methods
@@ -126,6 +176,295 @@ var BaseAdapter = class {
126
176
  uninstallSubagents(ctx) {
127
177
  return this.unsupportedSurface(ctx, "subagents", ctx.connector.subagents.length);
128
178
  }
179
+ // ── Memory surface (managed marker blocks; AGENTS.md-first) ───────────────
180
+ // ONE generic implementation for every supporting host: the per-adapter
181
+ // `memoryTargets()` hook resolves WHERE to write (AGENTS.md defaults below;
182
+ // claude-code → CLAUDE.md and gemini-cli → GEMINI.md override it), and the
183
+ // core/managed-block engine performs the surgical, hash-stamped block edit.
184
+ // Unlike commands/skills/subagents these files are SHARED and user-authored —
185
+ // bytes outside this connector's own marker pair are never touched.
186
+ /**
187
+ * Resolve the memory/rules file(s) this host actually reads at ctx.scope.
188
+ * Base default (AGENTS.md-first, owner mandate):
189
+ * - an explicit `platforms[<id>].memory.path` override wins;
190
+ * - project scope → `<projectDir>/AGENTS.md` (the agents.md standard);
191
+ * - user scope → the host's documented user-scope AGENTS.md, when one
192
+ * exists ({@link AGENTS_MD_USER_PATHS}); otherwise [] → skip-warn.
193
+ * Exception hosts (claude-code, gemini-cli) override this hook.
194
+ */
195
+ memoryTargets(ctx) {
196
+ const override = this.memoryOverride(ctx);
197
+ if (override?.path) {
198
+ const base = ctx.scope === "project" ? ctx.projectDir : homedir();
199
+ return [
200
+ {
201
+ path: isAbsolute(override.path) ? override.path : join(base, override.path),
202
+ reason: `platforms.${this.id}.memory.path override`
203
+ }
204
+ ];
205
+ }
206
+ if (ctx.scope === "project") {
207
+ return [
208
+ { path: join(ctx.projectDir, "AGENTS.md"), reason: "AGENTS.md standard (project root)" }
209
+ ];
210
+ }
211
+ if (ctx.scope === "user") {
212
+ const user = AGENTS_MD_USER_PATHS[this.id]?.();
213
+ return user ? [user] : [];
214
+ }
215
+ return [];
216
+ }
217
+ /** The per-platform memory override object, when one is declared. */
218
+ memoryOverride(ctx) {
219
+ const o = ctx.connector.platforms[this.id]?.memory;
220
+ return o && typeof o === "object" ? o : void 0;
221
+ }
222
+ installMemory(ctx) {
223
+ const { connector } = ctx;
224
+ const entries = connector.memory ?? [];
225
+ if (connector.platforms[this.id]?.memory === false) {
226
+ return [{ platform: this.id, action: "skip", detail: `memory disabled for ${this.id}` }];
227
+ }
228
+ if (entries.length === 0) {
229
+ return [{ platform: this.id, action: "skip", detail: "connector declares no memory" }];
230
+ }
231
+ if (!(this.capabilities.supportsMemory ?? false)) {
232
+ return this.unsupportedSurface(ctx, "memory", entries.length);
233
+ }
234
+ const changes = [];
235
+ const override = this.memoryOverride(ctx);
236
+ if (override?.mode && this.id !== "claude-code") {
237
+ changes.push({
238
+ platform: this.id,
239
+ action: "warn",
240
+ detail: `memory.mode is claude-code-only; ignored on ${this.id}`
241
+ });
242
+ }
243
+ if (ctx.scope !== "project" && ctx.scope !== "user") {
244
+ changes.push({
245
+ platform: this.id,
246
+ action: "warn",
247
+ detail: `memory not supported at ${ctx.scope} scope on ${this.id} (managed/admin memory files are out of scope); ${entries.length} skipped`
248
+ });
249
+ return changes;
250
+ }
251
+ const targets = this.memoryTargets(ctx);
252
+ if (targets.length === 0) {
253
+ changes.push({
254
+ platform: this.id,
255
+ action: "warn",
256
+ detail: `no ${ctx.scope}-scope memory file on ${this.id} (user rules are app/UI-managed or undocumented); ${entries.length} skipped`
257
+ });
258
+ return changes;
259
+ }
260
+ changes.push(...this.writeMemoryBlocks(ctx, targets));
261
+ return changes;
262
+ }
263
+ /**
264
+ * Upsert every declared memory entry's block into every resolved target and
265
+ * record the ownership ledger rows (`connectorDir(id)/memory-state.json`).
266
+ * Shared by the base implementation and the exception-host overrides.
267
+ */
268
+ writeMemoryBlocks(ctx, targets) {
269
+ const changes = [];
270
+ const ledger = loadMemoryLedger(ctx.connector.id);
271
+ let ledgerMutated = false;
272
+ for (const target of targets) {
273
+ for (const entry of ctx.connector.memory ?? []) {
274
+ const blockId = `${ctx.connector.id}/${entry.name ?? "memory"}`;
275
+ const res = upsertManagedBlockFile(target.path, {
276
+ blockId,
277
+ connectorId: ctx.connector.id,
278
+ content: entry.content,
279
+ ...target.commentStyle ? { commentStyle: target.commentStyle } : {},
280
+ force: ctx.force ?? false,
281
+ dryRun: ctx.dryRun
282
+ });
283
+ changes.push({
284
+ platform: this.id,
285
+ action: res.action,
286
+ path: target.path,
287
+ detail: `memory: ${res.detail} \u2014 ${target.reason}`
288
+ });
289
+ if (res.backupPath) {
290
+ changes.push({
291
+ platform: this.id,
292
+ action: "create",
293
+ path: res.backupPath,
294
+ detail: "backed up memory file before destructive change"
295
+ });
296
+ }
297
+ const bytes = Buffer.byteLength(entry.content, "utf8");
298
+ if (bytes > MEMORY_CONTENT_SOFT_BUDGET_BYTES) {
299
+ changes.push({
300
+ platform: this.id,
301
+ action: "warn",
302
+ path: target.path,
303
+ detail: `memory entry "${entry.name ?? "memory"}" is ${bytes} bytes (soft budget ${MEMORY_CONTENT_SOFT_BUDGET_BYTES}); this file is injected into every prompt \u2014 keep guidance terse`
304
+ });
305
+ }
306
+ if (res.action !== "warn") {
307
+ recordMemoryTarget(ledger, {
308
+ platform: this.id,
309
+ scope: ctx.scope,
310
+ path: target.path,
311
+ blockId,
312
+ createdFile: res.createdFile,
313
+ hash: res.hash
314
+ });
315
+ ledgerMutated = true;
316
+ }
317
+ }
318
+ if (target.budgetBytes !== void 0 && !ctx.dryRun && existsSync(target.path)) {
319
+ const fileBytes = statSync(target.path).size;
320
+ if (fileBytes > target.budgetBytes) {
321
+ changes.push({
322
+ platform: this.id,
323
+ action: "warn",
324
+ path: target.path,
325
+ detail: `memory file is ${fileBytes} bytes \u2014 over this host's ~${target.budgetBytes}-byte budget; the host may truncate or drop it`
326
+ });
327
+ }
328
+ }
329
+ }
330
+ if (ledgerMutated && !ctx.dryRun) saveMemoryLedger(ctx.connector.id, ledger);
331
+ return changes;
332
+ }
333
+ uninstallMemory(ctx) {
334
+ const { connector } = ctx;
335
+ if (!(this.capabilities.supportsMemory ?? false)) {
336
+ return this.unsupportedSurface(ctx, "memory", (connector.memory ?? []).length);
337
+ }
338
+ const ledger = loadMemoryLedger(connector.id);
339
+ const mine = ledger.targets.filter((t) => t.platform === this.id);
340
+ const candidates = /* @__PURE__ */ new Map();
341
+ if (ctx.scope === "project" || ctx.scope === "user") {
342
+ for (const t of this.memoryTargets(ctx)) {
343
+ candidates.set(t.path, { createdFile: false });
344
+ }
345
+ }
346
+ for (const row of mine) {
347
+ const existing = candidates.get(row.path);
348
+ candidates.set(row.path, { createdFile: (existing?.createdFile ?? false) || row.createdFile });
349
+ }
350
+ if (candidates.size === 0) {
351
+ return [
352
+ { platform: this.id, action: "skip", detail: `no memory targets to clean on ${this.id}` }
353
+ ];
354
+ }
355
+ const changes = [];
356
+ for (const [path, { createdFile }] of candidates) {
357
+ const results = removeManagedBlocksFile(
358
+ path,
359
+ { blockIdPrefix: `${connector.id}/` },
360
+ { dryRun: ctx.dryRun, deleteFileIfCreated: createdFile }
361
+ );
362
+ for (const r of results) {
363
+ changes.push({
364
+ platform: this.id,
365
+ action: r.action,
366
+ path: r.path,
367
+ detail: `memory: ${r.detail}`
368
+ });
369
+ if (r.backupPath) {
370
+ changes.push({
371
+ platform: this.id,
372
+ action: "create",
373
+ path: r.backupPath,
374
+ detail: "backed up memory file before block removal"
375
+ });
376
+ }
377
+ }
378
+ }
379
+ if (!ctx.dryRun && mine.length > 0) {
380
+ ledger.targets = ledger.targets.filter((t) => t.platform !== this.id);
381
+ saveMemoryLedger(connector.id, ledger);
382
+ }
383
+ return changes;
384
+ }
385
+ /**
386
+ * Doctor: per-ledger-row memory state for this platform — file present,
387
+ * block present, and recorded-vs-actual inner hash (drift → warn, the
388
+ * user edited inside our block; sync reports the same drift and never
389
+ * clobbers it without --force).
390
+ */
391
+ memoryDiagnostics(ctx) {
392
+ const results = [];
393
+ const rows = loadMemoryLedger(ctx.connector.id).targets.filter(
394
+ (t) => t.platform === this.id
395
+ );
396
+ for (const row of rows) {
397
+ const check = `${this.name}: memory block ${row.blockId}`;
398
+ if (!existsSync(row.path)) {
399
+ results.push({
400
+ check,
401
+ status: "warn",
402
+ message: `memory file missing: ${row.path}`,
403
+ fix: "agent-connector install (sync) will re-create the block"
404
+ });
405
+ continue;
406
+ }
407
+ let raw;
408
+ try {
409
+ raw = readFileSync(row.path, "utf8");
410
+ } catch {
411
+ results.push({ check, status: "warn", message: `cannot read ${row.path}` });
412
+ continue;
413
+ }
414
+ const block = listManagedBlocks(raw).find((b) => b.blockId === row.blockId);
415
+ if (!block) {
416
+ results.push({
417
+ check,
418
+ status: "warn",
419
+ message: `managed block not found in ${row.path}`,
420
+ fix: "agent-connector install (sync) will re-append it"
421
+ });
422
+ } else if (block.drifted) {
423
+ results.push({
424
+ check,
425
+ status: "warn",
426
+ message: `user-edited: inner content hash ${block.actualHash} differs from recorded ${block.recordedHash} in ${row.path}; sync leaves it intact (use --force to overwrite)`
427
+ });
428
+ } else {
429
+ results.push({ check, status: "pass", message: `intact in ${row.path}` });
430
+ }
431
+ if (!row.blockId.startsWith("_shared/") && row.scope === ctx.scope && (ctx.scope === "project" || ctx.scope === "user")) {
432
+ const current = this.memoryTargets(ctx);
433
+ if (current.length > 0 && !current.some((t) => t.path === row.path)) {
434
+ results.push({
435
+ check,
436
+ status: "warn",
437
+ message: `${this.id} now resolves its ${row.scope}-scope memory file to ${current[0].path} (${current[0].reason}) \u2014 the block in ${row.path} may no longer be read`,
438
+ fix: "agent-connector install (sync) re-probes and writes the file the host reads now"
439
+ });
440
+ }
441
+ }
442
+ }
443
+ return results;
444
+ }
445
+ // ── Declarative host-config key patches (configPatch) ─────────────────────
446
+ // CONCRETE (overridable) defaults, mirroring the content surfaces above: the
447
+ // installer additionally guards these behind capabilities.supportsConfigPatch
448
+ // (the nativeHooks precedent), so these defaults only fire if a capability-
449
+ // flagged adapter forgot to override them — still skip-warn, never silent.
450
+ installConfigPatches(ctx) {
451
+ const count = (ctx.connector.platforms[this.id]?.configPatch ?? []).length;
452
+ if (count === 0) {
453
+ return [
454
+ { platform: this.id, action: "skip", detail: "connector declares no configPatch entries" }
455
+ ];
456
+ }
457
+ return [
458
+ {
459
+ platform: this.id,
460
+ action: "warn",
461
+ detail: `configPatch not supported on ${this.id}; ${count} skipped`
462
+ }
463
+ ];
464
+ }
465
+ uninstallConfigPatches(_ctx) {
466
+ return [];
467
+ }
129
468
  /**
130
469
  * Default response for a content surface this platform cannot honor: a single
131
470
  * skip when the connector declares none of that surface, else a single "warn"
@@ -409,6 +748,7 @@ var BaseAdapter = class {
409
748
  message: r.detail ?? r.status
410
749
  });
411
750
  }
751
+ results.push(...this.memoryDiagnostics(ctx));
412
752
  return results;
413
753
  }
414
754
  };
@@ -417,4 +757,4 @@ export {
417
757
  parseJsonc,
418
758
  BaseAdapter
419
759
  };
420
- //# sourceMappingURL=chunk-TIIP3RG2.js.map
760
+ //# sourceMappingURL=chunk-PD4VFEBY.js.map