@moberg_hr/work-tree 2.22.5 → 2.23.1

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 (291) hide show
  1. package/dist/{account-J55P3HXH.js → account-O62WFR7C.js} +23 -20
  2. package/dist/{account-J55P3HXH.js.map → account-O62WFR7C.js.map} +1 -1
  3. package/dist/{add-repo-ALVEGU25.js → add-repo-FTAMMPVM.js} +13 -13
  4. package/dist/{answer-CI2SPQQL.js → answer-LKNMN2ZM.js} +11 -11
  5. package/dist/{attach-7LBIFBLX.js → attach-A3KA4YTK.js} +20 -17
  6. package/dist/{attach-7LBIFBLX.js.map → attach-A3KA4YTK.js.map} +1 -1
  7. package/dist/bin.js +4 -4
  8. package/dist/{block-TVIYWRJ5.js → block-3ZUFH2RO.js} +12 -12
  9. package/dist/{broadcast-GZNMZFOY.js → broadcast-I23BZI3R.js} +8 -8
  10. package/dist/{catchup-ZURJI6BF.js → catchup-G4EOJIZP.js} +13 -13
  11. package/dist/{child-K6YYF6MQ.js → child-MVNEFA2I.js} +11 -11
  12. package/dist/{chunk-ZTWZS5RK.js → chunk-24FQ5XXN.js} +3 -3
  13. package/dist/{chunk-D2SVBU7R.js → chunk-2FNYJEOH.js} +2 -2
  14. package/dist/{chunk-EEHPZMS3.js → chunk-2JLG65GB.js} +2 -2
  15. package/dist/{chunk-DC73NF67.js → chunk-2MJQTFTI.js} +3 -3
  16. package/dist/chunk-44QJVFOF.js +64 -0
  17. package/dist/chunk-44QJVFOF.js.map +1 -0
  18. package/dist/{chunk-7Q5PBXF6.js → chunk-4FN45EAF.js} +51 -10
  19. package/dist/chunk-4FN45EAF.js.map +1 -0
  20. package/dist/{chunk-G4T2HGLJ.js → chunk-4HQEYZIM.js} +4 -4
  21. package/dist/{chunk-WRDULHAN.js → chunk-5QENUGSC.js} +117 -16
  22. package/dist/chunk-5QENUGSC.js.map +1 -0
  23. package/dist/{chunk-CA56ETYX.js → chunk-5SXTMOO6.js} +5 -5
  24. package/dist/chunk-6KMG4WNW.js +87 -0
  25. package/dist/chunk-6KMG4WNW.js.map +1 -0
  26. package/dist/{chunk-OCUUM755.js → chunk-6PZ7RCXK.js} +2 -2
  27. package/dist/{chunk-RTCTD5PJ.js → chunk-773UJC5C.js} +4 -4
  28. package/dist/{chunk-W4GDPHIF.js → chunk-7ZATXG5F.js} +2 -2
  29. package/dist/{chunk-PTAG6WIE.js → chunk-APHVSSLI.js} +17 -3
  30. package/dist/chunk-APHVSSLI.js.map +1 -0
  31. package/dist/chunk-BCYBF7KJ.js +207 -0
  32. package/dist/chunk-BCYBF7KJ.js.map +1 -0
  33. package/dist/{chunk-6Y3VLCKA.js → chunk-BI7HIO2I.js} +3 -3
  34. package/dist/{chunk-FGBLFF4O.js → chunk-BMPTUIP4.js} +2 -2
  35. package/dist/{chunk-VQDE3DRG.js → chunk-DHZ5DF6Y.js} +6 -2
  36. package/dist/{chunk-VQDE3DRG.js.map → chunk-DHZ5DF6Y.js.map} +1 -1
  37. package/dist/{chunk-BQS73CWR.js → chunk-ET5K6S5H.js} +2 -2
  38. package/dist/{chunk-B2WV5RAL.js → chunk-ETAPX4JN.js} +5 -5
  39. package/dist/{chunk-3ZPVKUYD.js → chunk-ETWP7MDS.js} +7 -1
  40. package/dist/chunk-ETWP7MDS.js.map +1 -0
  41. package/dist/{chunk-RLPC3YKZ.js → chunk-FHC6KHIH.js} +2 -2
  42. package/dist/{chunk-DF4GOVDE.js → chunk-GF7RAQFD.js} +2 -2
  43. package/dist/{chunk-ZO7TF5OL.js → chunk-GHY7GZWN.js} +4 -4
  44. package/dist/{chunk-5FIUVBUC.js → chunk-GN7EAXHU.js} +7 -7
  45. package/dist/{chunk-EYJ42LDG.js → chunk-GTFMUWK6.js} +4 -4
  46. package/dist/{chunk-4QMWNAEJ.js → chunk-HCYES6U7.js} +2 -2
  47. package/dist/{chunk-TOMDOA4P.js → chunk-HNZ736XN.js} +2 -2
  48. package/dist/{chunk-ATQB6PTV.js → chunk-HPUD5IGB.js} +3 -3
  49. package/dist/{chunk-FV7BSQPQ.js → chunk-HQDQRC4F.js} +2 -2
  50. package/dist/{chunk-AITL3JYB.js → chunk-HUWWMTNG.js} +399 -69
  51. package/dist/chunk-HUWWMTNG.js.map +1 -0
  52. package/dist/{chunk-SDYY5MHW.js → chunk-INXHVNMZ.js} +7 -7
  53. package/dist/{chunk-QNOJOZYK.js → chunk-IRDWXDID.js} +2 -2
  54. package/dist/{chunk-EA4C6TVY.js → chunk-IVS2MAHD.js} +3 -3
  55. package/dist/{chunk-QOLHDDM2.js → chunk-IXC6EXVJ.js} +4 -4
  56. package/dist/{chunk-IU6LA6EB.js → chunk-IXZOZZGD.js} +4 -4
  57. package/dist/{chunk-SZAD5U3J.js → chunk-LB2GAU7E.js} +2 -2
  58. package/dist/{chunk-VHENFC2S.js → chunk-M2X6OHHR.js} +14 -1
  59. package/dist/chunk-M2X6OHHR.js.map +1 -0
  60. package/dist/{chunk-23QLXVH6.js → chunk-MQXMYVZV.js} +12 -14
  61. package/dist/{chunk-23QLXVH6.js.map → chunk-MQXMYVZV.js.map} +1 -1
  62. package/dist/{chunk-GNERWNZY.js → chunk-MVBBESXK.js} +4 -4
  63. package/dist/{chunk-AIYZJ7XD.js → chunk-N7T6NPE2.js} +5 -5
  64. package/dist/{chunk-GQ5WECPJ.js → chunk-NREZVTBP.js} +3 -3
  65. package/dist/chunk-NRX5V443.js +9 -0
  66. package/dist/{chunk-USENBMUV.js → chunk-NS7WH53I.js} +1 -1
  67. package/dist/chunk-NS7WH53I.js.map +1 -0
  68. package/dist/{chunk-KQMHGEI2.js → chunk-NWKVTUTN.js} +53 -15
  69. package/dist/chunk-NWKVTUTN.js.map +1 -0
  70. package/dist/chunk-NXS53NHR.js +79 -0
  71. package/dist/chunk-NXS53NHR.js.map +1 -0
  72. package/dist/{chunk-NYGKSOQ4.js → chunk-OPV6BE3W.js} +6 -6
  73. package/dist/{chunk-UAF2YFLZ.js → chunk-ROEEXEN7.js} +6 -6
  74. package/dist/{chunk-F4UIKOU6.js → chunk-TL7VLRRF.js} +4 -4
  75. package/dist/{chunk-NOQA7MJ4.js → chunk-U2A2DHWP.js} +3 -3
  76. package/dist/{chunk-Q2B3NUSM.js → chunk-U4XSBYQW.js} +4 -4
  77. package/dist/{chunk-Z4FWXDJG.js → chunk-VH5FRKJM.js} +3 -3
  78. package/dist/{chunk-DCENKA6E.js → chunk-W5YYTITQ.js} +2 -2
  79. package/dist/{chunk-5P27YL64.js → chunk-WOY35FXP.js} +8 -8
  80. package/dist/{chunk-HI674QZF.js → chunk-XIN6XUFL.js} +2 -2
  81. package/dist/{chunk-KU3TQAA7.js → chunk-XTAYJDL2.js} +8 -10
  82. package/dist/{chunk-KU3TQAA7.js.map → chunk-XTAYJDL2.js.map} +1 -1
  83. package/dist/{chunk-EVTMZ5IH.js → chunk-XWKN2HJD.js} +60 -60
  84. package/dist/{chunk-CMRTNTMU.js → chunk-YKTJL4SW.js} +6 -6
  85. package/dist/{chunk-RNPNBGVX.js → chunk-ZG6HB4BO.js} +3 -5
  86. package/dist/{chunk-RNPNBGVX.js.map → chunk-ZG6HB4BO.js.map} +1 -1
  87. package/dist/{chunk-PUJSLL6R.js → chunk-ZLPK2LQ3.js} +5 -5
  88. package/dist/{chunk-LV5JRLBM.js → chunk-ZMJR4Z6O.js} +17 -7
  89. package/dist/chunk-ZMJR4Z6O.js.map +1 -0
  90. package/dist/{chunk-YO3BNAAK.js → chunk-ZNRPBP5O.js} +27 -5
  91. package/dist/chunk-ZNRPBP5O.js.map +1 -0
  92. package/dist/{chunk-Z4P23XG3.js → chunk-ZX4ONO5Y.js} +5 -5
  93. package/dist/{cleanup-G4WQACD6.js → cleanup-ANVUCOBK.js} +32 -31
  94. package/dist/{cleanup-G4WQACD6.js.map → cleanup-ANVUCOBK.js.map} +1 -1
  95. package/dist/{cli-OPORB5PF.js → cli-CAF6VCVO.js} +4 -4
  96. package/dist/{color-C223W3Z6.js → color-7CQNI6Y4.js} +11 -11
  97. package/dist/{config-KQYXQCQA.js → config-EXQY26W4.js} +10 -10
  98. package/dist/{coordinate-4E5GIMC6.js → coordinate-LRY7LXS6.js} +11 -11
  99. package/dist/{diff-HEOLTXO2.js → diff-JRK3AUD5.js} +12 -13
  100. package/dist/{diff-HEOLTXO2.js.map → diff-JRK3AUD5.js.map} +1 -1
  101. package/dist/{digest-GYF4YLUH.js → digest-2AFW3WBL.js} +11 -11
  102. package/dist/{fork-B35ONP3Z.js → fork-DSNMPWUE.js} +29 -26
  103. package/dist/{fork-B35ONP3Z.js.map → fork-DSNMPWUE.js.map} +1 -1
  104. package/dist/{history-25DNQKKC.js → history-RFIDCGQY.js} +8 -8
  105. package/dist/{hook-B4JO2X57.js → hook-XBALB337.js} +20 -20
  106. package/dist/{hydrate-IJEKNZIP.js → hydrate-DAEY4PB6.js} +8 -8
  107. package/dist/{init-UJVOUDJI.js → init-4BK3T34W.js} +12 -12
  108. package/dist/{install-skills-FV2L5QHE.js → install-skills-TL5D7HZU.js} +8 -9
  109. package/dist/install-skills-bin.js +7 -8
  110. package/dist/install-skills-bin.js.map +1 -1
  111. package/dist/{keep-PKXGFZO2.js → keep-57TUKADV.js} +10 -10
  112. package/dist/{list-VYQ3QE2H.js → list-DRQRIT6U.js} +8 -8
  113. package/dist/{move-IAZY23ZX.js → move-UEHJ375P.js} +16 -16
  114. package/dist/{note-6HQUKUYY.js → note-FHPDVBRI.js} +10 -10
  115. package/dist/{overlaps-CGP3RJOW.js → overlaps-GKAKEUB6.js} +13 -13
  116. package/dist/{pin-PAWGQ4Q2.js → pin-CFTQDPPC.js} +11 -11
  117. package/dist/{pr-OJOGE3A3.js → pr-ZP4COZEZ.js} +22 -21
  118. package/dist/{pr-OJOGE3A3.js.map → pr-ZP4COZEZ.js.map} +1 -1
  119. package/dist/{prune-42MS36OR.js → prune-IQB2T45B.js} +29 -29
  120. package/dist/pty-host-BPFGJFBC.js +2658 -0
  121. package/dist/pty-host-BPFGJFBC.js.map +1 -0
  122. package/dist/{read-ATNCW4KH.js → read-DHJ6VY44.js} +10 -10
  123. package/dist/{recent-MTBFQT36.js → recent-OZW2ZNJ4.js} +16 -15
  124. package/dist/{recent-MTBFQT36.js.map → recent-OZW2ZNJ4.js.map} +1 -1
  125. package/dist/{remove-GLDJOKUI.js → remove-MW25RLNV.js} +30 -30
  126. package/dist/{report-AK7Z2Y4S.js → report-II75EKM6.js} +11 -11
  127. package/dist/{restart-DEPDGEZB.js → restart-4BGVRBX6.js} +11 -11
  128. package/dist/{resume-C2QPKKFN.js → resume-4J53KDCO.js} +16 -15
  129. package/dist/{resume-C2QPKKFN.js.map → resume-4J53KDCO.js.map} +1 -1
  130. package/dist/{review-RYAGH3PY.js → review-WKB3K6LI.js} +10 -10
  131. package/dist/{review-now-K4UWD7A5.js → review-now-AT2SPPRO.js} +2 -2
  132. package/dist/{run-WNP2SMNW.js → run-YS2D7WAQ.js} +8 -8
  133. package/dist/{screen-P746M4F2.js → screen-VVRNQXVW.js} +11 -11
  134. package/dist/{search-XQ2WMK5X.js → search-MKYCKZF4.js} +8 -8
  135. package/dist/{section-Q7TPOV7U.js → section-Y6RDD3MN.js} +11 -11
  136. package/dist/{send-EGG23J2B.js → send-AZM2XKN2.js} +12 -12
  137. package/dist/{sessions-2NNCWIND.js → sessions-OER6VNQJ.js} +26 -24
  138. package/dist/{sessions-2NNCWIND.js.map → sessions-OER6VNQJ.js.map} +1 -1
  139. package/dist/{show-KSMC7AJL.js → show-33VV3XCF.js} +10 -10
  140. package/dist/{snooze-4LVYUQEX.js → snooze-OFYZVVYS.js} +10 -10
  141. package/dist/{start-YKLLXW3L.js → start-OEQ5VW7Y.js} +11 -11
  142. package/dist/{state-GM22X3RN.js → state-HK67C4UA.js} +3 -3
  143. package/dist/state-HK67C4UA.js.map +1 -0
  144. package/dist/{status-4HGP4ZEF.js → status-HPYMNO2T.js} +11 -11
  145. package/dist/{statusline-QJ6CJGHB.js → statusline-Z5HLKDIA.js} +5 -5
  146. package/dist/{statusline-hook-Q645N4XF.js → statusline-hook-VPPS3PFO.js} +3 -3
  147. package/dist/{stop-YBQL6NFF.js → stop-QNICDWAU.js} +11 -11
  148. package/dist/{sync-DUXN2MFJ.js → sync-RH3M47QK.js} +29 -29
  149. package/dist/{time-Q42HPZZ3.js → time-PM72GK5W.js} +11 -11
  150. package/dist/{time-actions-IXZRVKKQ.js → time-actions-O3MCB7FU.js} +3 -3
  151. package/dist/{timesheet-YJ6O3GUU.js → timesheet-HJXQ4KHL.js} +15 -15
  152. package/dist/{todo-ZBFRL2A5.js → todo-UVKGOG7D.js} +2 -2
  153. package/dist/{tree-H2UYE6LH.js → tree-RGT736E3.js} +30 -28
  154. package/dist/{tree-H2UYE6LH.js.map → tree-RGT736E3.js.map} +1 -1
  155. package/dist/{update-RGNKMRUL.js → update-CMYVBWV3.js} +15 -15
  156. package/dist/{usage-YZRZKJ3H.js → usage-VEKD3JPL.js} +10 -10
  157. package/dist/{usage-ask-BYPNLA2B.js → usage-ask-V2SIRW4F.js} +3 -3
  158. package/dist/{version-4IOMOIDP.js → version-RJ4PCHPB.js} +5 -5
  159. package/dist/{wait-YOHPFWVJ.js → wait-RQZU3KDY.js} +11 -11
  160. package/dist/wd-bin.js +3 -3
  161. package/dist/web/assets/{PtyView-CYAhB_pW.js → PtyView-qP6blm2-.js} +26 -28
  162. package/dist/web/assets/PtyView-qP6blm2-.js.map +1 -0
  163. package/dist/web/assets/index-DuFRboh6.js +129 -0
  164. package/dist/web/assets/index-DuFRboh6.js.map +1 -0
  165. package/dist/web/assets/index-yBTfBzDm.css +1 -0
  166. package/dist/web/index.html +2 -2
  167. package/dist/{web-Q672AIMZ.js → web-GOCU26ZD.js} +617 -526
  168. package/dist/web-GOCU26ZD.js.map +1 -0
  169. package/npm-shrinkwrap.json +3 -4
  170. package/package.json +2 -2
  171. package/dist/chunk-3ZPVKUYD.js.map +0 -1
  172. package/dist/chunk-7Q5PBXF6.js.map +0 -1
  173. package/dist/chunk-7ZOY2QQN.js +0 -43
  174. package/dist/chunk-7ZOY2QQN.js.map +0 -1
  175. package/dist/chunk-AITL3JYB.js.map +0 -1
  176. package/dist/chunk-EXZ4A6VJ.js +0 -9
  177. package/dist/chunk-ICEP4WAK.js +0 -256
  178. package/dist/chunk-ICEP4WAK.js.map +0 -1
  179. package/dist/chunk-KQMHGEI2.js.map +0 -1
  180. package/dist/chunk-LNHSBM4L.js +0 -26
  181. package/dist/chunk-LNHSBM4L.js.map +0 -1
  182. package/dist/chunk-LV5JRLBM.js.map +0 -1
  183. package/dist/chunk-PTAG6WIE.js.map +0 -1
  184. package/dist/chunk-USENBMUV.js.map +0 -1
  185. package/dist/chunk-VHENFC2S.js.map +0 -1
  186. package/dist/chunk-WRDULHAN.js.map +0 -1
  187. package/dist/chunk-YO3BNAAK.js.map +0 -1
  188. package/dist/pty-host-EAWW62U4.js +0 -1235
  189. package/dist/pty-host-EAWW62U4.js.map +0 -1
  190. package/dist/state-GM22X3RN.js.map +0 -1
  191. package/dist/web/assets/PtyView-CYAhB_pW.js.map +0 -1
  192. package/dist/web/assets/index-Ca7KbCED.css +0 -1
  193. package/dist/web/assets/index-iBmmgBZv.js +0 -129
  194. package/dist/web/assets/index-iBmmgBZv.js.map +0 -1
  195. package/dist/web-Q672AIMZ.js.map +0 -1
  196. /package/dist/{add-repo-ALVEGU25.js.map → add-repo-FTAMMPVM.js.map} +0 -0
  197. /package/dist/{answer-CI2SPQQL.js.map → answer-LKNMN2ZM.js.map} +0 -0
  198. /package/dist/{block-TVIYWRJ5.js.map → block-3ZUFH2RO.js.map} +0 -0
  199. /package/dist/{broadcast-GZNMZFOY.js.map → broadcast-I23BZI3R.js.map} +0 -0
  200. /package/dist/{catchup-ZURJI6BF.js.map → catchup-G4EOJIZP.js.map} +0 -0
  201. /package/dist/{child-K6YYF6MQ.js.map → child-MVNEFA2I.js.map} +0 -0
  202. /package/dist/{chunk-ZTWZS5RK.js.map → chunk-24FQ5XXN.js.map} +0 -0
  203. /package/dist/{chunk-D2SVBU7R.js.map → chunk-2FNYJEOH.js.map} +0 -0
  204. /package/dist/{chunk-EEHPZMS3.js.map → chunk-2JLG65GB.js.map} +0 -0
  205. /package/dist/{chunk-DC73NF67.js.map → chunk-2MJQTFTI.js.map} +0 -0
  206. /package/dist/{chunk-G4T2HGLJ.js.map → chunk-4HQEYZIM.js.map} +0 -0
  207. /package/dist/{chunk-CA56ETYX.js.map → chunk-5SXTMOO6.js.map} +0 -0
  208. /package/dist/{chunk-OCUUM755.js.map → chunk-6PZ7RCXK.js.map} +0 -0
  209. /package/dist/{chunk-RTCTD5PJ.js.map → chunk-773UJC5C.js.map} +0 -0
  210. /package/dist/{chunk-W4GDPHIF.js.map → chunk-7ZATXG5F.js.map} +0 -0
  211. /package/dist/{chunk-6Y3VLCKA.js.map → chunk-BI7HIO2I.js.map} +0 -0
  212. /package/dist/{chunk-FGBLFF4O.js.map → chunk-BMPTUIP4.js.map} +0 -0
  213. /package/dist/{chunk-BQS73CWR.js.map → chunk-ET5K6S5H.js.map} +0 -0
  214. /package/dist/{chunk-B2WV5RAL.js.map → chunk-ETAPX4JN.js.map} +0 -0
  215. /package/dist/{chunk-RLPC3YKZ.js.map → chunk-FHC6KHIH.js.map} +0 -0
  216. /package/dist/{chunk-DF4GOVDE.js.map → chunk-GF7RAQFD.js.map} +0 -0
  217. /package/dist/{chunk-ZO7TF5OL.js.map → chunk-GHY7GZWN.js.map} +0 -0
  218. /package/dist/{chunk-5FIUVBUC.js.map → chunk-GN7EAXHU.js.map} +0 -0
  219. /package/dist/{chunk-EYJ42LDG.js.map → chunk-GTFMUWK6.js.map} +0 -0
  220. /package/dist/{chunk-4QMWNAEJ.js.map → chunk-HCYES6U7.js.map} +0 -0
  221. /package/dist/{chunk-TOMDOA4P.js.map → chunk-HNZ736XN.js.map} +0 -0
  222. /package/dist/{chunk-ATQB6PTV.js.map → chunk-HPUD5IGB.js.map} +0 -0
  223. /package/dist/{chunk-FV7BSQPQ.js.map → chunk-HQDQRC4F.js.map} +0 -0
  224. /package/dist/{chunk-SDYY5MHW.js.map → chunk-INXHVNMZ.js.map} +0 -0
  225. /package/dist/{chunk-QNOJOZYK.js.map → chunk-IRDWXDID.js.map} +0 -0
  226. /package/dist/{chunk-EA4C6TVY.js.map → chunk-IVS2MAHD.js.map} +0 -0
  227. /package/dist/{chunk-QOLHDDM2.js.map → chunk-IXC6EXVJ.js.map} +0 -0
  228. /package/dist/{chunk-IU6LA6EB.js.map → chunk-IXZOZZGD.js.map} +0 -0
  229. /package/dist/{chunk-SZAD5U3J.js.map → chunk-LB2GAU7E.js.map} +0 -0
  230. /package/dist/{chunk-GNERWNZY.js.map → chunk-MVBBESXK.js.map} +0 -0
  231. /package/dist/{chunk-AIYZJ7XD.js.map → chunk-N7T6NPE2.js.map} +0 -0
  232. /package/dist/{chunk-GQ5WECPJ.js.map → chunk-NREZVTBP.js.map} +0 -0
  233. /package/dist/{chunk-EXZ4A6VJ.js.map → chunk-NRX5V443.js.map} +0 -0
  234. /package/dist/{chunk-NYGKSOQ4.js.map → chunk-OPV6BE3W.js.map} +0 -0
  235. /package/dist/{chunk-UAF2YFLZ.js.map → chunk-ROEEXEN7.js.map} +0 -0
  236. /package/dist/{chunk-F4UIKOU6.js.map → chunk-TL7VLRRF.js.map} +0 -0
  237. /package/dist/{chunk-NOQA7MJ4.js.map → chunk-U2A2DHWP.js.map} +0 -0
  238. /package/dist/{chunk-Q2B3NUSM.js.map → chunk-U4XSBYQW.js.map} +0 -0
  239. /package/dist/{chunk-Z4FWXDJG.js.map → chunk-VH5FRKJM.js.map} +0 -0
  240. /package/dist/{chunk-DCENKA6E.js.map → chunk-W5YYTITQ.js.map} +0 -0
  241. /package/dist/{chunk-5P27YL64.js.map → chunk-WOY35FXP.js.map} +0 -0
  242. /package/dist/{chunk-HI674QZF.js.map → chunk-XIN6XUFL.js.map} +0 -0
  243. /package/dist/{chunk-EVTMZ5IH.js.map → chunk-XWKN2HJD.js.map} +0 -0
  244. /package/dist/{chunk-CMRTNTMU.js.map → chunk-YKTJL4SW.js.map} +0 -0
  245. /package/dist/{chunk-PUJSLL6R.js.map → chunk-ZLPK2LQ3.js.map} +0 -0
  246. /package/dist/{chunk-Z4P23XG3.js.map → chunk-ZX4ONO5Y.js.map} +0 -0
  247. /package/dist/{cli-OPORB5PF.js.map → cli-CAF6VCVO.js.map} +0 -0
  248. /package/dist/{color-C223W3Z6.js.map → color-7CQNI6Y4.js.map} +0 -0
  249. /package/dist/{config-KQYXQCQA.js.map → config-EXQY26W4.js.map} +0 -0
  250. /package/dist/{coordinate-4E5GIMC6.js.map → coordinate-LRY7LXS6.js.map} +0 -0
  251. /package/dist/{digest-GYF4YLUH.js.map → digest-2AFW3WBL.js.map} +0 -0
  252. /package/dist/{history-25DNQKKC.js.map → history-RFIDCGQY.js.map} +0 -0
  253. /package/dist/{hook-B4JO2X57.js.map → hook-XBALB337.js.map} +0 -0
  254. /package/dist/{hydrate-IJEKNZIP.js.map → hydrate-DAEY4PB6.js.map} +0 -0
  255. /package/dist/{init-UJVOUDJI.js.map → init-4BK3T34W.js.map} +0 -0
  256. /package/dist/{install-skills-FV2L5QHE.js.map → install-skills-TL5D7HZU.js.map} +0 -0
  257. /package/dist/{keep-PKXGFZO2.js.map → keep-57TUKADV.js.map} +0 -0
  258. /package/dist/{list-VYQ3QE2H.js.map → list-DRQRIT6U.js.map} +0 -0
  259. /package/dist/{move-IAZY23ZX.js.map → move-UEHJ375P.js.map} +0 -0
  260. /package/dist/{note-6HQUKUYY.js.map → note-FHPDVBRI.js.map} +0 -0
  261. /package/dist/{overlaps-CGP3RJOW.js.map → overlaps-GKAKEUB6.js.map} +0 -0
  262. /package/dist/{pin-PAWGQ4Q2.js.map → pin-CFTQDPPC.js.map} +0 -0
  263. /package/dist/{prune-42MS36OR.js.map → prune-IQB2T45B.js.map} +0 -0
  264. /package/dist/{read-ATNCW4KH.js.map → read-DHJ6VY44.js.map} +0 -0
  265. /package/dist/{remove-GLDJOKUI.js.map → remove-MW25RLNV.js.map} +0 -0
  266. /package/dist/{report-AK7Z2Y4S.js.map → report-II75EKM6.js.map} +0 -0
  267. /package/dist/{restart-DEPDGEZB.js.map → restart-4BGVRBX6.js.map} +0 -0
  268. /package/dist/{review-RYAGH3PY.js.map → review-WKB3K6LI.js.map} +0 -0
  269. /package/dist/{review-now-K4UWD7A5.js.map → review-now-AT2SPPRO.js.map} +0 -0
  270. /package/dist/{run-WNP2SMNW.js.map → run-YS2D7WAQ.js.map} +0 -0
  271. /package/dist/{screen-P746M4F2.js.map → screen-VVRNQXVW.js.map} +0 -0
  272. /package/dist/{search-XQ2WMK5X.js.map → search-MKYCKZF4.js.map} +0 -0
  273. /package/dist/{section-Q7TPOV7U.js.map → section-Y6RDD3MN.js.map} +0 -0
  274. /package/dist/{send-EGG23J2B.js.map → send-AZM2XKN2.js.map} +0 -0
  275. /package/dist/{show-KSMC7AJL.js.map → show-33VV3XCF.js.map} +0 -0
  276. /package/dist/{snooze-4LVYUQEX.js.map → snooze-OFYZVVYS.js.map} +0 -0
  277. /package/dist/{start-YKLLXW3L.js.map → start-OEQ5VW7Y.js.map} +0 -0
  278. /package/dist/{status-4HGP4ZEF.js.map → status-HPYMNO2T.js.map} +0 -0
  279. /package/dist/{statusline-QJ6CJGHB.js.map → statusline-Z5HLKDIA.js.map} +0 -0
  280. /package/dist/{statusline-hook-Q645N4XF.js.map → statusline-hook-VPPS3PFO.js.map} +0 -0
  281. /package/dist/{stop-YBQL6NFF.js.map → stop-QNICDWAU.js.map} +0 -0
  282. /package/dist/{sync-DUXN2MFJ.js.map → sync-RH3M47QK.js.map} +0 -0
  283. /package/dist/{time-Q42HPZZ3.js.map → time-PM72GK5W.js.map} +0 -0
  284. /package/dist/{time-actions-IXZRVKKQ.js.map → time-actions-O3MCB7FU.js.map} +0 -0
  285. /package/dist/{timesheet-YJ6O3GUU.js.map → timesheet-HJXQ4KHL.js.map} +0 -0
  286. /package/dist/{todo-ZBFRL2A5.js.map → todo-UVKGOG7D.js.map} +0 -0
  287. /package/dist/{update-RGNKMRUL.js.map → update-CMYVBWV3.js.map} +0 -0
  288. /package/dist/{usage-YZRZKJ3H.js.map → usage-VEKD3JPL.js.map} +0 -0
  289. /package/dist/{usage-ask-BYPNLA2B.js.map → usage-ask-V2SIRW4F.js.map} +0 -0
  290. /package/dist/{version-4IOMOIDP.js.map → version-RJ4PCHPB.js.map} +0 -0
  291. /package/dist/{wait-YOHPFWVJ.js.map → wait-RQZU3KDY.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-ZNRPBP5O.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-MVBBESXK.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-WOY35FXP.js";
43
45
  import {
44
46
  createDigestSource
45
- } from "./chunk-EYJ42LDG.js";
47
+ } from "./chunk-GTFMUWK6.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-INXHVNMZ.js";
53
55
  import {
54
56
  defaultCleanupDeps
55
- } from "./chunk-CMRTNTMU.js";
57
+ } from "./chunk-YKTJL4SW.js";
56
58
  import {
57
59
  DiffStatCache,
58
60
  findOverlaps,
59
61
  wantsDiffStat
60
- } from "./chunk-EEHPZMS3.js";
62
+ } from "./chunk-2JLG65GB.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-GN7EAXHU.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-4HQEYZIM.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-24FQ5XXN.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-IVS2MAHD.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-ROEEXEN7.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-XTAYJDL2.js";
142
144
  import {
143
145
  legacyUnsafeCheck
144
- } from "./chunk-NYGKSOQ4.js";
146
+ } from "./chunk-OPV6BE3W.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-NXS53NHR.js";
155
+ import "./chunk-44QJVFOF.js";
152
156
  import {
153
157
  removeWorktreeInChild
154
- } from "./chunk-D2SVBU7R.js";
158
+ } from "./chunk-2FNYJEOH.js";
155
159
  import {
156
160
  archiveMergedSession,
157
161
  archiveWaiting,
158
162
  defaultArchiveDeps
159
- } from "./chunk-23QLXVH6.js";
163
+ } from "./chunk-MQXMYVZV.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-5SXTMOO6.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-2MJQTFTI.js";
199
194
  import {
200
195
  defaultForkDeps,
201
196
  forkSession,
202
197
  startSessionWithPrompt
203
- } from "./chunk-Z4P23XG3.js";
198
+ } from "./chunk-ZX4ONO5Y.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-IXC6EXVJ.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-5QENUGSC.js";
239
+ import "./chunk-BCYBF7KJ.js";
240
+ import "./chunk-NREZVTBP.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-6PZ7RCXK.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-W5YYTITQ.js";
250
253
  import {
251
254
  teardownWorktree,
252
255
  toBaseSpec,
253
256
  wouldRefuseRemoval
254
- } from "./chunk-IU6LA6EB.js";
257
+ } from "./chunk-IXZOZZGD.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-ETAPX4JN.js";
275
278
  import {
276
279
  sessionStatusView,
277
280
  shownState
278
- } from "./chunk-6Y3VLCKA.js";
281
+ } from "./chunk-BI7HIO2I.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-TL7VLRRF.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-ZLPK2LQ3.js";
293
296
  import {
294
297
  computeDiff,
295
298
  computeRangeDiff,
296
299
  parseGitDiff
297
- } from "./chunk-QNOJOZYK.js";
300
+ } from "./chunk-IRDWXDID.js";
298
301
  import {
299
302
  changeRailSections,
300
303
  placeSession,
301
- readRailLayout
302
- } from "./chunk-PTAG6WIE.js";
304
+ readRailLayout,
305
+ saveRailView
306
+ } from "./chunk-APHVSSLI.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-ET5K6S5H.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-HNZ736XN.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-HQDQRC4F.js";
405
409
  import {
406
410
  clearDevWebDiscovery,
407
411
  clearWebDiscovery,
@@ -413,13 +417,13 @@ import {
413
417
  readWebUrl,
414
418
  writeDevWebDiscovery,
415
419
  writeWebDiscovery
416
- } from "./chunk-SZAD5U3J.js";
420
+ } from "./chunk-LB2GAU7E.js";
417
421
  import {
418
422
  NOTE_NUDGE,
419
423
  findSessionForCwd,
420
424
  readPendingForSession,
421
425
  readPendingForWorktree
422
- } from "./chunk-LV5JRLBM.js";
426
+ } from "./chunk-ZMJR4Z6O.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-U4XSBYQW.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-N7T6NPE2.js";
448
452
  import {
449
453
  createSessionBranches
450
- } from "./chunk-Z4FWXDJG.js";
454
+ } from "./chunk-VH5FRKJM.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-U2A2DHWP.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-HPUD5IGB.js";
483
487
  import {
484
488
  openUrl,
485
489
  openWithDefaultApp,
486
490
  revealInFileManager,
487
491
  startEditor
488
- } from "./chunk-RTCTD5PJ.js";
492
+ } from "./chunk-773UJC5C.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-HUWWMTNG.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-NWKVTUTN.js";
622
631
  import "./chunk-KGHWHAVF.js";
