@ken-jo/agent-connector 0.4.67 → 0.4.75

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 (160) hide show
  1. package/README.md +43 -6
  2. package/dist/{action-RUM6GP23.js → action-TCKBTTZX.js} +8 -8
  3. package/dist/{amazon-q-KXVJFT7Q.js → amazon-q-CB4XFX7T.js} +3 -3
  4. package/dist/{amp-WAPHJYTK.js → amp-6Q5OYHNW.js} +7 -3
  5. package/dist/amp-6Q5OYHNW.js.map +1 -0
  6. package/dist/{antigravity-GF3RU42A.js → antigravity-WIK3XBN5.js} +4 -4
  7. package/dist/{antigravity-cli-OH27IFH5.js → antigravity-cli-L3RZMF6V.js} +4 -4
  8. package/dist/{chunk-E45SUUD7.js → chunk-24K6JOKV.js} +3 -3
  9. package/dist/{chunk-IZ4XQ23W.js → chunk-2L6LTQ6L.js} +41 -6
  10. package/dist/chunk-2L6LTQ6L.js.map +1 -0
  11. package/dist/{chunk-RQCBBLTA.js → chunk-5LAFKXFM.js} +2 -2
  12. package/dist/{chunk-UVBAH263.js → chunk-7ITLLYWB.js} +2 -2
  13. package/dist/{chunk-DBQMX75U.js → chunk-BEFVJ2OE.js} +28 -2
  14. package/dist/chunk-BEFVJ2OE.js.map +1 -0
  15. package/dist/{chunk-ZSMGHEB5.js → chunk-DI6OWKH2.js} +7 -3
  16. package/dist/chunk-DI6OWKH2.js.map +1 -0
  17. package/dist/chunk-ECSRTK4M.js +386 -0
  18. package/dist/chunk-ECSRTK4M.js.map +1 -0
  19. package/dist/{chunk-F5COBB5F.js → chunk-FUXUEXDP.js} +3 -3
  20. package/dist/{chunk-NXR4HM5N.js → chunk-HKM3HUOK.js} +19 -19
  21. package/dist/{chunk-NXR4HM5N.js.map → chunk-HKM3HUOK.js.map} +1 -1
  22. package/dist/{chunk-P5KA5NVR.js → chunk-MDZG5QHB.js} +49 -3
  23. package/dist/chunk-MDZG5QHB.js.map +1 -0
  24. package/dist/{chunk-CSRBMJLU.js → chunk-MHDQWZ4A.js} +5 -5
  25. package/dist/{chunk-RHML2NOB.js → chunk-NUGMVVV2.js} +2 -2
  26. package/dist/chunk-NUGMVVV2.js.map +1 -0
  27. package/dist/{chunk-ZEFUDBTY.js → chunk-OEQJGBBW.js} +4 -4
  28. package/dist/{chunk-3Y23ZYYF.js → chunk-Q42SEI7W.js} +3 -3
  29. package/dist/{chunk-LS65GL2P.js → chunk-Q5LECKZL.js} +36 -36
  30. package/dist/{chunk-GCRRX4MO.js → chunk-TW4DVR4V.js} +2 -2
  31. package/dist/{claude-code-WLN43K7I.js → claude-code-HFBAAVWS.js} +10 -6
  32. package/dist/claude-code-HFBAAVWS.js.map +1 -0
  33. package/dist/cli/sdk.js +4 -4
  34. package/dist/cli.js +1 -1
  35. package/dist/{cline-PEGTGVQD.js → cline-26W4FEZ6.js} +3 -3
  36. package/dist/{codebuff-UG6LVSOM.js → codebuff-J5KEEBIL.js} +7 -3
  37. package/dist/codebuff-J5KEEBIL.js.map +1 -0
  38. package/dist/{codex-4LVDQXCD.js → codex-JKQ6TLRI.js} +16 -23
  39. package/dist/codex-JKQ6TLRI.js.map +1 -0
  40. package/dist/{continue-DYV5V55Y.js → continue-KQSJUSWX.js} +3 -3
  41. package/dist/{copilot-cli-NVFXFLUF.js → copilot-cli-YBNKLYUB.js} +65 -22
  42. package/dist/copilot-cli-YBNKLYUB.js.map +1 -0
  43. package/dist/{crush-PP4HYZLT.js → crush-JTWTZIPB.js} +20 -10
  44. package/dist/crush-JTWTZIPB.js.map +1 -0
  45. package/dist/{cursor-XMXOZKAP.js → cursor-2NIZSDZ4.js} +4 -4
  46. package/dist/{detect-IZOWP5AA.js → detect-CWEIQCRC.js} +4 -4
  47. package/dist/{doctor-5IVUQ2YH.js → doctor-AC437ZAW.js} +95 -13
  48. package/dist/doctor-AC437ZAW.js.map +1 -0
  49. package/dist/{droid-ETNOUIPJ.js → droid-HF2AIFB2.js} +3 -3
  50. package/dist/{gemini-cli-P7XJXWVH.js → gemini-cli-2EOK26S2.js} +3 -3
  51. package/dist/{goose-UZVA6MQC.js → goose-55JOTXS5.js} +3 -3
  52. package/dist/{hermes-IC6R4CII.js → hermes-QVZOZU4B.js} +3 -3
  53. package/dist/{hook-7IUPIHCZ.js → hook-VYD3OCLM.js} +8 -8
  54. package/dist/index.d.ts +2 -2
  55. package/dist/index.js +2 -2
  56. package/dist/{install-EP6GPQ65.js → install-S6BYIJ62.js} +11 -11
  57. package/dist/{introspect-BFcXpfUp.d.ts → introspect-5o5ick0_.d.ts} +9 -4
  58. package/dist/{jetbrains-copilot-MZO2RQGJ.js → jetbrains-copilot-DZ2ATXFN.js} +2 -2
  59. package/dist/{kilo-CCB34CQQ.js → kilo-GJNSBWVV.js} +3 -3
  60. package/dist/{kilo-cli-EOMN3WC7.js → kilo-cli-2CCB3DBI.js} +3 -3
  61. package/dist/{kimi-GUSJME55.js → kimi-YRPCSB6N.js} +3 -3
  62. package/dist/{kiro-6OHZ5RGV.js → kiro-BUOQFASX.js} +3 -3
  63. package/dist/{leaderboard-6I2E5XZK.js → leaderboard-SUSUDKHR.js} +2 -2
  64. package/dist/{mimo-code-ZPJJ6IIW.js → mimo-code-V4FP5PUJ.js} +3 -3
  65. package/dist/{mux-AFTVMGGM.js → mux-CMJSM42O.js} +3 -3
  66. package/dist/{nemoclaw-D5EN4G2Q.js → nemoclaw-VP56PGKC.js} +4 -4
  67. package/dist/{omp-GKI2PZ7G.js → omp-OOFGD3GG.js} +3 -3
  68. package/dist/{openclaw-A76PCNBV.js → openclaw-V73XHPXP.js} +4 -4
  69. package/dist/{opencode-M34E6PI7.js → opencode-MKLHSQRD.js} +3 -3
  70. package/dist/{package-BWLV24OO.js → package-KOAAVKHH.js} +9 -9
  71. package/dist/{pi-HVG6ZWFE.js → pi-NMVL7OFL.js} +2 -2
  72. package/dist/{qwen-code-OWLM3I5P.js → qwen-code-2XE2T6F4.js} +3 -3
  73. package/dist/{roo-code-RFKKTNNI.js → roo-code-YJOIKCCS.js} +3 -3
  74. package/dist/runtime/index.d.ts +1 -1
  75. package/dist/runtime/index.js +6 -6
  76. package/dist/sdk/index.d.ts +3 -3
  77. package/dist/sdk/index.js +3 -3
  78. package/dist/sdk/test.d.ts +33 -3
  79. package/dist/sdk/test.js +10 -280
  80. package/dist/sdk/test.js.map +1 -1
  81. package/dist/{serve-CM4HZPMP.js → serve-BU23QUSJ.js} +8 -8
  82. package/dist/{status-BPB4VLQX.js → status-N5LCQQ3R.js} +6 -6
  83. package/dist/{statusline-HIKR2I4Q.js → statusline-442XOF7R.js} +7 -7
  84. package/dist/{telemetry-SBVUJYNE.js → telemetry-V4YQL2NU.js} +5 -5
  85. package/dist/{trae-FVHQALK3.js → trae-QSV2JZFT.js} +3 -3
  86. package/dist/{types-ChUrvw0j.d.ts → types-D6RWGXm1.d.ts} +13 -0
  87. package/dist/{uninstall-MO3RGGVE.js → uninstall-WGEKTCDZ.js} +11 -11
  88. package/dist/{upgrade-6XIGSPGY.js → upgrade-IH7CKPTO.js} +11 -11
  89. package/dist/{usage-IBN36ZVW.js → usage-DI7XRCKM.js} +2 -2
  90. package/dist/{usage-event-4RJP37K6.js → usage-event-2FCU55AN.js} +7 -7
  91. package/dist/{vscode-copilot-6FLDRTKV.js → vscode-copilot-R23RTVST.js} +7 -3
  92. package/dist/vscode-copilot-R23RTVST.js.map +1 -0
  93. package/dist/{warp-7CC52UJV.js → warp-B72XSQ5G.js} +3 -3
  94. package/dist/{windsurf-6ZLQMBQW.js → windsurf-642VBMQ2.js} +3 -3
  95. package/dist/{zed-FULJMNBV.js → zed-6UJS7JKB.js} +3 -3
  96. package/package.json +1 -1
  97. package/dist/amp-WAPHJYTK.js.map +0 -1
  98. package/dist/chunk-DBQMX75U.js.map +0 -1
  99. package/dist/chunk-IZ4XQ23W.js.map +0 -1
  100. package/dist/chunk-P5KA5NVR.js.map +0 -1
  101. package/dist/chunk-RHML2NOB.js.map +0 -1
  102. package/dist/chunk-ZSMGHEB5.js.map +0 -1
  103. package/dist/claude-code-WLN43K7I.js.map +0 -1
  104. package/dist/codebuff-UG6LVSOM.js.map +0 -1
  105. package/dist/codex-4LVDQXCD.js.map +0 -1
  106. package/dist/copilot-cli-NVFXFLUF.js.map +0 -1
  107. package/dist/crush-PP4HYZLT.js.map +0 -1
  108. package/dist/doctor-5IVUQ2YH.js.map +0 -1
  109. package/dist/vscode-copilot-6FLDRTKV.js.map +0 -1
  110. /package/dist/{action-RUM6GP23.js.map → action-TCKBTTZX.js.map} +0 -0
  111. /package/dist/{amazon-q-KXVJFT7Q.js.map → amazon-q-CB4XFX7T.js.map} +0 -0
  112. /package/dist/{antigravity-GF3RU42A.js.map → antigravity-WIK3XBN5.js.map} +0 -0
  113. /package/dist/{antigravity-cli-OH27IFH5.js.map → antigravity-cli-L3RZMF6V.js.map} +0 -0
  114. /package/dist/{chunk-E45SUUD7.js.map → chunk-24K6JOKV.js.map} +0 -0
  115. /package/dist/{chunk-RQCBBLTA.js.map → chunk-5LAFKXFM.js.map} +0 -0
  116. /package/dist/{chunk-UVBAH263.js.map → chunk-7ITLLYWB.js.map} +0 -0
  117. /package/dist/{chunk-F5COBB5F.js.map → chunk-FUXUEXDP.js.map} +0 -0
  118. /package/dist/{chunk-CSRBMJLU.js.map → chunk-MHDQWZ4A.js.map} +0 -0
  119. /package/dist/{chunk-ZEFUDBTY.js.map → chunk-OEQJGBBW.js.map} +0 -0
  120. /package/dist/{chunk-3Y23ZYYF.js.map → chunk-Q42SEI7W.js.map} +0 -0
  121. /package/dist/{chunk-LS65GL2P.js.map → chunk-Q5LECKZL.js.map} +0 -0
  122. /package/dist/{chunk-GCRRX4MO.js.map → chunk-TW4DVR4V.js.map} +0 -0
  123. /package/dist/{cline-PEGTGVQD.js.map → cline-26W4FEZ6.js.map} +0 -0
  124. /package/dist/{continue-DYV5V55Y.js.map → continue-KQSJUSWX.js.map} +0 -0
  125. /package/dist/{cursor-XMXOZKAP.js.map → cursor-2NIZSDZ4.js.map} +0 -0
  126. /package/dist/{detect-IZOWP5AA.js.map → detect-CWEIQCRC.js.map} +0 -0
  127. /package/dist/{droid-ETNOUIPJ.js.map → droid-HF2AIFB2.js.map} +0 -0
  128. /package/dist/{gemini-cli-P7XJXWVH.js.map → gemini-cli-2EOK26S2.js.map} +0 -0
  129. /package/dist/{goose-UZVA6MQC.js.map → goose-55JOTXS5.js.map} +0 -0
  130. /package/dist/{hermes-IC6R4CII.js.map → hermes-QVZOZU4B.js.map} +0 -0
  131. /package/dist/{hook-7IUPIHCZ.js.map → hook-VYD3OCLM.js.map} +0 -0
  132. /package/dist/{install-EP6GPQ65.js.map → install-S6BYIJ62.js.map} +0 -0
  133. /package/dist/{jetbrains-copilot-MZO2RQGJ.js.map → jetbrains-copilot-DZ2ATXFN.js.map} +0 -0
  134. /package/dist/{kilo-CCB34CQQ.js.map → kilo-GJNSBWVV.js.map} +0 -0
  135. /package/dist/{kilo-cli-EOMN3WC7.js.map → kilo-cli-2CCB3DBI.js.map} +0 -0
  136. /package/dist/{kimi-GUSJME55.js.map → kimi-YRPCSB6N.js.map} +0 -0
  137. /package/dist/{kiro-6OHZ5RGV.js.map → kiro-BUOQFASX.js.map} +0 -0
  138. /package/dist/{leaderboard-6I2E5XZK.js.map → leaderboard-SUSUDKHR.js.map} +0 -0
  139. /package/dist/{mimo-code-ZPJJ6IIW.js.map → mimo-code-V4FP5PUJ.js.map} +0 -0
  140. /package/dist/{mux-AFTVMGGM.js.map → mux-CMJSM42O.js.map} +0 -0
  141. /package/dist/{nemoclaw-D5EN4G2Q.js.map → nemoclaw-VP56PGKC.js.map} +0 -0
  142. /package/dist/{omp-GKI2PZ7G.js.map → omp-OOFGD3GG.js.map} +0 -0
  143. /package/dist/{openclaw-A76PCNBV.js.map → openclaw-V73XHPXP.js.map} +0 -0
  144. /package/dist/{opencode-M34E6PI7.js.map → opencode-MKLHSQRD.js.map} +0 -0
  145. /package/dist/{package-BWLV24OO.js.map → package-KOAAVKHH.js.map} +0 -0
  146. /package/dist/{pi-HVG6ZWFE.js.map → pi-NMVL7OFL.js.map} +0 -0
  147. /package/dist/{qwen-code-OWLM3I5P.js.map → qwen-code-2XE2T6F4.js.map} +0 -0
  148. /package/dist/{roo-code-RFKKTNNI.js.map → roo-code-YJOIKCCS.js.map} +0 -0
  149. /package/dist/{serve-CM4HZPMP.js.map → serve-BU23QUSJ.js.map} +0 -0
  150. /package/dist/{status-BPB4VLQX.js.map → status-N5LCQQ3R.js.map} +0 -0
  151. /package/dist/{statusline-HIKR2I4Q.js.map → statusline-442XOF7R.js.map} +0 -0
  152. /package/dist/{telemetry-SBVUJYNE.js.map → telemetry-V4YQL2NU.js.map} +0 -0
  153. /package/dist/{trae-FVHQALK3.js.map → trae-QSV2JZFT.js.map} +0 -0
  154. /package/dist/{uninstall-MO3RGGVE.js.map → uninstall-WGEKTCDZ.js.map} +0 -0
  155. /package/dist/{upgrade-6XIGSPGY.js.map → upgrade-IH7CKPTO.js.map} +0 -0
  156. /package/dist/{usage-IBN36ZVW.js.map → usage-DI7XRCKM.js.map} +0 -0
  157. /package/dist/{usage-event-4RJP37K6.js.map → usage-event-2FCU55AN.js.map} +0 -0
  158. /package/dist/{warp-7CC52UJV.js.map → warp-B72XSQ5G.js.map} +0 -0
  159. /package/dist/{windsurf-6ZLQMBQW.js.map → windsurf-642VBMQ2.js.map} +0 -0
  160. /package/dist/{zed-FULJMNBV.js.map → zed-6UJS7JKB.js.map} +0 -0
