@ken-jo/agent-connector 0.4.92 → 0.4.94

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 (167) hide show
  1. package/README.md +49 -30
  2. package/dist/{action-CVIEPX4U.js → action-VW5SACXY.js} +9 -9
  3. package/dist/{amazon-q-TIT7FIW3.js → amazon-q-ETMAGY3D.js} +3 -3
  4. package/dist/{amp-NF3OAAUG.js → amp-67BZONGF.js} +3 -3
  5. package/dist/{antigravity-7LPK7QOY.js → antigravity-VXLDLTO7.js} +4 -4
  6. package/dist/{antigravity-cli-MDEMPPAH.js → antigravity-cli-OM6SC3PE.js} +4 -4
  7. package/dist/{chunk-7UT6OB52.js → chunk-2RIFORQS.js} +2 -2
  8. package/dist/{chunk-JFXL4HYA.js → chunk-6WZODR3Z.js} +2 -2
  9. package/dist/{chunk-IBLYVAWH.js → chunk-B5W3RHTI.js} +48 -20
  10. package/dist/{chunk-IBLYVAWH.js.map → chunk-B5W3RHTI.js.map} +1 -1
  11. package/dist/{chunk-447JWFZO.js → chunk-EHP7WISI.js} +5 -5
  12. package/dist/{chunk-FBCBHEGB.js → chunk-I5TO42QC.js} +3 -3
  13. package/dist/{chunk-3C5AASHM.js → chunk-JKKU2WKG.js} +2 -2
  14. package/dist/{chunk-AY3VFNOH.js → chunk-KJLFGQQM.js} +178 -8
  15. package/dist/chunk-KJLFGQQM.js.map +1 -0
  16. package/dist/{chunk-JVO6NBTT.js → chunk-KSPMSRVU.js} +26 -14
  17. package/dist/chunk-KSPMSRVU.js.map +1 -0
  18. package/dist/{chunk-WFEHWTLM.js → chunk-MGTDQLJJ.js} +2 -2
  19. package/dist/{chunk-L26PSQTY.js → chunk-P23RVIUY.js} +4 -4
  20. package/dist/{chunk-KA55FISM.js → chunk-SILKSP2Y.js} +43 -43
  21. package/dist/{chunk-5Z36KVU2.js → chunk-TQRLMA2C.js} +19 -19
  22. package/dist/chunk-TQRLMA2C.js.map +1 -0
  23. package/dist/{chunk-JO2IM2JL.js → chunk-TTKSYJRY.js} +6 -6
  24. package/dist/{chunk-M2H7JURF.js → chunk-UMQ6NBQR.js} +2 -2
  25. package/dist/chunk-UMQ6NBQR.js.map +1 -0
  26. package/dist/{chunk-DI5S6TXJ.js → chunk-XC5SJ35F.js} +2 -2
  27. package/dist/{chunk-FO5CEXXN.js → chunk-ZMAJ2XFD.js} +2 -2
  28. package/dist/{claude-code-7RS4YVGZ.js → claude-code-DUZNOAS2.js} +6 -6
  29. package/dist/cli/sdk.d.ts +53 -12
  30. package/dist/cli/sdk.js +83 -15
  31. package/dist/cli/sdk.js.map +1 -1
  32. package/dist/cli.js +1 -1
  33. package/dist/{cline-BZQAUYPC.js → cline-25KW25IN.js} +3 -3
  34. package/dist/{codebuddy-G42IKGKB.js → codebuddy-ZNYQACMF.js} +3 -3
  35. package/dist/{codebuff-5RLTLZAU.js → codebuff-VR6JUDIY.js} +3 -3
  36. package/dist/{codex-XHAMJILX.js → codex-CPNKTXG3.js} +3 -3
  37. package/dist/{continue-JLIB7R7X.js → continue-WU2IB5KS.js} +3 -3
  38. package/dist/{copilot-cli-XZSUYNQZ.js → copilot-cli-PAP377OM.js} +3 -3
  39. package/dist/{crush-ESERLVLT.js → crush-3AVQA4YU.js} +3 -3
  40. package/dist/{cursor-FUDOV5VK.js → cursor-GSLUET3V.js} +4 -4
  41. package/dist/define-connector-LQFJL_at.d.ts +89 -0
  42. package/dist/{detect-Z5BDTY6B.js → detect-P5OA5UYM.js} +4 -4
  43. package/dist/{devin-Y7PWKVHY.js → devin-QMEM3OFA.js} +3 -3
  44. package/dist/{doctor-GAP27PP2.js → doctor-2O2Q6MIB.js} +14 -14
  45. package/dist/{droid-DTO5POTK.js → droid-MOKV53J4.js} +3 -3
  46. package/dist/{gemini-cli-RBIG6U2F.js → gemini-cli-47ZHCOZR.js} +3 -3
  47. package/dist/{goose-VGNOP5J2.js → goose-4EI5MYTI.js} +3 -3
  48. package/dist/{grok-cli-2RFBK6J3.js → grok-cli-QYQPDSVB.js} +3 -3
  49. package/dist/{hermes-NUKFWZI5.js → hermes-F75OSK3Y.js} +3 -3
  50. package/dist/{hook-XPR3AHDI.js → hook-4N3BMKIK.js} +9 -9
  51. package/dist/index.d.ts +15 -88
  52. package/dist/index.js +13 -5
  53. package/dist/{install-O32TDIZP.js → install-NPN77N3S.js} +11 -11
  54. package/dist/{introspect-BkId4LGP.d.ts → introspect-D4fEGuhN.d.ts} +1 -1
  55. package/dist/{jetbrains-copilot-FXZ5AOTS.js → jetbrains-copilot-ZGIWI6YV.js} +3 -3
  56. package/dist/{junie-TSXIZSCE.js → junie-DIFN2P22.js} +3 -3
  57. package/dist/{kilo-JLH3KVZJ.js → kilo-EMZJBEBB.js} +3 -3
  58. package/dist/{kilo-cli-5W36VJQZ.js → kilo-cli-S3GXBPAE.js} +3 -3
  59. package/dist/{kimi-R62W7HKZ.js → kimi-IQJOIY6B.js} +3 -3
  60. package/dist/{kiro-AUJMGIBL.js → kiro-BYX4HEAJ.js} +3 -3
  61. package/dist/{leaderboard-YWMOSJBC.js → leaderboard-QKB36OBR.js} +2 -2
  62. package/dist/{mimo-code-PGLFFVER.js → mimo-code-7R53QDHB.js} +3 -3
  63. package/dist/{mistral-vibe-36CZVQNQ.js → mistral-vibe-LHJ55FSB.js} +3 -3
  64. package/dist/{mux-HWL4N5KH.js → mux-NYCNGL43.js} +3 -3
  65. package/dist/{nemoclaw-QPHETUXM.js → nemoclaw-WSIPSE7U.js} +4 -4
  66. package/dist/{omp-3TFMTJ5U.js → omp-562NK5BJ.js} +3 -3
  67. package/dist/{open-interpreter-UTBKE2EH.js → open-interpreter-I2CNOEXY.js} +3 -3
  68. package/dist/{openclaw-RYFO5TLY.js → openclaw-7EYBQS4R.js} +4 -4
  69. package/dist/{opencode-JX7GBE5Q.js → opencode-YS4WX2E2.js} +3 -3
  70. package/dist/{openhands-AZW4PXJ3.js → openhands-QMYIKNOS.js} +3 -3
  71. package/dist/{package-2KKUGZFS.js → package-Q6DV5247.js} +9 -9
  72. package/dist/{pi-MRI3EBWU.js → pi-644FIN3A.js} +3 -3
  73. package/dist/{qwen-code-ISR6BEET.js → qwen-code-STDMX7EM.js} +3 -3
  74. package/dist/{roo-code-6TSCME4R.js → roo-code-DLPIHHQ6.js} +3 -3
  75. package/dist/runtime/index.d.ts +1 -1
  76. package/dist/runtime/index.js +7 -7
  77. package/dist/sdk/index.d.ts +4 -4
  78. package/dist/sdk/index.js +4 -4
  79. package/dist/sdk/test.d.ts +2 -2
  80. package/dist/sdk/test.js +7 -7
  81. package/dist/{serve-EPRN7F2X.js → serve-MJTTXDX4.js} +9 -9
  82. package/dist/{status-B2PG6YKR.js → status-Q3UY4NZU.js} +7 -7
  83. package/dist/{statusline-5ERFMYSM.js → statusline-QF4G724E.js} +8 -8
  84. package/dist/{telemetry-ZMCAWBWB.js → telemetry-JHVRDDNK.js} +6 -6
  85. package/dist/{trae-7KDCYIMN.js → trae-UOYD6JZZ.js} +3 -3
  86. package/dist/{types-D0RqWxT8.d.ts → types-BhcUEIJJ.d.ts} +39 -3
  87. package/dist/{uninstall-M76BHLTH.js → uninstall-H2SOV3AP.js} +11 -11
  88. package/dist/{upgrade-JLSCNAQA.js → upgrade-UCSG7L5U.js} +11 -11
  89. package/dist/{usage-5I72HWCR.js → usage-4EGIJ4TM.js} +2 -2
  90. package/dist/{usage-event-HIX4ZI45.js → usage-event-GRQE7XWT.js} +8 -8
  91. package/dist/{vscode-copilot-LILHAPJI.js → vscode-copilot-NIMH2DGU.js} +3 -3
  92. package/dist/{warp-KJUCWEA3.js → warp-QYJGKURM.js} +3 -3
  93. package/dist/{windsurf-5TGGQR5I.js → windsurf-75LLZ37C.js} +3 -3
  94. package/dist/{zed-EL3JCZ25.js → zed-HKAZXEJW.js} +3 -3
  95. package/package.json +1 -1
  96. package/dist/chunk-5Z36KVU2.js.map +0 -1
  97. package/dist/chunk-AY3VFNOH.js.map +0 -1
  98. package/dist/chunk-JVO6NBTT.js.map +0 -1
  99. package/dist/chunk-M2H7JURF.js.map +0 -1
  100. /package/dist/{action-CVIEPX4U.js.map → action-VW5SACXY.js.map} +0 -0
  101. /package/dist/{amazon-q-TIT7FIW3.js.map → amazon-q-ETMAGY3D.js.map} +0 -0
  102. /package/dist/{amp-NF3OAAUG.js.map → amp-67BZONGF.js.map} +0 -0
  103. /package/dist/{antigravity-7LPK7QOY.js.map → antigravity-VXLDLTO7.js.map} +0 -0
  104. /package/dist/{antigravity-cli-MDEMPPAH.js.map → antigravity-cli-OM6SC3PE.js.map} +0 -0
  105. /package/dist/{chunk-7UT6OB52.js.map → chunk-2RIFORQS.js.map} +0 -0
  106. /package/dist/{chunk-JFXL4HYA.js.map → chunk-6WZODR3Z.js.map} +0 -0
  107. /package/dist/{chunk-447JWFZO.js.map → chunk-EHP7WISI.js.map} +0 -0
  108. /package/dist/{chunk-FBCBHEGB.js.map → chunk-I5TO42QC.js.map} +0 -0
  109. /package/dist/{chunk-3C5AASHM.js.map → chunk-JKKU2WKG.js.map} +0 -0
  110. /package/dist/{chunk-WFEHWTLM.js.map → chunk-MGTDQLJJ.js.map} +0 -0
  111. /package/dist/{chunk-L26PSQTY.js.map → chunk-P23RVIUY.js.map} +0 -0
  112. /package/dist/{chunk-KA55FISM.js.map → chunk-SILKSP2Y.js.map} +0 -0
  113. /package/dist/{chunk-JO2IM2JL.js.map → chunk-TTKSYJRY.js.map} +0 -0
  114. /package/dist/{chunk-DI5S6TXJ.js.map → chunk-XC5SJ35F.js.map} +0 -0
  115. /package/dist/{chunk-FO5CEXXN.js.map → chunk-ZMAJ2XFD.js.map} +0 -0
  116. /package/dist/{claude-code-7RS4YVGZ.js.map → claude-code-DUZNOAS2.js.map} +0 -0
  117. /package/dist/{cline-BZQAUYPC.js.map → cline-25KW25IN.js.map} +0 -0
  118. /package/dist/{codebuddy-G42IKGKB.js.map → codebuddy-ZNYQACMF.js.map} +0 -0
  119. /package/dist/{codebuff-5RLTLZAU.js.map → codebuff-VR6JUDIY.js.map} +0 -0
  120. /package/dist/{codex-XHAMJILX.js.map → codex-CPNKTXG3.js.map} +0 -0
  121. /package/dist/{continue-JLIB7R7X.js.map → continue-WU2IB5KS.js.map} +0 -0
  122. /package/dist/{copilot-cli-XZSUYNQZ.js.map → copilot-cli-PAP377OM.js.map} +0 -0
  123. /package/dist/{crush-ESERLVLT.js.map → crush-3AVQA4YU.js.map} +0 -0
  124. /package/dist/{cursor-FUDOV5VK.js.map → cursor-GSLUET3V.js.map} +0 -0
  125. /package/dist/{detect-Z5BDTY6B.js.map → detect-P5OA5UYM.js.map} +0 -0
  126. /package/dist/{devin-Y7PWKVHY.js.map → devin-QMEM3OFA.js.map} +0 -0
  127. /package/dist/{doctor-GAP27PP2.js.map → doctor-2O2Q6MIB.js.map} +0 -0
  128. /package/dist/{droid-DTO5POTK.js.map → droid-MOKV53J4.js.map} +0 -0
  129. /package/dist/{gemini-cli-RBIG6U2F.js.map → gemini-cli-47ZHCOZR.js.map} +0 -0
  130. /package/dist/{goose-VGNOP5J2.js.map → goose-4EI5MYTI.js.map} +0 -0
  131. /package/dist/{grok-cli-2RFBK6J3.js.map → grok-cli-QYQPDSVB.js.map} +0 -0
  132. /package/dist/{hermes-NUKFWZI5.js.map → hermes-F75OSK3Y.js.map} +0 -0
  133. /package/dist/{hook-XPR3AHDI.js.map → hook-4N3BMKIK.js.map} +0 -0
  134. /package/dist/{install-O32TDIZP.js.map → install-NPN77N3S.js.map} +0 -0
  135. /package/dist/{jetbrains-copilot-FXZ5AOTS.js.map → jetbrains-copilot-ZGIWI6YV.js.map} +0 -0
  136. /package/dist/{junie-TSXIZSCE.js.map → junie-DIFN2P22.js.map} +0 -0
  137. /package/dist/{kilo-JLH3KVZJ.js.map → kilo-EMZJBEBB.js.map} +0 -0
  138. /package/dist/{kilo-cli-5W36VJQZ.js.map → kilo-cli-S3GXBPAE.js.map} +0 -0
  139. /package/dist/{kimi-R62W7HKZ.js.map → kimi-IQJOIY6B.js.map} +0 -0
  140. /package/dist/{kiro-AUJMGIBL.js.map → kiro-BYX4HEAJ.js.map} +0 -0
  141. /package/dist/{leaderboard-YWMOSJBC.js.map → leaderboard-QKB36OBR.js.map} +0 -0
  142. /package/dist/{mimo-code-PGLFFVER.js.map → mimo-code-7R53QDHB.js.map} +0 -0
  143. /package/dist/{mistral-vibe-36CZVQNQ.js.map → mistral-vibe-LHJ55FSB.js.map} +0 -0
  144. /package/dist/{mux-HWL4N5KH.js.map → mux-NYCNGL43.js.map} +0 -0
  145. /package/dist/{nemoclaw-QPHETUXM.js.map → nemoclaw-WSIPSE7U.js.map} +0 -0
  146. /package/dist/{omp-3TFMTJ5U.js.map → omp-562NK5BJ.js.map} +0 -0
  147. /package/dist/{open-interpreter-UTBKE2EH.js.map → open-interpreter-I2CNOEXY.js.map} +0 -0
  148. /package/dist/{openclaw-RYFO5TLY.js.map → openclaw-7EYBQS4R.js.map} +0 -0
  149. /package/dist/{opencode-JX7GBE5Q.js.map → opencode-YS4WX2E2.js.map} +0 -0
  150. /package/dist/{openhands-AZW4PXJ3.js.map → openhands-QMYIKNOS.js.map} +0 -0
  151. /package/dist/{package-2KKUGZFS.js.map → package-Q6DV5247.js.map} +0 -0
  152. /package/dist/{pi-MRI3EBWU.js.map → pi-644FIN3A.js.map} +0 -0
  153. /package/dist/{qwen-code-ISR6BEET.js.map → qwen-code-STDMX7EM.js.map} +0 -0
  154. /package/dist/{roo-code-6TSCME4R.js.map → roo-code-DLPIHHQ6.js.map} +0 -0
  155. /package/dist/{serve-EPRN7F2X.js.map → serve-MJTTXDX4.js.map} +0 -0
  156. /package/dist/{status-B2PG6YKR.js.map → status-Q3UY4NZU.js.map} +0 -0
  157. /package/dist/{statusline-5ERFMYSM.js.map → statusline-QF4G724E.js.map} +0 -0
  158. /package/dist/{telemetry-ZMCAWBWB.js.map → telemetry-JHVRDDNK.js.map} +0 -0
  159. /package/dist/{trae-7KDCYIMN.js.map → trae-UOYD6JZZ.js.map} +0 -0
  160. /package/dist/{uninstall-M76BHLTH.js.map → uninstall-H2SOV3AP.js.map} +0 -0
  161. /package/dist/{upgrade-JLSCNAQA.js.map → upgrade-UCSG7L5U.js.map} +0 -0
  162. /package/dist/{usage-5I72HWCR.js.map → usage-4EGIJ4TM.js.map} +0 -0
  163. /package/dist/{usage-event-HIX4ZI45.js.map → usage-event-GRQE7XWT.js.map} +0 -0
  164. /package/dist/{vscode-copilot-LILHAPJI.js.map → vscode-copilot-NIMH2DGU.js.map} +0 -0
  165. /package/dist/{warp-KJUCWEA3.js.map → warp-QYJGKURM.js.map} +0 -0
  166. /package/dist/{windsurf-5TGGQR5I.js.map → windsurf-75LLZ37C.js.map} +0 -0
  167. /package/dist/{zed-EL3JCZ25.js.map → zed-HKAZXEJW.js.map} +0 -0
