@ken-jo/agent-connector 0.4.75 → 0.4.91
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 +3 -3
- package/dist/{action-TCKBTTZX.js → action-L44DXFHT.js} +14 -14
- package/dist/{amazon-q-CB4XFX7T.js → amazon-q-B52EY2SV.js} +5 -5
- package/dist/{amp-6Q5OYHNW.js → amp-UXABVUKC.js} +5 -5
- package/dist/{antigravity-WIK3XBN5.js → antigravity-RZHN53VB.js} +6 -6
- package/dist/antigravity-cli-JO6GUTV7.js +436 -0
- package/dist/antigravity-cli-JO6GUTV7.js.map +1 -0
- package/dist/{chunk-Q5LECKZL.js → chunk-25CPWJA7.js} +116 -36
- package/dist/chunk-25CPWJA7.js.map +1 -0
- package/dist/{chunk-D6ZJS4ND.js → chunk-4FWETID5.js} +2 -2
- package/dist/{chunk-Q42SEI7W.js → chunk-4HVQ7IUM.js} +3 -3
- package/dist/{chunk-IU42THN7.js → chunk-4NSU3KWX.js} +2 -2
- package/dist/{chunk-7CZKXXBD.js → chunk-56R2ER7K.js} +2 -2
- package/dist/{chunk-HKM3HUOK.js → chunk-7HUUINPB.js} +18 -18
- package/dist/{chunk-TZ5KGCE2.js → chunk-AY3RGRTT.js} +2 -2
- package/dist/{chunk-MHDQWZ4A.js → chunk-BLTVZACS.js} +23 -13
- package/dist/chunk-BLTVZACS.js.map +1 -0
- package/dist/{chunk-7ITLLYWB.js → chunk-G4CEELKO.js} +5 -5
- package/dist/{chunk-TO57WYBB.js → chunk-HORHRHNG.js} +9 -3
- package/dist/chunk-HORHRHNG.js.map +1 -0
- package/dist/{chunk-2HCJV6UO.js → chunk-IXOQDZWC.js} +9 -2
- package/dist/chunk-IXOQDZWC.js.map +1 -0
- package/dist/{chunk-2L6LTQ6L.js → chunk-KIRCPLM4.js} +21 -10
- package/dist/chunk-KIRCPLM4.js.map +1 -0
- package/dist/{chunk-24K6JOKV.js → chunk-LAIITCMW.js} +8 -8
- package/dist/{chunk-OEQJGBBW.js → chunk-LF76VPGQ.js} +9 -9
- package/dist/{chunk-7QRUZAUG.js → chunk-LN76OGNR.js} +2 -2
- package/dist/{chunk-DI6OWKH2.js → chunk-NBUEL74R.js} +3 -3
- package/dist/{chunk-IRUYJD23.js → chunk-NLE2J5P4.js} +1 -1
- package/dist/{chunk-5LAFKXFM.js → chunk-NWLRJNXM.js} +3 -3
- package/dist/{chunk-ECSRTK4M.js → chunk-QARPXSIV.js} +4 -4
- package/dist/{chunk-AXAHW2KU.js → chunk-QKLJU4JX.js} +2 -2
- package/dist/{chunk-MDZG5QHB.js → chunk-R6LML2YS.js} +2 -2
- package/dist/{chunk-FUXUEXDP.js → chunk-UBB7T54N.js} +3 -3
- package/dist/{chunk-NUGMVVV2.js → chunk-VVFDU4IX.js} +4 -4
- package/dist/{chunk-ALVXORZM.js → chunk-YYNXIUR2.js} +2 -2
- package/dist/{chunk-TW4DVR4V.js → chunk-ZMLVR4J7.js} +7 -2
- package/dist/chunk-ZMLVR4J7.js.map +1 -0
- package/dist/{claude-code-HFBAAVWS.js → claude-code-WS4NAGZT.js} +9 -9
- package/dist/cli/sdk.js +7 -7
- package/dist/cli.js +1 -1
- package/dist/{cline-26W4FEZ6.js → cline-NNMVCECA.js} +5 -5
- package/dist/codebuddy-RBEZGXBG.js +643 -0
- package/dist/codebuddy-RBEZGXBG.js.map +1 -0
- package/dist/{codebuff-J5KEEBIL.js → codebuff-RJIDSEU3.js} +5 -5
- package/dist/{codex-JKQ6TLRI.js → codex-ZZ434GYR.js} +8 -8
- package/dist/{continue-KQSJUSWX.js → continue-MNM7YVJY.js} +6 -6
- package/dist/{copilot-cli-YBNKLYUB.js → copilot-cli-SMTX5F65.js} +5 -5
- package/dist/{crush-JTWTZIPB.js → crush-NYDBHIJE.js} +5 -5
- package/dist/{cursor-2NIZSDZ4.js → cursor-AOELDNZU.js} +6 -6
- package/dist/{detect-CWEIQCRC.js → detect-3S46RUMK.js} +4 -4
- package/dist/devin-PRJY2TTD.js +510 -0
- package/dist/devin-PRJY2TTD.js.map +1 -0
- package/dist/{doctor-AC437ZAW.js → doctor-3CUBPQKU.js} +22 -22
- package/dist/{droid-HF2AIFB2.js → droid-PTCH2K7Y.js} +5 -5
- package/dist/{gemini-cli-2EOK26S2.js → gemini-cli-QGLN2UMS.js} +5 -5
- package/dist/{goose-55JOTXS5.js → goose-DQ6GSZ5O.js} +6 -6
- package/dist/grok-cli-5QD235UB.js +482 -0
- package/dist/grok-cli-5QD235UB.js.map +1 -0
- package/dist/{hermes-QVZOZU4B.js → hermes-E47IG63A.js} +6 -6
- package/dist/{hook-VYD3OCLM.js → hook-P6EKDINW.js} +14 -14
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/{install-S6BYIJ62.js → install-7DMK53SB.js} +18 -18
- package/dist/{introspect-5o5ick0_.d.ts → introspect-DYOIX8Ov.d.ts} +1 -1
- package/dist/{jetbrains-copilot-DZ2ATXFN.js → jetbrains-copilot-T2EPKROP.js} +13 -7
- package/dist/jetbrains-copilot-T2EPKROP.js.map +1 -0
- package/dist/junie-SQ4SDLGK.js +227 -0
- package/dist/junie-SQ4SDLGK.js.map +1 -0
- package/dist/{kilo-GJNSBWVV.js → kilo-OU2ZLZKB.js} +8 -8
- package/dist/{kilo-cli-2CCB3DBI.js → kilo-cli-NMWGYF4F.js} +8 -8
- package/dist/{kimi-YRPCSB6N.js → kimi-Z7L2LEEI.js} +5 -5
- package/dist/{kiro-BUOQFASX.js → kiro-4IN5IH46.js} +81 -6
- package/dist/kiro-4IN5IH46.js.map +1 -0
- package/dist/{leaderboard-SUSUDKHR.js → leaderboard-LF5SP6X2.js} +7 -7
- package/dist/{mimo-code-V4FP5PUJ.js → mimo-code-G2CBZ4M6.js} +5 -5
- package/dist/mistral-vibe-TRQDHAWV.js +300 -0
- package/dist/mistral-vibe-TRQDHAWV.js.map +1 -0
- package/dist/{mux-CMJSM42O.js → mux-JNM3F2NW.js} +5 -5
- package/dist/{nemoclaw-VP56PGKC.js → nemoclaw-SHA4IUML.js} +6 -6
- package/dist/{omp-OOFGD3GG.js → omp-OOVUNXME.js} +5 -5
- package/dist/open-interpreter-4PKL56AA.js +264 -0
- package/dist/open-interpreter-4PKL56AA.js.map +1 -0
- package/dist/openclaw-BD56E5MV.js +17 -0
- package/dist/{opencode-MKLHSQRD.js → opencode-W2RK4M7G.js} +5 -5
- package/dist/openhands-5LNH3BKB.js +384 -0
- package/dist/openhands-5LNH3BKB.js.map +1 -0
- package/dist/{package-KOAAVKHH.js → package-2EAIYSJ4.js} +13 -13
- package/dist/{pi-NMVL7OFL.js → pi-BUADR5MJ.js} +143 -6
- package/dist/pi-BUADR5MJ.js.map +1 -0
- package/dist/{qwen-code-2XE2T6F4.js → qwen-code-TUJNHKNI.js} +9 -9
- package/dist/{roo-code-YJOIKCCS.js → roo-code-L5F7S6QH.js} +5 -5
- package/dist/runtime/index.d.ts +12 -1
- package/dist/runtime/index.js +12 -12
- package/dist/sdk/index.d.ts +3 -3
- package/dist/sdk/index.js +6 -6
- package/dist/sdk/test.d.ts +2 -2
- package/dist/sdk/test.js +10 -10
- package/dist/{serve-BU23QUSJ.js → serve-K62FW3V7.js} +24 -17
- package/dist/serve-K62FW3V7.js.map +1 -0
- package/dist/{status-N5LCQQ3R.js → status-E5MCFZM6.js} +11 -11
- package/dist/{statusline-442XOF7R.js → statusline-LIPF2KVP.js} +13 -13
- package/dist/{telemetry-V4YQL2NU.js → telemetry-4OC56NTM.js} +10 -10
- package/dist/{trae-QSV2JZFT.js → trae-Z7CQ2A2Q.js} +5 -5
- package/dist/{types-D6RWGXm1.d.ts → types-C4qMgbJn.d.ts} +10 -9
- package/dist/{uninstall-WGEKTCDZ.js → uninstall-2YYKN5DX.js} +18 -18
- package/dist/{upgrade-IH7CKPTO.js → upgrade-55AFPJEF.js} +18 -18
- package/dist/{usage-DI7XRCKM.js → usage-3PB3WZSL.js} +3 -3
- package/dist/{usage-event-2FCU55AN.js → usage-event-KD5FW6W4.js} +13 -13
- package/dist/{vscode-copilot-R23RTVST.js → vscode-copilot-LU5NC4ZS.js} +5 -5
- package/dist/{warp-B72XSQ5G.js → warp-4PPG5LOM.js} +5 -5
- package/dist/{windsurf-642VBMQ2.js → windsurf-3T3RVXKM.js} +5 -5
- package/dist/{zed-6UJS7JKB.js → zed-ZF2OQ75O.js} +123 -7
- package/dist/zed-ZF2OQ75O.js.map +1 -0
- package/package.json +1 -1
- package/dist/antigravity-cli-L3RZMF6V.js +0 -87
- package/dist/antigravity-cli-L3RZMF6V.js.map +0 -1
- package/dist/chunk-2HCJV6UO.js.map +0 -1
- package/dist/chunk-2L6LTQ6L.js.map +0 -1
- package/dist/chunk-MHDQWZ4A.js.map +0 -1
- package/dist/chunk-Q5LECKZL.js.map +0 -1
- package/dist/chunk-TO57WYBB.js.map +0 -1
- package/dist/chunk-TW4DVR4V.js.map +0 -1
- package/dist/jetbrains-copilot-DZ2ATXFN.js.map +0 -1
- package/dist/kiro-BUOQFASX.js.map +0 -1
- package/dist/openclaw-V73XHPXP.js +0 -17
- package/dist/pi-NMVL7OFL.js.map +0 -1
- package/dist/serve-BU23QUSJ.js.map +0 -1
- package/dist/zed-6UJS7JKB.js.map +0 -1
- /package/dist/{action-TCKBTTZX.js.map → action-L44DXFHT.js.map} +0 -0
- /package/dist/{amazon-q-CB4XFX7T.js.map → amazon-q-B52EY2SV.js.map} +0 -0
- /package/dist/{amp-6Q5OYHNW.js.map → amp-UXABVUKC.js.map} +0 -0
- /package/dist/{antigravity-WIK3XBN5.js.map → antigravity-RZHN53VB.js.map} +0 -0
- /package/dist/{chunk-D6ZJS4ND.js.map → chunk-4FWETID5.js.map} +0 -0
- /package/dist/{chunk-Q42SEI7W.js.map → chunk-4HVQ7IUM.js.map} +0 -0
- /package/dist/{chunk-IU42THN7.js.map → chunk-4NSU3KWX.js.map} +0 -0
- /package/dist/{chunk-7CZKXXBD.js.map → chunk-56R2ER7K.js.map} +0 -0
- /package/dist/{chunk-HKM3HUOK.js.map → chunk-7HUUINPB.js.map} +0 -0
- /package/dist/{chunk-TZ5KGCE2.js.map → chunk-AY3RGRTT.js.map} +0 -0
- /package/dist/{chunk-7ITLLYWB.js.map → chunk-G4CEELKO.js.map} +0 -0
- /package/dist/{chunk-24K6JOKV.js.map → chunk-LAIITCMW.js.map} +0 -0
- /package/dist/{chunk-OEQJGBBW.js.map → chunk-LF76VPGQ.js.map} +0 -0
- /package/dist/{chunk-7QRUZAUG.js.map → chunk-LN76OGNR.js.map} +0 -0
- /package/dist/{chunk-DI6OWKH2.js.map → chunk-NBUEL74R.js.map} +0 -0
- /package/dist/{chunk-IRUYJD23.js.map → chunk-NLE2J5P4.js.map} +0 -0
- /package/dist/{chunk-5LAFKXFM.js.map → chunk-NWLRJNXM.js.map} +0 -0
- /package/dist/{chunk-ECSRTK4M.js.map → chunk-QARPXSIV.js.map} +0 -0
- /package/dist/{chunk-AXAHW2KU.js.map → chunk-QKLJU4JX.js.map} +0 -0
- /package/dist/{chunk-MDZG5QHB.js.map → chunk-R6LML2YS.js.map} +0 -0
- /package/dist/{chunk-FUXUEXDP.js.map → chunk-UBB7T54N.js.map} +0 -0
- /package/dist/{chunk-NUGMVVV2.js.map → chunk-VVFDU4IX.js.map} +0 -0
- /package/dist/{chunk-ALVXORZM.js.map → chunk-YYNXIUR2.js.map} +0 -0
- /package/dist/{claude-code-HFBAAVWS.js.map → claude-code-WS4NAGZT.js.map} +0 -0
- /package/dist/{cline-26W4FEZ6.js.map → cline-NNMVCECA.js.map} +0 -0
- /package/dist/{codebuff-J5KEEBIL.js.map → codebuff-RJIDSEU3.js.map} +0 -0
- /package/dist/{codex-JKQ6TLRI.js.map → codex-ZZ434GYR.js.map} +0 -0
- /package/dist/{continue-KQSJUSWX.js.map → continue-MNM7YVJY.js.map} +0 -0
- /package/dist/{copilot-cli-YBNKLYUB.js.map → copilot-cli-SMTX5F65.js.map} +0 -0
- /package/dist/{crush-JTWTZIPB.js.map → crush-NYDBHIJE.js.map} +0 -0
- /package/dist/{cursor-2NIZSDZ4.js.map → cursor-AOELDNZU.js.map} +0 -0
- /package/dist/{detect-CWEIQCRC.js.map → detect-3S46RUMK.js.map} +0 -0
- /package/dist/{doctor-AC437ZAW.js.map → doctor-3CUBPQKU.js.map} +0 -0
- /package/dist/{droid-HF2AIFB2.js.map → droid-PTCH2K7Y.js.map} +0 -0
- /package/dist/{gemini-cli-2EOK26S2.js.map → gemini-cli-QGLN2UMS.js.map} +0 -0
- /package/dist/{goose-55JOTXS5.js.map → goose-DQ6GSZ5O.js.map} +0 -0
- /package/dist/{hermes-QVZOZU4B.js.map → hermes-E47IG63A.js.map} +0 -0
- /package/dist/{hook-VYD3OCLM.js.map → hook-P6EKDINW.js.map} +0 -0
- /package/dist/{install-S6BYIJ62.js.map → install-7DMK53SB.js.map} +0 -0
- /package/dist/{kilo-GJNSBWVV.js.map → kilo-OU2ZLZKB.js.map} +0 -0
- /package/dist/{kilo-cli-2CCB3DBI.js.map → kilo-cli-NMWGYF4F.js.map} +0 -0
- /package/dist/{kimi-YRPCSB6N.js.map → kimi-Z7L2LEEI.js.map} +0 -0
- /package/dist/{leaderboard-SUSUDKHR.js.map → leaderboard-LF5SP6X2.js.map} +0 -0
- /package/dist/{mimo-code-V4FP5PUJ.js.map → mimo-code-G2CBZ4M6.js.map} +0 -0
- /package/dist/{mux-CMJSM42O.js.map → mux-JNM3F2NW.js.map} +0 -0
- /package/dist/{nemoclaw-VP56PGKC.js.map → nemoclaw-SHA4IUML.js.map} +0 -0
- /package/dist/{omp-OOFGD3GG.js.map → omp-OOVUNXME.js.map} +0 -0
- /package/dist/{openclaw-V73XHPXP.js.map → openclaw-BD56E5MV.js.map} +0 -0
- /package/dist/{opencode-MKLHSQRD.js.map → opencode-W2RK4M7G.js.map} +0 -0
- /package/dist/{package-KOAAVKHH.js.map → package-2EAIYSJ4.js.map} +0 -0
- /package/dist/{qwen-code-2XE2T6F4.js.map → qwen-code-TUJNHKNI.js.map} +0 -0
- /package/dist/{roo-code-YJOIKCCS.js.map → roo-code-L5F7S6QH.js.map} +0 -0
- /package/dist/{status-N5LCQQ3R.js.map → status-E5MCFZM6.js.map} +0 -0
- /package/dist/{statusline-442XOF7R.js.map → statusline-LIPF2KVP.js.map} +0 -0
- /package/dist/{telemetry-V4YQL2NU.js.map → telemetry-4OC56NTM.js.map} +0 -0
- /package/dist/{trae-QSV2JZFT.js.map → trae-Z7CQ2A2Q.js.map} +0 -0
- /package/dist/{uninstall-WGEKTCDZ.js.map → uninstall-2YYKN5DX.js.map} +0 -0
- /package/dist/{upgrade-IH7CKPTO.js.map → upgrade-55AFPJEF.js.map} +0 -0
- /package/dist/{usage-DI7XRCKM.js.map → usage-3PB3WZSL.js.map} +0 -0
- /package/dist/{usage-event-2FCU55AN.js.map → usage-event-KD5FW6W4.js.map} +0 -0
- /package/dist/{vscode-copilot-R23RTVST.js.map → vscode-copilot-LU5NC4ZS.js.map} +0 -0
- /package/dist/{warp-B72XSQ5G.js.map → warp-4PPG5LOM.js.map} +0 -0
- /package/dist/{windsurf-642VBMQ2.js.map → windsurf-3T3RVXKM.js.map} +0 -0
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
normalizeSessionSource
|
|
4
|
+
} from "./chunk-H53QZQJI.js";
|
|
5
|
+
import {
|
|
6
|
+
rewriteEnvRefs
|
|
7
|
+
} from "./chunk-BEFVJ2OE.js";
|
|
8
|
+
import {
|
|
9
|
+
BaseAdapter
|
|
10
|
+
} from "./chunk-VVFDU4IX.js";
|
|
11
|
+
import {
|
|
12
|
+
buildWrappedStdio,
|
|
13
|
+
isHomeBinHookCommand
|
|
14
|
+
} from "./chunk-HORHRHNG.js";
|
|
15
|
+
import "./chunk-YYNXIUR2.js";
|
|
16
|
+
import "./chunk-IXOQDZWC.js";
|
|
17
|
+
|
|
18
|
+
// src/adapters/devin/index.ts
|
|
19
|
+
import { existsSync } from "fs";
|
|
20
|
+
import { homedir, platform as osPlatform } from "os";
|
|
21
|
+
import { join } from "path";
|
|
22
|
+
var HOST = "devin";
|
|
23
|
+
var MCP_ROOT_KEY = "mcpServers";
|
|
24
|
+
function devinUserConfigDir() {
|
|
25
|
+
if (osPlatform() === "win32") {
|
|
26
|
+
const appData = process.env.APPDATA ?? join(homedir(), "AppData", "Roaming");
|
|
27
|
+
return join(appData, "devin");
|
|
28
|
+
}
|
|
29
|
+
return join(homedir(), ".config", "devin");
|
|
30
|
+
}
|
|
31
|
+
var SUPPORTED_EVENTS = /* @__PURE__ */ new Set([
|
|
32
|
+
"PreToolUse",
|
|
33
|
+
"PostToolUse",
|
|
34
|
+
"PermissionRequest",
|
|
35
|
+
"UserPromptSubmit",
|
|
36
|
+
"Stop",
|
|
37
|
+
"PostCompact",
|
|
38
|
+
"SessionStart",
|
|
39
|
+
"SessionEnd"
|
|
40
|
+
]);
|
|
41
|
+
var DEVIN_POSTCOMPACT = "PostCompaction";
|
|
42
|
+
var DevinAdapter = class extends BaseAdapter {
|
|
43
|
+
id = HOST;
|
|
44
|
+
name = "Devin CLI (Cognition)";
|
|
45
|
+
paradigm = "json-stdio";
|
|
46
|
+
capabilities = {
|
|
47
|
+
// Memory surface: AGENTS.md-first managed block — project <projectDir>/AGENTS.md
|
|
48
|
+
// via the base default; user scope → ~/.config/devin/AGENTS.md (override below).
|
|
49
|
+
// Devin reads AGENTS.md / AGENT.md / CLAUDE.md identically as always-on rules
|
|
50
|
+
// (docs.devin.ai/cli/extensibility/rules).
|
|
51
|
+
supportsMemory: true,
|
|
52
|
+
preToolUse: true,
|
|
53
|
+
postToolUse: true,
|
|
54
|
+
userPromptSubmit: true,
|
|
55
|
+
stop: true,
|
|
56
|
+
sessionStart: true,
|
|
57
|
+
sessionEnd: true,
|
|
58
|
+
// PermissionRequest is a documented Devin hook event (decision-capable).
|
|
59
|
+
permissionRequest: true,
|
|
60
|
+
// PostCompaction (canonical PostCompact) — observe-only post-compaction hook.
|
|
61
|
+
postCompact: true,
|
|
62
|
+
// Devin documents NO Notification / PreCompact / SubagentStart / SubagentStop /
|
|
63
|
+
// PostToolUseFailure event — those stay unset (install reports the skip-warn).
|
|
64
|
+
notification: false,
|
|
65
|
+
preCompact: false,
|
|
66
|
+
// Devin's PreToolUse/PermissionRequest can block/deny via the simple
|
|
67
|
+
// {decision} reply, but it documents no tool-arg/-output rewrite and no
|
|
68
|
+
// context-injection reply channel.
|
|
69
|
+
canModifyArgs: false,
|
|
70
|
+
canModifyOutput: false,
|
|
71
|
+
canInjectSessionContext: false,
|
|
72
|
+
// Devin registers stdio and remote MCP servers. Remote is Streamable HTTP
|
|
73
|
+
// ("http", the URL default) with a legacy "sse" fallback — both map to our
|
|
74
|
+
// remote-transport handling; advertise both.
|
|
75
|
+
transports: ["stdio", "http", "sse"],
|
|
76
|
+
// Devin natively interpolates ${env:VAR} / ${file:/path} in secret-bearing
|
|
77
|
+
// server fields, so the token survives into the host config (pass-through).
|
|
78
|
+
nativeServerEnvInterpolation: true,
|
|
79
|
+
// Content surfaces. Devin reads Agent Skills from its `.devin` config tree
|
|
80
|
+
// at <configDir>/skills/<name>/SKILL.md — the SKILL.md format + frontmatter
|
|
81
|
+
// are byte-confirmed (docs.devin.ai/cli/extensibility/skills/creating-skills),
|
|
82
|
+
// so skills IS wired.
|
|
83
|
+
supportsSkills: true
|
|
84
|
+
// Devin ALSO documents native slash commands (/cli/reference/commands) and
|
|
85
|
+
// subagents (/cli/subagents), but their exact on-disk dir names are NOT
|
|
86
|
+
// byte-confirmed from a first-party config reference — to avoid fabricating a
|
|
87
|
+
// path, commands/subagents stay unset (BaseAdapter skip-warn) in v1. See the
|
|
88
|
+
// module header CEILING note.
|
|
89
|
+
};
|
|
90
|
+
// ── Detection ────────────────────────────────────────────────────────────
|
|
91
|
+
detectInstalled(projectDir) {
|
|
92
|
+
const userDir = devinUserConfigDir();
|
|
93
|
+
const userCfg = join(userDir, "config.json");
|
|
94
|
+
const projDir = join(projectDir, ".devin");
|
|
95
|
+
const projCfg = join(projDir, "config.json");
|
|
96
|
+
const binMarker = join(homedir(), ".local", "bin", "devin");
|
|
97
|
+
const userInstalled = existsSync(userDir) || existsSync(userCfg) || existsSync(binMarker);
|
|
98
|
+
const projInstalled = existsSync(projDir) || existsSync(projCfg);
|
|
99
|
+
const installed = userInstalled || projInstalled;
|
|
100
|
+
const scope = projInstalled && !userInstalled ? "project" : "user";
|
|
101
|
+
const configPath = scope === "project" ? projCfg : userCfg;
|
|
102
|
+
return {
|
|
103
|
+
id: this.id,
|
|
104
|
+
name: this.name,
|
|
105
|
+
installed,
|
|
106
|
+
paradigm: this.paradigm,
|
|
107
|
+
capabilities: this.capabilities,
|
|
108
|
+
configPath,
|
|
109
|
+
scope,
|
|
110
|
+
reason: installed ? `found Devin CLI config (${scope}) at ${configPath}` : `no Devin CLI config at ${userDir} or ${projDir}`,
|
|
111
|
+
confidence: installed ? "high" : "low"
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
// ── Native paths ─────────────────────────────────────────────────────────
|
|
115
|
+
getConfigDir(ctx) {
|
|
116
|
+
return ctx.scope === "project" ? join(ctx.projectDir, ".devin") : devinUserConfigDir();
|
|
117
|
+
}
|
|
118
|
+
getServerConfigPath(ctx) {
|
|
119
|
+
return join(this.getConfigDir(ctx), "config.json");
|
|
120
|
+
}
|
|
121
|
+
/** Hooks live under the `"hooks"` key in the SAME config.json. */
|
|
122
|
+
getHookConfigPath(ctx) {
|
|
123
|
+
return this.getServerConfigPath(ctx);
|
|
124
|
+
}
|
|
125
|
+
// ── Memory surface: user-scope AGENTS.md ─────────────────────────────────
|
|
126
|
+
// Project scope rides on the AGENTS.md base default (project root). User scope
|
|
127
|
+
// targets ~/.config/devin/AGENTS.md (%APPDATA%\devin\AGENTS.md on Windows) —
|
|
128
|
+
// Devin's documented global-rules file (docs.devin.ai/cli/extensibility/rules).
|
|
129
|
+
memoryTargets(ctx) {
|
|
130
|
+
if (this.memoryOverride(ctx)?.path || ctx.scope !== "user") {
|
|
131
|
+
return super.memoryTargets(ctx);
|
|
132
|
+
}
|
|
133
|
+
return [
|
|
134
|
+
{
|
|
135
|
+
path: join(devinUserConfigDir(), "AGENTS.md"),
|
|
136
|
+
reason: "Devin CLI global rules file (~/.config/devin/AGENTS.md)"
|
|
137
|
+
}
|
|
138
|
+
];
|
|
139
|
+
}
|
|
140
|
+
// ── MCP server install / uninstall ───────────────────────────────────────
|
|
141
|
+
installServer(ctx) {
|
|
142
|
+
const { connector } = ctx;
|
|
143
|
+
const override = connector.platforms[HOST]?.server;
|
|
144
|
+
if (!connector.server || override === false) {
|
|
145
|
+
return [
|
|
146
|
+
{
|
|
147
|
+
platform: this.id,
|
|
148
|
+
action: "skip",
|
|
149
|
+
detail: connector.server ? "server registration disabled for devin" : "connector declares no MCP server"
|
|
150
|
+
}
|
|
151
|
+
];
|
|
152
|
+
}
|
|
153
|
+
const server = override && typeof override === "object" ? { ...connector.server, ...override } : connector.server;
|
|
154
|
+
const serverPath = this.getServerConfigPath(ctx);
|
|
155
|
+
const entry = this.renderServerEntry(ctx, server);
|
|
156
|
+
return [
|
|
157
|
+
this.upsertServerInJson(serverPath, MCP_ROOT_KEY, connector.id, entry, ctx.dryRun)
|
|
158
|
+
];
|
|
159
|
+
}
|
|
160
|
+
uninstallServer(ctx) {
|
|
161
|
+
const serverPath = this.getServerConfigPath(ctx);
|
|
162
|
+
return [
|
|
163
|
+
this.removeServerFromJson(serverPath, MCP_ROOT_KEY, ctx.connector.id, ctx.dryRun)
|
|
164
|
+
];
|
|
165
|
+
}
|
|
166
|
+
/** Render a normalized ServerDef into Devin's native mcpServers entry. */
|
|
167
|
+
renderServerEntry(ctx, server) {
|
|
168
|
+
const transport = server.transport;
|
|
169
|
+
if (transport === "stdio") {
|
|
170
|
+
let command = server.command ?? "";
|
|
171
|
+
let args = [...server.args ?? []];
|
|
172
|
+
({ command, args } = buildWrappedStdio(ctx, server, this.id, command, args));
|
|
173
|
+
const entry2 = { command };
|
|
174
|
+
if (args.length > 0) entry2.args = args;
|
|
175
|
+
const env = this.renderEnv(server.env);
|
|
176
|
+
if (env) entry2.env = env;
|
|
177
|
+
return entry2;
|
|
178
|
+
}
|
|
179
|
+
const entry = {
|
|
180
|
+
url: rewriteEnvRefs(server.url ?? "", devinEnvToken)
|
|
181
|
+
};
|
|
182
|
+
if (transport === "sse") entry.transport = "sse";
|
|
183
|
+
const headers = this.renderEnv(server.headers);
|
|
184
|
+
if (headers) entry.headers = headers;
|
|
185
|
+
return entry;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Render env/header values. Devin interpolates ${env:VAR} natively, so each
|
|
189
|
+
* ${env:VAR} token is passed THROUGH (rewriteEnvRefs/devinEnvToken) rather
|
|
190
|
+
* than baked to a literal — secrets never land in the committed config.
|
|
191
|
+
*/
|
|
192
|
+
renderEnv(env) {
|
|
193
|
+
if (!env || Object.keys(env).length === 0) return void 0;
|
|
194
|
+
const out = {};
|
|
195
|
+
for (const [k, v] of Object.entries(env)) {
|
|
196
|
+
out[k] = rewriteEnvRefs(v, devinEnvToken);
|
|
197
|
+
}
|
|
198
|
+
return out;
|
|
199
|
+
}
|
|
200
|
+
// ── Hook install / uninstall (config.json "hooks" key, nested-rule shape) ──
|
|
201
|
+
installHooks(ctx) {
|
|
202
|
+
const { connector } = ctx;
|
|
203
|
+
if (connector.platforms[HOST]?.hooks === false) {
|
|
204
|
+
return [{ platform: this.id, action: "skip", detail: "hooks disabled for devin" }];
|
|
205
|
+
}
|
|
206
|
+
if (connector.hookEvents.length === 0) {
|
|
207
|
+
return [{ platform: this.id, action: "skip", detail: "connector declares no hooks" }];
|
|
208
|
+
}
|
|
209
|
+
const pending = connector.hookEvents.map((event) => ({
|
|
210
|
+
event,
|
|
211
|
+
matcher: connector.hooks[event]?.matcher ?? ""
|
|
212
|
+
}));
|
|
213
|
+
return this.upsertHookEntries(
|
|
214
|
+
ctx,
|
|
215
|
+
this.getHookConfigPath(ctx),
|
|
216
|
+
pending,
|
|
217
|
+
this.hookDescriptor(ctx)
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
uninstallHooks(ctx) {
|
|
221
|
+
return this.removeHookEntries(ctx, this.getHookConfigPath(ctx), this.hookDescriptor(ctx));
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Devin's hook-merge descriptor (NESTED shape `{ matcher, hooks: [...] }`).
|
|
225
|
+
* Bound to `ctx` because Devin's ownership is CONNECTOR-GENERIC (ANY of our
|
|
226
|
+
* commands in the entry's inner `hooks`):
|
|
227
|
+
* - mapEvent = drop events outside SUPPORTED_EVENTS; the canonical
|
|
228
|
+
* PostCompact is rewritten to Devin's on-wire "PostCompaction" key while
|
|
229
|
+
* all other supported events map 1:1.
|
|
230
|
+
* - entryOwnsCommand reuses isOurCommand over the inner commands.
|
|
231
|
+
* - uninstall = inner-strip ONLY (ownsEntryForRemove never-true).
|
|
232
|
+
*/
|
|
233
|
+
hookDescriptor(ctx) {
|
|
234
|
+
return {
|
|
235
|
+
mapEvent: (e) => {
|
|
236
|
+
if (!SUPPORTED_EVENTS.has(e)) return void 0;
|
|
237
|
+
return e === "PostCompact" ? DEVIN_POSTCOMPACT : e;
|
|
238
|
+
},
|
|
239
|
+
unmappedWarnDetail: (e) => `${e} has no Devin hook equivalent \u2014 skipped`,
|
|
240
|
+
renderEntry: (_event, matcher, command) => ({
|
|
241
|
+
matcher,
|
|
242
|
+
hooks: [{ type: "command", command }]
|
|
243
|
+
}),
|
|
244
|
+
entryOwnsCommand: (entry, _command) => (entry.hooks ?? []).some((h) => this.isOurCommand(h.command, ctx)),
|
|
245
|
+
ownsEntryForRemove: () => () => false,
|
|
246
|
+
stripInner: (c) => (entry) => {
|
|
247
|
+
const innerBefore = entry.hooks?.length ?? 0;
|
|
248
|
+
const inner = (entry.hooks ?? []).filter((h) => !this.isOurCommand(h.command, c));
|
|
249
|
+
return {
|
|
250
|
+
next: inner.length > 0 ? { matcher: entry.matcher ?? "", hooks: inner } : null,
|
|
251
|
+
removed: innerBefore - inner.length
|
|
252
|
+
};
|
|
253
|
+
},
|
|
254
|
+
skipDetail: (event) => `hooks.${event} already registered`,
|
|
255
|
+
removeDetail: (event, removed) => `hooks.${event} (${removed})`,
|
|
256
|
+
absentDetail: "no hooks section present",
|
|
257
|
+
noMatchDetail: "no matching hook entries"
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
/** True when a hook command references our home binary AND this connector id
|
|
261
|
+
* (anchored so a shared-prefix id can't collide — see isHomeBinHookCommand). */
|
|
262
|
+
isOurCommand(command, ctx) {
|
|
263
|
+
return isHomeBinHookCommand(command, ctx.homeBinPath, ctx.connector.id);
|
|
264
|
+
}
|
|
265
|
+
// ── Content surfaces: skills ──────────────────────────────────────────────
|
|
266
|
+
// CEILING (v1): only the byte-confirmed SKILL.md layout is wired. Devin
|
|
267
|
+
// documents the SKILL.md format + frontmatter
|
|
268
|
+
// (docs.devin.ai/cli/extensibility/skills/creating-skills) under the `.devin`
|
|
269
|
+
// tree (<configDir>/skills/<name>/SKILL.md). Commands/subagents on-disk dir
|
|
270
|
+
// names are NOT byte-confirmed from a first-party config reference, so they
|
|
271
|
+
// stay on the BaseAdapter skip-warn rather than guessing a path.
|
|
272
|
+
/** Native skill dir: <configDir>/skills/<name>. */
|
|
273
|
+
skillDir(ctx, name) {
|
|
274
|
+
return join(this.getConfigDir(ctx), "skills", name);
|
|
275
|
+
}
|
|
276
|
+
installSkills(ctx) {
|
|
277
|
+
const { connector } = ctx;
|
|
278
|
+
if (connector.platforms[HOST]?.skills === false) {
|
|
279
|
+
return [{ platform: this.id, action: "skip", detail: "skills disabled for devin" }];
|
|
280
|
+
}
|
|
281
|
+
if (connector.skills.length === 0) {
|
|
282
|
+
return [{ platform: this.id, action: "skip", detail: "connector declares no skills" }];
|
|
283
|
+
}
|
|
284
|
+
const changes = [];
|
|
285
|
+
for (const skill of connector.skills) {
|
|
286
|
+
const dir = this.skillDir(ctx, skill.name);
|
|
287
|
+
changes.push(
|
|
288
|
+
this.writeContentFile(join(dir, "SKILL.md"), this.renderSkill(skill), ctx.dryRun)
|
|
289
|
+
);
|
|
290
|
+
for (const [rel, contents] of Object.entries(skill.resources ?? {})) {
|
|
291
|
+
const target = this.resolveWithin(dir, rel);
|
|
292
|
+
if (target === null) {
|
|
293
|
+
changes.push({
|
|
294
|
+
platform: this.id,
|
|
295
|
+
action: "warn",
|
|
296
|
+
detail: `skill resource "${rel}" escapes the skill dir; skipped`
|
|
297
|
+
});
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
changes.push(this.writeContentFile(target, contents, ctx.dryRun));
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
return changes;
|
|
304
|
+
}
|
|
305
|
+
uninstallSkills(ctx) {
|
|
306
|
+
const { connector } = ctx;
|
|
307
|
+
if (connector.skills.length === 0) {
|
|
308
|
+
return [{ platform: this.id, action: "skip", detail: "connector declares no skills" }];
|
|
309
|
+
}
|
|
310
|
+
const changes = [];
|
|
311
|
+
for (const skill of connector.skills) {
|
|
312
|
+
const dir = this.skillDir(ctx, skill.name);
|
|
313
|
+
changes.push(this.removeContentFile(join(dir, "SKILL.md"), ctx.dryRun));
|
|
314
|
+
for (const rel of Object.keys(skill.resources ?? {})) {
|
|
315
|
+
const target = this.resolveWithin(dir, rel);
|
|
316
|
+
if (target === null) continue;
|
|
317
|
+
changes.push(this.removeContentFile(target, ctx.dryRun));
|
|
318
|
+
}
|
|
319
|
+
changes.push(this.removeDirIfEmpty(dir, ctx.dryRun));
|
|
320
|
+
}
|
|
321
|
+
return changes;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Render a skill's SKILL.md: frontmatter (name, description) + body. Devin's
|
|
325
|
+
* SKILL.md frontmatter documents name/description; extra keys pass through
|
|
326
|
+
* verbatim. No model/allowed-tools skill field is emitted.
|
|
327
|
+
*/
|
|
328
|
+
renderSkill(skill) {
|
|
329
|
+
const frontmatter = {
|
|
330
|
+
name: skill.name,
|
|
331
|
+
description: skill.description
|
|
332
|
+
};
|
|
333
|
+
if (skill.extra) Object.assign(frontmatter, skill.extra);
|
|
334
|
+
return this.renderFrontmatterMd(frontmatter, skill.body);
|
|
335
|
+
}
|
|
336
|
+
// ── Diagnostics ──────────────────────────────────────────────────────────
|
|
337
|
+
getHealthChecks(ctx) {
|
|
338
|
+
const cfgPath = this.getServerConfigPath(ctx);
|
|
339
|
+
const connectorId = ctx.connector.id;
|
|
340
|
+
const homeBin = ctx.homeBinPath;
|
|
341
|
+
const hookEvents = ctx.connector.hookEvents;
|
|
342
|
+
return [
|
|
343
|
+
{
|
|
344
|
+
name: `${this.name}: config.json present`,
|
|
345
|
+
check: () => existsSync(cfgPath) ? { status: "OK", detail: cfgPath } : { status: "FAIL", detail: `not found: ${cfgPath}` }
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
name: `${this.name}: server entry registered`,
|
|
349
|
+
check: () => {
|
|
350
|
+
if (!ctx.connector.server) {
|
|
351
|
+
return { status: "OK", detail: "no MCP server declared" };
|
|
352
|
+
}
|
|
353
|
+
const cfg = this.readJson(cfgPath);
|
|
354
|
+
const bucket = cfg?.[MCP_ROOT_KEY];
|
|
355
|
+
if (!cfg || !bucket) {
|
|
356
|
+
return { status: "FAIL", detail: `no ${MCP_ROOT_KEY} in ${cfgPath}` };
|
|
357
|
+
}
|
|
358
|
+
return connectorId in bucket ? { status: "OK", detail: `${MCP_ROOT_KEY}.${connectorId} present` } : {
|
|
359
|
+
status: "FAIL",
|
|
360
|
+
detail: `no ${MCP_ROOT_KEY}.${connectorId} in ${cfgPath}`
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
name: `${this.name}: hook command registered`,
|
|
366
|
+
check: () => {
|
|
367
|
+
if (hookEvents.length === 0) {
|
|
368
|
+
return { status: "OK", detail: "no hooks declared" };
|
|
369
|
+
}
|
|
370
|
+
const file = this.readJson(cfgPath);
|
|
371
|
+
if (!file) return { status: "FAIL", detail: `cannot read ${cfgPath}` };
|
|
372
|
+
const hooks = file.hooks ?? {};
|
|
373
|
+
const registered = Object.values(hooks).some(
|
|
374
|
+
(entries) => (entries ?? []).some(
|
|
375
|
+
(e) => (e.hooks ?? []).some(
|
|
376
|
+
(h) => isHomeBinHookCommand(h.command, homeBin, connectorId)
|
|
377
|
+
)
|
|
378
|
+
)
|
|
379
|
+
);
|
|
380
|
+
return registered ? { status: "OK", detail: "hook command present" } : { status: "FAIL", detail: `no hook for ${connectorId} in ${cfgPath}` };
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
];
|
|
384
|
+
}
|
|
385
|
+
// ── Runtime: parse Devin stdin JSON → normalized event ─────────────────────
|
|
386
|
+
parseEvent(event, raw) {
|
|
387
|
+
const input = raw ?? {};
|
|
388
|
+
const connectorId = typeof input.connector === "string" ? input.connector : "";
|
|
389
|
+
const sessionId = typeof input.session_id === "string" ? input.session_id : "";
|
|
390
|
+
const projectDir = typeof input.cwd === "string" ? input.cwd : void 0;
|
|
391
|
+
const base = {
|
|
392
|
+
hostPlatform: HOST,
|
|
393
|
+
connectorId,
|
|
394
|
+
sessionId,
|
|
395
|
+
raw,
|
|
396
|
+
...projectDir !== void 0 ? { projectDir } : {}
|
|
397
|
+
};
|
|
398
|
+
switch (event) {
|
|
399
|
+
case "PreToolUse": {
|
|
400
|
+
const ev = {
|
|
401
|
+
...base,
|
|
402
|
+
toolName: input.tool_name ?? "",
|
|
403
|
+
toolInput: input.tool_input ?? {}
|
|
404
|
+
};
|
|
405
|
+
return ev;
|
|
406
|
+
}
|
|
407
|
+
case "PostToolUse": {
|
|
408
|
+
const ev = {
|
|
409
|
+
...base,
|
|
410
|
+
toolName: input.tool_name ?? "",
|
|
411
|
+
toolInput: input.tool_input ?? {},
|
|
412
|
+
...toolResponseToString(input.tool_response) !== void 0 ? { toolOutput: toolResponseToString(input.tool_response) } : {}
|
|
413
|
+
};
|
|
414
|
+
return ev;
|
|
415
|
+
}
|
|
416
|
+
case "PermissionRequest": {
|
|
417
|
+
const ev = {
|
|
418
|
+
...base,
|
|
419
|
+
toolName: input.tool_name ?? "",
|
|
420
|
+
toolInput: input.tool_input ?? {}
|
|
421
|
+
};
|
|
422
|
+
return ev;
|
|
423
|
+
}
|
|
424
|
+
case "UserPromptSubmit": {
|
|
425
|
+
const ev = {
|
|
426
|
+
...base,
|
|
427
|
+
prompt: typeof input.prompt === "string" ? input.prompt : ""
|
|
428
|
+
};
|
|
429
|
+
return ev;
|
|
430
|
+
}
|
|
431
|
+
case "Stop": {
|
|
432
|
+
const ev = {
|
|
433
|
+
...base,
|
|
434
|
+
...typeof input.stop_hook_active === "boolean" ? { stopHookActive: input.stop_hook_active } : {}
|
|
435
|
+
};
|
|
436
|
+
return ev;
|
|
437
|
+
}
|
|
438
|
+
case "PostCompact": {
|
|
439
|
+
const ev = { ...base };
|
|
440
|
+
return ev;
|
|
441
|
+
}
|
|
442
|
+
case "SessionStart": {
|
|
443
|
+
const ev = {
|
|
444
|
+
...base,
|
|
445
|
+
source: normalizeSessionSource(input.source)
|
|
446
|
+
};
|
|
447
|
+
return ev;
|
|
448
|
+
}
|
|
449
|
+
case "SessionEnd": {
|
|
450
|
+
const ev = {
|
|
451
|
+
...base,
|
|
452
|
+
...typeof input.reason === "string" ? { reason: input.reason } : {}
|
|
453
|
+
};
|
|
454
|
+
return ev;
|
|
455
|
+
}
|
|
456
|
+
default: {
|
|
457
|
+
throw new Error(`unsupported devin hook event: ${String(event)}`);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
// ── Runtime: normalized response → Devin native (simple {decision}) reply ──
|
|
462
|
+
formatReply(event, response) {
|
|
463
|
+
const decision = response.decision ?? "allow";
|
|
464
|
+
if (event === "PostCompact" || event === "SessionEnd") {
|
|
465
|
+
return { exitCode: 0 };
|
|
466
|
+
}
|
|
467
|
+
if (event === "PermissionRequest") {
|
|
468
|
+
if (decision === "deny") {
|
|
469
|
+
return this.stdout({
|
|
470
|
+
decision: "deny",
|
|
471
|
+
reason: response.reason ?? "Denied by hook"
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
if (decision === "allow") {
|
|
475
|
+
return this.stdout({ decision: "approve" });
|
|
476
|
+
}
|
|
477
|
+
return { exitCode: 0 };
|
|
478
|
+
}
|
|
479
|
+
if (decision === "deny") {
|
|
480
|
+
return this.stdout({
|
|
481
|
+
decision: "block",
|
|
482
|
+
reason: response.reason ?? "Blocked by hook"
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
return { exitCode: 0 };
|
|
486
|
+
}
|
|
487
|
+
stdout(payload) {
|
|
488
|
+
return { exitCode: 0, stdout: JSON.stringify(payload) };
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
function devinEnvToken(name, def) {
|
|
492
|
+
return def !== void 0 ? `\${env:${name}:-${def}}` : `\${env:${name}}`;
|
|
493
|
+
}
|
|
494
|
+
function toolResponseToString(value) {
|
|
495
|
+
if (value == null) return void 0;
|
|
496
|
+
if (typeof value === "string") return value;
|
|
497
|
+
try {
|
|
498
|
+
return JSON.stringify(value);
|
|
499
|
+
} catch {
|
|
500
|
+
return String(value);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
var adapter = new DevinAdapter();
|
|
504
|
+
var devin_default = adapter;
|
|
505
|
+
export {
|
|
506
|
+
DevinAdapter,
|
|
507
|
+
adapter,
|
|
508
|
+
devin_default as default
|
|
509
|
+
};
|
|
510
|
+
//# sourceMappingURL=devin-PRJY2TTD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/adapters/devin/index.ts"],"sourcesContent":["/**\n * adapters/devin — Devin CLI (Cognition) platform adapter for agent-connector.\n *\n * Devin CLI is a Rust binary (`devin`, installed via `curl cli.devin.ai/install.sh`\n * → symlinked at `~/.local/bin/devin`; XDG namespace `devin`). It is a\n * **json-stdio** host: it ships a FULL Claude-Code-compatible lifecycle hook\n * system alongside MCP server registration. Both surfaces live in ONE JSON\n * config file per scope:\n *\n * - user scope → ~/.config/devin/config.json\n * (%APPDATA%\\devin\\config.json on Windows)\n * - project scope → <projectDir>/.devin/config.json\n *\n * MCP servers — root key `mcpServers` (object map keyed by server name; the\n * Claude-Desktop dialect). Native stdio entry { command, args?, env? } (NO\n * `type`/`disabled` discriminator); remote entry { url, transport?, headers?,\n * oauthClientId?, oauthClientSecret? } where transport is \"http\" (Streamable\n * HTTP, the URL default) or \"sse\" (legacy). Devin natively interpolates\n * `${env:VAR}` and `${file:/path}` in secret-bearing fields, so we PASS the\n * ${env:VAR} token THROUGH (nativeServerEnvInterpolation) rather than baking a\n * literal at install time. Primary source:\n * docs.devin.ai/cli/extensibility/mcp/configuration.\n *\n * Hooks — the `\"hooks\"` key IN the same config.json (root key `hooks`,\n * Claude NESTED-rule shape). Devin's hook format is documented as\n * \"compatible with Claude Code hooks\" — PascalCase event names, Claude\n * snake_case stdin wire fields. We deliberately write the `\"hooks\"` key in\n * config.json (a first-party-documented hook location whose object-map shape\n * fits the shared hook-merge engine exactly) rather than the alternative\n * standalone `.devin/hooks.v1.json` (whose event map is the WHOLE file with NO\n * `hooks` wrapper — incompatible with the engine's `file.hooks` contract). Both\n * are documented; config.json keeps us on the shared, Windows-safe engine with\n * zero hand-rolled file handling. Primary source:\n * docs.devin.ai/cli/extensibility/hooks/overview (\"Where Hooks Live\").\n *\n * Supported events (docs.devin.ai/cli/extensibility/hooks/lifecycle-hooks):\n * PreToolUse, PostToolUse, PermissionRequest, UserPromptSubmit, Stop,\n * PostCompaction (canonical PostCompact), SessionStart, SessionEnd. Devin\n * exposes no Notification / PreCompact / SubagentStart / SubagentStop /\n * PostToolUseFailure, so those degrade to a warn/skip at install time.\n *\n * Reply protocol — Devin's stdout reply is the SIMPLE top-level\n * { \"decision\": \"approve\"|\"block\"|\"deny\", \"reason\" } form (NOT Claude's\n * `hookSpecificOutput.permissionDecision` envelope). exit 0 = success,\n * exit 2 = block. \"block\" denies a tool/stop with a reason; on PermissionRequest\n * \"approve\"/\"deny\" are the grant/refuse verbs. Devin documents no\n * output-rewrite or context-injection reply channel, so canModifyOutput /\n * canInjectSessionContext stay false. Primary source:\n * docs.devin.ai/cli/extensibility/hooks/overview (\"Command Hooks\" output +\n * \"Exit Codes\") + lifecycle-hooks (PermissionRequest / Stop examples).\n */\n\nimport { existsSync } from \"node:fs\";\nimport { homedir, platform as osPlatform } from \"node:os\";\nimport { join } from \"node:path\";\n\nimport { BaseAdapter, type HookMergeDescriptor } from \"../base.js\";\nimport type { Adapter, HookReply, InstallContext, MemoryTarget, NormalizedEvent } from \"../spi.js\";\nimport type {\n ChangeRecord,\n DetectedPlatform,\n HealthCheck,\n HookEventName,\n HookParadigm,\n HookResponse,\n PermissionRequestEvent,\n PlatformCapabilities,\n PlatformId,\n PostCompactEvent,\n PostToolUseEvent,\n PreToolUseEvent,\n ServerDef,\n SessionEndEvent,\n SessionStartEvent,\n SkillDef,\n StopEvent,\n Transport,\n UserPromptSubmitEvent,\n} from \"../../core/types.js\";\nimport { rewriteEnvRefs } from \"../../core/interpolate.js\";\nimport {\n buildWrappedStdio,\n isHomeBinHookCommand,\n} from \"../../core/spawn.js\";\nimport { normalizeSessionSource } from \"../claude-code/wire.js\";\n\nconst HOST: PlatformId = \"devin\";\nconst MCP_ROOT_KEY = \"mcpServers\";\n\n/**\n * Resolve the Devin user config directory: ~/.config/devin (POSIX) or\n * %APPDATA%\\devin (Windows). Mirrors the documented user-scope path in\n * docs.devin.ai/cli/extensibility/mcp/configuration.\n */\nfunction devinUserConfigDir(): string {\n if (osPlatform() === \"win32\") {\n const appData = process.env.APPDATA ?? join(homedir(), \"AppData\", \"Roaming\");\n return join(appData, \"devin\");\n }\n return join(homedir(), \".config\", \"devin\");\n}\n\n/**\n * Canonical events Devin actually fires. Devin's hook event names are\n * Claude-identical PascalCase, so each canonical name is registered directly\n * EXCEPT PostCompaction, which Devin spells \"PostCompaction\" on the wire while\n * agent-connector's canonical name is \"PostCompact\" — handled by the descriptor\n * mapEvent / parseEvent so the home binary still dispatches on the canonical\n * \"PostCompact\" command.\n */\nconst SUPPORTED_EVENTS: ReadonlySet<HookEventName> = new Set<HookEventName>([\n \"PreToolUse\",\n \"PostToolUse\",\n \"PermissionRequest\",\n \"UserPromptSubmit\",\n \"Stop\",\n \"PostCompact\",\n \"SessionStart\",\n \"SessionEnd\",\n]);\n\n/** Devin's on-the-wire event name for the canonical PostCompact event. */\nconst DEVIN_POSTCOMPACT = \"PostCompaction\";\n\n/**\n * Native MCP server entry shapes Devin accepts under `mcpServers`.\n * A stdio entry is { command, args?, env? } — no type/disabled discriminator;\n * remote transports register a URL with an optional `transport` (\"http\"|\"sse\").\n */\ninterface DevinStdioServer {\n command: string;\n args?: string[];\n env?: Record<string, string>;\n}\ninterface DevinHttpServer {\n url: string;\n transport?: \"http\" | \"sse\";\n headers?: Record<string, string>;\n}\n\n/** A single Devin native hook registration entry (Claude-shaped, nested). */\ninterface DevinHookEntry {\n matcher: string;\n hooks: Array<{ type: \"command\"; command: string }>;\n}\n\n/** The shape of Devin's config.json hooks section (only the parts we touch). */\ninterface DevinHooksFile {\n hooks?: Record<string, DevinHookEntry[]>;\n [key: string]: unknown;\n}\n\n/** Raw Devin CLI hook stdin payload (Claude-compatible snake_case wire fields). */\ninterface DevinWireInput {\n hook_event_name?: string;\n tool_name?: string;\n tool_input?: Record<string, unknown>;\n /** PostToolUse — object { success, output, error }. */\n tool_response?: unknown;\n /** UserPromptSubmit — the user's message text. */\n prompt?: string;\n /** SessionStart — how the session was started. */\n source?: string;\n /** SessionEnd — why the session ended. */\n reason?: string;\n /** Stop loop guard. */\n stop_hook_active?: boolean;\n /** PostCompaction — compactor summary (may be null). Rides on raw; no normalized field. */\n summary?: unknown;\n /** Injected by the entrypoint so the runtime knows which connector to dispatch. */\n connector?: unknown;\n /** Session/cwd are not documented Devin wire fields; read defensively. */\n session_id?: string;\n cwd?: string;\n}\n\nexport class DevinAdapter extends BaseAdapter implements Adapter {\n readonly id: PlatformId = HOST;\n readonly name = \"Devin CLI (Cognition)\";\n readonly paradigm: HookParadigm = \"json-stdio\";\n\n readonly capabilities: PlatformCapabilities = {\n // Memory surface: AGENTS.md-first managed block — project <projectDir>/AGENTS.md\n // via the base default; user scope → ~/.config/devin/AGENTS.md (override below).\n // Devin reads AGENTS.md / AGENT.md / CLAUDE.md identically as always-on rules\n // (docs.devin.ai/cli/extensibility/rules).\n supportsMemory: true,\n preToolUse: true,\n postToolUse: true,\n userPromptSubmit: true,\n stop: true,\n sessionStart: true,\n sessionEnd: true,\n // PermissionRequest is a documented Devin hook event (decision-capable).\n permissionRequest: true,\n // PostCompaction (canonical PostCompact) — observe-only post-compaction hook.\n postCompact: true,\n // Devin documents NO Notification / PreCompact / SubagentStart / SubagentStop /\n // PostToolUseFailure event — those stay unset (install reports the skip-warn).\n notification: false,\n preCompact: false,\n // Devin's PreToolUse/PermissionRequest can block/deny via the simple\n // {decision} reply, but it documents no tool-arg/-output rewrite and no\n // context-injection reply channel.\n canModifyArgs: false,\n canModifyOutput: false,\n canInjectSessionContext: false,\n // Devin registers stdio and remote MCP servers. Remote is Streamable HTTP\n // (\"http\", the URL default) with a legacy \"sse\" fallback — both map to our\n // remote-transport handling; advertise both.\n transports: [\"stdio\", \"http\", \"sse\"],\n // Devin natively interpolates ${env:VAR} / ${file:/path} in secret-bearing\n // server fields, so the token survives into the host config (pass-through).\n nativeServerEnvInterpolation: true,\n // Content surfaces. Devin reads Agent Skills from its `.devin` config tree\n // at <configDir>/skills/<name>/SKILL.md — the SKILL.md format + frontmatter\n // are byte-confirmed (docs.devin.ai/cli/extensibility/skills/creating-skills),\n // so skills IS wired.\n supportsSkills: true,\n // Devin ALSO documents native slash commands (/cli/reference/commands) and\n // subagents (/cli/subagents), but their exact on-disk dir names are NOT\n // byte-confirmed from a first-party config reference — to avoid fabricating a\n // path, commands/subagents stay unset (BaseAdapter skip-warn) in v1. See the\n // module header CEILING note.\n };\n\n // ── Detection ────────────────────────────────────────────────────────────\n\n detectInstalled(projectDir: string): DetectedPlatform {\n const userDir = devinUserConfigDir();\n const userCfg = join(userDir, \"config.json\");\n const projDir = join(projectDir, \".devin\");\n const projCfg = join(projDir, \"config.json\");\n // The installed binary symlink (~/.local/bin/devin) is a strong marker even\n // before any config file is written.\n const binMarker = join(homedir(), \".local\", \"bin\", \"devin\");\n\n const userInstalled = existsSync(userDir) || existsSync(userCfg) || existsSync(binMarker);\n const projInstalled = existsSync(projDir) || existsSync(projCfg);\n const installed = userInstalled || projInstalled;\n const scope = projInstalled && !userInstalled ? \"project\" : \"user\";\n const configPath = scope === \"project\" ? projCfg : userCfg;\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 Devin CLI config (${scope}) at ${configPath}`\n : `no Devin CLI config at ${userDir} or ${projDir}`,\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, \".devin\")\n : devinUserConfigDir();\n }\n\n getServerConfigPath(ctx: InstallContext): string {\n return join(this.getConfigDir(ctx), \"config.json\");\n }\n\n /** Hooks live under the `\"hooks\"` key in the SAME config.json. */\n getHookConfigPath(ctx: InstallContext): string {\n return this.getServerConfigPath(ctx);\n }\n\n // ── Memory surface: user-scope AGENTS.md ─────────────────────────────────\n // Project scope rides on the AGENTS.md base default (project root). User scope\n // targets ~/.config/devin/AGENTS.md (%APPDATA%\\devin\\AGENTS.md on Windows) —\n // Devin's documented global-rules file (docs.devin.ai/cli/extensibility/rules).\n protected override memoryTargets(ctx: InstallContext): MemoryTarget[] {\n if (this.memoryOverride(ctx)?.path || ctx.scope !== \"user\") {\n return super.memoryTargets(ctx);\n }\n return [\n {\n path: join(devinUserConfigDir(), \"AGENTS.md\"),\n reason: \"Devin CLI global rules file (~/.config/devin/AGENTS.md)\",\n },\n ];\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 devin\"\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 Devin's native mcpServers entry. */\n private renderServerEntry(\n ctx: InstallContext,\n server: ServerDef,\n ): DevinStdioServer | DevinHttpServer {\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 ({ command, args } = buildWrappedStdio(ctx, server, this.id, command, args));\n\n // command/args are passed verbatim (mirrors claude-code — they route\n // through the serve wrapper and rarely carry secrets).\n const entry: DevinStdioServer = { command };\n if (args.length > 0) entry.args = args;\n const env = this.renderEnv(server.env);\n if (env) entry.env = env;\n return entry;\n }\n\n // http / sse (and any other remote transport) — Devin registers a URL.\n // Map our \"http\" transport to Streamable HTTP (the URL default) and \"sse\" to\n // legacy SSE; omit `transport` for the default-http case to keep the entry\n // minimal (Devin infers http from a URL). ${env:VAR} survives into the\n // config via Devin's native interpolation (rewriteEnvRefs/devinEnvToken).\n const entry: DevinHttpServer = {\n url: rewriteEnvRefs(server.url ?? \"\", devinEnvToken),\n };\n if (transport === \"sse\") entry.transport = \"sse\";\n const headers = this.renderEnv(server.headers);\n if (headers) entry.headers = headers;\n return entry;\n }\n\n /**\n * Render env/header values. Devin interpolates ${env:VAR} natively, so each\n * ${env:VAR} token is passed THROUGH (rewriteEnvRefs/devinEnvToken) rather\n * than baked to a literal — secrets never land in the committed config.\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)) {\n out[k] = rewriteEnvRefs(v, devinEnvToken);\n }\n return out;\n }\n\n // ── Hook install / uninstall (config.json \"hooks\" key, nested-rule shape) ──\n\n installHooks(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[HOST]?.hooks === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"hooks disabled for devin\" }];\n }\n if (connector.hookEvents.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no hooks\" }];\n }\n\n const pending = connector.hookEvents.map((event) => ({\n event,\n matcher: connector.hooks[event]?.matcher ?? \"\",\n }));\n return this.upsertHookEntries(\n ctx,\n this.getHookConfigPath(ctx),\n pending,\n this.hookDescriptor(ctx),\n );\n }\n\n uninstallHooks(ctx: InstallContext): ChangeRecord[] {\n return this.removeHookEntries(ctx, this.getHookConfigPath(ctx), this.hookDescriptor(ctx));\n }\n\n /**\n * Devin's hook-merge descriptor (NESTED shape `{ matcher, hooks: [...] }`).\n * Bound to `ctx` because Devin's ownership is CONNECTOR-GENERIC (ANY of our\n * commands in the entry's inner `hooks`):\n * - mapEvent = drop events outside SUPPORTED_EVENTS; the canonical\n * PostCompact is rewritten to Devin's on-wire \"PostCompaction\" key while\n * all other supported events map 1:1.\n * - entryOwnsCommand reuses isOurCommand over the inner commands.\n * - uninstall = inner-strip ONLY (ownsEntryForRemove never-true).\n */\n private hookDescriptor(ctx: InstallContext): HookMergeDescriptor<DevinHookEntry> {\n return {\n mapEvent: (e) => {\n if (!SUPPORTED_EVENTS.has(e as HookEventName)) return undefined;\n return e === \"PostCompact\" ? DEVIN_POSTCOMPACT : e;\n },\n unmappedWarnDetail: (e) => `${e} has no Devin hook equivalent — skipped`,\n renderEntry: (_event, matcher, command) => ({\n matcher,\n hooks: [{ type: \"command\", command }],\n }),\n entryOwnsCommand: (entry, _command) =>\n (entry.hooks ?? []).some((h) => this.isOurCommand(h.command, ctx)),\n ownsEntryForRemove: () => () => false,\n stripInner: (c) => (entry) => {\n const innerBefore = entry.hooks?.length ?? 0;\n const inner = (entry.hooks ?? []).filter((h) => !this.isOurCommand(h.command, c));\n return {\n next: inner.length > 0 ? { matcher: entry.matcher ?? \"\", hooks: inner } : null,\n removed: innerBefore - inner.length,\n };\n },\n skipDetail: (event) => `hooks.${event} already registered`,\n removeDetail: (event, removed) => `hooks.${event} (${removed})`,\n absentDetail: \"no hooks section present\",\n noMatchDetail: \"no matching hook entries\",\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 private isOurCommand(command: string | undefined, ctx: InstallContext): boolean {\n return isHomeBinHookCommand(command, ctx.homeBinPath, ctx.connector.id);\n }\n\n // ── Content surfaces: skills ──────────────────────────────────────────────\n // CEILING (v1): only the byte-confirmed SKILL.md layout is wired. Devin\n // documents the SKILL.md format + frontmatter\n // (docs.devin.ai/cli/extensibility/skills/creating-skills) under the `.devin`\n // tree (<configDir>/skills/<name>/SKILL.md). Commands/subagents on-disk dir\n // names are NOT byte-confirmed from a first-party config reference, so they\n // stay on the BaseAdapter skip-warn rather than guessing a path.\n\n /** Native skill dir: <configDir>/skills/<name>. */\n private skillDir(ctx: InstallContext, name: string): string {\n return join(this.getConfigDir(ctx), \"skills\", name);\n }\n\n override installSkills(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[HOST]?.skills === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"skills disabled for devin\" }];\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 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 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.\n changes.push(this.removeDirIfEmpty(dir, ctx.dryRun));\n }\n return changes;\n }\n\n /**\n * Render a skill's SKILL.md: frontmatter (name, description) + body. Devin's\n * SKILL.md frontmatter documents name/description; extra keys pass through\n * verbatim. No model/allowed-tools skill field is emitted.\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.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 cfgPath = this.getServerConfigPath(ctx);\n const connectorId = ctx.connector.id;\n const homeBin = ctx.homeBinPath;\n const hookEvents = ctx.connector.hookEvents;\n return [\n {\n name: `${this.name}: config.json present`,\n check: () =>\n existsSync(cfgPath)\n ? { status: \"OK\", detail: cfgPath }\n : { status: \"FAIL\", detail: `not found: ${cfgPath}` },\n },\n {\n name: `${this.name}: server entry registered`,\n check: () => {\n if (!ctx.connector.server) {\n return { status: \"OK\", detail: \"no MCP server declared\" };\n }\n const cfg = this.readJson<{ [k: string]: Record<string, unknown> }>(cfgPath);\n const bucket = cfg?.[MCP_ROOT_KEY];\n if (!cfg || !bucket) {\n return { status: \"FAIL\", detail: `no ${MCP_ROOT_KEY} in ${cfgPath}` };\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 ${cfgPath}`,\n };\n },\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<DevinHooksFile>(cfgPath);\n if (!file) return { status: \"FAIL\", detail: `cannot read ${cfgPath}` };\n const hooks = file.hooks ?? {};\n const registered = Object.values(hooks).some((entries) =>\n (entries ?? []).some((e) =>\n (e.hooks ?? []).some((h) =>\n isHomeBinHookCommand(h.command, homeBin, connectorId),\n ),\n ),\n );\n return registered\n ? { status: \"OK\", detail: \"hook command present\" }\n : { status: \"FAIL\", detail: `no hook for ${connectorId} in ${cfgPath}` };\n },\n },\n ];\n }\n\n // ── Runtime: parse Devin stdin JSON → normalized event ─────────────────────\n\n parseEvent(event: HookEventName, raw: unknown): NormalizedEvent {\n const input = (raw ?? {}) as DevinWireInput;\n const connectorId = typeof input.connector === \"string\" ? input.connector : \"\";\n const sessionId = typeof input.session_id === \"string\" ? input.session_id : \"\";\n const projectDir = typeof input.cwd === \"string\" ? input.cwd : undefined;\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 ev: PostToolUseEvent = {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\n ...(toolResponseToString(input.tool_response) !== undefined\n ? { toolOutput: toolResponseToString(input.tool_response) }\n : {}),\n };\n return ev;\n }\n case \"PermissionRequest\": {\n // Devin PermissionRequest stdin: { tool_name, tool_input }. No\n // permission-suggestion entries are documented.\n const ev: PermissionRequestEvent = {\n ...base,\n toolName: input.tool_name ?? \"\",\n toolInput: input.tool_input ?? {},\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 \"PostCompact\": {\n // Devin's PostCompaction wire carries { summary } (no trigger enum);\n // summary rides on base.raw (no normalized field).\n const ev: PostCompactEvent = { ...base };\n return ev;\n }\n case \"SessionStart\": {\n const ev: SessionStartEvent = {\n ...base,\n source: normalizeSessionSource(input.source),\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 default: {\n // Devin never delivers Notification / PreCompact / SubagentStart /\n // SubagentStop / PostToolUseFailure (see SUPPORTED_EVENTS). Surface it\n // loudly rather than silently mis-parse.\n throw new Error(`unsupported devin hook event: ${String(event)}`);\n }\n }\n }\n\n // ── Runtime: normalized response → Devin native (simple {decision}) reply ──\n\n formatReply(event: HookEventName, response: HookResponse): HookReply {\n const decision = response.decision ?? \"allow\";\n\n // PostCompaction / SessionEnd are observe-only — no Decision Control. Every\n // decision is an unconditional no-op passthrough.\n if (event === \"PostCompact\" || event === \"SessionEnd\") {\n return { exitCode: 0 };\n }\n\n // PermissionRequest: an explicit allow is an active GRANT (Devin's \"approve\"\n // verb); deny refuses the tool. ask/context/void fall through to the native\n // dialog (exit 0, no decision output).\n if (event === \"PermissionRequest\") {\n if (decision === \"deny\") {\n return this.stdout({\n decision: \"deny\",\n reason: response.reason ?? \"Denied by hook\",\n });\n }\n if (decision === \"allow\") {\n return this.stdout({ decision: \"approve\" });\n }\n return { exitCode: 0 };\n }\n\n // deny → block the action with a reason (Devin's top-level {decision:\"block\"}\n // form, NOT Claude's hookSpecificOutput envelope). Covers PreToolUse and\n // Stop (Stop-block keeps the agent running with `reason` as guidance).\n if (decision === \"deny\") {\n return this.stdout({\n decision: \"block\",\n reason: response.reason ?? \"Blocked by hook\",\n });\n }\n\n // ask is not a distinct Devin reply verb (only approve/block/deny) — fall\n // through to allow. allow / modify (no rewrite channel) / context (no\n // injection channel) / void → 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 * Devin's native interpolation token reconstructor. Devin reads the SAME\n * `${env:VAR}` (and `${env:VAR:-default}`) form the connector author writes, so\n * the rewrite is a faithful round-trip of the token (Devin resolves it at\n * runtime — the secret never lands in the committed config).\n */\nfunction devinEnvToken(name: string, def?: string): string {\n return def !== undefined ? `\\${env:${name}:-${def}}` : `\\${env:${name}}`;\n}\n\n/** Coerce a Devin PostToolUse `tool_response` into a string for the normalized event. */\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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