@moberg_hr/work-tree 2.22.3 → 2.22.4

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 (239) hide show
  1. package/dist/{account-XM6AGLTP.js → account-J55P3HXH.js} +16 -16
  2. package/dist/{add-repo-Q2QRLPCY.js → add-repo-ALVEGU25.js} +9 -9
  3. package/dist/{answer-EN2SUUMI.js → answer-CI2SPQQL.js} +7 -7
  4. package/dist/{attach-WYSTXYA7.js → attach-7LBIFBLX.js} +14 -14
  5. package/dist/bin.js +2 -2
  6. package/dist/{block-O5XC4JSQ.js → block-TVIYWRJ5.js} +9 -9
  7. package/dist/{broadcast-MT77AQG5.js → broadcast-GZNMZFOY.js} +5 -5
  8. package/dist/{catchup-WNXY4QRC.js → catchup-ZURJI6BF.js} +10 -10
  9. package/dist/{child-4OQQ4RMP.js → child-K6YYF6MQ.js} +6 -6
  10. package/dist/{chunk-MHKDX7CD.js → chunk-23QLXVH6.js} +9 -9
  11. package/dist/{chunk-OHX7WKZU.js → chunk-4QMWNAEJ.js} +2 -2
  12. package/dist/{chunk-MD4G7DIO.js → chunk-5FIUVBUC.js} +5 -5
  13. package/dist/{chunk-XZF526OU.js → chunk-5P27YL64.js} +7 -7
  14. package/dist/{chunk-RDRQDE6J.js → chunk-6Y3VLCKA.js} +3 -3
  15. package/dist/{chunk-B4VQXZV4.js → chunk-7Q5PBXF6.js} +3 -3
  16. package/dist/{chunk-ZWD3QJLP.js → chunk-7ZOY2QQN.js} +2 -2
  17. package/dist/{chunk-VPFWY2GG.js → chunk-AITL3JYB.js} +2 -2
  18. package/dist/{chunk-SLA7CB3C.js → chunk-AIYZJ7XD.js} +4 -4
  19. package/dist/{chunk-VT6FJG3P.js → chunk-ATQB6PTV.js} +2 -2
  20. package/dist/{chunk-EXNRUU7Z.js → chunk-B2WV5RAL.js} +4 -4
  21. package/dist/{chunk-LVRV5UED.js → chunk-CA56ETYX.js} +4 -4
  22. package/dist/{chunk-MRMFJQZI.js → chunk-CMRTNTMU.js} +5 -5
  23. package/dist/{chunk-66OWGZAF.js → chunk-D2SVBU7R.js} +2 -2
  24. package/dist/{chunk-HF3ZGAW7.js → chunk-DC73NF67.js} +3 -3
  25. package/dist/{chunk-Z52GYYGA.js → chunk-DCENKA6E.js} +2 -2
  26. package/dist/{chunk-ORBZDEPN.js → chunk-DF4GOVDE.js} +2 -2
  27. package/dist/{chunk-R4DGGYME.js → chunk-EA4C6TVY.js} +3 -3
  28. package/dist/{chunk-YQSWVHKK.js → chunk-ED6YLB4S.js} +13 -13
  29. package/dist/chunk-ED6YLB4S.js.map +1 -0
  30. package/dist/{chunk-JBQOBCH4.js → chunk-EEHPZMS3.js} +2 -2
  31. package/dist/{chunk-JATQW6OX.js → chunk-EYJ42LDG.js} +4 -4
  32. package/dist/{chunk-TZ4BIOMS.js → chunk-F4UIKOU6.js} +4 -4
  33. package/dist/{chunk-HF4VUIGE.js → chunk-FGBLFF4O.js} +2 -2
  34. package/dist/{chunk-QAAYE6IY.js → chunk-FV7BSQPQ.js} +2 -2
  35. package/dist/{chunk-ZU36UJVG.js → chunk-G4T2HGLJ.js} +4 -4
  36. package/dist/{chunk-YYFYCOGY.js → chunk-GNERWNZY.js} +3 -3
  37. package/dist/{chunk-VRMALBZK.js → chunk-GQ5WECPJ.js} +2 -2
  38. package/dist/{chunk-7TAPYCLF.js → chunk-HUW27DSB.js} +57 -57
  39. package/dist/{chunk-WANJYVUP.js → chunk-IU6LA6EB.js} +3 -3
  40. package/dist/{chunk-QWD76K3E.js → chunk-KQMHGEI2.js} +805 -739
  41. package/dist/chunk-KQMHGEI2.js.map +1 -0
  42. package/dist/{chunk-EH4H2I72.js → chunk-KU3TQAA7.js} +3 -3
  43. package/dist/{chunk-WFKL2SJ3.js → chunk-LV5JRLBM.js} +2 -2
  44. package/dist/{chunk-RE6WWXD6.js → chunk-NOQA7MJ4.js} +2 -2
  45. package/dist/{chunk-I6GXPPEH.js → chunk-NYGKSOQ4.js} +6 -6
  46. package/dist/{chunk-GGBFSQEX.js → chunk-OCUUM755.js} +2 -2
  47. package/dist/{chunk-XYDGDIGZ.js → chunk-PUJSLL6R.js} +5 -5
  48. package/dist/{chunk-T4Y2Z6HB.js → chunk-Q2B3NUSM.js} +3 -3
  49. package/dist/{chunk-VOHPXD2P.js → chunk-QNOJOZYK.js} +2 -2
  50. package/dist/{chunk-WDKHEFR6.js → chunk-QOLHDDM2.js} +4 -4
  51. package/dist/{chunk-KSG6RRGI.js → chunk-RLPC3YKZ.js} +2 -2
  52. package/dist/{chunk-5C6N447O.js → chunk-RNPNBGVX.js} +2 -2
  53. package/dist/{chunk-GRHVKD2K.js → chunk-RTCTD5PJ.js} +3 -3
  54. package/dist/{chunk-5TW5NKYZ.js → chunk-SDYY5MHW.js} +6 -6
  55. package/dist/chunk-TDJVYUF2.js +9 -0
  56. package/dist/{chunk-4VM6GMMI.js → chunk-TOMDOA4P.js} +2 -2
  57. package/dist/{chunk-NHDZ3ECC.js → chunk-UAF2YFLZ.js} +6 -6
  58. package/dist/{chunk-DLV7TRON.js → chunk-USENBMUV.js} +2 -2
  59. package/dist/{chunk-J4CEJOSI.js → chunk-WRDULHAN.js} +14 -11
  60. package/dist/chunk-WRDULHAN.js.map +1 -0
  61. package/dist/{chunk-OOFCBN43.js → chunk-YO3BNAAK.js} +4 -4
  62. package/dist/{chunk-P3QIN44Y.js → chunk-Z4FWXDJG.js} +3 -3
  63. package/dist/{chunk-E5N4CJDI.js → chunk-Z4P23XG3.js} +4 -4
  64. package/dist/{chunk-4AAFXLXN.js → chunk-ZO7TF5OL.js} +3 -3
  65. package/dist/{chunk-RFE3HK2L.js → chunk-ZTWZS5RK.js} +3 -3
  66. package/dist/{cleanup-OZFN7I2N.js → cleanup-G4WQACD6.js} +26 -26
  67. package/dist/{cli-RA5CKMTR.js → cli-XI2W5KRQ.js} +3 -3
  68. package/dist/{color-47LQGPVK.js → color-C223W3Z6.js} +7 -7
  69. package/dist/{config-U7RPODOW.js → config-KQYXQCQA.js} +7 -7
  70. package/dist/{coordinate-UO432TPP.js → coordinate-4E5GIMC6.js} +7 -7
  71. package/dist/{diff-TXGP7XHY.js → diff-HEOLTXO2.js} +8 -8
  72. package/dist/{digest-OEU7P5GQ.js → digest-GYF4YLUH.js} +7 -7
  73. package/dist/{fork-PBSBRV6J.js → fork-B35ONP3Z.js} +23 -23
  74. package/dist/{history-WF7Z54MS.js → history-25DNQKKC.js} +5 -5
  75. package/dist/{hook-7INHBIR6.js → hook-B4JO2X57.js} +8 -8
  76. package/dist/{hydrate-RRASKNTO.js → hydrate-IJEKNZIP.js} +5 -5
  77. package/dist/{init-BPQTPNQ4.js → init-UJVOUDJI.js} +9 -9
  78. package/dist/{install-skills-KSLTHRHH.js → install-skills-FV2L5QHE.js} +5 -5
  79. package/dist/install-skills-bin.js +4 -4
  80. package/dist/{keep-G4WED2HV.js → keep-PKXGFZO2.js} +7 -7
  81. package/dist/{list-XVLFF6AY.js → list-VYQ3QE2H.js} +5 -5
  82. package/dist/{move-UXB5XDIY.js → move-IAZY23ZX.js} +12 -12
  83. package/dist/{note-3JZISZMY.js → note-6HQUKUYY.js} +7 -7
  84. package/dist/{overlaps-5VSNWHEA.js → overlaps-CGP3RJOW.js} +10 -10
  85. package/dist/{pin-QJZZZETK.js → pin-PAWGQ4Q2.js} +7 -7
  86. package/dist/{pr-P5JHMUIS.js → pr-OJOGE3A3.js} +17 -17
  87. package/dist/{prune-7VM47E6R.js → prune-42MS36OR.js} +24 -24
  88. package/dist/{pty-host-VOE63H3Q.js → pty-host-ULVOMW3R.js} +12 -12
  89. package/dist/{read-Y75YWFMD.js → read-ATNCW4KH.js} +7 -7
  90. package/dist/{recent-O67MPZAU.js → recent-MTBFQT36.js} +15 -13
  91. package/dist/recent-MTBFQT36.js.map +1 -0
  92. package/dist/{remove-L7UKL4HS.js → remove-GLDJOKUI.js} +25 -25
  93. package/dist/{report-F2ASNP5G.js → report-AK7Z2Y4S.js} +6 -6
  94. package/dist/{restart-QJPCIHLM.js → restart-DEPDGEZB.js} +7 -7
  95. package/dist/{resume-6GHK46FG.js → resume-C2QPKKFN.js} +15 -13
  96. package/dist/resume-C2QPKKFN.js.map +1 -0
  97. package/dist/{review-XUWVO4XU.js → review-RYAGH3PY.js} +6 -6
  98. package/dist/{run-XHU4OPHL.js → run-WNP2SMNW.js} +5 -5
  99. package/dist/{screen-BE5IFYMV.js → screen-P746M4F2.js} +7 -7
  100. package/dist/{search-AHBK3Q6S.js → search-XQ2WMK5X.js} +5 -5
  101. package/dist/{section-VHRFW7OS.js → section-Q7TPOV7U.js} +7 -7
  102. package/dist/{send-QN56VR4Q.js → send-EGG23J2B.js} +8 -8
  103. package/dist/{sessions-36NA666U.js → sessions-2NNCWIND.js} +21 -21
  104. package/dist/{show-5YRGL7E2.js → show-KSMC7AJL.js} +6 -6
  105. package/dist/{snooze-YQAIVXJ3.js → snooze-4LVYUQEX.js} +7 -7
  106. package/dist/{start-RYQVC4AV.js → start-YKLLXW3L.js} +7 -7
  107. package/dist/{status-IJARRSRU.js → status-4HGP4ZEF.js} +8 -8
  108. package/dist/{stop-XUYL3ICW.js → stop-YBQL6NFF.js} +7 -7
  109. package/dist/{sync-ZGU3G5OD.js → sync-DUXN2MFJ.js} +24 -24
  110. package/dist/{time-AQ3HEFPA.js → time-Q42HPZZ3.js} +8 -8
  111. package/dist/{timesheet-DM2YY3ZP.js → timesheet-YJ6O3GUU.js} +10 -10
  112. package/dist/{tree-2YWTOJEK.js → tree-H2UYE6LH.js} +26 -24
  113. package/dist/tree-H2UYE6LH.js.map +1 -0
  114. package/dist/{update-7YGHGCW5.js → update-RGNKMRUL.js} +12 -12
  115. package/dist/{usage-IEH7X5QH.js → usage-YZRZKJ3H.js} +7 -7
  116. package/dist/{usage-ask-52X2RMQC.js → usage-ask-BYPNLA2B.js} +2 -2
  117. package/dist/{version-6A3FWFQR.js → version-4IOMOIDP.js} +3 -3
  118. package/dist/{wait-I4UVNBU2.js → wait-YOHPFWVJ.js} +8 -8
  119. package/dist/wd-bin.js +2 -2
  120. package/dist/web/assets/{PtyView-BPgPdKsH.js → PtyView-CW2GxKSc.js} +2 -2
  121. package/dist/web/assets/{PtyView-BPgPdKsH.js.map → PtyView-CW2GxKSc.js.map} +1 -1
  122. package/dist/web/assets/{index-fsWlaZJc.js → index-DEdSxNCA.js} +4 -4
  123. package/dist/web/assets/{index-fsWlaZJc.js.map → index-DEdSxNCA.js.map} +1 -1
  124. package/dist/web/index.html +1 -1
  125. package/dist/{web-W3YHTTSV.js → web-EC3KKH6E.js} +48 -48
  126. package/npm-shrinkwrap.json +2 -2
  127. package/package.json +1 -1
  128. package/dist/chunk-J4CEJOSI.js.map +0 -1
  129. package/dist/chunk-QWD76K3E.js.map +0 -1
  130. package/dist/chunk-TJ5XUAJK.js +0 -9
  131. package/dist/chunk-YQSWVHKK.js.map +0 -1
  132. package/dist/recent-O67MPZAU.js.map +0 -1
  133. package/dist/resume-6GHK46FG.js.map +0 -1
  134. package/dist/tree-2YWTOJEK.js.map +0 -1
  135. /package/dist/{account-XM6AGLTP.js.map → account-J55P3HXH.js.map} +0 -0
  136. /package/dist/{add-repo-Q2QRLPCY.js.map → add-repo-ALVEGU25.js.map} +0 -0
  137. /package/dist/{answer-EN2SUUMI.js.map → answer-CI2SPQQL.js.map} +0 -0
  138. /package/dist/{attach-WYSTXYA7.js.map → attach-7LBIFBLX.js.map} +0 -0
  139. /package/dist/{block-O5XC4JSQ.js.map → block-TVIYWRJ5.js.map} +0 -0
  140. /package/dist/{broadcast-MT77AQG5.js.map → broadcast-GZNMZFOY.js.map} +0 -0
  141. /package/dist/{catchup-WNXY4QRC.js.map → catchup-ZURJI6BF.js.map} +0 -0
  142. /package/dist/{child-4OQQ4RMP.js.map → child-K6YYF6MQ.js.map} +0 -0
  143. /package/dist/{chunk-MHKDX7CD.js.map → chunk-23QLXVH6.js.map} +0 -0
  144. /package/dist/{chunk-OHX7WKZU.js.map → chunk-4QMWNAEJ.js.map} +0 -0
  145. /package/dist/{chunk-MD4G7DIO.js.map → chunk-5FIUVBUC.js.map} +0 -0
  146. /package/dist/{chunk-XZF526OU.js.map → chunk-5P27YL64.js.map} +0 -0
  147. /package/dist/{chunk-RDRQDE6J.js.map → chunk-6Y3VLCKA.js.map} +0 -0
  148. /package/dist/{chunk-B4VQXZV4.js.map → chunk-7Q5PBXF6.js.map} +0 -0
  149. /package/dist/{chunk-ZWD3QJLP.js.map → chunk-7ZOY2QQN.js.map} +0 -0
  150. /package/dist/{chunk-VPFWY2GG.js.map → chunk-AITL3JYB.js.map} +0 -0
  151. /package/dist/{chunk-SLA7CB3C.js.map → chunk-AIYZJ7XD.js.map} +0 -0
  152. /package/dist/{chunk-VT6FJG3P.js.map → chunk-ATQB6PTV.js.map} +0 -0
  153. /package/dist/{chunk-EXNRUU7Z.js.map → chunk-B2WV5RAL.js.map} +0 -0
  154. /package/dist/{chunk-LVRV5UED.js.map → chunk-CA56ETYX.js.map} +0 -0
  155. /package/dist/{chunk-MRMFJQZI.js.map → chunk-CMRTNTMU.js.map} +0 -0
  156. /package/dist/{chunk-66OWGZAF.js.map → chunk-D2SVBU7R.js.map} +0 -0
  157. /package/dist/{chunk-HF3ZGAW7.js.map → chunk-DC73NF67.js.map} +0 -0
  158. /package/dist/{chunk-Z52GYYGA.js.map → chunk-DCENKA6E.js.map} +0 -0
  159. /package/dist/{chunk-ORBZDEPN.js.map → chunk-DF4GOVDE.js.map} +0 -0
  160. /package/dist/{chunk-R4DGGYME.js.map → chunk-EA4C6TVY.js.map} +0 -0
  161. /package/dist/{chunk-JBQOBCH4.js.map → chunk-EEHPZMS3.js.map} +0 -0
  162. /package/dist/{chunk-JATQW6OX.js.map → chunk-EYJ42LDG.js.map} +0 -0
  163. /package/dist/{chunk-TZ4BIOMS.js.map → chunk-F4UIKOU6.js.map} +0 -0
  164. /package/dist/{chunk-HF4VUIGE.js.map → chunk-FGBLFF4O.js.map} +0 -0
  165. /package/dist/{chunk-QAAYE6IY.js.map → chunk-FV7BSQPQ.js.map} +0 -0
  166. /package/dist/{chunk-ZU36UJVG.js.map → chunk-G4T2HGLJ.js.map} +0 -0
  167. /package/dist/{chunk-YYFYCOGY.js.map → chunk-GNERWNZY.js.map} +0 -0
  168. /package/dist/{chunk-VRMALBZK.js.map → chunk-GQ5WECPJ.js.map} +0 -0
  169. /package/dist/{chunk-7TAPYCLF.js.map → chunk-HUW27DSB.js.map} +0 -0
  170. /package/dist/{chunk-WANJYVUP.js.map → chunk-IU6LA6EB.js.map} +0 -0
  171. /package/dist/{chunk-EH4H2I72.js.map → chunk-KU3TQAA7.js.map} +0 -0
  172. /package/dist/{chunk-WFKL2SJ3.js.map → chunk-LV5JRLBM.js.map} +0 -0
  173. /package/dist/{chunk-RE6WWXD6.js.map → chunk-NOQA7MJ4.js.map} +0 -0
  174. /package/dist/{chunk-I6GXPPEH.js.map → chunk-NYGKSOQ4.js.map} +0 -0
  175. /package/dist/{chunk-GGBFSQEX.js.map → chunk-OCUUM755.js.map} +0 -0
  176. /package/dist/{chunk-XYDGDIGZ.js.map → chunk-PUJSLL6R.js.map} +0 -0
  177. /package/dist/{chunk-T4Y2Z6HB.js.map → chunk-Q2B3NUSM.js.map} +0 -0
  178. /package/dist/{chunk-VOHPXD2P.js.map → chunk-QNOJOZYK.js.map} +0 -0
  179. /package/dist/{chunk-WDKHEFR6.js.map → chunk-QOLHDDM2.js.map} +0 -0
  180. /package/dist/{chunk-KSG6RRGI.js.map → chunk-RLPC3YKZ.js.map} +0 -0
  181. /package/dist/{chunk-5C6N447O.js.map → chunk-RNPNBGVX.js.map} +0 -0
  182. /package/dist/{chunk-GRHVKD2K.js.map → chunk-RTCTD5PJ.js.map} +0 -0
  183. /package/dist/{chunk-5TW5NKYZ.js.map → chunk-SDYY5MHW.js.map} +0 -0
  184. /package/dist/{chunk-TJ5XUAJK.js.map → chunk-TDJVYUF2.js.map} +0 -0
  185. /package/dist/{chunk-4VM6GMMI.js.map → chunk-TOMDOA4P.js.map} +0 -0
  186. /package/dist/{chunk-NHDZ3ECC.js.map → chunk-UAF2YFLZ.js.map} +0 -0
  187. /package/dist/{chunk-DLV7TRON.js.map → chunk-USENBMUV.js.map} +0 -0
  188. /package/dist/{chunk-OOFCBN43.js.map → chunk-YO3BNAAK.js.map} +0 -0
  189. /package/dist/{chunk-P3QIN44Y.js.map → chunk-Z4FWXDJG.js.map} +0 -0
  190. /package/dist/{chunk-E5N4CJDI.js.map → chunk-Z4P23XG3.js.map} +0 -0
  191. /package/dist/{chunk-4AAFXLXN.js.map → chunk-ZO7TF5OL.js.map} +0 -0
  192. /package/dist/{chunk-RFE3HK2L.js.map → chunk-ZTWZS5RK.js.map} +0 -0
  193. /package/dist/{cleanup-OZFN7I2N.js.map → cleanup-G4WQACD6.js.map} +0 -0
  194. /package/dist/{cli-RA5CKMTR.js.map → cli-XI2W5KRQ.js.map} +0 -0
  195. /package/dist/{color-47LQGPVK.js.map → color-C223W3Z6.js.map} +0 -0
  196. /package/dist/{config-U7RPODOW.js.map → config-KQYXQCQA.js.map} +0 -0
  197. /package/dist/{coordinate-UO432TPP.js.map → coordinate-4E5GIMC6.js.map} +0 -0
  198. /package/dist/{diff-TXGP7XHY.js.map → diff-HEOLTXO2.js.map} +0 -0
  199. /package/dist/{digest-OEU7P5GQ.js.map → digest-GYF4YLUH.js.map} +0 -0
  200. /package/dist/{fork-PBSBRV6J.js.map → fork-B35ONP3Z.js.map} +0 -0
  201. /package/dist/{history-WF7Z54MS.js.map → history-25DNQKKC.js.map} +0 -0
  202. /package/dist/{hook-7INHBIR6.js.map → hook-B4JO2X57.js.map} +0 -0
  203. /package/dist/{hydrate-RRASKNTO.js.map → hydrate-IJEKNZIP.js.map} +0 -0
  204. /package/dist/{init-BPQTPNQ4.js.map → init-UJVOUDJI.js.map} +0 -0
  205. /package/dist/{install-skills-KSLTHRHH.js.map → install-skills-FV2L5QHE.js.map} +0 -0
  206. /package/dist/{keep-G4WED2HV.js.map → keep-PKXGFZO2.js.map} +0 -0
  207. /package/dist/{list-XVLFF6AY.js.map → list-VYQ3QE2H.js.map} +0 -0
  208. /package/dist/{move-UXB5XDIY.js.map → move-IAZY23ZX.js.map} +0 -0
  209. /package/dist/{note-3JZISZMY.js.map → note-6HQUKUYY.js.map} +0 -0
  210. /package/dist/{overlaps-5VSNWHEA.js.map → overlaps-CGP3RJOW.js.map} +0 -0
  211. /package/dist/{pin-QJZZZETK.js.map → pin-PAWGQ4Q2.js.map} +0 -0
  212. /package/dist/{pr-P5JHMUIS.js.map → pr-OJOGE3A3.js.map} +0 -0
  213. /package/dist/{prune-7VM47E6R.js.map → prune-42MS36OR.js.map} +0 -0
  214. /package/dist/{pty-host-VOE63H3Q.js.map → pty-host-ULVOMW3R.js.map} +0 -0
  215. /package/dist/{read-Y75YWFMD.js.map → read-ATNCW4KH.js.map} +0 -0
  216. /package/dist/{remove-L7UKL4HS.js.map → remove-GLDJOKUI.js.map} +0 -0
  217. /package/dist/{report-F2ASNP5G.js.map → report-AK7Z2Y4S.js.map} +0 -0
  218. /package/dist/{restart-QJPCIHLM.js.map → restart-DEPDGEZB.js.map} +0 -0
  219. /package/dist/{review-XUWVO4XU.js.map → review-RYAGH3PY.js.map} +0 -0
  220. /package/dist/{run-XHU4OPHL.js.map → run-WNP2SMNW.js.map} +0 -0
  221. /package/dist/{screen-BE5IFYMV.js.map → screen-P746M4F2.js.map} +0 -0
  222. /package/dist/{search-AHBK3Q6S.js.map → search-XQ2WMK5X.js.map} +0 -0
  223. /package/dist/{section-VHRFW7OS.js.map → section-Q7TPOV7U.js.map} +0 -0
  224. /package/dist/{send-QN56VR4Q.js.map → send-EGG23J2B.js.map} +0 -0
  225. /package/dist/{sessions-36NA666U.js.map → sessions-2NNCWIND.js.map} +0 -0
  226. /package/dist/{show-5YRGL7E2.js.map → show-KSMC7AJL.js.map} +0 -0
  227. /package/dist/{snooze-YQAIVXJ3.js.map → snooze-4LVYUQEX.js.map} +0 -0
  228. /package/dist/{start-RYQVC4AV.js.map → start-YKLLXW3L.js.map} +0 -0
  229. /package/dist/{status-IJARRSRU.js.map → status-4HGP4ZEF.js.map} +0 -0
  230. /package/dist/{stop-XUYL3ICW.js.map → stop-YBQL6NFF.js.map} +0 -0
  231. /package/dist/{sync-ZGU3G5OD.js.map → sync-DUXN2MFJ.js.map} +0 -0
  232. /package/dist/{time-AQ3HEFPA.js.map → time-Q42HPZZ3.js.map} +0 -0
  233. /package/dist/{timesheet-DM2YY3ZP.js.map → timesheet-YJ6O3GUU.js.map} +0 -0
  234. /package/dist/{update-7YGHGCW5.js.map → update-RGNKMRUL.js.map} +0 -0
  235. /package/dist/{usage-IEH7X5QH.js.map → usage-YZRZKJ3H.js.map} +0 -0
  236. /package/dist/{usage-ask-52X2RMQC.js.map → usage-ask-BYPNLA2B.js.map} +0 -0
  237. /package/dist/{version-6A3FWFQR.js.map → version-4IOMOIDP.js.map} +0 -0
  238. /package/dist/{wait-I4UVNBU2.js.map → wait-YOHPFWVJ.js.map} +0 -0
  239. /package/dist/{web-W3YHTTSV.js.map → web-EC3KKH6E.js.map} +0 -0
