@moberg_hr/work-tree 2.22.4 → 2.23.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 (281) hide show
  1. package/dist/{account-J55P3HXH.js → account-FKQZQP3W.js} +20 -17
  2. package/dist/{account-J55P3HXH.js.map → account-FKQZQP3W.js.map} +1 -1
  3. package/dist/{add-repo-ALVEGU25.js → add-repo-VJ2OPGRB.js} +10 -10
  4. package/dist/{answer-CI2SPQQL.js → answer-HQGVCGOF.js} +8 -8
  5. package/dist/{attach-7LBIFBLX.js → attach-M46SZYRL.js} +18 -15
  6. package/dist/{attach-7LBIFBLX.js.map → attach-M46SZYRL.js.map} +1 -1
  7. package/dist/bin.js +3 -3
  8. package/dist/{block-TVIYWRJ5.js → block-B2WNCH52.js} +10 -10
  9. package/dist/{broadcast-GZNMZFOY.js → broadcast-JD755S3I.js} +6 -6
  10. package/dist/{catchup-ZURJI6BF.js → catchup-PTV2VTWT.js} +11 -11
  11. package/dist/{child-K6YYF6MQ.js → child-XFLJLJ6I.js} +8 -8
  12. package/dist/{chunk-RTCTD5PJ.js → chunk-26BZGPFZ.js} +3 -3
  13. package/dist/{chunk-HUW27DSB.js → chunk-336YLJ5L.js} +60 -60
  14. package/dist/{chunk-OCUUM755.js → chunk-4FOC35LW.js} +2 -2
  15. package/dist/{chunk-B2WV5RAL.js → chunk-4GIAERRK.js} +5 -5
  16. package/dist/{chunk-BQS73CWR.js → chunk-4LZLVHZE.js} +2 -2
  17. package/dist/{chunk-DCENKA6E.js → chunk-4VTRRZWZ.js} +2 -2
  18. package/dist/{chunk-GNERWNZY.js → chunk-5IZMEAKN.js} +4 -4
  19. package/dist/{chunk-ATQB6PTV.js → chunk-5THKIWZU.js} +3 -3
  20. package/dist/{chunk-NOQA7MJ4.js → chunk-6HVDHGNE.js} +3 -3
  21. package/dist/{chunk-NYGKSOQ4.js → chunk-6ISLCEBR.js} +6 -6
  22. package/dist/chunk-6KMG4WNW.js +87 -0
  23. package/dist/chunk-6KMG4WNW.js.map +1 -0
  24. package/dist/{chunk-F4UIKOU6.js → chunk-6RFDASKQ.js} +4 -4
  25. package/dist/{chunk-5P27YL64.js → chunk-7I2UHJJF.js} +8 -8
  26. package/dist/{chunk-FV7BSQPQ.js → chunk-AEH72XTU.js} +2 -2
  27. package/dist/{chunk-3ZPVKUYD.js → chunk-ASGJ3MCL.js} +6 -1
  28. package/dist/chunk-ASGJ3MCL.js.map +1 -0
  29. package/dist/{chunk-DF4GOVDE.js → chunk-AUIHERJ7.js} +2 -2
  30. package/dist/{chunk-6Y3VLCKA.js → chunk-AZF7HIDT.js} +3 -3
  31. package/dist/chunk-BCYBF7KJ.js +207 -0
  32. package/dist/chunk-BCYBF7KJ.js.map +1 -0
  33. package/dist/{chunk-KQMHGEI2.js → chunk-BS6GTKF2.js} +51 -13
  34. package/dist/chunk-BS6GTKF2.js.map +1 -0
  35. package/dist/{chunk-AIYZJ7XD.js → chunk-BTGPUOF7.js} +5 -5
  36. package/dist/chunk-CJFAJV2K.js +9 -0
  37. package/dist/{chunk-VQDE3DRG.js → chunk-DHZ5DF6Y.js} +6 -2
  38. package/dist/{chunk-VQDE3DRG.js.map → chunk-DHZ5DF6Y.js.map} +1 -1
  39. package/dist/{chunk-LV5JRLBM.js → chunk-DP6YMZUL.js} +2 -2
  40. package/dist/{chunk-Z4FWXDJG.js → chunk-DSDPJATB.js} +3 -3
  41. package/dist/{chunk-RLPC3YKZ.js → chunk-EE744F4B.js} +2 -2
  42. package/dist/{chunk-QOLHDDM2.js → chunk-EEMPMVCP.js} +4 -4
  43. package/dist/{chunk-SDYY5MHW.js → chunk-EJZMCAM2.js} +7 -7
  44. package/dist/{chunk-EYJ42LDG.js → chunk-EOXYDFBB.js} +4 -4
  45. package/dist/{chunk-DC73NF67.js → chunk-ETO7CUIS.js} +3 -3
  46. package/dist/{chunk-ZO7TF5OL.js → chunk-ETRKZHM5.js} +4 -4
  47. package/dist/{chunk-HI674QZF.js → chunk-EVGYDJI2.js} +2 -2
  48. package/dist/{chunk-PUJSLL6R.js → chunk-FEI73IPX.js} +4 -4
  49. package/dist/{chunk-KU3TQAA7.js → chunk-FRFS6JC4.js} +8 -10
  50. package/dist/{chunk-KU3TQAA7.js.map → chunk-FRFS6JC4.js.map} +1 -1
  51. package/dist/{chunk-4QMWNAEJ.js → chunk-HCYES6U7.js} +2 -2
  52. package/dist/{chunk-WRDULHAN.js → chunk-HTV7366A.js} +117 -16
  53. package/dist/chunk-HTV7366A.js.map +1 -0
  54. package/dist/{chunk-5FIUVBUC.js → chunk-JIMD77FI.js} +7 -7
  55. package/dist/{chunk-TOMDOA4P.js → chunk-K76NOSEX.js} +2 -2
  56. package/dist/{chunk-FGBLFF4O.js → chunk-KUYEYPO4.js} +2 -2
  57. package/dist/{chunk-Z4P23XG3.js → chunk-L5U47Q63.js} +5 -5
  58. package/dist/{chunk-YO3BNAAK.js → chunk-LZJ5VDUD.js} +26 -4
  59. package/dist/chunk-LZJ5VDUD.js.map +1 -0
  60. package/dist/{chunk-USENBMUV.js → chunk-NS7WH53I.js} +1 -1
  61. package/dist/chunk-NS7WH53I.js.map +1 -0
  62. package/dist/{chunk-EA4C6TVY.js → chunk-O7BXNXU2.js} +3 -3
  63. package/dist/{chunk-ZTWZS5RK.js → chunk-OETBYJFV.js} +3 -3
  64. package/dist/chunk-PCJVBGRS.js +64 -0
  65. package/dist/chunk-PCJVBGRS.js.map +1 -0
  66. package/dist/{chunk-RNPNBGVX.js → chunk-QPQV3IU2.js} +3 -5
  67. package/dist/{chunk-RNPNBGVX.js.map → chunk-QPQV3IU2.js.map} +1 -1
  68. package/dist/chunk-R7IENU76.js +79 -0
  69. package/dist/chunk-R7IENU76.js.map +1 -0
  70. package/dist/{chunk-23QLXVH6.js → chunk-R7JIKEIL.js} +12 -14
  71. package/dist/{chunk-23QLXVH6.js.map → chunk-R7JIKEIL.js.map} +1 -1
  72. package/dist/{chunk-CA56ETYX.js → chunk-TVIM5VV5.js} +5 -5
  73. package/dist/{chunk-PTAG6WIE.js → chunk-UGDTSOPX.js} +17 -3
  74. package/dist/chunk-UGDTSOPX.js.map +1 -0
  75. package/dist/{chunk-D2SVBU7R.js → chunk-ULI54QYZ.js} +2 -2
  76. package/dist/{chunk-7Q5PBXF6.js → chunk-V56WW2LA.js} +51 -10
  77. package/dist/chunk-V56WW2LA.js.map +1 -0
  78. package/dist/{chunk-G4T2HGLJ.js → chunk-V6FD76AQ.js} +4 -4
  79. package/dist/{chunk-QNOJOZYK.js → chunk-VVJY6IKW.js} +2 -2
  80. package/dist/{chunk-Q2B3NUSM.js → chunk-WLYWO6JH.js} +4 -4
  81. package/dist/{chunk-IU6LA6EB.js → chunk-WYCGV5Z7.js} +4 -4
  82. package/dist/{chunk-AITL3JYB.js → chunk-XJQ7XJJC.js} +398 -68
  83. package/dist/chunk-XJQ7XJJC.js.map +1 -0
  84. package/dist/{chunk-CMRTNTMU.js → chunk-Z3JSYKOS.js} +6 -6
  85. package/dist/{chunk-UAF2YFLZ.js → chunk-ZBVM57LO.js} +6 -6
  86. package/dist/{chunk-GQ5WECPJ.js → chunk-ZDTFAMD2.js} +2 -2
  87. package/dist/{chunk-EEHPZMS3.js → chunk-ZIZ5ZTEN.js} +2 -2
  88. package/dist/{cleanup-G4WQACD6.js → cleanup-RVQ2PPCC.js} +30 -29
  89. package/dist/{cleanup-G4WQACD6.js.map → cleanup-RVQ2PPCC.js.map} +1 -1
  90. package/dist/{cli-XI2W5KRQ.js → cli-RQ7LQXRX.js} +4 -4
  91. package/dist/{color-C223W3Z6.js → color-37SJ7NPH.js} +9 -9
  92. package/dist/{config-KQYXQCQA.js → config-QMNCPBT7.js} +8 -8
  93. package/dist/{coordinate-4E5GIMC6.js → coordinate-22N2UBE4.js} +9 -9
  94. package/dist/{diff-HEOLTXO2.js → diff-VSM47DNB.js} +9 -10
  95. package/dist/{diff-HEOLTXO2.js.map → diff-VSM47DNB.js.map} +1 -1
  96. package/dist/{digest-GYF4YLUH.js → digest-H5YMEW54.js} +8 -8
  97. package/dist/{fork-B35ONP3Z.js → fork-Q2AEFG5M.js} +27 -24
  98. package/dist/{fork-B35ONP3Z.js.map → fork-Q2AEFG5M.js.map} +1 -1
  99. package/dist/{history-25DNQKKC.js → history-E34WUNZO.js} +6 -6
  100. package/dist/{hook-B4JO2X57.js → hook-IMBHXXH2.js} +17 -17
  101. package/dist/{hydrate-IJEKNZIP.js → hydrate-IPNTSEDA.js} +6 -6
  102. package/dist/{init-UJVOUDJI.js → init-V7Z3RVHQ.js} +10 -10
  103. package/dist/{install-skills-FV2L5QHE.js → install-skills-PP7WYASM.js} +6 -7
  104. package/dist/install-skills-bin.js +5 -6
  105. package/dist/install-skills-bin.js.map +1 -1
  106. package/dist/{keep-PKXGFZO2.js → keep-JZBFDYC5.js} +8 -8
  107. package/dist/{list-VYQ3QE2H.js → list-D6GWBNUI.js} +6 -6
  108. package/dist/{move-IAZY23ZX.js → move-T6IVLRRI.js} +13 -13
  109. package/dist/{note-6HQUKUYY.js → note-L4YF6DYN.js} +8 -8
  110. package/dist/{overlaps-CGP3RJOW.js → overlaps-33U2T7IV.js} +11 -11
  111. package/dist/{pin-PAWGQ4Q2.js → pin-BVNCXHQI.js} +9 -9
  112. package/dist/{pr-OJOGE3A3.js → pr-DBTWVMRE.js} +19 -18
  113. package/dist/{pr-OJOGE3A3.js.map → pr-DBTWVMRE.js.map} +1 -1
  114. package/dist/{prune-42MS36OR.js → prune-HUYBTMZM.js} +27 -27
  115. package/dist/pty-host-IJFDGRA4.js +2653 -0
  116. package/dist/pty-host-IJFDGRA4.js.map +1 -0
  117. package/dist/{read-ATNCW4KH.js → read-4OUYRSKS.js} +8 -8
  118. package/dist/{recent-MTBFQT36.js → recent-PB233FPD.js} +14 -13
  119. package/dist/{recent-MTBFQT36.js.map → recent-PB233FPD.js.map} +1 -1
  120. package/dist/{remove-GLDJOKUI.js → remove-YCQLIDTS.js} +28 -28
  121. package/dist/{report-AK7Z2Y4S.js → report-XMESBL7C.js} +8 -8
  122. package/dist/{restart-DEPDGEZB.js → restart-NQ5DJ3TN.js} +8 -8
  123. package/dist/{resume-C2QPKKFN.js → resume-KL5JCKVD.js} +14 -13
  124. package/dist/{resume-C2QPKKFN.js.map → resume-KL5JCKVD.js.map} +1 -1
  125. package/dist/{review-RYAGH3PY.js → review-MIKB545E.js} +7 -7
  126. package/dist/{review-now-K4UWD7A5.js → review-now-VF6X6M64.js} +2 -2
  127. package/dist/{run-WNP2SMNW.js → run-Y255ESUN.js} +6 -6
  128. package/dist/{screen-P746M4F2.js → screen-AZFHPOCB.js} +8 -8
  129. package/dist/{search-XQ2WMK5X.js → search-DAFKJTLY.js} +6 -6
  130. package/dist/{section-Q7TPOV7U.js → section-WCC35C44.js} +9 -9
  131. package/dist/{send-EGG23J2B.js → send-MYEMZU7Z.js} +9 -9
  132. package/dist/{sessions-2NNCWIND.js → sessions-P3D46QLP.js} +24 -22
  133. package/dist/{sessions-2NNCWIND.js.map → sessions-P3D46QLP.js.map} +1 -1
  134. package/dist/{show-KSMC7AJL.js → show-JOO5OT2F.js} +7 -7
  135. package/dist/{snooze-4LVYUQEX.js → snooze-7KLABMIG.js} +8 -8
  136. package/dist/{start-YKLLXW3L.js → start-PGVZZJQT.js} +8 -8
  137. package/dist/{state-GM22X3RN.js → state-XHTOESKK.js} +3 -3
  138. package/dist/state-XHTOESKK.js.map +1 -0
  139. package/dist/{status-4HGP4ZEF.js → status-CXIRNRMP.js} +9 -9
  140. package/dist/{statusline-QJ6CJGHB.js → statusline-HPH2ORNT.js} +3 -3
  141. package/dist/{stop-YBQL6NFF.js → stop-IJNUSRIG.js} +8 -8
  142. package/dist/{sync-DUXN2MFJ.js → sync-3HMCC55V.js} +27 -27
  143. package/dist/{time-Q42HPZZ3.js → time-DUDNSHM3.js} +9 -9
  144. package/dist/{time-actions-IXZRVKKQ.js → time-actions-M4QTTH4M.js} +3 -3
  145. package/dist/{timesheet-YJ6O3GUU.js → timesheet-BMKDX5KZ.js} +12 -12
  146. package/dist/{todo-ZBFRL2A5.js → todo-QMXJ5R3E.js} +2 -2
  147. package/dist/{tree-H2UYE6LH.js → tree-TL4GISI5.js} +28 -26
  148. package/dist/{tree-H2UYE6LH.js.map → tree-TL4GISI5.js.map} +1 -1
  149. package/dist/{update-RGNKMRUL.js → update-3TODL7J3.js} +13 -13
  150. package/dist/{usage-YZRZKJ3H.js → usage-YFTN2IS7.js} +8 -8
  151. package/dist/{usage-ask-BYPNLA2B.js → usage-ask-EZR3W3UW.js} +3 -3
  152. package/dist/{version-4IOMOIDP.js → version-LNHKXZBP.js} +4 -4
  153. package/dist/{wait-YOHPFWVJ.js → wait-B37BTCVG.js} +9 -9
  154. package/dist/wd-bin.js +3 -3
  155. package/dist/web/assets/{PtyView-CW2GxKSc.js → PtyView-C8yW4SST.js} +26 -28
  156. package/dist/web/assets/PtyView-C8yW4SST.js.map +1 -0
  157. package/dist/web/assets/index-DDZCgbD-.js +129 -0
  158. package/dist/web/assets/index-DDZCgbD-.js.map +1 -0
  159. package/dist/web/assets/index-yBTfBzDm.css +1 -0
  160. package/dist/web/index.html +2 -2
  161. package/dist/{web-EC3KKH6E.js → web-JAAXINIU.js} +528 -498
  162. package/dist/web-JAAXINIU.js.map +1 -0
  163. package/npm-shrinkwrap.json +3 -4
  164. package/package.json +2 -2
  165. package/dist/chunk-3ZPVKUYD.js.map +0 -1
  166. package/dist/chunk-7Q5PBXF6.js.map +0 -1
  167. package/dist/chunk-7ZOY2QQN.js +0 -43
  168. package/dist/chunk-7ZOY2QQN.js.map +0 -1
  169. package/dist/chunk-AITL3JYB.js.map +0 -1
  170. package/dist/chunk-ICEP4WAK.js +0 -256
  171. package/dist/chunk-ICEP4WAK.js.map +0 -1
  172. package/dist/chunk-KQMHGEI2.js.map +0 -1
  173. package/dist/chunk-LNHSBM4L.js +0 -26
  174. package/dist/chunk-LNHSBM4L.js.map +0 -1
  175. package/dist/chunk-PTAG6WIE.js.map +0 -1
  176. package/dist/chunk-TDJVYUF2.js +0 -9
  177. package/dist/chunk-USENBMUV.js.map +0 -1
  178. package/dist/chunk-WRDULHAN.js.map +0 -1
  179. package/dist/chunk-YO3BNAAK.js.map +0 -1
  180. package/dist/pty-host-ULVOMW3R.js +0 -1235
  181. package/dist/pty-host-ULVOMW3R.js.map +0 -1
  182. package/dist/state-GM22X3RN.js.map +0 -1
  183. package/dist/web/assets/PtyView-CW2GxKSc.js.map +0 -1
  184. package/dist/web/assets/index-Ca7KbCED.css +0 -1
  185. package/dist/web/assets/index-DEdSxNCA.js +0 -129
  186. package/dist/web/assets/index-DEdSxNCA.js.map +0 -1
  187. package/dist/web-EC3KKH6E.js.map +0 -1
  188. /package/dist/{add-repo-ALVEGU25.js.map → add-repo-VJ2OPGRB.js.map} +0 -0
  189. /package/dist/{answer-CI2SPQQL.js.map → answer-HQGVCGOF.js.map} +0 -0
  190. /package/dist/{block-TVIYWRJ5.js.map → block-B2WNCH52.js.map} +0 -0
  191. /package/dist/{broadcast-GZNMZFOY.js.map → broadcast-JD755S3I.js.map} +0 -0
  192. /package/dist/{catchup-ZURJI6BF.js.map → catchup-PTV2VTWT.js.map} +0 -0
  193. /package/dist/{child-K6YYF6MQ.js.map → child-XFLJLJ6I.js.map} +0 -0
  194. /package/dist/{chunk-RTCTD5PJ.js.map → chunk-26BZGPFZ.js.map} +0 -0
  195. /package/dist/{chunk-HUW27DSB.js.map → chunk-336YLJ5L.js.map} +0 -0
  196. /package/dist/{chunk-OCUUM755.js.map → chunk-4FOC35LW.js.map} +0 -0
  197. /package/dist/{chunk-B2WV5RAL.js.map → chunk-4GIAERRK.js.map} +0 -0
  198. /package/dist/{chunk-BQS73CWR.js.map → chunk-4LZLVHZE.js.map} +0 -0
  199. /package/dist/{chunk-DCENKA6E.js.map → chunk-4VTRRZWZ.js.map} +0 -0
  200. /package/dist/{chunk-GNERWNZY.js.map → chunk-5IZMEAKN.js.map} +0 -0
  201. /package/dist/{chunk-ATQB6PTV.js.map → chunk-5THKIWZU.js.map} +0 -0
  202. /package/dist/{chunk-NOQA7MJ4.js.map → chunk-6HVDHGNE.js.map} +0 -0
  203. /package/dist/{chunk-NYGKSOQ4.js.map → chunk-6ISLCEBR.js.map} +0 -0
  204. /package/dist/{chunk-F4UIKOU6.js.map → chunk-6RFDASKQ.js.map} +0 -0
  205. /package/dist/{chunk-5P27YL64.js.map → chunk-7I2UHJJF.js.map} +0 -0
  206. /package/dist/{chunk-FV7BSQPQ.js.map → chunk-AEH72XTU.js.map} +0 -0
  207. /package/dist/{chunk-DF4GOVDE.js.map → chunk-AUIHERJ7.js.map} +0 -0
  208. /package/dist/{chunk-6Y3VLCKA.js.map → chunk-AZF7HIDT.js.map} +0 -0
  209. /package/dist/{chunk-AIYZJ7XD.js.map → chunk-BTGPUOF7.js.map} +0 -0
  210. /package/dist/{chunk-TDJVYUF2.js.map → chunk-CJFAJV2K.js.map} +0 -0
  211. /package/dist/{chunk-LV5JRLBM.js.map → chunk-DP6YMZUL.js.map} +0 -0
  212. /package/dist/{chunk-Z4FWXDJG.js.map → chunk-DSDPJATB.js.map} +0 -0
  213. /package/dist/{chunk-RLPC3YKZ.js.map → chunk-EE744F4B.js.map} +0 -0
  214. /package/dist/{chunk-QOLHDDM2.js.map → chunk-EEMPMVCP.js.map} +0 -0
  215. /package/dist/{chunk-SDYY5MHW.js.map → chunk-EJZMCAM2.js.map} +0 -0
  216. /package/dist/{chunk-EYJ42LDG.js.map → chunk-EOXYDFBB.js.map} +0 -0
  217. /package/dist/{chunk-DC73NF67.js.map → chunk-ETO7CUIS.js.map} +0 -0
  218. /package/dist/{chunk-ZO7TF5OL.js.map → chunk-ETRKZHM5.js.map} +0 -0
  219. /package/dist/{chunk-HI674QZF.js.map → chunk-EVGYDJI2.js.map} +0 -0
  220. /package/dist/{chunk-PUJSLL6R.js.map → chunk-FEI73IPX.js.map} +0 -0
  221. /package/dist/{chunk-4QMWNAEJ.js.map → chunk-HCYES6U7.js.map} +0 -0
  222. /package/dist/{chunk-5FIUVBUC.js.map → chunk-JIMD77FI.js.map} +0 -0
  223. /package/dist/{chunk-TOMDOA4P.js.map → chunk-K76NOSEX.js.map} +0 -0
  224. /package/dist/{chunk-FGBLFF4O.js.map → chunk-KUYEYPO4.js.map} +0 -0
  225. /package/dist/{chunk-Z4P23XG3.js.map → chunk-L5U47Q63.js.map} +0 -0
  226. /package/dist/{chunk-EA4C6TVY.js.map → chunk-O7BXNXU2.js.map} +0 -0
  227. /package/dist/{chunk-ZTWZS5RK.js.map → chunk-OETBYJFV.js.map} +0 -0
  228. /package/dist/{chunk-CA56ETYX.js.map → chunk-TVIM5VV5.js.map} +0 -0
  229. /package/dist/{chunk-D2SVBU7R.js.map → chunk-ULI54QYZ.js.map} +0 -0
  230. /package/dist/{chunk-G4T2HGLJ.js.map → chunk-V6FD76AQ.js.map} +0 -0
  231. /package/dist/{chunk-QNOJOZYK.js.map → chunk-VVJY6IKW.js.map} +0 -0
  232. /package/dist/{chunk-Q2B3NUSM.js.map → chunk-WLYWO6JH.js.map} +0 -0
  233. /package/dist/{chunk-IU6LA6EB.js.map → chunk-WYCGV5Z7.js.map} +0 -0
  234. /package/dist/{chunk-CMRTNTMU.js.map → chunk-Z3JSYKOS.js.map} +0 -0
  235. /package/dist/{chunk-UAF2YFLZ.js.map → chunk-ZBVM57LO.js.map} +0 -0
  236. /package/dist/{chunk-GQ5WECPJ.js.map → chunk-ZDTFAMD2.js.map} +0 -0
  237. /package/dist/{chunk-EEHPZMS3.js.map → chunk-ZIZ5ZTEN.js.map} +0 -0
  238. /package/dist/{cli-XI2W5KRQ.js.map → cli-RQ7LQXRX.js.map} +0 -0
  239. /package/dist/{color-C223W3Z6.js.map → color-37SJ7NPH.js.map} +0 -0
  240. /package/dist/{config-KQYXQCQA.js.map → config-QMNCPBT7.js.map} +0 -0
  241. /package/dist/{coordinate-4E5GIMC6.js.map → coordinate-22N2UBE4.js.map} +0 -0
  242. /package/dist/{digest-GYF4YLUH.js.map → digest-H5YMEW54.js.map} +0 -0
  243. /package/dist/{history-25DNQKKC.js.map → history-E34WUNZO.js.map} +0 -0
  244. /package/dist/{hook-B4JO2X57.js.map → hook-IMBHXXH2.js.map} +0 -0
  245. /package/dist/{hydrate-IJEKNZIP.js.map → hydrate-IPNTSEDA.js.map} +0 -0
  246. /package/dist/{init-UJVOUDJI.js.map → init-V7Z3RVHQ.js.map} +0 -0
  247. /package/dist/{install-skills-FV2L5QHE.js.map → install-skills-PP7WYASM.js.map} +0 -0
  248. /package/dist/{keep-PKXGFZO2.js.map → keep-JZBFDYC5.js.map} +0 -0
  249. /package/dist/{list-VYQ3QE2H.js.map → list-D6GWBNUI.js.map} +0 -0
  250. /package/dist/{move-IAZY23ZX.js.map → move-T6IVLRRI.js.map} +0 -0
  251. /package/dist/{note-6HQUKUYY.js.map → note-L4YF6DYN.js.map} +0 -0
  252. /package/dist/{overlaps-CGP3RJOW.js.map → overlaps-33U2T7IV.js.map} +0 -0
  253. /package/dist/{pin-PAWGQ4Q2.js.map → pin-BVNCXHQI.js.map} +0 -0
  254. /package/dist/{prune-42MS36OR.js.map → prune-HUYBTMZM.js.map} +0 -0
  255. /package/dist/{read-ATNCW4KH.js.map → read-4OUYRSKS.js.map} +0 -0
  256. /package/dist/{remove-GLDJOKUI.js.map → remove-YCQLIDTS.js.map} +0 -0
  257. /package/dist/{report-AK7Z2Y4S.js.map → report-XMESBL7C.js.map} +0 -0
  258. /package/dist/{restart-DEPDGEZB.js.map → restart-NQ5DJ3TN.js.map} +0 -0
  259. /package/dist/{review-RYAGH3PY.js.map → review-MIKB545E.js.map} +0 -0
  260. /package/dist/{review-now-K4UWD7A5.js.map → review-now-VF6X6M64.js.map} +0 -0
  261. /package/dist/{run-WNP2SMNW.js.map → run-Y255ESUN.js.map} +0 -0
  262. /package/dist/{screen-P746M4F2.js.map → screen-AZFHPOCB.js.map} +0 -0
  263. /package/dist/{search-XQ2WMK5X.js.map → search-DAFKJTLY.js.map} +0 -0
  264. /package/dist/{section-Q7TPOV7U.js.map → section-WCC35C44.js.map} +0 -0
  265. /package/dist/{send-EGG23J2B.js.map → send-MYEMZU7Z.js.map} +0 -0
  266. /package/dist/{show-KSMC7AJL.js.map → show-JOO5OT2F.js.map} +0 -0
  267. /package/dist/{snooze-4LVYUQEX.js.map → snooze-7KLABMIG.js.map} +0 -0
  268. /package/dist/{start-YKLLXW3L.js.map → start-PGVZZJQT.js.map} +0 -0
  269. /package/dist/{status-4HGP4ZEF.js.map → status-CXIRNRMP.js.map} +0 -0
  270. /package/dist/{statusline-QJ6CJGHB.js.map → statusline-HPH2ORNT.js.map} +0 -0
  271. /package/dist/{stop-YBQL6NFF.js.map → stop-IJNUSRIG.js.map} +0 -0
  272. /package/dist/{sync-DUXN2MFJ.js.map → sync-3HMCC55V.js.map} +0 -0
  273. /package/dist/{time-Q42HPZZ3.js.map → time-DUDNSHM3.js.map} +0 -0
  274. /package/dist/{time-actions-IXZRVKKQ.js.map → time-actions-M4QTTH4M.js.map} +0 -0
  275. /package/dist/{timesheet-YJ6O3GUU.js.map → timesheet-BMKDX5KZ.js.map} +0 -0
  276. /package/dist/{todo-ZBFRL2A5.js.map → todo-QMXJ5R3E.js.map} +0 -0
  277. /package/dist/{update-RGNKMRUL.js.map → update-3TODL7J3.js.map} +0 -0
  278. /package/dist/{usage-YZRZKJ3H.js.map → usage-YFTN2IS7.js.map} +0 -0
  279. /package/dist/{usage-ask-BYPNLA2B.js.map → usage-ask-EZR3W3UW.js.map} +0 -0
  280. /package/dist/{version-4IOMOIDP.js.map → version-LNHKXZBP.js.map} +0 -0
  281. /package/dist/{wait-YOHPFWVJ.js.map → wait-B37BTCVG.js.map} +0 -0
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ensureAgentPath,
4
- restartHost
5
- } from "./chunk-YO3BNAAK.js";
4
+ restartHost,
5
+ resumeFromParams,
6
+ withResume
7
+ } from "./chunk-LZJ5VDUD.js";
6
8
  import {
7
9
  addTask,
8
10
  completeTask,
@@ -24,7 +26,7 @@ import {
24
26
  serveSpa,
25
27
  sessionBaseForPath,
26
28
  submitReviewSchema
27
- } from "./chunk-GNERWNZY.js";
29
+ } from "./chunk-5IZMEAKN.js";
28
30
  import {
29
31
  announceChange,
30
32
  createArchivedRows,
@@ -39,25 +41,25 @@ import {
39
41
  stageSeenKey,
40
42
  storeHolding,
41
43
  withRestoring
42
- } from "./chunk-5P27YL64.js";
44
+ } from "./chunk-7I2UHJJF.js";
43
45
  import {
44
46
  createDigestSource
45
- } from "./chunk-EYJ42LDG.js";
47
+ } from "./chunk-EOXYDFBB.js";
46
48
  import {
47
49
  createBuildFoldersJob,
48
50
  defaultBranchTidyDeps,
49
51
  defaultBuildFoldersDeps,
50
52
  deleteMergedBranches,
51
53
  findMergedBranches
52
- } from "./chunk-SDYY5MHW.js";
54
+ } from "./chunk-EJZMCAM2.js";
53
55
  import {
54
56
  defaultCleanupDeps
55
- } from "./chunk-CMRTNTMU.js";
57
+ } from "./chunk-Z3JSYKOS.js";
56
58
  import {
57
59
  DiffStatCache,
58
60
  findOverlaps,
59
61
  wantsDiffStat
60
- } from "./chunk-EEHPZMS3.js";
62
+ } from "./chunk-ZIZ5ZTEN.js";
61
63
  import {
62
64
  dropLocalReview,
63
65
  readLocalReview,
@@ -77,14 +79,14 @@ import {
77
79
  graphProblem,
78
80
  signOutGraph,
79
81
  startDeviceLogin
80
- } from "./chunk-5FIUVBUC.js";
82
+ } from "./chunk-JIMD77FI.js";
81
83
  import {
82
84
  anyOwnStatusLine,
83
85
  buildUsage,
84
86
  realUsageDeps,
85
87
  refreshUsage,
86
88
  setupAgentUsage
87
- } from "./chunk-G4T2HGLJ.js";
89
+ } from "./chunk-V6FD76AQ.js";
88
90
  import {
89
91
  archivedRefusal,
90
92
  sendToSession
@@ -106,7 +108,7 @@ import {
106
108
  removeBlocker,
107
109
  sweepBlocks,
108
110
  unblockedPrompt
109
- } from "./chunk-ZTWZS5RK.js";
111
+ } from "./chunk-OETBYJFV.js";
110
112
  import {
111
113
  jiraWorklogPoster,
112
114
  logWorkDay,
@@ -115,7 +117,7 @@ import {
115
117
  } from "./chunk-WIXY4EDH.js";
116
118
  import {
117
119
  sessionWorkTime
118
- } from "./chunk-EA4C6TVY.js";
120
+ } from "./chunk-O7BXNXU2.js";
119
121
  import {
120
122
  accountOverview,
121
123
  accountSkillsNote,
@@ -128,7 +130,7 @@ import {
128
130
  removeAgentAccount,
129
131
  setDefaultAgentAccount,
130
132
  switchRefusal
131
- } from "./chunk-UAF2YFLZ.js";
133
+ } from "./chunk-ZBVM57LO.js";
132
134
  import "./chunk-LK7HJGUC.js";
