@ken-jo/agent-connector 0.4.8 → 0.4.43

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.
Files changed (240) hide show
  1. package/README.md +36 -24
  2. package/dist/{action-RWPRIZIC.js → action-ZUHMOGLV.js} +12 -12
  3. package/dist/amazon-q-UFLBUSHG.js +570 -0
  4. package/dist/amazon-q-UFLBUSHG.js.map +1 -0
  5. package/dist/{amp-PU4LFSY6.js → amp-5DJK7VAL.js} +5 -7
  6. package/dist/{amp-PU4LFSY6.js.map → amp-5DJK7VAL.js.map} +1 -1
  7. package/dist/{amp-TULUPXXL.js → amp-BQZOL5GR.js} +2 -2
  8. package/dist/{antigravity-STHZWMP3.js → antigravity-EA4L225L.js} +2 -2
  9. package/dist/{antigravity-DWW35HZO.js → antigravity-NWP2TUG6.js} +5 -6
  10. package/dist/{antigravity-cli-P6HADOAO.js → antigravity-cli-B2HXZFYQ.js} +2 -2
  11. package/dist/{antigravity-cli-VTQ6DNWL.js → antigravity-cli-KPNLE7X4.js} +5 -6
  12. package/dist/{antigravity-cli-VTQ6DNWL.js.map → antigravity-cli-KPNLE7X4.js.map} +1 -1
  13. package/dist/{chunk-NLFPH4S2.js → chunk-2RPHDVHW.js} +2 -2
  14. package/dist/{chunk-CENEXP7K.js → chunk-3Q6YEDCG.js} +11 -6
  15. package/dist/chunk-3Q6YEDCG.js.map +1 -0
  16. package/dist/{chunk-A2T4Q7RM.js → chunk-3ZZK4KXG.js} +18 -18
  17. package/dist/{chunk-YYISBXOM.js → chunk-4CBHYWUG.js} +9 -8
  18. package/dist/{chunk-YYISBXOM.js.map → chunk-4CBHYWUG.js.map} +1 -1
  19. package/dist/{chunk-HOE2MN36.js → chunk-54B5HAVT.js} +4 -4
  20. package/dist/{chunk-XQUUNAGC.js → chunk-5HSLICR3.js} +36 -36
  21. package/dist/{chunk-CDVOBKSG.js → chunk-5TMIJ7AY.js} +26 -5
  22. package/dist/chunk-5TMIJ7AY.js.map +1 -0
  23. package/dist/{chunk-KG6T3YNJ.js → chunk-A767JFHW.js} +87 -7
  24. package/dist/chunk-A767JFHW.js.map +1 -0
  25. package/dist/{chunk-MOW2RKHX.js → chunk-AQ53TOH4.js} +8 -4
  26. package/dist/chunk-AQ53TOH4.js.map +1 -0
  27. package/dist/{chunk-YS2NYJ6R.js → chunk-ERV4TKRV.js} +3 -5
  28. package/dist/{chunk-YS2NYJ6R.js.map → chunk-ERV4TKRV.js.map} +1 -1
  29. package/dist/{chunk-BCHWFTV4.js → chunk-F4DSMVZ7.js} +2 -2
  30. package/dist/{chunk-OZ5EXXQV.js → chunk-H3BATOBP.js} +2 -2
  31. package/dist/{chunk-SCVBYSF7.js → chunk-IRUYJD23.js} +28 -28
  32. package/dist/{chunk-FAHIMJRU.js → chunk-L7ESV37V.js} +2 -2
  33. package/dist/{chunk-JNM3TPLX.js → chunk-LETB5HCK.js} +2 -2
  34. package/dist/{chunk-7TVBFRVI.js → chunk-M3H7PQWT.js} +2 -2
  35. package/dist/{chunk-JWNT5KW7.js → chunk-O7SDRBVB.js} +3 -1
  36. package/dist/chunk-O7SDRBVB.js.map +1 -0
  37. package/dist/{chunk-TRQKHP7D.js → chunk-QY42WGBX.js} +23 -2
  38. package/dist/chunk-QY42WGBX.js.map +1 -0
  39. package/dist/{chunk-VRKTVCYJ.js → chunk-RAJBLK2V.js} +33 -43
  40. package/dist/chunk-RAJBLK2V.js.map +1 -0
  41. package/dist/{chunk-WI6YSXOC.js → chunk-VDSXVNEH.js} +51 -28
  42. package/dist/chunk-VDSXVNEH.js.map +1 -0
  43. package/dist/{cursor-GJBSMXI6.js → chunk-XW46WVR2.js} +11 -12
  44. package/dist/chunk-XW46WVR2.js.map +1 -0
  45. package/dist/{chunk-NYR55UT7.js → chunk-YG3KFOOQ.js} +2 -2
  46. package/dist/{chunk-N6HH7K6P.js → chunk-ZY25RG4Y.js} +2 -2
  47. package/dist/{claude-code-W74MNTAC.js → claude-code-NMRKTAP7.js} +2 -2
  48. package/dist/{claude-code-64X6RR2S.js → claude-code-YNNKQCCR.js} +9 -11
  49. package/dist/{claude-code-64X6RR2S.js.map → claude-code-YNNKQCCR.js.map} +1 -1
  50. package/dist/cli/sdk.js +7 -7
  51. package/dist/cli.js +1 -1
  52. package/dist/{cline-T7ZDJYZQ.js → cline-AGFJF4AC.js} +5 -7
  53. package/dist/{cline-T7ZDJYZQ.js.map → cline-AGFJF4AC.js.map} +1 -1
  54. package/dist/{codebuff-3PMZJJHP.js → codebuff-ETYT5UBL.js} +2 -2
  55. package/dist/{codebuff-PPPY3SJV.js → codebuff-YUQ4PN7G.js} +5 -7
  56. package/dist/{codebuff-PPPY3SJV.js.map → codebuff-YUQ4PN7G.js.map} +1 -1
  57. package/dist/{codex-EEVN43C2.js → codex-FLU37DV3.js} +28 -13
  58. package/dist/codex-FLU37DV3.js.map +1 -0
  59. package/dist/{codex-Q3ATRRX3.js → codex-YAORPCOD.js} +2 -2
  60. package/dist/{continue-VLLZO4PM.js → continue-ZMI4YN75.js} +5 -6
  61. package/dist/{continue-VLLZO4PM.js.map → continue-ZMI4YN75.js.map} +1 -1
  62. package/dist/{copilot-cli-SJGIXVSD.js → copilot-cli-MZTAWMPW.js} +2 -2
  63. package/dist/{copilot-cli-A7G5WB4N.js → copilot-cli-XPRJ5MQB.js} +31 -7
  64. package/dist/copilot-cli-XPRJ5MQB.js.map +1 -0
  65. package/dist/{crush-AH24GDDB.js → crush-3OB5ZTCC.js} +13 -12
  66. package/dist/crush-3OB5ZTCC.js.map +1 -0
  67. package/dist/{crush-LN5QFFR2.js → crush-QBXLNN7T.js} +2 -2
  68. package/dist/{cursor-QZ6MTO74.js → cursor-DIW43TRZ.js} +2 -2
  69. package/dist/cursor-F4HYO2FP.js +22 -0
  70. package/dist/{detect-YDCZNV4W.js → detect-FXGBSNQU.js} +4 -4
  71. package/dist/{doctor-DGC7P3P7.js → doctor-2O65SAPG.js} +17 -14
  72. package/dist/{doctor-DGC7P3P7.js.map → doctor-2O65SAPG.js.map} +1 -1
  73. package/dist/{droid-RBWCFKL3.js → droid-NZCKYKOV.js} +5 -7
  74. package/dist/{droid-RBWCFKL3.js.map → droid-NZCKYKOV.js.map} +1 -1
  75. package/dist/{droid-W5WF5XEX.js → droid-U3ZBLQFO.js} +2 -2
  76. package/dist/{gemini-cli-CFPFEJEA.js → gemini-cli-3ZGCXUDD.js} +5 -7
  77. package/dist/{gemini-cli-CFPFEJEA.js.map → gemini-cli-3ZGCXUDD.js.map} +1 -1
  78. package/dist/{gemini-cli-CIRW37TU.js → gemini-cli-NMVVBO3K.js} +2 -2
  79. package/dist/{goose-A3M5GODH.js → goose-64V46Y2W.js} +2 -2
  80. package/dist/{goose-UBJVQFUE.js → goose-MGGNVXJP.js} +59 -12
  81. package/dist/goose-MGGNVXJP.js.map +1 -0
  82. package/dist/{hermes-ZYLMOFLZ.js → hermes-F3EGTK6N.js} +2 -2
  83. package/dist/{hermes-6FXGXLNL.js → hermes-L3CBJ37L.js} +11 -9
  84. package/dist/hermes-L3CBJ37L.js.map +1 -0
  85. package/dist/{hook-CDGSCASQ.js → hook-D3PY6TDK.js} +12 -12
  86. package/dist/index.d.ts +2 -2
  87. package/dist/index.js +5 -5
  88. package/dist/{install-2D3UKEME.js → install-SVBIK4VJ.js} +17 -14
  89. package/dist/{install-2D3UKEME.js.map → install-SVBIK4VJ.js.map} +1 -1
  90. package/dist/{introspect-Cn3MSA4_.d.ts → introspect-B164-hj3.d.ts} +1 -1
  91. package/dist/{jetbrains-copilot-K26KMA3U.js → jetbrains-copilot-M2LHJBAW.js} +5 -7
  92. package/dist/{jetbrains-copilot-K26KMA3U.js.map → jetbrains-copilot-M2LHJBAW.js.map} +1 -1
  93. package/dist/{kilo-BKZJ26RM.js → kilo-RMRP2EL7.js} +5 -7
  94. package/dist/{kilo-BKZJ26RM.js.map → kilo-RMRP2EL7.js.map} +1 -1
  95. package/dist/{kilo-NSWAVP6P.js → kilo-SW7BH6EG.js} +2 -2
  96. package/dist/{kilo-cli-6UVWCXQD.js → kilo-cli-6ITBNHTH.js} +16 -12
  97. package/dist/kilo-cli-6ITBNHTH.js.map +1 -0
  98. package/dist/{kilo-cli-EVBKUODA.js → kilo-cli-ZF272ZHN.js} +2 -2
  99. package/dist/{kimi-EI3UM3ZV.js → kimi-5FHEXGZD.js} +72 -13
  100. package/dist/kimi-5FHEXGZD.js.map +1 -0
  101. package/dist/{kimi-QALYPSRR.js → kimi-I35VOOY4.js} +69 -32
  102. package/dist/kimi-I35VOOY4.js.map +1 -0
  103. package/dist/{kiro-J5J42I5Z.js → kiro-2K5UJVGC.js} +13 -18
  104. package/dist/kiro-2K5UJVGC.js.map +1 -0
  105. package/dist/{kiro-UCLSLBW2.js → kiro-WGOI5CGT.js} +2 -2
  106. package/dist/{leaderboard-VZQXNWTX.js → leaderboard-ZMZST52G.js} +6 -6
  107. package/dist/{mimo-code-BEE622P2.js → mimo-code-K7AMX2QW.js} +38 -9
  108. package/dist/mimo-code-K7AMX2QW.js.map +1 -0
  109. package/dist/{mux-5HTNKK4K.js → mux-GT7FWVLH.js} +5 -7
  110. package/dist/{mux-5HTNKK4K.js.map → mux-GT7FWVLH.js.map} +1 -1
  111. package/dist/{mux-ZMLVAXOO.js → mux-XM6AP35L.js} +2 -2
  112. package/dist/{nemoclaw-DNFIZFDF.js → nemoclaw-GQMS6CUM.js} +5 -6
  113. package/dist/{nemoclaw-DNFIZFDF.js.map → nemoclaw-GQMS6CUM.js.map} +1 -1
  114. package/dist/{omp-I3UTRBNP.js → omp-2RPYIZUF.js} +4 -5
  115. package/dist/{omp-I3UTRBNP.js.map → omp-2RPYIZUF.js.map} +1 -1
  116. package/dist/{openclaw-IYA7ASL6.js → openclaw-5EQFGOWL.js} +2 -2
  117. package/dist/{openclaw-QE2LMWIF.js → openclaw-P5GMEEGC.js} +5 -6
  118. package/dist/openclaw-P5GMEEGC.js.map +1 -0
  119. package/dist/{opencode-ZFSUYJXI.js → opencode-5D2SK3EX.js} +5 -7
  120. package/dist/{opencode-ZFSUYJXI.js.map → opencode-5D2SK3EX.js.map} +1 -1
  121. package/dist/{opencode-HWT3RSMN.js → opencode-QGP4ALQY.js} +2 -2
  122. package/dist/{package-BSCCMW4E.js → package-EDYQF6C6.js} +13 -10
  123. package/dist/{package-BSCCMW4E.js.map → package-EDYQF6C6.js.map} +1 -1
  124. package/dist/{pi-UFX2OYFV.js → pi-GGDQREVG.js} +2 -2
  125. package/dist/{pi-H2KBBDDJ.js → pi-ZMM4KJTO.js} +4 -5
  126. package/dist/{pi-H2KBBDDJ.js.map → pi-ZMM4KJTO.js.map} +1 -1
  127. package/dist/{qwen-code-5LE34FNE.js → qwen-code-4ZLVGN2C.js} +12 -14
  128. package/dist/qwen-code-4ZLVGN2C.js.map +1 -0
  129. package/dist/{qwen-code-W7NUCDEN.js → qwen-code-GQILBJ5B.js} +2 -2
  130. package/dist/{roo-code-XH4GCYIS.js → roo-code-67QGLQRM.js} +6 -7
  131. package/dist/roo-code-67QGLQRM.js.map +1 -0
  132. package/dist/{roo-code-ZLKH4A7N.js → roo-code-SUWI4BBN.js} +2 -2
  133. package/dist/runtime/index.d.ts +1 -1
  134. package/dist/runtime/index.js +10 -10
  135. package/dist/sdk/index.d.ts +3 -3
  136. package/dist/sdk/index.js +6 -6
  137. package/dist/sdk/test.d.ts +2 -2
  138. package/dist/sdk/test.js +9 -9
  139. package/dist/{serve-MQNGPY2H.js → serve-427CCEYA.js} +12 -12
  140. package/dist/{status-MRHVRDFY.js → status-6IHRW6PI.js} +10 -10
  141. package/dist/{statusline-IYWA75TR.js → statusline-2CKH5RHO.js} +11 -11
  142. package/dist/{synthetic-UKR6SMGS.js → synthetic-6FRA7P5Q.js} +2 -2
  143. package/dist/{telemetry-IONIOMLC.js → telemetry-WNVKL7HW.js} +10 -10
  144. package/dist/{trae-PA26DPBW.js → trae-CPPYASR2.js} +2 -2
  145. package/dist/{trae-RVNRSV7X.js → trae-TMJPHWZ5.js} +5 -7
  146. package/dist/{trae-RVNRSV7X.js.map → trae-TMJPHWZ5.js.map} +1 -1
  147. package/dist/{types-_6arHbX9.d.ts → types-COSBYpKs.d.ts} +7 -5
  148. package/dist/{uninstall-ESLSVCLE.js → uninstall-QFCDXGKR.js} +17 -14
  149. package/dist/{uninstall-ESLSVCLE.js.map → uninstall-QFCDXGKR.js.map} +1 -1
  150. package/dist/{upgrade-VICY5T64.js → upgrade-PP46DURC.js} +17 -14
  151. package/dist/{upgrade-VICY5T64.js.map → upgrade-PP46DURC.js.map} +1 -1
  152. package/dist/{usage-TCUWV2YZ.js → usage-VDORZJPT.js} +3 -3
  153. package/dist/{usage-event-CBZZP37Q.js → usage-event-4533OURF.js} +11 -11
  154. package/dist/{vscode-copilot-B2QBBHJW.js → vscode-copilot-H7JKUKLZ.js} +21 -10
  155. package/dist/vscode-copilot-H7JKUKLZ.js.map +1 -0
  156. package/dist/{warp-JNQA7PBU.js → warp-NRBBJQR2.js} +2 -2
  157. package/dist/{warp-5R54ST3N.js → warp-SVDVKQQI.js} +5 -7
  158. package/dist/{warp-5R54ST3N.js.map → warp-SVDVKQQI.js.map} +1 -1
  159. package/dist/{windsurf-L32UEOLY.js → windsurf-H36YKOMR.js} +5 -7
  160. package/dist/{windsurf-L32UEOLY.js.map → windsurf-H36YKOMR.js.map} +1 -1
  161. package/dist/{zed-FDJHJZKD.js → zed-LHWJALLZ.js} +5 -7
  162. package/dist/{zed-FDJHJZKD.js.map → zed-LHWJALLZ.js.map} +1 -1
  163. package/dist/{zed-NNNX5MNT.js → zed-XJFOOKCO.js} +2 -2
  164. package/package.json +7 -2
  165. package/dist/amazon-q-5LJOB5L3.js +0 -264
  166. package/dist/amazon-q-5LJOB5L3.js.map +0 -1
  167. package/dist/chunk-CDVOBKSG.js.map +0 -1
  168. package/dist/chunk-CENEXP7K.js.map +0 -1
  169. package/dist/chunk-IEGR4TP3.js +0 -70
  170. package/dist/chunk-IEGR4TP3.js.map +0 -1
  171. package/dist/chunk-JWNT5KW7.js.map +0 -1
  172. package/dist/chunk-KG6T3YNJ.js.map +0 -1
  173. package/dist/chunk-MOW2RKHX.js.map +0 -1
  174. package/dist/chunk-TRQKHP7D.js.map +0 -1
  175. package/dist/chunk-VRKTVCYJ.js.map +0 -1
  176. package/dist/chunk-WI6YSXOC.js.map +0 -1
  177. package/dist/codex-EEVN43C2.js.map +0 -1
  178. package/dist/copilot-cli-A7G5WB4N.js.map +0 -1
  179. package/dist/crush-AH24GDDB.js.map +0 -1
  180. package/dist/cursor-GJBSMXI6.js.map +0 -1
  181. package/dist/goose-UBJVQFUE.js.map +0 -1
  182. package/dist/hermes-6FXGXLNL.js.map +0 -1
  183. package/dist/kilo-cli-6UVWCXQD.js.map +0 -1
  184. package/dist/kimi-EI3UM3ZV.js.map +0 -1
  185. package/dist/kimi-QALYPSRR.js.map +0 -1
  186. package/dist/kiro-J5J42I5Z.js.map +0 -1
  187. package/dist/mimo-code-BEE622P2.js.map +0 -1
  188. package/dist/qwen-code-5LE34FNE.js.map +0 -1
  189. package/dist/roo-code-XH4GCYIS.js.map +0 -1
  190. package/dist/vscode-copilot-B2QBBHJW.js.map +0 -1
  191. /package/dist/{action-RWPRIZIC.js.map → action-ZUHMOGLV.js.map} +0 -0
  192. /package/dist/{amp-TULUPXXL.js.map → amp-BQZOL5GR.js.map} +0 -0
  193. /package/dist/{antigravity-STHZWMP3.js.map → antigravity-EA4L225L.js.map} +0 -0
  194. /package/dist/{antigravity-DWW35HZO.js.map → antigravity-NWP2TUG6.js.map} +0 -0
  195. /package/dist/{antigravity-cli-P6HADOAO.js.map → antigravity-cli-B2HXZFYQ.js.map} +0 -0
  196. /package/dist/{chunk-NLFPH4S2.js.map → chunk-2RPHDVHW.js.map} +0 -0
  197. /package/dist/{chunk-A2T4Q7RM.js.map → chunk-3ZZK4KXG.js.map} +0 -0
  198. /package/dist/{chunk-HOE2MN36.js.map → chunk-54B5HAVT.js.map} +0 -0
  199. /package/dist/{chunk-XQUUNAGC.js.map → chunk-5HSLICR3.js.map} +0 -0
  200. /package/dist/{chunk-BCHWFTV4.js.map → chunk-F4DSMVZ7.js.map} +0 -0
  201. /package/dist/{chunk-OZ5EXXQV.js.map → chunk-H3BATOBP.js.map} +0 -0
  202. /package/dist/{chunk-SCVBYSF7.js.map → chunk-IRUYJD23.js.map} +0 -0
  203. /package/dist/{chunk-FAHIMJRU.js.map → chunk-L7ESV37V.js.map} +0 -0
  204. /package/dist/{chunk-JNM3TPLX.js.map → chunk-LETB5HCK.js.map} +0 -0
  205. /package/dist/{chunk-7TVBFRVI.js.map → chunk-M3H7PQWT.js.map} +0 -0
  206. /package/dist/{chunk-NYR55UT7.js.map → chunk-YG3KFOOQ.js.map} +0 -0
  207. /package/dist/{chunk-N6HH7K6P.js.map → chunk-ZY25RG4Y.js.map} +0 -0
  208. /package/dist/{claude-code-W74MNTAC.js.map → claude-code-NMRKTAP7.js.map} +0 -0
  209. /package/dist/{codebuff-3PMZJJHP.js.map → codebuff-ETYT5UBL.js.map} +0 -0
  210. /package/dist/{codex-Q3ATRRX3.js.map → codex-YAORPCOD.js.map} +0 -0
  211. /package/dist/{copilot-cli-SJGIXVSD.js.map → copilot-cli-MZTAWMPW.js.map} +0 -0
  212. /package/dist/{crush-LN5QFFR2.js.map → crush-QBXLNN7T.js.map} +0 -0
  213. /package/dist/{cursor-QZ6MTO74.js.map → cursor-DIW43TRZ.js.map} +0 -0
  214. /package/dist/{openclaw-QE2LMWIF.js.map → cursor-F4HYO2FP.js.map} +0 -0
  215. /package/dist/{detect-YDCZNV4W.js.map → detect-FXGBSNQU.js.map} +0 -0
  216. /package/dist/{droid-W5WF5XEX.js.map → droid-U3ZBLQFO.js.map} +0 -0
  217. /package/dist/{gemini-cli-CIRW37TU.js.map → gemini-cli-NMVVBO3K.js.map} +0 -0
  218. /package/dist/{goose-A3M5GODH.js.map → goose-64V46Y2W.js.map} +0 -0
  219. /package/dist/{hermes-ZYLMOFLZ.js.map → hermes-F3EGTK6N.js.map} +0 -0
  220. /package/dist/{hook-CDGSCASQ.js.map → hook-D3PY6TDK.js.map} +0 -0
  221. /package/dist/{kilo-NSWAVP6P.js.map → kilo-SW7BH6EG.js.map} +0 -0
  222. /package/dist/{kilo-cli-EVBKUODA.js.map → kilo-cli-ZF272ZHN.js.map} +0 -0
  223. /package/dist/{kiro-UCLSLBW2.js.map → kiro-WGOI5CGT.js.map} +0 -0
  224. /package/dist/{leaderboard-VZQXNWTX.js.map → leaderboard-ZMZST52G.js.map} +0 -0
  225. /package/dist/{mux-ZMLVAXOO.js.map → mux-XM6AP35L.js.map} +0 -0
  226. /package/dist/{openclaw-IYA7ASL6.js.map → openclaw-5EQFGOWL.js.map} +0 -0
  227. /package/dist/{opencode-HWT3RSMN.js.map → opencode-QGP4ALQY.js.map} +0 -0
  228. /package/dist/{pi-UFX2OYFV.js.map → pi-GGDQREVG.js.map} +0 -0
  229. /package/dist/{qwen-code-W7NUCDEN.js.map → qwen-code-GQILBJ5B.js.map} +0 -0
  230. /package/dist/{roo-code-ZLKH4A7N.js.map → roo-code-SUWI4BBN.js.map} +0 -0
  231. /package/dist/{serve-MQNGPY2H.js.map → serve-427CCEYA.js.map} +0 -0
  232. /package/dist/{status-MRHVRDFY.js.map → status-6IHRW6PI.js.map} +0 -0
  233. /package/dist/{statusline-IYWA75TR.js.map → statusline-2CKH5RHO.js.map} +0 -0
  234. /package/dist/{synthetic-UKR6SMGS.js.map → synthetic-6FRA7P5Q.js.map} +0 -0
  235. /package/dist/{telemetry-IONIOMLC.js.map → telemetry-WNVKL7HW.js.map} +0 -0
  236. /package/dist/{trae-PA26DPBW.js.map → trae-CPPYASR2.js.map} +0 -0
  237. /package/dist/{usage-TCUWV2YZ.js.map → usage-VDORZJPT.js.map} +0 -0
  238. /package/dist/{usage-event-CBZZP37Q.js.map → usage-event-4533OURF.js.map} +0 -0
  239. /package/dist/{warp-JNQA7PBU.js.map → warp-NRBBJQR2.js.map} +0 -0
  240. /package/dist/{zed-NNNX5MNT.js.map → zed-XJFOOKCO.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/adapters/kiro/index.ts"],"sourcesContent":["/**\n * adapters/kiro — Kiro (AWS) platform adapter for agent-connector.\n *\n * Kiro is a json-stdio host with TWO native config surfaces that live in\n * DIFFERENT files (so getServerConfigPath ≠ getHookConfigPath):\n *\n * 1. MCP servers — `mcp.json` under `~/.kiro/settings/` (user) or\n * `<projectDir>/.kiro/settings/` (project). The file is JSONC; we WRITE\n * plain JSON (valid JSONC), mirroring the other JSON-config adapters. Root\n * key `mcpServers`; a stdio server is `{ command, args, env }`.\n * Ref: https://kiro.dev/docs/mcp/configuration/\n *\n * 2. Hooks — NOT a settings file but an AGENT file:\n * `~/.kiro/agents/kiro_default.json`. Kiro auto-loads the built-in default\n * agent `kiro_default` for a new chat session, so hooks must register on\n * THAT agent (a file literally named `default.json` would define an inactive\n * custom agent the user must `/agent`-swap to). We merge a `hooks` key into\n * the existing agent JSON, creating a minimal agent object if absent.\n * Ref: kiro.dev/docs/cli/custom-agents/configuration-reference#hooks-field\n *\n * Hook protocol is EXIT-CODE based (unlike Claude's JSON-decision wrapper):\n * - exit 0 → allow the action.\n * - exit 2 → block the action; the reason is written to stderr (PreToolUse).\n * - context injection → exit 0 with the guidance text written as PLAIN STDOUT\n * (NOT a JSON envelope). Kiro adds a hook's STDOUT to the agent's context\n * ONLY for agentSpawn and userPromptSubmit; for preToolUse / postToolUse /\n * stop the docs say STDOUT is \"captured but not shown\" — there is no\n * context channel, so a `context` decision on those degrades to exit 0.\n * Ref: https://kiro.dev/docs/cli/hooks (Hook output / Hook types).\n * Kiro CANNOT rewrite tool arguments or output (exit codes only), so\n * canModifyArgs / canModifyOutput are false; `modify` degrades to allow.\n *\n * Native hook event vocabulary differs from the canonical names and is mapped:\n * PreToolUse → preToolUse\n * PostToolUse → postToolUse\n * SessionStart → agentSpawn (Kiro's session-start equivalent)\n * UserPromptSubmit → userPromptSubmit\n * Stop → stop (documented Kiro hook)\n * Kiro has no equivalent for PreCompact / SessionEnd / Notification; those are\n * reported as a warn/skip at install time.\n *\n * Env handling: Kiro documents no `${env:VAR}` token of the framework's syntax,\n * so env/header/url refs are resolved to literals at install time via\n * resolveEnvRefsDeep — the safe default matching the Gemini/Codex adapters.\n *\n * Grounded in context-mode's proven Kiro adapter (src/adapters/kiro/*).\n */\n\nimport { existsSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\n\nimport { BaseAdapter } from \"../base.js\";\nimport type { Adapter, HookReply, InstallContext, 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 SkillDef,\n StopEvent,\n Transport,\n UserPromptSubmitEvent,\n} from \"../../core/types.js\";\nimport { renderSkillMd } from \"../claude-code/render.js\";\nimport { resolveEnvRefsDeep } from \"../../core/interpolate.js\";\nimport {\n buildHomeBinHookCommand,\n buildWrappedStdio,\n isHomeBinHookCommand,\n} from \"../../core/spawn.js\";\nimport { normalizeSessionSource } from \"../claude-code/wire.js\";\n\nconst HOST: PlatformId = \"kiro\";\nconst MCP_ROOT_KEY = \"mcpServers\";\n\n/** The built-in agent Kiro auto-loads for a new chat session. */\nconst DEFAULT_AGENT_FILE = \"kiro_default.json\";\n\n/**\n * Kiro-native hook event names (the keys under an agent file's `hooks` object).\n * Only the events Kiro actually fires for the json-stdio command paradigm.\n */\nconst KIRO_EVENT = {\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 → Kiro's native hook event names. Only the events\n * Kiro supports are present; PreCompact / SessionEnd / Notification have no Kiro\n * equivalent and are reported as a warn/skip at install time.\n */\nconst EVENT_MAP: Partial<Record<HookEventName, string>> = {\n PreToolUse: KIRO_EVENT.preToolUse,\n PostToolUse: KIRO_EVENT.postToolUse,\n SessionStart: KIRO_EVENT.agentSpawn,\n UserPromptSubmit: KIRO_EVENT.userPromptSubmit,\n Stop: KIRO_EVENT.stop,\n};\n\n/**\n * Kiro events whose hook STDOUT is added to the agent's context: agentSpawn\n * (≈ SessionStart) and userPromptSubmit. For preToolUse / postToolUse / stop the\n * docs say STDOUT is \"captured but not shown to user\" — no context channel — so a\n * `context` decision on those degrades to a plain exit-0 pass-through.\n * Ref: https://kiro.dev/docs/cli/hooks\n */\nconst CONTEXT_EVENTS: ReadonlySet<string> = new Set([\n KIRO_EVENT.agentSpawn,\n KIRO_EVENT.userPromptSubmit,\n]);\n\n/** A single Kiro native hook registration entry (Claude-shaped, nested). */\ninterface KiroHookEntry {\n matcher: string;\n hooks: Array<{ type: \"command\"; command: string }>;\n}\n\n/** The shape of a Kiro agent file (only the parts we touch). */\ninterface KiroAgentFile {\n hooks?: Record<string, KiroHookEntry[]>;\n [key: string]: unknown;\n}\n\n/** The shape of Kiro's mcp.json (only the parts we touch). */\ninterface KiroMcpFile {\n mcpServers?: Record<string, unknown>;\n [key: string]: unknown;\n}\n\n/** Native MCP server entry shapes Kiro accepts under `mcpServers`. */\ninterface KiroStdioServer {\n command: string;\n args?: string[];\n env?: Record<string, string>;\n cwd?: string;\n}\ninterface KiroHttpServer {\n url: string;\n headers?: Record<string, string>;\n}\n\n/** Raw Kiro CLI hook stdin payload (snake_case wire fields). */\ninterface KiroWireInput {\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\nexport class KiroAdapter extends BaseAdapter implements Adapter {\n readonly id: PlatformId = HOST;\n readonly name = \"Kiro\";\n readonly paradigm: HookParadigm = \"json-stdio\";\n\n readonly capabilities: PlatformCapabilities = {\n // Memory surface: AGENTS.md-first managed block (project <projectDir>/AGENTS.md\n // via the base default — always included, no inclusion modes; user scope →\n // ~/.kiro/steering/agent-connector.md below).\n supportsMemory: true,\n preToolUse: true,\n postToolUse: true,\n preCompact: false,\n sessionStart: true,\n sessionEnd: false,\n // Kiro fires userPromptSubmit and stop, but it has no PreCompact /\n // SessionEnd / Notification equivalent.\n userPromptSubmit: true,\n stop: true,\n notification: false,\n // Newer events: Kiro's native set (agentSpawn / userPromptSubmit /\n // preToolUse / postToolUse / stop) has no permission-dialog, tool-failure,\n // or subagent lifecycle events, so permissionRequest / postToolUseFailure /\n // subagentStart / subagentStop stay unset — install reports the standard\n // skip-warn for them.\n // Kiro's hook protocol is exit-code only — a hook can allow (0), block (2),\n // or inject agentSpawn context, but it CANNOT rewrite tool args or output.\n canModifyArgs: false,\n canModifyOutput: false,\n // agentSpawn (and userPromptSubmit) add the hook's plain STDOUT to context.\n canInjectSessionContext: true,\n transports: [\"stdio\", \"http\"],\n // Skills: Kiro reads SKILL.md from .kiro/skills/<name>/SKILL.md (project)\n // and ~/.kiro/skills/<name>/SKILL.md (user).\n supportsSkills: true,\n };\n\n // ── Detection ────────────────────────────────────────────────────────────\n\n detectInstalled(projectDir: string): DetectedPlatform {\n const userDir = join(homedir(), \".kiro\");\n const userMcp = this.userMcpPath();\n const projectDirKiro = join(projectDir, \".kiro\");\n const projectMcp = this.projectMcpPath(projectDir);\n\n const userInstalled = existsSync(userDir) || existsSync(userMcp);\n const projInstalled = existsSync(projectDirKiro) || existsSync(projectMcp);\n const installed = userInstalled || projInstalled;\n // Report the scope/path that actually matched, so a project-only install\n // isn't misreported as a (non-existent) user install.\n const scope = projInstalled && !userInstalled ? \"project\" : \"user\";\n const configPath = scope === \"project\" ? projectMcp : userMcp;\n return {\n id: this.id,\n name: this.name,\n installed,\n paradigm: this.paradigm,\n capabilities: this.capabilities,\n configPath,\n scope,\n reason: installed\n ? scope === \"project\"\n ? `found project Kiro config at ${projectMcp}`\n : `found Kiro config under ${userDir}`\n : `no Kiro config at ${userDir}`,\n confidence: installed ? \"high\" : \"low\",\n };\n }\n\n // ── Memory surface: global steering dir at user scope ───────────────────\n // Project scope stays on the AGENTS.md base default (workspace-root\n // AGENTS.md is always included, with no inclusion modes). User scope targets\n // a dedicated agent-connector.md in Kiro's documented ~/.kiro/steering/ dir\n // (default-always inclusion; AC-created → cleanly deletable on uninstall).\n protected override memoryTargets(ctx: InstallContext): MemoryTarget[] {\n if (this.memoryOverride(ctx)?.path || ctx.scope !== \"user\") {\n return super.memoryTargets(ctx);\n }\n return [\n {\n path: join(homedir(), \".kiro\", \"steering\", \"agent-connector.md\"),\n reason: \"kiro global steering dir (~/.kiro/steering; agent-connector-owned file)\",\n },\n ];\n }\n\n // ── Native paths ─────────────────────────────────────────────────────────\n\n getConfigDir(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? join(ctx.projectDir, \".kiro\")\n : join(homedir(), \".kiro\");\n }\n\n /** MCP servers live in mcp.json under the scope's `.kiro/settings/`. */\n getServerConfigPath(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? this.projectMcpPath(ctx.projectDir)\n : this.userMcpPath();\n }\n\n /**\n * Hooks live in an AGENT file, NOT a settings file. Kiro auto-loads the\n * built-in default agent (`kiro_default`) for a new chat session, so we always\n * register hooks on the user-scope default agent — that is the agent Kiro\n * actually loads regardless of install scope.\n */\n getHookConfigPath(_ctx: InstallContext): string {\n return join(homedir(), \".kiro\", \"agents\", DEFAULT_AGENT_FILE);\n }\n\n private userMcpPath(): string {\n return join(homedir(), \".kiro\", \"settings\", \"mcp.json\");\n }\n\n private projectMcpPath(projectDir: string): string {\n return join(projectDir, \".kiro\", \"settings\", \"mcp.json\");\n }\n\n // ── MCP server install / uninstall ───────────────────────────────────────\n\n installServer(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n const override = connector.platforms[HOST]?.server;\n if (!connector.server || override === false) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n detail: connector.server\n ? \"server registration disabled for kiro\"\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 Kiro's native mcpServers entry. */\n private renderServerEntry(\n ctx: InstallContext,\n server: ServerDef,\n ): KiroStdioServer | KiroHttpServer {\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 // Kiro documents no native interpolation token, so resolve every\n // ${env:VAR} to a literal at install time.\n const entry: KiroStdioServer = { command: resolveEnvRefsDeep(command) };\n if (args.length > 0) entry.args = resolveEnvRefsDeep(args);\n const env = this.renderEnv(server.env);\n if (env) entry.env = env;\n if (server.cwd) entry.cwd = resolveEnvRefsDeep(server.cwd);\n return entry;\n }\n\n // http (and any other remote transport) — Kiro registers a URL.\n const entry: KiroHttpServer = { url: resolveEnvRefsDeep(server.url ?? \"\") };\n const headers = this.renderEnv(server.headers);\n if (headers) entry.headers = headers;\n return entry;\n }\n\n /**\n * Render env/header values. Kiro documents no native interpolation token, so\n * resolve `${env:VAR}` references to literals at install time.\n */\n private renderEnv(\n env: Record<string, string> | undefined,\n ): Record<string, string> | undefined {\n if (!env || Object.keys(env).length === 0) return undefined;\n return resolveEnvRefsDeep({ ...env });\n }\n\n // ── Skills surface ───────────────────────────────────────────────────────\n // Kiro reads SKILL.md from:\n // project scope → <projectDir>/.kiro/skills/<name>/SKILL.md\n // user scope → ~/.kiro/skills/<name>/SKILL.md\n\n private skillsDir(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? join(ctx.projectDir, \".kiro\", \"skills\")\n : join(homedir(), \".kiro\", \"skills\");\n }\n\n private skillDir(ctx: InstallContext, name: string): string {\n return join(this.skillsDir(ctx), name);\n }\n\n override installSkills(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[HOST]?.skills === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"skills disabled for kiro\" }];\n }\n if (connector.skills.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no skills\" }];\n }\n const changes: ChangeRecord[] = [];\n for (const skill of connector.skills) {\n const dir = this.skillDir(ctx, skill.name);\n changes.push(\n this.writeContentFile(join(dir, \"SKILL.md\"), this.renderSkill(skill), ctx.dryRun),\n );\n for (const [rel, contents] of Object.entries(skill.resources ?? {})) {\n const target = this.resolveWithin(dir, rel);\n if (target === null) {\n changes.push({\n platform: this.id,\n action: \"warn\",\n detail: `skill resource \"${rel}\" escapes the skill dir; skipped`,\n });\n continue;\n }\n changes.push(this.writeContentFile(target, contents, ctx.dryRun));\n }\n }\n return changes;\n }\n\n override uninstallSkills(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.skills.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no skills\" }];\n }\n const changes: ChangeRecord[] = [];\n for (const skill of connector.skills) {\n const dir = this.skillDir(ctx, skill.name);\n changes.push(this.removeContentFile(join(dir, \"SKILL.md\"), ctx.dryRun));\n for (const rel of Object.keys(skill.resources ?? {})) {\n const target = this.resolveWithin(dir, rel);\n if (target === null) continue;\n changes.push(this.removeContentFile(target, ctx.dryRun));\n }\n changes.push(this.removeDirIfEmpty(dir, ctx.dryRun));\n }\n return changes;\n }\n\n private renderSkill(skill: SkillDef): string {\n return renderSkillMd(skill);\n }\n\n // ── Hook install / uninstall (merge into the 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 kiro\" }];\n }\n if (connector.hookEvents.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no hooks\" }];\n }\n\n const agentPath = this.getHookConfigPath(ctx);\n // Merge into the existing agent JSON; create a minimal agent object if absent.\n const agent = this.readJson<KiroAgentFile>(agentPath) ?? {};\n const __skip = this.malformedHookRootSkip(agentPath, (agent as Record<string, unknown>).hooks);\n if (__skip) return [__skip];\n const hooks = (agent.hooks ??= {});\n\n const changes: ChangeRecord[] = [];\n let mutated = false;\n\n for (const event of connector.hookEvents) {\n const kiroEvent = EVENT_MAP[event];\n if (!kiroEvent) {\n // No Kiro equivalent for this canonical event — report and continue.\n changes.push({\n platform: this.id,\n action: \"warn\",\n path: agentPath,\n detail: `${event} has no Kiro hook equivalent — skipped`,\n });\n continue;\n }\n\n const command = buildHomeBinHookCommand(ctx.homeBinPath, HOST, event, connector.id);\n const matcher = connector.hooks[event]?.matcher ?? \"\";\n const entry: KiroHookEntry = {\n matcher,\n hooks: [{ type: \"command\", command }],\n };\n\n const bucket = (hooks[kiroEvent] ??= []);\n const existingIdx = bucket.findIndex((e) => this.entryHasOurCommand(e, ctx));\n\n if (existingIdx >= 0) {\n if (JSON.stringify(bucket[existingIdx]) === JSON.stringify(entry)) {\n changes.push({\n platform: this.id,\n action: \"skip\",\n path: agentPath,\n detail: `hooks.${kiroEvent} already registered`,\n });\n continue;\n }\n bucket[existingIdx] = entry;\n changes.push({\n platform: this.id,\n action: \"update\",\n path: agentPath,\n detail: `hooks.${kiroEvent}`,\n });\n } else {\n bucket.push(entry);\n changes.push({\n platform: this.id,\n action: \"create\",\n path: agentPath,\n detail: `hooks.${kiroEvent}`,\n });\n }\n mutated = true;\n }\n\n if (mutated) this.writeJson(agentPath, agent, ctx.dryRun);\n return changes;\n }\n\n uninstallHooks(ctx: InstallContext): ChangeRecord[] {\n const agentPath = this.getHookConfigPath(ctx);\n const agent = this.readJson<KiroAgentFile>(agentPath);\n const hooks = agent?.hooks;\n if (!agent || !hooks) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n path: agentPath,\n detail: \"no hooks section present\",\n },\n ];\n }\n\n const changes: ChangeRecord[] = [];\n let mutated = false;\n\n for (const kiroEvent of Object.keys(hooks)) {\n const bucket = hooks[kiroEvent];\n if (!Array.isArray(bucket)) continue;\n\n // Strip our hook command from each entry; drop entries left empty so we\n // never remove another connector's (or the user's own) hook commands.\n const next: KiroHookEntry[] = [];\n let removed = 0;\n for (const e of bucket) {\n const innerBefore = e.hooks?.length ?? 0;\n const inner = (e.hooks ?? []).filter((h) => !this.isOurCommand(h.command, ctx));\n removed += innerBefore - inner.length;\n if (inner.length > 0) next.push({ matcher: e.matcher ?? \"\", hooks: inner });\n }\n\n if (removed > 0) {\n if (next.length > 0) hooks[kiroEvent] = next;\n else delete hooks[kiroEvent];\n changes.push({\n platform: this.id,\n action: \"remove\",\n path: agentPath,\n detail: `hooks.${kiroEvent} (${removed})`,\n });\n mutated = true;\n }\n }\n\n if (mutated) this.writeJson(agentPath, agent, ctx.dryRun);\n if (changes.length === 0) {\n changes.push({\n platform: this.id,\n action: \"skip\",\n path: agentPath,\n detail: \"no matching hook entries\",\n });\n }\n return changes;\n }\n\n private entryHasOurCommand(entry: KiroHookEntry, ctx: InstallContext): boolean {\n return (entry.hooks ?? []).some((h) => this.isOurCommand(h.command, ctx));\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 // ── 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 return [\n {\n name: `${this.name}: mcp.json present`,\n check: () =>\n existsSync(mcpPath)\n ? { status: \"OK\", detail: mcpPath }\n : { status: \"FAIL\", detail: `not found: ${mcpPath}` },\n },\n {\n name: `${this.name}: server entry registered`,\n check: () => {\n // Only assert what the connector declares (same rule as the hook\n // check below): a server-less connector never writes an mcpServers\n // entry, so its absence is healthy.\n if (!ctx.connector.server) {\n return { status: \"OK\", detail: \"no MCP server declared\" };\n }\n const cfg = this.readJson<KiroMcpFile>(mcpPath);\n const bucket = cfg?.mcpServers;\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 : { status: \"FAIL\", detail: `no ${MCP_ROOT_KEY}.${connectorId} in ${mcpPath}` };\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<KiroAgentFile>(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) =>\n (e.hooks ?? []).some((h) =>\n isHomeBinHookCommand(h.command, homeBin, connectorId),\n ),\n ),\n );\n return registered\n ? { status: \"OK\", detail: \"hook command present\" }\n : { status: \"FAIL\", detail: `no hook for ${connectorId} in ${agentPath}` };\n },\n },\n ];\n }\n\n // ── Runtime: parse Kiro stdin JSON → normalized event ────────────────────\n\n parseEvent(event: HookEventName, raw: unknown): NormalizedEvent {\n const input = (raw ?? {}) as KiroWireInput;\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 // Kiro never delivers PreCompact / SessionEnd / Notification nor the\n // newer PermissionRequest / PostToolUseFailure / SubagentStart /\n // SubagentStop (no native equivalents). If the runtime dispatches one\n // anyway, surface it loudly rather than silently mis-parse.\n throw new Error(`unsupported kiro hook event: ${String(event)}`);\n }\n }\n }\n\n // ── Runtime: normalized response → Kiro 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 → Kiro 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 as exit 2). There is no\n // context/additionalContext channel on a Stop hook, so anything non-deny\n // passes through with exit 0 (do not fall into the context branch).\n if (event === \"Stop\") {\n return { exitCode: 0 };\n }\n\n // context → inject soft guidance. Kiro adds a hook's PLAIN STDOUT to the\n // agent's context (no JSON envelope), but ONLY for the agentSpawn and\n // userPromptSubmit events; preToolUse / postToolUse have no context channel\n // (their STDOUT is \"captured but not shown\"). So emit the raw text on stdout\n // only when the FIRING event maps to a context-supporting Kiro event;\n // otherwise the context decision degrades to a plain exit-0 pass-through\n // rather than a mislabeled/ineffective payload. exit 0 = allow.\n // Ref: https://kiro.dev/docs/cli/hooks\n const kiroEvent = EVENT_MAP[event];\n if (\n decision === \"context\" &&\n response.additionalContext &&\n kiroEvent !== undefined &&\n CONTEXT_EVENTS.has(kiroEvent)\n ) {\n return { exitCode: 0, stdout: response.additionalContext };\n }\n\n // modify is unsupported on Kiro (exit-code protocol — cannot rewrite\n // args/output); allow / void → pass through with exit 0.\n return { exitCode: 0 };\n }\n}\n\n/** Coerce a Kiro 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 KiroAdapter();\nexport default adapter;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgDA,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,YAAY;AA+BrB,IAAM,OAAmB;AACzB,IAAM,eAAe;AAGrB,IAAM,qBAAqB;AAM3B,IAAM,aAAa;AAAA,EACjB,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,MAAM;AACR;AAOA,IAAM,YAAoD;AAAA,EACxD,YAAY,WAAW;AAAA,EACvB,aAAa,WAAW;AAAA,EACxB,c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AKA,QAAI,UAAU,QAAQ;AACpB,aAAO,EAAE,UAAU,EAAE;AAAA,IACvB;AAUA,UAAM,YAAY,UAAU,KAAK;AACjC,QACE,aAAa,aACb,SAAS,qBACT,cAAc,UACd,eAAe,IAAI,SAAS,GAC5B;AACA,aAAO,EAAE,UAAU,GAAG,QAAQ,SAAS,kBAAkB;AAAA,IAC3D;AAIA,WAAO,EAAE,UAAU,EAAE;AAAA,EACvB;AACF;AAGA,SAAS,qBAAqB,OAAoC;AAChE,MAAI,SAAS,KAAM,QAAO;AAC1B,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,MAAI;AACF,WAAO,KAAK,UAAU,KAAK;AAAA,EAC7B,QAAQ;AACN,WAAO,OAAO,KAAK;AAAA,EACrB;AACF;AAEO,IAAM,UAAU,IAAI,YAAY;AACvC,IAAO,eAAQ;","names":["entry"]}
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  firstExistingRoot,
9
9
  walkFiles
10
- } from "./chunk-JWNT5KW7.js";
10
+ } from "./chunk-O7SDRBVB.js";
11
11
  import {
12
12
  emptyTokens,
13
13
  normalizeWorkspaceKey,
@@ -214,4 +214,4 @@ var kiro_default = kiroReader;
214
214
  export {
215
215
  kiro_default as default
216
216
  };
217
- //# sourceMappingURL=kiro-UCLSLBW2.js.map
217
+ //# sourceMappingURL=kiro-WGOI5CGT.js.map
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  formatHostLeaderboard,
4
4
  hostLeaderboard
5
- } from "./chunk-SCVBYSF7.js";
5
+ } from "./chunk-IRUYJD23.js";
6
6
  import {
7
7
  SCOPE_FILTER_VALUES,
8
8
  formatHostNativeTurns,
@@ -10,14 +10,14 @@ import {
10
10
  hostNativeTurns,
11
11
  isScopeFilter,
12
12
  mcpLeaderboard
13
- } from "./chunk-JNM3TPLX.js";
13
+ } from "./chunk-LETB5HCK.js";
14
14
  import "./chunk-XD7MY6HB.js";