package/README.md CHANGED
@@ -120,6 +120,12 @@ The 0.2.0 additions — the `memory` surface, the `nativeHooks` passthrough, and
120
120
  migrations (context-mode, oh-my-claudecode) and verified in isolated-home
121
121
  installs before landing (see [`CHANGELOG.md`](CHANGELOG.md)).
122
122
 
123
+ **Dogfood result:** the context-mode connector migration — porting a real
124
+ multi-host plugin to `defineConnector` — collapsed **~20,322 lines of
125
+ hand-maintained per-host code down to ~76 lines** (a 99.63% reduction). The
126
+ other hand-maintained surfaces — MCP registration, hook entries, memory files —
127
+ dissolved into the same single config declaration.
128
+
123
129
  Coverage was confirmed by **installing the real, not-yet-present agent CLIs into
124
130
  isolated homes and observing their actual config** — which caught defects a
125
131
  static code/web audit missed. See the reports under
@@ -175,6 +181,14 @@ npx @ken-jo/agent-connector usage export --format csv --out usage.csv
175
181
  > **Audience A** — you write an MCP server + hooks once and deploy them across
176
182
  > every detected host, measuring **your own server's** per-tool tokens.
177
183
 
184
+ **Step 0 — write your MCP server.** agent-connector deploys and wraps an MCP
185
+ server you already have (or are about to write). If you haven't built one yet,
186
+ the [official MCP SDK quickstart](https://modelcontextprotocol.io/quickstart/server)
187
+ is the fastest on-ramp — pick your language, follow the tutorial, and come back
188
+ with a working stdio server binary or script. The
189
+ [`examples/acme-db/acme-db-mcp-server.mjs`](examples/acme-db/acme-db-mcp-server.mjs)
190
+ in this repo is a self-contained ~35-line stub you can copy as a template.
191
+
178
192
  agent-connector is an **SDK you depend on**, not a global tool. Add it to the
179
193
  package that holds your connector, declare the connector once, then **either**
180
194
  ship a branded CLI your users drive directly **or** run it with `npx`. No
@@ -225,7 +239,7 @@ users never install agent-connector globally or type `--connector`. See
225
239
  "name": "acme-db-tools",
226
240
  "type": "module",
227
241
  "bin": { "acme-db": "./bin.mjs" },
228
- "dependencies": { "@ken-jo/agent-connector": "^0.2.0" }
242
+ "dependencies": { "@ken-jo/agent-connector": "^0.4.0" }
229
243
  }