package/README.md CHANGED
@@ -47,10 +47,13 @@ if you already run an agent CLI and just want token totals, jump straight to
47
47
 
48
48
  ## Quick start
49
49
 
50
- agent-connector is an **SDK you depend on**, not a global tool. Add it to the
51
- package that holds your connector, declare the connector once, then `install`
52
- it deploys to every detected agent CLI in that host's own native config. The
53
- linear path is: **get a server declare it install**.
50
+ agent-connector is an **SDK connector developers depend on**. Add it to the
51
+ package that holds your connector, declare the connector once, then ship a
52
+ branded MCP package/bin such as `npx @acme/acme-db-mcp install` it deploys to
53
+ every detected agent CLI in that host's own native config. Installing
54
+ `@ken-jo/agent-connector` globally is only an optional path for connector-free
55
+ token usage reports. The linear path is:
56
+ **get a server → declare it → install through your branded package**.
54
57
 
55
58
  **0. You need an MCP server file first.** The config below points at
56
59
  `./my-mcp-server.mjs`, so that file must exist before you install. Don't have an
@@ -64,15 +67,27 @@ MCP server yet? Copy
64
67
  npm install @ken-jo/agent-connector
65
68
  ```
66
69
 
70
+ ```jsonc
71
+ // 2. package.json — this is the user-facing package identity
72
+ {
73
+ "name": "@acme/acme-db-mcp",
74
+ "mcpName": "io.github.acme/acme-db",
75
+ "bin": { "acme-db": "./bin.mjs" },
76
+ "dependencies": { "@ken-jo/agent-connector": "^0.4.92" }
77
+ }
78
+ ```
79
+
67
80
  ```js