133
135
  import {
134
136
  freeLeftovers,
@@ -138,25 +140,27 @@ import {
138
140
  parsePrRef,
139
141
  resolvePrToStart,
140
142
  workOnPrPrompt
141
- } from "./chunk-KU3TQAA7.js";
143
+ } from "./chunk-FRFS6JC4.js";
142
144
  import {
143
145
  legacyUnsafeCheck
144
- } from "./chunk-NYGKSOQ4.js";
146
+ } from "./chunk-6ISLCEBR.js";
145
147
  import {
146
148
  howToLift
147
149
  } from "./chunk-FZHFD2AY.js";
148
150
  import {
149
151
  agentsBySession,
152
+ stopBackgroundWork,
150
153
  summarizeAgents
151
- } from "./chunk-7ZOY2QQN.js";
154
+ } from "./chunk-R7IENU76.js";
155
+ import "./chunk-PCJVBGRS.js";
152
156
  import {
153
157
  removeWorktreeInChild
154
- } from "./chunk-D2SVBU7R.js";
158
+ } from "./chunk-ULI54QYZ.js";
155
159
  import {
156
160
  archiveMergedSession,
157
161
  archiveWaiting,
158
162
  defaultArchiveDeps
159
- } from "./chunk-23QLXVH6.js";
163
+ } from "./chunk-R7JIKEIL.js";
160
164
  import {
161
165
  cleanupVerdict,
162
166
  createCleanupJob
@@ -176,7 +180,7 @@ import {
176
180
  retireResolvedReplies,
177
181
  sessionRepoRefs,
178
182
  withThreadContext
179
- } from "./chunk-CA56ETYX.js";
183
+ } from "./chunk-TVIM5VV5.js";
180
184
  import {
181
185
  DEFAULT_TRUSTED_BOTS,
182
186
  createCiStore,
@@ -186,21 +190,19 @@ import {
186
190
  openThreadsOf,
187
191
  reviewMessage,
188
192
  subAgentHint
189
- } from "./chunk-DC73NF67.js";
190
- import {
191
- commandWords,
192
- describeProcess,
193
- isPtyHelper,
194
- listProcesses,
195
- normDir,
196
- runningFromNames,
197
- runsFrom
198
- } from "./chunk-ICEP4WAK.js";
193
+ } from "./chunk-ETO7CUIS.js";
199
194
  import {
200
195
  defaultForkDeps,
201
196
  forkSession,
202
197
  startSessionWithPrompt
203
- } from "./chunk-Z4P23XG3.js";
198
+ } from "./chunk-L5U47Q63.js";
199
+ import {
200
+ FLOW_PARAM,
201
+ gridFromParams,
202
+ validGrid,
203
+ withFlow,
204
+ withGrid
205
+ } from "./chunk-6KMG4WNW.js";
204
206
  import {
205
207
  childText,
206
208
  createInChild,
@@ -208,7 +210,7 @@ import {
208
210
  keyedQueue,
209
211
  oneAtATime,
210
212
  runWorkChild
211
- } from "./chunk-QOLHDDM2.js";
213
+ } from "./chunk-EEMPMVCP.js";
212
214
  import {
213
215
  configurePtyPool,
214
216
  detachPtyPool,
@@ -233,25 +235,26 @@ import {
233
235
  syncPtyPool,
234
236
  terminalTicketUrl,
235
237
  writeToPty
236
- } from "./chunk-WRDULHAN.js";
237
- import "./chunk-GQ5WECPJ.js";
238
+ } from "./chunk-HTV7366A.js";
239
+ import "./chunk-BCYBF7KJ.js";
240
+ import "./chunk-ZDTFAMD2.js";
238
241
  import {
239
242
  disposeAllWatchers,
240
243
  disposeSessionWatcher,
241
244
  findSession as findSession2,
242
245
  subscribeSession
243
- } from "./chunk-OCUUM755.js";
244
- import "./chunk-4QMWNAEJ.js";
245
- import "./chunk-USENBMUV.js";
246
+ } from "./chunk-4FOC35LW.js";
247
+ import "./chunk-HCYES6U7.js";
248
+ import "./chunk-NS7WH53I.js";
246
249
  import {
247
250
  addRepoRefusal,
248
251
  addedRepoNote
249
- } from "./chunk-DCENKA6E.js";
252
+ } from "./chunk-4VTRRZWZ.js";
250
253
  import {
251
254
  teardownWorktree,
252
255
  toBaseSpec,
253
256
  wouldRefuseRemoval
254
- } from "./chunk-IU6LA6EB.js";
257
+ } from "./chunk-WYCGV5Z7.js";
255
258
  import "./chunk-Y7PWSACJ.js";
256
259
  import {
257
260
  isWorktreeFolder
@@ -271,35 +274,36 @@ import {
271
274
  stackedOn,
272
275
  updateFromBase,
273
276
  updateFromMain
274
- } from "./chunk-B2WV5RAL.js";
277
+ } from "./chunk-4GIAERRK.js";
275
278
  import {
276
279
  sessionStatusView,
277
280
  shownState
278
- } from "./chunk-6Y3VLCKA.js";
281
+ } from "./chunk-AZF7HIDT.js";
279
282
  import {
280
283
  askCatchUp,
281
284
  cachedCatchUp,
282
285
  catchUp,
283
286
  catchUpFacts,
284
287
  forgetCatchUp
285
- } from "./chunk-F4UIKOU6.js";
288
+ } from "./chunk-6RFDASKQ.js";
286
289
  import {
287
290
  internalReadOnly,
288
291
  runInternal,
289
292
  runInternalReadOnly,
290
293
  summarizeCheckpoint,
291
294
  throttleTrailing
292
- } from "./chunk-PUJSLL6R.js";
295
+ } from "./chunk-FEI73IPX.js";
293
296
  import {
294
297
  computeDiff,
295
298
  computeRangeDiff,
296
299
  parseGitDiff
297
- } from "./chunk-QNOJOZYK.js";
300
+ } from "./chunk-VVJY6IKW.js";
298
301
  import {
299
302
  changeRailSections,
300
303
  placeSession,
301
- readRailLayout
302
- } from "./chunk-PTAG6WIE.js";
304
+ readRailLayout,
305
+ saveRailView
306
+ } from "./chunk-UGDTSOPX.js";
303
307
  import {
304
308
  QUEUE_RECHECK_MS,
305
309
  busyForRestart,
@@ -337,7 +341,7 @@ import {
337
341
  tempoSetup,
338
342
  timeRange,
339
343
  updateDay
340
- } from "./chunk-BQS73CWR.js";
344
+ } from "./chunk-4LZLVHZE.js";
341
345
  import {
342
346
  DISCUSSION_OPEN_MIN_MS,
343
347
  LEFT_OVER_SUBMIT,
@@ -386,6 +390,12 @@ import {
386
390
  asData,
387
391
  asDataBlock
388
392
  } from "./chunk-JVE2JFLV.js";
393
+ import {
394
+ ASSISTANT_ID,
395
+ assistantDir,
396
+ describeView,
397
+ writeAssistantContext
398
+ } from "./chunk-K76NOSEX.js";
389
399
  import {
390
400
  childBrief,
391
401
  childrenOf,
@@ -393,15 +403,9 @@ import {
393
403
  newBranchCheck,
394
404
  setParent,
395
405
  spawnCheck
396
- } from "./chunk-VQDE3DRG.js";
397
- import {
398
- ASSISTANT_ID,
399
- assistantDir,
400
- describeView,
401
- writeAssistantContext
402
- } from "./chunk-TOMDOA4P.js";
406
+ } from "./chunk-DHZ5DF6Y.js";
403
407
  import "./chunk-7E5XPDKX.js";
404
- import "./chunk-FV7BSQPQ.js";
408
+ import "./chunk-AEH72XTU.js";
405
409
  import {
406
410
  clearDevWebDiscovery,
407
411
  clearWebDiscovery,
@@ -419,7 +423,7 @@ import {
419
423
  findSessionForCwd,
420
424
  readPendingForSession,
421
425
  readPendingForWorktree
422
- } from "./chunk-LV5JRLBM.js";
426
+ } from "./chunk-DP6YMZUL.js";
423
427
  import "./chunk-ZSHWP2VS.js";
424
428
  import {
425
429
  getCommentFileStore
@@ -431,7 +435,7 @@ import {
431
435
  checkTools,
432
436
  saveFolders,
433
437
  setupState
434
- } from "./chunk-Q2B3NUSM.js";
438
+ } from "./chunk-WLYWO6JH.js";
435
439
  import {
436
440
  chooseWorktreesRoot,
437
441
  expandHome
@@ -444,17 +448,17 @@ import {
444
448
  stageInputOf,
445
449
  withRequiredChecks,
446
450
  workElsewhere
447
- } from "./chunk-AIYZJ7XD.js";
451
+ } from "./chunk-BTGPUOF7.js";
448
452
  import {
449
453
  createSessionBranches
450
- } from "./chunk-Z4FWXDJG.js";
454
+ } from "./chunk-DSDPJATB.js";
451
455
  import {
452
456
  defaultHost,
453
457
  hostById,
454
458
  hostForRepo,
455
459
  hostOfPrUrl,
456
460
  originHostname
457
- } from "./chunk-NOQA7MJ4.js";
461
+ } from "./chunk-6HVDHGNE.js";
458
462
  import {
459
463
  MAX_THREAD_BODY
460
464
  } from "./chunk-FGPXMAYU.js";