230
244
  ```
231
245
 
@@ -306,7 +320,13 @@ handler / HUD actually work on host X?"* before you touch a real host:
306
320
 
307
321
  - `explain(connector)` → `Promise<ExplainRow[]>` — the per-host × per-declared-surface
308
322
  matrix. Each row is `{ host, surface, support: "native"|"skip-warn"|"disabled", reason }`.
309
- Only surfaces the connector actually declares are included.
323
+ Only surfaces the connector actually declares are included. The `hooks` row is judged
324
+ against **your connector's specific declared events** — a Stop-only connector reports
325
+ `skip-warn` (not `native`) on a host that cannot fire Stop, naming the dead events.
326
+ - `explainHooks(connector, hosts)` → `Promise<HookEventVerdict[]>` — the per-`(host, event)`
327
+ honor matrix (`honored | degraded | dropped` + reason), powered by `simulate()`. This is
328
+ what `agent-connector doctor --explain` prints — the trustworthy per-event diagnostic,
329
+ no hand-enumeration of `(host, event)` pairs.
310
330
  - `simulate(connector, { surface, host, event?, input })` → `Promise<{ honored, hostReply?, reason }>`
311
331
  — runs the **real** adapter parse→handler→format chain offline and judges the
312
332
  actual `(event, decision)` contract. It encodes each host's real honor / drop /
@@ -376,14 +396,18 @@ Same one definition, your choice of distribution:
376
396
  ## Define once
377
397
 
378
398
  ```ts
399
+ import { fileURLToPath } from "node:url";
379
400
  import { defineConnector } from "@ken-jo/agent-connector";
380
401
 