68
- // 2. agent-connector.config.mjs — declare your server + hooks once
81
+ // 3. agent-connector.config.mjs — declare your server + hooks once
69
82
  import { fileURLToPath } from "node:url";
70
83
  import { defineConnector } from "@ken-jo/agent-connector";
71
84
 
72
85
  const serverPath = fileURLToPath(new URL("./my-mcp-server.mjs", import.meta.url));
73
86
 
74
87
  export default defineConnector({
75
- id: "acme-db",
88
+ // package.json / npm metadata is the source of truth. The host alias/runtime
89
+ // id and connector version are derived from name/mcpName/bin/version unless
90
+ // you need a multi-instance alias.
76
91
  server: {
77
92
  transport: "stdio",
78
93
  command: "node",
@@ -88,25 +103,27 @@ export default defineConnector({
88
103
  > [site quick-start](https://agent-connector.ai) teaches.
89
104
 
90
105
  ```bash
91
- # 3. deploy across the agent CLIs detected on this machine
92
- npx @ken-jo/agent-connector detect # which platforms are installed here?
93
- npx @ken-jo/agent-connector install --dry-run # preview every change first
94
- npx @ken-jo/agent-connector install # write native config in each host
106
+ # 4. deploy under your branded MCP package/bin
107
+ npx @acme/acme-db-mcp detect # which platforms are installed here?
108
+ npx @acme/acme-db-mcp install --dry-run # preview every change first
109
+ npx @acme/acme-db-mcp install # write native config in each host
95
110
  ```
96
111
 
97
112
  > `install` targets only the hosts actually **detected** on this machine (or an
98
113
  > explicit `--targets` / `connector.targets` list), intersected with the
99
114
  > 42-adapter registry — there is no "install to all 42 unconditionally" path.
100
- > A global `npm i -g` is **not** required: `npx @ken-jo/agent-connector …` runs
101
- > straight from your project.
115
+ > `@ken-jo/agent-connector` is the framework dependency underneath; use it
116
+ > directly for development fallback or connector-free token telemetry, not as
117
+ > the foreground install brand for your users.
102
118
 
103
119
  ## Ship it: direct install or a marketplace plugin
104
120
 
105
121
  Same one definition, your choice of distribution.
106
122
 
107
- **Direct install** — `agent-connector install` writes each host's native MCP +
108
- hook + content-surface config in place, with no per-platform marketplace
109
- submission or review. This is the Quick start path above.
123
+ **Direct install** — your branded command (`acme-db install`,
124
+ `npx @acme/acme-db-mcp install`) writes each host's native MCP + hook +
125
+ content-surface config in place, with no per-platform marketplace submission or
126
+ review. This is the Quick start path above.
110
127
 
111
128
  **Marketplace plugin** — `agent-connector package` turns the connector into a
112
129
  real plugin/extension bundle (manifest + bundled commands, agents, skills,
@@ -147,8 +164,15 @@ agent-connector package --format gemini-extension --out ./ext # or just one
147
164
  > **local install on that same machine/home**. For shared distribution use
148
165
  > `npm-plugin` or the MCP standard artifacts, or re-run `package` per machine.
149
166
 
150
- **Let agent-connector drive the host's own install flow** with `install --method
151
- marketplace`:
167
+ **Let your branded MCP package drive the host's own install flow** with
168
+ `install --method marketplace`:
169
+
170
+ ```bash
171
+ acme-db install --method marketplace
172
+
173
+ # framework fallback for local framework development/debugging only
174
+ npx @ken-jo/agent-connector install --method marketplace --connector ./agent-connector.config.mjs
175
+ ```
152
176
 
153
177
  - **What it does** — stages the bundle, registers a local marketplace where the
154
178
  host has one, then runs the host's plugin-install verb (or, for npm-plugin
@@ -165,24 +189,22 @@ marketplace`:
165
189
  ### Ship a branded CLI
166
190
 
167
191
  A connector developer can ship their **own** bin instead of having users type
168
- `agent-connector`. `createConnectorCli({ name, connector })` (from the
169
- `@ken-jo/agent-connector/cli` export) exposes **every** subcommand under your
170
- brand, fully delegated and **auto-scoped** to your connector — so your users
171
- never install agent-connector globally or type `--connector`. See
192
+ `agent-connector`. `createConnectorCli({ packageJson, connector })` (from the
193
+ `@ken-jo/agent-connector/cli` export) derives the bin name/version from
194
+ `package.json` and exposes **every** subcommand under your brand, fully
195
+ delegated and **auto-scoped** to your connector so your users do not need a
196
+ framework global install or `--connector` for branded MCP install/doctor/uninstall. See
172
197
  [`examples/branded-cli`](examples/branded-cli) for the full, runnable package.
173
198
 
174
199
  ```js
175
200
  #!/usr/bin/env node
176
201
  // bin.mjs — every agent-connector subcommand, branded as `acme-db`
177
- import { fileURLToPath } from "node:url";
178
202
  import { createConnectorCli } from "@ken-jo/agent-connector/cli";
179
203
 
180
204
  // run() resolves to the exit code and never calls process.exit
181
205
  process.exitCode = await createConnectorCli({
182
- name: "acme-db",
183
- connector: fileURLToPath(
184
- new URL("./agent-connector.config.mjs", import.meta.url),
185
- ),
206
+ packageJson: new URL("./package.json", import.meta.url),
207
+ connector: new URL("./agent-connector.config.mjs", import.meta.url),
186
208
  }).run();
187
209
  ```
188
210
 
@@ -210,7 +232,6 @@ import { defineConnector } from "@ken-jo/agent-connector";
210
232
  const serverPath = fileURLToPath(new URL("./my-mcp-server.mjs", import.meta.url));
211
233
 
212
234
  export default defineConnector({
213
- id: "acme-db",
214
235
  server: {
215
236
  transport: "stdio",
216
237
  command: "node", // or "npx", "python", etc. — whatever starts your server
@@ -231,7 +252,7 @@ export default defineConnector({
231
252
  });
232
253
  ```
233
254
 
234
- `agent-connector install` turns that into, e.g.:
255
+ `npx @acme/acme-db-mcp install` turns that into, e.g.:
235
256
 
236
257
  | Host | What gets written |
237
258
  |---|---|
@@ -408,8 +429,6 @@ published package + author):
408
429
 
409
430
  ```ts
410
431
  defineConnector({
411
- id: "acme-db",
412
- version: "1.2.0",
413
432
  server: { transport: "stdio", command: "npx", args: ["-y", "@acme/acme-db-mcp"] },
414
433
  publish: {
415
434
  registryNamespace: "io.github.acme", // a namespace YOU proved ownership of
@@ -1,22 +1,22 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  fail
4
- } from "./chunk-5Z36KVU2.js";
4
+ } from "./chunk-TQRLMA2C.js";
5
5
  import {
6
6
  runAction
7
- } from "./chunk-447JWFZO.js";
7
+ } from "./chunk-EHP7WISI.js";
8
8
  import "./chunk-OP4KBXUO.js";
9
9
  import "./chunk-Z2MRSS2I.js";
10
- import "./chunk-FO5CEXXN.js";
11
- import "./chunk-FBCBHEGB.js";
10
+ import "./chunk-ZMAJ2XFD.js";
11
+ import "./chunk-I5TO42QC.js";
12
12
  import "./chunk-KHO5WNTP.js";
13
13
  import "./chunk-IVAWP6HH.js";
14
- import "./chunk-JVO6NBTT.js";
15
- import "./chunk-AY3VFNOH.js";
16
- import "./chunk-KA55FISM.js";
14
+ import "./chunk-KSPMSRVU.js";
15
+ import "./chunk-KJLFGQQM.js";
16
+ import "./chunk-SILKSP2Y.js";
17
17
  import "./chunk-NBYKLUF6.js";
18
18
  import "./chunk-4NHXLXSD.js";
19
- import "./chunk-M2H7JURF.js";
19
+ import "./chunk-UMQ6NBQR.js";
20
20
  import "./chunk-GZGLCCEE.js";
21
21
 
22
22
  // src/cli/commands/action.ts
@@ -52,4 +52,4 @@ async function run(argv) {
52
52
  export {
53
53
  run
54
54
  };
55
- //# sourceMappingURL=action-CVIEPX4U.js.map
55
+ //# sourceMappingURL=action-VW5SACXY.js.map
@@ -4,12 +4,12 @@ import {
4
4
  } from "./chunk-BEFVJ2OE.js";
5
5
  import {
6
6
  BaseAdapter
7
- } from "./chunk-WFEHWTLM.js";
7
+ } from "./chunk-MGTDQLJJ.js";
8
8
  import {
9
9
  buildWrappedStdio,
10
10
  isHomeBinHookCommand
11
11
  } from "./chunk-4NHXLXSD.js";
12
- import "./chunk-M2H7JURF.js";
12
+ import "./chunk-UMQ6NBQR.js";
13
13
  import "./chunk-GZGLCCEE.js";
14
14
 
15
15
  // src/adapters/amazon-q/index.ts
@@ -563,4 +563,4 @@ export {
563
563
  adapter,
564
564
  amazon_q_default as default
565
565
  };
566
- //# sourceMappingURL=amazon-q-TIT7FIW3.js.map
566
+ //# sourceMappingURL=amazon-q-ETMAGY3D.js.map
@@ -8,11 +8,11 @@ import {
8
8
  import {
9
9
  BaseAdapter,
10
10
  renderSkillMd
11
- } from "./chunk-WFEHWTLM.js";
11
+ } from "./chunk-MGTDQLJJ.js";
12
12
  import {
13
13
  buildWrappedStdio
14
14
  } from "./chunk-4NHXLXSD.js";
15
- import "./chunk-M2H7JURF.js";
15
+ import "./chunk-UMQ6NBQR.js";
16
16
  import "./chunk-GZGLCCEE.js";
17
17
 
18
18
  // src/adapters/amp/index.ts
@@ -608,4 +608,4 @@ export {
608
608
  adapter,
609
609
  amp_default as default
610
610
  };
611
- //# sourceMappingURL=amp-NF3OAAUG.js.map
611
+ //# sourceMappingURL=amp-67BZONGF.js.map
@@ -3,16 +3,16 @@ import {
3
3
  AntigravityAdapter,
4
4
  adapter,
5
5
  antigravity_default
6
- } from "./chunk-DI5S6TXJ.js";
6
+ } from "./chunk-XC5SJ35F.js";
7
7
  import "./chunk-H53QZQJI.js";
8
8
  import "./chunk-BEFVJ2OE.js";
9
- import "./chunk-WFEHWTLM.js";
9
+ import "./chunk-MGTDQLJJ.js";
10
10
  import "./chunk-4NHXLXSD.js";
11
- import "./chunk-M2H7JURF.js";
11
+ import "./chunk-UMQ6NBQR.js";
12
12
  import "./chunk-GZGLCCEE.js";
13
13
  export {
14
14
  AntigravityAdapter,
15
15
  adapter,
16
16
  antigravity_default as default
17
17
  };
18
- //# sourceMappingURL=antigravity-7LPK7QOY.js.map
18
+ //# sourceMappingURL=antigravity-VXLDLTO7.js.map
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  AntigravityAdapter,
4
4
  adapter
5
- } from "./chunk-DI5S6TXJ.js";
5
+ } from "./chunk-XC5SJ35F.js";
6
6
  import {
7
7
  addLedgerOwner,
8
8
  createLedgerEntry,
@@ -18,12 +18,12 @@ import {
18
18
  } from "./chunk-NBYKLUF6.js";
19
19
  import "./chunk-H53QZQJI.js";
20
20
  import "./chunk-BEFVJ2OE.js";
21
- import "./chunk-WFEHWTLM.js";
21
+ import "./chunk-MGTDQLJJ.js";
22
22
  import {
23
23
  buildHomeBinStatuslineCommand,
24
24
  isHomeBinStatuslineCommand
25
25
  } from "./chunk-4NHXLXSD.js";
26
- import "./chunk-M2H7JURF.js";
26
+ import "./chunk-UMQ6NBQR.js";
27
27
  import "./chunk-GZGLCCEE.js";
28
28
 
29
29
  // src/adapters/antigravity-cli/index.ts
@@ -464,4 +464,4 @@ export {
464
464
  adapter2 as adapter,
465
465
  antigravity_cli_default as default
466
466
  };
467
- //# sourceMappingURL=antigravity-cli-MDEMPPAH.js.map
467
+ //# sourceMappingURL=antigravity-cli-OM6SC3PE.js.map
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  allAdapters,
4
4
  loadAdapter
5
- } from "./chunk-KA55FISM.js";
5
+ } from "./chunk-SILKSP2Y.js";
6
6
 
7
7
  // src/sdk/introspect.ts
8
8
  function hostCanFireEvent(c, event) {
@@ -87,4 +87,4 @@ export {
87
87
  hostsSupporting,
88
88
  surfaceSupport
89
89
  };
90
- //# sourceMappingURL=chunk-7UT6OB52.js.map
90
+ //# sourceMappingURL=chunk-2RIFORQS.js.map
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  BaseAdapter,
10
10
  renderSkillMd
11
- } from "./chunk-WFEHWTLM.js";
11
+ } from "./chunk-MGTDQLJJ.js";
12
12
  import {
13
13
  buildWrappedStdio,
14
14
  isHomeBinHookCommand
@@ -650,4 +650,4 @@ export {
650
650
  adapter,
651
651
  cursor_default
652
652
  };
653
- //# sourceMappingURL=chunk-JFXL4HYA.js.map
653
+ //# sourceMappingURL=chunk-6WZODR3Z.js.map
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  CURSOR_EVENT_MAP,
4
4
  CURSOR_HOOKS_VERSION
5
- } from "./chunk-JFXL4HYA.js";
5
+ } from "./chunk-6WZODR3Z.js";
6
6
  import {
7
7
  writeTomlString
8
8
  } from "./chunk-OPXAP3AC.js";
@@ -14,12 +14,12 @@ import {
14
14
  isConcreteSemver,
15
15
  isPlaceholderVersion,
16
16
  registryTransportType
17
- } from "./chunk-AY3VFNOH.js";
17
+ } from "./chunk-KJLFGQQM.js";
18
18
  import {
19
19
  renderCommandMd,
20
20
  renderSkillMd,
21
21
  renderSubagentMd
22
- } from "./chunk-WFEHWTLM.js";
22
+ } from "./chunk-MGTDQLJJ.js";
23
23
  import {
24
24
  buildHomeBinHookCommand,
25
25
  buildServeWrapperCommand,
@@ -506,12 +506,27 @@ var emitKimiPlugin = (connector, ctx) => {
506
506
  };
507
507
 
508
508
  // src/core/package-formats/npm.ts
509
+ import { createRequire } from "module";
509
510
  import { join as join6 } from "path";
511
+ var AGENT_CONNECTOR_PACKAGE_NAME = "@ken-jo/agent-connector";
510
512
  var EVENT_TO_OPENCODE = {
511
513
  PreToolUse: "tool.execute.before",
512
514
  PostToolUse: "tool.execute.after",
513
515
  SessionStart: "experimental.chat.system.transform"
514
516
  };
517
+ function resolveFrameworkDependencyRange() {
518
+ const req = createRequire(import.meta.url);
519
+ for (const rel of ["../../../package.json", "../../package.json", "../package.json"]) {
520
+ try {
521
+ const pkg = req(rel);
522
+ if (pkg.name === AGENT_CONNECTOR_PACKAGE_NAME && typeof pkg.version === "string" && /^\d+\.\d+\.\d+/.test(pkg.version)) {
523
+ return `^${pkg.version}`;
524
+ }
525
+ } catch {
526
+ }
527
+ }
528
+ return "*";
529
+ }
515
530
  function buildPackageJson(connector) {
516
531
  const pkgName = connector.id.startsWith("opencode-") ? connector.id : `opencode-${connector.id}`;
517
532
  const version = connector.version && connector.version !== "0.0.0" ? connector.version : "0.0.1";
@@ -523,6 +538,7 @@ function buildPackageJson(connector) {
523
538
  main: "index.js",
524
539
  exports: { ".": "./index.js" },
525
540
  keywords: ["opencode", "opencode-plugin", "pi-package", "agent-connector"],
541
+ dependencies: { [AGENT_CONNECTOR_PACKAGE_NAME]: resolveFrameworkDependencyRange() },
526
542
  // pi reads skills/prompts/themes/extensions from the package.json "pi" key.
527
543
  pi: { extensions: ["./index.js"], skills: ["./skills"] },
528
544
  engines: { node: ">=18.17", opencode: ">=1.0.0" }
@@ -536,7 +552,7 @@ function buildPackageJson(connector) {
536
552
  return pkg;
537
553
  }
538
554
  function buildIndexJs(connector) {
539
- const homeBin = JSON.stringify("agent-connector");
555
+ const frameworkPackageName = JSON.stringify(AGENT_CONNECTOR_PACKAGE_NAME);
540
556
  const connectorId = JSON.stringify(connector.id);
541
557
  const events = connector.hookEvents.filter(
542
558
  (e) => EVENT_TO_OPENCODE[e] !== void 0
@@ -546,27 +562,39 @@ function buildIndexJs(connector) {
546
562
  * AUTO-GENERATED by agent-connector \u2014 DO NOT EDIT.
547
563
  *
548
564
  * Publishable OpenCode/Kilo/Pi plugin for connector ${connector.id}. It imports
549
- * nothing from agent-connector: every hook invocation shells out to the stable
550
- * home binary's universal entrypoint and JSON-parses the normalized response.
565
+ * no public framework APIs: every hook invocation shells out to the bundled
566
+ * framework runtime's universal entrypoint and JSON-parses the normalized response.
551
567
  * Fail-open: any bridge error degrades to "allow".
552
568
  */
553
569
  import { execFileSync, execSync } from "node:child_process";
570
+ import { createRequire } from "node:module";
571
+ import { dirname, join } from "node:path";
554
572
 
555
- const HOME_BIN = ${homeBin};
573
+ const FRAMEWORK_PACKAGE_NAME = ${frameworkPackageName};
556
574
  const CONNECTOR_ID = ${connectorId};
575
+ const require = createRequire(import.meta.url);
576
+
577
+ function resolveBridgeCommand() {
578
+ try {
579
+ const pkgJson = require.resolve(FRAMEWORK_PACKAGE_NAME + "/package.json");
580
+ return { command: process.execPath, prefix: [join(dirname(pkgJson), "dist", "cli.js")] };
581
+ } catch {
582
+ return { command: "agent-connector", prefix: [] };
583
+ }
584
+ }
585
+
586
+ const BRIDGE_COMMAND = resolveBridgeCommand();
557
587
 
558
588
  function bridge(event, payload) {
559
589
  try {
560
- // The published bridge resolves HOME_BIN by bare name via the consumer's
561
- // PATH, where on Windows it is agent-connector.cmd. Node cannot execFile a
562
- // .cmd, and shell+args is deprecated (DEP0190), so on Windows run one quoted
563
- // command line via a shell (cmd.exe applies PATHEXT). POSIX keeps execFile.
564
- const args = ["hook", "opencode", event, "--connector", CONNECTOR_ID];
590
+ // Prefer the runtime bundled as this plugin's dependency. The bare
591
+ // agent-connector command is only a recovery fallback for hand-built bundles.
592
+ const args = [...BRIDGE_COMMAND.prefix, "hook", "opencode", event, "--connector", CONNECTOR_ID];
565
593
  const opts = { input: JSON.stringify(payload), encoding: "utf8" };
566
594
  const stdout =
567
- process.platform === "win32"
568
- ? execSync([HOME_BIN, ...args].map((a) => '"' + a + '"').join(" "), opts)
569
- : execFileSync(HOME_BIN, args, opts);
595
+ process.platform === "win32" && BRIDGE_COMMAND.command === "agent-connector"
596
+ ? execSync([BRIDGE_COMMAND.command, ...args].map((a) => '"' + a + '"').join(" "), opts)
597
+ : execFileSync(BRIDGE_COMMAND.command, args, opts);
570
598
  const text = (stdout || "").trim();
571
599
  if (text === "") return { decision: "allow" };
572
600
  return JSON.parse(text);
@@ -657,9 +685,9 @@ there is no uninstall verb, remove it by editing that array).
657
685
 
658
686
  ## Prerequisite
659
687
 
660
- Hooks shell out to the \`agent-connector\` CLI resolved from the consumer's PATH \u2014
661
- the consumer machine needs \`npm i -g @ken-jo/agent-connector\` (hooks silently no-op,
662
- fail-open, without it).
688
+ The generated package depends on \`@ken-jo/agent-connector\` and hooks resolve that
689
+ local runtime first. A global \`agent-connector\` binary is only a recovery fallback
690
+ for hand-built bundles; hooks silently no-op, fail-open, if neither runtime exists.
663
691
 
664
692
  ## Before you publish
665
693
 
@@ -668,7 +696,7 @@ connector declared \`publish.author\` \u2014 set them to YOUR terms before \`npm
668
696
  `
669
697
  );
670
698
  notes.push(
671
- "npm-plugin: hooks require `npm i -g @ken-jo/agent-connector` on the consumer machine (bridge resolves the CLI by name on PATH; silently fail-open without it)"
699
+ "npm-plugin: hooks resolve the bundled @ken-jo/agent-connector dependency first; a global agent-connector binary is only a recovery fallback, and hooks silently fail-open without either runtime"
672
700
  );
673
701
  notes.push(
674
702
  "npm-plugin: set license/author in the emitted package.json before `npm publish` \u2014 agent-connector does not license your plugin for you"
@@ -1084,4 +1112,4 @@ export {
1084
1112
  packageConnectorAll,
1085
1113
  installInstructions
1086
1114
  };
1087
- //# sourceMappingURL=chunk-IBLYVAWH.js.map
1115
+ //# sourceMappingURL=chunk-B5W3RHTI.js.map