15
15
  import {
16
16
  fail,
17
17
  print
18
- } from "./chunk-A2T4Q7RM.js";
19
- import "./chunk-BCHWFTV4.js";
20
- import "./chunk-TRQKHP7D.js";
18
+ } from "./chunk-3ZZK4KXG.js";
19
+ import "./chunk-F4DSMVZ7.js";
20
+ import "./chunk-QY42WGBX.js";
21
21
 
22
22
  // src/cli/commands/leaderboard.ts
23
23
  import { parseArgs } from "util";
@@ -134,4 +134,4 @@ export {
134
134
  parseSince,
135
135
  run
136
136
  };
137
- //# sourceMappingURL=leaderboard-VZQXNWTX.js.map
137
+ //# sourceMappingURL=leaderboard-ZMZST52G.js.map
@@ -6,17 +6,15 @@ import {
6
6
  resolveEnvRefsDeep
7
7
  } from "./chunk-DBQMX75U.js";
8
8
  import {
9
- BaseAdapter
10
- } from "./chunk-KG6T3YNJ.js";
11
- import {
9
+ BaseAdapter,
12
10
  renderOpenCodeSubagentMd,
13
11
  renderSkillMd
14
- } from "./chunk-IEGR4TP3.js";
12
+ } from "./chunk-A767JFHW.js";
15
13
  import {
16
14
  buildWrappedStdio
17
15
  } from "./chunk-TO57WYBB.js";