402
+ // Resolve your server to an absolute path — host CLIs spawn it from their own CWD.
403
+ const serverPath = fileURLToPath(new URL("./my-mcp-server.mjs", import.meta.url));
404
+
381
405
  export default defineConnector({
382
406
  id: "acme-db",
383
407
  server: {
384
408
  transport: "stdio",
385
- command: "npx",
386
- args: ["-y", "@acme/db-mcp"],
409
+ command: "node", // or "npx", "python", etc. — whatever starts your server
410
+ args: [serverPath], // replace with your real server entrypoint
387
411
  env: { ACME_DB_DSN: "${env:ACME_DB_DSN}" },
388
412
  },
389
413
  hooks: {
@@ -400,6 +424,19 @@ export default defineConnector({
400
424
  });
401
425
  ```
402
426
 
427
+ > **Secret env-refs (`${env:VAR}`).** Write `"${env:VAR}"` in `command`, `args`,
428
+ > `env`, `url`, or `headers` to reference an environment variable, or
429
+ > `"${env:VAR:-default}"` to supply a fallback. On hosts with **native**
430
+ > interpolation (Claude Code, Cursor, VS Code Copilot, amp, codebuff) the token
431
+ > is written through to the host config and resolved at runtime — the secret is
432
+ > never baked into a file. Every other host has **no** native interpolation, so
433
+ > the value is resolved to a **literal at install time**. An unset variable with
434
+ > no default resolves to an **empty string**; on a literal-resolving host that
435
+ > would silently bake `""` where a secret was meant, so `install` now emits a
436
+ > `warn` for it (e.g. *"ACME_DB_DSN is unset — baking an empty value into codex
437
+ > config"*) — `export` the variable before installing, or give the ref a
438
+ > `:-default`.
439
+
403
440
  > **Native hooks escape hatch.** The normalized `hooks` API covers the 13
404
441
  > cross-platform events. For host-only events — Claude Code alone ships 30
405
442
  > (`TaskCompleted`, `TeammateIdle`, `WorktreeCreate`, …) — declare
@@ -594,7 +631,7 @@ verdict — intentional).
594
631
  | `install [--scope user\|project] [--targets …] [--dry-run] [--force]` | Render + write MCP + hooks + content surfaces (commands / skills / subagents / memory) across targets. `--force` overwrites user-edited memory blocks (after a backup). |
595
632
  | `uninstall [--targets …]` | Full inverse — removes everything we wrote. |
596
633
  | `upgrade [--channel stable\|latest]` | One verb (alias: `update`, `sync`) — re-render host config + heal stale pointers + refresh the home-binary pointer, printing managed-update guidance (never a silent self-update). |
597
- | `doctor [--probe]` | Per-platform health checks with fixes; `--probe` runs a live MCP handshake (initialize → ping → tools/list) against the real server. |
634
+ | `doctor [--probe] [--explain]` | Per-platform health checks with fixes; `--probe` runs a live MCP handshake (initialize → ping → tools/list) against the real server; `--explain` prints the per-`(host, event)` hook honor matrix (`honored` / `degraded` / `dropped` + reason) for the connector's declared events. **Exit code:** `--explain` fails (exit 1) ONLY when an explicitly-targeted host (`--targets` / `targets:[...]`) `degraded`s a declared event — it fires the event but silently won't honor the reply. A `dropped` cell (an mcp-only host that architecturally can't fire hooks) and fleet-wide gaps under `targets:"auto"` are expected and stay informational (exit 0) — the same scope-aware non-failure as plain `doctor`. |
598
635
  | `status` | Light install-state: which connectors are present on which hosts (always exits 0). |
599
636
  | `package [--format <fmt>\|all]` | Emit a host bundle, or an OFFICIAL standard artifact: `mcp-server-json` (registry) · `mcpb` (one-click bundle). |
600
637
  | `telemetry report [--by tool\|session\|project] [--since 7d] [--connector <id>]` | **MCP-developer track.** Per-tool token footprint of **your connector's own wrapped server** (scope with `--connector`). Stdio servers only. |
@@ -604,7 +641,7 @@ verdict — intentional).
604
641
 
605
642
  > `hook` and `serve` also exist — internal entrypoints the written host configs
606
643
  > point at; you never run them by hand. Full flag-level reference: the
607
- > [docs site `/docs/dev/cli`](https://github.com/ken-jo/agent-connector) · `llms-full.txt` §3 (canonical, drift-guarded by tests).
644
+ > [docs site `/docs/dev/cli`](https://agent-connector.ai/docs/dev/cli) · `llms-full.txt` §3 (canonical, drift-guarded by tests).
608
645
 
609
646
  > A **branded CLI** auto-injects `--connector` for you: `<your-tool>
610
647
  > leaderboard` ≈ `agent-connector leaderboard --connector <id>`, and
@@ -1,19 +1,19 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  fail
4
- } from "./chunk-NXR4HM5N.js";
4
+ } from "./chunk-HKM3HUOK.js";
5
5
  import {
6
6
  runAction
7
- } from "./chunk-CSRBMJLU.js";
7
+ } from "./chunk-MHDQWZ4A.js";
8
8
  import "./chunk-OP4KBXUO.js";
9
9
  import "./chunk-7QRUZAUG.js";
10
- import "./chunk-GCRRX4MO.js";
11
- import "./chunk-E45SUUD7.js";
10
+ import "./chunk-TW4DVR4V.js";
11
+ import "./chunk-24K6JOKV.js";
12
12
  import "./chunk-D6ZJS4ND.js";
13
13
  import "./chunk-KHO5WNTP.js";
14
- import "./chunk-RQCBBLTA.js";
15
- import "./chunk-UVBAH263.js";
16
- import "./chunk-LS65GL2P.js";
14
+ import "./chunk-5LAFKXFM.js";
15
+ import "./chunk-7ITLLYWB.js";
16
+ import "./chunk-Q5LECKZL.js";
17
17
  import "./chunk-7CZKXXBD.js";
18
18
  import "./chunk-TO57WYBB.js";
19
19
  import "./chunk-ALVXORZM.js";
@@ -52,4 +52,4 @@ async function run(argv) {
52
52
  export {
53
53
  run
54
54
  };
55
- //# sourceMappingURL=action-RUM6GP23.js.map
55
+ //# sourceMappingURL=action-TCKBTTZX.js.map
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  resolveEnvRefsDeep
4
- } from "./chunk-DBQMX75U.js";
4
+ } from "./chunk-BEFVJ2OE.js";
5
5
  import {
6
6
  BaseAdapter
7
- } from "./chunk-RHML2NOB.js";
7
+ } from "./chunk-NUGMVVV2.js";
8
8
  import {
9
9
  buildWrappedStdio,
10
10
  isHomeBinHookCommand
@@ -563,4 +563,4 @@ export {
563
563
  adapter,
564
564
  amazon_q_default as default
565
565
  };
566
- //# sourceMappingURL=amazon-q-KXVJFT7Q.js.map
566
+ //# sourceMappingURL=amazon-q-CB4XFX7T.js.map
@@ -4,11 +4,11 @@ import {
4
4
  } from "./chunk-FBJQGRET.js";
5
5
  import {
6
6
  rewriteEnvRefs
7
- } from "./chunk-DBQMX75U.js";
7
+ } from "./chunk-BEFVJ2OE.js";
8
8
  import {
9
9
  BaseAdapter,
10
10
  renderSkillMd
11
- } from "./chunk-RHML2NOB.js";
11
+ } from "./chunk-NUGMVVV2.js";
12
12
  import {
13
13
  buildWrappedStdio
14
14
  } from "./chunk-TO57WYBB.js";
@@ -68,6 +68,10 @@ var AmpAdapter = class extends BaseAdapter {
68
68
  canInjectSessionContext: false,
69
69
  // Amp registers stdio and Streamable HTTP MCP servers.
70
70
  transports: ["stdio", "http"],
71
+ // Server env/url use Amp's NATIVE ${env:VAR} interpolation (rewriteEnvRefs)
72
+ // — the token survives into the config, never a baked literal — so the
73
+ // installer's unset-env-ref bake warn does not apply here.
74
+ nativeServerEnvInterpolation: true,
71
75
  // Skills: Amp reads SKILL.md from ~/.config/agents/skills/<name>/SKILL.md
72
76
  // (user) and <projectDir>/.agents/skills/<name>/SKILL.md (project) — a root
73
77
  // OUTSIDE the config dir, so the skillDir() helper resolves it explicitly.
@@ -604,4 +608,4 @@ export {
604
608
  adapter,
605
609
  amp_default as default
606
610
  };
607
- //# sourceMappingURL=amp-WAPHJYTK.js.map
611
+ //# sourceMappingURL=amp-6Q5OYHNW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/adapters/amp/index.ts"],"sourcesContent":["/**\n * adapters/amp — Amp (Sourcegraph / AmpCode) platform adapter for agent-connector.\n *\n * Amp is a **ts-plugin** host: alongside MCP it loads TypeScript plugin modules\n * from `.amp/plugins/<name>.ts`, each default-exporting a function `(amp) => void`\n * that registers lifecycle handlers via `amp.on(\"<event>\", async (event, ctx) =>\n * …)` (ampcode.com/manual → Plugins). This adapter wires the five amp.on events\n * that have a canonical analog and bridges them to the universal home-bin\n * entrypoint, exactly like the OMP / OpenCode ts-plugin adapters.\n *\n * Event mapping (only events the connector declares are subscribed):\n * SessionStart → amp.on(\"session.start\", …) (thread begins; id = event.thread.id)\n * UserPromptSubmit → amp.on(\"agent.start\", …) (user submits a prompt; observe-only)\n * PreToolUse → amp.on(\"tool.call\", …) (before a tool runs; deny → return\n * { action: \"reject-and-continue\" }, else { action: \"allow\" })\n * PostToolUse → amp.on(\"tool.result\", …) (after a tool finishes; observe-only)\n * Stop → amp.on(\"agent.end\", …) (turn ends; observe-only)\n * Amp documents NO session.end event, so SessionEnd is an honest gap (warn-skip\n * via the unsupported-here detail). tool.call's decision surface is the\n * { action } union (canModifyArgs:false — the \"modify\" input shape is not\n * documented); tool.result CAN return a replacement but the manual never\n * documents its object shape, so PostToolUse is observe-only (canModifyOutput:\n * false) rather than ship a guessed mutation; session.start has no documented\n * context-injection surface (canInjectSessionContext:false).\n *\n * Why we SYNTHESIZE a self-contained module instead of importing handlers:\n * the connector's hook handlers are arbitrary developer code we must not import\n * into Amp's (Bun) runtime — wrong cwd, wrong deps, version skew. So, like the\n * OMP / OpenCode adapters, we generate a tiny ESM/TS plugin that imports NOTHING\n * from agent-connector: each `amp.on(...)` handler shells out to the ONE stable\n * home binary's universal entrypoint (`<homeBin> hook amp <event> --connector\n * <id>`) over child_process, feeds it the amp-shaped payload as JSON on stdin,\n * and JSON.parses the normalized HookResponse back from stdout. Fail-open: any\n * bridge error → no-op. One entrypoint, every paradigm.\n *\n * Plugin scope: the `.amp/plugins/` dir is documented at PROJECT scope only; Amp\n * documents no user-scope plugins dir, so installHooks writes the plugin for\n * project scope and warn-skips user scope (the MCP + skills surfaces keep their\n * own user-scope paths). MCP config (report §2 / §5.3):\n * - user scope → ~/.config/amp/settings.json\n * - project scope → <projectDir>/.amp/settings.json\n * Both are JSONC (we write plain JSON, which is valid JSONC). The settings file\n * is SHARED with the rest of Amp's configuration, so we MERGE our entry into\n * the existing object and never clobber unrelated keys.\n *\n * QUIRK 1 — dotted top-level key: Amp does NOT use a nested `mcpServers` object.\n * The MCP registry is a single FLAT settings key literally named\n * `\"amp.mcpServers\"`, whose value is an object of `{ id: { command, args, env } }`.\n * We therefore set `settings[\"amp.mcpServers\"][connectorId] = entry`. Because the\n * base JSON helpers index `config[rootKey][serverId]`, passing the dotted string\n * as the root key writes exactly that flat key while preserving every sibling\n * setting (true merge).\n *\n * QUIRK 2 — native interpolation: Amp expands `${VAR_NAME}` in stdio entries at\n * runtime, so we KEEP env/header/url refs native by rewriting the portable\n * `${env:VAR}` syntax to Amp's `${VAR}` token rather than resolving to literals\n * (secrets stay out of the settings file).\n *\n * Skills surface: Amp reads SKILL.md files (dir-per-skill, same shape as\n * claude-code) from a skill root that is NOT under the config dir\n * (`~/.config/amp`):\n * - user scope → ~/.config/agents/skills/<name>/SKILL.md (the sibling\n * cross-agent `agents` dir — `~/.config/amp/skills/` is also documented-native,\n * but the `agents` root is the cross-agent standard we standardize on)\n * - project scope → <projectDir>/.agents/skills/<name>/SKILL.md\n * Because that root differs from getConfigDir, skills use a dedicated skillDir()\n * helper rather than reusing getConfigDir.\n */\n\nimport { existsSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\n\nimport { BaseAdapter } from \"../base.js\";\nimport type {\n Adapter,\n GeneratedPluginFile,\n HookReply,\n InstallContext,\n NormalizedEvent,\n} from \"../spi.js\";\nimport type {\n ChangeRecord,\n DetectedPlatform,\n HealthCheck,\n HookEventName,\n HookParadigm,\n HookResponse,\n PlatformCapabilities,\n PlatformId,\n PostToolUseEvent,\n PreToolUseEvent,\n ServerDef,\n SessionStartEvent,\n SkillDef,\n StopEvent,\n Transport,\n UserPromptSubmitEvent,\n} from \"../../core/types.js\";\nimport { rewriteEnvRefs } from \"../../core/interpolate.js\";\nimport { renderBridgePrelude } from \"../../core/ts-plugin-bridge.js\";\nimport {\n buildWrappedStdio,\n} from \"../../core/spawn.js\";\nimport { renderSkillMd } from \"../claude-code/render.js\";\n\nconst HOST: PlatformId = \"amp\";\n/**\n * QUIRK: a single FLAT, dotted settings key — NOT a nested object. The base\n * JSON helpers treat this as `config[\"amp.mcpServers\"][serverId]`.\n */\nconst MCP_ROOT_KEY = \"amp.mcpServers\";\n\n/**\n * Canonical → Amp plugin event name map. A connector hook event is only\n * subscribed by the generated plugin when it appears here AND is declared by the\n * connector. Names verified against ampcode.com/manual (Plugins → amp.on events).\n * Amp documents NO `session.end`, so SessionEnd has no entry (honest gap).\n */\nconst EVENT_TO_AMP: Partial<Record<HookEventName, string>> = {\n SessionStart: \"session.start\",\n UserPromptSubmit: \"agent.start\",\n PreToolUse: \"tool.call\",\n PostToolUse: \"tool.result\",\n Stop: \"agent.end\",\n};\n\n/** Raw payload the generated plugin posts to the universal hook entrypoint. */\ninterface AmpBridgePayload {\n toolName?: string;\n toolInput?: Record<string, unknown>;\n // ToolResultEvent.output is typed `unknown` by the host (@ampcode/plugin\n // index.d.ts:947 — \"Tool output/result if available\"), so the bridge may\n // forward a string OR a structured value; parseEvent stringifies non-strings.\n toolOutput?: unknown;\n isError?: boolean;\n prompt?: string;\n sessionId?: string;\n projectDir?: string;\n}\n\n/** Native MCP server entry shapes Amp accepts under `amp.mcpServers`. */\ninterface AmpStdioServer {\n command: string;\n args?: string[];\n env?: Record<string, string>;\n}\ninterface AmpHttpServer {\n url: string;\n headers?: Record<string, string>;\n}\n\nexport class AmpAdapter extends BaseAdapter implements Adapter {\n readonly id: PlatformId = HOST;\n readonly name = \"Amp\";\n readonly paradigm: HookParadigm = \"ts-plugin\";\n\n readonly capabilities: PlatformCapabilities = {\n // Memory surface: AGENTS.md-first managed block via the BaseAdapter default\n // (memoryTargets: project <projectDir>/AGENTS.md; user scope where documented).\n supportsMemory: true,\n // amp.on lifecycle events with a canonical analog (EVENT_TO_AMP):\n // tool.call / tool.result / session.start / agent.start / agent.end.\n preToolUse: true,\n postToolUse: true,\n // Amp has no documented compaction hook.\n preCompact: false,\n sessionStart: true,\n // Amp documents NO session.end event — SessionEnd is an honest gap.\n sessionEnd: false,\n userPromptSubmit: true,\n stop: true,\n notification: false,\n // Newer events: Amp documents no permission/approval, post-tool-failure, or\n // subagent lifecycle hook with a canonical analog, so permissionRequest /\n // postToolUseFailure / subagentStart / subagentStop stay unset — the\n // generated bridge never references them and install reports them as\n // \"unsupported here\".\n // tool.call's documented decision surface is { action: \"allow\" |\n // \"reject-and-continue\" | \"modify\" | \"synthesize\" } (ampcode.com/manual →\n // Plugins → tool.call). We wire allow + reject-and-continue (block); the\n // \"modify\" input-rewrite shape is not byte-documented, so canModifyArgs:false.\n canModifyArgs: false,\n // tool.result says \"return a replacement status/output\" but the manual never\n // documents the replacement OBJECT SHAPE (which keys). Rather than guess it,\n // PostToolUse is observe-only and canModifyOutput stays false until the shape\n // is primary-source-verified (honesty bar: under-claim, never emit a guessed\n // mutation contract).\n canModifyOutput: false,\n // session.start has no documented context-injection surface.\n canInjectSessionContext: false,\n // Amp registers stdio and Streamable HTTP MCP servers.\n transports: [\"stdio\", \"http\"],\n // Server env/url use Amp's NATIVE ${env:VAR} interpolation (rewriteEnvRefs)\n // — the token survives into the config, never a baked literal — so the\n // installer's unset-env-ref bake warn does not apply here.\n nativeServerEnvInterpolation: true,\n // Skills: Amp reads SKILL.md from ~/.config/agents/skills/<name>/SKILL.md\n // (user) and <projectDir>/.agents/skills/<name>/SKILL.md (project) — a root\n // OUTSIDE the config dir, so the skillDir() helper resolves it explicitly.\n supportsSkills: true,\n // Native passthrough hooks: amp.on events with no canonical HookEventName\n // analog are reachable via platforms[\"amp\"].nativeHooks; the generated plugin\n // registers + bridges each declared native event verbatim and the home-bin\n // runtime dispatches it host-generically via runNativeHook.\n supportsNativeHooks: true,\n };\n\n // ── Detection ────────────────────────────────────────────────────────────\n\n detectInstalled(projectDir: string): DetectedPlatform {\n const userDir = join(homedir(), \".config\", \"amp\");\n const userSettings = join(userDir, \"settings.json\");\n const projectDirAmp = join(projectDir, \".amp\");\n const projectSettings = join(projectDirAmp, \"settings.json\");\n\n const userInstalled = existsSync(userDir) || existsSync(userSettings);\n const projectInstalled = existsSync(projectDirAmp) || existsSync(projectSettings);\n const installed = userInstalled || projectInstalled;\n const scope = projectInstalled && !userInstalled ? \"project\" : \"user\";\n const configPath = scope === \"project\" ? projectSettings : userSettings;\n\n return {\n id: this.id,\n name: this.name,\n installed,\n paradigm: this.paradigm,\n capabilities: this.capabilities,\n configPath,\n scope,\n reason: installed\n ? `found Amp config (${scope}) at ${configPath}`\n : `no Amp config at ${userSettings} or ${projectSettings}`,\n confidence: installed ? \"high\" : \"low\",\n };\n }\n\n // ── Native paths ─────────────────────────────────────────────────────────\n\n getConfigDir(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? join(ctx.projectDir, \".amp\")\n : join(homedir(), \".config\", \"amp\");\n }\n\n getServerConfigPath(ctx: InstallContext): string {\n return join(this.getConfigDir(ctx), \"settings.json\");\n }\n\n /**\n * For this ts-plugin host the \"hook config path\" is the generated plugin\n * MODULE. Amp loads every `.ts` file in `.amp/plugins/`, so writing this file\n * IS the registration. The `.amp/plugins/` dir is documented at PROJECT scope\n * (Amp documents no user-scope plugins dir — see pluginsDir); the user-scope\n * path is returned for doctor/uninstall symmetry but installHooks warn-skips it.\n */\n getHookConfigPath(ctx: InstallContext): string {\n return join(this.pluginsDir(ctx), `${ctx.connector.id}.ts`);\n }\n\n /**\n * Plugin directory Amp auto-loads `.ts` modules from. PROJECT scope is the\n * documented `<projectDir>/.amp/plugins`; user scope mirrors the MCP config dir\n * (`~/.config/amp/plugins`) for path symmetry only — installHooks never writes\n * there because Amp documents no user-scope plugins dir.\n */\n private pluginsDir(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? join(ctx.projectDir, \".amp\", \"plugins\")\n : join(this.getConfigDir(ctx), \"plugins\");\n }\n\n // ── MCP server install / uninstall ───────────────────────────────────────\n\n installServer(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n const override = connector.platforms[HOST]?.server;\n if (!connector.server || override === false) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n detail: connector.server\n ? \"server registration disabled for amp\"\n : \"connector declares no MCP server\",\n },\n ];\n }\n\n // Shallow-merge any per-platform server override into the base ServerDef.\n const server: ServerDef =\n override && typeof override === \"object\"\n ? { ...connector.server, ...override }\n : connector.server;\n\n const serverPath = this.getServerConfigPath(ctx);\n const entry = this.renderServerEntry(ctx, server);\n\n // Upsert into the flat \"amp.mcpServers\" key, merging into existing settings.\n return [\n this.upsertServerInJson(serverPath, MCP_ROOT_KEY, connector.id, entry, ctx.dryRun),\n ];\n }\n\n uninstallServer(ctx: InstallContext): ChangeRecord[] {\n const serverPath = this.getServerConfigPath(ctx);\n return [\n this.removeServerFromJson(serverPath, MCP_ROOT_KEY, ctx.connector.id, ctx.dryRun),\n ];\n }\n\n /** Render a normalized ServerDef into Amp's native `amp.mcpServers` entry. */\n private renderServerEntry(\n ctx: InstallContext,\n server: ServerDef,\n ): AmpStdioServer | AmpHttpServer {\n const transport: Transport = server.transport;\n\n if (transport === \"stdio\") {\n let command = server.command ?? \"\";\n let args = [...(server.args ?? [])];\n\n // Transparent telemetry wrapping: route the real command through\n // `<homeBin> serve --connector <id> -- <command> <args...>`.\n ({ command, args } = buildWrappedStdio(ctx, server, this.id, command, args));\n\n // Amp expands ${VAR_NAME} natively, so keep refs native (no literals).\n const entry: AmpStdioServer = { command: this.rewrite(command) };\n if (args.length > 0) entry.args = args.map((a) => this.rewrite(a));\n const env = this.renderEnv(server.env);\n if (env) entry.env = env;\n return entry;\n }\n\n // http (and any other remote transport we surface) — Amp registers a URL.\n const entry: AmpHttpServer = { url: this.rewrite(server.url ?? \"\") };\n const headers = this.renderEnv(server.headers);\n if (headers) entry.headers = headers;\n return entry;\n }\n\n /**\n * Render env/header values. Amp supports native `${VAR_NAME}` interpolation,\n * so translate `${env:VAR}` refs to that native token rather than baking\n * secrets into the file. Literals pass through unchanged.\n */\n private renderEnv(\n env: Record<string, string> | undefined,\n ): Record<string, string> | undefined {\n if (!env || Object.keys(env).length === 0) return undefined;\n const out: Record<string, string> = {};\n for (const [k, v] of Object.entries(env)) out[k] = this.rewrite(v);\n return out;\n }\n\n /** Translate `${env:VAR(:-default)}` to Amp's native `${VAR}` token. */\n private rewrite(value: string): string {\n return rewriteEnvRefs(value, ampEnvToken);\n }\n\n // ── Skills surface ───────────────────────────────────────────────────────\n // CONTENT-ONLY: pure native-file writers under the skill root. No runtime\n // dispatch, no home-bin pointer, no telemetry wrap. Idempotent (byte-identical\n // → skip) via writeContentFile and reversible via removeContentFile. Honors\n // platforms[\"amp\"].skills === false to skip.\n //\n // QUIRK: the skill root is NOT under getConfigDir (~/.config/amp). Amp reads\n // SKILL.md from the sibling cross-agent `agents` tree:\n // user scope → ~/.config/agents/skills/<name>/SKILL.md\n // project scope → <projectDir>/.agents/skills/<name>/SKILL.md\n // so skillDir() resolves it explicitly rather than reusing getConfigDir.\n\n /** Skill root: user `~/.config/agents/skills`, project `<projectDir>/.agents/skills`. */\n private skillsDir(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? join(ctx.projectDir, \".agents\", \"skills\")\n : join(homedir(), \".config\", \"agents\", \"skills\");\n }\n\n /** Native skill dir: <skillRoot>/<name>. */\n private skillDir(ctx: InstallContext, name: string): string {\n return join(this.skillsDir(ctx), name);\n }\n\n override installSkills(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[HOST]?.skills === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"skills disabled for amp\" }];\n }\n if (connector.skills.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no skills\" }];\n }\n const changes: ChangeRecord[] = [];\n for (const skill of connector.skills) {\n const dir = this.skillDir(ctx, skill.name);\n changes.push(\n this.writeContentFile(join(dir, \"SKILL.md\"), this.renderSkill(skill), ctx.dryRun),\n );\n // Bundle any resource files beside SKILL.md (relative path → contents).\n // Defense-in-depth: skip+warn on any key that escapes the skill dir\n // (config-time validation already rejects these, but never trust input).\n for (const [rel, contents] of Object.entries(skill.resources ?? {})) {\n const target = this.resolveWithin(dir, rel);\n if (target === null) {\n changes.push({\n platform: this.id,\n action: \"warn\",\n detail: `skill resource \"${rel}\" escapes the skill dir; skipped`,\n });\n continue;\n }\n changes.push(this.writeContentFile(target, contents, ctx.dryRun));\n }\n }\n return changes;\n }\n\n override uninstallSkills(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.skills.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no skills\" }];\n }\n const changes: ChangeRecord[] = [];\n for (const skill of connector.skills) {\n const dir = this.skillDir(ctx, skill.name);\n // Remove only the files we wrote (SKILL.md + declared resources), then the\n // skill dir itself when we own its full contents.\n changes.push(this.removeContentFile(join(dir, \"SKILL.md\"), ctx.dryRun));\n for (const rel of Object.keys(skill.resources ?? {})) {\n const target = this.resolveWithin(dir, rel);\n if (target === null) continue; // never delete outside the skill dir\n changes.push(this.removeContentFile(target, ctx.dryRun));\n }\n // Only remove the skill dir when WE own its full contents — never rm -rf a\n // dir that still holds user-added / sibling-tool / shared files.\n changes.push(this.removeDirIfEmpty(dir, ctx.dryRun));\n }\n return changes;\n }\n\n /** Render a skill's SKILL.md (delegates to the shared renderer). */\n private renderSkill(skill: SkillDef): string {\n return renderSkillMd(skill);\n }\n\n // ── Hook install / uninstall (ts-plugin module) ──────────────────────────\n\n installHooks(ctx: InstallContext): ChangeRecord[] {\n const pluginPath = this.getHookConfigPath(ctx);\n\n // Amp documents no user-scope plugins dir — only `.amp/plugins/` at project\n // scope. Degradation is never silent: warn-skip rather than write to an\n // unverified user path.\n if (ctx.scope !== \"project\") {\n return [\n {\n platform: this.id,\n action: \"warn\",\n path: pluginPath,\n detail:\n \"amp plugins are project-scoped (.amp/plugins/) — no user-scope plugins dir is documented; skipped\",\n },\n ];\n }\n\n // Native passthrough events are a sibling, amp-scoped declaration: `hooks:\n // false` disables only the CANONICAL events, and the generated native loop\n // reads platforms.amp.nativeHooks directly (independent of hookEvents). So\n // whenever native events exist the plugin must still be synthesized.\n const canonicalDisabled = ctx.connector.platforms[HOST]?.hooks === false;\n const hasCanonical = !canonicalDisabled && ctx.connector.hookEvents.length > 0;\n const hasNative = this.nativeHookEvents(ctx).length > 0;\n\n if (!hasCanonical && !hasNative) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n path: pluginPath,\n detail: canonicalDisabled\n ? \"hooks disabled for amp\"\n : \"connector declares no hooks\",\n },\n ];\n }\n\n const files = this.synthesizePlugin(ctx);\n const changes: ChangeRecord[] = [];\n\n for (const file of files) {\n changes.push(\n this.writeManagedFile(\n file.path,\n file.contents,\n ctx.dryRun,\n `amp plugin module (${this.hookDetail(ctx)})`,\n file.executable,\n ),\n );\n }\n\n return changes;\n }\n\n uninstallHooks(ctx: InstallContext): ChangeRecord[] {\n const pluginPath = this.getHookConfigPath(ctx);\n return [\n this.removeManagedFile(pluginPath, ctx.dryRun, \"amp plugin module\", \"no amp plugin module present\"),\n ];\n }\n\n /**\n * Human-facing summary of which declared events the synthesized module ACTUALLY\n * wires. Only events present in EVENT_TO_AMP are mapped/wired; any declared\n * event with no Amp mapping (e.g. SessionEnd) is reported separately as\n * \"unsupported here\" so the detail never overstates coverage.\n */\n private hookDetail(ctx: InstallContext): string {\n // `hooks: false` suppresses the canonical handlers, so the detail must not\n // claim them; native events are still reported below.\n const canonicalOff = ctx.connector.platforms[HOST]?.hooks === false;\n const declared = canonicalOff ? [] : ctx.connector.hookEvents;\n const mapped = declared.filter((e) => EVENT_TO_AMP[e] !== undefined);\n const unsupported = declared.filter((e) => EVENT_TO_AMP[e] === undefined);\n const native = this.nativeHookEvents(ctx);\n const parts: string[] = [];\n if (mapped.length > 0) parts.push(mapped.join(\",\"));\n if (native.length > 0) parts.push(`native: ${native.join(\",\")}`);\n const base = parts.join(\"; \") || \"no canonical hooks\";\n return unsupported.length > 0\n ? `${base}; unsupported here: ${unsupported.join(\",\")}`\n : base;\n }\n\n /**\n * Amp-native passthrough events declared on platforms[\"amp\"].nativeHooks\n * (amp.on event names with no canonical HookEventName analog). Emitted as\n * generic bridge registrations and dispatched host-generically by the home-bin's\n * runNativeHook.\n */\n private nativeHookEvents(ctx: InstallContext): string[] {\n return Object.keys(ctx.connector.platforms[HOST]?.nativeHooks ?? {});\n }\n\n // ── ts-plugin synthesis ──────────────────────────────────────────────────\n\n /**\n * Build ONE self-contained Amp plugin module (`.amp/plugins/<id>.ts`). It\n * imports nothing from agent-connector; each `amp.on(...)` handler shells out to\n * the universal hook entrypoint via child_process and applies the normalized\n * HookResponse. Its default export is the Amp plugin function `(amp) => void`.\n */\n synthesizePlugin(ctx: InstallContext): GeneratedPluginFile[] {\n const path = this.getHookConfigPath(ctx);\n const contents = this.buildPluginSource(ctx);\n return [{ path, contents, executable: false }];\n }\n\n /** Compose the generated plugin source with plain string concatenation. */\n private buildPluginSource(ctx: InstallContext): string {\n // `platforms.amp.hooks === false` disables only the CANONICAL events (the\n // native loop below reads platforms.amp.nativeHooks directly and is a sibling,\n // unaffected). When canonical hooks are off the module may still be\n // synthesized for native events, so the canonical handler set collapses to\n // empty here rather than short-circuiting the whole plugin.\n const canonicalOff = ctx.connector.platforms[HOST]?.hooks === false;\n const events = canonicalOff\n ? []\n : ctx.connector.hookEvents.filter(\n (e): e is HookEventName => EVENT_TO_AMP[e] !== undefined,\n );\n const has = (e: HookEventName) => events.includes(e);\n\n const header = `/**\n * AUTO-GENERATED by agent-connector — DO NOT EDIT.\n *\n * Self-contained Amp plugin for connector ${ctx.connector.id}.\n * It imports nothing from agent-connector: every hook invocation shells out to\n * the stable home binary's universal entrypoint and JSON-parses the normalized\n * response. Fail-open: any bridge error degrades to a no-op (never wedges Amp).\n *\n * Amp loads this module from .amp/plugins/${ctx.connector.id}.ts; the default\n * export is the plugin function (amp) => void called once with the PluginAPI.\n */\nimport type { PluginAPI } from \"@ampcode/plugin\";\nimport { execFileSync, execSync } from \"node:child_process\";\n\n${renderBridgePrelude({\n homeBin: ctx.homeBinPath,\n connectorId: ctx.connector.id,\n hookSlug: \"amp\",\n payloadNoun: \"amp\",\n failOpenComment: \"Fail-open — never wedge an Amp tool call / lifecycle event.\",\n})}\n\n// Amp documents no project-dir env var; the plugin process runs in the workspace\n// root, so resolve once at load. Session id is rebound on each session.start.\nconst PROJECT_DIR = process.cwd();\nlet SESSION_ID = \"\";\n`;\n\n const handlers: string[] = [];\n\n if (has(\"SessionStart\")) {\n handlers.push(` // SessionStart → rebind the session id and notify the connector.\n // Amp's session.start event carries event.thread.id (ampcode.com/manual →\n // Plugins → session.start: \"Example session.start for \\${event.thread.id}\").\n amp.on(\"session.start\", async (event) => {\n SESSION_ID =\n (event && event.thread && event.thread.id) || \"amp-session\";\n bridge(\"SessionStart\", { sessionId: SESSION_ID, projectDir: PROJECT_DIR });\n });`);\n }\n\n if (has(\"UserPromptSubmit\")) {\n handlers.push(` // UserPromptSubmit → agent.start \"fires when the user submits a prompt\"\n // (ampcode.com/manual). The host DOES carry the prompt: AgentStartEvent.message\n // is \"The user's prompt message\" (@ampcode/plugin index.d.ts:1011-1012), so we\n // PROJECT event.message into the bridge payload's prompt key (the prior version\n // dropped it). Observe-only return surface — any deny/context decision is a no-op.\n amp.on(\"agent.start\", async (event) => {\n bridge(\"UserPromptSubmit\", {\n prompt: (event && typeof event.message === \"string\" && event.message) || \"\",\n sessionId: SESSION_ID,\n projectDir: PROJECT_DIR,\n raw: event,\n });\n });`);\n }\n\n if (has(\"PreToolUse\")) {\n handlers.push(` // PreToolUse → Amp's tool.call returns a decision union (ampcode.com/manual →\n // Plugins → tool.call): { action: \"allow\" } to run, or { action:\n // \"reject-and-continue\", message } to block and let the agent continue. The\n // tool name is event.tool (verified); the input field is not byte-documented,\n // so event.input is a best-effort hint for the connector's matcher (the matcher\n // keys on the verified tool name). A deny/ask decision maps to reject-and-\n // continue; everything else allows.\n amp.on(\"tool.call\", async (event) => {\n const payload = {\n toolName: (event && event.tool) || \"\",\n toolInput: (event && event.input) || {},\n sessionId: SESSION_ID,\n projectDir: PROJECT_DIR,\n };\n const res = bridge(\"PreToolUse\", payload);\n if (res && (res.decision === \"deny\" || res.decision === \"ask\")) {\n return {\n action: \"reject-and-continue\",\n message: res.reason || \"Blocked by ${ctx.connector.id}\",\n };\n }\n return { action: \"allow\" };\n });`);\n }\n\n if (has(\"PostToolUse\")) {\n handlers.push(` // PostToolUse → tool.result \"fires after a tool finishes and before the result\n // is sent back to the model\" (ampcode.com/manual). The tool name is event.tool\n // and the error signal is event.status === \"error\" (both verified). The host DOES\n // carry the output: ToolResultEvent extends ToolResult.output (typed unknown —\n // \"Tool output/result if available\", @ampcode/plugin index.d.ts:946-947,976), so\n // we PROJECT event.output into the bridge payload's toolOutput (prior version\n // dropped it). Replacement still observe-only (canModifyOutput:false) — the\n // replacement OBJECT shape is undocumented, so we never return a guessed mutation.\n amp.on(\"tool.result\", async (event) => {\n bridge(\"PostToolUse\", {\n toolName: (event && event.tool) || \"\",\n toolOutput: event && event.output,\n isError: !!(event && event.status === \"error\"),\n sessionId: SESSION_ID,\n projectDir: PROJECT_DIR,\n raw: event,\n });\n });`);\n }\n\n if (has(\"Stop\")) {\n handlers.push(` // Stop → observe turn end. Amp's agent.end exposes no decision surface, so\n // this is observe-only (a deny decision degrades to a no-op).\n amp.on(\"agent.end\", async (event) => {\n bridge(\"Stop\", { sessionId: SESSION_ID, projectDir: PROJECT_DIR, raw: event });\n });`);\n }\n\n // NATIVE passthrough events: amp.on event names with no canonical analog,\n // declared on platforms.amp.nativeHooks (independent of hookEvents, so they\n // install even with hooks:false). Each bridges the NATIVE event name verbatim\n // to the home-bin → runNativeHook dispatches it host-generically.\n for (const ev of this.nativeHookEvents(ctx)) {\n const key = JSON.stringify(ev);\n handlers.push(` // nativeHooks passthrough → ${ev}\n amp.on(${key}, async (event) => {\n bridge(${key}, { sessionId: SESSION_ID, projectDir: PROJECT_DIR, raw: event });\n });`);\n }\n\n const factory = `\nexport default function plugin(amp: PluginAPI) {\n${handlers.join(\"\\n\\n\")}\n}\n`;\n\n return header + factory;\n }\n\n // ── Runtime: parse OUR bridge payload → normalized event ─────────────────\n\n /**\n * `raw` is the payload OUR generated plugin posts (NOT a host-native shape):\n * { toolName?, toolInput?, toolOutput?, isError?, prompt?, sessionId?, projectDir? }\n * so this maps straight through.\n */\n parseEvent(event: HookEventName, raw: unknown): NormalizedEvent {\n const input = (raw ?? {}) as AmpBridgePayload;\n const base = {\n hostPlatform: HOST,\n connectorId: \"\",\n sessionId: typeof input.sessionId === \"string\" ? input.sessionId : \"\",\n raw,\n ...(typeof input.projectDir === \"string\"\n ? { projectDir: input.projectDir }\n : {}),\n } as const;\n\n switch (event) {\n case \"PreToolUse\": {\n const ev: PreToolUseEvent = {\n ...base,\n toolName: input.toolName ?? \"\",\n toolInput: input.toolInput ?? {},\n };\n return ev;\n }\n case \"PostToolUse\": {\n // ToolResultEvent.output is typed `unknown` by the host (@ampcode/plugin\n // index.d.ts:947), so the bridge can forward a string OR a structured value.\n // Accept both: pass strings through, JSON-stringify other non-nullish\n // values (the old `typeof === \"string\"` guard silently dropped the latter).\n const out = coerceToolOutput(input.toolOutput);\n const ev: PostToolUseEvent = {\n ...base,\n toolName: input.toolName ?? \"\",\n toolInput: input.toolInput ?? {},\n ...(out !== undefined ? { toolOutput: out } : {}),\n ...(typeof input.isError === \"boolean\"\n ? { isError: input.isError }\n : {}),\n };\n return ev;\n }\n case \"UserPromptSubmit\": {\n const ev: UserPromptSubmitEvent = {\n ...base,\n prompt: typeof input.prompt === \"string\" ? input.prompt : \"\",\n };\n return ev;\n }\n case \"Stop\": {\n const ev: StopEvent = { ...base };\n return ev;\n }\n case \"SessionStart\": {\n const ev: SessionStartEvent = { ...base, source: \"startup\" };\n return ev;\n }\n default:\n // Other canonical events are not surfaced by Amp; treat as a\n // session-start-shaped no-op so the dispatcher fails open gracefully.\n return { ...base, source: \"startup\" } satisfies SessionStartEvent;\n }\n }\n\n // ── Runtime: normalized response → reply the generated bridge parses ─────\n\n /**\n * Unlike json-stdio hosts (whose reply is the host's NATIVE control payload),\n * OUR generated bridge consumes this stdout directly. So the reply body is the\n * NORMALIZED HookResponse itself — the bridge JSON.parses it and, for tool.call,\n * maps a deny/ask decision → { action: \"reject-and-continue\" } (else allow).\n * Other events are observe-only, so their reply is ignored by the handler.\n */\n formatReply(_event: HookEventName, response: HookResponse): HookReply {\n return {\n exitCode: 0,\n stdout: JSON.stringify(response ?? { decision: \"allow\" }),\n };\n }\n\n // ── Diagnostics ──────────────────────────────────────────────────────────\n\n override getHealthChecks(ctx: InstallContext): readonly HealthCheck[] {\n const settingsPath = this.getServerConfigPath(ctx);\n const connectorId = ctx.connector.id;\n return [\n {\n name: `${this.name}: settings.json present`,\n check: () =>\n existsSync(settingsPath)\n ? { status: \"OK\", detail: settingsPath }\n : { status: \"FAIL\", detail: `not found: ${settingsPath}` },\n },\n {\n name: `${this.name}: server entry registered`,\n check: () => {\n // Only assert what the connector declares: a server-less connector\n // never writes a server entry, so its absence is healthy.\n if (!ctx.connector.server) {\n return { status: \"OK\", detail: \"no MCP server declared\" };\n }\n const cfg = this.readJson<{ [k: string]: Record<string, unknown> }>(settingsPath);\n const bucket = cfg?.[MCP_ROOT_KEY];\n if (!cfg || !bucket) {\n return { status: \"FAIL\", detail: `no \"${MCP_ROOT_KEY}\" in ${settingsPath}` };\n }\n return connectorId in bucket\n ? { status: \"OK\", detail: `\"${MCP_ROOT_KEY}\".${connectorId} present` }\n : {\n status: \"FAIL\",\n detail: `no \"${MCP_ROOT_KEY}\".${connectorId} in ${settingsPath}`,\n };\n },\n },\n {\n name: `${this.name}: plugin module present`,\n check: () => {\n const hasHooks =\n ctx.connector.hookEvents.length > 0 ||\n this.nativeHookEvents(ctx).length > 0;\n if (!hasHooks) return { status: \"OK\", detail: \"no hooks declared\" };\n // Amp plugins are project-scoped; a user-scope install warn-skips the\n // plugin, so its absence there is healthy.\n if (ctx.scope !== \"project\") {\n return {\n status: \"OK\",\n detail: \"amp plugins are project-scoped (user scope skipped)\",\n };\n }\n const pluginPath = this.getHookConfigPath(ctx);\n return existsSync(pluginPath)\n ? { status: \"OK\", detail: pluginPath }\n : { status: \"FAIL\", detail: `not found: ${pluginPath}` };\n },\n },\n ];\n }\n\n /** Read a file, returning undefined on any error (idempotency compare). */\n}\n\n/**\n * Coerce Amp's `ToolResultEvent.output` (typed `unknown` upstream) into the\n * normalized event's `toolOutput: string`. Strings pass through; other\n * non-nullish values (objects / arrays / numbers) are JSON-stringified so a\n * structured tool result is no longer silently dropped. `undefined`/`null`\n * yields `undefined` (the key is omitted by the caller).\n */\nfunction coerceToolOutput(value: unknown): string | undefined {\n if (typeof value === \"string\") return value;\n if (value === undefined || value === null) return undefined;\n try {\n return JSON.stringify(value);\n } catch {\n return String(value);\n }\n}\n\n/**\n * Amp native interpolation token: `${env:VAR}` → `${VAR}`.\n *\n * When the portable ref carried a default (`${env:VAR:-fallback}`), Amp's native\n * `${VAR}` token has no way to express it — so a bare native token would silently\n * DROP the default. Instead, resolve the default at install time: emit the live\n * value when VAR is set and non-empty, else the literal fallback. The native\n * token is only emitted when there is no default to preserve.\n */\nfunction ampEnvToken(name: string, def?: string): string {\n if (def !== undefined) {\n const v = process.env[name];\n return v != null && v !== \"\" ? v : def;\n }\n return `\\${${name}}`;\n}\n\nexport const adapter = new AmpAdapter();\nexport default adapter;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqEA,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,YAAY;AAmCrB,IAAM,OAAmB;AAKzB,IAAM,eAAe;AAQrB,IAAM,eAAuD;AAAA,EAC3D,cAAc;AAAA,EACd,kBAAkB;AAAA,EAClB,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,MAAM;AACR;AA2BO,IAAM,aAAN,cAAyB,YAA+B;AAAA,EACp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AW;AACrB,UAAM,IAAI,QAAQ,IAAI,IAAI;AAC1B,WAAO,KAAK,QAAQ,MAAM,KAAK,IAAI;AAAA,EACrC;AACA,SAAO,MAAM,IAAI;AACnB;AAEO,IAAM,UAAU,IAAI,WAAW;AACtC,IAAO,cAAQ;","names":["entry"]}
@@ -3,10 +3,10 @@ import {
3
3
  AntigravityAdapter,
4
4
  adapter,
5
5
  antigravity_default
6
- } from "./chunk-3Y23ZYYF.js";
6
+ } from "./chunk-Q42SEI7W.js";
7
7
  import "./chunk-H53QZQJI.js";
8
- import "./chunk-DBQMX75U.js";
9
- import "./chunk-RHML2NOB.js";
8
+ import "./chunk-BEFVJ2OE.js";
9
+ import "./chunk-NUGMVVV2.js";
10
10
  import "./chunk-TO57WYBB.js";
11
11
  import "./chunk-ALVXORZM.js";
12
12
  import "./chunk-2HCJV6UO.js";
@@ -15,4 +15,4 @@ export {
15
15
  adapter,
16
16
  antigravity_default as default
17
17
  };
18
- //# sourceMappingURL=antigravity-GF3RU42A.js.map
18
+ //# sourceMappingURL=antigravity-WIK3XBN5.js.map
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  AntigravityAdapter
4
- } from "./chunk-3Y23ZYYF.js";
4
+ } from "./chunk-Q42SEI7W.js";
5
5
  import "./chunk-H53QZQJI.js";
