@moberg_hr/work-tree 2.21.0 → 2.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. package/README.md +2 -2
  2. package/dist/{account-RCMYHLUP.js → account-7QAH33LA.js} +11 -11
  3. package/dist/{add-repo-4NQUBY2A.js → add-repo-BFHI76SN.js} +7 -7
  4. package/dist/{answer-PAMFIP4B.js → answer-MWBEM7P7.js} +5 -5
  5. package/dist/{attach-QX72JAJN.js → attach-OTWK6PD5.js} +9 -9
  6. package/dist/bin.js +2 -2
  7. package/dist/{block-GLMNDZJC.js → block-EB22EIRA.js} +7 -7
  8. package/dist/{broadcast-4AMVPDUV.js → broadcast-BUJ5PWPB.js} +3 -3
  9. package/dist/{catchup-AWIE3PVF.js → catchup-YD3OCG66.js} +8 -8
  10. package/dist/{child-HG4WXOMX.js → child-OAKEKASR.js} +9 -9
  11. package/dist/{chunk-NS5K4IN5.js → chunk-2GIPYZCX.js} +5 -5
  12. package/dist/{chunk-LCKBOPFU.js → chunk-2YGXGVLV.js} +4 -4
  13. package/dist/{chunk-VAFS24P4.js → chunk-3LY3FKBF.js} +3 -3
  14. package/dist/{chunk-CVN5E4SU.js → chunk-42MSD6GF.js} +2 -2
  15. package/dist/{chunk-GFCVBKHL.js → chunk-5C6N447O.js} +2 -2
  16. package/dist/{chunk-XOEGBVWQ.js → chunk-5K33LDOS.js} +3 -3
  17. package/dist/{chunk-4FQ4QOIF.js → chunk-5QJQXRRY.js} +5 -5
  18. package/dist/{chunk-JKARKFLX.js → chunk-6GQG5CTJ.js} +6 -6
  19. package/dist/{chunk-HNK36GM3.js → chunk-6TY74NY6.js} +5 -5
  20. package/dist/{chunk-JNYXRMZL.js → chunk-6UJLYHK5.js} +2 -2
  21. package/dist/{chunk-DDDWQ36P.js → chunk-AI4BMD74.js} +4 -4
  22. package/dist/{chunk-QUOA4RSP.js → chunk-AO2IFRQW.js} +3 -3
  23. package/dist/{chunk-74FGCQML.js → chunk-C4W2VTOP.js} +3 -3
  24. package/dist/{chunk-IPXOVAEX.js → chunk-DD4GYEFQ.js} +3 -3
  25. package/dist/{chunk-KLJMHYU7.js → chunk-EDOYMSIA.js} +2 -2
  26. package/dist/chunk-EDOYMSIA.js.map +1 -0
  27. package/dist/{chunk-2IK6EQXW.js → chunk-EGYNUNKI.js} +5 -5
  28. package/dist/{chunk-YNPORFRR.js → chunk-FO37VXQE.js} +2 -2
  29. package/dist/{chunk-U3UPGZGQ.js → chunk-FYDBT6AI.js} +2 -2
  30. package/dist/{chunk-IMO7KKYZ.js → chunk-GRHVKD2K.js} +72 -3
  31. package/dist/chunk-GRHVKD2K.js.map +1 -0
  32. package/dist/{chunk-2EXZ24MI.js → chunk-H5SEBLE2.js} +3 -3
  33. package/dist/{chunk-OW7YUW4W.js → chunk-H7QMUEEA.js} +2 -2
  34. package/dist/{chunk-XHTBWRXU.js → chunk-I2JMZBZY.js} +4 -4
  35. package/dist/{chunk-XN77RX4I.js → chunk-INPJC2TX.js} +4 -4
  36. package/dist/{chunk-BOQJBO4K.js → chunk-IPIVNBKT.js} +2 -2
  37. package/dist/{chunk-4EPMJVQY.js → chunk-IQWUHU2D.js} +4 -4
  38. package/dist/{chunk-ZBVVI3XT.js → chunk-JBQOBCH4.js} +2 -2
  39. package/dist/{chunk-JZZJRVWZ.js → chunk-KLUN6KKF.js} +3 -3
  40. package/dist/{chunk-YM3DJE2Q.js → chunk-MAXPKVQM.js} +4 -4
  41. package/dist/{chunk-3BXCMTFV.js → chunk-MSWU4NDC.js} +2 -2
  42. package/dist/{chunk-COBR6DBI.js → chunk-OOFCBN43.js} +2 -2
  43. package/dist/{chunk-2MZODCSG.js → chunk-ORBZDEPN.js} +2 -2
  44. package/dist/{chunk-XCQD5XSN.js → chunk-QAK5RTKL.js} +4 -4
  45. package/dist/{chunk-IYJHSMXQ.js → chunk-QBB5JDFF.js} +2 -2
  46. package/dist/{chunk-YKWDZCUW.js → chunk-QWD76K3E.js} +152 -112
  47. package/dist/chunk-QWD76K3E.js.map +1 -0
  48. package/dist/{chunk-X3ON5EYW.js → chunk-S7Z3UJW7.js} +2 -2
  49. package/dist/{chunk-I3AO3NVC.js → chunk-SE3M6KDX.js} +2 -2
  50. package/dist/{chunk-777W7BCX.js → chunk-TCKNRYWG.js} +9 -9
  51. package/dist/{chunk-PKY63672.js → chunk-THHDB7JN.js} +2 -2
  52. package/dist/chunk-TIRRXH6I.js +9 -0
  53. package/dist/{chunk-E4EQDJD2.js → chunk-UPYZYJPK.js} +3 -3
  54. package/dist/{chunk-POF2FE4S.js → chunk-V7TACE53.js} +7 -7
  55. package/dist/{chunk-AGICFQMJ.js → chunk-VQDE3DRG.js} +13 -2
  56. package/dist/{chunk-AGICFQMJ.js.map → chunk-VQDE3DRG.js.map} +1 -1
  57. package/dist/{chunk-NISGFF25.js → chunk-WRINMNRX.js} +4 -4
  58. package/dist/{chunk-A5O3CP37.js → chunk-XOA3X4MN.js} +3 -3
  59. package/dist/{chunk-WDGQAGF4.js → chunk-XT3HB45X.js} +4 -4
  60. package/dist/{chunk-LYUD6DNS.js → chunk-XVE23FA2.js} +4 -3
  61. package/dist/chunk-XVE23FA2.js.map +1 -0
  62. package/dist/{chunk-NJ7CHZJS.js → chunk-Z5SKKACK.js} +2 -2
  63. package/dist/{chunk-MGMRLWJA.js → chunk-ZG3W3DJ3.js} +6 -6
  64. package/dist/{chunk-FGZVHEFP.js → chunk-ZLIW4G24.js} +57 -57
  65. package/dist/{cleanup-757RQ5NW.js → cleanup-2VQTVWIG.js} +21 -21
  66. package/dist/{cli-RRT5BOWM.js → cli-KRTX5VN7.js} +3 -3
  67. package/dist/{color-SMQZHNFH.js → color-2G5SIVSI.js} +5 -5
  68. package/dist/{config-TSNQIWAG.js → config-XBTJVJK3.js} +5 -5
  69. package/dist/{coordinate-RJOG5DCS.js → coordinate-S3HTZFMP.js} +10 -10
  70. package/dist/{diff-GBVTHXCV.js → diff-63GBECFI.js} +6 -6
  71. package/dist/{digest-UFZSHQCP.js → digest-367JAS7G.js} +5 -5
  72. package/dist/{fork-5ISDLKQF.js → fork-ALCUOTFA.js} +18 -18
  73. package/dist/{history-ZX5COG2M.js → history-JESCVDIU.js} +3 -3
  74. package/dist/{hook-3LHEQPBM.js → hook-2Y4UOTZ6.js} +41 -8
  75. package/dist/hook-2Y4UOTZ6.js.map +1 -0
  76. package/dist/{hydrate-N6ZIPOLK.js → hydrate-F2BZ6K7Y.js} +3 -3
  77. package/dist/{init-P42G52BR.js → init-QPU6VIYG.js} +7 -7
  78. package/dist/{install-skills-N63CWTOH.js → install-skills-KSLTHRHH.js} +3 -3
  79. package/dist/install-skills-bin.js +2 -2
  80. package/dist/{keep-HZC6HIWF.js → keep-DJRHEEFB.js} +5 -5
  81. package/dist/{list-UAQKE4BT.js → list-5AVOAFXA.js} +3 -3
  82. package/dist/{move-TUX7SKKM.js → move-75DQHXBR.js} +8 -8
  83. package/dist/{note-SLVYVDC5.js → note-VFFRLSIF.js} +5 -5
  84. package/dist/{overlaps-HC7GB3OL.js → overlaps-JW7C7MWI.js} +8 -8
  85. package/dist/{pin-73FSKVDV.js → pin-CE63RHI3.js} +5 -5
  86. package/dist/{pr-FJHTWA6C.js → pr-ONSSW6J4.js} +13 -13
  87. package/dist/{prune-4DG3YNHQ.js → prune-HHTATOOQ.js} +19 -19
  88. package/dist/{pty-host-72PLYNBT.js → pty-host-4LWIAULG.js} +7 -7
  89. package/dist/{read-VFPXCEP6.js → read-O72SGX7S.js} +5 -5
  90. package/dist/{recent-MT4K3M7A.js → recent-TI6O5KHP.js} +8 -8
  91. package/dist/{remove-CTXCSMMJ.js → remove-L7YB6227.js} +20 -20
  92. package/dist/{report-OZN3UE3W.js → report-2NXU55QS.js} +8 -8
  93. package/dist/{restart-P3HCOUJY.js → restart-P352BMWT.js} +5 -5
  94. package/dist/{resume-IQTLSLS3.js → resume-PAHRZPAJ.js} +8 -8
  95. package/dist/{review-RAFSZBOC.js → review-WPHNJ47M.js} +4 -4
  96. package/dist/{run-UYTHFJ7P.js → run-3CYZS4BM.js} +3 -3
  97. package/dist/{screen-A33PDNY4.js → screen-YX7C4PXH.js} +5 -5
  98. package/dist/{search-RIZJANOI.js → search-3LOJM3G4.js} +3 -3
  99. package/dist/{section-XOWMNRLK.js → section-RMQAANNH.js} +5 -5
  100. package/dist/{send-DTHWOC4Z.js → send-S3BBWJHD.js} +6 -6
  101. package/dist/{sessions-PP555IEM.js → sessions-5WRAWFNI.js} +16 -16
  102. package/dist/show-VGC7QTGL.js +94 -0
  103. package/dist/show-VGC7QTGL.js.map +1 -0
  104. package/dist/{snooze-F43627DM.js → snooze-5TASHLGL.js} +5 -5
  105. package/dist/{start-LQP5L2UY.js → start-JGVD2O5V.js} +5 -5
  106. package/dist/{status-U3OJRC4Y.js → status-ZO54EQVF.js} +6 -6
  107. package/dist/{stop-EQCUYVUF.js → stop-XXLTBUCF.js} +5 -5
  108. package/dist/{sync-GQBVRSSD.js → sync-2BTD7U2A.js} +19 -19
  109. package/dist/{time-FOC4HMSX.js → time-WHUJH7FC.js} +6 -6
  110. package/dist/{timesheet-YEKW5L2L.js → timesheet-T575FQNM.js} +8 -8
  111. package/dist/{tree-2L6ZCDCE.js → tree-PV6GRIRG.js} +18 -18
  112. package/dist/{update-RO7OB54G.js → update-W5KD6237.js} +10 -10
  113. package/dist/{usage-2OYLKV6R.js → usage-AB2UAMHM.js} +5 -5
  114. package/dist/{wait-4LZJ5WNQ.js → wait-RULOZMLR.js} +6 -6
  115. package/dist/wd-bin.js +2 -2
  116. package/dist/web/assets/{PtyView-B11_5QTN.js → PtyView-BTvDVP2F.js} +27 -27
  117. package/dist/web/assets/PtyView-BTvDVP2F.js.map +1 -0
  118. package/dist/web/assets/index-C-u0RGnu.css +1 -0
  119. package/dist/web/assets/index-CBDCRV_L.js +129 -0
  120. package/dist/web/assets/index-CBDCRV_L.js.map +1 -0
  121. package/dist/web/index.html +2 -2
  122. package/dist/{web-A6FWH4WT.js → web-4JKMKTTD.js} +800 -475
  123. package/dist/web-4JKMKTTD.js.map +1 -0
  124. package/npm-shrinkwrap.json +2 -2
  125. package/package.json +1 -1
  126. package/plugins/work-tree/skills/work-sessions/SKILL.md +1 -1
  127. package/dist/chunk-5GW6OEYN.js +0 -9
  128. package/dist/chunk-IMO7KKYZ.js.map +0 -1
  129. package/dist/chunk-KLJMHYU7.js.map +0 -1
  130. package/dist/chunk-LYUD6DNS.js.map +0 -1
  131. package/dist/chunk-YKWDZCUW.js.map +0 -1
  132. package/dist/hook-3LHEQPBM.js.map +0 -1
  133. package/dist/show-ZY2X46TS.js +0 -68
  134. package/dist/show-ZY2X46TS.js.map +0 -1
  135. package/dist/web/assets/PtyView-B11_5QTN.js.map +0 -1
  136. package/dist/web/assets/index-Cuq2OWKw.css +0 -1
  137. package/dist/web/assets/index-Rj1VHPO1.js +0 -127
  138. package/dist/web/assets/index-Rj1VHPO1.js.map +0 -1
  139. package/dist/web-A6FWH4WT.js.map +0 -1
  140. /package/dist/{account-RCMYHLUP.js.map → account-7QAH33LA.js.map} +0 -0
  141. /package/dist/{add-repo-4NQUBY2A.js.map → add-repo-BFHI76SN.js.map} +0 -0
  142. /package/dist/{answer-PAMFIP4B.js.map → answer-MWBEM7P7.js.map} +0 -0
  143. /package/dist/{attach-QX72JAJN.js.map → attach-OTWK6PD5.js.map} +0 -0
  144. /package/dist/{block-GLMNDZJC.js.map → block-EB22EIRA.js.map} +0 -0
  145. /package/dist/{broadcast-4AMVPDUV.js.map → broadcast-BUJ5PWPB.js.map} +0 -0
  146. /package/dist/{catchup-AWIE3PVF.js.map → catchup-YD3OCG66.js.map} +0 -0
  147. /package/dist/{child-HG4WXOMX.js.map → child-OAKEKASR.js.map} +0 -0
  148. /package/dist/{chunk-NS5K4IN5.js.map → chunk-2GIPYZCX.js.map} +0 -0
  149. /package/dist/{chunk-LCKBOPFU.js.map → chunk-2YGXGVLV.js.map} +0 -0
  150. /package/dist/{chunk-VAFS24P4.js.map → chunk-3LY3FKBF.js.map} +0 -0
  151. /package/dist/{chunk-CVN5E4SU.js.map → chunk-42MSD6GF.js.map} +0 -0
  152. /package/dist/{chunk-GFCVBKHL.js.map → chunk-5C6N447O.js.map} +0 -0
  153. /package/dist/{chunk-XOEGBVWQ.js.map → chunk-5K33LDOS.js.map} +0 -0
  154. /package/dist/{chunk-4FQ4QOIF.js.map → chunk-5QJQXRRY.js.map} +0 -0
  155. /package/dist/{chunk-JKARKFLX.js.map → chunk-6GQG5CTJ.js.map} +0 -0
  156. /package/dist/{chunk-HNK36GM3.js.map → chunk-6TY74NY6.js.map} +0 -0
  157. /package/dist/{chunk-JNYXRMZL.js.map → chunk-6UJLYHK5.js.map} +0 -0
  158. /package/dist/{chunk-DDDWQ36P.js.map → chunk-AI4BMD74.js.map} +0 -0
  159. /package/dist/{chunk-QUOA4RSP.js.map → chunk-AO2IFRQW.js.map} +0 -0
  160. /package/dist/{chunk-74FGCQML.js.map → chunk-C4W2VTOP.js.map} +0 -0
  161. /package/dist/{chunk-IPXOVAEX.js.map → chunk-DD4GYEFQ.js.map} +0 -0
  162. /package/dist/{chunk-2IK6EQXW.js.map → chunk-EGYNUNKI.js.map} +0 -0
  163. /package/dist/{chunk-YNPORFRR.js.map → chunk-FO37VXQE.js.map} +0 -0
  164. /package/dist/{chunk-U3UPGZGQ.js.map → chunk-FYDBT6AI.js.map} +0 -0
  165. /package/dist/{chunk-2EXZ24MI.js.map → chunk-H5SEBLE2.js.map} +0 -0
  166. /package/dist/{chunk-OW7YUW4W.js.map → chunk-H7QMUEEA.js.map} +0 -0
  167. /package/dist/{chunk-XHTBWRXU.js.map → chunk-I2JMZBZY.js.map} +0 -0
  168. /package/dist/{chunk-XN77RX4I.js.map → chunk-INPJC2TX.js.map} +0 -0
  169. /package/dist/{chunk-BOQJBO4K.js.map → chunk-IPIVNBKT.js.map} +0 -0
  170. /package/dist/{chunk-4EPMJVQY.js.map → chunk-IQWUHU2D.js.map} +0 -0
  171. /package/dist/{chunk-ZBVVI3XT.js.map → chunk-JBQOBCH4.js.map} +0 -0
  172. /package/dist/{chunk-JZZJRVWZ.js.map → chunk-KLUN6KKF.js.map} +0 -0
  173. /package/dist/{chunk-YM3DJE2Q.js.map → chunk-MAXPKVQM.js.map} +0 -0
  174. /package/dist/{chunk-3BXCMTFV.js.map → chunk-MSWU4NDC.js.map} +0 -0
  175. /package/dist/{chunk-COBR6DBI.js.map → chunk-OOFCBN43.js.map} +0 -0
  176. /package/dist/{chunk-2MZODCSG.js.map → chunk-ORBZDEPN.js.map} +0 -0
  177. /package/dist/{chunk-XCQD5XSN.js.map → chunk-QAK5RTKL.js.map} +0 -0
  178. /package/dist/{chunk-IYJHSMXQ.js.map → chunk-QBB5JDFF.js.map} +0 -0
  179. /package/dist/{chunk-X3ON5EYW.js.map → chunk-S7Z3UJW7.js.map} +0 -0
  180. /package/dist/{chunk-I3AO3NVC.js.map → chunk-SE3M6KDX.js.map} +0 -0
  181. /package/dist/{chunk-777W7BCX.js.map → chunk-TCKNRYWG.js.map} +0 -0
  182. /package/dist/{chunk-PKY63672.js.map → chunk-THHDB7JN.js.map} +0 -0
  183. /package/dist/{chunk-5GW6OEYN.js.map → chunk-TIRRXH6I.js.map} +0 -0
  184. /package/dist/{chunk-E4EQDJD2.js.map → chunk-UPYZYJPK.js.map} +0 -0
  185. /package/dist/{chunk-POF2FE4S.js.map → chunk-V7TACE53.js.map} +0 -0
  186. /package/dist/{chunk-NISGFF25.js.map → chunk-WRINMNRX.js.map} +0 -0
  187. /package/dist/{chunk-A5O3CP37.js.map → chunk-XOA3X4MN.js.map} +0 -0
  188. /package/dist/{chunk-WDGQAGF4.js.map → chunk-XT3HB45X.js.map} +0 -0
  189. /package/dist/{chunk-NJ7CHZJS.js.map → chunk-Z5SKKACK.js.map} +0 -0
  190. /package/dist/{chunk-MGMRLWJA.js.map → chunk-ZG3W3DJ3.js.map} +0 -0
  191. /package/dist/{chunk-FGZVHEFP.js.map → chunk-ZLIW4G24.js.map} +0 -0
  192. /package/dist/{cleanup-757RQ5NW.js.map → cleanup-2VQTVWIG.js.map} +0 -0
  193. /package/dist/{cli-RRT5BOWM.js.map → cli-KRTX5VN7.js.map} +0 -0
  194. /package/dist/{color-SMQZHNFH.js.map → color-2G5SIVSI.js.map} +0 -0
  195. /package/dist/{config-TSNQIWAG.js.map → config-XBTJVJK3.js.map} +0 -0
  196. /package/dist/{coordinate-RJOG5DCS.js.map → coordinate-S3HTZFMP.js.map} +0 -0
  197. /package/dist/{diff-GBVTHXCV.js.map → diff-63GBECFI.js.map} +0 -0
  198. /package/dist/{digest-UFZSHQCP.js.map → digest-367JAS7G.js.map} +0 -0
  199. /package/dist/{fork-5ISDLKQF.js.map → fork-ALCUOTFA.js.map} +0 -0
  200. /package/dist/{history-ZX5COG2M.js.map → history-JESCVDIU.js.map} +0 -0
  201. /package/dist/{hydrate-N6ZIPOLK.js.map → hydrate-F2BZ6K7Y.js.map} +0 -0
  202. /package/dist/{init-P42G52BR.js.map → init-QPU6VIYG.js.map} +0 -0
  203. /package/dist/{install-skills-N63CWTOH.js.map → install-skills-KSLTHRHH.js.map} +0 -0
  204. /package/dist/{keep-HZC6HIWF.js.map → keep-DJRHEEFB.js.map} +0 -0
  205. /package/dist/{list-UAQKE4BT.js.map → list-5AVOAFXA.js.map} +0 -0
  206. /package/dist/{move-TUX7SKKM.js.map → move-75DQHXBR.js.map} +0 -0
  207. /package/dist/{note-SLVYVDC5.js.map → note-VFFRLSIF.js.map} +0 -0
  208. /package/dist/{overlaps-HC7GB3OL.js.map → overlaps-JW7C7MWI.js.map} +0 -0
  209. /package/dist/{pin-73FSKVDV.js.map → pin-CE63RHI3.js.map} +0 -0
  210. /package/dist/{pr-FJHTWA6C.js.map → pr-ONSSW6J4.js.map} +0 -0
  211. /package/dist/{prune-4DG3YNHQ.js.map → prune-HHTATOOQ.js.map} +0 -0
  212. /package/dist/{pty-host-72PLYNBT.js.map → pty-host-4LWIAULG.js.map} +0 -0
  213. /package/dist/{read-VFPXCEP6.js.map → read-O72SGX7S.js.map} +0 -0
  214. /package/dist/{recent-MT4K3M7A.js.map → recent-TI6O5KHP.js.map} +0 -0
  215. /package/dist/{remove-CTXCSMMJ.js.map → remove-L7YB6227.js.map} +0 -0
  216. /package/dist/{report-OZN3UE3W.js.map → report-2NXU55QS.js.map} +0 -0
  217. /package/dist/{restart-P3HCOUJY.js.map → restart-P352BMWT.js.map} +0 -0
  218. /package/dist/{resume-IQTLSLS3.js.map → resume-PAHRZPAJ.js.map} +0 -0
  219. /package/dist/{review-RAFSZBOC.js.map → review-WPHNJ47M.js.map} +0 -0
  220. /package/dist/{run-UYTHFJ7P.js.map → run-3CYZS4BM.js.map} +0 -0
  221. /package/dist/{screen-A33PDNY4.js.map → screen-YX7C4PXH.js.map} +0 -0
  222. /package/dist/{search-RIZJANOI.js.map → search-3LOJM3G4.js.map} +0 -0
  223. /package/dist/{section-XOWMNRLK.js.map → section-RMQAANNH.js.map} +0 -0
  224. /package/dist/{send-DTHWOC4Z.js.map → send-S3BBWJHD.js.map} +0 -0
  225. /package/dist/{sessions-PP555IEM.js.map → sessions-5WRAWFNI.js.map} +0 -0
  226. /package/dist/{snooze-F43627DM.js.map → snooze-5TASHLGL.js.map} +0 -0
  227. /package/dist/{start-LQP5L2UY.js.map → start-JGVD2O5V.js.map} +0 -0
  228. /package/dist/{status-U3OJRC4Y.js.map → status-ZO54EQVF.js.map} +0 -0
  229. /package/dist/{stop-EQCUYVUF.js.map → stop-XXLTBUCF.js.map} +0 -0
  230. /package/dist/{sync-GQBVRSSD.js.map → sync-2BTD7U2A.js.map} +0 -0
  231. /package/dist/{time-FOC4HMSX.js.map → time-WHUJH7FC.js.map} +0 -0
  232. /package/dist/{timesheet-YEKW5L2L.js.map → timesheet-T575FQNM.js.map} +0 -0
  233. /package/dist/{tree-2L6ZCDCE.js.map → tree-PV6GRIRG.js.map} +0 -0
  234. /package/dist/{update-RO7OB54G.js.map → update-W5KD6237.js.map} +0 -0
  235. /package/dist/{usage-2OYLKV6R.js.map → usage-AB2UAMHM.js.map} +0 -0
  236. /package/dist/{wait-4LZJ5WNQ.js.map → wait-RULOZMLR.js.map} +0 -0
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  ensureAgentPath,
4
4
  restartHost
