@ken-jo/agent-connector 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +176 -24
- package/dist/{amp-QSFH2V7Y.js → amp-YGV66GJT.js} +9 -2
- package/dist/amp-YGV66GJT.js.map +1 -0
- package/dist/{antigravity-CX2YLSY7.js → antigravity-7IBYFO6P.js} +4 -3
- package/dist/{antigravity-cli-YQDFVV4U.js → antigravity-cli-JEOUP2VN.js} +4 -3
- package/dist/{antigravity-cli-YQDFVV4U.js.map → antigravity-cli-JEOUP2VN.js.map} +1 -1
- package/dist/{chunk-LTT56GI3.js → chunk-3JCRUROU.js} +18 -5
- package/dist/chunk-3JCRUROU.js.map +1 -0
- package/dist/{chunk-YNZU6PAV.js → chunk-4ML7SZ7R.js} +69 -16
- package/dist/chunk-4ML7SZ7R.js.map +1 -0
- package/dist/{chunk-54EMKTTX.js → chunk-AKJGNTU3.js} +17 -17
- package/dist/chunk-AKJGNTU3.js.map +1 -0
- package/dist/chunk-GSGDG2BV.js +568 -0
- package/dist/chunk-GSGDG2BV.js.map +1 -0
- package/dist/{chunk-TRKWUNO4.js → chunk-KQSNDFBN.js} +13 -2
- package/dist/chunk-KQSNDFBN.js.map +1 -0
- package/dist/chunk-N6HH7K6P.js +494 -0
- package/dist/chunk-N6HH7K6P.js.map +1 -0
- package/dist/{chunk-XUCWLJY5.js → chunk-O2SBA5KR.js} +30 -30
- package/dist/{chunk-TIIP3RG2.js → chunk-PD4VFEBY.js} +342 -2
- package/dist/chunk-PD4VFEBY.js.map +1 -0
- package/dist/{chunk-WV63X7IK.js → chunk-SCVBYSF7.js} +2 -2
- package/dist/chunk-SCVBYSF7.js.map +1 -0
- package/dist/{chunk-7MSDGHJW.js → chunk-Z2BVYKZL.js} +60 -7
- package/dist/chunk-Z2BVYKZL.js.map +1 -0
- package/dist/claude-code-4275HQU4.js +1432 -0
- package/dist/claude-code-4275HQU4.js.map +1 -0
- package/dist/cli/sdk.js +4 -3
- package/dist/cli/sdk.js.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/{codebuff-QX57FJDN.js → codebuff-LE3KBZGM.js} +9 -2
- package/dist/codebuff-LE3KBZGM.js.map +1 -0
- package/dist/{codex-JFQTS6LU.js → codex-4BY2ZJIW.js} +148 -7
- package/dist/codex-4BY2ZJIW.js.map +1 -0
- package/dist/{copilot-cli-MTCGHZ2T.js → copilot-cli-IPISKO3V.js} +109 -2
- package/dist/copilot-cli-IPISKO3V.js.map +1 -0
- package/dist/{crush-I7PK3FGI.js → crush-X3E25EQG.js} +31 -3
- package/dist/crush-X3E25EQG.js.map +1 -0
- package/dist/{cursor-4TMXKJOZ.js → cursor-UH3W622V.js} +66 -5
- package/dist/cursor-UH3W622V.js.map +1 -0
- package/dist/{detect-WIAGVYS4.js → detect-JK7T46N6.js} +7 -3
- package/dist/detect-JK7T46N6.js.map +1 -0
- package/dist/{doctor-EZW2K4NI.js → doctor-62BHIXOR.js} +13 -5
- package/dist/doctor-62BHIXOR.js.map +1 -0
- package/dist/{droid-KN6VRMMT.js → droid-T5VBRXZF.js} +32 -3
- package/dist/droid-T5VBRXZF.js.map +1 -0
- package/dist/{gemini-cli-Y35FFK4M.js → gemini-cli-ZSUK55UA.js} +51 -3
- package/dist/gemini-cli-ZSUK55UA.js.map +1 -0
- package/dist/{goose-ZTGTSUFJ.js → goose-M3RR3CZG.js} +63 -4
- package/dist/goose-M3RR3CZG.js.map +1 -0
- package/dist/{hermes-H2KV44GK.js → hermes-CUNKIAR5.js} +76 -3
- package/dist/hermes-CUNKIAR5.js.map +1 -0
- package/dist/{hook-YVDILAMZ.js → hook-AC7APC66.js} +26 -11
- package/dist/hook-AC7APC66.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -1
- package/dist/{install-HQRYZOQ2.js → install-DMW2C7SV.js} +12 -7
- package/dist/install-DMW2C7SV.js.map +1 -0
- package/dist/{jetbrains-copilot-HWA3DMH7.js → jetbrains-copilot-C3HDGGML.js} +16 -2
- package/dist/jetbrains-copilot-C3HDGGML.js.map +1 -0
- package/dist/{kilo-QXJRCSLT.js → kilo-ISR5FBBJ.js} +26 -2
- package/dist/kilo-ISR5FBBJ.js.map +1 -0
- package/dist/{kilo-cli-EAQTHXUW.js → kilo-cli-2RNODHWY.js} +30 -2
- package/dist/kilo-cli-2RNODHWY.js.map +1 -0
- package/dist/{kimi-GQ7VXNYT.js → kimi-Q5RG7CYT.js} +89 -6
- package/dist/kimi-Q5RG7CYT.js.map +1 -0
- package/dist/{kiro-VQTT6LO2.js → kiro-EKTRW424.js} +31 -2
- package/dist/kiro-EKTRW424.js.map +1 -0
- package/dist/{leaderboard-K6ON3SWW.js → leaderboard-R5HRJHNU.js} +3 -3
- package/dist/{mux-T2TV4CIQ.js → mux-5CI5FP2W.js} +9 -2
- package/dist/mux-5CI5FP2W.js.map +1 -0
- package/dist/{omp-PB4VDKS6.js → omp-AXA7XY22.js} +13 -2
- package/dist/omp-AXA7XY22.js.map +1 -0
- package/dist/{openclaw-ETN2M63O.js → openclaw-UZ5BMCGQ.js} +101 -4
- package/dist/openclaw-UZ5BMCGQ.js.map +1 -0
- package/dist/{opencode-FZ33JKUZ.js → opencode-NZBRLJN3.js} +53 -7
- package/dist/opencode-NZBRLJN3.js.map +1 -0
- package/dist/{package-DLOVE2E4.js → package-O63K4S7T.js} +10 -5
- package/dist/package-O63K4S7T.js.map +1 -0
- package/dist/{pi-CIU2QHT4.js → pi-SJPIL4VE.js} +6 -2
- package/dist/pi-SJPIL4VE.js.map +1 -0
- package/dist/{qwen-code-5POCNU6P.js → qwen-code-IFCM6BJY.js} +110 -2
- package/dist/qwen-code-IFCM6BJY.js.map +1 -0
- package/dist/{roo-code-IOIUXRDE.js → roo-code-NI5UU6JB.js} +26 -2
- package/dist/roo-code-NI5UU6JB.js.map +1 -0
- package/dist/runtime/index.d.ts +38 -4
- package/dist/runtime/index.js +9 -4
- package/dist/{serve-HVWWY4B6.js → serve-LFOUSZAD.js} +7 -6
- package/dist/{serve-HVWWY4B6.js.map → serve-LFOUSZAD.js.map} +1 -1
- package/dist/{status-FE7TECZD.js → status-M7JLZVLC.js} +6 -5
- package/dist/{status-FE7TECZD.js.map → status-M7JLZVLC.js.map} +1 -1
- package/dist/{telemetry-36GESKQQ.js → telemetry-3NVEXPYX.js} +5 -4
- package/dist/{telemetry-36GESKQQ.js.map → telemetry-3NVEXPYX.js.map} +1 -1
- package/dist/{trae-JSNDZFKL.js → trae-CQC72RHH.js} +9 -2
- package/dist/trae-CQC72RHH.js.map +1 -0
- package/dist/types-CNigfEuR.d.ts +757 -0
- package/dist/{uninstall-IGCKNOSF.js → uninstall-H6FGMIHN.js} +7 -6
- package/dist/{uninstall-IGCKNOSF.js.map → uninstall-H6FGMIHN.js.map} +1 -1
- package/dist/{upgrade-JV2VK242.js → upgrade-76BQZBMA.js} +7 -6
- package/dist/{upgrade-JV2VK242.js.map → upgrade-76BQZBMA.js.map} +1 -1
- package/dist/{usage-6ER6EMEY.js → usage-G3GSCX23.js} +3 -3
- package/dist/{usage-event-JKBI6XCF.js → usage-event-QUTMNBS5.js} +6 -5
- package/dist/{usage-event-JKBI6XCF.js.map → usage-event-QUTMNBS5.js.map} +1 -1
- package/dist/{vscode-copilot-CK3NO54M.js → vscode-copilot-4RVRTCKV.js} +53 -4
- package/dist/vscode-copilot-4RVRTCKV.js.map +1 -0
- package/dist/{warp-QNVDXOG4.js → warp-LLOSXR7A.js} +30 -2
- package/dist/warp-LLOSXR7A.js.map +1 -0
- package/dist/{zed-VRJKWYUR.js → zed-HYOITK7F.js} +53 -3
- package/dist/zed-HYOITK7F.js.map +1 -0
- package/package.json +4 -3
- package/dist/amp-QSFH2V7Y.js.map +0 -1
- package/dist/chunk-54EMKTTX.js.map +0 -1
- package/dist/chunk-7MSDGHJW.js.map +0 -1
- package/dist/chunk-LTT56GI3.js.map +0 -1
- package/dist/chunk-TIIP3RG2.js.map +0 -1
- package/dist/chunk-TRKWUNO4.js.map +0 -1
- package/dist/chunk-WV63X7IK.js.map +0 -1
- package/dist/chunk-XNAM7F35.js +0 -276
- package/dist/chunk-XNAM7F35.js.map +0 -1
- package/dist/chunk-YNZU6PAV.js.map +0 -1
- package/dist/claude-code-HKDV7T32.js +0 -637
- package/dist/claude-code-HKDV7T32.js.map +0 -1
- package/dist/codebuff-QX57FJDN.js.map +0 -1
- package/dist/codex-JFQTS6LU.js.map +0 -1
- package/dist/copilot-cli-MTCGHZ2T.js.map +0 -1
- package/dist/crush-I7PK3FGI.js.map +0 -1
- package/dist/cursor-4TMXKJOZ.js.map +0 -1
- package/dist/detect-WIAGVYS4.js.map +0 -1
- package/dist/doctor-EZW2K4NI.js.map +0 -1
- package/dist/droid-KN6VRMMT.js.map +0 -1
- package/dist/gemini-cli-Y35FFK4M.js.map +0 -1
- package/dist/goose-ZTGTSUFJ.js.map +0 -1
- package/dist/hermes-H2KV44GK.js.map +0 -1
- package/dist/hook-YVDILAMZ.js.map +0 -1
- package/dist/install-HQRYZOQ2.js.map +0 -1
- package/dist/jetbrains-copilot-HWA3DMH7.js.map +0 -1
- package/dist/kilo-QXJRCSLT.js.map +0 -1
- package/dist/kilo-cli-EAQTHXUW.js.map +0 -1
- package/dist/kimi-GQ7VXNYT.js.map +0 -1
- package/dist/kiro-VQTT6LO2.js.map +0 -1
- package/dist/mux-T2TV4CIQ.js.map +0 -1
- package/dist/omp-PB4VDKS6.js.map +0 -1
- package/dist/openclaw-ETN2M63O.js.map +0 -1
- package/dist/opencode-FZ33JKUZ.js.map +0 -1
- package/dist/package-DLOVE2E4.js.map +0 -1
- package/dist/pi-CIU2QHT4.js.map +0 -1
- package/dist/qwen-code-5POCNU6P.js.map +0 -1
- package/dist/roo-code-IOIUXRDE.js.map +0 -1
- package/dist/trae-JSNDZFKL.js.map +0 -1
- package/dist/types-CYUB1OTr.d.ts +0 -427
- package/dist/vscode-copilot-CK3NO54M.js.map +0 -1
- package/dist/warp-QNVDXOG4.js.map +0 -1
- package/dist/zed-VRJKWYUR.js.map +0 -1
- /package/dist/{antigravity-CX2YLSY7.js.map → antigravity-7IBYFO6P.js.map} +0 -0
- /package/dist/{chunk-XUCWLJY5.js.map → chunk-O2SBA5KR.js.map} +0 -0
- /package/dist/{leaderboard-K6ON3SWW.js.map → leaderboard-R5HRJHNU.js.map} +0 -0
- /package/dist/{usage-6ER6EMEY.js.map → usage-G3GSCX23.js.map} +0 -0
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "./chunk-DBQMX75U.js";
|
|
9
9
|
import {
|
|
10
10
|
BaseAdapter
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-PD4VFEBY.js";
|
|
12
12
|
import "./chunk-7L6ITC4T.js";
|
|
13
13
|
import {
|
|
14
14
|
buildHomeBinHookCommand,
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
isHomeBinHookCommand,
|
|
17
17
|
shouldWrapForTelemetry
|
|
18
18
|
} from "./chunk-MEH7GC7R.js";
|
|
19
|
+
import "./chunk-N6HH7K6P.js";
|
|
19
20
|
import {
|
|
20
21
|
ensureDir
|
|
21
22
|
} from "./chunk-TRQKHP7D.js";
|
|
@@ -34,13 +35,24 @@ var EVENT_CAPABILITY = {
|
|
|
34
35
|
PostToolUse: "postToolUse",
|
|
35
36
|
PreCompact: "preCompact",
|
|
36
37
|
Stop: "stop",
|
|
37
|
-
Notification: "notification"
|
|
38
|
+
Notification: "notification",
|
|
39
|
+
// Newer events. Goose's hooks system ships a dedicated PostToolUseFailure;
|
|
40
|
+
// it has NO permission-dialog or subagent lifecycle events, so those three
|
|
41
|
+
// flags stay unset on `capabilities` and warn-skip at install.
|
|
42
|
+
PermissionRequest: "permissionRequest",
|
|
43
|
+
PostToolUseFailure: "postToolUseFailure",
|
|
44
|
+
SubagentStart: "subagentStart",
|
|
45
|
+
SubagentStop: "subagentStop"
|
|
38
46
|
};
|
|
39
47
|
var GooseAdapter = class extends BaseAdapter {
|
|
40
48
|
id = HOST;
|
|
41
49
|
name = "Goose";
|
|
42
50
|
paradigm = "json-stdio";
|
|
43
51
|
capabilities = {
|
|
52
|
+
// Memory surface: AGENTS.md-first managed block (project <projectDir>/AGENTS.md
|
|
53
|
+
// via the base default — goose reads AGENTS.md AND .goosehints at each level,
|
|
54
|
+
// .goosehints left untouched; user scope → the global .goosehints below).
|
|
55
|
+
supportsMemory: true,
|
|
44
56
|
preToolUse: true,
|
|
45
57
|
postToolUse: true,
|
|
46
58
|
preCompact: false,
|
|
@@ -49,6 +61,12 @@ var GooseAdapter = class extends BaseAdapter {
|
|
|
49
61
|
userPromptSubmit: false,
|
|
50
62
|
stop: false,
|
|
51
63
|
notification: false,
|
|
64
|
+
// Newer events: Goose ships a dedicated PostToolUseFailure hook (feedback
|
|
65
|
+
// beside the error; the failure itself is not blockable). Goose has no
|
|
66
|
+
// permission-dialog event and no subagent lifecycle hooks, so
|
|
67
|
+
// permissionRequest / subagentStart / subagentStop stay unset — install
|
|
68
|
+
// reports the standard skip-warn for them.
|
|
69
|
+
postToolUseFailure: true,
|
|
52
70
|
// Open Plugins documents PreToolUse/PostToolUse/SessionStart; argument
|
|
53
71
|
// rewrite is not guaranteed across versions, so default to the safe value.
|
|
54
72
|
canModifyArgs: false,
|
|
@@ -102,6 +120,24 @@ var GooseAdapter = class extends BaseAdapter {
|
|
|
102
120
|
}
|
|
103
121
|
return join(homedir(), ".config", "goose", "config.yaml");
|
|
104
122
|
}
|
|
123
|
+
// ── Memory surface: global .goosehints at user scope ────────────────────
|
|
124
|
+
// Project scope stays on the AGENTS.md base default (goose reads project
|
|
125
|
+
// AGENTS.md and .goosehints at each level by default — one canonical copy in
|
|
126
|
+
// the standard file; the user's .goosehints is never touched). User scope:
|
|
127
|
+
// goose's only documented global memory file is the .goosehints next to
|
|
128
|
+
// config.yaml (~/.config/goose/.goosehints; Windows under
|
|
129
|
+
// %APPDATA%\Block\goose\config — adapter-corroborated, verify per version).
|
|
130
|
+
memoryTargets(ctx) {
|
|
131
|
+
if (this.memoryOverride(ctx)?.path || ctx.scope !== "user") {
|
|
132
|
+
return super.memoryTargets(ctx);
|
|
133
|
+
}
|
|
134
|
+
return [
|
|
135
|
+
{
|
|
136
|
+
path: join(dirname(this.userConfigPath()), ".goosehints"),
|
|
137
|
+
reason: "goose global hints file (.goosehints beside config.yaml)"
|
|
138
|
+
}
|
|
139
|
+
];
|
|
140
|
+
}
|
|
105
141
|
// ── MCP server install / uninstall (YAML — merge via readYaml/writeYaml) ──
|
|
106
142
|
installServer(ctx) {
|
|
107
143
|
const { connector, dryRun } = ctx;
|
|
@@ -317,6 +353,7 @@ var GooseAdapter = class extends BaseAdapter {
|
|
|
317
353
|
{
|
|
318
354
|
name: `${this.name}: ${MCP_ROOT_KEY}.${id} registered`,
|
|
319
355
|
check: () => {
|
|
356
|
+
if (!ctx.connector.server) return { status: "OK", detail: "no MCP server declared" };
|
|
320
357
|
const cfg = readYaml(serverPath);
|
|
321
358
|
const bucket = cfg?.[MCP_ROOT_KEY];
|
|
322
359
|
const present = typeof bucket === "object" && bucket !== null && !Array.isArray(bucket) && id in bucket;
|
|
@@ -410,6 +447,23 @@ var GooseAdapter = class extends BaseAdapter {
|
|
|
410
447
|
};
|
|
411
448
|
return ev;
|
|
412
449
|
}
|
|
450
|
+
case "PostToolUseFailure": {
|
|
451
|
+
const ev = {
|
|
452
|
+
...base,
|
|
453
|
+
toolName: input.tool_name ?? "",
|
|
454
|
+
toolInput: input.tool_input ?? {},
|
|
455
|
+
error: typeof input.error === "string" ? input.error : "",
|
|
456
|
+
...typeof input.tool_use_id === "string" ? { toolUseId: input.tool_use_id } : {},
|
|
457
|
+
...typeof input.is_interrupt === "boolean" ? { isInterrupt: input.is_interrupt } : {},
|
|
458
|
+
...typeof input.duration_ms === "number" ? { durationMs: input.duration_ms } : {}
|
|
459
|
+
};
|
|
460
|
+
return ev;
|
|
461
|
+
}
|
|
462
|
+
case "PermissionRequest":
|
|
463
|
+
case "SubagentStart":
|
|
464
|
+
case "SubagentStop": {
|
|
465
|
+
throw new Error(`unsupported goose hook event: ${String(event)}`);
|
|
466
|
+
}
|
|
413
467
|
default: {
|
|
414
468
|
const _never = event;
|
|
415
469
|
throw new Error(`unsupported goose hook event: ${String(_never)}`);
|
|
@@ -417,8 +471,13 @@ var GooseAdapter = class extends BaseAdapter {
|
|
|
417
471
|
}
|
|
418
472
|
}
|
|
419
473
|
// ── Runtime: normalized response → Goose native hook reply (Claude-shaped) ─
|
|
420
|
-
formatReply(
|
|
474
|
+
formatReply(event, response) {
|
|
421
475
|
const decision = response.decision ?? "allow";
|
|
476
|
+
if (event === "PostToolUseFailure") {
|
|
477
|
+
const context = decision === "context" ? response.additionalContext : decision === "deny" ? response.reason ?? response.additionalContext : void 0;
|
|
478
|
+
if (context) return this.stdout({ additionalContext: context });
|
|
479
|
+
return { exitCode: 0 };
|
|
480
|
+
}
|
|
422
481
|
if (decision === "deny") {
|
|
423
482
|
return this.stdout({
|
|
424
483
|
decision: "block",
|
|
@@ -477,4 +536,4 @@ export {
|
|
|
477
536
|
adapter,
|
|
478
537
|
goose_default as default
|
|
479
538
|
};
|
|
480
|
-
//# sourceMappingURL=goose-
|
|
539
|
+
//# sourceMappingURL=goose-M3RR3CZG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/adapters/goose/index.ts"],"sourcesContent":["/**\n * adapters/goose — Block's Goose platform adapter for agent-connector.\n *\n * Goose is a json-stdio host, but its two config surfaces use DIFFERENT formats:\n *\n * - MCP servers (Goose calls them \"extensions\") live in a YAML config under the\n * root key `extensions`. The native stdio entry shape is Goose-specific:\n * { type: \"stdio\", cmd: <exe>, args: [...], envs: {...}, timeout, enabled }\n * NOTE the field is `cmd` (NOT `command`) and the env map is `envs` (NOT\n * `env`). Because the file is YAML, the BaseAdapter JSON helpers do not apply\n * — we merge via core/yaml's readYaml/writeYaml, preserving any other config.\n *\n * - Hooks use Goose's Open Plugins system, which stores hook registrations in\n * JSON at <root>/.agents/plugins/<plugin-name>/hooks/hooks.json (project root\n * = <projectDir>/.agents; user root = ~/.agents):\n * { hooks: { <Event>: [ { matcher?, hooks:[{ type:\"command\", command }] } ] } }\n * The shape is the Claude-style NESTED rule (an optional `matcher` plus an\n * inner `hooks` array), and there is NO top-level `version` key. This file is\n * plain JSON, so the standard fs/JSON helpers are used for it.\n *\n * Wire protocol (parse) is Claude-compatible JSON on stdin, except Goose names\n * the working directory field `working_dir` (not `cwd`). The deny reply is\n * Goose's `{ decision: \"block\", reason }` (NOT Claude's hookSpecificOutput\n * permissionDecision shape).\n *\n * Native config locations (user scope):\n * - Linux/macOS: ~/.config/goose/config.yaml\n * - Windows: %APPDATA%/Block/goose/config/config.yaml\n */\n\nimport { existsSync, writeFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\n\nimport { BaseAdapter } from \"../base.js\";\nimport type { Adapter, HookReply, InstallContext, MemoryTarget, NormalizedEvent } from \"../spi.js\";\nimport type {\n ChangeRecord,\n DetectedPlatform,\n HealthCheck,\n HookEventName,\n HookParadigm,\n HookResponse,\n NotificationEvent,\n PlatformCapabilities,\n PlatformId,\n PostToolUseEvent,\n PostToolUseFailureEvent,\n PreCompactEvent,\n PreToolUseEvent,\n SessionEndEvent,\n SessionStartEvent,\n ServerDef,\n StopEvent,\n UserPromptSubmitEvent,\n} from \"../../core/types.js\";\nimport { ensureDir } from \"../../core/paths.js\";\nimport { readYaml, writeYaml } from \"../../core/yaml.js\";\nimport { resolveEnvRefsDeep } from \"../../core/interpolate.js\";\nimport {\n buildHomeBinHookCommand,\n buildServeWrapperCommand,\n isHomeBinHookCommand,\n shouldWrapForTelemetry,\n} from \"../../core/spawn.js\";\n\nconst HOST: PlatformId = \"goose\";\n/** Root key under which Goose stores MCP servers (\"extensions\") in config.yaml. */\nconst MCP_ROOT_KEY = \"extensions\";\n\n/**\n * Map each normalized hook event to the matching capability flag on this\n * adapter. The adapter's own `capabilities` literal is the single source of\n * truth for what Goose's Open-Plugins runtime delivers (PreToolUse/PostToolUse/\n * SessionStart/PostToolUseFailure); installHooks filters declared events\n * through this map so an unsupported event (e.g. UserPromptSubmit) is never\n * written verbatim into hooks.json — it is reported as a graceful warn/skip\n * instead.\n */\nconst EVENT_CAPABILITY: Record<HookEventName, keyof PlatformCapabilities> = {\n SessionStart: \"sessionStart\",\n SessionEnd: \"sessionEnd\",\n UserPromptSubmit: \"userPromptSubmit\",\n PreToolUse: \"preToolUse\",\n PostToolUse: \"postToolUse\",\n PreCompact: \"preCompact\",\n Stop: \"stop\",\n Notification: \"notification\",\n // Newer events. Goose's hooks system ships a dedicated PostToolUseFailure;\n // it has NO permission-dialog or subagent lifecycle events, so those three\n // flags stay unset on `capabilities` and warn-skip at install.\n PermissionRequest: \"permissionRequest\",\n PostToolUseFailure: \"postToolUseFailure\",\n SubagentStart: \"subagentStart\",\n SubagentStop: \"subagentStop\",\n};\n\n/**\n * Goose extension (MCP server) entry — note the Goose-specific field names:\n * `cmd` (not `command`) and `envs` (not `env`).\n */\ninterface GooseStdioExtension {\n type: \"stdio\";\n cmd: string;\n args: string[];\n envs?: Record<string, string>;\n timeout: number;\n enabled: boolean;\n}\n\n/** One inner command entry inside a hook rule. */\ninterface GooseHookCommand {\n type: \"command\";\n command: string;\n}\n\n/**\n * One nested-rule entry under a hook event. Goose's Open Plugins spec uses the\n * Claude-shaped nested rule: an optional `matcher` plus an inner `hooks` array\n * of `{ type, command }` commands (NOT a flat list of commands).\n */\ninterface GooseHookRule {\n matcher?: string;\n hooks: GooseHookCommand[];\n}\n\n/**\n * Goose Open-Plugins hooks.json shape: `{ hooks: { <Event>: [ rule, ... ] } }`.\n * There is NO top-level `version` key in the spec.\n */\ninterface GooseHooksFile {\n hooks: Record<string, GooseHookRule[]>;\n}\n\n/** Raw Goose hook stdin payload (Claude-compatible JSON). */\ninterface GooseWireInput {\n session_id?: string;\n /** Goose names the working directory `working_dir`; `cwd` is a fallback. */\n working_dir?: string;\n cwd?: string;\n hook_event_name?: string;\n tool_name?: string;\n tool_input?: Record<string, unknown>;\n tool_response?: unknown;\n // PostToolUseFailure (Claude-compatible failure fields)\n tool_use_id?: string;\n error?: string;\n is_interrupt?: boolean;\n duration_ms?: number;\n source?: string;\n reason?: string;\n prompt?: string;\n trigger?: string;\n stop_hook_active?: boolean;\n message?: string;\n is_error?: boolean;\n /** Injected by the entrypoint so the runtime knows which connector to dispatch. */\n connector?: string;\n}\n\nexport class GooseAdapter extends BaseAdapter implements Adapter {\n readonly id: PlatformId = HOST;\n readonly name = \"Goose\";\n readonly paradigm: HookParadigm = \"json-stdio\";\n\n readonly capabilities: PlatformCapabilities = {\n // Memory surface: AGENTS.md-first managed block (project <projectDir>/AGENTS.md\n // via the base default — goose reads AGENTS.md AND .goosehints at each level,\n // .goosehints left untouched; user scope → the global .goosehints below).\n supportsMemory: true,\n preToolUse: true,\n postToolUse: true,\n preCompact: false,\n sessionStart: true,\n sessionEnd: false,\n userPromptSubmit: false,\n stop: false,\n notification: false,\n // Newer events: Goose ships a dedicated PostToolUseFailure hook (feedback\n // beside the error; the failure itself is not blockable). Goose has no\n // permission-dialog event and no subagent lifecycle hooks, so\n // permissionRequest / subagentStart / subagentStop stay unset — install\n // reports the standard skip-warn for them.\n postToolUseFailure: true,\n // Open Plugins documents PreToolUse/PostToolUse/SessionStart; argument\n // rewrite is not guaranteed across versions, so default to the safe value.\n canModifyArgs: false,\n canModifyOutput: false,\n canInjectSessionContext: true,\n transports: [\"stdio\", \"sse\", \"http\"],\n };\n\n // ── Detection ────────────────────────────────────────────────────────────\n\n detectInstalled(_projectDir: string): DetectedPlatform {\n const configPath = this.userConfigPath();\n const configDir = dirname(configPath);\n const installed = existsSync(configDir) || existsSync(configPath);\n return {\n id: this.id,\n name: this.name,\n installed,\n paradigm: this.paradigm,\n capabilities: this.capabilities,\n configPath,\n scope: \"user\",\n reason: installed\n ? `found Goose config at ${configPath}`\n : `no Goose config at ${configPath}`,\n confidence: installed ? \"high\" : \"low\",\n };\n }\n\n // ── Native paths ─────────────────────────────────────────────────────────\n\n override getConfigDir(_ctx: InstallContext): string {\n return dirname(this.userConfigPath());\n }\n\n /** MCP config: the YAML config.yaml (user scope). */\n override getServerConfigPath(_ctx: InstallContext): string {\n return this.userConfigPath();\n }\n\n /**\n * Hooks: Open-Plugins hooks.json under the `.agents/plugins/<plugin-name>/`\n * dir. The connector id is the plugin name. Project scope roots at\n * `<projectDir>/.agents`; user scope roots at `~/.agents`.\n */\n override getHookConfigPath(ctx: InstallContext): string {\n const root = ctx.scope === \"project\" ? ctx.projectDir : homedir();\n return join(root, \".agents\", \"plugins\", ctx.connector.id, \"hooks\", \"hooks.json\");\n }\n\n /**\n * OS-correct user config.yaml path:\n * - Windows: %APPDATA%/Block/goose/config/config.yaml\n * - macOS/Linux: ~/.config/goose/config.yaml\n */\n private userConfigPath(): string {\n if (process.platform === \"win32\") {\n const appData =\n process.env.APPDATA && process.env.APPDATA.trim() !== \"\"\n ? process.env.APPDATA\n : join(homedir(), \"AppData\", \"Roaming\");\n return join(appData, \"Block\", \"goose\", \"config\", \"config.yaml\");\n }\n return join(homedir(), \".config\", \"goose\", \"config.yaml\");\n }\n\n // ── Memory surface: global .goosehints at user scope ────────────────────\n // Project scope stays on the AGENTS.md base default (goose reads project\n // AGENTS.md and .goosehints at each level by default — one canonical copy in\n // the standard file; the user's .goosehints is never touched). User scope:\n // goose's only documented global memory file is the .goosehints next to\n // config.yaml (~/.config/goose/.goosehints; Windows under\n // %APPDATA%\\Block\\goose\\config — adapter-corroborated, verify per version).\n protected override memoryTargets(ctx: InstallContext): MemoryTarget[] {\n if (this.memoryOverride(ctx)?.path || ctx.scope !== \"user\") {\n return super.memoryTargets(ctx);\n }\n return [\n {\n path: join(dirname(this.userConfigPath()), \".goosehints\"),\n reason: \"goose global hints file (.goosehints beside config.yaml)\",\n },\n ];\n }\n\n // ── MCP server install / uninstall (YAML — merge via readYaml/writeYaml) ──\n\n override installServer(ctx: InstallContext): ChangeRecord[] {\n const { connector, dryRun } = ctx;\n const path = this.getServerConfigPath(ctx);\n const server = this.effectiveServer(ctx);\n\n if (!server) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n path,\n detail: connector.server\n ? \"server registration disabled for goose\"\n : \"connector declares no MCP server\",\n },\n ];\n }\n\n const entry = this.renderExtension(ctx, server);\n\n // Merge into existing YAML, preserving every other config key + extension.\n const cfg = readYaml<Record<string, unknown>>(path) ?? {};\n const bucketRaw = cfg[MCP_ROOT_KEY];\n const bucket: Record<string, unknown> =\n bucketRaw && typeof bucketRaw === \"object\" && !Array.isArray(bucketRaw)\n ? (bucketRaw as Record<string, unknown>)\n : {};\n cfg[MCP_ROOT_KEY] = bucket;\n\n const before = JSON.stringify(bucket[connector.id]);\n const after = JSON.stringify(entry);\n let action: ChangeRecord[\"action\"];\n if (before === undefined) action = \"create\";\n else if (before === after) action = \"skip\";\n else action = \"update\";\n\n if (action !== \"skip\") {\n bucket[connector.id] = entry;\n writeYaml(path, cfg, dryRun);\n }\n return [{ platform: this.id, action, path, detail: `${MCP_ROOT_KEY}.${connector.id}` }];\n }\n\n override uninstallServer(ctx: InstallContext): ChangeRecord[] {\n const { connector, dryRun } = ctx;\n const path = this.getServerConfigPath(ctx);\n const cfg = readYaml<Record<string, unknown>>(path);\n const bucketRaw = cfg?.[MCP_ROOT_KEY];\n if (\n !cfg ||\n !bucketRaw ||\n typeof bucketRaw !== \"object\" ||\n Array.isArray(bucketRaw) ||\n !(connector.id in (bucketRaw as Record<string, unknown>))\n ) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n path,\n detail: `${MCP_ROOT_KEY}.${connector.id} absent`,\n },\n ];\n }\n delete (bucketRaw as Record<string, unknown>)[connector.id];\n writeYaml(path, cfg, dryRun);\n return [\n { platform: this.id, action: \"remove\", path, detail: `${MCP_ROOT_KEY}.${connector.id}` },\n ];\n }\n\n /**\n * Render a normalized ServerDef into Goose's native extension entry. Goose has\n * no native env interpolation, so `${env:VAR}` refs are resolved to literals at\n * install time. Honors the telemetry serve-wrapper (cmd=homeBin, args=[serve…]).\n */\n private renderExtension(ctx: InstallContext, server: ServerDef): GooseStdioExtension {\n let cmd = server.command ?? \"\";\n let args = [...(server.args ?? [])];\n\n if (shouldWrapForTelemetry(server, ctx.connector.telemetry)) {\n const wrapped = buildServeWrapperCommand(\n ctx.homeBinPath,\n ctx.connector.id,\n cmd,\n args,\n ctx.scope,\n this.id,\n );\n cmd = wrapped.command;\n args = wrapped.args;\n }\n\n cmd = resolveEnvRefsDeep(cmd);\n args = resolveEnvRefsDeep(args);\n\n const timeoutMs = server.timeoutMs;\n const timeout =\n typeof timeoutMs === \"number\" && timeoutMs > 0 ? Math.round(timeoutMs / 1000) : 300;\n\n const entry: GooseStdioExtension = {\n type: \"stdio\",\n cmd,\n args,\n timeout,\n enabled: server.enabled !== false,\n };\n\n if (server.env && Object.keys(server.env).length > 0) {\n const envs: Record<string, string> = {};\n for (const [k, v] of Object.entries(resolveEnvRefsDeep(server.env))) {\n envs[k] = String(v);\n }\n entry.envs = envs;\n }\n return entry;\n }\n\n // ── Hook install / uninstall (JSON Open-Plugins hooks.json) ───────────────\n\n override installHooks(ctx: InstallContext): ChangeRecord[] {\n const { connector, dryRun } = ctx;\n const path = this.getHookConfigPath(ctx);\n\n if (connector.platforms[HOST]?.hooks === false) {\n return [{ platform: this.id, action: \"skip\", path, detail: \"hooks disabled for goose\" }];\n }\n const events = connector.hookEvents;\n if (events.length === 0) {\n return [{ platform: this.id, action: \"skip\", path, detail: \"connector declares no hooks\" }];\n }\n\n const file = this.readHooksFile(path);\n const changes: ChangeRecord[] = [];\n let mutated = false;\n\n for (const event of events) {\n // CAPABILITY FILTER: only write events Goose's Open-Plugins runtime\n // actually delivers. Derive support from THIS adapter's capabilities (the\n // single source of truth) so an event Goose does not support (e.g.\n // UserPromptSubmit) is reported as a graceful warn and never written\n // verbatim into hooks.json — mirroring the cursor adapter's pattern.\n if (this.capabilities[EVENT_CAPABILITY[event]] !== true) {\n changes.push({\n platform: this.id,\n action: \"warn\",\n path,\n detail: `${event} unsupported on goose — skipped`,\n });\n continue;\n }\n\n const command = buildHomeBinHookCommand(ctx.homeBinPath, HOST, event, connector.id);\n const matcher = connector.hooks[event]?.matcher ?? \"\";\n const desired: GooseHookRule = {\n matcher,\n hooks: [{ type: \"command\", command }],\n };\n const bucket = (file.hooks[event] ??= []);\n const idx = bucket.findIndex((rule) => this.ruleHasOurCommand(rule, ctx));\n\n if (idx >= 0) {\n if (JSON.stringify(bucket[idx]) === JSON.stringify(desired)) {\n changes.push({ platform: this.id, action: \"skip\", path, detail: `hooks.${event}` });\n continue;\n }\n bucket[idx] = desired;\n changes.push({ platform: this.id, action: \"update\", path, detail: `hooks.${event}` });\n } else {\n bucket.push(desired);\n changes.push({ platform: this.id, action: \"create\", path, detail: `hooks.${event}` });\n }\n mutated = true;\n }\n\n if (mutated) this.writeHooksFile(path, file, dryRun);\n return changes;\n }\n\n override uninstallHooks(ctx: InstallContext): ChangeRecord[] {\n const path = this.getHookConfigPath(ctx);\n const file = this.readJson<GooseHooksFile>(path);\n if (!file || !file.hooks || typeof file.hooks !== \"object\") {\n return [{ platform: this.id, action: \"skip\", path, detail: \"no hooks.json\" }];\n }\n\n const changes: ChangeRecord[] = [];\n let mutated = false;\n for (const event of Object.keys(file.hooks)) {\n const bucket = file.hooks[event];\n if (!Array.isArray(bucket)) continue;\n\n // Strip our command from each rule's inner `hooks` array; drop rules left\n // empty so we never remove another connector's (or the user's own) hooks.\n const next: GooseHookRule[] = [];\n let removed = 0;\n for (const rule of bucket) {\n const innerBefore = rule.hooks?.length ?? 0;\n const inner = (rule.hooks ?? []).filter((h) => !this.isOurCommand(h.command, ctx));\n removed += innerBefore - inner.length;\n if (inner.length > 0) {\n next.push({ ...(rule.matcher !== undefined ? { matcher: rule.matcher } : {}), hooks: inner });\n }\n }\n\n if (removed === 0) continue;\n mutated = true;\n if (next.length > 0) file.hooks[event] = next;\n else delete file.hooks[event];\n changes.push({\n platform: this.id,\n action: \"remove\",\n path,\n detail: `hooks.${event} (${removed})`,\n });\n }\n\n if (mutated) this.writeHooksFile(path, file, ctx.dryRun);\n if (changes.length === 0) {\n return [{ platform: this.id, action: \"skip\", path, detail: \"no matching hook entries\" }];\n }\n return changes;\n }\n\n /** True when a hook command is ours (anchored home-bin + connector id). */\n private isOurCommand(command: string | undefined, ctx: InstallContext): boolean {\n return isHomeBinHookCommand(command, ctx.homeBinPath, ctx.connector.id);\n }\n\n /** True when any inner command of a nested rule is ours. */\n private ruleHasOurCommand(rule: GooseHookRule, ctx: InstallContext): boolean {\n return (rule.hooks ?? []).some((h) => this.isOurCommand(h.command, ctx));\n }\n\n private readHooksFile(path: string): GooseHooksFile {\n const existing = this.readJson<GooseHooksFile>(path);\n if (existing && existing.hooks && typeof existing.hooks === \"object\") {\n return { hooks: existing.hooks };\n }\n return { hooks: {} };\n }\n\n private writeHooksFile(path: string, file: GooseHooksFile, dryRun: boolean): void {\n if (dryRun) return;\n ensureDir(dirname(path));\n writeFileSync(path, `${JSON.stringify(file, null, 2)}\\n`, \"utf8\");\n }\n\n // ── Diagnostics ──────────────────────────────────────────────────────────\n\n override getHealthChecks(ctx: InstallContext): readonly HealthCheck[] {\n const serverPath = this.getServerConfigPath(ctx);\n const hookPath = this.getHookConfigPath(ctx);\n const id = ctx.connector.id;\n const homeBin = ctx.homeBinPath;\n const hookEvents = ctx.connector.hookEvents;\n return [\n {\n name: `${this.name}: config.yaml present`,\n check: () =>\n existsSync(serverPath)\n ? { status: \"OK\", detail: serverPath }\n : { status: \"FAIL\", detail: `not found: ${serverPath}` },\n },\n {\n name: `${this.name}: ${MCP_ROOT_KEY}.${id} registered`,\n check: () => {\n if (!ctx.connector.server) return { status: \"OK\", detail: \"no MCP server declared\" };\n const cfg = readYaml<Record<string, unknown>>(serverPath);\n const bucket = cfg?.[MCP_ROOT_KEY];\n const present =\n typeof bucket === \"object\" &&\n bucket !== null &&\n !Array.isArray(bucket) &&\n id in (bucket as Record<string, unknown>);\n return present\n ? { status: \"OK\", detail: `${MCP_ROOT_KEY}.${id}` }\n : { status: \"FAIL\", detail: `${MCP_ROOT_KEY}.${id} not found in ${serverPath}` };\n },\n },\n {\n name: `${this.name}: hook command registered`,\n check: () => {\n if (hookEvents.length === 0) return { status: \"OK\", detail: \"no hooks declared\" };\n const file = this.readJson<GooseHooksFile>(hookPath);\n if (!file || !file.hooks) {\n return { status: \"FAIL\", detail: `cannot read ${hookPath}` };\n }\n const registered = Object.values(file.hooks).some((bucket) =>\n (bucket ?? []).some((rule) =>\n (rule.hooks ?? []).some((h) => isHomeBinHookCommand(h.command, homeBin, id)),\n ),\n );\n return registered\n ? { status: \"OK\", detail: \"hook command present\" }\n : { status: \"FAIL\", detail: `no hook for ${id} in ${hookPath}` };\n },\n },\n ];\n }\n\n // ── Runtime: parse Goose stdin JSON → normalized event ───────────────────\n\n parseEvent(event: HookEventName, raw: unknown): NormalizedEvent {\n const input = (raw ?? {}) as GooseWireInput;\n // Goose sends the working directory as `working_dir`; fall back to `cwd`.\n const projectDir =\n typeof input.working_dir === \"string\"\n ? input.working_dir\n : typeof input.cwd === \"string\"\n ? input.cwd\n : undefined;\n const base = {\n hostPlatform: HOST,\n connectorId: typeof input.connector === \"string\" ? input.connector : \"\",\n sessionId: typeof input.session_id === \"string\" ? input.session_id : \"\",\n ...(projectDir !== undefined ? { projectDir } : {}),\n raw,\n } as const;\n\n switch (event) {\n case \"PreToolUse\": {\n const ev: PreToolUseEvent = {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n };\n return ev;\n }\n case \"PostToolUse\": {\n const ev: PostToolUseEvent = {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n ...(toolResponseToString(input.tool_response) !== undefined\n ? { toolOutput: toolResponseToString(input.tool_response) }\n : {}),\n ...(typeof input.is_error === \"boolean\" ? { isError: input.is_error } : {}),\n };\n return ev;\n }\n case \"SessionStart\": {\n const ev: SessionStartEvent = { ...base, source: normalizeSource(input.source) };\n return ev;\n }\n case \"SessionEnd\": {\n const ev: SessionEndEvent = {\n ...base,\n ...(typeof input.reason === \"string\" ? { reason: input.reason } : {}),\n };\n return ev;\n }\n case \"UserPromptSubmit\": {\n const ev: UserPromptSubmitEvent = {\n ...base,\n prompt: typeof input.prompt === \"string\" ? input.prompt : \"\",\n };\n return ev;\n }\n case \"PreCompact\": {\n const ev: PreCompactEvent = {\n ...base,\n ...(input.trigger === \"auto\" || input.trigger === \"manual\"\n ? { trigger: input.trigger }\n : {}),\n };\n return ev;\n }\n case \"Stop\": {\n const ev: StopEvent = {\n ...base,\n ...(typeof input.stop_hook_active === \"boolean\"\n ? { stopHookActive: input.stop_hook_active }\n : {}),\n };\n return ev;\n }\n case \"Notification\": {\n const ev: NotificationEvent = {\n ...base,\n message: typeof input.message === \"string\" ? input.message : \"\",\n };\n return ev;\n }\n case \"PostToolUseFailure\": {\n const ev: PostToolUseFailureEvent = {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n error: typeof input.error === \"string\" ? input.error : \"\",\n ...(typeof input.tool_use_id === \"string\"\n ? { toolUseId: input.tool_use_id }\n : {}),\n ...(typeof input.is_interrupt === \"boolean\"\n ? { isInterrupt: input.is_interrupt }\n : {}),\n ...(typeof input.duration_ms === \"number\"\n ? { durationMs: input.duration_ms }\n : {}),\n };\n return ev;\n }\n case \"PermissionRequest\":\n case \"SubagentStart\":\n case \"SubagentStop\": {\n // No Goose analog (no permission-dialog event, no subagent lifecycle\n // hooks). Install already skip-warns these via EVENT_CAPABILITY; a\n // runtime dispatch is a mis-route — fail loudly.\n throw new Error(`unsupported goose hook event: ${String(event)}`);\n }\n default: {\n const _never: never = event;\n throw new Error(`unsupported goose hook event: ${String(_never)}`);\n }\n }\n }\n\n // ── Runtime: normalized response → Goose native hook reply (Claude-shaped) ─\n\n formatReply(event: HookEventName, response: HookResponse): HookReply {\n const decision = response.decision ?? \"allow\";\n\n // PostToolUseFailure is feedback-only (the tool already failed, nothing is\n // blockable): \"context\" injects additionalContext beside the error, and a\n // \"deny\" DEGRADES to the same shape carrying the reason — it must never\n // render as `{ decision: \"block\" }`.\n if (event === \"PostToolUseFailure\") {\n const context =\n decision === \"context\"\n ? response.additionalContext\n : decision === \"deny\"\n ? response.reason ?? response.additionalContext\n : undefined;\n if (context) return this.stdout({ additionalContext: context });\n return { exitCode: 0 };\n }\n\n // deny → Goose blocks via `{ decision: \"block\", reason }` on stdout JSON\n // (NOT Claude's hookSpecificOutput.permissionDecision shape).\n if (decision === \"deny\") {\n return this.stdout({\n decision: \"block\",\n reason: response.reason ?? \"Blocked by hook\",\n });\n }\n\n // ask → Goose has no native \"ask\"; degrade to block to stay fail-safe.\n if (decision === \"ask\") {\n return this.stdout({\n decision: \"block\",\n reason: response.reason ?? \"Confirmation required by hook\",\n });\n }\n\n if (decision === \"context\" && response.additionalContext) {\n return this.stdout({ additionalContext: response.additionalContext });\n }\n\n // allow / modify (unsupported) / void → pass through.\n return { exitCode: 0 };\n }\n\n private stdout(payload: unknown): HookReply {\n return { exitCode: 0, stdout: JSON.stringify(payload) };\n }\n\n // ── Internal helpers ──────────────────────────────────────────────────────\n\n /** Resolve the per-platform server override into an effective ServerDef. */\n private effectiveServer(ctx: InstallContext): ServerDef | undefined {\n const override = ctx.connector.platforms[this.id]?.server;\n if (override === false) return undefined;\n const base = ctx.connector.server;\n if (!base) return undefined;\n return override && typeof override === \"object\" ? { ...base, ...override } : base;\n }\n}\n\n/** Coerce a Goose PostToolUse `tool_response` into a string. */\nfunction toolResponseToString(value: unknown): string | undefined {\n if (value == null) return undefined;\n if (typeof value === \"string\") return value;\n try {\n return JSON.stringify(value);\n } catch {\n return String(value);\n }\n}\n\nfunction normalizeSource(raw: string | undefined): SessionStartEvent[\"source\"] {\n switch (raw) {\n case \"compact\":\n return \"compact\";\n case \"resume\":\n return \"resume\";\n case \"clear\":\n return \"clear\";\n default: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I;AAAA,EAC/E;AACF;AAGA,SAAS,qBAAqB,OAAoC;AAChE,MAAI,SAAS,KAAM,QAAO;AAC1B,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,MAAI;AACF,WAAO,KAAK,UAAU,KAAK;AAAA,EAC7B,QAAQ;AACN,WAAO,OAAO,KAAK;AAAA,EACrB;AACF;AAEA,SAAS,gBAAgB,KAAsD;AAC7E,UAAQ,KAAK;AAAA,IACX,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAEO,IAAM,UAAU,IAAI,aAAa;AACxC,IAAO,gBAAQ;","names":[]}
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "./chunk-DBQMX75U.js";
|
|
9
9
|
import {
|
|
10
10
|
BaseAdapter
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-PD4VFEBY.js";
|
|
12
12
|
import "./chunk-7L6ITC4T.js";
|
|
13
13
|
import {
|
|
14
14
|
buildHomeBinHookCommand,
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
isHomeBinHookCommand,
|
|
17
17
|
shouldWrapForTelemetry
|
|
18
18
|
} from "./chunk-MEH7GC7R.js";
|
|
19
|
+
import "./chunk-N6HH7K6P.js";
|
|
19
20
|
import "./chunk-TRQKHP7D.js";
|
|
20
21
|
|
|
21
22
|
// src/adapters/hermes/index.ts
|
|
@@ -30,13 +31,25 @@ var EVENT_TO_HERMES = {
|
|
|
30
31
|
PreToolUse: "pre_tool_call",
|
|
31
32
|
PostToolUse: "post_tool_call",
|
|
32
33
|
SessionStart: "on_session_start",
|
|
33
|
-
SessionEnd: "on_session_end"
|
|
34
|
+
SessionEnd: "on_session_end",
|
|
35
|
+
// Hermes is a STOP-ONLY subagent host: subagent_stop fires when a
|
|
36
|
+
// delegate_task child exits (child_status ∈ completed/failed/interrupted/
|
|
37
|
+
// error); there is NO subagent_start analog. PermissionRequest is also
|
|
38
|
+
// deliberately ABSENT: Hermes' pre_approval_request/post_approval_response
|
|
39
|
+
// hooks OBSERVE the approval prompt but carry no decision control, so a
|
|
40
|
+
// PermissionRequest handler could never be honored — install skip-warns it.
|
|
41
|
+
SubagentStop: "subagent_stop"
|
|
34
42
|
};
|
|
35
43
|
var HermesAdapter = class extends BaseAdapter {
|
|
36
44
|
id = HOST;
|
|
37
45
|
name = "Hermes Agent";
|
|
38
46
|
paradigm = "json-stdio";
|
|
39
47
|
capabilities = {
|
|
48
|
+
// Memory surface: AGENTS.md-first managed block. memoryTargets below probes
|
|
49
|
+
// for .hermes.md / HERMES.md (first context category wins on hermes —
|
|
50
|
+
// AGENTS.md is ignored when they exist); ~/.hermes holds identity/volatile
|
|
51
|
+
// files (SOUL.md, MEMORY.md), not a rules surface → user-scope skip-warn.
|
|
52
|
+
supportsMemory: true,
|
|
40
53
|
preToolUse: true,
|
|
41
54
|
postToolUse: true,
|
|
42
55
|
preCompact: false,
|
|
@@ -46,6 +59,12 @@ var HermesAdapter = class extends BaseAdapter {
|
|
|
46
59
|
userPromptSubmit: false,
|
|
47
60
|
stop: false,
|
|
48
61
|
notification: false,
|
|
62
|
+
// Newer events: Hermes ships subagent_stop (stop-only — no subagent_start
|
|
63
|
+
// analog). permissionRequest stays unset because pre_approval_request is
|
|
64
|
+
// observe-only (no decision control); postToolUseFailure stays unset (a
|
|
65
|
+
// tool failure arrives merged into post_tool_call's result, not as a
|
|
66
|
+
// dedicated event). Install reports the standard skip-warn for those.
|
|
67
|
+
subagentStop: true,
|
|
49
68
|
// Shell hooks cannot rewrite tool args/output in-process.
|
|
50
69
|
canModifyArgs: false,
|
|
51
70
|
canModifyOutput: false,
|
|
@@ -70,6 +89,37 @@ var HermesAdapter = class extends BaseAdapter {
|
|
|
70
89
|
confidence: installed ? "high" : "low"
|
|
71
90
|
};
|
|
72
91
|
}
|
|
92
|
+
// ── Memory surface: .hermes.md / HERMES.md shadow probe (project) ────────
|
|
93
|
+
// Hermes assembles project context by FIRST CATEGORY WINS: .hermes.md or
|
|
94
|
+
// HERMES.md (cwd walking up to the git root) → AGENTS.md (cwd only) →
|
|
95
|
+
// CLAUDE.md (cwd only). When a hermes-native file exists our block must live
|
|
96
|
+
// there or it is never loaded. Reason strings note the cwd-only AGENTS.md
|
|
97
|
+
// read and hermes' ~20k-chars-per-file truncation.
|
|
98
|
+
memoryTargets(ctx) {
|
|
99
|
+
if (this.memoryOverride(ctx)?.path || ctx.scope !== "project") {
|
|
100
|
+
return super.memoryTargets(ctx);
|
|
101
|
+
}
|
|
102
|
+
for (const name of [".hermes.md", "HERMES.md"]) {
|
|
103
|
+
const candidate = join(ctx.projectDir, name);
|
|
104
|
+
if (existsSync(candidate)) {
|
|
105
|
+
return [
|
|
106
|
+
{
|
|
107
|
+
path: candidate,
|
|
108
|
+
reason: `${name} shadows AGENTS.md on hermes (first context category wins)`,
|
|
109
|
+
budgetBytes: 18 * 1024
|
|
110
|
+
// hermes truncates each context file at ~20k chars
|
|
111
|
+
}
|
|
112
|
+
];
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return [
|
|
116
|
+
{
|
|
117
|
+
path: join(ctx.projectDir, "AGENTS.md"),
|
|
118
|
+
reason: "AGENTS.md (hermes reads it from the cwd only \u2014 run from the project root; ~20k chars/file truncation)",
|
|
119
|
+
budgetBytes: 18 * 1024
|
|
120
|
+
}
|
|
121
|
+
];
|
|
122
|
+
}
|
|
73
123
|
// ── Native paths (server + hooks share the SAME file) ─────────────────────
|
|
74
124
|
getConfigDir(_ctx) {
|
|
75
125
|
return dirname(this.userConfigPath());
|
|
@@ -281,6 +331,7 @@ var HermesAdapter = class extends BaseAdapter {
|
|
|
281
331
|
{
|
|
282
332
|
name: `${this.name}: ${MCP_ROOT_KEY}.${id} registered`,
|
|
283
333
|
check: () => {
|
|
334
|
+
if (!ctx.connector.server) return { status: "OK", detail: "no MCP server declared" };
|
|
284
335
|
const cfg = readYaml(path);
|
|
285
336
|
const bucket = cfg?.[MCP_ROOT_KEY];
|
|
286
337
|
const present = typeof bucket === "object" && bucket !== null && !Array.isArray(bucket) && id in bucket;
|
|
@@ -375,6 +426,22 @@ var HermesAdapter = class extends BaseAdapter {
|
|
|
375
426
|
};
|
|
376
427
|
return ev;
|
|
377
428
|
}
|
|
429
|
+
case "SubagentStop": {
|
|
430
|
+
const agentId = input.agent_id ?? input.child_id;
|
|
431
|
+
const ev = {
|
|
432
|
+
...base,
|
|
433
|
+
...typeof agentId === "string" ? { agentId } : {},
|
|
434
|
+
...typeof input.agent_type === "string" ? { agentType: input.agent_type } : {},
|
|
435
|
+
...typeof input.last_assistant_message === "string" ? { lastAssistantMessage: input.last_assistant_message } : {},
|
|
436
|
+
...typeof input.stop_hook_active === "boolean" ? { stopHookActive: input.stop_hook_active } : {}
|
|
437
|
+
};
|
|
438
|
+
return ev;
|
|
439
|
+
}
|
|
440
|
+
case "PermissionRequest":
|
|
441
|
+
case "PostToolUseFailure":
|
|
442
|
+
case "SubagentStart": {
|
|
443
|
+
throw new Error(`unsupported hermes hook event: ${String(event)}`);
|
|
444
|
+
}
|
|
378
445
|
default: {
|
|
379
446
|
const _never = event;
|
|
380
447
|
throw new Error(`unsupported hermes hook event: ${String(_never)}`);
|
|
@@ -388,6 +455,12 @@ var HermesAdapter = class extends BaseAdapter {
|
|
|
388
455
|
formatReply(event, response) {
|
|
389
456
|
const decision = response.decision ?? "allow";
|
|
390
457
|
if (decision === "deny") {
|
|
458
|
+
if (event === "SubagentStop") {
|
|
459
|
+
return this.stdout({
|
|
460
|
+
decision: "block",
|
|
461
|
+
reason: response.reason ?? "Blocked by hook"
|
|
462
|
+
});
|
|
463
|
+
}
|
|
391
464
|
return this.stdout({
|
|
392
465
|
hookSpecificOutput: {
|
|
393
466
|
hookEventName: event,
|
|
@@ -467,4 +540,4 @@ export {
|
|
|
467
540
|
adapter,
|
|
468
541
|
hermes_default as default
|
|
469
542
|
};
|
|
470
|
-
//# sourceMappingURL=hermes-
|
|
543
|
+
//# sourceMappingURL=hermes-CUNKIAR5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/adapters/hermes/index.ts"],"sourcesContent":["/**\n * adapters/hermes — Hermes Agent platform adapter for agent-connector.\n *\n * Hermes is a json-stdio host whose ENTIRE configuration — both the MCP servers\n * and the lifecycle hooks — lives in a single user-scope YAML file:\n *\n * ~/.hermes/config.yaml\n *\n * Because the file is YAML, the BaseAdapter JSON helpers do not apply; this\n * adapter merges via core/yaml's readYaml/writeYaml, preserving any unrelated\n * config the user has authored.\n *\n * - MCP servers: top-level snake_case root key `mcp_servers`. The stdio entry\n * uses the portable field names { command, args, env } (unlike Goose's\n * cmd/envs). Hermes has no native env interpolation, so `${env:VAR}` refs are\n * resolved to literals at install time.\n *\n * - Hooks: a top-level `hooks` map keyed by Hermes' NATIVE snake_case event\n * names (pre_tool_call / post_tool_call / on_session_start / on_session_end /\n * subagent_stop — NOT the canonical PascalCase names; see EVENT_TO_HERMES).\n * Each value is a\n * list of shell-hook entries { matcher, command:\"<homeBin> hook …\", timeout }.\n * The command keeps the canonical event token so the runtime dispatcher\n * (parseEvent/formatReply) stays consistent. Hermes shell hooks pipe the\n * event JSON to the command on stdin and read the reply JSON from stdout —\n * the same wire protocol as Claude Code, so the runtime parse/format mirror\n * the Claude adapter (a Claude-like JSON shape; the exact Hermes field map is\n * documented inline where it could vary).\n *\n * Since hooks are external shell commands (not an in-process plugin), Hermes\n * cannot let a hook rewrite tool arguments — canModifyArgs is false. Hermes has\n * no SSE transport, so only stdio + http are advertised.\n */\n\nimport { existsSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\n\nimport { BaseAdapter } from \"../base.js\";\nimport type { Adapter, HookReply, InstallContext, MemoryTarget, NormalizedEvent } from \"../spi.js\";\nimport type {\n ChangeRecord,\n DetectedPlatform,\n HealthCheck,\n HookEventName,\n HookParadigm,\n HookResponse,\n NotificationEvent,\n PlatformCapabilities,\n PlatformId,\n PostToolUseEvent,\n PreCompactEvent,\n PreToolUseEvent,\n SessionEndEvent,\n SessionStartEvent,\n ServerDef,\n StopEvent,\n SubagentStopEvent,\n UserPromptSubmitEvent,\n} from \"../../core/types.js\";\nimport { readYaml, writeYaml } from \"../../core/yaml.js\";\nimport { resolveEnvRefsDeep } from \"../../core/interpolate.js\";\nimport {\n buildHomeBinHookCommand,\n buildServeWrapperCommand,\n isHomeBinHookCommand,\n shouldWrapForTelemetry,\n} from \"../../core/spawn.js\";\n\nconst HOST: PlatformId = \"hermes\";\n/** Root key under which Hermes stores MCP servers in config.yaml (snake_case). */\nconst MCP_ROOT_KEY = \"mcp_servers\";\n/** Top-level key under which Hermes stores shell hooks in config.yaml. */\nconst HOOKS_KEY = \"hooks\";\n/** Default per-hook timeout (seconds) when the connector declares none. */\nconst DEFAULT_HOOK_TIMEOUT = 60;\n\n/**\n * Canonical → Hermes native hook event name. Hermes keys its `hooks:` block by\n * its OWN snake_case lifecycle names (pre_tool_call / post_tool_call /\n * on_session_start / on_session_end — see docs/research/platform-research.json),\n * NOT the canonical PascalCase names. A connector event is only wired when it\n * appears here AND is declared by the connector; everything else is reported as\n * a warn/skip at install time.\n */\nconst EVENT_TO_HERMES: Partial<Record<HookEventName, string>> = {\n PreToolUse: \"pre_tool_call\",\n PostToolUse: \"post_tool_call\",\n SessionStart: \"on_session_start\",\n SessionEnd: \"on_session_end\",\n // Hermes is a STOP-ONLY subagent host: subagent_stop fires when a\n // delegate_task child exits (child_status ∈ completed/failed/interrupted/\n // error); there is NO subagent_start analog. PermissionRequest is also\n // deliberately ABSENT: Hermes' pre_approval_request/post_approval_response\n // hooks OBSERVE the approval prompt but carry no decision control, so a\n // PermissionRequest handler could never be honored — install skip-warns it.\n SubagentStop: \"subagent_stop\",\n};\n\n/** Hermes stdio MCP entry — portable field names (command/args/env). */\ninterface HermesStdioServer {\n command: string;\n args?: string[];\n env?: Record<string, string>;\n}\n\n/** One Hermes shell-hook entry. */\ninterface HermesHookEntry {\n /** Tool-name matcher (empty = all). Tool events only; \"\" elsewhere. */\n matcher: string;\n /** The home-bin hook command Hermes invokes (event JSON on stdin). */\n command: string;\n /** Hook timeout in seconds. */\n timeout: number;\n}\n\n/** Raw Hermes hook stdin payload. Hermes uses snake_case pre_tool_call /\n * post_tool_call event tokens; field names below cover both its tool-call and\n * session payloads. Shape kept Claude-like where Hermes does not document it. */\ninterface HermesWireInput {\n session_id?: string;\n cwd?: string;\n event?: string;\n hook_event_name?: string;\n tool_name?: string;\n tool_input?: Record<string, unknown>;\n tool_response?: unknown;\n tool_output?: unknown;\n source?: string;\n reason?: string;\n prompt?: string;\n trigger?: string;\n stop_hook_active?: boolean;\n message?: string;\n is_error?: boolean;\n // subagent_stop — fires when a delegate_task child exits. agent_* are the\n // Claude-compatible names, child_* the Hermes-native ones (child_status ∈\n // completed/failed/interrupted/error stays accessible via `raw`).\n agent_id?: string;\n agent_type?: string;\n child_id?: string;\n child_status?: string;\n last_assistant_message?: string;\n /** Injected by the entrypoint so the runtime knows which connector to dispatch. */\n connector?: string;\n}\n\nexport class HermesAdapter extends BaseAdapter implements Adapter {\n readonly id: PlatformId = HOST;\n readonly name = \"Hermes Agent\";\n readonly paradigm: HookParadigm = \"json-stdio\";\n\n readonly capabilities: PlatformCapabilities = {\n // Memory surface: AGENTS.md-first managed block. memoryTargets below probes\n // for .hermes.md / HERMES.md (first context category wins on hermes —\n // AGENTS.md is ignored when they exist); ~/.hermes holds identity/volatile\n // files (SOUL.md, MEMORY.md), not a rules surface → user-scope skip-warn.\n supportsMemory: true,\n preToolUse: true,\n postToolUse: true,\n preCompact: false,\n // Hermes exposes on_session_start / on_session_end lifecycle hooks.\n sessionStart: true,\n sessionEnd: true,\n userPromptSubmit: false,\n stop: false,\n notification: false,\n // Newer events: Hermes ships subagent_stop (stop-only — no subagent_start\n // analog). permissionRequest stays unset because pre_approval_request is\n // observe-only (no decision control); postToolUseFailure stays unset (a\n // tool failure arrives merged into post_tool_call's result, not as a\n // dedicated event). Install reports the standard skip-warn for those.\n subagentStop: true,\n // Shell hooks cannot rewrite tool args/output in-process.\n canModifyArgs: false,\n canModifyOutput: false,\n canInjectSessionContext: true,\n // Hermes has no SSE transport.\n transports: [\"stdio\", \"http\"],\n };\n\n // ── Detection ────────────────────────────────────────────────────────────\n\n detectInstalled(_projectDir: string): DetectedPlatform {\n const configPath = this.userConfigPath();\n const configDir = dirname(configPath);\n const installed = existsSync(configDir) || existsSync(configPath);\n return {\n id: this.id,\n name: this.name,\n installed,\n paradigm: this.paradigm,\n capabilities: this.capabilities,\n configPath,\n scope: \"user\",\n reason: installed\n ? `found Hermes config at ${configPath}`\n : `no Hermes config at ${configPath}`,\n confidence: installed ? \"high\" : \"low\",\n };\n }\n\n // ── Memory surface: .hermes.md / HERMES.md shadow probe (project) ────────\n // Hermes assembles project context by FIRST CATEGORY WINS: .hermes.md or\n // HERMES.md (cwd walking up to the git root) → AGENTS.md (cwd only) →\n // CLAUDE.md (cwd only). When a hermes-native file exists our block must live\n // there or it is never loaded. Reason strings note the cwd-only AGENTS.md\n // read and hermes' ~20k-chars-per-file truncation.\n protected override memoryTargets(ctx: InstallContext): MemoryTarget[] {\n if (this.memoryOverride(ctx)?.path || ctx.scope !== \"project\") {\n return super.memoryTargets(ctx); // user scope: no rules surface → skip-warn\n }\n for (const name of [\".hermes.md\", \"HERMES.md\"]) {\n const candidate = join(ctx.projectDir, name);\n if (existsSync(candidate)) {\n return [\n {\n path: candidate,\n reason: `${name} shadows AGENTS.md on hermes (first context category wins)`,\n budgetBytes: 18 * 1024, // hermes truncates each context file at ~20k chars\n },\n ];\n }\n }\n return [\n {\n path: join(ctx.projectDir, \"AGENTS.md\"),\n reason:\n \"AGENTS.md (hermes reads it from the cwd only — run from the project root; ~20k chars/file truncation)\",\n budgetBytes: 18 * 1024,\n },\n ];\n }\n\n // ── Native paths (server + hooks share the SAME file) ─────────────────────\n\n override getConfigDir(_ctx: InstallContext): string {\n return dirname(this.userConfigPath());\n }\n\n override getServerConfigPath(_ctx: InstallContext): string {\n return this.userConfigPath();\n }\n\n /** Same file as the server config — Hermes hooks live in config.yaml. */\n override getHookConfigPath(_ctx: InstallContext): string {\n return this.userConfigPath();\n }\n\n private userConfigPath(): string {\n return join(homedir(), \".hermes\", \"config.yaml\");\n }\n\n // ── MCP server install / uninstall (YAML mcp_servers) ─────────────────────\n\n override installServer(ctx: InstallContext): ChangeRecord[] {\n const { connector, dryRun } = ctx;\n const path = this.getServerConfigPath(ctx);\n const server = this.effectiveServer(ctx);\n\n if (!server) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n path,\n detail: connector.server\n ? \"server registration disabled for hermes\"\n : \"connector declares no MCP server\",\n },\n ];\n }\n if (server.transport !== \"stdio\" || !server.command) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n path,\n detail: `transport \"${server.transport}\" not registrable in ${MCP_ROOT_KEY} (stdio only)`,\n },\n ];\n }\n\n const entry = this.renderServerEntry(ctx, server);\n\n const cfg = readYaml<Record<string, unknown>>(path) ?? {};\n const bucket = this.objectBucket(cfg, MCP_ROOT_KEY);\n const before = JSON.stringify(bucket[connector.id]);\n const after = JSON.stringify(entry);\n let action: ChangeRecord[\"action\"];\n if (before === undefined) action = \"create\";\n else if (before === after) action = \"skip\";\n else action = \"update\";\n\n if (action !== \"skip\") {\n bucket[connector.id] = entry;\n writeYaml(path, cfg, dryRun);\n }\n return [{ platform: this.id, action, path, detail: `${MCP_ROOT_KEY}.${connector.id}` }];\n }\n\n override uninstallServer(ctx: InstallContext): ChangeRecord[] {\n const { connector, dryRun } = ctx;\n const path = this.getServerConfigPath(ctx);\n const cfg = readYaml<Record<string, unknown>>(path);\n const bucketRaw = cfg?.[MCP_ROOT_KEY];\n if (\n !cfg ||\n !bucketRaw ||\n typeof bucketRaw !== \"object\" ||\n Array.isArray(bucketRaw) ||\n !(connector.id in (bucketRaw as Record<string, unknown>))\n ) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n path,\n detail: `${MCP_ROOT_KEY}.${connector.id} absent`,\n },\n ];\n }\n delete (bucketRaw as Record<string, unknown>)[connector.id];\n writeYaml(path, cfg, dryRun);\n return [\n { platform: this.id, action: \"remove\", path, detail: `${MCP_ROOT_KEY}.${connector.id}` },\n ];\n }\n\n /**\n * Render the stdio MCP entry. Hermes has no native interpolation, so env-refs\n * resolve to literals here. Honors the telemetry serve-wrapper.\n */\n private renderServerEntry(ctx: InstallContext, server: ServerDef): HermesStdioServer {\n let command = server.command as string;\n let args = [...(server.args ?? [])];\n\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 command = resolveEnvRefsDeep(command);\n args = resolveEnvRefsDeep(args);\n\n const entry: HermesStdioServer = { command };\n if (args.length > 0) entry.args = args;\n if (server.env && Object.keys(server.env).length > 0) {\n const env: Record<string, string> = {};\n for (const [k, v] of Object.entries(resolveEnvRefsDeep(server.env))) {\n env[k] = String(v);\n }\n entry.env = env;\n }\n return entry;\n }\n\n // ── Hook install / uninstall (YAML hooks map in the SAME config.yaml) ─────\n\n override installHooks(ctx: InstallContext): ChangeRecord[] {\n const { connector, dryRun } = ctx;\n const path = this.getHookConfigPath(ctx);\n\n if (connector.platforms[HOST]?.hooks === false) {\n return [{ platform: this.id, action: \"skip\", path, detail: \"hooks disabled for hermes\" }];\n }\n const events = connector.hookEvents;\n if (events.length === 0) {\n return [{ platform: this.id, action: \"skip\", path, detail: \"connector declares no hooks\" }];\n }\n\n const cfg = readYaml<Record<string, unknown>>(path) ?? {};\n const hooks = this.hooksBucket(cfg);\n const changes: ChangeRecord[] = [];\n let mutated = false;\n\n for (const event of events) {\n const hermesEvent = EVENT_TO_HERMES[event];\n if (!hermesEvent) {\n // No Hermes equivalent for this canonical event — report and skip.\n changes.push({\n platform: this.id,\n action: \"warn\",\n path,\n detail: `${event} has no Hermes hook equivalent — skipped`,\n });\n continue;\n }\n\n // The hook command keeps the CANONICAL event token so the runtime\n // dispatcher (parseEvent/formatReply) stays consistent; only the YAML KEY\n // the entry is filed under is the native Hermes name.\n const command = buildHomeBinHookCommand(ctx.homeBinPath, HOST, event, connector.id);\n const matcher = connector.hooks[event]?.matcher ?? \"\";\n const timeout = this.hookTimeout(connector.server);\n const desired: HermesHookEntry = { matcher, command, timeout };\n\n const bucket = Array.isArray(hooks[hermesEvent])\n ? (hooks[hermesEvent] as HermesHookEntry[])\n : (hooks[hermesEvent] = [] as HermesHookEntry[]);\n const idx = bucket.findIndex((e) => this.isOurCommand(e?.command, ctx));\n\n if (idx >= 0) {\n if (JSON.stringify(bucket[idx]) === JSON.stringify(desired)) {\n changes.push({ platform: this.id, action: \"skip\", path, detail: `${HOOKS_KEY}.${hermesEvent}` });\n continue;\n }\n bucket[idx] = desired;\n changes.push({ platform: this.id, action: \"update\", path, detail: `${HOOKS_KEY}.${hermesEvent}` });\n } else {\n bucket.push(desired);\n changes.push({ platform: this.id, action: \"create\", path, detail: `${HOOKS_KEY}.${hermesEvent}` });\n }\n mutated = true;\n }\n\n if (mutated) writeYaml(path, cfg, dryRun);\n return changes;\n }\n\n override uninstallHooks(ctx: InstallContext): ChangeRecord[] {\n const path = this.getHookConfigPath(ctx);\n const cfg = readYaml<Record<string, unknown>>(path);\n const hooksRaw = cfg?.[HOOKS_KEY];\n if (\n !cfg ||\n !hooksRaw ||\n typeof hooksRaw !== \"object\" ||\n Array.isArray(hooksRaw)\n ) {\n return [{ platform: this.id, action: \"skip\", path, detail: \"no hooks section present\" }];\n }\n const hooks = hooksRaw as Record<string, unknown>;\n\n const changes: ChangeRecord[] = [];\n let mutated = false;\n for (const event of Object.keys(hooks)) {\n const bucket = hooks[event];\n if (!Array.isArray(bucket)) continue;\n const kept = (bucket as HermesHookEntry[]).filter(\n (e) => !this.isOurCommand(e?.command, ctx),\n );\n if (kept.length === bucket.length) continue;\n mutated = true;\n if (kept.length > 0) hooks[event] = kept;\n else delete hooks[event];\n changes.push({\n platform: this.id,\n action: \"remove\",\n path,\n detail: `${HOOKS_KEY}.${event} (${bucket.length - kept.length})`,\n });\n }\n\n if (mutated) writeYaml(path, cfg, ctx.dryRun);\n if (changes.length === 0) {\n return [{ platform: this.id, action: \"skip\", path, detail: \"no matching hook entries\" }];\n }\n return changes;\n }\n\n /** True when a hook command is ours (anchored home-bin + connector id). */\n private isOurCommand(command: string | undefined, ctx: InstallContext): boolean {\n return isHomeBinHookCommand(command, ctx.homeBinPath, ctx.connector.id);\n }\n\n private hookTimeout(server: ServerDef | undefined): number {\n const ms = server?.timeoutMs;\n if (typeof ms === \"number\" && ms > 0) return Math.round(ms / 1000);\n return DEFAULT_HOOK_TIMEOUT;\n }\n\n // ── Diagnostics ──────────────────────────────────────────────────────────\n\n override getHealthChecks(ctx: InstallContext): readonly HealthCheck[] {\n const path = this.getServerConfigPath(ctx);\n const id = ctx.connector.id;\n const homeBin = ctx.homeBinPath;\n const hookEvents = ctx.connector.hookEvents;\n return [\n {\n name: `${this.name}: config.yaml present`,\n check: () =>\n existsSync(path)\n ? { status: \"OK\", detail: path }\n : { status: \"FAIL\", detail: `not found: ${path}` },\n },\n {\n name: `${this.name}: ${MCP_ROOT_KEY}.${id} registered`,\n check: () => {\n // Only assert what the connector declares: a server-less connector\n // never writes an mcp entry, so its absence is healthy.\n if (!ctx.connector.server) return { status: \"OK\", detail: \"no MCP server declared\" };\n const cfg = readYaml<Record<string, unknown>>(path);\n const bucket = cfg?.[MCP_ROOT_KEY];\n const present =\n typeof bucket === \"object\" &&\n bucket !== null &&\n !Array.isArray(bucket) &&\n id in (bucket as Record<string, unknown>);\n return present\n ? { status: \"OK\", detail: `${MCP_ROOT_KEY}.${id}` }\n : { status: \"FAIL\", detail: `${MCP_ROOT_KEY}.${id} not found in ${path}` };\n },\n },\n {\n name: `${this.name}: hook command registered`,\n check: () => {\n if (hookEvents.length === 0) return { status: \"OK\", detail: \"no hooks declared\" };\n const cfg = readYaml<Record<string, unknown>>(path);\n const hooks = cfg?.[HOOKS_KEY];\n if (!hooks || typeof hooks !== \"object\" || Array.isArray(hooks)) {\n return { status: \"FAIL\", detail: `no ${HOOKS_KEY} section in ${path}` };\n }\n const registered = Object.values(hooks as Record<string, unknown>).some(\n (bucket) =>\n Array.isArray(bucket) &&\n (bucket as HermesHookEntry[]).some((e) =>\n isHomeBinHookCommand(e?.command, homeBin, id),\n ),\n );\n return registered\n ? { status: \"OK\", detail: \"hook command present\" }\n : { status: \"FAIL\", detail: `no hook for ${id} in ${path}` };\n },\n },\n ];\n }\n\n // ── Runtime: parse Hermes stdin JSON → normalized event ──────────────────\n\n parseEvent(event: HookEventName, raw: unknown): NormalizedEvent {\n const input = (raw ?? {}) as HermesWireInput;\n const base = {\n hostPlatform: HOST,\n connectorId: typeof input.connector === \"string\" ? input.connector : \"\",\n sessionId: typeof input.session_id === \"string\" ? input.session_id : \"\",\n ...(typeof input.cwd === \"string\" ? { projectDir: input.cwd } : {}),\n raw,\n } as const;\n\n switch (event) {\n case \"PreToolUse\": {\n const ev: PreToolUseEvent = {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n };\n return ev;\n }\n case \"PostToolUse\": {\n // Hermes may carry the result under tool_output or tool_response.\n const out = toStringOrUndefined(input.tool_output ?? input.tool_response);\n const ev: PostToolUseEvent = {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n ...(out !== undefined ? { toolOutput: out } : {}),\n ...(typeof input.is_error === \"boolean\" ? { isError: input.is_error } : {}),\n };\n return ev;\n }\n case \"SessionStart\": {\n const ev: SessionStartEvent = { ...base, source: normalizeSource(input.source) };\n return ev;\n }\n case \"SessionEnd\": {\n const ev: SessionEndEvent = {\n ...base,\n ...(typeof input.reason === \"string\" ? { reason: input.reason } : {}),\n };\n return ev;\n }\n case \"UserPromptSubmit\": {\n const ev: UserPromptSubmitEvent = {\n ...base,\n prompt: typeof input.prompt === \"string\" ? input.prompt : \"\",\n };\n return ev;\n }\n case \"PreCompact\": {\n const ev: PreCompactEvent = {\n ...base,\n ...(input.trigger === \"auto\" || input.trigger === \"manual\"\n ? { trigger: input.trigger }\n : {}),\n };\n return ev;\n }\n case \"Stop\": {\n const ev: StopEvent = {\n ...base,\n ...(typeof input.stop_hook_active === \"boolean\"\n ? { stopHookActive: input.stop_hook_active }\n : {}),\n };\n return ev;\n }\n case \"Notification\": {\n const ev: NotificationEvent = {\n ...base,\n message: typeof input.message === \"string\" ? input.message : \"\",\n };\n return ev;\n }\n case \"SubagentStop\": {\n // agent_id/agent_type stay optional (some hosts never populate them);\n // Hermes' native child_id is accepted as the id fallback. child_status\n // is host-specific and stays accessible via `raw`.\n const agentId = input.agent_id ?? input.child_id;\n const ev: SubagentStopEvent = {\n ...base,\n ...(typeof agentId === \"string\" ? { agentId } : {}),\n ...(typeof input.agent_type === \"string\"\n ? { agentType: input.agent_type }\n : {}),\n ...(typeof input.last_assistant_message === \"string\"\n ? { lastAssistantMessage: input.last_assistant_message }\n : {}),\n ...(typeof input.stop_hook_active === \"boolean\"\n ? { stopHookActive: input.stop_hook_active }\n : {}),\n };\n return ev;\n }\n case \"PermissionRequest\":\n case \"PostToolUseFailure\":\n case \"SubagentStart\": {\n // No Hermes analog: pre_approval_request is observe-only (no decision\n // control), tool failures arrive merged into post_tool_call, and there\n // is no subagent_start. Install already skip-warns these; a runtime\n // dispatch is a mis-route — fail loudly.\n throw new Error(`unsupported hermes hook event: ${String(event)}`);\n }\n default: {\n const _never: never = event;\n throw new Error(`unsupported hermes hook event: ${String(_never)}`);\n }\n }\n }\n\n // ── Runtime: normalized response → Hermes native hook reply ──────────────\n // Hermes shell hooks read a JSON reply from stdout (exit 0 = allow). We emit a\n // Claude-like `hookSpecificOutput` wrapper; if Hermes' exact reply schema\n // differs, this is the single place to adjust the mapping.\n\n formatReply(event: HookEventName, response: HookResponse): HookReply {\n const decision = response.decision ?? \"allow\";\n\n if (decision === \"deny\") {\n // SubagentStop deny carries Stop semantics — it keeps the subagent\n // running with `reason` as its next instruction — and (like Claude's\n // Stop class) is honored only as the TOP-LEVEL {\"decision\":\"block\",\n // \"reason\"}, not as a permissionDecision envelope.\n if (event === \"SubagentStop\") {\n return this.stdout({\n decision: \"block\",\n reason: response.reason ?? \"Blocked by hook\",\n });\n }\n return this.stdout({\n hookSpecificOutput: {\n hookEventName: event,\n permissionDecision: \"deny\",\n permissionDecisionReason: response.reason ?? \"Blocked by hook\",\n },\n });\n }\n\n if (decision === \"ask\") {\n return this.stdout({\n hookSpecificOutput: {\n hookEventName: event,\n permissionDecision: \"ask\",\n permissionDecisionReason: response.reason ?? \"Confirmation required by hook\",\n },\n });\n }\n\n if (decision === \"context\" && response.additionalContext) {\n return this.stdout({\n hookSpecificOutput: { hookEventName: event, additionalContext: response.additionalContext },\n });\n }\n\n // allow / modify (unsupported — shell hooks can't rewrite args) / void.\n return { exitCode: 0 };\n }\n\n private stdout(payload: unknown): HookReply {\n return { exitCode: 0, stdout: JSON.stringify(payload) };\n }\n\n // ── Internal helpers ──────────────────────────────────────────────────────\n\n /** Resolve the per-platform server override into an effective ServerDef. */\n private effectiveServer(ctx: InstallContext): ServerDef | undefined {\n const override = ctx.connector.platforms[this.id]?.server;\n if (override === false) return undefined;\n const base = ctx.connector.server;\n if (!base) return undefined;\n return override && typeof override === \"object\" ? { ...base, ...override } : base;\n }\n\n /** Get-or-create an object bucket (map) at `cfg[key]`. */\n private objectBucket(cfg: Record<string, unknown>, key: string): Record<string, unknown> {\n const existing = cfg[key];\n if (existing && typeof existing === \"object\" && !Array.isArray(existing)) {\n return existing as Record<string, unknown>;\n }\n const fresh: Record<string, unknown> = {};\n cfg[key] = fresh;\n return fresh;\n }\n\n /** Get-or-create the hooks map at `cfg.hooks`. */\n private hooksBucket(cfg: Record<string, unknown>): Record<string, unknown> {\n return this.objectBucket(cfg, HOOKS_KEY);\n }\n}\n\n/** Coerce an unknown value into a string for the normalized event. */\nfunction toStringOrUndefined(value: unknown): string | undefined {\n if (value == null) return undefined;\n if (typeof value === \"string\") return value;\n try {\n return JSON.stringify(value);\n } catch {\n return String(value);\n }\n}\n\nfunction normalizeSource(raw: string | undefined): SessionStartEvent[\"source\"] {\n switch (raw) {\n case \"compact\":\n return \"compact\";\n case \"resume\":\n return \"resume\";\n case \"clear\":\n return \"clear\";\n default:\n return \"startup\";\n }\n}\n\nexport const adapter = new HermesAdapter();\nexport default adapter;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAkCA,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,SAAS,YAAY;AAiC9B,IAAM,OAAmB;AAEzB,IAAM,eAAe;AAErB,IAAM,YAAY;AAElB,IAAM,uBAAuB;AAU7B,IAAM,kBAA0D;AAAA,EAC9D,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,cAAc;AAAA,EACd,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOZ,cAAc;AAChB;AAkDO,IAAM,gBAAN,cAA4B,YAA+B;AAAA,EACvD,KAAiB;AAAA,EACjB,OAAO;AAAA,EACP,WAAyB;AAAA,EAEzB,eAAqC;AAAA;AAAA;AAAA;AAAA;AAAA,IAK5C,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,YAAY;AAAA;AAAA,IAEZ,cAAc;AAAA,IACd,YAAY;AAAA,IACZ,kBAAkB;AAAA,IAClB,MAAM;AAAA,IACN,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMd,cAAc;AAAA;AAAA,IAEd,eAAe;AAAA,IACf,iBAAiB;AAAA,IACjB,yBAAyB;AAAA;AAAA,IAEzB,YAAY,CAAC,SAAS,MAAM;AAAA,EAC9B;AAAA;AAAA,EAIA,gBAAgB,aAAuC;AACrD,UAAM,aAAa,KAAK,eAAe;AACvC,UAAM,YAAY,QAAQ,UA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,EAC7B,QAAQ;AACN,WAAO,OAAO,KAAK;AAAA,EACrB;AACF;AAEA,SAAS,gBAAgB,KAAsD;AAC7E,UAAQ,KAAK;AAAA,IACX,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAEO,IAAM,UAAU,IAAI,cAAc;AACzC,IAAO,iBAAQ;","names":[]}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
fail
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-AKJGNTU3.js";
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
isNativeHookDeclared,
|
|
7
|
+
runHook,
|
|
8
|
+
runNativeHook
|
|
9
|
+
} from "./chunk-4ML7SZ7R.js";
|
|
8
10
|
import "./chunk-BCHWFTV4.js";
|
|
9
11
|
import "./chunk-KHO5WNTP.js";
|
|
10
12
|
import "./chunk-WCETQWWK.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-O2SBA5KR.js";
|
|
14
|
+
import "./chunk-3JCRUROU.js";
|
|
15
|
+
import "./chunk-GSGDG2BV.js";
|
|
14
16
|
import "./chunk-MEH7GC7R.js";
|
|
17
|
+
import "./chunk-N6HH7K6P.js";
|
|
15
18
|
import "./chunk-TRQKHP7D.js";
|
|
16
19
|
|
|
17
20
|
// src/cli/commands/hook.ts
|
|
@@ -24,7 +27,11 @@ var HOOK_EVENTS = /* @__PURE__ */ new Set([
|
|
|
24
27
|
"PostToolUse",
|
|
25
28
|
"PreCompact",
|
|
26
29
|
"Stop",
|
|
27
|
-
"Notification"
|
|
30
|
+
"Notification",
|
|
31
|
+
"PermissionRequest",
|
|
32
|
+
"PostToolUseFailure",
|
|
33
|
+
"SubagentStart",
|
|
34
|
+
"SubagentStop"
|
|
28
35
|
]);
|
|
29
36
|
async function readAll(stream) {
|
|
30
37
|
const chunks = [];
|
|
@@ -46,13 +53,18 @@ async function run(argv) {
|
|
|
46
53
|
if (!platformId || !event) {
|
|
47
54
|
return fail("usage: agent-connector hook <platform> <event> --connector <id>");
|
|
48
55
|
}
|
|
49
|
-
if (!HOOK_EVENTS.has(event)) {
|
|
50
|
-
return fail(`unknown hook event "${event}"`);
|
|
51
|
-
}
|
|
52
56
|
const connectorId = values.connector;
|
|
53
57
|
if (!connectorId || connectorId.trim() === "") {
|
|
54
58
|
return fail("hook requires --connector <id>");
|
|
55
59
|
}
|
|
60
|
+
if (!HOOK_EVENTS.has(event)) {
|
|
61
|
+
if (!await isNativeHookDeclared(platformId, event, connectorId)) {
|
|
62
|
+
return fail(`unknown hook event "${event}"`);
|
|
63
|
+
}
|
|
64
|
+
const stdin2 = await readAll(process.stdin);
|
|
65
|
+
const reply2 = await runNativeHook({ platformId, event, connectorId, stdin: stdin2 });
|
|
66
|
+
return exitWithReply(reply2);
|
|
67
|
+
}
|
|
56
68
|
const stdin = await readAll(process.stdin);
|
|
57
69
|
const reply = await runHook({
|
|
58
70
|
platformId,
|
|
@@ -60,6 +72,9 @@ async function run(argv) {
|
|
|
60
72
|
connectorId,
|
|
61
73
|
stdin
|
|
62
74
|
});
|
|
75
|
+
return exitWithReply(reply);
|
|
76
|
+
}
|
|
77
|
+
function exitWithReply(reply) {
|
|
63
78
|
if (reply.stdout !== void 0 && reply.stdout !== "") {
|
|
64
79
|
process.stdout.write(reply.stdout);
|
|
65
80
|
}
|
|
@@ -72,4 +87,4 @@ async function run(argv) {
|
|
|
72
87
|
export {
|
|
73
88
|
run
|
|
74
89
|
};
|
|
75
|
-
//# sourceMappingURL=hook-
|
|
90
|
+
//# sourceMappingURL=hook-AC7APC66.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/commands/hook.ts"],"sourcesContent":["/**\n * cli/commands/hook — the universal json-stdio hook entrypoint.\n *\n * agent-connector hook <platform> <event> --connector <id>\n *\n * This is the single command every host's hook config points at (via the stable\n * home binary). It reads the ENTIRE host payload from stdin, dispatches through\n * runHook, writes any stdout/stderr the adapter produced, and exits with the\n * adapter's exit code (the host interprets it as allow/deny/etc.).\n *\n * Fail-open is the runtime's contract: runHook never rejects, so a framework or\n * handler bug can't wedge a host's tool call.\n */\n\nimport { parseArgs } from \"node:util\";\n\nimport type { HookEventName } from \"../../core/types.js\";\nimport { isNativeHookDeclared, runHook, runNativeHook } from \"../../runtime/index.js\";\nimport type { RunHookResult } from \"../../runtime/index.js\";\nimport { fail } from \"../app.js\";\n\nconst HOOK_EVENTS: ReadonlySet<string> = new Set<HookEventName>([\n \"SessionStart\",\n \"SessionEnd\",\n \"UserPromptSubmit\",\n \"PreToolUse\",\n \"PostToolUse\",\n \"PreCompact\",\n \"Stop\",\n \"Notification\",\n \"PermissionRequest\",\n \"PostToolUseFailure\",\n \"SubagentStart\",\n \"SubagentStop\",\n]);\n\n/** Read all of a readable stream to a UTF-8 string. */\nasync function readAll(stream: NodeJS.ReadStream): Promise<string> {\n const chunks: Buffer[] = [];\n for await (const chunk of stream) {\n chunks.push(typeof chunk === \"string\" ? Buffer.from(chunk) : chunk);\n }\n return Buffer.concat(chunks).toString(\"utf8\");\n}\n\nexport async function run(argv: string[]): Promise<number> {\n const { values, positionals } = parseArgs({\n args: argv,\n options: {\n connector: { type: \"string\" },\n },\n allowPositionals: true,\n });\n\n const platformId = positionals[0];\n const event = positionals[1];\n if (!platformId || !event) {\n return fail(\"usage: agent-connector hook <platform> <event> --connector <id>\");\n }\n const connectorId = values.connector;\n if (!connectorId || connectorId.trim() === \"\") {\n return fail(\"hook requires --connector <id>\");\n }\n\n // NATIVE PASSTHROUGH: a non-union event name is accepted ONLY when the\n // resolved connector declares it under platforms[<platform>].nativeHooks —\n // dispatch then bypasses the normalized parse/format entirely (raw stdin →\n // handler → verbatim JSON stdout). Undeclared names keep the strict error.\n if (!HOOK_EVENTS.has(event)) {\n if (!(await isNativeHookDeclared(platformId, event, connectorId))) {\n return fail(`unknown hook event \"${event}\"`);\n }\n const stdin = await readAll(process.stdin);\n const reply = await runNativeHook({ platformId, event, connectorId, stdin });\n return exitWithReply(reply);\n }\n\n // Read the entire host payload before dispatching.\n const stdin = await readAll(process.stdin);\n\n const reply = await runHook({\n platformId,\n event: event as HookEventName,\n connectorId,\n stdin,\n });\n\n return exitWithReply(reply);\n}\n\n/** Write a hook reply's stdout/stderr and exit with its code. */\nfunction exitWithReply(reply: RunHookResult): never {\n if (reply.stdout !== undefined && reply.stdout !== \"\") {\n process.stdout.write(reply.stdout);\n }\n if (reply.stderr !== undefined && reply.stderr !== \"\") {\n process.stderr.write(reply.stderr.endsWith(\"\\n\") ? reply.stderr : `${reply.stderr}\\n`);\n }\n process.exit(reply.exitCode);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAcA,SAAS,iBAAiB;AAO1B,IAAM,cAAmC,oBAAI,IAAmB;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGD,eAAe,QAAQ,QAA4C;AACjE,QAAM,SAAmB,CAAC;AAC1B,mBAAiB,SAAS,QAAQ;AAChC,WAAO,KAAK,OAAO,UAAU,WAAW,OAAO,KAAK,KAAK,IAAI,KAAK;AAAA,EACpE;AACA,SAAO,OAAO,OAAO,MAAM,EAAE,SAAS,MAAM;AAC9C;AAEA,eAAsB,IAAI,MAAiC;AACzD,QAAM,EAAE,QAAQ,YAAY,IAAI,UAAU;AAAA,IACxC,MAAM;AAAA,IACN,SAAS;AAAA,MACP,WAAW,EAAE,MAAM,SAAS;AAAA,IAC9B;AAAA,IACA,kBAAkB;AAAA,EACpB,CAAC;AAED,QAAM,aAAa,YAAY,CAAC;AAChC,QAAM,QAAQ,YAAY,CAAC;AAC3B,MAAI,CAAC,cAAc,CAAC,OAAO;AACzB,WAAO,KAAK,iEAAiE;AAAA,EAC/E;AACA,QAAM,cAAc,OAAO;AAC3B,MAAI,CAAC,eAAe,YAAY,KAAK,MAAM,IAAI;AAC7C,WAAO,KAAK,gCAAgC;AAAA,EAC9C;AAMA,MAAI,CAAC,YAAY,IAAI,KAAK,GAAG;AAC3B,QAAI,CAAE,MAAM,qBAAqB,YAAY,OAAO,WAAW,GAAI;AACjE,aAAO,KAAK,uBAAuB,KAAK,GAAG;AAAA,IAC7C;AACA,UAAMA,SAAQ,MAAM,QAAQ,QAAQ,KAAK;AACzC,UAAMC,SAAQ,MAAM,cAAc,EAAE,YAAY,OAAO,aAAa,OAAAD,OAAM,CAAC;AAC3E,WAAO,cAAcC,MAAK;AAAA,EAC5B;AAGA,QAAM,QAAQ,MAAM,QAAQ,QAAQ,KAAK;AAEzC,QAAM,QAAQ,MAAM,QAAQ;AAAA,IAC1B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,SAAO,cAAc,KAAK;AAC5B;AAGA,SAAS,cAAc,OAA6B;AAClD,MAAI,MAAM,WAAW,UAAa,MAAM,WAAW,IAAI;AACrD,YAAQ,OAAO,MAAM,MAAM,MAAM;AAAA,EACnC;AACA,MAAI,MAAM,WAAW,UAAa,MAAM,WAAW,IAAI;AACrD,YAAQ,OAAO,MAAM,MAAM,OAAO,SAAS,IAAI,IAAI,MAAM,SAAS,GAAG,MAAM,MAAM;AAAA,CAAI;AAAA,EACvF;AACA,UAAQ,KAAK,MAAM,QAAQ;AAC7B;","names":["stdin","reply"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ConnectorConfig, R as ResolvedConnector } from './types-
|
|
2
|
-
export { A as AuthSpec, a as ChangeRecord, D as DetectedPlatform, b as DiagnosticResult, E as EventPayloadMap, H as HookDefinition, c as HookEventName, d as HookParadigm, e as HookResponse, f as HooksConfig, I as InstallResult, g as InstallScope, N as NotificationEvent, P as PlatformCapabilities,
|
|
1
|
+
import { C as ConnectorConfig, R as ResolvedConnector } from './types-CNigfEuR.js';
|
|
2
|
+
export { A as AuthSpec, a as ChangeRecord, D as DetectedPlatform, b as DiagnosticResult, E as EventPayloadMap, H as HookDefinition, c as HookEventName, d as HookParadigm, e as HookResponse, f as HooksConfig, I as InstallResult, g as InstallScope, M as MemoryDef, N as NativeHookDef, h as NativeHookEvent, i as NotificationEvent, P as PermissionRequestEvent, j as PlatformCapabilities, k as PlatformId, l as PlatformMemoryOverride, m as PlatformOverride, n as PostToolUseEvent, o as PostToolUseFailureEvent, p as PreCompactEvent, q as PreToolUseEvent, S as ServerDef, r as SessionEndEvent, s as SessionStartEvent, t as StopEvent, u as SubagentStartEvent, v as SubagentStopEvent, T as TelemetryConfig, w as ToolFilter, x as Transport, U as UserPromptSubmitEvent } from './types-CNigfEuR.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* core/define-connector — the public write-once entry point.
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
installConnector
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-Z2BVYKZL.js";
|
|
5
5
|
import {
|
|
6
6
|
fail,
|
|
7
7
|
parseScope,
|
|
8
8
|
parseTargets,
|
|
9
9
|
print,
|
|
10
10
|
renderInstallResult
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-AKJGNTU3.js";
|
|
12
12
|
import "./chunk-KHO5WNTP.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-O2SBA5KR.js";
|
|
14
14
|
import {
|
|
15
15
|
findConnectorConfig,
|
|
16
16
|
loadConnectorFromPath
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-3JCRUROU.js";
|
|
18
|
+
import "./chunk-GSGDG2BV.js";
|
|
19
|
+
import "./chunk-N6HH7K6P.js";
|
|
19
20
|
import "./chunk-TRQKHP7D.js";
|
|
20
21
|
|
|
21
22
|
// src/cli/commands/install.ts
|
|
@@ -28,7 +29,10 @@ async function run(argv) {
|
|
|
28
29
|
targets: { type: "string" },
|
|
29
30
|
connector: { type: "string" },
|
|
30
31
|
project: { type: "string" },
|
|
31
|
-
"dry-run": { type: "boolean", default: false }
|
|
32
|
+
"dry-run": { type: "boolean", default: false },
|
|
33
|
+
// Memory surface: overwrite USER-EDITED managed blocks (hash drift).
|
|
34
|
+
// Default behavior is warn-and-leave; --force backs the file up first.
|
|
35
|
+
force: { type: "boolean", default: false }
|
|
32
36
|
},
|
|
33
37
|
allowPositionals: false
|
|
34
38
|
});
|
|
@@ -49,6 +53,7 @@ async function run(argv) {
|
|
|
49
53
|
scope,
|
|
50
54
|
projectDir,
|
|
51
55
|
dryRun: values["dry-run"],
|
|
56
|
+
force: values.force,
|
|
52
57
|
...targets ? { targets } : {}
|
|
53
58
|
});
|
|
54
59
|
print(renderInstallResult(result, "install"));
|
|
@@ -57,4 +62,4 @@ async function run(argv) {
|
|
|
57
62
|
export {
|
|
58
63
|
run
|
|
59
64
|
};
|
|
60
|
-
//# sourceMappingURL=install-
|
|
65
|
+
//# sourceMappingURL=install-DMW2C7SV.js.map
|