623
- import "./chunk-FGBLFF4O.js";
632
+ import "./chunk-BMPTUIP4.js";
624
633
  import "./chunk-ED6YLB4S.js";
625
634
  import {
626
635
  VERSION
627
- } from "./chunk-EXZ4A6VJ.js";
636
+ } from "./chunk-NRX5V443.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-XIN6XUFL.js";
650
659
  import {
651
660
  DEFAULT_ACCOUNT,
652
661
  DEFAULT_PROMPTS,
@@ -655,24 +664,27 @@ 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";
665
- import "./chunk-W4GDPHIF.js";
674
+ } from "./chunk-ETWP7MDS.js";
675
+ import "./chunk-7ZATXG5F.js";
666
676
  import "./chunk-BR6OWWAA.js";
667
677
  import {
668
678
  bootTime,
669
679
  detachHere,
670
680
  isPidAlive,
681
+ isPidRunning,
671
682
  killTreeAsync,
672
683
  recentProcessTable
673
- } from "./chunk-VHENFC2S.js";
684
+ } from "./chunk-M2X6OHHR.js";
674
685
  import {
675
686
  explainNotOnPath,
687
+ findOnPath,
676
688
  programPath,
677
689
  shellEnv,
678
690
  spawn_default,
@@ -789,6 +801,12 @@ function realDeps(app) {
789
801
  const agent = s ? agentOf(s) : null;
790
802
  if (!s || !agent?.conversation) return { error: `work can't read ${agent?.name ?? "its agent"}'s conversations yet` };
791
803
  return { text: lastReplyOf(agent.conversation.read(s, { last: 40 })) };
804
+ },
805
+ stopBackground: async (id) => {
806
+ const s = findSession2(id);
807
+ const toolShell = s ? agentOf(s).live?.toolShell : void 0;
808
+ if (!s || !toolShell) return { error: `work can't tell ${s ? agentOf(s).name : "its agent"}'s background commands apart yet` };
809
+ return stopBackgroundWork(agentsBySession(liveAgents(), loadHistory()).get(id) ?? [], toolShell);
792
810
  }
793
811
  };
794
812
  }
@@ -836,6 +854,14 @@ function mountSessionControlRoutes(app, opts) {
836
854
  opts.broadcast("sessions-changed", { ts: Date.now() });
837
855
  return c.json({ how: "stopped" });
838
856
  });
