@namzu/cli 53.0.1 → 53.1.0

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 (417) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/chunks/{acp-IOWTKF2X.js → acp-UVCLNIXU.js} +83 -77
  4. package/dist/chunks/acp-UVCLNIXU.js.map +6 -0
  5. package/dist/chunks/{activity-command-U2AOTIVF.js → activity-command-2QIWTUUB.js} +15 -15
  6. package/dist/chunks/{add-YYQLPCP2.js → add-2YDEALUT.js} +26 -26
  7. package/dist/chunks/{agent-WL6NX4W6.js → agent-IKQ67NMW.js} +45 -42
  8. package/dist/chunks/agent-session-H3OE6ZJT.js +76 -0
  9. package/dist/chunks/{apply-at-exit-BRXYTQVG.js → apply-at-exit-F4G7PCZL.js} +8 -8
  10. package/dist/chunks/{archive-UE756BME.js → archive-FOTYHQPL.js} +14 -14
  11. package/dist/chunks/{bin-main-XR2DJOI6.js → bin-main-DWOCG2WK.js} +14 -14
  12. package/dist/chunks/{binding-HCIPLFUO.js → binding-2GEVBR5H.js} +3 -3
  13. package/dist/chunks/{browser-7SFVCKSO.js → browser-WYPSIPEZ.js} +6 -6
  14. package/dist/chunks/{chat-K6GQGRUA.js → chat-LWVIDEXR.js} +22 -22
  15. package/dist/chunks/{chunk-CQKYKQEF.js → chunk-2CYBRCPH.js} +4 -4
  16. package/dist/chunks/{chunk-7AWFHVMT.js → chunk-2Q2TPLYP.js} +3 -3
  17. package/dist/chunks/{chunk-TYTE2GIF.js → chunk-2QMXCXZ2.js} +5 -5
  18. package/dist/chunks/{chunk-Z5NMQ2YN.js → chunk-33WFG4C3.js} +2 -2
  19. package/dist/chunks/{chunk-Z5FDI74K.js → chunk-3EEKLQXD.js} +6 -6
  20. package/dist/chunks/chunk-3HJXXP6L.js +226 -0
  21. package/dist/chunks/chunk-3HJXXP6L.js.map +6 -0
  22. package/dist/chunks/{chunk-NZMKMXGG.js → chunk-3T5AX2PC.js} +2 -2
  23. package/dist/chunks/{chunk-OBMHA7OP.js → chunk-4ASCYXSH.js} +3 -3
  24. package/dist/chunks/{chunk-MHXJYXOF.js → chunk-4EBZUUE4.js} +5 -5
  25. package/dist/chunks/{chunk-WSMX3IQE.js → chunk-53UWPLAF.js} +503 -402
  26. package/dist/chunks/chunk-53UWPLAF.js.map +6 -0
  27. package/dist/chunks/{chunk-3NAVAACC.js → chunk-5F4SSZKS.js} +2 -2
  28. package/dist/chunks/{chunk-RDW6L3PV.js → chunk-5JQIGBBR.js} +3 -3
  29. package/dist/chunks/{chunk-HOB6FTE2.js → chunk-5S7U5MFW.js} +5 -4
  30. package/dist/chunks/{chunk-HOB6FTE2.js.map → chunk-5S7U5MFW.js.map} +1 -1
  31. package/dist/chunks/{chunk-U4XNJBDB.js → chunk-5WORROIE.js} +8 -1
  32. package/dist/chunks/{chunk-U4XNJBDB.js.map → chunk-5WORROIE.js.map} +1 -1
  33. package/dist/chunks/{chunk-V7VNFYA4.js → chunk-6APCO6YC.js} +18 -14
  34. package/dist/chunks/chunk-6APCO6YC.js.map +6 -0
  35. package/dist/chunks/{chunk-HJILJSZO.js → chunk-6CXEEZLK.js} +2 -2
  36. package/dist/chunks/{chunk-2U357RJS.js → chunk-6JKNPDZD.js} +10 -10
  37. package/dist/chunks/{chunk-AGFGC7SI.js → chunk-6KIXUAOC.js} +3 -3
  38. package/dist/chunks/{chunk-2WDF5N2A.js → chunk-6NUQEVHG.js} +9 -9
  39. package/dist/chunks/{chunk-4RTQTX5R.js → chunk-6RTDZGPO.js} +2 -2
  40. package/dist/chunks/{chunk-5I45HTKW.js → chunk-7PDUMQ4M.js} +175 -33
  41. package/dist/chunks/chunk-7PDUMQ4M.js.map +6 -0
  42. package/dist/chunks/{chunk-7JT7DNR7.js → chunk-7T6TX47O.js} +3 -3
  43. package/dist/chunks/{chunk-UJOWXA23.js → chunk-ABOV5CRT.js} +302 -131
  44. package/dist/chunks/chunk-ABOV5CRT.js.map +6 -0
  45. package/dist/chunks/{chunk-SVMGV4AS.js → chunk-AZHBCP6G.js} +46 -46
  46. package/dist/chunks/{chunk-POOJ2MUS.js → chunk-BLGPF6UL.js} +3 -3
  47. package/dist/chunks/{chunk-YELRULQ7.js → chunk-C74LVDRC.js} +3948 -2225
  48. package/dist/chunks/chunk-C74LVDRC.js.map +6 -0
  49. package/dist/chunks/{chunk-F3SQRGKZ.js → chunk-CMHOQ62S.js} +2 -2
  50. package/dist/chunks/{chunk-24N42TGE.js → chunk-D5RO75LO.js} +6 -6
  51. package/dist/chunks/{chunk-M3AUPUII.js → chunk-D7JY7KNY.js} +6 -6
  52. package/dist/chunks/chunk-DCMZYSON.js +247 -0
  53. package/dist/chunks/chunk-DCMZYSON.js.map +6 -0
  54. package/dist/chunks/{chunk-5NDRDTNX.js → chunk-DHWD5YYD.js} +6 -6
  55. package/dist/chunks/chunk-DHWD5YYD.js.map +6 -0
  56. package/dist/chunks/{chunk-RAPO3KLG.js → chunk-DTORDCJR.js} +4 -4
  57. package/dist/chunks/{chunk-NICPMJJQ.js → chunk-E7GZ5OXM.js} +6 -5
  58. package/dist/chunks/{chunk-NICPMJJQ.js.map → chunk-E7GZ5OXM.js.map} +1 -1
  59. package/dist/chunks/{chunk-O326HKCW.js → chunk-EADNTGVW.js} +3 -3
  60. package/dist/chunks/{chunk-YSKCWH72.js → chunk-EYAWI7KU.js} +196 -27
  61. package/dist/chunks/chunk-EYAWI7KU.js.map +6 -0
  62. package/dist/chunks/{chunk-KNQ7R54U.js → chunk-F3GGSHY2.js} +715 -622
  63. package/dist/chunks/chunk-F3GGSHY2.js.map +6 -0
  64. package/dist/chunks/{chunk-HGZYNEQE.js → chunk-FBRYV5YN.js} +14 -7
  65. package/dist/chunks/chunk-FBRYV5YN.js.map +6 -0
  66. package/dist/chunks/{chunk-2VSICYQP.js → chunk-FWTWILCD.js} +2 -2
  67. package/dist/chunks/{chunk-HUONDMU4.js → chunk-G4R65ULE.js} +2 -2
  68. package/dist/chunks/{chunk-C5XQHEYB.js → chunk-G7LMPHZE.js} +2 -2
  69. package/dist/chunks/{chunk-XHLFI6F6.js → chunk-GD7VSTWZ.js} +2 -2
  70. package/dist/chunks/{chunk-4FV2VZS6.js → chunk-GZNTRTD5.js} +3 -3
  71. package/dist/chunks/{chunk-UMHKTV2L.js → chunk-H7UZKOVC.js} +132 -4
  72. package/dist/chunks/chunk-H7UZKOVC.js.map +6 -0
  73. package/dist/chunks/{chunk-FEIIR46G.js → chunk-HFZLLEJS.js} +5 -5
  74. package/dist/chunks/chunk-IOWYDR6H.js +414 -0
  75. package/dist/chunks/chunk-IOWYDR6H.js.map +6 -0
  76. package/dist/chunks/{chunk-WOSL3OZD.js → chunk-IW3XMMEN.js} +4 -4
  77. package/dist/chunks/{chunk-DSKNFDTL.js → chunk-KXUKJLA2.js} +2 -2
  78. package/dist/chunks/{chunk-EA73SWCT.js → chunk-L2AKMCV3.js} +4 -4
  79. package/dist/chunks/{chunk-Z6J7SVOB.js → chunk-LC7SV2KM.js} +2 -2
  80. package/dist/chunks/{chunk-J7SA5BCI.js → chunk-LOUV4VZ6.js} +4 -4
  81. package/dist/chunks/{chunk-DI4L3GH5.js → chunk-LQJLTW2D.js} +2 -2
  82. package/dist/chunks/{chunk-HTHNDZ3L.js → chunk-LRFRTQW7.js} +2 -2
  83. package/dist/chunks/{chunk-EKMHZKVP.js → chunk-MDY2IMVQ.js} +2 -2
  84. package/dist/chunks/{chunk-NTV2XD2J.js → chunk-MNMKHEMI.js} +2 -2
  85. package/dist/chunks/{chunk-ZDZ35MMZ.js → chunk-MTY4XYDO.js} +2 -2
  86. package/dist/chunks/{chunk-OAHCS42A.js → chunk-MZURZ6P4.js} +2 -2
  87. package/dist/chunks/{chunk-6CFPN6I4.js → chunk-NFKSV6UI.js} +2 -2
  88. package/dist/chunks/{chunk-TI6FFONP.js → chunk-NIRQFXO6.js} +2 -2
  89. package/dist/chunks/{chunk-QPR3UA4L.js → chunk-NJWQUZF2.js} +2 -2
  90. package/dist/chunks/{chunk-EKQ6J5KA.js → chunk-NRGGICBE.js} +2 -2
  91. package/dist/chunks/{chunk-ZMKEYARZ.js → chunk-NW6VBCCU.js} +6 -6
  92. package/dist/chunks/{chunk-UWN4WNQZ.js → chunk-ORCR5VST.js} +2 -2
  93. package/dist/chunks/{chunk-TUXH7IXQ.js → chunk-P6OOW3RL.js} +2 -2
  94. package/dist/chunks/{chunk-46VSU4QF.js → chunk-PXA27JGJ.js} +2 -2
  95. package/dist/chunks/{chunk-SPSWX3QZ.js → chunk-PXJ2KPOI.js} +2 -2
  96. package/dist/chunks/chunk-QBCGPM4E.js +41 -0
  97. package/dist/chunks/chunk-QBCGPM4E.js.map +6 -0
  98. package/dist/chunks/{chunk-VVWI4EB7.js → chunk-QE5PQM5T.js} +3 -3
  99. package/dist/chunks/{chunk-SHUA4YUK.js → chunk-QIDU76IF.js} +2 -2
  100. package/dist/chunks/{chunk-SB3A7KUJ.js → chunk-QP435RW7.js} +4 -4
  101. package/dist/chunks/{chunk-FX7BSCB4.js → chunk-QPAWT3EG.js} +4 -4
  102. package/dist/chunks/{chunk-BHOZPFJM.js → chunk-QTPZCVPP.js} +5 -5
  103. package/dist/chunks/{chunk-CCYAWSZL.js → chunk-RFGMOXA6.js} +5 -5
  104. package/dist/chunks/{chunk-N56NUKMT.js → chunk-RPXTYB22.js} +2 -2
  105. package/dist/chunks/chunk-RVXJ5MYA.js +686 -0
  106. package/dist/chunks/chunk-RVXJ5MYA.js.map +6 -0
  107. package/dist/chunks/{chunk-X6SREM2V.js → chunk-RXUWYGFX.js} +7 -7
  108. package/dist/chunks/{chunk-DIWEKTYK.js → chunk-S5R2E5TZ.js} +5 -5
  109. package/dist/chunks/{chunk-DOFQWVBL.js → chunk-T3NIOUQJ.js} +3 -3
  110. package/dist/chunks/{chunk-LMLJ7NS5.js → chunk-TMOEYXPR.js} +5 -5
  111. package/dist/chunks/{chunk-PV65WQHD.js → chunk-UNO2ZRXA.js} +12 -12
  112. package/dist/chunks/{chunk-ZZNHDQAD.js → chunk-UNZNPAW7.js} +2 -2
  113. package/dist/chunks/{chunk-PYSZ7JTU.js → chunk-URIGGSIK.js} +2 -2
  114. package/dist/chunks/{chunk-RJWPNAYL.js → chunk-UWYDZYCZ.js} +6 -6
  115. package/dist/chunks/chunk-UYAI6F3R.js +44 -0
  116. package/dist/chunks/chunk-UYAI6F3R.js.map +6 -0
  117. package/dist/chunks/{chunk-P5E6ITP5.js → chunk-VG6RBHI4.js} +5 -5
  118. package/dist/chunks/{chunk-A47ZNTW7.js → chunk-VV2EHZOG.js} +3 -3
  119. package/dist/chunks/{chunk-VYLCV6W3.js → chunk-WY6KOPIY.js} +9 -9
  120. package/dist/chunks/{chunk-HOKSVFIC.js → chunk-XFVVJAI3.js} +6 -6
  121. package/dist/chunks/{chunk-MYVF3JRV.js → chunk-XKIV3H62.js} +6 -6
  122. package/dist/chunks/{chunk-J3PHMXN4.js → chunk-XLDFNUCV.js} +4 -4
  123. package/dist/chunks/{chunk-KAPCNFMC.js → chunk-XODDL7OV.js} +3 -3
  124. package/dist/chunks/{chunk-DHS5CQNC.js → chunk-XTVF376M.js} +12 -12
  125. package/dist/chunks/{chunk-PSLNHLZI.js → chunk-YLCMBXE3.js} +3 -3
  126. package/dist/chunks/{chunk-P7FHJL3V.js → chunk-YNY6XL5T.js} +2 -2
  127. package/dist/chunks/{chunk-KO2N6EIF.js → chunk-YVJVXTUS.js} +10 -10
  128. package/dist/chunks/{chunk-LOWGGJOB.js → chunk-ZYSTDBP7.js} +7 -112
  129. package/dist/chunks/chunk-ZYSTDBP7.js.map +6 -0
  130. package/dist/chunks/{cli-runtime-SVXU6U4V.js → cli-runtime-33Z22SZM.js} +24 -24
  131. package/dist/chunks/{commands-A2E3OV7F.js → commands-DLREWCNK.js} +5 -5
  132. package/dist/chunks/{cost-NA7APCZD.js → cost-MJOM52FI.js} +8 -8
  133. package/dist/chunks/{crash-report-C6QXQJAK.js → crash-report-62LMID3V.js} +9 -9
  134. package/dist/chunks/{dist-5SZ7VOLE.js → dist-HA6ABMIV.js} +2 -2
  135. package/dist/chunks/{dist-GVGW7AZ2.js → dist-HWU5U4SQ.js} +2 -2
  136. package/dist/chunks/{dist-HASAHQL3.js → dist-IL4H4QGY.js} +2 -2
  137. package/dist/chunks/{dist-G4BSVJKY.js → dist-MTYIYUQU.js} +2 -2
  138. package/dist/chunks/{dist-LBTLFSNF.js → dist-NUPNUHXB.js} +66 -2
  139. package/dist/chunks/{dist-3PE5MOU6.js → dist-TCKNCSZO.js} +2 -2
  140. package/dist/chunks/{dist-HYKH6P7F.js → dist-U7A47UOF.js} +2 -2
  141. package/dist/chunks/{dist-6CHQ5OPZ.js → dist-XFBNYCQ7.js} +2 -2
  142. package/dist/chunks/{doctor-Y5PQ2R7D.js → doctor-V5C6R5EN.js} +43 -40
  143. package/dist/chunks/{drain-RG275P5J.js → drain-CS7XQ5B7.js} +14 -14
  144. package/dist/chunks/{entry-BJY7UE6P.js → entry-HXLBVNDK.js} +6 -6
  145. package/dist/chunks/{eval-GG2BH7CQ.js → eval-NRBZ4IWO.js} +11 -11
  146. package/dist/chunks/{exec-63SUPKUV.js → exec-GCNNTGHM.js} +82 -54
  147. package/dist/chunks/exec-GCNNTGHM.js.map +6 -0
  148. package/dist/chunks/{github-MGIA7MTZ.js → github-Z3JQNLXA.js} +5 -5
  149. package/dist/chunks/{home-KMZDOTX5.js → home-GP3Y7F5H.js} +3 -3
  150. package/dist/chunks/{host-OB5CL3GG.js → host-C5GIO57R.js} +10 -10
  151. package/dist/chunks/{host-queries-2GQM7BTI.js → host-queries-F5Y3L7E4.js} +15 -15
  152. package/dist/chunks/{learn-LUEHNOMA.js → learn-5FEP65D6.js} +12 -12
  153. package/dist/chunks/{learn-builtin-R2Z27LDI.js → learn-builtin-HV3ASHAJ.js} +17 -17
  154. package/dist/chunks/{lifecycle-DCLLAROM.js → lifecycle-TMZEWFWF.js} +36 -36
  155. package/dist/chunks/{list-5UW5SFIX.js → list-MD6ZN2PW.js} +18 -18
  156. package/dist/chunks/{live-YUE4AKRQ.js → live-OVTHCQB3.js} +41 -38
  157. package/dist/chunks/load-ADBRLXAL.js +73 -0
  158. package/dist/chunks/{login-ELIGI6HT.js → login-RV3AHE4C.js} +13 -13
  159. package/dist/chunks/{logs-PXASK6XI.js → logs-6SBW5BWD.js} +5 -5
  160. package/dist/chunks/{mcp-YVV35X7H.js → mcp-3QDMZ7PD.js} +33 -33
  161. package/dist/chunks/{message-command-QVGOKB4W.js → message-command-TW57Q7AB.js} +57 -54
  162. package/dist/chunks/message-command-TW57Q7AB.js.map +6 -0
  163. package/dist/chunks/{open-MDT2NTF4.js → open-K4R6E6QJ.js} +8 -8
  164. package/dist/chunks/{operator-tools-LYY2FXSO.js → operator-tools-YX4575HD.js} +14 -14
  165. package/dist/chunks/{output-schema-VR43KZNJ.js → output-schema-QBKJSX77.js} +3 -3
  166. package/dist/chunks/{pal-YXOWNULV.js → pal-KLH2IC3W.js} +19 -19
  167. package/dist/chunks/{peers-CJOTRI4W.js → peers-5BMGZLHY.js} +18 -18
  168. package/dist/chunks/{peers-6M4UPHDF.js → peers-6F4JS4VL.js} +6 -6
  169. package/dist/chunks/{plugin-IVIHCAEO.js → plugin-T6ULGX5N.js} +101 -20
  170. package/dist/chunks/plugin-T6ULGX5N.js.map +6 -0
  171. package/dist/chunks/{providers-7WDY37V3.js → providers-YJVPCIRI.js} +11 -11
  172. package/dist/chunks/{pty-CLDDZT5T.js → pty-UMMMCRJW.js} +3 -3
  173. package/dist/chunks/resume-RKZ52FZP.js +23 -0
  174. package/dist/chunks/{resume-command-TXPTYQFF.js → resume-command-H4IJJDLH.js} +4 -4
  175. package/dist/chunks/{running-KBISZDIQ.js → running-UTOYIBXM.js} +5 -5
  176. package/dist/chunks/{schedule-ECZVNZLH.js → schedule-KWX4SXS5.js} +8 -8
  177. package/dist/chunks/{send-VUJ33MJM.js → send-UEL2L3VA.js} +16 -16
  178. package/dist/chunks/{send-person-WXM7Y5PZ.js → send-person-X3SWXKWV.js} +13 -13
  179. package/dist/chunks/{service-DORQ3PNE.js → service-4VS6XQ7O.js} +41 -41
  180. package/dist/chunks/{skills-W7KY3WX4.js → skills-LK7WSDDG.js} +45 -16
  181. package/dist/chunks/skills-LK7WSDDG.js.map +6 -0
  182. package/dist/chunks/{start-check-KECY75IO.js → start-check-HTPENJ36.js} +2 -2
  183. package/dist/chunks/{startup-failure-MS7TPUMI.js → startup-failure-LKAHWAYZ.js} +2 -2
  184. package/dist/chunks/{state-YK5JWP5I.js → state-UQPKWIYT.js} +6 -6
  185. package/dist/chunks/{store-TM7VDQ5G.js → store-74PEEN6L.js} +4 -4
  186. package/dist/chunks/{store-XIPDR26B.js → store-BY6HMUUN.js} +6 -6
  187. package/dist/chunks/{store-7SFKBFX6.js → store-MILGWYSA.js} +10 -10
  188. package/dist/chunks/{store-H4IVAEZK.js → store-UHIHEGKS.js} +3 -3
  189. package/dist/chunks/store-UHIHEGKS.js.map +6 -0
  190. package/dist/chunks/{tui-XKAQI3DD.js → tui-FOVSBYCD.js} +86 -81
  191. package/dist/chunks/tui-FOVSBYCD.js.map +6 -0
  192. package/dist/chunks/{upgrade-GLEEEZWO.js → upgrade-V5ST42EQ.js} +10 -10
  193. package/dist/chunks/{watch-XZKKDKAF.js → watch-Q7MSKZIA.js} +96 -91
  194. package/dist/chunks/watch-Q7MSKZIA.js.map +6 -0
  195. package/dist/chunks/{workspaces-GS6D72XT.js → workspaces-2AL72WFH.js} +19 -19
  196. package/dist/chunks/worktree-QPKIZBSK.js +204 -0
  197. package/dist/chunks/worktree-QPKIZBSK.js.map +6 -0
  198. package/dist/commands/acp.d.ts.map +1 -1
  199. package/dist/commands/desktop-host.d.ts.map +1 -1
  200. package/dist/commands/exec-json.d.ts.map +1 -1
  201. package/dist/commands/exec.d.ts.map +1 -1
  202. package/dist/commands/worktree.d.ts.map +1 -1
  203. package/dist/config/hook-common-shape.d.ts +2 -0
  204. package/dist/config/hook-common-shape.d.ts.map +1 -1
  205. package/dist/config/hook-layers.d.ts.map +1 -1
  206. package/dist/config/load.d.ts +25 -1
  207. package/dist/config/load.d.ts.map +1 -1
  208. package/dist/config/skill-hooks-reader.d.ts +46 -0
  209. package/dist/config/skill-hooks-reader.d.ts.map +1 -0
  210. package/dist/doctor/checks/hooks.d.ts +7 -2
  211. package/dist/doctor/checks/hooks.d.ts.map +1 -1
  212. package/dist/index.js +44 -41
  213. package/dist/integrations/plugins/hook-activity.d.ts +62 -0
  214. package/dist/integrations/plugins/hook-activity.d.ts.map +1 -0
  215. package/dist/integrations/plugins/hook-entries.d.ts +92 -0
  216. package/dist/integrations/plugins/hook-entries.d.ts.map +1 -0
  217. package/dist/integrations/plugins/runtime.d.ts +52 -2
  218. package/dist/integrations/plugins/runtime.d.ts.map +1 -1
  219. package/dist/integrations/plugins/validate.d.ts.map +1 -1
  220. package/dist/integrations/subagents/NamzuCliAgent.d.ts +9 -1
  221. package/dist/integrations/subagents/NamzuCliAgent.d.ts.map +1 -1
  222. package/dist/integrations/subagents/agent-hooks.d.ts +116 -0
  223. package/dist/integrations/subagents/agent-hooks.d.ts.map +1 -0
  224. package/dist/integrations/subagents/definitions.d.ts +18 -0
  225. package/dist/integrations/subagents/definitions.d.ts.map +1 -1
  226. package/dist/integrations/subagents/runtime.d.ts +23 -0
  227. package/dist/integrations/subagents/runtime.d.ts.map +1 -1
  228. package/dist/integrations/subagents/worktree-driver.d.ts +20 -5
  229. package/dist/integrations/subagents/worktree-driver.d.ts.map +1 -1
  230. package/dist/integrations/trust/folder-grants.d.ts.map +1 -1
  231. package/dist/integrations/worktrees/hook-host.d.ts +23 -0
  232. package/dist/integrations/worktrees/hook-host.d.ts.map +1 -0
  233. package/dist/integrations/worktrees/managed.d.ts +20 -2
  234. package/dist/integrations/worktrees/managed.d.ts.map +1 -1
  235. package/dist/integrations/worktrees/untrusted-hook.d.ts +16 -0
  236. package/dist/integrations/worktrees/untrusted-hook.d.ts.map +1 -0
  237. package/dist/schedule/fire/fire.d.ts.map +1 -1
  238. package/dist/skills/audit.d.ts +11 -0
  239. package/dist/skills/audit.d.ts.map +1 -1
  240. package/dist/skills/catalog.d.ts +3 -0
  241. package/dist/skills/catalog.d.ts.map +1 -1
  242. package/dist/skills/skill-hooks.d.ts +52 -0
  243. package/dist/skills/skill-hooks.d.ts.map +1 -0
  244. package/dist/skills/store.d.ts +3 -0
  245. package/dist/skills/store.d.ts.map +1 -1
  246. package/dist/skills/use-hooks.d.ts +25 -0
  247. package/dist/skills/use-hooks.d.ts.map +1 -0
  248. package/dist/tui/App.d.ts.map +1 -1
  249. package/dist/tui/agent.d.ts +73 -1
  250. package/dist/tui/agent.d.ts.map +1 -1
  251. package/dist/tui/plugin-view.d.ts.map +1 -1
  252. package/dist/tui/slashCommands.d.ts +44 -1
  253. package/dist/tui/slashCommands.d.ts.map +1 -1
  254. package/dist/user-commands/store.d.ts +2 -0
  255. package/dist/user-commands/store.d.ts.map +1 -1
  256. package/package.json +8 -8
  257. package/dist/chunks/acp-IOWTKF2X.js.map +0 -6
  258. package/dist/chunks/agent-session-L6J5GZVX.js +0 -73
  259. package/dist/chunks/chunk-5I45HTKW.js.map +0 -6
  260. package/dist/chunks/chunk-5NDRDTNX.js.map +0 -6
  261. package/dist/chunks/chunk-AME342DQ.js +0 -245
  262. package/dist/chunks/chunk-AME342DQ.js.map +0 -6
  263. package/dist/chunks/chunk-HGZYNEQE.js.map +0 -6
  264. package/dist/chunks/chunk-KNQ7R54U.js.map +0 -6
  265. package/dist/chunks/chunk-LOWGGJOB.js.map +0 -6
  266. package/dist/chunks/chunk-UJOWXA23.js.map +0 -6
  267. package/dist/chunks/chunk-UMHKTV2L.js.map +0 -6
  268. package/dist/chunks/chunk-V7VNFYA4.js.map +0 -6
  269. package/dist/chunks/chunk-WSMX3IQE.js.map +0 -6
  270. package/dist/chunks/chunk-YELRULQ7.js.map +0 -6
  271. package/dist/chunks/chunk-YSKCWH72.js.map +0 -6
  272. package/dist/chunks/exec-63SUPKUV.js.map +0 -6
  273. package/dist/chunks/message-command-QVGOKB4W.js.map +0 -6
  274. package/dist/chunks/plugin-IVIHCAEO.js.map +0 -6
  275. package/dist/chunks/resume-ZRVTAGB6.js +0 -23
  276. package/dist/chunks/skills-W7KY3WX4.js.map +0 -6
  277. package/dist/chunks/tui-XKAQI3DD.js.map +0 -6
  278. package/dist/chunks/watch-XZKKDKAF.js.map +0 -6
  279. package/dist/chunks/worktree-Z456JZKA.js +0 -119
  280. package/dist/chunks/worktree-Z456JZKA.js.map +0 -6
  281. /package/dist/chunks/{activity-command-U2AOTIVF.js.map → activity-command-2QIWTUUB.js.map} +0 -0
  282. /package/dist/chunks/{add-YYQLPCP2.js.map → add-2YDEALUT.js.map} +0 -0
  283. /package/dist/chunks/{agent-WL6NX4W6.js.map → agent-IKQ67NMW.js.map} +0 -0
  284. /package/dist/chunks/{agent-session-L6J5GZVX.js.map → agent-session-H3OE6ZJT.js.map} +0 -0
  285. /package/dist/chunks/{apply-at-exit-BRXYTQVG.js.map → apply-at-exit-F4G7PCZL.js.map} +0 -0
  286. /package/dist/chunks/{archive-UE756BME.js.map → archive-FOTYHQPL.js.map} +0 -0
  287. /package/dist/chunks/{bin-main-XR2DJOI6.js.map → bin-main-DWOCG2WK.js.map} +0 -0
  288. /package/dist/chunks/{binding-HCIPLFUO.js.map → binding-2GEVBR5H.js.map} +0 -0
  289. /package/dist/chunks/{browser-7SFVCKSO.js.map → browser-WYPSIPEZ.js.map} +0 -0
  290. /package/dist/chunks/{chat-K6GQGRUA.js.map → chat-LWVIDEXR.js.map} +0 -0
  291. /package/dist/chunks/{chunk-CQKYKQEF.js.map → chunk-2CYBRCPH.js.map} +0 -0
  292. /package/dist/chunks/{chunk-7AWFHVMT.js.map → chunk-2Q2TPLYP.js.map} +0 -0
  293. /package/dist/chunks/{chunk-TYTE2GIF.js.map → chunk-2QMXCXZ2.js.map} +0 -0
  294. /package/dist/chunks/{chunk-Z5NMQ2YN.js.map → chunk-33WFG4C3.js.map} +0 -0
  295. /package/dist/chunks/{chunk-Z5FDI74K.js.map → chunk-3EEKLQXD.js.map} +0 -0
  296. /package/dist/chunks/{chunk-NZMKMXGG.js.map → chunk-3T5AX2PC.js.map} +0 -0
  297. /package/dist/chunks/{chunk-OBMHA7OP.js.map → chunk-4ASCYXSH.js.map} +0 -0
  298. /package/dist/chunks/{chunk-MHXJYXOF.js.map → chunk-4EBZUUE4.js.map} +0 -0
  299. /package/dist/chunks/{chunk-3NAVAACC.js.map → chunk-5F4SSZKS.js.map} +0 -0
  300. /package/dist/chunks/{chunk-RDW6L3PV.js.map → chunk-5JQIGBBR.js.map} +0 -0
  301. /package/dist/chunks/{chunk-HJILJSZO.js.map → chunk-6CXEEZLK.js.map} +0 -0
  302. /package/dist/chunks/{chunk-2U357RJS.js.map → chunk-6JKNPDZD.js.map} +0 -0
  303. /package/dist/chunks/{chunk-AGFGC7SI.js.map → chunk-6KIXUAOC.js.map} +0 -0
  304. /package/dist/chunks/{chunk-2WDF5N2A.js.map → chunk-6NUQEVHG.js.map} +0 -0
  305. /package/dist/chunks/{chunk-4RTQTX5R.js.map → chunk-6RTDZGPO.js.map} +0 -0
  306. /package/dist/chunks/{chunk-7JT7DNR7.js.map → chunk-7T6TX47O.js.map} +0 -0
  307. /package/dist/chunks/{chunk-SVMGV4AS.js.map → chunk-AZHBCP6G.js.map} +0 -0
  308. /package/dist/chunks/{chunk-POOJ2MUS.js.map → chunk-BLGPF6UL.js.map} +0 -0
  309. /package/dist/chunks/{chunk-F3SQRGKZ.js.map → chunk-CMHOQ62S.js.map} +0 -0
  310. /package/dist/chunks/{chunk-24N42TGE.js.map → chunk-D5RO75LO.js.map} +0 -0
  311. /package/dist/chunks/{chunk-M3AUPUII.js.map → chunk-D7JY7KNY.js.map} +0 -0
  312. /package/dist/chunks/{chunk-RAPO3KLG.js.map → chunk-DTORDCJR.js.map} +0 -0
  313. /package/dist/chunks/{chunk-O326HKCW.js.map → chunk-EADNTGVW.js.map} +0 -0
  314. /package/dist/chunks/{chunk-2VSICYQP.js.map → chunk-FWTWILCD.js.map} +0 -0
  315. /package/dist/chunks/{chunk-HUONDMU4.js.map → chunk-G4R65ULE.js.map} +0 -0
  316. /package/dist/chunks/{chunk-C5XQHEYB.js.map → chunk-G7LMPHZE.js.map} +0 -0
  317. /package/dist/chunks/{chunk-XHLFI6F6.js.map → chunk-GD7VSTWZ.js.map} +0 -0
  318. /package/dist/chunks/{chunk-4FV2VZS6.js.map → chunk-GZNTRTD5.js.map} +0 -0
  319. /package/dist/chunks/{chunk-FEIIR46G.js.map → chunk-HFZLLEJS.js.map} +0 -0
  320. /package/dist/chunks/{chunk-WOSL3OZD.js.map → chunk-IW3XMMEN.js.map} +0 -0
  321. /package/dist/chunks/{chunk-DSKNFDTL.js.map → chunk-KXUKJLA2.js.map} +0 -0
  322. /package/dist/chunks/{chunk-EA73SWCT.js.map → chunk-L2AKMCV3.js.map} +0 -0
  323. /package/dist/chunks/{chunk-Z6J7SVOB.js.map → chunk-LC7SV2KM.js.map} +0 -0
  324. /package/dist/chunks/{chunk-J7SA5BCI.js.map → chunk-LOUV4VZ6.js.map} +0 -0
  325. /package/dist/chunks/{chunk-DI4L3GH5.js.map → chunk-LQJLTW2D.js.map} +0 -0
  326. /package/dist/chunks/{chunk-HTHNDZ3L.js.map → chunk-LRFRTQW7.js.map} +0 -0
  327. /package/dist/chunks/{chunk-EKMHZKVP.js.map → chunk-MDY2IMVQ.js.map} +0 -0
  328. /package/dist/chunks/{chunk-NTV2XD2J.js.map → chunk-MNMKHEMI.js.map} +0 -0
  329. /package/dist/chunks/{chunk-ZDZ35MMZ.js.map → chunk-MTY4XYDO.js.map} +0 -0
  330. /package/dist/chunks/{chunk-OAHCS42A.js.map → chunk-MZURZ6P4.js.map} +0 -0
  331. /package/dist/chunks/{chunk-6CFPN6I4.js.map → chunk-NFKSV6UI.js.map} +0 -0
  332. /package/dist/chunks/{chunk-TI6FFONP.js.map → chunk-NIRQFXO6.js.map} +0 -0
  333. /package/dist/chunks/{chunk-QPR3UA4L.js.map → chunk-NJWQUZF2.js.map} +0 -0
  334. /package/dist/chunks/{chunk-EKQ6J5KA.js.map → chunk-NRGGICBE.js.map} +0 -0
  335. /package/dist/chunks/{chunk-ZMKEYARZ.js.map → chunk-NW6VBCCU.js.map} +0 -0
  336. /package/dist/chunks/{chunk-UWN4WNQZ.js.map → chunk-ORCR5VST.js.map} +0 -0
  337. /package/dist/chunks/{chunk-TUXH7IXQ.js.map → chunk-P6OOW3RL.js.map} +0 -0
  338. /package/dist/chunks/{chunk-46VSU4QF.js.map → chunk-PXA27JGJ.js.map} +0 -0
  339. /package/dist/chunks/{chunk-SPSWX3QZ.js.map → chunk-PXJ2KPOI.js.map} +0 -0
  340. /package/dist/chunks/{chunk-VVWI4EB7.js.map → chunk-QE5PQM5T.js.map} +0 -0
  341. /package/dist/chunks/{chunk-SHUA4YUK.js.map → chunk-QIDU76IF.js.map} +0 -0
  342. /package/dist/chunks/{chunk-SB3A7KUJ.js.map → chunk-QP435RW7.js.map} +0 -0
  343. /package/dist/chunks/{chunk-FX7BSCB4.js.map → chunk-QPAWT3EG.js.map} +0 -0
  344. /package/dist/chunks/{chunk-BHOZPFJM.js.map → chunk-QTPZCVPP.js.map} +0 -0
  345. /package/dist/chunks/{chunk-CCYAWSZL.js.map → chunk-RFGMOXA6.js.map} +0 -0
  346. /package/dist/chunks/{chunk-N56NUKMT.js.map → chunk-RPXTYB22.js.map} +0 -0
  347. /package/dist/chunks/{chunk-X6SREM2V.js.map → chunk-RXUWYGFX.js.map} +0 -0
  348. /package/dist/chunks/{chunk-DIWEKTYK.js.map → chunk-S5R2E5TZ.js.map} +0 -0
  349. /package/dist/chunks/{chunk-DOFQWVBL.js.map → chunk-T3NIOUQJ.js.map} +0 -0
  350. /package/dist/chunks/{chunk-LMLJ7NS5.js.map → chunk-TMOEYXPR.js.map} +0 -0
  351. /package/dist/chunks/{chunk-PV65WQHD.js.map → chunk-UNO2ZRXA.js.map} +0 -0
  352. /package/dist/chunks/{chunk-ZZNHDQAD.js.map → chunk-UNZNPAW7.js.map} +0 -0
  353. /package/dist/chunks/{chunk-PYSZ7JTU.js.map → chunk-URIGGSIK.js.map} +0 -0
  354. /package/dist/chunks/{chunk-RJWPNAYL.js.map → chunk-UWYDZYCZ.js.map} +0 -0
  355. /package/dist/chunks/{chunk-P5E6ITP5.js.map → chunk-VG6RBHI4.js.map} +0 -0
  356. /package/dist/chunks/{chunk-A47ZNTW7.js.map → chunk-VV2EHZOG.js.map} +0 -0
  357. /package/dist/chunks/{chunk-VYLCV6W3.js.map → chunk-WY6KOPIY.js.map} +0 -0
  358. /package/dist/chunks/{chunk-HOKSVFIC.js.map → chunk-XFVVJAI3.js.map} +0 -0
  359. /package/dist/chunks/{chunk-MYVF3JRV.js.map → chunk-XKIV3H62.js.map} +0 -0
  360. /package/dist/chunks/{chunk-J3PHMXN4.js.map → chunk-XLDFNUCV.js.map} +0 -0
  361. /package/dist/chunks/{chunk-KAPCNFMC.js.map → chunk-XODDL7OV.js.map} +0 -0
  362. /package/dist/chunks/{chunk-DHS5CQNC.js.map → chunk-XTVF376M.js.map} +0 -0
  363. /package/dist/chunks/{chunk-PSLNHLZI.js.map → chunk-YLCMBXE3.js.map} +0 -0
  364. /package/dist/chunks/{chunk-P7FHJL3V.js.map → chunk-YNY6XL5T.js.map} +0 -0
  365. /package/dist/chunks/{chunk-KO2N6EIF.js.map → chunk-YVJVXTUS.js.map} +0 -0
  366. /package/dist/chunks/{cli-runtime-SVXU6U4V.js.map → cli-runtime-33Z22SZM.js.map} +0 -0
  367. /package/dist/chunks/{commands-A2E3OV7F.js.map → commands-DLREWCNK.js.map} +0 -0
  368. /package/dist/chunks/{cost-NA7APCZD.js.map → cost-MJOM52FI.js.map} +0 -0
  369. /package/dist/chunks/{crash-report-C6QXQJAK.js.map → crash-report-62LMID3V.js.map} +0 -0
  370. /package/dist/chunks/{dist-5SZ7VOLE.js.map → dist-HA6ABMIV.js.map} +0 -0
  371. /package/dist/chunks/{dist-GVGW7AZ2.js.map → dist-HWU5U4SQ.js.map} +0 -0
  372. /package/dist/chunks/{dist-HASAHQL3.js.map → dist-IL4H4QGY.js.map} +0 -0
  373. /package/dist/chunks/{dist-G4BSVJKY.js.map → dist-MTYIYUQU.js.map} +0 -0
  374. /package/dist/chunks/{dist-LBTLFSNF.js.map → dist-NUPNUHXB.js.map} +0 -0
  375. /package/dist/chunks/{dist-3PE5MOU6.js.map → dist-TCKNCSZO.js.map} +0 -0
  376. /package/dist/chunks/{dist-HYKH6P7F.js.map → dist-U7A47UOF.js.map} +0 -0
  377. /package/dist/chunks/{dist-6CHQ5OPZ.js.map → dist-XFBNYCQ7.js.map} +0 -0
  378. /package/dist/chunks/{doctor-Y5PQ2R7D.js.map → doctor-V5C6R5EN.js.map} +0 -0
  379. /package/dist/chunks/{drain-RG275P5J.js.map → drain-CS7XQ5B7.js.map} +0 -0
  380. /package/dist/chunks/{entry-BJY7UE6P.js.map → entry-HXLBVNDK.js.map} +0 -0
  381. /package/dist/chunks/{eval-GG2BH7CQ.js.map → eval-NRBZ4IWO.js.map} +0 -0
  382. /package/dist/chunks/{github-MGIA7MTZ.js.map → github-Z3JQNLXA.js.map} +0 -0
  383. /package/dist/chunks/{home-KMZDOTX5.js.map → home-GP3Y7F5H.js.map} +0 -0
  384. /package/dist/chunks/{host-OB5CL3GG.js.map → host-C5GIO57R.js.map} +0 -0
  385. /package/dist/chunks/{host-queries-2GQM7BTI.js.map → host-queries-F5Y3L7E4.js.map} +0 -0
  386. /package/dist/chunks/{learn-LUEHNOMA.js.map → learn-5FEP65D6.js.map} +0 -0
  387. /package/dist/chunks/{learn-builtin-R2Z27LDI.js.map → learn-builtin-HV3ASHAJ.js.map} +0 -0
  388. /package/dist/chunks/{lifecycle-DCLLAROM.js.map → lifecycle-TMZEWFWF.js.map} +0 -0
  389. /package/dist/chunks/{list-5UW5SFIX.js.map → list-MD6ZN2PW.js.map} +0 -0
  390. /package/dist/chunks/{live-YUE4AKRQ.js.map → live-OVTHCQB3.js.map} +0 -0
  391. /package/dist/chunks/{login-ELIGI6HT.js.map → load-ADBRLXAL.js.map} +0 -0
  392. /package/dist/chunks/{open-MDT2NTF4.js.map → login-RV3AHE4C.js.map} +0 -0
  393. /package/dist/chunks/{logs-PXASK6XI.js.map → logs-6SBW5BWD.js.map} +0 -0
  394. /package/dist/chunks/{mcp-YVV35X7H.js.map → mcp-3QDMZ7PD.js.map} +0 -0
  395. /package/dist/chunks/{output-schema-VR43KZNJ.js.map → open-K4R6E6QJ.js.map} +0 -0
  396. /package/dist/chunks/{operator-tools-LYY2FXSO.js.map → operator-tools-YX4575HD.js.map} +0 -0
  397. /package/dist/chunks/{peers-6M4UPHDF.js.map → output-schema-QBKJSX77.js.map} +0 -0
  398. /package/dist/chunks/{pal-YXOWNULV.js.map → pal-KLH2IC3W.js.map} +0 -0
  399. /package/dist/chunks/{peers-CJOTRI4W.js.map → peers-5BMGZLHY.js.map} +0 -0
  400. /package/dist/chunks/{providers-7WDY37V3.js.map → peers-6F4JS4VL.js.map} +0 -0
  401. /package/dist/chunks/{pty-CLDDZT5T.js.map → providers-YJVPCIRI.js.map} +0 -0
  402. /package/dist/chunks/{resume-ZRVTAGB6.js.map → pty-UMMMCRJW.js.map} +0 -0
  403. /package/dist/chunks/{resume-command-TXPTYQFF.js.map → resume-RKZ52FZP.js.map} +0 -0
  404. /package/dist/chunks/{running-KBISZDIQ.js.map → resume-command-H4IJJDLH.js.map} +0 -0
  405. /package/dist/chunks/{send-VUJ33MJM.js.map → running-UTOYIBXM.js.map} +0 -0
  406. /package/dist/chunks/{schedule-ECZVNZLH.js.map → schedule-KWX4SXS5.js.map} +0 -0
  407. /package/dist/chunks/{send-person-WXM7Y5PZ.js.map → send-UEL2L3VA.js.map} +0 -0
  408. /package/dist/chunks/{start-check-KECY75IO.js.map → send-person-X3SWXKWV.js.map} +0 -0
  409. /package/dist/chunks/{service-DORQ3PNE.js.map → service-4VS6XQ7O.js.map} +0 -0
  410. /package/dist/chunks/{store-7SFKBFX6.js.map → start-check-HTPENJ36.js.map} +0 -0
  411. /package/dist/chunks/{startup-failure-MS7TPUMI.js.map → startup-failure-LKAHWAYZ.js.map} +0 -0
  412. /package/dist/chunks/{state-YK5JWP5I.js.map → state-UQPKWIYT.js.map} +0 -0
  413. /package/dist/chunks/{store-H4IVAEZK.js.map → store-74PEEN6L.js.map} +0 -0
  414. /package/dist/chunks/{store-TM7VDQ5G.js.map → store-BY6HMUUN.js.map} +0 -0
  415. /package/dist/chunks/{store-XIPDR26B.js.map → store-MILGWYSA.js.map} +0 -0
  416. /package/dist/chunks/{upgrade-GLEEEZWO.js.map → upgrade-V5ST42EQ.js.map} +0 -0
  417. /package/dist/chunks/{workspaces-GS6D72XT.js.map → workspaces-2AL72WFH.js.map} +0 -0