18
- import "./chunk-N6HH7K6P.js";
19
- import "./chunk-TRQKHP7D.js";
16
+ import "./chunk-ZY25RG4Y.js";
17
+ import "./chunk-QY42WGBX.js";
20
18
 
21
19
  // src/adapters/mimo-code/index.ts
22
20
  import {
@@ -41,7 +39,14 @@ var EVENT_TO_MIMOCODE = {
41
39
  SessionStart: "experimental.chat.system.transform",
42
40
  // chat.message fires on the user's prompt submission; the handler mutates
43
41
  // output (pushes a text part) to inject context. No documented block/abort.
44
- UserPromptSubmit: "chat.message"
42
+ UserPromptSubmit: "chat.message",
43
+ // session.idle ("session finished responding") → canonical Stop. NOT a direct
44
+ // hook key — dispatched through the generic `event` hook (event.type switch).
45
+ // session.idle is the OpenCode-family session-completion event (mirrors kilo /
46
+ // kilo-cli); if it never fires on a given MiMoCode build, Stop is a silent
47
+ // no-op (an acceptable degrade — it never mis-fires), so coverage may be
48
+ // optimistic.
49
+ Stop: "session.idle"
45
50
  };
46
51
  var MiMoCodeAdapter = class extends BaseAdapter {
47
52
  id = HOST;
@@ -57,7 +62,9 @@ var MiMoCodeAdapter = class extends BaseAdapter {
57
62
  sessionStart: true,
58
63
  sessionEnd: false,
59
64
  userPromptSubmit: true,
60
- stop: false,
65
+ // session.idle (via the generic `event` hook) backs Stop (mirrors kilo /
66
+ // kilo-cli — same OpenCode-family ts-plugin layer).
67
+ stop: true,
61
68
  notification: false,
62
69
  // tool.execute.before mutates output.args → input rewrite supported.
63
70
  canModifyArgs: true,
@@ -567,6 +574,24 @@ ${renderBridgePrelude({
567
574
  }
568
575
  },`);
569
576
  }
577
+ if (has("Stop")) {
578
+ handlers.push(` // Stop \u2192 session.idle ("session finished responding"). session.idle is NOT a
579
+ // direct hook key \u2014 it is dispatched through the generic \`event\` hook
580
+ // switching on event.type (the OpenCode plugin shape, per opencode.ai/docs/
581
+ // plugins). A block decision throws to halt (MiMoCode has no Stop-gate return
582
+ // value). If session.idle never fires on a given build, Stop is a silent
583
+ // no-op (an acceptable degrade \u2014 it never mis-fires).
584
+ event: async ({ event }) => {
585
+ if (!event || event.type !== "session.idle") return;
586
+ const res = bridge("Stop", {
587
+ sessionId: (event.properties && event.properties.sessionID) || "",
588
+ projectDir: PROJECT_DIR,
589
+ });
590
+ if (res && res.decision === "deny") {
591
+ throw new Error(res.reason || "Stop blocked by ${ctx.connector.id}");
592
+ }
593
+ },`);
594
+ }
570
595
  const factory = `
571
596
  export default async function (ctx) {
572
597
  // ctx.directory is the MiMoCode project root; fall back to cwd.
@@ -626,6 +651,10 @@ ${handlers.join("\n")}
626
651
  };
627
652
  return ev;
628
653
  }
654
+ case "Stop": {
655
+ const ev = { ...base };
656
+ return ev;
657
+ }
629
658
  default:
630
659
  return { ...base, source: "startup" };
631
660
  }
@@ -722,4 +751,4 @@ export {
722
751
  adapter,
723
752
  mimo_code_default as default
724
753
  };
725
- //# sourceMappingURL=mimo-code-BEE622P2.js.map
754
+ //# sourceMappingURL=mimo-code-K7AMX2QW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/adapters/mimo-code/index.ts"],"sourcesContent":["/**\n * adapters/mimo-code — Xiaomi MiMoCode platform adapter for agent-connector.\n *\n * MiMoCode (github.com/XiaomiMiMo/MiMo-Code, MIT) is Xiaomi's open-source\n * terminal AI coding agent — a FORK OF OpenCode (anomalyco/opencode) that adds\n * cross-session memory, checkpoints, subagents, etc. Official npm `@mimo-ai/cli`\n * (bin: `mimo`). NOTE: `@xiaomi-mimo/cli` is an UNOFFICIAL squatter (GPL) — not\n * referenced here; the bin is `mimo`, NOT `mimo-code`.\n *\n * DESIGN — STANDALONE (mirrors OpenCode's render logic with mimocode paths),\n * NOT `extends OpenCodeAdapter`. The OpenCode adapter binds the host string in\n * several places that a subclass cannot cleanly override:\n * - a module-level `const HOST = \"opencode\"` used for the per-platform server/\n * hooks override lookup (`ctx.connector.platforms[HOST]`) and stamped as\n * `hostPlatform` on every parsed event — extending would read\n * `platforms[\"opencode\"]` overrides and mis-stamp events as opencode;\n * - the PRIVATE `buildPluginSource` hardcodes `[\"hook\", \"opencode\", event, …]`\n * in the GENERATED bridge, so an inherited plugin would dispatch the runtime\n * hook to the opencode adapter (`hook opencode`) instead of mimo-code;\n * - the config/plugin/content directory builders hardcode \"opencode\" /\n * \".opencode\" / \"opencode.json\".\n * Overriding all of that means re-implementing the private render core anyway,\n * so this adapter mirrors OpenCode's logic with a `HOST = \"mimo-code\"` constant\n * and the mimocode paths — a clean standalone that routes detection, the runtime\n * bridge, and per-platform overrides to its own id.\n *\n * MiMoCode IS OpenCode's config dialect, so the render shapes are IDENTICAL:\n * - config file `mimocode.json`\n * user scope → ~/.config/mimocode/mimocode.json\n * project scope → <projectDir>/mimocode.json\n * (the dir is `.mimocode` / `~/.config/mimocode` — NO hyphen; the committed\n * example is `.mimocode/mimocode.jsonc`).\n * - MCP root key \"mcp\" (the OpenCode shape, NOT \"mcpServers\"); each server\n * keyed by name; stdio → { type:\"local\", command:[exe,…args], environment },\n * remote → { type:\"remote\", url }.\n * - ts-plugin hooks: a self-contained ESM bridge module auto-loaded from the\n * user scope → ~/.config/mimocode/plugin/<id>.js\n * project scope → <projectDir>/.mimocode/plugin/<id>.js\n * plugin dir (writing the file IS the registration; no config array edit).\n * - content surfaces under <mcDir>/{commands,skills,agent} (singular `agent/`,\n * matching OpenCode).\n *\n * Event mapping (OpenCode's, unchanged):\n * PreToolUse → \"tool.execute.before\" (mutate output.args; throw to deny)\n * PostToolUse → \"tool.execute.after\" (mutate output.output)\n * SessionStart → \"experimental.chat.system.transform\" (inject into output.system)\n *\n * SOURCES: github.com/XiaomiMiMo/MiMo-Code (README, .mimocode/mimocode.jsonc,\n * packages/opencode/src/config/{config.ts,mcp.ts,plugin.ts}). npm @mimo-ai/cli.\n * mimo.xiaomi.com/en/mimocode.\n */\n\nimport {\n chmodSync,\n existsSync,\n mkdirSync,\n readFileSync,\n rmSync,\n writeFileSync,\n} from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\n\nimport { BaseAdapter } from \"../base.js\";\nimport type {\n Adapter,\n GeneratedPluginFile,\n HookReply,\n InstallContext,\n MemoryTarget,\n NormalizedEvent,\n} from \"../spi.js\";\nimport type {\n ChangeRecord,\n CommandDef,\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 Transport,\n UserPromptSubmitEvent,\n} from \"../../core/types.js\";\nimport { resolveEnvRefsDeep } from \"../../core/interpolate.js\";\nimport { renderBridgePrelude } from \"../../core/ts-plugin-bridge.js\";\nimport {\n buildWrappedStdio,\n} from \"../../core/spawn.js\";\nimport { renderOpenCodeSubagentMd, renderSkillMd } from \"../claude-code/render.js\";\n\nconst HOST: PlatformId = \"mimo-code\";\nconst MCP_ROOT_KEY = \"mcp\";\n\n/** The config dir name (NO hyphen): `.mimocode` / `~/.config/mimocode`. */\nconst CONFIG_DIR_NAME = \"mimocode\";\n/** The config file name: `mimocode.json`. */\nconst CONFIG_FILE_NAME = \"mimocode.json\";\n\n/**\n * Canonical → MiMoCode (OpenCode-shaped) event name map. A connector hook event\n * is only emitted by the generated plugin when it appears here AND is declared\n * by the connector.\n */\nconst EVENT_TO_MIMOCODE: Partial<Record<HookEventName, string>> = {\n PreToolUse: \"tool.execute.before\",\n PostToolUse: \"tool.execute.after\",\n // No real SessionStart hook (inherited from OpenCode #14808 / #5409). The\n // verified surrogate is experimental.chat.system.transform.\n SessionStart: \"experimental.chat.system.transform\",\n // chat.message fires on the user's prompt submission; the handler mutates\n // output (pushes a text part) to inject context. No documented block/abort.\n UserPromptSubmit: \"chat.message\",\n // session.idle (\"session finished responding\") → canonical Stop. NOT a direct\n // hook key — dispatched through the generic `event` hook (event.type switch).\n // session.idle is the OpenCode-family session-completion event (mirrors kilo /\n // kilo-cli); if it never fires on a given MiMoCode build, Stop is a silent\n // no-op (an acceptable degrade — it never mis-fires), so coverage may be\n // optimistic.\n Stop: \"session.idle\",\n};\n\n/** Raw payload the generated plugin posts to the universal hook entrypoint. */\ninterface MiMoCodeBridgePayload {\n toolName?: string;\n toolInput?: Record<string, unknown>;\n toolOutput?: string;\n isError?: boolean;\n prompt?: string;\n sessionId?: string;\n projectDir?: string;\n}\n\n/** Native MCP server entry shapes MiMoCode accepts under the \"mcp\" key. */\ninterface MiMoCodeLocalServer {\n type: \"local\";\n command: string[];\n environment?: Record<string, string>;\n enabled?: boolean;\n}\ninterface MiMoCodeRemoteServer {\n type: \"remote\";\n url: string;\n enabled?: boolean;\n}\n\nexport class MiMoCodeAdapter extends BaseAdapter implements Adapter {\n readonly id: PlatformId = HOST;\n readonly name = \"MiMoCode\";\n readonly paradigm: HookParadigm = \"ts-plugin\";\n\n readonly capabilities: PlatformCapabilities = {\n // Memory surface: AGENTS.md-first managed block (CLAUDE.md fallback, like\n // OpenCode — MiMoCode keeps OpenCode's CLAUDE.md import + AGENTS.md reading).\n supportsMemory: true,\n preToolUse: true,\n postToolUse: true,\n preCompact: false,\n sessionStart: true,\n sessionEnd: false,\n userPromptSubmit: true,\n // session.idle (via the generic `event` hook) backs Stop (mirrors kilo /\n // kilo-cli — same OpenCode-family ts-plugin layer).\n stop: true,\n notification: false,\n // tool.execute.before mutates output.args → input rewrite supported.\n canModifyArgs: true,\n // tool.execute.after mutates output.output → output rewrite supported.\n canModifyOutput: true,\n // injected via experimental.chat.system.transform at session start.\n canInjectSessionContext: true,\n transports: [\"stdio\", \"sse\", \"http\"],\n // Content surfaces: MiMoCode authors all three natively under <mcDir>\n // (inherited from OpenCode's commands/skills/agent layout).\n supportsCommands: true,\n supportsSkills: true,\n supportsSubagents: true,\n };\n\n // ── Detection ──────────────────────────────────────────────────────────\n\n detectInstalled(projectDir: string): DetectedPlatform {\n const userConfigDir = join(homedir(), \".config\", CONFIG_DIR_NAME);\n const userConfig = join(userConfigDir, CONFIG_FILE_NAME);\n const projectConfig = join(projectDir, CONFIG_FILE_NAME);\n\n const userInstalled = existsSync(userConfigDir) || existsSync(userConfig);\n const projInstalled = existsSync(projectConfig);\n const installed = userInstalled || projInstalled;\n\n // Report the marker that actually matched so a project-only install isn't\n // misreported as a (non-existent) user install.\n const scope = projInstalled && !userInstalled ? \"project\" : \"user\";\n const configPath = scope === \"project\" ? projectConfig : userConfig;\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 ? scope === \"project\"\n ? `found project MiMoCode config at ${projectConfig}`\n : `found MiMoCode config under ${userConfigDir}`\n : `no MiMoCode config at ${userConfigDir}`,\n confidence: installed ? \"high\" : \"low\",\n };\n }\n\n // ── Memory surface: AGENTS.md / CLAUDE.md-fallback probe (project) ──────\n // Mirrors OpenCode: project AGENTS.md, falling back to CLAUDE.md ONLY when no\n // AGENTS.md exists (creating AGENTS.md beside a relied-on CLAUDE.md would\n // shadow the user's rules). User scope stays on the BaseAdapter default.\n protected override memoryTargets(ctx: InstallContext): MemoryTarget[] {\n if (this.memoryOverride(ctx)?.path || ctx.scope !== \"project\") {\n return super.memoryTargets(ctx);\n }\n const agentsMd = join(ctx.projectDir, \"AGENTS.md\");\n if (existsSync(agentsMd)) {\n return [{ path: agentsMd, reason: \"AGENTS.md (mimocode's primary project rules file)\" }];\n }\n const claudeMd = join(ctx.projectDir, \"CLAUDE.md\");\n if (existsSync(claudeMd)) {\n return [\n {\n path: claudeMd,\n reason:\n \"CLAUDE.md (mimocode's fallback rules file — creating AGENTS.md would shadow it)\",\n },\n ];\n }\n return [{ path: agentsMd, reason: \"AGENTS.md standard (created; no mimocode rules file yet)\" }];\n }\n\n // ── Native paths ───────────────────────────────────────────────────────\n\n getConfigDir(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? ctx.projectDir\n : join(homedir(), \".config\", CONFIG_DIR_NAME);\n }\n\n getServerConfigPath(ctx: InstallContext): string {\n return join(this.getConfigDir(ctx), CONFIG_FILE_NAME);\n }\n\n /**\n * For ts-plugin hosts the \"hook config path\" is the generated plugin FILE.\n * MiMoCode (like OpenCode) auto-loads every file in the plugin dir; writing\n * this file IS the registration.\n */\n getHookConfigPath(ctx: InstallContext): string {\n return join(this.pluginDir(ctx), this.pluginFileName(ctx));\n }\n\n /** Plugin directory MiMoCode auto-loads modules from, per scope. */\n private pluginDir(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? join(ctx.projectDir, `.${CONFIG_DIR_NAME}`, \"plugin\")\n : join(homedir(), \".config\", CONFIG_DIR_NAME, \"plugin\");\n }\n\n /** Plugin module file name (one per connector, kebab-case id). */\n private pluginFileName(ctx: InstallContext): string {\n return `${ctx.connector.id}.js`;\n }\n\n // ── MCP server install / uninstall ─────────────────────────────────────\n\n installServer(ctx: InstallContext): ChangeRecord[] {\n const server = this.effectiveServer(ctx);\n const serverPath = this.getServerConfigPath(ctx);\n\n if (!server) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n path: serverPath,\n detail: ctx.connector.server\n ? \"server registration disabled for mimo-code\"\n : \"connector declares no MCP server\",\n },\n ];\n }\n\n const entry = this.renderServerEntry(ctx, server);\n return [\n this.upsertServerInJson(\n serverPath,\n MCP_ROOT_KEY,\n ctx.connector.id,\n entry,\n ctx.dryRun,\n ),\n ];\n }\n\n uninstallServer(ctx: InstallContext): ChangeRecord[] {\n const serverPath = this.getServerConfigPath(ctx);\n return [\n this.removeServerFromJson(\n serverPath,\n MCP_ROOT_KEY,\n ctx.connector.id,\n ctx.dryRun,\n ),\n ];\n }\n\n /** Resolve the per-platform server override into an effective ServerDef. */\n private effectiveServer(ctx: InstallContext): ServerDef | undefined {\n const override = ctx.connector.platforms[HOST]?.server;\n if (override === false) return undefined;\n const base = ctx.connector.server;\n if (!base) return undefined;\n return override && typeof override === \"object\" ? { ...base, ...override } : base;\n }\n\n /**\n * Render a normalized ServerDef into MiMoCode's native \"mcp\" entry (OpenCode\n * dialect).\n *\n * stdio → { type: \"local\", command: [exe, ...args], environment }\n * remote → { type: \"remote\", url }\n *\n * MiMoCode flattens command+args into a single ARRAY. When telemetry wrapping\n * applies, the wrapper's command+args (which already include the real command\n * tail after `--`) become the head of that array. No native interpolation\n * token → resolve every ${env:VAR} reference to a literal at install time.\n */\n private renderServerEntry(\n ctx: InstallContext,\n server: ServerDef,\n ): MiMoCodeLocalServer | MiMoCodeRemoteServer {\n const transport: Transport = server.transport;\n\n if (transport === \"stdio\") {\n let command = server.command ?? \"\";\n let args = [...(server.args ?? [])];\n\n ({ command, args } = buildWrappedStdio(ctx, server, this.id, command, args));\n\n const commandArray = resolveEnvRefsDeep([command, ...args]).filter(\n (s) => s !== \"\",\n );\n const entry: MiMoCodeLocalServer = {\n type: \"local\",\n command: commandArray,\n };\n const environment = this.renderEnv(server.env);\n if (environment) entry.environment = environment;\n if (server.enabled === false) entry.enabled = false;\n return entry;\n }\n\n // sse / http / ws (any remote transport) — MiMoCode registers a URL.\n const entry: MiMoCodeRemoteServer = {\n type: \"remote\",\n url: resolveEnvRefsDeep(server.url ?? \"\"),\n };\n if (server.enabled === false) entry.enabled = false;\n return entry;\n }\n\n /** Render env values, resolving every ${env:VAR} reference to a literal. */\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 (ts-plugin) ───────────────────────────────\n\n installHooks(ctx: InstallContext): ChangeRecord[] {\n const pluginPath = this.getHookConfigPath(ctx);\n\n if (ctx.connector.platforms[HOST]?.hooks === false) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n path: pluginPath,\n detail: \"hooks disabled for mimo-code\",\n },\n ];\n }\n if (ctx.connector.hookEvents.length === 0) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n path: pluginPath,\n detail: \"connector declares no hooks\",\n },\n ];\n }\n\n const files = this.synthesizePlugin(ctx);\n const changes: ChangeRecord[] = [];\n\n for (const file of files) {\n const before = existsSync(file.path)\n ? this.safeRead(file.path)\n : undefined;\n let action: ChangeRecord[\"action\"];\n if (before === undefined) action = \"create\";\n else if (before === file.contents) action = \"skip\";\n else action = \"update\";\n\n if (action !== \"skip\" && !ctx.dryRun) {\n ensureDir(dirname(file.path));\n writeFileSync(file.path, file.contents, \"utf8\");\n chmodSync(file.path, file.executable ? 0o755 : 0o644);\n }\n\n changes.push({\n platform: this.id,\n action,\n path: file.path,\n detail: `mimo-code plugin module (${this.hookDetail(ctx)})`,\n });\n }\n\n return changes;\n }\n\n /**\n * Human-facing summary of which declared events the synthesized module\n * ACTUALLY wires. Only events present in EVENT_TO_MIMOCODE are mapped/wired;\n * any declared event with no mapping is reported separately as \"unsupported\n * here\" so the detail never overstates coverage.\n */\n private hookDetail(ctx: InstallContext): string {\n const declared = ctx.connector.hookEvents;\n const mapped = declared.filter((e) => EVENT_TO_MIMOCODE[e] !== undefined);\n const unsupported = declared.filter((e) => EVENT_TO_MIMOCODE[e] === undefined);\n const base = mapped.join(\",\");\n return unsupported.length > 0\n ? `${base}; unsupported here: ${unsupported.join(\",\")}`\n : base;\n }\n\n uninstallHooks(ctx: InstallContext): ChangeRecord[] {\n const pluginPath = this.getHookConfigPath(ctx);\n if (!existsSync(pluginPath)) {\n return [\n {\n platform: this.id,\n action: \"skip\",\n path: pluginPath,\n detail: \"no mimo-code plugin module present\",\n },\n ];\n }\n if (!ctx.dryRun) rmSync(pluginPath, { force: true });\n return [\n {\n platform: this.id,\n action: \"remove\",\n path: pluginPath,\n detail: \"mimo-code plugin module\",\n },\n ];\n }\n\n // ── Content surfaces: commands / skills / subagents ──────────────────────\n // CONTENT-ONLY: pure native-file writers under <mcDir>/{commands,skills,\n // agent}. No runtime dispatch, no home-bin pointer, no telemetry wrap. Each\n // method is idempotent (byte-identical → skip) and reversible. Mirrors\n // OpenCode's layout: commands/<name>.md, skills/<name>/SKILL.md, and the\n // SINGULAR agent/<name>.md dir for subagents. For project scope the content\n // root is <projectDir>/.mimocode (NOT the project root where mimocode.json\n // lives).\n\n private contentRootDir(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? join(ctx.projectDir, `.${CONFIG_DIR_NAME}`)\n : this.getConfigDir(ctx);\n }\n private commandsDir(ctx: InstallContext): string {\n return join(this.contentRootDir(ctx), \"commands\");\n }\n private skillsDir(ctx: InstallContext): string {\n return join(this.contentRootDir(ctx), \"skills\");\n }\n private agentDir(ctx: InstallContext): string {\n return join(this.contentRootDir(ctx), \"agent\");\n }\n\n /** Native command file path: <mcDir>/commands/<name>.md. */\n private commandPath(ctx: InstallContext, name: string): string {\n return join(this.commandsDir(ctx), `${name}.md`);\n }\n /** Native skill dir: <mcDir>/skills/<name>. */\n private skillDir(ctx: InstallContext, name: string): string {\n return join(this.skillsDir(ctx), name);\n }\n /** Native subagent file path: <mcDir>/agent/<name>.md (SINGULAR dir). */\n private subagentPath(ctx: InstallContext, name: string): string {\n return join(this.agentDir(ctx), `${name}.md`);\n }\n\n // ── Commands ──────────────────────────────────────────────────────────────\n\n override installCommands(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[HOST]?.commands === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"commands disabled for mimo-code\" }];\n }\n if (connector.commands.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no commands\" }];\n }\n return connector.commands.map((cmd) =>\n this.writeContentFile(\n this.commandPath(ctx, cmd.name),\n this.renderCommand(cmd),\n ctx.dryRun,\n ),\n );\n }\n\n override uninstallCommands(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.commands.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no commands\" }];\n }\n return connector.commands.map((cmd) =>\n this.removeContentFile(this.commandPath(ctx, cmd.name), ctx.dryRun),\n );\n }\n\n /** Render a command to md+frontmatter (description, model, subtask). */\n private renderCommand(cmd: CommandDef): string {\n const frontmatter: Record<string, unknown> = {};\n if (cmd.description !== undefined) frontmatter.description = cmd.description;\n if (cmd.model !== undefined) frontmatter.model = cmd.model;\n if (cmd.subtask !== undefined) frontmatter.subtask = cmd.subtask;\n if (cmd.extra) Object.assign(frontmatter, cmd.extra);\n return this.renderFrontmatterMd(frontmatter, cmd.prompt);\n }\n\n // ── Skills ────────────────────────────────────────────────────────────────\n\n override installSkills(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[HOST]?.skills === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"skills disabled for mimo-code\" }];\n }\n if (connector.skills.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no skills\" }];\n }\n const changes: ChangeRecord[] = [];\n for (const skill of connector.skills) {\n const dir = this.skillDir(ctx, skill.name);\n changes.push(\n this.writeContentFile(join(dir, \"SKILL.md\"), renderSkillMd(skill), ctx.dryRun),\n );\n for (const [rel, contents] of Object.entries(skill.resources ?? {})) {\n const target = this.resolveWithin(dir, rel);\n if (target === null) {\n changes.push({\n platform: this.id,\n action: \"warn\",\n detail: `skill resource \"${rel}\" escapes the skill dir; skipped`,\n });\n continue;\n }\n changes.push(this.writeContentFile(target, contents, ctx.dryRun));\n }\n }\n return changes;\n }\n\n override uninstallSkills(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.skills.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no skills\" }];\n }\n const changes: ChangeRecord[] = [];\n for (const skill of connector.skills) {\n const dir = this.skillDir(ctx, skill.name);\n changes.push(this.removeContentFile(join(dir, \"SKILL.md\"), ctx.dryRun));\n for (const rel of Object.keys(skill.resources ?? {})) {\n const target = this.resolveWithin(dir, rel);\n if (target === null) continue;\n changes.push(this.removeContentFile(target, ctx.dryRun));\n }\n changes.push(this.removeDirIfEmpty(dir, ctx.dryRun));\n }\n return changes;\n }\n\n // ── Subagents ───────────────────────────────────────────────────────────────\n\n override installSubagents(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[HOST]?.subagents === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"subagents disabled for mimo-code\" }];\n }\n if (connector.subagents.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no subagents\" }];\n }\n return connector.subagents.map((agent) =>\n this.writeContentFile(\n this.subagentPath(ctx, agent.name),\n renderOpenCodeSubagentMd(agent),\n ctx.dryRun,\n ),\n );\n }\n\n override uninstallSubagents(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.subagents.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no subagents\" }];\n }\n return connector.subagents.map((agent) =>\n this.removeContentFile(this.subagentPath(ctx, agent.name), ctx.dryRun),\n );\n }\n\n // ── ts-plugin synthesis ────────────────────────────────────────────────\n\n /**\n * Build ONE self-contained ESM bridge module for MiMoCode. The module imports\n * nothing from agent-connector; it embeds the home-bin path + connector id and\n * a `bridge()` helper that shells out to the universal hook entrypoint\n * (`<homeBin> hook mimo-code <event> --connector <id>`), feeding the payload on\n * stdin and JSON.parsing the normalized HookResponse from stdout (fail-open).\n */\n synthesizePlugin(ctx: InstallContext): GeneratedPluginFile[] {\n const path = this.getHookConfigPath(ctx);\n const contents = this.buildPluginSource(ctx);\n return [{ path, contents, executable: false }];\n }\n\n /** Compose the generated plugin source with plain string concatenation. */\n private buildPluginSource(ctx: InstallContext): string {\n const events = ctx.connector.hookEvents.filter(\n (e): e is HookEventName => EVENT_TO_MIMOCODE[e] !== undefined,\n );\n const has = (e: HookEventName) => events.includes(e);\n\n const header = `/**\n * AUTO-GENERATED by agent-connector — DO NOT EDIT.\n *\n * Self-contained MiMoCode plugin bridge for connector ${ctx.connector.id}.\n * It imports nothing from agent-connector: every hook invocation shells out to\n * the stable home binary's universal entrypoint and JSON-parses the normalized\n * response. Fail-open: any bridge error degrades to \"allow\".\n */\nimport { execFileSync, execSync } from \"node:child_process\";\n\n${renderBridgePrelude({\n homeBin: ctx.homeBinPath,\n connectorId: ctx.connector.id,\n hookSlug: \"mimo-code\",\n payloadNoun: \"MiMoCode\",\n eventDoc: \" (PreToolUse|PostToolUse|SessionStart)\",\n failOpenComment: \"Fail-open — never wedge a tool call on a bridge error.\",\n})}\n`;\n\n const handlers: string[] = [];\n\n if (has(\"PreToolUse\")) {\n handlers.push(` // PreToolUse → block (throw) / rewrite args (mutate output.args).\n \"tool.execute.before\": async (input, output) => {\n const payload = {\n toolName: input.tool ?? \"\",\n toolInput: (output && output.args) ?? {},\n sessionId: input.sessionID ?? \"\",\n projectDir: PROJECT_DIR,\n };\n const res = bridge(\"PreToolUse\", payload);\n if (!res) return;\n // MiMoCode has no \"ask\" gate — degrade \"ask\" to a block (safe direction).\n if (res.decision === \"deny\" || res.decision === \"ask\") {\n throw new Error(res.reason || \"Blocked by ${ctx.connector.id}\");\n }\n if (res.updatedInput && output && output.args) {\n Object.assign(output.args, res.updatedInput);\n }\n },`);\n }\n\n if (has(\"PostToolUse\")) {\n handlers.push(` // PostToolUse → observe / rewrite tool output (mutate output.output).\n \"tool.execute.after\": async (input, output) => {\n const payload = {\n toolName: input.tool ?? \"\",\n toolInput: input.args ?? {},\n toolOutput: output ? output.output : undefined,\n sessionId: input.sessionID ?? \"\",\n projectDir: PROJECT_DIR,\n };\n const res = bridge(\"PostToolUse\", payload);\n if (!res) return;\n if (typeof res.updatedOutput === \"string\" && output) {\n output.output = res.updatedOutput;\n }\n },`);\n }\n\n if (has(\"SessionStart\")) {\n handlers.push(` // SessionStart surrogate → inject context into the system prompt.\n // MiMoCode has no real SessionStart hook (inherited from OpenCode\n // #14808 / #5409); experimental.chat.system.transform is the injection point.\n \"experimental.chat.system.transform\": async (input, output) => {\n const payload = {\n sessionId: (input && input.sessionID) ?? \"\",\n projectDir: PROJECT_DIR,\n };\n const res = bridge(\"SessionStart\", payload);\n if (!res) return;\n if (res.additionalContext && output && Array.isArray(output.system)) {\n // Insert at index 1 (after the header) to preserve the prompt-cache\n // fold (header must remain system[0]).\n output.system.splice(1, 0, res.additionalContext);\n }\n },`);\n }\n\n if (has(\"UserPromptSubmit\")) {\n handlers.push(` // UserPromptSubmit → context injection on prompt submission.\n // chat.message fires on the USER's prompt; output.message is a UserMessage\n // and output.parts holds the prompt parts. Inject context by PUSHING a text\n // part onto output.parts. chat.message has NO documented block/abort\n // mechanism, so a \"deny\" decision degrades to a NO-OP (best-effort) — same\n // way the tool/system handlers degrade decisions this host cannot honor.\n \"chat.message\": async (input, output) => {\n const promptText =\n output && Array.isArray(output.parts)\n ? output.parts\n .filter((p) => p && p.type === \"text\" && typeof p.text === \"string\")\n .map((p) => p.text)\n .join(\"\\\\n\")\n : \"\";\n const res = bridge(\"UserPromptSubmit\", {\n prompt: promptText,\n sessionId: (input && input.sessionID) || \"\",\n projectDir: PROJECT_DIR,\n });\n if (!res) return;\n if (res.additionalContext && output && Array.isArray(output.parts)) {\n output.parts.push({ type: \"text\", text: res.additionalContext });\n }\n },`);\n }\n\n if (has(\"Stop\")) {\n handlers.push(` // Stop → session.idle (\"session finished responding\"). session.idle is NOT a\n // direct hook key — it is dispatched through the generic \\`event\\` hook\n // switching on event.type (the OpenCode plugin shape, per opencode.ai/docs/\n // plugins). A block decision throws to halt (MiMoCode has no Stop-gate return\n // value). If session.idle never fires on a given build, Stop is a silent\n // no-op (an acceptable degrade — it never mis-fires).\n event: async ({ event }) => {\n if (!event || event.type !== \"session.idle\") return;\n const res = bridge(\"Stop\", {\n sessionId: (event.properties && event.properties.sessionID) || \"\",\n projectDir: PROJECT_DIR,\n });\n if (res && res.decision === \"deny\") {\n throw new Error(res.reason || \"Stop blocked by ${ctx.connector.id}\");\n }\n },`);\n }\n\n const factory = `\nexport default async function (ctx) {\n // ctx.directory is the MiMoCode project root; fall back to cwd.\n const PROJECT_DIR =\n (ctx && (ctx.directory || (ctx.worktree && ctx.worktree.path))) ||\n process.cwd();\n\n return {\n${handlers.join(\"\\n\")}\n };\n}\n`;\n\n return header + factory;\n }\n\n // ── Runtime: parse OUR bridge payload → normalized event ───────────────\n\n /**\n * `raw` is the payload OUR generated plugin posts (NOT a host-native shape):\n * { toolName, toolInput, toolOutput?, isError?, sessionId, projectDir }\n * so this maps straight through.\n */\n parseEvent(event: HookEventName, raw: unknown): NormalizedEvent {\n const input = (raw ?? {}) as MiMoCodeBridgePayload;\n const base = {\n hostPlatform: HOST,\n connectorId: \"\",\n sessionId: typeof input.sessionId === \"string\" ? input.sessionId : \"\",\n raw,\n ...(typeof input.projectDir === \"string\"\n ? { projectDir: input.projectDir }\n : {}),\n } as const;\n\n switch (event) {\n case \"PreToolUse\": {\n const ev: PreToolUseEvent = {\n ...base,\n toolName: input.toolName ?? \"\",\n toolInput: input.toolInput ?? {},\n };\n return ev;\n }\n case \"PostToolUse\": {\n const ev: PostToolUseEvent = {\n ...base,\n toolName: input.toolName ?? \"\",\n toolInput: input.toolInput ?? {},\n ...(typeof input.toolOutput === \"string\"\n ? { toolOutput: input.toolOutput }\n : {}),\n ...(typeof input.isError === \"boolean\"\n ? { isError: input.isError }\n : {}),\n };\n return ev;\n }\n case \"SessionStart\": {\n const ev: SessionStartEvent = { ...base, source: \"startup\" };\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 = { ...base };\n return ev;\n }\n default:\n // Other canonical events are not surfaced by MiMoCode; treat as a\n // session-start-shaped no-op so the dispatcher fails open gracefully.\n return { ...base, source: \"startup\" } satisfies SessionStartEvent;\n }\n }\n\n // ── Runtime: normalized response → reply the generated bridge parses ───\n\n /**\n * Our generated bridge consumes this stdout directly, so the reply body is the\n * NORMALIZED HookResponse itself — the bridge JSON.parses it and reads\n * decision / updatedInput / updatedOutput / additionalContext.\n */\n formatReply(_event: HookEventName, response: HookResponse): HookReply {\n return {\n exitCode: 0,\n stdout: JSON.stringify(response ?? { decision: \"allow\" }),\n };\n }\n\n // ── Diagnostics ────────────────────────────────────────────────────────\n\n override getHealthChecks(ctx: InstallContext): readonly HealthCheck[] {\n const serverPath = this.getServerConfigPath(ctx);\n const pluginPath = this.getHookConfigPath(ctx);\n const connectorId = ctx.connector.id;\n const hasHooks = ctx.connector.hookEvents.length > 0;\n\n const checks: HealthCheck[] = [\n {\n name: `${this.name}: mimocode.json present`,\n check: () =>\n existsSync(serverPath)\n ? { status: \"OK\", detail: serverPath }\n : { status: \"FAIL\", detail: `not found: ${serverPath}` },\n },\n {\n name: `${this.name}: mcp.${connectorId} 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> }>(\n serverPath,\n );\n const bucket = cfg?.[MCP_ROOT_KEY];\n if (!cfg || !bucket) {\n return { status: \"FAIL\", detail: `no ${MCP_ROOT_KEY} in ${serverPath}` };\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 ${serverPath}`,\n };\n },\n },\n {\n name: `${this.name}: plugin module present`,\n check: () => {\n if (!hasHooks) return { status: \"OK\", detail: \"no hooks declared\" };\n return existsSync(pluginPath)\n ? { status: \"OK\", detail: pluginPath }\n : { status: \"FAIL\", detail: `not found: ${pluginPath}` };\n },\n },\n ];\n\n for (const cmd of ctx.connector.commands) {\n const p = this.commandPath(ctx, cmd.name);\n checks.push({\n name: `${this.name}: command ${cmd.name} present`,\n check: () =>\n existsSync(p) ? { status: \"OK\", detail: p } : { status: \"FAIL\", detail: `not found: ${p}` },\n });\n }\n for (const skill of ctx.connector.skills) {\n const p = join(this.skillDir(ctx, skill.name), \"SKILL.md\");\n checks.push({\n name: `${this.name}: skill ${skill.name} present`,\n check: () =>\n existsSync(p) ? { status: \"OK\", detail: p } : { status: \"FAIL\", detail: `not found: ${p}` },\n });\n }\n for (const agent of ctx.connector.subagents) {\n const p = this.subagentPath(ctx, agent.name);\n checks.push({\n name: `${this.name}: subagent ${agent.name} present`,\n check: () =>\n existsSync(p) ? { status: \"OK\", detail: p } : { status: \"FAIL\", detail: `not found: ${p}` },\n });\n }\n return checks;\n }\n\n /** Read a file, returning undefined on any error (idempotency compare). */\n private safeRead(path: string): string | undefined {\n try {\n return readFileSync(path, \"utf8\");\n } catch {\n return undefined;\n }\n }\n}\n\n/** Create a directory (recursive) if it does not already exist. */\nfunction ensureDir(dir: string): void {\n if (!existsSync(dir)) mkdirSync(dir, { recursive: true });\n}\n\nexport const adapter = new MiMoCodeAdapter();\nexport default adapter;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoDA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAAe;AACxB,SAAS,SAAS,YAAY;AAoC9B,IAAM,OAAmB;AACzB,IAAM,eAAe;AAGrB,IAAM,kBAAkB;AAExB,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AU,KAAmB;AACpC,MAAI,CAAC,WAAW,GAAG,EAAG,WAAU,KAAK,EAAE,WAAW,KAAK,CAAC;AAC1D;AAEO,IAAM,UAAU,IAAI,gBAAgB;AAC3C,IAAO,oBAAQ;","names":["entry"]}
@@ -4,16 +4,14 @@ import {
4
4
  resolveEnvRefsDeep
5
5
  } from "./chunk-DBQMX75U.js";
6
6
  import {
7
- BaseAdapter
8
- } from "./chunk-KG6T3YNJ.js";
9
- import {
7
+ BaseAdapter,
10
8
  renderSkillMd
11
- } from "./chunk-IEGR4TP3.js";
9
+ } from "./chunk-A767JFHW.js";
12
10
  import {
13
11
  buildWrappedStdio
14
12
  } from "./chunk-TO57WYBB.js";
15
- import "./chunk-N6HH7K6P.js";
16
- import "./chunk-TRQKHP7D.js";
13
+ import "./chunk-ZY25RG4Y.js";
14
+ import "./chunk-QY42WGBX.js";
17
15
 
18
16
  // src/adapters/mux/index.ts
19
17
  import { existsSync, statSync } from "fs";
@@ -321,4 +319,4 @@ export {
321
319
  adapter,
322
320
  mux_default as default
323
321
  };
324
- //# sourceMappingURL=mux-5HTNKK4K.js.map
322
+ //# sourceMappingURL=mux-GT7FWVLH.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/adapters/mux/index.ts"],"sourcesContent":["/**\n * adapters/mux — Mux (Coder) platform adapter for agent-connector.\n *\n * Mux is an **mcp-only** host: it exposes no lifecycle hook system, and MCP is\n * its extensibility mechanism. This adapter therefore installs only the MCP\n * server and reports hooks as unavailable — the same shape as the Warp\n * reference adapter.\n *\n * MCP config:\n * - user scope → ~/.mux/mcp.jsonc\n * - project scope → <projectDir>/.mux/mcp.jsonc\n * Both are JSONC (comments allowed) but we write strict JSON. The root key is\n * \"servers\", and this file doubles as the (non-existent) hook config — there\n * is no separate hook file here.\n *\n * QUIRK: Mux models each server entry as a single shell-command STRING, not an\n * object. So `servers[id]` is `\"<exe> <arg1> <arg2> ...\"` — space-joined, with\n * any token containing whitespace double-quoted. We therefore build that string\n * ourselves and upsert it idempotently (the generic object upsert helper would\n * write the wrong shape). When telemetry-wrapping, the string is the home-bin\n * `serve` wrapper command followed by its args.\n *\n * Mux documents no native `${env:VAR}` interpolation token, so env-refs in the\n * command/args are resolved to literals at install time. The string form has no\n * place for an env map, so server.env is dropped with no native equivalent.\n */\n\nimport { existsSync, statSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\n\nimport { BaseAdapter } from \"../base.js\";\nimport type { Adapter, InstallContext } from \"../spi.js\";\nimport type {\n ChangeRecord,\n DetectedPlatform,\n HealthCheck,\n HookParadigm,\n PlatformCapabilities,\n PlatformId,\n ServerDef,\n} from \"../../core/types.js\";\nimport { resolveEnvRefs, resolveEnvRefsDeep } from \"../../core/interpolate.js\";\nimport {\n buildWrappedStdio,\n} from \"../../core/spawn.js\";\nimport { renderSkillMd } from \"../claude-code/render.js\";\n\nconst HOST: PlatformId = \"mux\";\nconst MCP_ROOT_KEY = \"servers\";\n\n/**\n * Mux enforces this exact pattern (1–64 chars) on a SKILL directory name, and\n * the SKILL.md `name` field MUST equal the directory name\n * (mux.coder.com/agents/agent-skills). A skill name that does not match is\n * skip-warned rather than written to a dir Mux would reject.\n */\nconst MUX_SKILL_NAME_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;\nconst MUX_SKILL_NAME_MAX = 64;\n\n/** Quote a token only when it contains whitespace (Mux command-string form). */\nfunction quoteToken(token: string): string {\n return /\\s/.test(token) ? `\"${token}\"` : token;\n}\n\n/** Join an executable + args into Mux's single shell-command string. */\nfunction buildCommandString(command: string, args: readonly string[]): string {\n return [command, ...args].map(quoteToken).join(\" \");\n}\n\nexport class MuxAdapter extends BaseAdapter implements Adapter {\n readonly id: PlatformId = HOST;\n readonly name = \"Mux\";\n readonly paradigm: HookParadigm = \"mcp-only\";\n\n readonly capabilities: PlatformCapabilities = {\n // Memory surface: AGENTS.md-first managed block via the BaseAdapter default\n // (memoryTargets: project <projectDir>/AGENTS.md; user scope where documented).\n supportsMemory: true,\n // Mux has no lifecycle hook system — every hook capability is false.\n preToolUse: false,\n postToolUse: false,\n preCompact: false,\n sessionStart: false,\n sessionEnd: false,\n userPromptSubmit: false,\n stop: false,\n notification: false,\n canModifyArgs: false,\n canModifyOutput: false,\n canInjectSessionContext: false,\n // Mux's command-string server entry is stdio-only.\n transports: [\"stdio\"],\n // Content surface: Mux auto-discovers dir-per-skill SKILL.md from its\n // workspace-local and global roots (mux.coder.com/agents/agent-skills,\n // fetched 2026-06-16):\n // project → <projectDir>/.mux/skills/<name>/SKILL.md (workspace-local)\n // user → ~/.mux/skills/<name>/SKILL.md (global, Mux-specific)\n // The skill directory name MUST match ^[a-z0-9]+(?:-[a-z0-9]+)*$ (1–64\n // chars) and the SKILL.md `name` field must equal it — a name that cannot\n // be represented is skip-warned (see installSkills).\n supportsSkills: true,\n };\n\n // ── Detection ────────────────────────────────────────────────────────────\n\n detectInstalled(projectDir: string): DetectedPlatform {\n const userDir = join(homedir(), \".mux\");\n const userMcp = join(userDir, \"mcp.jsonc\");\n const projDir = join(projectDir, \".mux\");\n const projMcp = join(projDir, \"mcp.jsonc\");\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 Mux config (${scope})`\n : `no Mux config at ${userDir} or ${projDir}`,\n confidence: installed ? \"high\" : \"low\",\n };\n }\n\n // ── Native paths ─────────────────────────────────────────────────────────\n\n getConfigDir(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? join(ctx.projectDir, \".mux\")\n : join(homedir(), \".mux\");\n }\n\n getServerConfigPath(ctx: InstallContext): string {\n return join(this.getConfigDir(ctx), \"mcp.jsonc\");\n }\n\n /**\n * Mux has no hook file — hooks are not a thing here. The hook \"config path\"\n * is the same mcp.jsonc so the generic doctor/backup behave sensibly.\n */\n getHookConfigPath(ctx: InstallContext): string {\n return this.getServerConfigPath(ctx);\n }\n\n // ── MCP server install / uninstall ───────────────────────────────────────\n\n installServer(ctx: InstallContext): ChangeRecord[] {\n const { connector, dryRun } = 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 mux\"\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 path = this.getServerConfigPath(ctx);\n\n if (server.transport !== \"stdio\" || !server.command) {\n // Mux's command-string entry is stdio-only; remote transports skip.\n return [\n {\n platform: this.id,\n action: \"skip\",\n path,\n detail: `transport \"${server.transport}\" not registrable (mux expects a stdio command string)`,\n },\n ];\n }\n\n const entry = this.renderCommandString(ctx, server);\n // Mux's server VALUE is a command string, but the object-map upsert is\n // value-agnostic — route through the shared helper (byte-identical output).\n return [this.upsertServerInJson(path, MCP_ROOT_KEY, connector.id, entry, dryRun)];\n }\n\n uninstallServer(ctx: InstallContext): ChangeRecord[] {\n const path = this.getServerConfigPath(ctx);\n return [\n this.removeServerFromJson(path, MCP_ROOT_KEY, ctx.connector.id, ctx.dryRun),\n ];\n }\n\n /**\n * Render a stdio ServerDef into Mux's single shell-command string. Honors the\n * telemetry serve-wrapper and resolves every `${env:VAR}` to a literal (Mux\n * documents no native interpolation token).\n */\n private renderCommandString(ctx: InstallContext, server: ServerDef): string {\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 // Resolve env-refs to literals (Mux has no native interpolation token).\n command = resolveEnvRefs(command);\n args = resolveEnvRefsDeep(args);\n\n return buildCommandString(command, args);\n }\n\n // ── Hooks (unavailable — Mux is mcp-only) ─────────────────────────────────\n\n installHooks(_ctx: InstallContext): ChangeRecord[] {\n return [\n {\n platform: this.id,\n action: \"skip\",\n detail: \"hooks unavailable (Mux is mcp-only)\",\n },\n ];\n }\n\n uninstallHooks(_ctx: InstallContext): ChangeRecord[] {\n return [\n {\n platform: this.id,\n action: \"skip\",\n detail: \"hooks unavailable (Mux is mcp-only)\",\n },\n ];\n }\n\n // ── Content surface: skills (dir-per-skill SKILL.md) ─────────────────────\n // CONTENT-ONLY: pure native-file writers, mirroring goose/openclaw. No\n // runtime dispatch, no home-bin pointer, no telemetry wrap. Idempotent\n // (byte-identical → skip) via writeContentFile and reversible via\n // removeContentFile + removeDirIfEmpty. Honors platforms[\"mux\"].skills ===\n // false. No mcp.jsonc entry — Mux auto-discovers the skills dirs.\n //\n // Native locations (mux.coder.com/agents/agent-skills):\n // project → <projectDir>/.mux/skills/<name>/SKILL.md (workspace-local)\n // user → ~/.mux/skills/<name>/SKILL.md (global, Mux-specific)\n // The dir name MUST match MUX_SKILL_NAME_RE (1–64 chars) and the SKILL.md\n // `name` field must equal it — a name that can't be represented is skip-warned.\n\n /** The skills ROOT dir for ctx.scope (parent of every per-skill dir). */\n private skillsDir(ctx: InstallContext): string {\n return join(this.getConfigDir(ctx), \"skills\");\n }\n\n /** Per-skill directory: <skillsDir>/<name>. */\n private skillDir(ctx: InstallContext, name: string): string {\n return join(this.skillsDir(ctx), name);\n }\n\n override installSkills(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[HOST]?.skills === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"skills disabled for mux\" }];\n }\n if (connector.skills.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no skills\" }];\n }\n const changes: ChangeRecord[] = [];\n for (const skill of connector.skills) {\n // Mux REQUIRES the dir name (and SKILL.md `name`) to match its pattern;\n // a name we cannot represent is skip-warned rather than written to a dir\n // Mux would reject (the honesty bar — never write an unreadable path).\n if (!this.isValidSkillName(skill.name)) {\n changes.push({\n platform: this.id,\n action: \"warn\",\n detail:\n `skill \"${skill.name}\" cannot be represented on mux ` +\n `(name must match ${MUX_SKILL_NAME_RE.source}, 1–${MUX_SKILL_NAME_MAX} chars); skipped`,\n });\n continue;\n }\n const dir = this.skillDir(ctx, skill.name);\n // Guard a skills path occupied by a regular FILE (mkdir would throw\n // ENOTDIR): skip-warn rather than crash (cline `.clinerules`-is-a-file\n // precedent).\n const blockingFile = this.firstFileOnSkillPath(ctx, dir);\n if (blockingFile !== null) {\n changes.push({\n platform: this.id,\n action: \"warn\",\n path: blockingFile,\n detail: `${blockingFile} is a file, not a directory; skill \"${skill.name}\" skipped`,\n });\n continue;\n }\n changes.push(\n this.writeContentFile(join(dir, \"SKILL.md\"), renderSkillMd(skill), ctx.dryRun),\n );\n // Bundle any resource files beside SKILL.md (relative path → contents).\n // Defense-in-depth: skip+warn on any key that escapes the skill dir.\n for (const [rel, contents] of Object.entries(skill.resources ?? {})) {\n const target = this.resolveWithin(dir, rel);\n if (target === null) {\n changes.push({\n platform: this.id,\n action: \"warn\",\n detail: `skill resource \"${rel}\" escapes the skill dir; skipped`,\n });\n continue;\n }\n changes.push(this.writeContentFile(target, contents, ctx.dryRun));\n }\n }\n return changes;\n }\n\n override uninstallSkills(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.skills.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no skills\" }];\n }\n const changes: ChangeRecord[] = [];\n for (const skill of connector.skills) {\n // Skip names install never wrote (invalid → never on disk under our dir).\n if (!this.isValidSkillName(skill.name)) continue;\n const dir = this.skillDir(ctx, skill.name);\n // Remove only the files we wrote (SKILL.md + declared resources), then the\n // skill dir itself when we own its full contents.\n changes.push(this.removeContentFile(join(dir, \"SKILL.md\"), ctx.dryRun));\n for (const rel of Object.keys(skill.resources ?? {})) {\n const target = this.resolveWithin(dir, rel);\n if (target === null) continue; // never delete outside the skill dir\n changes.push(this.removeContentFile(target, ctx.dryRun));\n }\n // Only remove the skill dir when WE own its full contents — never rm -rf a\n // dir that still holds user-added / sibling-tool / shared files.\n changes.push(this.removeDirIfEmpty(dir, ctx.dryRun));\n }\n if (changes.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"no installable skills to remove\" }];\n }\n return changes;\n }\n\n /** True when a skill name is representable as a Mux skill directory name. */\n private isValidSkillName(name: string): boolean {\n return name.length >= 1 && name.length <= MUX_SKILL_NAME_MAX && MUX_SKILL_NAME_RE.test(name);\n }\n\n /**\n * Walk from the skills root down to `leaf` and return the FIRST segment that\n * exists as a regular file (a mkdir there throws ENOTDIR), else null — so\n * installSkills can skip-warn instead of crashing.\n */\n private firstFileOnSkillPath(ctx: InstallContext, leaf: string): string | null {\n const root = this.skillsDir(ctx);\n const segments: string[] = [];\n let cur = leaf;\n while (cur.length >= root.length) {\n segments.unshift(cur);\n if (cur === root) break;\n const parent = dirname(cur);\n if (parent === cur) break;\n cur = parent;\n }\n for (const p of segments) {\n if (!existsSync(p)) return null;\n try {\n if (statSync(p).isFile()) return p;\n } catch {\n return null;\n }\n }\n return null;\n }\n\n // ── Diagnostics ──────────────────────────────────────────────────────────\n\n override getHealthChecks(ctx: InstallContext): readonly HealthCheck[] {\n const mcpPath = this.getServerConfigPath(ctx);\n const connectorId = ctx.connector.id;\n return [\n {\n name: `${this.name}: mcp.jsonc 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 // Only assert what the connector declares: a server-less connector\n // never writes an mcpServers entry, so its absence is healthy.\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> }>(\n mcpPath,\n );\n const bucket = cfg?.[MCP_ROOT_KEY];\n if (!cfg || !bucket) {\n return { status: \"FAIL\", detail: `no ${MCP_ROOT_KEY} in ${mcpPath}` };\n }\n return connectorId in bucket\n ? { status: \"OK\", detail: `${MCP_ROOT_KEY}.${connectorId} present` }\n : {\n status: \"FAIL\",\n detail: `no ${MCP_ROOT_KEY}.${connectorId} in ${mcpPath}`,\n };\n },\n },\n ];\n }\n}\n\nexport const adapter = new MuxAdapter();\nexport default adapter;\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2BA,SAAS,YAAY,gBAAgB;AACrC,SAAS,eAAe;AACxB,SAAS,SAAS,YAAY;AAmB9B,IAAM,OAAmB;AACzB,IAAM,eAAe;AAQrB,IAAM,oBAAoB;AAC1B,IAAM,qBAAqB;AAG3B,SAAS,WAAW,OAAuB;AACzC,SAAO,KAAK,KAAK,KAAK,IAAI,IAAI,KAAK,MAAM;AAC3C;AAGA,SAAS,mBAAmB,SAAiB,MAAiC;AAC5E,SAAO,CAAC,SAAS,GAAG,IAAI,EAAE,IAAI,UAAU,EAAE,KAAK,GAAG;AACpD;AAEO,IAAM,aAAN,cAAyB,YAA+B;AAAA,EACpD,KAAiB;AAAA,EACjB,OAAO;AAAA,EACP,WAAyB;AAAA,EAEzB,eAAqC;AAAA;AAAA;AAAA,IAG5C,gBAAgB;AAAA;AAAA,IAEhB,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,YAAY;AAAA,IACZ,kBAAkB;AAAA,IAClB,MAAM;AAAA,IACN,cAAc;AAAA,IACd,eAAe;AAAA,IACf,iBAAiB;AAAA,IACjB,yBAAyB;AAAA;AAAA,IAEzB,YAAY,CAAC,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IASpB,gBAAgB;AAAA,EAClB;AAAA;AAAA,EAIA,gBAAgB,YAAsC;AACpD,UAAM,UAAU,KAAK,QAAQ,GAAG,MAAM;AACtC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AAM,YAAY,OAAO,OAAO,GAAG;AAAA,UACtE;AACA,iBAAO,eAAe,SAClB,EAAE,QAAQ,MAAM,QAAQ,GAAG,YAAY,IAAI,WAAW,WAAW,IACjE;AAAA,YACE,QAAQ;AAAA,YACR,QAAQ,MAAM,YAAY,IAAI,WAAW,OAAO,OAAO;AAAA,UACzD;AAAA,QACN;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,UAAU,IAAI,WAAW;AACtC,IAAO,cAAQ;","names":[]}
1
+ {"version":3,"sources":["../src/adapters/mux/index.ts"],"sourcesContent":["/**\n * adapters/mux — Mux (Coder) platform adapter for agent-connector.\n *\n * Mux is an **mcp-only** host: it exposes no lifecycle hook system, and MCP is\n * its extensibility mechanism. This adapter therefore installs only the MCP\n * server and reports hooks as unavailable — the same shape as the Warp\n * reference adapter.\n *\n * MCP config:\n * - user scope → ~/.mux/mcp.jsonc\n * - project scope → <projectDir>/.mux/mcp.jsonc\n * Both are JSONC (comments allowed) but we write strict JSON. The root key is\n * \"servers\", and this file doubles as the (non-existent) hook config — there\n * is no separate hook file here.\n *\n * QUIRK: Mux models each server entry as a single shell-command STRING, not an\n * object. So `servers[id]` is `\"<exe> <arg1> <arg2> ...\"` — space-joined, with\n * any token containing whitespace double-quoted. We therefore build that string\n * ourselves and upsert it idempotently (the generic object upsert helper would\n * write the wrong shape). When telemetry-wrapping, the string is the home-bin\n * `serve` wrapper command followed by its args.\n *\n * Mux documents no native `${env:VAR}` interpolation token, so env-refs in the\n * command/args are resolved to literals at install time. The string form has no\n * place for an env map, so server.env is dropped with no native equivalent.\n */\n\nimport { existsSync, statSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\n\nimport { BaseAdapter } from \"../base.js\";\nimport type { Adapter, InstallContext } from \"../spi.js\";\nimport type {\n ChangeRecord,\n DetectedPlatform,\n HealthCheck,\n HookParadigm,\n PlatformCapabilities,\n PlatformId,\n ServerDef,\n} from \"../../core/types.js\";\nimport { resolveEnvRefs, resolveEnvRefsDeep } from \"../../core/interpolate.js\";\nimport {\n buildWrappedStdio,\n} from \"../../core/spawn.js\";\nimport { renderSkillMd } from \"../claude-code/render.js\";\n\nconst HOST: PlatformId = \"mux\";\nconst MCP_ROOT_KEY = \"servers\";\n\n/**\n * Mux enforces this exact pattern (1–64 chars) on a SKILL directory name, and\n * the SKILL.md `name` field MUST equal the directory name\n * (mux.coder.com/agents/agent-skills). A skill name that does not match is\n * skip-warned rather than written to a dir Mux would reject.\n */\nconst MUX_SKILL_NAME_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;\nconst MUX_SKILL_NAME_MAX = 64;\n\n/** Quote a token only when it contains whitespace (Mux command-string form). */\nfunction quoteToken(token: string): string {\n return /\\s/.test(token) ? `\"${token}\"` : token;\n}\n\n/** Join an executable + args into Mux's single shell-command string. */\nfunction buildCommandString(command: string, args: readonly string[]): string {\n return [command, ...args].map(quoteToken).join(\" \");\n}\n\nexport class MuxAdapter extends BaseAdapter implements Adapter {\n readonly id: PlatformId = HOST;\n readonly name = \"Mux\";\n readonly paradigm: HookParadigm = \"mcp-only\";\n\n readonly capabilities: PlatformCapabilities = {\n // Memory surface: AGENTS.md-first managed block via the BaseAdapter default\n // (memoryTargets: project <projectDir>/AGENTS.md; user scope where documented).\n supportsMemory: true,\n // Mux has no lifecycle hook system — every hook capability is false.\n preToolUse: false,\n postToolUse: false,\n preCompact: false,\n sessionStart: false,\n sessionEnd: false,\n userPromptSubmit: false,\n stop: false,\n notification: false,\n canModifyArgs: false,\n canModifyOutput: false,\n canInjectSessionContext: false,\n // Mux's command-string server entry is stdio-only.\n transports: [\"stdio\"],\n // Content surface: Mux auto-discovers dir-per-skill SKILL.md from its\n // workspace-local and global roots (mux.coder.com/agents/agent-skills,\n // fetched 2026-06-16):\n // project → <projectDir>/.mux/skills/<name>/SKILL.md (workspace-local)\n // user → ~/.mux/skills/<name>/SKILL.md (global, Mux-specific)\n // The skill directory name MUST match ^[a-z0-9]+(?:-[a-z0-9]+)*$ (1–64\n // chars) and the SKILL.md `name` field must equal it — a name that cannot\n // be represented is skip-warned (see installSkills).\n supportsSkills: true,\n };\n\n // ── Detection ────────────────────────────────────────────────────────────\n\n detectInstalled(projectDir: string): DetectedPlatform {\n const userDir = join(homedir(), \".mux\");\n const userMcp = join(userDir, \"mcp.jsonc\");\n const projDir = join(projectDir, \".mux\");\n const projMcp = join(projDir, \"mcp.jsonc\");\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 Mux config (${scope})`\n : `no Mux config at ${userDir} or ${projDir}`,\n confidence: installed ? \"high\" : \"low\",\n };\n }\n\n // ── Native paths ─────────────────────────────────────────────────────────\n\n getConfigDir(ctx: InstallContext): string {\n return ctx.scope === \"project\"\n ? join(ctx.projectDir, \".mux\")\n : join(homedir(), \".mux\");\n }\n\n getServerConfigPath(ctx: InstallContext): string {\n return join(this.getConfigDir(ctx), \"mcp.jsonc\");\n }\n\n /**\n * Mux has no hook file — hooks are not a thing here. The hook \"config path\"\n * is the same mcp.jsonc so the generic doctor/backup behave sensibly.\n */\n getHookConfigPath(ctx: InstallContext): string {\n return this.getServerConfigPath(ctx);\n }\n\n // ── MCP server install / uninstall ───────────────────────────────────────\n\n installServer(ctx: InstallContext): ChangeRecord[] {\n const { connector, dryRun } = 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 mux\"\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 path = this.getServerConfigPath(ctx);\n\n if (server.transport !== \"stdio\" || !server.command) {\n // Mux's command-string entry is stdio-only; remote transports skip.\n return [\n {\n platform: this.id,\n action: \"skip\",\n path,\n detail: `transport \"${server.transport}\" not registrable (mux expects a stdio command string)`,\n },\n ];\n }\n\n const entry = this.renderCommandString(ctx, server);\n // Mux's server VALUE is a command string, but the object-map upsert is\n // value-agnostic — route through the shared helper (byte-identical output).\n return [this.upsertServerInJson(path, MCP_ROOT_KEY, connector.id, entry, dryRun)];\n }\n\n uninstallServer(ctx: InstallContext): ChangeRecord[] {\n const path = this.getServerConfigPath(ctx);\n return [\n this.removeServerFromJson(path, MCP_ROOT_KEY, ctx.connector.id, ctx.dryRun),\n ];\n }\n\n /**\n * Render a stdio ServerDef into Mux's single shell-command string. Honors the\n * telemetry serve-wrapper and resolves every `${env:VAR}` to a literal (Mux\n * documents no native interpolation token).\n */\n private renderCommandString(ctx: InstallContext, server: ServerDef): string {\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 // Resolve env-refs to literals (Mux has no native interpolation token).\n command = resolveEnvRefs(command);\n args = resolveEnvRefsDeep(args);\n\n return buildCommandString(command, args);\n }\n\n // ── Hooks (unavailable — Mux is mcp-only) ─────────────────────────────────\n\n installHooks(_ctx: InstallContext): ChangeRecord[] {\n return [\n {\n platform: this.id,\n action: \"skip\",\n detail: \"hooks unavailable (Mux is mcp-only)\",\n },\n ];\n }\n\n uninstallHooks(_ctx: InstallContext): ChangeRecord[] {\n return [\n {\n platform: this.id,\n action: \"skip\",\n detail: \"hooks unavailable (Mux is mcp-only)\",\n },\n ];\n }\n\n // ── Content surface: skills (dir-per-skill SKILL.md) ─────────────────────\n // CONTENT-ONLY: pure native-file writers, mirroring goose/openclaw. No\n // runtime dispatch, no home-bin pointer, no telemetry wrap. Idempotent\n // (byte-identical → skip) via writeContentFile and reversible via\n // removeContentFile + removeDirIfEmpty. Honors platforms[\"mux\"].skills ===\n // false. No mcp.jsonc entry — Mux auto-discovers the skills dirs.\n //\n // Native locations (mux.coder.com/agents/agent-skills):\n // project → <projectDir>/.mux/skills/<name>/SKILL.md (workspace-local)\n // user → ~/.mux/skills/<name>/SKILL.md (global, Mux-specific)\n // The dir name MUST match MUX_SKILL_NAME_RE (1–64 chars) and the SKILL.md\n // `name` field must equal it — a name that can't be represented is skip-warned.\n\n /** The skills ROOT dir for ctx.scope (parent of every per-skill dir). */\n private skillsDir(ctx: InstallContext): string {\n return join(this.getConfigDir(ctx), \"skills\");\n }\n\n /** Per-skill directory: <skillsDir>/<name>. */\n private skillDir(ctx: InstallContext, name: string): string {\n return join(this.skillsDir(ctx), name);\n }\n\n override installSkills(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.platforms[HOST]?.skills === false) {\n return [{ platform: this.id, action: \"skip\", detail: \"skills disabled for mux\" }];\n }\n if (connector.skills.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no skills\" }];\n }\n const changes: ChangeRecord[] = [];\n for (const skill of connector.skills) {\n // Mux REQUIRES the dir name (and SKILL.md `name`) to match its pattern;\n // a name we cannot represent is skip-warned rather than written to a dir\n // Mux would reject (the honesty bar — never write an unreadable path).\n if (!this.isValidSkillName(skill.name)) {\n changes.push({\n platform: this.id,\n action: \"warn\",\n detail:\n `skill \"${skill.name}\" cannot be represented on mux ` +\n `(name must match ${MUX_SKILL_NAME_RE.source}, 1–${MUX_SKILL_NAME_MAX} chars); skipped`,\n });\n continue;\n }\n const dir = this.skillDir(ctx, skill.name);\n // Guard a skills path occupied by a regular FILE (mkdir would throw\n // ENOTDIR): skip-warn rather than crash (cline `.clinerules`-is-a-file\n // precedent).\n const blockingFile = this.firstFileOnSkillPath(ctx, dir);\n if (blockingFile !== null) {\n changes.push({\n platform: this.id,\n action: \"warn\",\n path: blockingFile,\n detail: `${blockingFile} is a file, not a directory; skill \"${skill.name}\" skipped`,\n });\n continue;\n }\n changes.push(\n this.writeContentFile(join(dir, \"SKILL.md\"), renderSkillMd(skill), ctx.dryRun),\n );\n // Bundle any resource files beside SKILL.md (relative path → contents).\n // Defense-in-depth: skip+warn on any key that escapes the skill dir.\n for (const [rel, contents] of Object.entries(skill.resources ?? {})) {\n const target = this.resolveWithin(dir, rel);\n if (target === null) {\n changes.push({\n platform: this.id,\n action: \"warn\",\n detail: `skill resource \"${rel}\" escapes the skill dir; skipped`,\n });\n continue;\n }\n changes.push(this.writeContentFile(target, contents, ctx.dryRun));\n }\n }\n return changes;\n }\n\n override uninstallSkills(ctx: InstallContext): ChangeRecord[] {\n const { connector } = ctx;\n if (connector.skills.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"connector declares no skills\" }];\n }\n const changes: ChangeRecord[] = [];\n for (const skill of connector.skills) {\n // Skip names install never wrote (invalid → never on disk under our dir).\n if (!this.isValidSkillName(skill.name)) continue;\n const dir = this.skillDir(ctx, skill.name);\n // Remove only the files we wrote (SKILL.md + declared resources), then the\n // skill dir itself when we own its full contents.\n changes.push(this.removeContentFile(join(dir, \"SKILL.md\"), ctx.dryRun));\n for (const rel of Object.keys(skill.resources ?? {})) {\n const target = this.resolveWithin(dir, rel);\n if (target === null) continue; // never delete outside the skill dir\n changes.push(this.removeContentFile(target, ctx.dryRun));\n }\n // Only remove the skill dir when WE own its full contents — never rm -rf a\n // dir that still holds user-added / sibling-tool / shared files.\n changes.push(this.removeDirIfEmpty(dir, ctx.dryRun));\n }\n if (changes.length === 0) {\n return [{ platform: this.id, action: \"skip\", detail: \"no installable skills to remove\" }];\n }\n return changes;\n }\n\n /** True when a skill name is representable as a Mux skill directory name. */\n private isValidSkillName(name: string): boolean {\n return name.length >= 1 && name.length <= MUX_SKILL_NAME_MAX && MUX_SKILL_NAME_RE.test(name);\n }\n\n /**\n * Walk from the skills root down to `leaf` and return the FIRST segment that\n * exists as a regular file (a mkdir there throws ENOTDIR), else null — so\n * installSkills can skip-warn instead of crashing.\n */\n private firstFileOnSkillPath(ctx: InstallContext, leaf: string): string | null {\n const root = this.skillsDir(ctx);\n const segments: string[] = [];\n let cur = leaf;\n while (cur.length >= root.length) {\n segments.unshift(cur);\n if (cur === root) break;\n const parent = dirname(cur);\n if (parent === cur) break;\n cur = parent;\n }\n for (const p of segments) {\n if (!existsSync(p)) return null;\n try {\n if (statSync(p).isFile()) return p;\n } catch {\n return null;\n }\n }\n return null;\n }\n\n // ── Diagnostics ──────────────────────────────────────────────────────────\n\n override getHealthChecks(ctx: InstallContext): readonly HealthCheck[] {\n const mcpPath = this.getServerConfigPath(ctx);\n const connectorId = ctx.connector.id;\n return [\n {\n name: `${this.name}: mcp.jsonc 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 // Only assert what the connector declares: a server-less connector\n // never writes an mcpServers entry, so its absence is healthy.\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> }>(\n mcpPath,\n );\n const bucket = cfg?.[MCP_ROOT_KEY];\n if (!cfg || !bucket) {\n return { status: \"FAIL\", detail: `no ${MCP_ROOT_KEY} in ${mcpPath}` };\n }\n return connectorId in bucket\n ? { status: \"OK\", detail: `${MCP_ROOT_KEY}.${connectorId} present` }\n : {\n status: \"FAIL\",\n detail: `no ${MCP_ROOT_KEY}.${connectorId} in ${mcpPath}`,\n };\n },\n },\n ];\n }\n}\n\nexport const adapter = new MuxAdapter();\nexport default adapter;\n"],"mappings":";;;;;;;;;;;;;;;;AA2BA,SAAS,YAAY,gBAAgB;AACrC,SAAS,eAAe;AACxB,SAAS,SAAS,YAAY;AAmB9B,IAAM,OAAmB;AACzB,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SDRBVB.js";
10
10
  import {
11
11
  emptyTokens
12
12
  } from "./chunk-XD7MY6HB.js";
@@ -93,4 +93,4 @@ var mux_default = muxReader;
93
93
  export {
94
94
  mux_default as default
95
95
  };
96
- //# sourceMappingURL=mux-ZMLVAXOO.js.map
96
+ //# sourceMappingURL=mux-XM6AP35L.js.map
@@ -1,13 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  OpenClawAdapter
4
- } from "./chunk-CENEXP7K.js";
4
+ } from "./chunk-3Q6YEDCG.js";
5
5
  import "./chunk-DBQMX75U.js";
