@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
package/dist/types-CYUB1OTr.d.ts
DELETED
|
@@ -1,427 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* core/types — the shared contract surface for agent-connector.
|
|
3
|
-
*
|
|
4
|
-
* Everything in this file is type-only (no runtime), so it is safe to import
|
|
5
|
-
* from anywhere without creating module cycles. It is the single source of
|
|
6
|
-
* truth that every adapter, the telemetry layer, the CLI, and the public API
|
|
7
|
-
* code against.
|
|
8
|
-
*
|
|
9
|
-
* Grounded in the understand-phase report (docs/research/understand-report.md)
|
|
10
|
-
* and generalized from context-mode's proven 15-platform adapter SPI:
|
|
11
|
-
* - context-mode hardcoded the served identity ("context-mode"); here the
|
|
12
|
-
* identity is a parameter the developer supplies via defineConnector().
|
|
13
|
-
* - context-mode's session/memory/FTS domain logic is removed from the SPI.
|
|
14
|
-
* - MCP server registration is modeled here (root key + format differ per
|
|
15
|
-
* platform, so adapters must render it — it is NOT "100% portable").
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* Stable identifiers for every host platform agent-connector can target.
|
|
19
|
-
*
|
|
20
|
-
* NOTE on usage-only platforms: `"synthetic"` is a TELEMETRY-ONLY id
|
|
21
|
-
* (Octofriend / synthetic.new). It has a usage reader (usage/readers/synthetic)
|
|
22
|
-
* but DELIBERATELY no deploy adapter and no ADAPTER_REGISTRY entry — Octofriend
|
|
23
|
-
* exposes no writable MCP config to install into. The registry-completeness test
|
|
24
|
-
* (tests/adapters/registry-completeness.test.ts) allowlists it for this reason.
|
|
25
|
-
*/
|
|
26
|
-
type PlatformId = "claude-code" | "codex" | "cursor" | "vscode-copilot" | "jetbrains-copilot" | "copilot-cli" | "gemini-cli" | "opencode" | "kilo" | "kilo-cli" | "warp" | "hermes" | "openclaw" | "zed" | "antigravity" | "antigravity-cli" | "kiro" | "qwen-code" | "kimi" | "pi" | "omp" | "droid" | "roo-code" | "trae" | "amp" | "codebuff" | "mux" | "crush" | "goose" | "synthetic" | "unknown";
|
|
27
|
-
/**
|
|
28
|
-
* Hook I/O paradigm — the deepest cross-platform divergence (report §4).
|
|
29
|
-
* Canonical shipped sets (keep in sync with src/adapters/registry.ts — this
|
|
30
|
-
* comment once drifted and seeded a docs-wide misclassification):
|
|
31
|
-
* - "json-stdio" (16): host pipes JSON to a command on stdin, reads
|
|
32
|
-
* JSON/exit-code back — Claude Code, Codex, Cursor, VS Code/JetBrains
|
|
33
|
-
* Copilot, Copilot CLI, Gemini CLI, Qwen, Kiro, Kimi, Crush, Goose, Hermes,
|
|
34
|
-
* Droid (Factory), Antigravity (+ the agy CLI). One universal entrypoint
|
|
35
|
-
* binary handles all of them.
|
|
36
|
-
* - "ts-plugin" (4): host loads a JS/TS module exporting lifecycle functions
|
|
37
|
-
* — OpenCode, Kilo CLI, OMP, OpenClaw. Framework generates the module.
|
|
38
|
-
* - "mcp-only" (9): no hook layer at all — Warp, Kilo, Roo Code, Trae, Zed,
|
|
39
|
-
* Amp, Codebuff, Mux, Pi. Only the MCP server (or skills surface) is
|
|
40
|
-
* installed; hooks are reported unavailable.
|
|
41
|
-
*/
|
|
42
|
-
type HookParadigm = "json-stdio" | "ts-plugin" | "mcp-only";
|
|
43
|
-
/**
|
|
44
|
-
* Install scope, normalized across platforms and ordered low→high precedence.
|
|
45
|
-
* Each adapter maps these to a concrete config path and knows which it supports.
|
|
46
|
-
*/
|
|
47
|
-
type InstallScope = "system" | "user" | "project" | "profile" | "managed";
|
|
48
|
-
type Transport = "stdio" | "http" | "sse" | "ws";
|
|
49
|
-
interface ToolFilter {
|
|
50
|
-
/** Glob/exact tool names to expose. Default: ["*"]. */
|
|
51
|
-
include?: string[];
|
|
52
|
-
/** Glob/exact tool names to hide. */
|
|
53
|
-
exclude?: string[];
|
|
54
|
-
}
|
|
55
|
-
interface AuthSpec {
|
|
56
|
-
type: "oauth" | "bearerEnv" | "none";
|
|
57
|
-
/** Env var holding the bearer token when type === "bearerEnv". */
|
|
58
|
-
bearerEnvVar?: string;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* A normalized, transport-polymorphic MCP server descriptor. Declared ONCE by
|
|
62
|
-
* the developer; each adapter renders it into that platform's native dialect
|
|
63
|
-
* (root key, field names, format). Adapters that cannot honor a requested
|
|
64
|
-
* transport downgrade-or-skip and report it — they never throw.
|
|
65
|
-
*/
|
|
66
|
-
interface ServerDef {
|
|
67
|
-
transport: Transport;
|
|
68
|
-
command?: string;
|
|
69
|
-
args?: string[];
|
|
70
|
-
/** Env vars passed to the server process. Values support ${env:VAR} interpolation. */
|
|
71
|
-
env?: Record<string, string>;
|
|
72
|
-
cwd?: string;
|
|
73
|
-
url?: string;
|
|
74
|
-
headers?: Record<string, string>;
|
|
75
|
-
auth?: AuthSpec;
|
|
76
|
-
tools?: ToolFilter;
|
|
77
|
-
timeoutMs?: number;
|
|
78
|
-
/** Default true. When false, the entry is written disabled where supported. */
|
|
79
|
-
enabled?: boolean;
|
|
80
|
-
/**
|
|
81
|
-
* Wrap the server with `agent-connector serve` so per-tool telemetry is
|
|
82
|
-
* captured transparently. Default: true for stdio servers when telemetry is
|
|
83
|
-
* enabled; false for remote servers (cannot intercept) and when explicitly off.
|
|
84
|
-
*/
|
|
85
|
-
wrapForTelemetry?: boolean;
|
|
86
|
-
}
|
|
87
|
-
/** Canonical, platform-agnostic lifecycle event names. */
|
|
88
|
-
type HookEventName = "SessionStart" | "SessionEnd" | "UserPromptSubmit" | "PreToolUse" | "PostToolUse" | "PreCompact" | "Stop" | "Notification";
|
|
89
|
-
interface BaseEvent {
|
|
90
|
-
/** Which host produced this event (from runtime detection). */
|
|
91
|
-
hostPlatform: PlatformId;
|
|
92
|
-
/** Connector id this event is dispatched to. */
|
|
93
|
-
connectorId: string;
|
|
94
|
-
/** Host session id (adapter-extracted; "" when the host provides none). */
|
|
95
|
-
sessionId: string;
|
|
96
|
-
/** Project directory if the host exposes one. */
|
|
97
|
-
projectDir?: string;
|
|
98
|
-
/** Raw host-specific payload for passthrough/escape-hatch use. */
|
|
99
|
-
raw: unknown;
|
|
100
|
-
}
|
|
101
|
-
interface PreToolUseEvent extends BaseEvent {
|
|
102
|
-
toolName: string;
|
|
103
|
-
toolInput: Record<string, unknown>;
|
|
104
|
-
}
|
|
105
|
-
interface PostToolUseEvent extends BaseEvent {
|
|
106
|
-
toolName: string;
|
|
107
|
-
toolInput: Record<string, unknown>;
|
|
108
|
-
toolOutput?: string;
|
|
109
|
-
isError?: boolean;
|
|
110
|
-
}
|
|
111
|
-
interface SessionStartEvent extends BaseEvent {
|
|
112
|
-
source: "startup" | "compact" | "resume" | "clear";
|
|
113
|
-
}
|
|
114
|
-
interface SessionEndEvent extends BaseEvent {
|
|
115
|
-
reason?: string;
|
|
116
|
-
}
|
|
117
|
-
interface UserPromptSubmitEvent extends BaseEvent {
|
|
118
|
-
prompt: string;
|
|
119
|
-
}
|
|
120
|
-
interface PreCompactEvent extends BaseEvent {
|
|
121
|
-
trigger?: "auto" | "manual";
|
|
122
|
-
}
|
|
123
|
-
interface StopEvent extends BaseEvent {
|
|
124
|
-
/** True when the stop hook itself was triggered during a previous stop hook. */
|
|
125
|
-
stopHookActive?: boolean;
|
|
126
|
-
}
|
|
127
|
-
interface NotificationEvent extends BaseEvent {
|
|
128
|
-
message: string;
|
|
129
|
-
}
|
|
130
|
-
/** Map of event name → its normalized payload type. */
|
|
131
|
-
interface EventPayloadMap {
|
|
132
|
-
SessionStart: SessionStartEvent;
|
|
133
|
-
SessionEnd: SessionEndEvent;
|
|
134
|
-
UserPromptSubmit: UserPromptSubmitEvent;
|
|
135
|
-
PreToolUse: PreToolUseEvent;
|
|
136
|
-
PostToolUse: PostToolUseEvent;
|
|
137
|
-
PreCompact: PreCompactEvent;
|
|
138
|
-
Stop: StopEvent;
|
|
139
|
-
Notification: NotificationEvent;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Normalized hook response. A handler returns a subset of these; the adapter
|
|
143
|
-
* formats it into the host's native reply (exit codes / JSON / control fields).
|
|
144
|
-
* Adapters drop fields the host cannot honor (e.g. updatedOutput where the host
|
|
145
|
-
* cannot rewrite tool output) and the framework reports the degradation.
|
|
146
|
-
*/
|
|
147
|
-
interface HookResponse {
|
|
148
|
-
/**
|
|
149
|
-
* - "allow": pass through (default when handler returns void)
|
|
150
|
-
* - "deny": block tool execution / stop the action
|
|
151
|
-
* - "modify": replace tool input (PreToolUse) with `updatedInput`
|
|
152
|
-
* - "context": inject `additionalContext` as soft guidance
|
|
153
|
-
* - "ask": prompt the user to confirm
|
|
154
|
-
*/
|
|
155
|
-
decision?: "allow" | "deny" | "modify" | "context" | "ask";
|
|
156
|
-
/** Shown to the model/user; required in spirit for deny/ask. */
|
|
157
|
-
reason?: string;
|
|
158
|
-
/** Replacement tool input — only meaningful with decision "modify". */
|
|
159
|
-
updatedInput?: Record<string, unknown>;
|
|
160
|
-
/** Extra context to inject — meaningful with "context" or on SessionStart. */
|
|
161
|
-
additionalContext?: string;
|
|
162
|
-
/** Rewritten tool output — only where the host supports it (PostToolUse). */
|
|
163
|
-
updatedOutput?: string;
|
|
164
|
-
}
|
|
165
|
-
/** A handler bound to one event, optionally filtered by a tool matcher. */
|
|
166
|
-
interface HookDefinition<E extends HookEventName = HookEventName> {
|
|
167
|
-
/**
|
|
168
|
-
* Regex string matched against the tool name (tool events only). Empty/omitted
|
|
169
|
-
* matches all. Rendered into each host's native matcher syntax where supported,
|
|
170
|
-
* else evaluated by the universal entrypoint at runtime.
|
|
171
|
-
*/
|
|
172
|
-
matcher?: string;
|
|
173
|
-
handler(event: EventPayloadMap[E]): HookResponse | void | Promise<HookResponse | void>;
|
|
174
|
-
}
|
|
175
|
-
/** Developer-declared hooks, keyed by canonical event name. */
|
|
176
|
-
interface HooksConfig {
|
|
177
|
-
SessionStart?: HookDefinition<"SessionStart">;
|
|
178
|
-
SessionEnd?: HookDefinition<"SessionEnd">;
|
|
179
|
-
UserPromptSubmit?: HookDefinition<"UserPromptSubmit">;
|
|
180
|
-
PreToolUse?: HookDefinition<"PreToolUse">;
|
|
181
|
-
PostToolUse?: HookDefinition<"PostToolUse">;
|
|
182
|
-
PreCompact?: HookDefinition<"PreCompact">;
|
|
183
|
-
Stop?: HookDefinition<"Stop">;
|
|
184
|
-
Notification?: HookDefinition<"Notification">;
|
|
185
|
-
}
|
|
186
|
-
/** What a given host can actually honor. The single-API layer degrades to it. */
|
|
187
|
-
interface PlatformCapabilities {
|
|
188
|
-
preToolUse: boolean;
|
|
189
|
-
postToolUse: boolean;
|
|
190
|
-
preCompact: boolean;
|
|
191
|
-
sessionStart: boolean;
|
|
192
|
-
sessionEnd: boolean;
|
|
193
|
-
userPromptSubmit: boolean;
|
|
194
|
-
stop: boolean;
|
|
195
|
-
notification: boolean;
|
|
196
|
-
/** Can a PreToolUse hook rewrite tool arguments? */
|
|
197
|
-
canModifyArgs: boolean;
|
|
198
|
-
/** Can a PostToolUse hook rewrite tool output? */
|
|
199
|
-
canModifyOutput: boolean;
|
|
200
|
-
/** Can a hook inject context at session start / compaction? */
|
|
201
|
-
canInjectSessionContext: boolean;
|
|
202
|
-
/** MCP transports this host can register. */
|
|
203
|
-
transports: Transport[];
|
|
204
|
-
/**
|
|
205
|
-
* Content-surface support (all OPTIONAL so existing adapter capability
|
|
206
|
-
* literals compile unchanged; read as `?? false`). Only surface-supporting
|
|
207
|
-
* adapters set these true. The BaseAdapter install/uninstall defaults
|
|
208
|
-
* handle the "unsupported" skip/warn regardless of the flag.
|
|
209
|
-
*/
|
|
210
|
-
supportsCommands?: boolean;
|
|
211
|
-
supportsSkills?: boolean;
|
|
212
|
-
supportsSubagents?: boolean;
|
|
213
|
-
}
|
|
214
|
-
/** Tool access expressed once; adapters render to allowed-tools / tools[] / readonly. */
|
|
215
|
-
interface SurfaceToolPolicy {
|
|
216
|
-
allow?: string[];
|
|
217
|
-
deny?: string[];
|
|
218
|
-
}
|
|
219
|
-
/** A slash command (= a Skill on 2026 Claude; adapters pick the right surface). */
|
|
220
|
-
interface CommandDef {
|
|
221
|
-
/** kebab-case; becomes the slash name and the filename stem. Source of truth. */
|
|
222
|
-
name: string;
|
|
223
|
-
/** One-line description for /help + model auto-selection. */
|
|
224
|
-
description?: string;
|
|
225
|
-
/** Prompt template body (markdown). The portable core of the command. */
|
|
226
|
-
prompt: string;
|
|
227
|
-
/** Shown in argument completion, e.g. "[environment]". */
|
|
228
|
-
argumentHint?: string;
|
|
229
|
-
tools?: SurfaceToolPolicy;
|
|
230
|
-
/** Model override (raw id or alias; adapters pass through or drop+warn). */
|
|
231
|
-
model?: string;
|
|
232
|
-
/** Force subagent / forked context where the platform supports it. */
|
|
233
|
-
subtask?: boolean;
|
|
234
|
-
/** Verbatim per-platform frontmatter additions (escape hatch). */
|
|
235
|
-
extra?: Record<string, unknown>;
|
|
236
|
-
}
|
|
237
|
-
/** An Agent Skill (folder + SKILL.md, Agent Skills open standard). */
|
|
238
|
-
interface SkillDef {
|
|
239
|
-
/** <=64 chars, [a-z0-9-]; MUST equal the skill dir name. Source of truth. */
|
|
240
|
-
name: string;
|
|
241
|
-
/** <=1024 chars, 3rd-person "what + when"; drives model auto-selection. Required. */
|
|
242
|
-
description: string;
|
|
243
|
-
/** SKILL.md markdown body (instructions). */
|
|
244
|
-
body: string;
|
|
245
|
-
tools?: SurfaceToolPolicy;
|
|
246
|
-
model?: string;
|
|
247
|
-
disableModelInvocation?: boolean;
|
|
248
|
-
/** Extra files bundled beside SKILL.md, relative path → contents. */
|
|
249
|
-
resources?: Record<string, string>;
|
|
250
|
-
extra?: Record<string, unknown>;
|
|
251
|
-
}
|
|
252
|
-
/** A named subagent (system-prompt + tool/model scoping). */
|
|
253
|
-
interface SubagentDef {
|
|
254
|
-
/** kebab-case identifier. Source of truth (filename stem on most platforms). */
|
|
255
|
-
name: string;
|
|
256
|
-
/** Delegation hint shown to the orchestrator. Required. */
|
|
257
|
-
description: string;
|
|
258
|
-
/** System prompt = the agent's instructions (markdown body / developer_instructions). */
|
|
259
|
-
prompt: string;
|
|
260
|
-
tools?: SurfaceToolPolicy;
|
|
261
|
-
/** Model: alias|full-id|"inherit". Default left to platform. */
|
|
262
|
-
model?: string;
|
|
263
|
-
/** Coarse permission knob → Cursor readonly, opencode/kilo permission map. */
|
|
264
|
-
readonly?: boolean;
|
|
265
|
-
extra?: Record<string, unknown>;
|
|
266
|
-
}
|
|
267
|
-
interface TelemetryConfig {
|
|
268
|
-
/** On by default. Global kill switch also via AGENT_CONNECTOR_TELEMETRY=0. */
|
|
269
|
-
enabled?: boolean;
|
|
270
|
-
/** Tokenizer family selection. "auto" infers from client/host. */
|
|
271
|
-
modelFamilyHint?: "auto" | "openai" | "anthropic" | "generic";
|
|
272
|
-
/** Tokenize tools/list schemas once → fixed per-turn tool-definition overhead. */
|
|
273
|
-
measureToolDefs?: boolean;
|
|
274
|
-
/** Opt-in network calibration (sends content off-box — off by default). */
|
|
275
|
-
calibration?: {
|
|
276
|
-
anthropicCountTokens?: boolean;
|
|
277
|
-
};
|
|
278
|
-
/**
|
|
279
|
-
* OPT-IN host-native turn-usage capture (off by default). When enabled, the
|
|
280
|
-
* Gemini / Antigravity adapters ALSO install an AfterModel / PostInvocation hook
|
|
281
|
-
* that reads the host's `usageMetadata` and records a DISTINCT `model_turn`
|
|
282
|
-
* telemetry row (confidence `host-native`). Whole-conversation, never summed with
|
|
283
|
-
* the per-MCP `call` rows. May also be forced on at install via the env switch
|
|
284
|
-
* AGENT_CONNECTOR_HOST_NATIVE=1. Aggregate counts only; no raw content stored.
|
|
285
|
-
*/
|
|
286
|
-
hostNativeUsage?: boolean;
|
|
287
|
-
/** Storage backend. NDJSON (default) needs no native deps; sqlite is an upgrade. */
|
|
288
|
-
store?: "ndjson" | "sqlite";
|
|
289
|
-
}
|
|
290
|
-
/** Per-platform override / escape hatch (report §3.2). */
|
|
291
|
-
interface PlatformOverride {
|
|
292
|
-
/** false → do not install hooks on this platform; object → merge/replace hooks. */
|
|
293
|
-
hooks?: boolean | Partial<HooksConfig>;
|
|
294
|
-
/** false → do not register the MCP server here; object → shallow-merge into ServerDef. */
|
|
295
|
-
server?: Partial<ServerDef> | false;
|
|
296
|
-
/** Force a specific scope for this platform. */
|
|
297
|
-
scope?: InstallScope;
|
|
298
|
-
/** false → skip command files on this platform. */
|
|
299
|
-
commands?: boolean;
|
|
300
|
-
/** false → skip skill files on this platform. */
|
|
301
|
-
skills?: boolean;
|
|
302
|
-
/** false → skip subagent files on this platform. */
|
|
303
|
-
subagents?: boolean;
|
|
304
|
-
/** Verbatim fields merged into the native config (reach platform-exclusive features). */
|
|
305
|
-
extra?: Record<string, unknown>;
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
308
|
-
* Distribution metadata for the OFFICIAL MCP standard artifacts `package` can
|
|
309
|
-
* emit — the registry `server.json` and the MCPB `.mcpb` bundle. These describe
|
|
310
|
-
* the developer's REAL upstream MCP server (what a registry installer / Claude
|
|
311
|
-
* Desktop runs directly), NOT agent-connector's telemetry `serve` wrapper, so
|
|
312
|
-
* they need inputs the cross-platform install does not: the namespace the dev
|
|
313
|
-
* proved ownership of, their published package name, and bundle author info.
|
|
314
|
-
*
|
|
315
|
-
* All optional — a connector that never publishes to the registry or as a
|
|
316
|
-
* bundle can omit this entirely; the relevant `package --format` raises a clear,
|
|
317
|
-
* actionable error only when its required field is missing.
|
|
318
|
-
*/
|
|
319
|
-
interface PublishConfig {
|
|
320
|
-
/**
|
|
321
|
-
* Reverse-DNS namespace the developer OWNS, e.g. "io.github.acme" or
|
|
322
|
-
* "com.acme". server.json `name` is rendered as `${registryNamespace}/${id}`.
|
|
323
|
-
* agent-connector never mints a namespace on the dev's behalf — the registry
|
|
324
|
-
* requires proven ownership (the `mcp-publisher login` step the dev runs).
|
|
325
|
-
*/
|
|
326
|
-
registryNamespace?: string;
|
|
327
|
-
/**
|
|
328
|
-
* The developer's REAL published package that runs the MCP server, e.g.
|
|
329
|
-
* "@acme/acme-db-mcp" — server.json packages[].identifier. Required to emit a
|
|
330
|
-
* registry npm package entry (we cannot guess the published name).
|
|
331
|
-
*/
|
|
332
|
-
packageName?: string;
|
|
333
|
-
/** Package registry base URL. Default https://registry.npmjs.org for npm. */
|
|
334
|
-
registryBaseUrl?: string;
|
|
335
|
-
/** Bundle author. The MCPB manifest requires author.name. */
|
|
336
|
-
author?: {
|
|
337
|
-
name: string;
|
|
338
|
-
email?: string;
|
|
339
|
-
url?: string;
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
/** What a developer passes to defineConnector(). */
|
|
343
|
-
interface ConnectorConfig {
|
|
344
|
-
/** Stable connector id (kebab-case). Replaces context-mode's hardcoded identity. */
|
|
345
|
-
id: string;
|
|
346
|
-
displayName?: string;
|
|
347
|
-
version?: string;
|
|
348
|
-
/** The MCP server to deploy. Omit for a hooks-only connector. */
|
|
349
|
-
server?: ServerDef;
|
|
350
|
-
/** Lifecycle hooks. Omit for a server-only connector. */
|
|
351
|
-
hooks?: HooksConfig;
|
|
352
|
-
/** Telemetry options. Telemetry is ON by default even if this is omitted. */
|
|
353
|
-
telemetry?: TelemetryConfig;
|
|
354
|
-
/** Slash commands to deploy as native content files. */
|
|
355
|
-
commands?: CommandDef[];
|
|
356
|
-
/** Agent Skills to deploy as native content files. */
|
|
357
|
-
skills?: SkillDef[];
|
|
358
|
-
/** Named subagents to deploy as native content files. */
|
|
359
|
-
subagents?: SubagentDef[];
|
|
360
|
-
/** Per-platform overrides / escape hatches. */
|
|
361
|
-
platforms?: Partial<Record<PlatformId, PlatformOverride>>;
|
|
362
|
-
/** "auto" (all detected) or an explicit allow-list. Default "auto". */
|
|
363
|
-
targets?: "auto" | PlatformId[];
|
|
364
|
-
/** Distribution metadata for the registry server.json + MCPB bundle formats. */
|
|
365
|
-
publish?: PublishConfig;
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* A validated, normalized connector — what defineConnector() returns and what
|
|
369
|
-
* adapters/CLI consume. All optional config fields are resolved to defaults.
|
|
370
|
-
*/
|
|
371
|
-
interface ResolvedConnector {
|
|
372
|
-
id: string;
|
|
373
|
-
displayName: string;
|
|
374
|
-
version: string;
|
|
375
|
-
server?: ServerDef;
|
|
376
|
-
hooks: HooksConfig;
|
|
377
|
-
hookEvents: HookEventName[];
|
|
378
|
-
telemetry: Required<Omit<TelemetryConfig, "calibration">> & {
|
|
379
|
-
calibration: {
|
|
380
|
-
anthropicCountTokens: boolean;
|
|
381
|
-
};
|
|
382
|
-
};
|
|
383
|
-
/** Normalized commands; defaults applied; [] when none. */
|
|
384
|
-
commands: CommandDef[];
|
|
385
|
-
/** Normalized skills; defaults applied; [] when none. */
|
|
386
|
-
skills: SkillDef[];
|
|
387
|
-
/** Normalized subagents; defaults applied; [] when none. */
|
|
388
|
-
subagents: SubagentDef[];
|
|
389
|
-
platforms: Partial<Record<PlatformId, PlatformOverride>>;
|
|
390
|
-
targets: "auto" | PlatformId[];
|
|
391
|
-
/** Distribution metadata (registry server.json + MCPB bundle); passed through verbatim. */
|
|
392
|
-
publish?: PublishConfig;
|
|
393
|
-
}
|
|
394
|
-
/** Result of detecting one platform on this machine. */
|
|
395
|
-
interface DetectedPlatform {
|
|
396
|
-
id: PlatformId;
|
|
397
|
-
name: string;
|
|
398
|
-
installed: boolean;
|
|
399
|
-
paradigm: HookParadigm;
|
|
400
|
-
capabilities: PlatformCapabilities;
|
|
401
|
-
/** Native config path that would be written for `scope`. */
|
|
402
|
-
configPath: string;
|
|
403
|
-
scope: InstallScope;
|
|
404
|
-
reason: string;
|
|
405
|
-
confidence: "high" | "medium" | "low";
|
|
406
|
-
}
|
|
407
|
-
interface ChangeRecord {
|
|
408
|
-
platform: PlatformId;
|
|
409
|
-
action: "create" | "update" | "skip" | "remove" | "warn";
|
|
410
|
-
/** File touched (when applicable). */
|
|
411
|
-
path?: string;
|
|
412
|
-
detail: string;
|
|
413
|
-
}
|
|
414
|
-
interface InstallResult {
|
|
415
|
-
connectorId: string;
|
|
416
|
-
dryRun: boolean;
|
|
417
|
-
changes: ChangeRecord[];
|
|
418
|
-
warnings: string[];
|
|
419
|
-
}
|
|
420
|
-
interface DiagnosticResult {
|
|
421
|
-
check: string;
|
|
422
|
-
status: "pass" | "fail" | "warn";
|
|
423
|
-
message: string;
|
|
424
|
-
fix?: string;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
export type { AuthSpec as A, ConnectorConfig as C, DetectedPlatform as D, EventPayloadMap as E, HookDefinition as H, InstallResult as I, NotificationEvent as N, PlatformCapabilities as P, ResolvedConnector as R, ServerDef as S, TelemetryConfig as T, UserPromptSubmitEvent as U, ChangeRecord as a, DiagnosticResult as b, HookEventName as c, HookParadigm as d, HookResponse as e, HooksConfig as f, InstallScope as g, PlatformId as h, PlatformOverride as i, PostToolUseEvent as j, PreCompactEvent as k, PreToolUseEvent as l, SessionEndEvent as m, SessionStartEvent as n, StopEvent as o, ToolFilter as p, Transport as q };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/adapters/vscode-copilot/index.ts"],"sourcesContent":["/**\n * adapters/vscode-copilot — VS Code Copilot platform adapter for agent-connector.\n *\n * Generalized from context-mode's proven VS Code Copilot adapter: the served\n * identity is now `ctx.connector` (not a hardcoded \"context-mode\"), and every\n * hook command points at the single stable home binary\n * (`buildHomeBinHookCommand`) so one framework update propagates everywhere.\n *\n * VS Code Copilot is a json-stdio host (report §2 \"Platform Integration Matrix\"):\n * - MCP servers: workspace (project) scope → <projectDir>/.vscode/mcp.json;\n * user-profile scope → ~/.vscode/mcp.json. The ROOT KEY is \"servers\" (NOT\n * \"mcpServers\" — a Cursor footgun VS Code deliberately diverges on), with an\n * optional sibling \"inputs\" array. The file is officially JSONC, but a plain\n * JSON write is valid JSONC, so we write strict JSON.\n * - Hooks (Preview, ~v1.110): discovered from .github/hooks/*.json (and from\n * Claude-compatible .claude/settings.json). We write a per-connector file at\n * <projectDir>/.github/hooks/<connector-id>.json shaped like the Copilot\n * hooks schema: `{ version: 1, hooks: { <PascalCaseEvent>: [ { type:\n * \"command\", command } ] } }`. The top-level `version: 1` is REQUIRED — the\n * Copilot runtime rejects a version-less file and no hooks fire. Unlike\n * Claude, each entry is a FLAT `{ type, command }` object (no `{ matcher,\n * hooks:[...] }` wrapper). Matchers are parsed but IGNORED (all hooks fire\n * on all tools) — we still persist a connector-declared matcher for parity.\n * - Reply: Claude-compatible JSON on stdout (exit 0). A `hookSpecificOutput`\n * object keyed by PascalCase `hookEventName` carries permissionDecision\n * (deny|ask) + permissionDecisionReason, additionalContext, and (PreToolUse)\n * updatedInput. This mirrors the claude-code adapter exactly.\n *\n * Env interpolation: VS Code supports its own `${env:VAR}` (and `${input:VAR}`)\n * native interpolation, so env/header/url values are rewritten to the native\n * `${env:VAR}` token rather than baked into the file. The token is documented at\n * vscodeEnvToken below.\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, HookReply, InstallContext, NormalizedEvent } from \"../spi.js\";\nimport type {\n ChangeRecord,\n CommandDef,\n DetectedPlatform,\n HealthCheck,\n HookEventName,\n HookParadigm,\n HookResponse,\n NotificationEvent,\n PlatformCapabilities,\n PlatformId,\n PostToolUseEvent,\n PreCompactEvent,\n PreToolUseEvent,\n ServerDef,\n SessionEndEvent,\n SessionStartEvent,\n SkillDef,\n StopEvent,\n SubagentDef,\n Transport,\n UserPromptSubmitEvent,\n} from \"../../core/types.js\";\nimport { rewriteEnvRefs } from \"../../core/interpolate.js\";\nimport {\n buildHomeBinHookCommand,\n buildServeWrapperCommand,\n isHomeBinHookCommand,\n shouldWrapForTelemetry,\n} from \"../../core/spawn.js\";\n\nconst HOST: PlatformId = \"vscode-copilot\";\n\n/**\n * VS Code's MCP root key is \"servers\" — NOT \"mcpServers\". This is the single\n * most common VS Code Copilot integration bug (report §1): a config written\n * under \"mcpServers\" is silently ignored.\n */\nconst MCP_ROOT_KEY = \"servers\";\n\n/** Top-level version the Copilot hooks runtime requires; a version-less file is rejected. */\nconst VSCODE_HOOKS_VERSION = 1;\n\n/**\n * VS Code Copilot reads PascalCase hook event names from its hooks file —\n * identical to Claude Code. Only the events VS Code actually delivers are\n * registered; everything else has no Copilot equivalent and is reported as a\n * warn/skip at install time.\n */\nconst EVENT_MAP: Partial<Record<HookEventName, string>> = {\n PreToolUse: \"PreToolUse\",\n PostToolUse: \"PostToolUse\",\n PreCompact: \"PreCompact\",\n SessionStart: \"SessionStart\",\n};\n\n/** A single VS Code Copilot native hook entry — a flat command object. */\ninterface VSCodeHookEntry {\n type: \"command\";\n command: string;\n}\n\n/** The shape of a VS Code Copilot .github/hooks/<connector>.json file. */\ninterface VSCodeHooksFile {\n version?: number;\n hooks?: Record<string, VSCodeHookEntry[]>;\n}\n\n/** Native MCP server entry shapes VS Code accepts under `servers`. */\ninterface VSCodeStdioServer {\n type: \"stdio\";\n command: string;\n args?: string[];\n env?: Record<string, string>;\n cwd?: string;\n}\ninterface VSCodeHttpServer {\n type: \"http\";\n url: string;\n headers?: Record<string, string>;\n}\n\n/** Raw VS Code Copilot hook stdin payload (Claude-compatible snake_case fields). */\ninterface VSCodeWireInput {\n session_id?: string;\n transcript_path?: string;\n cwd?: string;\n workspace_roots?: string[];\n hook_event_name?: string;\n\n // tool events\n tool_name?: string;\n tool_input?: Record<string, unknown>;\n tool_response?: unknown;\n tool_output?: string;\n error_message?: string;\n\n // SessionStart\n source?: string;\n // SessionEnd\n reason?: string;\n // UserPromptSubmit\n prompt?: string;\n // PreCompact\n trigger?: string;\n // Stop\n stop_hook_active?: boolean;\n // Notification\n message?: string;\n\n /** Injected by the entrypoint so the runtime knows which connector to dispatch. */\n connector?: string;\n}\n\nexport class VSCodeCopilotAdapter extends BaseAdapter implements Adapter {\n readonly id: PlatformId = HOST;\n readonly name = \"VS Code Copilot\";\n readonly paradigm: HookParadigm = \"json-stdio\";\n\n readonly capabilities: PlatformCapabilities = {\n // VS Code Copilot's Preview hooks runtime delivers Pre/PostToolUse,\n // PreCompact, and SessionStart (the four events its schema documents).\n preToolUse: true,\n postToolUse: true,\n preCompact: true,\n sessionStart: true,\n sessionEnd: false,\n userPromptSubmit: false,\n stop: false,\n notification: false,\n // PreToolUse can rewrite tool input (updatedInput) but a PostToolUse hook\n // cannot rewrite already-emitted tool output — same as Claude/Cursor.\n canModifyArgs: true,\n canModifyOutput: false,\n canInjectSessionContext: true,\n transports: [\"stdio\", \"http\"],\n // Content surfaces: VS Code Copilot authors prompt files, Agent Skills, and\n // chat-mode agent files under the workspace .github/ tree (see content-file\n // path helpers below). All three are supported.\n supportsCommands: true,\n supportsSkills: true,\n supportsSubagents: true,\n };\n\n // ── Detection ────────────────────────────────────────────────────────────\n\n detectInstalled(projectDir: string): DetectedPlatform {\n const userDir = join(homedir(), \".vscode\");\n const userMcp = join(userDir, \"mcp.json\");\n const userInsidersDir = join(homedir(), \".vscode-insiders\");\n const projectVscode = join(projectDir, \".vscode\");\n const projectMcp = join(projectVscode, \"mcp.json\");\n\n const projInstalled = existsSync(projectMcp) || existsSync(projectVscode);\n const userInstalled =\n existsSync(userMcp) || existsSync(userDir) || existsSync(userInsidersDir);\n const installed = projInstalled || userInstalled;\n\n // Report the scope/path/reason for the marker that actually matched, so a\n // project-only install isn't misreported as a (non-existent) user install.\n const scope = projInstalled && !userInstalled ? \"project\" : \"user\";\n const configPath = scope === \"project\" ? projectMcp : userMcp;\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 ? scope === \"project\"\n ? `found project VS Code config at ${projectVscode}`\n : `found VS Code config under ${userDir}`\n : `no VS Code config at ${userDir}`,\n confidence: installed ? \"high\" : \"low\",\n };\n }\n\n // ── Native paths ─────────────────────────────────────────────────────────\n\n /**\n * Config dir choice (documented per task brief): project (workspace) scope →\n * <projectDir>/.vscode; user-profile scope → ~/.vscode. The real VS Code user\n * profile dir is OS-specific and not reliably discoverable without launching\n * VS Code, so ~/.vscode is the reasonable, cross-OS, no-launch choice — it is\n * also where \"MCP: Open User Configuration\" writes on a default profile.\n */\n getConfigDir(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? join(ctx.projectDir, \".vscode\")\n : join(homedir(), \".vscode\");\n }\n\n /** MCP server registration lives in <configDir>/mcp.json under root \"servers\". */\n getServerConfigPath(ctx: InstallContext): string {\n return join(this.getConfigDir(ctx), \"mcp.json\");\n }\n\n /**\n * Hook registration lives in the workspace-discovered .github/hooks tree,\n * which VS Code Copilot scans for *.json hook files. We write one file per\n * connector so installs/uninstalls never clobber another connector's hooks.\n * Anchored on projectDir for both scopes — .github/hooks is a workspace\n * concept (there is no user-profile equivalent in the Copilot hooks schema).\n */\n getHookConfigPath(ctx: InstallContext): string {\n return join(ctx.projectDir, \".github\", \"hooks\", `${ctx.connector.id}.json`);\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 vscode-copilot\"\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 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 VS Code's native `servers` entry. */\n private renderServerEntry(\n ctx: InstallContext,\n server: ServerDef,\n ): VSCodeStdioServer | VSCodeHttpServer {\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 const entry: VSCodeStdioServer = { type: \"stdio\", 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 if (server.cwd) entry.cwd = this.rewrite(server.cwd);\n return entry;\n }\n\n // http (and any other remote transport we surface) — VS Code registers a URL.\n const entry: VSCodeHttpServer = {\n type: \"http\",\n url: this.rewrite(server.url ?? \"\"),\n };\n const headers = this.renderEnv(server.headers);\n if (headers) entry.headers = headers;\n return entry;\n }\n\n /**\n * Render env/header values. VS Code supports its own `${env:VAR}` native\n * interpolation, so translate `${env:VAR}` refs to that native token rather\n * than baking 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 VS Code's native `${env:VAR}` token. */\n private rewrite(value: string): string {\n return rewriteEnvRefs(value, vscodeEnvToken);\n }\n\n // ── Hook install / uninstall ─────────────────────────────────────────────\n\n installHooks(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[HOST]?.hooks === false) {\n return [\n { platform: this.id, action: \"skip\", detail: \"hooks disabled for vscode-copilot\" },\n ];\n }\n if (connector.hookEvents.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no hooks\" }];\n }\n\n const hooksPath = this.getHookConfigPath(ctx);\n const file = this.readJson<VSCodeHooksFile>(hooksPath) ?? {};\n const hooks = (file.hooks ??= {});\n\n const changes: ChangeRecord[] = [];\n let mutated = false;\n\n for (const event of connector.hookEvents) {\n const vscodeEvent = EVENT_MAP[event];\n if (!vscodeEvent) {\n // No VS Code Copilot equivalent for this normalized event — report+skip.\n changes.push({\n platform: this.id,\n action: \"warn\",\n path: hooksPath,\n detail: `${event} has no VS Code Copilot hook equivalent — skipped`,\n });\n continue;\n }\n\n const command = buildHomeBinHookCommand(ctx.homeBinPath, HOST, event, connector.id);\n const entry: VSCodeHookEntry = { type: \"command\", command };\n\n const bucket = (hooks[vscodeEvent] ??= []);\n const existingIdx = bucket.findIndex((e) => this.isOurCommand(e.command, ctx));\n\n if (existingIdx >= 0) {\n if (JSON.stringify(bucket[existingIdx]) === JSON.stringify(entry)) {\n changes.push({\n platform: this.id,\n action: \"skip\",\n path: hooksPath,\n detail: `hooks.${vscodeEvent} already registered`,\n });\n continue;\n }\n bucket[existingIdx] = entry;\n changes.push({\n platform: this.id,\n action: \"update\",\n path: hooksPath,\n detail: `hooks.${vscodeEvent}`,\n });\n } else {\n bucket.push(entry);\n changes.push({\n platform: this.id,\n action: \"create\",\n path: hooksPath,\n detail: `hooks.${vscodeEvent}`,\n });\n }\n mutated = true;\n }\n\n if (mutated) {\n // The top-level version is REQUIRED — a version-less file is rejected and\n // no hooks fire. Always (re)assert it when we write.\n file.version = VSCODE_HOOKS_VERSION;\n this.writeJson(hooksPath, file, ctx.dryRun);\n }\n return changes;\n }\n\n uninstallHooks(ctx: InstallContext): ChangeRecord[] {\n const hooksPath = this.getHookConfigPath(ctx);\n const file = this.readJson<VSCodeHooksFile>(hooksPath);\n const hooks = file?.hooks;\n if (!file || !hooks) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n path: hooksPath,\n detail: \"no hooks section present\",\n },\n ];\n }\n\n const changes: ChangeRecord[] = [];\n let mutated = false;\n\n for (const vscodeEvent of Object.keys(hooks)) {\n const bucket = hooks[vscodeEvent];\n if (!Array.isArray(bucket)) continue;\n\n const before = bucket.length;\n // Only strip OUR connector's home-bin commands — never another\n // connector's (isHomeBinHookCommand is id-anchored).\n const next = bucket.filter((e) => !this.isOurCommand(e.command, ctx));\n const removed = before - next.length;\n if (removed > 0) {\n if (next.length > 0) hooks[vscodeEvent] = next;\n else delete hooks[vscodeEvent];\n changes.push({\n platform: this.id,\n action: \"remove\",\n path: hooksPath,\n detail: `hooks.${vscodeEvent} (${removed})`,\n });\n mutated = true;\n }\n }\n\n if (mutated) this.writeJson(hooksPath, file, ctx.dryRun);\n if (changes.length === 0) {\n changes.push({\n platform: this.id,\n action: \"skip\",\n path: hooksPath,\n detail: \"no matching hook entries\",\n });\n }\n return changes;\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 private isOurCommand(command: string | undefined, ctx: InstallContext): boolean {\n return isHomeBinHookCommand(command, ctx.homeBinPath, ctx.connector.id);\n }\n\n // ── Content surfaces: commands / skills / subagents ──────────────────────\n // CONTENT-ONLY: pure native-file writers under the workspace .github/ tree\n // ({prompts,skills,agents}). No runtime dispatch, no home-bin pointer, no\n // telemetry wrap. Each method is idempotent (byte-identical → skip) via\n // BaseAdapter.writeContentFile and reversible via removeContentFile. Honors\n // platforms[\"vscode-copilot\"] per-surface false to skip.\n //\n // SHARED .github TREE: vscode-copilot, copilot-cli, and jetbrains-copilot all\n // write under the SAME project <projectDir>/.github tree. The rendered content\n // is identical and idempotent across those connectors, and uninstall here only\n // removes the files THIS connector declared — never another writer's files.\n //\n // SCOPE NOTE: .github is a workspace concept; the Copilot prompt/skill/agent\n // discovery is workspace-rooted and there is no documented per-user .github\n // authoring location. VS Code's reliable per-user authoring root is the user\n // profile prompts dir under the OS app-data path, which is not discoverable\n // without launching VS Code. So for user scope we anchor on\n // <homedir>/.config/github-copilot (the documented cross-OS Copilot user dir;\n // see contentRootDir) rather than fabricating a profile path. Project scope is\n // the primary, fully-supported path.\n\n /**\n * Root of the content tree. Project (workspace) scope → <projectDir>/.github,\n * which VS Code Copilot scans for prompt/skill/agent files (and which\n * copilot-cli + jetbrains-copilot share). User scope has no documented\n * workspace-independent .github equivalent, so we anchor on the documented\n * cross-OS Copilot user dir ~/.config/github-copilot to keep user-scope writes\n * deterministic and removable.\n */\n private contentRootDir(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? join(ctx.projectDir, \".github\")\n : join(homedir(), \".config\", \"github-copilot\");\n }\n\n private promptsDir(ctx: InstallContext): string {\n return join(this.contentRootDir(ctx), \"prompts\");\n }\n private skillsDir(ctx: InstallContext): string {\n return join(this.contentRootDir(ctx), \"skills\");\n }\n private agentsDir(ctx: InstallContext): string {\n return join(this.contentRootDir(ctx), \"agents\");\n }\n\n /** Native command file path: <ghDir>/prompts/<name>.prompt.md. */\n private commandPath(ctx: InstallContext, name: string): string {\n return join(this.promptsDir(ctx), `${name}.prompt.md`);\n }\n /** Native skill dir: <ghDir>/skills/<name>. */\n private skillDir(ctx: InstallContext, name: string): string {\n return join(this.skillsDir(ctx), name);\n }\n /** Native subagent file path: <ghDir>/agents/<name>.agent.md. */\n private subagentPath(ctx: InstallContext, name: string): string {\n return join(this.agentsDir(ctx), `${name}.agent.md`);\n }\n\n // ── Commands ──────────────────────────────────────────────────────────────\n\n override installCommands(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[HOST]?.commands === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"commands disabled for vscode-copilot\" }];\n }\n if (connector.commands.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no commands\" }];\n }\n return connector.commands.map((cmd) =>\n this.writeContentFile(\n this.commandPath(ctx, cmd.name),\n this.renderCommand(cmd),\n ctx.dryRun,\n ),\n );\n }\n\n override uninstallCommands(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.commands.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no commands\" }];\n }\n return connector.commands.map((cmd) =>\n this.removeContentFile(this.commandPath(ctx, cmd.name), ctx.dryRun),\n );\n }\n\n /** Render a VS Code Copilot prompt file: md+frontmatter(description, tools, model, argument-hint). */\n private renderCommand(cmd: CommandDef): string {\n const frontmatter: Record<string, unknown> = {};\n if (cmd.description !== undefined) frontmatter.description = cmd.description;\n // VS Code prompt files express tool access as a `tools` array, sourced from\n // the portable tools.allow policy.\n const allow = cmd.tools?.allow;\n if (allow && allow.length > 0) frontmatter.tools = [...allow];\n if (cmd.model !== undefined) frontmatter.model = cmd.model;\n if (cmd.argumentHint !== undefined) frontmatter[\"argument-hint\"] = cmd.argumentHint;\n if (cmd.extra) Object.assign(frontmatter, cmd.extra);\n return this.renderFrontmatterMd(frontmatter, cmd.prompt);\n }\n\n // ── Skills ────────────────────────────────────────────────────────────────\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 vscode-copilot\" }];\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 /**\n * Render a skill's SKILL.md — the uniform Agent Skills format: frontmatter\n * (name, description + optional model, allowed-tools, disable-model-invocation)\n * + body. Byte-identical to the other .github-sharing connectors so a shared\n * skill folder never thrashes.\n */\n private renderSkill(skill: SkillDef): string {\n const frontmatter: Record<string, unknown> = {\n name: skill.name,\n description: skill.description,\n };\n if (skill.model !== undefined) frontmatter.model = skill.model;\n const allow = skill.tools?.allow;\n if (allow && allow.length > 0) frontmatter[\"allowed-tools\"] = allow.join(\", \");\n if (skill.disableModelInvocation !== undefined) {\n frontmatter[\"disable-model-invocation\"] = skill.disableModelInvocation;\n }\n if (skill.extra) Object.assign(frontmatter, skill.extra);\n return this.renderFrontmatterMd(frontmatter, skill.body);\n }\n\n // ── Subagents ───────────────────────────────────────────────────────────────\n\n override installSubagents(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[HOST]?.subagents === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"subagents disabled for vscode-copilot\" }];\n }\n if (connector.subagents.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no subagents\" }];\n }\n return connector.subagents.map((agent) =>\n this.writeContentFile(\n this.subagentPath(ctx, agent.name),\n this.renderSubagent(agent),\n ctx.dryRun,\n ),\n );\n }\n\n override uninstallSubagents(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.subagents.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no subagents\" }];\n }\n return connector.subagents.map((agent) =>\n this.removeContentFile(this.subagentPath(ctx, agent.name), ctx.dryRun),\n );\n }\n\n /** Render a subagent agent file: md+frontmatter(name, description, tools, model) + prompt body. */\n private renderSubagent(agent: SubagentDef): string {\n const frontmatter: Record<string, unknown> = {\n name: agent.name,\n description: agent.description,\n };\n const allow = agent.tools?.allow;\n if (allow && allow.length > 0) frontmatter.tools = allow.join(\", \");\n if (agent.model !== undefined) frontmatter.model = agent.model;\n if (agent.extra) Object.assign(frontmatter, agent.extra);\n return this.renderFrontmatterMd(frontmatter, agent.prompt);\n }\n\n // ── Diagnostics ──────────────────────────────────────────────────────────\n\n override getHealthChecks(ctx: InstallContext): readonly HealthCheck[] {\n const mcpPath = this.getServerConfigPath(ctx);\n const hooksPath = this.getHookConfigPath(ctx);\n const connectorId = ctx.connector.id;\n const homeBin = ctx.homeBinPath;\n const hookEvents = ctx.connector.hookEvents;\n const checks: HealthCheck[] = [\n {\n name: `${this.name}: mcp.json present`,\n check: () =>\n existsSync(mcpPath)\n ? { status: \"OK\", detail: mcpPath }\n : { status: \"FAIL\", detail: `not found: ${mcpPath}` },\n },\n {\n name: `${this.name}: hook command registered`,\n check: () => {\n if (hookEvents.length === 0) {\n return { status: \"OK\", detail: \"no hooks declared\" };\n }\n const file = this.readJson<VSCodeHooksFile>(hooksPath);\n if (!file) return { status: \"FAIL\", detail: `not found: ${hooksPath}` };\n if (file.version !== VSCODE_HOOKS_VERSION) {\n return {\n status: \"FAIL\",\n detail: `${hooksPath} missing required \"version\": ${VSCODE_HOOKS_VERSION} — Copilot rejects it`,\n };\n }\n const registered = Object.values(file.hooks ?? {}).some((entries) =>\n (entries ?? []).some((e) =>\n isHomeBinHookCommand(e.command, homeBin, connectorId),\n ),\n );\n return registered\n ? { status: \"OK\", detail: \"hook command present\" }\n : { status: \"FAIL\", detail: `no hook for ${connectorId} in ${hooksPath}` };\n },\n },\n ];\n\n // Content-surface checks: only assert presence of the files this connector\n // declares (skip silently for surfaces it never asked for).\n for (const cmd of ctx.connector.commands) {\n const p = this.commandPath(ctx, cmd.name);\n checks.push({\n name: `${this.name}: command ${cmd.name} present`,\n check: () =>\n existsSync(p) ? { status: \"OK\", detail: p } : { status: \"FAIL\", detail: `not found: ${p}` },\n });\n }\n for (const skill of ctx.connector.skills) {\n const p = join(this.skillDir(ctx, skill.name), \"SKILL.md\");\n checks.push({\n name: `${this.name}: skill ${skill.name} present`,\n check: () =>\n existsSync(p) ? { status: \"OK\", detail: p } : { status: \"FAIL\", detail: `not found: ${p}` },\n });\n }\n for (const agent of ctx.connector.subagents) {\n const p = this.subagentPath(ctx, agent.name);\n checks.push({\n name: `${this.name}: subagent ${agent.name} present`,\n check: () =>\n existsSync(p) ? { status: \"OK\", detail: p } : { status: \"FAIL\", detail: `not found: ${p}` },\n });\n }\n return checks;\n }\n\n // ── Runtime: parse VS Code Copilot stdin JSON → normalized event ──────────\n\n parseEvent(event: HookEventName, raw: unknown): NormalizedEvent {\n const input = (raw ?? {}) as VSCodeWireInput;\n const connectorId = typeof input.connector === \"string\" ? input.connector : \"\";\n const sessionId = extractSessionId(input);\n const projectDir = this.getProjectDir(input);\n\n const base = {\n hostPlatform: HOST,\n connectorId,\n sessionId,\n raw,\n ...(projectDir !== undefined ? { projectDir } : {}),\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 toolOutput =\n toolResponseToString(input.tool_response) ??\n input.tool_output ??\n input.error_message;\n const ev: PostToolUseEvent = {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n ...(toolOutput !== undefined ? { toolOutput } : {}),\n ...(input.error_message ? { isError: true } : {}),\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 \"SessionStart\": {\n const ev: SessionStartEvent = {\n ...base,\n source: normalizeSessionSource(input.source ?? input.trigger),\n };\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 \"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 default: {\n // Exhaustive guard — every HookEventName is handled above. (VS Code only\n // delivers the four it declares; the rest are handled defensively so a\n // mis-dispatch stays inert rather than crashing.)\n const _never: never = event;\n throw new Error(`unsupported vscode-copilot hook event: ${String(_never)}`);\n }\n }\n }\n\n /** Resolve the project dir from the wire payload, preferring the explicit cwd. */\n private getProjectDir(input: VSCodeWireInput): string | undefined {\n return input.cwd ?? input.workspace_roots?.[0] ?? undefined;\n }\n\n // ── Runtime: normalized response → VS Code Copilot native hook reply ──────\n\n formatReply(event: HookEventName, response: HookResponse): HookReply {\n const hookEventName = event;\n const decision = response.decision ?? \"allow\";\n\n // deny → block the action with a reason (exit 0; JSON carries the decision).\n // VS Code Copilot is Claude-compatible: the decision lives inside\n // `hookSpecificOutput`, keyed by the PascalCase event name.\n if (decision === \"deny\") {\n return this.stdout({\n hookSpecificOutput: {\n hookEventName,\n permissionDecision: \"deny\",\n permissionDecisionReason: response.reason ?? \"Blocked by hook\",\n },\n });\n }\n\n // ask → prompt the user to confirm.\n if (decision === \"ask\") {\n return this.stdout({\n hookSpecificOutput: {\n hookEventName,\n permissionDecision: \"ask\",\n permissionDecisionReason:\n response.reason ?? \"Confirmation required by hook\",\n },\n });\n }\n\n // modify → rewrite PreToolUse input (only where VS Code supports it).\n if (decision === \"modify\") {\n if (event === \"PreToolUse\" && response.updatedInput) {\n return this.stdout({\n hookSpecificOutput: { hookEventName, updatedInput: response.updatedInput },\n });\n }\n // Output rewrite is unsupported on VS Code; fall through to allow.\n }\n\n // context → inject soft guidance (also the SessionStart context path).\n if (decision === \"context\" && response.additionalContext) {\n return this.stdout({\n hookSpecificOutput: { hookEventName, additionalContext: response.additionalContext },\n });\n }\n\n // allow / void / unsupported-degradation → pass through with exit 0.\n return { exitCode: 0 };\n }\n\n private stdout(payload: unknown): HookReply {\n return { exitCode: 0, stdout: JSON.stringify(payload) };\n }\n}\n\n/**\n * VS Code native interpolation token: `${env:VAR}` → `${env:VAR}` (passthrough).\n * VS Code also supports `${input:VAR}` (prompted/secret inputs declared in the\n * sibling `inputs` array); we keep portable `${env:VAR}` refs as the native env\n * token so secrets are never baked into the committed config.\n */\nfunction vscodeEnvToken(name: string): string {\n return `\\${env:${name}}`;\n}\n\n/**\n * Extract a stable session id from a VS Code Copilot wire payload. Priority\n * mirrors the Claude-compatible wire: transcript UUID > session_id > \"\" (the\n * framework uses \"\" when no id is available — no ppid fabrication here).\n */\nfunction extractSessionId(input: VSCodeWireInput): string {\n if (typeof input.transcript_path === \"string\") {\n const m = input.transcript_path.match(/([a-f0-9-]{36})\\.jsonl$/);\n if (m && m[1]) return m[1];\n }\n if (typeof input.session_id === \"string\" && input.session_id !== \"\") {\n return input.session_id;\n }\n return \"\";\n}\n\n/** Coerce a Claude-compatible 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 normalizeSessionSource(source: string | undefined): SessionStartEvent[\"source\"] {\n switch (source) {\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 VSCodeCopilotAdapter();\nexport default adapter;\n"],"mappings":";;;;;;;;;;;;;;;;;AAkCA,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,YAAY;AAmCrB,IAAM,OAAmB;AAOzB,IAAM,eAAe;AAGrB,IAAM,uBAAuB;AAQ7B,IAAM,YAAoD;AAAA,EACxD,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,cAAc;AAChB;AA4DO,IAAM,uBAAN,cAAmC,YAA+B;AAAA,EAC9D,KAAiB;AAAA,EACjB,OAAO;AAAA,EACP,WAAyB;AAAA,EAEzB,eAAqC;AAAA;AAAA;AAAA,IAG5C,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,YAAY;AAAA,IACZ,kBAAkB;AAAA,IAClB,MAAM;AAAA,IACN,cAAc;AAAA;AAAA;AAAA,IAGd,eAAe;AAAA,IACf,iBAAiB;AAAA,IACjB,yBAAyB;AAAA,IACzB,YAAY,CAAC,SAAS,MAAM;AAAA;AAAA;AAAA;AAAA,IAI5B,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,IAChB,mBAAmB;AAAA,EACrB;AAAA;AAAA,EAIA,gBAAgB,YAAsC;AACpD,UAAM,UAAU,KAAK,QAAQ,GAAG,SAAS;AACzC,UAAM,UAAU,KAAK,SAAS,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0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/adapters/warp/index.ts"],"sourcesContent":["/**\n * adapters/warp — Warp (Warp.dev) platform adapter for agent-connector.\n *\n * Warp is an **mcp-only** host: it has NO lifecycle hook system (open FR #7834),\n * and MCP *is* its extensibility mechanism (\"MCP servers act as plugins\"). This\n * adapter therefore installs only the MCP server and reports hooks as\n * unavailable — it is the reference path that validates the `mcp-only` paradigm\n * end-to-end through the framework.\n *\n * MCP config (report §2 / §5.3):\n * - user scope → ~/.warp/.mcp.json\n * - project scope → <projectDir>/.warp/.mcp.json\n * Both are JSON, root key \"mcpServers\", and are the SAME file used for the\n * (non-existent) hook registration — there is no separate hook file here.\n *\n * QUIRK: a stdio server entry uses `working_directory` (NOT `cwd`) for its\n * working directory. Everything else mirrors the Claude/Cursor stdio shape.\n *\n * Warp documents no native `${env:VAR}` interpolation token, so env/header/url\n * refs are resolved to literals at install time (the no-native-token path).\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 Transport,\n} from \"../../core/types.js\";\nimport { resolveEnvRefsDeep } from \"../../core/interpolate.js\";\nimport {\n buildServeWrapperCommand,\n isHomeBinHookCommand,\n shouldWrapForTelemetry,\n} from \"../../core/spawn.js\";\n\nconst HOST: PlatformId = \"warp\";\nconst MCP_ROOT_KEY = \"mcpServers\";\n\n/**\n * Native MCP server entry shapes Warp accepts under `mcpServers`.\n * Note the working-directory key: Warp uses `working_directory`, not `cwd`.\n */\ninterface WarpStdioServer {\n command: string;\n args?: string[];\n env?: Record<string, string>;\n working_directory?: string;\n}\ninterface WarpHttpServer {\n url: string;\n headers?: Record<string, string>;\n}\n\nexport class WarpAdapter extends BaseAdapter implements Adapter {\n readonly id: PlatformId = HOST;\n readonly name = \"Warp\";\n readonly paradigm: HookParadigm = \"mcp-only\";\n\n readonly capabilities: PlatformCapabilities = {\n // Warp 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 // Warp registers stdio, SSE, and Streamable HTTP MCP servers.\n transports: [\"stdio\", \"sse\", \"http\"],\n };\n\n // ── Detection ────────────────────────────────────────────────────────────\n\n detectInstalled(projectDir: string): DetectedPlatform {\n const userDir = join(homedir(), \".warp\");\n const userMcp = join(userDir, \".mcp.json\");\n const projectMcp = join(projectDir, \".warp\", \".mcp.json\");\n const installed = existsSync(userDir) || existsSync(userMcp) || existsSync(projectMcp);\n return {\n id: this.id,\n name: this.name,\n installed,\n paradigm: this.paradigm,\n capabilities: this.capabilities,\n configPath: userMcp,\n scope: \"user\",\n reason: installed\n ? `found Warp config under ${userDir}`\n : `no Warp config at ${userDir}`,\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, \".warp\")\n : join(homedir(), \".warp\");\n }\n\n getServerConfigPath(ctx: InstallContext): string {\n return join(this.getConfigDir(ctx), \".mcp.json\");\n }\n\n /**\n * Warp has no hook file — hooks are not a thing here. The hook \"config path\"\n * is the same .mcp.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 warp\"\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 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 Warp's native mcpServers entry. */\n private renderServerEntry(\n ctx: InstallContext,\n server: ServerDef,\n ): WarpStdioServer | WarpHttpServer {\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 // Warp has no documented native interpolation token, so resolve every\n // ${env:VAR} to a literal at install time.\n const entry: WarpStdioServer = { command: resolveEnvRefsDeep(command) };\n if (args.length > 0) entry.args = resolveEnvRefsDeep(args);\n const env = this.renderEnv(server.env);\n if (env) entry.env = env;\n // QUIRK: Warp keys the working directory as `working_directory`, not `cwd`.\n if (server.cwd) entry.working_directory = resolveEnvRefsDeep(server.cwd);\n return entry;\n }\n\n // sse / http (and any other remote transport) — Warp registers a URL.\n const entry: WarpHttpServer = { url: resolveEnvRefsDeep(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. Warp documents no native interpolation token, so\n * resolve `${env:VAR}` references to literals at install time.\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 return resolveEnvRefsDeep({ ...env });\n }\n\n // ── Hooks (unavailable — Warp is mcp-only) ───────────────────────────────\n\n installHooks(_ctx: InstallContext): ChangeRecord[] {\n return [\n {\n platform: this.id,\n action: \"skip\",\n detail: \"hooks unavailable (Warp 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 (Warp 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 * Warp installs no hooks, but this guard keeps any future shared-file edit\n * from 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 mcpPath = this.getServerConfigPath(ctx);\n const connectorId = ctx.connector.id;\n return [\n {\n name: `${this.name}: .mcp.json present`,\n check: () =>\n existsSync(mcpPath)\n ? { status: \"OK\", detail: mcpPath }\n : { status: \"FAIL\", detail: `not found: ${mcpPath}` },\n },\n {\n name: `${this.name}: server entry registered`,\n check: () => {\n const cfg = this.readJson<{ [k: string]: Record<string, unknown> }>(mcpPath);\n const bucket = cfg?.[MCP_ROOT_KEY];\n if (!cfg || !bucket) {\n return { status: \"FAIL\", detail: `no ${MCP_ROOT_KEY} in ${mcpPath}` };\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 ${mcpPath}`,\n };\n },\n },\n ];\n }\n}\n\nexport const adapter = new WarpAdapter();\nexport default adapter;\n"],"mappings":";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AAQ,QAAQ,IAChC,EAAE,QAAQ,QAAQ,QAAQ,cAAc,OAAO,GAAG;AAAA,MAC1D;AAAA,MACA;AAAA,QACE,MAAM,GAAG,KAAK,IAAI;AAAA,QAClB,OAAO,MAAM;AACX,gBAAM,MAAM,KAAK,SAAmD,OAAO;AAC3E,gBAAM,SAAS,MAAM,YAAY;AACjC,cAAI,CAAC,OAAO,CAAC,QAAQ;AACnB,mBAAO,EAAE,QAAQ,QAAQ,QAAQ,MAAM,YAAY,OAAO,OAAO,GAAG;AAAA,UACtE;AACA,iBAAO,eAAe,SAClB,EAAE,QAAQ,MAAM,QAAQ,GAAG,YAAY,IAAI,WAAW,WAAW,IACjE;AAAA,YACE,QAAQ;AAAA,YACR,QAAQ,MAAM,YAAY,IAAI,WAAW,OAAO,OAAO;AAAA,UACzD;AAAA,QACN;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,UAAU,IAAI,YAAY;AACvC,IAAO,eAAQ;","names":["entry"]}
|
package/dist/zed-VRJKWYUR.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/adapters/zed/index.ts"],"sourcesContent":["/**\n * adapters/zed — Zed editor platform adapter for agent-connector.\n *\n * Zed is an **mcp-only** host: it is an IDE, not a CLI with a hook pipeline, so\n * there is NO lifecycle hook system. MCP (\"context servers\") is the only\n * integration path, so this adapter installs only the MCP server and reports\n * hooks as unavailable — like Warp, it exercises the `mcp-only` paradigm.\n *\n * MCP config (one JSON-with-comments settings file, NOT a dedicated MCP file):\n * - user scope → settings.json under Zed's OS-native config dir (Rust\n * `dirs::config_dir()`):\n * • Windows: %APPDATA%\\Zed\\settings.json (Roaming, NOT %LOCALAPPDATA%)\n * • macOS / Linux: ~/.config/zed/settings.json\n * - project scope → <projectDir>/.zed/settings.json\n * Root key is \"context_servers\" (NOT \"mcpServers\"). The same file holds the\n * (non-existent) hook config — there is no separate hook file here.\n *\n * MERGE CONTRACT: Zed's settings.json is a large user-owned IDE config. We read\n * the whole file, set ONLY context_servers[<id>], and write it back — every\n * other top-level key and sibling context server is preserved. (Zed accepts\n * JSONC; we WRITE plain JSON, mirroring the other JSON-config adapters.)\n *\n * ENTRY SHAPE QUIRK (verified against context-mode's proven Zed adapter +\n * zed-industries/zed crates/settings_content/src/project.rs): Zed's\n * context_servers Stdio variant flattens ContextServerCommand and renames its\n * `path` field to the JSON key `command`. The accepted shape is therefore a\n * FLAT entry: { \"command\": \"<exe>\", \"args\": [...], \"env\": {...} }. The nested\n * { command: { path, args } } form fails to deserialize under Zed's\n * #[serde(untagged)] enum and is silently dropped (the server never loads).\n *\n * Zed documents no native ${env:VAR} interpolation token for context_servers,\n * so env refs are resolved to literals at install time (the no-native-token\n * path, same as Warp).\n */\n\nimport { existsSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join, resolve } 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 Transport,\n} from \"../../core/types.js\";\nimport { resolveEnvRefsDeep } from \"../../core/interpolate.js\";\nimport {\n buildServeWrapperCommand,\n shouldWrapForTelemetry,\n} from \"../../core/spawn.js\";\n\nconst HOST: PlatformId = \"zed\";\nconst MCP_ROOT_KEY = \"context_servers\";\n\n/**\n * Zed's context_servers Stdio entry. FLAT shape — `command` is a string, NOT a\n * nested { path, args } object (see file header). Remote transports are\n * represented as a URL-bearing entry.\n */\ninterface ZedStdioServer {\n command: string;\n args?: string[];\n env?: Record<string, string>;\n}\ninterface ZedHttpServer {\n url: string;\n headers?: Record<string, string>;\n}\n\nexport class ZedAdapter extends BaseAdapter implements Adapter {\n readonly id: PlatformId = HOST;\n readonly name = \"Zed\";\n readonly paradigm: HookParadigm = \"mcp-only\";\n\n readonly capabilities: PlatformCapabilities = {\n // Zed 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 // Zed registers stdio context servers; remote URLs are also accepted.\n transports: [\"stdio\", \"sse\", \"http\"],\n };\n\n // ── Detection ────────────────────────────────────────────────────────────\n\n detectInstalled(projectDir: string): DetectedPlatform {\n const userDir = this.userConfigDir();\n const userSettings = this.userSettingsPath();\n const projDir = join(projectDir, \".zed\");\n const projSettings = join(projDir, \"settings.json\");\n\n const userInstalled = existsSync(userDir) || existsSync(userSettings);\n const projInstalled = existsSync(projDir) || existsSync(projSettings);\n const installed = userInstalled || projInstalled;\n const scope = projInstalled && !userInstalled ? \"project\" : \"user\";\n const configPath = scope === \"project\" ? projSettings : 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 Zed config (${scope}) at ${configPath}`\n : `no Zed config at ${userSettings} or ${projSettings}`,\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, \".zed\")\n : this.userConfigDir();\n }\n\n getServerConfigPath(ctx: InstallContext): string {\n return join(this.getConfigDir(ctx), \"settings.json\");\n }\n\n /**\n * Zed has no hook file — hooks are not a thing here. The hook \"config path\"\n * is 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 /**\n * Zed's user config dir is OS-native (Rust `dirs::config_dir()`), NOT a\n * uniform ~/.config:\n * - Windows: %APPDATA%\\Zed (Roaming, NOT Local/%LOCALAPPDATA%)\n * - macOS / Linux: ~/.config/zed\n */\n private userConfigDir(): string {\n if (process.platform === \"win32\") {\n const appData =\n process.env.APPDATA && process.env.APPDATA.trim() !== \"\"\n ? process.env.APPDATA\n : resolve(homedir(), \"AppData\", \"Roaming\");\n return join(appData, \"Zed\");\n }\n return join(homedir(), \".config\", \"zed\");\n }\n\n private userSettingsPath(): string {\n return join(this.userConfigDir(), \"settings.json\");\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 zed\"\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 // upsertServerInJson reads the WHOLE settings file, sets only\n // context_servers[<id>], and writes it back — preserving every other\n // top-level key and sibling context server (the merge contract).\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 Zed's native context_servers entry. */\n private renderServerEntry(\n ctx: InstallContext,\n server: ServerDef,\n ): ZedStdioServer | ZedHttpServer {\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 // Zed has no documented native interpolation token, so resolve every\n // ${env:VAR} to a literal at install time.\n // FLAT shape: `command` is a string, never a nested { path, args }.\n const entry: ZedStdioServer = { command: resolveEnvRefsDeep(command) };\n if (args.length > 0) entry.args = resolveEnvRefsDeep(args);\n const env = this.renderEnv(server.env);\n if (env) entry.env = env;\n return entry;\n }\n\n // sse / http (and any other remote transport) — Zed registers a URL.\n const entry: ZedHttpServer = { url: resolveEnvRefsDeep(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. Zed documents no native interpolation token, so\n * resolve `${env:VAR}` references to literals at install time.\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 return resolveEnvRefsDeep({ ...env });\n }\n\n // ── Hooks (unavailable — Zed is mcp-only) ────────────────────────────────\n\n installHooks(_ctx: InstallContext): ChangeRecord[] {\n return [\n {\n platform: this.id,\n action: \"skip\",\n detail: \"hooks unavailable (Zed 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 (Zed is mcp-only)\",\n },\n ];\n }\n\n // ── Diagnostics ──────────────────────────────────────────────────────────\n\n override getHealthChecks(ctx: InstallContext): readonly HealthCheck[] {\n const settingsPath = this.getServerConfigPath(ctx);\n const connectorId = ctx.connector.id;\n return [\n {\n name: `${this.name}: settings.json present`,\n check: () =>\n existsSync(settingsPath)\n ? { status: \"OK\", detail: settingsPath }\n : { status: \"FAIL\", detail: `not found: ${settingsPath}` },\n },\n {\n name: `${this.name}: context server entry registered`,\n check: () => {\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\nexport const adapter = new ZedAdapter();\nexport default adapter;\n"],"mappings":";;;;;;;;;;;;;;;AAmCA,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,MAAM,eAAe;AAoB9B,IAAM,OAAmB;AACzB,IAAM,eAAe;AAiBd,IAAM,aAAN,cAAyB,YAA+B;AAAA,EACpD,KAAiB;AAAA,EACjB,OAAO;AAAA,EACP,WAAyB;AAAA,EAEzB,eAAqC;AAAA;AAAA,IAE5C,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,YAAY;AAAA,IACZ,kBAAkB;AAAA,IAClB,MAAM;AAAA,IACN,cAAc;AAAA,IACd,eAAe;AAAA,IACf,iBAAiB;AAAA,IACjB,yBAAyB;AAAA;AAAA,IAEzB,YAAY,CAAC,SAAS,OAAO,MAAM;AAAA,EACrC;AAAA;AAAA,EAIA,gBAAgB,YAAsC;AACpD,UAAM,UAAU,KAAK,cAAc;AACnC,UAAM,eAAe,KAAK,iBAAiB;AAC3C,UAAM,UAAU,KAAK,YAAY,MAAM;AACvC,UAAM,eAAe,KAAK,SAAS,eAAe;AAElD,UAAM,gBAAgB,WAAW,OAAO,KAAK,WAAW,YAAY;AACpE,UAAM,gBAAgB,WAAW,OAAO,KAAK,WAAW,YAAY;AACpE,UAAM,YAAY,iBAAiB;AACnC,UAAM,QAAQ,iBAAiB,CAAC,gBAAgB,YAAY;AAC5D,UAAM,aAAa,UAAU,YAAY,eAAe;AAExD,WAAO;AAAA,MACL,IAAI,KAAK;AAAA,MACT,MAAM,KAAK;AAAA,MACX;AAAA,MACA,UAAU,KAAK;AAAA,MACf,cAAc,KAAK;AAAA,MACnB;AAAA,MACA;AAAA,MACA,QAAQ,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