6
- import "./chunk-DBQMX75U.js";
7
- import "./chunk-RHML2NOB.js";
6
+ import "./chunk-BEFVJ2OE.js";
7
+ import "./chunk-NUGMVVV2.js";
8
8
  import "./chunk-TO57WYBB.js";
9
9
  import "./chunk-ALVXORZM.js";
10
10
  import "./chunk-2HCJV6UO.js";
@@ -84,4 +84,4 @@ export {
84
84
  adapter,
85
85
  antigravity_cli_default as default
86
86
  };
87
- //# sourceMappingURL=antigravity-cli-OH27IFH5.js.map
87
+ //# sourceMappingURL=antigravity-cli-L3RZMF6V.js.map
@@ -12,11 +12,11 @@ import {
12
12
  import {
13
13
  loadRegisteredConnector,
14
14
  readRegisteredMeta
15
- } from "./chunk-RQCBBLTA.js";
15
+ } from "./chunk-5LAFKXFM.js";
16
16
  import {
17
17
  REGISTERED_PLATFORM_IDS,
18
18
  loadAdapter
19
- } from "./chunk-LS65GL2P.js";
19
+ } from "./chunk-Q5LECKZL.js";
20
20
  import {
21
21
  projectIdentity
22
22
  } from "./chunk-2HCJV6UO.js";
