@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,571 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
normalizeSessionSource
|
|
4
|
+
} from "./chunk-H53QZQJI.js";
|
|
5
|
+
import {
|
|
6
|
+
resolveEnvRefsDeep
|
|
7
|
+
} from "./chunk-DBQMX75U.js";
|
|
8
|
+
import {
|
|
9
|
+
BaseAdapter
|
|
10
|
+
} from "./chunk-3I7UG52L.js";
|
|
11
|
+
import "./chunk-IEGR4TP3.js";
|
|
12
|
+
import {
|
|
13
|
+
buildWrappedStdio,
|
|
14
|
+
isHomeBinHookCommand
|
|
15
|
+
} from "./chunk-TO57WYBB.js";
|
|
16
|
+
import "./chunk-ZY25RG4Y.js";
|
|
17
|
+
import "./chunk-QY42WGBX.js";
|
|
18
|
+
|
|
19
|
+
// src/adapters/amazon-q/index.ts
|
|
20
|
+
import { existsSync, statSync } from "fs";
|
|
21
|
+
import { homedir } from "os";
|
|
22
|
+
import { join } from "path";
|
|
23
|
+
var HOST = "amazon-q";
|
|
24
|
+
var MCP_ROOT_KEY = "mcpServers";
|
|
25
|
+
var DEFAULT_AGENT_FILE = "q_cli_default.json";
|
|
26
|
+
var RESERVED_AGENT_NAME = "q_cli_default";
|
|
27
|
+
var Q_TRIGGER = {
|
|
28
|
+
preToolUse: "preToolUse",
|
|
29
|
+
postToolUse: "postToolUse",
|
|
30
|
+
agentSpawn: "agentSpawn",
|
|
31
|
+
userPromptSubmit: "userPromptSubmit",
|
|
32
|
+
stop: "stop"
|
|
33
|
+
};
|
|
34
|
+
var EVENT_MAP = {
|
|
35
|
+
SessionStart: Q_TRIGGER.agentSpawn,
|
|
36
|
+
UserPromptSubmit: Q_TRIGGER.userPromptSubmit,
|
|
37
|
+
PreToolUse: Q_TRIGGER.preToolUse,
|
|
38
|
+
PostToolUse: Q_TRIGGER.postToolUse,
|
|
39
|
+
Stop: Q_TRIGGER.stop
|
|
40
|
+
};
|
|
41
|
+
var MATCHER_TRIGGERS = /* @__PURE__ */ new Set([
|
|
42
|
+
Q_TRIGGER.preToolUse,
|
|
43
|
+
Q_TRIGGER.postToolUse
|
|
44
|
+
]);
|
|
45
|
+
var AmazonQAdapter = class extends BaseAdapter {
|
|
46
|
+
id = HOST;
|
|
47
|
+
name = "Amazon Q Developer CLI";
|
|
48
|
+
paradigm = "json-stdio";
|
|
49
|
+
capabilities = {
|
|
50
|
+
// Memory surface: WIRED. Amazon Q reads `.amazonq/rules` (NOT AGENTS.md), so
|
|
51
|
+
// the AGENTS.md-first BaseAdapter default does not apply — memoryTargets()
|
|
52
|
+
// below overrides it to write a DEDICATED agent-connector-owned file
|
|
53
|
+
// (<projectDir>/.amazonq/rules/agent-connector.md, plain Markdown, no
|
|
54
|
+
// frontmatter — auto-applied as context per the AWS docs). Project scope
|
|
55
|
+
// only; user scope skip-warns (no verified user/global rules dir).
|
|
56
|
+
supportsMemory: true,
|
|
57
|
+
//
|
|
58
|
+
// Hooks: Amazon Q fires agentSpawn / userPromptSubmit / preToolUse /
|
|
59
|
+
// postToolUse / stop (mapped from SessionStart / UserPromptSubmit /
|
|
60
|
+
// PreToolUse / PostToolUse / Stop). It has no PreCompact / SessionEnd /
|
|
61
|
+
// Notification equivalent, nor the E1 extension events (PermissionRequest /
|
|
62
|
+
// PostToolUseFailure / SubagentStart / SubagentStop) — those warn-skip.
|
|
63
|
+
preToolUse: true,
|
|
64
|
+
postToolUse: true,
|
|
65
|
+
preCompact: false,
|
|
66
|
+
sessionStart: true,
|
|
67
|
+
sessionEnd: false,
|
|
68
|
+
userPromptSubmit: true,
|
|
69
|
+
stop: true,
|
|
70
|
+
notification: false,
|
|
71
|
+
// Exit-code protocol only — a hook can allow (0) or block (2), but it CANNOT
|
|
72
|
+
// rewrite tool args or output.
|
|
73
|
+
canModifyArgs: false,
|
|
74
|
+
canModifyOutput: false,
|
|
75
|
+
// agentSpawn returns additionalContext via JSON stdout (mirrors kiro).
|
|
76
|
+
canInjectSessionContext: true,
|
|
77
|
+
// Amazon Q registers stdio + Streamable HTTP MCP servers (primary-verified).
|
|
78
|
+
transports: ["stdio", "http"],
|
|
79
|
+
// Content surfaces:
|
|
80
|
+
// subagents: WIRED. Amazon Q's "agents" are per-agent JSON files where the
|
|
81
|
+
// FILENAME (minus .json) IS the agent name (primary-verified via the CLI
|
|
82
|
+
// repo docs/agent-file-locations.md + docs/agent-format.md). AC maps each
|
|
83
|
+
// connector SubagentDef → cli-agents/<name>.json = { name, description,
|
|
84
|
+
// prompt } (+ model when non-"inherit"; + tools/allowedTools when the
|
|
85
|
+
// SubagentDef carries a tool policy — see renderSubagent). Both scopes:
|
|
86
|
+
// user → ~/.aws/amazonq/cli-agents/<name>.json
|
|
87
|
+
// project → <projectDir>/.amazonq/cli-agents/<name>.json
|
|
88
|
+
// A subagent named `q_cli_default` would resolve to the hooks/default-agent
|
|
89
|
+
// file — the SDK already rejects it (non-kebab name), and installSubagents
|
|
90
|
+
// refuses it as defense-in-depth so a subagent write can never clobber it.
|
|
91
|
+
supportsSubagents: true
|
|
92
|
+
// commands (prompt library): DEFERRED — format unverified. The only primary
|
|
93
|
+
// doc for the ~/.aws/amazonq/prompts/*.md prompt library is the IDE prompt-
|
|
94
|
+
// library page (q-in-IDE-chat → ide-chat-context: prompts saved in
|
|
95
|
+
// ~/.aws/amazonq/prompts, invoked via @<name> inside the IDE chat). The Q
|
|
96
|
+
// CLI repo (aws/amazon-q-developer-cli/docs) ships NO prompts/saved-prompts
|
|
97
|
+
// doc, so whether the `q`/`qchat` CLI reads that folder — and whether a
|
|
98
|
+
// project-scoped prompts dir exists — is NOT primary-verified for the CLI
|
|
99
|
+
// host this adapter targets. supportsCommands stays UNSET (base skip-warns)
|
|
100
|
+
// rather than render an unverified surface (the continue per-server-YAML /
|
|
101
|
+
// other deferred-unverified precedent).
|
|
102
|
+
};
|
|
103
|
+
// ── Detection ────────────────────────────────────────────────────────────
|
|
104
|
+
detectInstalled(projectDir) {
|
|
105
|
+
const userDir = join(homedir(), ".aws", "amazonq");
|
|
106
|
+
const userMcp = join(userDir, "mcp.json");
|
|
107
|
+
const projDir = join(projectDir, ".amazonq");
|
|
108
|
+
const projMcp = join(projDir, "mcp.json");
|
|
109
|
+
const userInstalled = existsSync(userDir) || existsSync(userMcp);
|
|
110
|
+
const projInstalled = existsSync(projDir) || existsSync(projMcp);
|
|
111
|
+
const installed = userInstalled || projInstalled;
|
|
112
|
+
const scope = projInstalled && !userInstalled ? "project" : "user";
|
|
113
|
+
const configPath = scope === "project" ? projMcp : userMcp;
|
|
114
|
+
return {
|
|
115
|
+
id: this.id,
|
|
116
|
+
name: this.name,
|
|
117
|
+
installed,
|
|
118
|
+
paradigm: this.paradigm,
|
|
119
|
+
capabilities: this.capabilities,
|
|
120
|
+
configPath,
|
|
121
|
+
scope,
|
|
122
|
+
reason: installed ? `found Amazon Q config (${scope}) at ${configPath}` : `no Amazon Q mcp.json at ${userDir} or ${projDir}`,
|
|
123
|
+
confidence: installed ? "high" : "low"
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
// ── Native paths ─────────────────────────────────────────────────────────
|
|
127
|
+
/**
|
|
128
|
+
* Config directory per scope. Amazon Q uses DIFFERENT basenames:
|
|
129
|
+
* user: ~/.aws/amazonq (two segments — NOT a single dotDir)
|
|
130
|
+
* project: <projectDir>/.amazonq
|
|
131
|
+
* This is the ONE deviation from droid/cursor's single-basename getConfigDir.
|
|
132
|
+
*/
|
|
133
|
+
getConfigDir(ctx) {
|
|
134
|
+
return ctx.scope === "project" ? join(ctx.projectDir, ".amazonq") : join(homedir(), ".aws", "amazonq");
|
|
135
|
+
}
|
|
136
|
+
getServerConfigPath(ctx) {
|
|
137
|
+
return join(this.getConfigDir(ctx), "mcp.json");
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Hooks live in a per-agent file, NOT the mcp.json. Amazon Q hooks have no
|
|
141
|
+
* global file, so AC targets the built-in `q_cli_default` agent file at the
|
|
142
|
+
* install scope (mirroring kiro's default-agent selection):
|
|
143
|
+
* user → ~/.aws/amazonq/cli-agents/q_cli_default.json
|
|
144
|
+
* project → <projectDir>/.amazonq/cli-agents/q_cli_default.json
|
|
145
|
+
* A project install writes a project-scoped `q_cli_default` that SHADOWS the
|
|
146
|
+
* user-global one (a local `q_cli_default` takes precedence and auto-loads).
|
|
147
|
+
*/
|
|
148
|
+
getHookConfigPath(ctx) {
|
|
149
|
+
return join(this.getConfigDir(ctx), "cli-agents", DEFAULT_AGENT_FILE);
|
|
150
|
+
}
|
|
151
|
+
// ── Memory surface: the `.amazonq/rules` content tree ─────────────────────
|
|
152
|
+
// Amazon Q uses `.amazonq/rules` (NOT AGENTS.md) for its OWN project rules, so
|
|
153
|
+
// this override replaces the AGENTS.md base default entirely:
|
|
154
|
+
// project → <projectDir>/.amazonq/rules/agent-connector.md (DEDICATED file
|
|
155
|
+
// AC owns; plain Markdown, auto-applied — no frontmatter needed)
|
|
156
|
+
// user → [] (no verified user/global rules dir → base installMemory
|
|
157
|
+
// skip-warns rather than guessing a path the CLI may not read)
|
|
158
|
+
// When `.amazonq/rules` exists as a single FILE (not a directory) we must NOT
|
|
159
|
+
// create `.amazonq/rules/agent-connector.md` underneath it (that would throw
|
|
160
|
+
// ENOTDIR), so memoryTargets() returns [] and installMemory() emits a precise
|
|
161
|
+
// skip-warn rather than crashing (the cline `.clinerules`-is-a-file precedent).
|
|
162
|
+
memoryTargets(ctx) {
|
|
163
|
+
if (this.memoryOverride(ctx)?.path) return super.memoryTargets(ctx);
|
|
164
|
+
if (ctx.scope === "project") {
|
|
165
|
+
if (this.rulesDirIsFile(ctx.projectDir)) return [];
|
|
166
|
+
return [
|
|
167
|
+
{
|
|
168
|
+
path: join(ctx.projectDir, ".amazonq", "rules", "agent-connector.md"),
|
|
169
|
+
reason: "amazon-q project rules dir (.amazonq/rules; agent-connector-owned file)"
|
|
170
|
+
}
|
|
171
|
+
];
|
|
172
|
+
}
|
|
173
|
+
return [];
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Override installMemory ONLY to surface a precise warn when `.amazonq/rules`
|
|
177
|
+
* exists as a single FILE at project scope (so memoryTargets() returned []):
|
|
178
|
+
* we never write under it. All other behavior delegates to the base
|
|
179
|
+
* implementation (the cline `.clinerules`-is-a-file precedent).
|
|
180
|
+
*/
|
|
181
|
+
installMemory(ctx) {
|
|
182
|
+
if (ctx.scope === "project" && !this.memoryOverride(ctx)?.path && (ctx.connector.memory ?? []).length > 0 && ctx.connector.platforms[this.id]?.memory !== false && this.rulesDirIsFile(ctx.projectDir)) {
|
|
183
|
+
return [
|
|
184
|
+
{
|
|
185
|
+
platform: this.id,
|
|
186
|
+
action: "warn",
|
|
187
|
+
path: join(ctx.projectDir, ".amazonq", "rules"),
|
|
188
|
+
detail: "existing .amazonq/rules is a file, not a directory; left untouched \u2014 convert it to a .amazonq/rules/ directory to receive agent-connector memory"
|
|
189
|
+
}
|
|
190
|
+
];
|
|
191
|
+
}
|
|
192
|
+
return super.installMemory(ctx);
|
|
193
|
+
}
|
|
194
|
+
/** True when `<dir>/.amazonq/rules` exists and is a regular FILE (not a dir). */
|
|
195
|
+
rulesDirIsFile(dir) {
|
|
196
|
+
const p = join(dir, ".amazonq", "rules");
|
|
197
|
+
if (!existsSync(p)) return false;
|
|
198
|
+
try {
|
|
199
|
+
return statSync(p).isFile();
|
|
200
|
+
} catch {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
// ── MCP server install / uninstall ───────────────────────────────────────
|
|
205
|
+
installServer(ctx) {
|
|
206
|
+
const { connector } = ctx;
|
|
207
|
+
const override = connector.platforms[HOST]?.server;
|
|
208
|
+
if (!connector.server || override === false) {
|
|
209
|
+
return [
|
|
210
|
+
{
|
|
211
|
+
platform: this.id,
|
|
212
|
+
action: "skip",
|
|
213
|
+
detail: connector.server ? "server registration disabled for amazon-q" : "connector declares no MCP server"
|
|
214
|
+
}
|
|
215
|
+
];
|
|
216
|
+
}
|
|
217
|
+
const server = override && typeof override === "object" ? { ...connector.server, ...override } : connector.server;
|
|
218
|
+
const serverPath = this.getServerConfigPath(ctx);
|
|
219
|
+
const entry = this.renderServerEntry(ctx, server);
|
|
220
|
+
return [
|
|
221
|
+
this.upsertServerInJson(serverPath, MCP_ROOT_KEY, connector.id, entry, ctx.dryRun)
|
|
222
|
+
];
|
|
223
|
+
}
|
|
224
|
+
uninstallServer(ctx) {
|
|
225
|
+
const serverPath = this.getServerConfigPath(ctx);
|
|
226
|
+
return [
|
|
227
|
+
this.removeServerFromJson(serverPath, MCP_ROOT_KEY, ctx.connector.id, ctx.dryRun)
|
|
228
|
+
];
|
|
229
|
+
}
|
|
230
|
+
/** Render a normalized ServerDef into Amazon Q's native mcpServers entry. */
|
|
231
|
+
renderServerEntry(ctx, server) {
|
|
232
|
+
const transport = server.transport;
|
|
233
|
+
if (transport === "stdio") {
|
|
234
|
+
let command = server.command ?? "";
|
|
235
|
+
let args = [...server.args ?? []];
|
|
236
|
+
({ command, args } = buildWrappedStdio(ctx, server, this.id, command, args));
|
|
237
|
+
const entry = {
|
|
238
|
+
command: resolveEnvRefsDeep(command)
|
|
239
|
+
};
|
|
240
|
+
if (args.length > 0) entry.args = resolveEnvRefsDeep(args);
|
|
241
|
+
const env = this.renderEnv(server.env);
|
|
242
|
+
if (env) entry.env = env;
|
|
243
|
+
if (server.timeoutMs !== void 0) entry.timeout = server.timeoutMs;
|
|
244
|
+
return entry;
|
|
245
|
+
}
|
|
246
|
+
return {
|
|
247
|
+
type: "http",
|
|
248
|
+
url: resolveEnvRefsDeep(server.url ?? "")
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Render stdio env values. Amazon Q has no documented native interpolation
|
|
253
|
+
* token, so resolve `${env:VAR}` references to literals at install time.
|
|
254
|
+
*/
|
|
255
|
+
renderEnv(env) {
|
|
256
|
+
if (!env || Object.keys(env).length === 0) return void 0;
|
|
257
|
+
return resolveEnvRefsDeep({ ...env });
|
|
258
|
+
}
|
|
259
|
+
// ── Hook install / uninstall (merge into the default agent file) ──────────
|
|
260
|
+
installHooks(ctx) {
|
|
261
|
+
const { connector } = ctx;
|
|
262
|
+
if (connector.platforms[HOST]?.hooks === false) {
|
|
263
|
+
return [{ platform: this.id, action: "skip", detail: "hooks disabled for amazon-q" }];
|
|
264
|
+
}
|
|
265
|
+
if (connector.hookEvents.length === 0) {
|
|
266
|
+
return [{ platform: this.id, action: "skip", detail: "connector declares no hooks" }];
|
|
267
|
+
}
|
|
268
|
+
const pending = connector.hookEvents.map((event) => ({
|
|
269
|
+
event,
|
|
270
|
+
matcher: connector.hooks[event]?.matcher ?? ""
|
|
271
|
+
}));
|
|
272
|
+
return this.upsertHookEntries(
|
|
273
|
+
ctx,
|
|
274
|
+
this.getHookConfigPath(ctx),
|
|
275
|
+
pending,
|
|
276
|
+
this.hookDescriptor()
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
uninstallHooks(ctx) {
|
|
280
|
+
return this.removeHookEntries(ctx, this.getHookConfigPath(ctx), this.hookDescriptor());
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Amazon Q's hook-merge descriptor (FLAT object-of-arrays shape — each entry is
|
|
284
|
+
* `{ command, matcher? }`, NO `type` field, unlike kiro's nested
|
|
285
|
+
* `{ matcher, hooks:[...] }`).
|
|
286
|
+
* - mapEvent = EVENT_MAP (canonical → Amazon Q trigger); unmapped events
|
|
287
|
+
* (PreCompact / SessionEnd / Notification + the E1 set) warn-skip.
|
|
288
|
+
* - renderEntry emits `{ command }`, adding `matcher` ONLY for the
|
|
289
|
+
* matcher-meaningful triggers (preToolUse/postToolUse) when one is declared;
|
|
290
|
+
* an empty matcher = all tools, so it is OMITTED (no `matcher: ""` noise).
|
|
291
|
+
* - entryOwnsCommand / ownsEntryForRemove match the home-bin command string
|
|
292
|
+
* (idempotency on re-install; whole-entry removal on uninstall). FLAT host →
|
|
293
|
+
* no stripInner; an emptied trigger key is dropped by the engine.
|
|
294
|
+
*/
|
|
295
|
+
hookDescriptor() {
|
|
296
|
+
return {
|
|
297
|
+
mapEvent: (e) => EVENT_MAP[e],
|
|
298
|
+
unmappedWarnDetail: (e) => `${e} has no Amazon Q hook equivalent \u2014 skipped`,
|
|
299
|
+
renderEntry: (trigger, matcher, command) => {
|
|
300
|
+
const entry = { command };
|
|
301
|
+
if (matcher && MATCHER_TRIGGERS.has(trigger)) entry.matcher = matcher;
|
|
302
|
+
return entry;
|
|
303
|
+
},
|
|
304
|
+
entryOwnsCommand: (entry, command) => entry.command === command,
|
|
305
|
+
ownsEntryForRemove: (c) => (entry) => this.isOurCommand(entry.command, c),
|
|
306
|
+
skipDetail: (trigger) => `hooks.${trigger} already registered`,
|
|
307
|
+
removeDetail: (trigger, removed) => `hooks.${trigger} (${removed})`,
|
|
308
|
+
absentDetail: "no hooks section present",
|
|
309
|
+
noMatchDetail: "no matching hook entries"
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
/** True when a hook command references our home binary AND this connector id
|
|
313
|
+
* (anchored so a shared-prefix id can't collide — see isHomeBinHookCommand). */
|
|
314
|
+
isOurCommand(command, ctx) {
|
|
315
|
+
return isHomeBinHookCommand(command, ctx.homeBinPath, ctx.connector.id);
|
|
316
|
+
}
|
|
317
|
+
// ── Content surface: subagents → cli-agents/<name>.json ───────────────────
|
|
318
|
+
// CONTENT-ONLY: a pure native-file writer — no runtime dispatch, no home-bin
|
|
319
|
+
// pointer, no telemetry wrap. Amazon Q "agents" are per-agent JSON files where
|
|
320
|
+
// the FILENAME (minus .json) IS the agent name (agent-file-locations.md). Each
|
|
321
|
+
// file is a STANDALONE agent definition: we write only { name, description,
|
|
322
|
+
// prompt } (+ model / tools / allowedTools when the SubagentDef carries them)
|
|
323
|
+
// and NEVER inject hooks (those live in q_cli_default.json) or mcpServers (those
|
|
324
|
+
// live in mcp.json). The whole file is AC-owned, so idempotency + reversibility
|
|
325
|
+
// come from writeContentFile/removeContentFile (byte-identical → skip; uninstall
|
|
326
|
+
// removes the file → NO_RESIDUE).
|
|
327
|
+
// user → ~/.aws/amazonq/cli-agents/<name>.json
|
|
328
|
+
// project → <projectDir>/.amazonq/cli-agents/<name>.json
|
|
329
|
+
/** Native subagent file path: <configDir>/cli-agents/<name>.json. */
|
|
330
|
+
subagentPath(ctx, name) {
|
|
331
|
+
return join(this.getConfigDir(ctx), "cli-agents", `${name}.json`);
|
|
332
|
+
}
|
|
333
|
+
installSubagents(ctx) {
|
|
334
|
+
const { connector } = ctx;
|
|
335
|
+
if (connector.platforms[HOST]?.subagents === false) {
|
|
336
|
+
return [{ platform: this.id, action: "skip", detail: "subagents disabled for amazon-q" }];
|
|
337
|
+
}
|
|
338
|
+
if (connector.subagents.length === 0) {
|
|
339
|
+
return [{ platform: this.id, action: "skip", detail: "connector declares no subagents" }];
|
|
340
|
+
}
|
|
341
|
+
return connector.subagents.map((agent) => {
|
|
342
|
+
if (agent.name === RESERVED_AGENT_NAME) {
|
|
343
|
+
return {
|
|
344
|
+
platform: this.id,
|
|
345
|
+
action: "warn",
|
|
346
|
+
detail: `subagent "${agent.name}" collides with the built-in default agent file (cli-agents/${DEFAULT_AGENT_FILE}); skipped \u2014 rename the subagent`
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
return this.writeContentFile(
|
|
350
|
+
this.subagentPath(ctx, agent.name),
|
|
351
|
+
this.renderSubagent(agent),
|
|
352
|
+
ctx.dryRun
|
|
353
|
+
);
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
uninstallSubagents(ctx) {
|
|
357
|
+
const { connector } = ctx;
|
|
358
|
+
if (connector.subagents.length === 0) {
|
|
359
|
+
return [{ platform: this.id, action: "skip", detail: "connector declares no subagents" }];
|
|
360
|
+
}
|
|
361
|
+
return connector.subagents.map((agent) => {
|
|
362
|
+
if (agent.name === RESERVED_AGENT_NAME) {
|
|
363
|
+
return {
|
|
364
|
+
platform: this.id,
|
|
365
|
+
action: "warn",
|
|
366
|
+
detail: `subagent "${agent.name}" was never installed (collides with cli-agents/${DEFAULT_AGENT_FILE}); left untouched`
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
return this.removeContentFile(this.subagentPath(ctx, agent.name), ctx.dryRun);
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Render a connector subagent into an Amazon Q agent JSON file
|
|
374
|
+
* (agent-format.md):
|
|
375
|
+
* { name, description, prompt } — prompt is the INLINE system-prompt string
|
|
376
|
+
* (Amazon Q's `prompt` field is "high-level context … similar to a system
|
|
377
|
+
* prompt"; we use the inline-text form, NOT a file:// ref).
|
|
378
|
+
* Plus, when the SubagentDef carries them:
|
|
379
|
+
* - model: only when set and not the platform-agnostic "inherit"
|
|
380
|
+
* sentinel (Amazon Q has no "inherit" — omitting it applies the default).
|
|
381
|
+
* - tools: SurfaceToolPolicy.allow → the `tools` array (the tools the
|
|
382
|
+
* agent can use). Amazon Q's `tools` accepts plain tool-name strings and
|
|
383
|
+
* `*`, the same vocabulary the portable allow-list carries.
|
|
384
|
+
* - allowedTools: SurfaceToolPolicy.allow → the `allowedTools` array (tools
|
|
385
|
+
* usable WITHOUT a permission prompt) — BUT only when the allow-list holds
|
|
386
|
+
* no `*` (Amazon Q's allowedTools does NOT accept the `"*"` wildcard;
|
|
387
|
+
* agent-format.md "AllowedTools Field"). When allow is exactly ["*"] we set
|
|
388
|
+
* `tools` but omit `allowedTools` (every tool available, none auto-allowed).
|
|
389
|
+
* `deny` has no clean Amazon Q analog (there is no disallowedTools field —
|
|
390
|
+
* access is an allow-list), so a deny-only policy maps to no tool keys.
|
|
391
|
+
* `readonly` is likewise dropped — Amazon Q has no read-only-agent field; the
|
|
392
|
+
* permission model IS the allowedTools allow-list (no separate analog).
|
|
393
|
+
* `extra` is shallow-merged last (per-platform escape hatch).
|
|
394
|
+
*/
|
|
395
|
+
renderSubagent(agent) {
|
|
396
|
+
const obj = {
|
|
397
|
+
name: agent.name,
|
|
398
|
+
description: agent.description,
|
|
399
|
+
prompt: agent.prompt
|
|
400
|
+
};
|
|
401
|
+
if (agent.model !== void 0 && agent.model !== "inherit") obj.model = agent.model;
|
|
402
|
+
const allow = agent.tools?.allow;
|
|
403
|
+
if (allow && allow.length > 0) {
|
|
404
|
+
obj.tools = [...allow];
|
|
405
|
+
const allowed = allow.filter((t) => t !== "*");
|
|
406
|
+
if (allowed.length > 0) obj.allowedTools = allowed;
|
|
407
|
+
}
|
|
408
|
+
if (agent.extra) Object.assign(obj, agent.extra);
|
|
409
|
+
return `${JSON.stringify(obj, null, 2)}
|
|
410
|
+
`;
|
|
411
|
+
}
|
|
412
|
+
// ── Diagnostics ──────────────────────────────────────────────────────────
|
|
413
|
+
getHealthChecks(ctx) {
|
|
414
|
+
const mcpPath = this.getServerConfigPath(ctx);
|
|
415
|
+
const agentPath = this.getHookConfigPath(ctx);
|
|
416
|
+
const connectorId = ctx.connector.id;
|
|
417
|
+
const homeBin = ctx.homeBinPath;
|
|
418
|
+
const hookEvents = ctx.connector.hookEvents;
|
|
419
|
+
const checks = [
|
|
420
|
+
{
|
|
421
|
+
name: `${this.name}: mcp.json present`,
|
|
422
|
+
check: () => existsSync(mcpPath) ? { status: "OK", detail: mcpPath } : { status: "FAIL", detail: `not found: ${mcpPath}` }
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
name: `${this.name}: server entry registered`,
|
|
426
|
+
check: () => {
|
|
427
|
+
if (!ctx.connector.server) {
|
|
428
|
+
return { status: "OK", detail: "no MCP server declared" };
|
|
429
|
+
}
|
|
430
|
+
const cfg = this.readJson(mcpPath);
|
|
431
|
+
const bucket = cfg?.[MCP_ROOT_KEY];
|
|
432
|
+
if (!cfg || !bucket) {
|
|
433
|
+
return { status: "FAIL", detail: `no ${MCP_ROOT_KEY} in ${mcpPath}` };
|
|
434
|
+
}
|
|
435
|
+
return connectorId in bucket ? { status: "OK", detail: `${MCP_ROOT_KEY}.${connectorId} present` } : {
|
|
436
|
+
status: "FAIL",
|
|
437
|
+
detail: `no ${MCP_ROOT_KEY}.${connectorId} in ${mcpPath}`
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
name: `${this.name}: hook command registered`,
|
|
443
|
+
check: () => {
|
|
444
|
+
if (hookEvents.length === 0) {
|
|
445
|
+
return { status: "OK", detail: "no hooks declared" };
|
|
446
|
+
}
|
|
447
|
+
const agent = this.readJson(agentPath);
|
|
448
|
+
if (!agent) return { status: "FAIL", detail: `cannot read ${agentPath}` };
|
|
449
|
+
const hooks = agent.hooks ?? {};
|
|
450
|
+
const registered = Object.values(hooks).some(
|
|
451
|
+
(entries) => (entries ?? []).some((e) => isHomeBinHookCommand(e.command, homeBin, connectorId))
|
|
452
|
+
);
|
|
453
|
+
return registered ? { status: "OK", detail: "hook command present" } : { status: "FAIL", detail: `no hook for ${connectorId} in ${agentPath}` };
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
];
|
|
457
|
+
for (const agent of ctx.connector.subagents) {
|
|
458
|
+
if (agent.name === RESERVED_AGENT_NAME) continue;
|
|
459
|
+
const p = this.subagentPath(ctx, agent.name);
|
|
460
|
+
checks.push({
|
|
461
|
+
name: `${this.name}: subagent ${agent.name} present`,
|
|
462
|
+
check: () => existsSync(p) ? { status: "OK", detail: p } : { status: "FAIL", detail: `not found: ${p}` }
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
return checks;
|
|
466
|
+
}
|
|
467
|
+
// ── Runtime: parse Amazon Q stdin JSON → normalized event ─────────────────
|
|
468
|
+
// Amazon Q's stdin payload shape and exit-code contract are IDENTICAL to kiro's,
|
|
469
|
+
// so this parse + the formatReply below mirror the kiro adapter exactly.
|
|
470
|
+
parseEvent(event, raw) {
|
|
471
|
+
const input = raw ?? {};
|
|
472
|
+
const connectorId = typeof input.connector === "string" ? input.connector : "";
|
|
473
|
+
const sessionId = typeof input.session_id === "string" ? input.session_id : "";
|
|
474
|
+
const projectDir = typeof input.cwd === "string" ? input.cwd : void 0;
|
|
475
|
+
const base = {
|
|
476
|
+
hostPlatform: HOST,
|
|
477
|
+
connectorId,
|
|
478
|
+
sessionId,
|
|
479
|
+
raw,
|
|
480
|
+
...projectDir !== void 0 ? { projectDir } : {}
|
|
481
|
+
};
|
|
482
|
+
switch (event) {
|
|
483
|
+
case "PreToolUse": {
|
|
484
|
+
const ev = {
|
|
485
|
+
...base,
|
|
486
|
+
toolName: input.tool_name ?? "",
|
|
487
|
+
toolInput: input.tool_input ?? {}
|
|
488
|
+
};
|
|
489
|
+
return ev;
|
|
490
|
+
}
|
|
491
|
+
case "PostToolUse": {
|
|
492
|
+
const ev = {
|
|
493
|
+
...base,
|
|
494
|
+
toolName: input.tool_name ?? "",
|
|
495
|
+
toolInput: input.tool_input ?? {},
|
|
496
|
+
...toolResponseToString(input.tool_response) !== void 0 ? { toolOutput: toolResponseToString(input.tool_response) } : {}
|
|
497
|
+
};
|
|
498
|
+
return ev;
|
|
499
|
+
}
|
|
500
|
+
case "SessionStart": {
|
|
501
|
+
const ev = {
|
|
502
|
+
...base,
|
|
503
|
+
source: normalizeSessionSource(input.source)
|
|
504
|
+
};
|
|
505
|
+
return ev;
|
|
506
|
+
}
|
|
507
|
+
case "UserPromptSubmit": {
|
|
508
|
+
const ev = {
|
|
509
|
+
...base,
|
|
510
|
+
prompt: typeof input.prompt === "string" ? input.prompt : ""
|
|
511
|
+
};
|
|
512
|
+
return ev;
|
|
513
|
+
}
|
|
514
|
+
case "Stop": {
|
|
515
|
+
const ev = {
|
|
516
|
+
...base,
|
|
517
|
+
...typeof input.stop_hook_active === "boolean" ? { stopHookActive: input.stop_hook_active } : {}
|
|
518
|
+
};
|
|
519
|
+
return ev;
|
|
520
|
+
}
|
|
521
|
+
default: {
|
|
522
|
+
throw new Error(`unsupported amazon-q hook event: ${String(event)}`);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
// ── Runtime: normalized response → Amazon Q native (exit-code) hook reply ──
|
|
527
|
+
formatReply(event, response) {
|
|
528
|
+
const decision = response.decision ?? "allow";
|
|
529
|
+
if (decision === "deny") {
|
|
530
|
+
return { exitCode: 2, stderr: response.reason ?? "Blocked by hook" };
|
|
531
|
+
}
|
|
532
|
+
if (decision === "ask") {
|
|
533
|
+
return {
|
|
534
|
+
exitCode: 2,
|
|
535
|
+
stderr: response.reason ?? "Action requires user confirmation (security policy)"
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
if (event === "Stop") {
|
|
539
|
+
return { exitCode: 0 };
|
|
540
|
+
}
|
|
541
|
+
if (decision === "context" && response.additionalContext) {
|
|
542
|
+
return {
|
|
543
|
+
exitCode: 0,
|
|
544
|
+
stdout: JSON.stringify({
|
|
545
|
+
hookSpecificOutput: {
|
|
546
|
+
hookEventName: Q_TRIGGER.agentSpawn,
|
|
547
|
+
additionalContext: response.additionalContext
|
|
548
|
+
}
|
|
549
|
+
})
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
return { exitCode: 0 };
|
|
553
|
+
}
|
|
554
|
+
};
|
|
555
|
+
function toolResponseToString(value) {
|
|
556
|
+
if (value == null) return void 0;
|
|
557
|
+
if (typeof value === "string") return value;
|
|
558
|
+
try {
|
|
559
|
+
return JSON.stringify(value);
|
|
560
|
+
} catch {
|
|
561
|
+
return String(value);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
var adapter = new AmazonQAdapter();
|
|
565
|
+
var amazon_q_default = adapter;
|
|
566
|
+
export {
|
|
567
|
+
AmazonQAdapter,
|
|
568
|
+
adapter,
|
|
569
|
+
amazon_q_default as default
|
|
570
|
+
};
|
|
571
|
+
//# sourceMappingURL=amazon-q-BWSOHTW5.js.map
|