@ken-jo/agent-connector 0.4.0 → 0.4.6
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 +9 -9
- package/dist/{action-PLZW5BGX.js → action-EV63GAPY.js} +11 -10
- package/dist/{action-PLZW5BGX.js.map → action-EV63GAPY.js.map} +1 -1
- package/dist/amazon-q-COAL3764.js +276 -0
- package/dist/amazon-q-COAL3764.js.map +1 -0
- package/dist/amp-XJQ4TDAU.js +666 -0
- package/dist/amp-XJQ4TDAU.js.map +1 -0
- package/dist/{antigravity-ANDKF3K7.js → antigravity-AMKKKHS4.js} +4 -4
- package/dist/{antigravity-cli-LLRPDDOT.js → antigravity-cli-XERXEH5W.js} +4 -4
- package/dist/{chunk-MAH6QQTO.js → chunk-2X4EH2D7.js} +5 -4
- package/dist/chunk-2X4EH2D7.js.map +1 -0
- package/dist/{chunk-G3ER4SY5.js → chunk-5G4EPJ4Y.js} +9 -9
- package/dist/chunk-BMD7ANKF.js +237 -0
- package/dist/chunk-BMD7ANKF.js.map +1 -0
- package/dist/{chunk-IW77FFNX.js → chunk-CPLK7GTE.js} +41 -5
- package/dist/chunk-CPLK7GTE.js.map +1 -0
- package/dist/{chunk-ADTHT2FN.js → chunk-DCK5FADX.js} +10 -173
- package/dist/chunk-DCK5FADX.js.map +1 -0
- package/dist/{chunk-J3D5W5T2.js → chunk-EROJDXMW.js} +2 -2
- package/dist/{chunk-22Y24V7O.js → chunk-F5RX62T7.js} +2 -2
- package/dist/chunk-FAHIMJRU.js +177 -0
- package/dist/chunk-FAHIMJRU.js.map +1 -0
- package/dist/{chunk-BHUCB6LY.js → chunk-H67V7DEL.js} +8 -7
- package/dist/{chunk-BHUCB6LY.js.map → chunk-H67V7DEL.js.map} +1 -1
- package/dist/{chunk-BXGFUENQ.js → chunk-I5MLE6S7.js} +14 -1
- package/dist/{chunk-BXGFUENQ.js.map → chunk-I5MLE6S7.js.map} +1 -1
- package/dist/{chunk-LL4OBGRU.js → chunk-LQRAPXS4.js} +3 -3
- package/dist/{chunk-KGJWE6A2.js → chunk-MZF2YCXX.js} +2 -2
- package/dist/{chunk-KGXDYGNJ.js → chunk-QC5A3TFQ.js} +19 -19
- package/dist/{chunk-KGXDYGNJ.js.map → chunk-QC5A3TFQ.js.map} +1 -1
- package/dist/{chunk-CIRDOY2V.js → chunk-QOGMDOUX.js} +3 -3
- package/dist/{chunk-KGGBNKI4.js → chunk-RQPKL62M.js} +144 -21
- package/dist/chunk-RQPKL62M.js.map +1 -0
- package/dist/{chunk-6XHB6BE3.js → chunk-SCVBYSF7.js} +1 -1
- package/dist/{chunk-76FUSVIA.js → chunk-SRVAA2VN.js} +6 -5
- package/dist/chunk-SRVAA2VN.js.map +1 -0
- package/dist/chunk-WZA4CSGJ.js +28 -0
- package/dist/chunk-WZA4CSGJ.js.map +1 -0
- package/dist/{claude-code-MLWS7CW6.js → claude-code-T2LPFNC3.js} +20 -30
- package/dist/claude-code-T2LPFNC3.js.map +1 -0
- package/dist/cli/sdk.js +5 -4
- package/dist/cli/sdk.js.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cline-WRYMNS7Z.js +442 -0
- package/dist/cline-WRYMNS7Z.js.map +1 -0
- package/dist/{codebuff-SH2S3QAN.js → codebuff-PODYPOOP.js} +130 -5
- package/dist/codebuff-PODYPOOP.js.map +1 -0
- package/dist/{codex-BXA4FIF4.js → codex-O4G7D7KK.js} +61 -13
- package/dist/codex-O4G7D7KK.js.map +1 -0
- package/dist/continue-K43SUHLQ.js +790 -0
- package/dist/continue-K43SUHLQ.js.map +1 -0
- package/dist/{copilot-cli-ROIBTTDT.js → copilot-cli-Q3SSPT4V.js} +70 -12
- package/dist/copilot-cli-Q3SSPT4V.js.map +1 -0
- package/dist/{crush-QLEFLHUC.js → crush-MBEH2R3I.js} +130 -6
- package/dist/crush-MBEH2R3I.js.map +1 -0
- package/dist/{cursor-ASJPWZ4R.js → cursor-TMBXDYR4.js} +119 -19
- package/dist/cursor-TMBXDYR4.js.map +1 -0
- package/dist/{detect-ZIIS55LD.js → detect-AHJIUMBO.js} +5 -4
- package/dist/{detect-ZIIS55LD.js.map → detect-AHJIUMBO.js.map} +1 -1
- package/dist/{doctor-TJUGSQ5C.js → doctor-G5MLCPAB.js} +221 -95
- package/dist/doctor-G5MLCPAB.js.map +1 -0
- package/dist/{droid-NCSS3B5Y.js → droid-JC2NT6S4.js} +135 -13
- package/dist/droid-JC2NT6S4.js.map +1 -0
- package/dist/{gemini-cli-SLVWLXJW.js → gemini-cli-ILR7M5X3.js} +62 -10
- package/dist/gemini-cli-ILR7M5X3.js.map +1 -0
- package/dist/{goose-PBA7KTE5.js → goose-SFO5BBGW.js} +15 -8
- package/dist/goose-SFO5BBGW.js.map +1 -0
- package/dist/{hermes-ONDCECP2.js → hermes-3N7WN4WS.js} +329 -15
- package/dist/hermes-3N7WN4WS.js.map +1 -0
- package/dist/{hook-OU522ABV.js → hook-76JBKTUX.js} +14 -11
- package/dist/hook-76JBKTUX.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -2
- package/dist/{install-UDCBL7HP.js → install-R7252QFH.js} +11 -10
- package/dist/{install-UDCBL7HP.js.map → install-R7252QFH.js.map} +1 -1
- package/dist/{introspect-DuZSPSHB.d.ts → introspect-Cn3MSA4_.d.ts} +1 -1
- package/dist/{jetbrains-copilot-YABZ3HFA.js → jetbrains-copilot-NRZHI5PC.js} +85 -18
- package/dist/jetbrains-copilot-NRZHI5PC.js.map +1 -0
- package/dist/{kilo-F3ZDZKCT.js → kilo-IX4T3OHJ.js} +115 -19
- package/dist/kilo-IX4T3OHJ.js.map +1 -0
- package/dist/{kilo-cli-3HWPWBY4.js → kilo-cli-2AYCXBQD.js} +109 -13
- package/dist/kilo-cli-2AYCXBQD.js.map +1 -0
- package/dist/{kimi-NV72FVAO.js → kimi-2YFK2GBA.js} +87 -25
- package/dist/kimi-2YFK2GBA.js.map +1 -0
- package/dist/{kiro-C5W6AGDR.js → kiro-YL6AWUYG.js} +3 -3
- package/dist/{leaderboard-TIBVONVT.js → leaderboard-V6VWA5ZV.js} +3 -3
- package/dist/{mimo-code-IMM5YM3M.js → mimo-code-FTMGSKMQ.js} +41 -5
- package/dist/mimo-code-FTMGSKMQ.js.map +1 -0
- package/dist/{mux-DSSH4AFS.js → mux-5XZFB44C.js} +156 -6
- package/dist/mux-5XZFB44C.js.map +1 -0
- package/dist/{nemoclaw-3EVNKD3I.js → nemoclaw-CQYXZVQN.js} +4 -4
- package/dist/{omp-Z6FRNDPN.js → omp-2QMEY6HD.js} +138 -18
- package/dist/omp-2QMEY6HD.js.map +1 -0
- package/dist/{openclaw-7G437NT7.js → openclaw-UZC437RW.js} +4 -4
- package/dist/{opencode-Q6KBSAKW.js → opencode-L4BGFP25.js} +87 -27
- package/dist/opencode-L4BGFP25.js.map +1 -0
- package/dist/{package-RMPN57YZ.js → package-DNLQTPNN.js} +8 -7
- package/dist/{package-RMPN57YZ.js.map → package-DNLQTPNN.js.map} +1 -1
- package/dist/{pi-LZT6WWAZ.js → pi-PVVPVWKG.js} +3 -2
- package/dist/{pi-LZT6WWAZ.js.map → pi-PVVPVWKG.js.map} +1 -1
- package/dist/{qwen-code-WQBKRPWJ.js → qwen-code-G4CXKUHR.js} +426 -10
- package/dist/qwen-code-G4CXKUHR.js.map +1 -0
- package/dist/{roo-code-GWSNU3OW.js → roo-code-67TYJIQR.js} +3 -3
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +9 -8
- package/dist/sdk/index.d.ts +3 -3
- package/dist/sdk/index.js +4 -3
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/test.d.ts +2 -2
- package/dist/sdk/test.js +6 -5
- package/dist/sdk/test.js.map +1 -1
- package/dist/{serve-D3GO36UT.js → serve-EOVWYBGZ.js} +11 -10
- package/dist/{serve-D3GO36UT.js.map → serve-EOVWYBGZ.js.map} +1 -1
- package/dist/{status-KOSKCETC.js → status-VTD6XXLW.js} +7 -6
- package/dist/{status-KOSKCETC.js.map → status-VTD6XXLW.js.map} +1 -1
- package/dist/{statusline-ZNTCL5YC.js → statusline-3ET5YPQ5.js} +10 -9
- package/dist/{statusline-ZNTCL5YC.js.map → statusline-3ET5YPQ5.js.map} +1 -1
- package/dist/{telemetry-XIKUUGTQ.js → telemetry-QCTMKDBQ.js} +6 -5
- package/dist/{telemetry-XIKUUGTQ.js.map → telemetry-QCTMKDBQ.js.map} +1 -1
- package/dist/{trae-NWT3TMSZ.js → trae-7CZZGOGI.js} +3 -3
- package/dist/{types-BEKsAium.d.ts → types-_6arHbX9.d.ts} +67 -24
- package/dist/{uninstall-2LBLQVFA.js → uninstall-FL3SH2DT.js} +11 -10
- package/dist/{uninstall-2LBLQVFA.js.map → uninstall-FL3SH2DT.js.map} +1 -1
- package/dist/{upgrade-ZC2S7VRN.js → upgrade-SLFG2FCT.js} +11 -10
- package/dist/{upgrade-ZC2S7VRN.js.map → upgrade-SLFG2FCT.js.map} +1 -1
- package/dist/{usage-E2A4O2CY.js → usage-IRBLVUZM.js} +3 -3
- package/dist/{usage-event-JKMC4QC4.js → usage-event-VFF77WYY.js} +10 -9
- package/dist/{usage-event-JKMC4QC4.js.map → usage-event-VFF77WYY.js.map} +1 -1
- package/dist/{vscode-copilot-ALV45XF6.js → vscode-copilot-MF2CDNMT.js} +23 -10
- package/dist/vscode-copilot-MF2CDNMT.js.map +1 -0
- package/dist/{warp-H6IX4U3J.js → warp-VKG55TAT.js} +55 -4
- package/dist/warp-VKG55TAT.js.map +1 -0
- package/dist/windsurf-FU5G4SHF.js +443 -0
- package/dist/windsurf-FU5G4SHF.js.map +1 -0
- package/dist/{zed-RH34TNSW.js → zed-SFUHL3GS.js} +3 -3
- package/package.json +2 -2
- package/dist/amp-B524U6LO.js +0 -300
- package/dist/amp-B524U6LO.js.map +0 -1
- package/dist/chunk-3PFFTFCU.js +0 -190
- package/dist/chunk-3PFFTFCU.js.map +0 -1
- package/dist/chunk-76FUSVIA.js.map +0 -1
- package/dist/chunk-ADTHT2FN.js.map +0 -1
- package/dist/chunk-IW77FFNX.js.map +0 -1
- package/dist/chunk-KGGBNKI4.js.map +0 -1
- package/dist/chunk-MAH6QQTO.js.map +0 -1
- package/dist/claude-code-MLWS7CW6.js.map +0 -1
- package/dist/codebuff-SH2S3QAN.js.map +0 -1
- package/dist/codex-BXA4FIF4.js.map +0 -1
- package/dist/copilot-cli-ROIBTTDT.js.map +0 -1
- package/dist/crush-QLEFLHUC.js.map +0 -1
- package/dist/cursor-ASJPWZ4R.js.map +0 -1
- package/dist/doctor-TJUGSQ5C.js.map +0 -1
- package/dist/droid-NCSS3B5Y.js.map +0 -1
- package/dist/gemini-cli-SLVWLXJW.js.map +0 -1
- package/dist/goose-PBA7KTE5.js.map +0 -1
- package/dist/hermes-ONDCECP2.js.map +0 -1
- package/dist/hook-OU522ABV.js.map +0 -1
- package/dist/jetbrains-copilot-YABZ3HFA.js.map +0 -1
- package/dist/kilo-F3ZDZKCT.js.map +0 -1
- package/dist/kilo-cli-3HWPWBY4.js.map +0 -1
- package/dist/kimi-NV72FVAO.js.map +0 -1
- package/dist/mimo-code-IMM5YM3M.js.map +0 -1
- package/dist/mux-DSSH4AFS.js.map +0 -1
- package/dist/omp-Z6FRNDPN.js.map +0 -1
- package/dist/opencode-Q6KBSAKW.js.map +0 -1
- package/dist/qwen-code-WQBKRPWJ.js.map +0 -1
- package/dist/vscode-copilot-ALV45XF6.js.map +0 -1
- package/dist/warp-H6IX4U3J.js.map +0 -1
- /package/dist/{antigravity-ANDKF3K7.js.map → antigravity-AMKKKHS4.js.map} +0 -0
- /package/dist/{antigravity-cli-LLRPDDOT.js.map → antigravity-cli-XERXEH5W.js.map} +0 -0
- /package/dist/{chunk-G3ER4SY5.js.map → chunk-5G4EPJ4Y.js.map} +0 -0
- /package/dist/{chunk-J3D5W5T2.js.map → chunk-EROJDXMW.js.map} +0 -0
- /package/dist/{chunk-22Y24V7O.js.map → chunk-F5RX62T7.js.map} +0 -0
- /package/dist/{chunk-LL4OBGRU.js.map → chunk-LQRAPXS4.js.map} +0 -0
- /package/dist/{chunk-KGJWE6A2.js.map → chunk-MZF2YCXX.js.map} +0 -0
- /package/dist/{chunk-CIRDOY2V.js.map → chunk-QOGMDOUX.js.map} +0 -0
- /package/dist/{chunk-6XHB6BE3.js.map → chunk-SCVBYSF7.js.map} +0 -0
- /package/dist/{kiro-C5W6AGDR.js.map → kiro-YL6AWUYG.js.map} +0 -0
- /package/dist/{leaderboard-TIBVONVT.js.map → leaderboard-V6VWA5ZV.js.map} +0 -0
- /package/dist/{nemoclaw-3EVNKD3I.js.map → nemoclaw-CQYXZVQN.js.map} +0 -0
- /package/dist/{openclaw-7G437NT7.js.map → openclaw-UZC437RW.js.map} +0 -0
- /package/dist/{roo-code-GWSNU3OW.js.map → roo-code-67TYJIQR.js.map} +0 -0
- /package/dist/{trae-NWT3TMSZ.js.map → trae-7CZZGOGI.js.map} +0 -0
- /package/dist/{usage-E2A4O2CY.js.map → usage-IRBLVUZM.js.map} +0 -0
- /package/dist/{zed-RH34TNSW.js.map → zed-SFUHL3GS.js.map} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as ActionDef, C as CommandDef, c as ConfigPatchDef, d as ConnectorConfig, R as ResolvedConnector, e as HookEventName, H as HookDefinition, M as MemoryDef, N as NativeHookDef, w as SkillDef, y as StatuslineDef, B as SubagentDef } from './types-
|
|
2
|
-
export { a as ActionResult, b as AuthSpec, V as ChangeRecord, W as DetectedPlatform, X as DiagnosticResult, E as EventPayloadMap, f as HookParadigm, g as HookResponse, h as HooksConfig, i as HostCtx, Y as InstallResult, I as InstallScope, j as NativeHookEvent, k as NotificationEvent, l as PermissionRequestEvent, m as PlatformCapabilities, P as PlatformId, n as PlatformMemoryOverride, o as PlatformOverride, p as PostToolUseEvent, q as PostToolUseFailureEvent, r as PreCompactEvent, s as PreToolUseEvent, S as ServerDef, u as SessionEndEvent, v as SessionStartEvent, x as StatuslineContext, z as StopEvent, D as SubagentStartEvent, F as SubagentStopEvent, T as TelemetryAccessor, K as TelemetryConfig, L as TelemetryUsageSummary, O as ToolFilter, Q as Transport, U as UserPromptSubmitEvent } from './types-
|
|
1
|
+
import { A as ActionDef, C as CommandDef, c as ConfigPatchDef, d as ConnectorConfig, R as ResolvedConnector, e as HookEventName, H as HookDefinition, M as MemoryDef, N as NativeHookDef, w as SkillDef, y as StatuslineDef, B as SubagentDef } from './types-_6arHbX9.js';
|
|
2
|
+
export { a as ActionResult, b as AuthSpec, V as ChangeRecord, W as DetectedPlatform, X as DiagnosticResult, E as EventPayloadMap, f as HookParadigm, g as HookResponse, h as HooksConfig, i as HostCtx, Y as InstallResult, I as InstallScope, j as NativeHookEvent, k as NotificationEvent, l as PermissionRequestEvent, m as PlatformCapabilities, P as PlatformId, n as PlatformMemoryOverride, o as PlatformOverride, p as PostToolUseEvent, q as PostToolUseFailureEvent, r as PreCompactEvent, s as PreToolUseEvent, S as ServerDef, u as SessionEndEvent, v as SessionStartEvent, x as StatuslineContext, z as StopEvent, D as SubagentStartEvent, F as SubagentStopEvent, T as TelemetryAccessor, K as TelemetryConfig, L as TelemetryUsageSummary, O as ToolFilter, Q as Transport, U as UserPromptSubmitEvent } from './types-_6arHbX9.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* core/define-connector — the public write-once entry point.
|
package/dist/index.js
CHANGED
|
@@ -11,8 +11,9 @@ import {
|
|
|
11
11
|
defineSkill,
|
|
12
12
|
defineStatusline,
|
|
13
13
|
defineSubagent
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-DCK5FADX.js";
|
|
15
|
+
import "./chunk-BMD7ANKF.js";
|
|
16
|
+
import "./chunk-FAHIMJRU.js";
|
|
16
17
|
import "./chunk-N6HH7K6P.js";
|
|
17
18
|
import "./chunk-TRQKHP7D.js";
|
|
18
19
|
export {
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
installConnector,
|
|
4
4
|
installViaMarketplace,
|
|
5
5
|
parseInstallMethod
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-5G4EPJ4Y.js";
|
|
7
|
+
import "./chunk-2X4EH2D7.js";
|
|
8
8
|
import "./chunk-G5CQHVQG.js";
|
|
9
9
|
import {
|
|
10
10
|
fail,
|
|
@@ -12,19 +12,20 @@ import {
|
|
|
12
12
|
parseTargets,
|
|
13
13
|
print,
|
|
14
14
|
renderInstallResult
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-QC5A3TFQ.js";
|
|
16
|
+
import "./chunk-F5RX62T7.js";
|
|
17
|
+
import "./chunk-EROJDXMW.js";
|
|
18
18
|
import "./chunk-KHO5WNTP.js";
|
|
19
19
|
import {
|
|
20
20
|
findConnectorConfig,
|
|
21
21
|
loadConnectorFromPath
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-
|
|
22
|
+
} from "./chunk-MZF2YCXX.js";
|
|
23
|
+
import "./chunk-DCK5FADX.js";
|
|
24
|
+
import "./chunk-BMD7ANKF.js";
|
|
25
|
+
import "./chunk-FAHIMJRU.js";
|
|
25
26
|
import "./chunk-OPXAP3AC.js";
|
|
26
27
|
import "./chunk-7L6ITC4T.js";
|
|
27
|
-
import "./chunk-
|
|
28
|
+
import "./chunk-I5MLE6S7.js";
|
|
28
29
|
import "./chunk-N6HH7K6P.js";
|
|
29
30
|
import "./chunk-TRQKHP7D.js";
|
|
30
31
|
|
|
@@ -88,4 +89,4 @@ async function run(argv) {
|
|
|
88
89
|
export {
|
|
89
90
|
run
|
|
90
91
|
};
|
|
91
|
-
//# sourceMappingURL=install-
|
|
92
|
+
//# sourceMappingURL=install-R7252QFH.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/commands/install.ts"],"sourcesContent":["/**\n * cli/commands/install — deploy a connector across its target platforms.\n *\n * Resolves the connector config (--connector <path>, else findConnectorConfig\n * walking up from the project dir), loads it into a live ResolvedConnector, and\n * hands it to the chosen DELIVERY METHOD's orchestration:\n *\n * --method direct (default) — the installer renders each host's native\n * MCP + hook + content config in place (zero behavior\n * change for existing scripts).\n * --method marketplace — stage the connector's plugin bundle under the\n * data-root and DRIVE the host's own plugin/marketplace\n * install flow (v1 driver: claude-code; other hosts get\n * never-silent skip/warn records with manual commands).\n *\n * Both methods emit the same ChangeRecords, rendered as a readable diff;\n * --dry-run renders the plan without writing or spawning. A double-install\n * guard (both directions) enforces exactly one method per (connector, host,\n * scope) — a refusal is a `warn` record, so the exit-1-on-warn convention\n * carries over.\n */\n\nimport { parseArgs } from \"node:util\";\n\nimport { installConnector } from \"../../core/installer.js\";\nimport { installViaMarketplace, parseInstallMethod } from \"../../core/marketplace.js\";\nimport { findConnectorConfig, loadConnectorFromPath } from \"../../core/load-connector.js\";\nimport { fail, parseScope, parseTargets, print, renderInstallResult } from \"../app.js\";\n\nexport async function run(argv: string[]): Promise<number> {\n const { values } = parseArgs({\n args: argv,\n options: {\n method: { type: \"string\", default: \"direct\" },\n scope: { type: \"string\", default: \"user\" },\n targets: { type: \"string\" },\n connector: { type: \"string\" },\n project: { type: \"string\" },\n \"dry-run\": { type: \"boolean\", default: false },\n // Memory surface: overwrite USER-EDITED managed blocks (hash drift).\n // Default behavior is warn-and-leave; --force backs the file up first.\n force: { type: \"boolean\", default: false },\n },\n allowPositionals: false,\n });\n\n const method = parseInstallMethod(values.method);\n if (method == null) {\n return fail(`invalid --method \"${values.method}\" (use direct|marketplace)`);\n }\n\n const projectDir = values.project ?? process.cwd();\n const configPath = values.connector ?? findConnectorConfig(projectDir);\n if (!configPath) {\n return fail(\n \"no connector config found. Pass --connector <path> or add an \" +\n \"agent-connector.config.{mjs,js,json} to your project.\",\n );\n }\n\n const scope = parseScope(values.scope);\n if (scope == null) return fail(`invalid --scope \"${values.scope}\" (use user|project)`);\n if (method === \"marketplace\" && scope !== \"user\") {\n return fail(\n \"--method marketplace supports --scope user only (project-scope plugin installs are deferred)\",\n );\n }\n\n const { connector, modulePath } = await loadConnectorFromPath(configPath);\n const targets = parseTargets(values.targets);\n\n const result =\n method === \"marketplace\"\n ? await installViaMarketplace({\n connector,\n modulePath,\n scope,\n projectDir,\n dryRun: values[\"dry-run\"],\n ...(targets ? { targets } : {}),\n })\n : await installConnector({\n connector,\n modulePath,\n scope,\n projectDir,\n dryRun: values[\"dry-run\"],\n force: values.force,\n ...(targets ? { targets } : {}),\n });\n\n print(renderInstallResult(result, \"install\"));\n return result.changes.some((c) => c.action === \"warn\") ? 1 : 0;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/cli/commands/install.ts"],"sourcesContent":["/**\n * cli/commands/install — deploy a connector across its target platforms.\n *\n * Resolves the connector config (--connector <path>, else findConnectorConfig\n * walking up from the project dir), loads it into a live ResolvedConnector, and\n * hands it to the chosen DELIVERY METHOD's orchestration:\n *\n * --method direct (default) — the installer renders each host's native\n * MCP + hook + content config in place (zero behavior\n * change for existing scripts).\n * --method marketplace — stage the connector's plugin bundle under the\n * data-root and DRIVE the host's own plugin/marketplace\n * install flow (v1 driver: claude-code; other hosts get\n * never-silent skip/warn records with manual commands).\n *\n * Both methods emit the same ChangeRecords, rendered as a readable diff;\n * --dry-run renders the plan without writing or spawning. A double-install\n * guard (both directions) enforces exactly one method per (connector, host,\n * scope) — a refusal is a `warn` record, so the exit-1-on-warn convention\n * carries over.\n */\n\nimport { parseArgs } from \"node:util\";\n\nimport { installConnector } from \"../../core/installer.js\";\nimport { installViaMarketplace, parseInstallMethod } from \"../../core/marketplace.js\";\nimport { findConnectorConfig, loadConnectorFromPath } from \"../../core/load-connector.js\";\nimport { fail, parseScope, parseTargets, print, renderInstallResult } from \"../app.js\";\n\nexport async function run(argv: string[]): Promise<number> {\n const { values } = parseArgs({\n args: argv,\n options: {\n method: { type: \"string\", default: \"direct\" },\n scope: { type: \"string\", default: \"user\" },\n targets: { type: \"string\" },\n connector: { type: \"string\" },\n project: { type: \"string\" },\n \"dry-run\": { type: \"boolean\", default: false },\n // Memory surface: overwrite USER-EDITED managed blocks (hash drift).\n // Default behavior is warn-and-leave; --force backs the file up first.\n force: { type: \"boolean\", default: false },\n },\n allowPositionals: false,\n });\n\n const method = parseInstallMethod(values.method);\n if (method == null) {\n return fail(`invalid --method \"${values.method}\" (use direct|marketplace)`);\n }\n\n const projectDir = values.project ?? process.cwd();\n const configPath = values.connector ?? findConnectorConfig(projectDir);\n if (!configPath) {\n return fail(\n \"no connector config found. Pass --connector <path> or add an \" +\n \"agent-connector.config.{mjs,js,json} to your project.\",\n );\n }\n\n const scope = parseScope(values.scope);\n if (scope == null) return fail(`invalid --scope \"${values.scope}\" (use user|project)`);\n if (method === \"marketplace\" && scope !== \"user\") {\n return fail(\n \"--method marketplace supports --scope user only (project-scope plugin installs are deferred)\",\n );\n }\n\n const { connector, modulePath } = await loadConnectorFromPath(configPath);\n const targets = parseTargets(values.targets);\n\n const result =\n method === \"marketplace\"\n ? await installViaMarketplace({\n connector,\n modulePath,\n scope,\n projectDir,\n dryRun: values[\"dry-run\"],\n ...(targets ? { targets } : {}),\n })\n : await installConnector({\n connector,\n modulePath,\n scope,\n projectDir,\n dryRun: values[\"dry-run\"],\n force: values.force,\n ...(targets ? { targets } : {}),\n });\n\n print(renderInstallResult(result, \"install\"));\n return result.changes.some((c) => c.action === \"warn\") ? 1 : 0;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAS,iBAAiB;AAO1B,eAAsB,IAAI,MAAiC;AACzD,QAAM,EAAE,OAAO,IAAI,UAAU;AAAA,IAC3B,MAAM;AAAA,IACN,SAAS;AAAA,MACP,QAAQ,EAAE,MAAM,UAAU,SAAS,SAAS;AAAA,MAC5C,OAAO,EAAE,MAAM,UAAU,SAAS,OA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AQ,SAAS,CAAC;AAC5C,SAAO,OAAO,QAAQ,KAAK,CAAC,MAAM,EAAE,WAAW,MAAM,IAAI,IAAI;AAC/D;","names":[]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
BaseAdapter
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CPLK7GTE.js";
|
|
5
5
|
import "./chunk-7L6ITC4T.js";
|
|
6
6
|
import {
|
|
7
7
|
buildHomeBinHookCommand,
|
|
8
8
|
isHomeBinHookCommand
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-I5MLE6S7.js";
|
|
10
10
|
import "./chunk-N6HH7K6P.js";
|
|
11
11
|
import "./chunk-TRQKHP7D.js";
|
|
12
12
|
|
|
@@ -19,7 +19,9 @@ var EVENT_MAP = {
|
|
|
19
19
|
PreToolUse: "PreToolUse",
|
|
20
20
|
PostToolUse: "PostToolUse",
|
|
21
21
|
PreCompact: "PreCompact",
|
|
22
|
-
SessionStart: "SessionStart"
|
|
22
|
+
SessionStart: "SessionStart",
|
|
23
|
+
SessionEnd: "SessionEnd",
|
|
24
|
+
UserPromptSubmit: "UserPromptSubmit"
|
|
23
25
|
};
|
|
24
26
|
var JetBrainsCopilotAdapter = class extends BaseAdapter {
|
|
25
27
|
id = HOST;
|
|
@@ -30,14 +32,17 @@ var JetBrainsCopilotAdapter = class extends BaseAdapter {
|
|
|
30
32
|
// (memoryTargets: project <projectDir>/AGENTS.md; user scope where documented).
|
|
31
33
|
supportsMemory: true,
|
|
32
34
|
// JetBrains Copilot's Preview hooks runtime delivers Pre/PostToolUse,
|
|
33
|
-
// PreCompact,
|
|
34
|
-
// same surface as VS Code Copilot
|
|
35
|
+
// PreCompact, SessionStart, SessionEnd, and UserPromptSubmit (GitHub's
|
|
36
|
+
// hooks-reference) — same surface as VS Code Copilot, whose reply contract
|
|
37
|
+
// this adapter mirrors exactly (see formatReply: UserPromptSubmit/PostToolUse
|
|
38
|
+
// deny → top-level {decision:block}). Stop stays unwired (refuted for
|
|
39
|
+
// JetBrains: an unimplemented feature request, not in the documented schema).
|
|
35
40
|
preToolUse: true,
|
|
36
41
|
postToolUse: true,
|
|
37
42
|
preCompact: true,
|
|
38
43
|
sessionStart: true,
|
|
39
|
-
sessionEnd:
|
|
40
|
-
userPromptSubmit:
|
|
44
|
+
sessionEnd: true,
|
|
45
|
+
userPromptSubmit: true,
|
|
41
46
|
stop: false,
|
|
42
47
|
notification: false,
|
|
43
48
|
// Newer events: the JetBrains Copilot Preview hooks runtime documents no
|
|
@@ -49,9 +54,11 @@ var JetBrainsCopilotAdapter = class extends BaseAdapter {
|
|
|
49
54
|
canModifyArgs: false,
|
|
50
55
|
canModifyOutput: false,
|
|
51
56
|
canInjectSessionContext: true,
|
|
52
|
-
// MCP is managed via the IDE Settings UI
|
|
53
|
-
//
|
|
54
|
-
|
|
57
|
+
// MCP is managed via the IDE Settings UI (Settings > Tools > GitHub Copilot
|
|
58
|
+
// > MCP). The UI accepts local stdio servers AND remote Streamable HTTP / SSE
|
|
59
|
+
// servers; AC writes no file, so this list only describes what the UI accepts
|
|
60
|
+
// (install reports a UI-managed warn for every transport).
|
|
61
|
+
transports: ["stdio", "http", "sse"],
|
|
55
62
|
// Content surfaces: JetBrains Copilot consumes the GitHub Copilot .github/
|
|
56
63
|
// files (it has no distinct authoring location), so it is an ALIAS of the
|
|
57
64
|
// vscode-copilot writer for prompt files and Agent Skills. It has no native
|
|
@@ -59,7 +66,15 @@ var JetBrainsCopilotAdapter = class extends BaseAdapter {
|
|
|
59
66
|
// returns the skip/warn default).
|
|
60
67
|
supportsCommands: true,
|
|
61
68
|
supportsSkills: true,
|
|
62
|
-
supportsSubagents: false
|
|
69
|
+
supportsSubagents: false,
|
|
70
|
+
// Native passthrough: GitHub's JetBrains-Copilot changelog documents an
|
|
71
|
+
// errorOccurred / ErrorOccurred lifecycle event with NO canonical
|
|
72
|
+
// HookEventName analog (PostToolUseFailure is tool-scoped, not a session-wide
|
|
73
|
+
// error event). A connector reaches it via platforms["jetbrains-copilot"].
|
|
74
|
+
// nativeHooks; installHooks files the event-name key VERBATIM and the generic
|
|
75
|
+
// uninstall reverses it. PascalCase ErrorOccurred matches the adapter's
|
|
76
|
+
// Claude-compatible payload dialect (GitHub hooks-reference accepts both).
|
|
77
|
+
supportsNativeHooks: true
|
|
63
78
|
};
|
|
64
79
|
// ── Detection ────────────────────────────────────────────────────────────
|
|
65
80
|
detectInstalled(projectDir) {
|
|
@@ -156,20 +171,26 @@ var JetBrainsCopilotAdapter = class extends BaseAdapter {
|
|
|
156
171
|
// ── Hook install / uninstall ─────────────────────────────────────────────
|
|
157
172
|
installHooks(ctx) {
|
|
158
173
|
const { connector } = ctx;
|
|
159
|
-
|
|
174
|
+
const override = connector.platforms[HOST];
|
|
175
|
+
const hooksDisabled = override?.hooks === false;
|
|
176
|
+
const normalizedEvents = hooksDisabled ? [] : connector.hookEvents;
|
|
177
|
+
const nativeHooks = override?.nativeHooks ?? {};
|
|
178
|
+
const nativeEvents = Object.keys(nativeHooks);
|
|
179
|
+
if (normalizedEvents.length === 0 && nativeEvents.length === 0) {
|
|
160
180
|
return [
|
|
161
|
-
{
|
|
181
|
+
{
|
|
182
|
+
platform: this.id,
|
|
183
|
+
action: "skip",
|
|
184
|
+
detail: hooksDisabled ? "hooks disabled for jetbrains-copilot" : "connector declares no hooks"
|
|
185
|
+
}
|
|
162
186
|
];
|
|
163
187
|
}
|
|
164
|
-
if (connector.hookEvents.length === 0) {
|
|
165
|
-
return [{ platform: this.id, action: "skip", detail: "connector declares no hooks" }];
|
|
166
|
-
}
|
|
167
188
|
const hooksPath = this.getHookConfigPath(ctx);
|
|
168
189
|
const file = this.readJson(hooksPath) ?? {};
|
|
169
190
|
const hooks = file.hooks ??= {};
|
|
170
191
|
const changes = [];
|
|
171
192
|
let mutated = false;
|
|
172
|
-
for (const event of
|
|
193
|
+
for (const event of normalizedEvents) {
|
|
173
194
|
const jetbrainsEvent = EVENT_MAP[event];
|
|
174
195
|
if (!jetbrainsEvent) {
|
|
175
196
|
changes.push({
|
|
@@ -212,6 +233,39 @@ var JetBrainsCopilotAdapter = class extends BaseAdapter {
|
|
|
212
233
|
}
|
|
213
234
|
mutated = true;
|
|
214
235
|
}
|
|
236
|
+
for (const nativeEvent of nativeEvents) {
|
|
237
|
+
const command = buildHomeBinHookCommand(ctx.homeBinPath, HOST, nativeEvent, connector.id);
|
|
238
|
+
const entry = { type: "command", command };
|
|
239
|
+
const bucket = hooks[nativeEvent] ??= [];
|
|
240
|
+
const existingIdx = bucket.findIndex((e) => e.command === command);
|
|
241
|
+
if (existingIdx >= 0) {
|
|
242
|
+
if (JSON.stringify(bucket[existingIdx]) === JSON.stringify(entry)) {
|
|
243
|
+
changes.push({
|
|
244
|
+
platform: this.id,
|
|
245
|
+
action: "skip",
|
|
246
|
+
path: hooksPath,
|
|
247
|
+
detail: `hooks.${nativeEvent} (native) already registered`
|
|
248
|
+
});
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
bucket[existingIdx] = entry;
|
|
252
|
+
changes.push({
|
|
253
|
+
platform: this.id,
|
|
254
|
+
action: "update",
|
|
255
|
+
path: hooksPath,
|
|
256
|
+
detail: `hooks.${nativeEvent} (native)`
|
|
257
|
+
});
|
|
258
|
+
} else {
|
|
259
|
+
bucket.push(entry);
|
|
260
|
+
changes.push({
|
|
261
|
+
platform: this.id,
|
|
262
|
+
action: "create",
|
|
263
|
+
path: hooksPath,
|
|
264
|
+
detail: `hooks.${nativeEvent} (native)`
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
mutated = true;
|
|
268
|
+
}
|
|
215
269
|
if (mutated) {
|
|
216
270
|
file.version = JETBRAINS_HOOKS_VERSION;
|
|
217
271
|
this.writeJson(hooksPath, file, ctx.dryRun);
|
|
@@ -522,6 +576,13 @@ var JetBrainsCopilotAdapter = class extends BaseAdapter {
|
|
|
522
576
|
};
|
|
523
577
|
return ev;
|
|
524
578
|
}
|
|
579
|
+
case "PostCompact": {
|
|
580
|
+
const ev = {
|
|
581
|
+
...base,
|
|
582
|
+
...input.trigger === "auto" || input.trigger === "manual" ? { trigger: input.trigger } : {}
|
|
583
|
+
};
|
|
584
|
+
return ev;
|
|
585
|
+
}
|
|
525
586
|
case "SessionStart": {
|
|
526
587
|
const ev = {
|
|
527
588
|
...base,
|
|
@@ -578,6 +639,12 @@ var JetBrainsCopilotAdapter = class extends BaseAdapter {
|
|
|
578
639
|
const hookEventName = event;
|
|
579
640
|
const decision = response.decision ?? "allow";
|
|
580
641
|
if (decision === "deny") {
|
|
642
|
+
if (event === "PostToolUse" || event === "UserPromptSubmit" || event === "Stop" || event === "SubagentStop") {
|
|
643
|
+
return this.stdout({
|
|
644
|
+
decision: "block",
|
|
645
|
+
reason: response.reason ?? "Blocked by hook"
|
|
646
|
+
});
|
|
647
|
+
}
|
|
581
648
|
return this.stdout({
|
|
582
649
|
hookSpecificOutput: {
|
|
583
650
|
hookEventName,
|
|
@@ -644,4 +711,4 @@ export {
|
|
|
644
711
|
adapter,
|
|
645
712
|
jetbrains_copilot_default as default
|
|
646
713
|
};
|
|
647
|
-
//# sourceMappingURL=jetbrains-copilot-
|
|
714
|
+
//# sourceMappingURL=jetbrains-copilot-NRZHI5PC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/adapters/jetbrains-copilot/index.ts"],"sourcesContent":["/**\n * adapters/jetbrains-copilot — JetBrains Copilot platform adapter for agent-connector.\n *\n * JetBrains Copilot shares the Copilot hook paradigm with VS Code Copilot\n * (Claude-compatible json-stdio), but diverges on MCP registration:\n *\n * - MCP servers: JetBrains stores MCP server registration via the IDE Settings\n * UI (Settings > Tools > GitHub Copilot > MCP > Configure), NOT in any file\n * we can reliably write — the runtime owns the `servers` key behind the UI.\n * So `installServer` writes NOTHING and returns a \"warn\" ChangeRecord telling\n * the user to add the server via the JetBrains MCP settings UI. Writing a\n * bogus file would be ignored at best and corrupt real UI state at worst.\n * `getHealthChecks` surfaces this as a WARN (not FAIL).\n *\n * - Hooks (Copilot Preview hooks): file-based and identical in shape to VS Code\n * Copilot. We write one per-connector file at\n * <projectDir>/.github/hooks/<connector-id>.json shaped as:\n * { \"version\": 1, \"hooks\": { <Event>: [ { \"type\": \"command\", \"command\" } ] } }\n * The top-level `version: 1` is REQUIRED — the Copilot hooks runtime rejects a\n * version-less file and no hooks fire. Each entry is a FLAT { type, command }\n * object (no Claude-style { matcher, hooks:[...] } wrapper). JetBrains parses\n * matchers but IGNORES them — ALL hooks fire on ALL tools — so we omit the\n * matcher entirely rather than persist an advisory one that never applies.\n *\n * - Reply: Claude-compatible JSON on stdout (exit 0), a `hookSpecificOutput`\n * object keyed by the PascalCase `hookEventName` carrying permissionDecision\n * (deny|ask) + permissionDecisionReason and additionalContext. This mirrors\n * vscode-copilot/claude-code exactly EXCEPT JetBrains cannot rewrite tool\n * input (canModifyArgs:false), so a \"modify\" decision degrades to allow.\n *\n * Env interpolation: GitHub Copilot does not document a portable native env\n * token for the hooks file, and the hooks file only ever carries our home-bin\n * hook command (no secrets), so there is nothing to interpolate here. MCP env\n * interpolation is moot because we never write the MCP file.\n */\n\nimport { existsSync, rmSync } from \"node:fs\";\nimport { dirname, 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 PostCompactEvent,\n PreCompactEvent,\n PreToolUseEvent,\n SessionEndEvent,\n SessionStartEvent,\n SkillDef,\n StopEvent,\n UserPromptSubmitEvent,\n} from \"../../core/types.js\";\nimport {\n buildHomeBinHookCommand,\n isHomeBinHookCommand,\n} from \"../../core/spawn.js\";\n\nconst HOST: PlatformId = \"jetbrains-copilot\";\n\n/** Top-level version the Copilot hooks runtime requires; a version-less file is rejected. */\nconst JETBRAINS_HOOKS_VERSION = 1;\n\n/**\n * JetBrains Copilot reads PascalCase hook event names from its hooks file —\n * identical to VS Code Copilot / Claude Code. Only the events JetBrains actually\n * delivers are registered; everything else has no Copilot equivalent and is\n * reported as a 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 SessionEnd: \"SessionEnd\",\n UserPromptSubmit: \"UserPromptSubmit\",\n};\n\n/** A single JetBrains Copilot native hook entry — a flat command object. */\ninterface JetBrainsHookEntry {\n type: \"command\";\n command: string;\n}\n\n/** The shape of a JetBrains Copilot .github/hooks/<connector>.json file. */\ninterface JetBrainsHooksFile {\n version?: number;\n hooks?: Record<string, JetBrainsHookEntry[]>;\n}\n\n/** Raw JetBrains Copilot hook stdin payload (Claude-compatible snake_case fields). */\ninterface JetBrainsWireInput {\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 JetBrainsCopilotAdapter extends BaseAdapter implements Adapter {\n readonly id: PlatformId = HOST;\n readonly name = \"JetBrains Copilot\";\n readonly paradigm: HookParadigm = \"json-stdio\";\n\n readonly capabilities: PlatformCapabilities = {\n // Memory surface: AGENTS.md-first managed block via the BaseAdapter default\n // (memoryTargets: project <projectDir>/AGENTS.md; user scope where documented).\n supportsMemory: true,\n // JetBrains Copilot's Preview hooks runtime delivers Pre/PostToolUse,\n // PreCompact, SessionStart, SessionEnd, and UserPromptSubmit (GitHub's\n // hooks-reference) — same surface as VS Code Copilot, whose reply contract\n // this adapter mirrors exactly (see formatReply: UserPromptSubmit/PostToolUse\n // deny → top-level {decision:block}). Stop stays unwired (refuted for\n // JetBrains: an unimplemented feature request, not in the documented schema).\n preToolUse: true,\n postToolUse: true,\n preCompact: true,\n sessionStart: true,\n sessionEnd: true,\n userPromptSubmit: true,\n stop: false,\n notification: false,\n // Newer events: the JetBrains Copilot Preview hooks runtime documents no\n // permission-dialog, tool-failure, or subagent lifecycle events, so\n // permissionRequest / postToolUseFailure / subagentStart / subagentStop\n // stay unset — install reports the standard skip-warn for them.\n // Per the JetBrains spec this host is deny/ask-only: a PreToolUse hook\n // CANNOT rewrite tool input, and PostToolUse cannot rewrite tool output.\n canModifyArgs: false,\n canModifyOutput: false,\n canInjectSessionContext: true,\n // MCP is managed via the IDE Settings UI (Settings > Tools > GitHub Copilot\n // > MCP). The UI accepts local stdio servers AND remote Streamable HTTP / SSE\n // servers; AC writes no file, so this list only describes what the UI accepts\n // (install reports a UI-managed warn for every transport).\n transports: [\"stdio\", \"http\", \"sse\"],\n // Content surfaces: JetBrains Copilot consumes the GitHub Copilot .github/\n // files (it has no distinct authoring location), so it is an ALIAS of the\n // vscode-copilot writer for prompt files and Agent Skills. It has no native\n // subagent/chat-mode surface, so subagents stay unsupported (BaseAdapter\n // returns the skip/warn default).\n supportsCommands: true,\n supportsSkills: true,\n supportsSubagents: false,\n // Native passthrough: GitHub's JetBrains-Copilot changelog documents an\n // errorOccurred / ErrorOccurred lifecycle event with NO canonical\n // HookEventName analog (PostToolUseFailure is tool-scoped, not a session-wide\n // error event). A connector reaches it via platforms[\"jetbrains-copilot\"].\n // nativeHooks; installHooks files the event-name key VERBATIM and the generic\n // uninstall reverses it. PascalCase ErrorOccurred matches the adapter's\n // Claude-compatible payload dialect (GitHub hooks-reference accepts both).\n supportsNativeHooks: true,\n };\n\n // ── Detection ────────────────────────────────────────────────────────────\n\n detectInstalled(projectDir: string): DetectedPlatform {\n // JetBrains Copilot integration is observable through two markers:\n // • the project hooks tree (<projectDir>/.github/hooks) we write to, and\n // • our per-connector hooks file specifically.\n // There is no reliable user-profile MCP file to probe (the UI owns it), so\n // detection is project-scoped and keyed on the hooks footprint.\n const githubDir = join(projectDir, \".github\");\n const hooksDir = join(githubDir, \"hooks\");\n const installed = existsSync(hooksDir) || existsSync(githubDir);\n const configPath = hooksDir;\n return {\n id: this.id,\n name: this.name,\n installed,\n paradigm: this.paradigm,\n capabilities: this.capabilities,\n configPath,\n scope: \"project\",\n reason: installed\n ? `found JetBrains Copilot hooks tree at ${hooksDir}`\n : `no JetBrains Copilot hooks tree at ${hooksDir}`,\n confidence: installed ? \"medium\" : \"low\",\n };\n }\n\n // ── Native paths ─────────────────────────────────────────────────────────\n\n /** Hooks live under the workspace .github tree for both scopes. */\n getConfigDir(ctx: InstallContext): string {\n return join(ctx.projectDir, \".github\");\n }\n\n /**\n * MCP server registration has NO writable file on JetBrains — the IDE owns it\n * behind the Settings UI. We still return a stable path (the hooks file) so the\n * base-adapter `doctor`/`backupSettings` helpers have a sensible target rather\n * than a nonexistent/bogus MCP path. `installServer` never writes here.\n */\n getServerConfigPath(ctx: InstallContext): string {\n return this.getHookConfigPath(ctx);\n }\n\n /**\n * Hook registration lives in the workspace-discovered .github/hooks tree, which\n * JetBrains Copilot scans for *.json hook files. We write one file per connector\n * so installs/uninstalls never clobber another connector's hooks. Anchored on\n * projectDir for both scopes — .github/hooks is a workspace concept (there is no\n * 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 /**\n * JetBrains MCP registration is UI-only. We never write a file: a bogus file is\n * ignored at best and corrupts real UI-managed state at worst. Emit a \"warn\"\n * ChangeRecord that tells the user exactly where to add the server by hand.\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 jetbrains-copilot\"\n : \"connector declares no MCP server\",\n },\n ];\n }\n\n return [\n {\n platform: this.id,\n action: \"warn\",\n detail:\n `JetBrains Copilot manages MCP servers via the IDE Settings UI — ` +\n `add \"${connector.id}\" manually under Settings > Tools > GitHub Copilot ` +\n `> MCP > Configure (no file is written here).`,\n },\n ];\n }\n\n /**\n * Nothing was written for the MCP server, so there is nothing to remove. Mirror\n * the install-time guidance as a \"warn\" so an uninstall report is honest about\n * the UI-managed entry the user may still want to remove by hand.\n */\n uninstallServer(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (!connector.server || connector.platforms[HOST]?.server === false) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n detail: \"no MCP server was registered for jetbrains-copilot\",\n },\n ];\n }\n return [\n {\n platform: this.id,\n action: \"warn\",\n detail:\n `JetBrains Copilot MCP servers are UI-managed — if \"${connector.id}\" was ` +\n `added manually, remove it under Settings > Tools > GitHub Copilot > MCP.`,\n },\n ];\n }\n\n // ── Hook install / uninstall ─────────────────────────────────────────────\n\n installHooks(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n const override = connector.platforms[HOST];\n const hooksDisabled = override?.hooks === false;\n // `hooks: false` disables only the NORMALIZED events; nativeHooks is a\n // sibling, jetbrains-copilot-scoped declaration that installs regardless.\n const normalizedEvents = hooksDisabled ? [] : connector.hookEvents;\n const nativeHooks = override?.nativeHooks ?? {};\n const nativeEvents = Object.keys(nativeHooks);\n\n if (normalizedEvents.length === 0 && nativeEvents.length === 0) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n detail: hooksDisabled\n ? \"hooks disabled for jetbrains-copilot\"\n : \"connector declares no hooks\",\n },\n ];\n }\n\n const hooksPath = this.getHookConfigPath(ctx);\n const file = this.readJson<JetBrainsHooksFile>(hooksPath) ?? {};\n const hooks = (file.hooks ??= {});\n\n const changes: ChangeRecord[] = [];\n let mutated = false;\n\n for (const event of normalizedEvents) {\n const jetbrainsEvent = EVENT_MAP[event];\n if (!jetbrainsEvent) {\n // No JetBrains 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 JetBrains Copilot hook equivalent — skipped`,\n });\n continue;\n }\n\n const command = buildHomeBinHookCommand(ctx.homeBinPath, HOST, event, connector.id);\n // Matchers are IGNORED by JetBrains (all hooks fire on all tools), so we omit\n // the matcher entirely — a flat { type, command } entry.\n const entry: JetBrainsHookEntry = { type: \"command\", command };\n\n const bucket = (hooks[jetbrainsEvent] ??= []);\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.${jetbrainsEvent} 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.${jetbrainsEvent}`,\n });\n } else {\n bucket.push(entry);\n changes.push({\n platform: this.id,\n action: \"create\",\n path: hooksPath,\n detail: `hooks.${jetbrainsEvent}`,\n });\n }\n mutated = true;\n }\n\n // NATIVE passthrough events: jetbrains-copilot-native event-name keys (e.g.\n // ErrorOccurred) filed VERBATIM into the hooks map — no EVENT_MAP, since they\n // ARE Copilot events. Flat { type, command } entry (matchers are ignored);\n // matched by EXACT command so a native key coinciding with a normalized one\n // never clobbers it.\n for (const nativeEvent of nativeEvents) {\n const command = buildHomeBinHookCommand(ctx.homeBinPath, HOST, nativeEvent, connector.id);\n const entry: JetBrainsHookEntry = { type: \"command\", command };\n const bucket = (hooks[nativeEvent] ??= []);\n const existingIdx = bucket.findIndex((e) => e.command === command);\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.${nativeEvent} (native) 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.${nativeEvent} (native)`,\n });\n } else {\n bucket.push(entry);\n changes.push({\n platform: this.id,\n action: \"create\",\n path: hooksPath,\n detail: `hooks.${nativeEvent} (native)`,\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 = JETBRAINS_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<JetBrainsHooksFile>(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 jetbrainsEvent of Object.keys(hooks)) {\n const bucket = hooks[jetbrainsEvent];\n if (!Array.isArray(bucket)) continue;\n\n const before = bucket.length;\n // Only strip OUR connector's home-bin commands — never another connector's\n // (isHomeBinHookCommand is id-anchored against a shared-prefix collision).\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[jetbrainsEvent] = next;\n else delete hooks[jetbrainsEvent];\n changes.push({\n platform: this.id,\n action: \"remove\",\n path: hooksPath,\n detail: `hooks.${jetbrainsEvent} (${removed})`,\n });\n mutated = true;\n }\n }\n\n if (mutated) {\n // The hooks file is connector-OWNED (<connector-id>.json), so when our\n // strip leaves it with NO hooks we must DELETE the whole file rather than\n // rewrite a `{ \"hooks\": {}, \"version\": 1 }` shell — an empty shell is an\n // orphan per-connector file that lingers after uninstall. A non-empty\n // result still belongs to us, so we rewrite it as before. dryRun reports\n // the would-be remove without mutating the filesystem.\n if (Object.keys(hooks).length === 0) {\n if (!ctx.dryRun) rmSync(hooksPath, { force: true });\n changes.push({\n platform: this.id,\n action: \"remove\",\n path: hooksPath,\n detail: \"removed empty connector hooks file\",\n });\n // Clean up the parent .github/hooks dir only when it is now empty (it is\n // a per-connector tree; leave it in place if other connectors' files\n // remain).\n changes.push(this.removeDirIfEmpty(dirname(hooksPath), ctx.dryRun));\n } else {\n this.writeJson(hooksPath, file, ctx.dryRun);\n }\n }\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 ──────────────────────────────────\n // CONTENT-ONLY: pure native-file writers under the workspace .github/ tree\n // ({prompts,skills}). No runtime dispatch, no home-bin pointer, no telemetry\n // wrap. Each method is idempotent (byte-identical → skip) via\n // BaseAdapter.writeContentFile and reversible via removeContentFile. Honors\n // platforms[\"jetbrains-copilot\"] per-surface false to skip.\n //\n // ALIAS of vscode-copilot: JetBrains consumes the GitHub Copilot .github/\n // files and has no distinct authoring location, so the rendered content +\n // paths here are IDENTICAL to the vscode-copilot writer.\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 and this adapter is project-\n // scoped (no user-profile .github authoring location exists in the Copilot\n // prompt/skill discovery), so the content root is always the project .github\n // tree — the same dir getConfigDir already anchors on.\n\n /** Root of the content tree — the project .github tree (see getConfigDir). */\n private contentRootDir(ctx: InstallContext): string {\n return this.getConfigDir(ctx);\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\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\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 jetbrains-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 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 // Copilot 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 jetbrains-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 // ── Diagnostics ──────────────────────────────────────────────────────────\n\n override getHealthChecks(ctx: InstallContext): readonly HealthCheck[] {\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 hasServer =\n ctx.connector.server != null &&\n ctx.connector.platforms[HOST]?.server !== false;\n const checks: HealthCheck[] = [\n {\n // MCP cannot be verified from disk — JetBrains owns it behind the UI.\n // BaseAdapter.doctor maps != OK to a hard FAIL, but an unverifiable\n // UI-managed surface must NOT hard-fail doctor (that contradicts the\n // install-time WARN). Return OK with a verify-in-UI detail instead.\n name: `${this.name}: MCP server (UI-managed)`,\n check: () =>\n hasServer\n ? {\n status: \"OK\",\n detail:\n \"MCP is UI-managed — verify in Settings > Tools > GitHub Copilot > MCP\",\n }\n : { status: \"OK\", detail: \"connector declares no MCP server\" },\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<JetBrainsHooksFile>(hooksPath);\n if (!file) return { status: \"FAIL\", detail: `not found: ${hooksPath}` };\n if (file.version !== JETBRAINS_HOOKS_VERSION) {\n return {\n status: \"FAIL\",\n detail: `${hooksPath} missing required \"version\": ${JETBRAINS_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). Subagents are\n // unsupported here, so they are never checked.\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 return checks;\n }\n\n // ── Runtime: parse JetBrains Copilot stdin JSON → normalized event ────────\n\n parseEvent(event: HookEventName, raw: unknown): NormalizedEvent {\n const input = (raw ?? {}) as JetBrainsWireInput;\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 \"PostCompact\": {\n // JetBrains Copilot does not fire PostCompact natively (postCompact\n // unset → warn-skip at install). Parsed defensively, mirroring\n // PreCompact, so a manual/mis-routed dispatch normalizes instead of\n // hitting the guard.\n const ev: PostCompactEvent = {\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 case \"PermissionRequest\":\n case \"PostToolUseFailure\":\n case \"SubagentStart\":\n case \"SubagentStop\": {\n // No JetBrains Copilot analog — its Preview hooks runtime documents no\n // permission-dialog, tool-failure, or subagent lifecycle events.\n // Install already skip-warns these via EVENT_MAP; a runtime dispatch is\n // a mis-route — fail loudly.\n throw new Error(`unsupported jetbrains-copilot hook event: ${String(event)}`);\n }\n default: {\n // Exhaustive guard — every HookEventName is handled above. (JetBrains 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 jetbrains-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: JetBrainsWireInput): string | undefined {\n return input.cwd ?? input.workspace_roots?.[0] ?? undefined;\n }\n\n // ── Runtime: normalized response → JetBrains 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 // JetBrains Copilot's reply is Claude-compatible, identical to vscode-copilot:\n // `hookSpecificOutput.permissionDecision` is read ONLY for the pre-execution\n // PreToolUse permission event. The post-execution / turn-control events —\n // PostToolUse, UserPromptSubmit, Stop, SubagentStop — block via the TOP-LEVEL\n // {\"decision\":\"block\",\"reason\"} instead (PostToolUse runs AFTER the tool, so a\n // permissionDecision there is silently ignored). Mirrors vscode-copilot #56/#58.\n if (decision === \"deny\") {\n if (\n event === \"PostToolUse\" ||\n event === \"UserPromptSubmit\" ||\n event === \"Stop\" ||\n event === \"SubagentStop\"\n ) {\n return this.stdout({\n decision: \"block\",\n reason: response.reason ?? \"Blocked by hook\",\n });\n }\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 → unsupported on JetBrains (canModifyArgs:false): a PreToolUse hook\n // cannot rewrite tool input here, so degrade to allow rather than emit an\n // updatedInput the host will ignore.\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 / modify-degradation / unsupported → 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 * Extract a stable session id from a JetBrains 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: JetBrainsWireInput): 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 JetBrainsCopilotAdapter();\nexport default adapter;\n"],"mappings":";;;;;;;;;;;;;AAoCA,SAAS,YAAY,cAAc;AACnC,SAAS,SAAS,YAAY;AA8B9B,IAAM,OAAmB;AAGzB,IAAM,0BAA0B;AAQhC,IAAM,YAAoD;AAAA,EACxD,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,kBAAkB;AACpB;AA8CO,IAAM,0BAAN,cAAsC,YAA+B;AAAA,EACjE,KAAiB;AAAA,EACjB,OAAO;AAAA,EACP,WAAyB;AAAA,EAEzB,eAAqC;A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AAEO,IAAM,UAAU,IAAI,wBAAwB;AACnD,IAAO,4BAAQ;","names":[]}
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
} from "./chunk-DBQMX75U.js";
|
|
5
5
|
import {
|
|
6
6
|
BaseAdapter
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-CPLK7GTE.js";
|
|
8
8
|
import "./chunk-7L6ITC4T.js";
|
|
9
9
|
import {
|
|
10
10
|
buildServeWrapperCommand,
|
|
11
11
|
shouldWrapForTelemetry
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-I5MLE6S7.js";
|
|
13
13
|
import "./chunk-N6HH7K6P.js";
|
|
14
14
|
import "./chunk-TRQKHP7D.js";
|
|
15
15
|
|
|
@@ -34,7 +34,20 @@ var LEGACY_CLINE_SETTINGS_FILE = "cline_mcp_settings.json";
|
|
|
34
34
|
var EVENT_TO_KILO = {
|
|
35
35
|
PreToolUse: "tool.execute.before",
|
|
36
36
|
PostToolUse: "tool.execute.after",
|
|
37
|
-
SessionStart: "experimental.chat.system.transform"
|
|
37
|
+
SessionStart: "experimental.chat.system.transform",
|
|
38
|
+
// chat.message fires when a new user message arrives (inspect/modify parts) →
|
|
39
|
+
// canonical UserPromptSubmit (mirrors the mimo-code OpenCode fork).
|
|
40
|
+
UserPromptSubmit: "chat.message",
|
|
41
|
+
// permission.ask is the decision-capable gate (auto-allow/auto-deny). The
|
|
42
|
+
// handler MUTATES output.status ("ask"|"deny"|"allow") — mirrors OpenCode.
|
|
43
|
+
PermissionRequest: "permission.ask",
|
|
44
|
+
// session.idle ("session finished responding") → canonical Stop. NOT a direct
|
|
45
|
+
// hook key — dispatched through the generic `event` hook (event.type switch).
|
|
46
|
+
// session.idle is doc-listed for the VS Code extension & CLI but its runtime
|
|
47
|
+
// firing on a given Kilo build is not separately verified (an upstream FR for
|
|
48
|
+
// session-lifecycle hooks exists); if it never fires, Stop is a silent no-op
|
|
49
|
+
// (an acceptable degrade — it never mis-fires), so coverage may be optimistic.
|
|
50
|
+
Stop: "session.idle"
|
|
38
51
|
};
|
|
39
52
|
function kiloConfigDir() {
|
|
40
53
|
const xdg = process.env.XDG_CONFIG_HOME;
|
|
@@ -68,9 +81,13 @@ var KiloAdapter = class extends BaseAdapter {
|
|
|
68
81
|
preCompact: false,
|
|
69
82
|
sessionStart: true,
|
|
70
83
|
sessionEnd: false,
|
|
71
|
-
|
|
72
|
-
|
|
84
|
+
// chat.message backs UserPromptSubmit; session.idle (via the generic `event`
|
|
85
|
+
// hook) backs Stop.
|
|
86
|
+
userPromptSubmit: true,
|
|
87
|
+
stop: true,
|
|
73
88
|
notification: false,
|
|
89
|
+
// Decision-capable permission gate (permission.ask) — mutates output.status.
|
|
90
|
+
permissionRequest: true,
|
|
74
91
|
canModifyArgs: true,
|
|
75
92
|
canModifyOutput: true,
|
|
76
93
|
canInjectSessionContext: true,
|
|
@@ -491,6 +508,66 @@ function bridge(event, payload) {
|
|
|
491
508
|
}
|
|
492
509
|
},`);
|
|
493
510
|
}
|
|
511
|
+
if (has("UserPromptSubmit")) {
|
|
512
|
+
handlers.push(` // UserPromptSubmit \u2192 context injection on prompt submission.
|
|
513
|
+
// chat.message fires when a new user message arrives; output.parts holds the
|
|
514
|
+
// prompt parts. Inject context by PUSHING a text part onto output.parts.
|
|
515
|
+
// chat.message has NO documented block/abort, so a "deny" decision degrades
|
|
516
|
+
// to a NO-OP (best-effort) \u2014 mirrors the mimo-code OpenCode fork.
|
|
517
|
+
"chat.message": async (input, output) => {
|
|
518
|
+
const promptText =
|
|
519
|
+
output && Array.isArray(output.parts)
|
|
520
|
+
? output.parts
|
|
521
|
+
.filter((p) => p && p.type === "text" && typeof p.text === "string")
|
|
522
|
+
.map((p) => p.text)
|
|
523
|
+
.join("\\n")
|
|
524
|
+
: "";
|
|
525
|
+
const res = bridge("UserPromptSubmit", {
|
|
526
|
+
prompt: promptText,
|
|
527
|
+
sessionId: (input && input.sessionID) || "",
|
|
528
|
+
projectDir: PROJECT_DIR,
|
|
529
|
+
});
|
|
530
|
+
if (!res) return;
|
|
531
|
+
if (res.additionalContext && output && Array.isArray(output.parts)) {
|
|
532
|
+
output.parts.push({ type: "text", text: res.additionalContext });
|
|
533
|
+
}
|
|
534
|
+
},`);
|
|
535
|
+
}
|
|
536
|
+
if (has("PermissionRequest")) {
|
|
537
|
+
handlers.push(` // PermissionRequest \u2192 decision-capable permission gate.
|
|
538
|
+
// permission.ask MUTATES output.status ("ask"|"deny"|"allow") \u2014 it does NOT
|
|
539
|
+
// return a value (mirrors tool.execute.before mutating output.args). A
|
|
540
|
+
// normalized "deny" maps to output.status "deny"; "ask" to "ask"; allow/void
|
|
541
|
+
// leave the default status untouched.
|
|
542
|
+
"permission.ask": async (input, output) => {
|
|
543
|
+
const payload = {
|
|
544
|
+
toolName: (input && (input.type || input.tool)) ?? "",
|
|
545
|
+
toolInput: (input && (input.metadata || input.args)) ?? {},
|
|
546
|
+
sessionId: (input && input.sessionID) ?? "",
|
|
547
|
+
projectDir: PROJECT_DIR,
|
|
548
|
+
};
|
|
549
|
+
const res = bridge("PermissionRequest", payload);
|
|
550
|
+
if (!res || !output) return;
|
|
551
|
+
if (res.decision === "deny") output.status = "deny";
|
|
552
|
+
else if (res.decision === "ask") output.status = "ask";
|
|
553
|
+
},`);
|
|
554
|
+
}
|
|
555
|
+
if (has("Stop")) {
|
|
556
|
+
handlers.push(` // Stop \u2192 session.idle ("session finished responding"). session.idle is NOT a
|
|
557
|
+
// direct hook key \u2014 it is dispatched through the generic \`event\` hook
|
|
558
|
+
// switching on event.type. A block decision throws to halt (Kilo has no
|
|
559
|
+
// Stop-gate return value).
|
|
560
|
+
event: async ({ event }) => {
|
|
561
|
+
if (!event || event.type !== "session.idle") return;
|
|
562
|
+
const res = bridge("Stop", {
|
|
563
|
+
sessionId: (event.properties && event.properties.sessionID) || "",
|
|
564
|
+
projectDir: PROJECT_DIR,
|
|
565
|
+
});
|
|
566
|
+
if (res && res.decision === "deny") {
|
|
567
|
+
throw new Error(res.reason || "Stop blocked by ${ctx.connector.id}");
|
|
568
|
+
}
|
|
569
|
+
},`);
|
|
570
|
+
}
|
|
494
571
|
const definition = `
|
|
495
572
|
const plugin = {
|
|
496
573
|
id: CONNECTOR_ID,
|
|
@@ -549,6 +626,25 @@ export default plugin;
|
|
|
549
626
|
const ev = { ...base, source: "startup" };
|
|
550
627
|
return ev;
|
|
551
628
|
}
|
|
629
|
+
case "UserPromptSubmit": {
|
|
630
|
+
const ev = {
|
|
631
|
+
...base,
|
|
632
|
+
prompt: typeof input.prompt === "string" ? input.prompt : ""
|
|
633
|
+
};
|
|
634
|
+
return ev;
|
|
635
|
+
}
|
|
636
|
+
case "PermissionRequest": {
|
|
637
|
+
const ev = {
|
|
638
|
+
...base,
|
|
639
|
+
toolName: input.toolName ?? "",
|
|
640
|
+
toolInput: input.toolInput ?? {}
|
|
641
|
+
};
|
|
642
|
+
return ev;
|
|
643
|
+
}
|
|
644
|
+
case "Stop": {
|
|
645
|
+
const ev = { ...base };
|
|
646
|
+
return ev;
|
|
647
|
+
}
|
|
552
648
|
default:
|
|
553
649
|
return { ...base, source: "startup" };
|
|
554
650
|
}
|
|
@@ -571,26 +667,26 @@ export default plugin;
|
|
|
571
667
|
// skip) via BaseAdapter.writeContentFile and reversible via removeContentFile.
|
|
572
668
|
// Honors platforms["kilo"] per-surface false to skip.
|
|
573
669
|
//
|
|
574
|
-
// NOTE on dirs: the
|
|
575
|
-
//
|
|
576
|
-
//
|
|
577
|
-
//
|
|
578
|
-
//
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
670
|
+
// NOTE on dirs: the CURRENT kilo backend (7.x, shared with kilo-cli) reads
|
|
671
|
+
// commands, subagents, and skills from the .kilo/ tree (project) + the XDG
|
|
672
|
+
// backend config dir ~/.config/kilo (user) — NOT the .kilocode/ VS Code
|
|
673
|
+
// extension legacy tree (which only carries legacy workflows). Verified against
|
|
674
|
+
// kilo.ai/docs/customize/{custom-subagents,workflows,skills} (2026-06-16):
|
|
675
|
+
// commands → <projectDir>/.kilo/commands | ~/.config/kilo/commands
|
|
676
|
+
// subagents → <projectDir>/.kilo/agents | ~/.config/kilo/agents
|
|
677
|
+
// skills → <projectDir>/.kilo/skills | ~/.kilo/skills (skills keep the
|
|
678
|
+
// ~/.kilo user root per the docs — surface-specific).
|
|
583
679
|
/** Skills root: project → <projectDir>/.kilo/skills; user → ~/.kilo/skills. */
|
|
584
680
|
skillsRootDir(ctx) {
|
|
585
681
|
return ctx.scope === "project" ? join(ctx.projectDir, ".kilo", "skills") : join(homedir(), ".kilo", "skills");
|
|
586
682
|
}
|
|
587
|
-
/** Commands root: project → <projectDir>/.
|
|
683
|
+
/** Commands root: project → <projectDir>/.kilo/commands; user → ~/.config/kilo/commands. */
|
|
588
684
|
commandsDir(ctx) {
|
|
589
|
-
return ctx.scope === "project" ? join(ctx.projectDir, ".
|
|
685
|
+
return ctx.scope === "project" ? join(ctx.projectDir, ".kilo", "commands") : join(kiloConfigDir(), "commands");
|
|
590
686
|
}
|
|
591
|
-
/** Subagents root: project → <projectDir>/.
|
|
687
|
+
/** Subagents root: project → <projectDir>/.kilo/agents; user → ~/.config/kilo/agents. */
|
|
592
688
|
agentsDir(ctx) {
|
|
593
|
-
return ctx.scope === "project" ? join(ctx.projectDir, ".
|
|
689
|
+
return ctx.scope === "project" ? join(ctx.projectDir, ".kilo", "agents") : join(kiloConfigDir(), "agents");
|
|
594
690
|
}
|
|
595
691
|
/** Native command file path: <commandsDir>/<name>.md. */
|
|
596
692
|
commandPath(ctx, name) {
|
|
@@ -849,4 +945,4 @@ export {
|
|
|
849
945
|
adapter,
|
|
850
946
|
kilo_default as default
|
|
851
947
|
};
|
|
852
|
-
//# sourceMappingURL=kilo-
|
|
948
|
+
//# sourceMappingURL=kilo-IX4T3OHJ.js.map
|