@@ -371,4 +371,4 @@ export {
371
371
  isNativeHookDeclared,
372
372
  runNativeHook
373
373
  };
374
- //# sourceMappingURL=chunk-E45SUUD7.js.map
374
+ //# sourceMappingURL=chunk-24K6JOKV.js.map
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  installInstructions,
4
4
  packageConnector
5
- } from "./chunk-ZEFUDBTY.js";
5
+ } from "./chunk-OEQJGBBW.js";
6
6
  import {
7
7
  MARKETPLACE_NAME,
8
8
  agyPluginInstalled,
@@ -44,7 +44,7 @@ import {
44
44
  } from "./chunk-7QRUZAUG.js";
45
45
  import {
46
46
  detectInstalledPlatforms
47
- } from "./chunk-GCRRX4MO.js";
47
+ } from "./chunk-TW4DVR4V.js";
48
48
  import {
49
49
  log
50
50
  } from "./chunk-KHO5WNTP.js";
@@ -52,14 +52,17 @@ import {
52
52
  deregisterConnector,
53
53
  loadRegisteredConnector,
54
54
  registerConnector
55
- } from "./chunk-RQCBBLTA.js";
55
+ } from "./chunk-5LAFKXFM.js";
56
56
  import {
57
57
  REGISTERED_PLATFORM_IDS,
58
58
  loadAdapter
59
- } from "./chunk-LS65GL2P.js";
59
+ } from "./chunk-Q5LECKZL.js";
60
60
  import {
61
61
  configPatchManualEdit
62
62
  } from "./chunk-7CZKXXBD.js";