@@ -0,0 +1,686 @@
1
+ import { createRequire as __namzuCreateRequire } from 'node:module';
2
+ const require = __namzuCreateRequire(import.meta.url);
3
+ import {
4
+ listMarkdownNames,
5
+ resolvePluginFileDirs
6
+ } from "./chunk-ZYSTDBP7.js";
7
+ import {
8
+ activeConversationTurn,
9
+ closeSessions,
10
+ forkConversationInto,
11
+ listRecent,
12
+ loadResumableConversation,
13
+ openSessions
14
+ } from "./chunk-XFVVJAI3.js";
15
+ import {
16
+ PluginSettingsStore,
17
+ dataDirOverlapsPlugin,
18
+ pluginDataDir,
19
+ readPluginHookEntriesOf
20
+ } from "./chunk-IOWYDR6H.js";
21
+ import {
22
+ isPathRuleTool,
23
+ pathRule,
24
+ pathRuleTools
25
+ } from "./chunk-DHWD5YYD.js";
26
+ import {
27
+ cliLogger
28
+ } from "./chunk-G4R65ULE.js";
29
+ import {
30
+ FileChangeHooks,
31
+ GitWorktreeDriver,
32
+ HookedWorkspaceDriver,
33
+ PluginLifecycleManager,
34
+ PluginRegistry,
35
+ SHELL_HOOKS_PLUGIN_ID,
36
+ SHELL_HOOK_EVENTS,
37
+ SessionHookEnv,
38
+ SkillRegistry,
39
+ asSessionId,
40
+ attachShellHooks,
41
+ createShellHook,
42
+ discoverAllPluginDirs,
43
+ fileChangedMatcherNote,
44
+ fileChangedMatcherPaths,
45
+ generateWorkspaceId,
46
+ resolveNamzuHome
47
+ } from "./chunk-C74LVDRC.js";
48
+ import {
49
+ __name
50
+ } from "./chunk-76FLAFCG.js";
51
+
52
+ // src/integrations/plugins/hook-activity.ts
53
+ var MAX_PENDING_NOTICES = 20;
54
+ function createSessionHookActivity(options) {
55
+ const listeners = /* @__PURE__ */ new Set();
56
+ const pending = [];
57
+ const notify = /* @__PURE__ */ __name((line) => {
58
+ cliLogger().warn("hook", { "namzu.hook.notice": line });
59
+ if (listeners.size === 0) {
60
+ if (pending.length < MAX_PENDING_NOTICES) pending.push(line);
61
+ return;
62
+ }
63
+ for (const listener of listeners) listener(line);
64
+ }, "notify");
65
+ const hookEnv = new SessionHookEnv({ onProblem: notify });
66
+ const entries = options.hooks?.file_changed ?? [];
67
+ const matcherPaths = entries.flatMap((entry) => fileChangedMatcherPaths(entry.matcher));
68
+ let manager = options.manager;
69
+ let files;
70
+ let closed = false;
71
+ const attach = /* @__PURE__ */ __name((given) => {
72
+ manager = given;
73
+ if (closed) return;
74
+ files = new FileChangeHooks({
75
+ manager: given,
76
+ cwd: options.cwd,
77
+ sessionId: options.sessionId,
78
+ matcherPaths,
79
+ onNotice: notify,
80
+ onProblem: notify
81
+ });
82
+ }, "attach");
83
+ if (manager !== void 0) attach(manager);
84
+ return {
85
+ variables: hookEnv.variables,
86
+ hookEnv,
87
+ attach,
88
+ absorbSessionStart: /* @__PURE__ */ __name((results) => files?.absorb(results), "absorbSessionStart"),
89
+ async changeDirectory(change) {
90
+ hookEnv.clearFolderLayers();
91
+ if (manager === void 0) return;
92
+ try {
93
+ const results = await manager.executeHooks("cwd_changed", {
94
+ sessionId: options.sessionId(),
95
+ oldCwd: change.from,
96
+ newCwd: change.to
97
+ });
98
+ files?.absorb(results);
99
+ } catch (error) {
100
+ notify(
101
+ `A cwd_changed hook could not run: ${error instanceof Error ? error.message : String(error)}.`
102
+ );
103
+ }
104
+ },
105
+ notify,
106
+ describe: /* @__PURE__ */ __name(() => ({
107
+ variables: hookEnv.describe(),
108
+ watching: files?.watching ?? [],
109
+ notes: entries.map((entry) => fileChangedMatcherNote(entry.matcher)).filter((note) => note !== void 0)
110
+ }), "describe"),
111
+ onNotice(listener) {
112
+ listeners.add(listener);
113
+ for (const line of pending.splice(0)) listener(line);
114
+ return () => {
115
+ listeners.delete(listener);
116
+ };
117
+ },
118
+ close() {
119
+ closed = true;
120
+ files?.close();
121
+ hookEnv.dispose();
122
+ listeners.clear();
123
+ }
124
+ };
125
+ }
126
+ __name(createSessionHookActivity, "createSessionHookActivity");
127
+
128
+ // src/integrations/plugins/hook-path-filter.ts
129
+ function createHookPathFilter(cwd) {
130
+ return (tool, pattern, callTool, toolInput) => {
131
+ if (!isPathRuleTool(tool)) return void 0;
132
+ if (!pathRuleTools(tool).includes(callTool)) return false;
133
+ const input = toolInput !== null && typeof toolInput === "object" ? toolInput : void 0;
134
+ const written = input?.path;
135
+ const searchTool = callTool === "grep" || callTool === "glob" || callTool === "ls";
136
+ if (!(typeof written === "string" && written !== "") && !searchTool) return void 0;
137
+ const rule = pathRule(tool, pattern, "ask", { cwd });
138
+ if (rule.type !== "predicate") return void 0;
139
+ try {
140
+ return rule.decide({
141
+ toolName: callTool,
142
+ toolInput,
143
+ toolDef: void 0,
144
+ commandDialect: "sh"
145
+ }) !== null;
146
+ } catch {
147
+ return void 0;
148
+ }
149
+ };
150
+ }
151
+ __name(createHookPathFilter, "createHookPathFilter");
152
+
153
+ // src/integrations/plugins/runtime.ts
154
+ var SESSION_END_HOOK_TIMEOUT_MS = 5e3;
155
+ var MAX_HOOK_TIMEOUT_MS = 10 * 6e4;
156
+ function sessionEndHookBudgetMs(hooks) {
157
+ let longest = 0;
158
+ for (const entry of hooks?.session_end ?? []) {
159
+ if ("async" in entry && entry.async === true) continue;
160
+ const own = entry.timeoutMs ?? SESSION_END_HOOK_TIMEOUT_MS;
161
+ longest = Math.max(longest, Math.min(MAX_HOOK_TIMEOUT_MS, Math.max(1, own)));
162
+ }
163
+ return longest;
164
+ }
165
+ __name(sessionEndHookBudgetMs, "sessionEndHookBudgetMs");
166
+ function hookTimeoutLine(info) {
167
+ const seconds = info.timeoutMs / 1e3;
168
+ return `The ${info.event} hook \`${info.hook}\` did not finish within ${seconds} second${seconds === 1 ? "" : "s"} and was ended.`;
169
+ }
170
+ __name(hookTimeoutLine, "hookTimeoutLine");
171
+ function message(error) {
172
+ return error instanceof Error ? error.message : String(error);
173
+ }
174
+ __name(message, "message");
175
+ async function createCliPluginRuntime(config, cwd, hooks, hookHost, host) {
176
+ const pluginsEnabled = config?.enabled === true;
177
+ const launchDirs = config?.launchDirs ?? [];
178
+ const hookCount = hooks ? Object.values(hooks).reduce((n, list) => n + (list?.length ?? 0), 0) : 0;
179
+ if (!pluginsEnabled && hookCount === 0 && launchDirs.length === 0 && host?.keepForSkills !== true) {
180
+ return void 0;
181
+ }
182
+ const log = cliLogger();
183
+ const userRoot = resolveNamzuHome();
184
+ const settings = new PluginSettingsStore(userRoot);
185
+ const plugins = new PluginRegistry();
186
+ const skills = new SkillRegistry(log);
187
+ const { sessionId: currentSession, ...shellHost } = hookHost ?? {};
188
+ const hookActivity = createSessionHookActivity({
189
+ hooks,
190
+ cwd,
191
+ sessionId: currentSession ?? (() => "")
192
+ });
193
+ const shellOptions = {
194
+ hookEnv: hookActivity.hookEnv,
195
+ cwd,
196
+ // The folder the session was started for, for a hook script to find its own files.
197
+ projectDir: cwd,
198
+ pathFilter: createHookPathFilter(cwd),
199
+ log,
200
+ defaultTimeoutMs: { session_end: SESSION_END_HOOK_TIMEOUT_MS },
201
+ // Only the close of a session says so out loud: it is the one place
202
+ // a person is left waiting with nothing on screen to explain it.
203
+ onTimeout: /* @__PURE__ */ __name((info) => {
204
+ if (info.event === "session_end") process.stderr.write(`${hookTimeoutLine(info)}
205
+ `);
206
+ }, "onTimeout"),
207
+ ...shellHost
208
+ };
209
+ const shipped = /* @__PURE__ */ new Map();
210
+ const warningLines = [];
211
+ const hooksSwitch = host?.hooksSwitch;
212
+ const manager = new PluginLifecycleManager({
213
+ pluginRegistry: plugins,
214
+ skillRegistry: skills,
215
+ scopeRoots: { project: cwd, user: userRoot },
216
+ log,
217
+ ...config?.hookTimeoutMs !== void 0 ? { hookTimeoutMs: config.hookTimeoutMs } : {},
218
+ hooksFor: /* @__PURE__ */ __name((plugin) => {
219
+ const read = readPluginHookEntriesOf(plugin);
220
+ const name = plugin.manifest.name;
221
+ const dataDir = pluginDataDir(userRoot, {
222
+ name,
223
+ scope: plugin.scope,
224
+ rootDir: plugin.rootDir
225
+ });
226
+ const problems = [...read.problems];
227
+ let usable = true;
228
+ if (read.count > 0 && dataDirOverlapsPlugin(dataDir, plugin.rootDir)) {
229
+ usable = false;
230
+ problems.push({
231
+ severity: "problem",
232
+ code: "hook-entries-invalid",
233
+ file: name,
234
+ message: `its data folder ${dataDir} would overlap the plugin's own folder, so its hook entries are not attached.`
235
+ });
236
+ }
237
+ const entries = SHELL_HOOK_EVENTS.flatMap(
238
+ (event) => (read.hooks[event] ?? []).map((entry) => ({ event, entry }))
239
+ );
240
+ shipped.set(plugin.id, {
241
+ name,
242
+ entries,
243
+ problems,
244
+ ...hooksSwitch !== void 0 ? { off: hooksSwitch } : {}
245
+ });
246
+ for (const problem of problems) {
247
+ warningLines.push(
248
+ `${problem.severity === "problem" ? "Hook problem" : "Hook note"} in plugin ${name}, ${problem.file}: ${problem.message}`
249
+ );
250
+ }
251
+ if (hooksSwitch !== void 0 || !usable) return [];
252
+ const options = {
253
+ ...shellOptions,
254
+ plugin: { root: plugin.rootDir, dataDir }
255
+ };
256
+ return entries.map(
257
+ ({ event, entry }) => createShellHook(event, entry, options)
258
+ );
259
+ }, "hooksFor")
260
+ });
261
+ hookActivity.attach(manager);
262
+ if (hooks && hookCount > 0) attachShellHooks(manager, hooks, shellOptions);
263
+ const allowedScopes = config?.allowedScopes ?? ["project", "user"];
264
+ const discovered = pluginsEnabled ? await discoverAllPluginDirs(cwd, {
265
+ enabled: true,
266
+ autoDiscovery: config?.autoDiscovery ?? true,
267
+ allowedScopes,
268
+ userRoot,
269
+ log
270
+ }) : { project: [], user: [] };
271
+ const installed = [];
272
+ try {
273
+ for (const scope of allowedScopes) {
274
+ const dirs = [...discovered[scope]].sort((a, b) => a.localeCompare(b));
275
+ for (const dir of dirs) {
276
+ const plugin = await manager.install(dir, scope);
277
+ installed.push(plugin);
278
+ const enabled = settings.read({ rootDir: plugin.rootDir, name: plugin.manifest.name });
279
+ if (enabled) await manager.enable(plugin.id);
280
+ }
281
+ }
282
+ for (const dir of launchDirs) {
283
+ const plugin = await manager.install(dir, "user", { authorityRoot: dir });
284
+ installed.push(plugin);
285
+ const enabled = settings.read({ rootDir: plugin.rootDir, name: plugin.manifest.name });
286
+ if (enabled) await manager.enable(plugin.id);
287
+ }
288
+ } catch (error) {
289
+ const cleanupErrors = [];
290
+ for (const plugin of [...installed].reverse()) {
291
+ try {
292
+ await manager.uninstall(plugin.id);
293
+ } catch (cleanupError) {
294
+ cleanupErrors.push(cleanupError);
295
+ }
296
+ }
297
+ const cleanupSuffix = cleanupErrors.length === 0 ? "" : ` Cleanup also failed: ${cleanupErrors.map(message).join("; ")}`;
298
+ throw new Error(`Plugin runtime could not start: ${message(error)}.${cleanupSuffix}`, {
299
+ cause: error
300
+ });
301
+ }
302
+ let closePromise;
303
+ let closed = false;
304
+ let mutation;
305
+ const contributedToolNames = /* @__PURE__ */ __name((prefix) => manager.toolsets.flatMap((ts) => ts.tools()).map((tool) => tool.name).filter((name) => name.startsWith(prefix)).sort(), "contributedToolNames");
306
+ return {
307
+ manager,
308
+ hookOptions: shellOptions,
309
+ skills,
310
+ pluginCount: installed.length,
311
+ sessionEndBudgetMs: sessionEndHookBudgetMs(hooks),
312
+ hookActivity,
313
+ pluginHookEntries: /* @__PURE__ */ __name(() => plugins.getAll().filter((plugin) => plugin.status === "enabled").flatMap((plugin) => {
314
+ const state = shipped.get(plugin.id);
315
+ return (state?.entries ?? []).map(({ event, entry }) => ({
316
+ plugin: state?.name ?? plugin.manifest.name,
317
+ event,
318
+ entry,
319
+ ...state?.off !== void 0 ? { off: state.off } : {}
320
+ }));
321
+ }), "pluginHookEntries"),
322
+ pluginHookProblems: /* @__PURE__ */ __name(() => plugins.getAll().filter((plugin) => plugin.status === "enabled").flatMap(
323
+ (plugin) => (shipped.get(plugin.id)?.problems ?? []).map((problem) => ({
324
+ ...problem,
325
+ plugin: plugin.manifest.name
326
+ }))
327
+ ), "pluginHookProblems"),
328
+ takePluginHookWarnings: /* @__PURE__ */ __name(() => warningLines.splice(0), "takePluginHookWarnings"),
329
+ pluginHooks: /* @__PURE__ */ __name(() => manager.listHooks().filter((hook) => hook.pluginId !== SHELL_HOOKS_PLUGIN_ID && hook.shell !== true).map((hook) => ({
330
+ plugin: plugins.get(hook.pluginId)?.manifest.name ?? String(hook.pluginId),
331
+ event: hook.event
332
+ })), "pluginHooks"),
333
+ list: /* @__PURE__ */ __name(() => plugins.getAll().map((plugin) => {
334
+ const prefix = `${plugin.manifest.name}__`;
335
+ let startupEnabled;
336
+ let startupError;
337
+ try {
338
+ startupEnabled = settings.read({ rootDir: plugin.rootDir, name: plugin.manifest.name });
339
+ } catch (error) {
340
+ startupError = message(error);
341
+ }
342
+ return {
343
+ name: plugin.manifest.name,
344
+ version: plugin.manifest.version,
345
+ description: plugin.manifest.description,
346
+ scope: plugin.scope,
347
+ rootDir: plugin.rootDir,
348
+ status: plugin.status === "installed" ? "disabled" : plugin.status,
349
+ ...startupEnabled !== void 0 ? { startupEnabled } : {},
350
+ ...startupError ? { startupError } : {},
351
+ tools: contributedToolNames(prefix),
352
+ skills: skills.list().map((skill) => skill.metadata.name).filter((name) => name.startsWith(prefix)).sort(),
353
+ hookModules: (plugin.manifest.hooks ?? []).filter(
354
+ (path) => !path.toLowerCase().endsWith(".json")
355
+ ),
356
+ hookEntries: readPluginHookEntriesOf(plugin).count,
357
+ mcpServers: (plugin.manifest.mcpServers ?? []).map((server) => server.name),
358
+ commands: resolvePluginFileDirs(
359
+ plugin.manifest.name,
360
+ plugin.rootDir,
361
+ plugin.manifest.commands
362
+ ).dirs.flatMap(
363
+ (source) => listMarkdownNames(source.dir).map((file) => `${prefix}${file}`)
364
+ ),
365
+ agents: resolvePluginFileDirs(
366
+ plugin.manifest.name,
367
+ plugin.rootDir,
368
+ plugin.manifest.agents
369
+ ).dirs.flatMap(
370
+ (source) => listMarkdownNames(source.dir).map((file) => `${prefix}${file}`)
371
+ )
372
+ };
373
+ }).sort((a, b) => a.name.localeCompare(b.name)), "list"),
374
+ async setEnabled(name, enabled) {
375
+ if (closed) throw new Error("Plugin runtime is closed.");
376
+ if (mutation) throw new Error("Another plugin change is in progress.");
377
+ const plugin = plugins.findByName(name);
378
+ if (!plugin) throw new Error(`Plugin "${name}" is not loaded in this session.`);
379
+ if (enabled && plugin.status === "enabled" || !enabled && (plugin.status === "disabled" || plugin.status === "installed"))
380
+ return;
381
+ mutation = enabled ? manager.enable(plugin.id) : manager.disable(plugin.id);
382
+ try {
383
+ await mutation;
384
+ } finally {
385
+ mutation = void 0;
386
+ }
387
+ },
388
+ async rememberState(name) {
389
+ if (closed) throw new Error("Plugin runtime is closed.");
390
+ if (mutation) throw new Error("Another plugin change is in progress.");
391
+ const plugin = plugins.findByName(name);
392
+ if (!plugin) throw new Error(`Plugin "${name}" is not loaded in this session.`);
393
+ if (!["enabled", "disabled", "installed"].includes(plugin.status)) {
394
+ throw new Error("Resolve the plugin error before remembering its state.");
395
+ }
396
+ const enabled = plugin.status === "enabled";
397
+ settings.write({ rootDir: plugin.rootDir, name }, enabled);
398
+ },
399
+ close() {
400
+ if (closePromise) return closePromise;
401
+ closed = true;
402
+ closePromise = (async () => {
403
+ hookActivity.close();
404
+ if (mutation) await mutation.catch(() => {
405
+ });
406
+ const errors = [];
407
+ for (const plugin of [...installed].reverse()) {
408
+ try {
409
+ await manager.uninstall(plugin.id);
410
+ } catch (error) {
411
+ errors.push(error);
412
+ }
413
+ }
414
+ if (errors.length > 0) {
415
+ throw new AggregateError(errors, "One or more plugins could not be uninstalled.");
416
+ }
417
+ })();
418
+ return closePromise;
419
+ }
420
+ };
421
+ }
422
+ __name(createCliPluginRuntime, "createCliPluginRuntime");
423
+
424
+ // src/integrations/worktrees/managed.ts
425
+ import { execFile } from "node:child_process";
426
+ import { randomUUID } from "node:crypto";
427
+ import { lstat, mkdir, readdir, realpath, rmdir } from "node:fs/promises";
428
+ import { join, resolve } from "node:path";
429
+ import { promisify } from "node:util";
430
+ var runFile = promisify(execFile);
431
+ var HOOK_MADE_BRANCH = "(made by a worktree_create hook)";
432
+ function worktreeOpenHint(path, conversationId) {
433
+ const quoted = process.platform === "win32" ? `'${path.replaceAll("'", "''")}'` : `'${path.replaceAll("'", "'\\''")}'`;
434
+ const launch = `namzu${conversationId ? ` resume ${conversationId}` : ""}`;
435
+ return process.platform === "win32" ? `Set-Location -LiteralPath ${quoted}; if ($?) { ${launch} }` : `cd ${quoted} && ${launch}`;
436
+ }
437
+ __name(worktreeOpenHint, "worktreeOpenHint");
438
+ function checkedLabel(value) {
439
+ if (!/^[a-z0-9][a-z0-9-]{0,63}$/.test(value)) {
440
+ throw new Error("A worktree name must use 1\u201364 lowercase letters, digits or hyphens.");
441
+ }
442
+ return value;
443
+ }
444
+ __name(checkedLabel, "checkedLabel");
445
+ async function git(cwd, ...args) {
446
+ const { stdout } = await runFile("git", ["-C", cwd, ...args]);
447
+ return stdout;
448
+ }
449
+ __name(git, "git");
450
+ async function openManagedWorktrees(cwd, options = {}) {
451
+ const directory = await realpath(resolve(cwd));
452
+ let sourceRoot;
453
+ let repoRoot;
454
+ let notGit;
455
+ try {
456
+ sourceRoot = await realpath((await git(directory, "rev-parse", "--show-toplevel")).trim());
457
+ const listing = await git(directory, "worktree", "list", "--porcelain", "-z");
458
+ const first = listing.split("\0", 1)[0];
459
+ if (!first?.startsWith("worktree ")) throw new Error("Git did not report a main checkout.");
460
+ repoRoot = await realpath(first.slice("worktree ".length));
461
+ const sourceCommon = await realpath(
462
+ (await git(sourceRoot, "rev-parse", "--path-format=absolute", "--git-common-dir")).trim()
463
+ );
464
+ const mainCommon = await realpath(
465
+ (await git(repoRoot, "rev-parse", "--path-format=absolute", "--git-common-dir")).trim()
466
+ );
467
+ if (sourceCommon !== mainCommon)
468
+ throw new Error("The selected checkout belongs to another repository.");
469
+ } catch (cause) {
470
+ const failure = new Error(
471
+ `Cannot manage worktrees here: ${cause instanceof Error ? cause.message : String(cause)}`
472
+ );
473
+ if (options.hooks === void 0) throw failure;
474
+ notGit = failure;
475
+ sourceRoot = directory;
476
+ repoRoot = directory;
477
+ }
478
+ const sessions = await openSessions(repoRoot, options);
479
+ const worktreesDir = sessions.paths.worktrees();
480
+ closeSessions(sessions);
481
+ try {
482
+ const node = await lstat(worktreesDir);
483
+ if (!node.isDirectory()) throw new Error("The managed worktree path is not a directory.");
484
+ } catch (cause) {
485
+ if (cause.code !== "ENOENT") throw cause;
486
+ }
487
+ const kernel = notGit === void 0 ? new GitWorktreeDriver({ repoRoot, worktreesDir, logger: cliLogger() }) : withoutGit(notGit);
488
+ return new ManagedWorktrees(
489
+ repoRoot,
490
+ sourceRoot,
491
+ worktreesDir,
492
+ new HookedWorkspaceDriver({
493
+ inner: kernel,
494
+ hooks: options.hooks ?? (() => void 0),
495
+ root: /* @__PURE__ */ __name(() => worktreesDir, "root"),
496
+ repoRoot: /* @__PURE__ */ __name(() => repoRoot, "repoRoot"),
497
+ ...options.onNotice ? { onNotice: options.onNotice } : {}
498
+ }),
499
+ options,
500
+ notGit === void 0
501
+ );
502
+ }
503
+ __name(openManagedWorktrees, "openManagedWorktrees");
504
+ function withoutGit(failure) {
505
+ const refuse = /* @__PURE__ */ __name(async () => {
506
+ throw failure;
507
+ }, "refuse");
508
+ return {
509
+ kind: "git-worktree",
510
+ create: refuse,
511
+ branch: refuse,
512
+ dispose: refuse,
513
+ inspect: refuse
514
+ };
515
+ }
516
+ __name(withoutGit, "withoutGit");
517
+ var ManagedWorktrees = class {
518
+ constructor(repoRoot, sourceRoot, worktreesDir, driver, options, isGit = true) {
519
+ this.repoRoot = repoRoot;
520
+ this.sourceRoot = sourceRoot;
521
+ this.worktreesDir = worktreesDir;
522
+ this.driver = driver;
523
+ this.options = options;
524
+ this.isGit = isGit;
525
+ }
526
+ repoRoot;
527
+ sourceRoot;
528
+ worktreesDir;
529
+ driver;
530
+ options;
531
+ isGit;
532
+ static {
533
+ __name(this, "ManagedWorktrees");
534
+ }
535
+ /** The driver that makes and removes worktrees: hooks first, the kernel's Git logic otherwise. */
536
+ get workspaceDriver() {
537
+ return this.driver;
538
+ }
539
+ ref(label) {
540
+ const checked = checkedLabel(label);
541
+ return {
542
+ id: generateWorkspaceId(),
543
+ meta: {
544
+ backend: "git-worktree",
545
+ repoRoot: this.repoRoot,
546
+ branch: `namzu/${checked}`,
547
+ worktreePath: join(this.worktreesDir, checked)
548
+ },
549
+ createdAt: /* @__PURE__ */ new Date()
550
+ };
551
+ }
552
+ /** Registered Namzu-owned checkouts only; arbitrary folders are omitted. */
553
+ async list() {
554
+ let entries;
555
+ try {
556
+ entries = await readdir(this.worktreesDir, {
557
+ withFileTypes: true,
558
+ encoding: "utf8"
559
+ });
560
+ } catch (cause) {
561
+ if (cause.code === "ENOENT") return [];
562
+ throw cause;
563
+ }
564
+ const found = [];
565
+ for (const entry of entries) {
566
+ if (!entry.isDirectory()) continue;
567
+ if (!/^[a-z0-9][a-z0-9-]{0,63}$/.test(entry.name)) continue;
568
+ try {
569
+ const worktree = await this.inspect(entry.name);
570
+ if (worktree) found.push(worktree);
571
+ } catch {
572
+ }
573
+ }
574
+ return found.sort((a, b) => a.label.localeCompare(b.label));
575
+ }
576
+ /** An exact label must still pass the SDK driver's ownership and Git registration checks. */
577
+ async inspect(label) {
578
+ const ref = this.ref(label);
579
+ const inspection = await this.driver.inspect(ref);
580
+ return inspection.exists ? {
581
+ label,
582
+ path: ref.meta.worktreePath,
583
+ branch: ref.meta.branch,
584
+ dirty: inspection.isDirty
585
+ } : null;
586
+ }
587
+ /** Create at the selected checkout's committed HEAD, leaving its dirty files in place. */
588
+ async create(label) {
589
+ const name = checkedLabel(label ?? `work-${randomUUID().slice(0, 8)}`);
590
+ const sourceDirty = this.isGit ? (await git(this.sourceRoot, "status", "--porcelain")).trim().length > 0 : false;
591
+ const head = this.isGit ? (await git(this.sourceRoot, "rev-parse", "HEAD")).trim() : void 0;
592
+ await mkdir(this.worktreesDir, { recursive: true, mode: 448 });
593
+ const lockPath = join(this.worktreesDir, `.${name}.creating`);
594
+ try {
595
+ await mkdir(lockPath);
596
+ } catch (cause) {
597
+ if (cause.code === "EEXIST") {
598
+ throw new Error(`Worktree ${name} is already being created. Try another name.`);
599
+ }
600
+ throw cause;
601
+ }
602
+ try {
603
+ if (this.isGit && await this.inspect(name)) {
604
+ throw new Error(`Worktree ${name} already exists.`);
605
+ }
606
+ const ref = await this.driver.create({
607
+ label: name,
608
+ ...head !== void 0 ? { baseRef: head } : {}
609
+ });
610
+ const inspection = await this.driver.inspect(ref);
611
+ if (!inspection.exists) {
612
+ throw new Error(
613
+ ref.meta.hookOwned === true ? `A worktree_create hook gave ${ref.meta.worktreePath}, which is not a folder that exists.` : `Git reported a worktree at ${ref.meta.worktreePath}, but it is not registered.`
614
+ );
615
+ }
616
+ return {
617
+ label: name,
618
+ path: ref.meta.worktreePath,
619
+ branch: ref.meta.hookOwned === true ? HOOK_MADE_BRANCH : ref.meta.branch,
620
+ madeByHook: ref.meta.hookOwned === true,
621
+ dirty: inspection.isDirty,
622
+ sourceDirty
623
+ };
624
+ } finally {
625
+ await rmdir(lockPath);
626
+ }
627
+ }
628
+ /** Fork the source checkout's settled conversation into the new checkout's Project. */
629
+ async fork(sourceConversationId, label) {
630
+ const source = await openSessions(this.sourceRoot, this.options);
631
+ try {
632
+ const sourceId = asSessionId(sourceConversationId);
633
+ const messages = await loadResumableConversation(source, sourceId);
634
+ if (messages.length === 0) {
635
+ throw new Error("There is nothing to fork yet \u2014 this conversation has no messages.");
636
+ }
637
+ if (await activeConversationTurn(source, sourceId)) {
638
+ throw new Error("Wait for the current turn to finish before forking to a worktree.");
639
+ }
640
+ const created = await this.create(label);
641
+ try {
642
+ const target = await openSessions(created.path, this.options);
643
+ try {
644
+ const forked = await forkConversationInto(source, target, sourceId);
645
+ return {
646
+ ...created,
647
+ conversationId: forked.id,
648
+ title: forked.title,
649
+ copied: forked.copied
650
+ };
651
+ } finally {
652
+ closeSessions(target);
653
+ }
654
+ } catch (cause) {
655
+ throw new Error(
656
+ `Worktree ${created.path} was created, but its conversation copy failed: ${cause instanceof Error ? cause.message : String(cause)}. The worktree was kept for inspection.`
657
+ );
658
+ }
659
+ } finally {
660
+ closeSessions(source);
661
+ }
662
+ }
663
+ /** Resolve an owned checkout and one of its own conversations for a fresh TUI launch. */
664
+ async resume(label, conversationId) {
665
+ const worktree = await this.inspect(label);
666
+ if (!worktree) throw new Error(`No managed worktree named ${label} is registered here.`);
667
+ const sessions = await openSessions(worktree.path, this.options);
668
+ try {
669
+ if (conversationId) {
670
+ await loadResumableConversation(sessions, conversationId);
671
+ return { worktree, conversationId };
672
+ }
673
+ const latest = (await listRecent(sessions, 1))[0];
674
+ return latest ? { worktree, conversationId: latest.id, title: latest.title } : { worktree };
675
+ } finally {
676
+ closeSessions(sessions);
677
+ }
678
+ }
679
+ };
680
+
681
+ export {
682
+ createCliPluginRuntime,
683
+ worktreeOpenHint,
684
+ openManagedWorktrees
685
+ };
686
+ //# sourceMappingURL=chunk-RVXJ5MYA.js.map