5
- } from "./chunk-COBR6DBI.js";
5
+ } from "./chunk-OOFCBN43.js";
6
6
  import {
7
7
  addTask,
8
8
  completeTask,
@@ -24,7 +24,7 @@ import {
24
24
  serveSpa,
25
25
  sessionBaseForPath,
26
26
  submitReviewSchema
27
- } from "./chunk-LYUD6DNS.js";
27
+ } from "./chunk-XVE23FA2.js";
28
28
  import {
29
29
  announceChange,
30
30
  createArchivedRows,
@@ -39,25 +39,25 @@ import {
39
39
  stageSeenKey,
40
40
  storeHolding,
41
41
  withRestoring
42
- } from "./chunk-POF2FE4S.js";
42
+ } from "./chunk-V7TACE53.js";
43
43
  import {
44
44
  createDigestSource
45
- } from "./chunk-XCQD5XSN.js";
45
+ } from "./chunk-QAK5RTKL.js";
46
46
  import {
47
47
  createBuildFoldersJob,
48
48
  defaultBranchTidyDeps,
49
49
  defaultBuildFoldersDeps,
50
50
  deleteMergedBranches,
51
51
  findMergedBranches
52
- } from "./chunk-JKARKFLX.js";
52
+ } from "./chunk-6GQG5CTJ.js";
53
53
  import {
54
54
  defaultCleanupDeps
55
- } from "./chunk-HNK36GM3.js";
55
+ } from "./chunk-6TY74NY6.js";
56
56
  import {
57
57
  DiffStatCache,
58
58
  findOverlaps,
59
59
  wantsDiffStat
60
- } from "./chunk-ZBVVI3XT.js";
60
+ } from "./chunk-JBQOBCH4.js";
61
61
  import {
62
62
  dropLocalReview,
63
63
  readLocalReview,
@@ -77,22 +77,14 @@ import {
77
77
  graphProblem,
78
78
  signOutGraph,
79
79
  startDeviceLogin
80
- } from "./chunk-NS5K4IN5.js";
81
- import {
82
- childBrief,
83
- childrenOf,
84
- coordinatorSince,
85
- newBranchCheck,
86
- setParent,
87
- spawnCheck
88
- } from "./chunk-AGICFQMJ.js";
80
+ } from "./chunk-2GIPYZCX.js";
89
81
  import {
90
82
  anyOwnStatusLine,
91
83
  buildUsage,
92
84
  realUsageDeps,
93
85
  refreshUsage,
94
86
  setupAgentUsage
95
- } from "./chunk-XHTBWRXU.js";
87
+ } from "./chunk-I2JMZBZY.js";
96
88
  import {
97
89
  sendToSession
98
90
  } from "./chunk-KWHHB737.js";
@@ -113,7 +105,7 @@ import {
113
105
  removeBlocker,
114
106
  sweepBlocks,
115
107
  unblockedPrompt
116
- } from "./chunk-74FGCQML.js";
108
+ } from "./chunk-C4W2VTOP.js";
117
109
  import {
118
110
  jiraWorklogPoster,
119
111
  logWorkDay,
@@ -122,7 +114,7 @@ import {
122
114
  } from "./chunk-WIXY4EDH.js";
123
115
  import {
124
116
  sessionWorkTime
125
- } from "./chunk-JZZJRVWZ.js";
117
+ } from "./chunk-KLUN6KKF.js";
126
118
  import {
127
119
  accountOverview,
128
120
  accountSkillsNote,
@@ -134,7 +126,7 @@ import {
134
126
  removeAgentAccount,
135
127
  setDefaultAgentAccount,
136
128
  switchRefusal
137
- } from "./chunk-MGMRLWJA.js";
129
+ } from "./chunk-ZG3W3DJ3.js";
138
130
  import "./chunk-LK7HJGUC.js";
139
131
  import {
140
132
  freeLeftovers,
@@ -144,25 +136,25 @@ import {
144
136
  parsePrRef,
145
137
  resolvePrToStart,
146
138
  workOnPrPrompt
147
- } from "./chunk-XOEGBVWQ.js";
139
+ } from "./chunk-5K33LDOS.js";
148
140
  import {
149
141
  legacyUnsafeCheck
150
- } from "./chunk-2IK6EQXW.js";
142
+ } from "./chunk-EGYNUNKI.js";
151
143
  import {
152
144
  howToLift
153
145
  } from "./chunk-FZHFD2AY.js";
154
146
  import {
155
147
  agentsBySession,
156
148
  summarizeAgents
157
- } from "./chunk-NJ7CHZJS.js";
149
+ } from "./chunk-Z5SKKACK.js";
158
150
  import {
159
151
  removeWorktreeInChild
160
- } from "./chunk-3BXCMTFV.js";
152
+ } from "./chunk-MSWU4NDC.js";
161
153
  import {
162
154
  archiveMergedSession,
163
155
  archiveWaiting,
164
156
  defaultArchiveDeps
165
- } from "./chunk-777W7BCX.js";
157
+ } from "./chunk-TCKNRYWG.js";
166
158
  import {
167
159
  cleanupVerdict,
168
160
  createCleanupJob
@@ -182,7 +174,7 @@ import {
182
174
  retireResolvedReplies,
183
175
  sessionRepoRefs,
184
176
  withThreadContext
185
- } from "./chunk-LCKBOPFU.js";
177
+ } from "./chunk-2YGXGVLV.js";
186
178
  import {
187
179
  DEFAULT_TRUSTED_BOTS,
188
180
  createCiStore,
@@ -192,7 +184,7 @@ import {
192
184
  openThreadsOf,
193
185
  reviewMessage,
194
186
  subAgentHint
195
- } from "./chunk-VAFS24P4.js";
187
+ } from "./chunk-3LY3FKBF.js";
196
188
  import {
197
189
  commandWords,
198
190
  describeProcess,
@@ -206,7 +198,7 @@ import {
206
198
  defaultForkDeps,
207
199
  forkSession,
208
200
  startSessionWithPrompt
209
- } from "./chunk-WDGQAGF4.js";
201
+ } from "./chunk-XT3HB45X.js";
210
202
  import {
211
203
  childText,
212
204
  createInChild,
@@ -214,7 +206,7 @@ import {
214
206
  keyedQueue,
215
207
  oneAtATime,
216
208
  runWorkChild
217
- } from "./chunk-4EPMJVQY.js";
209
+ } from "./chunk-IQWUHU2D.js";
218
210
  import {
219
211
  configurePtyPool,
220
212
  detachPtyPool,
@@ -239,25 +231,25 @@ import {
239
231
  syncPtyPool,
240
232
  terminalTicketUrl,
241
233
  writeToPty
242
- } from "./chunk-4FQ4QOIF.js";
234
+ } from "./chunk-5QJQXRRY.js";
243
235
  import "./chunk-VRMALBZK.js";
244
236
  import {
245
237
  disposeAllWatchers,
246
238
  disposeSessionWatcher,
247
239
  findSession as findSession2,
248
240
  subscribeSession
249
- } from "./chunk-U3UPGZGQ.js";
241
+ } from "./chunk-FYDBT6AI.js";
250
242
  import "./chunk-OHX7WKZU.js";
251
243
  import "./chunk-DLV7TRON.js";
252
244
  import {
253
245
  addRepoRefusal,
254
246
  addedRepoNote
255
- } from "./chunk-CVN5E4SU.js";
247
+ } from "./chunk-42MSD6GF.js";
256
248
  import {
257
249
  teardownWorktree,
258
250
  toBaseSpec,
259
251
  wouldRefuseRemoval
260
- } from "./chunk-2EXZ24MI.js";
252
+ } from "./chunk-H5SEBLE2.js";
261
253
  import "./chunk-Y7PWSACJ.js";
262
254
  import {
263
255
  isWorktreeFolder
@@ -277,30 +269,30 @@ import {
277
269
  stackedOn,
278
270
  updateFromBase,
279
271
  updateFromMain
280
- } from "./chunk-YM3DJE2Q.js";
272
+ } from "./chunk-MAXPKVQM.js";
281
273
  import {
282
274
  sessionStatusView,
283
275
  shownState
284
- } from "./chunk-E4EQDJD2.js";
276
+ } from "./chunk-UPYZYJPK.js";
285
277
  import {
286
278
  askCatchUp,
287
279
  cachedCatchUp,
288
280
  catchUp,
289
281
  catchUpFacts,
290
282
  forgetCatchUp
291
- } from "./chunk-DDDWQ36P.js";
283
+ } from "./chunk-AI4BMD74.js";
292
284
  import {
293
285
  internalReadOnly,
294
286
  runInternal,
295
287
  runInternalReadOnly,
296
288
  summarizeCheckpoint,
297
289
  throttleTrailing
298
- } from "./chunk-NISGFF25.js";
290
+ } from "./chunk-WRINMNRX.js";
299
291
  import {
300
292
  computeDiff,
301
293
  computeRangeDiff,
302
294
  parseGitDiff
303
- } from "./chunk-BOQJBO4K.js";
295
+ } from "./chunk-IPIVNBKT.js";
304
296
  import {
305
297
  changeRailSections,
306
298
  placeSession,
@@ -392,14 +384,22 @@ import {
392
384
  asData,
393
385
  asDataBlock
394
386
  } from "./chunk-JVE2JFLV.js";
387
+ import {
388
+ childBrief,
389
+ childrenOf,
390
+ coordinatorSince,
391
+ newBranchCheck,
392
+ setParent,
393
+ spawnCheck
394
+ } from "./chunk-VQDE3DRG.js";
395
395
  import {
396
396
  ASSISTANT_ID,
397
397
  assistantDir,
398
398
  describeView,
399
399
  writeAssistantContext
400
- } from "./chunk-IYJHSMXQ.js";
400
+ } from "./chunk-QBB5JDFF.js";
401
401
  import "./chunk-7E5XPDKX.js";
402
- import "./chunk-I3AO3NVC.js";
402
+ import "./chunk-SE3M6KDX.js";
403
403
  import {
404
404
  clearDevWebDiscovery,
405
405
  clearWebDiscovery,
@@ -417,7 +417,7 @@ import {
417
417
  findSessionForCwd,
418
418
  readPendingForSession,
419
419
  readPendingForWorktree
420
- } from "./chunk-OW7YUW4W.js";
420
+ } from "./chunk-H7QMUEEA.js";
421
421
  import "./chunk-ZSHWP2VS.js";
422
422
  import {
423
423
  getCommentFileStore
@@ -429,7 +429,7 @@ import {
429
429
  checkTools,
430
430
  saveFolders,
431
431
  setupState
432
- } from "./chunk-IPXOVAEX.js";
432
+ } from "./chunk-DD4GYEFQ.js";
433
433
  import {
434
434
  chooseWorktreesRoot,
435
435
  expandHome
@@ -442,17 +442,17 @@ import {
442
442
  stageInputOf,
443
443
  withRequiredChecks,
444
444
  workElsewhere
445
- } from "./chunk-XN77RX4I.js";
445
+ } from "./chunk-INPJC2TX.js";
446
446
  import {
447
447
  createSessionBranches
448
- } from "./chunk-QUOA4RSP.js";
448
+ } from "./chunk-AO2IFRQW.js";
449
449
  import {
450
450
  defaultHost,
451
451
  hostById,
452
452
  hostForRepo,
453
453
  hostOfPrUrl,
454
454
  originHostname
455
- } from "./chunk-YNPORFRR.js";
455
+ } from "./chunk-FO37VXQE.js";
456
456
  import {
457
457
  MAX_THREAD_BODY
458
458
  } from "./chunk-FGPXMAYU.js";
@@ -477,11 +477,13 @@ import {
477
477
  setRepoIgnored,
478
478
  setReviewMode,
479
479
  setScanRoot
480
- } from "./chunk-X3ON5EYW.js";
480
+ } from "./chunk-S7Z3UJW7.js";
481
481
  import {
482
- editorArgs,
483
- openUrl
484
- } from "./chunk-IMO7KKYZ.js";
482
+ openUrl,
483
+ openWithDefaultApp,
484
+ revealInFileManager,
485
+ startEditor
486
+ } from "./chunk-GRHVKD2K.js";
485
487
  import {
486
488
  enrollProblem,
487
489
  groupProblem,
@@ -581,7 +583,7 @@ import {
581
583
  updateCheckpoint,
582
584
  whileRestoring,
583
585
  writeArchiveRecord
584
- } from "./chunk-KLJMHYU7.js";
586
+ } from "./chunk-EDOYMSIA.js";
585
587
  import {
586
588
  dayKey
587
589
  } from "./chunk-NEJVK5CF.js";
@@ -614,13 +616,13 @@ import {
614
616
  projectList,
615
617
  readJsonlSince,
616
618
  swallow
617
- } from "./chunk-YKWDZCUW.js";
619
+ } from "./chunk-QWD76K3E.js";
618
620
  import "./chunk-KGHWHAVF.js";
619
621
  import "./chunk-HF4VUIGE.js";
620
622
  import "./chunk-YQSWVHKK.js";
621
623
  import {
622
624
  VERSION
623
- } from "./chunk-5GW6OEYN.js";
625
+ } from "./chunk-TIRRXH6I.js";
624
626
  import {
625
627
  resolveProjectTarget
626
628
  } from "./chunk-IPHADNF5.js";
@@ -721,12 +723,12 @@ function createStartupQuestions(deps) {
721
723
  const screen = await deps.screen(t.id).catch(() => null);
722
724
  if (screen === null) continue;
723
725
  const what = deps.question(t.id, screen);
724
- const found = what ? { what, since: was?.found?.what === what ? was.found.since : (deps.now?.() ?? /* @__PURE__ */ new Date()).toISOString() } : null;
725
- if ((was?.found?.what ?? null) !== (found?.what ?? null)) {
726
+ const found2 = what ? { what, since: was?.found?.what === what ? was.found.since : (deps.now?.() ?? /* @__PURE__ */ new Date()).toISOString() } : null;
727
+ if ((was?.found?.what ?? null) !== (found2?.what ?? null)) {
726
728
  changed = true;
727
- if (found) asked.push(t.id);
729
+ if (found2) asked.push(t.id);
728
730
  }
729
- read.set(t.id, { key, found });
731
+ read.set(t.id, { key, found: found2 });
730
732
  }
731
733
  return { changed, asked };
732
734
  }
@@ -734,7 +736,7 @@ function createStartupQuestions(deps) {
734
736
  }
735
737
 
736
738
  // src/server/web-server.ts
737
- import fs18 from "fs";
739
+ import fs19 from "fs";
738
740
 
739
741
  // src/core/conversations/last-reply.ts
740
742
  function lastReplyOf(entries) {
@@ -1610,13 +1612,13 @@ function createLocalReviews(deps) {
1610
1612
  }),
1611
1613
  /** Dismiss a note (`on` false: bring it back). False when no review is ready, or it has no such note. */
1612
1614
  dismiss(sessionId, noteId, on = true) {
1613
- let found = false;
1615
+ let found2 = false;
1614
1616
  const ok = mark(sessionId, (k, known) => {
1615
- found = known.has(noteId);
1616
- if (!found) return;
1617
+ found2 = known.has(noteId);
1618
+ if (!found2) return;
1617
1619
  k.dismissed = on ? [.../* @__PURE__ */ new Set([...k.dismissed, noteId])] : k.dismissed.filter((x) => x !== noteId);
1618
1620
  });
1619
- return ok && found;
1621
+ return ok && found2;
1620
1622
  },
1621
1623
  /**
1622
1624
  * Where a session's review stands, for its row: null when it has none. One not in memory is read from the store
@@ -1802,75 +1804,29 @@ function mountSessionReviewRoutes(app, deps) {
1802
1804
  }
1803
1805
 
1804
1806
  // src/server/routes/session-show-routes.ts
1805
- import fs4 from "fs";
1807
+ import path5 from "path";
1806
1808
 
1807
1809
  // src/core/sessions/shown-file.ts
1808
- import path2 from "path";
1809
- function shownKind(file) {
1810
- const ext = file.slice(file.lastIndexOf(".") + 1).toLowerCase();
1811
- if (ext === "md" || ext === "markdown" || ext === "mdx") return "markdown";
1812
- if (["png", "jpg", "jpeg", "gif", "webp", "bmp", "avif"].includes(ext)) return "image";
1813
- return "text";
1814
- }
1815
- function imageType(file) {
1816
- const ext = file.slice(file.lastIndexOf(".") + 1).toLowerCase();
1817
- const types = {
1818
- png: "image/png",
1819
- jpg: "image/jpeg",
1820
- jpeg: "image/jpeg",
1821
- gif: "image/gif",
1822
- webp: "image/webp",
1823
- bmp: "image/bmp",
1824
- avif: "image/avif"
1825
- };
1826
- return types[ext] ?? null;
1827
- }
1828
- var norm = (p) => path2.resolve(p).replace(/\\/g, "/").replace(/\/+$/, "");
1829
- var sameStart = (a, b) => process.platform === "win32" ? a.toLowerCase() === b.toLowerCase() : a === b;
1830
- function locateInSession(s, file) {
1831
- const target = norm(file);
1832
- const roots = s.paths.map((p) => ({ repo: path2.basename(norm(p)), root: norm(p) }));
1833
- if (s.isGroup && roots.length) {
1834
- const parents = [...new Set(roots.map((r) => path2.posix.dirname(r.root)))];
1835
- if (parents.length === 1) roots.push({ repo: "", root: parents[0] });
1836
- }
1837
- const holding = roots.filter((r) => target.length > r.root.length + 1 && sameStart(target.slice(0, r.root.length + 1), `${r.root}/`)).sort((a, b) => b.root.length - a.root.length)[0];
1838
- if (!holding) return null;
1839
- const rel = target.slice(holding.root.length + 1);
1840
- if (holding.repo === "" && rel.includes("/")) return null;
1841
- return { repo: holding.repo, path: rel };
1842
- }
1843
- function createShownFiles(deps) {
1844
- const shown = /* @__PURE__ */ new Map();
1845
- return {
1846
- get: (sessionId) => shown.get(sessionId) ?? null,
1847
- show(sessionId, file) {
1848
- const next = { repo: file.repo, path: file.path, at: (deps.now?.() ?? /* @__PURE__ */ new Date()).toISOString() };
1849
- shown.set(sessionId, next);
1850
- deps.onChange(sessionId);
1851
- return next;
1852
- },
1853
- /** False when it showed nothing. */
1854
- close(sessionId) {
1855
- if (!shown.delete(sessionId)) return false;
1856
- deps.onChange(sessionId);
1857
- return true;
1858
- }
1859
- };
1860
- }
1810
+ import fs5 from "fs";
1811
+ import path4 from "path";
1812
+
1813
+ // src/core/worktree/terminal-paths.ts
1814
+ import fs4 from "fs";
1815
+ import os from "os";
1816
+ import path3 from "path";
1861
1817
 
1862
1818
  // src/core/worktree/code-browse.ts
1863
1819
  import fs3 from "fs";
1864
- import path3 from "path";
1820
+ import path2 from "path";
1865
1821
  var MAX_CODE_FILES = 5e4;
1866
1822
  var MAX_CODE_FILE_BYTES = 2 * 1024 * 1024;
1867
1823
  var LIST_TTL_MS = 3e3;
1868
1824
  function codeRoots(s) {
1869
- return s.paths.map((p) => ({ name: path3.basename(p), root: p }));
1825
+ return s.paths.map((p) => ({ name: path2.basename(p), root: p }));
1870
1826
  }
1871
1827
  function groupRoot(s) {
1872
1828
  if (!s.isGroup || s.paths.length === 0) return null;
1873
- const parents = [...new Set(s.paths.map((p) => path3.dirname(p)))];
1829
+ const parents = [...new Set(s.paths.map((p) => path2.dirname(p)))];
1874
1830
  return parents.length === 1 ? parents[0] : null;
1875
1831
  }