857
+ app.post("/api/sessions/:id/background/stop", async (c) => {
858
+ const id = c.req.param("id");
859
+ if (!findSession2(id)) return c.json({ error: "unknown session" }, 404);
860
+ const r = await deps.stopBackground(id);
861
+ if ("error" in r) return c.json(r, 409);
862
+ if (r.stopped.length) opts.broadcast("sessions-changed", { ts: Date.now() });
863
+ return c.json(r);
864
+ });
839
865
  app.get("/api/sessions/:id/screen", async (c) => {
840
866
  const id = c.req.param("id");
841
867
  if (!findSession2(id)) return c.json({ error: "unknown session" }, 404);
@@ -852,12 +878,12 @@ function mountSessionControlRoutes(app, opts) {
852
878
  // src/core/stacks/stack-sync.ts
853
879
  var busyWhy = (state) => state === "working" ? "its Claude is working" : state === "needs_input" ? "its Claude is waiting for your answer" : null;
854
880
  async function syncStackChild(child, parentBranch, deps) {
855
- const run2 = deps.run ?? defaultRunner;
881
+ const run = deps.run ?? defaultRunner;
856
882
  const busy = busyWhy(deps.shownState(child));
857
883
  if (busy) return { updated: false, why: busy };
858
884
  const behind = [];
859
885
  for (const p of child.paths) {
860
- const b = await behindMain(p, run2, parentBranch);
886
+ const b = await behindMain(p, run, parentBranch);
861
887
  if (b && b.commits > 0) behind.push({ path: p, b });
862
888
  }
863
889
  if (behind.length === 0) return { updated: false, why: `already on top of ${parentBranch}` };
@@ -865,9 +891,9 @@ async function syncStackChild(child, parentBranch, deps) {
865
891
  return { updated: false, why: `bringing in ${parentBranch} would conflict: left for you (Update from ${parentBranch})` };
866
892
  const heads = /* @__PURE__ */ new Map();
867
893
  for (const { path: p } of behind) {
868
- const st = await run2("git", ["-C", p, "status", "--porcelain"], p);
894
+ const st = await run("git", ["-C", p, "status", "--porcelain"], p);
869
895
  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);
896
+ const head = await run("git", ["-C", p, "rev-parse", "HEAD"], p);
871
897
  if (head.code !== 0) return { updated: false, why: `${p}: ${head.stderr.trim() || "no HEAD"}` };
872
898
  heads.set(p, head.stdout.trim());
873
899
  }
@@ -876,9 +902,9 @@ async function syncStackChild(child, parentBranch, deps) {
876
902
  const done = [];
877
903
  for (const { path: p } of behind) {
878
904
  const nowBusy = busyWhy(deps.shownState(child));
879
- const r = nowBusy ? null : await updateFromMain(p, run2, parentBranch);
905
+ const r = nowBusy ? null : await updateFromMain(p, run, parentBranch);
880
906
  if (!r || !r.ok) {
881
- for (const q of done) await run2("git", ["-C", q, "reset", "--hard", "--quiet", heads.get(q)], q);
907
+ for (const q of done) await run("git", ["-C", q, "reset", "--hard", "--quiet", heads.get(q)], q);
882
908
  return {
883
909
  updated: false,
884
910
  why: nowBusy ?? `${r.repo}: ${r.reason}${done.length ? " (the others were put back)" : ""}`
@@ -900,15 +926,15 @@ async function syncStackChild(child, parentBranch, deps) {
900
926
  return { updated: true, commits, how, told };
901
927
  }
902
928
  async function retargetIfMerged(child, parent, config, deps) {
903
- const run2 = deps.run ?? defaultRunner;
929
+ const run = deps.run ?? defaultRunner;
904
930
  const busy = busyWhy(deps.shownState(child));
905
931
  if (busy) return { updated: false, why: busy };
906
932
  const tips = /* @__PURE__ */ new Map();
907
- for (const p of child.paths) tips.set(p, await parentTipFor(p, parent, config, run2));
933
+ for (const p of child.paths) tips.set(p, await parentTipFor(p, parent, config, run));
908
934
  for (const p of child.paths) {
909
935
  const tip = tips.get(p);
910
936
  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);
937
+ const blocker = await retargetBlocker(p, { branch: parent.branch, tip }, run);
912
938
  if (blocker?.handOff) {
913
939
  const key = `${sessionIdFor(child)}:${tip}`;
914
940
  if (handedOff.has(key))
@@ -920,7 +946,7 @@ async function retargetIfMerged(child, parent, config, deps) {
920
946
  await deps.tell(child, ontoMainPrompt(parent.branch)).catch((err) => logSwallowed(`asking ${child.branch} to move onto main`, err));
921
947
  return { updated: false, why: `${parent.branch} was rewritten before it merged: its Claude was asked to move this branch onto main` };
922
948
  }
923
- if (!await retargetIsClean(p, { branch: parent.branch, tip }, run2)) {
949
+ if (!await retargetIsClean(p, { branch: parent.branch, tip }, run)) {
924
950
  return {
925
951
  updated: false,
926
952
  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 +956,7 @@ async function retargetIfMerged(child, parent, config, deps) {
930
956
  const r = await retargetOntoMain(
931
957
  child,
932
958
  async (p) => ({ branch: parent.branch, tip: tips.get(p) ?? null }),
933
- run2,
959
+ run,
934
960
  () => busyWhy(deps.shownState(child))
935
961
  );
936
962
  if (!r.ok)
@@ -961,7 +987,7 @@ async function retargetChildrenOf(parentId, deps) {
961
987
  const stacks = sessionStacks(history, config);
962
988
  const children = history.filter((s) => stacks.mergedParentOf.get(sessionIdFor(s))?.id === parentId);
963
989
  if (children.length === 0) return 0;
964
- const run2 = deps.startRun();
990
+ const run = deps.startRun();
965
991
  let moved = 0;
966
992
  for (const child of children) {
967
993
  const id = sessionIdFor(child);
@@ -972,18 +998,18 @@ async function retargetChildrenOf(parentId, deps) {
972
998
  if (r.updated) {
973
999
  moved++;
974
1000
  deps.invalidate(id);
975
- run2.note(
1001
+ run.note(
976
1002
  `${child.branch}: ${r.how} (its parent merged and was archived)${r.told ? "; its Claude was told" : " \u2014 telling its Claude failed"}`,
977
1003
  { sessionId: id, ...r.told ? {} : { level: "warn" } }
978
1004
  );
979
- } else run2.note(`${child.branch}: left as it is \u2014 ${r.why}`, { sessionId: id });
1005
+ } else run.note(`${child.branch}: left as it is \u2014 ${r.why}`, { sessionId: id });
980
1006
  } catch (err) {
981
- run2.note(`${child.branch}: ${err.message}`, { sessionId: id, level: "warn" });
1007
+ run.note(`${child.branch}: ${err.message}`, { sessionId: id, level: "warn" });
982
1008
  } finally {
983
1009
  deps.busy.delete(id);
984
1010
  }
985
1011
  }
986
- run2.done(moved ? `${moved} moved onto main` : "none could move by itself");
1012
+ run.done(moved ? `${moved} moved onto main` : "none could move by itself");
987
1013
  return moved;
988
1014
  }
989
1015
  async function syncStacksAfterTurn(sessionId, deps) {
@@ -996,7 +1022,7 @@ async function syncStacksAfterTurn(sessionId, deps) {
996
1022
  if (candidates2.length === 0 && !merged) return 0;
997
1023
  for (const c of candidates2) deps.invalidate(sessionIdFor(c));
998
1024
  if (config?.stacks?.autoUpdate === false) return 0;
999
- const run2 = deps.startRun();
1025
+ const run = deps.startRun();
1000
1026
  let updated = 0;
1001
1027
  if (self && merged && !deps.busy.has(sessionId)) {
1002
1028
  deps.busy.add(sessionId);
@@ -1005,13 +1031,13 @@ async function syncStacksAfterTurn(sessionId, deps) {
1005
1031
  if (r.updated) {
1006
1032
  updated++;
1007
1033
  deps.invalidate(sessionId);
1008
- run2.note(`${self.branch}: ${r.how} (${merged.branch} merged)${r.told ? "; its Claude was told" : " \u2014 telling its Claude failed"}`, {
1034
+ run.note(`${self.branch}: ${r.how} (${merged.branch} merged)${r.told ? "; its Claude was told" : " \u2014 telling its Claude failed"}`, {
1009
1035
  sessionId,
1010
1036
  ...r.told ? {} : { level: "warn" }
1011
1037
  });
1012
- } else run2.note(`${self.branch}: left as it is \u2014 ${r.why}`, { sessionId });
1038
+ } else run.note(`${self.branch}: left as it is \u2014 ${r.why}`, { sessionId });
1013
1039
  } catch (err) {
1014
- run2.note(`${self.branch}: ${err.message}`, { sessionId, level: "warn" });
1040
+ run.note(`${self.branch}: ${err.message}`, { sessionId, level: "warn" });
1015
1041
  } finally {
1016
1042
  deps.busy.delete(sessionId);
1017
1043
  }
@@ -1026,20 +1052,20 @@ async function syncStacksAfterTurn(sessionId, deps) {
1026
1052
  if (r.updated) {
1027
1053
  updated++;
1028
1054
  deps.invalidate(childId);
1029
- run2.note(
1055
+ run.note(
1030
1056
  `${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
1057
  { sessionId: childId, ...r.told ? {} : { level: "warn" } }
1032
1058
  );
1033
1059
  } else {
1034
- run2.note(`${child.branch}: left as it is \u2014 ${r.why}`, { sessionId: childId });
1060
+ run.note(`${child.branch}: left as it is \u2014 ${r.why}`, { sessionId: childId });
1035
1061
  }
1036
1062
  } catch (err) {
1037
- run2.note(`${child.branch}: ${err.message}`, { sessionId: childId, level: "warn" });
1063
+ run.note(`${child.branch}: ${err.message}`, { sessionId: childId, level: "warn" });
1038
1064
  } finally {
1039
1065
  deps.busy.delete(childId);
1040
1066
  }
1041
1067
  }
1042
- run2.done(updated ? `${updated} brought up to date` : "nothing to bring in");
1068
+ run.done(updated ? `${updated} brought up to date` : "nothing to bring in");
1043
1069
  return updated;
1044
1070
  }
1045
1071
 
@@ -2017,24 +2043,24 @@ async function readCodeFile(s, repo, rel, io = realIo) {
2017
2043
 
2018
2044
  // src/core/worktree/terminal-path-refs.ts
2019
2045
  function splitLine(raw) {
2020
- let path26 = raw;
2046
+ let path25 = raw;
2021
2047
  let line;
2022
- const m = /:(\d+)(?::\d+)?$/.exec(path26);
2048
+ const m = /:(\d+)(?::\d+)?$/.exec(path25);
2023
2049
  if (m) {
2024
- path26 = path26.slice(0, m.index);
2050
+ path25 = path25.slice(0, m.index);
2025
2051
  const n = Number(m[1]);
2026
2052
  if (n > 0) line = n;
2027
2053
  }
2028
- const url = /^file:\/\/([^/]*)(\/.*)?$/i.exec(path26);
2054
+ const url = /^file:\/\/([^/]*)(\/.*)?$/i.exec(path25);
2029
2055
  if (url) {
2030
- path26 = url[2] ?? "/";
2056
+ path25 = url[2] ?? "/";
2031
2057
  try {
2032
- path26 = decodeURIComponent(path26);
2058
+ path25 = decodeURIComponent(path25);
2033
2059
  } catch {
2034
2060
  }
2035
- if (/^\/[A-Za-z]:[\\/]/.test(path26)) path26 = path26.slice(1);
2061
+ if (/^\/[A-Za-z]:[\\/]/.test(path25)) path25 = path25.slice(1);
2036
2062
  }
2037
- return line === void 0 ? { path: path26 } : { path: path26, line };
2063
+ return line === void 0 ? { path: path25 } : { path: path25, line };
2038
2064
  }
2039
2065
 
2040
2066
  // src/core/worktree/terminal-paths.ts
@@ -2463,77 +2489,6 @@ function reviewFocus(config, aliases) {
2463
2489
  return attentionItems(r?.focus, ...[...new Set(aliases)].map((a) => r?.focusFor?.[a]));
2464
2490
  }
2465
2491
 
2466
- // src/core/platform/process-usage.ts
2467
- import { execFile } from "child_process";
2468
- import path8 from "path";
2469
- var num = (v) => typeof v === "number" && Number.isFinite(v) && v >= 0 ? v : null;
2470
- function parseCimUsage(json2) {
2471
- let data;
2472
- try {
2473
- data = JSON.parse(json2);
2474
- } catch {
2475
- return [];
2476
- }
2477
- const rows = Array.isArray(data) ? data : data ? [data] : [];
2478
- const out = [];
2479
- for (const r of rows) {
2480
- if (!r || typeof r !== "object") continue;
2481
- const o = r;
2482
- if (typeof o.ProcessId !== "number") continue;
2483
- const started = num(o.Started);
2484
- out.push({
2485
- pid: o.ProcessId,
2486
- ppid: typeof o.ParentProcessId === "number" ? o.ParentProcessId : 0,
2487
- name: typeof o.Name === "string" ? o.Name : "",
2488
- exe: typeof o.ExecutablePath === "string" ? o.ExecutablePath : null,
2489
- command: typeof o.CommandLine === "string" ? o.CommandLine : "",
2490
- memBytes: num(o.PrivatePageCount),
2491
- // 0: a system process with no creation date.
2492
- startedAt: started ? started : null
2493
- });
2494
- }
2495
- return out;
2496
- }
2497
- function elapsedMs(etime) {
2498
- const m = /^(?:(\d+)-)?(?:(\d+):)?(\d+):(\d+)$/.exec(etime.trim());
2499
- if (!m) return null;
2500
- const [days, hours, mins, secs] = [m[1], m[2], m[3], m[4]].map((x) => Number(x ?? 0));
2501
- return (((days * 24 + hours) * 60 + mins) * 60 + secs) * 1e3;
2502
- }
2503
- function parsePsUsage(stdout, now) {
2504
- const out = [];
2505
- for (const line of stdout.split(/\r?\n/)) {
2506
- const m = /^\s*(\d+)\s+(\d+)\s+(\d+)\s+(\S+)\s+(.*)$/.exec(line);
2507
- if (!m) continue;
2508
- const command = m[5].trim();
2509
- const first = commandWords(command)[0] ?? "";
2510
- const elapsed = elapsedMs(m[4]);
2511
- out.push({
2512
- pid: Number(m[1]),
2513
- ppid: Number(m[2]),
2514
- name: path8.posix.basename(first),
2515
- exe: first.startsWith("/") ? first : null,
2516
- command,
2517
- memBytes: Number(m[3]) * 1024,
2518
- startedAt: elapsed === null ? null : now - elapsed
2519
- });
2520
- }
2521
- return out;
2522
- }
2523
- var run = (cmd, args) => new Promise(
2524
- (resolve) => execFile(
2525
- programPath(cmd),
2526
- args,
2527
- { encoding: "utf-8", windowsHide: true, timeout: 2e4, maxBuffer: 64 * 1024 * 1024 },
2528
- (_err, stdout) => resolve(stdout ?? "")
2529
- )
2530
- );
2531
- 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";
2532
- async function listProcessUsage(now = Date.now()) {
2533
- if (process.platform === "win32") return parseCimUsage(await run("powershell", ["-NoProfile", "-NonInteractive", "-Command", CIM_USAGE]));
2534
- return parsePsUsage(await run("ps", ["-A", "-o", "pid=,ppid=,rss=,etime=,args="]), now);
2535
- }
2536
-
2537
2492
  // src/core/sessions/leftover-sweep.ts
2538
2493
  async function sweepLeftovers(deps) {
2539
2494
  const procs = await deps.list();
@@ -2635,9 +2590,9 @@ var NOT_NAMES = /* @__PURE__ */ new Set([
2635
2590
  "typeof",
2636
2591
  "await"
2637
2592
  ]);
2638
- function declarationOf(path26, text) {
2593
+ function declarationOf(path25, text) {
2639
2594
  for (const r of RULES) {
2640
- if (!r.ext.test(path26)) continue;
2595
+ if (!r.ext.test(path25)) continue;
2641
2596
  const m = r.re.exec(text);
2642
2597
  if (!m) continue;
2643
2598
  const name = r.name(m);
@@ -2889,8 +2844,8 @@ function mountTerminalPathRoutes(app) {
2889
2844
  app.post("/api/sessions/:id/terminal-paths/open", zValidator3("json", openSchema), async (c) => {
2890
2845
  const session = findSession2(c.req.param("id"));
2891
2846
  if (!session) return c.json({ error: "unknown session" }, 404);
2892
- const { path: path26, how } = c.req.valid("json");
2893
- const r = await openTerminalPath(session, path26, how);
2847
+ const { path: path25, how } = c.req.valid("json");
2848
+ const r = await openTerminalPath(session, path25, how);
2894
2849
  if ("ok" in r) return c.json({ ok: true, opened: r.opened });
2895
2850
  if (r.error === "failed") return c.json({ error: r.message ?? "could not open it" }, 500);
2896
2851
  return c.json({ error: r.error }, 404);
@@ -3022,7 +2977,7 @@ function mountSetupRoutes(app, opts) {
3022
2977
 
3023
2978
  // src/core/updates/update-source.ts
3024
2979
  import fs7 from "fs";
3025
- import path9 from "path";
2980
+ import path8 from "path";
3026
2981
 
3027
2982
  // src/core/updates/updates.ts
3028
2983
  function parseVersion(v) {
@@ -3107,9 +3062,9 @@ function parseDesktopUpdate(text) {
3107
3062
  var RELEASES_REPO = "moberghr/cli-work-tree-manager";
3108
3063
  var RELEASES_URL = `https://api.github.com/repos/${RELEASES_REPO}/releases?per_page=30`;
3109
3064
  var SEEN_KEY = "ui:seen-version";
3110
- var desktopUpdatePath = () => path9.join(getConfigDir(), "desktop-update.json");
3111
- var desktopRequestPath = () => path9.join(getConfigDir(), "desktop-request.json");
3112
- async function fetchReleases(get = (url) => fetch(url, { headers: { "User-Agent": "work", Accept: "application/vnd.github+json" }, signal: AbortSignal.timeout(15e3) }), run2 = defaultRunner) {
3065
+ var desktopUpdatePath = () => path8.join(getConfigDir(), "desktop-update.json");
3066
+ var desktopRequestPath = () => path8.join(getConfigDir(), "desktop-request.json");
3067
+ async function fetchReleases(get = (url) => fetch(url, { headers: { "User-Agent": "work", Accept: "application/vnd.github+json" }, signal: AbortSignal.timeout(15e3) }), run = defaultRunner) {
3113
3068
  const why = await get(RELEASES_URL).then(
3114
3069
  async (res) => res.ok ? parseReleases(await res.json()) : res.status === 403 ? "GitHub's limit for this address is spent" : `GitHub answered ${res.status}`,
3115
3070
  (err) => err
@@ -3118,7 +3073,7 @@ async function fetchReleases(get = (url) => fetch(url, { headers: { "User-Agent"
3118
3073
  const offline = networkFailure(why);
3119
3074
  if (offline) throw new Error(offline);
3120
3075
  } else if (typeof why !== "string") return why;
3121
- const r = await run2("gh", ["api", `repos/${RELEASES_REPO}/releases?per_page=30`], process.cwd());
3076
+ const r = await run("gh", ["api", `repos/${RELEASES_REPO}/releases?per_page=30`], process.cwd());
3122
3077
  if (r.code === 0) {
3123
3078
  try {
3124
3079
  return parseReleases(JSON.parse(r.stdout));
@@ -3170,7 +3125,7 @@ function markSeenVersion(version) {
3170
3125
  }
3171
3126
  function installKind() {
3172
3127
  const root = packageRoot();
3173
- return installKindOf(root, getConfigDir(), !!root && fs7.existsSync(path9.join(root, ".git")));
3128
+ return installKindOf(root, getConfigDir(), !!root && fs7.existsSync(path8.join(root, ".git")));
3174
3129
  }
3175
3130
  var defaultDeps = () => ({
3176
3131
  fetchReleases: () => fetchReleases(),
@@ -3221,12 +3176,12 @@ function createUpdates(deps = defaultDeps()) {
3221
3176
  checkedAt: () => checkedAt
3222
3177
  };
3223
3178
  }
3224
- async function lookForUpdates(updates, run2, changed) {
3179
+ async function lookForUpdates(updates, run, changed) {
3225
3180
  const before = updates.wire().latest;
3226
3181
  await updates.refresh();
3227
3182
  const w = updates.wire();
3228
- if (w.checkError) run2.fail(w.checkError);
3229
- else run2.done(w.available ? `work ${w.available.version} is out (this is ${w.running})` : `up to date (${w.running})`);
3183
+ if (w.checkError) run.fail(w.checkError);
3184
+ else run.done(w.available ? `work ${w.available.version} is out (this is ${w.running})` : `up to date (${w.running})`);
3230
3185
  if (w.latest !== before) changed();
3231
3186
  }
3232
3187
 
@@ -3376,7 +3331,7 @@ function mountRepoRoutes(app, opts) {
3376
3331
  const regenerate = (name) => {
3377
3332
  const bin = opts.workBin?.();
3378
3333
  if (!bin) return;
3379
- const run2 = opts.activity?.start("groups", `Writing ${name}'s combined instructions`);
3334
+ const run = opts.activity?.start("groups", `Writing ${name}'s combined instructions`);
3380
3335
  const child = spawn_default(
3381
3336
  process.execPath,
3382
3337
  [...process.execArgv.filter((f) => !/^--inspect/.test(f)), bin, "config", "group", "regen", name],
@@ -3386,8 +3341,8 @@ function mountRepoRoutes(app, opts) {
3386
3341
  env: { ...process.env, NO_COLOR: "1" }
3387
3342
  }
3388
3343
  );
3389
- child.on("error", (e) => run2?.fail(e.message));
3390
- child.on("close", (code) => code === 0 ? run2?.done("written") : run2?.fail(`work config group regen exited ${code}`));
3344
+ child.on("error", (e) => run?.fail(e.message));
3345
+ child.on("close", (code) => code === 0 ? run?.done("written") : run?.fail(`work config group regen exited ${code}`));
3391
3346
  };
3392
3347
  app.get("/api/repos", (c) => {
3393
3348
  try {
@@ -3450,8 +3405,8 @@ var SETTING_PATTERNS = {
3450
3405
  /** A font name or several, comma-separated (the terminal's font; it refuses what would end a CSS value). */
3451
3406
  fontFamily: "^[^;{}<>\\\\]+$"
3452
3407
  };
3453
- var bool = (path26, section, label, help, def, when) => ({
3454
- path: path26,
3408
+ var bool = (path25, section, label, help, def, when) => ({
3409
+ path: path25,
3455
3410
  section,
3456
3411
  label,
3457
3412
  help,
@@ -3478,6 +3433,14 @@ var SETTINGS = [
3478
3433
  kind: { type: "text", placeholder: "code" },
3479
3434
  default: "code"
3480
3435
  },
3436
+ {
3437
+ path: "terminalApp",
3438
+ section: "General",
3439
+ label: "Terminal app",
3440
+ help: "The terminal Open in terminal starts: a name (ptyxis, gnome-terminal, konsole, kitty, wezterm, ghostty, alacritty, foot, xterm\u2026; Terminal or iTerm on macOS; wt or conhost on Windows). Empty: Windows Terminal, Terminal.app, or on Linux $TERMINAL, else the first one installed.",
3441
+ kind: { type: "text", placeholder: "automatic" },
3442
+ default: null
3443
+ },
3481
3444
  bool(
3482
3445
  "notifications",
3483
3446
  "General",
@@ -3921,7 +3884,7 @@ var SETTINGS = [
3921
3884
  "when each Claude next starts"
3922
3885
  )
3923
3886
  ];
3924
- var settingAt = (path26) => SETTINGS.find((f) => f.path === path26);
3887
+ var settingAt = (path25) => SETTINGS.find((f) => f.path === path25);
3925
3888
  function checkSetting(field, raw) {
3926
3889
  const checked = checkValue(field, raw);
3927
3890
  if (checked.ok && checked.value === null && field.required) return { ok: false, error: "it can\u2019t be left empty" };
@@ -3967,16 +3930,16 @@ function checkValue(field, raw) {
3967
3930
  return typeof raw === "string" && k.options.some((o) => o.value === raw) ? { ok: true, value: raw } : { ok: false, error: `one of ${k.options.map((o) => o.value).join(", ")}` };
3968
3931
  }
3969
3932
  }
3970
- function valueAt(obj, path26) {
3933
+ function valueAt(obj, path25) {
3971
3934
  let cur = obj;
3972
- for (const key of path26.split(".")) {
3935
+ for (const key of path25.split(".")) {
3973
3936
  if (!cur || typeof cur !== "object" || Array.isArray(cur)) return void 0;
3974
3937
  cur = cur[key];
3975
3938
  }
3976
3939
  return cur;
3977
3940
  }
3978
- function setValueAt(obj, path26, value) {
3979
- const keys = path26.split(".");
3941
+ function setValueAt(obj, path25, value) {
3942
+ const keys = path25.split(".");
3980
3943
  const chain = [obj];
3981
3944
  let cur = obj;
3982
3945
  for (const key of keys.slice(0, -1)) {
@@ -4016,8 +3979,8 @@ function checkRepoSetting(key, raw) {
4016
3979
  return raw === "all" || raw === "asked" || raw === "off" ? { ok: true, value: raw } : { ok: false, error: "all, asked or off" };
4017
3980
  }
4018
3981
  function repoSettingsOf(raw, alias) {
4019
- const map = (path26) => {
4020
- const m = valueAt(raw, path26);
3982
+ const map = (path25) => {
3983
+ const m = valueAt(raw, path25);
4021
3984
  return m && typeof m === "object" && !Array.isArray(m) ? m : {};
4022
3985
  };
4023
3986
  const checks = map(REPO_SETTING_PATH.requiredChecks)[alias];
@@ -4078,7 +4041,7 @@ function mountSettingsRoutes(app, opts) {
4078
4041
 
4079
4042
  // src/core/settings/settings-admin.ts
4080
4043
  import fs9 from "fs";
4081
- import path10 from "path";
4044
+ import path9 from "path";
4082
4045
 
4083
4046
  // src/core/settings/terminal-style.ts
4084
4047
  var TERMINAL_COLOR_KEYS = [
@@ -4244,7 +4207,7 @@ var TERMINAL_THEMES = [
4244
4207
  }
4245
4208
  ];
4246
4209
  var DEFAULT_TERMINAL_THEME = "default";
4247
- var DEFAULT_TERMINAL_FONT_FAMILY = '"Cascadia Code", "Cascadia Mono", SFMono-Regular, Consolas, "Liberation Mono", monospace';
4210
+ var DEFAULT_TERMINAL_FONT_FAMILY = '"Cascadia Code", "Cascadia Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace';
4248
4211
  var DEFAULT_TERMINAL_FONT_SIZE = 13;
4249
4212
  var TERMINAL_FONT_SIZE_RANGE = { min: 8, max: 32 };
4250
4213
  var DEFAULT_TERMINAL_LINE_HEIGHT = 1;
@@ -4318,13 +4281,13 @@ function readSettings() {
4318
4281
  const colors = checkTerminalColors(valueAt(raw, "terminal.colors"));
4319
4282
  return { values, ...Object.keys(colors).length ? { terminalColors: colors } : {}, configPath: getConfigPath() };
4320
4283
  }
4321
- async function writeSetting(path26, value) {
4322
- const field = settingAt(path26);
4323
- if (!field) throw new SettingsError(`no setting ${path26}`, 404);
4284
+ async function writeSetting(path25, value) {
4285
+ const field = settingAt(path25);
4286
+ if (!field) throw new SettingsError(`no setting ${path25}`, 404);
4324
4287
  const checked = checkSetting(field, value);
4325
4288
  if (!checked.ok) throw new SettingsError(`${field.label}: ${checked.error}`);
4326
- const toWrite = checkedFolders(path26, checked.value);
4327
- await editConfig((raw) => setValueAt(raw, path26, toWrite)).catch((err) => {
4289
+ const toWrite = checkedFolders(path25, checked.value);
4290
+ await editConfig((raw) => setValueAt(raw, path25, toWrite)).catch((err) => {
4328
4291
  throw err instanceof RepoAdminError ? new SettingsError(err.message) : err;
4329
4292
  });
4330
4293
  return readSettings();
@@ -4338,9 +4301,9 @@ function checkedFolders(at, value) {
4338
4301
  if (at === "scanRoots" && Array.isArray(value))
4339
4302
  return value.map((v) => {
4340
4303
  const p = expandHome(v);
4341
- if (!path10.isAbsolute(p))
4304
+ if (!path9.isAbsolute(p))
4342
4305
  throw new SettingsError(`Folders scanned for repos: ${v} isn't a full path (start it from the drive, / or ~)`);
4343
- const full = path10.resolve(p);
4306
+ const full = path9.resolve(p);
4344
4307
  if (!fs9.statSync(full, { throwIfNoEntry: false })?.isDirectory())
4345
4308
  throw new SettingsError(`Folders scanned for repos: ${full} isn't a folder`);
4346
4309
  return full;
@@ -4396,7 +4359,7 @@ function withOwnStatusLine(source, own) {
4396
4359
  }
4397
4360
 
4398
4361
  // src/core/conversations/timeline-source.ts
4399
- import path11 from "path";
4362
+ import path10 from "path";
4400
4363
 
4401
4364
  // src/core/conversations/timeline.ts
4402
4365
  var SIZE_LABEL = /^(\d+ files? · \+\d+ −\d+|no changes)$/;
@@ -4437,19 +4400,19 @@ function order(k) {
4437
4400
  var DAYS = 30;
4438
4401
  var MAX_TRANSCRIPT_BYTES = 8 << 20;
4439
4402
  var MAX_COMMITS = 100;
4440
- async function commitsOf(repo, since, run2) {
4441
- const git3 = (...args) => run2("git", ["-C", repo, ...args], repo);
4403
+ async function commitsOf(repo, since, run) {
4404
+ const git3 = (...args) => run("git", ["-C", repo, ...args], repo);
4442
4405
  const base = (await git3("merge-base", "HEAD", "origin/HEAD")).stdout.trim();
4443
4406
  const range = base ? [`${base}..HEAD`] : [`--since=${since}`, "HEAD"];
4444
4407
  const log = await git3("log", `--max-count=${MAX_COMMITS}`, "--format=%H%x09%aI%x09%s", ...range);
4445
4408
  if (log.code !== 0) return [];
4446
4409
  return log.stdout.split("\n").filter(Boolean).map((line) => {
4447
4410
  const [sha, at, ...subject] = line.split(" ");
4448
- return { repo: path11.basename(repo), sha, at, subject: subject.join(" ") };
4411
+ return { repo: path10.basename(repo), sha, at, subject: subject.join(" ") };
4449
4412
  });
4450
4413
  }
4451
4414
  async function sessionTimeline(s, deps = {}) {
4452
- const run2 = deps.run ?? defaultRunner;
4415
+ const run = deps.run ?? defaultRunner;
4453
4416
  const since = Math.max(Date.parse(s.createdAt) || 0, (deps.now ?? Date.now()) - DAYS * 864e5);
4454
4417
  const transcripts = [];
4455
4418
  const conv = agentOf(s).conversation;
@@ -4460,7 +4423,7 @@ async function sessionTimeline(s, deps = {}) {
4460
4423
  } catch {
4461
4424
  }
4462
4425
  }
4463
- const commits = s.archivedAt ? [] : (await Promise.all(s.paths.map((p) => commitsOf(p, s.createdAt, run2).catch(() => [])))).flat();
4426
+ const commits = s.archivedAt ? [] : (await Promise.all(s.paths.map((p) => commitsOf(p, s.createdAt, run).catch(() => [])))).flat();
4464
4427
  const prs = (deps.ci?.repos ?? []).filter((r) => r.pr).map((r) => ({
4465
4428
  repo: r.name,
4466
4429
  number: r.pr.number,
@@ -4582,7 +4545,7 @@ function placeJira(issue, detail, cfg) {
4582
4545
 
4583
4546
  // src/server/routes/jira-watch-routes.ts
4584
4547
  import fs10 from "fs";
4585
- import path12 from "path";
4548
+ import path11 from "path";
4586
4549
 
4587
4550
  // src/core/jira/jira-watch.ts
4588
4551
  var START_PER_SWEEP = 2;
@@ -4785,14 +4748,14 @@ async function sweepJira(deps) {
4785
4748
  var EVERY_MS = 5 * 6e4;
4786
4749
  function aboutRepo(dir) {
4787
4750
  try {
4788
- const readme = ["README.md", "readme.md", "README"].map((n) => path12.join(dir, n)).find((f) => fs10.existsSync(f));
4751
+ const readme = ["README.md", "readme.md", "README"].map((n) => path11.join(dir, n)).find((f) => fs10.existsSync(f));
4789
4752
  if (readme) {
4790
4753
  const line = fs10.readFileSync(readme, "utf8").split(/\r?\n/).map(
4791
4754
  (l) => l.replace(/^[#>*\-\s]+/, "").replace(/[`*_[\]]/g, "").trim()
4792
4755
  ).find((l) => l.length > 20 && !/^(!|<|http)/.test(l));
4793
4756
  if (line) return line.slice(0, 160);
4794
4757
  }
4795
- const pkg = path12.join(dir, "package.json");
4758
+ const pkg = path11.join(dir, "package.json");
4796
4759
  if (fs10.existsSync(pkg)) {
4797
4760
  const d = JSON.parse(fs10.readFileSync(pkg, "utf8")).description;
4798
4761
  if (typeof d === "string" && d.trim()) return d.trim().slice(0, 160);
@@ -4806,7 +4769,7 @@ function watchTargets(cfg = loadConfig()) {
4806
4769
  const repos = Object.entries(cfg.repos).map(([alias, dir]) => ({
4807
4770
  name: alias,
4808
4771
  kind: "repo",
4809
- members: [path12.basename(dir)],
4772
+ members: [path11.basename(dir)],
4810
4773
  about: aboutRepo(dir)
4811
4774
  }));
4812
4775
  const groups = Object.entries(cfg.groups).map(([name, aliases]) => ({ name, kind: "group", members: aliases }));
@@ -4838,7 +4801,7 @@ function mountJiraWatchRoutes(app, opts) {
4838
4801
  running ??= (async () => {
4839
4802
  try {
4840
4803
  if (!readSettings2().enabled) return;
4841
- const run2 = opts.activity?.start("jira-watch", "Looking for newly assigned Jira issues");
4804
+ const run = opts.activity?.start("jira-watch", "Looking for newly assigned Jira issues");
4842
4805
  const deps = {
4843
4806
  // Throws when acli can't list them: the sweep fails (said in Activity) rather than reading "none".
4844
4807
  fetchIssues: fetchMyIssuesOrThrow,
@@ -4848,17 +4811,17 @@ function mountJiraWatchRoutes(app, opts) {
4848
4811
  place: (issue, detail) => placeJira(issue, detail, loadConfig()),
4849
4812
  ask: (prompt) => runInternal(prompt, 9e4),
4850
4813
  start: (target, branch, issue) => start(target, branch, issue, true),
4851
- note: (text, level, sessionId) => run2?.note(text, { level, ...sessionId ? { sessionId } : {} }),
4814
+ note: (text, level, sessionId) => run?.note(text, { level, ...sessionId ? { sessionId } : {} }),
4852
4815
  maxPerDay: loadConfig()?.jiraWatch?.maxPerDay
4853
4816
  };
4854
4817
  try {
4855
4818
  const r = await sweepJira(deps);
4856
- run2?.done(
4819
+ run?.done(
4857
4820
  r.started || r.suggested || r.waiting ? `${r.started} started \xB7 ${r.suggested} to start yourself${r.waiting ? ` \xB7 ${r.waiting} waiting` : ""}` : "no new issues"
4858
4821
  );
4859
4822
  if (r.started || r.suggested) changed();
4860
4823
  } catch (err) {
4861
- run2?.fail(err.message);
4824
+ run?.fail(err.message);
4862
4825
  }
4863
4826
  lastRunAt = (/* @__PURE__ */ new Date()).toISOString();
4864
4827
  } finally {
@@ -4984,7 +4947,7 @@ function describeStall(s) {
4984
4947
  }
4985
4948
 
4986
4949
  // src/server/web-server.ts
4987
- import path23 from "path";
4950
+ import path22 from "path";
4988
4951
  import { Hono } from "hono";
4989
4952
  import { streamSSE as streamSSE2 } from "hono/streaming";
4990
4953
 
@@ -5255,19 +5218,19 @@ function mountPanesRoutes(app, opts) {
5255
5218
  const prsFetch = createSharedFetch(async () => {
5256
5219
  const config = loadConfig();
5257
5220
  if (!config) return { prs: [] };
5258
- const run2 = opts.activity?.start("pr-list", "Listing open pull requests");
5221
+ const run = opts.activity?.start("pr-list", "Listing open pull requests");
5259
5222
  try {
5260
5223
  const { map, incomplete } = await fetchAllPullRequests(config.repos);
5261
5224
  const prs = Array.from(map.values()).flat();
5262
5225
  if (incomplete.length)
5263
- run2?.note(
5226
+ run?.note(
5264
5227
  `couldn't list every PR of ${incomplete.join(", ")} (gh failed, or 100+ open): archiving isn't suggested for sessions there`,
5265
5228
  { level: "warn" }
5266
5229
  );
5267
- run2?.done(`${prs.length} open PR${prs.length === 1 ? "" : "s"} in ${Object.keys(config.repos).length} repos`);
5230
+ run?.done(`${prs.length} open PR${prs.length === 1 ? "" : "s"} in ${Object.keys(config.repos).length} repos`);
5268
5231
  return incomplete.length ? { prs, incomplete } : { prs };
5269
5232
  } catch (err) {
5270
- run2?.fail(err.message);
5233
+ run?.fail(err.message);
5271
5234
  throw err;
5272
5235
  }
5273
5236
  }, PRS_TTL_MS);
@@ -5287,19 +5250,19 @@ function mountPanesRoutes(app, opts) {
5287
5250
  let issuesInFlight = null;
5288
5251
  app.get("/api/issues", async (c) => {
5289
5252
  issuesInFlight ??= (async () => {
5290
- const run2 = opts.activity?.start("jira", "Fetching your issues");
5253
+ const run = opts.activity?.start("jira", "Fetching your issues");
5291
5254
  try {
5292
5255
  const r = await listIssues(issueSources(), loadConfig());
5293
5256
  const down = r.sources.filter((s) => !s.available);
5294
5257
  if (down.length && down.length === r.sources.length)
5295
- run2?.fail(`${down.map((s) => s.name).join(", ")}: not available or not signed in`);
5258
+ run?.fail(`${down.map((s) => s.name).join(", ")}: not available or not signed in`);
5296
5259
  else
5297
- run2?.done(
5260
+ run?.done(
5298
5261
  `${r.issues.length} issue${r.issues.length === 1 ? "" : "s"}${down.length ? ` \xB7 ${down.map((s) => s.name).join(", ")} not available` : ""}`
5299
5262
  );
5300
5263
  return r;
5301
5264
  } catch (err) {
5302
- run2?.fail(err.message);
5265
+ run?.fail(err.message);
5303
5266
  throw err;
5304
5267
  } finally {
5305
5268
  issuesInFlight = null;
@@ -5315,7 +5278,7 @@ function mountPanesRoutes(app, opts) {
5315
5278
  app.get("/api/jira", async (c) => {
5316
5279
  if (!jiraInFlight) {
5317
5280
  jiraInFlight = (async () => {
5318
- const run2 = opts.activity?.start("jira", "Fetching your Jira issues");
5281
+ const run = opts.activity?.start("jira", "Fetching your Jira issues");
5319
5282
  try {
5320
5283
  const got = await fetchJiraPane();
5321
5284
  const cfg = loadConfig();
@@ -5326,11 +5289,11 @@ function mountPanesRoutes(app, opts) {
5326
5289
  return placed?.target ? { ...i, startsIn: placed.target } : i;
5327
5290
  })
5328
5291
  };
5329
- if (!r.available) run2?.fail("Jira CLI (acli) not available or not logged in");
5330
- else run2?.done(`${r.issues.length} issue${r.issues.length === 1 ? "" : "s"}`);
5292
+ if (!r.available) run?.fail("Jira CLI (acli) not available or not logged in");
5293
+ else run?.done(`${r.issues.length} issue${r.issues.length === 1 ? "" : "s"}`);
5331
5294
  return r;
5332
5295
  } catch (err) {
5333
- run2?.fail(err.message);
5296
+ run?.fail(err.message);
5334
5297
  throw err;
5335
5298
  } finally {
5336
5299
  jiraInFlight = null;
@@ -5392,7 +5355,11 @@ function mountPanesRoutes(app, opts) {
5392
5355
 
5393
5356
  // src/server/routes/worktree-routes.ts
5394
5357
  import fs11 from "fs";
5395
- import path13 from "path";
5358
+ import path12 from "path";
5359
+ import { zValidator as zValidator6 } from "@hono/zod-validator";
5360
+ import { z as z5 } from "zod";
5361
+
5362
+ // src/core/platform/terminal-launch.ts
5396
5363
  import { spawn } from "child_process";
5397
5364
 
5398
5365
  // src/core/platform/started.ts
@@ -5410,17 +5377,127 @@ function whenStarted(child) {
5410
5377
  });
5411
5378
  }
5412
5379
 
5380
+ // src/core/platform/terminal-launch.ts
5381
+ var TERMINALS = {
5382
+ // wt splits its own command line on `;`: the caller refuses a folder with one and strips it from the title.
5383
+ wt: (j) => ["-w", "0", "nt", "--title", j.title, "-d", j.cwd, ...j.argv],
5384
+ ptyxis: (j) => ["--new-window", "-d", j.cwd, "-T", j.title, "--", ...j.argv],
5385
+ "gnome-terminal": (j) => ["--tab", `--working-directory=${j.cwd}`, "--", ...j.argv],
5386
+ kgx: (j) => ["--tab", `--working-directory=${j.cwd}`, "--", ...j.argv],
5387
+ konsole: (j) => ["--new-tab", "--workdir", j.cwd, "-p", `tabtitle=${j.title}`, "-e", ...j.argv],
5388
+ "xfce4-terminal": (j) => ["--tab", "--working-directory", j.cwd, "--title", j.title, "-x", ...j.argv],
5389
+ kitty: (j) => ["--directory", j.cwd, "--title", j.title, ...j.argv],
5390
+ alacritty: (j) => ["--working-directory", j.cwd, "--title", j.title, "-e", ...j.argv],
5391
+ wezterm: (j) => ["start", "--cwd", j.cwd, "--", ...j.argv],
5392
+ ghostty: (j) => [`--working-directory=${j.cwd}`, `--title=${j.title}`, "-e", ...j.argv],
5393
+ foot: (j) => ["--working-directory", j.cwd, "--title", j.title, ...j.argv],
5394
+ xterm: (j) => ["-T", j.title, "-e", ...j.argv],
5395
+ "x-terminal-emulator": (j) => ["-e", ...j.argv]
5396
+ };
5397
+ var LINUX_TERMINALS = [
5398
+ "ptyxis",
5399
+ "gnome-terminal",
5400
+ "konsole",
5401
+ "kgx",
5402
+ "xfce4-terminal",
5403
+ "ghostty",
5404
+ "kitty",
5405
+ "wezterm",
5406
+ "alacritty",
5407
+ "foot",
5408
+ "x-terminal-emulator",
5409
+ "xterm"
5410
+ ];
5411
+ var MAC_LINE = `"cd " & quoted form of (item 1 of argv) & " && exec" & my shellWords(rest of argv)`;
5412
+ var MAC_WORDS = [
5413
+ "on shellWords(xs)",
5414
+ 'set s to ""',
5415
+ "repeat with x in xs",
5416
+ 'set s to s & " " & quoted form of (x as text)',
5417
+ "end repeat",
5418
+ "return s",
5419
+ "end shellWords"
5420
+ ];
5421
+ var MAC_SCRIPTS = {
5422
+ terminal: ["on run argv", 'tell application "Terminal"', "activate", `do script ${MAC_LINE}`, "end tell", "end run", ...MAC_WORDS],
5423
+ iterm: [
5424
+ "on run argv",
5425
+ 'tell application "iTerm"',
5426
+ "activate",
5427
+ "set w to (create window with default profile)",
5428
+ `tell current session of w to write text ${MAC_LINE}`,
5429
+ "end tell",
5430
+ "end run",
5431
+ ...MAC_WORDS
5432
+ ]
5433
+ };
5434
+ function terminalName(program) {
5435
+ return (program.trim().split(/[\\/]/).pop() ?? "").replace(/\.(exe|app)$/i, "").toLowerCase();
5436
+ }
5437
+ function terminalLaunch(terminal, job, platform = process.platform) {
5438
+ const name = terminalName(terminal);
5439
+ if (platform === "win32" && (name === "conhost" || name === "console")) {
5440
+ return { cmd: job.argv[0], args: job.argv.slice(1), detached: true };
5441
+ }
5442
+ if (platform === "darwin" && (name === "terminal" || name === "iterm" || name === "iterm2")) {
5443
+ const script = MAC_SCRIPTS[name === "terminal" ? "terminal" : "iterm"];
5444
+ return { cmd: "osascript", args: [...script.flatMap((l) => ["-e", l]), job.cwd, ...job.argv], detached: detachHere(platform) };
5445
+ }
5446
+ const args = TERMINALS[name];
5447
+ if (!args) return null;
5448
+ const run = platform === "win32" ? job : { ...job, argv: inFolder(job.cwd, job.argv) };
5449
+ return { cmd: terminal.trim(), args: args(run), detached: detachHere(platform) };
5450
+ }
5451
+ function inFolder(cwd, argv) {
5452
+ return ["/bin/sh", "-c", 'cd -- "$1" && shift && exec "$@"', "sh", cwd, ...argv];
5453
+ }
5454
+ function pickTerminal(configured, platform = process.platform, env = process.env, onPath = (cmd) => findOnPath(cmd, env, platform) !== null) {
5455
+ if (configured?.trim()) return configured.trim();
5456
+ if (platform === "win32") return onPath("wt.exe") ? "wt.exe" : "conhost";
5457
+ if (platform === "darwin") return "Terminal";
5458
+ const preferred = env.TERMINAL?.trim();
5459
+ if (preferred && TERMINALS[terminalName(preferred)] && onPath(preferred)) return preferred;
5460
+ return LINUX_TERMINALS.find(onPath) ?? null;
5461
+ }
5462
+ async function openTerminal(job) {
5463
+ const configured = loadConfig()?.terminalApp;
5464
+ const terminal = pickTerminal(configured);
5465
+ if (!terminal) {
5466
+ return `no terminal found (tried ${LINUX_TERMINALS.join(", ")}) \u2014 set "terminalApp" in work's config, or run \`work attach\` in the worktree`;
5467
+ }
5468
+ const launch2 = terminalLaunch(terminal, job);
5469
+ if (!launch2) {
5470
+ return `work doesn't know how to start ${terminal} in a folder \u2014 set "terminalApp" in work's config to one of: ${Object.keys(TERMINALS).join(", ")}`;
5471
+ }
5472
+ if (terminalName(launch2.cmd) === "wt" && job.cwd.includes(";")) return 'worktree path contains ";", which wt.exe cannot take';
5473
+ let child;
5474
+ try {
5475
+ child = spawn(programPath(launch2.cmd), launch2.args, {
5476
+ cwd: job.cwd,
5477
+ stdio: "ignore",
5478
+ shell: false,
5479
+ detached: launch2.detached,
5480
+ windowsHide: false
5481
+ // a terminal window: the window is what was asked for
5482
+ // node's spawn, not work's wrapper: no shellEnv — the shell in the window is the user's (shell-env.ts).
5483
+ });
5484
+ } catch (err) {
5485
+ return `could not start ${terminal}: ${err.message}`;
5486
+ }
5487
+ const why = await whenStarted(child);
5488
+ child.unref();
5489
+ return why ? `${terminal} didn't start: ${why}` : null;
5490
+ }
5491
+
5413
5492
  // src/server/routes/worktree-routes.ts
5414
- import { zValidator as zValidator6 } from "@hono/zod-validator";
5415
- import { z as z5 } from "zod";
5416
5493
  var queues = /* @__PURE__ */ new Map();
5417
5494
  function oneAtATime2(key, fn) {
5418
- const run2 = (queues.get(key) ?? Promise.resolve()).catch(() => void 0).then(fn);
5419
- queues.set(key, run2);
5420
- void run2.finally(() => {
5421
- if (queues.get(key) === run2) queues.delete(key);
5495
+ const run = (queues.get(key) ?? Promise.resolve()).catch(() => void 0).then(fn);
5496
+ queues.set(key, run);
5497
+ void run.finally(() => {
5498
+ if (queues.get(key) === run) queues.delete(key);
5422
5499
  }).catch(() => void 0);
5423
- return run2;
5500
+ return run;
5424
5501
  }
5425
5502
  function mountWorktreeRoutes(app, opts) {
5426
5503
  const createSchema = z5.object({
@@ -5500,7 +5577,11 @@ function mountWorktreeRoutes(app, opts) {
5500
5577
  try {
5501
5578
  started = await startSession(
5502
5579
  id,
5503
- parent ? childBrief(parent.title?.trim() || `${parent.target} \xB7 ${parent.branch}`, prompt) : prompt.trim()
5580
+ parent ? childBrief(
5581
+ parent.title?.trim() || `${parent.target} \xB7 ${parent.branch}`,
5582
+ prompt,
5583
+ agentOf(parent).tempFolders?.(parent) ?? []
5584
+ ) : prompt.trim()
5504
5585
  );
5505
5586
  } catch (err) {
5506
5587
  startError = err.message;
@@ -5623,7 +5704,7 @@ function mountWorktreeRoutes(app, opts) {
5623
5704
  const wantsFile = !!body && typeof body === "object" && "path" in body;
5624
5705
  const asked = wantsFile ? openFileSchema.safeParse(body) : null;
5625
5706
  if (asked && !asked.success) return c.json({ error: "repo and path required" }, 400);
5626
- const folder = session.isGroup ? path13.dirname(session.paths[0]) : session.paths[0];
5707
+ const folder = session.isGroup ? path12.dirname(session.paths[0]) : session.paths[0];
5627
5708
  let file;
5628
5709
  if (asked?.success) {
5629
5710
  const at = await codeFilePath(session, asked.data.repo, asked.data.path);
@@ -5640,28 +5721,9 @@ function mountWorktreeRoutes(app, opts) {
5640
5721
  const session = findSession2(id);
5641
5722
  const spec = session ? spawnSpecFor(session) : null;
5642
5723
  if (!session || !spec) return c.json({ error: "unknown session" }, 404);
5643
- if (process.platform !== "win32") {
5644
- return c.json({ error: "Only Windows Terminal is supported so far \u2014 run `work attach` in the worktree." }, 501);
5645
- }
5646
- if (spec.cwd.includes(";")) {
5647
- return c.json({ error: 'worktree path contains ";", which wt.exe cannot take' }, 400);
5648
- }
5649
5724
  const title = `${session.target} \xB7 ${session.branch || "(base)"}`.replace(/;/g, " ");
5650
- let child;
5651
- try {
5652
- child = spawn(programPath("wt.exe"), ["-w", "0", "nt", "--title", title, "-d", spec.cwd, process.execPath, getWorkBin(), "attach"], {
5653
- stdio: "ignore",
5654
- shell: false,
5655
- windowsHide: false
5656
- // a Windows Terminal tab: the window is what was asked for
5657
- // node's spawn, not work's wrapper: no shellEnv — the shell in the tab is the user's (shell-env.ts).
5658
- });
5659
- } catch (err) {
5660
- return c.json({ error: err.message }, 500);
5661
- }
5662
- const why = await whenStarted(child);
5663
- child.unref();
5664
- if (why) return c.json({ error: `Windows Terminal didn't start: ${why}` }, 500);
5725
+ const failed = await openTerminal({ cwd: spec.cwd, title, argv: [process.execPath, getWorkBin(), "attach"] });
5726
+ if (failed) return c.json({ error: failed }, 500);
5665
5727
  return c.json({ ok: true });
5666
5728
  });
5667
5729
  }
@@ -5670,7 +5732,7 @@ function mountWorktreeRoutes(app, opts) {
5670
5732
  import { zValidator as zValidator7 } from "@hono/zod-validator";
5671
5733
  import { z as z6 } from "zod";
5672
5734
  import { EventEmitter } from "events";
5673
- import path14 from "path";
5735
+ import path13 from "path";
5674
5736
  import { streamSSE } from "hono/streaming";
5675
5737
  function mountScopeRoutes(app, opts) {
5676
5738
  const background = /* @__PURE__ */ new Set();
@@ -5917,7 +5979,7 @@ function mountScopeRoutes(app, opts) {
5917
5979
  const fromSha = fromEntry.repos[p] ?? "HEAD";
5918
5980
  const toSha = toEntry === void 0 ? "working" : toEntry.repos[p] ?? "HEAD";
5919
5981
  return {
5920
- name: path14.basename(p),
5982
+ name: path13.basename(p),
5921
5983
  root: p,
5922
5984
  files: computeRangeDiff({ root: p, fromRef: fromSha, toRef: toSha })
5923
5985
  };
@@ -5934,7 +5996,7 @@ function mountScopeRoutes(app, opts) {
5934
5996
  }
5935
5997
  const resolved = scope.paths.map((p) => resolveRepoDiff(p, base, sessionBaseForPath(p)));
5936
5998
  const repos = scope.paths.map((p, i) => ({
5937
- name: path14.basename(p),
5999
+ name: path13.basename(p),
5938
6000
  root: p,
5939
6001
  resolvedBase: resolved[i].resolvedBase,
5940
6002
  files: computeDiff({ root: p, diffArg: resolved[i].diffArg })
@@ -5965,7 +6027,7 @@ function mountScopeRoutes(app, opts) {
5965
6027
  if (!relPath || !Number.isInteger(start) || !Number.isInteger(end)) {
5966
6028
  return c.json({ error: "bad path/start/end" }, 400);
5967
6029
  }
5968
- const root = scope.paths.length === 1 ? scope.paths[0] : scope.paths.find((p) => path14.basename(p) === repoName);
6030
+ const root = scope.paths.length === 1 ? scope.paths[0] : scope.paths.find((p) => path13.basename(p) === repoName);
5969
6031
  if (!root) return c.json({ error: "unknown repo" }, 404);
5970
6032
  const result = readContextLines({ root, relPath, start, end, ref });
5971
6033
  if (!result) return c.json({ error: "cannot read file" }, 400);
@@ -6146,7 +6208,7 @@ function mountScopeRoutes(app, opts) {
6146
6208
  // src/core/pty/terminal-perf.ts
6147
6209
  var MAX_KEYS = 200;
6148
6210
  var MAX_STALLS = 100;
6149
- var num2 = (x) => typeof x === "number" && Number.isFinite(x) && x >= 0 && x < 1e13;
6211
+ var num = (x) => typeof x === "number" && Number.isFinite(x) && x >= 0 && x < 1e13;
6150
6212
  function cleanPerfReport(x) {
6151
6213
  if (!x || typeof x !== "object") return null;
6152
6214
  const r = x;
@@ -6157,13 +6219,13 @@ function cleanPerfReport(x) {
6157
6219
  const keys = [];
6158
6220
  for (const k of r.keys.slice(0, MAX_KEYS)) {
6159
6221
  const o = k;
6160
- if (!o || !num2(o.arrived) || !(o.shown === null || num2(o.shown))) return null;
6222
+ if (!o || !num(o.arrived) || !(o.shown === null || num(o.shown))) return null;
6161
6223
  keys.push({ arrived: Math.round(o.arrived), shown: o.shown === null ? null : Math.round(o.shown) });
6162
6224
  }
6163
6225
  const stalls = [];
6164
6226
  for (const s of r.stalls.slice(0, MAX_STALLS)) {
6165
6227
  const o = s;
6166
- if (!o || !num2(o.at) || !num2(o.ms) || !(o.blocking === null || num2(o.blocking)) || typeof o.what !== "string") return null;
6228
+ if (!o || !num(o.at) || !num(o.ms) || !(o.blocking === null || num(o.blocking)) || typeof o.what !== "string") return null;
6167
6229
  stalls.push({
6168
6230
  at: o.at,
6169
6231
  ms: Math.round(o.ms),
@@ -6198,15 +6260,17 @@ function mountTerminalRoutes(app, opts) {
6198
6260
  app.post("/api/terminals/:id/ticket", async (c) => {
6199
6261
  const id = c.req.param("id");
6200
6262
  const body = await c.req.json().catch(() => ({}));
6263
+ const attachOnly = body.attachOnly === true;
6201
6264
  const origin = c.req.header("origin");
6202
6265
  if (!origin) return c.json({ fallback: true });
6203
- if (body.force !== true) {
6266
+ if (body.force !== true && !attachOnly) {
6204
6267
  const elsewhere = await opts.elsewhere(id);
6205
6268
  if (elsewhere) return c.json({ elsewhere });
6206
6269
  }
6207
6270
  let running;
6208
6271
  try {
6209
- running = await opts.ensure(id);
6272
+ const grid = validGrid(body.cols, body.rows) ?? void 0;
6273
+ running = await (attachOnly ? opts.ensure(id, grid, true) : opts.ensure(id, grid));
6210
6274
  } catch (err) {
6211
6275
  return c.json({ error: err.message }, 409);
6212
6276
  }
@@ -6223,7 +6287,7 @@ function mountTerminalRoutes(app, opts) {
6223
6287
  }
6224
6288
 
6225
6289
  // src/server/routes/status-routes.ts
6226
- import path15 from "path";
6290
+ import path14 from "path";
6227
6291
 
6228
6292
  // src/core/status/notifier.ts
6229
6293
  var MESSAGES = {
@@ -6372,7 +6436,7 @@ function mountStatusRoutes(app, opts) {
6372
6436
  const kind = notifyKindForTransition(status.prevState ? { state: status.prevState } : null, status);
6373
6437
  if (kind) {
6374
6438
  const config = loadConfig();
6375
- const launchDir = session.isGroup && session.paths[0] ? path15.dirname(session.paths[0]) : session.paths[0] ?? body.cwd;
6439
+ const launchDir = session.isGroup && session.paths[0] ? path14.dirname(session.paths[0]) : session.paths[0] ?? body.cwd;
6376
6440
  const name = `${session.target} \xB7 ${session.branch}`;
6377
6441
  const snooze = readSnooze(id);
6378
6442
  const route = snooze?.until && snoozeActive(snooze, { attention: status }) ? "none" : presence.route(id);
@@ -6694,16 +6758,16 @@ function createPrWatch(deps) {
6694
6758
  const me = ci.repos.find((r) => r.name === f.repo)?.viewer ?? ci.viewer;
6695
6759
  return !!me && me.toLowerCase() === author.toLowerCase();
6696
6760
  }
6697
- function check(id, session, act = true, run2) {
6761
+ function check(id, session, act = true, run) {
6698
6762
  const running2 = inflight.get(id);
6699
6763
  if (running2) return running2;
6700
- const p = checkNow(id, session, act, run2).finally(() => inflight.delete(id));
6764
+ const p = checkNow(id, session, act, run).finally(() => inflight.delete(id));
6701
6765
  inflight.set(id, p);
6702
6766
  return p;
6703
6767
  }
6704
- async function checkNow(id, session, act = true, run2) {
6768
+ async function checkNow(id, session, act = true, run) {
6705
6769
  const name = `${session.target} ${session.branch}`;
6706
- const note = (text, level = "info") => run2?.note(`${name}: ${text}`, { level, sessionId: id });
6770
+ const note = (text, level = "info") => run?.note(`${name}: ${text}`, { level, sessionId: id });
6707
6771
  let pre;
6708
6772
  try {
6709
6773
  pre = await deps.preflight(session, { resting });
@@ -6971,20 +7035,20 @@ function createPrWatch(deps) {
6971
7035
  if (!restingNames()) schedule?.resume();
6972
7036
  const queue = due;
6973
7037
  const ids = queue.map((q) => q.id);
6974
- const run2 = deps.activity?.start("pr-watch", "Checking pull requests");
7038
+ const run = deps.activity?.start("pr-watch", "Checking pull requests");
6975
7039
  let done = 0;
6976
- run2?.progress(0, ids.length);
7040
+ run?.progress(0, ids.length);
6977
7041
  const worker = async () => {
6978
7042
  for (let next = queue.shift(); next; next = queue.shift()) {
6979
- await check(next.id, next.session, !deps.lookOnly, run2);
6980
- run2?.progress(++done, ids.length);
7043
+ await check(next.id, next.session, !deps.lookOnly, run);
7044
+ run?.progress(++done, ids.length);
6981
7045
  }
6982
7046
  };
6983
7047
  try {
6984
7048
  await Promise.all(Array.from({ length: CONCURRENCY }, worker));
6985
- run2?.done(sweepSummary(ids));
7049
+ run?.done(sweepSummary(ids));
6986
7050
  } catch (err) {
6987
- run2?.fail(err.message);
7051
+ run?.fail(err.message);
6988
7052
  throw err;
6989
7053
  }
6990
7054
  })().finally(() => {
@@ -7045,7 +7109,7 @@ function repoServer(repoPath) {
7045
7109
  const { origin } = hostForRepo(repoPath);
7046
7110
  return origin ? originHostname(origin) : null;
7047
7111
  }
7048
- function viewerLogin(run2, lookup = hostOf, serverOf = repoServer) {
7112
+ function viewerLogin(run, lookup = hostOf, serverOf = repoServer) {
7049
7113
  const known = /* @__PURE__ */ new Map();
7050
7114
  return async (hostId, repoPath) => {
7051
7115
  const host = lookup(hostId);
@@ -7053,21 +7117,21 @@ function viewerLogin(run2, lookup = hostOf, serverOf = repoServer) {
7053
7117
  ${repoPath ? serverOf(repoPath) ?? "" : ""}`;
7054
7118
  const was = known.get(key);
7055
7119
  if (was) return was;
7056
- const login = await host.viewer(run2, repoPath ?? process.cwd()).catch(() => null);
7120
+ const login = await host.viewer(run, repoPath ?? process.cwd()).catch(() => null);
7057
7121
  if (login) known.set(key, login);
7058
7122
  return login || null;
7059
7123
  };
7060
7124
  }
7061
- async function fetchReviewFeedback(repoPath, prNumber, run2) {
7062
- return hostForRepo(repoPath).host.reviewFeedback(run2, repoPath, prNumber);
7125
+ async function fetchReviewFeedback(repoPath, prNumber, run) {
7126
+ return hostForRepo(repoPath).host.reviewFeedback(run, repoPath, prNumber);
7063
7127
  }
7064
7128
  function hostRateLimited(hostId, text) {
7065
7129
  return hostOf(hostId).rateLimited(text);
7066
7130
  }
7067
- function prWatchHostDeps(run2) {
7131
+ function prWatchHostDeps(run) {
7068
7132
  return {
7069
- viewer: viewerLogin(run2),
7070
- reviewFeedback: (repoPath, n) => fetchReviewFeedback(repoPath, n, run2),
7133
+ viewer: viewerLogin(run),
7134
+ reviewFeedback: (repoPath, n) => fetchReviewFeedback(repoPath, n, run),
7071
7135
  rateLimited: hostRateLimited
7072
7136
  };
7073
7137
  }
@@ -7143,7 +7207,7 @@ function branchFactsOf(pre) {
7143
7207
  }))
7144
7208
  );
7145
7209
  }
7146
- function listedPrsIo(run2, opts = {}) {
7210
+ function listedPrsIo(run, opts = {}) {
7147
7211
  return {
7148
7212
  repoIdOf: (repoPath) => {
7149
7213
  const { host, origin } = hostForRepo(repoPath);
@@ -7153,19 +7217,19 @@ function listedPrsIo(run2, opts = {}) {
7153
7217
  const h = hostOfPrUrl(url)?.host;
7154
7218
  return h ? h.id === DEFAULT_HOST ? void 0 : h.id : null;
7155
7219
  },
7156
- lookup: (cwd, host, ref) => hostOf(host).prForRef(run2, cwd ?? os3.tmpdir(), ref),
7220
+ lookup: (cwd, host, ref) => hostOf(host).prForRef(run, cwd ?? os3.tmpdir(), ref),
7157
7221
  ...opts
7158
7222
  };
7159
7223
  }
7160
- async function shipPreflightWithListed(session, run2, io = {}) {
7161
- const pre = await (io.preflight ?? shipPreflight)(session, run2);
7162
- return (await withListedPrs(pre, readSessionPrs(sessionIdFor(session)), io.listed ?? listedPrsIo(run2))).pre;
7224
+ async function shipPreflightWithListed(session, run, io = {}) {
7225
+ const pre = await (io.preflight ?? shipPreflight)(session, run);
7226
+ return (await withListedPrs(pre, readSessionPrs(sessionIdFor(session)), io.listed ?? listedPrsIo(run))).pre;
7163
7227
  }
7164
- async function watchPreflight(session, run2, opts = {}, io = {}) {
7228
+ async function watchPreflight(session, run, opts = {}, io = {}) {
7165
7229
  const id = sessionIdFor(session);
7166
7230
  const last = opts.last ?? null;
7167
7231
  const repoOf = (name) => last?.repos.find((x) => x.name === name);
7168
- const pre = await (io.preflight ?? shipPreflight)(session, run2, {
7232
+ const pre = await (io.preflight ?? shipPreflight)(session, run, {
7169
7233
  askGh: watchAskGh(opts.resting, (name) => !!repoOf(name)?.pr),
7170
7234
  ...watchBranchOptions(
7171
7235
  readSessionBranches(id),
@@ -7177,7 +7241,7 @@ async function watchPreflight(session, run2, opts = {}, io = {}) {
7177
7241
  const facts = branchFactsOf(pre);
7178
7242
  if (facts.length) bestEffort(`keep the branch facts of ${id}`, () => noteBranchFacts(id, facts));
7179
7243
  const previous = (url) => last ? prsOfCheck(last).find((p) => p.pr.url.toLowerCase() === url.toLowerCase())?.pr : void 0;
7180
- const listed = io.listed ?? listedPrsIo(run2, { ...opts.resting ? { resting: opts.resting } : {}, previous });
7244
+ const listed = io.listed ?? listedPrsIo(run, { ...opts.resting ? { resting: opts.resting } : {}, previous });
7181
7245
  const found2 = await withListedPrs(pre, readSessionPrs(id), listed);
7182
7246
  const aliases = new Map(sessionRepos(session, loadConfig()).map((r) => [r.path, r.alias]));
7183
7247
  const keys = new Map(pre.repos.map((r) => [r.name, [aliases.get(r.path), listed.repoIdOf(r.path)]]));
@@ -7289,7 +7353,7 @@ function mountShipRoutes(app, opts) {
7289
7353
  selection,
7290
7354
  body.method ?? "squash",
7291
7355
  opts.run,
7292
- (s, run2) => shipPreflightWithListed(s, run2)
7356
+ (s, run) => shipPreflightWithListed(s, run)
7293
7357
  );
7294
7358
  opts.onRepoChanged?.(id);
7295
7359
  let archived = false;
@@ -7388,6 +7452,12 @@ function mountRailRoutes(app, opts) {
7388
7452
  changed();
7389
7453
  return c.json(r.layout);
7390
7454
  });
7455
+ app.put("/api/rail/view", async (c) => {
7456
+ const body = await c.req.json().catch(() => null);
7457
+ const view = asRailView(body?.view);
7458
+ if (!view) return c.json({ error: "expected {view: mine|state|project}" }, 400);
7459
+ return c.json(saveRailView(view));
7460
+ });
7391
7461
  app.put("/api/sessions/:id/rail", async (c) => {
7392
7462
  const id = c.req.param("id");
7393
7463
  if (!findSession2(id)) return c.json({ error: "unknown session" }, 404);
@@ -7402,8 +7472,8 @@ function mountRailRoutes(app, opts) {
7402
7472
 
7403
7473
  // src/core/worktree/shared-folders.ts
7404
7474
  import fs12 from "fs";
7405
- import path16 from "path";
7406
- var norm3 = (p) => path16.resolve(p).replace(/\\/g, "/").toLowerCase();
7475
+ import path15 from "path";
7476
+ var norm3 = (p) => path15.resolve(p).replace(/\\/g, "/").toLowerCase();
7407
7477
  function shadowedSessions(sessions, branchCheckedOut2) {
7408
7478
  const byFolder = /* @__PURE__ */ new Map();
7409
7479
  for (const s of sessions) {
@@ -7422,14 +7492,14 @@ function shadowedSessions(sessions, branchCheckedOut2) {
7422
7492
  }
7423
7493
  function branchCheckedOut(dir) {
7424
7494
  try {
7425
- const dotGit = path16.join(dir, ".git");
7495
+ const dotGit = path15.join(dir, ".git");
7426
7496
  let gitDir = dotGit;
7427
7497
  if (fs12.statSync(dotGit).isFile()) {
7428
7498
  const m = /^gitdir:\s*(.+)$/m.exec(fs12.readFileSync(dotGit, "utf8"));
7429
7499
  if (!m) return null;
7430
- gitDir = path16.resolve(dir, m[1].trim());
7500
+ gitDir = path15.resolve(dir, m[1].trim());
7431
7501
  }
7432
- const head = fs12.readFileSync(path16.join(gitDir, "HEAD"), "utf8");
7502
+ const head = fs12.readFileSync(path15.join(gitDir, "HEAD"), "utf8");
7433
7503
  const ref = /^ref:\s*refs\/heads\/(.+)$/m.exec(head);
7434
7504
  return ref ? ref[1].trim() : null;
7435
7505
  } catch {
@@ -7523,13 +7593,13 @@ function mountCleanupRoutes(app, opts) {
7523
7593
  app.post("/api/cleanup/branches/scan", (c) => {
7524
7594
  if (!branches.scanning) {
7525
7595
  branches = { ...branches, scanning: true };
7526
- const run2 = opts.activity?.start("branches", "Looking for merged local branches");
7596
+ const run = opts.activity?.start("branches", "Looking for merged local branches");
7527
7597
  void findMergedBranches(branchDeps).then((candidates2) => {
7528
7598
  branches = { scanning: false, scannedAt: (/* @__PURE__ */ new Date()).toISOString(), candidates: candidates2 };
7529
- run2?.done(`${candidates2.length} merged local branch${candidates2.length === 1 ? "" : "es"}`);
7599
+ run?.done(`${candidates2.length} merged local branch${candidates2.length === 1 ? "" : "es"}`);
7530
7600
  }).catch((err) => {
7531
7601
  branches = { ...branches, scanning: false };
7532
- run2?.fail(err.message);
7602
+ run?.fail(err.message);
7533
7603
  });
7534
7604
  }
7535
7605
  return c.json(branches);
@@ -7540,10 +7610,10 @@ function mountCleanupRoutes(app, opts) {
7540
7610
  (i) => !!i && typeof i.repo === "string" && typeof i.branch === "string"
7541
7611
  ).map((i) => ({ repo: i.repo, branch: i.branch, ...typeof i.tip === "string" ? { tip: i.tip } : {} })) : [];
7542
7612
  if (items.length === 0) return c.json({ error: "items: [{repo, branch, tip?}]" }, 400);
7543
- const run2 = opts.activity?.start("branches", "Deleting merged local branches");
7613
+ const run = opts.activity?.start("branches", "Deleting merged local branches");
7544
7614
  const results = await deleteMergedBranches(items, branchDeps);
7545
- for (const r of results) run2?.note(`${r.repo} ${r.branch}: ${r.message}`, { level: r.ok ? "action" : "warn" });
7546
- run2?.done(`${results.filter((r) => r.ok).length} of ${results.length} deleted`);
7615
+ for (const r of results) run?.note(`${r.repo} ${r.branch}: ${r.message}`, { level: r.ok ? "action" : "warn" });
7616
+ run?.done(`${results.filter((r) => r.ok).length} of ${results.length} deleted`);
7547
7617
  const gone = new Set(results.filter((r) => r.ok).map((r) => `${r.repo}\0${r.branch}`));
7548
7618
  branches = { ...branches, candidates: branches.candidates.filter((b) => !gone.has(`${b.repo}\0${b.branch}`)) };
7549
7619
  return c.json({ results, state: branches });
@@ -7593,14 +7663,14 @@ function createActivityLog(opts = {}) {
7593
7663
  let recent = [];
7594
7664
  const lastOk = /* @__PURE__ */ new Map();
7595
7665
  const schedules = /* @__PURE__ */ new Map();
7596
- const finish = (run2) => {
7597
- running.delete(run2.id);
7598
- recent = [run2, ...recent].slice(0, keep);
7666
+ const finish = (run) => {
7667
+ running.delete(run.id);
7668
+ recent = [run, ...recent].slice(0, keep);
7599
7669
  changed();
7600
7670
  };
7601
7671
  return {
7602
7672
  start(kind, label) {
7603
- const run2 = {
7673
+ const run = {
7604
7674
  id: nextId++,
7605
7675
  kind,
7606
7676
  label,
@@ -7611,31 +7681,31 @@ function createActivityLog(opts = {}) {
7611
7681
  summary: null,
7612
7682
  notes: []
7613
7683
  };
7614
- running.set(run2.id, run2);
7684
+ running.set(run.id, run);
7615
7685
  changed();
7616
- const open = () => run2.status === "running";
7686
+ const open = () => run.status === "running";
7617
7687
  return {
7618
7688
  progress(done, total) {
7619
7689
  if (!open()) return;
7620
- run2.progress = { done, total };
7690
+ run.progress = { done, total };
7621
7691
  changed();
7622
7692
  },
7623
7693
  note(text, o = {}) {
7624
7694
  if (!open()) return;
7625
7695
  const n = { at: iso(), text, level: o.level ?? "info", ...o.sessionId ? { sessionId: o.sessionId } : {} };
7626
- run2.notes = [...run2.notes, n].slice(-KEEP_NOTES);
7696
+ run.notes = [...run.notes, n].slice(-KEEP_NOTES);
7627
7697
  changed();
7628
7698
  },
7629
7699
  done(summary) {
7630
7700
  if (!open()) return;
7631
- Object.assign(run2, { status: "done", endedAt: iso(), summary });
7632
- lastOk.set(run2.kind, run2.endedAt);
7633
- finish(run2);
7701
+ Object.assign(run, { status: "done", endedAt: iso(), summary });
7702
+ lastOk.set(run.kind, run.endedAt);
7703
+ finish(run);
7634
7704
  },
7635
7705
  fail(error) {
7636
7706
  if (!open()) return;
7637
- Object.assign(run2, { status: "failed", endedAt: iso(), summary: error });
7638
- finish(run2);
7707
+ Object.assign(run, { status: "failed", endedAt: iso(), summary: error });
7708
+ finish(run);
7639
7709
  }
7640
7710
  };
7641
7711
  },
@@ -7691,7 +7761,7 @@ function threadsWithoutDraft(open, replies) {
7691
7761
  return open.filter((t) => !drafted.has(t.threadId));
7692
7762
  }
7693
7763
  function mountPrReplyRoutes(app, opts) {
7694
- const run2 = opts.run ?? defaultRunner;
7764
+ const run = opts.run ?? defaultRunner;
7695
7765
  const changed = (sessionId) => {
7696
7766
  if (opts.watch) markPostedAnswered(sessionId, opts.watch);
7697
7767
  opts.broadcast("replies-changed", { sessionId });
@@ -7713,7 +7783,7 @@ function mountPrReplyRoutes(app, opts) {
7713
7783
  if (typeof b.body !== "string") return c.json({ error: "body: string" }, 400);
7714
7784
  const r = await draftReply(id, c.req.param("thread"), b.body, {
7715
7785
  repos: () => sessionRepoRefs(session),
7716
- run: run2
7786
+ run
7717
7787
  });
7718
7788
  if (!r.ok) return c.json({ error: r.error }, 400);
7719
7789
  changed(id);
@@ -7736,7 +7806,7 @@ function mountPrReplyRoutes(app, opts) {
7736
7806
  return c.json({ error: "body: the reply text" }, 400);
7737
7807
  const thread = c.req.param("thread");
7738
7808
  const cwd = replyFolder(session, listReplies(id).find((r2) => r2.threadId === thread)?.repo);
7739
- const r = await postReply(id, thread, b.body, { resolve: b.resolve === true, cwd, run: run2 });
7809
+ const r = await postReply(id, thread, b.body, { resolve: b.resolve === true, cwd, run });
7740
7810
  if (!r.ok) return c.json({ error: r.error }, 502);
7741
7811
  const act = opts.activity?.start("pr-watch", "Posting a review reply");
7742
7812
  act?.note(`${session.target} ${session.branch}: posted your reply${r.resolved ? " and resolved the thread" : ""}`, {
@@ -7757,7 +7827,7 @@ function mountPrReplyRoutes(app, opts) {
7757
7827
 
7758
7828
  // src/core/archive/archive-retention.ts
7759
7829
  import fs14 from "fs";
7760
- import path17 from "path";
7830
+ import path16 from "path";
7761
7831
  import zlib from "zlib";
7762
7832
  var DEFAULT_COMPRESS_AFTER_DAYS = 30;
7763
7833
  var DAY_MS = 24 * 36e5;
@@ -7778,14 +7848,14 @@ function applyArchiveRetention(opts) {
7778
7848
  if (!rec) continue;
7779
7849
  const age = now - Date.parse(rec.archivedAt);
7780
7850
  if (!Number.isFinite(age)) continue;
7781
- const ignored = path17.join(archiveDirFor(id, root), "ignored");
7851
+ const ignored = path16.join(archiveDirFor(id, root), "ignored");
7782
7852
  if (compressAfter > 0 && age >= compressAfter * DAY_MS && !rec.ignoredDroppedAt && fs14.existsSync(ignored)) {
7783
7853
  fs14.rmSync(ignored, { recursive: true, force: true });
7784
7854
  rec.ignoredDroppedAt = new Date(now).toISOString();
7785
7855
  writeArchiveRecord(rec, root);
7786
7856
  }
7787
7857
  if (rec.transcriptsDroppedAt) continue;
7788
- const dir = path17.join(archiveDirFor(id, root), "transcripts");
7858
+ const dir = path16.join(archiveDirFor(id, root), "transcripts");
7789
7859
  if (dropAfter > 0 && age >= dropAfter * DAY_MS) {
7790
7860
  out.bytesSaved += dirBytes(dir);
7791
7861
  fs14.rmSync(dir, { recursive: true, force: true });
@@ -7796,7 +7866,7 @@ function applyArchiveRetention(opts) {
7796
7866
  }
7797
7867
  if (compressAfter <= 0 || rec.compressedAt || age < compressAfter * DAY_MS) continue;
7798
7868
  for (const t of rec.transcripts) {
7799
- const plain = path17.join(dir, t.file);
7869
+ const plain = path16.join(dir, t.file);
7800
7870
  if (!fs14.existsSync(plain)) continue;
7801
7871
  const data = fs14.readFileSync(plain);
7802
7872
  const gz = zlib.gzipSync(data);
@@ -7817,7 +7887,7 @@ function applyArchiveRetention(opts) {
7817
7887
  function dirBytes(dir) {
7818
7888
  let n = 0;
7819
7889
  try {
7820
- for (const f of fs14.readdirSync(dir)) n += fs14.statSync(path17.join(dir, f)).size;
7890
+ for (const f of fs14.readdirSync(dir)) n += fs14.statSync(path16.join(dir, f)).size;
7821
7891
  } catch {
7822
7892
  }
7823
7893
  return n;
@@ -7841,7 +7911,7 @@ function createTimeKeeper(deps, opts) {
7841
7911
  if (d === today) return true;
7842
7912
  return needsBuild(d, builtAt.get(d));
7843
7913
  });
7844
- const run3 = opts.activity?.start("time", days.length === 1 ? "Updating today" : `Building ${days.length} days`);
7914
+ const run2 = opts.activity?.start("time", days.length === 1 ? "Updating today" : `Building ${days.length} days`);
7845
7915
  const failed = [];
7846
7916
  let built = 0;
7847
7917
  for (const d of days) {
@@ -7853,11 +7923,11 @@ function createTimeKeeper(deps, opts) {
7853
7923
  }
7854
7924
  }
7855
7925
  if (built) opts.changed();
7856
- if (failed.length) run3?.fail(`${failed.length} of ${days.length} not built \u2014 ${failed.join("; ")}`);
7857
- else run3?.done(days.length === 1 ? "today updated" : `${days.length} days built`);
7926
+ if (failed.length) run2?.fail(`${failed.length} of ${days.length} not built \u2014 ${failed.join("; ")}`);
7927
+ else run2?.done(days.length === 1 ? "today updated" : `${days.length} days built`);
7858
7928
  }
7859
7929
  let again = null;
7860
- const run2 = (what = "all") => {
7930
+ const run = (what = "all") => {
7861
7931
  if (busy) {
7862
7932
  again = again === "all" || what === "all" ? "all" : "local";
7863
7933
  return busy;
@@ -7879,12 +7949,12 @@ function createTimeKeeper(deps, opts) {
7879
7949
  return busy;
7880
7950
  };
7881
7951
  return {
7882
- run: run2,
7952
+ run,
7883
7953
  soon: () => {
7884
7954
  if (timer) return;
7885
7955
  timer = setTimeout(() => {
7886
7956
  timer = null;
7887
- void run2("local");
7957
+ void run("local");
7888
7958
  }, AFTER_TURN_MS);
7889
7959
  timer.unref?.();
7890
7960
  },
@@ -8123,14 +8193,14 @@ function settleLeftOverClaims(deps) {
8123
8193
  function tidyLeftOverSubmits(deps, activity, changed) {
8124
8194
  const done = settleLeftOverClaims(deps);
8125
8195
  if (!done.length) return;
8126
- const run2 = activity?.start("reviews", "Submits left mid-way");
8196
+ const run = activity?.start("reviews", "Submits left mid-way");
8127
8197
  for (const r of done) {
8128
- run2?.note(`${r.repo} #${r.number}: work stopped while submitting your review \u2014 look at the PR and say whether it went`, {
8198
+ run?.note(`${r.repo} #${r.number}: work stopped while submitting your review \u2014 look at the PR and say whether it went`, {
8129
8199
  level: "warn"
8130
8200
  });
8131
8201
  changed(r);
8132
8202
  }
8133
- run2?.done(`${done.length} submit${done.length === 1 ? "" : "s"} in doubt`);
8203
+ run?.done(`${done.length} submit${done.length === 1 ? "" : "s"} in doubt`);
8134
8204
  }
8135
8205
 
8136
8206
  // src/core/review/review-fix.ts
@@ -8209,10 +8279,10 @@ async function fixItMyself(deps, repo, number, input) {
8209
8279
  const no = claimRefused;
8210
8280
  if (no) return { ok: false, ...no };
8211
8281
  const release = () => deps.update(repo, number, (cur) => cur.fixing?.at === claimAt ? withoutFixClaim(cur) : cur);
8212
- const run2 = deps.activity?.start("reviews", `Fix it myself: ${repo} #${number}`);
8282
+ const run = deps.activity?.start("reviews", `Fix it myself: ${repo} #${number}`);
8213
8283
  const fail = (status, error, sessionId) => {
8214
8284
  release();
8215
- run2?.fail(error);
8285
+ run?.fail(error);
8216
8286
  return { ok: false, status, error, ...sessionId ? { sessionId } : {} };
8217
8287
  };
8218
8288
  try {
@@ -8273,13 +8343,13 @@ async function fixItMyself(deps, repo, number, input) {
8273
8343
  `${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`
8274
8344
  );
8275
8345
  const said = `${plural(moved, "comment")} on #${number} being fixed in ${label}${created ? " (new session)" : ""}`;
8276
- run2?.note(said, { level: "action", sessionId });
8277
- for (const w of warnings) run2?.note(`${label}: ${w}`, { level: "warn", sessionId });
8278
- run2?.done(said);
8346
+ run?.note(said, { level: "action", sessionId });
8347
+ for (const w of warnings) run?.note(`${label}: ${w}`, { level: "warn", sessionId });
8348
+ run?.done(said);
8279
8349
  return { ok: true, sessionId, created, review: next ?? claimed, ...warnings.length ? { warnings } : {} };
8280
8350
  } catch (err) {
8281
8351
  release();
8282
- run2?.fail(err.message);
8352
+ run?.fail(err.message);
8283
8353
  throw err;
8284
8354
  }
8285
8355
  }
@@ -8295,7 +8365,7 @@ function reviewModeOf(alias, config) {
8295
8365
  return { mode: "all", from: "default" };
8296
8366
  }
8297
8367
  function reviewProjects(config) {
8298
- return Object.entries(config.repos).map(([alias, path26]) => ({ alias, path: path26, mode: reviewModeOf(alias, config).mode }));
8368
+ return Object.entries(config.repos).map(([alias, path25]) => ({ alias, path: path25, mode: reviewModeOf(alias, config).mode }));
8299
8369
  }
8300
8370
  function reviewLimits(config) {
8301
8371
  return {
@@ -8306,7 +8376,7 @@ function reviewLimits(config) {
8306
8376
  var isReviewMode = (v) => v === "all" || v === "asked" || v === "off";
8307
8377
 
8308
8378
  // src/server/routes/review-routes.ts
8309
- var num3 = (s) => /^\d+$/.test(s) ? Number(s) : null;
8379
+ var num2 = (s) => /^\d+$/.test(s) ? Number(s) : null;
8310
8380
  function mountReviewRoutes(app, deps) {
8311
8381
  const changed = (repo, number) => deps.broadcast("reviews-changed", { repo, number });
8312
8382
  app.get("/api/reviews", (c) => {
@@ -8327,13 +8397,13 @@ function mountReviewRoutes(app, deps) {
8327
8397
  return c.json(deps.settings());
8328
8398
  });
8329
8399
  app.get("/api/reviews/:repo/:number", (c) => {
8330
- const n = num3(c.req.param("number"));
8400
+ const n = num2(c.req.param("number"));
8331
8401
  const r = n === null ? null : deps.read(c.req.param("repo"), n);
8332
8402
  return r ? c.json(shownReview(deps, r)) : c.json({ error: "no review of that PR" }, 404);
8333
8403
  });
8334
8404
  app.get("/api/reviews/:repo/:number/diff", async (c) => {
8335
8405
  const repo = c.req.param("repo");
8336
- const n = num3(c.req.param("number"));
8406
+ const n = num2(c.req.param("number"));
8337
8407
  const r = n === null ? null : deps.read(repo, n);
8338
8408
  const at = deps.repoPath(repo);
8339
8409
  if (!r || n === null || !r.mergeBase || !at) return c.json({ error: "no prepared review of that PR" }, 404);
@@ -8342,7 +8412,7 @@ function mountReviewRoutes(app, deps) {
8342
8412
  });
8343
8413
  app.post("/api/reviews/:repo/:number", async (c) => {
8344
8414
  const repo = c.req.param("repo");
8345
- const n = num3(c.req.param("number"));
8415
+ const n = num2(c.req.param("number"));
8346
8416
  if (n === null) return c.json({ error: "not a PR number" }, 400);
8347
8417
  const body = await c.req.json().catch(() => ({}));
8348
8418
  if (body.also !== void 0 && typeof body.also !== "string") return c.json({ error: "also: string" }, 400);
@@ -8354,7 +8424,7 @@ function mountReviewRoutes(app, deps) {
8354
8424
  });
8355
8425
  app.post("/api/reviews/:repo/:number/discussion", async (c) => {
8356
8426
  const repo = c.req.param("repo");
8357
- const n = num3(c.req.param("number"));
8427
+ const n = num2(c.req.param("number"));
8358
8428
  if (n === null || !deps.read(repo, n)) return c.json({ error: "no review of that PR" }, 404);
8359
8429
  const was = deps.read(repo, n)?.discussion?.at;
8360
8430
  const r = await deps.refreshDiscussion(repo, n);
@@ -8364,7 +8434,7 @@ function mountReviewRoutes(app, deps) {
8364
8434
  });
8365
8435
  app.post("/api/reviews/:repo/:number/drafts", async (c) => {
8366
8436
  const repo = c.req.param("repo");
8367
- const n = num3(c.req.param("number"));
8437
+ const n = num2(c.req.param("number"));
8368
8438
  if (n === null || !deps.read(repo, n)) return c.json({ error: "no review of that PR" }, 404);
8369
8439
  const body = await c.req.json().catch(() => null);
8370
8440
  let error = null;
@@ -8382,7 +8452,7 @@ function mountReviewRoutes(app, deps) {
8382
8452
  });
8383
8453
  app.post("/api/reviews/:repo/:number/submit", async (c) => {
8384
8454
  const repo = c.req.param("repo");
8385
- const n = num3(c.req.param("number"));
8455
+ const n = num2(c.req.param("number"));
8386
8456
  if (n === null) return c.json({ error: "no review of that PR" }, 404);
8387
8457
  const input = await c.req.json().catch(() => null);
8388
8458
  const out = await submitPrReview(deps, repo, n, input);
@@ -8392,7 +8462,7 @@ function mountReviewRoutes(app, deps) {
8392
8462
  });
8393
8463
  app.post("/api/reviews/:repo/:number/fix-myself", async (c) => {
8394
8464
  const repo = c.req.param("repo");
8395
- const n = num3(c.req.param("number"));
8465
+ const n = num2(c.req.param("number"));
8396
8466
  if (n === null || !deps.read(repo, n)) return c.json({ error: "no review of that PR" }, 404);
8397
8467
  if (!deps.fixMyself) return c.json({ error: "not available on this server" }, 501);
8398
8468
  const input = await c.req.json().catch(() => null);
@@ -8405,7 +8475,7 @@ function mountReviewRoutes(app, deps) {
8405
8475
  });
8406
8476
  app.post("/api/reviews/:repo/:number/in-doubt", async (c) => {
8407
8477
  const repo = c.req.param("repo");
8408
- const n = num3(c.req.param("number"));
8478
+ const n = num2(c.req.param("number"));
8409
8479
  if (n === null || !deps.read(repo, n)) return c.json({ error: "no review of that PR" }, 404);
8410
8480
  const body = await c.req.json().catch(() => null);
8411
8481
  if (!body || typeof body.went !== "boolean") return c.json({ error: "expected {went: true|false}" }, 400);
@@ -8416,7 +8486,7 @@ function mountReviewRoutes(app, deps) {
8416
8486
  });
8417
8487
  app.delete("/api/reviews/:repo/:number/dropped", (c) => {
8418
8488
  const repo = c.req.param("repo");
8419
- const n = num3(c.req.param("number"));
8489
+ const n = num2(c.req.param("number"));
8420
8490
  const next = n === null ? null : deps.update(repo, n, clearDropped);
8421
8491
  if (!next || n === null) return c.json({ error: "no review of that PR" }, 404);
8422
8492
  changed(repo, n);
@@ -8424,7 +8494,7 @@ function mountReviewRoutes(app, deps) {
8424
8494
  });
8425
8495
  app.delete("/api/reviews/:repo/:number/drafts/:id", (c) => {
8426
8496
  const repo = c.req.param("repo");
8427
- const n = num3(c.req.param("number"));
8497
+ const n = num2(c.req.param("number"));
8428
8498
  if (n === null || !deps.read(repo, n)) return c.json({ error: "no review of that PR" }, 404);
8429
8499
  const id = c.req.param("id");
8430
8500
  let refused = null;
@@ -8447,49 +8517,59 @@ function mountReviewRoutes(app, deps) {
8447
8517
  // src/core/review/review-tree.ts
8448
8518
  import { randomBytes } from "crypto";
8449
8519
  import fs15 from "fs";
8450
- import path18 from "path";
8520
+ import path17 from "path";
8451
8521
 
8452
8522
  // src/core/review/review-source.ts
8453
8523
  var reviewRef = (number) => `refs/work/review/${number}`;
8454
8524
  var ATTR_CHUNK = 200;
8455
- var git2 = (run2, cwd, ...args) => run2("git", args, cwd);
8456
- async function preparePr(run2, repoPath, host, pr) {
8525
+ var git2 = (run, cwd, ...args) => run("git", args, cwd);
8526
+ async function preparePr(run, repoPath, host, pr) {
8457
8527
  const ref = reviewRef(pr.number);
8458
- const head = await git2(run2, repoPath, "fetch", "--quiet", "--no-tags", "origin", `+${host.prRef(pr.number)}:${ref}`);
8528
+ const head = await git2(run, repoPath, "fetch", "--quiet", "--no-tags", "origin", `+${host.prRef(pr.number)}:${ref}`);
8459
8529
  if (head.code !== 0)
8460
8530
  return { ok: false, error: `couldn't fetch the PR's code: ${head.stderr.trim().split("\n")[0] || "git fetch failed"}` };
8461
8531
  if (host.prRefIsMerge) {
8462
- const second = await git2(run2, repoPath, "rev-parse", "--verify", "--quiet", `${ref}^2`);
8532
+ const second = await git2(run, repoPath, "rev-parse", "--verify", "--quiet", `${ref}^2`);
8463
8533
  const tip = second.stdout.trim();
8464
8534
  if (second.code !== 0 || !tip) return { ok: false, error: "the PR's merge ref has no second parent: can't tell its head" };
8465
- const moved = await git2(run2, repoPath, "update-ref", ref, tip);
8535
+ const moved = await git2(run, repoPath, "update-ref", ref, tip);
8466
8536
  if (moved.code !== 0) return { ok: false, error: `couldn't keep the PR's head: ${moved.stderr.trim().split(/\r?\n/)[0]}` };
8467
8537
  }
8468
- if (pr.base) await git2(run2, repoPath, "fetch", "--quiet", "--no-tags", "origin", `+refs/heads/${pr.base}:refs/remotes/origin/${pr.base}`);
8469
- const sha = (await git2(run2, repoPath, "rev-parse", ref)).stdout.trim();
8538
+ if (pr.base) await git2(run, repoPath, "fetch", "--quiet", "--no-tags", "origin", `+refs/heads/${pr.base}:refs/remotes/origin/${pr.base}`);
8539
+ const sha = (await git2(run, repoPath, "rev-parse", ref)).stdout.trim();
8470
8540
  const baseRef = pr.base ? `refs/remotes/origin/${pr.base}` : "origin/HEAD";
8471
- const mb = await git2(run2, repoPath, "merge-base", baseRef, ref);
8541
+ const mb = await git2(run, repoPath, "merge-base", baseRef, ref);
8472
8542
  if (mb.code !== 0 || !mb.stdout.trim()) return { ok: false, error: `no common commit with ${pr.base || "the default branch"}` };
8473
8543
  const mergeBase = mb.stdout.trim();
8474
- const files = await reviewDiff(run2, repoPath, mergeBase, ref);
8544
+ const files = await reviewDiff(run, repoPath, mergeBase, ref);
8475
8545
  if (!files) return { ok: false, error: "git couldn't diff the PR" };
8476
- return { ok: true, files, extras: await diffExtras(run2, repoPath, mergeBase, ref, files), mergeBase, headSha: sha };
8546
+ return { ok: true, files, extras: await diffExtras(run, repoPath, mergeBase, ref, files), mergeBase, headSha: sha };
8477
8547
  }
8478
- async function reviewDiff(run2, repoPath, from, to) {
8479
- const d = await git2(run2, repoPath, "diff", "--no-color", "--no-ext-diff", "-M", from, to);
8548
+ async function reviewDiff(run, repoPath, from, to) {
8549
+ const d = await git2(run, repoPath, "diff", "--no-color", "--no-ext-diff", "-M", from, to);
8480
8550
  return d.code === 0 ? parseGitDiff(d.stdout) : null;
8481
8551
  }
8482
- async function diffExtras(run2, repoPath, from, to, files) {
8552
+ function numstatChanged(stdout) {
8553
+ const out = /* @__PURE__ */ new Set();
8554
+ const parts = stdout.split("\0");
8555
+ for (let i = 0; i < parts.length; i++) {
8556
+ const m = /^(-|\d+)\t(-|\d+)\t(.*)$/s.exec(parts[i].replace(/^\n+/, ""));
8557
+ if (!m) continue;
8558
+ const path25 = m[3] === "" ? parts[i += 2] : m[3];
8559
+ const counted = m[1] === "-" || m[2] === "-" || Number(m[1]) + Number(m[2]) > 0;
8560
+ if (path25 && counted) out.add(path25);
8561
+ }
8562
+ return out;
8563
+ }
8564
+ async function diffExtras(run, repoPath, from, to, files) {
8483
8565
  const changed = files.filter((f) => f.added + f.deleted > 0).map((f) => f.path);
8484
- const w = await git2(run2, repoPath, "diff", "--no-color", "--no-ext-diff", "-M", "-w", "--name-only", from, to);
8485
- const real = new Set(
8486
- w.code === 0 ? w.stdout.split("\n").map((l) => l.trim()).filter(Boolean) : changed
8487
- );
8566
+ const w = await git2(run, repoPath, "diff", "--no-color", "--no-ext-diff", "-M", "-w", "--numstat", "-z", from, to);
8567
+ const real = w.code === 0 ? numstatChanged(w.stdout) : new Set(changed);
8488
8568
  const whitespaceOnly = new Set(w.code === 0 ? changed.filter((p) => !real.has(p)) : []);
8489
8569
  const generated = /* @__PURE__ */ new Set();
8490
8570
  const paths = files.map((f) => f.path);
8491
8571
  for (let i = 0; i < paths.length; i += ATTR_CHUNK) {
8492
- const attr = await git2(run2, repoPath, "check-attr", `--source=${to}`, "linguist-generated", "--", ...paths.slice(i, i + ATTR_CHUNK));
8572
+ const attr = await git2(run, repoPath, "check-attr", `--source=${to}`, "linguist-generated", "--", ...paths.slice(i, i + ATTR_CHUNK));
8493
8573
  if (attr.code !== 0) break;
8494
8574
  for (const line of attr.stdout.split("\n")) {
8495
8575
  const m = /^(.*): linguist-generated: (set|true)$/.exec(line.trim());
@@ -8498,18 +8578,18 @@ async function diffExtras(run2, repoPath, from, to, files) {
8498
8578
  }
8499
8579
  return { whitespaceOnly, generated };
8500
8580
  }
8501
- async function dropReviewRef(run2, repoPath, number) {
8502
- await git2(run2, repoPath, "update-ref", "-d", reviewRef(number));
8581
+ async function dropReviewRef(run, repoPath, number) {
8582
+ await git2(run, repoPath, "update-ref", "-d", reviewRef(number));
8503
8583
  }
8504
8584
 
8505
8585
  // src/core/review/review-tree.ts
8506
- var reviewTreesDir = () => path18.join(getConfigDir(), "review-trees");
8586
+ var reviewTreesDir = () => path17.join(getConfigDir(), "review-trees");
8507
8587
  var NO_HOOKS = ".no-hooks";
8508
8588
  var NO_LFS = ["-c", "filter.lfs.smudge=", "-c", "filter.lfs.process=", "-c", "filter.lfs.required=false"];
8509
8589
  var NO_LFS_ENV = { GIT_LFS_SKIP_SMUDGE: "1" };
8510
- function reviewTreeName(alias, number, headSha, run2) {
8590
+ function reviewTreeName(alias, number, headSha, run) {
8511
8591
  const safe = alias.replace(/[^A-Za-z0-9._-]/g, "_").replace(/^\.+/, "_") || "repo";
8512
- const tag = run2.replace(/[^A-Za-z0-9]/g, "");
8592
+ const tag = run.replace(/[^A-Za-z0-9]/g, "");
8513
8593
  return `${safe}-${number}-${headSha.slice(0, 8)}${tag ? `-${tag}` : ""}`;
8514
8594
  }
8515
8595
  var runSuffix = () => `${process.pid.toString(36)}${randomBytes(3).toString("hex")}`;
@@ -8521,13 +8601,13 @@ function rmTree(dir) {
8521
8601
  }
8522
8602
  return !fs15.existsSync(dir);
8523
8603
  }
8524
- async function createReviewTree(run2, at, opts) {
8604
+ async function createReviewTree(run, at, opts) {
8525
8605
  const root = opts.root ?? reviewTreesDir();
8526
- const dir = path18.join(root, reviewTreeName(at.alias, at.number, at.headSha, opts.run ?? runSuffix()));
8527
- const noHooks = path18.join(root, NO_HOOKS);
8606
+ const dir = path17.join(root, reviewTreeName(at.alias, at.number, at.headSha, opts.run ?? runSuffix()));
8607
+ const noHooks = path17.join(root, NO_HOOKS);
8528
8608
  fs15.mkdirSync(noHooks, { recursive: true });
8529
- if (fs15.existsSync(dir)) await removeReviewTree(run2, at.repoPath, dir);
8530
- const added = await run2(
8609
+ if (fs15.existsSync(dir)) await removeReviewTree(run, at.repoPath, dir);
8610
+ const added = await run(
8531
8611
  "git",
8532
8612
  [
8533
8613
  "-c",
@@ -8546,58 +8626,58 @@ async function createReviewTree(run2, at, opts) {
8546
8626
  NO_LFS_ENV
8547
8627
  );
8548
8628
  if (added.code !== 0) {
8549
- await removeReviewTree(run2, at.repoPath, dir);
8629
+ await removeReviewTree(run, at.repoPath, dir);
8550
8630
  return { ok: false, error: `couldn't check the PR out: ${firstLine(added.stderr) || "git worktree add failed"}` };
8551
8631
  }
8552
- const head = await run2("git", ["rev-parse", "HEAD"], dir);
8632
+ const head = await run("git", ["rev-parse", "HEAD"], dir);
8553
8633
  if (head.code !== 0 || head.stdout.trim() !== at.headSha) {
8554
- await removeReviewTree(run2, at.repoPath, dir);
8634
+ await removeReviewTree(run, at.repoPath, dir);
8555
8635
  return { ok: false, error: "the checkout isn't at the reviewed commit (the PR moved meanwhile)" };
8556
8636
  }
8557
- const listed = await run2("git", ["ls-files", "-z"], dir);
8637
+ const listed = await run("git", ["ls-files", "-z"], dir);
8558
8638
  if (listed.code !== 0) {
8559
- await removeReviewTree(run2, at.repoPath, dir);
8639
+ await removeReviewTree(run, at.repoPath, dir);
8560
8640
  return { ok: false, error: "couldn't list the checkout's files to remove its settings" };
8561
8641
  }
8562
8642
  const removed = [];
8563
8643
  for (const rel of listed.stdout.split("\0").filter((rel2) => opts.strip(rel2))) {
8564
- const file = path18.join(dir, rel);
8644
+ const file = path17.join(dir, rel);
8565
8645
  fs15.rmSync(file, { recursive: true, force: true });
8566
8646
  if (fs15.existsSync(file)) {
8567
- await removeReviewTree(run2, at.repoPath, dir);
8647
+ await removeReviewTree(run, at.repoPath, dir);
8568
8648
  return { ok: false, error: `couldn't remove ${rel} from the checkout` };
8569
8649
  }
8570
8650
  removed.push(rel);
8571
8651
  }
8572
8652
  return { ok: true, dir, removed };
8573
8653
  }
8574
- async function removeReviewTree(run2, repoPath, dir) {
8575
- if (fs15.existsSync(dir)) await run2("git", ["worktree", "remove", "--force", "--force", dir], repoPath);
8654
+ async function removeReviewTree(run, repoPath, dir) {
8655
+ if (fs15.existsSync(dir)) await run("git", ["worktree", "remove", "--force", "--force", dir], repoPath);
8576
8656
  const gone = rmTree(dir);
8577
- await run2("git", ["worktree", "prune"], repoPath);
8657
+ await run("git", ["worktree", "prune"], repoPath);
8578
8658
  return gone;
8579
8659
  }
8580
- async function withReviewTree(run2, at, use, opts) {
8581
- const tree = await createReviewTree(run2, at, opts);
8660
+ async function withReviewTree(run, at, use, opts) {
8661
+ const tree = await createReviewTree(run, at, opts);
8582
8662
  if (!tree.ok) return tree;
8583
8663
  let value;
8584
8664
  let gone;
8585
8665
  try {
8586
8666
  value = await use(tree.dir, tree.removed);
8587
8667
  } finally {
8588
- gone = await removeReviewTree(run2, at.repoPath, tree.dir).catch(() => false);
8668
+ gone = await removeReviewTree(run, at.repoPath, tree.dir).catch(() => false);
8589
8669
  }
8590
8670
  return { ok: true, value, ...gone ? {} : { left: tree.dir } };
8591
8671
  }
8592
8672
  function gitDirOf(dir) {
8593
8673
  try {
8594
- const m = /^gitdir:\s*(.+)$/m.exec(fs15.readFileSync(path18.join(dir, ".git"), "utf8"));
8595
- return m ? path18.resolve(dir, m[1].trim(), "..", "..") : null;
8674
+ const m = /^gitdir:\s*(.+)$/m.exec(fs15.readFileSync(path17.join(dir, ".git"), "utf8"));
8675
+ return m ? path17.resolve(dir, m[1].trim(), "..", "..") : null;
8596
8676
  } catch {
8597
8677
  return null;
8598
8678
  }
8599
8679
  }
8600
- async function sweepReviewTrees(run2, opts = {}) {
8680
+ async function sweepReviewTrees(run, opts = {}) {
8601
8681
  const root = opts.root ?? reviewTreesDir();
8602
8682
  const now = opts.now?.() ?? Date.now();
8603
8683
  const swept = [];
@@ -8609,14 +8689,14 @@ async function sweepReviewTrees(run2, opts = {}) {
8609
8689
  return { swept, failed };
8610
8690
  }
8611
8691
  for (const name of names) {
8612
- const dir = path18.join(root, name);
8692
+ const dir = path17.join(root, name);
8613
8693
  try {
8614
8694
  if (opts.olderThanMs && now - fs15.statSync(dir).mtimeMs < opts.olderThanMs) continue;
8615
8695
  } catch {
8616
8696
  continue;
8617
8697
  }
8618
8698
  const gitDir = gitDirOf(dir);
8619
- const gone = gitDir && fs15.existsSync(gitDir) ? await removeReviewTree(run2, gitDir, dir) : rmTree(dir);
8699
+ const gone = gitDir && fs15.existsSync(gitDir) ? await removeReviewTree(run, gitDir, dir) : rmTree(dir);
8620
8700
  (gone ? swept : failed).push(name);
8621
8701
  }
8622
8702
  return { swept, failed };
@@ -8817,8 +8897,8 @@ function createReviewQueue(deps) {
8817
8897
  }
8818
8898
  }
8819
8899
  async function sweepNow() {
8820
- const run2 = deps.activity?.start("reviews", "Preparing PR reviews");
8821
- const note = (text, level = "info") => run2?.note(text, { level });
8900
+ const run = deps.activity?.start("reviews", "Preparing PR reviews");
8901
+ const note = (text, level = "info") => run?.note(text, { level });
8822
8902
  const { maxPerDay } = deps.limits();
8823
8903
  const asked = [];
8824
8904
  const open = /* @__PURE__ */ new Set();
@@ -8907,9 +8987,9 @@ function createReviewQueue(deps) {
8907
8987
  note(`${talk.length - DISCUSSIONS_PER_SWEEP} more discussions to read again: the next sweep`);
8908
8988
  if (read) note(`read the discussion of ${plural2(read, "PR")} again (moved on the host, or half an hour old)`);
8909
8989
  deps.changed();
8910
- run2?.done(todo.length ? `${plural2(todo.length, "PR")} looked at` : read ? `${plural2(read, "discussion")} read again` : "nothing new");
8990
+ run?.done(todo.length ? `${plural2(todo.length, "PR")} looked at` : read ? `${plural2(read, "discussion")} read again` : "nothing new");
8911
8991
  } catch (err) {
8912
- run2?.fail(err.message);
8992
+ run?.fail(err.message);
8913
8993
  }
8914
8994
  }
8915
8995
  return {
@@ -8927,11 +9007,11 @@ function createReviewQueue(deps) {
8927
9007
  if (!list.ok) return { ok: false, error: list.error };
8928
9008
  const pr = list.prs.find((p) => p.number === number);
8929
9009
  if (!pr) return { ok: false, error: `#${number} isn't an open pull request of ${repo}` };
8930
- const run2 = deps.activity?.start("reviews", `Preparing the review of ${repo} #${number}`);
8931
- const note = (text, level = "info") => run2?.note(text, { level });
9010
+ const run = deps.activity?.start("reviews", `Preparing the review of ${repo} #${number}`);
9011
+ const note = (text, level = "info") => run?.note(text, { level });
8932
9012
  const r = await oneAtATime3(() => prepareOne(project, metaOf(repo, host, pr), pr, false, note, also));
8933
- if (r.ok) run2?.done(`prepared${r.how ? `; ${r.how}` : ""}`);
8934
- else run2?.fail(r.error);
9013
+ if (r.ok) run?.done(`prepared${r.how ? `; ${r.how}` : ""}`);
9014
+ else run?.fail(r.error);
8935
9015
  return r.ok ? { ok: true, review: r.review } : { ok: false, error: r.error };
8936
9016
  },
8937
9017
  async refreshDiscussion(repo, number) {
@@ -9094,7 +9174,7 @@ function startReviewSweeps(opts) {
9094
9174
  }
9095
9175
 
9096
9176
  // src/core/diff/session-history.ts
9097
- import path19 from "path";
9177
+ import path18 from "path";
9098
9178
 
9099
9179
  // src/core/diff/diff-points.ts
9100
9180
  var SHA = /^[0-9a-f]{7,40}$/;
@@ -9190,12 +9270,12 @@ async function sessionHistory(session, others = []) {
9190
9270
  });
9191
9271
  if (diffArg === "HEAD") continue;
9192
9272
  const log = await g(["log", `-n${MAX_COMMITS2}`, "--format=%H%x1f%cI%x1f%s", `${diffArg}..HEAD`, "--"], root);
9193
- if (log.ok && log.out) commits.push(...parseLog(log.out, path19.basename(root)));
9273
+ if (log.ok && log.out) commits.push(...parseLog(log.out, path18.basename(root)));
9194
9274
  }
9195
9275
  for (const b of others) {
9196
9276
  const tip = await tipOf(b);
9197
9277
  if (!tip) continue;
9198
- const repo = path19.basename(b.path);
9278
+ const repo = path18.basename(b.path);
9199
9279
  const start = liveStart(b) ?? b.start;
9200
9280
  let list = [];
9201
9281
  let base;
@@ -9256,7 +9336,7 @@ function parseLog(stdout, repo) {
9256
9336
  return out;
9257
9337
  }
9258
9338
  function computeSessionRange(session, from, to) {
9259
- const paths = session.paths.map((p) => path19.resolve(p));
9339
+ const paths = session.paths.map((p) => path18.resolve(p));
9260
9340
  const refs = rangeRefs(paths, loadManifest(scopeHashForPaths(paths)).entries, from, to);
9261
9341
  if ("error" in refs) return refs;
9262
9342
  return { repos: refs.map((r) => ({ name: r.name, root: r.root, files: computeRangeDiff(r) })) };
@@ -9275,17 +9355,17 @@ async function sessionHistoryWire(session) {
9275
9355
  }
9276
9356
 
9277
9357
  // src/server/routes/revert-routes.ts
9278
- import path21 from "path";
9358
+ import path20 from "path";
9279
9359
  import { zValidator as zValidator8 } from "@hono/zod-validator";
9280
9360
  import { z as z7 } from "zod";
9281
9361
 
9282
9362
  // src/core/diff/revert.ts
9283
9363
  import fs17 from "fs";
9284
- import path20 from "path";
9364
+ import path19 from "path";
9285
9365
  function inside(root, rel) {
9286
- const abs = path20.resolve(root, rel);
9287
- const back = path20.relative(path20.resolve(root), abs);
9288
- if (!back || back.startsWith("..") || path20.isAbsolute(back)) return null;
9366
+ const abs = path19.resolve(root, rel);
9367
+ const back = path19.relative(path19.resolve(root), abs);
9368
+ if (!back || back.startsWith("..") || path19.isAbsolute(back)) return null;
9289
9369
  return abs;
9290
9370
  }
9291
9371
  function inHead(root, rel) {
@@ -9398,8 +9478,8 @@ function mountRevertRoutes(app, opts) {
9398
9478
  if (!session) return c.json({ error: "unknown session" }, 404);
9399
9479
  const body = c.req.valid("json");
9400
9480
  const repo = opts.uncommitted(session).find((r) => r.name === body.repo);
9401
- const allowed = new Set(session.paths.map((p) => path21.resolve(p).toLowerCase()));
9402
- if (!repo || !allowed.has(path21.resolve(repo.root).toLowerCase())) {
9481
+ const allowed = new Set(session.paths.map((p) => path20.resolve(p).toLowerCase()));
9482
+ if (!repo || !allowed.has(path20.resolve(repo.root).toLowerCase())) {
9403
9483
  return c.json({ error: `unknown repo: ${body.repo}` }, 404);
9404
9484
  }
9405
9485
  const file = repo.files.find((f) => f.path === body.path);
@@ -9557,10 +9637,10 @@ function mountCiRoutes(app, opts) {
9557
9637
 
9558
9638
  // src/core/diff/diffs-sweep.ts
9559
9639
  import fs19 from "fs";
9560
- import path22 from "path";
9640
+ import path21 from "path";
9561
9641
  var SWEEP_AFTER_DAYS = 30;
9562
9642
  var DISPOSABLE = /\.(html|log)$/i;
9563
- function sweepOldDiffArtifacts(now = Date.now(), maxAgeDays = SWEEP_AFTER_DAYS, dir = path22.join(getConfigDir(), "diffs")) {
9643
+ function sweepOldDiffArtifacts(now = Date.now(), maxAgeDays = SWEEP_AFTER_DAYS, dir = path21.join(getConfigDir(), "diffs")) {
9564
9644
  const cutoff = now - maxAgeDays * 24 * 60 * 60 * 1e3;
9565
9645
  let removed = 0;
9566
9646
  let bytes = 0;
@@ -9572,7 +9652,7 @@ function sweepOldDiffArtifacts(now = Date.now(), maxAgeDays = SWEEP_AFTER_DAYS,
9572
9652
  }
9573
9653
  for (const name of names) {
9574
9654
  if (!DISPOSABLE.test(name)) continue;
9575
- const file = path22.join(dir, name);
9655
+ const file = path21.join(dir, name);
9576
9656
  try {
9577
9657
  const st = fs19.statSync(file);
9578
9658
  if (!st.isFile() || st.mtimeMs >= cutoff) continue;
@@ -9664,16 +9744,20 @@ function attachTerminalWs(httpServer, port, opts = {}) {
9664
9744
  return;
9665
9745
  }
9666
9746
  const sessionId = decodeURIComponent(match[1]);
9667
- const force = new URLSearchParams(match[2] ?? "").get("force") === "1";
9747
+ const params = new URLSearchParams(match[2] ?? "");
9748
+ const force = params.get("force") === "1";
9749
+ const flow = params.get(FLOW_PARAM) === "1";
9750
+ const grid = gridFromParams(params);
9751
+ const resume = resumeFromParams(params);
9668
9752
  wss.handleUpgrade(req, socket, head, (ws) => {
9669
- void bridgeToHost(ws, sessionId, force ? null : elsewhere(sessionId));
9753
+ void bridgeToHost(ws, sessionId, force || resume ? null : elsewhere(sessionId), flow, grid, resume);
9670
9754
  });
9671
9755
  });
9672
9756
  return {
9673
9757
  close: () => wss.close()
9674
9758
  };
9675
9759
  }
9676
- async function bridgeToHost(ws, sessionId, pending) {
9760
+ async function bridgeToHost(ws, sessionId, pending, flow = false, grid = null, resume = null) {
9677
9761
  const elsewhere = await pending;
9678
9762
  if (ws.readyState !== WebSocket.OPEN) return;
9679
9763
  if (elsewhere) {
@@ -9697,7 +9781,7 @@ async function bridgeToHost(ws, sessionId, pending) {
9697
9781
  ws.on("error", drop);
9698
9782
  let hostUrl;
9699
9783
  try {
9700
- hostUrl = await ensurePty(sessionId);
9784
+ hostUrl = await ensurePty(sessionId, { ...grid ? { grid } : {}, ...resume ? { attachOnly: true } : {} });
9701
9785
  } catch (err) {
9702
9786
  try {
9703
9787
  ws.send(JSON.stringify({ type: "error", message: err.message }));
@@ -9715,7 +9799,7 @@ async function bridgeToHost(ws, sessionId, pending) {
9715
9799
  return;
9716
9800
  }
9717
9801
  if (browserGone) return;
9718
- upstream = new WebSocket(hostUrl);
9802
+ upstream = new WebSocket(withResume(withGrid(flow ? withFlow(hostUrl) : hostUrl, grid), resume));
9719
9803
  const up = upstream;
9720
9804
  const queued = [];
9721
9805
  up.on("open", () => {
@@ -10001,9 +10085,9 @@ function mountAccountRoutes(app, opts) {
10001
10085
 
10002
10086
  // src/core/sessions/account-skills-child.ts
10003
10087
  var lastLine = (text) => text.split("\n").map((l) => l.trim()).filter(Boolean).pop() ?? "";
10004
- function accountSkillsInChild(workBin, run2 = runWorkChild) {
10088
+ function accountSkillsInChild(workBin, run = runWorkChild) {
10005
10089
  return async (name) => {
10006
- const r = await run2(workBin(), ["account", "skills", name], { timeoutMs: 5 * 6e4 });
10090
+ const r = await run(workBin(), ["account", "skills", name], { timeoutMs: 5 * 6e4 });
10007
10091
  if (r.spawnError) return { ok: false, message: `couldn't start work: ${r.spawnError}` };
10008
10092
  if (r.timedOut) return { ok: false, message: "installing work\u2019s skills took too long" };
10009
10093
  const said = lastLine(r.stdout) || lastLine(r.stderr);
@@ -10176,7 +10260,7 @@ var localReviewRow = () => null;
10176
10260
  function computeSessionDiff(s, base) {
10177
10261
  const resolved = s.paths.map((p) => resolveRepoDiff(p, base, s.baseBranches?.[p] ?? s.baseBranch));
10178
10262
  const repos = s.paths.map((p, i) => ({
10179
- name: path23.basename(p),
10263
+ name: path22.basename(p),
10180
10264
  root: p,
10181
10265
  resolvedBase: resolved[i].resolvedBase,
10182
10266
  files: computeDiff({ root: p, diffArg: resolved[i].diffArg })
@@ -10280,7 +10364,7 @@ async function startWebServer(opts = {}) {
10280
10364
  }, 500);
10281
10365
  }
10282
10366
  });
10283
- const repoNames = (s) => s.isGroup ? s.paths.map((p) => path23.basename(p)) : [s.target];
10367
+ const repoNames = (s) => s.isGroup ? s.paths.map((p) => path22.basename(p)) : [s.target];
10284
10368
  const diffStatFor = (id, s, hasStatus) => wantsDiffStat(s, hasStatus) ? diffStats.get(id, s.paths, repoNames(s)) : null;
10285
10369
  const archivedRow = createArchivedRows();
10286
10370
  app.get("/api/sessions", (c) => {
@@ -10454,12 +10538,12 @@ async function startWebServer(opts = {}) {
10454
10538
  busy: restartBusy,
10455
10539
  running: peekPty,
10456
10540
  report: (notes) => {
10457
- const run2 = activity.start("agents", "Restarting agents");
10541
+ const run = activity.start("agents", "Restarting agents");
10458
10542
  for (const { id, text, level } of notes) {
10459
10543
  const s = findSession2(id);
10460
- run2.note(`${s ? `${s.target} ${s.branch}` : id}: ${text}`, { level, sessionId: s ? id : void 0 });
10544
+ run.note(`${s ? `${s.target} ${s.branch}` : id}: ${text}`, { level, sessionId: s ? id : void 0 });
10461
10545
  }
10462
- run2.done(restartNotesSummary(notes));
10546
+ run.done(restartNotesSummary(notes));
10463
10547
  },
10464
10548
  changed: () => {
10465
10549
  broadcast("agents-changed", { ts: Date.now() });
@@ -10514,7 +10598,7 @@ async function startWebServer(opts = {}) {
10514
10598
  const minutes = loadConfig()?.sleepIdleAfterMinutes ?? DEFAULT_SLEEP_AFTER_MINUTES;
10515
10599
  if (sleepAfterMs(minutes) === 0)
10516
10600
  return activity.skip("idle-sleep", "Looking for idle Claudes", "turned off (sleepIdleAfterMinutes: 0)");
10517
- const run2 = activity.start("idle-sleep", "Looking for idle Claudes");
10601
+ const run = activity.start("idle-sleep", "Looking for idle Claudes");
10518
10602
  const ptys = await listHostPtys().catch(() => []);
10519
10603
  const quiet = new Set(sleepCandidates(ptys, Date.now(), sleepAfterMs(minutes), agentBusy));
10520
10604
  const plan = await sleepPlan(
@@ -10523,7 +10607,7 @@ async function startWebServer(opts = {}) {
10523
10607
  );
10524
10608
  for (const { id, why } of plan.awake) {
10525
10609
  const s = findSession2(id);
10526
- run2.note(`${s ? `${s.target} ${s.branch}` : id}: kept awake: ${why}`, { sessionId: s ? id : void 0 });
10610
+ run.note(`${s ? `${s.target} ${s.branch}` : id}: kept awake: ${why}`, { sessionId: s ? id : void 0 });
10527
10611
  }
10528
10612
  const ids = plan.sleep;
10529
10613
  for (const id of ids) {
@@ -10533,16 +10617,16 @@ async function startWebServer(opts = {}) {
10533
10617
  async () => {
10534
10618
  await markAgentStopped(id).catch(() => {
10535
10619
  });
10536
- run2.note(
10620
+ run.note(
10537
10621
  `${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)`,
10538
10622
  { level: "action", sessionId: id }
10539
10623
  );
10540
10624
  },
10541
- (err) => run2.note(`${id}: couldn't stop its Claude: ${err.message}`, { level: "warn", sessionId: id })
10625
+ (err) => run.note(`${id}: couldn't stop its Claude: ${err.message}`, { level: "warn", sessionId: id })
10542
10626
  );
10543
10627
  }
10544
10628
  const slept = ids.length;
10545
- run2.done(`${ptys.length} Claude${ptys.length === 1 ? "" : "s"} running \xB7 ${slept ? `${slept} put to sleep` : "none idle long enough"}`);
10629
+ run.done(`${ptys.length} Claude${ptys.length === 1 ? "" : "s"} running \xB7 ${slept ? `${slept} put to sleep` : "none idle long enough"}`);
10546
10630
  if (ids.length) broadcast("sessions-changed", { ts: Date.now() });
10547
10631
  };
10548
10632
  sleepSchedule?.next(Date.now() + SLEEP_EVERY_MS);
@@ -10601,15 +10685,15 @@ async function startWebServer(opts = {}) {
10601
10685
  const archiveUpkeep = () => {
10602
10686
  retentionSchedule?.next(Date.now() + RETENTION_EVERY_MS);
10603
10687
  const cfg = loadConfig()?.archive;
10604
- const run2 = activity.start("archive", "Compressing old archived conversations");
10688
+ const run = activity.start("archive", "Compressing old archived conversations");
10605
10689
  try {
10606
10690
  const r = applyArchiveRetention({ compressAfterDays: cfg?.compressAfterDays, dropAfterDays: cfg?.dropTranscriptsAfterDays });
10607
10691
  const mb = Math.round(r.bytesSaved / 1e6);
10608
- run2.done(
10692
+ run.done(
10609
10693
  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"
10610
10694
  );
10611
10695
  } catch (err) {
10612
- run2.fail(err.message);
10696
+ run.fail(err.message);
10613
10697
  }
10614
10698
  };
10615
10699
  const retentionFirst = !jobs ? null : setTimeout(archiveUpkeep, 3 * 6e4);
@@ -10625,18 +10709,18 @@ async function startWebServer(opts = {}) {
10625
10709
  conversationsSchedule?.next(Date.now() + CONVERSATIONS_EVERY_MS);
10626
10710
  if (conversationsBusy) return;
10627
10711
  conversationsBusy = true;
10628
- const run2 = activity.start("conversations", "Copying new conversation lines");
10712
+ const run = activity.start("conversations", "Copying new conversation lines");
10629
10713
  try {
10630
10714
  const r = await syncConversations(loadHistory().filter((s) => !s.archivedAt));
10631
10715
  const packed = await compressQuietCopies();
10632
- run2.done(
10716
+ run.done(
10633
10717
  [
10634
10718
  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",
10635
10719
  packed.files ? `${packed.files} quiet one${packed.files === 1 ? "" : "s"} compressed \xB7 ${Math.round(packed.bytesSaved / 1e6)} MB freed` : ""
10636
10720
  ].filter(Boolean).join(" \xB7 ")
10637
10721
  );
10638
10722
  } catch (err) {
10639
- run2.fail(err.message);
10723
+ run.fail(err.message);
10640
10724
  } finally {
10641
10725
  conversationsBusy = false;
10642
10726
  }
@@ -10702,7 +10786,7 @@ async function startWebServer(opts = {}) {
10702
10786
  blocksSchedule?.next(Date.now() + BLOCKS_EVERY_MS);
10703
10787
  if (blocksBusy || allBlocks().size === 0) return;
10704
10788
  blocksBusy = true;
10705
- const run2 = activity.start("blocks", "Checking what sessions wait on");
10789
+ const run = activity.start("blocks", "Checking what sessions wait on");
10706
10790
  try {
10707
10791
  const history = loadHistory();
10708
10792
  const live = new Set(history.filter((x) => !x.archivedAt).map((x) => sessionIdFor(x)));
@@ -10714,7 +10798,7 @@ async function startWebServer(opts = {}) {
10714
10798
  const r = await blockedPrState(url, defaultRunner);
10715
10799
  if (r && "rateLimited" in r) {
10716
10800
  ghRestUntil = Date.now() + 10 * 6e4;
10717
- run2.note(`${r.host} API limit reached: resting 10 minutes`, { level: "warn" });
10801
+ run.note(`${r.host} API limit reached: resting 10 minutes`, { level: "warn" });
10718
10802
  return null;
10719
10803
  }
10720
10804
  return r?.state ?? null;
@@ -10722,7 +10806,7 @@ async function startWebServer(opts = {}) {
10722
10806
  unblocked: async (id, done) => {
10723
10807
  const s = history.find((x) => sessionIdFor(x) === id);
10724
10808
  const name = s ? `${s.target} \xB7 ${s.branch}` : id;
10725
- run2.note(`${name}: no longer waiting (${done.map((b) => b.label).join(", ")})`, { sessionId: id });
10809
+ run.note(`${name}: no longer waiting (${done.map((b) => b.label).join(", ")})`, { sessionId: id });
10726
10810
  const event = {
10727
10811
  sessionId: id,
10728
10812
  kind: "unblocked",
@@ -10734,10 +10818,10 @@ async function startWebServer(opts = {}) {
10734
10818
  if (s) await stackDeps.tell(s, unblockedPrompt(done)).catch((err) => logSwallowed(`telling ${name} it is unblocked`, err));
10735
10819
  }
10736
10820
  });
10737
- run2.done(freed.length ? `${freed.length} unblocked` : "still waiting");
10821
+ run.done(freed.length ? `${freed.length} unblocked` : "still waiting");
10738
10822
  if (freed.length) broadcast("sessions-changed", { ts: Date.now() });
10739
10823
  } catch (err) {
10740
- run2.fail(err.message);
10824
+ run.fail(err.message);
10741
10825
  } finally {
10742
10826
  blocksBusy = false;
10743
10827
  }
@@ -10748,18 +10832,18 @@ async function startWebServer(opts = {}) {
10748
10832
  leftoversSchedule?.next(Date.now() + LEFTOVERS_EVERY_MS);
10749
10833
  if (leftoversBusy) return;
10750
10834
  leftoversBusy = true;
10751
- const run2 = activity.start("processes", "Looking for processes left running");
10835
+ const run = activity.start("processes", "Looking for processes left running");
10752
10836
  try {
10753
10837
  const found2 = await sweepLeftovers({
10754
10838
  sessions: () => loadHistory().filter((x) => !x.archivedAt).map((x) => ({ id: sessionIdFor(x), name: `${x.target} \xB7 ${x.branch}`, paths: x.paths })),
10755
10839
  list: () => listProcessUsage(),
10756
10840
  agentPid: ptyPid,
10757
- note: (text, o) => run2.note(text, o)
10841
+ note: (text, o) => run.note(text, o)
10758
10842
  });
10759
- if (found2) run2.done(leftoverSummary(found2));
10760
- else run2.fail(leftoverSummary(found2));
10843
+ if (found2) run.done(leftoverSummary(found2));
10844
+ else run.fail(leftoverSummary(found2));
10761
10845
  } catch (err) {
10762
- run2.fail(err.message);
10846
+ run.fail(err.message);
10763
10847
  } finally {
10764
10848
  leftoversBusy = false;
10765
10849
  }
@@ -10806,7 +10890,7 @@ async function startWebServer(opts = {}) {
10806
10890
  scopeApi = mountScopeRoutes(app, { broadcast });
10807
10891
  mountTerminalRoutes(app, {
10808
10892
  elsewhere: defaultElsewhere,
10809
- ensure: (id) => ensurePty(id),
10893
+ ensure: (id, grid, attachOnly) => ensurePty(id, { grid, attachOnly }),
10810
10894
  ticket: terminalTicketUrl,
10811
10895
  log: (line) => debugLog("INFO", line)
10812
10896
  });
@@ -11066,10 +11150,10 @@ async function settleAgentHooks(io) {
11066
11150
 
11067
11151
  // src/core/platform/autostart.ts
11068
11152
  import fs21 from "fs";
11069
- import path24 from "path";
11153
+ import path23 from "path";
11070
11154
  function startupScriptPath() {
11071
11155
  if (process.platform !== "win32" || !process.env.APPDATA) return null;
11072
- return path24.join(process.env.APPDATA, "Microsoft", "Windows", "Start Menu", "Programs", "Startup", "work-web.vbs");
11156
+ return path23.join(process.env.APPDATA, "Microsoft", "Windows", "Start Menu", "Programs", "Startup", "work-web.vbs");
11073
11157
  }
11074
11158
  function vbsQuote(s) {
11075
11159
  return '"' + s.replace(/"/g, '""') + '"';
@@ -11087,7 +11171,7 @@ function setAutostart(enabled, workBin) {
11087
11171
  const file = startupScriptPath();
11088
11172
  if (!file) throw new Error("Autostart is only supported on Windows so far.");
11089
11173
  if (enabled) {
11090
- fs21.mkdirSync(path24.dirname(file), { recursive: true });
11174
+ fs21.mkdirSync(path23.dirname(file), { recursive: true });
11091
11175
  fs21.writeFileSync(file, buildStartupScript(process.execPath, workBin), "utf-8");
11092
11176
  } else {
11093
11177
  try {
@@ -11108,14 +11192,14 @@ async function demoHostSubmit(url, review) {
11108
11192
  };
11109
11193
  return { ok: true, url: `${url}#pullrequestreview-1` };
11110
11194
  }
11111
- var hunk = (path26, lines, status = "modified") => {
11195
+ var hunk = (path25, lines, status = "modified") => {
11112
11196
  const added = lines.filter((l) => l.startsWith("+")).length;
11113
11197
  const deleted = lines.filter((l) => l.startsWith("-")).length;
11114
11198
  const context = lines.length - added - deleted;
11115
11199
  return [
11116
- `diff --git a/${path26} b/${path26}`,
11117
- ...status === "added" ? ["new file mode 100644", "index 0000000..1111111", "--- /dev/null"] : ["index 1111111..2222222 100644", `--- a/${path26}`],
11118
- `+++ b/${path26}`,
11200
+ `diff --git a/${path25} b/${path25}`,
11201
+ ...status === "added" ? ["new file mode 100644", "index 0000000..1111111", "--- /dev/null"] : ["index 1111111..2222222 100644", `--- a/${path25}`],
11202
+ `+++ b/${path25}`,
11119
11203
  `@@ -${status === "added" ? 0 : 1},${status === "added" ? 0 : context + deleted} +1,${context + added} @@`,
11120
11204
  ...lines
11121
11205
  ].join("\n");
@@ -11434,12 +11518,12 @@ function mountDemoReviews(app, broadcast, sessions = noSessions) {
11434
11518
  });
11435
11519
  const key = (repo, n) => `${repo}#${n}`;
11436
11520
  const store = {
11437
- read: (rp, num4) => reviews.get(key(rp, String(num4))) ?? null,
11438
- update: (rp, num4, change) => {
11439
- const was = reviews.get(key(rp, String(num4)));
11521
+ read: (rp, num3) => reviews.get(key(rp, String(num3))) ?? null,
11522
+ update: (rp, num3, change) => {
11523
+ const was = reviews.get(key(rp, String(num3)));
11440
11524
  if (!was) return null;
11441
11525
  const next = change(was);
11442
- reviews.set(key(rp, String(num4)), next);
11526
+ reviews.set(key(rp, String(num3)), next);
11443
11527
  return next;
11444
11528
  },
11445
11529
  pid: 0,
@@ -11503,7 +11587,7 @@ function mountDemoReviews(app, broadcast, sessions = noSessions) {
11503
11587
  {
11504
11588
  ...store,
11505
11589
  repoPath: (alias) => alias === "api" ? "/demo/api" : null,
11506
- submit: async (_at, num4, review) => demoHostSubmit(reviews.get(key(repo, String(num4)))?.url ?? "", review)
11590
+ submit: async (_at, num3, review) => demoHostSubmit(reviews.get(key(repo, String(num3)))?.url ?? "", review)
11507
11591
  },
11508
11592
  repo,
11509
11593
  n,
@@ -11617,7 +11701,7 @@ function createDemoRepos(liveTargets) {
11617
11701
  /** GET /api/projects: what New worktree offers, as the real one reads config. */
11618
11702
  projects() {
11619
11703
  return {
11620
- singles: Object.entries(repos).map(([name, path26]) => ({ name, kind: "single", path: path26 })),
11704
+ singles: Object.entries(repos).map(([name, path25]) => ({ name, kind: "single", path: path25 })),
11621
11705
  groups: Object.entries(groups).map(([name, members]) => ({ name, kind: "group", members }))
11622
11706
  };
11623
11707
  },
@@ -11659,12 +11743,12 @@ function createDemoRepos(liveTargets) {
11659
11743
  }));
11660
11744
  return { roots: [root], repos: rows, groups: groupRows };
11661
11745
  },
11662
- enroll(alias, path26) {
11663
- if (!found2.some((f) => f.path === path26)) throw new DemoRepoError(`${path26} is not the top folder of a git repository`);
11664
- const problem = enrollProblem(alias, path26, config());
11746
+ enroll(alias, path25) {
11747
+ if (!found2.some((f) => f.path === path25)) throw new DemoRepoError(`${path25} is not the top folder of a git repository`);
11748
+ const problem = enrollProblem(alias, path25, config());
11665
11749
  if (problem) throw new DemoRepoError(problem);
11666
- repos[alias] = path26;
11667
- ignored.delete(path26);
11750
+ repos[alias] = path25;
11751
+ ignored.delete(path25);
11668
11752
  },
11669
11753
  remove(alias, force) {
11670
11754
  if (!(alias in repos)) throw new DemoRepoError(`no repo \u201C${alias}\u201D`);
@@ -11673,9 +11757,9 @@ function createDemoRepos(liveTargets) {
11673
11757
  delete repos[alias];
11674
11758
  for (const g2 of Object.keys(groups)) groups[g2] = groups[g2].filter((m) => m !== alias);
11675
11759
  },
11676
- ignore(path26, on) {
11677
- if (on) ignored.add(path26);
11678
- else ignored.delete(path26);
11760
+ ignore(path25, on) {
11761
+ if (on) ignored.add(path25);
11762
+ else ignored.delete(path25);
11679
11763
  },
11680
11764
  saveGroup(name, members, creating) {
11681
11765
  const problem = groupProblem(name, members, config(), { creating });
@@ -12076,8 +12160,8 @@ var DemoScenario = class {
12076
12160
  this.pending = this.pending.filter((p) => !ready.includes(p));
12077
12161
  for (const p of ready) p.run();
12078
12162
  }
12079
- after(ms, run2) {
12080
- this.pending.push({ at: this.now() + ms * this.speed, run: run2 });
12163
+ after(ms, run) {
12164
+ this.pending.push({ at: this.now() + ms * this.speed, run });
12081
12165
  }
12082
12166
  // -- seed -----------------------------------------------------------------
12083
12167
  iso(minutesAgo) {
@@ -12974,15 +13058,15 @@ ${reply}\r
12974
13058
  if (refusal || !s) return { ok: false, status: refusal?.status ?? 404, error: refusal?.error ?? "unknown session" };
12975
13059
  s.repos.push({ name: alias, uncommitted: "", sinceBranch: "", published: false, pr: null });
12976
13060
  const from = base || "main";
12977
- const path26 = this.wire(s).paths[s.repos.length - 1];
13061
+ const path25 = this.wire(s).paths[s.repos.length - 1];
12978
13062
  s.comments.post({
12979
13063
  side: "general",
12980
13064
  status: "published",
12981
- body: addedRepoNote({ alias, path: path26, branch: s.branch, from, imported: true })
13065
+ body: addedRepoNote({ alias, path: path25, branch: s.branch, from, imported: true })
12982
13066
  });
12983
13067
  this.emit("comments-changed", { sessionId: id });
12984
13068
  this.changed();
12985
- return { ok: true, wire: { ok: true, path: path26, branch: s.branch, created: true, from, imported: true, warnings: [] } };
13069
+ return { ok: true, wire: { ok: true, path: path25, branch: s.branch, created: true, from, imported: true, warnings: [] } };
12986
13070
  }
12987
13071
  // -- CI (the PR watch, simulated) ------------------------------------------
12988
13072
  /** The Today digest, through the same builder as work web: the demo's
@@ -13560,20 +13644,20 @@ function demoCodeFiles(repos, group) {
13560
13644
  })
13561
13645
  };
13562
13646
  }
13563
- function demoCodeFile(repos, group, repo, path26) {
13647
+ function demoCodeFile(repos, group, repo, path25) {
13564
13648
  if (repo === "") {
13565
- if (!group || path26 !== "CLAUDE.md") return null;
13649
+ if (!group || path25 !== "CLAUDE.md") return null;
13566
13650
  const text2 = `# Group instructions
13567
13651
 
13568
13652
  Repos: ${repos.map((r2) => r2.name).join(", ")}.
13569
13653
  `;
13570
- return { repo, path: path26, size: text2.length, text: text2 };
13654
+ return { repo, path: path25, size: text2.length, text: text2 };
13571
13655
  }
13572
13656
  const r = repos.find((x) => x.name === repo);
13573
13657
  if (!r) return null;
13574
- const changed = r.changed.find((f) => f.path === path26 && f.status !== "deleted");
13575
- const text = changed ? newSide(changed) : COMMON[path26]?.replace(/\{repo\}/g, repo);
13576
- return text === void 0 ? null : { repo, path: path26, size: text.length, text };
13658
+ const changed = r.changed.find((f) => f.path === path25 && f.status !== "deleted");
13659
+ const text = changed ? newSide(changed) : COMMON[path25]?.replace(/\{repo\}/g, repo);
13660
+ return text === void 0 ? null : { repo, path: path25, size: text.length, text };
13577
13661
  }
13578
13662
  function demoCodeSearch(repos, group, query) {
13579
13663
  const q = query.trim();
@@ -13582,12 +13666,12 @@ function demoCodeSearch(repos, group, query) {
13582
13666
  const text = [];
13583
13667
  const fold = (x) => ignoresCase(q) ? x.toLowerCase() : x;
13584
13668
  for (const r of demoCodeFiles(repos, group).repos) {
13585
- for (const path26 of r.files) {
13586
- const lines = (demoCodeFile(repos, group, r.name, path26)?.text ?? "").split("\n");
13669
+ for (const path25 of r.files) {
13670
+ const lines = (demoCodeFile(repos, group, r.name, path25)?.text ?? "").split("\n");
13587
13671
  lines.forEach((line, i) => {
13588
- const d = declarationOf(path26, line);
13589
- if (d) symbols.push({ ...d, repo: r.name, path: path26, line: i + 1, text: line.trim() });
13590
- if (fold(line).includes(fold(q))) text.push({ repo: r.name, path: path26, line: i + 1, text: line });
13672
+ const d = declarationOf(path25, line);
13673
+ if (d) symbols.push({ ...d, repo: r.name, path: path25, line: i + 1, text: line.trim() });
13674
+ if (fold(line).includes(fold(q))) text.push({ repo: r.name, path: path25, line: i + 1, text: line });
13591
13675
  });
13592
13676
  }
13593
13677
  }
@@ -13615,8 +13699,8 @@ function createDemoActivity(scenario, emit) {
13615
13699
  const sweep = () => {
13616
13700
  prCheck.next(Date.now() + SWEEP_EVERY_MS);
13617
13701
  const sessions = scenario.list().filter((s) => !s.archivedAt);
13618
- const run2 = log.start("pr-watch", "Checking pull requests");
13619
- run2.progress(0, sessions.length);
13702
+ const run = log.start("pr-watch", "Checking pull requests");
13703
+ run.progress(0, sessions.length);
13620
13704
  let prs = 0;
13621
13705
  let threads = 0;
13622
13706
  let failing = 0;
@@ -13628,24 +13712,24 @@ function createDemoActivity(scenario, emit) {
13628
13712
  threads += r.openThreads ?? 0;
13629
13713
  if (r.pr.checks === "fail") {
13630
13714
  failing++;
13631
- run2.note(
13715
+ run.note(
13632
13716
  `${s.target} ${s.branch}: checks fail on #${r.pr.number} (${(r.pr.failing ?? []).map((f) => f.name).join(", ")}): already told its Claude`,
13633
13717
  { sessionId: s.id }
13634
13718
  );
13635
13719
  }
13636
13720
  if (r.openThreads)
13637
- run2.note(`${s.target} ${s.branch}: ${r.openThreads} unresolved review threads on #${r.pr.number}`, { sessionId: s.id });
13721
+ run.note(`${s.target} ${s.branch}: ${r.openThreads} unresolved review threads on #${r.pr.number}`, { sessionId: s.id });
13638
13722
  }
13639
- run2.progress(i + 1, sessions.length);
13723
+ run.progress(i + 1, sessions.length);
13640
13724
  if (i === sessions.length - 1) {
13641
13725
  const parts = [`${sessions.length} sessions`, `${prs} open PRs`];
13642
13726
  if (threads) parts.push(`${threads} unresolved review threads`);
13643
13727
  if (failing) parts.push(`${failing} failing`);
13644
- run2.done(parts.join(" \xB7 "));
13728
+ run.done(parts.join(" \xB7 "));
13645
13729
  }
13646
13730
  });
13647
13731
  });
13648
- if (sessions.length === 0) run2.done("0 sessions");
13732
+ if (sessions.length === 0) run.done("0 sessions");
13649
13733
  };
13650
13734
  later(3e3, sweep);
13651
13735
  prCheck.next(Date.now() + 3e3);
@@ -13870,13 +13954,13 @@ function createDemoSettings(repoPathOf) {
13870
13954
  };
13871
13955
  return {
13872
13956
  read,
13873
- async write(path26, value) {
13874
- const f = settingAt(path26);
13875
- if (!f) throw new SettingsError(`no setting ${path26}`, 404);
13957
+ async write(path25, value) {
13958
+ const f = settingAt(path25);
13959
+ if (!f) throw new SettingsError(`no setting ${path25}`, 404);
13876
13960
  const r = checkSetting(f, value);
13877
13961
  if (!r.ok) throw new SettingsError(`${f.label}: ${r.error}`);
13878
- if (r.value === null) delete values[path26];
13879
- else values[path26] = r.value;
13962
+ if (r.value === null) delete values[path25];
13963
+ else values[path25] = r.value;
13880
13964
  return read();
13881
13965
  },
13882
13966
  readRepo,
@@ -14550,10 +14634,16 @@ async function startDemoServer(opts) {
14550
14634
  const next = p.section && !known2.has(p.section) ? applyPlacePatch(p, { section: null }) : p;
14551
14635
  if (next) places[id] = next;
14552
14636
  }
14553
- rail = { sections, places };
14637
+ rail = { ...rail, sections, places };
14554
14638
  railChanged();
14555
14639
  return c.json(railView());
14556
14640
  });
14641
+ app.put("/api/rail/view", async (c) => {
14642
+ const view = asRailView((await json2(c)).view);
14643
+ if (!view) return c.json({ error: "expected {view: mine|state|project}" }, 400);
14644
+ rail = { ...rail, view };
14645
+ return c.json(railView());
14646
+ });
14557
14647
  app.put("/api/sessions/:id/rail", async (c) => {
14558
14648
  const id = c.req.param("id");
14559
14649
  if (!scenario.list().some((x) => x.id === id)) return notFound(c);
@@ -14582,6 +14672,7 @@ async function startDemoServer(opts) {
14582
14672
  });
14583
14673
  app.post("/api/sessions/:id/agent/start", (c) => scenario.comments(c.req.param("id")) ? c.json({ how: "running" }) : notFound(c));
14584
14674
  app.post("/api/sessions/:id/agent/stop", (c) => scenario.comments(c.req.param("id")) ? c.json({ how: "stopped" }) : notFound(c));
14675
+ app.post("/api/sessions/:id/background/stop", (c) => scenario.comments(c.req.param("id")) ? c.json({ stopped: [] }) : notFound(c));
14585
14676
  app.get(
14586
14677
  "/api/sessions/:id/last-reply",
14587
14678
  (c) => scenario.comments(c.req.param("id")) ? c.json({ text: scenario.lastReply(c.req.param("id")) }) : notFound(c)
@@ -15049,7 +15140,7 @@ async function startDemoServer(opts) {
15049
15140
  tick.unref?.();
15050
15141
  const wss = new WebSocketServer2({ noServer: true });
15051
15142
  handle.httpServer.on("upgrade", (req, socket, head) => {
15052
- const m = (req.url ?? "").match(/^\/ws\/sessions\/([^/]+)\/terminal$/);
15143
+ const m = (req.url ?? "").match(/^\/ws\/sessions\/([^/?]+)\/terminal(?:\?.*)?$/);
15053
15144
  const reason = refuseReason({ method: "GET", upgrade: true, host: req.headers.host, origin: req.headers.origin }, handle.port);
15054
15145
  if (!m || reason) {
15055
15146
  socket.destroy();
@@ -15106,8 +15197,8 @@ async function startDemoServer(opts) {
15106
15197
 
15107
15198
  // src/core/platform/web-life.ts
15108
15199
  import fs22 from "fs";
15109
- import path25 from "path";
15110
- var lifePath = () => path25.join(getConfigDir(), "web-life.json");
15200
+ import path24 from "path";
15201
+ var lifePath = () => path24.join(getConfigDir(), "web-life.json");
15111
15202
  function isLife(v) {
15112
15203
  const l = v;
15113
15204
  return !!l && typeof l === "object" && typeof l.pid === "number" && typeof l.version === "string" && typeof l.startedAt === "string" && typeof l.lastSeen === "string" && (l.ended === void 0 || typeof l.ended?.at === "string" && typeof l.ended?.how === "string");
@@ -15218,9 +15309,9 @@ async function stopExisting(kill = (pid) => process.kill(pid), graceMs = 8e3) {
15218
15309
  const asked = await fetch(`${url}api/shutdown`, { method: "POST", signal: AbortSignal.timeout(3e3) }).then((r) => r.ok).catch(() => false);
15219
15310
  if (asked) {
15220
15311
  const until = Date.now() + graceMs;
15221
- while (Date.now() < until && isPidAlive(pid)) await new Promise((r) => setTimeout(r, 100));
15312
+ while (Date.now() < until && isPidRunning(pid)) await new Promise((r) => setTimeout(r, 100));
15222
15313
  }
15223
- if (isPidAlive(pid)) {
15314
+ if (isPidRunning(pid)) {
15224
15315
  try {
15225
15316
  kill(pid);
15226
15317
  } catch {
@@ -15442,17 +15533,17 @@ async function stopDev2() {
15442
15533
  const asked = await fetch(`${found2.url}api/shutdown`, { method: "POST", signal: AbortSignal.timeout(3e3) }).then((r) => r.ok).catch(() => false);
15443
15534
  const waitGone = async (ms) => {
15444
15535
  const until = Date.now() + ms;
15445
- while (Date.now() < until && isPidAlive(found2.pid)) await new Promise((r) => setTimeout(r, 100));
15536
+ while (Date.now() < until && isPidRunning(found2.pid)) await new Promise((r) => setTimeout(r, 100));
15446
15537
  };
15447
15538
  if (asked) await waitGone(1e4);
15448
- if (isPidAlive(found2.pid)) {
15539
+ if (isPidRunning(found2.pid)) {
15449
15540
  try {
15450
15541
  process.kill(found2.pid);
15451
15542
  } catch {
15452
15543
  }
15453
15544
  await waitGone(3e3);
15454
15545
  }
15455
- const gone = !isPidAlive(found2.pid);
15546
+ const gone = !isPidRunning(found2.pid);
15456
15547
  if (gone) clearDevWebDiscovery(found2.pid);
15457
15548
  info(gone ? chalk.gray("Stopped the dev server.") : chalk.red(`The dev server (PID ${found2.pid}) did not stop.`));
15458
15549
  return gone;
@@ -15480,4 +15571,4 @@ export {
15480
15571
  stopExisting,
15481
15572
  webCommand
15482
15573
  };
15483
- //# sourceMappingURL=web-Q672AIMZ.js.map
15574
+ //# sourceMappingURL=web-GOCU26ZD.js.map