@@ -479,13 +483,13 @@ import {
479
483
  setRepoIgnored,
480
484
  setReviewMode,
481
485
  setScanRoot
482
- } from "./chunk-ATQB6PTV.js";
486
+ } from "./chunk-5THKIWZU.js";
483
487
  import {
484
488
  openUrl,
485
489
  openWithDefaultApp,
486
490
  revealInFileManager,
487
491
  startEditor
488
- } from "./chunk-RTCTD5PJ.js";
492
+ } from "./chunk-26BZGPFZ.js";
489
493
  import {
490
494
  enrollProblem,
491
495
  groupProblem,
@@ -517,6 +521,7 @@ import {
517
521
  compressQuietCopies,
518
522
  createFsWatcher,
519
523
  createStageTracker,
524
+ describeProcess,
520
525
  devLogTail,
521
526
  devState,
522
527
  disposeAllScopes,
@@ -527,15 +532,19 @@ import {
527
532
  headAdvancedSinceInitial,
528
533
  headBroughtInOtherWork,
529
534
  hostName,
535
+ isPtyHelper,
530
536
  isRestoring,
531
537
  lastConversationWriteMs,
532
538
  listIssues,
539
+ listProcessUsage,
540
+ listProcesses,
533
541
  listScopes,
534
542
  loadHistory,
535
543
  loadManifest,
536
544
  markAgentStopped,
537
545
  markScopeEnded,
538
546
  markSeen,
547
+ normDir,
539
548
  notePrLooks,
540
549
  noteSessionPrs,
541
550
  notifyKindForTransition,
@@ -558,6 +567,8 @@ import {
558
567
  restoreArchivedTranscripts,
559
568
  reviveScope,
560
569
  runGitAsync,
570
+ runningFromNames,
571
+ runsFrom,
561
572
  scopeHashForPaths,
562
573
  scopesForCwd,
563
574
  scopesToSweep,
@@ -585,7 +596,7 @@ import {
585
596
  updateCheckpoint,
586
597
  whileRestoring,
587
598
  writeArchiveRecord
588
- } from "./chunk-AITL3JYB.js";
599
+ } from "./chunk-XJQ7XJJC.js";
589
600
  import {
590
601
  dayKey
591
602
  } from "./chunk-NEJVK5CF.js";
@@ -597,9 +608,6 @@ import {
597
608
  tx,
598
609
  withDb
599
610
  } from "./chunk-QGUBOOEN.js";
600
- import {
601
- packageRoot
602
- } from "./chunk-LNHSBM4L.js";
603
611
  import {
604
612
  AccountAdminError,
605
613
  RETIRED_HOOK_OWNERS,
@@ -615,16 +623,17 @@ import {
615
623
  liveAgents,
616
624
  logSwallowed,
617
625
  ownsBranch,
626
+ packageRoot,
618
627
  projectList,
619
628
  readJsonlSince,
620
629
  swallow
621
- } from "./chunk-KQMHGEI2.js";
630
+ } from "./chunk-BS6GTKF2.js";
622
631
  import "./chunk-KGHWHAVF.js";
623
- import "./chunk-FGBLFF4O.js";
632
+ import "./chunk-KUYEYPO4.js";
624
633
  import "./chunk-ED6YLB4S.js";
625
634
  import {
626
635
  VERSION
627
- } from "./chunk-TDJVYUF2.js";
636
+ } from "./chunk-CJFAJV2K.js";
628
637
  import {
629
638
  resolveProjectTarget
630
639
  } from "./chunk-IPHADNF5.js";
@@ -646,7 +655,7 @@ import {
646
655
  import {
647
656
  DEFAULT_ACCOUNT_NAME,
648
657
  accountNameProblem
649
- } from "./chunk-HI674QZF.js";
658
+ } from "./chunk-EVGYDJI2.js";
650
659
  import {
651
660
  DEFAULT_ACCOUNT,
652
661
  DEFAULT_PROMPTS,
@@ -655,13 +664,14 @@ import {
655
664
  RAIL_COLORS,
656
665
  applyPlacePatch,
657
666
  applySectionOp,
667
+ asRailView,
658
668
  cleanPlacePatch,
659
669
  cleanSectionOp,
660
670
  getConfigPath,
661
671
  isRailColor,
662
672
  isWorkday,
663
673
  loadConfig
664
- } from "./chunk-3ZPVKUYD.js";
674
+ } from "./chunk-ASGJ3MCL.js";
665
675
  import "./chunk-W4GDPHIF.js";
666
676
  import "./chunk-BR6OWWAA.js";
667
677
  import {
@@ -738,7 +748,7 @@ function createStartupQuestions(deps) {
738
748
  }
739
749
 
740
750
  // src/server/web-server.ts
741
- import fs19 from "fs";
751
+ import fs20 from "fs";
742
752
 
743
753
  // src/core/conversations/last-reply.ts
744
754
  function lastReplyOf(entries) {
@@ -789,6 +799,12 @@ function realDeps(app) {
789
799
  const agent = s ? agentOf(s) : null;
790
800
  if (!s || !agent?.conversation) return { error: `work can't read ${agent?.name ?? "its agent"}'s conversations yet` };
791
801
  return { text: lastReplyOf(agent.conversation.read(s, { last: 40 })) };
802
+ },
803
+ stopBackground: async (id) => {
804
+ const s = findSession2(id);
805
+ const toolShell = s ? agentOf(s).live?.toolShell : void 0;
806
+ if (!s || !toolShell) return { error: `work can't tell ${s ? agentOf(s).name : "its agent"}'s background commands apart yet` };
807
+ return stopBackgroundWork(agentsBySession(liveAgents(), loadHistory()).get(id) ?? [], toolShell);
792
808
  }
793
809
  };
794
810
  }
@@ -836,6 +852,14 @@ function mountSessionControlRoutes(app, opts) {
836
852
  opts.broadcast("sessions-changed", { ts: Date.now() });
837
853
  return c.json({ how: "stopped" });
838
854
  });
855
+ app.post("/api/sessions/:id/background/stop", async (c) => {
856
+ const id = c.req.param("id");
857
+ if (!findSession2(id)) return c.json({ error: "unknown session" }, 404);
858
+ const r = await deps.stopBackground(id);
859
+ if ("error" in r) return c.json(r, 409);
860
+ if (r.stopped.length) opts.broadcast("sessions-changed", { ts: Date.now() });
861
+ return c.json(r);
862
+ });
839
863
  app.get("/api/sessions/:id/screen", async (c) => {
840
864
  const id = c.req.param("id");
841
865
  if (!findSession2(id)) return c.json({ error: "unknown session" }, 404);
@@ -852,12 +876,12 @@ function mountSessionControlRoutes(app, opts) {
852
876
  // src/core/stacks/stack-sync.ts
853
877
  var busyWhy = (state) => state === "working" ? "its Claude is working" : state === "needs_input" ? "its Claude is waiting for your answer" : null;
854
878
  async function syncStackChild(child, parentBranch, deps) {
855
- const run2 = deps.run ?? defaultRunner;
879
+ const run = deps.run ?? defaultRunner;
856
880
  const busy = busyWhy(deps.shownState(child));
857
881
  if (busy) return { updated: false, why: busy };
858
882
  const behind = [];
859
883
  for (const p of child.paths) {
860
- const b = await behindMain(p, run2, parentBranch);
884
+ const b = await behindMain(p, run, parentBranch);
861
885
  if (b && b.commits > 0) behind.push({ path: p, b });
862
886
  }
863
887
  if (behind.length === 0) return { updated: false, why: `already on top of ${parentBranch}` };
@@ -865,9 +889,9 @@ async function syncStackChild(child, parentBranch, deps) {
865
889
  return { updated: false, why: `bringing in ${parentBranch} would conflict: left for you (Update from ${parentBranch})` };
866
890
  const heads = /* @__PURE__ */ new Map();
867
891
  for (const { path: p } of behind) {
868
- const st = await run2("git", ["-C", p, "status", "--porcelain"], p);
892
+ const st = await run("git", ["-C", p, "status", "--porcelain"], p);
869
893
  if (st.code !== 0 || st.stdout.trim()) return { updated: false, why: "it has uncommitted changes" };
870
- const head = await run2("git", ["-C", p, "rev-parse", "HEAD"], p);
894
+ const head = await run("git", ["-C", p, "rev-parse", "HEAD"], p);
871
895
  if (head.code !== 0) return { updated: false, why: `${p}: ${head.stderr.trim() || "no HEAD"}` };
872
896
  heads.set(p, head.stdout.trim());
873
897
  }
@@ -876,9 +900,9 @@ async function syncStackChild(child, parentBranch, deps) {
876
900
  const done = [];
877
901
  for (const { path: p } of behind) {
878
902
  const nowBusy = busyWhy(deps.shownState(child));
879
- const r = nowBusy ? null : await updateFromMain(p, run2, parentBranch);
903
+ const r = nowBusy ? null : await updateFromMain(p, run, parentBranch);
880
904
  if (!r || !r.ok) {
881
- for (const q of done) await run2("git", ["-C", q, "reset", "--hard", "--quiet", heads.get(q)], q);
905
+ for (const q of done) await run("git", ["-C", q, "reset", "--hard", "--quiet", heads.get(q)], q);
882
906
  return {
883
907
  updated: false,
884
908
  why: nowBusy ?? `${r.repo}: ${r.reason}${done.length ? " (the others were put back)" : ""}`
@@ -900,15 +924,15 @@ async function syncStackChild(child, parentBranch, deps) {
900
924
  return { updated: true, commits, how, told };
901
925
  }
902
926
  async function retargetIfMerged(child, parent, config, deps) {
903
- const run2 = deps.run ?? defaultRunner;
927
+ const run = deps.run ?? defaultRunner;
904
928
  const busy = busyWhy(deps.shownState(child));
905
929
  if (busy) return { updated: false, why: busy };
906
930
  const tips = /* @__PURE__ */ new Map();
907
- for (const p of child.paths) tips.set(p, await parentTipFor(p, parent, config, run2));
931
+ for (const p of child.paths) tips.set(p, await parentTipFor(p, parent, config, run));
908
932
  for (const p of child.paths) {
909
933
  const tip = tips.get(p);
910
934
  if (!tip) return { updated: false, why: `${parent.branch} merged, but its tip is unknown here: Move onto main by hand` };
911
- const blocker = await retargetBlocker(p, { branch: parent.branch, tip }, run2);
935
+ const blocker = await retargetBlocker(p, { branch: parent.branch, tip }, run);
912
936
  if (blocker?.handOff) {
913
937
  const key = `${sessionIdFor(child)}:${tip}`;
914
938
  if (handedOff.has(key))
@@ -920,7 +944,7 @@ async function retargetIfMerged(child, parent, config, deps) {
920
944
  await deps.tell(child, ontoMainPrompt(parent.branch)).catch((err) => logSwallowed(`asking ${child.branch} to move onto main`, err));
921
945
  return { updated: false, why: `${parent.branch} was rewritten before it merged: its Claude was asked to move this branch onto main` };
922
946
  }
923
- if (!await retargetIsClean(p, { branch: parent.branch, tip }, run2)) {
947
+ if (!await retargetIsClean(p, { branch: parent.branch, tip }, run)) {
924
948
  return {
925
949
  updated: false,
926
950
  why: `${parent.branch} merged; moving onto main isn't sure to go cleanly (a conflict, uncommitted changes, a rewritten parent, or an old git): left for you`
@@ -930,7 +954,7 @@ async function retargetIfMerged(child, parent, config, deps) {
930
954
  const r = await retargetOntoMain(
931
955
  child,
932
956
  async (p) => ({ branch: parent.branch, tip: tips.get(p) ?? null }),
933
- run2,
957
+ run,
934
958
  () => busyWhy(deps.shownState(child))
935
959
  );
936
960
  if (!r.ok)
@@ -961,7 +985,7 @@ async function retargetChildrenOf(parentId, deps) {
961
985
  const stacks = sessionStacks(history, config);
962
986
  const children = history.filter((s) => stacks.mergedParentOf.get(sessionIdFor(s))?.id === parentId);
963
987
  if (children.length === 0) return 0;
964
- const run2 = deps.startRun();
988
+ const run = deps.startRun();
965
989
  let moved = 0;
966
990
  for (const child of children) {
967
991
  const id = sessionIdFor(child);
@@ -972,18 +996,18 @@ async function retargetChildrenOf(parentId, deps) {
972
996
  if (r.updated) {
973
997
  moved++;
974
998
  deps.invalidate(id);
975
- run2.note(
999
+ run.note(
976
1000
  `${child.branch}: ${r.how} (its parent merged and was archived)${r.told ? "; its Claude was told" : " \u2014 telling its Claude failed"}`,
977
1001
  { sessionId: id, ...r.told ? {} : { level: "warn" } }
978
1002
  );
979
- } else run2.note(`${child.branch}: left as it is \u2014 ${r.why}`, { sessionId: id });
1003
+ } else run.note(`${child.branch}: left as it is \u2014 ${r.why}`, { sessionId: id });
980
1004
  } catch (err) {
981
- run2.note(`${child.branch}: ${err.message}`, { sessionId: id, level: "warn" });
1005
+ run.note(`${child.branch}: ${err.message}`, { sessionId: id, level: "warn" });
982
1006
  } finally {
983
1007
  deps.busy.delete(id);
984
1008
  }
985
1009
  }
986
- run2.done(moved ? `${moved} moved onto main` : "none could move by itself");
1010
+ run.done(moved ? `${moved} moved onto main` : "none could move by itself");
987
1011
  return moved;
988
1012
  }
989
1013
  async function syncStacksAfterTurn(sessionId, deps) {
@@ -996,7 +1020,7 @@ async function syncStacksAfterTurn(sessionId, deps) {
996
1020
  if (candidates2.length === 0 && !merged) return 0;
997
1021
  for (const c of candidates2) deps.invalidate(sessionIdFor(c));
998
1022
  if (config?.stacks?.autoUpdate === false) return 0;
999
- const run2 = deps.startRun();
1023
+ const run = deps.startRun();
1000
1024
  let updated = 0;
1001
1025
  if (self && merged && !deps.busy.has(sessionId)) {
1002
1026
  deps.busy.add(sessionId);
@@ -1005,13 +1029,13 @@ async function syncStacksAfterTurn(sessionId, deps) {
1005
1029
  if (r.updated) {
1006
1030
  updated++;
1007
1031
  deps.invalidate(sessionId);
1008
- run2.note(`${self.branch}: ${r.how} (${merged.branch} merged)${r.told ? "; its Claude was told" : " \u2014 telling its Claude failed"}`, {
1032
+ run.note(`${self.branch}: ${r.how} (${merged.branch} merged)${r.told ? "; its Claude was told" : " \u2014 telling its Claude failed"}`, {
1009
1033
  sessionId,
1010
1034
  ...r.told ? {} : { level: "warn" }
1011
1035
  });
1012
- } else run2.note(`${self.branch}: left as it is \u2014 ${r.why}`, { sessionId });
1036
+ } else run.note(`${self.branch}: left as it is \u2014 ${r.why}`, { sessionId });
1013
1037
  } catch (err) {
1014
- run2.note(`${self.branch}: ${err.message}`, { sessionId, level: "warn" });
1038
+ run.note(`${self.branch}: ${err.message}`, { sessionId, level: "warn" });
1015
1039
  } finally {
1016
1040
  deps.busy.delete(sessionId);
1017
1041
  }
@@ -1026,20 +1050,20 @@ async function syncStacksAfterTurn(sessionId, deps) {
1026
1050
  if (r.updated) {
1027
1051
  updated++;
1028
1052
  deps.invalidate(childId);
1029
- run2.note(
1053
+ run.note(
1030
1054
  `${child.branch}: ${r.commits} commit${r.commits === 1 ? "" : "s"} from ${parent.branch} (${r.how})${r.told ? "; its Claude was told" : "; telling its Claude failed \u2014 it doesn't know yet"}`,
1031
1055
  { sessionId: childId, ...r.told ? {} : { level: "warn" } }
1032
1056
  );
1033
1057
  } else {
1034
- run2.note(`${child.branch}: left as it is \u2014 ${r.why}`, { sessionId: childId });
1058
+ run.note(`${child.branch}: left as it is \u2014 ${r.why}`, { sessionId: childId });
1035
1059
  }
1036
1060
  } catch (err) {
1037
- run2.note(`${child.branch}: ${err.message}`, { sessionId: childId, level: "warn" });
1061
+ run.note(`${child.branch}: ${err.message}`, { sessionId: childId, level: "warn" });
1038
1062
  } finally {
1039
1063
  deps.busy.delete(childId);
1040
1064
  }
1041
1065
  }
1042
- run2.done(updated ? `${updated} brought up to date` : "nothing to bring in");
1066
+ run.done(updated ? `${updated} brought up to date` : "nothing to bring in");
1043
1067
  return updated;
1044
1068
  }
1045
1069
 
@@ -1809,29 +1833,79 @@ function mountSessionReviewRoutes(app, deps) {
1809
1833
  }
1810
1834
 
1811
1835
  // src/server/routes/session-show-routes.ts
1812
- import path5 from "path";
1836
+ import path6 from "path";
1813
1837
 
1814
1838
  // src/core/sessions/shown-file.ts
1815
- import fs5 from "fs";
1816
- import path4 from "path";
1839
+ import fs6 from "fs";
1840
+ import path5 from "path";
1817
1841
 
1818
1842
  // src/core/worktree/terminal-paths.ts
1819
- import fs4 from "fs";
1843
+ import fs5 from "fs";
1820
1844
  import os from "os";
1821
- import path3 from "path";
1845
+ import path4 from "path";
1822
1846
 
1823
- // src/core/worktree/code-browse.ts
1847
+ // src/core/platform/network-mounts.ts
1824
1848
  import fs3 from "fs";
1825
1849
  import path2 from "path";
1850
+ var NETWORK_TYPES = /^(?:nfs\d?|smbfs|afpfs|webdav|cifs|smb3?|autofs|sshfs|fuse\.sshfs|9p|davfs)$/i;
1851
+ var DARWIN_AUTOMOUNTS = ["/home", "/net", "/Network"];
1852
+ var KEEP_MS = 6e4;
1853
+ function parseNetworkMounts(text, platform) {
1854
+ const roots = [];
1855
+ for (const line of text.split(/\r?\n/)) {
1856
+ if (platform === "darwin") {
1857
+ const m = / on (\/.*?) \(([^,)]+)/.exec(line);
1858
+ if (m && NETWORK_TYPES.test(m[2].trim())) roots.push(m[1]);
1859
+ } else {
1860
+ const [, where, type] = line.split(" ");
1861
+ if (where && type && NETWORK_TYPES.test(type)) roots.push(where.replace(/\\040/g, " "));
1862
+ }
1863
+ }
1864
+ return roots;
1865
+ }
1866
+ function readMountTable(platform) {
1867
+ if (platform === "linux") return fs3.readFileSync("/proc/mounts", "utf-8");
1868
+ if (platform !== "darwin") return "";
1869
+ const r = spawn_default.sync("/sbin/mount", [], { encoding: "utf-8", timeout: 2e3, windowsHide: true });
1870
+ return typeof r.stdout === "string" ? r.stdout : "";
1871
+ }
1872
+ var cached = null;
1873
+ function networkMountRoots(platform = process.platform, now = Date.now()) {
1874
+ if (cached && now - cached.at < KEEP_MS) return cached.roots;
1875
+ let mounts = [];
1876
+ try {
1877
+ mounts = parseNetworkMounts(readMountTable(platform), platform);
1878
+ } catch {
1879
+ }
1880
+ const roots = [...platform === "darwin" ? DARWIN_AUTOMOUNTS : [], ...mounts];
1881
+ cached = { at: now, roots };
1882
+ return roots;
1883
+ }
1884
+ function onNetworkVolume(p, roots, platform = process.platform) {
1885
+ const win = platform === "win32";
1886
+ const norm4 = (s) => {
1887
+ const n = win ? path2.win32.normalize(s).replace(/\\/g, "/") : path2.posix.normalize(s);
1888
+ return win || platform === "darwin" ? n.toLowerCase() : n;
1889
+ };
1890
+ const at = norm4(p);
1891
+ return roots.some((root) => {
1892
+ const r = norm4(root).replace(/\/+$/, "");
1893
+ return r !== "" && (at === r || at.startsWith(r + "/"));
1894
+ });
1895
+ }
1896
+
1897
+ // src/core/worktree/code-browse.ts
1898
+ import fs4 from "fs";
1899
+ import path3 from "path";
1826
1900
  var MAX_CODE_FILES = 5e4;
1827
1901
  var MAX_CODE_FILE_BYTES = 2 * 1024 * 1024;
1828
1902
  var LIST_TTL_MS = 3e3;
1829
1903
  function codeRoots(s) {
1830
- return s.paths.map((p) => ({ name: path2.basename(p), root: p }));
1904
+ return s.paths.map((p) => ({ name: path3.basename(p), root: p }));
1831
1905
  }
1832
1906
  function groupRoot(s) {
1833
1907
  if (!s.isGroup || s.paths.length === 0) return null;
1834
- const parents = [...new Set(s.paths.map((p) => path2.dirname(p)))];
1908
+ const parents = [...new Set(s.paths.map((p) => path3.dirname(p)))];
1835
1909
  return parents.length === 1 ? parents[0] : null;
1836
1910
  }
1837
1911
  var realIo = {
@@ -1904,7 +1978,7 @@ async function changedFiles(root, base, io = realIo) {
1904
1978
  async function listCodeFiles(s, io = realIo) {
1905
1979
  const repos = await Promise.all(
1906
1980
  codeRoots(s).map(async ({ name, root }) => {
1907
- if (!fs3.existsSync(root)) return { name, files: [], changed: [], truncated: false };
1981
+ if (!fs4.existsSync(root)) return { name, files: [], changed: [], truncated: false };
1908
1982
  const [all, changed] = await Promise.all([listRepoFiles(root, io), changedFiles(root, s.baseBranches?.[root] ?? s.baseBranch, io)]);
1909
1983
  const listed = new Set(all);
1910
1984
  return {
@@ -1921,7 +1995,7 @@ function groupRootFiles(s) {
1921
1995
  const dir = groupRoot(s);
1922
1996
  if (!dir) return [];
1923
1997
  try {
1924
- return fs3.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && isGroupNote(e.name)).map((e) => e.name).sort();
1998
+ return fs4.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && isGroupNote(e.name)).map((e) => e.name).sort();
1925
1999
  } catch {
1926
2000
  return [];
1927
2001
  }
@@ -1940,12 +2014,12 @@ async function codeFilePath(s, repo, rel, io = realIo) {
1940
2014
  if (!root) return { error: "unknown repo" };
1941
2015
  if (!allowed) return { error: "not listed" };
1942
2016
  try {
1943
- const full = path2.resolve(root, rel);
1944
- const realRoot = fs3.realpathSync.native(root);
1945
- const real = fs3.realpathSync.native(full);
1946
- const inside2 = path2.relative(realRoot, real);
1947
- if (!inside2 || inside2.startsWith("..") || path2.isAbsolute(inside2)) return { error: "not listed" };
1948
- const st = fs3.statSync(real);
2017
+ const full = path3.resolve(root, rel);
2018
+ const realRoot = fs4.realpathSync.native(root);
2019
+ const real = fs4.realpathSync.native(full);
2020
+ const inside2 = path3.relative(realRoot, real);
2021
+ if (!inside2 || inside2.startsWith("..") || path3.isAbsolute(inside2)) return { error: "not listed" };
2022
+ const st = fs4.statSync(real);
1949
2023
  if (!st.isFile()) return { error: "unreadable" };
1950
2024
  return { real, size: st.size };
1951
2025
  } catch (err) {
@@ -1957,7 +2031,7 @@ async function readCodeFile(s, repo, rel, io = realIo) {
1957
2031
  if ("error" in at) return at;
1958
2032
  if (at.size > MAX_CODE_FILE_BYTES) return { repo, path: rel, size: at.size, text: null, reason: "too-large" };
1959
2033
  try {
1960
- const buf = await fs3.promises.readFile(at.real);
2034
+ const buf = await fs4.promises.readFile(at.real);
1961
2035
  if (buf.subarray(0, 8e3).includes(0)) return { repo, path: rel, size: at.size, text: null, reason: "binary" };
1962
2036
  return { repo, path: rel, size: at.size, text: buf.toString("utf-8") };
1963
2037
  } catch (err) {
@@ -1991,12 +2065,13 @@ function splitLine(raw) {
1991
2065
  var VIEWER_EXTENSIONS = /* @__PURE__ */ new Set(["html", "htm", "pdf", "png", "jpg", "jpeg", "gif", "webp", "svg"]);
1992
2066
  var MAX_TERMINAL_LINE = 1e7;
1993
2067
  var realIo2 = {
1994
- listFiles: (root) => listRepoFiles(root)
2068
+ listFiles: (root) => listRepoFiles(root),
2069
+ networkRoots: () => networkMountRoots()
1995
2070
  };
1996
2071
  function onDisk(candidate) {
1997
2072
  try {
1998
- const real = fs4.realpathSync.native(candidate);
1999
- const st = fs4.statSync(real);
2073
+ const real = fs5.realpathSync.native(candidate);
2074
+ const st = fs5.statSync(real);
2000
2075
  if (st.isDirectory()) return { real, kind: "dir" };
2001
2076
  if (st.isFile()) return { real, kind: "file" };
2002
2077
  return null;
@@ -2006,7 +2081,7 @@ function onDisk(candidate) {
2006
2081
  }
2007
2082
  function found(raw, at, line) {
2008
2083
  if (at.kind === "dir") return { raw, path: at.real, kind: "dir", opens: "reveal" };
2009
- const ext = path3.extname(at.real).slice(1).toLowerCase();
2084
+ const ext = path4.extname(at.real).slice(1).toLowerCase();
2010
2085
  const opens = VIEWER_EXTENSIONS.has(ext) ? "app" : "editor";
2011
2086
  return line === void 0 ? { raw, path: at.real, kind: "file", opens } : { raw, path: at.real, kind: "file", opens, line };
2012
2087
  }
@@ -2027,7 +2102,7 @@ async function listedMatches(session, rel, io) {
2027
2102
  if (!want || want.split("/").includes("..")) return [];
2028
2103
  const lists = await Promise.all(
2029
2104
  codeRoots(session).map(async ({ root }) => {
2030
- if (!fs4.existsSync(root)) return { root, files: [] };
2105
+ if (!fs5.existsSync(root)) return { root, files: [] };
2031
2106
  try {
2032
2107
  return { root, files: await io.listFiles(root) };
2033
2108
  } catch {
@@ -2039,7 +2114,7 @@ async function listedMatches(session, rel, io) {
2039
2114
  for (const { root, files } of lists) {
2040
2115
  for (const f of files) {
2041
2116
  if (f !== want && !f.endsWith("/" + want)) continue;
2042
- const at = onDisk(path3.join(root, f));
2117
+ const at = onDisk(path4.join(root, f));
2043
2118
  if (at) hits.set(at.real, at);
2044
2119
  }
2045
2120
  }
@@ -2051,17 +2126,19 @@ async function resolveTerminalPath(session, raw, io = realIo2) {
2051
2126
  const p = split.path;
2052
2127
  const line = split.line !== void 0 && split.line <= MAX_TERMINAL_LINE ? split.line : void 0;
2053
2128
  if (!p || refusedPath(raw, p)) return missing(raw);
2129
+ const local = (abs) => !onNetworkVolume(abs, io.networkRoots?.() ?? []);
2054
2130
  if (/^~(?=$|[\\/])/.test(p)) {
2055
- const at = onDisk(path3.join(os.homedir(), p.slice(1)));
2131
+ const abs = path4.join(os.homedir(), p.slice(1));
2132
+ const at = local(abs) ? onDisk(abs) : null;
2056
2133
  return at ? found(raw, at, line) : missing(raw);
2057
2134
  }
2058
- if (path3.isAbsolute(p)) {
2059
- const at = onDisk(p);
2135
+ if (path4.isAbsolute(p)) {
2136
+ const at = local(p) ? onDisk(p) : null;
2060
2137
  return at ? found(raw, at, line) : missing(raw);
2061
2138
  }
2062
2139
  if (/^[A-Za-z]:[\\/]/.test(p)) return missing(raw);
2063
2140
  for (const root of relativeRoots(session)) {
2064
- const at = onDisk(path3.resolve(root, p));
2141
+ const at = onDisk(path4.resolve(root, p));
2065
2142
  if (at) return found(raw, at, line);
2066
2143
  }
2067
2144
  const matches = await listedMatches(session, p, io);
@@ -2074,17 +2151,17 @@ async function resolveTerminalPath(session, raw, io = realIo2) {
2074
2151
  }
2075
2152
  function editorFolder(session, real) {
2076
2153
  const first = session.paths[0];
2077
- const folder = first && session.isGroup ? path3.dirname(first) : first;
2154
+ const folder = first && session.isGroup ? path4.dirname(first) : first;
2078
2155
  if (folder) {
2079
2156
  let realFolder = folder;
2080
2157
  try {
2081
- realFolder = fs4.realpathSync.native(folder);
2158
+ realFolder = fs5.realpathSync.native(folder);
2082
2159
  } catch {
2083
2160
  }
2084
- const rel = path3.relative(realFolder, real);
2085
- if (rel && rel !== ".." && !rel.startsWith(".." + path3.sep) && !path3.isAbsolute(rel)) return folder;
2161
+ const rel = path4.relative(realFolder, real);
2162
+ if (rel && rel !== ".." && !rel.startsWith(".." + path4.sep) && !path4.isAbsolute(rel)) return folder;
2086
2163
  }
2087
- return path3.dirname(real);
2164
+ return path4.dirname(real);
2088
2165
  }
2089
2166
  async function openTerminalPath(session, raw, how, deps = {}) {
2090
2167
  const r = await resolveTerminalPath(session, raw, deps.io ?? realIo2);
@@ -2124,13 +2201,13 @@ function imageType(file) {
2124
2201
  };
2125
2202
  return types[ext] ?? null;
2126
2203
  }
2127
- var norm = (p) => path4.resolve(p).replace(/\\/g, "/").replace(/\/+$/, "");
2204
+ var norm = (p) => path5.resolve(p).replace(/\\/g, "/").replace(/\/+$/, "");
2128
2205
  var sameStart = (a, b) => process.platform === "win32" ? a.toLowerCase() === b.toLowerCase() : a === b;
2129
2206
  function locateInSession(s, file) {
2130
2207
  const target = norm(file);
2131
- const roots = s.paths.map((p) => ({ repo: path4.basename(norm(p)), root: norm(p) }));
2208
+ const roots = s.paths.map((p) => ({ repo: path5.basename(norm(p)), root: norm(p) }));
2132
2209
  if (s.isGroup && roots.length) {
2133
- const parents = [...new Set(roots.map((r) => path4.posix.dirname(r.root)))];
2210
+ const parents = [...new Set(roots.map((r) => path5.posix.dirname(r.root)))];
2134
2211
  if (parents.length === 1) roots.push({ repo: "", root: parents[0] });
2135
2212
  }
2136
2213
  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];
@@ -2150,10 +2227,11 @@ function insideFolders(real, folders, platform = process.platform) {
2150
2227
  return root.length > 0 && target.length > root.length + 1 && target.startsWith(`${root}/`);
2151
2228
  });
2152
2229
  }
2153
- var realTempIo = { realpath: (p) => fs5.promises.realpath(p), stat: (p) => fs5.promises.stat(p) };
2230
+ var realTempIo = { realpath: (p) => fs6.promises.realpath(p), stat: (p) => fs6.promises.stat(p) };
2154
2231
  async function findTempFile(file, folders, io = realTempIo, platform = process.platform) {
2155
- if (refusedPath(file, file, platform) || !(platform === "win32" ? path4.win32 : path4.posix).isAbsolute(file))
2232
+ if (refusedPath(file, file, platform) || !(platform === "win32" ? path5.win32 : path5.posix).isAbsolute(file))
2156
2233
  return { error: "not a local absolute path" };
2234
+ if (onNetworkVolume(file, networkMountRoots(platform), platform)) return { error: "not a local absolute path" };
2157
2235
  let real;
2158
2236
  try {
2159
2237
  real = await io.realpath(file);
@@ -2172,7 +2250,7 @@ async function findTempFile(file, folders, io = realTempIo, platform = process.p
2172
2250
  async function readShownFile(real, limit) {
2173
2251
  let fh;
2174
2252
  try {
2175
- fh = await fs5.promises.open(real, fs5.constants.O_RDONLY | (fs5.constants.O_NOFOLLOW ?? 0));
2253
+ fh = await fs6.promises.open(real, fs6.constants.O_RDONLY | (fs6.constants.O_NOFOLLOW ?? 0));
2176
2254
  } catch {
2177
2255
  return { error: "not there" };
2178
2256
  }
@@ -2196,8 +2274,8 @@ async function readShownFile(real, limit) {
2196
2274
  }
2197
2275
  function shownAbsolute(s, f) {
2198
2276
  if (f.temp) return f.temp;
2199
- 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);
2200
- return root ? path4.join(root, ...f.path.split("/")) : null;
2277
+ const root = f.repo === "" ? s.isGroup && s.paths[0] ? path5.dirname(s.paths[0]) : null : s.paths.find((p) => path5.basename(norm(p)) === f.repo);
2278
+ return root ? path5.join(root, ...f.path.split("/")) : null;
2201
2279
  }
2202
2280
  var PANE_TABS = ["file", "diff", "code", "review"];
2203
2281
  function createShownFiles(deps) {
@@ -2291,7 +2369,7 @@ function mountSessionShowRoutes(app, deps) {
2291
2369
  const temp = file ? await findTempFile(file, tempFolders(session)) : { error: "outside" };
2292
2370
  if ("error" in temp)
2293
2371
  return c.json({ error: "That file is not in one of this session\u2019s folders, nor in its agent\u2019s scratch folder." }, 404);
2294
- shown.show(id, { repo: "", path: path5.basename(temp.real), temp: temp.real });
2372
+ shown.show(id, { repo: "", path: path6.basename(temp.real), temp: temp.real });
2295
2373
  return c.json(wire(id));
2296
2374
  }
2297
2375
  const found2 = await locate(session, at.repo, at.path);
@@ -2373,17 +2451,17 @@ function mountSessionShowRoutes(app, deps) {
2373
2451
  }
2374
2452
 
2375
2453
  // src/core/review/local-review-tree.ts
2376
- import path6 from "path";
2377
- var norm2 = (p) => path6.resolve(p).replace(/\\/g, "/").replace(/\/+$/, "");
2454
+ import path7 from "path";
2455
+ var norm2 = (p) => path7.resolve(p).replace(/\\/g, "/").replace(/\/+$/, "");
2378
2456
  function sessionTree(paths, names) {
2379
2457
  const byName = /* @__PURE__ */ new Map();
2380
- for (const p of paths) byName.set(path6.basename(norm2(p)), [...byName.get(path6.basename(norm2(p))) ?? [], norm2(p)]);
2458
+ for (const p of paths) byName.set(path7.basename(norm2(p)), [...byName.get(path7.basename(norm2(p))) ?? [], norm2(p)]);
2381
2459
  const dirs = names.map((n) => byName.get(n));
2382
2460
  if (names.length === 0 || dirs.some((d) => !d || d.length !== 1)) return null;
2383
2461
  const found2 = dirs.map((d) => d[0]);
2384
2462
  if (names.length === 1) return { cwd: found2[0], repos: [{ dir: found2[0], sub: null }] };
2385
- const parent = path6.posix.dirname(found2[0]);
2386
- if (found2.some((d) => path6.posix.dirname(d) !== parent)) return null;
2463
+ const parent = path7.posix.dirname(found2[0]);
2464
+ if (found2.some((d) => path7.posix.dirname(d) !== parent)) return null;
2387
2465
  return { cwd: parent, repos: found2.map((dir, i) => ({ dir, sub: names[i] })) };
2388
2466
  }
2389
2467
  var LOCAL_TREE_TIMEOUT_MS = 42e4;
@@ -2409,77 +2487,6 @@ function reviewFocus(config, aliases) {
2409
2487
  return attentionItems(r?.focus, ...[...new Set(aliases)].map((a) => r?.focusFor?.[a]));
2410
2488
  }
2411
2489
 
2412
- // src/core/platform/process-usage.ts
2413
- import { execFile } from "child_process";
2414
- import path7 from "path";
2415
- var num = (v) => typeof v === "number" && Number.isFinite(v) && v >= 0 ? v : null;
2416
- function parseCimUsage(json2) {
2417
- let data;
2418
- try {
2419
- data = JSON.parse(json2);
2420
- } catch {
2421
- return [];
2422
- }
2423
- const rows = Array.isArray(data) ? data : data ? [data] : [];
2424
- const out = [];
2425
- for (const r of rows) {
2426
- if (!r || typeof r !== "object") continue;
2427
- const o = r;
2428
- if (typeof o.ProcessId !== "number") continue;
2429
- const started = num(o.Started);
2430
- out.push({
2431
- pid: o.ProcessId,
2432
- ppid: typeof o.ParentProcessId === "number" ? o.ParentProcessId : 0,
2433
- name: typeof o.Name === "string" ? o.Name : "",
2434
- exe: typeof o.ExecutablePath === "string" ? o.ExecutablePath : null,
2435
- command: typeof o.CommandLine === "string" ? o.CommandLine : "",
2436
- memBytes: num(o.PrivatePageCount),
2437
- // 0: a system process with no creation date.
2438
- startedAt: started ? started : null
2439
- });
2440
- }
2441
- return out;
2442
- }
2443
- function elapsedMs(etime) {
2444
- const m = /^(?:(\d+)-)?(?:(\d+):)?(\d+):(\d+)$/.exec(etime.trim());
2445
- if (!m) return null;
2446
- const [days, hours, mins, secs] = [m[1], m[2], m[3], m[4]].map((x) => Number(x ?? 0));
2447
- return (((days * 24 + hours) * 60 + mins) * 60 + secs) * 1e3;
2448
- }
2449
- function parsePsUsage(stdout, now) {
2450
- const out = [];
2451
- for (const line of stdout.split(/\r?\n/)) {
2452
- const m = /^\s*(\d+)\s+(\d+)\s+(\d+)\s+(\S+)\s+(.*)$/.exec(line);
2453
- if (!m) continue;
2454
- const command = m[5].trim();
2455
- const first = commandWords(command)[0] ?? "";
2456
- const elapsed = elapsedMs(m[4]);
2457
- out.push({
2458
- pid: Number(m[1]),
2459
- ppid: Number(m[2]),
2460
- name: path7.posix.basename(first),
2461
- exe: first.startsWith("/") ? first : null,
2462
- command,
2463
- memBytes: Number(m[3]) * 1024,
2464
- startedAt: elapsed === null ? null : now - elapsed
2465
- });
2466
- }
2467
- return out;
2468
- }
2469
- var run = (cmd, args) => new Promise(
2470
- (resolve) => execFile(
2471
- programPath(cmd),
2472
- args,
2473
- { encoding: "utf-8", windowsHide: true, timeout: 2e4, maxBuffer: 64 * 1024 * 1024 },
2474
- (_err, stdout) => resolve(stdout ?? "")
2475
- )
2476
- );
2477
- var CIM_USAGE = "[Console]::OutputEncoding = [Text.Encoding]::UTF8; Get-CimInstance Win32_Process | Select-Object ProcessId,ParentProcessId,Name,ExecutablePath,CommandLine,PrivatePageCount,@{n='Started';e={ if ($_.CreationDate) { ([DateTimeOffset]$_.CreationDate).ToUnixTimeMilliseconds() } else { 0 } }} | ConvertTo-Json -Compress";
2478
- async function listProcessUsage(now = Date.now()) {
2479
- if (process.platform === "win32") return parseCimUsage(await run("powershell", ["-NoProfile", "-NonInteractive", "-Command", CIM_USAGE]));
2480
- return parsePsUsage(await run("ps", ["-A", "-o", "pid=,ppid=,rss=,etime=,args="]), now);
2481
- }
2482
-
2483
2490
  // src/core/sessions/leftover-sweep.ts
2484
2491
  async function sweepLeftovers(deps) {
2485
2492
  const procs = await deps.list();
@@ -2946,10 +2953,10 @@ function mountDiffPageRoutes(app, opts) {
2946
2953
  // src/server/routes/setup-routes.ts
2947
2954
  var TOOLS_TTL_MS = 10 * 6e4;
2948
2955
  function mountSetupRoutes(app, opts) {
2949
- let cached2 = null;
2956
+ let cached3 = null;
2950
2957
  const tools = (fresh) => {
2951
- if (fresh || !cached2 || Date.now() - cached2.at > TOOLS_TTL_MS) cached2 = { at: Date.now(), tools: (opts.tools ?? checkTools)() };
2952
- return cached2.tools;
2958
+ if (fresh || !cached3 || Date.now() - cached3.at > TOOLS_TTL_MS) cached3 = { at: Date.now(), tools: (opts.tools ?? checkTools)() };
2959
+ return cached3.tools;
2953
2960
  };
2954
2961
  app.get("/api/setup", async (c) => c.json(await setupState(() => tools(c.req.query("fresh") === "1"))));
2955
2962
  app.post("/api/setup", async (c) => {
@@ -2967,7 +2974,7 @@ function mountSetupRoutes(app, opts) {
2967
2974
  }
2968
2975
 
2969
2976
  // src/core/updates/update-source.ts
2970
- import fs6 from "fs";
2977
+ import fs7 from "fs";
2971
2978
  import path8 from "path";
2972
2979
 
2973
2980
  // src/core/updates/updates.ts
@@ -3055,7 +3062,7 @@ var RELEASES_URL = `https://api.github.com/repos/${RELEASES_REPO}/releases?per_p
3055
3062
  var SEEN_KEY = "ui:seen-version";
3056
3063
  var desktopUpdatePath = () => path8.join(getConfigDir(), "desktop-update.json");
3057
3064
  var desktopRequestPath = () => path8.join(getConfigDir(), "desktop-request.json");
3058
- async function fetchReleases(get = (url) => fetch(url, { headers: { "User-Agent": "work", Accept: "application/vnd.github+json" }, signal: AbortSignal.timeout(15e3) }), run2 = defaultRunner) {
3065
+ async function fetchReleases(get = (url) => fetch(url, { headers: { "User-Agent": "work", Accept: "application/vnd.github+json" }, signal: AbortSignal.timeout(15e3) }), run = defaultRunner) {
3059
3066
  const why = await get(RELEASES_URL).then(
3060
3067
  async (res) => res.ok ? parseReleases(await res.json()) : res.status === 403 ? "GitHub's limit for this address is spent" : `GitHub answered ${res.status}`,
3061
3068
  (err) => err
@@ -3064,7 +3071,7 @@ async function fetchReleases(get = (url) => fetch(url, { headers: { "User-Agent"
3064
3071
  const offline = networkFailure(why);
3065
3072
  if (offline) throw new Error(offline);
3066
3073
  } else if (typeof why !== "string") return why;
3067
- const r = await run2("gh", ["api", `repos/${RELEASES_REPO}/releases?per_page=30`], process.cwd());
3074
+ const r = await run("gh", ["api", `repos/${RELEASES_REPO}/releases?per_page=30`], process.cwd());
3068
3075
  if (r.code === 0) {
3069
3076
  try {
3070
3077
  return parseReleases(JSON.parse(r.stdout));
@@ -3094,7 +3101,7 @@ function networkFailure(err) {
3094
3101
  function readDesktopUpdate(file = desktopUpdatePath()) {
3095
3102
  let text;
3096
3103
  try {
3097
- text = fs6.readFileSync(file, "utf-8");
3104
+ text = fs7.readFileSync(file, "utf-8");
3098
3105
  } catch {
3099
3106
  return null;
3100
3107
  }
@@ -3116,7 +3123,7 @@ function markSeenVersion(version) {
3116
3123
  }
3117
3124
  function installKind() {
3118
3125
  const root = packageRoot();
3119
- return installKindOf(root, getConfigDir(), !!root && fs6.existsSync(path8.join(root, ".git")));
3126
+ return installKindOf(root, getConfigDir(), !!root && fs7.existsSync(path8.join(root, ".git")));
3120
3127
  }
3121
3128
  var defaultDeps = () => ({
3122
3129
  fetchReleases: () => fetchReleases(),
@@ -3167,12 +3174,12 @@ function createUpdates(deps = defaultDeps()) {
3167
3174
  checkedAt: () => checkedAt
3168
3175
  };
3169
3176
  }
3170
- async function lookForUpdates(updates, run2, changed) {
3177
+ async function lookForUpdates(updates, run, changed) {
3171
3178
  const before = updates.wire().latest;
3172
3179
  await updates.refresh();
3173
3180
  const w = updates.wire();
3174
- if (w.checkError) run2.fail(w.checkError);
3175
- else run2.done(w.available ? `work ${w.available.version} is out (this is ${w.running})` : `up to date (${w.running})`);
3181
+ if (w.checkError) run.fail(w.checkError);
3182
+ else run.done(w.available ? `work ${w.available.version} is out (this is ${w.running})` : `up to date (${w.running})`);
3176
3183
  if (w.latest !== before) changed();
3177
3184
  }
3178
3185
 
@@ -3209,7 +3216,7 @@ function mountAppUpdateRoutes(app, opts) {
3209
3216
  }
3210
3217
 
3211
3218
  // src/server/routes/usage-routes.ts
3212
- import fs7 from "fs";
3219
+ import fs8 from "fs";
3213
3220
  var FRESH_MS = 5e3;
3214
3221
  function createUsageCache(build, ttlMs = FRESH_MS, now = Date.now) {
3215
3222
  let last = null;
@@ -3271,7 +3278,7 @@ function watchUsage(opts) {
3271
3278
  };
3272
3279
  let watcher = null;
3273
3280
  try {
3274
- fs7.mkdirSync(dir, { recursive: true });
3281
+ fs8.mkdirSync(dir, { recursive: true });
3275
3282
  watcher = createFsWatcher({ roots: [dir], onChange });
3276
3283
  } catch (e) {
3277
3284
  report("warn", `[usage] not watching ${dir}: ${e instanceof Error ? e.message : String(e)}`);
@@ -3322,7 +3329,7 @@ function mountRepoRoutes(app, opts) {
3322
3329
  const regenerate = (name) => {
3323
3330
  const bin = opts.workBin?.();
3324
3331
  if (!bin) return;
3325
- const run2 = opts.activity?.start("groups", `Writing ${name}'s combined instructions`);
3332
+ const run = opts.activity?.start("groups", `Writing ${name}'s combined instructions`);
3326
3333
  const child = spawn_default(
3327
3334
  process.execPath,
3328
3335
  [...process.execArgv.filter((f) => !/^--inspect/.test(f)), bin, "config", "group", "regen", name],
@@ -3332,8 +3339,8 @@ function mountRepoRoutes(app, opts) {
3332
3339
  env: { ...process.env, NO_COLOR: "1" }
3333
3340
  }
3334
3341
  );
3335
- child.on("error", (e) => run2?.fail(e.message));
3336
- child.on("close", (code) => code === 0 ? run2?.done("written") : run2?.fail(`work config group regen exited ${code}`));
3342
+ child.on("error", (e) => run?.fail(e.message));
3343
+ child.on("close", (code) => code === 0 ? run?.done("written") : run?.fail(`work config group regen exited ${code}`));
3337
3344
  };
3338
3345
  app.get("/api/repos", (c) => {
3339
3346
  try {
@@ -4023,7 +4030,7 @@ function mountSettingsRoutes(app, opts) {
4023
4030
  }
4024
4031
 
4025
4032
  // src/core/settings/settings-admin.ts
4026
- import fs8 from "fs";
4033
+ import fs9 from "fs";
4027
4034
  import path9 from "path";
4028
4035
 
4029
4036
  // src/core/settings/terminal-style.ts
@@ -4190,7 +4197,7 @@ var TERMINAL_THEMES = [
4190
4197
  }
4191
4198
  ];
4192
4199
  var DEFAULT_TERMINAL_THEME = "default";
4193
- var DEFAULT_TERMINAL_FONT_FAMILY = '"Cascadia Code", "Cascadia Mono", SFMono-Regular, Consolas, "Liberation Mono", monospace';
4200
+ var DEFAULT_TERMINAL_FONT_FAMILY = '"Cascadia Code", "Cascadia Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace';
4194
4201
  var DEFAULT_TERMINAL_FONT_SIZE = 13;
4195
4202
  var TERMINAL_FONT_SIZE_RANGE = { min: 8, max: 32 };
4196
4203
  var DEFAULT_TERMINAL_LINE_HEIGHT = 1;
@@ -4248,7 +4255,7 @@ var DEFAULT_TERMINAL_STYLE = resolveTerminalStyle({});
4248
4255
  // src/core/settings/settings-admin.ts
4249
4256
  function rawConfig(file = getConfigPath()) {
4250
4257
  try {
4251
- const raw = JSON.parse(fs8.readFileSync(file, "utf-8"));
4258
+ const raw = JSON.parse(fs9.readFileSync(file, "utf-8"));
4252
4259
  return raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
4253
4260
  } catch {
4254
4261
  return {};
@@ -4287,7 +4294,7 @@ function checkedFolders(at, value) {
4287
4294
  if (!path9.isAbsolute(p))
4288
4295
  throw new SettingsError(`Folders scanned for repos: ${v} isn't a full path (start it from the drive, / or ~)`);
4289
4296
  const full = path9.resolve(p);
4290
- if (!fs8.statSync(full, { throwIfNoEntry: false })?.isDirectory())
4297
+ if (!fs9.statSync(full, { throwIfNoEntry: false })?.isDirectory())
4291
4298
  throw new SettingsError(`Folders scanned for repos: ${full} isn't a folder`);
4292
4299
  return full;
4293
4300
  });
@@ -4383,8 +4390,8 @@ function order(k) {
4383
4390
  var DAYS = 30;
4384
4391
  var MAX_TRANSCRIPT_BYTES = 8 << 20;
4385
4392
  var MAX_COMMITS = 100;
4386
- async function commitsOf(repo, since, run2) {
4387
- const git3 = (...args) => run2("git", ["-C", repo, ...args], repo);
4393
+ async function commitsOf(repo, since, run) {
4394
+ const git3 = (...args) => run("git", ["-C", repo, ...args], repo);
4388
4395
  const base = (await git3("merge-base", "HEAD", "origin/HEAD")).stdout.trim();
4389
4396
  const range = base ? [`${base}..HEAD`] : [`--since=${since}`, "HEAD"];
4390
4397
  const log = await git3("log", `--max-count=${MAX_COMMITS}`, "--format=%H%x09%aI%x09%s", ...range);
@@ -4395,7 +4402,7 @@ async function commitsOf(repo, since, run2) {
4395
4402
  });
4396
4403
  }
4397
4404
  async function sessionTimeline(s, deps = {}) {
4398
- const run2 = deps.run ?? defaultRunner;
4405
+ const run = deps.run ?? defaultRunner;
4399
4406
  const since = Math.max(Date.parse(s.createdAt) || 0, (deps.now ?? Date.now()) - DAYS * 864e5);
4400
4407
  const transcripts = [];
4401
4408
  const conv = agentOf(s).conversation;
@@ -4406,7 +4413,7 @@ async function sessionTimeline(s, deps = {}) {
4406
4413
  } catch {
4407
4414
  }
4408
4415
  }
4409
- const commits = s.archivedAt ? [] : (await Promise.all(s.paths.map((p) => commitsOf(p, s.createdAt, run2).catch(() => [])))).flat();
4416
+ const commits = s.archivedAt ? [] : (await Promise.all(s.paths.map((p) => commitsOf(p, s.createdAt, run).catch(() => [])))).flat();
4410
4417
  const prs = (deps.ci?.repos ?? []).filter((r) => r.pr).map((r) => ({
4411
4418
  repo: r.name,
4412
4419
  number: r.pr.number,
@@ -4527,7 +4534,7 @@ function placeJira(issue, detail, cfg) {
4527
4534
  }
4528
4535
 
4529
4536
  // src/server/routes/jira-watch-routes.ts
4530
- import fs9 from "fs";
4537
+ import fs10 from "fs";
4531
4538
  import path11 from "path";
4532
4539
 
4533
4540
  // src/core/jira/jira-watch.ts
@@ -4731,16 +4738,16 @@ async function sweepJira(deps) {
4731
4738
  var EVERY_MS = 5 * 6e4;
4732
4739
  function aboutRepo(dir) {
4733
4740
  try {
4734
- const readme = ["README.md", "readme.md", "README"].map((n) => path11.join(dir, n)).find((f) => fs9.existsSync(f));
4741
+ const readme = ["README.md", "readme.md", "README"].map((n) => path11.join(dir, n)).find((f) => fs10.existsSync(f));
4735
4742
  if (readme) {
4736
- const line = fs9.readFileSync(readme, "utf8").split(/\r?\n/).map(
4743
+ const line = fs10.readFileSync(readme, "utf8").split(/\r?\n/).map(
4737
4744
  (l) => l.replace(/^[#>*\-\s]+/, "").replace(/[`*_[\]]/g, "").trim()
4738
4745
  ).find((l) => l.length > 20 && !/^(!|<|http)/.test(l));
4739
4746
  if (line) return line.slice(0, 160);
4740
4747
  }
4741
4748
  const pkg = path11.join(dir, "package.json");
4742
- if (fs9.existsSync(pkg)) {
4743
- const d = JSON.parse(fs9.readFileSync(pkg, "utf8")).description;
4749
+ if (fs10.existsSync(pkg)) {
4750
+ const d = JSON.parse(fs10.readFileSync(pkg, "utf8")).description;
4744
4751
  if (typeof d === "string" && d.trim()) return d.trim().slice(0, 160);
4745
4752
  }
4746
4753
  } catch {
@@ -4784,7 +4791,7 @@ function mountJiraWatchRoutes(app, opts) {
4784
4791
  running ??= (async () => {
4785
4792
  try {
4786
4793
  if (!readSettings2().enabled) return;
4787
- const run2 = opts.activity?.start("jira-watch", "Looking for newly assigned Jira issues");
4794
+ const run = opts.activity?.start("jira-watch", "Looking for newly assigned Jira issues");
4788
4795
  const deps = {
4789
4796
  // Throws when acli can't list them: the sweep fails (said in Activity) rather than reading "none".
4790
4797
  fetchIssues: fetchMyIssuesOrThrow,
@@ -4794,17 +4801,17 @@ function mountJiraWatchRoutes(app, opts) {
4794
4801
  place: (issue, detail) => placeJira(issue, detail, loadConfig()),
4795
4802
  ask: (prompt) => runInternal(prompt, 9e4),
4796
4803
  start: (target, branch, issue) => start(target, branch, issue, true),
4797
- note: (text, level, sessionId) => run2?.note(text, { level, ...sessionId ? { sessionId } : {} }),
4804
+ note: (text, level, sessionId) => run?.note(text, { level, ...sessionId ? { sessionId } : {} }),
4798
4805
  maxPerDay: loadConfig()?.jiraWatch?.maxPerDay
4799
4806
  };
4800
4807
  try {
4801
4808
  const r = await sweepJira(deps);
4802
- run2?.done(
4809
+ run?.done(
4803
4810
  r.started || r.suggested || r.waiting ? `${r.started} started \xB7 ${r.suggested} to start yourself${r.waiting ? ` \xB7 ${r.waiting} waiting` : ""}` : "no new issues"
4804
4811
  );
4805
4812
  if (r.started || r.suggested) changed();
4806
4813
  } catch (err) {
4807
- run2?.fail(err.message);
4814
+ run?.fail(err.message);
4808
4815
  }
4809
4816
  lastRunAt = (/* @__PURE__ */ new Date()).toISOString();
4810
4817
  } finally {
@@ -5201,19 +5208,19 @@ function mountPanesRoutes(app, opts) {
5201
5208
  const prsFetch = createSharedFetch(async () => {
5202
5209
  const config = loadConfig();
5203
5210
  if (!config) return { prs: [] };
5204
- const run2 = opts.activity?.start("pr-list", "Listing open pull requests");
5211
+ const run = opts.activity?.start("pr-list", "Listing open pull requests");
5205
5212
  try {
5206
5213
  const { map, incomplete } = await fetchAllPullRequests(config.repos);
5207
5214
  const prs = Array.from(map.values()).flat();
5208
5215
  if (incomplete.length)
5209
- run2?.note(
5216
+ run?.note(
5210
5217
  `couldn't list every PR of ${incomplete.join(", ")} (gh failed, or 100+ open): archiving isn't suggested for sessions there`,
5211
5218
  { level: "warn" }
5212
5219
  );
5213
- run2?.done(`${prs.length} open PR${prs.length === 1 ? "" : "s"} in ${Object.keys(config.repos).length} repos`);
5220
+ run?.done(`${prs.length} open PR${prs.length === 1 ? "" : "s"} in ${Object.keys(config.repos).length} repos`);
5214
5221
  return incomplete.length ? { prs, incomplete } : { prs };
5215
5222
  } catch (err) {
5216
- run2?.fail(err.message);
5223
+ run?.fail(err.message);
5217
5224
  throw err;
5218
5225
  }
5219
5226
  }, PRS_TTL_MS);
@@ -5233,19 +5240,19 @@ function mountPanesRoutes(app, opts) {
5233
5240
  let issuesInFlight = null;
5234
5241
  app.get("/api/issues", async (c) => {
5235
5242
  issuesInFlight ??= (async () => {
5236
- const run2 = opts.activity?.start("jira", "Fetching your issues");
5243
+ const run = opts.activity?.start("jira", "Fetching your issues");
5237
5244
  try {
5238
5245
  const r = await listIssues(issueSources(), loadConfig());
5239
5246
  const down = r.sources.filter((s) => !s.available);
5240
5247
  if (down.length && down.length === r.sources.length)
5241
- run2?.fail(`${down.map((s) => s.name).join(", ")}: not available or not signed in`);
5248
+ run?.fail(`${down.map((s) => s.name).join(", ")}: not available or not signed in`);
5242
5249
  else
5243
- run2?.done(
5250
+ run?.done(
5244
5251
  `${r.issues.length} issue${r.issues.length === 1 ? "" : "s"}${down.length ? ` \xB7 ${down.map((s) => s.name).join(", ")} not available` : ""}`
5245
5252
  );
5246
5253
  return r;
5247
5254
  } catch (err) {
5248
- run2?.fail(err.message);
5255
+ run?.fail(err.message);
5249
5256
  throw err;
5250
5257
  } finally {
5251
5258
  issuesInFlight = null;
@@ -5261,7 +5268,7 @@ function mountPanesRoutes(app, opts) {
5261
5268
  app.get("/api/jira", async (c) => {
5262
5269
  if (!jiraInFlight) {
5263
5270
  jiraInFlight = (async () => {
5264
- const run2 = opts.activity?.start("jira", "Fetching your Jira issues");
5271
+ const run = opts.activity?.start("jira", "Fetching your Jira issues");
5265
5272
  try {
5266
5273
  const got = await fetchJiraPane();
5267
5274
  const cfg = loadConfig();
@@ -5272,11 +5279,11 @@ function mountPanesRoutes(app, opts) {
5272
5279
  return placed?.target ? { ...i, startsIn: placed.target } : i;
5273
5280
  })
5274
5281
  };
5275
- if (!r.available) run2?.fail("Jira CLI (acli) not available or not logged in");
5276
- else run2?.done(`${r.issues.length} issue${r.issues.length === 1 ? "" : "s"}`);
5282
+ if (!r.available) run?.fail("Jira CLI (acli) not available or not logged in");
5283
+ else run?.done(`${r.issues.length} issue${r.issues.length === 1 ? "" : "s"}`);
5277
5284
  return r;
5278
5285
  } catch (err) {
5279
- run2?.fail(err.message);
5286
+ run?.fail(err.message);
5280
5287
  throw err;
5281
5288
  } finally {
5282
5289
  jiraInFlight = null;
@@ -5337,7 +5344,7 @@ function mountPanesRoutes(app, opts) {
5337
5344
  }
5338
5345
 
5339
5346
  // src/server/routes/worktree-routes.ts
5340
- import fs10 from "fs";
5347
+ import fs11 from "fs";
5341
5348
  import path12 from "path";
5342
5349
  import { spawn } from "child_process";
5343
5350
 
@@ -5361,12 +5368,12 @@ import { zValidator as zValidator6 } from "@hono/zod-validator";
5361
5368
  import { z as z5 } from "zod";
5362
5369
  var queues = /* @__PURE__ */ new Map();
5363
5370
  function oneAtATime2(key, fn) {
5364
- const run2 = (queues.get(key) ?? Promise.resolve()).catch(() => void 0).then(fn);
5365
- queues.set(key, run2);
5366
- void run2.finally(() => {
5367
- if (queues.get(key) === run2) queues.delete(key);
5371
+ const run = (queues.get(key) ?? Promise.resolve()).catch(() => void 0).then(fn);
5372
+ queues.set(key, run);
5373
+ void run.finally(() => {
5374
+ if (queues.get(key) === run) queues.delete(key);
5368
5375
  }).catch(() => void 0);
5369
- return run2;
5376
+ return run;
5370
5377
  }
5371
5378
  function mountWorktreeRoutes(app, opts) {
5372
5379
  const createSchema = z5.object({
@@ -5446,7 +5453,11 @@ function mountWorktreeRoutes(app, opts) {
5446
5453
  try {
5447
5454
  started = await startSession(
5448
5455
  id,
5449
- parent ? childBrief(parent.title?.trim() || `${parent.target} \xB7 ${parent.branch}`, prompt) : prompt.trim()
5456
+ parent ? childBrief(
5457
+ parent.title?.trim() || `${parent.target} \xB7 ${parent.branch}`,
5458
+ prompt,
5459
+ agentOf(parent).tempFolders?.(parent) ?? []
5460
+ ) : prompt.trim()
5450
5461
  );
5451
5462
  } catch (err) {
5452
5463
  startError = err.message;
@@ -5498,7 +5509,7 @@ function mountWorktreeRoutes(app, opts) {
5498
5509
  if (waiting.length) return { body: { error: `Not deleted: ${waiting.join("; ")}.`, blocked: waiting }, status: 409 };
5499
5510
  }
5500
5511
  try {
5501
- const onDisk2 = session.paths.some((p) => fs10.existsSync(p));
5512
+ const onDisk2 = session.paths.some((p) => fs11.existsSync(p));
5502
5513
  if (!sessionOnly && onDisk2 && session.paths.some((p) => wouldRefuseRemoval(p, force ?? false))) {
5503
5514
  return { body: { error: REFUSED }, status: 409 };
5504
5515
  }
@@ -6092,7 +6103,7 @@ function mountScopeRoutes(app, opts) {
6092
6103
  // src/core/pty/terminal-perf.ts
6093
6104
  var MAX_KEYS = 200;
6094
6105
  var MAX_STALLS = 100;
6095
- var num2 = (x) => typeof x === "number" && Number.isFinite(x) && x >= 0 && x < 1e13;
6106
+ var num = (x) => typeof x === "number" && Number.isFinite(x) && x >= 0 && x < 1e13;
6096
6107
  function cleanPerfReport(x) {
6097
6108
  if (!x || typeof x !== "object") return null;
6098
6109
  const r = x;
@@ -6103,13 +6114,13 @@ function cleanPerfReport(x) {
6103
6114
  const keys = [];
6104
6115
  for (const k of r.keys.slice(0, MAX_KEYS)) {
6105
6116
  const o = k;
6106
- if (!o || !num2(o.arrived) || !(o.shown === null || num2(o.shown))) return null;
6117
+ if (!o || !num(o.arrived) || !(o.shown === null || num(o.shown))) return null;
6107
6118
  keys.push({ arrived: Math.round(o.arrived), shown: o.shown === null ? null : Math.round(o.shown) });
6108
6119
  }
6109
6120
  const stalls = [];
6110
6121
  for (const s of r.stalls.slice(0, MAX_STALLS)) {
6111
6122
  const o = s;
6112
- if (!o || !num2(o.at) || !num2(o.ms) || !(o.blocking === null || num2(o.blocking)) || typeof o.what !== "string") return null;
6123
+ if (!o || !num(o.at) || !num(o.ms) || !(o.blocking === null || num(o.blocking)) || typeof o.what !== "string") return null;
6113
6124
  stalls.push({
6114
6125
  at: o.at,
6115
6126
  ms: Math.round(o.ms),
@@ -6144,15 +6155,17 @@ function mountTerminalRoutes(app, opts) {
6144
6155
  app.post("/api/terminals/:id/ticket", async (c) => {
6145
6156
  const id = c.req.param("id");
6146
6157
  const body = await c.req.json().catch(() => ({}));
6158
+ const attachOnly = body.attachOnly === true;
6147
6159
  const origin = c.req.header("origin");
6148
6160
  if (!origin) return c.json({ fallback: true });
6149
- if (body.force !== true) {
6161
+ if (body.force !== true && !attachOnly) {
6150
6162
  const elsewhere = await opts.elsewhere(id);
6151
6163
  if (elsewhere) return c.json({ elsewhere });
6152
6164
  }
6153
6165
  let running;
6154
6166
  try {
6155
- running = await opts.ensure(id);
6167
+ const grid = validGrid(body.cols, body.rows) ?? void 0;
6168
+ running = await (attachOnly ? opts.ensure(id, grid, true) : opts.ensure(id, grid));
6156
6169
  } catch (err) {
6157
6170
  return c.json({ error: err.message }, 409);
6158
6171
  }
@@ -6640,16 +6653,16 @@ function createPrWatch(deps) {
6640
6653
  const me = ci.repos.find((r) => r.name === f.repo)?.viewer ?? ci.viewer;
6641
6654
  return !!me && me.toLowerCase() === author.toLowerCase();
6642
6655
  }
6643
- function check(id, session, act = true, run2) {
6656
+ function check(id, session, act = true, run) {
6644
6657
  const running2 = inflight.get(id);
6645
6658
  if (running2) return running2;
6646
- const p = checkNow(id, session, act, run2).finally(() => inflight.delete(id));
6659
+ const p = checkNow(id, session, act, run).finally(() => inflight.delete(id));
6647
6660
  inflight.set(id, p);
6648
6661
  return p;
6649
6662
  }
6650
- async function checkNow(id, session, act = true, run2) {
6663
+ async function checkNow(id, session, act = true, run) {
6651
6664
  const name = `${session.target} ${session.branch}`;
6652
- const note = (text, level = "info") => run2?.note(`${name}: ${text}`, { level, sessionId: id });
6665
+ const note = (text, level = "info") => run?.note(`${name}: ${text}`, { level, sessionId: id });
6653
6666
  let pre;
6654
6667
  try {
6655
6668
  pre = await deps.preflight(session, { resting });
@@ -6702,9 +6715,9 @@ function createPrWatch(deps) {
6702
6715
  const r = a;
6703
6716
  if (r.pr.state !== "OPEN" || !r.path || theirs.has(prKey(r))) continue;
6704
6717
  const key = `${id}:${r.repo}:${r.pr.number}`;
6705
- const cached2 = feedbackCache.get(key);
6706
- const fresh = cached2 && r.pr.updatedAt && cached2.number === r.pr.number && cached2.updatedAt === r.pr.updatedAt && (openThreadCount(cached2.fb) === 0 || now() - cached2.at < THREADS_RECHECK_MS);
6707
- const fb = fresh ? cached2.fb : await deps.reviewFeedback(r.path, r.pr.number).catch(() => null);
6718
+ const cached3 = feedbackCache.get(key);
6719
+ const fresh = cached3 && r.pr.updatedAt && cached3.number === r.pr.number && cached3.updatedAt === r.pr.updatedAt && (openThreadCount(cached3.fb) === 0 || now() - cached3.at < THREADS_RECHECK_MS);
6720
+ const fb = fresh ? cached3.fb : await deps.reviewFeedback(r.path, r.pr.number).catch(() => null);
6708
6721
  if (fb && !fresh && r.pr.updatedAt) feedbackCache.set(key, { number: r.pr.number, updatedAt: r.pr.updatedAt, at: now(), fb });
6709
6722
  if (!fb) {
6710
6723
  const was = states.get(id)?.repos.find((p) => p.name === r.repo)?.threads?.filter((t) => t.prNumber === r.pr.number) ?? [];
@@ -6917,20 +6930,20 @@ function createPrWatch(deps) {
6917
6930
  if (!restingNames()) schedule?.resume();
6918
6931
  const queue = due;
6919
6932
  const ids = queue.map((q) => q.id);
6920
- const run2 = deps.activity?.start("pr-watch", "Checking pull requests");
6933
+ const run = deps.activity?.start("pr-watch", "Checking pull requests");
6921
6934
  let done = 0;
6922
- run2?.progress(0, ids.length);
6935
+ run?.progress(0, ids.length);
6923
6936
  const worker = async () => {
6924
6937
  for (let next = queue.shift(); next; next = queue.shift()) {
6925
- await check(next.id, next.session, !deps.lookOnly, run2);
6926
- run2?.progress(++done, ids.length);
6938
+ await check(next.id, next.session, !deps.lookOnly, run);
6939
+ run?.progress(++done, ids.length);
6927
6940
  }
6928
6941
  };
6929
6942
  try {
6930
6943
  await Promise.all(Array.from({ length: CONCURRENCY }, worker));
6931
- run2?.done(sweepSummary(ids));
6944
+ run?.done(sweepSummary(ids));
6932
6945
  } catch (err) {
6933
- run2?.fail(err.message);
6946
+ run?.fail(err.message);
6934
6947
  throw err;
6935
6948
  }
6936
6949
  })().finally(() => {
@@ -6991,7 +7004,7 @@ function repoServer(repoPath) {
6991
7004
  const { origin } = hostForRepo(repoPath);
6992
7005
  return origin ? originHostname(origin) : null;
6993
7006
  }
6994
- function viewerLogin(run2, lookup = hostOf, serverOf = repoServer) {
7007
+ function viewerLogin(run, lookup = hostOf, serverOf = repoServer) {
6995
7008
  const known = /* @__PURE__ */ new Map();
6996
7009
  return async (hostId, repoPath) => {
6997
7010
  const host = lookup(hostId);
@@ -6999,21 +7012,21 @@ function viewerLogin(run2, lookup = hostOf, serverOf = repoServer) {
6999
7012
  ${repoPath ? serverOf(repoPath) ?? "" : ""}`;
7000
7013
  const was = known.get(key);
7001
7014
  if (was) return was;
7002
- const login = await host.viewer(run2, repoPath ?? process.cwd()).catch(() => null);
7015
+ const login = await host.viewer(run, repoPath ?? process.cwd()).catch(() => null);
7003
7016
  if (login) known.set(key, login);
7004
7017
  return login || null;
7005
7018
  };
7006
7019
  }
7007
- async function fetchReviewFeedback(repoPath, prNumber, run2) {
7008
- return hostForRepo(repoPath).host.reviewFeedback(run2, repoPath, prNumber);
7020
+ async function fetchReviewFeedback(repoPath, prNumber, run) {
7021
+ return hostForRepo(repoPath).host.reviewFeedback(run, repoPath, prNumber);
7009
7022
  }
7010
7023
  function hostRateLimited(hostId, text) {
7011
7024
  return hostOf(hostId).rateLimited(text);
7012
7025
  }
7013
- function prWatchHostDeps(run2) {
7026
+ function prWatchHostDeps(run) {
7014
7027
  return {
7015
- viewer: viewerLogin(run2),
7016
- reviewFeedback: (repoPath, n) => fetchReviewFeedback(repoPath, n, run2),
7028
+ viewer: viewerLogin(run),
7029
+ reviewFeedback: (repoPath, n) => fetchReviewFeedback(repoPath, n, run),
7017
7030
  rateLimited: hostRateLimited
7018
7031
  };
7019
7032
  }
@@ -7089,7 +7102,7 @@ function branchFactsOf(pre) {
7089
7102
  }))
7090
7103
  );
7091
7104
  }
7092
- function listedPrsIo(run2, opts = {}) {
7105
+ function listedPrsIo(run, opts = {}) {
7093
7106
  return {
7094
7107
  repoIdOf: (repoPath) => {
7095
7108
  const { host, origin } = hostForRepo(repoPath);
@@ -7099,19 +7112,19 @@ function listedPrsIo(run2, opts = {}) {
7099
7112
  const h = hostOfPrUrl(url)?.host;
7100
7113
  return h ? h.id === DEFAULT_HOST ? void 0 : h.id : null;
7101
7114
  },
7102
- lookup: (cwd, host, ref) => hostOf(host).prForRef(run2, cwd ?? os3.tmpdir(), ref),
7115
+ lookup: (cwd, host, ref) => hostOf(host).prForRef(run, cwd ?? os3.tmpdir(), ref),
7103
7116
  ...opts
7104
7117
  };
7105
7118
  }
7106
- async function shipPreflightWithListed(session, run2, io = {}) {
7107
- const pre = await (io.preflight ?? shipPreflight)(session, run2);
7108
- return (await withListedPrs(pre, readSessionPrs(sessionIdFor(session)), io.listed ?? listedPrsIo(run2))).pre;
7119
+ async function shipPreflightWithListed(session, run, io = {}) {
7120
+ const pre = await (io.preflight ?? shipPreflight)(session, run);
7121
+ return (await withListedPrs(pre, readSessionPrs(sessionIdFor(session)), io.listed ?? listedPrsIo(run))).pre;
7109
7122
  }
7110
- async function watchPreflight(session, run2, opts = {}, io = {}) {
7123
+ async function watchPreflight(session, run, opts = {}, io = {}) {
7111
7124
  const id = sessionIdFor(session);
7112
7125
  const last = opts.last ?? null;
7113
7126
  const repoOf = (name) => last?.repos.find((x) => x.name === name);
7114
- const pre = await (io.preflight ?? shipPreflight)(session, run2, {
7127
+ const pre = await (io.preflight ?? shipPreflight)(session, run, {
7115
7128
  askGh: watchAskGh(opts.resting, (name) => !!repoOf(name)?.pr),
7116
7129
  ...watchBranchOptions(
7117
7130
  readSessionBranches(id),
@@ -7123,7 +7136,7 @@ async function watchPreflight(session, run2, opts = {}, io = {}) {
7123
7136
  const facts = branchFactsOf(pre);
7124
7137
  if (facts.length) bestEffort(`keep the branch facts of ${id}`, () => noteBranchFacts(id, facts));
7125
7138
  const previous = (url) => last ? prsOfCheck(last).find((p) => p.pr.url.toLowerCase() === url.toLowerCase())?.pr : void 0;
7126
- const listed = io.listed ?? listedPrsIo(run2, { ...opts.resting ? { resting: opts.resting } : {}, previous });
7139
+ const listed = io.listed ?? listedPrsIo(run, { ...opts.resting ? { resting: opts.resting } : {}, previous });
7127
7140
  const found2 = await withListedPrs(pre, readSessionPrs(id), listed);
7128
7141
  const aliases = new Map(sessionRepos(session, loadConfig()).map((r) => [r.path, r.alias]));
7129
7142
  const keys = new Map(pre.repos.map((r) => [r.name, [aliases.get(r.path), listed.repoIdOf(r.path)]]));
@@ -7235,7 +7248,7 @@ function mountShipRoutes(app, opts) {
7235
7248
  selection,
7236
7249
  body.method ?? "squash",
7237
7250
  opts.run,
7238
- (s, run2) => shipPreflightWithListed(s, run2)
7251
+ (s, run) => shipPreflightWithListed(s, run)
7239
7252
  );
7240
7253
  opts.onRepoChanged?.(id);
7241
7254
  let archived = false;
@@ -7334,6 +7347,12 @@ function mountRailRoutes(app, opts) {
7334
7347
  changed();
7335
7348
  return c.json(r.layout);
7336
7349
  });
7350
+ app.put("/api/rail/view", async (c) => {
7351
+ const body = await c.req.json().catch(() => null);
7352
+ const view = asRailView(body?.view);
7353
+ if (!view) return c.json({ error: "expected {view: mine|state|project}" }, 400);
7354
+ return c.json(saveRailView(view));
7355
+ });
7337
7356
  app.put("/api/sessions/:id/rail", async (c) => {
7338
7357
  const id = c.req.param("id");
7339
7358
  if (!findSession2(id)) return c.json({ error: "unknown session" }, 404);
@@ -7347,7 +7366,7 @@ function mountRailRoutes(app, opts) {
7347
7366
  }
7348
7367
 
7349
7368
  // src/core/worktree/shared-folders.ts
7350
- import fs11 from "fs";
7369
+ import fs12 from "fs";
7351
7370
  import path15 from "path";
7352
7371
  var norm3 = (p) => path15.resolve(p).replace(/\\/g, "/").toLowerCase();
7353
7372
  function shadowedSessions(sessions, branchCheckedOut2) {
@@ -7370,12 +7389,12 @@ function branchCheckedOut(dir) {
7370
7389
  try {
7371
7390
  const dotGit = path15.join(dir, ".git");
7372
7391
  let gitDir = dotGit;
7373
- if (fs11.statSync(dotGit).isFile()) {
7374
- const m = /^gitdir:\s*(.+)$/m.exec(fs11.readFileSync(dotGit, "utf8"));
7392
+ if (fs12.statSync(dotGit).isFile()) {
7393
+ const m = /^gitdir:\s*(.+)$/m.exec(fs12.readFileSync(dotGit, "utf8"));
7375
7394
  if (!m) return null;
7376
7395
  gitDir = path15.resolve(dir, m[1].trim());
7377
7396
  }
7378
- const head = fs11.readFileSync(path15.join(gitDir, "HEAD"), "utf8");
7397
+ const head = fs12.readFileSync(path15.join(gitDir, "HEAD"), "utf8");
7379
7398
  const ref = /^ref:\s*refs\/heads\/(.+)$/m.exec(head);
7380
7399
  return ref ? ref[1].trim() : null;
7381
7400
  } catch {
@@ -7384,18 +7403,18 @@ function branchCheckedOut(dir) {
7384
7403
  }
7385
7404
 
7386
7405
  // src/core/platform/build-stamp.ts
7387
- import fs12 from "fs";
7388
- var cached = null;
7406
+ import fs13 from "fs";
7407
+ var cached2 = null;
7389
7408
  function buildStamp() {
7390
- if (cached) return cached;
7409
+ if (cached2) return cached2;
7391
7410
  const forced = process.env.WORK_BUILD_STAMP;
7392
- if (forced) return cached = forced;
7411
+ if (forced) return cached2 = forced;
7393
7412
  try {
7394
- cached = String(Math.floor(fs12.statSync(process.argv[1]).mtimeMs));
7413
+ cached2 = String(Math.floor(fs13.statSync(process.argv[1]).mtimeMs));
7395
7414
  } catch {
7396
- cached = "unknown";
7415
+ cached2 = "unknown";
7397
7416
  }
7398
- return cached;
7417
+ return cached2;
7399
7418
  }
7400
7419
 
7401
7420
  // src/core/archive/after-archive.ts
@@ -7469,13 +7488,13 @@ function mountCleanupRoutes(app, opts) {
7469
7488
  app.post("/api/cleanup/branches/scan", (c) => {
7470
7489
  if (!branches.scanning) {
7471
7490
  branches = { ...branches, scanning: true };
7472
- const run2 = opts.activity?.start("branches", "Looking for merged local branches");
7491
+ const run = opts.activity?.start("branches", "Looking for merged local branches");
7473
7492
  void findMergedBranches(branchDeps).then((candidates2) => {
7474
7493
  branches = { scanning: false, scannedAt: (/* @__PURE__ */ new Date()).toISOString(), candidates: candidates2 };
7475
- run2?.done(`${candidates2.length} merged local branch${candidates2.length === 1 ? "" : "es"}`);
7494
+ run?.done(`${candidates2.length} merged local branch${candidates2.length === 1 ? "" : "es"}`);
7476
7495
  }).catch((err) => {
7477
7496
  branches = { ...branches, scanning: false };
7478
- run2?.fail(err.message);
7497
+ run?.fail(err.message);
7479
7498
  });
7480
7499
  }
7481
7500
  return c.json(branches);
@@ -7486,10 +7505,10 @@ function mountCleanupRoutes(app, opts) {
7486
7505
  (i) => !!i && typeof i.repo === "string" && typeof i.branch === "string"
7487
7506
  ).map((i) => ({ repo: i.repo, branch: i.branch, ...typeof i.tip === "string" ? { tip: i.tip } : {} })) : [];
7488
7507
  if (items.length === 0) return c.json({ error: "items: [{repo, branch, tip?}]" }, 400);
7489
- const run2 = opts.activity?.start("branches", "Deleting merged local branches");
7508
+ const run = opts.activity?.start("branches", "Deleting merged local branches");
7490
7509
  const results = await deleteMergedBranches(items, branchDeps);
7491
- for (const r of results) run2?.note(`${r.repo} ${r.branch}: ${r.message}`, { level: r.ok ? "action" : "warn" });
7492
- run2?.done(`${results.filter((r) => r.ok).length} of ${results.length} deleted`);
7510
+ for (const r of results) run?.note(`${r.repo} ${r.branch}: ${r.message}`, { level: r.ok ? "action" : "warn" });
7511
+ run?.done(`${results.filter((r) => r.ok).length} of ${results.length} deleted`);
7493
7512
  const gone = new Set(results.filter((r) => r.ok).map((r) => `${r.repo}\0${r.branch}`));
7494
7513
  branches = { ...branches, candidates: branches.candidates.filter((b) => !gone.has(`${b.repo}\0${b.branch}`)) };
7495
7514
  return c.json({ results, state: branches });
@@ -7539,14 +7558,14 @@ function createActivityLog(opts = {}) {
7539
7558
  let recent = [];
7540
7559
  const lastOk = /* @__PURE__ */ new Map();
7541
7560
  const schedules = /* @__PURE__ */ new Map();
7542
- const finish = (run2) => {
7543
- running.delete(run2.id);
7544
- recent = [run2, ...recent].slice(0, keep);
7561
+ const finish = (run) => {
7562
+ running.delete(run.id);
7563
+ recent = [run, ...recent].slice(0, keep);
7545
7564
  changed();
7546
7565
  };
7547
7566
  return {
7548
7567
  start(kind, label) {
7549
- const run2 = {
7568
+ const run = {
7550
7569
  id: nextId++,
7551
7570
  kind,
7552
7571
  label,
@@ -7557,31 +7576,31 @@ function createActivityLog(opts = {}) {
7557
7576
  summary: null,
7558
7577
  notes: []
7559
7578
  };
7560
- running.set(run2.id, run2);
7579
+ running.set(run.id, run);
7561
7580
  changed();
7562
- const open = () => run2.status === "running";
7581
+ const open = () => run.status === "running";
7563
7582
  return {
7564
7583
  progress(done, total) {
7565
7584
  if (!open()) return;
7566
- run2.progress = { done, total };
7585
+ run.progress = { done, total };
7567
7586
  changed();
7568
7587
  },
7569
7588
  note(text, o = {}) {
7570
7589
  if (!open()) return;
7571
7590
  const n = { at: iso(), text, level: o.level ?? "info", ...o.sessionId ? { sessionId: o.sessionId } : {} };
7572
- run2.notes = [...run2.notes, n].slice(-KEEP_NOTES);
7591
+ run.notes = [...run.notes, n].slice(-KEEP_NOTES);
7573
7592
  changed();
7574
7593
  },
7575
7594
  done(summary) {
7576
7595
  if (!open()) return;
7577
- Object.assign(run2, { status: "done", endedAt: iso(), summary });
7578
- lastOk.set(run2.kind, run2.endedAt);
7579
- finish(run2);
7596
+ Object.assign(run, { status: "done", endedAt: iso(), summary });
7597
+ lastOk.set(run.kind, run.endedAt);
7598
+ finish(run);
7580
7599
  },
7581
7600
  fail(error) {
7582
7601
  if (!open()) return;
7583
- Object.assign(run2, { status: "failed", endedAt: iso(), summary: error });
7584
- finish(run2);
7602
+ Object.assign(run, { status: "failed", endedAt: iso(), summary: error });
7603
+ finish(run);
7585
7604
  }
7586
7605
  };
7587
7606
  },
@@ -7637,7 +7656,7 @@ function threadsWithoutDraft(open, replies) {
7637
7656
  return open.filter((t) => !drafted.has(t.threadId));
7638
7657
  }
7639
7658
  function mountPrReplyRoutes(app, opts) {
7640
- const run2 = opts.run ?? defaultRunner;
7659
+ const run = opts.run ?? defaultRunner;
7641
7660
  const changed = (sessionId) => {
7642
7661
  if (opts.watch) markPostedAnswered(sessionId, opts.watch);
7643
7662
  opts.broadcast("replies-changed", { sessionId });
@@ -7659,7 +7678,7 @@ function mountPrReplyRoutes(app, opts) {
7659
7678
  if (typeof b.body !== "string") return c.json({ error: "body: string" }, 400);
7660
7679
  const r = await draftReply(id, c.req.param("thread"), b.body, {
7661
7680
  repos: () => sessionRepoRefs(session),
7662
- run: run2
7681
+ run
7663
7682
  });
7664
7683
  if (!r.ok) return c.json({ error: r.error }, 400);
7665
7684
  changed(id);
@@ -7682,7 +7701,7 @@ function mountPrReplyRoutes(app, opts) {
7682
7701
  return c.json({ error: "body: the reply text" }, 400);
7683
7702
  const thread = c.req.param("thread");
7684
7703
  const cwd = replyFolder(session, listReplies(id).find((r2) => r2.threadId === thread)?.repo);
7685
- const r = await postReply(id, thread, b.body, { resolve: b.resolve === true, cwd, run: run2 });
7704
+ const r = await postReply(id, thread, b.body, { resolve: b.resolve === true, cwd, run });
7686
7705
  if (!r.ok) return c.json({ error: r.error }, 502);
7687
7706
  const act = opts.activity?.start("pr-watch", "Posting a review reply");
7688
7707
  act?.note(`${session.target} ${session.branch}: posted your reply${r.resolved ? " and resolved the thread" : ""}`, {
@@ -7702,7 +7721,7 @@ function mountPrReplyRoutes(app, opts) {
7702
7721
  }
7703
7722
 
7704
7723
  // src/core/archive/archive-retention.ts
7705
- import fs13 from "fs";
7724
+ import fs14 from "fs";
7706
7725
  import path16 from "path";
7707
7726
  import zlib from "zlib";
7708
7727
  var DEFAULT_COMPRESS_AFTER_DAYS = 30;
@@ -7715,7 +7734,7 @@ function applyArchiveRetention(opts) {
7715
7734
  const out = { compressed: [], dropped: [], bytesSaved: 0 };
7716
7735
  let ids;
7717
7736
  try {
7718
- ids = fs13.readdirSync(root, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
7737
+ ids = fs14.readdirSync(root, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
7719
7738
  } catch {
7720
7739
  return out;
7721
7740
  }
@@ -7725,8 +7744,8 @@ function applyArchiveRetention(opts) {
7725
7744
  const age = now - Date.parse(rec.archivedAt);
7726
7745
  if (!Number.isFinite(age)) continue;
7727
7746
  const ignored = path16.join(archiveDirFor(id, root), "ignored");
7728
- if (compressAfter > 0 && age >= compressAfter * DAY_MS && !rec.ignoredDroppedAt && fs13.existsSync(ignored)) {
7729
- fs13.rmSync(ignored, { recursive: true, force: true });
7747
+ if (compressAfter > 0 && age >= compressAfter * DAY_MS && !rec.ignoredDroppedAt && fs14.existsSync(ignored)) {
7748
+ fs14.rmSync(ignored, { recursive: true, force: true });
7730
7749
  rec.ignoredDroppedAt = new Date(now).toISOString();
7731
7750
  writeArchiveRecord(rec, root);
7732
7751
  }
@@ -7734,7 +7753,7 @@ function applyArchiveRetention(opts) {
7734
7753
  const dir = path16.join(archiveDirFor(id, root), "transcripts");
7735
7754
  if (dropAfter > 0 && age >= dropAfter * DAY_MS) {
7736
7755
  out.bytesSaved += dirBytes(dir);
7737
- fs13.rmSync(dir, { recursive: true, force: true });
7756
+ fs14.rmSync(dir, { recursive: true, force: true });
7738
7757
  rec.transcriptsDroppedAt = new Date(now).toISOString();
7739
7758
  writeArchiveRecord(rec, root);
7740
7759
  out.dropped.push(id);
@@ -7743,15 +7762,15 @@ function applyArchiveRetention(opts) {
7743
7762
  if (compressAfter <= 0 || rec.compressedAt || age < compressAfter * DAY_MS) continue;
7744
7763
  for (const t of rec.transcripts) {
7745
7764
  const plain = path16.join(dir, t.file);
7746
- if (!fs13.existsSync(plain)) continue;
7747
- const data = fs13.readFileSync(plain);
7765
+ if (!fs14.existsSync(plain)) continue;
7766
+ const data = fs14.readFileSync(plain);
7748
7767
  const gz = zlib.gzipSync(data);
7749
- fs13.writeFileSync(`${plain}.gz`, gz);
7750
- if (!zlib.gunzipSync(fs13.readFileSync(`${plain}.gz`)).equals(data)) {
7751
- fs13.rmSync(`${plain}.gz`, { force: true });
7768
+ fs14.writeFileSync(`${plain}.gz`, gz);
7769
+ if (!zlib.gunzipSync(fs14.readFileSync(`${plain}.gz`)).equals(data)) {
7770
+ fs14.rmSync(`${plain}.gz`, { force: true });
7752
7771
  continue;
7753
7772
  }
7754
- fs13.rmSync(plain, { force: true });
7773
+ fs14.rmSync(plain, { force: true });
7755
7774
  out.bytesSaved += data.length - gz.length;
7756
7775
  }
7757
7776
  rec.compressedAt = new Date(now).toISOString();
@@ -7763,7 +7782,7 @@ function applyArchiveRetention(opts) {
7763
7782
  function dirBytes(dir) {
7764
7783
  let n = 0;
7765
7784
  try {
7766
- for (const f of fs13.readdirSync(dir)) n += fs13.statSync(path16.join(dir, f)).size;
7785
+ for (const f of fs14.readdirSync(dir)) n += fs14.statSync(path16.join(dir, f)).size;
7767
7786
  } catch {
7768
7787
  }
7769
7788
  return n;
@@ -7787,7 +7806,7 @@ function createTimeKeeper(deps, opts) {
7787
7806
  if (d === today) return true;
7788
7807
  return needsBuild(d, builtAt.get(d));
7789
7808
  });
7790
- const run3 = opts.activity?.start("time", days.length === 1 ? "Updating today" : `Building ${days.length} days`);
7809
+ const run2 = opts.activity?.start("time", days.length === 1 ? "Updating today" : `Building ${days.length} days`);
7791
7810
  const failed = [];
7792
7811
  let built = 0;
7793
7812
  for (const d of days) {
@@ -7799,11 +7818,11 @@ function createTimeKeeper(deps, opts) {
7799
7818
  }
7800
7819
  }
7801
7820
  if (built) opts.changed();
7802
- if (failed.length) run3?.fail(`${failed.length} of ${days.length} not built \u2014 ${failed.join("; ")}`);
7803
- else run3?.done(days.length === 1 ? "today updated" : `${days.length} days built`);
7821
+ if (failed.length) run2?.fail(`${failed.length} of ${days.length} not built \u2014 ${failed.join("; ")}`);
7822
+ else run2?.done(days.length === 1 ? "today updated" : `${days.length} days built`);
7804
7823
  }
7805
7824
  let again = null;
7806
- const run2 = (what = "all") => {
7825
+ const run = (what = "all") => {
7807
7826
  if (busy) {
7808
7827
  again = again === "all" || what === "all" ? "all" : "local";
7809
7828
  return busy;
@@ -7825,12 +7844,12 @@ function createTimeKeeper(deps, opts) {
7825
7844
  return busy;
7826
7845
  };
7827
7846
  return {
7828
- run: run2,
7847
+ run,
7829
7848
  soon: () => {
7830
7849
  if (timer) return;
7831
7850
  timer = setTimeout(() => {
7832
7851
  timer = null;
7833
- void run2("local");
7852
+ void run("local");
7834
7853
  }, AFTER_TURN_MS);
7835
7854
  timer.unref?.();
7836
7855
  },
@@ -8069,14 +8088,14 @@ function settleLeftOverClaims(deps) {
8069
8088
  function tidyLeftOverSubmits(deps, activity, changed) {
8070
8089
  const done = settleLeftOverClaims(deps);
8071
8090
  if (!done.length) return;
8072
- const run2 = activity?.start("reviews", "Submits left mid-way");
8091
+ const run = activity?.start("reviews", "Submits left mid-way");
8073
8092
  for (const r of done) {
8074
- run2?.note(`${r.repo} #${r.number}: work stopped while submitting your review \u2014 look at the PR and say whether it went`, {
8093
+ run?.note(`${r.repo} #${r.number}: work stopped while submitting your review \u2014 look at the PR and say whether it went`, {
8075
8094
  level: "warn"
8076
8095
  });
8077
8096
  changed(r);
8078
8097
  }
8079
- run2?.done(`${done.length} submit${done.length === 1 ? "" : "s"} in doubt`);
8098
+ run?.done(`${done.length} submit${done.length === 1 ? "" : "s"} in doubt`);
8080
8099
  }
8081
8100
 
8082
8101
  // src/core/review/review-fix.ts
@@ -8155,10 +8174,10 @@ async function fixItMyself(deps, repo, number, input) {
8155
8174
  const no = claimRefused;
8156
8175
  if (no) return { ok: false, ...no };
8157
8176
  const release = () => deps.update(repo, number, (cur) => cur.fixing?.at === claimAt ? withoutFixClaim(cur) : cur);
8158
- const run2 = deps.activity?.start("reviews", `Fix it myself: ${repo} #${number}`);
8177
+ const run = deps.activity?.start("reviews", `Fix it myself: ${repo} #${number}`);
8159
8178
  const fail = (status, error, sessionId) => {
8160
8179
  release();
8161
- run2?.fail(error);
8180
+ run?.fail(error);
8162
8181
  return { ok: false, status, error, ...sessionId ? { sessionId } : {} };
8163
8182
  };
8164
8183
  try {
@@ -8219,13 +8238,13 @@ async function fixItMyself(deps, repo, number, input) {
8219
8238
  `${plural(left.length, "comment")} stayed on the review (posted, or a submit took ${left.length === 1 ? "it" : "them"} meanwhile): the session has ${left.length === 1 ? "it" : "them"} too`
8220
8239
  );
8221
8240
  const said = `${plural(moved, "comment")} on #${number} being fixed in ${label}${created ? " (new session)" : ""}`;
8222
- run2?.note(said, { level: "action", sessionId });
8223
- for (const w of warnings) run2?.note(`${label}: ${w}`, { level: "warn", sessionId });
8224
- run2?.done(said);
8241
+ run?.note(said, { level: "action", sessionId });
8242
+ for (const w of warnings) run?.note(`${label}: ${w}`, { level: "warn", sessionId });
8243
+ run?.done(said);
8225
8244
  return { ok: true, sessionId, created, review: next ?? claimed, ...warnings.length ? { warnings } : {} };
8226
8245
  } catch (err) {
8227
8246
  release();
8228
- run2?.fail(err.message);
8247
+ run?.fail(err.message);
8229
8248
  throw err;
8230
8249
  }
8231
8250
  }
@@ -8252,7 +8271,7 @@ function reviewLimits(config) {
8252
8271
  var isReviewMode = (v) => v === "all" || v === "asked" || v === "off";
8253
8272
 
8254
8273
  // src/server/routes/review-routes.ts
8255
- var num3 = (s) => /^\d+$/.test(s) ? Number(s) : null;
8274
+ var num2 = (s) => /^\d+$/.test(s) ? Number(s) : null;
8256
8275
  function mountReviewRoutes(app, deps) {
8257
8276
  const changed = (repo, number) => deps.broadcast("reviews-changed", { repo, number });
8258
8277
  app.get("/api/reviews", (c) => {
@@ -8273,13 +8292,13 @@ function mountReviewRoutes(app, deps) {
8273
8292
  return c.json(deps.settings());
8274
8293
  });
8275
8294
  app.get("/api/reviews/:repo/:number", (c) => {
8276
- const n = num3(c.req.param("number"));
8295
+ const n = num2(c.req.param("number"));
8277
8296
  const r = n === null ? null : deps.read(c.req.param("repo"), n);
8278
8297
  return r ? c.json(shownReview(deps, r)) : c.json({ error: "no review of that PR" }, 404);
8279
8298
  });
8280
8299
  app.get("/api/reviews/:repo/:number/diff", async (c) => {
8281
8300
  const repo = c.req.param("repo");
8282
- const n = num3(c.req.param("number"));
8301
+ const n = num2(c.req.param("number"));
8283
8302
  const r = n === null ? null : deps.read(repo, n);
8284
8303
  const at = deps.repoPath(repo);
8285
8304
  if (!r || n === null || !r.mergeBase || !at) return c.json({ error: "no prepared review of that PR" }, 404);
@@ -8288,7 +8307,7 @@ function mountReviewRoutes(app, deps) {
8288
8307
  });
8289
8308
  app.post("/api/reviews/:repo/:number", async (c) => {
8290
8309
  const repo = c.req.param("repo");
8291
- const n = num3(c.req.param("number"));
8310
+ const n = num2(c.req.param("number"));
8292
8311
  if (n === null) return c.json({ error: "not a PR number" }, 400);
8293
8312
  const body = await c.req.json().catch(() => ({}));
8294
8313
  if (body.also !== void 0 && typeof body.also !== "string") return c.json({ error: "also: string" }, 400);
@@ -8300,7 +8319,7 @@ function mountReviewRoutes(app, deps) {
8300
8319
  });
8301
8320
  app.post("/api/reviews/:repo/:number/discussion", async (c) => {
8302
8321
  const repo = c.req.param("repo");
8303
- const n = num3(c.req.param("number"));
8322
+ const n = num2(c.req.param("number"));
8304
8323
  if (n === null || !deps.read(repo, n)) return c.json({ error: "no review of that PR" }, 404);
8305
8324
  const was = deps.read(repo, n)?.discussion?.at;
8306
8325
  const r = await deps.refreshDiscussion(repo, n);
@@ -8310,7 +8329,7 @@ function mountReviewRoutes(app, deps) {
8310
8329
  });
8311
8330
  app.post("/api/reviews/:repo/:number/drafts", async (c) => {
8312
8331
  const repo = c.req.param("repo");
8313
- const n = num3(c.req.param("number"));
8332
+ const n = num2(c.req.param("number"));
8314
8333
  if (n === null || !deps.read(repo, n)) return c.json({ error: "no review of that PR" }, 404);
8315
8334
  const body = await c.req.json().catch(() => null);
8316
8335
  let error = null;
@@ -8328,7 +8347,7 @@ function mountReviewRoutes(app, deps) {
8328
8347
  });
8329
8348
  app.post("/api/reviews/:repo/:number/submit", async (c) => {
8330
8349
  const repo = c.req.param("repo");
8331
- const n = num3(c.req.param("number"));
8350
+ const n = num2(c.req.param("number"));
8332
8351
  if (n === null) return c.json({ error: "no review of that PR" }, 404);
8333
8352
  const input = await c.req.json().catch(() => null);
8334
8353
  const out = await submitPrReview(deps, repo, n, input);
@@ -8338,7 +8357,7 @@ function mountReviewRoutes(app, deps) {
8338
8357
  });
8339
8358
  app.post("/api/reviews/:repo/:number/fix-myself", async (c) => {
8340
8359
  const repo = c.req.param("repo");
8341
- const n = num3(c.req.param("number"));
8360
+ const n = num2(c.req.param("number"));
8342
8361
  if (n === null || !deps.read(repo, n)) return c.json({ error: "no review of that PR" }, 404);
8343
8362
  if (!deps.fixMyself) return c.json({ error: "not available on this server" }, 501);
8344
8363
  const input = await c.req.json().catch(() => null);
@@ -8351,7 +8370,7 @@ function mountReviewRoutes(app, deps) {
8351
8370
  });
8352
8371
  app.post("/api/reviews/:repo/:number/in-doubt", async (c) => {
8353
8372
  const repo = c.req.param("repo");
8354
- const n = num3(c.req.param("number"));
8373
+ const n = num2(c.req.param("number"));
8355
8374
  if (n === null || !deps.read(repo, n)) return c.json({ error: "no review of that PR" }, 404);
8356
8375
  const body = await c.req.json().catch(() => null);
8357
8376
  if (!body || typeof body.went !== "boolean") return c.json({ error: "expected {went: true|false}" }, 400);
@@ -8362,7 +8381,7 @@ function mountReviewRoutes(app, deps) {
8362
8381
  });
8363
8382
  app.delete("/api/reviews/:repo/:number/dropped", (c) => {
8364
8383
  const repo = c.req.param("repo");
8365
- const n = num3(c.req.param("number"));
8384
+ const n = num2(c.req.param("number"));
8366
8385
  const next = n === null ? null : deps.update(repo, n, clearDropped);
8367
8386
  if (!next || n === null) return c.json({ error: "no review of that PR" }, 404);
8368
8387
  changed(repo, n);
@@ -8370,7 +8389,7 @@ function mountReviewRoutes(app, deps) {
8370
8389
  });
8371
8390
  app.delete("/api/reviews/:repo/:number/drafts/:id", (c) => {
8372
8391
  const repo = c.req.param("repo");
8373
- const n = num3(c.req.param("number"));
8392
+ const n = num2(c.req.param("number"));
8374
8393
  if (n === null || !deps.read(repo, n)) return c.json({ error: "no review of that PR" }, 404);
8375
8394
  const id = c.req.param("id");
8376
8395
  let refused = null;
@@ -8392,42 +8411,42 @@ function mountReviewRoutes(app, deps) {
8392
8411
 
8393
8412
  // src/core/review/review-tree.ts
8394
8413
  import { randomBytes } from "crypto";
8395
- import fs14 from "fs";
8414
+ import fs15 from "fs";
8396
8415
  import path17 from "path";
8397
8416
 
8398
8417
  // src/core/review/review-source.ts
8399
8418
  var reviewRef = (number) => `refs/work/review/${number}`;
8400
8419
  var ATTR_CHUNK = 200;
8401
- var git2 = (run2, cwd, ...args) => run2("git", args, cwd);
8402
- async function preparePr(run2, repoPath, host, pr) {
8420
+ var git2 = (run, cwd, ...args) => run("git", args, cwd);
8421
+ async function preparePr(run, repoPath, host, pr) {
8403
8422
  const ref = reviewRef(pr.number);
8404
- const head = await git2(run2, repoPath, "fetch", "--quiet", "--no-tags", "origin", `+${host.prRef(pr.number)}:${ref}`);
8423
+ const head = await git2(run, repoPath, "fetch", "--quiet", "--no-tags", "origin", `+${host.prRef(pr.number)}:${ref}`);
8405
8424
  if (head.code !== 0)
8406
8425
  return { ok: false, error: `couldn't fetch the PR's code: ${head.stderr.trim().split("\n")[0] || "git fetch failed"}` };
8407
8426
  if (host.prRefIsMerge) {
8408
- const second = await git2(run2, repoPath, "rev-parse", "--verify", "--quiet", `${ref}^2`);
8427
+ const second = await git2(run, repoPath, "rev-parse", "--verify", "--quiet", `${ref}^2`);
8409
8428
  const tip = second.stdout.trim();
8410
8429
  if (second.code !== 0 || !tip) return { ok: false, error: "the PR's merge ref has no second parent: can't tell its head" };
8411
- const moved = await git2(run2, repoPath, "update-ref", ref, tip);
8430
+ const moved = await git2(run, repoPath, "update-ref", ref, tip);
8412
8431
  if (moved.code !== 0) return { ok: false, error: `couldn't keep the PR's head: ${moved.stderr.trim().split(/\r?\n/)[0]}` };
8413
8432
  }
8414
- if (pr.base) await git2(run2, repoPath, "fetch", "--quiet", "--no-tags", "origin", `+refs/heads/${pr.base}:refs/remotes/origin/${pr.base}`);
8415
- const sha = (await git2(run2, repoPath, "rev-parse", ref)).stdout.trim();
8433
+ if (pr.base) await git2(run, repoPath, "fetch", "--quiet", "--no-tags", "origin", `+refs/heads/${pr.base}:refs/remotes/origin/${pr.base}`);
8434
+ const sha = (await git2(run, repoPath, "rev-parse", ref)).stdout.trim();
8416
8435
  const baseRef = pr.base ? `refs/remotes/origin/${pr.base}` : "origin/HEAD";
8417
- const mb = await git2(run2, repoPath, "merge-base", baseRef, ref);
8436
+ const mb = await git2(run, repoPath, "merge-base", baseRef, ref);
8418
8437
  if (mb.code !== 0 || !mb.stdout.trim()) return { ok: false, error: `no common commit with ${pr.base || "the default branch"}` };
8419
8438
  const mergeBase = mb.stdout.trim();
8420
- const files = await reviewDiff(run2, repoPath, mergeBase, ref);
8439
+ const files = await reviewDiff(run, repoPath, mergeBase, ref);
8421
8440
  if (!files) return { ok: false, error: "git couldn't diff the PR" };
8422
- return { ok: true, files, extras: await diffExtras(run2, repoPath, mergeBase, ref, files), mergeBase, headSha: sha };
8441
+ return { ok: true, files, extras: await diffExtras(run, repoPath, mergeBase, ref, files), mergeBase, headSha: sha };
8423
8442
  }
8424
- async function reviewDiff(run2, repoPath, from, to) {
8425
- const d = await git2(run2, repoPath, "diff", "--no-color", "--no-ext-diff", "-M", from, to);
8443
+ async function reviewDiff(run, repoPath, from, to) {
8444
+ const d = await git2(run, repoPath, "diff", "--no-color", "--no-ext-diff", "-M", from, to);
8426
8445
  return d.code === 0 ? parseGitDiff(d.stdout) : null;
8427
8446
  }
8428
- async function diffExtras(run2, repoPath, from, to, files) {
8447
+ async function diffExtras(run, repoPath, from, to, files) {
8429
8448
  const changed = files.filter((f) => f.added + f.deleted > 0).map((f) => f.path);
8430
- const w = await git2(run2, repoPath, "diff", "--no-color", "--no-ext-diff", "-M", "-w", "--name-only", from, to);
8449
+ const w = await git2(run, repoPath, "diff", "--no-color", "--no-ext-diff", "-M", "-w", "--name-only", from, to);
8431
8450
  const real = new Set(
8432
8451
  w.code === 0 ? w.stdout.split("\n").map((l) => l.trim()).filter(Boolean) : changed
8433
8452
  );
@@ -8435,7 +8454,7 @@ async function diffExtras(run2, repoPath, from, to, files) {
8435
8454
  const generated = /* @__PURE__ */ new Set();
8436
8455
  const paths = files.map((f) => f.path);
8437
8456
  for (let i = 0; i < paths.length; i += ATTR_CHUNK) {
8438
- const attr = await git2(run2, repoPath, "check-attr", `--source=${to}`, "linguist-generated", "--", ...paths.slice(i, i + ATTR_CHUNK));
8457
+ const attr = await git2(run, repoPath, "check-attr", `--source=${to}`, "linguist-generated", "--", ...paths.slice(i, i + ATTR_CHUNK));
8439
8458
  if (attr.code !== 0) break;
8440
8459
  for (const line of attr.stdout.split("\n")) {
8441
8460
  const m = /^(.*): linguist-generated: (set|true)$/.exec(line.trim());
@@ -8444,8 +8463,8 @@ async function diffExtras(run2, repoPath, from, to, files) {
8444
8463
  }
8445
8464
  return { whitespaceOnly, generated };
8446
8465
  }
8447
- async function dropReviewRef(run2, repoPath, number) {
8448
- await git2(run2, repoPath, "update-ref", "-d", reviewRef(number));
8466
+ async function dropReviewRef(run, repoPath, number) {
8467
+ await git2(run, repoPath, "update-ref", "-d", reviewRef(number));
8449
8468
  }
8450
8469
 
8451
8470
  // src/core/review/review-tree.ts
@@ -8453,27 +8472,27 @@ var reviewTreesDir = () => path17.join(getConfigDir(), "review-trees");
8453
8472
  var NO_HOOKS = ".no-hooks";
8454
8473
  var NO_LFS = ["-c", "filter.lfs.smudge=", "-c", "filter.lfs.process=", "-c", "filter.lfs.required=false"];
8455
8474
  var NO_LFS_ENV = { GIT_LFS_SKIP_SMUDGE: "1" };
8456
- function reviewTreeName(alias, number, headSha, run2) {
8475
+ function reviewTreeName(alias, number, headSha, run) {
8457
8476
  const safe = alias.replace(/[^A-Za-z0-9._-]/g, "_").replace(/^\.+/, "_") || "repo";
8458
- const tag = run2.replace(/[^A-Za-z0-9]/g, "");
8477
+ const tag = run.replace(/[^A-Za-z0-9]/g, "");
8459
8478
  return `${safe}-${number}-${headSha.slice(0, 8)}${tag ? `-${tag}` : ""}`;
8460
8479
  }
8461
8480
  var runSuffix = () => `${process.pid.toString(36)}${randomBytes(3).toString("hex")}`;
8462
8481
  var firstLine = (s) => s.trim().split(/\r?\n/)[0] ?? "";
8463
8482
  function rmTree(dir) {
8464
8483
  try {
8465
- fs14.rmSync(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 200 });
8484
+ fs15.rmSync(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 200 });
8466
8485
  } catch {
8467
8486
  }
8468
- return !fs14.existsSync(dir);
8487
+ return !fs15.existsSync(dir);
8469
8488
  }
8470
- async function createReviewTree(run2, at, opts) {
8489
+ async function createReviewTree(run, at, opts) {
8471
8490
  const root = opts.root ?? reviewTreesDir();
8472
8491
  const dir = path17.join(root, reviewTreeName(at.alias, at.number, at.headSha, opts.run ?? runSuffix()));
8473
8492
  const noHooks = path17.join(root, NO_HOOKS);
8474
- fs14.mkdirSync(noHooks, { recursive: true });
8475
- if (fs14.existsSync(dir)) await removeReviewTree(run2, at.repoPath, dir);
8476
- const added = await run2(
8493
+ fs15.mkdirSync(noHooks, { recursive: true });
8494
+ if (fs15.existsSync(dir)) await removeReviewTree(run, at.repoPath, dir);
8495
+ const added = await run(
8477
8496
  "git",
8478
8497
  [
8479
8498
  "-c",
@@ -8492,77 +8511,77 @@ async function createReviewTree(run2, at, opts) {
8492
8511
  NO_LFS_ENV
8493
8512
  );
8494
8513
  if (added.code !== 0) {
8495
- await removeReviewTree(run2, at.repoPath, dir);
8514
+ await removeReviewTree(run, at.repoPath, dir);
8496
8515
  return { ok: false, error: `couldn't check the PR out: ${firstLine(added.stderr) || "git worktree add failed"}` };
8497
8516
  }
8498
- const head = await run2("git", ["rev-parse", "HEAD"], dir);
8517
+ const head = await run("git", ["rev-parse", "HEAD"], dir);
8499
8518
  if (head.code !== 0 || head.stdout.trim() !== at.headSha) {
8500
- await removeReviewTree(run2, at.repoPath, dir);
8519
+ await removeReviewTree(run, at.repoPath, dir);
8501
8520
  return { ok: false, error: "the checkout isn't at the reviewed commit (the PR moved meanwhile)" };
8502
8521
  }
8503
- const listed = await run2("git", ["ls-files", "-z"], dir);
8522
+ const listed = await run("git", ["ls-files", "-z"], dir);
8504
8523
  if (listed.code !== 0) {
8505
- await removeReviewTree(run2, at.repoPath, dir);
8524
+ await removeReviewTree(run, at.repoPath, dir);
8506
8525
  return { ok: false, error: "couldn't list the checkout's files to remove its settings" };
8507
8526
  }
8508
8527
  const removed = [];
8509
8528
  for (const rel of listed.stdout.split("\0").filter((rel2) => opts.strip(rel2))) {
8510
8529
  const file = path17.join(dir, rel);
8511
- fs14.rmSync(file, { recursive: true, force: true });
8512
- if (fs14.existsSync(file)) {
8513
- await removeReviewTree(run2, at.repoPath, dir);
8530
+ fs15.rmSync(file, { recursive: true, force: true });
8531
+ if (fs15.existsSync(file)) {
8532
+ await removeReviewTree(run, at.repoPath, dir);
8514
8533
  return { ok: false, error: `couldn't remove ${rel} from the checkout` };
8515
8534
  }
8516
8535
  removed.push(rel);
8517
8536
  }
8518
8537
  return { ok: true, dir, removed };
8519
8538
  }
8520
- async function removeReviewTree(run2, repoPath, dir) {
8521
- if (fs14.existsSync(dir)) await run2("git", ["worktree", "remove", "--force", "--force", dir], repoPath);
8539
+ async function removeReviewTree(run, repoPath, dir) {
8540
+ if (fs15.existsSync(dir)) await run("git", ["worktree", "remove", "--force", "--force", dir], repoPath);
8522
8541
  const gone = rmTree(dir);
8523
- await run2("git", ["worktree", "prune"], repoPath);
8542
+ await run("git", ["worktree", "prune"], repoPath);
8524
8543
  return gone;
8525
8544
  }
8526
- async function withReviewTree(run2, at, use, opts) {
8527
- const tree = await createReviewTree(run2, at, opts);
8545
+ async function withReviewTree(run, at, use, opts) {
8546
+ const tree = await createReviewTree(run, at, opts);
8528
8547
  if (!tree.ok) return tree;
8529
8548
  let value;
8530
8549
  let gone;
8531
8550
  try {
8532
8551
  value = await use(tree.dir, tree.removed);
8533
8552
  } finally {
8534
- gone = await removeReviewTree(run2, at.repoPath, tree.dir).catch(() => false);
8553
+ gone = await removeReviewTree(run, at.repoPath, tree.dir).catch(() => false);
8535
8554
  }
8536
8555
  return { ok: true, value, ...gone ? {} : { left: tree.dir } };
8537
8556
  }
8538
8557
  function gitDirOf(dir) {
8539
8558
  try {
8540
- const m = /^gitdir:\s*(.+)$/m.exec(fs14.readFileSync(path17.join(dir, ".git"), "utf8"));
8559
+ const m = /^gitdir:\s*(.+)$/m.exec(fs15.readFileSync(path17.join(dir, ".git"), "utf8"));
8541
8560
  return m ? path17.resolve(dir, m[1].trim(), "..", "..") : null;
8542
8561
  } catch {
8543
8562
  return null;
8544
8563
  }
8545
8564
  }
8546
- async function sweepReviewTrees(run2, opts = {}) {
8565
+ async function sweepReviewTrees(run, opts = {}) {
8547
8566
  const root = opts.root ?? reviewTreesDir();
8548
8567
  const now = opts.now?.() ?? Date.now();
8549
8568
  const swept = [];
8550
8569
  const failed = [];
8551
8570
  let names;
8552
8571
  try {
8553
- names = fs14.readdirSync(root, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== NO_HOOKS).map((e) => e.name);
8572
+ names = fs15.readdirSync(root, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== NO_HOOKS).map((e) => e.name);
8554
8573
  } catch {
8555
8574
  return { swept, failed };
8556
8575
  }
8557
8576
  for (const name of names) {
8558
8577
  const dir = path17.join(root, name);
8559
8578
  try {
8560
- if (opts.olderThanMs && now - fs14.statSync(dir).mtimeMs < opts.olderThanMs) continue;
8579
+ if (opts.olderThanMs && now - fs15.statSync(dir).mtimeMs < opts.olderThanMs) continue;
8561
8580
  } catch {
8562
8581
  continue;
8563
8582
  }
8564
8583
  const gitDir = gitDirOf(dir);
8565
- const gone = gitDir && fs14.existsSync(gitDir) ? await removeReviewTree(run2, gitDir, dir) : rmTree(dir);
8584
+ const gone = gitDir && fs15.existsSync(gitDir) ? await removeReviewTree(run, gitDir, dir) : rmTree(dir);
8566
8585
  (gone ? swept : failed).push(name);
8567
8586
  }
8568
8587
  return { swept, failed };
@@ -8763,8 +8782,8 @@ function createReviewQueue(deps) {
8763
8782
  }
8764
8783
  }
8765
8784
  async function sweepNow() {
8766
- const run2 = deps.activity?.start("reviews", "Preparing PR reviews");
8767
- const note = (text, level = "info") => run2?.note(text, { level });
8785
+ const run = deps.activity?.start("reviews", "Preparing PR reviews");
8786
+ const note = (text, level = "info") => run?.note(text, { level });
8768
8787
  const { maxPerDay } = deps.limits();
8769
8788
  const asked = [];
8770
8789
  const open = /* @__PURE__ */ new Set();
@@ -8853,9 +8872,9 @@ function createReviewQueue(deps) {
8853
8872
  note(`${talk.length - DISCUSSIONS_PER_SWEEP} more discussions to read again: the next sweep`);
8854
8873
  if (read) note(`read the discussion of ${plural2(read, "PR")} again (moved on the host, or half an hour old)`);
8855
8874
  deps.changed();
8856
- run2?.done(todo.length ? `${plural2(todo.length, "PR")} looked at` : read ? `${plural2(read, "discussion")} read again` : "nothing new");
8875
+ run?.done(todo.length ? `${plural2(todo.length, "PR")} looked at` : read ? `${plural2(read, "discussion")} read again` : "nothing new");
8857
8876
  } catch (err) {
8858
- run2?.fail(err.message);
8877
+ run?.fail(err.message);
8859
8878
  }
8860
8879
  }
8861
8880
  return {
@@ -8873,11 +8892,11 @@ function createReviewQueue(deps) {
8873
8892
  if (!list.ok) return { ok: false, error: list.error };
8874
8893
  const pr = list.prs.find((p) => p.number === number);
8875
8894
  if (!pr) return { ok: false, error: `#${number} isn't an open pull request of ${repo}` };
8876
- const run2 = deps.activity?.start("reviews", `Preparing the review of ${repo} #${number}`);
8877
- const note = (text, level = "info") => run2?.note(text, { level });
8895
+ const run = deps.activity?.start("reviews", `Preparing the review of ${repo} #${number}`);
8896
+ const note = (text, level = "info") => run?.note(text, { level });
8878
8897
  const r = await oneAtATime3(() => prepareOne(project, metaOf(repo, host, pr), pr, false, note, also));
8879
- if (r.ok) run2?.done(`prepared${r.how ? `; ${r.how}` : ""}`);
8880
- else run2?.fail(r.error);
8898
+ if (r.ok) run?.done(`prepared${r.how ? `; ${r.how}` : ""}`);
8899
+ else run?.fail(r.error);
8881
8900
  return r.ok ? { ok: true, review: r.review } : { ok: false, error: r.error };
8882
8901
  },
8883
8902
  async refreshDiscussion(repo, number) {
@@ -8902,7 +8921,7 @@ function createReviewQueue(deps) {
8902
8921
  }
8903
8922
 
8904
8923
  // src/core/review/review-deps.ts
8905
- import fs15 from "fs";
8924
+ import fs16 from "fs";
8906
8925
  var AGENT_TIMEOUT_MS = 18e4;
8907
8926
  var CHECKOUT_AGENT_TIMEOUT_MS = 3e5;
8908
8927
  var TREE_SWEEP_MIN_AGE_MS = CHECKOUT_AGENT_TIMEOUT_MS + 5 * 6e4;
@@ -8985,7 +9004,7 @@ function realReviewRouteIo() {
8985
9004
  function realFixIo(opts) {
8986
9005
  return {
8987
9006
  lookUp: (r) => resolvePrToStart(r.url, loadConfig() ?? { repos: {}, groups: {} }, r.repo),
8988
- liveSessionOn: (alias, branch) => sessionOnBranch(loadHistory(), loadConfig(), alias, branch, { branchOf: checkedOutBranch, exists: (p) => fs15.existsSync(p) }),
9007
+ liveSessionOn: (alias, branch) => sessionOnBranch(loadHistory(), loadConfig(), alias, branch, { branchOf: checkedOutBranch, exists: (p) => fs16.existsSync(p) }),
8989
9008
  create: async (alias, branch, name) => {
8990
9009
  const config = loadConfig();
8991
9010
  if (!config) return { ok: false, error: "no config" };
@@ -9125,8 +9144,8 @@ function historyKey(session, others) {
9125
9144
  }
9126
9145
  async function sessionHistory(session, others = []) {
9127
9146
  const key = historyKey(session, others);
9128
- const cached2 = key ? historyCache.get(key) : void 0;
9129
- if (cached2) return cached2;
9147
+ const cached3 = key ? historyCache.get(key) : void 0;
9148
+ if (cached3) return cached3;
9130
9149
  const commits = [];
9131
9150
  const spans = [];
9132
9151
  for (const root of session.paths) {
@@ -9226,7 +9245,7 @@ import { zValidator as zValidator8 } from "@hono/zod-validator";
9226
9245
  import { z as z7 } from "zod";
9227
9246
 
9228
9247
  // src/core/diff/revert.ts
9229
- import fs16 from "fs";
9248
+ import fs17 from "fs";
9230
9249
  import path19 from "path";
9231
9250
  function inside(root, rel) {
9232
9251
  const abs = path19.resolve(root, rel);
@@ -9241,7 +9260,7 @@ function removeNew(root, rel) {
9241
9260
  const abs = inside(root, rel);
9242
9261
  if (!abs) return { ok: false, status: 400, error: `path escapes the worktree: ${rel}` };
9243
9262
  git(["rm", "--cached", "-q", "--ignore-unmatch", "--", rel], root);
9244
- fs16.rmSync(abs, { force: true });
9263
+ fs17.rmSync(abs, { force: true });
9245
9264
  return null;
9246
9265
  }
9247
9266
  function revertFile(root, file) {
@@ -9402,7 +9421,7 @@ function mountDevRoutes(app, opts) {
9402
9421
  }
9403
9422
 
9404
9423
  // src/server/routes/ci-routes.ts
9405
- import fs17 from "fs";
9424
+ import fs18 from "fs";
9406
9425
  var WAKE_PROMPT = NOTE_NUDGE;
9407
9426
  async function wakeForNote(id) {
9408
9427
  if (loadConfig()?.prWatch?.wakeClaude === false) return "off";
@@ -9423,7 +9442,7 @@ function mountCiRoutes(app, opts) {
9423
9442
  lookOnly: opts.lookOnly,
9424
9443
  sessions: () => {
9425
9444
  const now = Date.now();
9426
- return loadHistory().filter((s) => watchable(s, now, { exists: (p) => fs17.existsSync(p), lastWriteMs: lastConversationWriteMs })).map((session) => ({ id: sessionIdFor(session), session }));
9445
+ return loadHistory().filter((s) => watchable(s, now, { exists: (p) => fs18.existsSync(p), lastWriteMs: lastConversationWriteMs })).map((session) => ({ id: sessionIdFor(session), session }));
9427
9446
  },
9428
9447
  // Never-pushed branches can't have a PR: don't ask GitHub about them,
9429
9448
  // unless the watch already knows one (a merged PR whose branch is gone).
@@ -9487,8 +9506,8 @@ function mountCiRoutes(app, opts) {
9487
9506
  app.get("/api/sessions/:id/ci", async (c) => {
9488
9507
  const id = c.req.param("id");
9489
9508
  if (!findSession2(id)) return c.json({ error: "unknown session" }, 404);
9490
- const cached2 = watch.state(id);
9491
- if (cached2 && Date.now() - Date.parse(cached2.checkedAt) < FRESH_MS2) return c.json(cached2);
9509
+ const cached3 = watch.state(id);
9510
+ if (cached3 && Date.now() - Date.parse(cached3.checkedAt) < FRESH_MS2) return c.json(cached3);
9492
9511
  return c.json(await watch.refresh(id, { act: false }) ?? { checkedAt: (/* @__PURE__ */ new Date()).toISOString(), repos: [] });
9493
9512
  });
9494
9513
  app.post("/api/sessions/:id/ci/fix", async (c) => {
@@ -9502,7 +9521,7 @@ function mountCiRoutes(app, opts) {
9502
9521
  }
9503
9522
 
9504
9523
  // src/core/diff/diffs-sweep.ts
9505
- import fs18 from "fs";
9524
+ import fs19 from "fs";
9506
9525
  import path21 from "path";
9507
9526
  var SWEEP_AFTER_DAYS = 30;
9508
9527
  var DISPOSABLE = /\.(html|log)$/i;
@@ -9512,7 +9531,7 @@ function sweepOldDiffArtifacts(now = Date.now(), maxAgeDays = SWEEP_AFTER_DAYS,
9512
9531
  let bytes = 0;
9513
9532
  let names;
9514
9533
  try {
9515
- names = fs18.readdirSync(dir);
9534
+ names = fs19.readdirSync(dir);
9516
9535
  } catch {
9517
9536
  return { removed, bytes };
9518
9537
  }
@@ -9520,9 +9539,9 @@ function sweepOldDiffArtifacts(now = Date.now(), maxAgeDays = SWEEP_AFTER_DAYS,
9520
9539
  if (!DISPOSABLE.test(name)) continue;
9521
9540
  const file = path21.join(dir, name);
9522
9541
  try {
9523
- const st = fs18.statSync(file);
9542
+ const st = fs19.statSync(file);
9524
9543
  if (!st.isFile() || st.mtimeMs >= cutoff) continue;
9525
- fs18.rmSync(file, { force: true });
9544
+ fs19.rmSync(file, { force: true });
9526
9545
  removed++;
9527
9546
  bytes += st.size;
9528
9547
  } catch {
@@ -9610,16 +9629,20 @@ function attachTerminalWs(httpServer, port, opts = {}) {
9610
9629
  return;
9611
9630
  }
9612
9631
  const sessionId = decodeURIComponent(match[1]);
9613
- const force = new URLSearchParams(match[2] ?? "").get("force") === "1";
9632
+ const params = new URLSearchParams(match[2] ?? "");
9633
+ const force = params.get("force") === "1";
9634
+ const flow = params.get(FLOW_PARAM) === "1";
9635
+ const grid = gridFromParams(params);
9636
+ const resume = resumeFromParams(params);
9614
9637
  wss.handleUpgrade(req, socket, head, (ws) => {
9615
- void bridgeToHost(ws, sessionId, force ? null : elsewhere(sessionId));
9638
+ void bridgeToHost(ws, sessionId, force || resume ? null : elsewhere(sessionId), flow, grid, resume);
9616
9639
  });
9617
9640
  });
9618
9641
  return {
9619
9642
  close: () => wss.close()
9620
9643
  };
9621
9644
  }
9622
- async function bridgeToHost(ws, sessionId, pending) {
9645
+ async function bridgeToHost(ws, sessionId, pending, flow = false, grid = null, resume = null) {
9623
9646
  const elsewhere = await pending;
9624
9647
  if (ws.readyState !== WebSocket.OPEN) return;
9625
9648
  if (elsewhere) {
@@ -9643,7 +9666,7 @@ async function bridgeToHost(ws, sessionId, pending) {
9643
9666
  ws.on("error", drop);
9644
9667
  let hostUrl;
9645
9668
  try {
9646
- hostUrl = await ensurePty(sessionId);
9669
+ hostUrl = await ensurePty(sessionId, { ...grid ? { grid } : {}, ...resume ? { attachOnly: true } : {} });
9647
9670
  } catch (err) {
9648
9671
  try {
9649
9672
  ws.send(JSON.stringify({ type: "error", message: err.message }));
@@ -9661,7 +9684,7 @@ async function bridgeToHost(ws, sessionId, pending) {
9661
9684
  return;
9662
9685
  }
9663
9686
  if (browserGone) return;
9664
- upstream = new WebSocket(hostUrl);
9687
+ upstream = new WebSocket(withResume(withGrid(flow ? withFlow(hostUrl) : hostUrl, grid), resume));
9665
9688
  const up = upstream;
9666
9689
  const queued = [];
9667
9690
  up.on("open", () => {
@@ -9947,9 +9970,9 @@ function mountAccountRoutes(app, opts) {
9947
9970
 
9948
9971
  // src/core/sessions/account-skills-child.ts
9949
9972
  var lastLine = (text) => text.split("\n").map((l) => l.trim()).filter(Boolean).pop() ?? "";
9950
- function accountSkillsInChild(workBin, run2 = runWorkChild) {
9973
+ function accountSkillsInChild(workBin, run = runWorkChild) {
9951
9974
  return async (name) => {
9952
- const r = await run2(workBin(), ["account", "skills", name], { timeoutMs: 5 * 6e4 });
9975
+ const r = await run(workBin(), ["account", "skills", name], { timeoutMs: 5 * 6e4 });
9953
9976
  if (r.spawnError) return { ok: false, message: `couldn't start work: ${r.spawnError}` };
9954
9977
  if (r.timedOut) return { ok: false, message: "installing work\u2019s skills took too long" };
9955
9978
  const said = lastLine(r.stdout) || lastLine(r.stderr);
@@ -10173,7 +10196,7 @@ async function startWebServer(opts = {}) {
10173
10196
  let activityWatcher = null;
10174
10197
  if (!lean) {
10175
10198
  try {
10176
- const roots = activityRoots().filter((r) => fs19.existsSync(r));
10199
+ const roots = activityRoots().filter((r) => fs20.existsSync(r));
10177
10200
  if (roots.length > 0) {
10178
10201
  activityWatcher = createFsWatcher({
10179
10202
  roots,
@@ -10231,8 +10254,8 @@ async function startWebServer(opts = {}) {
10231
10254
  const archivedRow = createArchivedRows();
10232
10255
  app.get("/api/sessions", (c) => {
10233
10256
  const withArchived = c.req.query("archived") === "1";
10234
- const cached2 = withArchived ? allSessionsCache : sessionsCache;
10235
- if (cached2 && Date.now() - cached2.at <= SESSIONS_TTL_MS) return c.json(cached2.body);
10257
+ const cached3 = withArchived ? allSessionsCache : sessionsCache;
10258
+ if (cached3 && Date.now() - cached3.at <= SESSIONS_TTL_MS) return c.json(cached3.body);
10236
10259
  {
10237
10260
  const history = loadHistory();
10238
10261
  const shadow = shadowedSessions(history, branchCheckedOut);
@@ -10400,12 +10423,12 @@ async function startWebServer(opts = {}) {
10400
10423
  busy: restartBusy,
10401
10424
  running: peekPty,
10402
10425
  report: (notes) => {
10403
- const run2 = activity.start("agents", "Restarting agents");
10426
+ const run = activity.start("agents", "Restarting agents");
10404
10427
  for (const { id, text, level } of notes) {
10405
10428
  const s = findSession2(id);
10406
- run2.note(`${s ? `${s.target} ${s.branch}` : id}: ${text}`, { level, sessionId: s ? id : void 0 });
10429
+ run.note(`${s ? `${s.target} ${s.branch}` : id}: ${text}`, { level, sessionId: s ? id : void 0 });
10407
10430
  }
10408
- run2.done(restartNotesSummary(notes));
10431
+ run.done(restartNotesSummary(notes));
10409
10432
  },
10410
10433
  changed: () => {
10411
10434
  broadcast("agents-changed", { ts: Date.now() });
@@ -10460,7 +10483,7 @@ async function startWebServer(opts = {}) {
10460
10483
  const minutes = loadConfig()?.sleepIdleAfterMinutes ?? DEFAULT_SLEEP_AFTER_MINUTES;
10461
10484
  if (sleepAfterMs(minutes) === 0)
10462
10485
  return activity.skip("idle-sleep", "Looking for idle Claudes", "turned off (sleepIdleAfterMinutes: 0)");
10463
- const run2 = activity.start("idle-sleep", "Looking for idle Claudes");
10486
+ const run = activity.start("idle-sleep", "Looking for idle Claudes");
10464
10487
  const ptys = await listHostPtys().catch(() => []);
10465
10488
  const quiet = new Set(sleepCandidates(ptys, Date.now(), sleepAfterMs(minutes), agentBusy));
10466
10489
  const plan = await sleepPlan(
@@ -10469,7 +10492,7 @@ async function startWebServer(opts = {}) {
10469
10492
  );
10470
10493
  for (const { id, why } of plan.awake) {
10471
10494
  const s = findSession2(id);
10472
- run2.note(`${s ? `${s.target} ${s.branch}` : id}: kept awake: ${why}`, { sessionId: s ? id : void 0 });
10495
+ run.note(`${s ? `${s.target} ${s.branch}` : id}: kept awake: ${why}`, { sessionId: s ? id : void 0 });
10473
10496
  }
10474
10497
  const ids = plan.sleep;
10475
10498
  for (const id of ids) {
@@ -10479,16 +10502,16 @@ async function startWebServer(opts = {}) {
10479
10502
  async () => {
10480
10503
  await markAgentStopped(id).catch(() => {
10481
10504
  });
10482
- run2.note(
10505
+ run.note(
10483
10506
  `${s ? `${s.target} ${s.branch}` : id}: put its Claude to sleep (printed nothing for ${sleepAfterMs(minutes) / 6e4} min, nothing attached; opening it resumes the conversation)`,
10484
10507
  { level: "action", sessionId: id }
10485
10508
  );
10486
10509
  },
10487
- (err) => run2.note(`${id}: couldn't stop its Claude: ${err.message}`, { level: "warn", sessionId: id })
10510
+ (err) => run.note(`${id}: couldn't stop its Claude: ${err.message}`, { level: "warn", sessionId: id })
10488
10511
  );
10489
10512
  }
10490
10513
  const slept = ids.length;
10491
- run2.done(`${ptys.length} Claude${ptys.length === 1 ? "" : "s"} running \xB7 ${slept ? `${slept} put to sleep` : "none idle long enough"}`);
10514
+ run.done(`${ptys.length} Claude${ptys.length === 1 ? "" : "s"} running \xB7 ${slept ? `${slept} put to sleep` : "none idle long enough"}`);
10492
10515
  if (ids.length) broadcast("sessions-changed", { ts: Date.now() });
10493
10516
  };
10494
10517
  sleepSchedule?.next(Date.now() + SLEEP_EVERY_MS);
@@ -10547,15 +10570,15 @@ async function startWebServer(opts = {}) {
10547
10570
  const archiveUpkeep = () => {
10548
10571
  retentionSchedule?.next(Date.now() + RETENTION_EVERY_MS);
10549
10572
  const cfg = loadConfig()?.archive;
10550
- const run2 = activity.start("archive", "Compressing old archived conversations");
10573
+ const run = activity.start("archive", "Compressing old archived conversations");
10551
10574
  try {
10552
10575
  const r = applyArchiveRetention({ compressAfterDays: cfg?.compressAfterDays, dropAfterDays: cfg?.dropTranscriptsAfterDays });
10553
10576
  const mb = Math.round(r.bytesSaved / 1e6);
10554
- run2.done(
10577
+ run.done(
10555
10578
  r.compressed.length || r.dropped.length ? `${r.compressed.length} compressed${r.dropped.length ? `, ${r.dropped.length} conversations deleted (config)` : ""} \xB7 ${mb} MB freed` : "nothing old enough"
10556
10579
  );
10557
10580
  } catch (err) {
10558
- run2.fail(err.message);
10581
+ run.fail(err.message);
10559
10582
  }
10560
10583
  };
10561
10584
  const retentionFirst = !jobs ? null : setTimeout(archiveUpkeep, 3 * 6e4);
@@ -10571,18 +10594,18 @@ async function startWebServer(opts = {}) {
10571
10594
  conversationsSchedule?.next(Date.now() + CONVERSATIONS_EVERY_MS);
10572
10595
  if (conversationsBusy) return;
10573
10596
  conversationsBusy = true;
10574
- const run2 = activity.start("conversations", "Copying new conversation lines");
10597
+ const run = activity.start("conversations", "Copying new conversation lines");
10575
10598
  try {
10576
10599
  const r = await syncConversations(loadHistory().filter((s) => !s.archivedAt));
10577
10600
  const packed = await compressQuietCopies();
10578
- run2.done(
10601
+ run.done(
10579
10602
  [
10580
10603
  r.files ? `${r.sessions} session${r.sessions === 1 ? "" : "s"} \xB7 ${r.files} transcript${r.files === 1 ? "" : "s"} \xB7 ${Math.round(r.bytes / 1e3)} KB copied` : "all up to date",
10581
10604
  packed.files ? `${packed.files} quiet one${packed.files === 1 ? "" : "s"} compressed \xB7 ${Math.round(packed.bytesSaved / 1e6)} MB freed` : ""
10582
10605
  ].filter(Boolean).join(" \xB7 ")
10583
10606
  );
10584
10607
  } catch (err) {
10585
- run2.fail(err.message);
10608
+ run.fail(err.message);
10586
10609
  } finally {
10587
10610
  conversationsBusy = false;
10588
10611
  }
@@ -10648,7 +10671,7 @@ async function startWebServer(opts = {}) {
10648
10671
  blocksSchedule?.next(Date.now() + BLOCKS_EVERY_MS);
10649
10672
  if (blocksBusy || allBlocks().size === 0) return;
10650
10673
  blocksBusy = true;
10651
- const run2 = activity.start("blocks", "Checking what sessions wait on");
10674
+ const run = activity.start("blocks", "Checking what sessions wait on");
10652
10675
  try {
10653
10676
  const history = loadHistory();
10654
10677
  const live = new Set(history.filter((x) => !x.archivedAt).map((x) => sessionIdFor(x)));
@@ -10660,7 +10683,7 @@ async function startWebServer(opts = {}) {
10660
10683
  const r = await blockedPrState(url, defaultRunner);
10661
10684
  if (r && "rateLimited" in r) {
10662
10685
  ghRestUntil = Date.now() + 10 * 6e4;
10663
- run2.note(`${r.host} API limit reached: resting 10 minutes`, { level: "warn" });
10686
+ run.note(`${r.host} API limit reached: resting 10 minutes`, { level: "warn" });
10664
10687
  return null;
10665
10688
  }
10666
10689
  return r?.state ?? null;
@@ -10668,7 +10691,7 @@ async function startWebServer(opts = {}) {
10668
10691
  unblocked: async (id, done) => {
10669
10692
  const s = history.find((x) => sessionIdFor(x) === id);
10670
10693
  const name = s ? `${s.target} \xB7 ${s.branch}` : id;
10671
- run2.note(`${name}: no longer waiting (${done.map((b) => b.label).join(", ")})`, { sessionId: id });
10694
+ run.note(`${name}: no longer waiting (${done.map((b) => b.label).join(", ")})`, { sessionId: id });
10672
10695
  const event = {
10673
10696
  sessionId: id,
10674
10697
  kind: "unblocked",
@@ -10680,10 +10703,10 @@ async function startWebServer(opts = {}) {
10680
10703
  if (s) await stackDeps.tell(s, unblockedPrompt(done)).catch((err) => logSwallowed(`telling ${name} it is unblocked`, err));
10681
10704
  }
10682
10705
  });
10683
- run2.done(freed.length ? `${freed.length} unblocked` : "still waiting");
10706
+ run.done(freed.length ? `${freed.length} unblocked` : "still waiting");
10684
10707
  if (freed.length) broadcast("sessions-changed", { ts: Date.now() });
10685
10708
  } catch (err) {
10686
- run2.fail(err.message);
10709
+ run.fail(err.message);
10687
10710
  } finally {
10688
10711
  blocksBusy = false;
10689
10712
  }
@@ -10694,18 +10717,18 @@ async function startWebServer(opts = {}) {
10694
10717
  leftoversSchedule?.next(Date.now() + LEFTOVERS_EVERY_MS);
10695
10718
  if (leftoversBusy) return;
10696
10719
  leftoversBusy = true;
10697
- const run2 = activity.start("processes", "Looking for processes left running");
10720
+ const run = activity.start("processes", "Looking for processes left running");
10698
10721
  try {
10699
10722
  const found2 = await sweepLeftovers({
10700
10723
  sessions: () => loadHistory().filter((x) => !x.archivedAt).map((x) => ({ id: sessionIdFor(x), name: `${x.target} \xB7 ${x.branch}`, paths: x.paths })),
10701
10724
  list: () => listProcessUsage(),
10702
10725
  agentPid: ptyPid,
10703
- note: (text, o) => run2.note(text, o)
10726
+ note: (text, o) => run.note(text, o)
10704
10727
  });
10705
- if (found2) run2.done(leftoverSummary(found2));
10706
- else run2.fail(leftoverSummary(found2));
10728
+ if (found2) run.done(leftoverSummary(found2));
10729
+ else run.fail(leftoverSummary(found2));
10707
10730
  } catch (err) {
10708
- run2.fail(err.message);
10731
+ run.fail(err.message);
10709
10732
  } finally {
10710
10733
  leftoversBusy = false;
10711
10734
  }
@@ -10752,7 +10775,7 @@ async function startWebServer(opts = {}) {
10752
10775
  scopeApi = mountScopeRoutes(app, { broadcast });
10753
10776
  mountTerminalRoutes(app, {
10754
10777
  elsewhere: defaultElsewhere,
10755
- ensure: (id) => ensurePty(id),
10778
+ ensure: (id, grid, attachOnly) => ensurePty(id, { grid, attachOnly }),
10756
10779
  ticket: terminalTicketUrl,
10757
10780
  log: (line) => debugLog("INFO", line)
10758
10781
  });
@@ -10826,7 +10849,7 @@ async function startWebServer(opts = {}) {
10826
10849
  inTree: (s, names) => localTreeRun(s.paths, names, {
10827
10850
  readOnly: internalReadOnly,
10828
10851
  run: (prompt, cwd, deny) => runInternalReadOnly(prompt, cwd, LOCAL_TREE_TIMEOUT_MS, { lane: "localReviews", deny }),
10829
- exists: (dir) => fs19.existsSync(dir)
10852
+ exists: (dir) => fs20.existsSync(dir)
10830
10853
  }),
10831
10854
  rules: () => rulesWith(loadConfig()?.reviews?.rules),
10832
10855
  // Its project's and each of its repos' own points, with the ones for every review.
@@ -10866,7 +10889,7 @@ async function startWebServer(opts = {}) {
10866
10889
  updatesTimer?.unref?.();
10867
10890
  const desktopFile = desktopUpdatePath();
10868
10891
  const onDesktopUpdate = () => broadcast("updates-changed", { ts: Date.now() });
10869
- if (jobs) fs19.watchFile(desktopFile, { interval: 3e3 }, onDesktopUpdate);
10892
+ if (jobs) fs20.watchFile(desktopFile, { interval: 3e3 }, onDesktopUpdate);
10870
10893
  const usageWatcher = wireUsage(app, {
10871
10894
  broadcast,
10872
10895
  build: () => buildUsage(realUsageDeps()),
@@ -10947,7 +10970,7 @@ async function startWebServer(opts = {}) {
10947
10970
  if (timeFirst) clearTimeout(timeFirst);
10948
10971
  if (timeTimer) clearInterval(timeTimer);
10949
10972
  timeKeeper?.stop();
10950
- fs19.unwatchFile(desktopFile, onDesktopUpdate);
10973
+ fs20.unwatchFile(desktopFile, onDesktopUpdate);
10951
10974
  usageWatcher.stop();
10952
10975
  for (const t of conversationSyncs.values()) clearTimeout(t);
10953
10976
  clearTimeout(sweepTimer);
@@ -11011,7 +11034,7 @@ async function settleAgentHooks(io) {
11011
11034
  }
11012
11035
 
11013
11036
  // src/core/platform/autostart.ts
11014
- import fs20 from "fs";
11037
+ import fs21 from "fs";
11015
11038
  import path23 from "path";
11016
11039
  function startupScriptPath() {
11017
11040
  if (process.platform !== "win32" || !process.env.APPDATA) return null;
@@ -11033,11 +11056,11 @@ function setAutostart(enabled, workBin) {
11033
11056
  const file = startupScriptPath();
11034
11057
  if (!file) throw new Error("Autostart is only supported on Windows so far.");
11035
11058
  if (enabled) {
11036
- fs20.mkdirSync(path23.dirname(file), { recursive: true });
11037
- fs20.writeFileSync(file, buildStartupScript(process.execPath, workBin), "utf-8");
11059
+ fs21.mkdirSync(path23.dirname(file), { recursive: true });
11060
+ fs21.writeFileSync(file, buildStartupScript(process.execPath, workBin), "utf-8");
11038
11061
  } else {
11039
11062
  try {
11040
- fs20.unlinkSync(file);
11063
+ fs21.unlinkSync(file);
11041
11064
  } catch {
11042
11065
  }
11043
11066
  }
@@ -11380,12 +11403,12 @@ function mountDemoReviews(app, broadcast, sessions = noSessions) {
11380
11403
  });
11381
11404
  const key = (repo, n) => `${repo}#${n}`;
11382
11405
  const store = {
11383
- read: (rp, num4) => reviews.get(key(rp, String(num4))) ?? null,
11384
- update: (rp, num4, change) => {
11385
- const was = reviews.get(key(rp, String(num4)));
11406
+ read: (rp, num3) => reviews.get(key(rp, String(num3))) ?? null,
11407
+ update: (rp, num3, change) => {
11408
+ const was = reviews.get(key(rp, String(num3)));
11386
11409
  if (!was) return null;
11387
11410
  const next = change(was);
11388
- reviews.set(key(rp, String(num4)), next);
11411
+ reviews.set(key(rp, String(num3)), next);
11389
11412
  return next;
11390
11413
  },
11391
11414
  pid: 0,
@@ -11449,7 +11472,7 @@ function mountDemoReviews(app, broadcast, sessions = noSessions) {
11449
11472
  {
11450
11473
  ...store,
11451
11474
  repoPath: (alias) => alias === "api" ? "/demo/api" : null,
11452
- submit: async (_at, num4, review) => demoHostSubmit(reviews.get(key(repo, String(num4)))?.url ?? "", review)
11475
+ submit: async (_at, num3, review) => demoHostSubmit(reviews.get(key(repo, String(num3)))?.url ?? "", review)
11453
11476
  },
11454
11477
  repo,
11455
11478
  n,
@@ -12022,8 +12045,8 @@ var DemoScenario = class {
12022
12045
  this.pending = this.pending.filter((p) => !ready.includes(p));
12023
12046
  for (const p of ready) p.run();
12024
12047
  }
12025
- after(ms, run2) {
12026
- this.pending.push({ at: this.now() + ms * this.speed, run: run2 });
12048
+ after(ms, run) {
12049
+ this.pending.push({ at: this.now() + ms * this.speed, run });
12027
12050
  }
12028
12051
  // -- seed -----------------------------------------------------------------
12029
12052
  iso(minutesAgo) {
@@ -13561,8 +13584,8 @@ function createDemoActivity(scenario, emit) {
13561
13584
  const sweep = () => {
13562
13585
  prCheck.next(Date.now() + SWEEP_EVERY_MS);
13563
13586
  const sessions = scenario.list().filter((s) => !s.archivedAt);
13564
- const run2 = log.start("pr-watch", "Checking pull requests");
13565
- run2.progress(0, sessions.length);
13587
+ const run = log.start("pr-watch", "Checking pull requests");
13588
+ run.progress(0, sessions.length);
13566
13589
  let prs = 0;
13567
13590
  let threads = 0;
13568
13591
  let failing = 0;
@@ -13574,24 +13597,24 @@ function createDemoActivity(scenario, emit) {
13574
13597
  threads += r.openThreads ?? 0;
13575
13598
  if (r.pr.checks === "fail") {
13576
13599
  failing++;
13577
- run2.note(
13600
+ run.note(
13578
13601
  `${s.target} ${s.branch}: checks fail on #${r.pr.number} (${(r.pr.failing ?? []).map((f) => f.name).join(", ")}): already told its Claude`,
13579
13602
  { sessionId: s.id }
13580
13603
  );
13581
13604
  }
13582
13605
  if (r.openThreads)
13583
- run2.note(`${s.target} ${s.branch}: ${r.openThreads} unresolved review threads on #${r.pr.number}`, { sessionId: s.id });
13606
+ run.note(`${s.target} ${s.branch}: ${r.openThreads} unresolved review threads on #${r.pr.number}`, { sessionId: s.id });
13584
13607
  }
13585
- run2.progress(i + 1, sessions.length);
13608
+ run.progress(i + 1, sessions.length);
13586
13609
  if (i === sessions.length - 1) {
13587
13610
  const parts = [`${sessions.length} sessions`, `${prs} open PRs`];
13588
13611
  if (threads) parts.push(`${threads} unresolved review threads`);
13589
13612
  if (failing) parts.push(`${failing} failing`);
13590
- run2.done(parts.join(" \xB7 "));
13613
+ run.done(parts.join(" \xB7 "));
13591
13614
  }
13592
13615
  });
13593
13616
  });
13594
- if (sessions.length === 0) run2.done("0 sessions");
13617
+ if (sessions.length === 0) run.done("0 sessions");
13595
13618
  };
13596
13619
  later(3e3, sweep);
13597
13620
  prCheck.next(Date.now() + 3e3);
@@ -14496,10 +14519,16 @@ async function startDemoServer(opts) {
14496
14519
  const next = p.section && !known2.has(p.section) ? applyPlacePatch(p, { section: null }) : p;
14497
14520
  if (next) places[id] = next;
14498
14521
  }
14499
- rail = { sections, places };
14522
+ rail = { ...rail, sections, places };
14500
14523
  railChanged();
14501
14524
  return c.json(railView());
14502
14525
  });
14526
+ app.put("/api/rail/view", async (c) => {
14527
+ const view = asRailView((await json2(c)).view);
14528
+ if (!view) return c.json({ error: "expected {view: mine|state|project}" }, 400);
14529
+ rail = { ...rail, view };
14530
+ return c.json(railView());
14531
+ });
14503
14532
  app.put("/api/sessions/:id/rail", async (c) => {
14504
14533
  const id = c.req.param("id");
14505
14534
  if (!scenario.list().some((x) => x.id === id)) return notFound(c);
@@ -14528,6 +14557,7 @@ async function startDemoServer(opts) {
14528
14557
  });
14529
14558
  app.post("/api/sessions/:id/agent/start", (c) => scenario.comments(c.req.param("id")) ? c.json({ how: "running" }) : notFound(c));
14530
14559
  app.post("/api/sessions/:id/agent/stop", (c) => scenario.comments(c.req.param("id")) ? c.json({ how: "stopped" }) : notFound(c));
14560
+ app.post("/api/sessions/:id/background/stop", (c) => scenario.comments(c.req.param("id")) ? c.json({ stopped: [] }) : notFound(c));
14531
14561
  app.get(
14532
14562
  "/api/sessions/:id/last-reply",
14533
14563
  (c) => scenario.comments(c.req.param("id")) ? c.json({ text: scenario.lastReply(c.req.param("id")) }) : notFound(c)
@@ -14995,7 +15025,7 @@ async function startDemoServer(opts) {
14995
15025
  tick.unref?.();
14996
15026
  const wss = new WebSocketServer2({ noServer: true });
14997
15027
  handle.httpServer.on("upgrade", (req, socket, head) => {
14998
- const m = (req.url ?? "").match(/^\/ws\/sessions\/([^/]+)\/terminal$/);
15028
+ const m = (req.url ?? "").match(/^\/ws\/sessions\/([^/?]+)\/terminal(?:\?.*)?$/);
14999
15029
  const reason = refuseReason({ method: "GET", upgrade: true, host: req.headers.host, origin: req.headers.origin }, handle.port);
15000
15030
  if (!m || reason) {
15001
15031
  socket.destroy();
@@ -15051,7 +15081,7 @@ async function startDemoServer(opts) {
15051
15081
  }
15052
15082
 
15053
15083
  // src/core/platform/web-life.ts
15054
- import fs21 from "fs";
15084
+ import fs22 from "fs";
15055
15085
  import path24 from "path";
15056
15086
  var lifePath = () => path24.join(getConfigDir(), "web-life.json");
15057
15087
  function isLife(v) {
@@ -15060,7 +15090,7 @@ function isLife(v) {
15060
15090
  }
15061
15091
  function readWebLife() {
15062
15092
  try {
15063
- const v = JSON.parse(fs21.readFileSync(lifePath(), "utf-8"));
15093
+ const v = JSON.parse(fs22.readFileSync(lifePath(), "utf-8"));
15064
15094
  return isLife(v) ? v : null;
15065
15095
  } catch {
15066
15096
  return null;
@@ -15426,4 +15456,4 @@ export {
15426
15456
  stopExisting,
15427
15457
  webCommand
15428
15458
  };
15429
- //# sourceMappingURL=web-EC3KKH6E.js.map
15459
+ //# sourceMappingURL=web-JAAXINIU.js.map