6
- import "./chunk-KG6T3YNJ.js";
7
- import "./chunk-IEGR4TP3.js";
6
+ import "./chunk-A767JFHW.js";
8
7
  import "./chunk-TO57WYBB.js";
9
- import "./chunk-N6HH7K6P.js";
10
- import "./chunk-TRQKHP7D.js";
8
+ import "./chunk-ZY25RG4Y.js";
9
+ import "./chunk-QY42WGBX.js";
11
10
 
12
11
  // src/adapters/nemoclaw/index.ts
13
12
  import { existsSync } from "fs";
@@ -55,4 +54,4 @@ export {
55
54
  adapter,
56
55
  nemoclaw_default as default
57
56
  };
58
- //# sourceMappingURL=nemoclaw-DNFIZFDF.js.map
57
+ //# sourceMappingURL=nemoclaw-GQMS6CUM.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/adapters/nemoclaw/index.ts"],"sourcesContent":["/**\n * adapters/nemoclaw — NVIDIA NemoClaw platform adapter for agent-connector.\n *\n * NemoClaw (github.com/NVIDIA/NemoClaw, Apache-2.0, v0.1.0) is an\n * orchestrator/wrapper that deploys and lifecycle-manages an OpenClaw agent\n * (the default) inside an NVIDIA OpenShell sandbox. It is ALSO an OpenClaw\n * plugin. It is NOT a Claude/Codex/Gemini fork: the agent it wraps is OpenClaw,\n * and the config the wrapped agent actually loads is the SAME\n * `~/.openclaw/openclaw.json` the OpenClaw adapter already targets (top-level\n * `mcp.servers.<id>` for MCP sidecars; plugins.entries + plugins.load.paths for\n * the ts-plugin bridge — OpenClaw's verified DUAL REGISTRATION shape).\n *\n * DESIGN — a thin fork of {@link OpenClawAdapter} (precedent:\n * AntigravityCliAdapter extends AntigravityAdapter). It REUSES every render /\n * hook / parse / surface path from the parent unchanged — MCP still lands in\n * the wrapped `~/.openclaw/openclaw.json`, the paradigm stays ts-plugin, and the\n * content surfaces (skills) are inherited. The ONLY differences are identity and\n * detection:\n *\n * - id = \"nemoclaw\", name = \"NVIDIA NemoClaw\". Identity flows into the\n * ChangeRecord `platform` stamp and the host-detection result.\n * - detectInstalled probes the NemoClaw-specific marker `~/.nemoclaw/`\n * (config.json + rebuild-backups/ + blueprints/). A NemoClaw box has BOTH\n * markers on disk: it DRIVES the wrapped `~/.openclaw/openclaw.json`, so\n * `~/.openclaw/` is present too. Exclusivity is therefore guaranteed at the\n * SOURCE, not by registry order alone — {@link OpenClawAdapter.detectInstalled}\n * BOWS OUT (reports its user scope not-installed) whenever `~/.nemoclaw/`\n * exists, so the shared config is never double-targeted as two platforms\n * (an `uninstall openclaw` would otherwise strip nemoclaw's entries). nemoclaw\n * is ALSO registered BEFORE openclaw (PlatformId union AND ADAPTER_REGISTRY)\n * as the deterministic tie-break — a NemoClaw box classifies as nemoclaw; an\n * OpenClaw-only box (no `~/.nemoclaw/`) classifies as openclaw.\n *\n * HOOKS: NemoClaw ships NO Claude-style lifecycle hooks of its own\n * (managedChannels are messaging; plugin activation.onStartup and runtime-slash\n * aliases are not hook events). It nonetheless INHERITS OpenClaw's ts-plugin\n * hook machinery — when a connector declares hooks, the inherited installHooks\n * writes the same self-contained OpenClaw plugin bridge into the wrapped\n * `~/.openclaw/openclaw.json` (the agent NemoClaw runs), so the paradigm stays\n * ts-plugin honestly.\n *\n * SOURCES: github.com/NVIDIA/NemoClaw (README, nemoclaw/openclaw.plugin.json,\n * src/onboard/config.ts, test/openclaw-config-snapshot.test.ts,\n * src/lib/state/sandbox.ts), docs.nvidia.com/nemoclaw.\n */\n\nimport { existsSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\n\nimport { OpenClawAdapter } from \"../openclaw/index.js\";\nimport type { Adapter } from \"../spi.js\";\nimport type { DetectedPlatform, PlatformId } from \"../../core/types.js\";\n\nconst HOST: PlatformId = \"nemoclaw\";\n\nexport class NemoClawAdapter extends OpenClawAdapter implements Adapter {\n override readonly id: PlatformId = HOST;\n override readonly name = \"NVIDIA NemoClaw\";\n\n // ── Detection ────────────────────────────────────────────────────────────\n\n /**\n * Probe the NemoClaw-specific marker `~/.nemoclaw/` (its onboarding writes\n * config.json + rebuild-backups/ + blueprints/ there). This is DISTINCT from\n * OpenClaw's `~/.openclaw/` marker even though NemoClaw drives the wrapped\n * OpenClaw config: a box with `~/.nemoclaw/` is a NemoClaw install. Reported\n * before the OpenClaw adapter in the registry so the more-specific NemoClaw\n * marker wins host detection (a plain OpenClaw box — `~/.openclaw/` only,\n * no `~/.nemoclaw/` — falls through to the openclaw adapter).\n *\n * The config path returned is the WRAPPED OpenClaw config (where MCP/hooks are\n * actually written) so install/doctor point at the file the agent loads.\n */\n override detectInstalled(projectDir: string): DetectedPlatform {\n const nemoclawDir = join(homedir(), \".nemoclaw\");\n const installed = existsSync(nemoclawDir);\n\n // Inherit OpenClaw's path resolution for the wrapped config (the file the\n // agent NemoClaw runs actually loads) and the capabilities/paradigm.\n const base = super.detectInstalled(projectDir);\n\n return {\n id: this.id,\n name: this.name,\n installed,\n paradigm: this.paradigm,\n capabilities: this.capabilities,\n // Where MCP/hooks land for NemoClaw: the wrapped OpenClaw config.\n configPath: base.configPath,\n scope: base.scope,\n reason: installed\n ? `found NVIDIA NemoClaw config at ${nemoclawDir} (wraps OpenClaw at ${base.configPath})`\n : `no NVIDIA NemoClaw config at ${nemoclawDir}`,\n confidence: installed ? \"high\" : \"low\",\n };\n }\n}\n\nexport const adapter = new NemoClawAdapter();\nexport default adapter;\n"],"mappings":";;;;;;;;;;;;AA8CA,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,YAAY;AAMrB,IAAM,OAAmB;AAElB,IAAM,kBAAN,cAA8B,gBAAmC;AAAA,EACpD,KAAiB;AAAA,EACjB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBhB,gBAAgB,YAAsC;AAC7D,UAAM,cAAc,KAAK,QAAQ,GAAG,WAAW;AAC/C,UAAM,YAAY,WAAW,WAAW;AAIxC,UAAM,OAAO,MAAM,gBAAgB,UAAU;AAE7C,WAAO;AAAA,MACL,IAAI,KAAK;AAAA,MACT,MAAM,KAAK;AAAA,MACX;AAAA,MACA,UAAU,KAAK;AAAA,MACf,cAAc,KAAK;AAAA;AAAA,MAEnB,YAAY,KAAK;AAAA,MACjB,OAAO,KAAK;AAAA,MACZ,QAAQ,YACJ,mCAAmC,WAAW,uBAAuB,KAAK,UAAU,MACpF,gCAAgC,WAAW;AAAA,MAC/C,YAAY,YAAY,SAAS;AAAA,IACnC;AAAA,EACF;AACF;AAEO,IAAM,UAAU,IAAI,gBAAgB;AAC3C,IAAO,mBAAQ;","names":[]}
1
+ {"version":3,"sources":["../src/adapters/nemoclaw/index.ts"],"sourcesContent":["/**\n * adapters/nemoclaw — NVIDIA NemoClaw platform adapter for agent-connector.\n *\n * NemoClaw (github.com/NVIDIA/NemoClaw, Apache-2.0, v0.1.0) is an\n * orchestrator/wrapper that deploys and lifecycle-manages an OpenClaw agent\n * (the default) inside an NVIDIA OpenShell sandbox. It is ALSO an OpenClaw\n * plugin. It is NOT a Claude/Codex/Gemini fork: the agent it wraps is OpenClaw,\n * and the config the wrapped agent actually loads is the SAME\n * `~/.openclaw/openclaw.json` the OpenClaw adapter already targets (top-level\n * `mcp.servers.<id>` for MCP sidecars; plugins.entries + plugins.load.paths for\n * the ts-plugin bridge — OpenClaw's verified DUAL REGISTRATION shape).\n *\n * DESIGN — a thin fork of {@link OpenClawAdapter} (precedent:\n * AntigravityCliAdapter extends AntigravityAdapter). It REUSES every render /\n * hook / parse / surface path from the parent unchanged — MCP still lands in\n * the wrapped `~/.openclaw/openclaw.json`, the paradigm stays ts-plugin, and the\n * content surfaces (skills) are inherited. The ONLY differences are identity and\n * detection:\n *\n * - id = \"nemoclaw\", name = \"NVIDIA NemoClaw\". Identity flows into the\n * ChangeRecord `platform` stamp and the host-detection result.\n * - detectInstalled probes the NemoClaw-specific marker `~/.nemoclaw/`\n * (config.json + rebuild-backups/ + blueprints/). A NemoClaw box has BOTH\n * markers on disk: it DRIVES the wrapped `~/.openclaw/openclaw.json`, so\n * `~/.openclaw/` is present too. Exclusivity is therefore guaranteed at the\n * SOURCE, not by registry order alone — {@link OpenClawAdapter.detectInstalled}\n * BOWS OUT (reports its user scope not-installed) whenever `~/.nemoclaw/`\n * exists, so the shared config is never double-targeted as two platforms\n * (an `uninstall openclaw` would otherwise strip nemoclaw's entries). nemoclaw\n * is ALSO registered BEFORE openclaw (PlatformId union AND ADAPTER_REGISTRY)\n * as the deterministic tie-break — a NemoClaw box classifies as nemoclaw; an\n * OpenClaw-only box (no `~/.nemoclaw/`) classifies as openclaw.\n *\n * HOOKS: NemoClaw ships NO Claude-style lifecycle hooks of its own\n * (managedChannels are messaging; plugin activation.onStartup and runtime-slash\n * aliases are not hook events). It nonetheless INHERITS OpenClaw's ts-plugin\n * hook machinery — when a connector declares hooks, the inherited installHooks\n * writes the same self-contained OpenClaw plugin bridge into the wrapped\n * `~/.openclaw/openclaw.json` (the agent NemoClaw runs), so the paradigm stays\n * ts-plugin honestly.\n *\n * SOURCES: github.com/NVIDIA/NemoClaw (README, nemoclaw/openclaw.plugin.json,\n * src/onboard/config.ts, test/openclaw-config-snapshot.test.ts,\n * src/lib/state/sandbox.ts), docs.nvidia.com/nemoclaw.\n */\n\nimport { existsSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\n\nimport { OpenClawAdapter } from \"../openclaw/index.js\";\nimport type { Adapter } from \"../spi.js\";\nimport type { DetectedPlatform, PlatformId } from \"../../core/types.js\";\n\nconst HOST: PlatformId = \"nemoclaw\";\n\nexport class NemoClawAdapter extends OpenClawAdapter implements Adapter {\n override readonly id: PlatformId = HOST;\n override readonly name = \"NVIDIA NemoClaw\";\n\n // ── Detection ────────────────────────────────────────────────────────────\n\n /**\n * Probe the NemoClaw-specific marker `~/.nemoclaw/` (its onboarding writes\n * config.json + rebuild-backups/ + blueprints/ there). This is DISTINCT from\n * OpenClaw's `~/.openclaw/` marker even though NemoClaw drives the wrapped\n * OpenClaw config: a box with `~/.nemoclaw/` is a NemoClaw install. Reported\n * before the OpenClaw adapter in the registry so the more-specific NemoClaw\n * marker wins host detection (a plain OpenClaw box — `~/.openclaw/` only,\n * no `~/.nemoclaw/` — falls through to the openclaw adapter).\n *\n * The config path returned is the WRAPPED OpenClaw config (where MCP/hooks are\n * actually written) so install/doctor point at the file the agent loads.\n */\n override detectInstalled(projectDir: string): DetectedPlatform {\n const nemoclawDir = join(homedir(), \".nemoclaw\");\n const installed = existsSync(nemoclawDir);\n\n // Inherit OpenClaw's path resolution for the wrapped config (the file the\n // agent NemoClaw runs actually loads) and the capabilities/paradigm.\n const base = super.detectInstalled(projectDir);\n\n return {\n id: this.id,\n name: this.name,\n installed,\n paradigm: this.paradigm,\n capabilities: this.capabilities,\n // Where MCP/hooks land for NemoClaw: the wrapped OpenClaw config.\n configPath: base.configPath,\n scope: base.scope,\n reason: installed\n ? `found NVIDIA NemoClaw config at ${nemoclawDir} (wraps OpenClaw at ${base.configPath})`\n : `no NVIDIA NemoClaw config at ${nemoclawDir}`,\n confidence: installed ? \"high\" : \"low\",\n };\n }\n}\n\nexport const adapter = new NemoClawAdapter();\nexport default adapter;\n"],"mappings":";;;;;;;;;;;AA8CA,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,YAAY;AAMrB,IAAM,OAAmB;AAElB,IAAM,kBAAN,cAA8B,gBAAmC;AAAA,EACpD,KAAiB;AAAA,EACjB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBhB,gBAAgB,YAAsC;AAC7D,UAAM,cAAc,KAAK,QAAQ,GAAG,WAAW;AAC/C,UAAM,YAAY,WAAW,WAAW;AAIxC,UAAM,OAAO,MAAM,gBAAgB,UAAU;AAE7C,WAAO;AAAA,MACL,IAAI,KAAK;AAAA,MACT,MAAM,KAAK;AAAA,MACX;AAAA,MACA,UAAU,KAAK;AAAA,MACf,cAAc,KAAK;AAAA;AAAA,MAEnB,YAAY,KAAK;AAAA,MACjB,OAAO,KAAK;AAAA,MACZ,QAAQ,YACJ,mCAAmC,WAAW,uBAAuB,KAAK,UAAU,MACpF,gCAAgC,WAAW;AAAA,MAC/C,YAAY,YAAY,SAAS;AAAA,IACnC;AAAA,EACF;AACF;AAEO,IAAM,UAAU,IAAI,gBAAgB;AAC3C,IAAO,mBAAQ;","names":[]}
@@ -7,13 +7,12 @@ import {
7
7
  } from "./chunk-DBQMX75U.js";
8
8
  import {
9
9
  BaseAdapter
10
- } from "./chunk-KG6T3YNJ.js";
11
- import "./chunk-IEGR4TP3.js";
10
+ } from "./chunk-A767JFHW.js";
12
11
  import {
13
12
  buildWrappedStdio
14
13
  } from "./chunk-TO57WYBB.js";
15
- import "./chunk-N6HH7K6P.js";
16
- import "./chunk-TRQKHP7D.js";
14
+ import "./chunk-ZY25RG4Y.js";
15
+ import "./chunk-QY42WGBX.js";
17
16
 
18
17
  // src/adapters/omp/index.ts
19
18
  import {
@@ -682,4 +681,4 @@ export {
682
681
  adapter,
683
682
  omp_default as default
684
683
  };
685
- //# sourceMappingURL=omp-I3UTRBNP.js.map
684
+ //# sourceMappingURL=omp-2RPYIZUF.js.map