@@ -9,10 +9,10 @@ import {
9
9
  claudeSettingsFile,
10
10
  internalClaudeReadOnlySpawn,
11
11
  internalClaudeSpawn
12
- } from "./chunk-HF4VUIGE.js";
12
+ } from "./chunk-FGBLFF4O.js";
13
13
  import {
14
14
  applyEnvDelta
15
- } from "./chunk-YQSWVHKK.js";
15
+ } from "./chunk-ED6YLB4S.js";
16
16
  import {
17
17
  checkedOutBranch
18
18
  } from "./chunk-Z6ACV5ZQ.js";
@@ -190,17 +190,16 @@ var AccountAdminError = class extends Error {
190
190
  };
191
191
 
192
192
  // src/core/agents/index.ts
193
- import path14 from "path";
193
+ import path15 from "path";
194
194
 
195
195
  // src/core/agents/claude/startup-question.ts
196
- var YES = /^\s*[❯>]?\s*1\.\s+Yes, (?:I trust this folder|proceed)\s*$/;
197
- var NO = /^\s*[❯>]?\s*2\.\s+No, exit\s*$/;
196
+ var YES = /^\s*[❯>]?\s*(?:1\.\s+)?Yes, (?:I trust this folder|proceed)\s*$/;
197
+ var NO = /^\s*[❯>]?\s*(?:\d\.\s+)?No, exit\s*$/;
198
198
  var TAIL_LINES = 6;
199
199
  var TRUST_QUESTION = "Claude asks whether you trust this folder: answer in its terminal";
200
200
  function claudeStartupQuestion(screen) {
201
201
  const tail = screen.split(/\r?\n/).map((l) => l.replace(/[│┃|]/g, " ").trimEnd()).filter((l) => l.trim()).slice(-TAIL_LINES);
202
- const yes = tail.findIndex((l) => YES.test(l));
203
- return yes >= 0 && tail.slice(yes + 1).some((l) => NO.test(l)) ? TRUST_QUESTION : null;
202
+ return tail.some((l) => YES.test(l)) && tail.some((l) => NO.test(l)) ? TRUST_QUESTION : null;
204
203
  }
205
204
 
206
205
  // src/core/agents/claude/temp-folders.ts
@@ -341,193 +340,549 @@ function sessionTempFolders(session, root = claudeTempRoot(), platform = process
341
340
  });
342
341
  }
343
342
 
344
- // src/core/agents/claude/adapter.ts
345
- import path13 from "path";
343
+ // src/core/agents/claude/folder-trust.ts
344
+ import fs5 from "fs";
345
+ import path5 from "path";
346
346
 
347
- // src/core/agents/claude/files.ts
347
+ // src/core/agents/claude/setup-copy.ts
348
348
  import fs4 from "fs";
349
+ import os3 from "os";
349
350
  import path4 from "path";
