@ken-jo/agent-connector 0.4.8 → 0.4.26
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 +36 -24
- package/dist/{action-RWPRIZIC.js → action-AZRZ3V7E.js} +12 -12
- package/dist/amazon-q-BWSOHTW5.js +571 -0
- package/dist/amazon-q-BWSOHTW5.js.map +1 -0
- package/dist/{amp-TULUPXXL.js → amp-BQZOL5GR.js} +2 -2
- package/dist/{amp-PU4LFSY6.js → amp-TF5X6OGH.js} +4 -4
- package/dist/{antigravity-DWW35HZO.js → antigravity-3XHBPXZK.js} +5 -5
- package/dist/{antigravity-STHZWMP3.js → antigravity-EA4L225L.js} +2 -2
- package/dist/{antigravity-cli-P6HADOAO.js → antigravity-cli-B2HXZFYQ.js} +2 -2
- package/dist/{antigravity-cli-VTQ6DNWL.js → antigravity-cli-TJGOBUPK.js} +5 -5
- package/dist/{chunk-A2T4Q7RM.js → chunk-25BNMXPP.js} +18 -18
- package/dist/{chunk-NLFPH4S2.js → chunk-2RPHDVHW.js} +2 -2
- package/dist/{chunk-KG6T3YNJ.js → chunk-3I7UG52L.js} +23 -4
- package/dist/chunk-3I7UG52L.js.map +1 -0
- package/dist/{chunk-BCHWFTV4.js → chunk-F4DSMVZ7.js} +2 -2
- package/dist/{chunk-XQUUNAGC.js → chunk-HU6DZZBG.js} +36 -36
- package/dist/{chunk-CDVOBKSG.js → chunk-HZDU3J4U.js} +8 -3
- package/dist/chunk-HZDU3J4U.js.map +1 -0
- package/dist/{chunk-SCVBYSF7.js → chunk-IRUYJD23.js} +28 -28
- package/dist/{chunk-VRKTVCYJ.js → chunk-IW46JIQM.js} +33 -43
- package/dist/chunk-IW46JIQM.js.map +1 -0
- package/dist/{chunk-OZ5EXXQV.js → chunk-JLMD3IGK.js} +2 -2
- package/dist/{chunk-YS2NYJ6R.js → chunk-KD4BE5MW.js} +2 -2
- package/dist/{chunk-FAHIMJRU.js → chunk-L7ESV37V.js} +2 -2
- package/dist/{chunk-JNM3TPLX.js → chunk-LETB5HCK.js} +2 -2
- package/dist/{chunk-7TVBFRVI.js → chunk-M3H7PQWT.js} +2 -2
- package/dist/{chunk-JWNT5KW7.js → chunk-O7SDRBVB.js} +3 -1
- package/dist/chunk-O7SDRBVB.js.map +1 -0
- package/dist/{chunk-MOW2RKHX.js → chunk-OLI5SD6I.js} +8 -4
- package/dist/chunk-OLI5SD6I.js.map +1 -0
- package/dist/{chunk-NYR55UT7.js → chunk-Q5HR4ADS.js} +2 -2
- package/dist/{chunk-TRQKHP7D.js → chunk-QY42WGBX.js} +23 -2
- package/dist/chunk-QY42WGBX.js.map +1 -0
- package/dist/{chunk-HOE2MN36.js → chunk-YEJCNOET.js} +4 -4
- package/dist/{chunk-WI6YSXOC.js → chunk-YKVNI44Y.js} +51 -28
- package/dist/chunk-YKVNI44Y.js.map +1 -0
- package/dist/{chunk-CENEXP7K.js → chunk-YRBFSZ2G.js} +10 -3
- package/dist/chunk-YRBFSZ2G.js.map +1 -0
- package/dist/{chunk-YYISBXOM.js → chunk-ZVTPSV5Z.js} +9 -8
- package/dist/{chunk-YYISBXOM.js.map → chunk-ZVTPSV5Z.js.map} +1 -1
- package/dist/{chunk-N6HH7K6P.js → chunk-ZY25RG4Y.js} +2 -2
- package/dist/{claude-code-64X6RR2S.js → claude-code-JLPFUZ4V.js} +8 -8
- package/dist/{claude-code-W74MNTAC.js → claude-code-NMRKTAP7.js} +2 -2
- package/dist/cli/sdk.js +7 -7
- package/dist/cli.js +1 -1
- package/dist/{cline-T7ZDJYZQ.js → cline-GBP3EVSX.js} +4 -4
- package/dist/{codebuff-3PMZJJHP.js → codebuff-ETYT5UBL.js} +2 -2
- package/dist/{codebuff-PPPY3SJV.js → codebuff-WMKFUVER.js} +4 -4
- package/dist/{codex-EEVN43C2.js → codex-5CZR5XKX.js} +4 -4
- package/dist/{codex-Q3ATRRX3.js → codex-YAORPCOD.js} +2 -2
- package/dist/{continue-VLLZO4PM.js → continue-3AGXWM5W.js} +5 -5
- package/dist/{copilot-cli-A7G5WB4N.js → copilot-cli-IH4P3GRZ.js} +4 -4
- package/dist/{copilot-cli-SJGIXVSD.js → copilot-cli-MZTAWMPW.js} +2 -2
- package/dist/{crush-AH24GDDB.js → crush-FDBL3JEK.js} +4 -4
- package/dist/{crush-LN5QFFR2.js → crush-QBXLNN7T.js} +2 -2
- package/dist/{cursor-QZ6MTO74.js → cursor-DIW43TRZ.js} +2 -2
- package/dist/{cursor-GJBSMXI6.js → cursor-R5QB4YR4.js} +4 -4
- package/dist/{detect-YDCZNV4W.js → detect-L5OZPVFO.js} +4 -4
- package/dist/{doctor-DGC7P3P7.js → doctor-WDIQ2YFE.js} +12 -12
- package/dist/{droid-W5WF5XEX.js → droid-U3ZBLQFO.js} +2 -2
- package/dist/{droid-RBWCFKL3.js → droid-X2QHQL7D.js} +4 -4
- package/dist/{gemini-cli-CFPFEJEA.js → gemini-cli-HCN7XKSX.js} +4 -4
- package/dist/{gemini-cli-CIRW37TU.js → gemini-cli-NMVVBO3K.js} +2 -2
- package/dist/{goose-A3M5GODH.js → goose-64V46Y2W.js} +2 -2
- package/dist/{goose-UBJVQFUE.js → goose-ILMM76JP.js} +5 -5
- package/dist/{hermes-ZYLMOFLZ.js → hermes-F3EGTK6N.js} +2 -2
- package/dist/{hermes-6FXGXLNL.js → hermes-YX2ODUZL.js} +5 -5
- package/dist/{hook-CDGSCASQ.js → hook-JRDQ56BN.js} +12 -12
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/{install-2D3UKEME.js → install-HRCVPRAQ.js} +12 -12
- package/dist/{introspect-Cn3MSA4_.d.ts → introspect-B164-hj3.d.ts} +1 -1
- package/dist/{jetbrains-copilot-K26KMA3U.js → jetbrains-copilot-QESFUN6W.js} +4 -4
- package/dist/{kilo-BKZJ26RM.js → kilo-POTCYIRG.js} +4 -4
- package/dist/{kilo-NSWAVP6P.js → kilo-SW7BH6EG.js} +2 -2
- package/dist/{kilo-cli-6UVWCXQD.js → kilo-cli-MO6FSMH2.js} +4 -4
- package/dist/{kilo-cli-EVBKUODA.js → kilo-cli-ZF272ZHN.js} +2 -2
- package/dist/{kimi-EI3UM3ZV.js → kimi-5FHEXGZD.js} +72 -13
- package/dist/kimi-5FHEXGZD.js.map +1 -0
- package/dist/{kimi-QALYPSRR.js → kimi-RXS36OJP.js} +28 -21
- package/dist/kimi-RXS36OJP.js.map +1 -0
- package/dist/{kiro-J5J42I5Z.js → kiro-VTLX7CMF.js} +4 -4
- package/dist/{kiro-UCLSLBW2.js → kiro-WGOI5CGT.js} +2 -2
- package/dist/{leaderboard-VZQXNWTX.js → leaderboard-ASGR3E2U.js} +6 -6
- package/dist/{mimo-code-BEE622P2.js → mimo-code-F4BWMESO.js} +37 -6
- package/dist/mimo-code-F4BWMESO.js.map +1 -0
- package/dist/{mux-5HTNKK4K.js → mux-2YFCYFM7.js} +4 -4
- package/dist/{mux-ZMLVAXOO.js → mux-XM6AP35L.js} +2 -2
- package/dist/{nemoclaw-DNFIZFDF.js → nemoclaw-QDB6O22A.js} +5 -5
- package/dist/{omp-I3UTRBNP.js → omp-P2JNAEPN.js} +4 -4
- package/dist/{openclaw-QE2LMWIF.js → openclaw-3UMBSSZM.js} +5 -5
- package/dist/{openclaw-IYA7ASL6.js → openclaw-5EQFGOWL.js} +2 -2
- package/dist/{opencode-ZFSUYJXI.js → opencode-Q6H4YT66.js} +4 -4
- package/dist/{opencode-HWT3RSMN.js → opencode-QGP4ALQY.js} +2 -2
- package/dist/{package-BSCCMW4E.js → package-IXBSG7HD.js} +9 -9
- package/dist/{pi-UFX2OYFV.js → pi-GGDQREVG.js} +2 -2
- package/dist/{pi-H2KBBDDJ.js → pi-GW25LPC3.js} +4 -4
- package/dist/{qwen-code-W7NUCDEN.js → qwen-code-GQILBJ5B.js} +2 -2
- package/dist/{qwen-code-5LE34FNE.js → qwen-code-R6XXEEHJ.js} +5 -5
- package/dist/{roo-code-XH4GCYIS.js → roo-code-EZPNFC5V.js} +4 -4
- package/dist/{roo-code-ZLKH4A7N.js → roo-code-SUWI4BBN.js} +2 -2
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +10 -10
- 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 +9 -9
- package/dist/{serve-MQNGPY2H.js → serve-CFBQYKRB.js} +12 -12
- package/dist/{status-MRHVRDFY.js → status-ASBFEFQQ.js} +10 -10
- package/dist/{statusline-IYWA75TR.js → statusline-WKLWSM7I.js} +11 -11
- package/dist/{synthetic-UKR6SMGS.js → synthetic-6FRA7P5Q.js} +2 -2
- package/dist/{telemetry-IONIOMLC.js → telemetry-64GCGNIW.js} +10 -10
- package/dist/{trae-RVNRSV7X.js → trae-6VQW2UVP.js} +4 -4
- package/dist/{trae-PA26DPBW.js → trae-CPPYASR2.js} +2 -2
- package/dist/{types-_6arHbX9.d.ts → types-COSBYpKs.d.ts} +7 -5
- package/dist/{uninstall-ESLSVCLE.js → uninstall-KDJYE5ET.js} +12 -12
- package/dist/{upgrade-VICY5T64.js → upgrade-YQRVYR5U.js} +12 -12
- package/dist/{usage-TCUWV2YZ.js → usage-OV2BDZKF.js} +3 -3
- package/dist/{usage-event-CBZZP37Q.js → usage-event-KPI3NEX3.js} +11 -11
- package/dist/{vscode-copilot-B2QBBHJW.js → vscode-copilot-UOEEV4P3.js} +4 -4
- package/dist/{warp-5R54ST3N.js → warp-LUK2BPCU.js} +4 -4
- package/dist/{warp-JNQA7PBU.js → warp-NRBBJQR2.js} +2 -2
- package/dist/{windsurf-L32UEOLY.js → windsurf-NZ3G42NQ.js} +4 -4
- package/dist/{zed-FDJHJZKD.js → zed-LGWGZ4EO.js} +4 -4
- package/dist/{zed-NNNX5MNT.js → zed-XJFOOKCO.js} +2 -2
- package/package.json +7 -2
- package/dist/amazon-q-5LJOB5L3.js +0 -264
- package/dist/amazon-q-5LJOB5L3.js.map +0 -1
- package/dist/chunk-CDVOBKSG.js.map +0 -1
- package/dist/chunk-CENEXP7K.js.map +0 -1
- package/dist/chunk-JWNT5KW7.js.map +0 -1
- package/dist/chunk-KG6T3YNJ.js.map +0 -1
- package/dist/chunk-MOW2RKHX.js.map +0 -1
- package/dist/chunk-TRQKHP7D.js.map +0 -1
- package/dist/chunk-VRKTVCYJ.js.map +0 -1
- package/dist/chunk-WI6YSXOC.js.map +0 -1
- package/dist/kimi-EI3UM3ZV.js.map +0 -1
- package/dist/kimi-QALYPSRR.js.map +0 -1
- package/dist/mimo-code-BEE622P2.js.map +0 -1
- /package/dist/{action-RWPRIZIC.js.map → action-AZRZ3V7E.js.map} +0 -0
- /package/dist/{amp-TULUPXXL.js.map → amp-BQZOL5GR.js.map} +0 -0
- /package/dist/{amp-PU4LFSY6.js.map → amp-TF5X6OGH.js.map} +0 -0
- /package/dist/{antigravity-DWW35HZO.js.map → antigravity-3XHBPXZK.js.map} +0 -0
- /package/dist/{antigravity-STHZWMP3.js.map → antigravity-EA4L225L.js.map} +0 -0
- /package/dist/{antigravity-cli-P6HADOAO.js.map → antigravity-cli-B2HXZFYQ.js.map} +0 -0
- /package/dist/{antigravity-cli-VTQ6DNWL.js.map → antigravity-cli-TJGOBUPK.js.map} +0 -0
- /package/dist/{chunk-A2T4Q7RM.js.map → chunk-25BNMXPP.js.map} +0 -0
- /package/dist/{chunk-NLFPH4S2.js.map → chunk-2RPHDVHW.js.map} +0 -0
- /package/dist/{chunk-BCHWFTV4.js.map → chunk-F4DSMVZ7.js.map} +0 -0
- /package/dist/{chunk-XQUUNAGC.js.map → chunk-HU6DZZBG.js.map} +0 -0
- /package/dist/{chunk-SCVBYSF7.js.map → chunk-IRUYJD23.js.map} +0 -0
- /package/dist/{chunk-OZ5EXXQV.js.map → chunk-JLMD3IGK.js.map} +0 -0
- /package/dist/{chunk-YS2NYJ6R.js.map → chunk-KD4BE5MW.js.map} +0 -0
- /package/dist/{chunk-FAHIMJRU.js.map → chunk-L7ESV37V.js.map} +0 -0
- /package/dist/{chunk-JNM3TPLX.js.map → chunk-LETB5HCK.js.map} +0 -0
- /package/dist/{chunk-7TVBFRVI.js.map → chunk-M3H7PQWT.js.map} +0 -0
- /package/dist/{chunk-NYR55UT7.js.map → chunk-Q5HR4ADS.js.map} +0 -0
- /package/dist/{chunk-HOE2MN36.js.map → chunk-YEJCNOET.js.map} +0 -0
- /package/dist/{chunk-N6HH7K6P.js.map → chunk-ZY25RG4Y.js.map} +0 -0
- /package/dist/{claude-code-64X6RR2S.js.map → claude-code-JLPFUZ4V.js.map} +0 -0
- /package/dist/{claude-code-W74MNTAC.js.map → claude-code-NMRKTAP7.js.map} +0 -0
- /package/dist/{cline-T7ZDJYZQ.js.map → cline-GBP3EVSX.js.map} +0 -0
- /package/dist/{codebuff-3PMZJJHP.js.map → codebuff-ETYT5UBL.js.map} +0 -0
- /package/dist/{codebuff-PPPY3SJV.js.map → codebuff-WMKFUVER.js.map} +0 -0
- /package/dist/{codex-EEVN43C2.js.map → codex-5CZR5XKX.js.map} +0 -0
- /package/dist/{codex-Q3ATRRX3.js.map → codex-YAORPCOD.js.map} +0 -0
- /package/dist/{continue-VLLZO4PM.js.map → continue-3AGXWM5W.js.map} +0 -0
- /package/dist/{copilot-cli-A7G5WB4N.js.map → copilot-cli-IH4P3GRZ.js.map} +0 -0
- /package/dist/{copilot-cli-SJGIXVSD.js.map → copilot-cli-MZTAWMPW.js.map} +0 -0
- /package/dist/{crush-AH24GDDB.js.map → crush-FDBL3JEK.js.map} +0 -0
- /package/dist/{crush-LN5QFFR2.js.map → crush-QBXLNN7T.js.map} +0 -0
- /package/dist/{cursor-QZ6MTO74.js.map → cursor-DIW43TRZ.js.map} +0 -0
- /package/dist/{cursor-GJBSMXI6.js.map → cursor-R5QB4YR4.js.map} +0 -0
- /package/dist/{detect-YDCZNV4W.js.map → detect-L5OZPVFO.js.map} +0 -0
- /package/dist/{doctor-DGC7P3P7.js.map → doctor-WDIQ2YFE.js.map} +0 -0
- /package/dist/{droid-W5WF5XEX.js.map → droid-U3ZBLQFO.js.map} +0 -0
- /package/dist/{droid-RBWCFKL3.js.map → droid-X2QHQL7D.js.map} +0 -0
- /package/dist/{gemini-cli-CFPFEJEA.js.map → gemini-cli-HCN7XKSX.js.map} +0 -0
- /package/dist/{gemini-cli-CIRW37TU.js.map → gemini-cli-NMVVBO3K.js.map} +0 -0
- /package/dist/{goose-A3M5GODH.js.map → goose-64V46Y2W.js.map} +0 -0
- /package/dist/{goose-UBJVQFUE.js.map → goose-ILMM76JP.js.map} +0 -0
- /package/dist/{hermes-ZYLMOFLZ.js.map → hermes-F3EGTK6N.js.map} +0 -0
- /package/dist/{hermes-6FXGXLNL.js.map → hermes-YX2ODUZL.js.map} +0 -0
- /package/dist/{hook-CDGSCASQ.js.map → hook-JRDQ56BN.js.map} +0 -0
- /package/dist/{install-2D3UKEME.js.map → install-HRCVPRAQ.js.map} +0 -0
- /package/dist/{jetbrains-copilot-K26KMA3U.js.map → jetbrains-copilot-QESFUN6W.js.map} +0 -0
- /package/dist/{kilo-BKZJ26RM.js.map → kilo-POTCYIRG.js.map} +0 -0
- /package/dist/{kilo-NSWAVP6P.js.map → kilo-SW7BH6EG.js.map} +0 -0
- /package/dist/{kilo-cli-6UVWCXQD.js.map → kilo-cli-MO6FSMH2.js.map} +0 -0
- /package/dist/{kilo-cli-EVBKUODA.js.map → kilo-cli-ZF272ZHN.js.map} +0 -0
- /package/dist/{kiro-J5J42I5Z.js.map → kiro-VTLX7CMF.js.map} +0 -0
- /package/dist/{kiro-UCLSLBW2.js.map → kiro-WGOI5CGT.js.map} +0 -0
- /package/dist/{leaderboard-VZQXNWTX.js.map → leaderboard-ASGR3E2U.js.map} +0 -0
- /package/dist/{mux-5HTNKK4K.js.map → mux-2YFCYFM7.js.map} +0 -0
- /package/dist/{mux-ZMLVAXOO.js.map → mux-XM6AP35L.js.map} +0 -0
- /package/dist/{nemoclaw-DNFIZFDF.js.map → nemoclaw-QDB6O22A.js.map} +0 -0
- /package/dist/{omp-I3UTRBNP.js.map → omp-P2JNAEPN.js.map} +0 -0
- /package/dist/{openclaw-QE2LMWIF.js.map → openclaw-3UMBSSZM.js.map} +0 -0
- /package/dist/{openclaw-IYA7ASL6.js.map → openclaw-5EQFGOWL.js.map} +0 -0
- /package/dist/{opencode-ZFSUYJXI.js.map → opencode-Q6H4YT66.js.map} +0 -0
- /package/dist/{opencode-HWT3RSMN.js.map → opencode-QGP4ALQY.js.map} +0 -0
- /package/dist/{package-BSCCMW4E.js.map → package-IXBSG7HD.js.map} +0 -0
- /package/dist/{pi-UFX2OYFV.js.map → pi-GGDQREVG.js.map} +0 -0
- /package/dist/{pi-H2KBBDDJ.js.map → pi-GW25LPC3.js.map} +0 -0
- /package/dist/{qwen-code-W7NUCDEN.js.map → qwen-code-GQILBJ5B.js.map} +0 -0
- /package/dist/{qwen-code-5LE34FNE.js.map → qwen-code-R6XXEEHJ.js.map} +0 -0
- /package/dist/{roo-code-XH4GCYIS.js.map → roo-code-EZPNFC5V.js.map} +0 -0
- /package/dist/{roo-code-ZLKH4A7N.js.map → roo-code-SUWI4BBN.js.map} +0 -0
- /package/dist/{serve-MQNGPY2H.js.map → serve-CFBQYKRB.js.map} +0 -0
- /package/dist/{status-MRHVRDFY.js.map → status-ASBFEFQQ.js.map} +0 -0
- /package/dist/{statusline-IYWA75TR.js.map → statusline-WKLWSM7I.js.map} +0 -0
- /package/dist/{synthetic-UKR6SMGS.js.map → synthetic-6FRA7P5Q.js.map} +0 -0
- /package/dist/{telemetry-IONIOMLC.js.map → telemetry-64GCGNIW.js.map} +0 -0
- /package/dist/{trae-RVNRSV7X.js.map → trae-6VQW2UVP.js.map} +0 -0
- /package/dist/{trae-PA26DPBW.js.map → trae-CPPYASR2.js.map} +0 -0
- /package/dist/{uninstall-ESLSVCLE.js.map → uninstall-KDJYE5ET.js.map} +0 -0
- /package/dist/{upgrade-VICY5T64.js.map → upgrade-YQRVYR5U.js.map} +0 -0
- /package/dist/{usage-TCUWV2YZ.js.map → usage-OV2BDZKF.js.map} +0 -0
- /package/dist/{usage-event-CBZZP37Q.js.map → usage-event-KPI3NEX3.js.map} +0 -0
- /package/dist/{vscode-copilot-B2QBBHJW.js.map → vscode-copilot-UOEEV4P3.js.map} +0 -0
- /package/dist/{warp-5R54ST3N.js.map → warp-LUK2BPCU.js.map} +0 -0
- /package/dist/{warp-JNQA7PBU.js.map → warp-NRBBJQR2.js.map} +0 -0
- /package/dist/{windsurf-L32UEOLY.js.map → windsurf-NZ3G42NQ.js.map} +0 -0
- /package/dist/{zed-FDJHJZKD.js.map → zed-LGWGZ4EO.js.map} +0 -0
- /package/dist/{zed-NNNX5MNT.js.map → zed-XJFOOKCO.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/adapters/amazon-q/index.ts"],"sourcesContent":["/**\n * adapters/amazon-q — Amazon Q Developer CLI platform adapter.\n *\n * Amazon Q Developer CLI (`q` / `qchat`) is a **json-stdio** host. It exposes a\n * real hooks layer (agentSpawn / userPromptSubmit / preToolUse / postToolUse /\n * stop, JSON-over-STDIN, exit-code 0/2 contract — primary-verified via\n * aws.github.io/amazon-q-developer-cli agent-format → Hooks Field). The hook\n * STDIN+exit contract is IDENTICAL to the sibling AWS host kiro; only the WRITE\n * shape differs (see below).\n *\n * Hooks live ONLY in per-agent config JSON files — there is NO global hooks.json:\n * user → ~/.aws/amazonq/cli-agents/<name>.json\n * project → <projectDir>/.amazonq/cli-agents/<name>.json\n * Because hooks have no global file, AC must target a SPECIFIC agent file. We\n * mirror kiro's per-agent selection rule and write the built-in default agent\n * file — `cli-agents/q_cli_default.json`. Amazon Q auto-loads the built-in\n * `q_cli_default` agent for a new chat session (the built-in default is otherwise\n * in-memory); a file literally named `default.json` would be an INACTIVE custom\n * agent named `default` the user must explicitly select (`q chat --agent default`),\n * so hooks there would never fire — exactly the trap kiro avoids with\n * `kiro_default.json`. Primary-verified via the agent-format default\n * knowledge-base dir `~/.aws/amazonq/knowledge_bases/q_cli_default/`.\n * A PROJECT install writes a project-scoped `q_cli_default` agent file\n * (<projectDir>/.amazonq/cli-agents/q_cli_default.json) that SHADOWS the\n * user-global one — a local `q_cli_default` takes precedence and auto-loads.\n *\n * The `hooks` field is an OBJECT keyed by trigger name (NOT kiro's matcher-grouped\n * array). Each entry is `{ command, matcher? }` — NO `type` field; `matcher` is\n * only meaningful for preToolUse/postToolUse:\n * \"hooks\": {\n * \"agentSpawn\": [{ \"command\": \"<cmd>\" }],\n * \"userPromptSubmit\": [{ \"command\": \"<cmd>\" }],\n * \"preToolUse\": [{ \"command\": \"<cmd>\", \"matcher\": \"<toolNamePattern?>\" }],\n * \"postToolUse\": [{ \"command\": \"<cmd>\", \"matcher\": \"<optional>\" }],\n * \"stop\": [{ \"command\": \"<cmd>\" }]\n * }\n * AC MERGES into this object: it preserves ALL other agent fields (name /\n * description / mcpServers / tools / resources / user hooks) and only upserts its\n * own home-bin command into each mapped trigger array, identified by the command\n * string for idempotent re-install and clean uninstall (an emptied trigger key is\n * dropped). The shared object-map hook-array merge engine (base.ts\n * upsertHookEntries / removeHookEntries) handles this FLAT object-of-arrays shape\n * directly — the descriptor renders a flat `{ command, matcher? }` entry.\n *\n * Canonical AC event → Amazon Q trigger:\n * SessionStart → agentSpawn\n * UserPromptSubmit → userPromptSubmit\n * PreToolUse → preToolUse\n * PostToolUse → postToolUse\n * Stop → stop\n * Events with no Amazon Q trigger (PreCompact / SessionEnd / Notification and the\n * E1 extension events) warn-skip at install time.\n *\n * Hook protocol is EXIT-CODE based (identical to kiro): exit 0 = allow, exit 2 =\n * block (preToolUse only; STDERR is returned to the LLM). Amazon Q cannot rewrite\n * tool args or output, so canModifyArgs / canModifyOutput are false.\n *\n * MCP config (legacy files, primary-verified via AWS docs) — UNCHANGED by the\n * hooks wiring; the MCP server surface still targets the global/workspace mcp.json:\n * - user scope → ~/.aws/amazonq/mcp.json (global; applies to all workspaces)\n * - project scope → <projectDir>/.amazonq/mcp.json (local workspace)\n * Both are JSON, root key \"mcpServers\". Amazon Q reads BOTH when both exist\n * and merges them (union); workspace wins on same-name conflict with a warning.\n *\n * Server entry shape (primary-verified):\n * - stdio: { command: string; args?: string[]; env?: { [k: string]: string };\n * timeout?: number } (timeout in MILLISECONDS, e.g. 60000;\n * transport inferred from presence of `command` — no `type` key)\n * - http: { type: \"http\"; url: string }\n * (the remote/HTTP shape is written with an explicit `type: \"http\"`\n * discriminator + `url`, per command-line-mcp-config-CLI.html. No\n * `headers` field — Amazon Q remote auth is OAuth, not static\n * headers — and no `disabled` flag.)\n *\n * Path resolution — NOTE the nested user scope:\n * - user: join(homedir(), \".aws\", \"amazonq\") (two path segments)\n * - project: join(projectDir, \".amazonq\") (single dotDir, no .aws)\n * homedir() handles USERPROFILE on Windows automatically; no manual branch.\n *\n * Env interpolation: Amazon Q has no documented native ${env:VAR} token;\n * resolve all references to literals at install time (the safe path, same as\n * droid/crush).\n *\n * Memory / rules (primary-verified — docs.aws.amazon.com context-project-rules):\n * Project rules are plain Markdown files in <projectDir>/.amazonq/rules; Amazon\n * Q \"will automatically use them as context whenever a developer chats with\n * Amazon Q within your project\". NO frontmatter required. We write a DEDICATED\n * agent-connector-owned file there (`.amazonq/rules/agent-connector.md`),\n * mirroring the cline `.clinerules/agent-connector.md` approach: memoryTargets()\n * points at the dedicated file and the base managed-block engine performs the\n * surgical, hash-stamped, uninstall-reversible write. PROJECT SCOPE ONLY — the\n * AWS docs do not cleanly document a user/global rules directory for the CLI\n * (a `~/.aws/amazonq/.../rules` path is unverified), so user scope returns [] →\n * the base installMemory skip-warns rather than writing into an unread path.\n *\n * Hook config path targets the built-in default agent file\n * (cli-agents/q_cli_default.json), which is a DIFFERENT file from the MCP mcp.json\n * (getHookConfigPath ≠ getServerConfigPath), mirroring kiro's split surfaces.\n */\n\nimport { existsSync, statSync } from \"node:fs\";\nimport { homedir } 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 PlatformCapabilities,\n PlatformId,\n PostToolUseEvent,\n PreToolUseEvent,\n ServerDef,\n SessionStartEvent,\n StopEvent,\n SubagentDef,\n Transport,\n UserPromptSubmitEvent,\n} from \"../../core/types.js\";\nimport { resolveEnvRefsDeep } 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 = \"amazon-q\";\nconst MCP_ROOT_KEY = \"mcpServers\";\n\n/**\n * The built-in default agent file AC registers hooks on. Amazon Q auto-loads the\n * built-in `q_cli_default` agent for a new chat session (the built-in default is\n * otherwise in-memory). A file literally named `default.json` would be an INACTIVE\n * custom agent named `default` that the user must explicitly select\n * (`q chat --agent default`), so hooks merged there would never fire — we register\n * on `q_cli_default.json` instead (mirrors kiro's `kiro_default.json` selection;\n * primary-verified via the agent-format default knowledge-base dir\n * `knowledge_bases/q_cli_default/`).\n */\nconst DEFAULT_AGENT_FILE = \"q_cli_default.json\";\n\n/**\n * The agent NAME (filename stem) AC reserves for the hooks / built-in default\n * agent (`cli-agents/q_cli_default.json`). A connector subagent declared with\n * this exact name would resolve to the SAME file and clobber the hooks agent, so\n * installSubagents REFUSES it (skip-warn) and uninstallSubagents never touches it.\n */\nconst RESERVED_AGENT_NAME = \"q_cli_default\";\n\n/**\n * Amazon Q native hook trigger names (the keys under an agent file's `hooks`\n * object). Only the triggers Amazon Q fires for the json-stdio command paradigm.\n */\nconst Q_TRIGGER = {\n preToolUse: \"preToolUse\",\n postToolUse: \"postToolUse\",\n agentSpawn: \"agentSpawn\",\n userPromptSubmit: \"userPromptSubmit\",\n stop: \"stop\",\n} as const;\n\n/**\n * Map canonical event names → Amazon Q's native trigger names. Only mapped\n * events are present; PreCompact / SessionEnd / Notification and the E1\n * extension events have no Amazon Q equivalent → warn-skip at install time.\n */\nconst EVENT_MAP: Partial<Record<HookEventName, string>> = {\n SessionStart: Q_TRIGGER.agentSpawn,\n UserPromptSubmit: Q_TRIGGER.userPromptSubmit,\n PreToolUse: Q_TRIGGER.preToolUse,\n PostToolUse: Q_TRIGGER.postToolUse,\n Stop: Q_TRIGGER.stop,\n};\n\n/** Triggers whose `matcher` is meaningful (tool-name pattern). Others omit it. */\nconst MATCHER_TRIGGERS: ReadonlySet<string> = new Set([\n Q_TRIGGER.preToolUse,\n Q_TRIGGER.postToolUse,\n]);\n\n/**\n * A single Amazon Q native hook entry: FLAT `{ command, matcher? }` (NO `type`\n * field — unlike kiro's matcher-grouped nested shape).\n */\ninterface AmazonQHookEntry {\n command: string;\n matcher?: string;\n}\n\n/** The shape of an Amazon Q agent file (only the parts we touch). */\ninterface AmazonQAgentFile {\n hooks?: Record<string, AmazonQHookEntry[]>;\n [key: string]: unknown;\n}\n\n/** Raw Amazon Q CLI hook stdin payload (snake_case wire fields, == kiro's). */\ninterface AmazonQWireInput {\n connector?: unknown;\n hook_event_name?: string;\n cwd?: string;\n session_id?: string;\n tool_name?: string;\n tool_input?: Record<string, unknown>;\n tool_response?: unknown;\n source?: string;\n prompt?: string;\n stop_hook_active?: boolean;\n}\n\n/**\n * Native MCP server entry shapes Amazon Q accepts under `mcpServers`.\n * - stdio: BARE shape — NO `type` discriminator and NO `disabled` flag; the\n * transport is inferred from the presence of `command`. timeout is in\n * MILLISECONDS (pass timeoutMs through unchanged, do NOT divide).\n * - http: REMOTE shape — explicit `type: \"http\"` + `url`\n * (command-line-mcp-config-CLI.html). NO `headers` (remote auth is OAuth,\n * not static headers) and NO `disabled` flag.\n */\ninterface AmazonQStdioServer {\n command: string;\n args?: string[];\n env?: Record<string, string>;\n timeout?: number;\n}\ninterface AmazonQHttpServer {\n type: \"http\";\n url: string;\n}\n\nexport class AmazonQAdapter extends BaseAdapter implements Adapter {\n readonly id: PlatformId = HOST;\n readonly name = \"Amazon Q Developer CLI\";\n readonly paradigm: HookParadigm = \"json-stdio\";\n\n readonly capabilities: PlatformCapabilities = {\n // Memory surface: WIRED. Amazon Q reads `.amazonq/rules` (NOT AGENTS.md), so\n // the AGENTS.md-first BaseAdapter default does not apply — memoryTargets()\n // below overrides it to write a DEDICATED agent-connector-owned file\n // (<projectDir>/.amazonq/rules/agent-connector.md, plain Markdown, no\n // frontmatter — auto-applied as context per the AWS docs). Project scope\n // only; user scope skip-warns (no verified user/global rules dir).\n supportsMemory: true,\n //\n // Hooks: Amazon Q fires agentSpawn / userPromptSubmit / preToolUse /\n // postToolUse / stop (mapped from SessionStart / UserPromptSubmit /\n // PreToolUse / PostToolUse / Stop). It has no PreCompact / SessionEnd /\n // Notification equivalent, nor the E1 extension events (PermissionRequest /\n // PostToolUseFailure / SubagentStart / SubagentStop) — those warn-skip.\n preToolUse: true,\n postToolUse: true,\n preCompact: false,\n sessionStart: true,\n sessionEnd: false,\n userPromptSubmit: true,\n stop: true,\n notification: false,\n // Exit-code protocol only — a hook can allow (0) or block (2), but it CANNOT\n // rewrite tool args or output.\n canModifyArgs: false,\n canModifyOutput: false,\n // agentSpawn returns additionalContext via JSON stdout (mirrors kiro).\n canInjectSessionContext: true,\n // Amazon Q registers stdio + Streamable HTTP MCP servers (primary-verified).\n transports: [\"stdio\", \"http\"],\n // Content surfaces:\n // subagents: WIRED. Amazon Q's \"agents\" are per-agent JSON files where the\n // FILENAME (minus .json) IS the agent name (primary-verified via the CLI\n // repo docs/agent-file-locations.md + docs/agent-format.md). AC maps each\n // connector SubagentDef → cli-agents/<name>.json = { name, description,\n // prompt } (+ model when non-\"inherit\"; + tools/allowedTools when the\n // SubagentDef carries a tool policy — see renderSubagent). Both scopes:\n // user → ~/.aws/amazonq/cli-agents/<name>.json\n // project → <projectDir>/.amazonq/cli-agents/<name>.json\n // A subagent named `q_cli_default` would resolve to the hooks/default-agent\n // file — the SDK already rejects it (non-kebab name), and installSubagents\n // refuses it as defense-in-depth so a subagent write can never clobber it.\n supportsSubagents: true,\n // commands (prompt library): DEFERRED — format unverified. The only primary\n // doc for the ~/.aws/amazonq/prompts/*.md prompt library is the IDE prompt-\n // library page (q-in-IDE-chat → ide-chat-context: prompts saved in\n // ~/.aws/amazonq/prompts, invoked via @<name> inside the IDE chat). The Q\n // CLI repo (aws/amazon-q-developer-cli/docs) ships NO prompts/saved-prompts\n // doc, so whether the `q`/`qchat` CLI reads that folder — and whether a\n // project-scoped prompts dir exists — is NOT primary-verified for the CLI\n // host this adapter targets. supportsCommands stays UNSET (base skip-warns)\n // rather than render an unverified surface (the continue per-server-YAML /\n // other deferred-unverified precedent).\n };\n\n // ── Detection ────────────────────────────────────────────────────────────\n\n detectInstalled(projectDir: string): DetectedPlatform {\n const userDir = join(homedir(), \".aws\", \"amazonq\");\n const userMcp = join(userDir, \"mcp.json\");\n const projDir = join(projectDir, \".amazonq\");\n const projMcp = join(projDir, \"mcp.json\");\n\n const userInstalled = existsSync(userDir) || existsSync(userMcp);\n const projInstalled = existsSync(projDir) || existsSync(projMcp);\n const installed = userInstalled || projInstalled;\n const scope = projInstalled && !userInstalled ? \"project\" : \"user\";\n const configPath = scope === \"project\" ? projMcp : userMcp;\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 Amazon Q config (${scope}) at ${configPath}`\n : `no Amazon Q mcp.json at ${userDir} or ${projDir}`,\n confidence: installed ? \"high\" : \"low\",\n };\n }\n\n // ── Native paths ─────────────────────────────────────────────────────────\n\n /**\n * Config directory per scope. Amazon Q uses DIFFERENT basenames:\n * user: ~/.aws/amazonq (two segments — NOT a single dotDir)\n * project: <projectDir>/.amazonq\n * This is the ONE deviation from droid/cursor's single-basename getConfigDir.\n */\n getConfigDir(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? join(ctx.projectDir, \".amazonq\")\n : join(homedir(), \".aws\", \"amazonq\");\n }\n\n getServerConfigPath(ctx: InstallContext): string {\n return join(this.getConfigDir(ctx), \"mcp.json\");\n }\n\n /**\n * Hooks live in a per-agent file, NOT the mcp.json. Amazon Q hooks have no\n * global file, so AC targets the built-in `q_cli_default` agent file at the\n * install scope (mirroring kiro's default-agent selection):\n * user → ~/.aws/amazonq/cli-agents/q_cli_default.json\n * project → <projectDir>/.amazonq/cli-agents/q_cli_default.json\n * A project install writes a project-scoped `q_cli_default` that SHADOWS the\n * user-global one (a local `q_cli_default` takes precedence and auto-loads).\n */\n getHookConfigPath(ctx: InstallContext): string {\n return join(this.getConfigDir(ctx), \"cli-agents\", DEFAULT_AGENT_FILE);\n }\n\n // ── Memory surface: the `.amazonq/rules` content tree ─────────────────────\n // Amazon Q uses `.amazonq/rules` (NOT AGENTS.md) for its OWN project rules, so\n // this override replaces the AGENTS.md base default entirely:\n // project → <projectDir>/.amazonq/rules/agent-connector.md (DEDICATED file\n // AC owns; plain Markdown, auto-applied — no frontmatter needed)\n // user → [] (no verified user/global rules dir → base installMemory\n // skip-warns rather than guessing a path the CLI may not read)\n // When `.amazonq/rules` exists as a single FILE (not a directory) we must NOT\n // create `.amazonq/rules/agent-connector.md` underneath it (that would throw\n // ENOTDIR), so memoryTargets() returns [] and installMemory() emits a precise\n // skip-warn rather than crashing (the cline `.clinerules`-is-a-file precedent).\n protected override memoryTargets(ctx: InstallContext): MemoryTarget[] {\n // An explicit platforms[amazon-q].memory.path override wins (escape hatch).\n if (this.memoryOverride(ctx)?.path) return super.memoryTargets(ctx);\n if (ctx.scope === \"project\") {\n if (this.rulesDirIsFile(ctx.projectDir)) return [];\n return [\n {\n path: join(ctx.projectDir, \".amazonq\", \"rules\", \"agent-connector.md\"),\n reason: \"amazon-q project rules dir (.amazonq/rules; agent-connector-owned file)\",\n },\n ];\n }\n // user scope: no primary-verified user/global rules dir → [] → skip-warn.\n return [];\n }\n\n /**\n * Override installMemory ONLY to surface a precise warn when `.amazonq/rules`\n * exists as a single FILE at project scope (so memoryTargets() returned []):\n * we never write under it. All other behavior delegates to the base\n * implementation (the cline `.clinerules`-is-a-file precedent).\n */\n override installMemory(ctx: InstallContext): ChangeRecord[] {\n if (\n ctx.scope === \"project\" &&\n !this.memoryOverride(ctx)?.path &&\n (ctx.connector.memory ?? []).length > 0 &&\n ctx.connector.platforms[this.id]?.memory !== false &&\n this.rulesDirIsFile(ctx.projectDir)\n ) {\n return [\n {\n platform: this.id,\n action: \"warn\",\n path: join(ctx.projectDir, \".amazonq\", \"rules\"),\n detail:\n \"existing .amazonq/rules is a file, not a directory; left untouched — \" +\n \"convert it to a .amazonq/rules/ directory to receive agent-connector memory\",\n },\n ];\n }\n return super.installMemory(ctx);\n }\n\n /** True when `<dir>/.amazonq/rules` exists and is a regular FILE (not a dir). */\n private rulesDirIsFile(dir: string): boolean {\n const p = join(dir, \".amazonq\", \"rules\");\n if (!existsSync(p)) return false;\n try {\n return statSync(p).isFile();\n } catch {\n return false;\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 amazon-q\"\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 Amazon Q's native mcpServers entry. */\n private renderServerEntry(\n ctx: InstallContext,\n server: ServerDef,\n ): AmazonQStdioServer | AmazonQHttpServer {\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 // Amazon Q has no documented native interpolation token — resolve every\n // ${env:VAR} to a literal at install time (safe path, matches droid/crush).\n const entry: AmazonQStdioServer = {\n command: resolveEnvRefsDeep(command),\n };\n if (args.length > 0) entry.args = resolveEnvRefsDeep(args);\n const env = this.renderEnv(server.env);\n if (env) entry.env = env;\n // timeout: Amazon Q uses MILLISECONDS — pass timeoutMs through unchanged.\n // Only emit when the connector explicitly sets one (do NOT invent a default).\n if (server.timeoutMs !== undefined) entry.timeout = server.timeoutMs;\n return entry;\n }\n\n // http (and any other remote transport) — Amazon Q registers a remote URL.\n // REMOTE shape: { type: \"http\", url } — explicit `type` discriminator, NO\n // `headers` (OAuth auth, not static headers), NO `disabled`.\n return {\n type: \"http\",\n url: resolveEnvRefsDeep(server.url ?? \"\"),\n };\n }\n\n /**\n * Render stdio env values. Amazon Q has no documented native interpolation\n * token, so resolve `${env:VAR}` references to literals at install time.\n */\n private renderEnv(\n env: Record<string, string> | undefined,\n ): Record<string, string> | undefined {\n if (!env || Object.keys(env).length === 0) return undefined;\n return resolveEnvRefsDeep({ ...env });\n }\n\n // ── Hook install / uninstall (merge into the default agent file) ──────────\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 amazon-q\" }];\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(),\n );\n }\n\n uninstallHooks(ctx: InstallContext): ChangeRecord[] {\n return this.removeHookEntries(ctx, this.getHookConfigPath(ctx), this.hookDescriptor());\n }\n\n /**\n * Amazon Q's hook-merge descriptor (FLAT object-of-arrays shape — each entry is\n * `{ command, matcher? }`, NO `type` field, unlike kiro's nested\n * `{ matcher, hooks:[...] }`).\n * - mapEvent = EVENT_MAP (canonical → Amazon Q trigger); unmapped events\n * (PreCompact / SessionEnd / Notification + the E1 set) warn-skip.\n * - renderEntry emits `{ command }`, adding `matcher` ONLY for the\n * matcher-meaningful triggers (preToolUse/postToolUse) when one is declared;\n * an empty matcher = all tools, so it is OMITTED (no `matcher: \"\"` noise).\n * - entryOwnsCommand / ownsEntryForRemove match the home-bin command string\n * (idempotency on re-install; whole-entry removal on uninstall). FLAT host →\n * no stripInner; an emptied trigger key is dropped by the engine.\n */\n private hookDescriptor(): HookMergeDescriptor<AmazonQHookEntry> {\n return {\n mapEvent: (e) => EVENT_MAP[e as HookEventName],\n unmappedWarnDetail: (e) => `${e} has no Amazon Q hook equivalent — skipped`,\n renderEntry: (trigger, matcher, command) => {\n const entry: AmazonQHookEntry = { command };\n if (matcher && MATCHER_TRIGGERS.has(trigger)) entry.matcher = matcher;\n return entry;\n },\n entryOwnsCommand: (entry, command) => entry.command === command,\n ownsEntryForRemove: (c) => (entry) => this.isOurCommand(entry.command, c),\n skipDetail: (trigger) => `hooks.${trigger} already registered`,\n removeDetail: (trigger, removed) => `hooks.${trigger} (${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 surface: subagents → cli-agents/<name>.json ───────────────────\n // CONTENT-ONLY: a pure native-file writer — no runtime dispatch, no home-bin\n // pointer, no telemetry wrap. Amazon Q \"agents\" are per-agent JSON files where\n // the FILENAME (minus .json) IS the agent name (agent-file-locations.md). Each\n // file is a STANDALONE agent definition: we write only { name, description,\n // prompt } (+ model / tools / allowedTools when the SubagentDef carries them)\n // and NEVER inject hooks (those live in q_cli_default.json) or mcpServers (those\n // live in mcp.json). The whole file is AC-owned, so idempotency + reversibility\n // come from writeContentFile/removeContentFile (byte-identical → skip; uninstall\n // removes the file → NO_RESIDUE).\n // user → ~/.aws/amazonq/cli-agents/<name>.json\n // project → <projectDir>/.amazonq/cli-agents/<name>.json\n\n /** Native subagent file path: <configDir>/cli-agents/<name>.json. */\n private subagentPath(ctx: InstallContext, name: string): string {\n return join(this.getConfigDir(ctx), \"cli-agents\", `${name}.json`);\n }\n\n override installSubagents(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[HOST]?.subagents === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"subagents disabled for amazon-q\" }];\n }\n if (connector.subagents.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no subagents\" }];\n }\n return connector.subagents.map((agent) => {\n // COLLISION GUARD: a subagent named `q_cli_default` resolves to the SAME\n // file as the hooks/built-in default agent — refuse it so a subagent write\n // can never clobber the hooks agent.\n if (agent.name === RESERVED_AGENT_NAME) {\n return {\n platform: this.id,\n action: \"warn\",\n detail:\n `subagent \"${agent.name}\" collides with the built-in default agent file ` +\n `(cli-agents/${DEFAULT_AGENT_FILE}); skipped — rename the subagent`,\n };\n }\n return this.writeContentFile(\n this.subagentPath(ctx, agent.name),\n this.renderSubagent(agent),\n ctx.dryRun,\n );\n });\n }\n\n override uninstallSubagents(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.subagents.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no subagents\" }];\n }\n return connector.subagents.map((agent) => {\n // Never remove the hooks/default-agent file under the collision name.\n if (agent.name === RESERVED_AGENT_NAME) {\n return {\n platform: this.id,\n action: \"warn\",\n detail:\n `subagent \"${agent.name}\" was never installed (collides with ` +\n `cli-agents/${DEFAULT_AGENT_FILE}); left untouched`,\n };\n }\n return this.removeContentFile(this.subagentPath(ctx, agent.name), ctx.dryRun);\n });\n }\n\n /**\n * Render a connector subagent into an Amazon Q agent JSON file\n * (agent-format.md):\n * { name, description, prompt } — prompt is the INLINE system-prompt string\n * (Amazon Q's `prompt` field is \"high-level context … similar to a system\n * prompt\"; we use the inline-text form, NOT a file:// ref).\n * Plus, when the SubagentDef carries them:\n * - model: only when set and not the platform-agnostic \"inherit\"\n * sentinel (Amazon Q has no \"inherit\" — omitting it applies the default).\n * - tools: SurfaceToolPolicy.allow → the `tools` array (the tools the\n * agent can use). Amazon Q's `tools` accepts plain tool-name strings and\n * `*`, the same vocabulary the portable allow-list carries.\n * - allowedTools: SurfaceToolPolicy.allow → the `allowedTools` array (tools\n * usable WITHOUT a permission prompt) — BUT only when the allow-list holds\n * no `*` (Amazon Q's allowedTools does NOT accept the `\"*\"` wildcard;\n * agent-format.md \"AllowedTools Field\"). When allow is exactly [\"*\"] we set\n * `tools` but omit `allowedTools` (every tool available, none auto-allowed).\n * `deny` has no clean Amazon Q analog (there is no disallowedTools field —\n * access is an allow-list), so a deny-only policy maps to no tool keys.\n * `readonly` is likewise dropped — Amazon Q has no read-only-agent field; the\n * permission model IS the allowedTools allow-list (no separate analog).\n * `extra` is shallow-merged last (per-platform escape hatch).\n */\n private renderSubagent(agent: SubagentDef): string {\n const obj: Record<string, unknown> = {\n name: agent.name,\n description: agent.description,\n prompt: agent.prompt,\n };\n if (agent.model !== undefined && agent.model !== \"inherit\") obj.model = agent.model;\n\n const allow = agent.tools?.allow;\n if (allow && allow.length > 0) {\n obj.tools = [...allow];\n // allowedTools rejects the \"*\" wildcard — only emit it for concrete patterns.\n const allowed = allow.filter((t) => t !== \"*\");\n if (allowed.length > 0) obj.allowedTools = allowed;\n }\n if (agent.extra) Object.assign(obj, agent.extra);\n\n // Match writeJson's serialization (2-space indent + trailing newline) so the\n // bytes are stable for writeContentFile's idempotent skip.\n return `${JSON.stringify(obj, null, 2)}\\n`;\n }\n\n // ── Diagnostics ──────────────────────────────────────────────────────────\n\n override getHealthChecks(ctx: InstallContext): readonly HealthCheck[] {\n const mcpPath = this.getServerConfigPath(ctx);\n const agentPath = this.getHookConfigPath(ctx);\n const connectorId = ctx.connector.id;\n const homeBin = ctx.homeBinPath;\n const hookEvents = ctx.connector.hookEvents;\n const checks: HealthCheck[] = [\n {\n name: `${this.name}: mcp.json present`,\n check: () =>\n existsSync(mcpPath)\n ? { status: \"OK\", detail: mcpPath }\n : { status: \"FAIL\", detail: `not found: ${mcpPath}` },\n },\n {\n name: `${this.name}: 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> }>(mcpPath);\n const bucket = cfg?.[MCP_ROOT_KEY];\n if (!cfg || !bucket) {\n return { status: \"FAIL\", detail: `no ${MCP_ROOT_KEY} in ${mcpPath}` };\n }\n return connectorId in bucket\n ? { status: \"OK\", detail: `${MCP_ROOT_KEY}.${connectorId} present` }\n : {\n status: \"FAIL\",\n detail: `no ${MCP_ROOT_KEY}.${connectorId} in ${mcpPath}`,\n };\n },\n },\n {\n name: `${this.name}: hook command registered`,\n check: () => {\n if (hookEvents.length === 0) {\n return { status: \"OK\", detail: \"no hooks declared\" };\n }\n const agent = this.readJson<AmazonQAgentFile>(agentPath);\n if (!agent) return { status: \"FAIL\", detail: `cannot read ${agentPath}` };\n const hooks = agent.hooks ?? {};\n const registered = Object.values(hooks).some((entries) =>\n (entries ?? []).some((e) => isHomeBinHookCommand(e.command, homeBin, connectorId)),\n );\n return registered\n ? { status: \"OK\", detail: \"hook command present\" }\n : { status: \"FAIL\", detail: `no hook for ${connectorId} in ${agentPath}` };\n },\n },\n ];\n\n // Content-surface checks: assert each declared subagent's JSON file exists.\n // Skip the reserved collision name (never written by installSubagents).\n for (const agent of ctx.connector.subagents) {\n if (agent.name === RESERVED_AGENT_NAME) continue;\n const p = this.subagentPath(ctx, agent.name);\n checks.push({\n name: `${this.name}: subagent ${agent.name} present`,\n check: () =>\n existsSync(p) ? { status: \"OK\", detail: p } : { status: \"FAIL\", detail: `not found: ${p}` },\n });\n }\n return checks;\n }\n\n // ── Runtime: parse Amazon Q stdin JSON → normalized event ─────────────────\n // Amazon Q's stdin payload shape and exit-code contract are IDENTICAL to kiro's,\n // so this parse + the formatReply below mirror the kiro adapter exactly.\n\n parseEvent(event: HookEventName, raw: unknown): NormalizedEvent {\n const input = (raw ?? {}) as AmazonQWireInput;\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 \"SessionStart\": {\n const ev: SessionStartEvent = {\n ...base,\n source: normalizeSessionSource(input.source),\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 default: {\n // Amazon Q never delivers PreCompact / SessionEnd / Notification nor the\n // E1 extension events (no native triggers). If the runtime dispatches one\n // anyway, surface it loudly rather than silently mis-parse.\n throw new Error(`unsupported amazon-q hook event: ${String(event)}`);\n }\n }\n }\n\n // ── Runtime: normalized response → Amazon Q native (exit-code) hook reply ──\n\n formatReply(event: HookEventName, response: HookResponse): HookReply {\n const decision = response.decision ?? \"allow\";\n\n // deny → block the action: exit 2 with the reason on stderr.\n if (decision === \"deny\") {\n return { exitCode: 2, stderr: response.reason ?? \"Blocked by hook\" };\n }\n\n // ask → Amazon Q has no native \"ask\"; degrade to deny (exit 2) to stay fail-safe.\n if (decision === \"ask\") {\n return {\n exitCode: 2,\n stderr: response.reason ?? \"Action requires user confirmation (security policy)\",\n };\n }\n\n // Stop → exit-code only (deny already handled above). No context channel on a\n // Stop hook, so anything non-deny passes through with exit 0.\n if (event === \"Stop\") {\n return { exitCode: 0 };\n }\n\n // context → inject soft guidance. Amazon Q reads agentSpawn additionalContext\n // from stdout JSON (mirrors the kiro/Claude SessionStart shape). exit 0 = allow.\n if (decision === \"context\" && response.additionalContext) {\n return {\n exitCode: 0,\n stdout: JSON.stringify({\n hookSpecificOutput: {\n hookEventName: Q_TRIGGER.agentSpawn,\n additionalContext: response.additionalContext,\n },\n }),\n };\n }\n\n // modify is unsupported (exit-code protocol — cannot rewrite args/output);\n // allow / void → pass through with exit 0.\n return { exitCode: 0 };\n }\n}\n\n/** Coerce an Amazon Q 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(value);\n } catch {\n return String(value);\n }\n}\n\nexport const adapter = new AmazonQAdapter();\nexport default adapter;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoGA,SAAS,YAAY,gBAAgB;AACrC,SAAS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AAK,UAAU,KAAK;AAAA,EAC7B,QAAQ;AACN,WAAO,OAAO,KAAK;AAAA,EACrB;AACF;AAEO,IAAM,UAAU,IAAI,eAAe;AAC1C,IAAO,mBAAQ;","names":[]}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
firstExistingRoot,
|
|
8
8
|
walkFiles
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-O7SDRBVB.js";
|
|
10
10
|
import {
|
|
11
11
|
emptyTokens,
|
|
12
12
|
inferProvider
|
|
@@ -234,4 +234,4 @@ var amp_default = ampReader;
|
|
|
234
234
|
export {
|
|
235
235
|
amp_default as default
|
|
236
236
|
};
|
|
237
|
-
//# sourceMappingURL=amp-
|
|
237
|
+
//# sourceMappingURL=amp-BQZOL5GR.js.map
|
|
@@ -7,15 +7,15 @@ import {
|
|
|
7
7
|
} from "./chunk-DBQMX75U.js";
|
|
8
8
|
import {
|
|
9
9
|
BaseAdapter
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-3I7UG52L.js";
|
|
11
11
|
import {
|
|
12
12
|
renderSkillMd
|
|
13
13
|
} from "./chunk-IEGR4TP3.js";
|
|
14
14
|
import {
|
|
15
15
|
buildWrappedStdio
|
|
16
16
|
} from "./chunk-TO57WYBB.js";
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-ZY25RG4Y.js";
|
|
18
|
+
import "./chunk-QY42WGBX.js";
|
|
19
19
|
|
|
20
20
|
// src/adapters/amp/index.ts
|
|
21
21
|
import {
|
|
@@ -631,4 +631,4 @@ export {
|
|
|
631
631
|
adapter,
|
|
632
632
|
amp_default as default
|
|
633
633
|
};
|
|
634
|
-
//# sourceMappingURL=amp-
|
|
634
|
+
//# sourceMappingURL=amp-TF5X6OGH.js.map
|
|
@@ -3,17 +3,17 @@ import {
|
|
|
3
3
|
AntigravityAdapter,
|
|
4
4
|
adapter,
|
|
5
5
|
antigravity_default
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KD4BE5MW.js";
|
|
7
7
|
import "./chunk-H53QZQJI.js";
|
|
8
8
|
import "./chunk-DBQMX75U.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-3I7UG52L.js";
|
|
10
10
|
import "./chunk-IEGR4TP3.js";
|
|
11
11
|
import "./chunk-TO57WYBB.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-ZY25RG4Y.js";
|
|
13
|
+
import "./chunk-QY42WGBX.js";
|
|
14
14
|
export {
|
|
15
15
|
AntigravityAdapter,
|
|
16
16
|
adapter,
|
|
17
17
|
antigravity_default as default
|
|
18
18
|
};
|
|
19
|
-
//# sourceMappingURL=antigravity-
|
|
19
|
+
//# sourceMappingURL=antigravity-3XHBPXZK.js.map
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
isDir,
|
|
14
14
|
listSubdirs,
|
|
15
15
|
walkFiles
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-O7SDRBVB.js";
|
|
17
17
|
import {
|
|
18
18
|
emptyTokens,
|
|
19
19
|
inferProvider
|
|
@@ -168,4 +168,4 @@ var antigravity_default = antigravityReader;
|
|
|
168
168
|
export {
|
|
169
169
|
antigravity_default as default
|
|
170
170
|
};
|
|
171
|
-
//# sourceMappingURL=antigravity-
|
|
171
|
+
//# sourceMappingURL=antigravity-EA4L225L.js.map
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
firstExistingRoot,
|
|
12
12
|
isDir,
|
|
13
13
|
walkFiles
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-O7SDRBVB.js";
|
|
15
15
|
import {
|
|
16
16
|
emptyTokens,
|
|
17
17
|
inferProvider
|
|
@@ -118,4 +118,4 @@ var antigravity_cli_default = antigravityCliReader;
|
|
|
118
118
|
export {
|
|
119
119
|
antigravity_cli_default as default
|
|
120
120
|
};
|
|
121
|
-
//# sourceMappingURL=antigravity-cli-
|
|
121
|
+
//# sourceMappingURL=antigravity-cli-B2HXZFYQ.js.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
AntigravityAdapter
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KD4BE5MW.js";
|
|
5
5
|
import "./chunk-H53QZQJI.js";
|
|
6
6
|
import "./chunk-DBQMX75U.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-3I7UG52L.js";
|
|
8
8
|
import "./chunk-IEGR4TP3.js";
|
|
9
9
|
import "./chunk-TO57WYBB.js";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-ZY25RG4Y.js";
|
|
11
|
+
import "./chunk-QY42WGBX.js";
|
|
12
12
|
|
|
13
13
|
// src/adapters/antigravity-cli/index.ts
|
|
14
14
|
import { existsSync } from "fs";
|
|
@@ -85,4 +85,4 @@ export {
|
|
|
85
85
|
adapter,
|
|
86
86
|
antigravity_cli_default as default
|
|
87
87
|
};
|
|
88
|
-
//# sourceMappingURL=antigravity-cli-
|
|
88
|
+
//# sourceMappingURL=antigravity-cli-TJGOBUPK.js.map
|
|
@@ -73,36 +73,36 @@ function renderInstallResult(result, verb) {
|
|
|
73
73
|
return lines.join("\n");
|
|
74
74
|
}
|
|
75
75
|
var COMMANDS = {
|
|
76
|
-
detect: () => import("./detect-
|
|
77
|
-
install: () => import("./install-
|
|
78
|
-
uninstall: () => import("./uninstall-
|
|
76
|
+
detect: () => import("./detect-L5OZPVFO.js"),
|
|
77
|
+
install: () => import("./install-HRCVPRAQ.js"),
|
|
78
|
+
uninstall: () => import("./uninstall-KDJYE5ET.js"),
|
|
79
79
|
// `upgrade` is the single "bring everything current" verb (re-render host
|
|
80
80
|
// config + refresh the home pointer + managed channel guidance). `sync` and
|
|
81
81
|
// `update` are kept as back-compat aliases that route to the same module so
|
|
82
82
|
// existing scripts/docs keep working without a second concept to learn.
|
|
83
|
-
upgrade: () => import("./upgrade-
|
|
84
|
-
sync: () => import("./upgrade-
|
|
85
|
-
update: () => import("./upgrade-
|
|
86
|
-
package: () => import("./package-
|
|
87
|
-
doctor: () => import("./doctor-
|
|
88
|
-
status: () => import("./status-
|
|
89
|
-
telemetry: () => import("./telemetry-
|
|
90
|
-
usage: () => import("./usage-
|
|
91
|
-
leaderboard: () => import("./leaderboard-
|
|
92
|
-
hook: () => import("./hook-
|
|
83
|
+
upgrade: () => import("./upgrade-YQRVYR5U.js"),
|
|
84
|
+
sync: () => import("./upgrade-YQRVYR5U.js"),
|
|
85
|
+
update: () => import("./upgrade-YQRVYR5U.js"),
|
|
86
|
+
package: () => import("./package-IXBSG7HD.js"),
|
|
87
|
+
doctor: () => import("./doctor-WDIQ2YFE.js"),
|
|
88
|
+
status: () => import("./status-ASBFEFQQ.js"),
|
|
89
|
+
telemetry: () => import("./telemetry-64GCGNIW.js"),
|
|
90
|
+
usage: () => import("./usage-OV2BDZKF.js"),
|
|
91
|
+
leaderboard: () => import("./leaderboard-ASGR3E2U.js"),
|
|
92
|
+
hook: () => import("./hook-JRDQ56BN.js"),
|
|
93
93
|
// Internal (omitted from USAGE): the statusline (HUD) entrypoint a host's
|
|
94
94
|
// status line config points at. Fail-safe: always exits 0 with at most a
|
|
95
95
|
// rendered line. See cli/commands/statusline.ts.
|
|
96
|
-
statusline: () => import("./statusline-
|
|
96
|
+
statusline: () => import("./statusline-WKLWSM7I.js"),
|
|
97
97
|
// Internal (omitted from USAGE): the user-invokable action entrypoint a future
|
|
98
98
|
// host affordance points at. USER-TRIGGERED: surfaces errors (exit 1 + stderr),
|
|
99
99
|
// unlike the fail-open hook / fail-safe statusline. See cli/commands/action.ts.
|
|
100
|
-
action: () => import("./action-
|
|
101
|
-
serve: () => import("./serve-
|
|
100
|
+
action: () => import("./action-AZRZ3V7E.js"),
|
|
101
|
+
serve: () => import("./serve-CFBQYKRB.js"),
|
|
102
102
|
// Hidden (omitted from USAGE): the opt-in host-native turn-usage entrypoint an
|
|
103
103
|
// AfterModel / PostInvocation hook points at. Always exits 0; records a
|
|
104
104
|
// distinct `model_turn` row. See cli/commands/usage-event.ts.
|
|
105
|
-
"usage-event": () => import("./usage-event-
|
|
105
|
+
"usage-event": () => import("./usage-event-KPI3NEX3.js")
|
|
106
106
|
};
|
|
107
107
|
var DEFAULT_PROGRAM_NAME = "agent-connector";
|
|
108
108
|
var COMMAND_USAGE = {
|
|
@@ -198,4 +198,4 @@ export {
|
|
|
198
198
|
renderInstallResult,
|
|
199
199
|
main
|
|
200
200
|
};
|
|
201
|
-
//# sourceMappingURL=chunk-
|
|
201
|
+
//# sourceMappingURL=chunk-25BNMXPP.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ensureDir
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QY42WGBX.js";
|
|
5
5
|
|
|
6
6
|
// src/core/yaml.ts
|
|
7
7
|
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
@@ -34,4 +34,4 @@ export {
|
|
|
34
34
|
writeYaml,
|
|
35
35
|
yamlObjectMapCodec
|
|
36
36
|
};
|
|
37
|
-
//# sourceMappingURL=chunk-
|
|
37
|
+
//# sourceMappingURL=chunk-2RPHDVHW.js.map
|
|
@@ -14,11 +14,12 @@ import {
|
|
|
14
14
|
removeManagedBlocksFile,
|
|
15
15
|
saveMemoryLedger,
|
|
16
16
|
upsertManagedBlockFile
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-ZY25RG4Y.js";
|
|
18
18
|
import {
|
|
19
19
|
backupsDir,
|
|
20
|
-
ensureDir
|
|
21
|
-
|
|
20
|
+
ensureDir,
|
|
21
|
+
firstSymlinkInPath
|
|
22
|
+
} from "./chunk-QY42WGBX.js";
|
|
22
23
|
|
|
23
24
|
// src/core/jsonc.ts
|
|
24
25
|
function stripJsonc(text) {
|
|
@@ -671,6 +672,15 @@ var BaseAdapter = class {
|
|
|
671
672
|
* Honors dryRun (computes the action but writes nothing).
|
|
672
673
|
*/
|
|
673
674
|
writeContentFile(path, contents, dryRun) {
|
|
675
|
+
const symlink = firstSymlinkInPath(path);
|
|
676
|
+
if (symlink !== null) {
|
|
677
|
+
return {
|
|
678
|
+
platform: this.id,
|
|
679
|
+
action: "warn",
|
|
680
|
+
path,
|
|
681
|
+
detail: `${basename(path)} skipped: symbolic link in path (${symlink})`
|
|
682
|
+
};
|
|
683
|
+
}
|
|
674
684
|
let action;
|
|
675
685
|
if (!existsSync(path)) {
|
|
676
686
|
action = "create";
|
|
@@ -695,6 +705,15 @@ var BaseAdapter = class {
|
|
|
695
705
|
* (e.g. a skill folder removed by the supporting adapter).
|
|
696
706
|
*/
|
|
697
707
|
removeContentFile(path, dryRun) {
|
|
708
|
+
const symlink = firstSymlinkInPath(path);
|
|
709
|
+
if (symlink !== null) {
|
|
710
|
+
return {
|
|
711
|
+
platform: this.id,
|
|
712
|
+
action: "warn",
|
|
713
|
+
path,
|
|
714
|
+
detail: `${basename(path)} skipped: symbolic link in path (${symlink})`
|
|
715
|
+
};
|
|
716
|
+
}
|
|
698
717
|
if (!existsSync(path)) {
|
|
699
718
|
return { platform: this.id, action: "skip", path, detail: `${basename(path)} absent` };
|
|
700
719
|
}
|
|
@@ -1148,4 +1167,4 @@ export {
|
|
|
1148
1167
|
removeFromObjectMap,
|
|
1149
1168
|
BaseAdapter
|
|
1150
1169
|
};
|
|
1151
|
-
//# sourceMappingURL=chunk-
|
|
1170
|
+
//# sourceMappingURL=chunk-3I7UG52L.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/jsonc.ts","../src/core/object-map.ts","../src/adapters/base.ts","../src/core/hook-array.ts"],"sourcesContent":["/**\n * core/jsonc — tolerant JSONC / JSON5-lite parsing.\n *\n * Many hosts document their config file as JSONC (or JSON5): // line comments,\n * /* *\\/ block comments, and trailing commas are all legal. A strict JSON.parse\n * false-fails such a perfectly valid file → null → and a careless `?? {}` then\n * OVERWRITES the user's entire config with just our entry (data loss). To avoid\n * that, every JSON/JSONC adapter parses through `parseJsonc`, which strips\n * comments + trailing commas in ONE string-aware pass before JSON.parse.\n *\n * The single pass is deliberately string-literal aware: a // or /* inside a\n * quoted value (e.g. \"http://x//y\") is NOT a comment, and a comma inside a\n * string (e.g. \"a,]\") is NOT a trailing comma — both must survive verbatim.\n */\n\n/**\n * Strip // line comments, /* *\\/ block comments, and trailing commas from JSONC\n * text in a SINGLE string-aware pass.\n *\n * Rules:\n * - While inside a string literal, every character (including //, /*, and ,)\n * is copied verbatim; backslash escapes the next character.\n * - Outside a string, // … runs to end-of-line and /* … *\\/ to its close.\n * - A comma is dropped ONLY when the next non-whitespace, non-comment token is\n * a closing `}` or `]` (a trailing comma). A comma followed by another value\n * or by end-of-input is preserved (the latter lets JSON.parse report the\n * real syntax error instead of us masking it).\n */\nexport function stripJsonc(text: string): string {\n const n = text.length;\n let out = \"\";\n let i = 0;\n let inString = false;\n let quote = \"\";\n\n while (i < n) {\n const ch = text[i] as string;\n\n if (inString) {\n out += ch;\n if (ch === \"\\\\\") {\n // Copy the escaped character verbatim (covers \\\" \\\\ \\/ etc.).\n if (i + 1 < n) {\n out += text[i + 1] as string;\n i += 2;\n continue;\n }\n } else if (ch === quote) {\n inString = false;\n }\n i += 1;\n continue;\n }\n\n const next = i + 1 < n ? (text[i + 1] as string) : \"\";\n\n // Enter a string literal.\n if (ch === '\"' || ch === \"'\") {\n inString = true;\n quote = ch;\n out += ch;\n i += 1;\n continue;\n }\n\n // Line comment — skip to end of line (keep the newline for line tracking).\n if (ch === \"/\" && next === \"/\") {\n i += 2;\n while (i < n && text[i] !== \"\\n\") i += 1;\n continue;\n }\n\n // Block comment — skip to the closing */.\n if (ch === \"/\" && next === \"*\") {\n i += 2;\n while (i < n && !(text[i] === \"*\" && text[i + 1] === \"/\")) i += 1;\n i += 2; // consume the closing */\n continue;\n }\n\n // Trailing comma — drop it only when the next significant token (skipping\n // whitespace AND comments) is a closing } or ]. This stays string-aware\n // because we only reach here outside a string.\n if (ch === \",\") {\n const closer = nextSignificant(text, i + 1);\n if (closer === \"}\" || closer === \"]\") {\n i += 1; // drop the trailing comma\n continue;\n }\n }\n\n out += ch;\n i += 1;\n }\n\n return out;\n}\n\n/**\n * Peek the next significant (non-whitespace, non-comment) character at/after\n * `from`, returning \"\" at end-of-input. Used only outside string literals.\n */\nfunction nextSignificant(text: string, from: number): string {\n const n = text.length;\n let i = from;\n while (i < n) {\n const ch = text[i] as string;\n if (ch === \" \" || ch === \"\\t\" || ch === \"\\r\" || ch === \"\\n\") {\n i += 1;\n continue;\n }\n const next = i + 1 < n ? (text[i + 1] as string) : \"\";\n if (ch === \"/\" && next === \"/\") {\n i += 2;\n while (i < n && text[i] !== \"\\n\") i += 1;\n continue;\n }\n if (ch === \"/\" && next === \"*\") {\n i += 2;\n while (i < n && !(text[i] === \"*\" && text[i + 1] === \"/\")) i += 1;\n i += 2;\n continue;\n }\n return ch;\n }\n return \"\";\n}\n\n/**\n * Parse JSONC text tolerantly: strip comments + trailing commas, then JSON.parse.\n * Throws (like JSON.parse) on genuinely malformed input — callers that want a\n * fail-soft null should wrap in try/catch (BaseAdapter.readJson does).\n */\nexport function parseJsonc<T = unknown>(text: string): T {\n return JSON.parse(stripJsonc(text)) as T;\n}\n","import type { ChangeRecord } from \"./types.js\";\n\n/**\n * Format-agnostic upsert/remove for a config that stores entries in an object\n * map at config[rootKey][entryId]. Extracted from BaseAdapter.upsertServerInJson\n * / removeServerFromJson so JSON today (and other formats via a Codec later)\n * share ONE create/skip/update + overwrite/malformed-guard orchestration. The\n * JSON binding in BaseAdapter is a byte-identical wrapper over this.\n */\n\n/** The only format-specific surface: parse a config file to a record and\n * serialize it back. parse() fail-softs to null (absent or unparseable). */\nexport interface ObjectMapCodec {\n parse(path: string): Record<string, unknown> | null;\n serialize(path: string, data: Record<string, unknown>, dryRun: boolean): void;\n /** Detection half of the overwrite guard: present, non-empty, still unparseable. */\n isPresentButUnparseable(path: string): boolean;\n}\n\n/** What to do when config[rootKey] is present but the wrong type (hand-edited to\n * an array / primitive). \"warn-skip\" leaves the user's value untouched (the JSON\n * server/hook policy); \"coerce\" replaces it with a fresh {} and proceeds (the\n * TOML/YAML host policy, used by a later follow-up). */\nexport type MalformedRootPolicy = \"warn-skip\" | \"coerce\";\n\n/** True when a PRESENT value is not a plain object map (array / primitive).\n * null/undefined is NOT malformed — that is the well-formed \"absent\" case the\n * engine creates fresh. */\nexport function isMalformedRootValue(value: unknown): boolean {\n return value != null && (typeof value !== \"object\" || Array.isArray(value));\n}\n\nexport interface ObjectMapUpsertOptions {\n codec: ObjectMapCodec;\n rootKey: string;\n platform: string;\n configPath: string;\n entryId: string;\n entry: unknown;\n dryRun?: boolean;\n policy?: MalformedRootPolicy;\n}\n\nexport interface ObjectMapRemoveOptions {\n codec: ObjectMapCodec;\n rootKey: string;\n platform: string;\n configPath: string;\n entryId: string;\n dryRun?: boolean;\n policy?: MalformedRootPolicy;\n}\n\nfunction unparseableWarn(platform: string, configPath: string): ChangeRecord {\n return {\n platform: platform as ChangeRecord[\"platform\"],\n action: \"warn\",\n path: configPath,\n detail: `existing ${configPath} is not parseable; left untouched (back it up / fix it, then re-run)`,\n };\n}\n\nfunction malformedWarn(platform: string, rootKey: string, configPath: string): ChangeRecord {\n return {\n platform: platform as ChangeRecord[\"platform\"],\n action: \"warn\",\n path: configPath,\n detail: `existing \"${rootKey}\" in ${configPath} is not an object map; left untouched (fix it, then re-run)`,\n };\n}\n\nexport function upsertInObjectMap(o: ObjectMapUpsertOptions): ChangeRecord {\n const policy = o.policy ?? \"warn-skip\";\n if (o.codec.isPresentButUnparseable(o.configPath)) {\n return unparseableWarn(o.platform, o.configPath);\n }\n const cfg = o.codec.parse(o.configPath) ?? {};\n if (isMalformedRootValue(cfg[o.rootKey])) {\n if (policy === \"warn-skip\") return malformedWarn(o.platform, o.rootKey, o.configPath);\n cfg[o.rootKey] = {}; // coerce\n }\n const bucket = (cfg[o.rootKey] ?? (cfg[o.rootKey] = {})) as Record<string, unknown>;\n const before = JSON.stringify(bucket[o.entryId]);\n const after = JSON.stringify(o.entry);\n let action: ChangeRecord[\"action\"];\n if (before === undefined) action = \"create\";\n else if (before === after) action = \"skip\";\n else action = \"update\";\n if (action !== \"skip\") {\n bucket[o.entryId] = o.entry;\n o.codec.serialize(o.configPath, cfg, o.dryRun ?? false);\n }\n return {\n platform: o.platform as ChangeRecord[\"platform\"],\n action,\n path: o.configPath,\n detail: `${o.rootKey}.${o.entryId}`,\n };\n}\n\nexport function removeFromObjectMap(o: ObjectMapRemoveOptions): ChangeRecord {\n const policy = o.policy ?? \"warn-skip\";\n if (o.codec.isPresentButUnparseable(o.configPath)) {\n return unparseableWarn(o.platform, o.configPath);\n }\n const cfg = o.codec.parse(o.configPath);\n if (cfg && isMalformedRootValue(cfg[o.rootKey])) {\n if (policy === \"warn-skip\") return malformedWarn(o.platform, o.rootKey, o.configPath);\n // coerce: a malformed root holds nothing of ours to remove → absent skip\n return {\n platform: o.platform as ChangeRecord[\"platform\"],\n action: \"skip\",\n path: o.configPath,\n detail: `${o.rootKey}.${o.entryId} absent`,\n };\n }\n const bucket = cfg?.[o.rootKey] as Record<string, unknown> | undefined;\n if (!cfg || !bucket || !(o.entryId in bucket)) {\n return {\n platform: o.platform as ChangeRecord[\"platform\"],\n action: \"skip\",\n path: o.configPath,\n detail: `${o.rootKey}.${o.entryId} absent`,\n };\n }\n delete bucket[o.entryId];\n o.codec.serialize(o.configPath, cfg, o.dryRun ?? false);\n return {\n platform: o.platform as ChangeRecord[\"platform\"],\n action: \"remove\",\n path: o.configPath,\n detail: `${o.rootKey}.${o.entryId}`,\n };\n}\n","/**\n * adapters/base — shared adapter foundation.\n *\n * Provides JSON config IO, settings backup, and a default doctor. Per-platform\n * specifics (paths, capabilities, native render format, runtime parse/format)\n * are abstract and implemented by each adapter. TOML/YAML adapters override the\n * JSON helpers entirely.\n */\n\nimport {\n copyFileSync,\n existsSync,\n readdirSync,\n readFileSync,\n rmSync,\n statSync,\n writeFileSync,\n} from \"node:fs\";\nimport type { Dirent } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { basename, dirname, isAbsolute, join, relative, resolve, sep } from \"node:path\";\n\nimport type {\n ChangeRecord,\n DetectedPlatform,\n DiagnosticResult,\n HealthCheck,\n HookParadigm,\n PlatformCapabilities,\n PlatformId,\n PlatformMemoryOverride,\n} from \"../core/types.js\";\nimport { backupsDir, ensureDir, firstSymlinkInPath } from \"../core/paths.js\";\nimport { parseJsonc } from \"../core/jsonc.js\";\nimport {\n isMalformedRootValue as isMalformedRootValueFn,\n removeFromObjectMap,\n upsertInObjectMap,\n type ObjectMapCodec,\n} from \"../core/object-map.js\";\nimport { removeFromArray, upsertInArray } from \"../core/hook-array.js\";\nimport { buildHomeBinActionCommand, buildHomeBinHookCommand } from \"../core/spawn.js\";\nimport {\n MEMORY_CONTENT_SOFT_BUDGET_BYTES,\n listManagedBlocks,\n loadMemoryLedger,\n recordMemoryTarget,\n removeManagedBlocksFile,\n saveMemoryLedger,\n upsertManagedBlockFile,\n} from \"../core/managed-block.js\";\nimport { renderFrontmatterMd } from \"./claude-code/render.js\";\nimport type { Adapter, InstallContext, MemoryTarget } from \"./spi.js\";\n\n/** Content-surface kinds with BaseAdapter default install/uninstall handling. */\ntype ContentSurface =\n | \"commands\"\n | \"skills\"\n | \"subagents\"\n | \"memory\"\n | \"statusline\"\n | \"actions\";\n\n/**\n * Per-host policy + observables for the shared object-map hook-array merge\n * engine ({@link BaseAdapter.upsertHookEntries} / {@link BaseAdapter.removeHookEntries}).\n * `E` is the host's per-event array element type (e.g. claude-code's\n * `{ matcher, hooks: [...] }`). EVERY observable string + ownership predicate\n * is carried here so the engine body hardcodes none of them and per-host\n * wording never drifts; a future host needing divergent details overrides only\n * its descriptor, not the engine.\n */\nexport interface HookMergeDescriptor<E> {\n /**\n * How to handle a present-but-malformed `hooks` root (an array / primitive\n * instead of an object map) on install:\n * - \"warn-skip\" (DEFAULT): route through {@link BaseAdapter.malformedHookRootSkip}\n * — surface a `warn`, write nothing, leave the user's value untouched. This\n * is byte-identical to the pre-axis engine, so existing hosts that omit the\n * field are unchanged.\n * - \"coerce\": replace a malformed root (and any non-array event bucket) with a\n * fresh object map / array, then proceed — matching the container hosts\n * (codex, goose) whose server path already coerces a malformed root.\n */\n malformedPolicy?: \"warn-skip\" | \"coerce\";\n /**\n * Canonical → host event name. `undefined` = the host has no equivalent for\n * this event → the engine emits a warn (via unmappedWarnDetail) and skips it.\n * Omit the field entirely for identity hosts (claude-code) — no warn path.\n */\n mapEvent?(event: string): string | undefined;\n /** Warn detail for an event mapEvent returns undefined for. Required iff mapEvent can return undefined. */\n unmappedWarnDetail?(event: string): string;\n /** Render one host entry from the event name, declared matcher, and home-bin command. */\n renderEntry(event: string, matcher: string, command: string): E;\n /** Upsert find: does `entry` already carry THIS specific command (idempotency check)? */\n entryOwnsCommand(entry: E, command: string): boolean;\n /**\n * Uninstall whole-entry predicate (FLAT hosts): does `entry` belong to us?\n * NESTED hosts supplying {@link stripInner} may return a never-true predicate —\n * the engine then only ever invokes `stripInner`. Bound to `ctx` because\n * ownership is connector-generic (ANY of our commands), wider than the\n * install-time specific-command check. The `event` param lets EVENT-SPECIFIC\n * hosts (codex, whose ownership is per-event by construction) match the\n * canonical event being stripped; hosts whose ownership is event-independent\n * (claude-code/droid/cursor/qwen) ignore it — a `(ctx) => …` arrow is assignable\n * to this 2-param type (fewer params is fine in TS), so they need no change.\n */\n ownsEntryForRemove(ctx: InstallContext, event: string): (entry: E) => boolean;\n /**\n * Uninstall inner-strip (NESTED hosts): strip our owned inner commands from\n * `entry`, returning the rebuilt entry (`null` when fully emptied) and the\n * count of inner commands removed. Omit for FLAT hosts.\n */\n stripInner?(ctx: InstallContext): (entry: E) => { next: E | null; removed: number };\n /** Idempotent-reinstall skip detail, e.g. `hooks.<event> already registered`. */\n skipDetail(event: string): string;\n /** Uninstall remove detail, e.g. `hooks.<event> (<n>)`. */\n removeDetail(event: string, removed: number): string;\n /** Uninstall skip detail when no hooks section is present at all. */\n absentDetail: string;\n /** Uninstall skip detail when a hooks section exists but nothing matched. */\n noMatchDetail: string;\n /**\n * Uninstall: the exact event keys to scan, in order. Omit (default) to scan\n * every key actually present (`Object.keys(hooks)`). EVENT-SPECIFIC hosts whose\n * ownership predicate rebuilds a per-event command (codex) MUST pin their fixed\n * event set here so a home-bin command hand-placed under a foreign event key is\n * left untouched — byte-identical to a fixed-event-list uninstall loop.\n */\n removeEventKeys?: readonly string[];\n /** Optional post-mutation hook on the whole parsed file, before the single write. */\n onMutate?(file: Record<string, unknown>): void;\n /**\n * Native-pass ownership find (EXACT command match, vs the normalized\n * entryOwnsCommand). Set only when a `native` list is passed.\n */\n nativeOwnsCommand?(entry: E, command: string): boolean;\n /** Native-pass skip detail, e.g. `hooks.<event> (native) already registered`. */\n nativeSkipDetail?(event: string): string;\n /** Native-pass create/update detail, e.g. `hooks.<event> (native)`. */\n nativeMutateDetail?(event: string): string;\n}\n\n/**\n * One resolved action trigger for an EMITTER adapter: the host-native trigger\n * the adapter writes runs `command`, which re-enters the home binary at the\n * `action` verb. `label`/`description` fall back to the action id when the\n * connector declared none. Produced by {@link BaseAdapter.actionTriggers}.\n */\nexport interface ActionTrigger {\n /** The action id — also the per-action file/key name on most hosts. */\n id: string;\n /** Display label (action.description ?? action.id). */\n label: string;\n /** One-line description (action.description ?? action.id). */\n description: string;\n /** `<homeBin> action <host> <id> --connector <connectorId>` (the verb the host runs). */\n command: string;\n}\n\n/**\n * Documented USER-scope AGENTS.md locations, per host (the AGENTS.md-first\n * research matrix). Only hosts with a REAL user/global AGENTS.md file are\n * listed. Hosts whose documented user-scope memory lives in a DIFFERENT file\n * (qwen-code ~/.qwen/QWEN.md, goose .goosehints, kilo/roo/kiro rules dirs,\n * copilot-cli copilot-instructions.md) override memoryTargets in-adapter;\n * hosts whose user rules are app/UI/cloud-managed (warp Drive, trae,\n * jetbrains/cursor settings UI) deliberately have no row — user-scope memory\n * there reports the standard skip-warn (the JetBrains-MCP precedent), never a\n * write into a file the host ignores.\n */\nconst AGENTS_MD_USER_PATHS: Partial<Record<PlatformId, () => MemoryTarget>> = {\n // codex resolves its own user path in-adapter ($CODEX_HOME with ~ expansion\n // + the AGENTS.override.md shadow probe) — deliberately no row here.\n zed: () => ({\n path:\n process.platform === \"win32\" && process.env.APPDATA\n ? join(process.env.APPDATA, \"Zed\", \"AGENTS.md\")\n : join(homedir(), \".config\", \"zed\", \"AGENTS.md\"),\n reason: \"zed personal instructions file\",\n }),\n amp: () => ({\n path: join(homedir(), \".config\", \"amp\", \"AGENTS.md\"),\n reason: \"amp user-scope AGENTS.md\",\n }),\n mux: () => ({\n path: join(homedir(), \".mux\", \"AGENTS.md\"),\n reason: \"mux global AGENTS.md\",\n }),\n pi: () => ({\n path: join(homedir(), \".pi\", \"agent\", \"AGENTS.md\"),\n reason: \"pi global AGENTS.md\",\n }),\n droid: () => ({\n path: join(homedir(), \".factory\", \"AGENTS.md\"),\n reason: \"droid (Factory) personal AGENTS.md\",\n }),\n opencode: () => ({\n path: join(homedir(), \".config\", \"opencode\", \"AGENTS.md\"),\n reason: \"opencode global AGENTS.md\",\n }),\n antigravity: () => ({\n path: join(homedir(), \".gemini\", \"AGENTS.md\"),\n reason: \"antigravity global rules (~/.gemini/AGENTS.md, shared tree)\",\n }),\n \"antigravity-cli\": () => ({\n path: join(homedir(), \".gemini\", \"AGENTS.md\"),\n reason: \"agy shares the IDE's ~/.gemini tree (idempotent upsert dedupes)\",\n }),\n omp: () => ({\n path: join(homedir(), \".omp\", \"agent\", \"AGENTS.md\"),\n reason: \"omp global AGENTS.md (pi-parity; verify for your version)\",\n }),\n};\n\nexport abstract class BaseAdapter implements Adapter {\n abstract readonly id: PlatformId;\n abstract readonly name: string;\n abstract readonly paradigm: HookParadigm;\n abstract readonly capabilities: PlatformCapabilities;\n\n abstract detectInstalled(projectDir: string): DetectedPlatform;\n abstract getConfigDir(ctx: InstallContext): string;\n abstract getServerConfigPath(ctx: InstallContext): string;\n abstract getHookConfigPath(ctx: InstallContext): string;\n abstract installServer(ctx: InstallContext): ChangeRecord[];\n abstract uninstallServer(ctx: InstallContext): ChangeRecord[];\n abstract installHooks(ctx: InstallContext): ChangeRecord[];\n abstract uninstallHooks(ctx: InstallContext): ChangeRecord[];\n\n // ── Content surfaces (commands / skills / subagents) ─────────────────────\n // CONCRETE (overridable) defaults so every adapter inherits all six methods\n // and the installer can call them without optional-chaining. Each returns a\n // single skip when the connector declares no entries of that surface, else a\n // single \"warn\" — mirroring the mcp-only hook handling. Supporting adapters\n // override only the surfaces they honor.\n\n installCommands(ctx: InstallContext): ChangeRecord[] {\n return this.unsupportedSurface(ctx, \"commands\", ctx.connector.commands.length);\n }\n uninstallCommands(ctx: InstallContext): ChangeRecord[] {\n return this.unsupportedSurface(ctx, \"commands\", ctx.connector.commands.length);\n }\n installSkills(ctx: InstallContext): ChangeRecord[] {\n return this.unsupportedSurface(ctx, \"skills\", ctx.connector.skills.length);\n }\n uninstallSkills(ctx: InstallContext): ChangeRecord[] {\n return this.unsupportedSurface(ctx, \"skills\", ctx.connector.skills.length);\n }\n installSubagents(ctx: InstallContext): ChangeRecord[] {\n return this.unsupportedSurface(ctx, \"subagents\", ctx.connector.subagents.length);\n }\n uninstallSubagents(ctx: InstallContext): ChangeRecord[] {\n return this.unsupportedSurface(ctx, \"subagents\", ctx.connector.subagents.length);\n }\n\n // ── Memory surface (managed marker blocks; AGENTS.md-first) ───────────────\n // ONE generic implementation for every supporting host: the per-adapter\n // `memoryTargets()` hook resolves WHERE to write (AGENTS.md defaults below;\n // claude-code → CLAUDE.md and gemini-cli → GEMINI.md override it), and the\n // core/managed-block engine performs the surgical, hash-stamped block edit.\n // Unlike commands/skills/subagents these files are SHARED and user-authored —\n // bytes outside this connector's own marker pair are never touched.\n\n /**\n * Resolve the memory/rules file(s) this host actually reads at ctx.scope.\n * Base default (AGENTS.md-first, owner mandate):\n * - an explicit `platforms[<id>].memory.path` override wins;\n * - project scope → `<projectDir>/AGENTS.md` (the agents.md standard);\n * - user scope → the host's documented user-scope AGENTS.md, when one\n * exists ({@link AGENTS_MD_USER_PATHS}); otherwise [] → skip-warn.\n * Exception hosts (claude-code, gemini-cli) override this hook.\n */\n protected memoryTargets(ctx: InstallContext): MemoryTarget[] {\n const override = this.memoryOverride(ctx);\n if (override?.path) {\n const base = ctx.scope === \"project\" ? ctx.projectDir : homedir();\n return [\n {\n path: isAbsolute(override.path) ? override.path : join(base, override.path),\n reason: `platforms.${this.id}.memory.path override`,\n },\n ];\n }\n if (ctx.scope === \"project\") {\n return [\n { path: join(ctx.projectDir, \"AGENTS.md\"), reason: \"AGENTS.md standard (project root)\" },\n ];\n }\n if (ctx.scope === \"user\") {\n const user = AGENTS_MD_USER_PATHS[this.id]?.();\n return user ? [user] : [];\n }\n return [];\n }\n\n /** The per-platform memory override object, when one is declared. */\n protected memoryOverride(ctx: InstallContext): PlatformMemoryOverride | undefined {\n const o = ctx.connector.platforms[this.id]?.memory;\n return o && typeof o === \"object\" ? o : undefined;\n }\n\n installMemory(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n // `?? []` tolerates pre-resolved connectors from versions before the\n // memory surface existed (the installer applies the same guard).\n const entries = connector.memory ?? [];\n if (connector.platforms[this.id]?.memory === false) {\n return [{ platform: this.id, action: \"skip\", detail: `memory disabled for ${this.id}` }];\n }\n if (entries.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no memory\" }];\n }\n if (!(this.capabilities.supportsMemory ?? false)) {\n return this.unsupportedSurface(ctx, \"memory\", entries.length);\n }\n\n const changes: ChangeRecord[] = [];\n const override = this.memoryOverride(ctx);\n if (override?.mode && this.id !== \"claude-code\") {\n changes.push({\n platform: this.id,\n action: \"warn\",\n detail: `memory.mode is claude-code-only; ignored on ${this.id}`,\n });\n }\n if (ctx.scope !== \"project\" && ctx.scope !== \"user\") {\n // system/profile/managed memory files are admin-owned — out of scope (v1).\n changes.push({\n platform: this.id,\n action: \"warn\",\n detail:\n `memory not supported at ${ctx.scope} scope on ${this.id} ` +\n `(managed/admin memory files are out of scope); ${entries.length} skipped`,\n });\n return changes;\n }\n const targets = this.memoryTargets(ctx);\n if (targets.length === 0) {\n changes.push({\n platform: this.id,\n action: \"warn\",\n detail:\n `no ${ctx.scope}-scope memory file on ${this.id} ` +\n `(user rules are app/UI-managed or undocumented); ${entries.length} skipped`,\n });\n return changes;\n }\n changes.push(...this.writeMemoryBlocks(ctx, targets));\n return changes;\n }\n\n /**\n * Upsert every declared memory entry's block into every resolved target and\n * record the ownership ledger rows (`connectorDir(id)/memory-state.json`).\n * Shared by the base implementation and the exception-host overrides.\n */\n protected writeMemoryBlocks(ctx: InstallContext, targets: MemoryTarget[]): ChangeRecord[] {\n const changes: ChangeRecord[] = [];\n const ledger = loadMemoryLedger(ctx.connector.id);\n let ledgerMutated = false;\n\n for (const target of targets) {\n for (const entry of ctx.connector.memory ?? []) {\n const blockId = `${ctx.connector.id}/${entry.name ?? \"memory\"}`;\n const res = upsertManagedBlockFile(target.path, {\n blockId,\n connectorId: ctx.connector.id,\n content: entry.content,\n ...(target.commentStyle ? { commentStyle: target.commentStyle } : {}),\n force: ctx.force ?? false,\n dryRun: ctx.dryRun,\n });\n changes.push({\n platform: this.id,\n action: res.action,\n path: target.path,\n detail: `memory: ${res.detail} — ${target.reason}`,\n });\n if (res.backupPath) {\n changes.push({\n platform: this.id,\n action: \"create\",\n path: res.backupPath,\n detail: \"backed up memory file before destructive change\",\n });\n }\n const bytes = Buffer.byteLength(entry.content, \"utf8\");\n if (bytes > MEMORY_CONTENT_SOFT_BUDGET_BYTES) {\n changes.push({\n platform: this.id,\n action: \"warn\",\n path: target.path,\n detail:\n `memory entry \"${entry.name ?? \"memory\"}\" is ${bytes} bytes ` +\n `(soft budget ${MEMORY_CONTENT_SOFT_BUDGET_BYTES}); this file is injected into ` +\n `every prompt — keep guidance terse`,\n });\n }\n if (res.action !== \"warn\") {\n recordMemoryTarget(ledger, {\n platform: this.id,\n scope: ctx.scope,\n path: target.path,\n blockId,\n createdFile: res.createdFile,\n hash: res.hash,\n });\n ledgerMutated = true;\n }\n }\n // Per-FILE budget (e.g. codex caps combined project docs at 32 KiB —\n // budgetBytes ≈ 28 KiB leaves headroom): warn when the whole target file\n // (user content + every block) outgrows what the host will actually load.\n if (target.budgetBytes !== undefined && !ctx.dryRun && existsSync(target.path)) {\n const fileBytes = statSync(target.path).size;\n if (fileBytes > target.budgetBytes) {\n changes.push({\n platform: this.id,\n action: \"warn\",\n path: target.path,\n detail:\n `memory file is ${fileBytes} bytes — over this host's ~${target.budgetBytes}-byte ` +\n `budget; the host may truncate or drop it`,\n });\n }\n }\n }\n\n if (ledgerMutated && !ctx.dryRun) saveMemoryLedger(ctx.connector.id, ledger);\n return changes;\n }\n\n uninstallMemory(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (!(this.capabilities.supportsMemory ?? false)) {\n // Nothing could ever have been written by a non-supporting adapter.\n return this.unsupportedSurface(ctx, \"memory\", (connector.memory ?? []).length);\n }\n\n // Candidate files = union of (a) memoryTargets recomputed NOW (probe re-run\n // — catches teammate machines with no ledger; the markers in the committed\n // file are the source of truth) and (b) ledger rows for this platform from\n // EVERY scope (catches a scope flag that differs from install time).\n const ledger = loadMemoryLedger(connector.id);\n const mine = ledger.targets.filter((t) => t.platform === this.id);\n const candidates = new Map<string, { createdFile: boolean }>();\n if (ctx.scope === \"project\" || ctx.scope === \"user\") {\n for (const t of this.memoryTargets(ctx)) {\n candidates.set(t.path, { createdFile: false });\n }\n }\n for (const row of mine) {\n const existing = candidates.get(row.path);\n candidates.set(row.path, { createdFile: (existing?.createdFile ?? false) || row.createdFile });\n }\n if (candidates.size === 0) {\n return [\n { platform: this.id, action: \"skip\", detail: `no memory targets to clean on ${this.id}` },\n ];\n }\n\n // Prefix scan (`<connectorId>/`), NOT the declared entry list: renamed or\n // removed entries and stale blocks from older versions are reclaimed too.\n const changes: ChangeRecord[] = [];\n for (const [path, { createdFile }] of candidates) {\n const results = removeManagedBlocksFile(\n path,\n { blockIdPrefix: `${connector.id}/` },\n { dryRun: ctx.dryRun, deleteFileIfCreated: createdFile },\n );\n for (const r of results) {\n changes.push({\n platform: this.id,\n action: r.action,\n path: r.path,\n detail: `memory: ${r.detail}`,\n });\n if (r.backupPath) {\n changes.push({\n platform: this.id,\n action: \"create\",\n path: r.backupPath,\n detail: \"backed up memory file before block removal\",\n });\n }\n }\n }\n\n // Prune this connector's ledger rows for this platform (the file itself is\n // deleted when no rows remain). Markers stay the uninstall source of truth.\n if (!ctx.dryRun && mine.length > 0) {\n ledger.targets = ledger.targets.filter((t) => t.platform !== this.id);\n saveMemoryLedger(connector.id, ledger);\n }\n return changes;\n }\n\n /**\n * Doctor: per-ledger-row memory state for this platform — file present,\n * block present, and recorded-vs-actual inner hash (drift → warn, the\n * user edited inside our block; sync reports the same drift and never\n * clobbers it without --force).\n */\n protected memoryDiagnostics(ctx: InstallContext): DiagnosticResult[] {\n const results: DiagnosticResult[] = [];\n const rows = loadMemoryLedger(ctx.connector.id).targets.filter(\n (t) => t.platform === this.id,\n );\n for (const row of rows) {\n const check = `${this.name}: memory block ${row.blockId}`;\n if (!existsSync(row.path)) {\n results.push({\n check,\n status: \"warn\",\n message: `memory file missing: ${row.path}`,\n fix: \"agent-connector install (sync) will re-create the block\",\n fixable: true,\n });\n continue;\n }\n let raw: string;\n try {\n raw = readFileSync(row.path, \"utf8\");\n } catch {\n results.push({ check, status: \"warn\", message: `cannot read ${row.path}` });\n continue;\n }\n const block = listManagedBlocks(raw).find((b) => b.blockId === row.blockId);\n if (!block) {\n results.push({\n check,\n status: \"warn\",\n message: `managed block not found in ${row.path}`,\n fix: \"agent-connector install (sync) will re-append it\",\n fixable: true,\n });\n } else if (block.drifted) {\n results.push({\n check,\n status: \"warn\",\n message:\n `user-edited: inner content hash ${block.actualHash} differs from recorded ` +\n `${block.recordedHash} in ${row.path}; sync leaves it intact (use --force to overwrite)`,\n });\n } else {\n results.push({ check, status: \"pass\", message: `intact in ${row.path}` });\n }\n // Shadow-flip probe: re-run memoryTargets NOW for the row's scope — if\n // the host's resolution moved (a WARP.md / AGENTS.override.md / .rules /\n // .hermes.md appeared, gemini context.fileName changed), the written\n // block sits in a file the host no longer reads. The #1 wrong-file\n // risk; doctor is the detection layer.\n // (`_shared/` bridge rows deliberately live OUTSIDE memoryTargets —\n // e.g. claude-code's @AGENTS.md import in CLAUDE.md — skip those.)\n if (\n !row.blockId.startsWith(\"_shared/\") &&\n row.scope === ctx.scope &&\n (ctx.scope === \"project\" || ctx.scope === \"user\")\n ) {\n const current = this.memoryTargets(ctx);\n if (current.length > 0 && !current.some((t) => t.path === row.path)) {\n results.push({\n check,\n status: \"warn\",\n message:\n `${this.id} now resolves its ${row.scope}-scope memory file to ` +\n `${current[0]!.path} (${current[0]!.reason}) — the block in ${row.path} ` +\n `may no longer be read`,\n fix: \"agent-connector install (sync) re-probes and writes the file the host reads now\",\n fixable: true,\n });\n }\n }\n }\n return results;\n }\n\n // ── Declarative host-config key patches (configPatch) ─────────────────────\n // CONCRETE (overridable) defaults, mirroring the content surfaces above: the\n // installer additionally guards these behind capabilities.supportsConfigPatch\n // (the nativeHooks precedent), so these defaults only fire if a capability-\n // flagged adapter forgot to override them — still skip-warn, never silent.\n\n installConfigPatches(ctx: InstallContext): ChangeRecord[] {\n const count = (ctx.connector.platforms[this.id]?.configPatch ?? []).length;\n if (count === 0) {\n return [\n { platform: this.id, action: \"skip\", detail: \"connector declares no configPatch entries\" },\n ];\n }\n return [\n {\n platform: this.id,\n action: \"warn\",\n detail: `configPatch not supported on ${this.id}; ${count} skipped`,\n },\n ];\n }\n\n uninstallConfigPatches(_ctx: InstallContext): ChangeRecord[] {\n // Nothing was ever applied by a non-supporting adapter → nothing to release.\n return [];\n }\n\n // ── Statusline surface (a HUD/status line) ────────────────────────────────\n // CONCRETE (overridable) defaults, mirroring the content surfaces: the\n // installer calls these unconditionally (BaseAdapter defines them), and they\n // self-skip when the connector declares no statusline, else skip-warn on a\n // non-supporting host. Only claude-code overrides them today.\n\n installStatusline(ctx: InstallContext): ChangeRecord[] {\n if (ctx.connector.statusline == null) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no statusline\" }];\n }\n if (ctx.connector.platforms[this.id]?.statusline === false) {\n return [{ platform: this.id, action: \"skip\", detail: `statusline disabled for ${this.id}` }];\n }\n if (!(this.capabilities.supportsStatusline ?? false)) {\n return this.unsupportedSurface(ctx, \"statusline\", 1);\n }\n // A supporting adapter must override this; the default is the same skip-warn\n // safety net the configPatch defaults provide (never silent).\n return this.unsupportedSurface(ctx, \"statusline\", 1);\n }\n\n uninstallStatusline(ctx: InstallContext): ChangeRecord[] {\n if (ctx.connector.statusline == null) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no statusline\" }];\n }\n if (!(this.capabilities.supportsStatusline ?? false)) {\n // Nothing could ever have been written by a non-supporting adapter.\n return this.unsupportedSurface(ctx, \"statusline\", 1);\n }\n return this.unsupportedSurface(ctx, \"statusline\", 1);\n }\n\n // ── Action surface (a user-invokable action) ──────────────────────────────\n // CONCRETE (overridable) defaults, mirroring the statusline pair. v1 ships\n // ONLY the dispatch backbone: there is no verifiable host affordance to emit,\n // so EVERY host honestly skip-warns and NO adapter overrides these. (`?? []`\n // tolerates pre-resolved connectors from versions before the action surface\n // existed, exactly like installMemory.)\n\n installActions(ctx: InstallContext): ChangeRecord[] {\n return this.unsupportedSurface(ctx, \"actions\", (ctx.connector.actions ?? []).length);\n }\n uninstallActions(ctx: InstallContext): ChangeRecord[] {\n return this.unsupportedSurface(ctx, \"actions\", (ctx.connector.actions ?? []).length);\n }\n\n /**\n * Shared, surface-agnostic helper for the action EMITTERS: yield one\n * {@link ActionTrigger} per declared action, each carrying the home-bin verb\n * command the host trigger must run\n * (`<homeBin> action <host> <actionId> --connector <id>`, via\n * {@link buildHomeBinActionCommand}) plus a `label`/`description` that fall\n * back to the action id. Each supporting adapter iterates this and writes its\n * host-native trigger (hermes quick_commands / warp workflow / droid exec\n * file) — the per-host file shape is NOT this helper's concern, only the\n * common (id, label, description, command) tuple. Callers own the standard\n * guards (platforms[id].actions === false / empty actions).\n */\n protected actionTriggers(ctx: InstallContext): ActionTrigger[] {\n return (ctx.connector.actions ?? []).map((action) => ({\n id: action.id,\n label: action.description ?? action.id,\n description: action.description ?? action.id,\n command: buildHomeBinActionCommand(\n ctx.homeBinPath,\n this.id,\n action.id,\n ctx.connector.id,\n ),\n }));\n }\n\n /**\n * Default response for a content surface this platform cannot honor: a single\n * skip when the connector declares none of that surface, else a single \"warn\"\n * ChangeRecord noting how many were skipped. Mirrors mcp-only hook handling.\n */\n protected unsupportedSurface(\n _ctx: InstallContext,\n surface: ContentSurface,\n count: number,\n ): ChangeRecord[] {\n if (count === 0) {\n return [{ platform: this.id, action: \"skip\", detail: `connector declares no ${surface}` }];\n }\n return [\n {\n platform: this.id,\n action: \"warn\",\n detail: `${surface} not supported on ${this.id}; ${count} skipped`,\n },\n ];\n }\n\n // ── Content-file helpers (used by surface-supporting adapters) ────────────\n\n /**\n * Write a content file idempotently: \"skip\" when the existing bytes are\n * already identical, else \"create\"/\"update\". Creates parent dirs (mkdir -p).\n * Honors dryRun (computes the action but writes nothing).\n */\n protected writeContentFile(path: string, contents: string, dryRun: boolean): ChangeRecord {\n const symlink = firstSymlinkInPath(path);\n if (symlink !== null) {\n return {\n platform: this.id,\n action: \"warn\",\n path,\n detail: `${basename(path)} skipped: symbolic link in path (${symlink})`,\n };\n }\n\n let action: ChangeRecord[\"action\"];\n if (!existsSync(path)) {\n action = \"create\";\n } else {\n let current: string | null = null;\n try {\n current = readFileSync(path, \"utf8\");\n } catch {\n current = null;\n }\n action = current === contents ? \"skip\" : \"update\";\n }\n if (action !== \"skip\" && !dryRun) {\n ensureDir(dirname(path));\n writeFileSync(path, contents, \"utf8\");\n }\n return { platform: this.id, action, path, detail: basename(path) };\n }\n\n /**\n * Remove a content file we wrote; \"skip\" when already absent. Honors dryRun.\n * Uses rmSync with `force` to also tolerate a path that is a directory tree\n * (e.g. a skill folder removed by the supporting adapter).\n */\n protected removeContentFile(path: string, dryRun: boolean): ChangeRecord {\n const symlink = firstSymlinkInPath(path);\n if (symlink !== null) {\n return {\n platform: this.id,\n action: \"warn\",\n path,\n detail: `${basename(path)} skipped: symbolic link in path (${symlink})`,\n };\n }\n\n if (!existsSync(path)) {\n return { platform: this.id, action: \"skip\", path, detail: `${basename(path)} absent` };\n }\n if (!dryRun) {\n rmSync(path, { recursive: true, force: true });\n }\n return { platform: this.id, action: \"remove\", path, detail: basename(path) };\n }\n\n /**\n * Defense-in-depth path containment: resolve `rel` against `baseDir` and\n * return the absolute path ONLY when it stays inside `baseDir`. Returns null\n * when `rel` escapes (absolute path, `..` traversal, etc.) so a caller can\n * skip-and-warn rather than write/delete outside the surface dir. This is the\n * runtime backstop behind the config-time validation in normalizeSkills.\n */\n protected resolveWithin(baseDir: string, rel: string): string | null {\n const base = resolve(baseDir);\n const target = resolve(base, rel);\n if (target === base) return null; // rel resolved to the dir itself (e.g. \"\" / \".\")\n const rind = relative(base, target);\n // Outside when the relative path climbs out (`..`) or is itself absolute.\n if (rind === \"\" || rind.startsWith(\"..\") || resolve(base, rind) !== target) {\n return null;\n }\n if (rind === \"..\" || rind.startsWith(`..${sep}`)) return null;\n return target;\n }\n\n /**\n * Recursively report whether a directory tree contains any regular FILE (vs\n * only empty/nested-empty subdirectories). Symlinks count as files (we never\n * recurse through them). Used by removeDirIfEmpty to decide if a tree is safe\n * to drop. An unreadable entry is treated as \"a file is present\" (conservative).\n */\n private dirTreeHasFile(dir: string): boolean {\n let entries: Dirent[];\n try {\n entries = readdirSync(dir, { withFileTypes: true });\n } catch {\n return true; // unreadable → assume it holds data; do not remove\n }\n for (const e of entries) {\n if (e.isDirectory()) {\n if (this.dirTreeHasFile(join(dir, e.name))) return true;\n } else {\n return true; // a file / symlink / special → the tree is not \"empty\"\n }\n }\n return false;\n }\n\n /**\n * Remove a directory ONLY when its tree holds NO regular files — i.e. it is\n * empty or contains only (nested) empty directories, such as the intermediate\n * dirs our own nested skill resources created. Replaces the unconditional\n * `rm -rf <dir>` that uninstallSkills used to call, which destroyed user-added\n * files / sibling-tool files / shared skill dirs the connector never wrote.\n * When ANY file remains (at any depth) the whole tree is left in place and the\n * skip is noted. Honors dryRun (computes the action but removes nothing). A\n * missing dir is a no-op \"skip\".\n */\n protected removeDirIfEmpty(dir: string, dryRun: boolean): ChangeRecord {\n if (!existsSync(dir)) {\n return { platform: this.id, action: \"skip\", path: dir, detail: `${basename(dir)} absent` };\n }\n let stat: ReturnType<typeof statSync>;\n try {\n stat = statSync(dir);\n } catch {\n return {\n platform: this.id,\n action: \"skip\",\n path: dir,\n detail: `${basename(dir)} unreadable; left in place`,\n };\n }\n if (!stat.isDirectory()) {\n return {\n platform: this.id,\n action: \"skip\",\n path: dir,\n detail: `${basename(dir)} not a directory; left in place`,\n };\n }\n if (this.dirTreeHasFile(dir)) {\n return {\n platform: this.id,\n action: \"skip\",\n path: dir,\n detail: `${basename(dir)} still holds files we did not write; left in place`,\n };\n }\n if (!dryRun) {\n try {\n // The tree is files-free: only (possibly nested) empty dirs remain, which\n // are ours / inert. A recursive remove drops them without touching data.\n rmSync(dir, { recursive: true, force: true });\n } catch {\n // Lost a race or perms — non-fatal; report as a skip.\n return {\n platform: this.id,\n action: \"skip\",\n path: dir,\n detail: `${basename(dir)} could not be removed; left in place`,\n };\n }\n }\n return { platform: this.id, action: \"remove\", path: dir, detail: basename(dir) };\n }\n\n /**\n * Render a YAML-frontmatter + markdown body document:\n * \"---\\n\" + <yaml> + \"---\\n\\n\" + <body> + \"\\n\".\n * Delegates to the shared renderer (adapters/claude-code/render) so every\n * content-file path — adapters AND the plugin packager — emits identical bytes.\n */\n protected renderFrontmatterMd(\n frontmatter: Record<string, unknown>,\n body: string,\n ): string {\n return renderFrontmatterMd(frontmatter, body);\n }\n\n // ── JSON config helpers (used by JSON-format adapters) ───────────────────\n\n /**\n * Read + parse a JSON/JSONC config file, returning null when it is absent OR\n * unparseable. Parses TOLERANTLY via parseJsonc (strips // and /* *\\/ comments\n * and trailing commas) so a perfectly valid JSONC file never false-fails to\n * null — that null is what `?? {}` would otherwise turn into a clobbering\n * overwrite of the user's whole config.\n */\n protected readJson<T = Record<string, unknown>>(path: string): T | null {\n if (!existsSync(path)) return null;\n try {\n return parseJsonc<T>(readFileSync(path, \"utf8\"));\n } catch {\n return null;\n }\n }\n\n /**\n * True when `path` exists and holds non-whitespace content but readJson cannot\n * parse it (even after JSONC stripping). The overwrite guard: writing a\n * `{}`-based config over a present-but-broken settings file would silently\n * destroy the user's data, so callers warn-and-skip instead.\n */\n protected isPresentButUnparseable(path: string): boolean {\n if (!existsSync(path)) return false;\n let raw: string;\n try {\n if (statSync(path).size === 0) return false;\n raw = readFileSync(path, \"utf8\");\n } catch {\n return false;\n }\n if (raw.trim() === \"\") return false;\n return this.readJson(path) === null;\n }\n\n protected writeJson(path: string, data: unknown, dryRun = false): void {\n if (dryRun) return;\n ensureDir(dirname(path));\n writeFileSync(path, `${JSON.stringify(data, null, 2)}\\n`, \"utf8\");\n }\n\n /**\n * True when a PRESENT rootKey value is not a plain object map (the user\n * hand-edited it to an array / string / number / boolean). Assigning a server\n * entry into such a value would corrupt the file silently (a named property on\n * an Array is dropped by JSON.stringify) or throw under strict mode (a property\n * write / `in` operator against a primitive), so callers warn-and-skip. A\n * `null`/`undefined` value is NOT malformed — it is the well-formed \"absent\"\n * case the helpers create fresh.\n */\n protected isMalformedRootValue(value: unknown): boolean {\n return isMalformedRootValueFn(value);\n }\n\n /**\n * Warn-skip ChangeRecord when an existing JSON `hooks` config is present-but-\n * malformed (root hand-edited to an array/primitive, or an existing event\n * bucket is a non-array) — installing a hook into it would silently drop the\n * entry (a named property on an Array is dropped by JSON.stringify) or throw\n * under strict mode (a `.push`/property write against a primitive or non-array\n * bucket). Returns null when the hooks config is well-formed, including the\n * absent case the installers create fresh (proceed normally). Mirrors the\n * server-root guard (isMalformedRootValue). All targeted hosts use the Claude-\n * style `{ Event: Matcher[] }` shape, so every present event bucket must be an\n * array; a non-array bucket is the same malformed class as a wrong-typed root.\n */\n protected malformedHookRootSkip(configPath: string, hooksRoot: unknown): ChangeRecord | null {\n if (hooksRoot == null) return null; // absent → installer creates fresh\n if (this.isMalformedRootValue(hooksRoot)) {\n // array / primitive root\n return {\n platform: this.id,\n action: \"warn\",\n path: configPath,\n detail: `existing \"hooks\" in ${configPath} is not an object map; left untouched (fix it, then re-run)`,\n };\n }\n for (const v of Object.values(hooksRoot as Record<string, unknown>)) {\n if (v !== undefined && !Array.isArray(v)) {\n // an existing event bucket is a non-array\n return {\n platform: this.id,\n action: \"warn\",\n path: configPath,\n detail: `existing \"hooks\" in ${configPath} has a non-array event bucket; left untouched (fix it, then re-run)`,\n };\n }\n }\n return null;\n }\n\n // ── Shared object-map hook-array merge engine ────────────────────────────\n // installHooks/uninstallHooks for every json-stdio host that stores hooks as\n // `{ <event>: HookEntry[] }` share ONE create/update/skip + strip/remove\n // orchestration. The host supplies a {@link HookMergeDescriptor} carrying\n // EVERY observable string and ownership predicate — the engine body hardcodes\n // none of them, so per-host wording (skip/remove/absent/no-match details) and\n // FLAT-vs-NESTED removal stay host-controlled and never drift to a lowest-\n // common-denominator phrasing the suites (which assert by action) would miss.\n // The write-gate is the `mutated` bool, matching the migrated host exactly.\n\n /**\n * Install: upsert each `{ event, matcher }` in `pending` into the object-map\n * `hooks` root at `configPath`. Reproduces the canonical host's loop: read\n * `?? {}`, warn-skip on a malformed `hooks` root, then per pending item render\n * the entry, find the owned slot, and create/update/skip. Writes once at the\n * end iff anything mutated.\n *\n * Hosts that fold their `nativeHooks` surface into `pending` (claude-code) pass\n * no `native` arg. Hosts that keep the native surface SEPARATE — verbatim\n * event keys, EXACT-command ownership, a distinct `(native)` detail — pass it\n * as the optional `native` list (cursor); that pass runs after the normalized\n * loop and before the single write. Omitting it is byte-identical to before.\n */\n /**\n * Resolve the per-event hook bucket. With \"coerce\" policy a present-but-non-\n * array bucket (hand-edited) is replaced by a fresh array; otherwise `??=` is\n * used (the warn-skip path already rejected any non-array bucket via\n * malformedHookRootSkip, so `??=` only ever fills the absent case).\n */\n private coerceHookBucket<E>(\n hooks: Record<string, E[]>,\n event: string,\n coerce: boolean,\n ): E[] {\n if (coerce) {\n return Array.isArray(hooks[event]) ? hooks[event] : (hooks[event] = []);\n }\n return (hooks[event] ??= []);\n }\n\n protected upsertHookEntries<E>(\n ctx: InstallContext,\n configPath: string,\n pending: ReadonlyArray<{ event: string; matcher: string }>,\n descriptor: HookMergeDescriptor<E>,\n native?: ReadonlyArray<{ event: string; matcher: string }>,\n ): ChangeRecord[] {\n const file = this.readJson<Record<string, unknown>>(configPath) ?? {};\n const coerce = descriptor.malformedPolicy === \"coerce\";\n let hooks: Record<string, E[]>;\n if (coerce) {\n // COERCE policy: a present-but-malformed `hooks` root (array / primitive,\n // hand-edited) is replaced by a fresh object map; a well-formed object map\n // is kept as-is. Never warn, never throw — matches the container hosts'\n // server-path policy.\n const existing = file.hooks;\n hooks =\n existing && typeof existing === \"object\" && !Array.isArray(existing)\n ? (existing as Record<string, E[]>)\n : ((file.hooks = {}) as Record<string, E[]>);\n } else {\n const skip = this.malformedHookRootSkip(configPath, file.hooks);\n if (skip) return [skip];\n hooks = (file.hooks ??= {}) as Record<string, E[]>;\n }\n\n const changes: ChangeRecord[] = [];\n let mutated = false;\n\n for (const { event, matcher } of pending) {\n const hostEvent = descriptor.mapEvent ? descriptor.mapEvent(event) : event;\n if (hostEvent === undefined) {\n changes.push({\n platform: this.id,\n action: \"warn\",\n path: configPath,\n detail: descriptor.unmappedWarnDetail!(event),\n });\n continue;\n }\n // Command is built from the CANONICAL `event` (NOT hostEvent) — the home\n // binary dispatches on the canonical name; only the host's bucket key,\n // detail, and skipDetail use the mapped `hostEvent`.\n const command = buildHomeBinHookCommand(\n ctx.homeBinPath,\n this.id,\n event,\n ctx.connector.id,\n );\n const entry = descriptor.renderEntry(hostEvent, matcher, command);\n const bucket = this.coerceHookBucket(hooks, hostEvent, coerce);\n const r = upsertInArray(bucket, entry, (e) =>\n descriptor.entryOwnsCommand(e, command),\n );\n\n if (r.action !== \"skip\") {\n hooks[hostEvent] = r.array;\n mutated = true;\n }\n changes.push({\n platform: this.id,\n action: r.action,\n path: configPath,\n detail:\n r.action === \"skip\"\n ? descriptor.skipDetail(hostEvent)\n : `hooks.${hostEvent}`,\n });\n }\n\n // Native pass (json-stdio hosts with a verbatim `nativeHooks` surface):\n // native event-name keys are NOT mapEvent-mapped, are found by EXACT command\n // (so a native key coinciding with a normalized event's mapped key adds a\n // SECOND distinct command rather than clobbering it), and carry the `(native)`\n // detail. Hosts passing no `native` list skip this loop entirely → the\n // normalized-only behavior is byte-identical.\n for (const { event, matcher } of native ?? []) {\n const command = buildHomeBinHookCommand(\n ctx.homeBinPath,\n this.id,\n event,\n ctx.connector.id,\n );\n const entry = descriptor.renderEntry(event, matcher, command);\n const bucket = this.coerceHookBucket(hooks, event, coerce);\n const r = upsertInArray(bucket, entry, (e) =>\n descriptor.nativeOwnsCommand!(e, command),\n );\n if (r.action !== \"skip\") {\n hooks[event] = r.array;\n mutated = true;\n }\n changes.push({\n platform: this.id,\n action: r.action,\n path: configPath,\n detail:\n r.action === \"skip\"\n ? descriptor.nativeSkipDetail!(event)\n : descriptor.nativeMutateDetail!(event),\n });\n }\n\n if (mutated) {\n descriptor.onMutate?.(file);\n this.writeJson(configPath, file, ctx.dryRun);\n }\n return changes;\n }\n\n /**\n * Uninstall: strip owned content from every event bucket in the object-map\n * `hooks` root at `configPath`. NESTED hosts pass `descriptor.stripInner`\n * (strip owned inner commands, drop emptied entries; `removed` = inner\n * commands); FLAT hosts omit it (drop whole owned entries). Reproduces the\n * canonical host: read (NO `?? {}`), `[skip]` (absentDetail) when no hooks\n * section, per-event remove → delete-or-replace bucket, write once iff\n * mutated, and a single `[skip]` (noMatchDetail) when nothing matched.\n */\n protected removeHookEntries<E>(\n ctx: InstallContext,\n configPath: string,\n descriptor: HookMergeDescriptor<E>,\n ): ChangeRecord[] {\n const file = this.readJson<Record<string, unknown>>(configPath);\n const hooks = file?.hooks as Record<string, E[]> | undefined;\n if (!file || !hooks) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n path: configPath,\n detail: descriptor.absentDetail,\n },\n ];\n }\n\n const changes: ChangeRecord[] = [];\n let mutated = false;\n // stripInner is event-independent for current hosts → computed once. The\n // whole-entry ownership predicate is rebuilt PER EVENT so EVENT-SPECIFIC\n // hosts (codex) can match the canonical event being stripped; event-agnostic\n // hosts simply ignore the param.\n const stripInner = descriptor.stripInner?.(ctx);\n\n // Default: scan every present key. EVENT-SPECIFIC hosts pin a fixed event set\n // (descriptor.removeEventKeys) so a foreign-key bucket is never inspected —\n // matching their original fixed-event-list uninstall loop byte-for-byte.\n for (const event of descriptor.removeEventKeys ?? Object.keys(hooks)) {\n const bucket = hooks[event];\n if (!Array.isArray(bucket)) continue;\n\n const ownsEntry = descriptor.ownsEntryForRemove(ctx, event);\n const r = removeFromArray(bucket, ownsEntry, stripInner);\n if (r.removed > 0) {\n if (r.array.length > 0) hooks[event] = r.array;\n else delete hooks[event];\n changes.push({\n platform: this.id,\n action: \"remove\",\n path: configPath,\n detail: descriptor.removeDetail(event, r.removed),\n });\n mutated = true;\n }\n }\n\n if (mutated) this.writeJson(configPath, file, ctx.dryRun);\n if (changes.length === 0) {\n changes.push({\n platform: this.id,\n action: \"skip\",\n path: configPath,\n detail: descriptor.noMatchDetail,\n });\n }\n return changes;\n }\n\n /** Bind BaseAdapter's JSON leaf IO (readJson/writeJson + the unparseable\n * overwrite guard) as a Codec for the object-map engine. */\n private jsonObjectMapCodec(): ObjectMapCodec {\n return {\n parse: (path) => this.readJson<Record<string, unknown>>(path),\n serialize: (path, data, dryRun) => this.writeJson(path, data, dryRun),\n isPresentButUnparseable: (path) => this.isPresentButUnparseable(path),\n };\n }\n\n /**\n * Upsert `entry` at `config[rootKey][serverId]` in a JSON file, creating the\n * file/object as needed. Returns a ChangeRecord describing create/update/skip.\n * Idempotent: an identical entry yields \"skip\".\n */\n protected upsertServerInJson(\n configPath: string,\n rootKey: string,\n serverId: string,\n entry: unknown,\n dryRun = false,\n ): ChangeRecord {\n return upsertInObjectMap({\n codec: this.jsonObjectMapCodec(),\n rootKey,\n platform: this.id,\n configPath,\n entryId: serverId,\n entry,\n dryRun,\n });\n }\n\n /** Remove `config[rootKey][serverId]` from a JSON file. */\n protected removeServerFromJson(\n configPath: string,\n rootKey: string,\n serverId: string,\n dryRun = false,\n ): ChangeRecord {\n return removeFromObjectMap({\n codec: this.jsonObjectMapCodec(),\n rootKey,\n platform: this.id,\n configPath,\n entryId: serverId,\n dryRun,\n });\n }\n\n // ── Backup ───────────────────────────────────────────────────────────────\n\n backupSettings(ctx: InstallContext): string | null {\n const files = [...new Set([this.getServerConfigPath(ctx), this.getHookConfigPath(ctx)])].filter(\n (f) => existsSync(f),\n );\n if (files.length === 0) return null;\n if (ctx.dryRun) return null;\n ensureDir(backupsDir());\n const stamp = new Date().toISOString().replace(/[:.]/g, \"-\");\n let last: string | null = null;\n for (const f of files) {\n const dest = join(backupsDir(), `${this.id}-${stamp}-${basename(f)}`);\n copyFileSync(f, dest);\n last = dest;\n }\n return last;\n }\n\n // ── Diagnostics ─────────────────────────────────────────────────────────\n\n getHealthChecks?(ctx: InstallContext): readonly HealthCheck[];\n\n doctor(ctx: InstallContext): DiagnosticResult[] {\n const results: DiagnosticResult[] = [];\n const cfg = this.getServerConfigPath(ctx);\n results.push(\n existsSync(cfg)\n ? { check: `${this.name}: config present`, status: \"pass\", message: cfg }\n : {\n check: `${this.name}: config present`,\n status: \"warn\",\n message: `not found: ${cfg}`,\n fix: `agent-connector install --targets ${this.id}`,\n // Only sync-recoverable when the connector actually declares a\n // server — a re-sync writes the config file only then. For a\n // serverless (memory/configPatch-only) connector the file is never\n // created, so marking it fixable would loop it into \"still failing\".\n fixable: !!ctx.connector.server,\n },\n );\n for (const hc of this.getHealthChecks?.(ctx) ?? []) {\n const r = hc.check();\n results.push({\n check: hc.name,\n status: r.status === \"OK\" ? \"pass\" : \"fail\",\n message: r.detail ?? r.status,\n });\n }\n // Memory-surface checks are ledger-driven: no installed memory → no rows →\n // no noise. Shared by every adapter (the overrides call super.doctor()).\n results.push(...this.memoryDiagnostics(ctx));\n return results;\n }\n}\n","/** Decision for one inner-array upsert. */\nexport type ArrayUpsertAction = \"create\" | \"update\" | \"skip\";\n\nexport interface ArrayUpsertResult<E> {\n array: E[];\n action: ArrayUpsertAction;\n}\n\n/**\n * Upsert one rendered `candidate` into a per-event hook array.\n * - find the FIRST entry the caller OWNS via `ownsEntry`;\n * - hit + JSON-equal → skip (array returned unchanged);\n * - hit + differs → update (replace that slot);\n * - miss → create (push).\n */\nexport function upsertInArray<E>(\n array: E[],\n candidate: E,\n ownsEntry: (entry: E) => boolean,\n): ArrayUpsertResult<E> {\n const idx = array.findIndex(ownsEntry);\n if (idx >= 0) {\n if (JSON.stringify(array[idx]) === JSON.stringify(candidate)) {\n return { array, action: \"skip\" };\n }\n const next = array.slice();\n next[idx] = candidate;\n return { array: next, action: \"update\" };\n }\n return { array: [...array, candidate], action: \"create\" };\n}\n\nexport interface ArrayRemoveResult<E> {\n array: E[];\n removed: number;\n}\n\n/**\n * Remove owned content from a per-event hook array.\n * - FLAT hosts: omit `stripInner` → drop whole entries matching `ownsEntry`;\n * `removed` = whole entries dropped.\n * - NESTED hosts: pass `stripInner` → strip owned inner commands and rebuild,\n * dropping entries left empty; `removed` = inner commands removed.\n */\nexport function removeFromArray<E>(\n array: E[],\n ownsEntry: (entry: E) => boolean,\n stripInner?: (entry: E) => { next: E | null; removed: number },\n): ArrayRemoveResult<E> {\n if (!stripInner) {\n const kept = array.filter((e) => !ownsEntry(e));\n return { array: kept, removed: array.length - kept.length };\n }\n const kept: E[] = [];\n let removed = 0;\n for (const e of array) {\n const r = stripInner(e);\n removed += r.removed;\n if (r.next !== null) kept.push(r.next);\n }\n return { array: kept, removed };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA4BO,SAAS,WAAW,MAAsB;AAC/C,QAAM,IAAI,KAAK;AACf,MAAI,MAAM;AACV,MAAI,IAAI;AACR,MAAI,WAAW;AACf,MAAI,QAAQ;AAEZ,SAAO,IAAI,GAAG;AACZ,UAAM,KAAK,KAAK,CAAC;AAEjB,QAAI,UAAU;AACZ,aAAO;AACP,UAAI,OAAO,MAAM;AAEf,YAAI,IAAI,IAAI,GAAG;AACb,iBAAO,KAAK,IAAI,CAAC;AACjB,eAAK;AACL;AAAA,QACF;AAAA,MACF,WAAW,OAAO,OAAO;AACvB,mBAAW;AAAA,MACb;AACA,WAAK;AACL;AAAA,IACF;AAEA,UAAM,OAAO,IAAI,IAAI,IAAK,KAAK,IAAI,CAAC,IAAe;AAGnD,QAAI,OAAO,OAAO,OAAO,KAAK;AAC5B,iBAAW;AACX,cAAQ;AACR,aAAO;AACP,WAAK;AACL;AAAA,IACF;AAGA,QAAI,OAAO,OAAO,SAAS,KAAK;AAC9B,WAAK;AACL,aAAO,IAAI,KAAK,KAAK,CAAC,MAAM,KAAM,MAAK;AACvC;AAAA,IACF;AAGA,QAAI,OAAO,OAAO,SAAS,KAAK;AAC9B,WAAK;AACL,aAAO,IAAI,KAAK,EAAE,KAAK,CAAC,MAAM,OAAO,KAAK,IAAI,CAAC,MAAM,KAAM,MAAK;AAChE,WAAK;AACL;AAAA,IACF;AAKA,QAAI,OAAO,KAAK;AACd,YAAM,SAAS,gBAAgB,MAAM,IAAI,CAAC;AAC1C,UAAI,WAAW,OAAO,WAAW,KAAK;AACpC,aAAK;AACL;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AACP,SAAK;AAAA,EACP;AAEA,SAAO;AACT;AAMA,SAAS,gBA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K,WAAW,GAAG,GAAG,KAAK,EAAE,IAAI,KAAK,IAAI,SAAS,CAAC,CAAC,EAAE;AACpE,mBAAa,GAAG,IAAI;AACpB,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT;AAAA,EAMA,OAAO,KAAyC;AAC9C,UAAM,UAA8B,CAAC;AACrC,UAAM,MAAM,KAAK,oBAAoB,GAAG;AACxC,YAAQ;AAAA,MACN,WAAW,GAAG,IACV,EAAE,OAAO,GAAG,KAAK,IAAI,oBAAoB,QAAQ,QAAQ,SAAS,IAAI,IACtE;AAAA,QACE,OAAO,GAAG,KAAK,IAAI;AAAA,QACnB,QAAQ;AAAA,QACR,SAAS,cAAc,GAAG;AAAA,QAC1B,KAAK,qCAAqC,KAAK,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA,QAKjD,SAAS,CAAC,CAAC,IAAI,UAAU;AAAA,MAC3B;AAAA,IACN;AACA,eAAW,MAAM,KAAK,kBAAkB,GAAG,KAAK,CAAC,GAAG;AAClD,YAAM,IAAI,GAAG,MAAM;AACnB,cAAQ,KAAK;AAAA,QACX,OAAO,GAAG;AAAA,QACV,QAAQ,EAAE,WAAW,OAAO,SAAS;AAAA,QACrC,SAAS,EAAE,UAAU,EAAE;AAAA,MACzB,CAAC;AAAA,IACH;AAGA,YAAQ,KAAK,GAAG,KAAK,kBAAkB,GAAG,CAAC;AAC3C,WAAO;AAAA,EACT;AACF;","names":["kept"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
ensureDir,
|
|
4
4
|
telemetryPath
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-QY42WGBX.js";
|
|
6
6
|
|
|
7
7
|
// src/telemetry/store.ts
|
|
8
8
|
import { appendFileSync, existsSync, readFileSync } from "fs";
|
|
@@ -193,4 +193,4 @@ export {
|
|
|
193
193
|
getTokenizer,
|
|
194
194
|
inferModelFamily
|
|
195
195
|
};
|
|
196
|
-
//# sourceMappingURL=chunk-
|
|
196
|
+
//# sourceMappingURL=chunk-F4DSMVZ7.js.map
|