@ken-jo/agent-connector 0.3.1 → 0.4.1
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 +180 -16
- package/dist/action-WT7GVRCC.js +55 -0
- package/dist/action-WT7GVRCC.js.map +1 -0
- package/dist/amazon-q-COAL3764.js +276 -0
- package/dist/amazon-q-COAL3764.js.map +1 -0
- package/dist/{amp-YGV66GJT.js → amp-4U33CU7E.js} +81 -5
- package/dist/amp-4U33CU7E.js.map +1 -0
- package/dist/{antigravity-7IBYFO6P.js → antigravity-AMKKKHS4.js} +4 -4
- package/dist/{antigravity-cli-JEOUP2VN.js → antigravity-cli-XERXEH5W.js} +4 -4
- package/dist/{chunk-3JCRUROU.js → chunk-24IDL5RW.js} +13 -4
- package/dist/chunk-24IDL5RW.js.map +1 -0
- package/dist/chunk-2AVLX7GH.js +351 -0
- package/dist/chunk-2AVLX7GH.js.map +1 -0
- package/dist/{chunk-GSGDG2BV.js → chunk-4ENJK5S2.js} +106 -176
- package/dist/chunk-4ENJK5S2.js.map +1 -0
- package/dist/{chunk-ZAM4M7LI.js → chunk-5OWS5CMA.js} +136 -296
- package/dist/chunk-5OWS5CMA.js.map +1 -0
- package/dist/{chunk-PD4VFEBY.js → chunk-CPLK7GTE.js} +79 -5
- package/dist/chunk-CPLK7GTE.js.map +1 -0
- package/dist/chunk-DCKFYWGM.js +237 -0
- package/dist/chunk-DCKFYWGM.js.map +1 -0
- package/dist/chunk-EGCBZ2DC.js +83 -0
- package/dist/chunk-EGCBZ2DC.js.map +1 -0
- package/dist/chunk-F5RX62T7.js +21 -0
- package/dist/chunk-F5RX62T7.js.map +1 -0
- package/dist/chunk-FAHIMJRU.js +177 -0
- package/dist/chunk-FAHIMJRU.js.map +1 -0
- package/dist/{chunk-MEH7GC7R.js → chunk-I5MLE6S7.js} +33 -3
- package/dist/chunk-I5MLE6S7.js.map +1 -0
- package/dist/{chunk-KVAAFYRR.js → chunk-KHO5WNTP.js} +2 -18
- package/dist/chunk-KHO5WNTP.js.map +1 -0
- package/dist/{chunk-KQSNDFBN.js → chunk-LQRAPXS4.js} +3 -3
- package/dist/{chunk-3RBLIHPZ.js → chunk-O5TWCIJN.js} +27 -17
- package/dist/chunk-O5TWCIJN.js.map +1 -0
- package/dist/{chunk-WNREHWKL.js → chunk-QREL7LZJ.js} +5 -4
- package/dist/chunk-QREL7LZJ.js.map +1 -0
- package/dist/{chunk-KMAKDD3Z.js → chunk-RIMVWCZY.js} +37 -12
- package/dist/chunk-RIMVWCZY.js.map +1 -0
- package/dist/{openclaw-UZ5BMCGQ.js → chunk-URHQMFB3.js} +210 -41
- package/dist/chunk-URHQMFB3.js.map +1 -0
- package/dist/chunk-WZA4CSGJ.js +28 -0
- package/dist/chunk-WZA4CSGJ.js.map +1 -0
- package/dist/chunk-XJ4S47CT.js +44 -0
- package/dist/chunk-XJ4S47CT.js.map +1 -0
- package/dist/{claude-code-4275HQU4.js → claude-code-W4PUFZL5.js} +194 -52
- package/dist/claude-code-W4PUFZL5.js.map +1 -0
- package/dist/cli/sdk.js +5 -3
- package/dist/cli/sdk.js.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cline-WRYMNS7Z.js +442 -0
- package/dist/cline-WRYMNS7Z.js.map +1 -0
- package/dist/{codebuff-LE3KBZGM.js → codebuff-DH5Y7GAT.js} +106 -5
- package/dist/codebuff-DH5Y7GAT.js.map +1 -0
- package/dist/{codex-4BY2ZJIW.js → codex-DDHIV767.js} +43 -11
- package/dist/codex-DDHIV767.js.map +1 -0
- package/dist/continue-K43SUHLQ.js +790 -0
- package/dist/continue-K43SUHLQ.js.map +1 -0
- package/dist/{copilot-cli-IPISKO3V.js → copilot-cli-Q3SSPT4V.js} +70 -12
- package/dist/copilot-cli-Q3SSPT4V.js.map +1 -0
- package/dist/{crush-X3E25EQG.js → crush-MBEH2R3I.js} +130 -6
- package/dist/crush-MBEH2R3I.js.map +1 -0
- package/dist/{cursor-UH3W622V.js → cursor-TMBXDYR4.js} +119 -16
- package/dist/cursor-TMBXDYR4.js.map +1 -0
- package/dist/{detect-U3E7NVNW.js → detect-KG5FG3EV.js} +5 -3
- package/dist/{detect-U3E7NVNW.js.map → detect-KG5FG3EV.js.map} +1 -1
- package/dist/{doctor-DZTWED4O.js → doctor-FLZF34Y3.js} +226 -96
- package/dist/doctor-FLZF34Y3.js.map +1 -0
- package/dist/{droid-T5VBRXZF.js → droid-JC2NT6S4.js} +298 -10
- package/dist/droid-JC2NT6S4.js.map +1 -0
- package/dist/{gemini-cli-ZSUK55UA.js → gemini-cli-ILR7M5X3.js} +62 -10
- package/dist/gemini-cli-ILR7M5X3.js.map +1 -0
- package/dist/{goose-M3RR3CZG.js → goose-SFO5BBGW.js} +112 -10
- package/dist/goose-SFO5BBGW.js.map +1 -0
- package/dist/{hermes-CUNKIAR5.js → hermes-3N7WN4WS.js} +329 -15
- package/dist/hermes-3N7WN4WS.js.map +1 -0
- package/dist/{hook-EVY7LOUQ.js → hook-XR3Z45FB.js} +16 -10
- package/dist/hook-XR3Z45FB.js.map +1 -0
- package/dist/index.d.ts +71 -3
- package/dist/index.js +23 -3
- package/dist/{install-OWAS5UIE.js → install-BSR62UHJ.js} +12 -9
- package/dist/{install-OWAS5UIE.js.map → install-BSR62UHJ.js.map} +1 -1
- package/dist/introspect-Nw8hTReX.d.ts +53 -0
- package/dist/{jetbrains-copilot-C3HDGGML.js → jetbrains-copilot-NRZHI5PC.js} +85 -18
- package/dist/jetbrains-copilot-NRZHI5PC.js.map +1 -0
- package/dist/{kilo-PKAJCWPX.js → kilo-5NWOXVSD.js} +16 -16
- package/dist/kilo-5NWOXVSD.js.map +1 -0
- package/dist/{kilo-cli-QWUVXG2O.js → kilo-cli-UZ7R5UOP.js} +3 -3
- package/dist/{kimi-EVD7YKXS.js → kimi-2YFK2GBA.js} +87 -25
- package/dist/kimi-2YFK2GBA.js.map +1 -0
- package/dist/{kiro-UQRY6EIO.js → kiro-YL6AWUYG.js} +3 -3
- package/dist/{leaderboard-CSWHI4UY.js → leaderboard-MJG24O35.js} +2 -2
- package/dist/mimo-code-FTMGSKMQ.js +790 -0
- package/dist/mimo-code-FTMGSKMQ.js.map +1 -0
- package/dist/{mux-5CI5FP2W.js → mux-5XZFB44C.js} +156 -6
- package/dist/mux-5XZFB44C.js.map +1 -0
- package/dist/nemoclaw-W5KEJ3WX.js +58 -0
- package/dist/nemoclaw-W5KEJ3WX.js.map +1 -0
- package/dist/{omp-AXA7XY22.js → omp-2QMEY6HD.js} +138 -18
- package/dist/omp-2QMEY6HD.js.map +1 -0
- package/dist/openclaw-EXJEFNZI.js +18 -0
- package/dist/openclaw-EXJEFNZI.js.map +1 -0
- package/dist/{opencode-NZBRLJN3.js → opencode-WNXYJR4X.js} +84 -27
- package/dist/opencode-WNXYJR4X.js.map +1 -0
- package/dist/{package-WFOS4QVU.js → package-ACZXJHWB.js} +8 -6
- package/dist/{package-WFOS4QVU.js.map → package-ACZXJHWB.js.map} +1 -1
- package/dist/{pi-WMTUX6ES.js → pi-PVVPVWKG.js} +3 -2
- package/dist/{pi-WMTUX6ES.js.map → pi-PVVPVWKG.js.map} +1 -1
- package/dist/{qwen-code-MRRIUQ3P.js → qwen-code-G4CXKUHR.js} +426 -10
- package/dist/qwen-code-G4CXKUHR.js.map +1 -0
- package/dist/{roo-code-NI5UU6JB.js → roo-code-67TYJIQR.js} +137 -4
- package/dist/roo-code-67TYJIQR.js.map +1 -0
- package/dist/runtime/index.d.ts +96 -2
- package/dist/runtime/index.js +19 -10
- package/dist/sdk/index.d.ts +52 -0
- package/dist/sdk/index.js +82 -0
- package/dist/sdk/index.js.map +1 -0
- package/dist/sdk/test.d.ts +74 -0
- package/dist/sdk/test.js +292 -0
- package/dist/sdk/test.js.map +1 -0
- package/dist/{serve-3C2VFPAY.js → serve-GER7URPR.js} +13 -9
- package/dist/{serve-3C2VFPAY.js.map → serve-GER7URPR.js.map} +1 -1
- package/dist/{status-MKQYX5MW.js → status-LAJE3BM5.js} +10 -7
- package/dist/{status-MKQYX5MW.js.map → status-LAJE3BM5.js.map} +1 -1
- package/dist/statusline-L376ZPZU.js +60 -0
- package/dist/statusline-L376ZPZU.js.map +1 -0
- package/dist/{telemetry-3DN6XGYB.js → telemetry-B3DX3PWU.js} +6 -4
- package/dist/{telemetry-3DN6XGYB.js.map → telemetry-B3DX3PWU.js.map} +1 -1
- package/dist/{trae-CQC72RHH.js → trae-7CZZGOGI.js} +99 -5
- package/dist/trae-7CZZGOGI.js.map +1 -0
- package/dist/{types-CNigfEuR.d.ts → types-CRVrFWeU.d.ts} +322 -18
- package/dist/{uninstall-WG6PFWF3.js → uninstall-ZYTW7YMZ.js} +12 -9
- package/dist/{uninstall-WG6PFWF3.js.map → uninstall-ZYTW7YMZ.js.map} +1 -1
- package/dist/{upgrade-32NC2RKI.js → upgrade-4LUEEOZW.js} +12 -9
- package/dist/{upgrade-32NC2RKI.js.map → upgrade-4LUEEOZW.js.map} +1 -1
- package/dist/{usage-CJOM2WQM.js → usage-ZFBVQF3H.js} +2 -2
- package/dist/{usage-event-472X3DOY.js → usage-event-GZ32AGEB.js} +12 -8
- package/dist/{usage-event-472X3DOY.js.map → usage-event-GZ32AGEB.js.map} +1 -1
- package/dist/{vscode-copilot-4RVRTCKV.js → vscode-copilot-MF2CDNMT.js} +23 -10
- package/dist/vscode-copilot-MF2CDNMT.js.map +1 -0
- package/dist/{warp-X6MB67NT.js → warp-VKG55TAT.js} +55 -4
- package/dist/warp-VKG55TAT.js.map +1 -0
- package/dist/windsurf-FU5G4SHF.js +443 -0
- package/dist/windsurf-FU5G4SHF.js.map +1 -0
- package/dist/{zed-NTCYW4V2.js → zed-SFUHL3GS.js} +3 -3
- package/package.json +10 -2
- package/dist/amp-YGV66GJT.js.map +0 -1
- package/dist/chunk-3JCRUROU.js.map +0 -1
- package/dist/chunk-3RBLIHPZ.js.map +0 -1
- package/dist/chunk-GSGDG2BV.js.map +0 -1
- package/dist/chunk-KMAKDD3Z.js.map +0 -1
- package/dist/chunk-KVAAFYRR.js.map +0 -1
- package/dist/chunk-MEH7GC7R.js.map +0 -1
- package/dist/chunk-NJU275US.js +0 -238
- package/dist/chunk-NJU275US.js.map +0 -1
- package/dist/chunk-PD4VFEBY.js.map +0 -1
- package/dist/chunk-WNREHWKL.js.map +0 -1
- package/dist/chunk-ZAM4M7LI.js.map +0 -1
- package/dist/claude-code-4275HQU4.js.map +0 -1
- package/dist/codebuff-LE3KBZGM.js.map +0 -1
- package/dist/codex-4BY2ZJIW.js.map +0 -1
- package/dist/copilot-cli-IPISKO3V.js.map +0 -1
- package/dist/crush-X3E25EQG.js.map +0 -1
- package/dist/cursor-UH3W622V.js.map +0 -1
- package/dist/doctor-DZTWED4O.js.map +0 -1
- package/dist/droid-T5VBRXZF.js.map +0 -1
- package/dist/gemini-cli-ZSUK55UA.js.map +0 -1
- package/dist/goose-M3RR3CZG.js.map +0 -1
- package/dist/hermes-CUNKIAR5.js.map +0 -1
- package/dist/hook-EVY7LOUQ.js.map +0 -1
- package/dist/jetbrains-copilot-C3HDGGML.js.map +0 -1
- package/dist/kilo-PKAJCWPX.js.map +0 -1
- package/dist/kimi-EVD7YKXS.js.map +0 -1
- package/dist/mux-5CI5FP2W.js.map +0 -1
- package/dist/omp-AXA7XY22.js.map +0 -1
- package/dist/openclaw-UZ5BMCGQ.js.map +0 -1
- package/dist/opencode-NZBRLJN3.js.map +0 -1
- package/dist/qwen-code-MRRIUQ3P.js.map +0 -1
- package/dist/roo-code-NI5UU6JB.js.map +0 -1
- package/dist/trae-CQC72RHH.js.map +0 -1
- package/dist/vscode-copilot-4RVRTCKV.js.map +0 -1
- package/dist/warp-X6MB67NT.js.map +0 -1
- /package/dist/{antigravity-7IBYFO6P.js.map → antigravity-AMKKKHS4.js.map} +0 -0
- /package/dist/{antigravity-cli-JEOUP2VN.js.map → antigravity-cli-XERXEH5W.js.map} +0 -0
- /package/dist/{chunk-KQSNDFBN.js.map → chunk-LQRAPXS4.js.map} +0 -0
- /package/dist/{kilo-cli-QWUVXG2O.js.map → kilo-cli-UZ7R5UOP.js.map} +0 -0
- /package/dist/{kiro-UQRY6EIO.js.map → kiro-YL6AWUYG.js.map} +0 -0
- /package/dist/{leaderboard-CSWHI4UY.js.map → leaderboard-MJG24O35.js.map} +0 -0
- /package/dist/{usage-CJOM2WQM.js.map → usage-ZFBVQF3H.js.map} +0 -0
- /package/dist/{zed-NTCYW4V2.js.map → zed-SFUHL3GS.js.map} +0 -0
|
@@ -4,13 +4,15 @@ import {
|
|
|
4
4
|
} from "./chunk-DBQMX75U.js";
|
|
5
5
|
import {
|
|
6
6
|
BaseAdapter
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import
|
|
7
|
+
} from "./chunk-CPLK7GTE.js";
|
|
8
|
+
import {
|
|
9
|
+
renderSkillMd
|
|
10
|
+
} from "./chunk-7L6ITC4T.js";
|
|
9
11
|
import {
|
|
10
12
|
buildServeWrapperCommand,
|
|
11
13
|
isHomeBinHookCommand,
|
|
12
14
|
shouldWrapForTelemetry
|
|
13
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-I5MLE6S7.js";
|
|
14
16
|
import "./chunk-N6HH7K6P.js";
|
|
15
17
|
import "./chunk-TRQKHP7D.js";
|
|
16
18
|
|
|
@@ -41,7 +43,11 @@ var AmpAdapter = class extends BaseAdapter {
|
|
|
41
43
|
canModifyOutput: false,
|
|
42
44
|
canInjectSessionContext: false,
|
|
43
45
|
// Amp registers stdio and Streamable HTTP MCP servers.
|
|
44
|
-
transports: ["stdio", "http"]
|
|
46
|
+
transports: ["stdio", "http"],
|
|
47
|
+
// Skills: Amp reads SKILL.md from ~/.config/agents/skills/<name>/SKILL.md
|
|
48
|
+
// (user) and <projectDir>/.agents/skills/<name>/SKILL.md (project) — a root
|
|
49
|
+
// OUTSIDE the config dir, so the skillDir() helper resolves it explicitly.
|
|
50
|
+
supportsSkills: true
|
|
45
51
|
};
|
|
46
52
|
// ── Detection ────────────────────────────────────────────────────────────
|
|
47
53
|
detectInstalled(projectDir) {
|
|
@@ -150,6 +156,76 @@ var AmpAdapter = class extends BaseAdapter {
|
|
|
150
156
|
rewrite(value) {
|
|
151
157
|
return rewriteEnvRefs(value, ampEnvToken);
|
|
152
158
|
}
|
|
159
|
+
// ── Skills surface ───────────────────────────────────────────────────────
|
|
160
|
+
// CONTENT-ONLY: pure native-file writers under the skill root. No runtime
|
|
161
|
+
// dispatch, no home-bin pointer, no telemetry wrap. Idempotent (byte-identical
|
|
162
|
+
// → skip) via writeContentFile and reversible via removeContentFile. Honors
|
|
163
|
+
// platforms["amp"].skills === false to skip.
|
|
164
|
+
//
|
|
165
|
+
// QUIRK: the skill root is NOT under getConfigDir (~/.config/amp). Amp reads
|
|
166
|
+
// SKILL.md from the sibling cross-agent `agents` tree:
|
|
167
|
+
// user scope → ~/.config/agents/skills/<name>/SKILL.md
|
|
168
|
+
// project scope → <projectDir>/.agents/skills/<name>/SKILL.md
|
|
169
|
+
// so skillDir() resolves it explicitly rather than reusing getConfigDir.
|
|
170
|
+
/** Skill root: user `~/.config/agents/skills`, project `<projectDir>/.agents/skills`. */
|
|
171
|
+
skillsDir(ctx) {
|
|
172
|
+
return ctx.scope === "project" ? join(ctx.projectDir, ".agents", "skills") : join(homedir(), ".config", "agents", "skills");
|
|
173
|
+
}
|
|
174
|
+
/** Native skill dir: <skillRoot>/<name>. */
|
|
175
|
+
skillDir(ctx, name) {
|
|
176
|
+
return join(this.skillsDir(ctx), name);
|
|
177
|
+
}
|
|
178
|
+
installSkills(ctx) {
|
|
179
|
+
const { connector } = ctx;
|
|
180
|
+
if (connector.platforms[HOST]?.skills === false) {
|
|
181
|
+
return [{ platform: this.id, action: "skip", detail: "skills disabled for amp" }];
|
|
182
|
+
}
|
|
183
|
+
if (connector.skills.length === 0) {
|
|
184
|
+
return [{ platform: this.id, action: "skip", detail: "connector declares no skills" }];
|
|
185
|
+
}
|
|
186
|
+
const changes = [];
|
|
187
|
+
for (const skill of connector.skills) {
|
|
188
|
+
const dir = this.skillDir(ctx, skill.name);
|
|
189
|
+
changes.push(
|
|
190
|
+
this.writeContentFile(join(dir, "SKILL.md"), this.renderSkill(skill), ctx.dryRun)
|
|
191
|
+
);
|
|
192
|
+
for (const [rel, contents] of Object.entries(skill.resources ?? {})) {
|
|
193
|
+
const target = this.resolveWithin(dir, rel);
|
|
194
|
+
if (target === null) {
|
|
195
|
+
changes.push({
|
|
196
|
+
platform: this.id,
|
|
197
|
+
action: "warn",
|
|
198
|
+
detail: `skill resource "${rel}" escapes the skill dir; skipped`
|
|
199
|
+
});
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
changes.push(this.writeContentFile(target, contents, ctx.dryRun));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return changes;
|
|
206
|
+
}
|
|
207
|
+
uninstallSkills(ctx) {
|
|
208
|
+
const { connector } = ctx;
|
|
209
|
+
if (connector.skills.length === 0) {
|
|
210
|
+
return [{ platform: this.id, action: "skip", detail: "connector declares no skills" }];
|
|
211
|
+
}
|
|
212
|
+
const changes = [];
|
|
213
|
+
for (const skill of connector.skills) {
|
|
214
|
+
const dir = this.skillDir(ctx, skill.name);
|
|
215
|
+
changes.push(this.removeContentFile(join(dir, "SKILL.md"), ctx.dryRun));
|
|
216
|
+
for (const rel of Object.keys(skill.resources ?? {})) {
|
|
217
|
+
const target = this.resolveWithin(dir, rel);
|
|
218
|
+
if (target === null) continue;
|
|
219
|
+
changes.push(this.removeContentFile(target, ctx.dryRun));
|
|
220
|
+
}
|
|
221
|
+
changes.push(this.removeDirIfEmpty(dir, ctx.dryRun));
|
|
222
|
+
}
|
|
223
|
+
return changes;
|
|
224
|
+
}
|
|
225
|
+
/** Render a skill's SKILL.md (delegates to the shared renderer). */
|
|
226
|
+
renderSkill(skill) {
|
|
227
|
+
return renderSkillMd(skill);
|
|
228
|
+
}
|
|
153
229
|
// ── Hooks (unavailable — Amp is mcp-only) ────────────────────────────────
|
|
154
230
|
installHooks(_ctx) {
|
|
155
231
|
return [
|
|
@@ -221,4 +297,4 @@ export {
|
|
|
221
297
|
adapter,
|
|
222
298
|
amp_default as default
|
|
223
299
|
};
|
|
224
|
-
//# sourceMappingURL=amp-
|
|
300
|
+
//# sourceMappingURL=amp-4U33CU7E.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 an **mcp-only** host: it exposes no lifecycle hook system, so MCP is the\n * only extensibility surface. This adapter installs the MCP server entry and\n * reports hooks as unavailable — the same shape validated by the Warp adapter.\n *\n * 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 { Adapter, InstallContext } from \"../spi.js\";\nimport type {\n ChangeRecord,\n DetectedPlatform,\n HealthCheck,\n HookParadigm,\n PlatformCapabilities,\n PlatformId,\n ServerDef,\n SkillDef,\n Transport,\n} from \"../../core/types.js\";\nimport { rewriteEnvRefs } from \"../../core/interpolate.js\";\nimport {\n buildServeWrapperCommand,\n isHomeBinHookCommand,\n shouldWrapForTelemetry,\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/** 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 = \"mcp-only\";\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 has no lifecycle hook system — every hook capability is false.\n preToolUse: false,\n postToolUse: false,\n preCompact: false,\n sessionStart: false,\n sessionEnd: false,\n userPromptSubmit: false,\n stop: false,\n notification: false,\n canModifyArgs: false,\n canModifyOutput: false,\n canInjectSessionContext: false,\n // Amp registers stdio and Streamable HTTP MCP servers.\n transports: [\"stdio\", \"http\"],\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 };\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 * Amp has no hook file — hooks are not a thing here. The hook \"config path\" is\n * the same settings.json so the generic doctor/backup behave sensibly.\n */\n getHookConfigPath(ctx: InstallContext): string {\n return this.getServerConfigPath(ctx);\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 if (shouldWrapForTelemetry(server, ctx.connector.telemetry)) {\n const wrapped = buildServeWrapperCommand(\n ctx.homeBinPath,\n ctx.connector.id,\n command,\n args,\n ctx.scope,\n this.id,\n );\n command = wrapped.command;\n args = wrapped.args;\n }\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 // ── Hooks (unavailable — Amp is mcp-only) ────────────────────────────────\n\n installHooks(_ctx: InstallContext): ChangeRecord[] {\n return [\n {\n platform: this.id,\n action: \"skip\",\n detail: \"hooks unavailable (Amp is mcp-only)\",\n },\n ];\n }\n\n uninstallHooks(_ctx: InstallContext): ChangeRecord[] {\n return [\n {\n platform: this.id,\n action: \"skip\",\n detail: \"hooks unavailable (Amp is mcp-only)\",\n },\n ];\n }\n\n /**\n * True when a hook command references our home binary AND this connector id\n * (anchored so a shared-prefix id can't collide — see isHomeBinHookCommand).\n * Amp installs no hooks, but this guard keeps any future shared-file edit from\n * removing another connector's entries.\n */\n private isOurCommand(command: string | undefined, ctx: InstallContext): boolean {\n return isHomeBinHookCommand(command, ctx.homeBinPath, ctx.connector.id);\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 }\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":";;;;;;;;;;;;;;;;;;;AAsCA,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,YAAY;AAuBrB,IAAM,OAAmB;AAKzB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UAAU,QAAQ;AACzB,mBAAO,EAAE,QAAQ,MAAM,QAAQ,yBAAyB;AAAA,UAC1D;AACA,gBAAM,MAAM,KAAK,SAAmD,YAAY;AAChF,gBAAM,SAAS,MAAM,YAAY;AACjC,cAAI,CAAC,OAAO,CAAC,QAAQ;AACnB,mBAAO,EAAE,QAAQ,QAAQ,QAAQ,OAAO,YAAY,QAAQ,YAAY,GAAG;AAAA,UAC7E;AACA,iBAAO,eAAe,SAClB,EAAE,QAAQ,MAAM,QAAQ,IAAI,YAAY,KAAK,WAAW,WAAW,IACnE;AAAA,YACE,QAAQ;AAAA,YACR,QAAQ,OAAO,YAAY,KAAK,WAAW,OAAO,YAAY;AAAA,UAChE;AAAA,QACN;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAWA,SAAS,YAAY,MAAc,KAAsB;AACvD,MAAI,QAAQ,QAAW;AACrB,UAAM,IAAI,QAAQ,IAAI,IAAI;AAC1B,WAAO,KAAK,QAAQ,MAAM,KAAK,IAAI;AAAA,EACrC;AACA,SAAO,MAAM,IAAI;AACnB;AAEO,IAAM,UAAU,IAAI,WAAW;AACtC,IAAO,cAAQ;","names":["entry"]}
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
AntigravityAdapter,
|
|
4
4
|
adapter,
|
|
5
5
|
antigravity_default
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LQRAPXS4.js";
|
|
7
7
|
import "./chunk-DBQMX75U.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-CPLK7GTE.js";
|
|
9
9
|
import "./chunk-7L6ITC4T.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-I5MLE6S7.js";
|
|
11
11
|
import "./chunk-N6HH7K6P.js";
|
|
12
12
|
import "./chunk-TRQKHP7D.js";
|
|
13
13
|
export {
|
|
@@ -15,4 +15,4 @@ export {
|
|
|
15
15
|
adapter,
|
|
16
16
|
antigravity_default as default
|
|
17
17
|
};
|
|
18
|
-
//# sourceMappingURL=antigravity-
|
|
18
|
+
//# sourceMappingURL=antigravity-AMKKKHS4.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
AntigravityAdapter
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-LQRAPXS4.js";
|
|
5
5
|
import "./chunk-DBQMX75U.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-CPLK7GTE.js";
|
|
7
7
|
import "./chunk-7L6ITC4T.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-I5MLE6S7.js";
|
|
9
9
|
import "./chunk-N6HH7K6P.js";
|
|
10
10
|
import "./chunk-TRQKHP7D.js";
|
|
11
11
|
|
|
@@ -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-XERXEH5W.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
defineConnector
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4ENJK5S2.js";
|
|
5
5
|
import {
|
|
6
6
|
connectorDir,
|
|
7
7
|
connectorsDir,
|
|
@@ -73,7 +73,7 @@ function serializablePlatforms(platforms) {
|
|
|
73
73
|
}
|
|
74
74
|
return out;
|
|
75
75
|
}
|
|
76
|
-
function registerConnector(connector, modulePath) {
|
|
76
|
+
function registerConnector(connector, modulePath, scope) {
|
|
77
77
|
const meta = {
|
|
78
78
|
id: connector.id,
|
|
79
79
|
displayName: connector.displayName,
|
|
@@ -88,7 +88,11 @@ function registerConnector(connector, modulePath) {
|
|
|
88
88
|
subagents: connector.subagents,
|
|
89
89
|
memory: connector.memory,
|
|
90
90
|
targets: connector.targets,
|
|
91
|
-
platforms: serializablePlatforms(connector.platforms)
|
|
91
|
+
platforms: serializablePlatforms(connector.platforms),
|
|
92
|
+
// Persist the install scope when the caller supplied one (the installer
|
|
93
|
+
// passes its install scope). Omitted from the record when undefined so an
|
|
94
|
+
// ad-hoc register stays minimal and round-trips as "no scope known".
|
|
95
|
+
...scope !== void 0 ? { scope } : {}
|
|
92
96
|
};
|
|
93
97
|
const dir = connectorDir(connector.id);
|
|
94
98
|
ensureDir(dir);
|
|
@@ -140,6 +144,11 @@ function connectorFromMeta(meta) {
|
|
|
140
144
|
skills: meta.skills ?? [],
|
|
141
145
|
subagents: meta.subagents ?? [],
|
|
142
146
|
memory: meta.memory ?? [],
|
|
147
|
+
// Actions carry live `run` handlers, so they are NOT serialized into the
|
|
148
|
+
// record (like the statusline render). A handler-less meta-derived connector
|
|
149
|
+
// gets [] — inspection/uninstall never dispatch action handlers, and the
|
|
150
|
+
// BaseAdapter action default already tolerates an empty list.
|
|
151
|
+
actions: [],
|
|
143
152
|
platforms: meta.platforms ?? {},
|
|
144
153
|
targets: meta.targets
|
|
145
154
|
};
|
|
@@ -165,4 +174,4 @@ export {
|
|
|
165
174
|
connectorFromMeta,
|
|
166
175
|
listRegisteredConnectors
|
|
167
176
|
};
|
|
168
|
-
//# sourceMappingURL=chunk-
|
|
177
|
+
//# sourceMappingURL=chunk-24IDL5RW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/load-connector.ts"],"sourcesContent":["/**\n * core/load-connector — discover, load, and register connector definitions.\n *\n * Responsibilities:\n * 1. Locate the developer's `agent-connector.config.{mjs,js,json}` by walking\n * upward from a start directory (the project root convention).\n * 2. Load a config from a path into a LIVE ResolvedConnector (with handlers).\n * 3. Register a connector by persisting SERIALIZABLE metadata (no functions)\n * to `connectorDir(id)/connector.json`, pointing at the source module so\n * live handlers can be re-imported at runtime from a stable record.\n *\n * Why split live vs. serialized? Hook handlers are functions and cannot survive\n * JSON. The registry stores only what JSON can hold plus an absolute\n * `modulePath`; the runtime re-imports that module to recover the live handlers.\n */\n\nimport { existsSync, readdirSync, readFileSync, realpathSync, rmSync, writeFileSync } from \"node:fs\";\nimport { dirname, isAbsolute, join, resolve } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nimport type {\n CommandDef,\n HookEventName,\n InstallScope,\n MemoryDef,\n PlatformId,\n PlatformOverride,\n ResolvedConnector,\n ServerDef,\n SkillDef,\n SubagentDef,\n} from \"./types.js\";\nimport { defineConnector } from \"./define-connector.js\";\nimport { connectorDir, connectorsDir, ensureDir } from \"./paths.js\";\n\n/** Candidate config filenames, in resolution-precedence order. */\nconst CONFIG_FILENAMES = [\n \"agent-connector.config.mjs\",\n \"agent-connector.config.js\",\n \"agent-connector.config.json\",\n] as const;\n\n/**\n * The serializable subset of a connector persisted to `connector.json`.\n * Hook handler functions are intentionally absent — only the absolute\n * `modulePath` is stored so the live ResolvedConnector can be re-imported.\n */\nexport interface RegisteredMeta {\n id: string;\n displayName: string;\n version: string;\n /** Absolute path to the source module that produced this connector. */\n modulePath: string;\n telemetry: ResolvedConnector[\"telemetry\"];\n /** Canonical event names the connector handles (handlers themselves stripped). */\n hookEvents: HookEventName[];\n hasServer: boolean;\n server: ServerDef | null;\n /**\n * Content surfaces (commands/skills/subagents). These are JSON-serializable\n * (no functions) so they persist cleanly and let uninstall locate the files\n * to remove even when the source module is gone.\n */\n commands: CommandDef[];\n skills: SkillDef[];\n subagents: SubagentDef[];\n /**\n * Memory entries (managed-block content surface). Plain content, persisted\n * whole so uninstall normally has the full entry list even when the source\n * module is gone (the marker prefix-scan is the fallback beyond that).\n */\n memory: MemoryDef[];\n targets: ResolvedConnector[\"targets\"];\n /** Per-platform overrides with any hook handler functions stripped. */\n platforms: Partial<Record<PlatformId, PlatformOverride>>;\n /**\n * The install scope this connector was registered under, persisted so the\n * runtime entrypoints (hook/statusline/action) can recover it cheaply (sync)\n * and stamp it onto the HostCtx/event — scope is an install-time property the\n * runtime otherwise has no access to. OPTIONAL: absent for an ad-hoc register\n * that passed no scope, or a record written before this field existed.\n * This is the install's RUN-WIDE DEFAULT scope; it can differ from the\n * effective per-host scope when a `platforms[host].scope` override is set (the\n * record is keyed by connector id only and holds no per-host scope map).\n */\n scope?: InstallScope;\n}\n\n/**\n * Search `startDir` and each ancestor for a connector config file. Returns the\n * absolute path to the first match (filesystem-root-stopping), or null.\n */\nexport function findConnectorConfig(startDir: string): string | null {\n let dir = resolve(startDir);\n // Walk upward until `dirname(dir) === dir` (filesystem root).\n for (;;) {\n for (const name of CONFIG_FILENAMES) {\n const candidate = join(dir, name);\n if (existsSync(candidate)) return candidate;\n }\n const parent = dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return null;\n}\n\n/** True if a value already looks like a ResolvedConnector (vs. a raw config). */\nfunction isResolvedConnector(value: unknown): value is ResolvedConnector {\n return (\n typeof value === \"object\" &&\n value !== null &&\n Array.isArray((value as { hookEvents?: unknown }).hookEvents)\n );\n}\n\n/**\n * Load a connector from an absolute or relative path.\n * - `.json` → JSON.parse, then defineConnector().\n * - `.mjs` / `.js` → dynamic import (via pathToFileURL, Windows-safe),\n * take the default export. If it already looks like a\n * ResolvedConnector use it as-is; otherwise treat it as\n * a ConnectorConfig and run it through defineConnector().\n * Returns the live connector plus the absolute module path it came from.\n */\nexport async function loadConnectorFromPath(\n path: string,\n): Promise<{ connector: ResolvedConnector; modulePath: string }> {\n let modulePath = isAbsolute(path) ? path : resolve(path);\n // Canonicalize before building the file:// URL for dynamic import. On Windows a\n // short (8.3) temp path like C:\\Users\\RUNNER~1\\...\\x.mjs round-trips the \"~\" as\n // %7E and fails to load; realpathSync.native expands it to the real long path.\n // It also resolves symlinked temp roots (e.g. macOS /var -> /private/var).\n // If the file does not exist yet, fall through with the resolve()'d path so the\n // subsequent read/import throws the real not-found error.\n try {\n modulePath = realpathSync.native(modulePath);\n } catch {\n /* keep the resolve()'d path */\n }\n\n if (modulePath.endsWith(\".json\")) {\n const text = readFileSync(modulePath, \"utf8\");\n const config = JSON.parse(text) as unknown;\n const connector = defineConnector(config as Parameters<typeof defineConnector>[0]);\n return { connector, modulePath };\n }\n\n // .mjs / .js — dynamic ESM import. pathToFileURL keeps Windows paths valid.\n const mod = (await import(pathToFileURL(modulePath).href)) as {\n default?: unknown;\n };\n const exported = mod.default;\n if (exported == null) {\n throw new Error(\n `Connector module has no default export: ${modulePath}`,\n );\n }\n const connector = isResolvedConnector(exported)\n ? exported\n : defineConnector(exported as Parameters<typeof defineConnector>[0]);\n return { connector, modulePath };\n}\n\n/**\n * Strip any function-valued `hooks` from per-platform overrides so the result\n * is JSON-serializable. A boolean `hooks` override is preserved; an object\n * override is dropped (it can only carry handler functions, which are not\n * serializable). `nativeHooks` declarations are persisted HANDLER-LESS (event\n * name + matcher only) so meta-based inspection (doctor / health checks / the\n * hook CLI) can still see WHICH native events were declared — the live handlers\n * are re-imported from `modulePath` at runtime, exactly like normalized hooks.\n * Everything else on the override is kept verbatim — notably `configPatch`\n * declarations, which are pure JSON (key/value/reason/docsUrl, no functions)\n * and persist WHOLE so uninstall/doctor can reason about them even when the\n * source module is gone.\n */\nfunction serializablePlatforms(\n platforms: Partial<Record<PlatformId, PlatformOverride>>,\n): Partial<Record<PlatformId, PlatformOverride>> {\n const out: Partial<Record<PlatformId, PlatformOverride>> = {};\n for (const [id, override] of Object.entries(platforms) as [\n PlatformId,\n PlatformOverride | undefined,\n ][]) {\n if (!override) continue;\n const { hooks, nativeHooks, ...rest } = override;\n const clean: PlatformOverride = { ...rest };\n // Keep only a boolean hooks flag; object hooks carry handler functions.\n if (typeof hooks === \"boolean\") clean.hooks = hooks;\n if (nativeHooks && typeof nativeHooks === \"object\") {\n const stripped: Record<string, { matcher?: string }> = {};\n for (const [event, def] of Object.entries(nativeHooks)) {\n stripped[event] =\n typeof def?.matcher === \"string\" ? { matcher: def.matcher } : {};\n }\n // Cast: the persisted record deliberately omits the (non-serializable)\n // handler; consumers of meta-derived connectors never dispatch handlers.\n clean.nativeHooks = stripped as PlatformOverride[\"nativeHooks\"];\n }\n out[id] = clean;\n }\n return out;\n}\n\n/**\n * Persist a connector's serializable metadata to `connectorDir(id)/connector.json`.\n * Handlers are NOT serialized — they are re-imported from `modulePath` at runtime.\n * The optional `scope` (the install scope the caller deployed under) is persisted\n * so the runtime entrypoints can recover it and stamp it onto the HostCtx/event.\n * Returns the absolute path of the written record.\n */\nexport function registerConnector(\n connector: ResolvedConnector,\n modulePath: string,\n scope?: InstallScope,\n): string {\n const meta: RegisteredMeta = {\n id: connector.id,\n displayName: connector.displayName,\n version: connector.version,\n modulePath: resolve(modulePath),\n telemetry: connector.telemetry,\n hookEvents: connector.hookEvents,\n hasServer: !!connector.server,\n server: connector.server ?? null,\n commands: connector.commands,\n skills: connector.skills,\n subagents: connector.subagents,\n memory: connector.memory,\n targets: connector.targets,\n platforms: serializablePlatforms(connector.platforms),\n // Persist the install scope when the caller supplied one (the installer\n // passes its install scope). Omitted from the record when undefined so an\n // ad-hoc register stays minimal and round-trips as \"no scope known\".\n ...(scope !== undefined ? { scope } : {}),\n };\n\n const dir = connectorDir(connector.id);\n ensureDir(dir);\n const outPath = join(dir, \"connector.json\");\n writeFileSync(outPath, `${JSON.stringify(meta, null, 2)}\\n`, \"utf8\");\n return outPath;\n}\n\n/**\n * Deregister a connector by removing its DATA-dir record directory\n * (`connectorDir(id)`) recursively. This is the inverse of {@link registerConnector}:\n * registerConnector writes `connectorDir(id)/connector.json`, but per-target\n * uninstall only strips host-native registrations — it never removes this record,\n * leaving an orphan behind. Best-effort + guarded: returns the directory path and\n * whether it existed before removal.\n */\nexport function deregisterConnector(id: string): {\n removed: boolean;\n path: string;\n} {\n const dir = connectorDir(id);\n const existed = existsSync(dir);\n if (existed) rmSync(dir, { recursive: true, force: true });\n return { removed: existed, path: dir };\n}\n\n/**\n * Read the registered metadata record for `id`, or null if not registered or\n * the record is unreadable/corrupt.\n */\nexport function readRegisteredMeta(id: string): RegisteredMeta | null {\n const recordPath = join(connectorDir(id), \"connector.json\");\n if (!existsSync(recordPath)) return null;\n try {\n return JSON.parse(readFileSync(recordPath, \"utf8\")) as RegisteredMeta;\n } catch {\n return null;\n }\n}\n\n/**\n * Load the LIVE ResolvedConnector (with hook handlers) for a registered id by\n * re-importing its source module. Throws a clear error when the connector is\n * not registered or its source module no longer resolves to it.\n */\nexport async function loadRegisteredConnector(\n id: string,\n): Promise<ResolvedConnector> {\n const meta = readRegisteredMeta(id);\n if (!meta) {\n throw new Error(\n `Connector \"${id}\" is not registered (no record at ${join(connectorDir(id), \"connector.json\")}). ` +\n `Run an install/register step first.`,\n );\n }\n if (!meta.modulePath || !existsSync(meta.modulePath)) {\n throw new Error(\n `Connector \"${id}\" record points at a missing module: ${meta.modulePath}`,\n );\n }\n const { connector } = await loadConnectorFromPath(meta.modulePath);\n return connector;\n}\n\n/**\n * Build a handler-less ResolvedConnector from stored metadata. Suitable for\n * inspection/doctor where live hook handlers are not needed (and where the\n * source module may even be gone). `hooks` is empty; `hookEvents` is preserved.\n */\nexport function connectorFromMeta(meta: RegisteredMeta): ResolvedConnector {\n return {\n id: meta.id,\n displayName: meta.displayName,\n version: meta.version,\n ...(meta.server ? { server: meta.server } : {}),\n hooks: {},\n hookEvents: meta.hookEvents ?? [],\n telemetry: meta.telemetry,\n commands: meta.commands ?? [],\n skills: meta.skills ?? [],\n subagents: meta.subagents ?? [],\n memory: meta.memory ?? [],\n // Actions carry live `run` handlers, so they are NOT serialized into the\n // record (like the statusline render). A handler-less meta-derived connector\n // gets [] — inspection/uninstall never dispatch action handlers, and the\n // BaseAdapter action default already tolerates an empty list.\n actions: [],\n platforms: meta.platforms ?? {},\n targets: meta.targets,\n };\n}\n\n/**\n * List every registered connector as a handler-less ResolvedConnector (read\n * from `connectorsDir()`). Used by doctor to health-check what is actually\n * installed, rather than guessing from the local working directory.\n */\nexport function listRegisteredConnectors(): ResolvedConnector[] {\n const dir = connectorsDir();\n if (!existsSync(dir)) return [];\n const out: ResolvedConnector[] = [];\n for (const entry of readdirSync(dir)) {\n const meta = readRegisteredMeta(entry);\n if (meta) out.push(connectorFromMeta(meta));\n }\n return out;\n}\n"],"mappings":";;;;;;;;;;;AAgBA,SAAS,YAAY,aAAa,cAAc,cAAc,QAAQ,qBAAqB;AAC3F,SAAS,SAAS,YAAY,MAAM,eAAe;AACnD,SAAS,qBAAqB;AAkB9B,IAAM,mBAAmB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AACF;AAoDO,SAAS,oBAAoB,UAAiC;AACnE,MAAI,MAAM,QAAQ,QAAQ;AAE1B,aAAS;AACP,eAAW,QAAQ,kBAAkB;AACnC,YAAM,YAAY,KAAK,KAAK,IAAI;AAChC,UAAI,WAAW,SAAS,EAAG,QAAO;AAAA,IACpC;AACA,UAAM,SAAS,QAAQ,GAAG;AAC1B,QAAI,WAAW,IAAK;AACpB,UAAM;AAAA,EACR;AACA,SAAO;AACT;AAGA,SAAS,oBAAoB,OAA4C;AACvE,SACE,OAAO,UAAU,YACjB,UAAU,QACV,MAAM,QAAS,MAAmC,UAAU;AAEhE;AAWA,eAAsB,sBACpB,MAC+D;AAC/D,MAAI,aAAa,WAAW,IAAI,IAAI,OAAO,QAAQ,IAAI;AAOvD,MAAI;AACF,iBAAa,aAAa,OAAO,UAAU;AAAA,EAC7C,QAAQ;AAAA,EAER;AAEA,MAAI,WAAW,SAAS,OAAO,GAAG;AAChC,UAAM,OAAO,aAAa,YAAY,MAAM;AAC5C,UAAM,SAAS,KAAK,MAAM,IAAI;AAC9B,UAAMA,aAAY,gBAAgB,MAA+C;AACjF,WAAO,EAAE,WAAAA,YAAW,WAAW;AAAA,EACjC;AAGA,QAAM,MAAO,MAAM,OAAO,cAAc,UAAU,EAAE;AAGpD,QAAM,WAAW,IAAI;AACrB,MAAI,YAAY,MAAM;AACpB,UAAM,IAAI;AAAA,MACR,2CAA2C,UAAU;AAAA,IACvD;AAAA,EACF;AACA,QAAM,YAAY,oBAAoB,QAAQ,IAC1C,WACA,gBAAgB,Q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AA,IAC5B,QAAQ,KAAK,UAAU,CAAC;AAAA,IACxB,WAAW,KAAK,aAAa,CAAC;AAAA,IAC9B,QAAQ,KAAK,UAAU,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,IAKxB,SAAS,CAAC;AAAA,IACV,WAAW,KAAK,aAAa,CAAC;AAAA,IAC9B,SAAS,KAAK;AAAA,EAChB;AACF;AAOO,SAAS,2BAAgD;AAC9D,QAAM,MAAM,cAAc;AAC1B,MAAI,CAAC,WAAW,GAAG,EAAG,QAAO,CAAC;AAC9B,QAAM,MAA2B,CAAC;AAClC,aAAW,SAAS,YAAY,GAAG,GAAG;AACpC,UAAM,OAAO,mBAAmB,KAAK;AACrC,QAAI,KAAM,KAAI,KAAK,kBAAkB,IAAI,CAAC;AAAA,EAC5C;AACA,SAAO;AACT;","names":["connector"]}
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
getTokenizer,
|
|
4
|
+
inferModelFamily,
|
|
5
|
+
newRecordId,
|
|
6
|
+
openStore,
|
|
7
|
+
worstConfidence
|
|
8
|
+
} from "./chunk-BCHWFTV4.js";
|
|
9
|
+
import {
|
|
10
|
+
log
|
|
11
|
+
} from "./chunk-KHO5WNTP.js";
|
|
12
|
+
import {
|
|
13
|
+
loadRegisteredConnector,
|
|
14
|
+
readRegisteredMeta
|
|
15
|
+
} from "./chunk-24IDL5RW.js";
|
|
16
|
+
import {
|
|
17
|
+
REGISTERED_PLATFORM_IDS,
|
|
18
|
+
loadAdapter
|
|
19
|
+
} from "./chunk-DCKFYWGM.js";
|
|
20
|
+
import {
|
|
21
|
+
projectIdentity
|
|
22
|
+
} from "./chunk-TRQKHP7D.js";
|
|
23
|
+
|
|
24
|
+
// src/runtime/telemetry-accessor.ts
|
|
25
|
+
var ZERO = {
|
|
26
|
+
inputTokens: 0,
|
|
27
|
+
outputTokens: 0,
|
|
28
|
+
totalTokens: 0,
|
|
29
|
+
calls: 0
|
|
30
|
+
};
|
|
31
|
+
function buildTelemetryAccessor(connectorId) {
|
|
32
|
+
return async () => {
|
|
33
|
+
if (process.env.AGENT_CONNECTOR_TELEMETRY === "0") return { ...ZERO };
|
|
34
|
+
try {
|
|
35
|
+
const store = openStore({});
|
|
36
|
+
try {
|
|
37
|
+
let inputTokens = 0;
|
|
38
|
+
let outputTokens = 0;
|
|
39
|
+
let calls = 0;
|
|
40
|
+
for (const row of store.query({ connectorId })) {
|
|
41
|
+
inputTokens += Number.isFinite(row.inputTokens) ? row.inputTokens : 0;
|
|
42
|
+
outputTokens += Number.isFinite(row.outputTokens) ? row.outputTokens : 0;
|
|
43
|
+
calls += 1;
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
inputTokens,
|
|
47
|
+
outputTokens,
|
|
48
|
+
totalTokens: inputTokens + outputTokens,
|
|
49
|
+
calls
|
|
50
|
+
};
|
|
51
|
+
} finally {
|
|
52
|
+
store.close();
|
|
53
|
+
}
|
|
54
|
+
} catch {
|
|
55
|
+
return { ...ZERO };
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// src/telemetry/measure.ts
|
|
61
|
+
var MODALITY_ESTIMATE = {
|
|
62
|
+
image: 85,
|
|
63
|
+
audio: 85,
|
|
64
|
+
resource: 85
|
|
65
|
+
};
|
|
66
|
+
var UNKNOWN_BLOCK_ESTIMATE = 85;
|
|
67
|
+
function combineSources(sources) {
|
|
68
|
+
let worst = "host-native";
|
|
69
|
+
for (const s of sources) worst = worstConfidence(worst, s);
|
|
70
|
+
return worst;
|
|
71
|
+
}
|
|
72
|
+
function isObject(v) {
|
|
73
|
+
return typeof v === "object" && v !== null;
|
|
74
|
+
}
|
|
75
|
+
function isTextBlock(block) {
|
|
76
|
+
return block.type === "text";
|
|
77
|
+
}
|
|
78
|
+
function measureToolCall(args, result, family, tok = getTokenizer()) {
|
|
79
|
+
const input = tok.countValue(args, family);
|
|
80
|
+
const output = measureResult(result, family, tok);
|
|
81
|
+
return {
|
|
82
|
+
inputTokens: input.tokens,
|
|
83
|
+
outputTokens: output.tokens,
|
|
84
|
+
source: worstConfidence(input.source, output.source)
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function measureResult(result, family, tok) {
|
|
88
|
+
if (!isObject(result)) {
|
|
89
|
+
return tok.countValue(result, family);
|
|
90
|
+
}
|
|
91
|
+
const res = result;
|
|
92
|
+
const sources = [];
|
|
93
|
+
let tokens = 0;
|
|
94
|
+
if (Array.isArray(res.content)) {
|
|
95
|
+
for (const raw of res.content) {
|
|
96
|
+
if (!isObject(raw)) continue;
|
|
97
|
+
const block = raw;
|
|
98
|
+
if (isTextBlock(block)) {
|
|
99
|
+
const text = typeof block.text === "string" ? block.text : "";
|
|
100
|
+
const c = tok.count(text, family);
|
|
101
|
+
tokens += c.tokens;
|
|
102
|
+
sources.push(c.source);
|
|
103
|
+
} else {
|
|
104
|
+
const key = typeof block.type === "string" ? block.type : "";
|
|
105
|
+
tokens += MODALITY_ESTIMATE[key] ?? UNKNOWN_BLOCK_ESTIMATE;
|
|
106
|
+
sources.push("tokenizer-approx");
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
} else if (res.content !== void 0) {
|
|
110
|
+
const c = tok.countValue(res.content, family);
|
|
111
|
+
tokens += c.tokens;
|
|
112
|
+
sources.push(c.source);
|
|
113
|
+
}
|
|
114
|
+
if (res.structuredContent !== void 0) {
|
|
115
|
+
const c = tok.countValue(res.structuredContent, family);
|
|
116
|
+
tokens += c.tokens;
|
|
117
|
+
sources.push(c.source);
|
|
118
|
+
}
|
|
119
|
+
if (sources.length === 0) {
|
|
120
|
+
return tok.countValue(result, family);
|
|
121
|
+
}
|
|
122
|
+
return { tokens, source: combineSources(sources) };
|
|
123
|
+
}
|
|
124
|
+
function measureToolDefs(tools, family, tok = getTokenizer()) {
|
|
125
|
+
return tok.countValue(tools, family);
|
|
126
|
+
}
|
|
127
|
+
function measureHook(eventPayload, handlerReturn, family, tok = getTokenizer()) {
|
|
128
|
+
const input = tok.countValue(eventPayload, family);
|
|
129
|
+
const output = tok.countValue(handlerReturn, family);
|
|
130
|
+
return {
|
|
131
|
+
inputTokens: input.tokens,
|
|
132
|
+
outputTokens: output.tokens,
|
|
133
|
+
source: worstConfidence(input.source, output.source)
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// src/runtime/hook-entrypoint.ts
|
|
138
|
+
var ALLOW = { exitCode: 0 };
|
|
139
|
+
function eventMatcherSubject(evt) {
|
|
140
|
+
const name = evt.toolName;
|
|
141
|
+
if (typeof name === "string") return name;
|
|
142
|
+
const agentType = evt.agentType;
|
|
143
|
+
if (typeof agentType === "string") return agentType;
|
|
144
|
+
return void 0;
|
|
145
|
+
}
|
|
146
|
+
function parseStdin(stdin) {
|
|
147
|
+
const trimmed = stdin.trim();
|
|
148
|
+
if (trimmed === "") return {};
|
|
149
|
+
try {
|
|
150
|
+
return JSON.parse(trimmed);
|
|
151
|
+
} catch {
|
|
152
|
+
return {};
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function compileMatcher(matcher) {
|
|
156
|
+
if (!matcher || matcher === "") return null;
|
|
157
|
+
try {
|
|
158
|
+
return new RegExp(matcher);
|
|
159
|
+
} catch {
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function normalizeResponse(value) {
|
|
164
|
+
if (value == null || typeof value !== "object") return {};
|
|
165
|
+
return value;
|
|
166
|
+
}
|
|
167
|
+
function resolveHookHostPlatform(platformId, evt) {
|
|
168
|
+
const override = process.env.AGENT_CONNECTOR_HOST;
|
|
169
|
+
if (override !== void 0 && REGISTERED_PLATFORM_IDS.has(override)) {
|
|
170
|
+
return override;
|
|
171
|
+
}
|
|
172
|
+
if (REGISTERED_PLATFORM_IDS.has(platformId)) {
|
|
173
|
+
return platformId;
|
|
174
|
+
}
|
|
175
|
+
const fromEvent = evt.hostPlatform;
|
|
176
|
+
if (typeof fromEvent === "string" && REGISTERED_PLATFORM_IDS.has(fromEvent)) {
|
|
177
|
+
return fromEvent;
|
|
178
|
+
}
|
|
179
|
+
return "unknown";
|
|
180
|
+
}
|
|
181
|
+
function recordHookTelemetry(opts, connector, evt, response) {
|
|
182
|
+
if (process.env.AGENT_CONNECTOR_TELEMETRY === "0") return;
|
|
183
|
+
try {
|
|
184
|
+
const family = inferModelFamily("", connector.telemetry.modelFamilyHint);
|
|
185
|
+
const measurement = measureHook(evt, response, family, getTokenizer());
|
|
186
|
+
const sessionId = typeof evt.sessionId === "string" ? evt.sessionId : "";
|
|
187
|
+
const evtProjectDir = evt.projectDir;
|
|
188
|
+
const projectDir = typeof evtProjectDir === "string" && evtProjectDir !== "" ? evtProjectDir : process.cwd();
|
|
189
|
+
const id = projectIdentity(projectDir);
|
|
190
|
+
const store = openStore({});
|
|
191
|
+
try {
|
|
192
|
+
store.append({
|
|
193
|
+
id: newRecordId(0),
|
|
194
|
+
ts: Date.now(),
|
|
195
|
+
connectorId: opts.connectorId,
|
|
196
|
+
toolName: opts.event,
|
|
197
|
+
// for a hook row the per-item name IS the event
|
|
198
|
+
scope: "hook",
|
|
199
|
+
surfaceKind: "hook",
|
|
200
|
+
hostPlatform: resolveHookHostPlatform(opts.platformId, evt),
|
|
201
|
+
sessionId,
|
|
202
|
+
projectKey: id.key,
|
|
203
|
+
projectDir: id.dir,
|
|
204
|
+
inputTokens: measurement.inputTokens,
|
|
205
|
+
outputTokens: measurement.outputTokens,
|
|
206
|
+
confidenceSource: measurement.source,
|
|
207
|
+
isError: false
|
|
208
|
+
});
|
|
209
|
+
} finally {
|
|
210
|
+
store.close();
|
|
211
|
+
}
|
|
212
|
+
} catch {
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
async function runHook(opts) {
|
|
216
|
+
const { platformId, event, connectorId, stdin } = opts;
|
|
217
|
+
try {
|
|
218
|
+
const connector = await loadRegisteredConnector(connectorId);
|
|
219
|
+
const adapter = await loadAdapter(platformId);
|
|
220
|
+
if (!adapter || !adapter.parseEvent || !adapter.formatReply) {
|
|
221
|
+
return ALLOW;
|
|
222
|
+
}
|
|
223
|
+
const raw = parseStdin(stdin);
|
|
224
|
+
const evt = adapter.parseEvent(event, raw);
|
|
225
|
+
evt.connectorId = connectorId;
|
|
226
|
+
evt.capabilities = adapter.capabilities;
|
|
227
|
+
evt.scope = readRegisteredMeta(connectorId)?.scope;
|
|
228
|
+
evt.telemetry = buildTelemetryAccessor(connectorId);
|
|
229
|
+
const definition = connector.hooks[event];
|
|
230
|
+
if (!definition || typeof definition.handler !== "function") {
|
|
231
|
+
return ALLOW;
|
|
232
|
+
}
|
|
233
|
+
const perHost = definition.hosts?.[platformId]?.handler;
|
|
234
|
+
const handler = typeof perHost === "function" ? perHost : definition.handler;
|
|
235
|
+
const subject = eventMatcherSubject(evt);
|
|
236
|
+
if (subject !== void 0) {
|
|
237
|
+
const re = compileMatcher(definition.matcher);
|
|
238
|
+
if (re && !re.test(subject)) return ALLOW;
|
|
239
|
+
}
|
|
240
|
+
const handlerResult = await handler(
|
|
241
|
+
// The adapter parsed `evt` as exactly this event's payload type; the
|
|
242
|
+
// HooksConfig handler for the same event expects that payload.
|
|
243
|
+
evt
|
|
244
|
+
);
|
|
245
|
+
const response = normalizeResponse(handlerResult);
|
|
246
|
+
recordHookTelemetry(opts, connector, evt, response);
|
|
247
|
+
const reply = adapter.formatReply(event, response);
|
|
248
|
+
return {
|
|
249
|
+
exitCode: reply.exitCode,
|
|
250
|
+
...reply.stdout !== void 0 ? { stdout: reply.stdout } : {},
|
|
251
|
+
...reply.stderr !== void 0 ? { stderr: reply.stderr } : {}
|
|
252
|
+
};
|
|
253
|
+
} catch (err) {
|
|
254
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
255
|
+
log.error(`hook ${platformId}/${event} (${connectorId}) failed:`, message);
|
|
256
|
+
return failOpenOrPreserveDeny(opts, message);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
var DENY_PRESERVE_EVENTS = /* @__PURE__ */ new Set([
|
|
260
|
+
"PreToolUse",
|
|
261
|
+
"PermissionRequest"
|
|
262
|
+
]);
|
|
263
|
+
async function failOpenOrPreserveDeny(opts, errorMessage) {
|
|
264
|
+
if (!DENY_PRESERVE_EVENTS.has(opts.event)) return ALLOW;
|
|
265
|
+
try {
|
|
266
|
+
const connector = await loadRegisteredConnector(opts.connectorId);
|
|
267
|
+
const adapter = await loadAdapter(opts.platformId);
|
|
268
|
+
if (!adapter?.parseEvent || !adapter.formatReply) return ALLOW;
|
|
269
|
+
const definition = connector.hooks[opts.event];
|
|
270
|
+
if (!definition || typeof definition.handler !== "function") return ALLOW;
|
|
271
|
+
const perHost = definition.hosts?.[opts.platformId]?.handler;
|
|
272
|
+
const handler = typeof perHost === "function" ? perHost : definition.handler;
|
|
273
|
+
const raw = parseStdin(opts.stdin);
|
|
274
|
+
const evt = adapter.parseEvent(opts.event, raw);
|
|
275
|
+
evt.connectorId = opts.connectorId;
|
|
276
|
+
evt.capabilities = adapter.capabilities;
|
|
277
|
+
evt.scope = readRegisteredMeta(opts.connectorId)?.scope;
|
|
278
|
+
evt.telemetry = buildTelemetryAccessor(opts.connectorId);
|
|
279
|
+
const subject = eventMatcherSubject(evt);
|
|
280
|
+
if (subject !== void 0) {
|
|
281
|
+
const re = compileMatcher(definition.matcher);
|
|
282
|
+
if (re && !re.test(subject)) return ALLOW;
|
|
283
|
+
}
|
|
284
|
+
const response = normalizeResponse(await handler(evt));
|
|
285
|
+
if (response.decision !== "deny") return ALLOW;
|
|
286
|
+
const reply = adapter.formatReply(opts.event, response);
|
|
287
|
+
return {
|
|
288
|
+
exitCode: reply.exitCode,
|
|
289
|
+
...reply.stdout !== void 0 ? { stdout: reply.stdout } : {},
|
|
290
|
+
...reply.stderr !== void 0 ? { stderr: reply.stderr } : { stderr: errorMessage }
|
|
291
|
+
};
|
|
292
|
+
} catch {
|
|
293
|
+
return ALLOW;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
function nativeHookDef(connector, platformId, event) {
|
|
297
|
+
return connector.platforms[platformId]?.nativeHooks?.[event];
|
|
298
|
+
}
|
|
299
|
+
async function isNativeHookDeclared(platformId, event, connectorId) {
|
|
300
|
+
try {
|
|
301
|
+
const connector = await loadRegisteredConnector(connectorId);
|
|
302
|
+
return typeof nativeHookDef(connector, platformId, event)?.handler === "function";
|
|
303
|
+
} catch {
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
async function runNativeHook(opts) {
|
|
308
|
+
const { platformId, event, connectorId, stdin } = opts;
|
|
309
|
+
try {
|
|
310
|
+
const connector = await loadRegisteredConnector(connectorId);
|
|
311
|
+
const def = nativeHookDef(connector, platformId, event);
|
|
312
|
+
if (!def || typeof def.handler !== "function") {
|
|
313
|
+
return ALLOW;
|
|
314
|
+
}
|
|
315
|
+
const raw = parseStdin(stdin);
|
|
316
|
+
const sessionId = typeof raw?.session_id === "string" ? raw.session_id : "";
|
|
317
|
+
const cwd = raw?.cwd;
|
|
318
|
+
const evt = {
|
|
319
|
+
event,
|
|
320
|
+
hostPlatform: REGISTERED_PLATFORM_IDS.has(platformId) ? platformId : "unknown",
|
|
321
|
+
sessionId,
|
|
322
|
+
...typeof cwd === "string" && cwd !== "" ? { projectDir: cwd } : {},
|
|
323
|
+
raw
|
|
324
|
+
};
|
|
325
|
+
const result = await def.handler(evt);
|
|
326
|
+
recordHookTelemetry(opts, connector, evt, result === void 0 ? {} : result);
|
|
327
|
+
if (result === void 0) return ALLOW;
|
|
328
|
+
const json = JSON.stringify(result);
|
|
329
|
+
if (json === void 0) return ALLOW;
|
|
330
|
+
return { exitCode: 0, stdout: json };
|
|
331
|
+
} catch (err) {
|
|
332
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
333
|
+
log.error(
|
|
334
|
+
`native hook ${platformId}/${event} (${connectorId}) failed:`,
|
|
335
|
+
message
|
|
336
|
+
);
|
|
337
|
+
return ALLOW;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export {
|
|
342
|
+
buildTelemetryAccessor,
|
|
343
|
+
measureToolCall,
|
|
344
|
+
measureToolDefs,
|
|
345
|
+
eventMatcherSubject,
|
|
346
|
+
compileMatcher,
|
|
347
|
+
runHook,
|
|
348
|
+
isNativeHookDeclared,
|
|
349
|
+
runNativeHook
|
|
350
|
+
};
|
|
351
|
+
//# sourceMappingURL=chunk-2AVLX7GH.js.map
|