350
- function listTranscripts(session) {
351
- const dirs = session.isGroup ? [...new Set(session.paths.map((p) => path4.dirname(p)))] : session.paths;
352
- const roots = claudeProjectsRoots(sessionAccount(session));
353
- const seen = /* @__PURE__ */ new Set();
354
- const out = [];
355
- for (const d of dirs)
356
- for (const root of roots)
357
- for (const f of projectTranscripts(path4.join(root, encodeProjectDir(d)))) {
358
- if (seen.has(f.file)) continue;
359
- seen.add(f.file);
360
- out.push(f);
351
+ var TRUSTED_FOLDERS = "trusted folders";
352
+ function globalConfigFile(dir, home = os3.homedir()) {
353
+ return accountDirKey(dir) === accountDirKey(path4.join(home, ".claude")) ? path4.join(home, ".claude.json") : path4.join(dir, ".claude.json");
354
+ }
355
+ var isObject = (v) => !!v && typeof v === "object" && !Array.isArray(v);
356
+ var same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
357
+ var NEVER_COPIED = /* @__PURE__ */ new Set(["statusLine"]);
358
+ var MAPS = /* @__PURE__ */ new Set(["enabledPlugins", "extraKnownMarketplaces", "mcpServers", "env", "skillOverrides"]);
359
+ function mergeSettings(source, target) {
360
+ const out = { ...target };
361
+ for (const [key2, value] of Object.entries(source)) {
362
+ if (NEVER_COPIED.has(key2)) continue;
363
+ if (key2 === "hooks") {
364
+ if (!isObject(value)) continue;
365
+ const hooks = {};
366
+ for (const [event, list] of Object.entries(isObject(target.hooks) ? target.hooks : {}))
367
+ hooks[event] = Array.isArray(list) ? [...list] : [];
368
+ for (const [event, list] of Object.entries(value)) {
369
+ for (const entry of Array.isArray(list) ? list : []) {
370
+ if (isObject(entry) && "_workHookOwner" in entry) continue;
371
+ if (!(hooks[event] ??= []).some((have) => same(have, entry))) hooks[event].push(entry);
372
+ }
373
+ }
374
+ if (Object.keys(hooks).length) out.hooks = hooks;
375
+ } else if (key2 === "permissions" && isObject(value)) {
376
+ const have = isObject(target.permissions) ? target.permissions : {};
377
+ const merged = { ...have };
378
+ for (const [k, v] of Object.entries(value)) {
379
+ merged[k] = Array.isArray(v) ? [.../* @__PURE__ */ new Set([...Array.isArray(have[k]) ? have[k] : [], ...v])] : v;
361
380
  }
381
+ out.permissions = merged;
382
+ } else if (MAPS.has(key2) && isObject(value)) {
383
+ out[key2] = { ...isObject(target[key2]) ? target[key2] : {}, ...value };
384
+ } else {
385
+ out[key2] = value;
386
+ }
387
+ }
362
388
  return out;
363
389
  }
364
- function listUsageFiles(session) {
390
+ function settingsChanges(source, target) {
391
+ const merged = mergeSettings(source, target);
365
392
  const out = [];
366
- for (const t of listTranscripts(session)) {
367
- out.push(t);
368
- const dir = path4.join(t.file.replace(/\.jsonl$/, ""), "subagents");
369
- let names;
370
- try {
371
- names = fs4.readdirSync(dir);
372
- } catch {
373
- continue;
374
- }
375
- for (const name of names) {
376
- if (!name.startsWith("agent-") || !name.endsWith(".jsonl")) continue;
377
- const file = path4.join(dir, name);
378
- try {
379
- const st = fs4.statSync(file);
380
- out.push({ file, mtimeMs: st.mtimeMs, size: st.size });
381
- } catch {
393
+ for (const key2 of Object.keys(merged)) {
394
+ const now = merged[key2];
395
+ const was = target[key2];
396
+ if (same(now, was)) continue;
397
+ if (key2 === "enabledPlugins" && isObject(now)) {
398
+ const before = isObject(was) ? was : {};
399
+ for (const [id, on] of Object.entries(now))
400
+ if (before[id] !== on) out.push(`${on === true ? "turns on" : "turns off"} plugin ${id}${id in before ? "" : " (new here)"}`);
401
+ } else if (key2 === "permissions" && isObject(now)) {
402
+ const before = isObject(was) ? was : {};
403
+ for (const [k, v] of Object.entries(now)) {
404
+ if (same(v, before[k])) continue;
405
+ if (Array.isArray(v)) {
406
+ const n = v.length - (Array.isArray(before[k]) ? before[k].length : 0);
407
+ out.push(`adds ${n} ${k} rule${n === 1 ? "" : "s"}`);
408
+ } else out.push(`sets permissions.${k}`);
382
409
  }
383
- }
410
+ } else if (key2 === "hooks" && isObject(now)) {
411
+ const count = (h) => isObject(h) ? Object.values(h).reduce((n2, l) => n2 + (Array.isArray(l) ? l.length : 0), 0) : 0;
412
+ const n = count(now) - count(was);
413
+ out.push(`adds ${n} of your hook${n === 1 ? "" : "s"}`);
414
+ } else if (MAPS.has(key2) && isObject(now)) {
415
+ const before = isObject(was) ? was : {};
416
+ const names = Object.keys(now).filter((k) => !same(now[k], before[k]));
417
+ out.push(`${key2}: ${names.slice(0, 4).join(", ")}${names.length > 4 ? ` and ${names.length - 4} more` : ""}`);
418
+ } else out.push(`sets ${key2}`);
384
419
  }
385
420
  return out;
386
421
  }
387
- var AROUND_TURN_MS = 6e4;
388
- var AGENT_QUIET_MS = 60 * 6e4;
389
- var ANSWER_FOR_MS = 2e3;
390
- var answers = /* @__PURE__ */ new Map();
391
- function backgroundWorkSince(session, sinceMs, now = Date.now()) {
392
- const key2 = `${session.paths.join("|")}|${sinceMs}`;
393
- const kept2 = answers.get(key2);
394
- if (kept2 && now - kept2.at >= 0 && now - kept2.at < ANSWER_FOR_MS) return kept2.work;
395
- const work = lookForBackgroundWork(session, sinceMs, Math.max(sinceMs, now - AGENT_QUIET_MS), now - AGENT_QUIET_MS);
396
- if (answers.size > 200) answers.clear();
397
- answers.set(key2, { at: now, work });
398
- return work;
422
+ function marketplaceAddArgs(source) {
423
+ if (!isObject(source)) return null;
424
+ const sparse = Array.isArray(source.sparsePaths) && source.sparsePaths.every((p) => typeof p === "string") ? source.sparsePaths : [];
425
+ const where = source.source === "github" && typeof source.repo === "string" ? source.repo : source.source === "directory" && typeof source.path === "string" ? source.path : (source.source === "git" || source.source === "url") && typeof source.url === "string" ? source.url : null;
426
+ if (!where || where.startsWith("-") || sparse.some((p) => p.startsWith("-"))) return null;
427
+ return ["plugin", "marketplace", "add", where, "--scope", "user", ...sparse.length ? ["--sparse", ...sparse] : []];
399
428
  }
400
- function whatOf(meta) {
401
- const d = meta.description;
402
- return typeof d === "string" && d.trim() ? d.trim().replace(/\s+/g, " ") : null;
429
+ var FILES = ["CLAUDE.md", "statusline-command.sh"];
430
+ var FOLDERS = ["agents", "commands"];
431
+ var SETTINGS = ["settings.json", "settings.local.json"];
432
+ function alreadyThere(from, to, io) {
433
+ if (io.isDir(from)) return io.isDir(to) && io.list(from).every((name) => alreadyThere(path4.join(from, name), path4.join(to, name), io));
434
+ const a = io.read(from);
435
+ const b = io.read(to);
436
+ return !!a && !!b && a.equals(b);
403
437
  }
404
- function lookForBackgroundWork(session, sinceMs, afterMs, quietFrom = afterMs) {
405
- for (const t of listTranscripts(session)) {
406
- if (t.mtimeMs < sinceMs - AROUND_TURN_MS) continue;
407
- const dir = path4.join(t.file.replace(/\.jsonl$/, ""), "subagents");
408
- let names;
438
+ function marketplaceKey(source) {
439
+ const args = marketplaceAddArgs(source);
440
+ return args ? args[3].replace(/\\/g, "/").replace(/\/+$/, "").toLowerCase() : null;
441
+ }
442
+ var realSetupIo = {
443
+ exists: (p) => fs4.existsSync(p),
444
+ isDir: (p) => {
409
445
  try {
410
- names = fs4.readdirSync(dir);
446
+ return fs4.statSync(p).isDirectory();
411
447
  } catch {
412
- continue;
413
- }
414
- for (const name of names) {
415
- if (!name.endsWith(".jsonl")) continue;
416
- const file = path4.join(dir, name);
417
- try {
418
- const written = fs4.statSync(file).mtimeMs;
419
- if (written <= quietFrom) continue;
420
- const metaFile = file.replace(/\.jsonl$/, ".meta.json");
421
- const startedForTurn = fs4.statSync(metaFile).mtimeMs >= sinceMs - AROUND_TURN_MS;
422
- if (written <= afterMs && !startedForTurn) continue;
423
- const meta = JSON.parse(fs4.readFileSync(metaFile, "utf8"));
424
- if (meta && typeof meta === "object" && meta.requestShape === "background")
425
- return { what: whatOf(meta) };
426
- } catch {
427
- }
448
+ return false;
428
449
  }
429
- }
430
- return null;
431
- }
432
-
433
- // src/core/conversations/jsonl.ts
434
- import fs5 from "fs";
435
- var TAIL_BYTES = 256 * 1024;
436
- function parseLines(text) {
437
- const out = [];
438
- for (const raw of text.split("\n")) {
439
- const line = raw.trim();
440
- if (!line.startsWith("{")) continue;
450
+ },
451
+ list: (dir) => {
441
452
  try {
442
- const entry = JSON.parse(line);
443
- if (entry && typeof entry === "object" && !Array.isArray(entry)) out.push(entry);
453
+ return fs4.readdirSync(dir);
444
454
  } catch {
455
+ return [];
445
456
  }
446
- }
447
- return out;
448
- }
449
- function readJsonlTail(transcriptPath, bytes = TAIL_BYTES) {
450
- if (!transcriptPath) return [];
451
- let text;
452
- try {
453
- const fd = fs5.openSync(transcriptPath, "r");
457
+ },
458
+ read: (file) => {
454
459
  try {
455
- const size = fs5.fstatSync(fd).size;
456
- const start = Math.max(0, size - bytes);
457
- const buf = Buffer.alloc(size - start);
458
- fs5.readSync(fd, buf, 0, buf.length, start);
459
- text = buf.toString("utf-8");
460
- } finally {
461
- fs5.closeSync(fd);
460
+ return fs4.readFileSync(file);
461
+ } catch {
462
+ return null;
462
463
  }
463
- } catch {
464
- return [];
465
- }
466
- return parseLines(text);
467
- }
468
- var SINCE_CHUNK_BYTES = 2 * 1024 * 1024;
469
- var SINCE_MAX_BYTES = 64 * 1024 * 1024;
470
- async function readJsonlSince(transcriptPath, sinceMs, timeOf, opts = {}) {
471
- const chunk = Math.max(1, opts.chunkBytes ?? SINCE_CHUNK_BYTES);
472
- const max = Math.max(chunk, opts.maxBytes ?? SINCE_MAX_BYTES);
473
- let fh;
474
- try {
475
- fh = await fs5.promises.open(transcriptPath, "r");
476
- } catch {
477
- return { lines: [], partial: false };
478
- }
479
- try {
480
- const size = (await fh.stat()).size;
481
- let bytes = Math.min(chunk, size);
482
- for (; ; ) {
483
- const start = size - bytes;
484
- const buf = Buffer.alloc(bytes);
485
- await fh.read(buf, 0, bytes, start);
486
- const lines = parseLines(buf.toString("utf-8"));
487
- const earliest = lines.map(timeOf).find((ms) => Number.isFinite(ms));
488
- if (start === 0 || earliest !== void 0 && earliest < sinceMs) return { lines, partial: false };
489
- if (bytes >= max) return { lines, partial: true };
490
- bytes = Math.min(size, bytes * 2, max);
464
+ },
465
+ readJson: (file) => {
466
+ try {
467
+ return JSON.parse(fs4.readFileSync(file, "utf-8"));
468
+ } catch {
469
+ return null;
491
470
  }
492
- } catch {
493
- return { lines: [], partial: false };
494
- } finally {
495
- await fh.close();
496
471
  }
472
+ };
473
+ var objectAt = (v, key2) => isObject(v) && isObject(v[key2]) ? v[key2] : {};
474
+ function userMcpServers(dir, io = realSetupIo) {
475
+ return objectAt(io.readJson(globalConfigFile(dir)), "mcpServers");
497
476
  }
498
-
499
- // src/core/agents/claude/transcript-entry.ts
500
- function contentBlocks(entry) {
501
- const c = entry.message?.content;
502
- if (typeof c === "string") return [{ type: "text", text: c }];
503
- if (!Array.isArray(c)) return [];
504
- return c.filter((b) => !!b && typeof b === "object");
477
+ function trustedFolders(dir, io = realSetupIo) {
478
+ return Object.entries(objectAt(io.readJson(globalConfigFile(dir)), "projects")).filter(([, p]) => isObject(p) && p.hasTrustDialogAccepted === true).map(([folder]) => folder);
505
479
  }
506
-
507
- // src/core/agents/claude/transcript.ts
508
- function readTranscriptTail(transcriptPath, bytes = TAIL_BYTES) {
509
- return readJsonlTail(transcriptPath, bytes);
480
+ function trustToCopy(from, to, io = realSetupIo) {
481
+ const have = new Set(trustedFolders(to.dir, io));
482
+ return trustedFolders(from.dir, io).filter((folder) => !have.has(folder) && io.isDir(folder));
510
483
  }
511
-
512
- // src/core/agents/claude/background-commands.ts
513
- function whatOf2(input) {
514
- const pick = [input.description, input.command].find((v) => typeof v === "string" && !!v.trim());
515
- if (!pick) return null;
516
- const line = pick.trim().split(/\r?\n/)[0].replace(/\s+/g, " ");
517
- return line.length > 100 ? `${line.slice(0, 99)}\u2026` : line;
484
+ function withTrusted(config, folders) {
485
+ const base = isObject(config) ? config : {};
486
+ const projects = { ...objectAt(base, "projects") };
487
+ for (const folder of folders)
488
+ projects[folder] = { ...isObject(projects[folder]) ? projects[folder] : {}, hasTrustDialogAccepted: true };
489
+ return { ...base, projects };
518
490
  }
519
- function openBackgroundCommandInfo(lines, sinceMs = 0) {
520
- const started = /* @__PURE__ */ new Map();
521
- const whats = /* @__PURE__ */ new Map();
522
- const ended = /* @__PURE__ */ new Set();
523
- const endedTasks = /* @__PURE__ */ new Set();
524
- for (const line of lines) {
525
- if (!line || typeof line !== "object") continue;
526
- const l = line;
527
- const raw = JSON.stringify(line);
528
- if (raw.includes("<task-notification>")) {
529
- for (const m of raw.matchAll(/<tool-use-id>\s*([^<\s\\"]+)/g)) ended.add(m[1]);
530
- for (const m of raw.matchAll(/<task-id>\s*([^<\s\\"]+)/g)) endedTasks.add(m[1]);
491
+ function planSetupCopy(from, to, io = realSetupIo) {
492
+ const items = [];
493
+ const there = (rel) => io.exists(path4.join(to.dir, rel));
494
+ const differs = (rel) => !alreadyThere(path4.join(from.dir, rel), path4.join(to.dir, rel), io);
495
+ for (const f of FILES)
496
+ if (io.exists(path4.join(from.dir, f)) && differs(f)) items.push({ kind: "file", name: f, does: there(f) ? "replaces" : "adds" });
497
+ for (const d of FOLDERS)
498
+ if (io.isDir(path4.join(from.dir, d)) && io.list(path4.join(from.dir, d)).length && differs(d))
499
+ items.push({ kind: "folder", name: `${d}/`, does: there(d) ? "merges into" : "adds" });
500
+ for (const skill of io.list(path4.join(from.dir, "skills")).filter((s) => s !== "synced" && io.isDir(path4.join(from.dir, "skills", s))))
501
+ if (differs(path4.join("skills", skill)))
502
+ items.push({ kind: "folder", name: `skills/${skill}/`, does: there(path4.join("skills", skill)) ? "replaces" : "adds" });
503
+ for (const s of SETTINGS) {
504
+ const source = io.readJson(path4.join(from.dir, s));
505
+ if (!isObject(source)) continue;
506
+ const target = io.readJson(path4.join(to.dir, s));
507
+ const have = isObject(target) ? target : {};
508
+ if (!same(mergeSettings(source, have), have))
509
+ items.push({
510
+ kind: "settings",
511
+ name: s,
512
+ does: "merges into",
513
+ // What it would change, by name; the rest of the file stays (the status line and work's hooks always).
514
+ note: settingsChanges(source, have).join("; ")
515
+ });
516
+ }
517
+ const servers = userMcpServers(from.dir, io);
518
+ const haveServers = userMcpServers(to.dir, io);
519
+ for (const [name, def] of Object.entries(servers)) {
520
+ if (same(haveServers[name], def)) continue;
521
+ const remote = isObject(def) && (def.type === "http" || def.type === "sse");
522
+ items.push({
523
+ kind: "mcp",
524
+ name,
525
+ does: name in haveServers ? "replaces" : "adds",
526
+ ...remote ? { note: `needs its own sign-in on ${to.name}: /mcp \u2192 ${name} \u2192 Authenticate` } : {}
527
+ });
528
+ }
529
+ const markets = io.readJson(path4.join(from.dir, "plugins", "known_marketplaces.json"));
530
+ const haveMarkets = io.readJson(path4.join(to.dir, "plugins", "known_marketplaces.json"));
531
+ const haveSources = new Set(
532
+ Object.values(isObject(haveMarkets) ? haveMarkets : {}).map((m) => marketplaceKey(isObject(m) ? m.source : null)).filter((k) => k !== null)
533
+ );
534
+ for (const [name, m] of Object.entries(isObject(markets) ? markets : {})) {
535
+ if (isObject(haveMarkets) && name in haveMarkets) continue;
536
+ const key2 = marketplaceKey(isObject(m) ? m.source : null);
537
+ if (key2 && haveSources.has(key2)) continue;
538
+ const args = marketplaceAddArgs(isObject(m) ? m.source : null);
539
+ if (args) items.push({ kind: "marketplace", name, does: "adds", note: args[3] });
540
+ }
541
+ const enabled = objectAt(io.readJson(path4.join(from.dir, "settings.json")), "enabledPlugins");
542
+ const installed = objectAt(io.readJson(path4.join(to.dir, "plugins", "installed_plugins.json")), "plugins");
543
+ for (const [id, on] of Object.entries(enabled))
544
+ if (on === true && !(id in installed)) items.push({ kind: "plugin", name: id, does: "adds", note: "installed from its marketplace" });
545
+ const trust = trustToCopy(from, to, io);
546
+ if (trust.length) {
547
+ const first = [...trust].sort((a, b) => a.length - b.length || a.localeCompare(b)).slice(0, 3);
548
+ items.push({
549
+ kind: "trust",
550
+ name: TRUSTED_FOLDERS,
551
+ does: "adds",
552
+ note: `${trust.length} folder${trust.length === 1 ? "" : "s"} ${from.name} trusts, so ${to.name} doesn\u2019t ask again: ${first.join(", ")}${trust.length > first.length ? ` and ${trust.length - first.length} more` : ""}`
553
+ });
554
+ }
555
+ return items;
556
+ }
557
+ var runClaude = (args, env, input) => {
558
+ const r = spawn_default.sync("claude", args, {
559
+ encoding: "utf8",
560
+ timeout: 18e4,
561
+ windowsHide: true,
562
+ stdio: "pipe",
563
+ env: applyEnvDelta(process.env, env),
564
+ ...input !== void 0 ? { input } : {}
565
+ });
566
+ const text = (v) => typeof v === "string" ? v : "";
567
+ return { ok: !r.error && r.status === 0, out: r.error ? r.error.message : `${text(r.stderr)}
568
+ ${text(r.stdout)}` };
569
+ };
570
+ var lastLine = (out) => out.split("\n").map((l) => l.trim()).filter(Boolean).pop() ?? "it failed";
571
+ function setupEnv(dir) {
572
+ return accountDirKey(dir) === accountDirKey(defaultAccountDir()) ? { CLAUDE_CONFIG_DIR: null } : { CLAUDE_CONFIG_DIR: dir };
573
+ }
574
+ function mergeSettingsFile(fromFile, toFile) {
575
+ const source = JSON.parse(fs4.readFileSync(fromFile, "utf-8"));
576
+ if (!isObject(source)) throw new Error("its settings are not an object");
577
+ fs4.mkdirSync(path4.dirname(toFile), { recursive: true });
578
+ ensureFile(toFile, "{}\n");
579
+ withFileLockSync(toFile, () => {
580
+ let target = {};
581
+ try {
582
+ target = JSON.parse(fs4.readFileSync(toFile, "utf-8"));
583
+ } catch {
584
+ }
585
+ atomicWriteFile(toFile, `${JSON.stringify(mergeSettings(source, isObject(target) ? target : {}), null, 2)}
586
+ `);
587
+ });
588
+ }
589
+ function trustFolders(file, folders) {
590
+ fs4.mkdirSync(path4.dirname(file), { recursive: true });
591
+ ensureFile(file, "{}\n");
592
+ withFileLockSync(file, () => {
593
+ let config;
594
+ try {
595
+ config = JSON.parse(fs4.readFileSync(file, "utf-8"));
596
+ } catch {
597
+ throw new Error("its config file can\u2019t be read");
598
+ }
599
+ atomicWriteFile(file, `${JSON.stringify(withTrusted(config, folders), null, 2)}
600
+ `);
601
+ });
602
+ }
603
+ async function applySetupCopy(from, to, run = runClaude) {
604
+ if (accountDirKey(from.dir) === accountDirKey(to.dir)) throw new Error("an account\u2019s setup can\u2019t be copied to itself");
605
+ const env = setupEnv(to.dir);
606
+ const servers = userMcpServers(from.dir);
607
+ const markets = realSetupIo.readJson(path4.join(from.dir, "plugins", "known_marketplaces.json"));
608
+ const results = [];
609
+ for (const item of planSetupCopy(from, to)) {
610
+ try {
611
+ const rel = item.name.replace(/\/$/, "");
612
+ if (item.kind === "file") {
613
+ fs4.mkdirSync(to.dir, { recursive: true });
614
+ fs4.copyFileSync(path4.join(from.dir, rel), path4.join(to.dir, rel));
615
+ } else if (item.kind === "folder") {
616
+ fs4.cpSync(path4.join(from.dir, rel), path4.join(to.dir, rel), { recursive: true, force: true, verbatimSymlinks: true });
617
+ } else if (item.kind === "settings") {
618
+ mergeSettingsFile(path4.join(from.dir, rel), path4.join(to.dir, rel));
619
+ } else if (item.kind === "mcp") {
620
+ if (item.does === "replaces") run(["mcp", "remove", item.name, "--scope", "user"], env);
621
+ const r = run(["mcp", "add-json", item.name, "-", "--scope", "user"], env, JSON.stringify(servers[item.name]));
622
+ if (!r.ok) throw new Error(lastLine(r.out));
623
+ } else if (item.kind === "marketplace") {
624
+ const args = marketplaceAddArgs(
625
+ isObject(markets) && isObject(markets[item.name]) ? markets[item.name].source : null
626
+ );
627
+ if (!args) throw new Error("work doesn\u2019t know how to add this kind of marketplace");
628
+ const r = run(args, env);
629
+ if (!r.ok) throw new Error(lastLine(r.out));
630
+ } else if (item.kind === "trust") {
631
+ trustFolders(globalConfigFile(to.dir), trustToCopy(from, to));
632
+ } else {
633
+ const r = run(["plugin", "install", item.name, "--scope", "user", "-y"], env);
634
+ if (!r.ok) throw new Error(lastLine(r.out));
635
+ }
636
+ results.push({ ...item, ok: true });
637
+ } catch (err) {
638
+ results.push({ ...item, ok: false, error: err instanceof Error ? err.message : String(err) });
639
+ }
640
+ }
641
+ return results;
642
+ }
643
+
644
+ // src/core/agents/claude/folder-trust.ts
645
+ var realTrustIo = {
646
+ read(file) {
647
+ try {
648
+ return fs5.readFileSync(file, "utf-8");
649
+ } catch {
650
+ return null;
651
+ }
652
+ },
653
+ update(file, change) {
654
+ withFileLockSync(file, () => {
655
+ const next = change(fs5.readFileSync(file, "utf-8"));
656
+ if (next !== null) atomicWriteFile(file, next);
657
+ });
658
+ }
659
+ };
660
+ var isTrusted = (config, folder) => {
661
+ if (!config || typeof config !== "object") return false;
662
+ const projects = config.projects;
663
+ if (!projects || typeof projects !== "object") return false;
664
+ const entry = projects[folder];
665
+ return !!entry && typeof entry === "object" && entry.hasTrustDialogAccepted === true;
666
+ };
667
+ var parse = (text) => {
668
+ if (text === null) return void 0;
669
+ try {
670
+ return JSON.parse(text);
671
+ } catch {
672
+ return void 0;
673
+ }
674
+ };
675
+ function trustedConfigText(text, folders) {
676
+ const config = parse(text);
677
+ if (config === void 0 || typeof config !== "object" || config === null || Array.isArray(config)) return null;
678
+ const missing = folders.filter((f) => !isTrusted(config, f));
679
+ return missing.length ? `${JSON.stringify(withTrusted(config, missing), null, 2)}
680
+ ` : null;
681
+ }
682
+ function trustFoldersIn(configFile, folders, io = realTrustIo) {
683
+ const keys = [...new Set(folders.map((f) => path5.resolve(f)))];
684
+ const config = parse(io.read(configFile));
685
+ if (config === void 0) return [];
686
+ const missing = keys.filter((f) => !isTrusted(config, f));
687
+ if (!missing.length) return [];
688
+ io.update(configFile, (text) => trustedConfigText(text, missing));
689
+ return missing;
690
+ }
691
+ function sessionConfigFile(session) {
692
+ const dir = (session ? accountDir(sessionAccount(session)) : null) ?? defaultAccountDir();
693
+ return globalConfigFile(dir);
694
+ }
695
+ function trustSessionFolder(session, cwd, io = realTrustIo) {
696
+ return trustFoldersIn(sessionConfigFile(session), [cwd], io);
697
+ }
698
+
699
+ // src/core/agents/claude/adapter.ts
700
+ import path14 from "path";
701
+
702
+ // src/core/agents/claude/files.ts
703
+ import fs6 from "fs";
704
+ import path6 from "path";
705
+ function listTranscripts(session) {
706
+ const dirs = session.isGroup ? [...new Set(session.paths.map((p) => path6.dirname(p)))] : session.paths;
707
+ const roots = claudeProjectsRoots(sessionAccount(session));
708
+ const seen = /* @__PURE__ */ new Set();
709
+ const out = [];
710
+ for (const d of dirs)
711
+ for (const root of roots)
712
+ for (const f of projectTranscripts(path6.join(root, encodeProjectDir(d)))) {
713
+ if (seen.has(f.file)) continue;
714
+ seen.add(f.file);
715
+ out.push(f);
716
+ }
717
+ return out;
718
+ }
719
+ function listUsageFiles(session) {
720
+ const out = [];
721
+ for (const t of listTranscripts(session)) {
722
+ out.push(t);
723
+ const dir = path6.join(t.file.replace(/\.jsonl$/, ""), "subagents");
724
+ let names;
725
+ try {
726
+ names = fs6.readdirSync(dir);
727
+ } catch {
728
+ continue;
729
+ }
730
+ for (const name of names) {
731
+ if (!name.startsWith("agent-") || !name.endsWith(".jsonl")) continue;
732
+ const file = path6.join(dir, name);
733
+ try {
734
+ const st = fs6.statSync(file);
735
+ out.push({ file, mtimeMs: st.mtimeMs, size: st.size });
736
+ } catch {
737
+ }
738
+ }
739
+ }
740
+ return out;
741
+ }
742
+ var AROUND_TURN_MS = 6e4;
743
+ var AGENT_QUIET_MS = 60 * 6e4;
744
+ var ANSWER_FOR_MS = 2e3;
745
+ var answers = /* @__PURE__ */ new Map();
746
+ function backgroundWorkSince(session, sinceMs, now = Date.now()) {
747
+ const key2 = `${session.paths.join("|")}|${sinceMs}`;
748
+ const kept2 = answers.get(key2);
749
+ if (kept2 && now - kept2.at >= 0 && now - kept2.at < ANSWER_FOR_MS) return kept2.work;
750
+ const work = lookForBackgroundWork(session, sinceMs, Math.max(sinceMs, now - AGENT_QUIET_MS), now - AGENT_QUIET_MS);
751
+ if (answers.size > 200) answers.clear();
752
+ answers.set(key2, { at: now, work });
753
+ return work;
754
+ }
755
+ function whatOf(meta) {
756
+ const d = meta.description;
757
+ return typeof d === "string" && d.trim() ? d.trim().replace(/\s+/g, " ") : null;
758
+ }
759
+ function lookForBackgroundWork(session, sinceMs, afterMs, quietFrom = afterMs) {
760
+ for (const t of listTranscripts(session)) {
761
+ if (t.mtimeMs < sinceMs - AROUND_TURN_MS) continue;
762
+ const dir = path6.join(t.file.replace(/\.jsonl$/, ""), "subagents");
763
+ let names;
764
+ try {
765
+ names = fs6.readdirSync(dir);
766
+ } catch {
767
+ continue;
768
+ }
769
+ for (const name of names) {
770
+ if (!name.endsWith(".jsonl")) continue;
771
+ const file = path6.join(dir, name);
772
+ try {
773
+ const written = fs6.statSync(file).mtimeMs;
774
+ if (written <= quietFrom) continue;
775
+ const metaFile = file.replace(/\.jsonl$/, ".meta.json");
776
+ const startedForTurn = fs6.statSync(metaFile).mtimeMs >= sinceMs - AROUND_TURN_MS;
777
+ if (written <= afterMs && !startedForTurn) continue;
778
+ const meta = JSON.parse(fs6.readFileSync(metaFile, "utf8"));
779
+ if (meta && typeof meta === "object" && meta.requestShape === "background")
780
+ return { what: whatOf(meta) };
781
+ } catch {
782
+ }
783
+ }
784
+ }
785
+ return null;
786
+ }
787
+
788
+ // src/core/conversations/jsonl.ts
789
+ import fs7 from "fs";
790
+ var TAIL_BYTES = 256 * 1024;
791
+ function parseLines(text) {
792
+ const out = [];
793
+ for (const raw of text.split("\n")) {
794
+ const line = raw.trim();
795
+ if (!line.startsWith("{")) continue;
796
+ try {
797
+ const entry = JSON.parse(line);
798
+ if (entry && typeof entry === "object" && !Array.isArray(entry)) out.push(entry);
799
+ } catch {
800
+ }
801
+ }
802
+ return out;
803
+ }
804
+ function readJsonlTail(transcriptPath, bytes = TAIL_BYTES) {
805
+ if (!transcriptPath) return [];
806
+ let text;
807
+ try {
808
+ const fd = fs7.openSync(transcriptPath, "r");
809
+ try {
810
+ const size = fs7.fstatSync(fd).size;
811
+ const start = Math.max(0, size - bytes);
812
+ const buf = Buffer.alloc(size - start);
813
+ fs7.readSync(fd, buf, 0, buf.length, start);
814
+ text = buf.toString("utf-8");
815
+ } finally {
816
+ fs7.closeSync(fd);
817
+ }
818
+ } catch {
819
+ return [];
820
+ }
821
+ return parseLines(text);
822
+ }
823
+ var SINCE_CHUNK_BYTES = 2 * 1024 * 1024;
824
+ var SINCE_MAX_BYTES = 64 * 1024 * 1024;
825
+ async function readJsonlSince(transcriptPath, sinceMs, timeOf, opts = {}) {
826
+ const chunk = Math.max(1, opts.chunkBytes ?? SINCE_CHUNK_BYTES);
827
+ const max = Math.max(chunk, opts.maxBytes ?? SINCE_MAX_BYTES);
828
+ let fh;
829
+ try {
830
+ fh = await fs7.promises.open(transcriptPath, "r");
831
+ } catch {
832
+ return { lines: [], partial: false };
833
+ }
834
+ try {
835
+ const size = (await fh.stat()).size;
836
+ let bytes = Math.min(chunk, size);
837
+ for (; ; ) {
838
+ const start = size - bytes;
839
+ const buf = Buffer.alloc(bytes);
840
+ await fh.read(buf, 0, bytes, start);
841
+ const lines = parseLines(buf.toString("utf-8"));
842
+ const earliest = lines.map(timeOf).find((ms) => Number.isFinite(ms));
843
+ if (start === 0 || earliest !== void 0 && earliest < sinceMs) return { lines, partial: false };
844
+ if (bytes >= max) return { lines, partial: true };
845
+ bytes = Math.min(size, bytes * 2, max);
846
+ }
847
+ } catch {
848
+ return { lines: [], partial: false };
849
+ } finally {
850
+ await fh.close();
851
+ }
852
+ }
853
+
854
+ // src/core/agents/claude/transcript-entry.ts
855
+ function contentBlocks(entry) {
856
+ const c = entry.message?.content;
857
+ if (typeof c === "string") return [{ type: "text", text: c }];
858
+ if (!Array.isArray(c)) return [];
859
+ return c.filter((b) => !!b && typeof b === "object");
860
+ }
861
+
862
+ // src/core/agents/claude/transcript.ts
863
+ function readTranscriptTail(transcriptPath, bytes = TAIL_BYTES) {
864
+ return readJsonlTail(transcriptPath, bytes);
865
+ }
866
+
867
+ // src/core/agents/claude/background-commands.ts
868
+ function whatOf2(input) {
869
+ const pick = [input.description, input.command].find((v) => typeof v === "string" && !!v.trim());
870
+ if (!pick) return null;
871
+ const line = pick.trim().split(/\r?\n/)[0].replace(/\s+/g, " ");
872
+ return line.length > 100 ? `${line.slice(0, 99)}\u2026` : line;
873
+ }
874
+ function openBackgroundCommandInfo(lines, sinceMs = 0) {
875
+ const started = /* @__PURE__ */ new Map();
876
+ const whats = /* @__PURE__ */ new Map();
877
+ const ended = /* @__PURE__ */ new Set();
878
+ const endedTasks = /* @__PURE__ */ new Set();
879
+ for (const line of lines) {
880
+ if (!line || typeof line !== "object") continue;
881
+ const l = line;
882
+ const raw = JSON.stringify(line);
883
+ if (raw.includes("<task-notification>")) {
884
+ for (const m of raw.matchAll(/<tool-use-id>\s*([^<\s\\"]+)/g)) ended.add(m[1]);
885
+ for (const m of raw.matchAll(/<task-id>\s*([^<\s\\"]+)/g)) endedTasks.add(m[1]);
531
886
  }
532
887
  if (l.type !== "user" && l.type !== "assistant") continue;
533
888
  const at = typeof l.timestamp === "string" ? Date.parse(l.timestamp) : NaN;
@@ -687,10 +1042,10 @@ function claudeContextWindow(model, used) {
687
1042
  }
688
1043
 
689
1044
  // src/core/agents/claude/hooks.ts
690
- import path6 from "path";
1045
+ import path8 from "path";
691
1046
 
692
1047
  // src/core/agents/claude/permission.ts
693
- import path5 from "path";
1048
+ import path7 from "path";
694
1049
  function pendingToolUse(entries) {
695
1050
  const answered = /* @__PURE__ */ new Set();
696
1051
  for (const e of entries) {
@@ -721,7 +1076,7 @@ var YES_SELECTED_RE = /❯\s*1\.\s*Yes\b/;
721
1076
  var squash = (s) => s.replace(/[\s\u2500-\u257f]+/g, "");
722
1077
  function screenAnchor(req) {
723
1078
  if (req.tool === "Bash" || req.tool === "PowerShell") return squash(req.detail.split(" \u23CE ")[0]).slice(0, 40);
724
- if (/[\\/]/.test(req.detail) && !/^https?:/.test(req.detail)) return path5.basename(req.detail.replace(/\\/g, "/"));
1079
+ if (/[\\/]/.test(req.detail) && !/^https?:/.test(req.detail)) return path7.basename(req.detail.replace(/\\/g, "/"));
725
1080
  return "";
726
1081
  }
727
1082
  function checkDialog(screen, req) {
@@ -781,7 +1136,7 @@ function claudeStatusEvent(edge, payload) {
781
1136
  }
782
1137
  }
783
1138
  var toClaude = (h) => ({ owner: h.owner, event: CLAUDE_EVENT[h.edge] });
784
- var settingsFiles = () => setUpAccounts().map((a) => path6.join(a.dir, "settings.json"));
1139
+ var settingsFiles = () => setUpAccounts().map((a) => path8.join(a.dir, "settings.json"));
785
1140
  var claudeEvents = {
786
1141
  removeInstalled: async (hooks) => {
787
1142
  const inst = await loadInstaller();
@@ -808,589 +1163,290 @@ var claudeEvents = {
808
1163
  };
809
1164
 
810
1165
  // src/core/agents/claude/session-settings.ts
811
- import fs6 from "fs";
812
- import path7 from "path";
1166
+ import fs8 from "fs";
1167
+ import path9 from "path";
813
1168
  var SESSION_SETTINGS_NAME = "claude-settings.json";
814
1169
  var SESSION_ALLOW = ["Bash(work child:*)", "Bash(work report:*)"];
815
- var sessionSettingsPath = () => path7.join(getConfigDir(), SESSION_SETTINGS_NAME);
1170
+ var sessionSettingsPath = () => path9.join(getConfigDir(), SESSION_SETTINGS_NAME);
816
1171
  function claudeSessionSettings(o) {
817
1172
  const hooks = {};
818
1173
  for (const h of SESSION_HOOKS) {
819
1174
  (hooks[CLAUDE_EVENT[h.edge]] ??= []).push({
820
- hooks: [{ type: "command", command: workCommand(["hook", h.event], o.invocation), timeout: h.timeoutSec }]
821
- });
822
- }
823
- hooks.SessionStart = [{ hooks: [{ type: "command", command: workCommand(["hook", "session-start"], o.invocation), timeout: 10 }] }];
824
- hooks.SessionEnd = [{ hooks: [{ type: "command", command: workCommand(["hook", "session-end"], o.invocation), timeout: 10 }] }];
825
- hooks.StopFailure = [{ hooks: [{ type: "command", command: workCommand(["hook", "stop-failure"], o.invocation), timeout: 10 }] }];
826
- return {
827
- hooks,
828
- // A coordinator's own sessions (session-children.ts): `work child` acts only on the sessions the one running it
829
- // started, and only once you granted it (`work coordinate --on`, never allowed here: Claude running it asks you);
830
- // `work report` reaches only the session that started this one. Everything else that drives another session
831
- // (`work send / stop / answer`) keeps asking.
832
- permissions: { allow: [...SESSION_ALLOW] },
833
- ...o.statusLine ? { statusLine: { type: "command", command: workCommand(["hook", "statusline"], o.invocation) } } : {}
834
- };
835
- }
836
- function writeSessionSettings(o = {}) {
837
- const file = sessionSettingsPath();
838
- const config = loadConfig();
839
- const statusLine = o.statusLine ?? (config?.usage?.statusLine !== false || config?.claudeStatusLine === "work");
840
- const text = JSON.stringify(claudeSessionSettings({ statusLine, invocation: o.invocation }), null, 2) + "\n";
841
- let now = null;
842
- try {
843
- now = fs6.readFileSync(file, "utf-8");
844
- } catch {
845
- }
846
- if (now !== text) {
847
- fs6.mkdirSync(path7.dirname(file), { recursive: true });
848
- atomicWriteFile(file, text);
849
- }
850
- return file;
851
- }
852
- var isOurs = (p) => !!p && path7.basename(p) === SESSION_SETTINGS_NAME;
853
- function sessionSettingsFile(o = {}) {
854
- const file = sessionSettingsPath();
855
- return o.write === false && fs6.existsSync(file) ? file : writeSessionSettings();
856
- }
857
- var startedWithSessionSettings = (commandLine) => commandLine.includes(SESSION_SETTINGS_NAME);
858
- function withSessionSettings(tool, file = sessionSettingsFile()) {
859
- const rest = [];
860
- for (let i = 0; i < tool.baseArgs.length; i++) {
861
- if (tool.baseArgs[i] === "--settings" && isOurs(tool.baseArgs[i + 1])) {
862
- i++;
863
- continue;
864
- }
865
- rest.push(tool.baseArgs[i]);
866
- }
867
- return { ...tool, baseArgs: ["--settings", file, ...rest] };
868
- }
869
-
870
- // src/core/agents/claude/live.ts
871
- import fs7 from "fs";
872
- import os3 from "os";
873
- import path8 from "path";
874
- var isObj = (v) => !!v && typeof v === "object" && !Array.isArray(v);
875
- function parseLiveClaude(raw) {
876
- if (!isObj(raw)) return null;
877
- const { pid, sessionId, cwd, status, startedAt, statusUpdatedAt, waitingFor } = raw;
878
- if (typeof pid !== "number" || !Number.isInteger(pid) || pid <= 0) return null;
879
- if (typeof sessionId !== "string" || !sessionId || typeof cwd !== "string" || !cwd) return null;
880
- return {
881
- pid,
882
- conversationId: sessionId,
883
- cwd,
884
- busy: status === "busy",
885
- // `shell`: its prompt is free while a background command it started (a build, tests, a dev server) still runs.
886
- state: status === "busy" || status === "idle" || status === "waiting" || status === "shell" ? status : null,
887
- stateAt: typeof statusUpdatedAt === "number" ? statusUpdatedAt : null,
888
- waitingFor: typeof waitingFor === "string" && waitingFor ? waitingFor : null,
889
- startedAt: typeof startedAt === "number" ? startedAt : null
890
- };
891
- }
892
- var CLAUDE_EXE = /^(claude|node)(\.exe)?$/i;
893
- function aliveOnly(list, table, bootMs) {
894
- return list.filter((c) => {
895
- const name = table.get(c.pid);
896
- if (!name || !CLAUDE_EXE.test(name)) return false;
897
- return c.startedAt === null || c.startedAt >= bootMs - 6e4;
898
- });
899
- }
900
- var TTL_MS = 5e3;
901
- var cache = null;
902
- function claudeSessionsDir() {
903
- return path8.join(process.env.CLAUDE_CONFIG_DIR || path8.join(os3.homedir(), ".claude"), "sessions");
904
- }
905
- function claudeSessionsDirs() {
906
- const accounts = claudeAccounts();
907
- if (accounts.length <= 1) return [claudeSessionsDir()];
908
- return [...new Set(accounts.map((a) => path8.join(a.dir, "sessions")))];
909
- }
910
- function readDir(dir, table) {
911
- let names;
912
- try {
913
- names = fs7.readdirSync(dir).filter((n) => /^\d+\.json$/.test(n));
914
- } catch {
915
- return [];
916
- }
917
- const parsed = [];
918
- for (const n of names) {
919
- try {
920
- const c = parseLiveClaude(JSON.parse(fs7.readFileSync(path8.join(dir, n), "utf8")));
921
- if (c) parsed.push(c);
922
- } catch {
923
- }
924
- }
925
- return parsed.length ? aliveOnly(parsed, table(), bootTime()) : [];
926
- }
927
- function readLiveClaudes(dir, now = Date.now(), table) {
928
- const dirs = dir ? [dir] : claudeSessionsDirs();
929
- const key2 = dirs.join("|");
930
- const cached = !table && !dir;
931
- if (cached && cache && now - cache.at < TTL_MS && cache.key === key2) return cache.list;
932
- let procs = table;
933
- const procTable = () => procs ??= processTable();
934
- const list = dirs.flatMap((d) => readDir(d, procTable));
935
- if (cached) cache = { at: now, key: key2, list };
936
- return list;
937
- }
938
-
939
- // src/core/agents/typing.ts
940
- var SUBMIT_DELAY_MS = 250;
941
- var typeThenEnter = async (write, text, wait = (ms) => new Promise((r) => setTimeout(r, ms))) => {
942
- if (!await write(text)) return false;
943
- await wait(SUBMIT_DELAY_MS);
944
- return write("\r");
945
- };
946
-
947
- // src/core/agents/claude/workspace.ts
948
- import fs8 from "fs";
949
- import path9 from "path";
950
- var claudeAllowRule = (r) => `Bash(${r.command}${r.prefix ? ":*" : ""})`;
951
- var claudeWorkspace = {
952
- write(dir, { allow, hooks }) {
953
- fs8.mkdirSync(path9.join(dir, ".claude"), { recursive: true });
954
- const byEvent = {};
955
- for (const h of hooks) {
956
- (byEvent[CLAUDE_EVENT[h.edge]] ??= []).push({
957
- hooks: [{ type: "command", command: h.command, ...h.timeoutSec ? { timeout: h.timeoutSec } : {} }]
958
- });
959
- }
960
- const settings = { permissions: { allow: allow.map(claudeAllowRule) }, hooks: byEvent };
961
- atomicWriteFile(path9.join(dir, ".claude", "settings.json"), JSON.stringify(settings, null, 2) + "\n");
962
- return [path9.join(".claude", "settings.json")];
963
- }
964
- };
965
-
966
- // src/core/agents/claude/skills.ts
967
- var MARKETPLACE_REPO = "moberghr/moberg-plugins";
968
- var MARKETPLACE_NAME = "moberg-plugins";
969
- var PLUGIN_SPEC = "work-tree@moberg-plugins";
970
- var runClaude = (args, env) => {
971
- const r = spawn_default.sync("claude", args, {
972
- encoding: "utf8",
973
- timeout: 6e4,
974
- windowsHide: true,
975
- stdio: "pipe",
976
- ...env ? { env: applyEnvDelta(process.env, env) } : {}
977
- });
978
- const text = (v) => typeof v === "string" ? v : "";
979
- return { ok: !r.error && r.status === 0, stdout: text(r.stdout), stderr: r.error ? r.error.message : text(r.stderr) };
980
- };
981
- var lastLine = (r) => `${r.stderr ?? ""}
982
- ${r.stdout}`.split("\n").map((l) => l.trim()).filter(Boolean).pop() ?? "";
983
- function isInstalled(listJson) {
984
- try {
985
- const list = JSON.parse(listJson);
986
- return Array.isArray(list) && list.some((p) => !!p && typeof p === "object" && p.id === PLUGIN_SPEC);
987
- } catch {
988
- return false;
989
- }
990
- }
991
- function installFor(run) {
992
- if (!run(["--version"]).ok) return { ok: false, message: "Claude Code (the `claude` CLI) is not installed" };
993
- const list = run(["plugin", "marketplace", "list"]);
994
- if (!(list.ok && list.stdout.includes(MARKETPLACE_NAME))) {
995
- const add = run(["plugin", "marketplace", "add", MARKETPLACE_REPO, "--scope", "user", "--sparse", ".claude-plugin"]);
996
- if (!add.ok)
997
- return {
998
- ok: false,
999
- message: `could not register the Claude Code plugin marketplace (run \`claude plugin marketplace add ${MARKETPLACE_REPO}\`)`
1000
- };
1001
- }
1002
- const install = run(["plugin", "install", PLUGIN_SPEC, "--scope", "user"]);
1003
- if (install.ok) return { ok: true, message: `installed the Claude Code plugin ${PLUGIN_SPEC}` };
1004
- if (isInstalled(run(["plugin", "list", "--json"]).stdout))
1005
- return { ok: true, message: `the Claude Code plugin ${PLUGIN_SPEC} is installed` };
1006
- const why = lastLine(install);
1007
- return {
1008
- ok: false,
1009
- message: `could not install the Claude Code plugin${why ? ` (${why})` : ""}: run \`claude plugin install ${PLUGIN_SPEC} --scope user\``
1010
- };
1011
- }
1012
- function claudeSkillsWith(run, accounts = setUpAccounts) {
1013
- return {
1014
- async install() {
1015
- const list = accounts();
1016
- if (list.length <= 1) return installFor((args) => run(args));
1017
- const results = list.map((a) => {
1018
- const env = a.name === "default" ? { CLAUDE_CONFIG_DIR: null } : { CLAUDE_CONFIG_DIR: a.dir };
1019
- return { name: a.name, ...installFor((args) => run(args, env)) };
1020
- });
1021
- return { ok: results.every((r) => r.ok), message: results.map((r) => `${r.name}: ${r.message}`).join("; ") };
1022
- }
1175
+ hooks: [{ type: "command", command: workCommand(["hook", h.event], o.invocation), timeout: h.timeoutSec }]
1176
+ });
1177
+ }
1178
+ hooks.SessionStart = [{ hooks: [{ type: "command", command: workCommand(["hook", "session-start"], o.invocation), timeout: 10 }] }];
1179
+ hooks.SessionEnd = [{ hooks: [{ type: "command", command: workCommand(["hook", "session-end"], o.invocation), timeout: 10 }] }];
1180
+ hooks.StopFailure = [{ hooks: [{ type: "command", command: workCommand(["hook", "stop-failure"], o.invocation), timeout: 10 }] }];
1181
+ return {
1182
+ hooks,
1183
+ // A coordinator's own sessions (session-children.ts): `work child` acts only on the sessions the one running it
1184
+ // started, and only once you granted it (`work coordinate --on`, never allowed here: Claude running it asks you);
1185
+ // `work report` reaches only the session that started this one. Everything else that drives another session
1186
+ // (`work send / stop / answer`) keeps asking.
1187
+ permissions: { allow: [...SESSION_ALLOW] },
1188
+ ...o.statusLine ? { statusLine: { type: "command", command: workCommand(["hook", "statusline"], o.invocation) } } : {}
1023
1189
  };
1024
1190
  }
1025
- var claudeSkills = claudeSkillsWith(runClaude);
1026
- function installClaudeSkillsFor(dir, run = runClaude) {
1027
- return installFor((args) => run(args, { CLAUDE_CONFIG_DIR: dir }));
1028
- }
1029
-
1030
- // src/core/agents/claude/usage.ts
1031
- var installer2;
1032
- var loadInstaller2 = async () => installer2 ??= await import("./statusline-QJ6CJGHB.js");
1033
- var asker;
1034
- var loadAsker = async () => asker ??= await import("./usage-ask-52X2RMQC.js");
1035
- function restoreMessage(o, saved = "~/.work/statusline.json") {
1036
- switch (o) {
1037
- case "restored":
1038
- return "Your own status line is back (work no longer reads the plan limits from it).";
1039
- case "not-ours":
1040
- return "Its status line isn't work's: left as it is.";
1041
- case "kept":
1042
- return `work's status line left in place: the copy of yours (${saved}) is missing or damaged. Set yours again with /statusline in Claude Code.`;
1043
- case "failed":
1044
- return "Its settings couldn't be changed (see above).";
1191
+ function writeSessionSettings(o = {}) {
1192
+ const file = sessionSettingsPath();
1193
+ const config = loadConfig();
1194
+ const statusLine = o.statusLine ?? (config?.usage?.statusLine !== false || config?.claudeStatusLine === "work");
1195
+ const text = JSON.stringify(claudeSessionSettings({ statusLine, invocation: o.invocation }), null, 2) + "\n";
1196
+ let now = null;
1197
+ try {
1198
+ now = fs8.readFileSync(file, "utf-8");
1199
+ } catch {
1200
+ }
1201
+ if (now !== text) {
1202
+ fs8.mkdirSync(path9.dirname(file), { recursive: true });
1203
+ atomicWriteFile(file, text);
1045
1204
  }
1205
+ return file;
1046
1206
  }
1047
- function namedReadings() {
1048
- const accounts = claudeAccounts();
1049
- const byKey = /* @__PURE__ */ new Map();
1050
- for (const a of accounts) if (!byKey.has(accountOf(a.dir))) byKey.set(accountOf(a.dir), { name: a.name, isDefault: a.isDefault });
1051
- return readReadings("claude").map((r) => {
1052
- const known = byKey.get(r.account);
1053
- return known ? { ...r, account: known.name, ...known.isDefault ? { isDefault: true } : {} } : r;
1054
- });
1207
+ var isOurs = (p) => !!p && path9.basename(p) === SESSION_SETTINGS_NAME;
1208
+ function sessionSettingsFile(o = {}) {
1209
+ const file = sessionSettingsPath();
1210
+ return o.write === false && fs8.existsSync(file) ? file : writeSessionSettings();
1055
1211
  }
1056
- var claudeUsage = {
1057
- read: namedReadings,
1058
- // A model's own weekly window (Fable's) is in no status line: asked of Claude Code, at most every 5 minutes an account.
1059
- async refresh() {
1060
- await (await loadAsker()).askClaudeUsage();
1061
- },
1062
- // A line in any account's own settings (an older work web's wrap counts as the line it saved).
1063
- ownStatusLine: () => claudeAccounts().some((a) => userStatusLine({ configDir: a.dir }) !== null),
1064
- async setup() {
1065
- const done = await (await loadInstaller2()).unwrapAllStatusLines();
1066
- const restored = done.filter((d) => d.outcome === "restored").map((d) => d.account);
1067
- return restored.length > 0 ? `your own status line given back in ${restored.join(", ")} (work's Claudes carry their own now)` : "status line: nothing of work's in your settings";
1068
- },
1069
- async restore() {
1070
- const done = await (await loadInstaller2()).unwrapAllStatusLines();
1071
- const accounts = claudeAccounts();
1072
- const ok = done.every((d) => d.outcome === "restored" || d.outcome === "not-ours");
1073
- if (done.length === 1) return { ok, message: restoreMessage(done[0].outcome) };
1074
- const message = done.map((d) => {
1075
- const dir = accounts.find((a) => a.name === d.account)?.dir;
1076
- return `${d.account}: ${restoreMessage(d.outcome, dir ? savedPath(dir) : void 0)}`;
1077
- }).join("\n");
1078
- return { ok, message };
1212
+ var startedWithSessionSettings = (commandLine) => commandLine.includes(SESSION_SETTINGS_NAME);
1213
+ function withSessionSettings(tool, file = sessionSettingsFile()) {
1214
+ const rest = [];
1215
+ for (let i = 0; i < tool.baseArgs.length; i++) {
1216
+ if (tool.baseArgs[i] === "--settings" && isOurs(tool.baseArgs[i + 1])) {
1217
+ i++;
1218
+ continue;
1219
+ }
1220
+ rest.push(tool.baseArgs[i]);
1079
1221
  }
1080
- };
1081
-
1082
- // src/core/agents/claude/account-move.ts
1083
- import fs11 from "fs";
1084
- import path12 from "path";
1085
-
1086
- // src/core/agents/claude/account-admin.ts
1087
- import fs10 from "fs";
1088
- import os5 from "os";
1089
- import path11 from "path";
1222
+ return { ...tool, baseArgs: ["--settings", file, ...rest] };
1223
+ }
1090
1224
 
1091
- // src/core/agents/claude/setup-copy.ts
1225
+ // src/core/agents/claude/live.ts
1092
1226
  import fs9 from "fs";
1093
1227
  import os4 from "os";
1094
1228
  import path10 from "path";
1095
- var TRUSTED_FOLDERS = "trusted folders";
1096
- function globalConfigFile(dir, home = os4.homedir()) {
1097
- return accountDirKey(dir) === accountDirKey(path10.join(home, ".claude")) ? path10.join(home, ".claude.json") : path10.join(dir, ".claude.json");
1098
- }
1099
- var isObject = (v) => !!v && typeof v === "object" && !Array.isArray(v);
1100
- var same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
1101
- var NEVER_COPIED = /* @__PURE__ */ new Set(["statusLine"]);
1102
- var MAPS = /* @__PURE__ */ new Set(["enabledPlugins", "extraKnownMarketplaces", "mcpServers", "env", "skillOverrides"]);
1103
- function mergeSettings(source, target) {
1104
- const out = { ...target };
1105
- for (const [key2, value] of Object.entries(source)) {
1106
- if (NEVER_COPIED.has(key2)) continue;
1107
- if (key2 === "hooks") {
1108
- if (!isObject(value)) continue;
1109
- const hooks = {};
1110
- for (const [event, list] of Object.entries(isObject(target.hooks) ? target.hooks : {}))
1111
- hooks[event] = Array.isArray(list) ? [...list] : [];
1112
- for (const [event, list] of Object.entries(value)) {
1113
- for (const entry of Array.isArray(list) ? list : []) {
1114
- if (isObject(entry) && "_workHookOwner" in entry) continue;
1115
- if (!(hooks[event] ??= []).some((have) => same(have, entry))) hooks[event].push(entry);
1116
- }
1117
- }
1118
- if (Object.keys(hooks).length) out.hooks = hooks;
1119
- } else if (key2 === "permissions" && isObject(value)) {
1120
- const have = isObject(target.permissions) ? target.permissions : {};
1121
- const merged = { ...have };
1122
- for (const [k, v] of Object.entries(value)) {
1123
- merged[k] = Array.isArray(v) ? [.../* @__PURE__ */ new Set([...Array.isArray(have[k]) ? have[k] : [], ...v])] : v;
1124
- }
1125
- out.permissions = merged;
1126
- } else if (MAPS.has(key2) && isObject(value)) {
1127
- out[key2] = { ...isObject(target[key2]) ? target[key2] : {}, ...value };
1128
- } else {
1129
- out[key2] = value;
1130
- }
1131
- }
1132
- return out;
1133
- }
1134
- function settingsChanges(source, target) {
1135
- const merged = mergeSettings(source, target);
1136
- const out = [];
1137
- for (const key2 of Object.keys(merged)) {
1138
- const now = merged[key2];
1139
- const was = target[key2];
1140
- if (same(now, was)) continue;
1141
- if (key2 === "enabledPlugins" && isObject(now)) {
1142
- const before = isObject(was) ? was : {};
1143
- for (const [id, on] of Object.entries(now))
1144
- if (before[id] !== on) out.push(`${on === true ? "turns on" : "turns off"} plugin ${id}${id in before ? "" : " (new here)"}`);
1145
- } else if (key2 === "permissions" && isObject(now)) {
1146
- const before = isObject(was) ? was : {};
1147
- for (const [k, v] of Object.entries(now)) {
1148
- if (same(v, before[k])) continue;
1149
- if (Array.isArray(v)) {
1150
- const n = v.length - (Array.isArray(before[k]) ? before[k].length : 0);
1151
- out.push(`adds ${n} ${k} rule${n === 1 ? "" : "s"}`);
1152
- } else out.push(`sets permissions.${k}`);
1153
- }
1154
- } else if (key2 === "hooks" && isObject(now)) {
1155
- const count = (h) => isObject(h) ? Object.values(h).reduce((n2, l) => n2 + (Array.isArray(l) ? l.length : 0), 0) : 0;
1156
- const n = count(now) - count(was);
1157
- out.push(`adds ${n} of your hook${n === 1 ? "" : "s"}`);
1158
- } else if (MAPS.has(key2) && isObject(now)) {
1159
- const before = isObject(was) ? was : {};
1160
- const names = Object.keys(now).filter((k) => !same(now[k], before[k]));
1161
- out.push(`${key2}: ${names.slice(0, 4).join(", ")}${names.length > 4 ? ` and ${names.length - 4} more` : ""}`);
1162
- } else out.push(`sets ${key2}`);
1163
- }
1164
- return out;
1229
+ var isObj = (v) => !!v && typeof v === "object" && !Array.isArray(v);
1230
+ function parseLiveClaude(raw) {
1231
+ if (!isObj(raw)) return null;
1232
+ const { pid, sessionId, cwd, status, startedAt, statusUpdatedAt, waitingFor } = raw;
1233
+ if (typeof pid !== "number" || !Number.isInteger(pid) || pid <= 0) return null;
1234
+ if (typeof sessionId !== "string" || !sessionId || typeof cwd !== "string" || !cwd) return null;
1235
+ return {
1236
+ pid,
1237
+ conversationId: sessionId,
1238
+ cwd,
1239
+ busy: status === "busy",
1240
+ // `shell`: its prompt is free while a background command it started (a build, tests, a dev server) still runs.
1241
+ state: status === "busy" || status === "idle" || status === "waiting" || status === "shell" ? status : null,
1242
+ stateAt: typeof statusUpdatedAt === "number" ? statusUpdatedAt : null,
1243
+ waitingFor: typeof waitingFor === "string" && waitingFor ? waitingFor : null,
1244
+ startedAt: typeof startedAt === "number" ? startedAt : null
1245
+ };
1165
1246
  }
1166
- function marketplaceAddArgs(source) {
1167
- if (!isObject(source)) return null;
1168
- const sparse = Array.isArray(source.sparsePaths) && source.sparsePaths.every((p) => typeof p === "string") ? source.sparsePaths : [];
1169
- const where = source.source === "github" && typeof source.repo === "string" ? source.repo : source.source === "directory" && typeof source.path === "string" ? source.path : (source.source === "git" || source.source === "url") && typeof source.url === "string" ? source.url : null;
1170
- if (!where || where.startsWith("-") || sparse.some((p) => p.startsWith("-"))) return null;
1171
- return ["plugin", "marketplace", "add", where, "--scope", "user", ...sparse.length ? ["--sparse", ...sparse] : []];
1247
+ var CLAUDE_EXE = /^(claude|node)(\.exe)?$/i;
1248
+ function aliveOnly(list, table, bootMs) {
1249
+ return list.filter((c) => {
1250
+ const name = table.get(c.pid);
1251
+ if (!name || !CLAUDE_EXE.test(name)) return false;
1252
+ return c.startedAt === null || c.startedAt >= bootMs - 6e4;
1253
+ });
1172
1254
  }
1173
- var FILES = ["CLAUDE.md", "statusline-command.sh"];
1174
- var FOLDERS = ["agents", "commands"];
1175
- var SETTINGS = ["settings.json", "settings.local.json"];
1176
- function alreadyThere(from, to, io) {
1177
- if (io.isDir(from)) return io.isDir(to) && io.list(from).every((name) => alreadyThere(path10.join(from, name), path10.join(to, name), io));
1178
- const a = io.read(from);
1179
- const b = io.read(to);
1180
- return !!a && !!b && a.equals(b);
1255
+ var TTL_MS = 5e3;
1256
+ var cache = null;
1257
+ function claudeSessionsDir() {
1258
+ return path10.join(process.env.CLAUDE_CONFIG_DIR || path10.join(os4.homedir(), ".claude"), "sessions");
1181
1259
  }
1182
- function marketplaceKey(source) {
1183
- const args = marketplaceAddArgs(source);
1184
- return args ? args[3].replace(/\\/g, "/").replace(/\/+$/, "").toLowerCase() : null;
1260
+ function claudeSessionsDirs() {
1261
+ const accounts = claudeAccounts();
1262
+ if (accounts.length <= 1) return [claudeSessionsDir()];
1263
+ return [...new Set(accounts.map((a) => path10.join(a.dir, "sessions")))];
1185
1264
  }
1186
- var realSetupIo = {
1187
- exists: (p) => fs9.existsSync(p),
1188
- isDir: (p) => {
1189
- try {
1190
- return fs9.statSync(p).isDirectory();
1191
- } catch {
1192
- return false;
1193
- }
1194
- },
1195
- list: (dir) => {
1196
- try {
1197
- return fs9.readdirSync(dir);
1198
- } catch {
1199
- return [];
1200
- }
1201
- },
1202
- read: (file) => {
1203
- try {
1204
- return fs9.readFileSync(file);
1205
- } catch {
1206
- return null;
1207
- }
1208
- },
1209
- readJson: (file) => {
1265
+ function readDir(dir, table) {
1266
+ let names;
1267
+ try {
1268
+ names = fs9.readdirSync(dir).filter((n) => /^\d+\.json$/.test(n));
1269
+ } catch {
1270
+ return [];
1271
+ }
1272
+ const parsed = [];
1273
+ for (const n of names) {
1210
1274
  try {
1211
- return JSON.parse(fs9.readFileSync(file, "utf-8"));
1275
+ const c = parseLiveClaude(JSON.parse(fs9.readFileSync(path10.join(dir, n), "utf8")));
1276
+ if (c) parsed.push(c);
1212
1277
  } catch {
1213
- return null;
1214
- }
1215
- }
1216
- };
1217
- var objectAt = (v, key2) => isObject(v) && isObject(v[key2]) ? v[key2] : {};
1218
- function userMcpServers(dir, io = realSetupIo) {
1219
- return objectAt(io.readJson(globalConfigFile(dir)), "mcpServers");
1220
- }
1221
- function trustedFolders(dir, io = realSetupIo) {
1222
- return Object.entries(objectAt(io.readJson(globalConfigFile(dir)), "projects")).filter(([, p]) => isObject(p) && p.hasTrustDialogAccepted === true).map(([folder]) => folder);
1223
- }
1224
- function trustToCopy(from, to, io = realSetupIo) {
1225
- const have = new Set(trustedFolders(to.dir, io));
1226
- return trustedFolders(from.dir, io).filter((folder) => !have.has(folder) && io.isDir(folder));
1278
+ }
1279
+ }
1280
+ return parsed.length ? aliveOnly(parsed, table(), bootTime()) : [];
1227
1281
  }
1228
- function withTrusted(config, folders) {
1229
- const base = isObject(config) ? config : {};
1230
- const projects = { ...objectAt(base, "projects") };
1231
- for (const folder of folders)
1232
- projects[folder] = { ...isObject(projects[folder]) ? projects[folder] : {}, hasTrustDialogAccepted: true };
1233
- return { ...base, projects };
1282
+ function readLiveClaudes(dir, now = Date.now(), table) {
1283
+ const dirs = dir ? [dir] : claudeSessionsDirs();
1284
+ const key2 = dirs.join("|");
1285
+ const cached = !table && !dir;
1286
+ if (cached && cache && now - cache.at < TTL_MS && cache.key === key2) return cache.list;
1287
+ let procs = table;
1288
+ const procTable = () => procs ??= processTable();
1289
+ const list = dirs.flatMap((d) => readDir(d, procTable));
1290
+ if (cached) cache = { at: now, key: key2, list };
1291
+ return list;
1234
1292
  }
1235
- function planSetupCopy(from, to, io = realSetupIo) {
1236
- const items = [];
1237
- const there = (rel) => io.exists(path10.join(to.dir, rel));
1238
- const differs = (rel) => !alreadyThere(path10.join(from.dir, rel), path10.join(to.dir, rel), io);
1239
- for (const f of FILES)
1240
- if (io.exists(path10.join(from.dir, f)) && differs(f)) items.push({ kind: "file", name: f, does: there(f) ? "replaces" : "adds" });
1241
- for (const d of FOLDERS)
1242
- if (io.isDir(path10.join(from.dir, d)) && io.list(path10.join(from.dir, d)).length && differs(d))
1243
- items.push({ kind: "folder", name: `${d}/`, does: there(d) ? "merges into" : "adds" });
1244
- for (const skill of io.list(path10.join(from.dir, "skills")).filter((s) => s !== "synced" && io.isDir(path10.join(from.dir, "skills", s))))
1245
- if (differs(path10.join("skills", skill)))
1246
- items.push({ kind: "folder", name: `skills/${skill}/`, does: there(path10.join("skills", skill)) ? "replaces" : "adds" });
1247
- for (const s of SETTINGS) {
1248
- const source = io.readJson(path10.join(from.dir, s));
1249
- if (!isObject(source)) continue;
1250
- const target = io.readJson(path10.join(to.dir, s));
1251
- const have = isObject(target) ? target : {};
1252
- if (!same(mergeSettings(source, have), have))
1253
- items.push({
1254
- kind: "settings",
1255
- name: s,
1256
- does: "merges into",
1257
- // What it would change, by name; the rest of the file stays (the status line and work's hooks always).
1258
- note: settingsChanges(source, have).join("; ")
1293
+
1294
+ // src/core/agents/typing.ts
1295
+ var SUBMIT_DELAY_MS = 250;
1296
+ var typeThenEnter = async (write, text, wait = (ms) => new Promise((r) => setTimeout(r, ms))) => {
1297
+ if (!await write(text)) return false;
1298
+ await wait(SUBMIT_DELAY_MS);
1299
+ return write("\r");
1300
+ };
1301
+
1302
+ // src/core/agents/claude/workspace.ts
1303
+ import fs10 from "fs";
1304
+ import path11 from "path";
1305
+ var claudeAllowRule = (r) => `Bash(${r.command}${r.prefix ? ":*" : ""})`;
1306
+ var claudeWorkspace = {
1307
+ write(dir, { allow, hooks }) {
1308
+ fs10.mkdirSync(path11.join(dir, ".claude"), { recursive: true });
1309
+ const byEvent = {};
1310
+ for (const h of hooks) {
1311
+ (byEvent[CLAUDE_EVENT[h.edge]] ??= []).push({
1312
+ hooks: [{ type: "command", command: h.command, ...h.timeoutSec ? { timeout: h.timeoutSec } : {} }]
1259
1313
  });
1314
+ }
1315
+ const settings = { permissions: { allow: allow.map(claudeAllowRule) }, hooks: byEvent };
1316
+ atomicWriteFile(path11.join(dir, ".claude", "settings.json"), JSON.stringify(settings, null, 2) + "\n");
1317
+ return [path11.join(".claude", "settings.json")];
1260
1318
  }
1261
- const servers = userMcpServers(from.dir, io);
1262
- const haveServers = userMcpServers(to.dir, io);
1263
- for (const [name, def] of Object.entries(servers)) {
1264
- if (same(haveServers[name], def)) continue;
1265
- const remote = isObject(def) && (def.type === "http" || def.type === "sse");
1266
- items.push({
1267
- kind: "mcp",
1268
- name,
1269
- does: name in haveServers ? "replaces" : "adds",
1270
- ...remote ? { note: `needs its own sign-in on ${to.name}: /mcp \u2192 ${name} \u2192 Authenticate` } : {}
1271
- });
1272
- }
1273
- const markets = io.readJson(path10.join(from.dir, "plugins", "known_marketplaces.json"));
1274
- const haveMarkets = io.readJson(path10.join(to.dir, "plugins", "known_marketplaces.json"));
1275
- const haveSources = new Set(
1276
- Object.values(isObject(haveMarkets) ? haveMarkets : {}).map((m) => marketplaceKey(isObject(m) ? m.source : null)).filter((k) => k !== null)
1277
- );
1278
- for (const [name, m] of Object.entries(isObject(markets) ? markets : {})) {
1279
- if (isObject(haveMarkets) && name in haveMarkets) continue;
1280
- const key2 = marketplaceKey(isObject(m) ? m.source : null);
1281
- if (key2 && haveSources.has(key2)) continue;
1282
- const args = marketplaceAddArgs(isObject(m) ? m.source : null);
1283
- if (args) items.push({ kind: "marketplace", name, does: "adds", note: args[3] });
1284
- }
1285
- const enabled = objectAt(io.readJson(path10.join(from.dir, "settings.json")), "enabledPlugins");
1286
- const installed = objectAt(io.readJson(path10.join(to.dir, "plugins", "installed_plugins.json")), "plugins");
1287
- for (const [id, on] of Object.entries(enabled))
1288
- if (on === true && !(id in installed)) items.push({ kind: "plugin", name: id, does: "adds", note: "installed from its marketplace" });
1289
- const trust = trustToCopy(from, to, io);
1290
- if (trust.length) {
1291
- const first = [...trust].sort((a, b) => a.length - b.length || a.localeCompare(b)).slice(0, 3);
1292
- items.push({
1293
- kind: "trust",
1294
- name: TRUSTED_FOLDERS,
1295
- does: "adds",
1296
- note: `${trust.length} folder${trust.length === 1 ? "" : "s"} ${from.name} trusts, so ${to.name} doesn\u2019t ask again: ${first.join(", ")}${trust.length > first.length ? ` and ${trust.length - first.length} more` : ""}`
1297
- });
1298
- }
1299
- return items;
1300
- }
1301
- var runClaude2 = (args, env, input) => {
1319
+ };
1320
+
1321
+ // src/core/agents/claude/skills.ts
1322
+ var MARKETPLACE_REPO = "moberghr/moberg-plugins";
1323
+ var MARKETPLACE_NAME = "moberg-plugins";
1324
+ var PLUGIN_SPEC = "work-tree@moberg-plugins";
1325
+ var runClaude2 = (args, env) => {
1302
1326
  const r = spawn_default.sync("claude", args, {
1303
1327
  encoding: "utf8",
1304
- timeout: 18e4,
1328
+ timeout: 6e4,
1305
1329
  windowsHide: true,
1306
1330
  stdio: "pipe",
1307
- env: applyEnvDelta(process.env, env),
1308
- ...input !== void 0 ? { input } : {}
1331
+ ...env ? { env: applyEnvDelta(process.env, env) } : {}
1309
1332
  });
1310
1333
  const text = (v) => typeof v === "string" ? v : "";
1311
- return { ok: !r.error && r.status === 0, out: r.error ? r.error.message : `${text(r.stderr)}
1312
- ${text(r.stdout)}` };
1334
+ return { ok: !r.error && r.status === 0, stdout: text(r.stdout), stderr: r.error ? r.error.message : text(r.stderr) };
1313
1335
  };
1314
- var lastLine2 = (out) => out.split("\n").map((l) => l.trim()).filter(Boolean).pop() ?? "it failed";
1315
- function setupEnv(dir) {
1316
- return accountDirKey(dir) === accountDirKey(defaultAccountDir()) ? { CLAUDE_CONFIG_DIR: null } : { CLAUDE_CONFIG_DIR: dir };
1336
+ var lastLine2 = (r) => `${r.stderr ?? ""}
1337
+ ${r.stdout}`.split("\n").map((l) => l.trim()).filter(Boolean).pop() ?? "";
1338
+ function isInstalled(listJson) {
1339
+ try {
1340
+ const list = JSON.parse(listJson);
1341
+ return Array.isArray(list) && list.some((p) => !!p && typeof p === "object" && p.id === PLUGIN_SPEC);
1342
+ } catch {
1343
+ return false;
1344
+ }
1317
1345
  }
1318
- function mergeSettingsFile(fromFile, toFile) {
1319
- const source = JSON.parse(fs9.readFileSync(fromFile, "utf-8"));
1320
- if (!isObject(source)) throw new Error("its settings are not an object");
1321
- fs9.mkdirSync(path10.dirname(toFile), { recursive: true });
1322
- ensureFile(toFile, "{}\n");
1323
- withFileLockSync(toFile, () => {
1324
- let target = {};
1325
- try {
1326
- target = JSON.parse(fs9.readFileSync(toFile, "utf-8"));
1327
- } catch {
1328
- }
1329
- atomicWriteFile(toFile, `${JSON.stringify(mergeSettings(source, isObject(target) ? target : {}), null, 2)}
1330
- `);
1331
- });
1346
+ function installFor(run) {
1347
+ if (!run(["--version"]).ok) return { ok: false, message: "Claude Code (the `claude` CLI) is not installed" };
1348
+ const list = run(["plugin", "marketplace", "list"]);
1349
+ if (!(list.ok && list.stdout.includes(MARKETPLACE_NAME))) {
1350
+ const add = run(["plugin", "marketplace", "add", MARKETPLACE_REPO, "--scope", "user", "--sparse", ".claude-plugin"]);
1351
+ if (!add.ok)
1352
+ return {
1353
+ ok: false,
1354
+ message: `could not register the Claude Code plugin marketplace (run \`claude plugin marketplace add ${MARKETPLACE_REPO}\`)`
1355
+ };
1356
+ }
1357
+ const install = run(["plugin", "install", PLUGIN_SPEC, "--scope", "user"]);
1358
+ if (install.ok) return { ok: true, message: `installed the Claude Code plugin ${PLUGIN_SPEC}` };
1359
+ if (isInstalled(run(["plugin", "list", "--json"]).stdout))
1360
+ return { ok: true, message: `the Claude Code plugin ${PLUGIN_SPEC} is installed` };
1361
+ const why = lastLine2(install);
1362
+ return {
1363
+ ok: false,
1364
+ message: `could not install the Claude Code plugin${why ? ` (${why})` : ""}: run \`claude plugin install ${PLUGIN_SPEC} --scope user\``
1365
+ };
1332
1366
  }
1333
- function trustFolders(file, folders) {
1334
- fs9.mkdirSync(path10.dirname(file), { recursive: true });
1335
- ensureFile(file, "{}\n");
1336
- withFileLockSync(file, () => {
1337
- let config;
1338
- try {
1339
- config = JSON.parse(fs9.readFileSync(file, "utf-8"));
1340
- } catch {
1341
- throw new Error("its config file can\u2019t be read");
1367
+ function claudeSkillsWith(run, accounts = setUpAccounts) {
1368
+ return {
1369
+ async install() {
1370
+ const list = accounts();
1371
+ if (list.length <= 1) return installFor((args) => run(args));
1372
+ const results = list.map((a) => {
1373
+ const env = a.name === "default" ? { CLAUDE_CONFIG_DIR: null } : { CLAUDE_CONFIG_DIR: a.dir };
1374
+ return { name: a.name, ...installFor((args) => run(args, env)) };
1375
+ });
1376
+ return { ok: results.every((r) => r.ok), message: results.map((r) => `${r.name}: ${r.message}`).join("; ") };
1342
1377
  }
1343
- atomicWriteFile(file, `${JSON.stringify(withTrusted(config, folders), null, 2)}
1344
- `);
1345
- });
1378
+ };
1346
1379
  }
1347
- async function applySetupCopy(from, to, run = runClaude2) {
1348
- if (accountDirKey(from.dir) === accountDirKey(to.dir)) throw new Error("an account\u2019s setup can\u2019t be copied to itself");
1349
- const env = setupEnv(to.dir);
1350
- const servers = userMcpServers(from.dir);
1351
- const markets = realSetupIo.readJson(path10.join(from.dir, "plugins", "known_marketplaces.json"));
1352
- const results = [];
1353
- for (const item of planSetupCopy(from, to)) {
1354
- try {
1355
- const rel = item.name.replace(/\/$/, "");
1356
- if (item.kind === "file") {
1357
- fs9.mkdirSync(to.dir, { recursive: true });
1358
- fs9.copyFileSync(path10.join(from.dir, rel), path10.join(to.dir, rel));
1359
- } else if (item.kind === "folder") {
1360
- fs9.cpSync(path10.join(from.dir, rel), path10.join(to.dir, rel), { recursive: true, force: true, verbatimSymlinks: true });
1361
- } else if (item.kind === "settings") {
1362
- mergeSettingsFile(path10.join(from.dir, rel), path10.join(to.dir, rel));
1363
- } else if (item.kind === "mcp") {
1364
- if (item.does === "replaces") run(["mcp", "remove", item.name, "--scope", "user"], env);
1365
- const r = run(["mcp", "add-json", item.name, "-", "--scope", "user"], env, JSON.stringify(servers[item.name]));
1366
- if (!r.ok) throw new Error(lastLine2(r.out));
1367
- } else if (item.kind === "marketplace") {
1368
- const args = marketplaceAddArgs(
1369
- isObject(markets) && isObject(markets[item.name]) ? markets[item.name].source : null
1370
- );
1371
- if (!args) throw new Error("work doesn\u2019t know how to add this kind of marketplace");
1372
- const r = run(args, env);
1373
- if (!r.ok) throw new Error(lastLine2(r.out));
1374
- } else if (item.kind === "trust") {
1375
- trustFolders(globalConfigFile(to.dir), trustToCopy(from, to));
1376
- } else {
1377
- const r = run(["plugin", "install", item.name, "--scope", "user", "-y"], env);
1378
- if (!r.ok) throw new Error(lastLine2(r.out));
1379
- }
1380
- results.push({ ...item, ok: true });
1381
- } catch (err) {
1382
- results.push({ ...item, ok: false, error: err instanceof Error ? err.message : String(err) });
1383
- }
1380
+ var claudeSkills = claudeSkillsWith(runClaude2);
1381
+ function installClaudeSkillsFor(dir, run = runClaude2) {
1382
+ return installFor((args) => run(args, { CLAUDE_CONFIG_DIR: dir }));
1383
+ }
1384
+
1385
+ // src/core/agents/claude/usage.ts
1386
+ var installer2;
1387
+ var loadInstaller2 = async () => installer2 ??= await import("./statusline-QJ6CJGHB.js");
1388
+ var asker;
1389
+ var loadAsker = async () => asker ??= await import("./usage-ask-BYPNLA2B.js");
1390
+ function restoreMessage(o, saved = "~/.work/statusline.json") {
1391
+ switch (o) {
1392
+ case "restored":
1393
+ return "Your own status line is back (work no longer reads the plan limits from it).";
1394
+ case "not-ours":
1395
+ return "Its status line isn't work's: left as it is.";
1396
+ case "kept":
1397
+ return `work's status line left in place: the copy of yours (${saved}) is missing or damaged. Set yours again with /statusline in Claude Code.`;
1398
+ case "failed":
1399
+ return "Its settings couldn't be changed (see above).";
1384
1400
  }
1385
- return results;
1386
1401
  }
1402
+ function namedReadings() {
1403
+ const accounts = claudeAccounts();
1404
+ const byKey = /* @__PURE__ */ new Map();
1405
+ for (const a of accounts) if (!byKey.has(accountOf(a.dir))) byKey.set(accountOf(a.dir), { name: a.name, isDefault: a.isDefault });
1406
+ return readReadings("claude").map((r) => {
1407
+ const known = byKey.get(r.account);
1408
+ return known ? { ...r, account: known.name, ...known.isDefault ? { isDefault: true } : {} } : r;
1409
+ });
1410
+ }
1411
+ var claudeUsage = {
1412
+ read: namedReadings,
1413
+ // A model's own weekly window (Fable's) is in no status line: asked of Claude Code, at most every 5 minutes an account.
1414
+ async refresh() {
1415
+ await (await loadAsker()).askClaudeUsage();
1416
+ },
1417
+ // A line in any account's own settings (an older work web's wrap counts as the line it saved).
1418
+ ownStatusLine: () => claudeAccounts().some((a) => userStatusLine({ configDir: a.dir }) !== null),
1419
+ async setup() {
1420
+ const done = await (await loadInstaller2()).unwrapAllStatusLines();
1421
+ const restored = done.filter((d) => d.outcome === "restored").map((d) => d.account);
1422
+ return restored.length > 0 ? `your own status line given back in ${restored.join(", ")} (work's Claudes carry their own now)` : "status line: nothing of work's in your settings";
1423
+ },
1424
+ async restore() {
1425
+ const done = await (await loadInstaller2()).unwrapAllStatusLines();
1426
+ const accounts = claudeAccounts();
1427
+ const ok = done.every((d) => d.outcome === "restored" || d.outcome === "not-ours");
1428
+ if (done.length === 1) return { ok, message: restoreMessage(done[0].outcome) };
1429
+ const message = done.map((d) => {
1430
+ const dir = accounts.find((a) => a.name === d.account)?.dir;
1431
+ return `${d.account}: ${restoreMessage(d.outcome, dir ? savedPath(dir) : void 0)}`;
1432
+ }).join("\n");
1433
+ return { ok, message };
1434
+ }
1435
+ };
1436
+
1437
+ // src/core/agents/claude/account-move.ts
1438
+ import fs12 from "fs";
1439
+ import path13 from "path";
1387
1440
 
1388
1441
  // src/core/agents/claude/account-admin.ts
1442
+ import fs11 from "fs";
1443
+ import os5 from "os";
1444
+ import path12 from "path";
1389
1445
  async function editConfig(fn) {
1390
1446
  const file = getConfigPath();
1391
- if (!fs10.existsSync(file)) throw new AccountAdminError("No configuration yet: run `work init` first.");
1447
+ if (!fs11.existsSync(file)) throw new AccountAdminError("No configuration yet: run `work init` first.");
1392
1448
  return withFileLock(file, () => {
1393
- const raw = JSON.parse(fs10.readFileSync(file, "utf-8"));
1449
+ const raw = JSON.parse(fs11.readFileSync(file, "utf-8"));
1394
1450
  const existing = raw.claudeAccounts;
1395
1451
  const accounts = existing && typeof existing === "object" && !Array.isArray(existing) ? { ...existing } : {};
1396
1452
  const out = fn(raw, accounts);
@@ -1402,14 +1458,14 @@ async function editConfig(fn) {
1402
1458
  }
1403
1459
  var validIn = (raw) => validateClaudeAccounts(raw.claudeAccounts, void 0, accountForbiddenRoots(raw)).accounts ?? {};
1404
1460
  async function addAccount(name, dir) {
1405
- const folder = expandAccountDir(dir?.trim() || path11.join(os5.homedir(), `.claude-${name}`));
1461
+ const folder = expandAccountDir(dir?.trim() || path12.join(os5.homedir(), `.claude-${name}`));
1406
1462
  if (!folder) throw new AccountAdminError(`${dir} is not an absolute folder`);
1407
1463
  return editConfig((raw, accounts) => {
1408
1464
  if (name in accounts) throw new AccountAdminError(`there is already an account \u201C${name}\u201D`);
1409
1465
  const problem = accountProblem(name, folder, Object.values(validIn(raw)), accountForbiddenRoots(raw));
1410
1466
  if (problem) throw new AccountAdminError(problem);
1411
1467
  try {
1412
- fs10.mkdirSync(folder, { recursive: true });
1468
+ fs11.mkdirSync(folder, { recursive: true });
1413
1469
  } catch (e) {
1414
1470
  throw new AccountAdminError(`couldn't make ${folder}: ${e instanceof Error ? e.message : String(e)}`);
1415
1471
  }
@@ -1486,14 +1542,14 @@ var AccountMoveError = class extends Error {
1486
1542
  };
1487
1543
  var isDir = (p) => {
1488
1544
  try {
1489
- return fs11.statSync(p).isDirectory();
1545
+ return fs12.statSync(p).isDirectory();
1490
1546
  } catch {
1491
1547
  return false;
1492
1548
  }
1493
1549
  };
1494
1550
  var exists = (p) => {
1495
1551
  try {
1496
- fs11.lstatSync(p);
1552
+ fs12.lstatSync(p);
1497
1553
  return true;
1498
1554
  } catch {
1499
1555
  return false;
@@ -1501,31 +1557,31 @@ var exists = (p) => {
1501
1557
  };
1502
1558
  var mtime = (p) => {
1503
1559
  try {
1504
- return fs11.statSync(p).mtimeMs;
1560
+ return fs12.statSync(p).mtimeMs;
1505
1561
  } catch {
1506
1562
  return 0;
1507
1563
  }
1508
1564
  };
1509
1565
  function moveEntry(from, to) {
1510
- fs11.mkdirSync(path12.dirname(to), { recursive: true });
1566
+ fs12.mkdirSync(path13.dirname(to), { recursive: true });
1511
1567
  try {
1512
- fs11.renameSync(from, to);
1568
+ fs12.renameSync(from, to);
1513
1569
  return;
1514
1570
  } catch (err) {
1515
1571
  const code = err.code;
1516
1572
  if (code !== "EXDEV" && code !== "EPERM") throw err;
1517
1573
  }
1518
1574
  try {
1519
- fs11.cpSync(from, to, { recursive: true, errorOnExist: true, force: false, preserveTimestamps: true });
1575
+ fs12.cpSync(from, to, { recursive: true, errorOnExist: true, force: false, preserveTimestamps: true });
1520
1576
  } catch (err) {
1521
- fs11.rmSync(to, { recursive: true, force: true });
1577
+ fs12.rmSync(to, { recursive: true, force: true });
1522
1578
  throw err;
1523
1579
  }
1524
1580
  try {
1525
- fs11.rmSync(from, { recursive: true, force: true });
1581
+ fs12.rmSync(from, { recursive: true, force: true });
1526
1582
  } catch (err) {
1527
1583
  try {
1528
- fs11.cpSync(to, from, { recursive: true, force: false, errorOnExist: false, preserveTimestamps: true });
1584
+ fs12.cpSync(to, from, { recursive: true, force: false, errorOnExist: false, preserveTimestamps: true });
1529
1585
  } catch (back) {
1530
1586
  const why = (e) => e instanceof Error ? e.message : String(e);
1531
1587
  throw new Error(`${why(err)}; what its delete took couldn't be put back (${why(back)}), so it is kept at ${to} too`, {
@@ -1533,7 +1589,7 @@ function moveEntry(from, to) {
1533
1589
  });
1534
1590
  }
1535
1591
  try {
1536
- fs11.rmSync(to, { recursive: true, force: true });
1592
+ fs12.rmSync(to, { recursive: true, force: true });
1537
1593
  } catch {
1538
1594
  }
1539
1595
  throw err;
@@ -1552,9 +1608,9 @@ function mergeInto(src, dst, tag, steps, moved) {
1552
1608
  return;
1553
1609
  }
1554
1610
  if (isDir(src) && isDir(dst)) {
1555
- for (const name of fs11.readdirSync(src)) mergeInto(path12.join(src, name), path12.join(dst, name), tag, steps, moved);
1611
+ for (const name of fs12.readdirSync(src)) mergeInto(path13.join(src, name), path13.join(dst, name), tag, steps, moved);
1556
1612
  try {
1557
- fs11.rmdirSync(src);
1613
+ fs12.rmdirSync(src);
1558
1614
  } catch {
1559
1615
  }
1560
1616
  return;
@@ -1588,32 +1644,32 @@ function undo(steps) {
1588
1644
  }
1589
1645
  function latestConversation(dir) {
1590
1646
  let best = null;
1591
- for (const name of fs11.readdirSync(dir)) {
1647
+ for (const name of fs12.readdirSync(dir)) {
1592
1648
  if (!name.endsWith(".jsonl")) continue;
1593
- const at = mtime(path12.join(dir, name));
1649
+ const at = mtime(path13.join(dir, name));
1594
1650
  if (!best || at > best.at) best = { name, at };
1595
1651
  }
1596
1652
  if (!best) return [];
1597
1653
  const id = best.name.slice(0, -".jsonl".length);
1598
- return [best.name, ...isDir(path12.join(dir, id)) ? [id] : []];
1654
+ return [best.name, ...isDir(path13.join(dir, id)) ? [id] : []];
1599
1655
  }
1600
1656
  function moveConversations(session, fromDir, toDir, tag = "old", opts = {}) {
1601
1657
  const steps = [];
1602
1658
  const moved = [];
1603
- if (path12.resolve(fromDir) === path12.resolve(toDir)) return { moved };
1659
+ if (path13.resolve(fromDir) === path13.resolve(toDir)) return { moved };
1604
1660
  const emptied = [];
1605
1661
  let at = "";
1606
1662
  try {
1607
1663
  for (const cwd of sessionRunFolders(session, false)) {
1608
1664
  const name = encodeProjectDir(cwd);
1609
- const src = path12.join(projectsRootOf(fromDir), name);
1665
+ const src = path13.join(projectsRootOf(fromDir), name);
1610
1666
  if (!isDir(src)) continue;
1611
1667
  at = src;
1612
- const dst = path12.join(projectsRootOf(toDir), name);
1668
+ const dst = path13.join(projectsRootOf(toDir), name);
1613
1669
  if (opts.onlyLatest) {
1614
1670
  for (const entry of latestConversation(src)) {
1615
- at = path12.join(src, entry);
1616
- mergeInto(path12.join(src, entry), path12.join(dst, entry), tag, steps, moved);
1671
+ at = path13.join(src, entry);
1672
+ mergeInto(path13.join(src, entry), path13.join(dst, entry), tag, steps, moved);
1617
1673
  }
1618
1674
  continue;
1619
1675
  }
@@ -1632,7 +1688,7 @@ function moveConversations(session, fromDir, toDir, tag = "old", opts = {}) {
1632
1688
  }
1633
1689
  for (const src of emptied) {
1634
1690
  try {
1635
- fs11.rmdirSync(src);
1691
+ fs12.rmdirSync(src);
1636
1692
  } catch {
1637
1693
  }
1638
1694
  }
@@ -1677,7 +1733,9 @@ var claudeAgent = {
1677
1733
  // `--settings ~/.work/claude-settings.json`: work's hooks and status line for this Claude alone.
1678
1734
  // (`write: false`: the dev server names the file the installed work wrote, never its own build.)
1679
1735
  sessionTool: (tool, o) => withSessionSettings(tool, sessionSettingsFile(o)),
1680
- startedWithSessionHooks: startedWithSessionSettings
1736
+ startedWithSessionHooks: startedWithSessionSettings,
1737
+ // Its folder marked trusted on the session's account (`projects[<cwd>].hasTrustDialogAccepted`).
1738
+ trustFolder: (s, cwd) => void trustSessionFolder(s, cwd)
1681
1739
  },
1682
1740
  conversation: {
1683
1741
  files: (s) => listTranscripts(s),
@@ -1701,8 +1759,8 @@ var claudeAgent = {
1701
1759
  prLinks: claudePrLinks,
1702
1760
  // In the session's own account's projects folder: that is where its `--continue` looks.
1703
1761
  restoreDir: (s) => {
1704
- const cwd = s.isGroup && s.paths[0] ? path13.dirname(s.paths[0]) : s.paths[0];
1705
- return cwd ? path13.join(projectsRootOf(accountDir(sessionAccount(s)) ?? void 0), encodeProjectDir(cwd)) : null;
1762
+ const cwd = s.isGroup && s.paths[0] ? path14.dirname(s.paths[0]) : s.paths[0];
1763
+ return cwd ? path14.join(projectsRootOf(accountDir(sessionAccount(s)) ?? void 0), encodeProjectDir(cwd)) : null;
1706
1764
  }
1707
1765
  },
1708
1766
  events: claudeEvents,
@@ -1733,7 +1791,7 @@ var claudeAgent = {
1733
1791
  denyRules: (repos) => claudeReadDenyRules(repos),
1734
1792
  // Its flags were measured on one Claude Code (READ_ONLY_MIN_VERSION): an older one gets no checkout run.
1735
1793
  // Loaded when a review asks: the hook processes load this adapter on every turn edge.
1736
- available: async () => (await import("./version-6A3FWFQR.js")).claudeReadOnlyAvailable()
1794
+ available: async () => (await import("./version-4IOMOIDP.js")).claudeReadOnlyAvailable()
1737
1795
  }
1738
1796
  },
1739
1797
  instructionsFile: "CLAUDE.md",
@@ -1772,7 +1830,7 @@ function plainAgent(id) {
1772
1830
  launch: {
1773
1831
  tool: (config) => getAiTool(config && getAiTool(config).cmd === id ? config : { aiCommand: id }),
1774
1832
  canResume: () => false,
1775
- resumeLaunch: (s) => ({ launchPath: s.isGroup ? path14.dirname(s.paths[0] ?? "") : s.paths[0] ?? "", hasConversation: false }),
1833
+ resumeLaunch: (s) => ({ launchPath: s.isGroup ? path15.dirname(s.paths[0] ?? "") : s.paths[0] ?? "", hasConversation: false }),
1776
1834
  cleanEnv: (env) => ({ ...env })
1777
1835
  },
1778
1836
  // Text, a pause, Enter — and no dialog to answer by keystroke (its screen is unknown).
@@ -1831,6 +1889,13 @@ function sessionToolFor(tool, o = {}) {
1831
1889
  return tool;
1832
1890
  }
1833
1891
  }
1892
+ function trustAgentFolder(agent, session, cwd) {
1893
+ try {
1894
+ agent.launch.trustFolder?.(session, cwd);
1895
+ } catch (e) {
1896
+ logSwallowed(`trust ${cwd} for ${agent.id}`, e);
1897
+ }
1898
+ }
1834
1899
  function agentToRecord(config) {
1835
1900
  const cmd = getAiTool(config ?? {}).cmd;
1836
1901
  return isKnownAgent(cmd) ? cmd : void 0;
@@ -1866,7 +1931,8 @@ export {
1866
1931
  agentWire,
1867
1932
  agentById,
1868
1933
  sessionToolFor,
1934
+ trustAgentFolder,
1869
1935
  agentToRecord,
1870
1936
  agentFor
1871
1937
  };
1872
- //# sourceMappingURL=chunk-QWD76K3E.js.map
1938
+ //# sourceMappingURL=chunk-KQMHGEI2.js.map