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