1876
1832
  var realIo = {
@@ -1979,11 +1935,11 @@ async function codeFilePath(s, repo, rel, io = realIo) {
1979
1935
  if (!root) return { error: "unknown repo" };
1980
1936
  if (!allowed) return { error: "not listed" };
1981
1937
  try {
1982
- const full = path3.resolve(root, rel);
1938
+ const full = path2.resolve(root, rel);
1983
1939
  const realRoot = fs3.realpathSync.native(root);
1984
1940
  const real = fs3.realpathSync.native(full);
1985
- const inside2 = path3.relative(realRoot, real);
1986
- if (!inside2 || inside2.startsWith("..") || path3.isAbsolute(inside2)) return { error: "not listed" };
1941
+ const inside2 = path2.relative(realRoot, real);
1942
+ if (!inside2 || inside2.startsWith("..") || path2.isAbsolute(inside2)) return { error: "not listed" };
1987
1943
  const st = fs3.statSync(real);
1988
1944
  if (!st.isFile()) return { error: "unreadable" };
1989
1945
  return { real, size: st.size };
@@ -2004,14 +1960,293 @@ async function readCodeFile(s, repo, rel, io = realIo) {
2004
1960
  }
2005
1961
  }
2006
1962
 
1963
+ // src/core/worktree/terminal-path-refs.ts
1964
+ function splitLine(raw) {
1965
+ let path25 = raw;
1966
+ let line;
1967
+ const m = /:(\d+)(?::\d+)?$/.exec(path25);
1968
+ if (m) {
1969
+ path25 = path25.slice(0, m.index);
1970
+ const n = Number(m[1]);
1971
+ if (n > 0) line = n;
1972
+ }
1973
+ const url = /^file:\/\/([^/]*)(\/.*)?$/i.exec(path25);
1974
+ if (url) {
1975
+ path25 = url[2] ?? "/";
1976
+ try {
1977
+ path25 = decodeURIComponent(path25);
1978
+ } catch {
1979
+ }
1980
+ if (/^\/[A-Za-z]:[\\/]/.test(path25)) path25 = path25.slice(1);
1981
+ }
1982
+ return line === void 0 ? { path: path25 } : { path: path25, line };
1983
+ }
1984
+
1985
+ // src/core/worktree/terminal-paths.ts
1986
+ var VIEWER_EXTENSIONS = /* @__PURE__ */ new Set(["html", "htm", "pdf", "png", "jpg", "jpeg", "gif", "webp", "svg"]);
1987
+ var MAX_TERMINAL_LINE = 1e7;
1988
+ var realIo2 = {
1989
+ listFiles: (root) => listRepoFiles(root)
1990
+ };
1991
+ function onDisk(candidate) {
1992
+ try {
1993
+ const real = fs4.realpathSync.native(candidate);
1994
+ const st = fs4.statSync(real);
1995
+ if (st.isDirectory()) return { real, kind: "dir" };
1996
+ if (st.isFile()) return { real, kind: "file" };
1997
+ return null;
1998
+ } catch {
1999
+ return null;
2000
+ }
2001
+ }
2002
+ function found(raw, at, line) {
2003
+ if (at.kind === "dir") return { raw, path: at.real, kind: "dir", opens: "reveal" };
2004
+ const ext = path3.extname(at.real).slice(1).toLowerCase();
2005
+ const opens = VIEWER_EXTENSIONS.has(ext) ? "app" : "editor";
2006
+ return line === void 0 ? { raw, path: at.real, kind: "file", opens } : { raw, path: at.real, kind: "file", opens, line };
2007
+ }
2008
+ var missing = (raw) => ({ raw, path: null, kind: "missing", opens: null });
2009
+ function refusedPath(raw, p, platform = process.platform) {
2010
+ const host = /^file:\/\/([^/]*)/i.exec(raw)?.[1];
2011
+ if (host && host.toLowerCase() !== "localhost") return true;
2012
+ if (/^[\\/]{2}/.test(p)) return true;
2013
+ if (platform === "win32" && p.replace(/^[A-Za-z]:/, "").includes(":")) return true;
2014
+ return false;
2015
+ }
2016
+ function relativeRoots(session) {
2017
+ const group = groupRoot(session);
2018
+ return [...group ? [group] : [], ...codeRoots(session).map((r) => r.root)];
2019
+ }
2020
+ async function listedMatches(session, rel, io) {
2021
+ const want = rel.replace(/\\/g, "/").replace(/^(?:\.\/)+/, "");
2022
+ if (!want || want.split("/").includes("..")) return [];
2023
+ const lists = await Promise.all(
2024
+ codeRoots(session).map(async ({ root }) => {
2025
+ if (!fs4.existsSync(root)) return { root, files: [] };
2026
+ try {
2027
+ return { root, files: await io.listFiles(root) };
2028
+ } catch {
2029
+ return { root, files: [] };
2030
+ }
2031
+ })
2032
+ );
2033
+ const hits = /* @__PURE__ */ new Map();
2034
+ for (const { root, files } of lists) {
2035
+ for (const f of files) {
2036
+ if (f !== want && !f.endsWith("/" + want)) continue;
2037
+ const at = onDisk(path3.join(root, f));
2038
+ if (at) hits.set(at.real, at);
2039
+ }
2040
+ }
2041
+ return [...hits.values()];
2042
+ }
2043
+ async function resolveTerminalPath(session, raw, io = realIo2) {
2044
+ try {
2045
+ const split = splitLine(raw);
2046
+ const p = split.path;
2047
+ const line = split.line !== void 0 && split.line <= MAX_TERMINAL_LINE ? split.line : void 0;
2048
+ if (!p || refusedPath(raw, p)) return missing(raw);
2049
+ if (/^~(?=$|[\\/])/.test(p)) {
2050
+ const at = onDisk(path3.join(os.homedir(), p.slice(1)));
2051
+ return at ? found(raw, at, line) : missing(raw);
2052
+ }
2053
+ if (path3.isAbsolute(p)) {
2054
+ const at = onDisk(p);
2055
+ return at ? found(raw, at, line) : missing(raw);
2056
+ }
2057
+ if (/^[A-Za-z]:[\\/]/.test(p)) return missing(raw);
2058
+ for (const root of relativeRoots(session)) {
2059
+ const at = onDisk(path3.resolve(root, p));
2060
+ if (at) return found(raw, at, line);
2061
+ }
2062
+ const matches = await listedMatches(session, p, io);
2063
+ if (matches.length === 1) return found(raw, matches[0], line);
2064
+ if (matches.length > 1) return { raw, path: null, kind: "ambiguous", opens: "search" };
2065
+ return missing(raw);
2066
+ } catch {
2067
+ return missing(raw);
2068
+ }
2069
+ }
2070
+ function editorFolder(session, real) {
2071
+ const first = session.paths[0];
2072
+ const folder = first && session.isGroup ? path3.dirname(first) : first;
2073
+ if (folder) {
2074
+ let realFolder = folder;
2075
+ try {
2076
+ realFolder = fs4.realpathSync.native(folder);
2077
+ } catch {
2078
+ }
2079
+ const rel = path3.relative(realFolder, real);
2080
+ if (rel && rel !== ".." && !rel.startsWith(".." + path3.sep) && !path3.isAbsolute(rel)) return folder;
2081
+ }
2082
+ return path3.dirname(real);
2083
+ }
2084
+ async function openTerminalPath(session, raw, how, deps = {}) {
2085
+ const r = await resolveTerminalPath(session, raw, deps.io ?? realIo2);
2086
+ if (r.kind === "ambiguous") return { error: "ambiguous" };
2087
+ if (r.kind === "missing" || r.path === null) return { error: "missing" };
2088
+ const real = r.path;
2089
+ let failed;
2090
+ if (how === "reveal" || r.kind === "dir") {
2091
+ failed = await (deps.revealInFileManager ?? revealInFileManager)(real);
2092
+ } else if (how === "editor" || r.opens !== "app") {
2093
+ const file = r.line === void 0 ? { path: real } : { path: real, line: r.line };
2094
+ failed = await (deps.startEditor ?? startEditor)(editorFolder(session, real), file);
2095
+ } else {
2096
+ failed = await (deps.openWithDefaultApp ?? openWithDefaultApp)(real);
2097
+ }
2098
+ return failed ? { error: "failed", message: failed } : { ok: true, opened: real };
2099
+ }
2100
+
2101
+ // src/core/sessions/shown-file.ts
2102
+ function shownKind(file) {
2103
+ const ext = file.slice(file.lastIndexOf(".") + 1).toLowerCase();
2104
+ if (ext === "md" || ext === "markdown" || ext === "mdx") return "markdown";
2105
+ if (ext === "html" || ext === "htm") return "html";
2106
+ if (["png", "jpg", "jpeg", "gif", "webp", "bmp", "avif"].includes(ext)) return "image";
2107
+ return "text";
2108
+ }
2109
+ function imageType(file) {
2110
+ const ext = file.slice(file.lastIndexOf(".") + 1).toLowerCase();
2111
+ const types = {
2112
+ png: "image/png",
2113
+ jpg: "image/jpeg",
2114
+ jpeg: "image/jpeg",
2115
+ gif: "image/gif",
2116
+ webp: "image/webp",
2117
+ bmp: "image/bmp",
2118
+ avif: "image/avif"
2119
+ };
2120
+ return types[ext] ?? null;
2121
+ }
2122
+ var norm = (p) => path4.resolve(p).replace(/\\/g, "/").replace(/\/+$/, "");
2123
+ var sameStart = (a, b) => process.platform === "win32" ? a.toLowerCase() === b.toLowerCase() : a === b;
2124
+ function locateInSession(s, file) {
2125
+ const target = norm(file);
2126
+ const roots = s.paths.map((p) => ({ repo: path4.basename(norm(p)), root: norm(p) }));
2127
+ if (s.isGroup && roots.length) {
2128
+ const parents = [...new Set(roots.map((r) => path4.posix.dirname(r.root)))];
2129
+ if (parents.length === 1) roots.push({ repo: "", root: parents[0] });
2130
+ }
2131
+ const holding = roots.filter((r) => target.length > r.root.length + 1 && sameStart(target.slice(0, r.root.length + 1), `${r.root}/`)).sort((a, b) => b.root.length - a.root.length)[0];
2132
+ if (!holding) return null;
2133
+ const rel = target.slice(holding.root.length + 1);
2134
+ if (holding.repo === "" && rel.includes("/")) return null;
2135
+ return { repo: holding.repo, path: rel };
2136
+ }
2137
+ function insideFolders(real, folders, platform = process.platform) {
2138
+ const fold = (p) => {
2139
+ const n = p.replace(/\\/g, "/").replace(/\/+$/, "");
2140
+ return platform === "win32" ? n.toLowerCase() : n;
2141
+ };
2142
+ const target = fold(real);
2143
+ return folders.some((f) => {
2144
+ const root = fold(f);
2145
+ return root.length > 0 && target.length > root.length + 1 && target.startsWith(`${root}/`);
2146
+ });
2147
+ }
2148
+ var realTempIo = { realpath: (p) => fs5.promises.realpath(p), stat: (p) => fs5.promises.stat(p) };
2149
+ async function findTempFile(file, folders, io = realTempIo, platform = process.platform) {
2150
+ if (refusedPath(file, file, platform) || !(platform === "win32" ? path4.win32 : path4.posix).isAbsolute(file))
2151
+ return { error: "not a local absolute path" };
2152
+ let real;
2153
+ try {
2154
+ real = await io.realpath(file);
2155
+ } catch {
2156
+ return { error: "not there" };
2157
+ }
2158
+ if (!insideFolders(real, folders, platform)) return { error: "outside" };
2159
+ try {
2160
+ const st = await io.stat(real);
2161
+ if (!st.isFile()) return { error: "not a file" };
2162
+ return { real, size: st.size };
2163
+ } catch {
2164
+ return { error: "not there" };
2165
+ }
2166
+ }
2167
+ async function readShownFile(real, limit) {
2168
+ let fh;
2169
+ try {
2170
+ fh = await fs5.promises.open(real, fs5.constants.O_RDONLY | (fs5.constants.O_NOFOLLOW ?? 0));
2171
+ } catch {
2172
+ return { error: "not there" };
2173
+ }
2174
+ try {
2175
+ const st = await fh.stat();
2176
+ if (!st.isFile()) return { error: "not there" };
2177
+ if (st.size > limit) return { error: "too large" };
2178
+ const buf = Buffer.alloc(limit + 1);
2179
+ let n = 0;
2180
+ while (n < buf.length) {
2181
+ const { bytesRead } = await fh.read(buf, n, buf.length - n, n);
2182
+ if (bytesRead === 0) break;
2183
+ n += bytesRead;
2184
+ }
2185
+ return n > limit ? { error: "too large" } : { bytes: buf.subarray(0, n) };
2186
+ } catch {
2187
+ return { error: "not there" };
2188
+ } finally {
2189
+ await fh.close().catch(() => void 0);
2190
+ }
2191
+ }
2192
+ function shownAbsolute(s, f) {
2193
+ if (f.temp) return f.temp;
2194
+ const root = f.repo === "" ? s.isGroup && s.paths[0] ? path4.dirname(s.paths[0]) : null : s.paths.find((p) => path4.basename(norm(p)) === f.repo);
2195
+ return root ? path4.join(root, ...f.path.split("/")) : null;
2196
+ }
2197
+ var PANE_TABS = ["file", "diff", "code", "review"];
2198
+ function createShownFiles(deps) {
2199
+ const shown = /* @__PURE__ */ new Map();
2200
+ const panes = /* @__PURE__ */ new Map();
2201
+ const now = () => (deps.now?.() ?? /* @__PURE__ */ new Date()).toISOString();
2202
+ return {
2203
+ get: (sessionId) => shown.get(sessionId) ?? null,
2204
+ pane: (sessionId) => panes.get(sessionId) ?? null,
2205
+ show(sessionId, file) {
2206
+ const next = { repo: file.repo, path: file.path, at: now() };
2207
+ if (file.temp) next.temp = file.temp;
2208
+ shown.set(sessionId, next);
2209
+ panes.set(sessionId, { tab: "file", at: next.at });
2210
+ deps.onChange(sessionId);
2211
+ return next;
2212
+ },
2213
+ /** Opens the pane on a view. Null (nothing changes) for the file's when no file is shown. */
2214
+ open(sessionId, tab, place) {
2215
+ if (tab === "file" && !shown.has(sessionId)) return null;
2216
+ const view = { tab, at: now() };
2217
+ if (tab === "code" && place) view.place = place;
2218
+ panes.set(sessionId, view);
2219
+ deps.onChange(sessionId);
2220
+ return view;
2221
+ },
2222
+ /** Closes the pane and forgets its file. False when it showed nothing. */
2223
+ close(sessionId) {
2224
+ const had = panes.delete(sessionId) || shown.has(sessionId);
2225
+ shown.delete(sessionId);
2226
+ if (!had) return false;
2227
+ deps.onChange(sessionId);
2228
+ return true;
2229
+ }
2230
+ };
2231
+ }
2232
+
2007
2233
  // src/server/routes/session-show-routes.ts
2008
2234
  var MAX_SHOWN_IMAGE_BYTES = 20 * 1024 * 1024;
2235
+ var MAX_SHOWN_PAGE_BYTES = 5 * 1024 * 1024;
2236
+ var SHOWN_PAGE_SANDBOX = "allow-scripts allow-popups allow-forms";
2009
2237
  function mountSessionShowRoutes(app, deps) {
2010
2238
  const shown = createShownFiles({ onChange: (sessionId) => deps.broadcast("session-show-changed", { sessionId }) });
2011
2239
  const locate = deps.locate ?? ((s, repo, rel) => codeFilePath(s, repo, rel));
2240
+ const tempFolders = deps.tempFolders ?? ((s) => agentOf(s).tempFolders?.(s) ?? []);
2241
+ const where = (s, f) => f.temp ? findTempFile(f.temp, tempFolders(s)) : locate(s, f.repo, f.path);
2012
2242
  const wire = (id) => {
2013
2243
  const f = shown.get(id);
2014
- return { shown: f ? { ...f, kind: shownKind(f.path) } : null };
2244
+ const s = findSession2(id);
2245
+ const pane = shown.pane(id);
2246
+ if (!s) return { shown: null, pane: null };
2247
+ if (!f) return { shown: null, pane };
2248
+ const abs = shownAbsolute(s, f);
2249
+ return { shown: { ...f, kind: shownKind(f.path), ...abs ? { abs } : {} }, pane };
2015
2250
  };
2016
2251
  app.get("/api/sessions/:id/show", (c) => {
2017
2252
  const id = c.req.param("id");
@@ -2028,14 +2263,37 @@ function mountSessionShowRoutes(app, deps) {
2028
2263
  shown.close(id);
2029
2264
  return c.json(wire(id));
2030
2265
  }
2031
- const at = typeof body.file === "string" && body.file ? locateInSession(session, body.file) : typeof body.repo === "string" && typeof body.path === "string" && body.path ? { repo: body.repo, path: body.path.replace(/\\/g, "/") } : void 0;
2266
+ if (body.view !== void 0) {
2267
+ if (typeof body.view !== "string" || !PANE_TABS.includes(body.view))
2268
+ return c.json({ error: `view is one of ${PANE_TABS.join(", ")}` }, 400);
2269
+ const tab = body.view;
2270
+ let place;
2271
+ if (tab === "code" && (body.file !== void 0 || body.path !== void 0)) {
2272
+ const file2 = typeof body.file === "string" && body.file ? body.file : null;
2273
+ const at2 = file2 ? locateInSession(session, file2) : typeof body.repo === "string" && typeof body.path === "string" && body.path ? { repo: body.repo, path: body.path.replace(/\\/g, "/") } : null;
2274
+ const found3 = at2 ? await locate(session, at2.repo, at2.path) : { error: "outside" };
2275
+ if (!at2 || "error" in found3) return c.json({ error: "That file isn\u2019t one the Code tab lists for this session." }, 404);
2276
+ const line = typeof body.line === "number" && Number.isInteger(body.line) && body.line > 0 ? body.line : void 0;
2277
+ place = { ...at2, ...line ? { line } : {} };
2278
+ }
2279
+ if (!shown.open(id, tab, place)) return c.json({ error: "It shows no file." }, 409);
2280
+ return c.json(wire(id));
2281
+ }
2282
+ const file = typeof body.file === "string" && body.file ? body.file : null;
2283
+ const at = file ? locateInSession(session, file) : typeof body.repo === "string" && typeof body.path === "string" && body.path ? { repo: body.repo, path: body.path.replace(/\\/g, "/") } : void 0;
2032
2284
  if (at === void 0) return c.json({ error: "file (an absolute path), or repo and path" }, 400);
2033
- if (!at) return c.json({ error: "That file is not in one of this session\u2019s folders." }, 404);
2034
- const found = await locate(session, at.repo, at.path);
2035
- if ("error" in found)
2285
+ if (!at) {
2286
+ const temp = file ? await findTempFile(file, tempFolders(session)) : { error: "outside" };
2287
+ if ("error" in temp)
2288
+ return c.json({ error: "That file is not in one of this session\u2019s folders, nor in its agent\u2019s scratch folder." }, 404);
2289
+ shown.show(id, { repo: "", path: path5.basename(temp.real), temp: temp.real });
2290
+ return c.json(wire(id));
2291
+ }
2292
+ const found2 = await locate(session, at.repo, at.path);
2293
+ if ("error" in found2)
2036
2294
  return c.json(
2037
2295
  {
2038
- error: found.error === "not listed" ? "That file isn\u2019t one this session can show: it doesn\u2019t exist, or git ignores it." : `It can\u2019t be shown: ${found.error}.`
2296
+ error: found2.error === "not listed" ? "That file isn\u2019t one this session can show: it doesn\u2019t exist, or git ignores it." : `It can\u2019t be shown: ${found2.error}.`
2039
2297
  },
2040
2298
  404
2041
2299
  );
@@ -2048,21 +2306,34 @@ function mountSessionShowRoutes(app, deps) {
2048
2306
  shown.close(id);
2049
2307
  return c.json(wire(id));
2050
2308
  });
2309
+ app.get("/api/sessions/:id/show/text", async (c) => {
2310
+ const id = c.req.param("id");
2311
+ const session = findSession2(id);
2312
+ const f = shown.get(id);
2313
+ if (!session || !f?.temp) return c.json({ error: "it shows no scratch file" }, 404);
2314
+ const found2 = await findTempFile(f.temp, tempFolders(session));
2315
+ if ("error" in found2) return c.json({ error: "not there any more" }, 404);
2316
+ const base = { repo: "", path: f.path, size: found2.size };
2317
+ if (found2.size > MAX_CODE_FILE_BYTES) return c.json({ ...base, text: null, reason: "too-large" });
2318
+ const read = await readShownFile(found2.real, MAX_CODE_FILE_BYTES);
2319
+ if ("error" in read)
2320
+ return read.error === "too large" ? c.json({ ...base, text: null, reason: "too-large" }) : c.json({ error: "not there any more" }, 404);
2321
+ const buf = read.bytes;
2322
+ if (buf.subarray(0, 8e3).includes(0)) return c.json({ ...base, text: null, reason: "binary" });
2323
+ return c.json({ ...base, text: buf.toString("utf-8") });
2324
+ });
2051
2325
  app.get("/api/sessions/:id/show/image", async (c) => {
2052
2326
  const id = c.req.param("id");
2053
2327
  const session = findSession2(id);
2054
2328
  const f = shown.get(id);
2055
2329
  const type = f ? imageType(f.path) : null;
2056
2330
  if (!session || !f || !type) return c.json({ error: "it shows no image" }, 404);
2057
- const found = await locate(session, f.repo, f.path);
2058
- if ("error" in found) return c.json({ error: "not there any more" }, 404);
2059
- if (found.size > MAX_SHOWN_IMAGE_BYTES) return c.json({ error: "too large to show" }, 413);
2060
- let bytes;
2061
- try {
2062
- bytes = await fs4.promises.readFile(found.real);
2063
- } catch {
2064
- return c.json({ error: "not there any more" }, 404);
2065
- }
2331
+ const found2 = await where(session, f);
2332
+ if ("error" in found2) return c.json({ error: "not there any more" }, 404);
2333
+ const read = await readShownFile(found2.real, MAX_SHOWN_IMAGE_BYTES);
2334
+ if ("error" in read)
2335
+ return read.error === "too large" ? c.json({ error: "too large to show" }, 413) : c.json({ error: "not there any more" }, 404);
2336
+ const bytes = read.bytes;
2066
2337
  return new Response(new Uint8Array(bytes), {
2067
2338
  headers: {
2068
2339
  "Content-Type": type,
@@ -2072,22 +2343,43 @@ function mountSessionShowRoutes(app, deps) {
2072
2343
  }
2073
2344
  });
2074
2345
  });
2346
+ app.get("/api/sessions/:id/show/page", async (c) => {
2347
+ const id = c.req.param("id");
2348
+ const session = findSession2(id);
2349
+ const f = shown.get(id);
2350
+ if (!session || !f || shownKind(f.path) !== "html") return c.json({ error: "it shows no page" }, 404);
2351
+ const found2 = await where(session, f);
2352
+ if ("error" in found2) return c.json({ error: "not there any more" }, 404);
2353
+ const read = await readShownFile(found2.real, MAX_SHOWN_PAGE_BYTES);
2354
+ if ("error" in read)
2355
+ return read.error === "too large" ? c.json({ error: "too large to show" }, 413) : c.json({ error: "not there any more" }, 404);
2356
+ const bytes = read.bytes;
2357
+ return new Response(new Uint8Array(bytes), {
2358
+ headers: {
2359
+ "Content-Type": "text/html; charset=utf-8",
2360
+ "X-Content-Type-Options": "nosniff",
2361
+ "Content-Security-Policy": `sandbox ${SHOWN_PAGE_SANDBOX}`,
2362
+ "Referrer-Policy": "no-referrer",
2363
+ "Cache-Control": "no-store"
2364
+ }
2365
+ });
2366
+ });
2075
2367
  return { drop: (sessionId) => void shown.close(sessionId) };
2076
2368
  }
2077
2369
 
2078
2370
  // src/core/review/local-review-tree.ts
2079
- import path4 from "path";
2080
- var norm2 = (p) => path4.resolve(p).replace(/\\/g, "/").replace(/\/+$/, "");
2371
+ import path6 from "path";
2372
+ var norm2 = (p) => path6.resolve(p).replace(/\\/g, "/").replace(/\/+$/, "");
2081
2373
  function sessionTree(paths, names) {
2082
2374
  const byName = /* @__PURE__ */ new Map();
2083
- for (const p of paths) byName.set(path4.basename(norm2(p)), [...byName.get(path4.basename(norm2(p))) ?? [], norm2(p)]);
2375
+ for (const p of paths) byName.set(path6.basename(norm2(p)), [...byName.get(path6.basename(norm2(p))) ?? [], norm2(p)]);
2084
2376
  const dirs = names.map((n) => byName.get(n));
2085
2377
  if (names.length === 0 || dirs.some((d) => !d || d.length !== 1)) return null;
2086
- const found = dirs.map((d) => d[0]);
2087
- if (names.length === 1) return { cwd: found[0], repos: [{ dir: found[0], sub: null }] };
2088
- const parent = path4.posix.dirname(found[0]);
2089
- if (found.some((d) => path4.posix.dirname(d) !== parent)) return null;
2090
- return { cwd: parent, repos: found.map((dir, i) => ({ dir, sub: names[i] })) };
2378
+ const found2 = dirs.map((d) => d[0]);
2379
+ if (names.length === 1) return { cwd: found2[0], repos: [{ dir: found2[0], sub: null }] };
2380
+ const parent = path6.posix.dirname(found2[0]);
2381
+ if (found2.some((d) => path6.posix.dirname(d) !== parent)) return null;
2382
+ return { cwd: parent, repos: found2.map((dir, i) => ({ dir, sub: names[i] })) };
2091
2383
  }
2092
2384
  var LOCAL_TREE_TIMEOUT_MS = 42e4;
2093
2385
  var SEVERAL_REPOS_LINE = "The folder holds several repos, each in the folder its paths start with: a file's path as listed is its path from where you are.";
@@ -2114,7 +2406,7 @@ function reviewFocus(config, aliases) {
2114
2406
 
2115
2407
  // src/core/platform/process-usage.ts
2116
2408
  import { execFile } from "child_process";
2117
- import path5 from "path";
2409
+ import path7 from "path";
2118
2410
  var num = (v) => typeof v === "number" && Number.isFinite(v) && v >= 0 ? v : null;
2119
2411
  function parseCimUsage(json2) {
2120
2412
  let data;
@@ -2160,7 +2452,7 @@ function parsePsUsage(stdout, now) {
2160
2452
  out.push({
2161
2453
  pid: Number(m[1]),
2162
2454
  ppid: Number(m[2]),
2163
- name: path5.posix.basename(first),
2455
+ name: path7.posix.basename(first),
2164
2456
  exe: first.startsWith("/") ? first : null,
2165
2457
  command,
2166
2458
  memBytes: Number(m[3]) * 1024,
@@ -2188,34 +2480,34 @@ async function sweepLeftovers(deps) {
2188
2480
  const procs = await deps.list();
2189
2481
  if (procs.length === 0) return null;
2190
2482
  const now = (deps.now ?? Date.now)();
2191
- const found = { sessions: 0, processes: 0, bytes: 0 };
2483
+ const found2 = { sessions: 0, processes: 0, bytes: 0 };
2192
2484
  for (const s of deps.sessions()) {
2193
2485
  const pid = deps.agentPid(s.id);
2194
2486
  const left = sessionProcesses(procs, { agentPids: new Set(pid ? [pid] : []), dirs: s.paths, now }).processes.filter((p) => p.leftover);
2195
2487
  if (left.length === 0) continue;
2196
2488
  const bytes = left.reduce((n, p) => n + (p.memBytes ?? 0), 0);
2197
- found.sessions++;
2198
- found.processes += left.length;
2199
- found.bytes += bytes;
2489
+ found2.sessions++;
2490
+ found2.processes += left.length;
2491
+ found2.bytes += bytes;
2200
2492
  const names = left.slice(0, 2).map((p) => p.what);
2201
2493
  deps.note(
2202
2494
  `${s.name}: ${left.length} process${left.length === 1 ? "" : "es"} left running for over a day (${formatBytes(bytes)}): ${names.join("; ")}${left.length > 2 ? ` and ${left.length - 2} more` : ""} \u2014 its \u22EF menu \u2192 Processes\u2026 stops them`,
2203
2495
  { level: "warn", sessionId: s.id }
2204
2496
  );
2205
2497
  }
2206
- return found;
2498
+ return found2;
2207
2499
  }
2208
- function leftoverSummary(found) {
2209
- if (!found) return "couldn't read the running processes";
2210
- if (found.processes === 0) return "nothing left running for over a day";
2211
- return `${found.processes} process${found.processes === 1 ? "" : "es"} left running for over a day in ${found.sessions} session${found.sessions === 1 ? "" : "s"} (${formatBytes(found.bytes)})`;
2500
+ function leftoverSummary(found2) {
2501
+ if (!found2) return "couldn't read the running processes";
2502
+ if (found2.processes === 0) return "nothing left running for over a day";
2503
+ return `${found2.processes} process${found2.processes === 1 ? "" : "es"} left running for over a day in ${found2.sessions} session${found2.sessions === 1 ? "" : "s"} (${formatBytes(found2.bytes)})`;
2212
2504
  }
2213
2505
 
2214
2506
  // src/core/worktree/code-symbols.ts
2215
2507
  var MAX_LINE_CHARS = 240;
2216
2508
  function parseGrepLine(line) {
2217
- const z8 = /^([^\0]+)\0(\d+)\0(.*)$/.exec(line);
2218
- if (z8) return { path: z8[1], line: Number(z8[2]), text: z8[3] };
2509
+ const z9 = /^([^\0]+)\0(\d+)\0(.*)$/.exec(line);
2510
+ if (z9) return { path: z9[1], line: Number(z9[2]), text: z9[3] };
2219
2511
  const m = /^(.+?):(\d+):(.*)$/.exec(line);
2220
2512
  return m ? { path: m[1], line: Number(m[2]), text: m[3] } : null;
2221
2513
  }
@@ -2284,9 +2576,9 @@ var NOT_NAMES = /* @__PURE__ */ new Set([
2284
2576
  "typeof",
2285
2577
  "await"
2286
2578
  ]);
2287
- function declarationOf(path23, text) {
2579
+ function declarationOf(path25, text) {
2288
2580
  for (const r of RULES) {
2289
- if (!r.ext.test(path23)) continue;
2581
+ if (!r.ext.test(path25)) continue;
2290
2582
  const m = r.re.exec(text);
2291
2583
  if (!m) continue;
2292
2584
  const name = r.name(m);
@@ -2403,7 +2695,7 @@ function gitLines(cwd, args, onLine, signal) {
2403
2695
  async function searchText(s, query, signal) {
2404
2696
  const perRepo = await Promise.all(
2405
2697
  codeRoots(s).map(async ({ name, root }) => {
2406
- const found = [];
2698
+ const found2 = [];
2407
2699
  let more = false;
2408
2700
  const args = [
2409
2701
  "grep",
@@ -2424,11 +2716,11 @@ async function searchText(s, query, signal) {
2424
2716
  (line) => {
2425
2717
  const p = parseGrepLine(line);
2426
2718
  if (!p) return;
2427
- if (found.length >= MAX_TEXT_HITS) {
2719
+ if (found2.length >= MAX_TEXT_HITS) {
2428
2720
  more = true;
2429
2721
  return false;
2430
2722
  }
2431
- found.push({
2723
+ found2.push({
2432
2724
  repo: name,
2433
2725
  path: p.path,
2434
2726
  line: p.line,
@@ -2437,7 +2729,7 @@ async function searchText(s, query, signal) {
2437
2729
  },
2438
2730
  signal
2439
2731
  );
2440
- return { found, more };
2732
+ return { found: found2, more };
2441
2733
  })
2442
2734
  );
2443
2735
  const all = perRepo.flatMap((r) => r.found);
@@ -2519,6 +2811,33 @@ function mountCodeRoutes(app) {
2519
2811
  });
2520
2812
  }
2521
2813
 
2814
+ // src/server/routes/terminal-path-routes.ts
2815
+ import { zValidator as zValidator3 } from "@hono/zod-validator";
2816
+ import { z as z3 } from "zod";
2817
+ var MAX_TERMINAL_PATHS = 50;
2818
+ var MAX_TERMINAL_PATH_CHARS = 4096;
2819
+ var pathText = z3.string().min(1).max(MAX_TERMINAL_PATH_CHARS);
2820
+ var resolveSchema2 = z3.object({ paths: z3.array(pathText).min(1).max(MAX_TERMINAL_PATHS) });
2821
+ var openSchema = z3.object({ path: pathText, how: z3.enum(["default", "editor", "reveal"]) });
2822
+ function mountTerminalPathRoutes(app) {
2823
+ app.post("/api/sessions/:id/terminal-paths/resolve", zValidator3("json", resolveSchema2), async (c) => {
2824
+ const session = findSession2(c.req.param("id"));
2825
+ if (!session) return c.json({ error: "unknown session" }, 404);
2826
+ const { paths } = c.req.valid("json");
2827
+ const results = await Promise.all(paths.map((raw) => resolveTerminalPath(session, raw)));
2828
+ return c.json({ results });
2829
+ });
2830
+ app.post("/api/sessions/:id/terminal-paths/open", zValidator3("json", openSchema), async (c) => {
2831
+ const session = findSession2(c.req.param("id"));
2832
+ if (!session) return c.json({ error: "unknown session" }, 404);
2833
+ const { path: path25, how } = c.req.valid("json");
2834
+ const r = await openTerminalPath(session, path25, how);
2835
+ if ("ok" in r) return c.json({ ok: true, opened: r.opened });
2836
+ if (r.error === "failed") return c.json({ error: r.message ?? "could not open it" }, 500);
2837
+ return c.json({ error: r.error }, 404);
2838
+ });
2839
+ }
2840
+
2522
2841
  // src/core/diff/diff-looks.ts
2523
2842
  var LOOK_JOIN_MS = 15 * 6e4;
2524
2843
  var MAX_LOOKS = 20;
@@ -2643,8 +2962,8 @@ function mountSetupRoutes(app, opts) {
2643
2962
  }
2644
2963
 
2645
2964
  // src/core/updates/update-source.ts
2646
- import fs5 from "fs";
2647
- import path6 from "path";
2965
+ import fs6 from "fs";
2966
+ import path8 from "path";
2648
2967
 
2649
2968
  // src/core/updates/updates.ts
2650
2969
  function parseVersion(v) {
@@ -2729,8 +3048,8 @@ function parseDesktopUpdate(text) {
2729
3048
  var RELEASES_REPO = "moberghr/cli-work-tree-manager";
2730
3049
  var RELEASES_URL = `https://api.github.com/repos/${RELEASES_REPO}/releases?per_page=30`;
2731
3050
  var SEEN_KEY = "ui:seen-version";
2732
- var desktopUpdatePath = () => path6.join(getConfigDir(), "desktop-update.json");
2733
- var desktopRequestPath = () => path6.join(getConfigDir(), "desktop-request.json");
3051
+ var desktopUpdatePath = () => path8.join(getConfigDir(), "desktop-update.json");
3052
+ var desktopRequestPath = () => path8.join(getConfigDir(), "desktop-request.json");
2734
3053
  async function fetchReleases(get = (url) => fetch(url, { headers: { "User-Agent": "work", Accept: "application/vnd.github+json" }, signal: AbortSignal.timeout(15e3) }), run2 = defaultRunner) {
2735
3054
  const why = await get(RELEASES_URL).then(
2736
3055
  async (res) => res.ok ? parseReleases(await res.json()) : res.status === 403 ? "GitHub's limit for this address is spent" : `GitHub answered ${res.status}`,
@@ -2770,7 +3089,7 @@ function networkFailure(err) {
2770
3089
  function readDesktopUpdate(file = desktopUpdatePath()) {
2771
3090
  let text;
2772
3091
  try {
2773
- text = fs5.readFileSync(file, "utf-8");
3092
+ text = fs6.readFileSync(file, "utf-8");
2774
3093
  } catch {
2775
3094
  return null;
2776
3095
  }
@@ -2792,7 +3111,7 @@ function markSeenVersion(version) {
2792
3111
  }
2793
3112
  function installKind() {
2794
3113
  const root = packageRoot();
2795
- return installKindOf(root, getConfigDir(), !!root && fs5.existsSync(path6.join(root, ".git")));
3114
+ return installKindOf(root, getConfigDir(), !!root && fs6.existsSync(path8.join(root, ".git")));
2796
3115
  }
2797
3116
  var defaultDeps = () => ({
2798
3117
  fetchReleases: () => fetchReleases(),
@@ -2885,7 +3204,7 @@ function mountAppUpdateRoutes(app, opts) {
2885
3204
  }
2886
3205
 
2887
3206
  // src/server/routes/usage-routes.ts
2888
- import fs6 from "fs";
3207
+ import fs7 from "fs";
2889
3208
  var FRESH_MS = 5e3;
2890
3209
  function createUsageCache(build, ttlMs = FRESH_MS, now = Date.now) {
2891
3210
  let last = null;
@@ -2947,7 +3266,7 @@ function watchUsage(opts) {
2947
3266
  };
2948
3267
  let watcher = null;
2949
3268
  try {
2950
- fs6.mkdirSync(dir, { recursive: true });
3269
+ fs7.mkdirSync(dir, { recursive: true });
2951
3270
  watcher = createFsWatcher({ roots: [dir], onChange });
2952
3271
  } catch (e) {
2953
3272
  report("warn", `[usage] not watching ${dir}: ${e instanceof Error ? e.message : String(e)}`);
@@ -3072,8 +3391,8 @@ var SETTING_PATTERNS = {
3072
3391
  /** A font name or several, comma-separated (the terminal's font; it refuses what would end a CSS value). */
3073
3392
  fontFamily: "^[^;{}<>\\\\]+$"
3074
3393
  };
3075
- var bool = (path23, section, label, help, def, when) => ({
3076
- path: path23,
3394
+ var bool = (path25, section, label, help, def, when) => ({
3395
+ path: path25,
3077
3396
  section,
3078
3397
  label,
3079
3398
  help,
@@ -3543,7 +3862,7 @@ var SETTINGS = [
3543
3862
  "when each Claude next starts"
3544
3863
  )
3545
3864
  ];
3546
- var settingAt = (path23) => SETTINGS.find((f) => f.path === path23);
3865
+ var settingAt = (path25) => SETTINGS.find((f) => f.path === path25);
3547
3866
  function checkSetting(field, raw) {
3548
3867
  const checked = checkValue(field, raw);
3549
3868
  if (checked.ok && checked.value === null && field.required) return { ok: false, error: "it can\u2019t be left empty" };
@@ -3589,16 +3908,16 @@ function checkValue(field, raw) {
3589
3908
  return typeof raw === "string" && k.options.some((o) => o.value === raw) ? { ok: true, value: raw } : { ok: false, error: `one of ${k.options.map((o) => o.value).join(", ")}` };
3590
3909
  }
3591
3910
  }
3592
- function valueAt(obj, path23) {
3911
+ function valueAt(obj, path25) {
3593
3912
  let cur = obj;
3594
- for (const key of path23.split(".")) {
3913
+ for (const key of path25.split(".")) {
3595
3914
  if (!cur || typeof cur !== "object" || Array.isArray(cur)) return void 0;
3596
3915
  cur = cur[key];
3597
3916
  }
3598
3917
  return cur;
3599
3918
  }
3600
- function setValueAt(obj, path23, value) {
3601
- const keys = path23.split(".");
3919
+ function setValueAt(obj, path25, value) {
3920
+ const keys = path25.split(".");
3602
3921
  const chain = [obj];
3603
3922
  let cur = obj;
3604
3923
  for (const key of keys.slice(0, -1)) {
@@ -3638,8 +3957,8 @@ function checkRepoSetting(key, raw) {
3638
3957
  return raw === "all" || raw === "asked" || raw === "off" ? { ok: true, value: raw } : { ok: false, error: "all, asked or off" };
3639
3958
  }
3640
3959
  function repoSettingsOf(raw, alias) {
3641
- const map = (path23) => {
3642
- const m = valueAt(raw, path23);
3960
+ const map = (path25) => {
3961
+ const m = valueAt(raw, path25);
3643
3962
  return m && typeof m === "object" && !Array.isArray(m) ? m : {};
3644
3963
  };
3645
3964
  const checks = map(REPO_SETTING_PATH.requiredChecks)[alias];
@@ -3699,8 +4018,8 @@ function mountSettingsRoutes(app, opts) {
3699
4018
  }
3700
4019
 
3701
4020
  // src/core/settings/settings-admin.ts
3702
- import fs7 from "fs";
3703
- import path7 from "path";
4021
+ import fs8 from "fs";
4022
+ import path9 from "path";
3704
4023
 
3705
4024
  // src/core/settings/terminal-style.ts
3706
4025
  var TERMINAL_COLOR_KEYS = [
@@ -3924,7 +4243,7 @@ var DEFAULT_TERMINAL_STYLE = resolveTerminalStyle({});
3924
4243
  // src/core/settings/settings-admin.ts
3925
4244
  function rawConfig(file = getConfigPath()) {
3926
4245
  try {
3927
- const raw = JSON.parse(fs7.readFileSync(file, "utf-8"));
4246
+ const raw = JSON.parse(fs8.readFileSync(file, "utf-8"));
3928
4247
  return raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
3929
4248
  } catch {
3930
4249
  return {};
@@ -3940,13 +4259,13 @@ function readSettings() {
3940
4259
  const colors = checkTerminalColors(valueAt(raw, "terminal.colors"));
3941
4260
  return { values, ...Object.keys(colors).length ? { terminalColors: colors } : {}, configPath: getConfigPath() };
3942
4261
  }
3943
- async function writeSetting(path23, value) {
3944
- const field = settingAt(path23);
3945
- if (!field) throw new SettingsError(`no setting ${path23}`, 404);
4262
+ async function writeSetting(path25, value) {
4263
+ const field = settingAt(path25);
4264
+ if (!field) throw new SettingsError(`no setting ${path25}`, 404);
3946
4265
  const checked = checkSetting(field, value);
3947
4266
  if (!checked.ok) throw new SettingsError(`${field.label}: ${checked.error}`);
3948
- const toWrite = checkedFolders(path23, checked.value);
3949
- await editConfig((raw) => setValueAt(raw, path23, toWrite)).catch((err) => {
4267
+ const toWrite = checkedFolders(path25, checked.value);
4268
+ await editConfig((raw) => setValueAt(raw, path25, toWrite)).catch((err) => {
3950
4269
  throw err instanceof RepoAdminError ? new SettingsError(err.message) : err;
3951
4270
  });
3952
4271
  return readSettings();
@@ -3960,10 +4279,10 @@ function checkedFolders(at, value) {
3960
4279
  if (at === "scanRoots" && Array.isArray(value))
3961
4280
  return value.map((v) => {
3962
4281
  const p = expandHome(v);
3963
- if (!path7.isAbsolute(p))
4282
+ if (!path9.isAbsolute(p))
3964
4283
  throw new SettingsError(`Folders scanned for repos: ${v} isn't a full path (start it from the drive, / or ~)`);
3965
- const full = path7.resolve(p);
3966
- if (!fs7.statSync(full, { throwIfNoEntry: false })?.isDirectory())
4284
+ const full = path9.resolve(p);
4285
+ if (!fs8.statSync(full, { throwIfNoEntry: false })?.isDirectory())
3967
4286
  throw new SettingsError(`Folders scanned for repos: ${full} isn't a folder`);
3968
4287
  return full;
3969
4288
  });
@@ -3981,9 +4300,9 @@ function readRepoSettings(alias) {
3981
4300
  let origin = null;
3982
4301
  let host = null;
3983
4302
  try {
3984
- const found = hostForRepo(repoPath);
3985
- origin = originShown(found.origin);
3986
- host = hostName(found.host.id);
4303
+ const found2 = hostForRepo(repoPath);
4304
+ origin = originShown(found2.origin);
4305
+ host = hostName(found2.host.id);
3987
4306
  } catch {
3988
4307
  }
3989
4308
  return { alias, path: repoPath, origin, host, ...repoSettingsOf(raw, alias) };
@@ -4018,7 +4337,7 @@ function withOwnStatusLine(source, own) {
4018
4337
  }
4019
4338
 
4020
4339
  // src/core/conversations/timeline-source.ts
4021
- import path8 from "path";
4340
+ import path10 from "path";
4022
4341
 
4023
4342
  // src/core/conversations/timeline.ts
4024
4343
  var SIZE_LABEL = /^(\d+ files? · \+\d+ −\d+|no changes)$/;
@@ -4067,7 +4386,7 @@ async function commitsOf(repo, since, run2) {
4067
4386
  if (log.code !== 0) return [];
4068
4387
  return log.stdout.split("\n").filter(Boolean).map((line) => {
4069
4388
  const [sha, at, ...subject] = line.split(" ");
4070
- return { repo: path8.basename(repo), sha, at, subject: subject.join(" ") };
4389
+ return { repo: path10.basename(repo), sha, at, subject: subject.join(" ") };
4071
4390
  });
4072
4391
  }
4073
4392
  async function sessionTimeline(s, deps = {}) {
@@ -4203,8 +4522,8 @@ function placeJira(issue, detail, cfg) {
4203
4522
  }
4204
4523
 
4205
4524
  // src/server/routes/jira-watch-routes.ts
4206
- import fs8 from "fs";
4207
- import path9 from "path";
4525
+ import fs9 from "fs";
4526
+ import path11 from "path";
4208
4527
 
4209
4528
  // src/core/jira/jira-watch.ts
4210
4529
  var START_PER_SWEEP = 2;
@@ -4407,16 +4726,16 @@ async function sweepJira(deps) {
4407
4726
  var EVERY_MS = 5 * 6e4;
4408
4727
  function aboutRepo(dir) {
4409
4728
  try {
4410
- const readme = ["README.md", "readme.md", "README"].map((n) => path9.join(dir, n)).find((f) => fs8.existsSync(f));
4729
+ const readme = ["README.md", "readme.md", "README"].map((n) => path11.join(dir, n)).find((f) => fs9.existsSync(f));
4411
4730
  if (readme) {
4412
- const line = fs8.readFileSync(readme, "utf8").split(/\r?\n/).map(
4731
+ const line = fs9.readFileSync(readme, "utf8").split(/\r?\n/).map(
4413
4732
  (l) => l.replace(/^[#>*\-\s]+/, "").replace(/[`*_[\]]/g, "").trim()
4414
4733
  ).find((l) => l.length > 20 && !/^(!|<|http)/.test(l));
4415
4734
  if (line) return line.slice(0, 160);
4416
4735
  }
4417
- const pkg = path9.join(dir, "package.json");
4418
- if (fs8.existsSync(pkg)) {
4419
- const d = JSON.parse(fs8.readFileSync(pkg, "utf8")).description;
4736
+ const pkg = path11.join(dir, "package.json");
4737
+ if (fs9.existsSync(pkg)) {
4738
+ const d = JSON.parse(fs9.readFileSync(pkg, "utf8")).description;
4420
4739
  if (typeof d === "string" && d.trim()) return d.trim().slice(0, 160);
4421
4740
  }
4422
4741
  } catch {
@@ -4428,7 +4747,7 @@ function watchTargets(cfg = loadConfig()) {
4428
4747
  const repos = Object.entries(cfg.repos).map(([alias, dir]) => ({
4429
4748
  name: alias,
4430
4749
  kind: "repo",
4431
- members: [path9.basename(dir)],
4750
+ members: [path11.basename(dir)],
4432
4751
  about: aboutRepo(dir)
4433
4752
  }));
4434
4753
  const groups = Object.entries(cfg.groups).map(([name, aliases]) => ({ name, kind: "group", members: aliases }));
@@ -4606,12 +4925,12 @@ function describeStall(s) {
4606
4925
  }
4607
4926
 
4608
4927
  // src/server/web-server.ts
4609
- import path20 from "path";
4928
+ import path22 from "path";
4610
4929
  import { Hono } from "hono";
4611
4930
  import { streamSSE as streamSSE2 } from "hono/streaming";
4612
4931
 
4613
4932
  // src/server/routes/session-comment-routes.ts
4614
- import { zValidator as zValidator3 } from "@hono/zod-validator";
4933
+ import { zValidator as zValidator4 } from "@hono/zod-validator";
4615
4934
 
4616
4935
  // src/core/comments/note-delivery.ts
4617
4936
  function noteDelivery(o) {
@@ -4644,7 +4963,7 @@ function mountSessionCommentRoutes(app, opts) {
4644
4963
  if (!ctx) return c.json({ error: "unknown session" }, 404);
4645
4964
  return c.json({ comments: listFor(ctx) });
4646
4965
  });
4647
- app.post("/api/sessions/:id/comments", zValidator3("json", commentInputSchema), (c) => {
4966
+ app.post("/api/sessions/:id/comments", zValidator4("json", commentInputSchema), (c) => {
4648
4967
  const id = c.req.param("id");
4649
4968
  const ctx = context(id);
4650
4969
  if (!ctx) return c.json({ error: "unknown session" }, 404);
@@ -4670,7 +4989,7 @@ function mountSessionCommentRoutes(app, opts) {
4670
4989
  if (home && getCommentFileStore(home).remove(cid)) changed(ctx, home, { deleted: cid });
4671
4990
  return c.json({ comments: listFor(ctx) });
4672
4991
  });
4673
- app.post("/api/sessions/:id/comments/:cid/resolve", zValidator3("json", resolveSchema), (c) => {
4992
+ app.post("/api/sessions/:id/comments/:cid/resolve", zValidator4("json", resolveSchema), (c) => {
4674
4993
  const cid = c.req.param("cid");
4675
4994
  const ctx = context(c.req.param("id"));
4676
4995
  if (!ctx) return c.json({ error: "unknown session" }, 404);
@@ -4679,7 +4998,7 @@ function mountSessionCommentRoutes(app, opts) {
4679
4998
  if (home && updated) changed(ctx, home, { id: updated.id });
4680
4999
  return c.json({ comments: listFor(ctx) });
4681
5000
  });
4682
- app.post("/api/sessions/:id/submit-review", zValidator3("json", submitReviewSchema), (c) => {
5001
+ app.post("/api/sessions/:id/submit-review", zValidator4("json", submitReviewSchema), (c) => {
4683
5002
  const id = c.req.param("id");
4684
5003
  const ctx = context(id);
4685
5004
  if (!ctx) return c.json({ error: "unknown session" }, 404);
@@ -4749,11 +5068,11 @@ async function typeAndSubmit(sessionId, text, write2 = writeToPty, wait) {
4749
5068
  }
4750
5069
 
4751
5070
  // src/server/routes/panes-routes.ts
4752
- import { zValidator as zValidator4 } from "@hono/zod-validator";
4753
- import { z as z3 } from "zod";
5071
+ import { zValidator as zValidator5 } from "@hono/zod-validator";
5072
+ import { z as z4 } from "zod";
4754
5073
 
4755
5074
  // src/core/worktree/branch-check.ts
4756
- import os from "os";
5075
+ import os2 from "os";
4757
5076
 
4758
5077
  // src/core/worktree/branch-name.ts
4759
5078
  var MAX_SUFFIX = 9;
@@ -4770,7 +5089,7 @@ var realBranchCheckDeps = {
4770
5089
  branchExists: (repoPath, branch) => ["refs/heads/", "refs/remotes/origin/"].some(
4771
5090
  (prefix) => git(["show-ref", "--verify", "--quiet", `${prefix}${branch}`], repoPath).exitCode === 0
4772
5091
  ),
4773
- validBranch: (name) => !name.startsWith("-") && git(["check-ref-format", "--branch", name], os.tmpdir()).exitCode === 0,
5092
+ validBranch: (name) => !name.startsWith("-") && git(["check-ref-format", "--branch", name], os2.tmpdir()).exitCode === 0,
4774
5093
  sessions: loadHistory,
4775
5094
  ownsBranch: (target, branch, config) => ownsBranch(target, branch, config)
4776
5095
  };
@@ -4971,21 +5290,21 @@ function mountPanesRoutes(app, opts) {
4971
5290
  }
4972
5291
  });
4973
5292
  app.get("/api/tasks", (c) => c.json({ tasks: getTasks() }));
4974
- const newTaskSchema = z3.object({
4975
- text: z3.string().min(1),
4976
- link: z3.string().optional()
5293
+ const newTaskSchema = z4.object({
5294
+ text: z4.string().min(1),
5295
+ link: z4.string().optional()
4977
5296
  });
4978
- app.post("/api/tasks", zValidator4("json", newTaskSchema), async (c) => {
5297
+ app.post("/api/tasks", zValidator5("json", newTaskSchema), async (c) => {
4979
5298
  const { text, link } = c.req.valid("json");
4980
5299
  const task = await addTask(text, link);
4981
5300
  opts.broadcast("tasks-changed", { id: task.id });
4982
5301
  return c.json({ task, tasks: getTasks() });
4983
5302
  });
4984
- const editSchema = z3.object({
4985
- text: z3.string().min(1).optional(),
4986
- done: z3.boolean().optional()
5303
+ const editSchema = z4.object({
5304
+ text: z4.string().min(1).optional(),
5305
+ done: z4.boolean().optional()
4987
5306
  });
4988
- app.patch("/api/tasks/:id", zValidator4("json", editSchema), async (c) => {
5307
+ app.patch("/api/tasks/:id", zValidator5("json", editSchema), async (c) => {
4989
5308
  const id = Number(c.req.param("id"));
4990
5309
  if (!Number.isFinite(id)) {
4991
5310
  return c.json({ error: "invalid id" }, 400);
@@ -5013,8 +5332,8 @@ function mountPanesRoutes(app, opts) {
5013
5332
  }
5014
5333
 
5015
5334
  // src/server/routes/worktree-routes.ts
5016
- import fs9 from "fs";
5017
- import path10 from "path";
5335
+ import fs10 from "fs";
5336
+ import path12 from "path";
5018
5337
  import { spawn } from "child_process";
5019
5338
 
5020
5339
  // src/core/platform/started.ts
@@ -5033,8 +5352,8 @@ function whenStarted(child) {
5033
5352
  }
5034
5353
 
5035
5354
  // src/server/routes/worktree-routes.ts
5036
- import { zValidator as zValidator5 } from "@hono/zod-validator";
5037
- import { z as z4 } from "zod";
5355
+ import { zValidator as zValidator6 } from "@hono/zod-validator";
5356
+ import { z as z5 } from "zod";
5038
5357
  var queues = /* @__PURE__ */ new Map();
5039
5358
  function oneAtATime2(key, fn) {
5040
5359
  const run2 = (queues.get(key) ?? Promise.resolve()).catch(() => void 0).then(fn);
@@ -5045,20 +5364,20 @@ function oneAtATime2(key, fn) {
5045
5364
  return run2;
5046
5365
  }
5047
5366
  function mountWorktreeRoutes(app, opts) {
5048
- const createSchema = z4.object({
5049
- target: z4.string().min(1),
5367
+ const createSchema = z5.object({
5368
+ target: z5.string().min(1),
5050
5369
  /** Empty or left out: the repo's own checkout, on the branch it has (`work tree <repo>`). */
5051
- branch: z4.string().optional(),
5052
- base: z4.string().optional(),
5053
- issueKey: z4.string().optional(),
5370
+ branch: z5.string().optional(),
5371
+ base: z5.string().optional(),
5372
+ issueKey: z5.string().optional(),
5054
5373
  /** Start Claude with this as its first message. */
5055
- prompt: z4.string().max(2e4).optional(),
5374
+ prompt: z5.string().max(2e4).optional(),
5056
5375
  /** Name the session (its title); the branch stays its identity. */
5057
- name: z4.string().max(120).optional(),
5376
+ name: z5.string().max(120).optional(),
5058
5377
  /** The Claude account a new session runs on (a name from `work account list`); empty: the configured default. */
5059
- account: z4.string().max(64).optional(),
5378
+ account: z5.string().max(64).optional(),
5060
5379
  /** Started by this session (`work child spawn`): a new branch, its first prompt the task (session-children.ts). */
5061
- parentId: z4.string().optional()
5380
+ parentId: z5.string().optional()
5062
5381
  });
5063
5382
  const startSession = opts.startSession ?? startSessionWithPrompt;
5064
5383
  const create = opts.create ?? createInProcess;
@@ -5068,7 +5387,7 @@ function mountWorktreeRoutes(app, opts) {
5068
5387
  const r = await resolvePr(ref, c.req.query("target") || void 0);
5069
5388
  return r.ok ? c.json({ pr: r.pr }) : c.json({ error: r.error }, 400);
5070
5389
  });
5071
- app.post("/api/worktrees", zValidator5("json", createSchema), async (c) => {
5390
+ app.post("/api/worktrees", zValidator6("json", createSchema), async (c) => {
5072
5391
  const { target, base, issueKey, prompt, name } = c.req.valid("json");
5073
5392
  const account = c.req.valid("json").account?.trim() || void 0;
5074
5393
  const loaded = loadConfig();
@@ -5143,12 +5462,12 @@ function mountWorktreeRoutes(app, opts) {
5143
5462
  }
5144
5463
  });
5145
5464
  const REFUSED = "Worktree not removed: uncommitted changes, unpushed commits, or git refused. Retry with force, or forget the session only.";
5146
- const removeSchema = z4.object({
5147
- force: z4.boolean().optional(),
5148
- sessionOnly: z4.boolean().optional()
5465
+ const removeSchema = z5.object({
5466
+ force: z5.boolean().optional(),
5467
+ sessionOnly: z5.boolean().optional()
5149
5468
  });
5150
5469
  const deleting = /* @__PURE__ */ new Map();
5151
- app.delete("/api/sessions/:id/worktree", zValidator5("json", removeSchema), async (c) => {
5470
+ app.delete("/api/sessions/:id/worktree", zValidator6("json", removeSchema), async (c) => {
5152
5471
  const id = c.req.param("id");
5153
5472
  const asked = c.req.valid("json");
5154
5473
  const key = `${!!asked.force}:${!!asked.sessionOnly}`;
@@ -5174,15 +5493,15 @@ function mountWorktreeRoutes(app, opts) {
5174
5493
  if (waiting.length) return { body: { error: `Not deleted: ${waiting.join("; ")}.`, blocked: waiting }, status: 409 };
5175
5494
  }
5176
5495
  try {
5177
- const onDisk = session.paths.some((p) => fs9.existsSync(p));
5178
- if (!sessionOnly && onDisk && session.paths.some((p) => wouldRefuseRemoval(p, force ?? false))) {
5496
+ const onDisk2 = session.paths.some((p) => fs10.existsSync(p));
5497
+ if (!sessionOnly && onDisk2 && session.paths.some((p) => wouldRefuseRemoval(p, force ?? false))) {
5179
5498
  return { body: { error: REFUSED }, status: 409 };
5180
5499
  }
5181
5500
  await disposePty(id);
5182
5501
  await disposeSessionWatcher(id);
5183
5502
  opts.releaseScope?.(session.paths);
5184
5503
  let worktreeRemoved = false;
5185
- if (!sessionOnly && onDisk) {
5504
+ if (!sessionOnly && onDisk2) {
5186
5505
  const ok = teardownWorktree(session.target, session.isGroup, session.branch, config, force ?? false);
5187
5506
  if (!ok) return { body: { error: REFUSED }, status: 409 };
5188
5507
  worktreeRemoved = true;
@@ -5232,10 +5551,10 @@ function mountWorktreeRoutes(app, opts) {
5232
5551
  opts.broadcast("sessions-changed", { ts: Date.now() });
5233
5552
  return c.json({ results });
5234
5553
  });
5235
- const openFileSchema = z4.object({
5236
- repo: z4.string().max(200),
5237
- path: z4.string().min(1).max(4096),
5238
- line: z4.number().int().positive().max(1e7).optional()
5554
+ const openFileSchema = z5.object({
5555
+ repo: z5.string().max(200),
5556
+ path: z5.string().min(1).max(4096),
5557
+ line: z5.number().int().positive().max(1e7).optional()
5239
5558
  });
5240
5559
  app.post("/api/sessions/:id/open-editor", async (c) => {
5241
5560
  const id = c.req.param("id");
@@ -5245,7 +5564,7 @@ function mountWorktreeRoutes(app, opts) {
5245
5564
  const wantsFile = !!body && typeof body === "object" && "path" in body;
5246
5565
  const asked = wantsFile ? openFileSchema.safeParse(body) : null;
5247
5566
  if (asked && !asked.success) return c.json({ error: "repo and path required" }, 400);
5248
- const folder = session.isGroup ? path10.dirname(session.paths[0]) : session.paths[0];
5567
+ const folder = session.isGroup ? path12.dirname(session.paths[0]) : session.paths[0];
5249
5568
  let file;
5250
5569
  if (asked?.success) {
5251
5570
  const at = await codeFilePath(session, asked.data.repo, asked.data.path);
@@ -5253,30 +5572,8 @@ function mountWorktreeRoutes(app, opts) {
5253
5572
  file = { path: at.real, line: asked.data.line };
5254
5573
  }
5255
5574
  const target = file?.path ?? folder;
5256
- const editor = loadConfig()?.editor?.trim() || "code";
5257
- const failed = await new Promise((resolve) => {
5258
- try {
5259
- const child = spawn_default(editor, editorArgs(editor, folder, file), {
5260
- detached: detachHere(),
5261
- stdio: "ignore",
5262
- windowsHide: true,
5263
- keepCwdLookup: true
5264
- });
5265
- const settle = setTimeout(() => resolve(null), 1500);
5266
- child.once("error", (err) => {
5267
- clearTimeout(settle);
5268
- resolve(err.message);
5269
- });
5270
- child.once("exit", () => {
5271
- clearTimeout(settle);
5272
- resolve(null);
5273
- });
5274
- child.unref();
5275
- } catch (err) {
5276
- resolve(err.message);
5277
- }
5278
- });
5279
- if (failed) return c.json({ error: `could not start ${editor}: ${failed}` }, 500);
5575
+ const failed = await startEditor(folder, file);
5576
+ if (failed) return c.json({ error: failed }, 500);
5280
5577
  return c.json({ ok: true, opened: target });
5281
5578
  });
5282
5579
  app.post("/api/sessions/:id/open-terminal", async (c) => {
@@ -5311,10 +5608,10 @@ function mountWorktreeRoutes(app, opts) {
5311
5608
  }
5312
5609
 
5313
5610
  // src/server/routes/scope-routes.ts
5314
- import { zValidator as zValidator6 } from "@hono/zod-validator";
5315
- import { z as z5 } from "zod";
5611
+ import { zValidator as zValidator7 } from "@hono/zod-validator";
5612
+ import { z as z6 } from "zod";
5316
5613
  import { EventEmitter } from "events";
5317
- import path11 from "path";
5614
+ import path13 from "path";
5318
5615
  import { streamSSE } from "hono/streaming";
5319
5616
  function mountScopeRoutes(app, opts) {
5320
5617
  const background = /* @__PURE__ */ new Set();
@@ -5437,11 +5734,11 @@ function mountScopeRoutes(app, opts) {
5437
5734
  }
5438
5735
  app.post(
5439
5736
  "/api/scopes",
5440
- zValidator6(
5737
+ zValidator7(
5441
5738
  "json",
5442
- z5.object({
5443
- paths: z5.array(z5.string().min(1)).min(1),
5444
- label: z5.string().optional()
5739
+ z6.object({
5740
+ paths: z6.array(z6.string().min(1)).min(1),
5741
+ label: z6.string().optional()
5445
5742
  })
5446
5743
  ),
5447
5744
  (c) => {
@@ -5462,7 +5759,7 @@ function mountScopeRoutes(app, opts) {
5462
5759
  }
5463
5760
  );
5464
5761
  app.get("/api/scopes", (c) => c.json({ scopes: listScopes() }));
5465
- app.post("/api/checkpoint", zValidator6("json", z5.object({ cwd: z5.string().min(1) })), async (c) => {
5762
+ app.post("/api/checkpoint", zValidator7("json", z6.object({ cwd: z6.string().min(1) })), async (c) => {
5466
5763
  const { cwd } = c.req.valid("json");
5467
5764
  const matched = scopesForCwd(cwd);
5468
5765
  let snapshotted = 0;
@@ -5495,7 +5792,7 @@ function mountScopeRoutes(app, opts) {
5495
5792
  }
5496
5793
  return c.json({ ok: true, scopes: matched.length, snapshotted });
5497
5794
  });
5498
- app.post("/api/checkpoint/seal", zValidator6("json", z5.object({ cwd: z5.string().min(1) })), (c) => {
5795
+ app.post("/api/checkpoint/seal", zValidator7("json", z6.object({ cwd: z6.string().min(1) })), (c) => {
5499
5796
  const { cwd } = c.req.valid("json");
5500
5797
  const matched = scopesForCwd(cwd);
5501
5798
  let sealed = 0;
@@ -5561,7 +5858,7 @@ function mountScopeRoutes(app, opts) {
5561
5858
  const fromSha = fromEntry.repos[p] ?? "HEAD";
5562
5859
  const toSha = toEntry === void 0 ? "working" : toEntry.repos[p] ?? "HEAD";
5563
5860
  return {
5564
- name: path11.basename(p),
5861
+ name: path13.basename(p),
5565
5862
  root: p,
5566
5863
  files: computeRangeDiff({ root: p, fromRef: fromSha, toRef: toSha })
5567
5864
  };
@@ -5578,7 +5875,7 @@ function mountScopeRoutes(app, opts) {
5578
5875
  }
5579
5876
  const resolved = scope.paths.map((p) => resolveRepoDiff(p, base, sessionBaseForPath(p)));
5580
5877
  const repos = scope.paths.map((p, i) => ({
5581
- name: path11.basename(p),
5878
+ name: path13.basename(p),
5582
5879
  root: p,
5583
5880
  resolvedBase: resolved[i].resolvedBase,
5584
5881
  files: computeDiff({ root: p, diffArg: resolved[i].diffArg })
@@ -5609,7 +5906,7 @@ function mountScopeRoutes(app, opts) {
5609
5906
  if (!relPath || !Number.isInteger(start) || !Number.isInteger(end)) {
5610
5907
  return c.json({ error: "bad path/start/end" }, 400);
5611
5908
  }
5612
- const root = scope.paths.length === 1 ? scope.paths[0] : scope.paths.find((p) => path11.basename(p) === repoName);
5909
+ const root = scope.paths.length === 1 ? scope.paths[0] : scope.paths.find((p) => path13.basename(p) === repoName);
5613
5910
  if (!root) return c.json({ error: "unknown repo" }, 404);
5614
5911
  const result = readContextLines({ root, relPath, start, end, ref });
5615
5912
  if (!result) return c.json({ error: "cannot read file" }, 400);
@@ -5661,7 +5958,7 @@ function mountScopeRoutes(app, opts) {
5661
5958
  ended: scope.ended
5662
5959
  });
5663
5960
  });
5664
- app.post("/api/scopes/:hash/comments", zValidator6("json", commentInputSchema), (c) => {
5961
+ app.post("/api/scopes/:hash/comments", zValidator7("json", commentInputSchema), (c) => {
5665
5962
  const scope = getScope(c.req.param("hash"));
5666
5963
  if (!scope) return c.json({ error: "unknown scope" }, 404);
5667
5964
  const ctx = context(scope.hash);
@@ -5686,7 +5983,7 @@ function mountScopeRoutes(app, opts) {
5686
5983
  if (home && getCommentFileStore(home).remove(cid)) storeChanged(ctx, home, { deleted: cid });
5687
5984
  return c.json({ comments: listFor(ctx) });
5688
5985
  });
5689
- app.post("/api/scopes/:hash/comments/:cid/resolve", zValidator6("json", resolveSchema), (c) => {
5986
+ app.post("/api/scopes/:hash/comments/:cid/resolve", zValidator7("json", resolveSchema), (c) => {
5690
5987
  const scope = getScope(c.req.param("hash"));
5691
5988
  if (!scope) return c.json({ error: "unknown scope" }, 404);
5692
5989
  const ctx = context(scope.hash);
@@ -5696,7 +5993,7 @@ function mountScopeRoutes(app, opts) {
5696
5993
  if (home && updated) storeChanged(ctx, home, { id: updated.id });
5697
5994
  return c.json({ comments: listFor(ctx) });
5698
5995
  });
5699
- app.post("/api/scopes/:hash/submit-review", zValidator6("json", submitReviewSchema), (c) => {
5996
+ app.post("/api/scopes/:hash/submit-review", zValidator7("json", submitReviewSchema), (c) => {
5700
5997
  const scope = getScope(c.req.param("hash"));
5701
5998
  if (!scope) return c.json({ error: "unknown scope" }, 404);
5702
5999
  const ctx = context(scope.hash);
@@ -5867,7 +6164,7 @@ function mountTerminalRoutes(app, opts) {
5867
6164
  }
5868
6165
 
5869
6166
  // src/server/routes/status-routes.ts
5870
- import path12 from "path";
6167
+ import path14 from "path";
5871
6168
 
5872
6169
  // src/core/status/notifier.ts
5873
6170
  var MESSAGES = {
@@ -6016,7 +6313,7 @@ function mountStatusRoutes(app, opts) {
6016
6313
  const kind = notifyKindForTransition(status.prevState ? { state: status.prevState } : null, status);
6017
6314
  if (kind) {
6018
6315
  const config = loadConfig();
6019
- const launchDir = session.isGroup && session.paths[0] ? path12.dirname(session.paths[0]) : session.paths[0] ?? body.cwd;
6316
+ const launchDir = session.isGroup && session.paths[0] ? path14.dirname(session.paths[0]) : session.paths[0] ?? body.cwd;
6020
6317
  const name = `${session.target} \xB7 ${session.branch}`;
6021
6318
  const snooze = readSnooze(id);
6022
6319
  const route = snooze?.until && snoozeActive(snooze, { attention: status }) ? "none" : presence.route(id);
@@ -6113,7 +6410,7 @@ function mountStatusRoutes(app, opts) {
6113
6410
  }
6114
6411
 
6115
6412
  // src/core/pr/pr-watch-hosts.ts
6116
- import os2 from "os";
6413
+ import os3 from "os";
6117
6414
 
6118
6415
  // src/core/pr/pr-watch.ts
6119
6416
  var CONCURRENCY = 3;
@@ -6749,13 +7046,13 @@ async function withListedPrs(pre, listed, io) {
6749
7046
  pr = io.previous?.(rec.url);
6750
7047
  if (!pr) unknownPrs.push(`${target?.name ?? rec.repoId ?? "?"}#${rec.number}: its host is resting (API limit)`);
6751
7048
  } else {
6752
- const found = await io.lookup(target?.path, host, { number: rec.number, url: rec.url }).catch((err) => ({ kind: "error", error: err.message }));
6753
- if (found.kind === "pr") {
6754
- pr = found.pr;
7049
+ const found2 = await io.lookup(target?.path, host, { number: rec.number, url: rec.url }).catch((err) => ({ kind: "error", error: err.message }));
7050
+ if (found2.kind === "pr") {
7051
+ pr = found2.pr;
6755
7052
  looks.push({ url: rec.url, pr, ...pr.headBranch ? { branch: pr.headBranch } : {} });
6756
- } else if (found.kind === "error") {
7053
+ } else if (found2.kind === "error") {
6757
7054
  pr = io.previous?.(rec.url);
6758
- if (!pr) unknownPrs.push(`${target?.name ?? rec.repoId ?? "?"}#${rec.number}: ${found.error}`);
7055
+ if (!pr) unknownPrs.push(`${target?.name ?? rec.repoId ?? "?"}#${rec.number}: ${found2.error}`);
6759
7056
  }
6760
7057
  }
6761
7058
  }
@@ -6797,7 +7094,7 @@ function listedPrsIo(run2, opts = {}) {
6797
7094
  const h = hostOfPrUrl(url)?.host;
6798
7095
  return h ? h.id === DEFAULT_HOST ? void 0 : h.id : null;
6799
7096
  },
6800
- lookup: (cwd, host, ref) => hostOf(host).prForRef(run2, cwd ?? os2.tmpdir(), ref),
7097
+ lookup: (cwd, host, ref) => hostOf(host).prForRef(run2, cwd ?? os3.tmpdir(), ref),
6801
7098
  ...opts
6802
7099
  };
6803
7100
  }
@@ -6822,10 +7119,10 @@ async function watchPreflight(session, run2, opts = {}, io = {}) {
6822
7119
  if (facts.length) bestEffort(`keep the branch facts of ${id}`, () => noteBranchFacts(id, facts));
6823
7120
  const previous = (url) => last ? prsOfCheck(last).find((p) => p.pr.url.toLowerCase() === url.toLowerCase())?.pr : void 0;
6824
7121
  const listed = io.listed ?? listedPrsIo(run2, { ...opts.resting ? { resting: opts.resting } : {}, previous });
6825
- const found = await withListedPrs(pre, readSessionPrs(id), listed);
7122
+ const found2 = await withListedPrs(pre, readSessionPrs(id), listed);
6826
7123
  const aliases = new Map(sessionRepos(session, loadConfig()).map((r) => [r.path, r.alias]));
6827
7124
  const keys = new Map(pre.repos.map((r) => [r.name, [aliases.get(r.path), listed.repoIdOf(r.path)]]));
6828
- const out = { ...found, pre: withRequiredChecks(found.pre, opts.requiredChecks, (name) => keys.get(name) ?? []) };
7125
+ const out = { ...found2, pre: withRequiredChecks(found2.pre, opts.requiredChecks, (name) => keys.get(name) ?? []) };
6829
7126
  if (out.sightings.length) bestEffort(`keep the PRs of ${id}`, () => noteSessionPrs(id, out.sightings));
6830
7127
  if (out.looks.length) bestEffort(`keep what the host said of ${id}'s PRs`, () => notePrLooks(id, out.looks));
6831
7128
  return out.pre;
@@ -7045,9 +7342,9 @@ function mountRailRoutes(app, opts) {
7045
7342
  }
7046
7343
 
7047
7344
  // src/core/worktree/shared-folders.ts
7048
- import fs10 from "fs";
7049
- import path13 from "path";
7050
- var norm3 = (p) => path13.resolve(p).replace(/\\/g, "/").toLowerCase();
7345
+ import fs11 from "fs";
7346
+ import path15 from "path";
7347
+ var norm3 = (p) => path15.resolve(p).replace(/\\/g, "/").toLowerCase();
7051
7348
  function shadowedSessions(sessions, branchCheckedOut2) {
7052
7349
  const byFolder = /* @__PURE__ */ new Map();
7053
7350
  for (const s of sessions) {
@@ -7066,14 +7363,14 @@ function shadowedSessions(sessions, branchCheckedOut2) {
7066
7363
  }
7067
7364
  function branchCheckedOut(dir) {
7068
7365
  try {
7069
- const dotGit = path13.join(dir, ".git");
7366
+ const dotGit = path15.join(dir, ".git");
7070
7367
  let gitDir = dotGit;
7071
- if (fs10.statSync(dotGit).isFile()) {
7072
- const m = /^gitdir:\s*(.+)$/m.exec(fs10.readFileSync(dotGit, "utf8"));
7368
+ if (fs11.statSync(dotGit).isFile()) {
7369
+ const m = /^gitdir:\s*(.+)$/m.exec(fs11.readFileSync(dotGit, "utf8"));
7073
7370
  if (!m) return null;
7074
- gitDir = path13.resolve(dir, m[1].trim());
7371
+ gitDir = path15.resolve(dir, m[1].trim());
7075
7372
  }
7076
- const head = fs10.readFileSync(path13.join(gitDir, "HEAD"), "utf8");
7373
+ const head = fs11.readFileSync(path15.join(gitDir, "HEAD"), "utf8");
7077
7374
  const ref = /^ref:\s*refs\/heads\/(.+)$/m.exec(head);
7078
7375
  return ref ? ref[1].trim() : null;
7079
7376
  } catch {
@@ -7082,14 +7379,14 @@ function branchCheckedOut(dir) {
7082
7379
  }
7083
7380
 
7084
7381
  // src/core/platform/build-stamp.ts
7085
- import fs11 from "fs";
7382
+ import fs12 from "fs";
7086
7383
  var cached = null;
7087
7384
  function buildStamp() {
7088
7385
  if (cached) return cached;
7089
7386
  const forced = process.env.WORK_BUILD_STAMP;
7090
7387
  if (forced) return cached = forced;
7091
7388
  try {
7092
- cached = String(Math.floor(fs11.statSync(process.argv[1]).mtimeMs));
7389
+ cached = String(Math.floor(fs12.statSync(process.argv[1]).mtimeMs));
7093
7390
  } catch {
7094
7391
  cached = "unknown";
7095
7392
  }
@@ -7400,8 +7697,8 @@ function mountPrReplyRoutes(app, opts) {
7400
7697
  }
7401
7698
 
7402
7699
  // src/core/archive/archive-retention.ts
7403
- import fs12 from "fs";
7404
- import path14 from "path";
7700
+ import fs13 from "fs";
7701
+ import path16 from "path";
7405
7702
  import zlib from "zlib";
7406
7703
  var DEFAULT_COMPRESS_AFTER_DAYS = 30;
7407
7704
  var DAY_MS = 24 * 36e5;
@@ -7413,7 +7710,7 @@ function applyArchiveRetention(opts) {
7413
7710
  const out = { compressed: [], dropped: [], bytesSaved: 0 };
7414
7711
  let ids;
7415
7712
  try {
7416
- ids = fs12.readdirSync(root, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
7713
+ ids = fs13.readdirSync(root, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
7417
7714
  } catch {
7418
7715
  return out;
7419
7716
  }
@@ -7422,17 +7719,17 @@ function applyArchiveRetention(opts) {
7422
7719
  if (!rec) continue;
7423
7720
  const age = now - Date.parse(rec.archivedAt);
7424
7721
  if (!Number.isFinite(age)) continue;
7425
- const ignored = path14.join(archiveDirFor(id, root), "ignored");
7426
- if (compressAfter > 0 && age >= compressAfter * DAY_MS && !rec.ignoredDroppedAt && fs12.existsSync(ignored)) {
7427
- fs12.rmSync(ignored, { recursive: true, force: true });
7722
+ const ignored = path16.join(archiveDirFor(id, root), "ignored");
7723
+ if (compressAfter > 0 && age >= compressAfter * DAY_MS && !rec.ignoredDroppedAt && fs13.existsSync(ignored)) {
7724
+ fs13.rmSync(ignored, { recursive: true, force: true });
7428
7725
  rec.ignoredDroppedAt = new Date(now).toISOString();
7429
7726
  writeArchiveRecord(rec, root);
7430
7727
  }
7431
7728
  if (rec.transcriptsDroppedAt) continue;
7432
- const dir = path14.join(archiveDirFor(id, root), "transcripts");
7729
+ const dir = path16.join(archiveDirFor(id, root), "transcripts");
7433
7730
  if (dropAfter > 0 && age >= dropAfter * DAY_MS) {
7434
7731
  out.bytesSaved += dirBytes(dir);
7435
- fs12.rmSync(dir, { recursive: true, force: true });
7732
+ fs13.rmSync(dir, { recursive: true, force: true });
7436
7733
  rec.transcriptsDroppedAt = new Date(now).toISOString();
7437
7734
  writeArchiveRecord(rec, root);
7438
7735
  out.dropped.push(id);
@@ -7440,16 +7737,16 @@ function applyArchiveRetention(opts) {
7440
7737
  }
7441
7738
  if (compressAfter <= 0 || rec.compressedAt || age < compressAfter * DAY_MS) continue;
7442
7739
  for (const t of rec.transcripts) {
7443
- const plain = path14.join(dir, t.file);
7444
- if (!fs12.existsSync(plain)) continue;
7445
- const data = fs12.readFileSync(plain);
7740
+ const plain = path16.join(dir, t.file);
7741
+ if (!fs13.existsSync(plain)) continue;
7742
+ const data = fs13.readFileSync(plain);
7446
7743
  const gz = zlib.gzipSync(data);
7447
- fs12.writeFileSync(`${plain}.gz`, gz);
7448
- if (!zlib.gunzipSync(fs12.readFileSync(`${plain}.gz`)).equals(data)) {
7449
- fs12.rmSync(`${plain}.gz`, { force: true });
7744
+ fs13.writeFileSync(`${plain}.gz`, gz);
7745
+ if (!zlib.gunzipSync(fs13.readFileSync(`${plain}.gz`)).equals(data)) {
7746
+ fs13.rmSync(`${plain}.gz`, { force: true });
7450
7747
  continue;
7451
7748
  }
7452
- fs12.rmSync(plain, { force: true });
7749
+ fs13.rmSync(plain, { force: true });
7453
7750
  out.bytesSaved += data.length - gz.length;
7454
7751
  }
7455
7752
  rec.compressedAt = new Date(now).toISOString();
@@ -7461,7 +7758,7 @@ function applyArchiveRetention(opts) {
7461
7758
  function dirBytes(dir) {
7462
7759
  let n = 0;
7463
7760
  try {
7464
- for (const f of fs12.readdirSync(dir)) n += fs12.statSync(path14.join(dir, f)).size;
7761
+ for (const f of fs13.readdirSync(dir)) n += fs13.statSync(path16.join(dir, f)).size;
7465
7762
  } catch {
7466
7763
  }
7467
7764
  return n;
@@ -7860,9 +8157,9 @@ async function fixItMyself(deps, repo, number, input) {
7860
8157
  return { ok: false, status, error, ...sessionId ? { sessionId } : {} };
7861
8158
  };
7862
8159
  try {
7863
- const found = await deps.lookUp(claimed).catch((err) => ({ ok: false, error: err.message }));
7864
- if (!found.ok) return fail(409, found.error);
7865
- const pr = found.pr;
8160
+ const found2 = await deps.lookUp(claimed).catch((err) => ({ ok: false, error: err.message }));
8161
+ if (!found2.ok) return fail(409, found2.error);
8162
+ const pr = found2.pr;
7866
8163
  const picked = ids.map((id) => claimed.drafts.find((d) => d.id === id));
7867
8164
  const prompt = fixMyselfPrompt({ ...pr, author: pr.author || r.author }, picked);
7868
8165
  const warnings = [];
@@ -7939,7 +8236,7 @@ function reviewModeOf(alias, config) {
7939
8236
  return { mode: "all", from: "default" };
7940
8237
  }
7941
8238
  function reviewProjects(config) {
7942
- return Object.entries(config.repos).map(([alias, path23]) => ({ alias, path: path23, mode: reviewModeOf(alias, config).mode }));
8239
+ return Object.entries(config.repos).map(([alias, path25]) => ({ alias, path: path25, mode: reviewModeOf(alias, config).mode }));
7943
8240
  }
7944
8241
  function reviewLimits(config) {
7945
8242
  return {
@@ -8090,8 +8387,8 @@ function mountReviewRoutes(app, deps) {
8090
8387
 
8091
8388
  // src/core/review/review-tree.ts
8092
8389
  import { randomBytes } from "crypto";
8093
- import fs13 from "fs";
8094
- import path15 from "path";
8390
+ import fs14 from "fs";
8391
+ import path17 from "path";
8095
8392
 
8096
8393
  // src/core/review/review-source.ts
8097
8394
  var reviewRef = (number) => `refs/work/review/${number}`;
@@ -8147,7 +8444,7 @@ async function dropReviewRef(run2, repoPath, number) {
8147
8444
  }
8148
8445
 
8149
8446
  // src/core/review/review-tree.ts
8150
- var reviewTreesDir = () => path15.join(getConfigDir(), "review-trees");
8447
+ var reviewTreesDir = () => path17.join(getConfigDir(), "review-trees");
8151
8448
  var NO_HOOKS = ".no-hooks";
8152
8449
  var NO_LFS = ["-c", "filter.lfs.smudge=", "-c", "filter.lfs.process=", "-c", "filter.lfs.required=false"];
8153
8450
  var NO_LFS_ENV = { GIT_LFS_SKIP_SMUDGE: "1" };
@@ -8160,17 +8457,17 @@ var runSuffix = () => `${process.pid.toString(36)}${randomBytes(3).toString("hex
8160
8457
  var firstLine = (s) => s.trim().split(/\r?\n/)[0] ?? "";
8161
8458
  function rmTree(dir) {
8162
8459
  try {
8163
- fs13.rmSync(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 200 });
8460
+ fs14.rmSync(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 200 });
8164
8461
  } catch {
8165
8462
  }
8166
- return !fs13.existsSync(dir);
8463
+ return !fs14.existsSync(dir);
8167
8464
  }
8168
8465
  async function createReviewTree(run2, at, opts) {
8169
8466
  const root = opts.root ?? reviewTreesDir();
8170
- const dir = path15.join(root, reviewTreeName(at.alias, at.number, at.headSha, opts.run ?? runSuffix()));
8171
- const noHooks = path15.join(root, NO_HOOKS);
8172
- fs13.mkdirSync(noHooks, { recursive: true });
8173
- if (fs13.existsSync(dir)) await removeReviewTree(run2, at.repoPath, dir);
8467
+ const dir = path17.join(root, reviewTreeName(at.alias, at.number, at.headSha, opts.run ?? runSuffix()));
8468
+ const noHooks = path17.join(root, NO_HOOKS);
8469
+ fs14.mkdirSync(noHooks, { recursive: true });
8470
+ if (fs14.existsSync(dir)) await removeReviewTree(run2, at.repoPath, dir);
8174
8471
  const added = await run2(
8175
8472
  "git",
8176
8473
  [
@@ -8205,9 +8502,9 @@ async function createReviewTree(run2, at, opts) {
8205
8502
  }
8206
8503
  const removed = [];
8207
8504
  for (const rel of listed.stdout.split("\0").filter((rel2) => opts.strip(rel2))) {
8208
- const file = path15.join(dir, rel);
8209
- fs13.rmSync(file, { recursive: true, force: true });
8210
- if (fs13.existsSync(file)) {
8505
+ const file = path17.join(dir, rel);
8506
+ fs14.rmSync(file, { recursive: true, force: true });
8507
+ if (fs14.existsSync(file)) {
8211
8508
  await removeReviewTree(run2, at.repoPath, dir);
8212
8509
  return { ok: false, error: `couldn't remove ${rel} from the checkout` };
8213
8510
  }
@@ -8216,7 +8513,7 @@ async function createReviewTree(run2, at, opts) {
8216
8513
  return { ok: true, dir, removed };
8217
8514
  }
8218
8515
  async function removeReviewTree(run2, repoPath, dir) {
8219
- if (fs13.existsSync(dir)) await run2("git", ["worktree", "remove", "--force", "--force", dir], repoPath);
8516
+ if (fs14.existsSync(dir)) await run2("git", ["worktree", "remove", "--force", "--force", dir], repoPath);
8220
8517
  const gone = rmTree(dir);
8221
8518
  await run2("git", ["worktree", "prune"], repoPath);
8222
8519
  return gone;
@@ -8235,8 +8532,8 @@ async function withReviewTree(run2, at, use, opts) {
8235
8532
  }
8236
8533
  function gitDirOf(dir) {
8237
8534
  try {
8238
- const m = /^gitdir:\s*(.+)$/m.exec(fs13.readFileSync(path15.join(dir, ".git"), "utf8"));
8239
- return m ? path15.resolve(dir, m[1].trim(), "..", "..") : null;
8535
+ const m = /^gitdir:\s*(.+)$/m.exec(fs14.readFileSync(path17.join(dir, ".git"), "utf8"));
8536
+ return m ? path17.resolve(dir, m[1].trim(), "..", "..") : null;
8240
8537
  } catch {
8241
8538
  return null;
8242
8539
  }
@@ -8248,19 +8545,19 @@ async function sweepReviewTrees(run2, opts = {}) {
8248
8545
  const failed = [];
8249
8546
  let names;
8250
8547
  try {
8251
- names = fs13.readdirSync(root, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== NO_HOOKS).map((e) => e.name);
8548
+ names = fs14.readdirSync(root, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== NO_HOOKS).map((e) => e.name);
8252
8549
  } catch {
8253
8550
  return { swept, failed };
8254
8551
  }
8255
8552
  for (const name of names) {
8256
- const dir = path15.join(root, name);
8553
+ const dir = path17.join(root, name);
8257
8554
  try {
8258
- if (opts.olderThanMs && now - fs13.statSync(dir).mtimeMs < opts.olderThanMs) continue;
8555
+ if (opts.olderThanMs && now - fs14.statSync(dir).mtimeMs < opts.olderThanMs) continue;
8259
8556
  } catch {
8260
8557
  continue;
8261
8558
  }
8262
8559
  const gitDir = gitDirOf(dir);
8263
- const gone = gitDir && fs13.existsSync(gitDir) ? await removeReviewTree(run2, gitDir, dir) : rmTree(dir);
8560
+ const gone = gitDir && fs14.existsSync(gitDir) ? await removeReviewTree(run2, gitDir, dir) : rmTree(dir);
8264
8561
  (gone ? swept : failed).push(name);
8265
8562
  }
8266
8563
  return { swept, failed };
@@ -8600,7 +8897,7 @@ function createReviewQueue(deps) {
8600
8897
  }
8601
8898
 
8602
8899
  // src/core/review/review-deps.ts
8603
- import fs14 from "fs";
8900
+ import fs15 from "fs";
8604
8901
  var AGENT_TIMEOUT_MS = 18e4;
8605
8902
  var CHECKOUT_AGENT_TIMEOUT_MS = 3e5;
8606
8903
  var TREE_SWEEP_MIN_AGE_MS = CHECKOUT_AGENT_TIMEOUT_MS + 5 * 6e4;
@@ -8683,7 +8980,7 @@ function realReviewRouteIo() {
8683
8980
  function realFixIo(opts) {
8684
8981
  return {
8685
8982
  lookUp: (r) => resolvePrToStart(r.url, loadConfig() ?? { repos: {}, groups: {} }, r.repo),
8686
- liveSessionOn: (alias, branch) => sessionOnBranch(loadHistory(), loadConfig(), alias, branch, { branchOf: checkedOutBranch, exists: (p) => fs14.existsSync(p) }),
8983
+ liveSessionOn: (alias, branch) => sessionOnBranch(loadHistory(), loadConfig(), alias, branch, { branchOf: checkedOutBranch, exists: (p) => fs15.existsSync(p) }),
8687
8984
  create: async (alias, branch, name) => {
8688
8985
  const config = loadConfig();
8689
8986
  if (!config) return { ok: false, error: "no config" };
@@ -8738,7 +9035,7 @@ function startReviewSweeps(opts) {
8738
9035
  }
8739
9036
 
8740
9037
  // src/core/diff/session-history.ts
8741
- import path16 from "path";
9038
+ import path18 from "path";
8742
9039
 
8743
9040
  // src/core/diff/diff-points.ts
8744
9041
  var SHA = /^[0-9a-f]{7,40}$/;
@@ -8834,12 +9131,12 @@ async function sessionHistory(session, others = []) {
8834
9131
  });
8835
9132
  if (diffArg === "HEAD") continue;
8836
9133
  const log = await g(["log", `-n${MAX_COMMITS2}`, "--format=%H%x1f%cI%x1f%s", `${diffArg}..HEAD`, "--"], root);
8837
- if (log.ok && log.out) commits.push(...parseLog(log.out, path16.basename(root)));
9134
+ if (log.ok && log.out) commits.push(...parseLog(log.out, path18.basename(root)));
8838
9135
  }
8839
9136
  for (const b of others) {
8840
9137
  const tip = await tipOf(b);
8841
9138
  if (!tip) continue;
8842
- const repo = path16.basename(b.path);
9139
+ const repo = path18.basename(b.path);
8843
9140
  const start = liveStart(b) ?? b.start;
8844
9141
  let list = [];
8845
9142
  let base;
@@ -8900,7 +9197,7 @@ function parseLog(stdout, repo) {
8900
9197
  return out;
8901
9198
  }
8902
9199
  function computeSessionRange(session, from, to) {
8903
- const paths = session.paths.map((p) => path16.resolve(p));
9200
+ const paths = session.paths.map((p) => path18.resolve(p));
8904
9201
  const refs = rangeRefs(paths, loadManifest(scopeHashForPaths(paths)).entries, from, to);
8905
9202
  if ("error" in refs) return refs;
8906
9203
  return { repos: refs.map((r) => ({ name: r.name, root: r.root, files: computeRangeDiff(r) })) };
@@ -8919,17 +9216,17 @@ async function sessionHistoryWire(session) {
8919
9216
  }
8920
9217
 
8921
9218
  // src/server/routes/revert-routes.ts
8922
- import path18 from "path";
8923
- import { zValidator as zValidator7 } from "@hono/zod-validator";
8924
- import { z as z6 } from "zod";
9219
+ import path20 from "path";
9220
+ import { zValidator as zValidator8 } from "@hono/zod-validator";
9221
+ import { z as z7 } from "zod";
8925
9222
 
8926
9223
  // src/core/diff/revert.ts
8927
- import fs15 from "fs";
8928
- import path17 from "path";
9224
+ import fs16 from "fs";
9225
+ import path19 from "path";
8929
9226
  function inside(root, rel) {
8930
- const abs = path17.resolve(root, rel);
8931
- const back = path17.relative(path17.resolve(root), abs);
8932
- if (!back || back.startsWith("..") || path17.isAbsolute(back)) return null;
9227
+ const abs = path19.resolve(root, rel);
9228
+ const back = path19.relative(path19.resolve(root), abs);
9229
+ if (!back || back.startsWith("..") || path19.isAbsolute(back)) return null;
8933
9230
  return abs;
8934
9231
  }
8935
9232
  function inHead(root, rel) {
@@ -8939,7 +9236,7 @@ function removeNew(root, rel) {
8939
9236
  const abs = inside(root, rel);
8940
9237
  if (!abs) return { ok: false, status: 400, error: `path escapes the worktree: ${rel}` };
8941
9238
  git(["rm", "--cached", "-q", "--ignore-unmatch", "--", rel], root);
8942
- fs15.rmSync(abs, { force: true });
9239
+ fs16.rmSync(abs, { force: true });
8943
9240
  return null;
8944
9241
  }
8945
9242
  function revertFile(root, file) {
@@ -9028,22 +9325,22 @@ function revertLines(root, file, start, end) {
9028
9325
  }
9029
9326
 
9030
9327
  // src/server/routes/revert-routes.ts
9031
- var revertSchema = z6.object({
9032
- repo: z6.string().min(1),
9033
- path: z6.string().min(1),
9034
- lines: z6.object({ start: z6.number().int().min(0), end: z6.number().int().min(0) }).optional(),
9328
+ var revertSchema = z7.object({
9329
+ repo: z7.string().min(1),
9330
+ path: z7.string().min(1),
9331
+ lines: z7.object({ start: z7.number().int().min(0), end: z7.number().int().min(0) }).optional(),
9035
9332
  /** Leave Claude a note about it (default true). */
9036
- tell: z6.boolean().optional()
9333
+ tell: z7.boolean().optional()
9037
9334
  });
9038
9335
  function mountRevertRoutes(app, opts) {
9039
- app.post("/api/sessions/:id/revert", zValidator7("json", revertSchema), async (c) => {
9336
+ app.post("/api/sessions/:id/revert", zValidator8("json", revertSchema), async (c) => {
9040
9337
  const id = c.req.param("id");
9041
9338
  const session = findSession2(id);
9042
9339
  if (!session) return c.json({ error: "unknown session" }, 404);
9043
9340
  const body = c.req.valid("json");
9044
9341
  const repo = opts.uncommitted(session).find((r) => r.name === body.repo);
9045
- const allowed = new Set(session.paths.map((p) => path18.resolve(p).toLowerCase()));
9046
- if (!repo || !allowed.has(path18.resolve(repo.root).toLowerCase())) {
9342
+ const allowed = new Set(session.paths.map((p) => path20.resolve(p).toLowerCase()));
9343
+ if (!repo || !allowed.has(path20.resolve(repo.root).toLowerCase())) {
9047
9344
  return c.json({ error: `unknown repo: ${body.repo}` }, 404);
9048
9345
  }
9049
9346
  const file = repo.files.find((f) => f.path === body.path);
@@ -9100,7 +9397,7 @@ function mountDevRoutes(app, opts) {
9100
9397
  }
9101
9398
 
9102
9399
  // src/server/routes/ci-routes.ts
9103
- import fs16 from "fs";
9400
+ import fs17 from "fs";
9104
9401
  var WAKE_PROMPT = NOTE_NUDGE;
9105
9402
  async function wakeForNote(id) {
9106
9403
  if (loadConfig()?.prWatch?.wakeClaude === false) return "off";
@@ -9121,7 +9418,7 @@ function mountCiRoutes(app, opts) {
9121
9418
  lookOnly: opts.lookOnly,
9122
9419
  sessions: () => {
9123
9420
  const now = Date.now();
9124
- return loadHistory().filter((s) => watchable(s, now, { exists: (p) => fs16.existsSync(p), lastWriteMs: lastConversationWriteMs })).map((session) => ({ id: sessionIdFor(session), session }));
9421
+ return loadHistory().filter((s) => watchable(s, now, { exists: (p) => fs17.existsSync(p), lastWriteMs: lastConversationWriteMs })).map((session) => ({ id: sessionIdFor(session), session }));
9125
9422
  },
9126
9423
  // Never-pushed branches can't have a PR: don't ask GitHub about them,
9127
9424
  // unless the watch already knows one (a merged PR whose branch is gone).
@@ -9200,27 +9497,27 @@ function mountCiRoutes(app, opts) {
9200
9497
  }
9201
9498
 
9202
9499
  // src/core/diff/diffs-sweep.ts
9203
- import fs17 from "fs";
9204
- import path19 from "path";
9500
+ import fs18 from "fs";
9501
+ import path21 from "path";
9205
9502
  var SWEEP_AFTER_DAYS = 30;
9206
9503
  var DISPOSABLE = /\.(html|log)$/i;
9207
- function sweepOldDiffArtifacts(now = Date.now(), maxAgeDays = SWEEP_AFTER_DAYS, dir = path19.join(getConfigDir(), "diffs")) {
9504
+ function sweepOldDiffArtifacts(now = Date.now(), maxAgeDays = SWEEP_AFTER_DAYS, dir = path21.join(getConfigDir(), "diffs")) {
9208
9505
  const cutoff = now - maxAgeDays * 24 * 60 * 60 * 1e3;
9209
9506
  let removed = 0;
9210
9507
  let bytes = 0;
9211
9508
  let names;
9212
9509
  try {
9213
- names = fs17.readdirSync(dir);
9510
+ names = fs18.readdirSync(dir);
9214
9511
  } catch {
9215
9512
  return { removed, bytes };
9216
9513
  }
9217
9514
  for (const name of names) {
9218
9515
  if (!DISPOSABLE.test(name)) continue;
9219
- const file = path19.join(dir, name);
9516
+ const file = path21.join(dir, name);
9220
9517
  try {
9221
- const st = fs17.statSync(file);
9518
+ const st = fs18.statSync(file);
9222
9519
  if (!st.isFile() || st.mtimeMs >= cutoff) continue;
9223
- fs17.rmSync(file, { force: true });
9520
+ fs18.rmSync(file, { force: true });
9224
9521
  removed++;
9225
9522
  bytes += st.size;
9226
9523
  } catch {
@@ -9428,8 +9725,8 @@ function mountAgentRestartRoutes(app, opts) {
9428
9725
  }
9429
9726
 
9430
9727
  // src/server/routes/account-routes.ts
9431
- import { zValidator as zValidator8 } from "@hono/zod-validator";
9432
- import { z as z7 } from "zod";
9728
+ import { zValidator as zValidator9 } from "@hono/zod-validator";
9729
+ import { z as z8 } from "zod";
9433
9730
 
9434
9731
  // src/core/sessions/account-switch-all.ts
9435
9732
  function sessionsToSwitch(sessions, accountOf, to, from) {
@@ -9500,7 +9797,7 @@ function mountAccountRoutes(app, opts) {
9500
9797
  });
9501
9798
  app.post(
9502
9799
  "/api/accounts",
9503
- zValidator8("json", z7.object({ name: z7.string().min(1).max(64), folder: z7.string().max(1024).optional() })),
9800
+ zValidator9("json", z8.object({ name: z8.string().min(1).max(64), folder: z8.string().max(1024).optional() })),
9504
9801
  async (c) => {
9505
9802
  const accounts = accountsNow();
9506
9803
  const no = cantManage(accounts);
@@ -9580,7 +9877,7 @@ function mountAccountRoutes(app, opts) {
9580
9877
  return refused(c, e);
9581
9878
  }
9582
9879
  });
9583
- app.post("/api/accounts/:name/setup", zValidator8("json", z7.object({ from: z7.string().min(1).max(64) })), async (c) => {
9880
+ app.post("/api/accounts/:name/setup", zValidator9("json", z8.object({ from: z8.string().min(1).max(64) })), async (c) => {
9584
9881
  const accounts = accountsNow();
9585
9882
  const no = cantManage(accounts);
9586
9883
  if (no) return c.json({ error: no }, 409);
@@ -9601,7 +9898,7 @@ function mountAccountRoutes(app, opts) {
9601
9898
  return refused(c, e);
9602
9899
  }
9603
9900
  });
9604
- app.post("/api/accounts/:name/sessions", zValidator8("json", z7.object({ from: z7.string().min(1).max(64).optional() })), async (c) => {
9901
+ app.post("/api/accounts/:name/sessions", zValidator9("json", z8.object({ from: z8.string().min(1).max(64).optional() })), async (c) => {
9605
9902
  if (opts.lookOnly) return c.json({ error: opts.lookOnly }, 409);
9606
9903
  const to = c.req.param("name");
9607
9904
  const { from } = c.req.valid("json");
@@ -9621,7 +9918,7 @@ function mountAccountRoutes(app, opts) {
9621
9918
  changed();
9622
9919
  return c.json({ ok: true, summary: switchAllSummary(rows, to), sessions: rows });
9623
9920
  });
9624
- app.post("/api/sessions/:id/account", zValidator8("json", z7.object({ to: z7.string().min(1).max(64) })), async (c) => {
9921
+ app.post("/api/sessions/:id/account", zValidator9("json", z8.object({ to: z8.string().min(1).max(64) })), async (c) => {
9625
9922
  if (opts.lookOnly) return c.json({ error: opts.lookOnly }, 409);
9626
9923
  const r = await opts.switcher.switchAccount(c.req.param("id"), c.req.valid("json").to).catch((err) => ({
9627
9924
  ok: false,
@@ -9816,7 +10113,7 @@ var localReviewRow = () => null;
9816
10113
  function computeSessionDiff(s, base) {
9817
10114
  const resolved = s.paths.map((p) => resolveRepoDiff(p, base, s.baseBranches?.[p] ?? s.baseBranch));
9818
10115
  const repos = s.paths.map((p, i) => ({
9819
- name: path20.basename(p),
10116
+ name: path22.basename(p),
9820
10117
  root: p,
9821
10118
  resolvedBase: resolved[i].resolvedBase,
9822
10119
  files: computeDiff({ root: p, diffArg: resolved[i].diffArg })
@@ -9867,7 +10164,7 @@ async function startWebServer(opts = {}) {
9867
10164
  let activityWatcher = null;
9868
10165
  if (!lean) {
9869
10166
  try {
9870
- const roots = activityRoots().filter((r) => fs18.existsSync(r));
10167
+ const roots = activityRoots().filter((r) => fs19.existsSync(r));
9871
10168
  if (roots.length > 0) {
9872
10169
  activityWatcher = createFsWatcher({
9873
10170
  roots,
@@ -9920,7 +10217,7 @@ async function startWebServer(opts = {}) {
9920
10217
  }, 500);
9921
10218
  }
9922
10219
  });
9923
- const repoNames = (s) => s.isGroup ? s.paths.map((p) => path20.basename(p)) : [s.target];
10220
+ const repoNames = (s) => s.isGroup ? s.paths.map((p) => path22.basename(p)) : [s.target];
9924
10221
  const diffStatFor = (id, s, hasStatus) => wantsDiffStat(s, hasStatus) ? diffStats.get(id, s.paths, repoNames(s)) : null;
9925
10222
  const archivedRow = createArchivedRows();
9926
10223
  app.get("/api/sessions", (c) => {
@@ -10373,14 +10670,14 @@ async function startWebServer(opts = {}) {
10373
10670
  leftoversBusy = true;
10374
10671
  const run2 = activity.start("processes", "Looking for processes left running");
10375
10672
  try {
10376
- const found = await sweepLeftovers({
10673
+ const found2 = await sweepLeftovers({
10377
10674
  sessions: () => loadHistory().filter((x) => !x.archivedAt).map((x) => ({ id: sessionIdFor(x), name: `${x.target} \xB7 ${x.branch}`, paths: x.paths })),
10378
10675
  list: () => listProcessUsage(),
10379
10676
  agentPid: ptyPid,
10380
10677
  note: (text, o) => run2.note(text, o)
10381
10678
  });
10382
- if (found) run2.done(leftoverSummary(found));
10383
- else run2.fail(leftoverSummary(found));
10679
+ if (found2) run2.done(leftoverSummary(found2));
10680
+ else run2.fail(leftoverSummary(found2));
10384
10681
  } catch (err) {
10385
10682
  run2.fail(err.message);
10386
10683
  } finally {
@@ -10503,7 +10800,7 @@ async function startWebServer(opts = {}) {
10503
10800
  inTree: (s, names) => localTreeRun(s.paths, names, {
10504
10801
  readOnly: internalReadOnly,
10505
10802
  run: (prompt, cwd, deny) => runInternalReadOnly(prompt, cwd, LOCAL_TREE_TIMEOUT_MS, { lane: "localReviews", deny }),
10506
- exists: (dir) => fs18.existsSync(dir)
10803
+ exists: (dir) => fs19.existsSync(dir)
10507
10804
  }),
10508
10805
  rules: () => rulesWith(loadConfig()?.reviews?.rules),
10509
10806
  // Its project's and each of its repos' own points, with the ones for every review.
@@ -10518,6 +10815,7 @@ async function startWebServer(opts = {}) {
10518
10815
  }).row;
10519
10816
  mountSessionProcessRoutes(app, { list: () => listProcessUsage(), agentPid: ptyPid, kill: killTreeAsync });
10520
10817
  mountCodeRoutes(app);
10818
+ mountTerminalPathRoutes(app);
10521
10819
  mountDiffSeenRoutes(app);
10522
10820
  mountDiffPageRoutes(app, { ensureScope: sessionScope });
10523
10821
  mountRepoRoutes(app, { broadcast, activity, workBin: getWorkBin });
@@ -10542,7 +10840,7 @@ async function startWebServer(opts = {}) {
10542
10840
  updatesTimer?.unref?.();
10543
10841
  const desktopFile = desktopUpdatePath();
10544
10842
  const onDesktopUpdate = () => broadcast("updates-changed", { ts: Date.now() });
10545
- if (jobs) fs18.watchFile(desktopFile, { interval: 3e3 }, onDesktopUpdate);
10843
+ if (jobs) fs19.watchFile(desktopFile, { interval: 3e3 }, onDesktopUpdate);
10546
10844
  const usageWatcher = wireUsage(app, {
10547
10845
  broadcast,
10548
10846
  build: () => buildUsage(realUsageDeps()),
@@ -10623,7 +10921,7 @@ async function startWebServer(opts = {}) {
10623
10921
  if (timeFirst) clearTimeout(timeFirst);
10624
10922
  if (timeTimer) clearInterval(timeTimer);
10625
10923
  timeKeeper?.stop();
10626
- fs18.unwatchFile(desktopFile, onDesktopUpdate);
10924
+ fs19.unwatchFile(desktopFile, onDesktopUpdate);
10627
10925
  usageWatcher.stop();
10628
10926
  for (const t of conversationSyncs.values()) clearTimeout(t);
10629
10927
  clearTimeout(sweepTimer);
@@ -10687,11 +10985,11 @@ async function settleAgentHooks(io) {
10687
10985
  }
10688
10986
 
10689
10987
  // src/core/platform/autostart.ts
10690
- import fs19 from "fs";
10691
- import path21 from "path";
10988
+ import fs20 from "fs";
10989
+ import path23 from "path";
10692
10990
  function startupScriptPath() {
10693
10991
  if (process.platform !== "win32" || !process.env.APPDATA) return null;
10694
- return path21.join(process.env.APPDATA, "Microsoft", "Windows", "Start Menu", "Programs", "Startup", "work-web.vbs");
10992
+ return path23.join(process.env.APPDATA, "Microsoft", "Windows", "Start Menu", "Programs", "Startup", "work-web.vbs");
10695
10993
  }
10696
10994
  function vbsQuote(s) {
10697
10995
  return '"' + s.replace(/"/g, '""') + '"';
@@ -10709,11 +11007,11 @@ function setAutostart(enabled, workBin) {
10709
11007
  const file = startupScriptPath();
10710
11008
  if (!file) throw new Error("Autostart is only supported on Windows so far.");
10711
11009
  if (enabled) {
10712
- fs19.mkdirSync(path21.dirname(file), { recursive: true });
10713
- fs19.writeFileSync(file, buildStartupScript(process.execPath, workBin), "utf-8");
11010
+ fs20.mkdirSync(path23.dirname(file), { recursive: true });
11011
+ fs20.writeFileSync(file, buildStartupScript(process.execPath, workBin), "utf-8");
10714
11012
  } else {
10715
11013
  try {
10716
- fs19.unlinkSync(file);
11014
+ fs20.unlinkSync(file);
10717
11015
  } catch {
10718
11016
  }
10719
11017
  }
@@ -10730,14 +11028,14 @@ async function demoHostSubmit(url, review) {
10730
11028
  };
10731
11029
  return { ok: true, url: `${url}#pullrequestreview-1` };
10732
11030
  }
10733
- var hunk = (path23, lines, status = "modified") => {
11031
+ var hunk = (path25, lines, status = "modified") => {
10734
11032
  const added = lines.filter((l) => l.startsWith("+")).length;
10735
11033
  const deleted = lines.filter((l) => l.startsWith("-")).length;
10736
11034
  const context = lines.length - added - deleted;
10737
11035
  return [
10738
- `diff --git a/${path23} b/${path23}`,
10739
- ...status === "added" ? ["new file mode 100644", "index 0000000..1111111", "--- /dev/null"] : ["index 1111111..2222222 100644", `--- a/${path23}`],
10740
- `+++ b/${path23}`,
11036
+ `diff --git a/${path25} b/${path25}`,
11037
+ ...status === "added" ? ["new file mode 100644", "index 0000000..1111111", "--- /dev/null"] : ["index 1111111..2222222 100644", `--- a/${path25}`],
11038
+ `+++ b/${path25}`,
10741
11039
  `@@ -${status === "added" ? 0 : 1},${status === "added" ? 0 : context + deleted} +1,${context + added} @@`,
10742
11040
  ...lines
10743
11041
  ].join("\n");
@@ -11223,7 +11521,7 @@ function createDemoRepos(liveTargets) {
11223
11521
  };
11224
11522
  const groups = { shop: ["backend", "frontend"] };
11225
11523
  const ignored = /* @__PURE__ */ new Set();
11226
- const found = [
11524
+ const found2 = [
11227
11525
  { path: `${root}/api`, folder: "api", origin: "example/api" },
11228
11526
  { path: `${root}/web`, folder: "web", origin: "example/web" },
11229
11527
  { path: `${root}/shop-backend`, folder: "shop-backend", origin: "example/shop-backend" },
@@ -11239,7 +11537,7 @@ function createDemoRepos(liveTargets) {
11239
11537
  /** GET /api/projects: what New worktree offers, as the real one reads config. */
11240
11538
  projects() {
11241
11539
  return {
11242
- singles: Object.entries(repos).map(([name, path23]) => ({ name, kind: "single", path: path23 })),
11540
+ singles: Object.entries(repos).map(([name, path25]) => ({ name, kind: "single", path: path25 })),
11243
11541
  groups: Object.entries(groups).map(([name, members]) => ({ name, kind: "group", members }))
11244
11542
  };
11245
11543
  },
@@ -11248,13 +11546,13 @@ function createDemoRepos(liveTargets) {
11248
11546
  const rows = Object.entries(repos).map(([alias, p]) => ({
11249
11547
  path: p,
11250
11548
  folder: p.split("/").pop(),
11251
- origin: found.find((f) => f.path === p)?.origin ?? null,
11549
+ origin: found2.find((f) => f.path === p)?.origin ?? null,
11252
11550
  status: "enrolled",
11253
11551
  alias,
11254
11552
  groups: Object.entries(groups).flatMap(([g2, m]) => m.includes(alias) ? [g2] : []),
11255
11553
  sessions: sessionsOn(alias)
11256
11554
  }));
11257
- for (const f of found) {
11555
+ for (const f of found2) {
11258
11556
  if (enrolledAt.has(f.path)) continue;
11259
11557
  if (ignored.has(f.path)) {
11260
11558
  rows.push({ ...f, status: "ignored", alias: null, groups: [], sessions: 0 });
@@ -11281,12 +11579,12 @@ function createDemoRepos(liveTargets) {
11281
11579
  }));
11282
11580
  return { roots: [root], repos: rows, groups: groupRows };
11283
11581
  },
11284
- enroll(alias, path23) {
11285
- if (!found.some((f) => f.path === path23)) throw new DemoRepoError(`${path23} is not the top folder of a git repository`);
11286
- const problem = enrollProblem(alias, path23, config());
11582
+ enroll(alias, path25) {
11583
+ if (!found2.some((f) => f.path === path25)) throw new DemoRepoError(`${path25} is not the top folder of a git repository`);
11584
+ const problem = enrollProblem(alias, path25, config());
11287
11585
  if (problem) throw new DemoRepoError(problem);
11288
- repos[alias] = path23;
11289
- ignored.delete(path23);
11586
+ repos[alias] = path25;
11587
+ ignored.delete(path25);
11290
11588
  },
11291
11589
  remove(alias, force) {
11292
11590
  if (!(alias in repos)) throw new DemoRepoError(`no repo \u201C${alias}\u201D`);
@@ -11295,9 +11593,9 @@ function createDemoRepos(liveTargets) {
11295
11593
  delete repos[alias];
11296
11594
  for (const g2 of Object.keys(groups)) groups[g2] = groups[g2].filter((m) => m !== alias);
11297
11595
  },
11298
- ignore(path23, on) {
11299
- if (on) ignored.add(path23);
11300
- else ignored.delete(path23);
11596
+ ignore(path25, on) {
11597
+ if (on) ignored.add(path25);
11598
+ else ignored.delete(path25);
11301
11599
  },
11302
11600
  saveGroup(name, members, creating) {
11303
11601
  const problem = groupProblem(name, members, config(), { creating });
@@ -12596,15 +12894,15 @@ ${reply}\r
12596
12894
  if (refusal || !s) return { ok: false, status: refusal?.status ?? 404, error: refusal?.error ?? "unknown session" };
12597
12895
  s.repos.push({ name: alias, uncommitted: "", sinceBranch: "", published: false, pr: null });
12598
12896
  const from = base || "main";
12599
- const path23 = this.wire(s).paths[s.repos.length - 1];
12897
+ const path25 = this.wire(s).paths[s.repos.length - 1];
12600
12898
  s.comments.post({
12601
12899
  side: "general",
12602
12900
  status: "published",
12603
- body: addedRepoNote({ alias, path: path23, branch: s.branch, from, imported: true })
12901
+ body: addedRepoNote({ alias, path: path25, branch: s.branch, from, imported: true })
12604
12902
  });
12605
12903
  this.emit("comments-changed", { sessionId: id });
12606
12904
  this.changed();
12607
- return { ok: true, wire: { ok: true, path: path23, branch: s.branch, created: true, from, imported: true, warnings: [] } };
12905
+ return { ok: true, wire: { ok: true, path: path25, branch: s.branch, created: true, from, imported: true, warnings: [] } };
12608
12906
  }
12609
12907
  // -- CI (the PR watch, simulated) ------------------------------------------
12610
12908
  /** The Today digest, through the same builder as work web: the demo's
@@ -13182,20 +13480,20 @@ function demoCodeFiles(repos, group) {
13182
13480
  })
13183
13481
  };
13184
13482
  }
13185
- function demoCodeFile(repos, group, repo, path23) {
13483
+ function demoCodeFile(repos, group, repo, path25) {
13186
13484
  if (repo === "") {
13187
- if (!group || path23 !== "CLAUDE.md") return null;
13485
+ if (!group || path25 !== "CLAUDE.md") return null;
13188
13486
  const text2 = `# Group instructions
13189
13487
 
13190
13488
  Repos: ${repos.map((r2) => r2.name).join(", ")}.
13191
13489
  `;
13192
- return { repo, path: path23, size: text2.length, text: text2 };
13490
+ return { repo, path: path25, size: text2.length, text: text2 };
13193
13491
  }
13194
13492
  const r = repos.find((x) => x.name === repo);
13195
13493
  if (!r) return null;
13196
- const changed = r.changed.find((f) => f.path === path23 && f.status !== "deleted");
13197
- const text = changed ? newSide(changed) : COMMON[path23]?.replace(/\{repo\}/g, repo);
13198
- return text === void 0 ? null : { repo, path: path23, size: text.length, text };
13494
+ const changed = r.changed.find((f) => f.path === path25 && f.status !== "deleted");
13495
+ const text = changed ? newSide(changed) : COMMON[path25]?.replace(/\{repo\}/g, repo);
13496
+ return text === void 0 ? null : { repo, path: path25, size: text.length, text };
13199
13497
  }
13200
13498
  function demoCodeSearch(repos, group, query) {
13201
13499
  const q = query.trim();
@@ -13204,12 +13502,12 @@ function demoCodeSearch(repos, group, query) {
13204
13502
  const text = [];
13205
13503
  const fold = (x) => ignoresCase(q) ? x.toLowerCase() : x;
13206
13504
  for (const r of demoCodeFiles(repos, group).repos) {
13207
- for (const path23 of r.files) {
13208
- const lines = (demoCodeFile(repos, group, r.name, path23)?.text ?? "").split("\n");
13505
+ for (const path25 of r.files) {
13506
+ const lines = (demoCodeFile(repos, group, r.name, path25)?.text ?? "").split("\n");
13209
13507
  lines.forEach((line, i) => {
13210
- const d = declarationOf(path23, line);
13211
- if (d) symbols.push({ ...d, repo: r.name, path: path23, line: i + 1, text: line.trim() });
13212
- if (fold(line).includes(fold(q))) text.push({ repo: r.name, path: path23, line: i + 1, text: line });
13508
+ const d = declarationOf(path25, line);
13509
+ if (d) symbols.push({ ...d, repo: r.name, path: path25, line: i + 1, text: line.trim() });
13510
+ if (fold(line).includes(fold(q))) text.push({ repo: r.name, path: path25, line: i + 1, text: line });
13213
13511
  });
13214
13512
  }
13215
13513
  }
@@ -13492,13 +13790,13 @@ function createDemoSettings(repoPathOf) {
13492
13790
  };
13493
13791
  return {
13494
13792
  read,
13495
- async write(path23, value) {
13496
- const f = settingAt(path23);
13497
- if (!f) throw new SettingsError(`no setting ${path23}`, 404);
13793
+ async write(path25, value) {
13794
+ const f = settingAt(path25);
13795
+ if (!f) throw new SettingsError(`no setting ${path25}`, 404);
13498
13796
  const r = checkSetting(f, value);
13499
13797
  if (!r.ok) throw new SettingsError(`${f.label}: ${r.error}`);
13500
- if (r.value === null) delete values[path23];
13501
- else values[path23] = r.value;
13798
+ if (r.value === null) delete values[path25];
13799
+ else values[path25] = r.value;
13502
13800
  return read();
13503
13801
  },
13504
13802
  readRepo,
@@ -13682,19 +13980,39 @@ async function startDemoServer(opts) {
13682
13980
  });
13683
13981
  return c.json({ events });
13684
13982
  });
13983
+ const paneViews = /* @__PURE__ */ new Map();
13984
+ const panes = {
13985
+ pane: (id) => paneViews.get(id) ?? null,
13986
+ open: (id, tab) => void paneViews.set(id, { tab, at: new Date(scenario.clockMs()).toISOString() }),
13987
+ close: (id) => void paneViews.delete(id)
13988
+ };
13989
+ const known = (id) => scenario.list().some((x) => x.id === id);
13685
13990
  app.get(
13686
13991
  "/api/sessions/:id/show",
13687
- (c) => scenario.list().some((x) => x.id === c.req.param("id")) ? c.json({ shown: null }) : notFound(c)
13688
- );
13689
- app.post(
13690
- "/api/sessions/:id/show",
13691
- (c) => scenario.list().some((x) => x.id === c.req.param("id")) ? c.json({ error: "The demo has no files to show." }, 404) : notFound(c)
13692
- );
13693
- app.delete(
13694
- "/api/sessions/:id/show",
13695
- (c) => scenario.list().some((x) => x.id === c.req.param("id")) ? c.json({ shown: null }) : notFound(c)
13992
+ (c) => known(c.req.param("id")) ? c.json({ shown: null, pane: panes.pane(c.req.param("id")) }) : notFound(c)
13696
13993
  );
13994
+ app.post("/api/sessions/:id/show", async (c) => {
13995
+ const id = c.req.param("id");
13996
+ if (!known(id)) return notFound(c);
13997
+ const body = await c.req.json().catch(() => ({}));
13998
+ if (body.close === true) {
13999
+ panes.close(id);
14000
+ return c.json({ shown: null, pane: null });
14001
+ }
14002
+ if (body.view === "diff" || body.view === "code" || body.view === "review") {
14003
+ panes.open(id, body.view);
14004
+ return c.json({ shown: null, pane: panes.pane(id) });
14005
+ }
14006
+ return c.json({ error: "The demo has no files to show." }, 404);
14007
+ });
14008
+ app.delete("/api/sessions/:id/show", (c) => {
14009
+ if (!known(c.req.param("id"))) return notFound(c);
14010
+ panes.close(c.req.param("id"));
14011
+ return c.json({ shown: null, pane: null });
14012
+ });
13697
14013
  app.get("/api/sessions/:id/show/image", (c) => c.json({ error: "it shows no image" }, 404));
14014
+ app.get("/api/sessions/:id/show/text", (c) => c.json({ error: "it shows no scratch file" }, 404));
14015
+ app.get("/api/sessions/:id/show/page", (c) => c.json({ error: "it shows no page" }, 404));
13698
14016
  const localReviews = /* @__PURE__ */ new Set();
13699
14017
  const demoLocalReview = (w) => {
13700
14018
  if (!localReviews.has(w.id)) return { status: "none", repo: null, repos: [] };
@@ -13853,14 +14171,14 @@ async function startDemoServer(opts) {
13853
14171
  (c) => c.json({
13854
14172
  sessions: scenario.list().filter((w) => c.req.query("archived") === "1" || !w.archivedAt).map((w) => {
13855
14173
  const out = draftsFor(w.id) ? { ...w, replyDrafts: draftsFor(w.id) } : { ...w };
13856
- const z8 = snoozes.get(w.id);
14174
+ const z9 = snoozes.get(w.id);
13857
14175
  const waiting = (blocks.get(w.id) ?? []).filter(
13858
14176
  (b) => b.kind === "pr" || scenario.list().some((x) => x.id === b.sessionId && !x.archivedAt)
13859
14177
  );
13860
14178
  const withBlocks = waiting.length ? { ...out, blockedBy: waiting } : out;
13861
14179
  const withNote = notes.has(w.id) ? { ...withBlocks, hasNote: true } : withBlocks;
13862
14180
  const noted = kept.has(w.id) && !w.archivedAt ? { ...withNote, keepAfterMerge: true } : withNote;
13863
- return z8 && snoozeActive(z8, noted) ? { ...noted, snoozed: { until: z8.until } } : noted;
14181
+ return z9 && snoozeActive(z9, noted) ? { ...noted, snoozed: { until: z9.until } } : noted;
13864
14182
  })
13865
14183
  })
13866
14184
  );
@@ -13868,13 +14186,13 @@ async function startDemoServer(opts) {
13868
14186
  const body = await json2(c);
13869
14187
  const w = scenario.list().find((x) => x.id === c.req.param("id"));
13870
14188
  if (!w) return notFound(c);
13871
- let z8;
13872
- if (typeof body.until === "string") z8 = snoozeUntil(body.until, new Date(scenario.clockMs()));
13873
- else if (body.for === "2h" || body.for === "tomorrow" || body.for === "change") z8 = snoozeFor(body.for, w);
14189
+ let z9;
14190
+ if (typeof body.until === "string") z9 = snoozeUntil(body.until, new Date(scenario.clockMs()));
14191
+ else if (body.for === "2h" || body.for === "tomorrow" || body.for === "change") z9 = snoozeFor(body.for, w);
13874
14192
  else return c.json({ error: "for: '2h', 'tomorrow' or 'change', or until: a time" }, 400);
13875
- if (!z8) return c.json({ error: "not a time to snooze until: give one in the next 30 days" }, 400);
13876
- snoozes.set(w.id, z8);
13877
- return c.json({ ok: true, snooze: z8 });
14193
+ if (!z9) return c.json({ error: "not a time to snooze until: give one in the next 30 days" }, 400);
14194
+ snoozes.set(w.id, z9);
14195
+ return c.json({ ok: true, snooze: z9 });
13878
14196
  });
13879
14197
  app.delete("/api/sessions/:id/snooze", (c) => {
13880
14198
  snoozes.delete(c.req.param("id"));
@@ -14146,10 +14464,10 @@ async function startDemoServer(opts) {
14146
14464
  const r = applySectionOp(rail.sections, op);
14147
14465
  if (!r.ok) return c.json({ error: r.error }, 409);
14148
14466
  const sections = r.sections;
14149
- const known = new Set(sections.map((s) => s.id));
14467
+ const known2 = new Set(sections.map((s) => s.id));
14150
14468
  const places = {};
14151
14469
  for (const [id, p] of Object.entries(rail.places)) {
14152
- const next = p.section && !known.has(p.section) ? applyPlacePatch(p, { section: null }) : p;
14470
+ const next = p.section && !known2.has(p.section) ? applyPlacePatch(p, { section: null }) : p;
14153
14471
  if (next) places[id] = next;
14154
14472
  }
14155
14473
  rail = { sections, places };
@@ -14358,6 +14676,13 @@ async function startDemoServer(opts) {
14358
14676
  const noLocalApps = (c) => c.json({ error: "Demo mode: opening local apps is simulated \u2014 there is no real worktree." }, 501);
14359
14677
  app.post("/api/sessions/:id/open-editor", (c) => noLocalApps(c));
14360
14678
  app.post("/api/sessions/:id/open-terminal", (c) => noLocalApps(c));
14679
+ app.post("/api/sessions/:id/terminal-paths/resolve", async (c) => {
14680
+ const body = await c.req.json().catch(() => ({}));
14681
+ const asked = body && typeof body === "object" && "paths" in body && Array.isArray(body.paths) ? body.paths : [];
14682
+ const paths = asked.filter((p) => typeof p === "string").slice(0, 50);
14683
+ return c.json({ results: paths.map((raw) => ({ raw, path: null, kind: "missing", opens: null })) });
14684
+ });
14685
+ app.post("/api/sessions/:id/terminal-paths/open", (c) => noLocalApps(c));
14361
14686
  app.get("/api/sessions/:id/terminal/health", (c) => c.json({ ok: true }));
14362
14687
  app.post("/api/terminals/:id/ticket", (c) => c.json({ fallback: true }));
14363
14688
  app.post("/api/terminal-perf", (c) => c.body(null, 204));
@@ -14700,16 +15025,16 @@ async function startDemoServer(opts) {
14700
15025
  }
14701
15026
 
14702
15027
  // src/core/platform/web-life.ts
14703
- import fs20 from "fs";
14704
- import path22 from "path";
14705
- var lifePath = () => path22.join(getConfigDir(), "web-life.json");
15028
+ import fs21 from "fs";
15029
+ import path24 from "path";
15030
+ var lifePath = () => path24.join(getConfigDir(), "web-life.json");
14706
15031
  function isLife(v) {
14707
15032
  const l = v;
14708
15033
  return !!l && typeof l === "object" && typeof l.pid === "number" && typeof l.version === "string" && typeof l.startedAt === "string" && typeof l.lastSeen === "string" && (l.ended === void 0 || typeof l.ended?.at === "string" && typeof l.ended?.how === "string");
14709
15034
  }
14710
15035
  function readWebLife() {
14711
15036
  try {
14712
- const v = JSON.parse(fs20.readFileSync(lifePath(), "utf-8"));
15037
+ const v = JSON.parse(fs21.readFileSync(lifePath(), "utf-8"));
14713
15038
  return isLife(v) ? v : null;
14714
15039
  } catch {
14715
15040
  return null;
@@ -14973,14 +15298,14 @@ Stopping work web (${how}).`));
14973
15298
  }
14974
15299
  };
14975
15300
  async function runDev(open) {
14976
- const found = await findDevWeb();
14977
- if (found.kind === "running") {
14978
- info(chalk.gray(`work web --dev already running at ${found.url} (PID ${found.pid}).`));
14979
- if (open) openUrl(found.url);
15301
+ const found2 = await findDevWeb();
15302
+ if (found2.kind === "running") {
15303
+ info(chalk.gray(`work web --dev already running at ${found2.url} (PID ${found2.pid}).`));
15304
+ if (open) openUrl(found2.url);
14980
15305
  process.exit(0);
14981
15306
  }
14982
- if (found.kind === "busy") {
14983
- info(chalk.yellow(`A dev server (PID ${found.pid}) runs but isn't answering. Try again in a moment, or end that process.`));
15307
+ if (found2.kind === "busy") {
15308
+ info(chalk.yellow(`A dev server (PID ${found2.pid}) runs but isn't answering. Try again in a moment, or end that process.`));
14984
15309
  process.exit(1);
14985
15310
  }
14986
15311
  let pending;
@@ -15025,31 +15350,31 @@ async function runDev(open) {
15025
15350
  });
15026
15351
  }
15027
15352
  async function stopDev2() {
15028
- const found = await findDevWeb();
15029
- if (found.kind === "none") {
15353
+ const found2 = await findDevWeb();
15354
+ if (found2.kind === "none") {
15030
15355
  info(chalk.gray("No dev server running."));
15031
15356
  return true;
15032
15357
  }
15033
- if (found.kind === "busy") {
15034
- info(chalk.yellow(`The dev server (PID ${found.pid}) isn't answering. Nothing was stopped: try again in a moment.`));
15358
+ if (found2.kind === "busy") {
15359
+ info(chalk.yellow(`The dev server (PID ${found2.pid}) isn't answering. Nothing was stopped: try again in a moment.`));
15035
15360
  return false;
15036
15361
  }
15037
- const asked = await fetch(`${found.url}api/shutdown`, { method: "POST", signal: AbortSignal.timeout(3e3) }).then((r) => r.ok).catch(() => false);
15362
+ const asked = await fetch(`${found2.url}api/shutdown`, { method: "POST", signal: AbortSignal.timeout(3e3) }).then((r) => r.ok).catch(() => false);
15038
15363
  const waitGone = async (ms) => {
15039
15364
  const until = Date.now() + ms;
15040
- while (Date.now() < until && isPidAlive(found.pid)) await new Promise((r) => setTimeout(r, 100));
15365
+ while (Date.now() < until && isPidAlive(found2.pid)) await new Promise((r) => setTimeout(r, 100));
15041
15366
  };
15042
15367
  if (asked) await waitGone(1e4);
15043
- if (isPidAlive(found.pid)) {
15368
+ if (isPidAlive(found2.pid)) {
15044
15369
  try {
15045
- process.kill(found.pid);
15370
+ process.kill(found2.pid);
15046
15371
  } catch {
15047
15372
  }
15048
15373
  await waitGone(3e3);
15049
15374
  }
15050
- const gone = !isPidAlive(found.pid);
15051
- if (gone) clearDevWebDiscovery(found.pid);
15052
- info(gone ? chalk.gray("Stopped the dev server.") : chalk.red(`The dev server (PID ${found.pid}) did not stop.`));
15375
+ const gone = !isPidAlive(found2.pid);
15376
+ if (gone) clearDevWebDiscovery(found2.pid);
15377
+ info(gone ? chalk.gray("Stopped the dev server.") : chalk.red(`The dev server (PID ${found2.pid}) did not stop.`));
15053
15378
  return gone;
15054
15379
  }
15055
15380
  async function runDemo(open) {
@@ -15075,4 +15400,4 @@ export {
15075
15400
  stopExisting,
15076
15401
  webCommand
15077
15402
  };
15078
- //# sourceMappingURL=web-A6FWH4WT.js.map
15403
+ //# sourceMappingURL=web-4JKMKTTD.js.map