63
+ import {
64
+ findUnsetEnvRefs
65
+ } from "./chunk-BEFVJ2OE.js";
63
66
  import {
64
67
  hasMemoryLedger
65
68
  } from "./chunk-ALVXORZM.js";
@@ -124,7 +127,23 @@ async function installConnector(opts) {
124
127
  });
125
128
  }
126
129
  runStep(id, "installServer", result, () => {
127
- pushAll(result.changes, adapter.installServer(ctx));
130
+ const serverChanges = adapter.installServer(ctx);
131
+ pushAll(result.changes, serverChanges);
132
+ if (!(adapter.capabilities.nativeServerEnvInterpolation ?? false)) {
133
+ const wroteEntry = serverChanges.some(
134
+ (c) => c.action === "create" || c.action === "update"
135
+ );
136
+ const server = effectiveServerFor(connector, id);
137
+ if (wroteEntry && server) {
138
+ for (const name of findUnsetEnvRefs(serverSecretFields(server))) {
139
+ result.changes.push({
140
+ platform: id,
141
+ action: "warn",
142
+ detail: `${name} is unset \u2014 baking an empty value into ${id} config (export it before install, or give the ref a \${env:${name}:-default})`
143
+ });
144
+ }
145
+ }
146
+ }
128
147
  });
