@ken-jo/agent-connector 0.4.61 → 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.
- package/README.md +43 -6
- package/dist/{action-AIB2W4DU.js → action-TCKBTTZX.js} +12 -12
- package/dist/{amazon-q-PH7OFPJD.js → amazon-q-CB4XFX7T.js} +5 -5
- package/dist/{amp-ZYRC2VCH.js → amp-6Q5OYHNW.js} +9 -5
- package/dist/amp-6Q5OYHNW.js.map +1 -0
- package/dist/{antigravity-PM5NMS2J.js → antigravity-WIK3XBN5.js} +6 -6
- package/dist/{antigravity-cli-LN25XGWX.js → antigravity-cli-L3RZMF6V.js} +6 -6
- package/dist/{chunk-NFMHYIN2.js → chunk-24K6JOKV.js} +5 -5
- package/dist/{chunk-D65GIBCG.js → chunk-2HCJV6UO.js} +13 -14
- package/dist/chunk-2HCJV6UO.js.map +1 -0
- package/dist/{chunk-FVARNRCE.js → chunk-2L6LTQ6L.js} +45 -10
- package/dist/chunk-2L6LTQ6L.js.map +1 -0
- package/dist/{chunk-O4BKQSPP.js → chunk-5LAFKXFM.js} +3 -3
- package/dist/{chunk-BZOOVTFG.js → chunk-7CZKXXBD.js} +2 -2
- package/dist/{chunk-JZIM33C2.js → chunk-7ITLLYWB.js} +5 -5
- package/dist/{chunk-LBOGRZGY.js → chunk-ALVXORZM.js} +2 -2
- package/dist/{chunk-WOUGWPZQ.js → chunk-AXAHW2KU.js} +2 -2
- package/dist/{chunk-DBQMX75U.js → chunk-BEFVJ2OE.js} +28 -2
- package/dist/chunk-BEFVJ2OE.js.map +1 -0
- package/dist/{chunk-ZQCT63JU.js → chunk-D6ZJS4ND.js} +2 -2
- package/dist/{chunk-O3HIYTBK.js → chunk-DI6OWKH2.js} +7 -3
- package/dist/chunk-DI6OWKH2.js.map +1 -0
- package/dist/chunk-ECSRTK4M.js +386 -0
- package/dist/chunk-ECSRTK4M.js.map +1 -0
- package/dist/{chunk-C3TFA4CJ.js → chunk-FUXUEXDP.js} +3 -3
- package/dist/{chunk-KAEYJGK7.js → chunk-HKM3HUOK.js} +19 -19
- package/dist/{chunk-KAEYJGK7.js.map → chunk-HKM3HUOK.js.map} +1 -1
- package/dist/{chunk-AEQRMVRB.js → chunk-IU42THN7.js} +2 -2
- package/dist/{chunk-AAOYOAQT.js → chunk-MDZG5QHB.js} +49 -3
- package/dist/chunk-MDZG5QHB.js.map +1 -0
- package/dist/{chunk-RFYQXT7C.js → chunk-MHDQWZ4A.js} +7 -7
- package/dist/{chunk-GI4FDVWI.js → chunk-NUGMVVV2.js} +4 -4
- package/dist/chunk-NUGMVVV2.js.map +1 -0
- package/dist/{chunk-RGQTN7K3.js → chunk-OEQJGBBW.js} +5 -5
- package/dist/{chunk-4K5HEGVE.js → chunk-Q42SEI7W.js} +11 -11
- package/dist/chunk-Q42SEI7W.js.map +1 -0
- package/dist/{chunk-IDKI42JW.js → chunk-Q5LECKZL.js} +36 -36
- package/dist/{chunk-QP35SRUZ.js → chunk-TW4DVR4V.js} +2 -2
- package/dist/{chunk-3QCDVSMX.js → chunk-TZ5KGCE2.js} +2 -2
- package/dist/{claude-code-GCXXEWUN.js → claude-code-HFBAAVWS.js} +13 -9
- package/dist/claude-code-HFBAAVWS.js.map +1 -0
- package/dist/cli/sdk.js +7 -7
- package/dist/cli.js +1 -1
- package/dist/{cline-KHZLG7CU.js → cline-26W4FEZ6.js} +5 -5
- package/dist/{codebuff-EQGWZEP4.js → codebuff-J5KEEBIL.js} +9 -5
- package/dist/codebuff-J5KEEBIL.js.map +1 -0
- package/dist/{codex-7X7RC6JJ.js → codex-JKQ6TLRI.js} +18 -25
- package/dist/codex-JKQ6TLRI.js.map +1 -0
- package/dist/{continue-V4MB3WQ3.js → continue-KQSJUSWX.js} +6 -6
- package/dist/{copilot-cli-7EPIJHFM.js → copilot-cli-YBNKLYUB.js} +121 -43
- package/dist/copilot-cli-YBNKLYUB.js.map +1 -0
- package/dist/{crush-3AAA75C5.js → crush-JTWTZIPB.js} +22 -12
- package/dist/crush-JTWTZIPB.js.map +1 -0
- package/dist/{cursor-DTYZROKS.js → cursor-2NIZSDZ4.js} +6 -6
- package/dist/{detect-LWZEM7SN.js → detect-CWEIQCRC.js} +4 -4
- package/dist/{doctor-54P4JFA6.js → doctor-AC437ZAW.js} +99 -17
- package/dist/doctor-AC437ZAW.js.map +1 -0
- package/dist/{droid-QMNO5WZ2.js → droid-HF2AIFB2.js} +5 -5
- package/dist/{gemini-cli-7JU7ZWQL.js → gemini-cli-2EOK26S2.js} +5 -5
- package/dist/{goose-36TJNDKD.js → goose-55JOTXS5.js} +6 -6
- package/dist/{hermes-S4JZ6H42.js → hermes-QVZOZU4B.js} +6 -6
- package/dist/{hook-UT3Q43AB.js → hook-VYD3OCLM.js} +12 -12
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/{install-F4OIDYAK.js → install-S6BYIJ62.js} +15 -15
- package/dist/{introspect-BFcXpfUp.d.ts → introspect-5o5ick0_.d.ts} +9 -4
- package/dist/{jetbrains-copilot-6QLKUCAY.js → jetbrains-copilot-DZ2ATXFN.js} +6 -7
- package/dist/jetbrains-copilot-DZ2ATXFN.js.map +1 -0
- package/dist/{kilo-WLZOYKZK.js → kilo-GJNSBWVV.js} +5 -5
- package/dist/{kilo-cli-FBX4OFIZ.js → kilo-cli-2CCB3DBI.js} +5 -5
- package/dist/{kimi-7YXRAQ6Z.js → kimi-YRPCSB6N.js} +5 -5
- package/dist/{kiro-CSBQA6EX.js → kiro-BUOQFASX.js} +5 -5
- package/dist/{leaderboard-ZIAXBUWD.js → leaderboard-SUSUDKHR.js} +5 -5
- package/dist/{mimo-code-GYJNEULG.js → mimo-code-V4FP5PUJ.js} +5 -5
- package/dist/{mux-DAIC3VY7.js → mux-CMJSM42O.js} +5 -5
- package/dist/{nemoclaw-GS3XA7V2.js → nemoclaw-VP56PGKC.js} +6 -6
- package/dist/{omp-O6KNB4MM.js → omp-OOFGD3GG.js} +5 -5
- package/dist/openclaw-V73XHPXP.js +17 -0
- package/dist/{opencode-JPHRZPDQ.js → opencode-MKLHSQRD.js} +5 -5
- package/dist/{package-5FRMSWRT.js → package-KOAAVKHH.js} +12 -12
- package/dist/{pi-EFBTBI2B.js → pi-NMVL7OFL.js} +4 -4
- package/dist/{qwen-code-CLSMTMHX.js → qwen-code-2XE2T6F4.js} +6 -6
- package/dist/{roo-code-YIX3RPR2.js → roo-code-YJOIKCCS.js} +5 -5
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +10 -10
- package/dist/sdk/index.d.ts +3 -3
- package/dist/sdk/index.js +6 -6
- package/dist/sdk/test.d.ts +33 -3
- package/dist/sdk/test.js +14 -284
- package/dist/sdk/test.js.map +1 -1
- package/dist/{serve-NQBXN4FG.js → serve-BU23QUSJ.js} +12 -12
- package/dist/{status-5ZM6LXHV.js → status-N5LCQQ3R.js} +10 -10
- package/dist/{statusline-O76BCBUK.js → statusline-442XOF7R.js} +11 -11
- package/dist/{telemetry-NO7UUUSJ.js → telemetry-V4YQL2NU.js} +10 -10
- package/dist/{trae-JESXQKAF.js → trae-QSV2JZFT.js} +5 -5
- package/dist/{types-ChUrvw0j.d.ts → types-D6RWGXm1.d.ts} +13 -0
- package/dist/{uninstall-QCROBR6A.js → uninstall-WGEKTCDZ.js} +22 -15
- package/dist/uninstall-WGEKTCDZ.js.map +1 -0
- package/dist/{upgrade-KJ4QRZDZ.js → upgrade-IH7CKPTO.js} +15 -15
- package/dist/{usage-UY6DCND6.js → usage-DI7XRCKM.js} +2 -2
- package/dist/{usage-event-T4HWQDZF.js → usage-event-2FCU55AN.js} +11 -11
- package/dist/{vscode-copilot-56USZ5X4.js → vscode-copilot-R23RTVST.js} +9 -5
- package/dist/vscode-copilot-R23RTVST.js.map +1 -0
- package/dist/{warp-Y6JNLLGR.js → warp-B72XSQ5G.js} +5 -5
- package/dist/{windsurf-X7QCJ3XR.js → windsurf-642VBMQ2.js} +5 -5
- package/dist/{zed-L3ML5MHF.js → zed-6UJS7JKB.js} +5 -5
- package/package.json +1 -1
- package/dist/amp-ZYRC2VCH.js.map +0 -1
- package/dist/chunk-4K5HEGVE.js.map +0 -1
- package/dist/chunk-AAOYOAQT.js.map +0 -1
- package/dist/chunk-D65GIBCG.js.map +0 -1
- package/dist/chunk-DBQMX75U.js.map +0 -1
- package/dist/chunk-FVARNRCE.js.map +0 -1
- package/dist/chunk-GI4FDVWI.js.map +0 -1
- package/dist/chunk-O3HIYTBK.js.map +0 -1
- package/dist/claude-code-GCXXEWUN.js.map +0 -1
- package/dist/codebuff-EQGWZEP4.js.map +0 -1
- package/dist/codex-7X7RC6JJ.js.map +0 -1
- package/dist/copilot-cli-7EPIJHFM.js.map +0 -1
- package/dist/crush-3AAA75C5.js.map +0 -1
- package/dist/doctor-54P4JFA6.js.map +0 -1
- package/dist/jetbrains-copilot-6QLKUCAY.js.map +0 -1
- package/dist/openclaw-344VBMLY.js +0 -17
- package/dist/uninstall-QCROBR6A.js.map +0 -1
- package/dist/vscode-copilot-56USZ5X4.js.map +0 -1
- /package/dist/{action-AIB2W4DU.js.map → action-TCKBTTZX.js.map} +0 -0
- /package/dist/{amazon-q-PH7OFPJD.js.map → amazon-q-CB4XFX7T.js.map} +0 -0
- /package/dist/{antigravity-PM5NMS2J.js.map → antigravity-WIK3XBN5.js.map} +0 -0
- /package/dist/{antigravity-cli-LN25XGWX.js.map → antigravity-cli-L3RZMF6V.js.map} +0 -0
- /package/dist/{chunk-NFMHYIN2.js.map → chunk-24K6JOKV.js.map} +0 -0
- /package/dist/{chunk-O4BKQSPP.js.map → chunk-5LAFKXFM.js.map} +0 -0
- /package/dist/{chunk-BZOOVTFG.js.map → chunk-7CZKXXBD.js.map} +0 -0
- /package/dist/{chunk-JZIM33C2.js.map → chunk-7ITLLYWB.js.map} +0 -0
- /package/dist/{chunk-LBOGRZGY.js.map → chunk-ALVXORZM.js.map} +0 -0
- /package/dist/{chunk-WOUGWPZQ.js.map → chunk-AXAHW2KU.js.map} +0 -0
- /package/dist/{chunk-ZQCT63JU.js.map → chunk-D6ZJS4ND.js.map} +0 -0
- /package/dist/{chunk-C3TFA4CJ.js.map → chunk-FUXUEXDP.js.map} +0 -0
- /package/dist/{chunk-AEQRMVRB.js.map → chunk-IU42THN7.js.map} +0 -0
- /package/dist/{chunk-RFYQXT7C.js.map → chunk-MHDQWZ4A.js.map} +0 -0
- /package/dist/{chunk-RGQTN7K3.js.map → chunk-OEQJGBBW.js.map} +0 -0
- /package/dist/{chunk-IDKI42JW.js.map → chunk-Q5LECKZL.js.map} +0 -0
- /package/dist/{chunk-QP35SRUZ.js.map → chunk-TW4DVR4V.js.map} +0 -0
- /package/dist/{chunk-3QCDVSMX.js.map → chunk-TZ5KGCE2.js.map} +0 -0
- /package/dist/{cline-KHZLG7CU.js.map → cline-26W4FEZ6.js.map} +0 -0
- /package/dist/{continue-V4MB3WQ3.js.map → continue-KQSJUSWX.js.map} +0 -0
- /package/dist/{cursor-DTYZROKS.js.map → cursor-2NIZSDZ4.js.map} +0 -0
- /package/dist/{detect-LWZEM7SN.js.map → detect-CWEIQCRC.js.map} +0 -0
- /package/dist/{droid-QMNO5WZ2.js.map → droid-HF2AIFB2.js.map} +0 -0
- /package/dist/{gemini-cli-7JU7ZWQL.js.map → gemini-cli-2EOK26S2.js.map} +0 -0
- /package/dist/{goose-36TJNDKD.js.map → goose-55JOTXS5.js.map} +0 -0
- /package/dist/{hermes-S4JZ6H42.js.map → hermes-QVZOZU4B.js.map} +0 -0
- /package/dist/{hook-UT3Q43AB.js.map → hook-VYD3OCLM.js.map} +0 -0
- /package/dist/{install-F4OIDYAK.js.map → install-S6BYIJ62.js.map} +0 -0
- /package/dist/{kilo-WLZOYKZK.js.map → kilo-GJNSBWVV.js.map} +0 -0
- /package/dist/{kilo-cli-FBX4OFIZ.js.map → kilo-cli-2CCB3DBI.js.map} +0 -0
- /package/dist/{kimi-7YXRAQ6Z.js.map → kimi-YRPCSB6N.js.map} +0 -0
- /package/dist/{kiro-CSBQA6EX.js.map → kiro-BUOQFASX.js.map} +0 -0
- /package/dist/{leaderboard-ZIAXBUWD.js.map → leaderboard-SUSUDKHR.js.map} +0 -0
- /package/dist/{mimo-code-GYJNEULG.js.map → mimo-code-V4FP5PUJ.js.map} +0 -0
- /package/dist/{mux-DAIC3VY7.js.map → mux-CMJSM42O.js.map} +0 -0
- /package/dist/{nemoclaw-GS3XA7V2.js.map → nemoclaw-VP56PGKC.js.map} +0 -0
- /package/dist/{omp-O6KNB4MM.js.map → omp-OOFGD3GG.js.map} +0 -0
- /package/dist/{openclaw-344VBMLY.js.map → openclaw-V73XHPXP.js.map} +0 -0
- /package/dist/{opencode-JPHRZPDQ.js.map → opencode-MKLHSQRD.js.map} +0 -0
- /package/dist/{package-5FRMSWRT.js.map → package-KOAAVKHH.js.map} +0 -0
- /package/dist/{pi-EFBTBI2B.js.map → pi-NMVL7OFL.js.map} +0 -0
- /package/dist/{qwen-code-CLSMTMHX.js.map → qwen-code-2XE2T6F4.js.map} +0 -0
- /package/dist/{roo-code-YIX3RPR2.js.map → roo-code-YJOIKCCS.js.map} +0 -0
- /package/dist/{serve-NQBXN4FG.js.map → serve-BU23QUSJ.js.map} +0 -0
- /package/dist/{status-5ZM6LXHV.js.map → status-N5LCQQ3R.js.map} +0 -0
- /package/dist/{statusline-O76BCBUK.js.map → statusline-442XOF7R.js.map} +0 -0
- /package/dist/{telemetry-NO7UUUSJ.js.map → telemetry-V4YQL2NU.js.map} +0 -0
- /package/dist/{trae-JESXQKAF.js.map → trae-QSV2JZFT.js.map} +0 -0
- /package/dist/{upgrade-KJ4QRZDZ.js.map → upgrade-IH7CKPTO.js.map} +0 -0
- /package/dist/{usage-UY6DCND6.js.map → usage-DI7XRCKM.js.map} +0 -0
- /package/dist/{usage-event-T4HWQDZF.js.map → usage-event-2FCU55AN.js.map} +0 -0
- /package/dist/{warp-Y6JNLLGR.js.map → warp-B72XSQ5G.js.map} +0 -0
- /package/dist/{windsurf-X7QCJ3XR.js.map → windsurf-642VBMQ2.js.map} +0 -0
- /package/dist/{zed-L3ML5MHF.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.
|
|
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: [
|
|
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://
|
|
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,23 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
fail
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-HKM3HUOK.js";
|
|
5
5
|
import {
|
|
6
6
|
runAction
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-MHDQWZ4A.js";
|
|
8
8
|
import "./chunk-OP4KBXUO.js";
|
|
9
9
|
import "./chunk-7QRUZAUG.js";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-TW4DVR4V.js";
|
|
11
|
+
import "./chunk-24K6JOKV.js";
|
|
12
|
+
import "./chunk-D6ZJS4ND.js";
|
|
13
13
|
import "./chunk-KHO5WNTP.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-5LAFKXFM.js";
|
|
15
|
+
import "./chunk-7ITLLYWB.js";
|
|
16
|
+
import "./chunk-Q5LECKZL.js";
|
|
17
|
+
import "./chunk-7CZKXXBD.js";
|
|
18
18
|
import "./chunk-TO57WYBB.js";
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-ALVXORZM.js";
|
|
20
|
+
import "./chunk-2HCJV6UO.js";
|
|
21
21
|
|
|
22
22
|
// src/cli/commands/action.ts
|
|
23
23
|
import { parseArgs } from "util";
|
|
@@ -52,4 +52,4 @@ async function run(argv) {
|
|
|
52
52
|
export {
|
|
53
53
|
run
|
|
54
54
|
};
|
|
55
|
-
//# sourceMappingURL=action-
|
|
55
|
+
//# sourceMappingURL=action-TCKBTTZX.js.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
resolveEnvRefsDeep
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BEFVJ2OE.js";
|
|
5
5
|
import {
|
|
6
6
|
BaseAdapter
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-NUGMVVV2.js";
|
|
8
8
|
import {
|
|
9
9
|
buildWrappedStdio,
|
|
10
10
|
isHomeBinHookCommand
|
|
11
11
|
} from "./chunk-TO57WYBB.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-ALVXORZM.js";
|
|
13
|
+
import "./chunk-2HCJV6UO.js";
|
|
14
14
|
|
|
15
15
|
// src/adapters/amazon-q/index.ts
|
|
16
16
|
import { existsSync, statSync } from "fs";
|
|
@@ -563,4 +563,4 @@ export {
|
|
|
563
563
|
adapter,
|
|
564
564
|
amazon_q_default as default
|
|
565
565
|
};
|
|
566
|
-
//# sourceMappingURL=amazon-q-
|
|
566
|
+
//# sourceMappingURL=amazon-q-CB4XFX7T.js.map
|
|
@@ -4,16 +4,16 @@ import {
|
|
|
4
4
|
} from "./chunk-FBJQGRET.js";
|
|
5
5
|
import {
|
|
6
6
|
rewriteEnvRefs
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-BEFVJ2OE.js";
|
|
8
8
|
import {
|
|
9
9
|
BaseAdapter,
|
|
10
10
|
renderSkillMd
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-NUGMVVV2.js";
|
|
12
12
|
import {
|
|
13
13
|
buildWrappedStdio
|
|
14
14
|
} from "./chunk-TO57WYBB.js";
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-ALVXORZM.js";
|
|
16
|
+
import "./chunk-2HCJV6UO.js";
|
|
17
17
|
|
|
18
18
|
// src/adapters/amp/index.ts
|
|
19
19
|
import { existsSync } from "fs";
|
|
@@ -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-
|
|
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,EACpD,KAAiB;AAAA,EACjB,OAAO;AAAA,EACP,WAAyB;AAAA,EAEzB,eAAqC;AAAA;AAAA;AAAA,IAG5C,gBAAgB;AAAA;AAAA;AAAA,IAGhB,YAAY;AAAA,IACZ,aAAa;AAAA;AAAA,IAEb,YAAY;AAAA,IACZ,cAAc;AAAA;AAAA,IAEd,YAAY;AAAA,IACZ,kBAAkB;AAAA,IAClB,MAAM;AAAA,IACN,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAUd,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMf,iBAAiB;AA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|
|
9
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-BEFVJ2OE.js";
|
|
9
|
+
import "./chunk-NUGMVVV2.js";
|
|
10
10
|
import "./chunk-TO57WYBB.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-ALVXORZM.js";
|
|
12
|
+
import "./chunk-2HCJV6UO.js";
|
|
13
13
|
export {
|
|
14
14
|
AntigravityAdapter,
|
|
15
15
|
adapter,
|
|
16
16
|
antigravity_default as default
|
|
17
17
|
};
|
|
18
|
-
//# sourceMappingURL=antigravity-
|
|
18
|
+
//# sourceMappingURL=antigravity-WIK3XBN5.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
AntigravityAdapter
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-Q42SEI7W.js";
|
|
5
5
|
import "./chunk-H53QZQJI.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-BEFVJ2OE.js";
|
|
7
|
+
import "./chunk-NUGMVVV2.js";
|
|
8
8
|
import "./chunk-TO57WYBB.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-ALVXORZM.js";
|
|
10
|
+
import "./chunk-2HCJV6UO.js";
|
|
11
11
|
|
|
12
12
|
// src/adapters/antigravity-cli/index.ts
|
|
13
13
|
import { existsSync } from "fs";
|
|
@@ -84,4 +84,4 @@ export {
|
|
|
84
84
|
adapter,
|
|
85
85
|
antigravity_cli_default as default
|
|
86
86
|
};
|
|
87
|
-
//# sourceMappingURL=antigravity-cli-
|
|
87
|
+
//# sourceMappingURL=antigravity-cli-L3RZMF6V.js.map
|
|
@@ -5,21 +5,21 @@ import {
|
|
|
5
5
|
newRecordId,
|
|
6
6
|
openStore,
|
|
7
7
|
worstConfidence
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-D6ZJS4ND.js";
|
|
9
9
|
import {
|
|
10
10
|
log
|
|
11
11
|
} from "./chunk-KHO5WNTP.js";
|
|
12
12
|
import {
|
|
13
13
|
loadRegisteredConnector,
|
|
14
14
|
readRegisteredMeta
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-5LAFKXFM.js";
|
|
16
16
|
import {
|
|
17
17
|
REGISTERED_PLATFORM_IDS,
|
|
18
18
|
loadAdapter
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-Q5LECKZL.js";
|
|
20
20
|
import {
|
|
21
21
|
projectIdentity
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-2HCJV6UO.js";
|
|
23
23
|
|
|
24
24
|
// src/runtime/telemetry-accessor.ts
|
|
25
25
|
var ZERO = {
|
|
@@ -371,4 +371,4 @@ export {
|
|
|
371
371
|
isNativeHookDeclared,
|
|
372
372
|
runNativeHook
|
|
373
373
|
};
|
|
374
|
-
//# sourceMappingURL=chunk-
|
|
374
|
+
//# sourceMappingURL=chunk-24K6JOKV.js.map
|
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
// src/core/paths.ts
|
|
4
|
-
import { createHash } from "crypto";
|
|
5
|
-
import {
|
|
6
|
-
chmodSync,
|
|
7
|
-
existsSync,
|
|
8
|
-
lstatSync,
|
|
9
|
-
mkdirSync,
|
|
10
|
-
readFileSync,
|
|
11
|
-
writeFileSync
|
|
12
|
-
} from "fs";
|
|
13
|
-
import { homedir } from "os";
|
|
14
|
-
import { basename, isAbsolute, join, parse, relative, resolve, sep } from "path";
|
|
15
|
-
|
|
16
3
|
// src/core/ids.ts
|
|
17
4
|
var CONNECTOR_ID_RE = /^[a-z0-9][a-z0-9-]*$/;
|
|
18
5
|
function isValidConnectorId(id) {
|
|
@@ -26,6 +13,17 @@ function assertConnectorId(id, label = "connector id") {
|
|
|
26
13
|
}
|
|
27
14
|
|
|
28
15
|
// src/core/paths.ts
|
|
16
|
+
import { createHash } from "crypto";
|
|
17
|
+
import {
|
|
18
|
+
chmodSync,
|
|
19
|
+
existsSync,
|
|
20
|
+
lstatSync,
|
|
21
|
+
mkdirSync,
|
|
22
|
+
readFileSync,
|
|
23
|
+
writeFileSync
|
|
24
|
+
} from "fs";
|
|
25
|
+
import { homedir } from "os";
|
|
26
|
+
import { basename, isAbsolute, join, parse, relative, resolve, sep } from "path";
|
|
29
27
|
function dataRoot() {
|
|
30
28
|
const override = process.env.AGENT_CONNECTOR_DATA_DIR;
|
|
31
29
|
if (override && override.trim() !== "") return resolve(override);
|
|
@@ -130,6 +128,7 @@ function projectIdentity(projectDir) {
|
|
|
130
128
|
export {
|
|
131
129
|
CONNECTOR_ID_RE,
|
|
132
130
|
isValidConnectorId,
|
|
131
|
+
assertConnectorId,
|
|
133
132
|
dataRoot,
|
|
134
133
|
connectorsDir,
|
|
135
134
|
connectorDir,
|
|
@@ -142,4 +141,4 @@ export {
|
|
|
142
141
|
ensureHomeBin,
|
|
143
142
|
projectIdentity
|
|
144
143
|
};
|
|
145
|
-
//# sourceMappingURL=chunk-
|
|
144
|
+
//# sourceMappingURL=chunk-2HCJV6UO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/ids.ts","../src/core/paths.ts"],"sourcesContent":["/** Shared connector-id grammar for author-time configs and runtime ids. */\nexport const CONNECTOR_ID_RE = /^[a-z0-9][a-z0-9-]*$/;\n\nexport function isValidConnectorId(id: unknown): id is string {\n return typeof id === \"string\" && CONNECTOR_ID_RE.test(id);\n}\n\nexport function assertConnectorId(id: unknown, label = \"connector id\"): string {\n if (isValidConnectorId(id)) return id;\n throw new Error(\n `${label} must be kebab-case matching ${CONNECTOR_ID_RE} (got ${JSON.stringify(id)})`,\n );\n}\n","/**\n * core/paths — home data-root, stable home binary, and project identity.\n *\n * Operating model (docs/ARCHITECTURE.md §3):\n * • One home data-root holds the single binary + shared telemetry + state.\n * Override with AGENT_CONNECTOR_DATA_DIR (the cross-agent shared-DB key).\n * This relocates FRAMEWORK state only — never platform-native config files.\n * • The home binary lives at a STABLE path so every host's pointer config\n * keeps working across updates (no versioned cache dir → no cache-heal bug).\n * • Per-project data is keyed by a stable project identity (git remote ||\n * normalized absolute path), hashed — not by code location.\n */\n\nimport { createHash } from \"node:crypto\";\nimport {\n chmodSync,\n existsSync,\n lstatSync,\n mkdirSync,\n readFileSync,\n writeFileSync,\n} from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { basename, isAbsolute, join, parse, relative, resolve, sep } from \"node:path\";\n\nimport { assertConnectorId } from \"./ids.js\";\n\n/** Framework data-root: AGENT_CONNECTOR_DATA_DIR || ~/.agent-connector. */\nexport function dataRoot(): string {\n const override = process.env.AGENT_CONNECTOR_DATA_DIR;\n if (override && override.trim() !== \"\") return resolve(override);\n return join(homedir(), \".agent-connector\");\n}\n\nexport function connectorsDir(): string {\n return join(dataRoot(), \"connectors\");\n}\nexport function connectorDir(id: string): string {\n const root = resolve(connectorsDir());\n const safeId = assertConnectorId(id);\n const dir = resolve(root, safeId);\n const rel = relative(root, dir);\n if (rel === \"\" || rel.startsWith(\"..\") || isAbsolute(rel)) {\n throw new Error(`connector record path escapes ${root}: ${id}`);\n }\n return dir;\n}\nexport function backupsDir(): string {\n return join(dataRoot(), \"backups\");\n}\nexport function logsDir(): string {\n return join(dataRoot(), \"logs\");\n}\n\n/** Telemetry store path for the selected backend. */\nexport function telemetryPath(store: \"ndjson\" | \"sqlite\" = \"ndjson\"): string {\n return join(dataRoot(), store === \"sqlite\" ? \"telemetry.db\" : \"telemetry.ndjson\");\n}\n\n/** Stable, OS-correct path to the single home binary pointer. */\nexport function homeBinPath(): string {\n const name = process.platform === \"win32\" ? \"agent-connector.cmd\" : \"agent-connector\";\n return join(dataRoot(), \"bin\", name);\n}\n\nexport function ensureDir(dir: string): void {\n if (!existsSync(dir)) mkdirSync(dir, { recursive: true });\n}\n\n/**\n * Return the first existing symbolic-link component in `path`, or null when the\n * existing prefix is symlink-free. Stops at the first missing component so new\n * directories/files can still be created normally.\n */\nexport function firstSymlinkInPath(path: string): string | null {\n const abs = resolve(path);\n const root = parse(abs).root;\n const rest = relative(root, abs);\n if (rest === \"\") return null;\n\n let cur = root;\n for (const part of rest.split(sep)) {\n if (part === \"\") continue;\n cur = join(cur, part);\n try {\n if (lstatSync(cur).isSymbolicLink()) return cur;\n } catch (err) {\n const code = (err as NodeJS.ErrnoException).code;\n if (code === \"ENOENT\") return null;\n throw err;\n }\n }\n return null;\n}\n\nexport function assertNoSymlinkInPath(path: string): void {\n const symlink = firstSymlinkInPath(path);\n if (symlink !== null) {\n throw new Error(`${basename(path)} skipped: symbolic link in path (${symlink})`);\n }\n}\n\n/**\n * Write a stable launcher at homeBinPath() that execs the real CLI entry.\n * Avoids symlinks (Windows constraint) and versioned paths. Idempotent.\n *\n * @param cliEntry absolute path to the installed cli.js\n * @param nodePath node runtime to exec with (defaults to current process.execPath)\n * @returns the stable launcher path\n */\nexport function ensureHomeBin(cliEntry: string, nodePath: string = process.execPath): string {\n const binPath = homeBinPath();\n assertNoSymlinkInPath(binPath);\n ensureDir(join(dataRoot(), \"bin\"));\n const node = nodePath.replace(/\\\\/g, \"/\");\n const cli = cliEntry.replace(/\\\\/g, \"/\");\n if (process.platform === \"win32\") {\n writeFileSync(binPath, `@echo off\\r\\n\"${node}\" \"${cli}\" %*\\r\\n`, \"utf8\");\n } else {\n writeFileSync(binPath, `#!/bin/sh\\nexec \"${node}\" \"${cli}\" \"$@\"\\n`, \"utf8\");\n chmodSync(binPath, 0o755);\n }\n return binPath;\n}\n\n/** Read remote.origin.url from a project's .git/config without spawning git. */\nfunction gitRemoteUrl(projectDir: string): string | null {\n const cfg = join(projectDir, \".git\", \"config\");\n if (!existsSync(cfg)) return null;\n try {\n const text = readFileSync(cfg, \"utf8\");\n // Find [remote \"origin\"] ... url = X\n const lines = text.split(/\\r?\\n/);\n let inOrigin = false;\n for (const line of lines) {\n const s = line.trim();\n if (s.startsWith(\"[\")) inOrigin = /^\\[remote\\s+\"origin\"\\]$/.test(s);\n else if (inOrigin) {\n const m = s.match(/^url\\s*=\\s*(.+)$/);\n if (m && m[1]) return m[1].trim();\n }\n }\n } catch {\n /* ignore */\n }\n return null;\n}\n\nexport interface ProjectIdentity {\n /** Hashed stable key used to partition telemetry/state. */\n key: string;\n /** Human-readable label (git remote or directory name). */\n label: string;\n /** Absolute project directory. */\n dir: string;\n}\n\n/**\n * Derive a stable project identity. Prefers the git origin URL (stable across\n * clones/locations); falls back to the normalized absolute path.\n */\nexport function projectIdentity(projectDir: string): ProjectIdentity {\n const dir = resolve(projectDir);\n const remote = gitRemoteUrl(dir);\n const basis = remote ?? dir;\n const key = createHash(\"sha256\").update(basis).digest(\"hex\").slice(0, 16);\n return { key, label: remote ?? basename(dir), dir };\n}\n"],"mappings":";;;AACO,IAAM,kBAAkB;AAExB,SAAS,mBAAmB,IAA2B;AAC5D,SAAO,OAAO,OAAO,YAAY,gBAAgB,KAAK,EAAE;AAC1D;AAEO,SAAS,kBAAkB,IAAa,QAAQ,gBAAwB;AAC7E,MAAI,mBAAmB,EAAE,EAAG,QAAO;AACnC,QAAM,IAAI;AAAA,IACR,GAAG,KAAK,gCAAgC,eAAe,SAAS,KAAK,UAAU,EAAE,CAAC;AAAA,EACpF;AACF;;;ACCA,SAAS,kBAAkB;AAC3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAAe;AACxB,SAAS,UAAU,YAAY,MAAM,OAAO,UAAU,SAAS,WAAW;AAKnE,SAAS,WAAmB;AACjC,QAAM,WAAW,QAAQ,IAAI;AAC7B,MAAI,YAAY,SAAS,KAAK,MAAM,GAAI,QAAO,QAAQ,QAAQ;AAC/D,SAAO,KAAK,QAAQ,GAAG,kBAAkB;AAC3C;AAEO,SAAS,gBAAwB;AACtC,SAAO,KAAK,SAA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ACxB,QAAM,MAAM,WAAW,QAAQ,EAAE,OAAO,KAAK,EAAE,OAAO,KAAK,EAAE,MAAM,GAAG,EAAE;AACxE,SAAO,EAAE,KAAK,OAAO,UAAU,SAAS,GAAG,GAAG,IAAI;AACpD;","names":[]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
installInstructions,
|
|
4
4
|
packageConnector
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-OEQJGBBW.js";
|
|
6
6
|
import {
|
|
7
7
|
MARKETPLACE_NAME,
|
|
8
8
|
agyPluginInstalled,
|
|
@@ -38,13 +38,13 @@ import {
|
|
|
38
38
|
readMarketplaceInstalls,
|
|
39
39
|
readNpmConfig,
|
|
40
40
|
writeMarketplaceInstalls
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-AXAHW2KU.js";
|
|
42
42
|
import {
|
|
43
43
|
spawnChild
|
|
44
44
|
} from "./chunk-7QRUZAUG.js";
|
|
45
45
|
import {
|
|
46
46
|
detectInstalledPlatforms
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-TW4DVR4V.js";
|
|
48
48
|
import {
|
|
49
49
|
log
|
|
50
50
|
} from "./chunk-KHO5WNTP.js";
|
|
@@ -52,17 +52,20 @@ import {
|
|
|
52
52
|
deregisterConnector,
|
|
53
53
|
loadRegisteredConnector,
|
|
54
54
|
registerConnector
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-5LAFKXFM.js";
|
|
56
56
|
import {
|
|
57
57
|
REGISTERED_PLATFORM_IDS,
|
|
58
58
|
loadAdapter
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-Q5LECKZL.js";
|
|
60
60
|
import {
|
|
61
61
|
configPatchManualEdit
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-7CZKXXBD.js";
|
|
63
|
+
import {
|
|
64
|
+
findUnsetEnvRefs
|
|
65
|
+
} from "./chunk-BEFVJ2OE.js";
|
|
63
66
|
import {
|
|
64
67
|
hasMemoryLedger
|
|
65
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-ALVXORZM.js";
|
|
66
69
|
import {
|
|
67
70
|
connectorDir,
|
|
68
71
|
connectorsDir,
|
|
@@ -71,7 +74,7 @@ import {
|
|
|
71
74
|
ensureHomeBin,
|
|
72
75
|
firstSymlinkInPath,
|
|
73
76
|
homeBinPath
|
|
74
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-2HCJV6UO.js";
|
|
75
78
|
|
|
76
79
|
// src/core/installer.ts
|
|
77
80
|
import { existsSync, readdirSync, rmSync } from "fs";
|
|
@@ -124,7 +127,23 @@ async function installConnector(opts) {
|
|
|
124
127
|
});
|
|
125
128
|
}
|
|
126
129
|
runStep(id, "installServer", result, () => {
|
|
127
|
-
|
|
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-
|
|
3076
|
+
//# sourceMappingURL=chunk-2L6LTQ6L.js.map
|