129
148
  runStep(id, "installHooks", result, () => {
130
149
  pushAll(result.changes, adapter.installHooks(ctx));
@@ -391,6 +410,22 @@ function buildContext(connector, id, defaultScope, projectDir, dryRun, force = f
391
410
  force
392
411
  };
393
412
  }
413
+ function effectiveServerFor(connector, id) {
414
+ const override = connector.platforms[id]?.server;
415
+ if (override === false) return void 0;
416
+ const base = connector.server;
417
+ if (!base) return void 0;
418
+ return override && typeof override === "object" ? { ...base, ...override } : base;
419
+ }
420
+ function serverSecretFields(server) {
421
+ return {
422
+ command: server.command,
423
+ args: server.args,
424
+ env: server.env,
425
+ url: server.url,
426
+ headers: server.headers
427
+ };
428
+ }
394
429
  async function tryLoadAdapter(id, result) {
395
430
  try {
396
431
  const adapter = await loadAdapter(id);
@@ -3038,4 +3073,4 @@ export {
3038
3073
  upgradeViaMarketplace,
3039
3074
  marketplaceDoctorChecks
3040
3075
  };
3041
- //# sourceMappingURL=chunk-IZ4XQ23W.js.map
3076
+ //# sourceMappingURL=chunk-2L6LTQ6L.js.map