@moberg_hr/work-tree 2.20.2 → 2.21.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 (259) hide show
  1. package/dist/{account-K344BL55.js → account-RCMYHLUP.js} +19 -18
  2. package/dist/account-RCMYHLUP.js.map +1 -0
  3. package/dist/{add-repo-MAS2S3QH.js → add-repo-4NQUBY2A.js} +11 -11
  4. package/dist/{answer-SZBZMQ7Z.js → answer-PAMFIP4B.js} +8 -8
  5. package/dist/{attach-AUHGMRLW.js → attach-QX72JAJN.js} +12 -12
  6. package/dist/bin.js +3 -3
  7. package/dist/{block-NYK4PVEF.js → block-GLMNDZJC.js} +10 -10
  8. package/dist/{broadcast-XOERUBC5.js → broadcast-4AMVPDUV.js} +6 -6
  9. package/dist/{catchup-5U6YDQ4W.js → catchup-AWIE3PVF.js} +11 -11
  10. package/dist/{child-VW7SWBA7.js → child-HG4WXOMX.js} +7 -7
  11. package/dist/{chunk-U7G2M2M5.js → chunk-2EXZ24MI.js} +5 -5
  12. package/dist/{chunk-ZGIXYFAF.js → chunk-2IK6EQXW.js} +5 -5
  13. package/dist/{chunk-P34SYA2H.js → chunk-2MZODCSG.js} +2 -2
  14. package/dist/{chunk-RBME2ALO.js → chunk-3BXCMTFV.js} +2 -2
  15. package/dist/{chunk-LXBHVWOY.js → chunk-3ZPVKUYD.js} +4 -1
  16. package/dist/chunk-3ZPVKUYD.js.map +1 -0
  17. package/dist/{chunk-QRVE76XE.js → chunk-4EPMJVQY.js} +4 -4
  18. package/dist/{chunk-DHCZ3FFK.js → chunk-4FQ4QOIF.js} +6 -6
  19. package/dist/{chunk-CAWVPVQJ.js → chunk-64JQ5X2R.js} +60 -60
  20. package/dist/{chunk-3MJNANFY.js → chunk-74FGCQML.js} +3 -3
  21. package/dist/{chunk-CBXN7WRG.js → chunk-777W7BCX.js} +10 -10
  22. package/dist/{chunk-PTEFOGF6.js → chunk-A5O3CP37.js} +4 -4
  23. package/dist/{chunk-M6SF7K6X.js → chunk-BOQJBO4K.js} +2 -2
  24. package/dist/{chunk-AB3TSGJ4.js → chunk-BQS73CWR.js} +2 -2
  25. package/dist/{chunk-J6ORQOIL.js → chunk-COBR6DBI.js} +2 -2
  26. package/dist/{chunk-PR7YMO37.js → chunk-CVN5E4SU.js} +2 -2
  27. package/dist/{chunk-E3EHYNJB.js → chunk-DDDWQ36P.js} +4 -4
  28. package/dist/chunk-DVXO4L3C.js +9 -0
  29. package/dist/{chunk-EPE5IJHA.js → chunk-E4EQDJD2.js} +3 -3
  30. package/dist/{chunk-VS4X4T2D.js → chunk-GFCVBKHL.js} +2 -2
  31. package/dist/{chunk-NFM4NGTI.js → chunk-HF4VUIGE.js} +2 -2
  32. package/dist/{chunk-2YGVF224.js → chunk-HI674QZF.js} +2 -2
  33. package/dist/{chunk-BJA3RBG4.js → chunk-HNK36GM3.js} +6 -6
  34. package/dist/{chunk-EEF3MM42.js → chunk-I3AO3NVC.js} +2 -2
  35. package/dist/{chunk-M3M2BPSL.js → chunk-IMO7KKYZ.js} +2 -2
  36. package/dist/{chunk-3E6SV2Y5.js → chunk-IPXOVAEX.js} +4 -4
  37. package/dist/{chunk-BA3Q3BFH.js → chunk-IYJHSMXQ.js} +2 -2
  38. package/dist/{chunk-VCLHLBAB.js → chunk-JKARKFLX.js} +7 -7
  39. package/dist/{chunk-NBUKWW64.js → chunk-JNYXRMZL.js} +2 -2
  40. package/dist/{chunk-H22U66HV.js → chunk-JZZJRVWZ.js} +3 -3
  41. package/dist/{chunk-JLLIN3AK.js → chunk-KLJMHYU7.js} +3 -3
  42. package/dist/chunk-KLJMHYU7.js.map +1 -0
  43. package/dist/{chunk-22F5GWT6.js → chunk-LCKBOPFU.js} +5 -5
  44. package/dist/{chunk-EM3457HA.js → chunk-LYUD6DNS.js} +3 -3
  45. package/dist/{chunk-456FZP7D.js → chunk-MGMRLWJA.js} +28 -63
  46. package/dist/chunk-MGMRLWJA.js.map +1 -0
  47. package/dist/{chunk-PORC2R73.js → chunk-MJIYIMPI.js} +20 -8
  48. package/dist/chunk-MJIYIMPI.js.map +1 -0
  49. package/dist/{chunk-XDYQ5BSZ.js → chunk-NISGFF25.js} +4 -4
  50. package/dist/{chunk-XTQEYLTU.js → chunk-NJ7CHZJS.js} +2 -2
  51. package/dist/{chunk-2UNHMFUP.js → chunk-NS5K4IN5.js} +7 -7
  52. package/dist/{chunk-SJFGXIGE.js → chunk-OW7YUW4W.js} +2 -2
  53. package/dist/{chunk-M5JIFPLS.js → chunk-PKY63672.js} +2 -2
  54. package/dist/{chunk-YQOF6CVT.js → chunk-POF2FE4S.js} +8 -9
  55. package/dist/chunk-POF2FE4S.js.map +1 -0
  56. package/dist/{chunk-NB7IBSKF.js → chunk-PTAG6WIE.js} +2 -2
  57. package/dist/{chunk-SUQCUUUL.js → chunk-QUOA4RSP.js} +7 -6
  58. package/dist/chunk-QUOA4RSP.js.map +1 -0
  59. package/dist/{chunk-2EC7DNPA.js → chunk-U3UPGZGQ.js} +2 -2
  60. package/dist/{chunk-Q3VFGU5R.js → chunk-VAFS24P4.js} +3 -3
  61. package/dist/{chunk-YSQ62ZSW.js → chunk-WDGQAGF4.js} +5 -5
  62. package/dist/{chunk-WMF7DRJG.js → chunk-X3ON5EYW.js} +3 -3
  63. package/dist/{chunk-QYBHJ74T.js → chunk-XCQD5XSN.js} +4 -4
  64. package/dist/{chunk-B5HNEXK6.js → chunk-XHTBWRXU.js} +4 -4
  65. package/dist/{chunk-43FN5MBD.js → chunk-XN77RX4I.js} +6 -6
  66. package/dist/{chunk-6NMRGPQK.js → chunk-XOEGBVWQ.js} +3 -3
  67. package/dist/{chunk-FBX755VE.js → chunk-YKWDZCUW.js} +11 -10
  68. package/dist/chunk-YKWDZCUW.js.map +1 -0
  69. package/dist/{chunk-4BEE4ARM.js → chunk-YM3DJE2Q.js} +6 -6
  70. package/dist/{chunk-QYKVKSIU.js → chunk-YNPORFRR.js} +3 -3
  71. package/dist/{chunk-R4DKF53W.js → chunk-ZBVVI3XT.js} +2 -2
  72. package/dist/{cleanup-XHSOGFHE.js → cleanup-757RQ5NW.js} +25 -25
  73. package/dist/{cli-RHRVON2B.js → cli-6XNTBRIC.js} +4 -4
  74. package/dist/{color-H4WY7SVT.js → color-SMQZHNFH.js} +9 -9
  75. package/dist/{config-X6AATD45.js → config-TSNQIWAG.js} +8 -8
  76. package/dist/{coordinate-7GW4IY4I.js → coordinate-RJOG5DCS.js} +8 -8
  77. package/dist/{diff-BYBL57GA.js → diff-GBVTHXCV.js} +9 -9
  78. package/dist/{digest-UQHBBKGJ.js → digest-UFZSHQCP.js} +8 -8
  79. package/dist/{fork-BQR2QVBA.js → fork-5ISDLKQF.js} +22 -22
  80. package/dist/{history-H52GJNGT.js → history-ZX5COG2M.js} +6 -6
  81. package/dist/{hook-TRLZRFUX.js → hook-3LHEQPBM.js} +13 -13
  82. package/dist/{hydrate-CG427MNZ.js → hydrate-N6ZIPOLK.js} +6 -6
  83. package/dist/{init-LKJ7Q3KE.js → init-P42G52BR.js} +11 -11
  84. package/dist/{install-skills-Y7ZEBQ4B.js → install-skills-N63CWTOH.js} +6 -6
  85. package/dist/install-skills-bin.js +5 -5
  86. package/dist/{keep-JMNCVOCH.js → keep-HZC6HIWF.js} +8 -8
  87. package/dist/{list-MYI7QDKY.js → list-UAQKE4BT.js} +6 -6
  88. package/dist/{move-MVK2WDN7.js → move-TUX7SKKM.js} +12 -12
  89. package/dist/{note-NXG6Z5LQ.js → note-SLVYVDC5.js} +8 -8
  90. package/dist/{overlaps-CJ36PVM3.js → overlaps-HC7GB3OL.js} +12 -12
  91. package/dist/{pin-QYIOKDK2.js → pin-73FSKVDV.js} +9 -9
  92. package/dist/{pr-M6JTV3NH.js → pr-FJHTWA6C.js} +17 -17
  93. package/dist/{prune-FJU4XJRN.js → prune-4DG3YNHQ.js} +23 -23
  94. package/dist/{pty-host-AITKXZQR.js → pty-host-3UNFCKXJ.js} +10 -10
  95. package/dist/{read-7GP5NZSX.js → read-VFPXCEP6.js} +8 -8
  96. package/dist/{recent-JB3MBZLK.js → recent-MT4K3M7A.js} +11 -11
  97. package/dist/{remove-ABLKC5UR.js → remove-CTXCSMMJ.js} +24 -24
  98. package/dist/{report-UHMW7J32.js → report-OZN3UE3W.js} +7 -7
  99. package/dist/{restart-YQANH2WJ.js → restart-P3HCOUJY.js} +8 -8
  100. package/dist/{resume-UXRWNLAD.js → resume-IQTLSLS3.js} +11 -11
  101. package/dist/{review-3PKQCRR2.js → review-RAFSZBOC.js} +7 -7
  102. package/dist/{review-now-KZDBETZK.js → review-now-K4UWD7A5.js} +2 -2
  103. package/dist/{run-E3CJHPE4.js → run-UYTHFJ7P.js} +6 -6
  104. package/dist/{screen-5HGHIKGY.js → screen-A33PDNY4.js} +8 -8
  105. package/dist/{search-DL3UJDI7.js → search-RIZJANOI.js} +6 -6
  106. package/dist/{section-DIUSRPSJ.js → section-XOWMNRLK.js} +9 -9
  107. package/dist/{send-S3MQNHU6.js → send-DTHWOC4Z.js} +9 -9
  108. package/dist/{sessions-AQCTVE7I.js → sessions-PP555IEM.js} +20 -20
  109. package/dist/{show-5Q7AXKHA.js → show-ZY2X46TS.js} +7 -7
  110. package/dist/{snooze-TC3DIXDD.js → snooze-F43627DM.js} +8 -8
  111. package/dist/{start-UZCUYCQD.js → start-LQP5L2UY.js} +8 -8
  112. package/dist/{state-TOTGEK7J.js → state-GM22X3RN.js} +2 -2
  113. package/dist/{status-FEDX5R7G.js → status-U3OJRC4Y.js} +10 -10
  114. package/dist/{statusline-QZKHVDHR.js → statusline-QJ6CJGHB.js} +3 -3
  115. package/dist/{stop-3PSA22QB.js → stop-EQCUYVUF.js} +8 -8
  116. package/dist/{sync-22S2MXDN.js → sync-GQBVRSSD.js} +23 -23
  117. package/dist/{time-Z7YGB42L.js → time-FOC4HMSX.js} +9 -9
  118. package/dist/{time-actions-HY3AML3Y.js → time-actions-IXZRVKKQ.js} +3 -3
  119. package/dist/{timesheet-7LJHWOO3.js → timesheet-YEKW5L2L.js} +12 -12
  120. package/dist/{todo-QY5ZPN24.js → todo-ZBFRL2A5.js} +2 -2
  121. package/dist/{tree-GXAC2Z7V.js → tree-2L6ZCDCE.js} +22 -22
  122. package/dist/{update-PGBQTMWS.js → update-RO7OB54G.js} +14 -14
  123. package/dist/{usage-ZILA3OVK.js → usage-2OYLKV6R.js} +8 -8
  124. package/dist/{usage-ask-C3QLGFC5.js → usage-ask-52X2RMQC.js} +3 -3
  125. package/dist/{version-3UR4YFMC.js → version-6A3FWFQR.js} +4 -4
  126. package/dist/{wait-WHZK42TW.js → wait-4LZJ5WNQ.js} +9 -9
  127. package/dist/wd-bin.js +3 -3
  128. package/dist/web/assets/{PtyView-vDebX6wl.js → PtyView-BbZKZwM6.js} +27 -27
  129. package/dist/web/assets/PtyView-BbZKZwM6.js.map +1 -0
  130. package/dist/web/assets/index-BOoVxITJ.js +127 -0
  131. package/dist/web/assets/index-BOoVxITJ.js.map +1 -0
  132. package/dist/web/assets/index-BTok5U2M.css +1 -0
  133. package/dist/web/index.html +13 -7
  134. package/dist/{web-XRH6RSZA.js → web-OI4MT7VN.js} +357 -83
  135. package/dist/web-OI4MT7VN.js.map +1 -0
  136. package/npm-shrinkwrap.json +2 -2
  137. package/package.json +1 -1
  138. package/dist/account-K344BL55.js.map +0 -1
  139. package/dist/chunk-456FZP7D.js.map +0 -1
  140. package/dist/chunk-FBX755VE.js.map +0 -1
  141. package/dist/chunk-JLLIN3AK.js.map +0 -1
  142. package/dist/chunk-LXBHVWOY.js.map +0 -1
  143. package/dist/chunk-NVHSGKL3.js +0 -9
  144. package/dist/chunk-PORC2R73.js.map +0 -1
  145. package/dist/chunk-SUQCUUUL.js.map +0 -1
  146. package/dist/chunk-YQOF6CVT.js.map +0 -1
  147. package/dist/web/assets/PtyView-vDebX6wl.js.map +0 -1
  148. package/dist/web/assets/index-DJJxqL04.js +0 -127
  149. package/dist/web/assets/index-DJJxqL04.js.map +0 -1
  150. package/dist/web/assets/index-Dt4XbNcI.css +0 -1
  151. package/dist/web-XRH6RSZA.js.map +0 -1
  152. /package/dist/{add-repo-MAS2S3QH.js.map → add-repo-4NQUBY2A.js.map} +0 -0
  153. /package/dist/{answer-SZBZMQ7Z.js.map → answer-PAMFIP4B.js.map} +0 -0
  154. /package/dist/{attach-AUHGMRLW.js.map → attach-QX72JAJN.js.map} +0 -0
  155. /package/dist/{block-NYK4PVEF.js.map → block-GLMNDZJC.js.map} +0 -0
  156. /package/dist/{broadcast-XOERUBC5.js.map → broadcast-4AMVPDUV.js.map} +0 -0
  157. /package/dist/{catchup-5U6YDQ4W.js.map → catchup-AWIE3PVF.js.map} +0 -0
  158. /package/dist/{child-VW7SWBA7.js.map → child-HG4WXOMX.js.map} +0 -0
  159. /package/dist/{chunk-U7G2M2M5.js.map → chunk-2EXZ24MI.js.map} +0 -0
  160. /package/dist/{chunk-ZGIXYFAF.js.map → chunk-2IK6EQXW.js.map} +0 -0
  161. /package/dist/{chunk-P34SYA2H.js.map → chunk-2MZODCSG.js.map} +0 -0
  162. /package/dist/{chunk-RBME2ALO.js.map → chunk-3BXCMTFV.js.map} +0 -0
  163. /package/dist/{chunk-QRVE76XE.js.map → chunk-4EPMJVQY.js.map} +0 -0
  164. /package/dist/{chunk-DHCZ3FFK.js.map → chunk-4FQ4QOIF.js.map} +0 -0
  165. /package/dist/{chunk-CAWVPVQJ.js.map → chunk-64JQ5X2R.js.map} +0 -0
  166. /package/dist/{chunk-3MJNANFY.js.map → chunk-74FGCQML.js.map} +0 -0
  167. /package/dist/{chunk-CBXN7WRG.js.map → chunk-777W7BCX.js.map} +0 -0
  168. /package/dist/{chunk-PTEFOGF6.js.map → chunk-A5O3CP37.js.map} +0 -0
  169. /package/dist/{chunk-M6SF7K6X.js.map → chunk-BOQJBO4K.js.map} +0 -0
  170. /package/dist/{chunk-AB3TSGJ4.js.map → chunk-BQS73CWR.js.map} +0 -0
  171. /package/dist/{chunk-J6ORQOIL.js.map → chunk-COBR6DBI.js.map} +0 -0
  172. /package/dist/{chunk-PR7YMO37.js.map → chunk-CVN5E4SU.js.map} +0 -0
  173. /package/dist/{chunk-E3EHYNJB.js.map → chunk-DDDWQ36P.js.map} +0 -0
  174. /package/dist/{chunk-NVHSGKL3.js.map → chunk-DVXO4L3C.js.map} +0 -0
  175. /package/dist/{chunk-EPE5IJHA.js.map → chunk-E4EQDJD2.js.map} +0 -0
  176. /package/dist/{chunk-VS4X4T2D.js.map → chunk-GFCVBKHL.js.map} +0 -0
  177. /package/dist/{chunk-NFM4NGTI.js.map → chunk-HF4VUIGE.js.map} +0 -0
  178. /package/dist/{chunk-2YGVF224.js.map → chunk-HI674QZF.js.map} +0 -0
  179. /package/dist/{chunk-BJA3RBG4.js.map → chunk-HNK36GM3.js.map} +0 -0
  180. /package/dist/{chunk-EEF3MM42.js.map → chunk-I3AO3NVC.js.map} +0 -0
  181. /package/dist/{chunk-M3M2BPSL.js.map → chunk-IMO7KKYZ.js.map} +0 -0
  182. /package/dist/{chunk-3E6SV2Y5.js.map → chunk-IPXOVAEX.js.map} +0 -0
  183. /package/dist/{chunk-BA3Q3BFH.js.map → chunk-IYJHSMXQ.js.map} +0 -0
  184. /package/dist/{chunk-VCLHLBAB.js.map → chunk-JKARKFLX.js.map} +0 -0
  185. /package/dist/{chunk-NBUKWW64.js.map → chunk-JNYXRMZL.js.map} +0 -0
  186. /package/dist/{chunk-H22U66HV.js.map → chunk-JZZJRVWZ.js.map} +0 -0
  187. /package/dist/{chunk-22F5GWT6.js.map → chunk-LCKBOPFU.js.map} +0 -0
  188. /package/dist/{chunk-EM3457HA.js.map → chunk-LYUD6DNS.js.map} +0 -0
  189. /package/dist/{chunk-XDYQ5BSZ.js.map → chunk-NISGFF25.js.map} +0 -0
  190. /package/dist/{chunk-XTQEYLTU.js.map → chunk-NJ7CHZJS.js.map} +0 -0
  191. /package/dist/{chunk-2UNHMFUP.js.map → chunk-NS5K4IN5.js.map} +0 -0
  192. /package/dist/{chunk-SJFGXIGE.js.map → chunk-OW7YUW4W.js.map} +0 -0
  193. /package/dist/{chunk-M5JIFPLS.js.map → chunk-PKY63672.js.map} +0 -0
  194. /package/dist/{chunk-NB7IBSKF.js.map → chunk-PTAG6WIE.js.map} +0 -0
  195. /package/dist/{chunk-2EC7DNPA.js.map → chunk-U3UPGZGQ.js.map} +0 -0
  196. /package/dist/{chunk-Q3VFGU5R.js.map → chunk-VAFS24P4.js.map} +0 -0
  197. /package/dist/{chunk-YSQ62ZSW.js.map → chunk-WDGQAGF4.js.map} +0 -0
  198. /package/dist/{chunk-WMF7DRJG.js.map → chunk-X3ON5EYW.js.map} +0 -0
  199. /package/dist/{chunk-QYBHJ74T.js.map → chunk-XCQD5XSN.js.map} +0 -0
  200. /package/dist/{chunk-B5HNEXK6.js.map → chunk-XHTBWRXU.js.map} +0 -0
  201. /package/dist/{chunk-43FN5MBD.js.map → chunk-XN77RX4I.js.map} +0 -0
  202. /package/dist/{chunk-6NMRGPQK.js.map → chunk-XOEGBVWQ.js.map} +0 -0
  203. /package/dist/{chunk-4BEE4ARM.js.map → chunk-YM3DJE2Q.js.map} +0 -0
  204. /package/dist/{chunk-QYKVKSIU.js.map → chunk-YNPORFRR.js.map} +0 -0
  205. /package/dist/{chunk-R4DKF53W.js.map → chunk-ZBVVI3XT.js.map} +0 -0
  206. /package/dist/{cleanup-XHSOGFHE.js.map → cleanup-757RQ5NW.js.map} +0 -0
  207. /package/dist/{cli-RHRVON2B.js.map → cli-6XNTBRIC.js.map} +0 -0
  208. /package/dist/{color-H4WY7SVT.js.map → color-SMQZHNFH.js.map} +0 -0
  209. /package/dist/{config-X6AATD45.js.map → config-TSNQIWAG.js.map} +0 -0
  210. /package/dist/{coordinate-7GW4IY4I.js.map → coordinate-RJOG5DCS.js.map} +0 -0
  211. /package/dist/{diff-BYBL57GA.js.map → diff-GBVTHXCV.js.map} +0 -0
  212. /package/dist/{digest-UQHBBKGJ.js.map → digest-UFZSHQCP.js.map} +0 -0
  213. /package/dist/{fork-BQR2QVBA.js.map → fork-5ISDLKQF.js.map} +0 -0
  214. /package/dist/{history-H52GJNGT.js.map → history-ZX5COG2M.js.map} +0 -0
  215. /package/dist/{hook-TRLZRFUX.js.map → hook-3LHEQPBM.js.map} +0 -0
  216. /package/dist/{hydrate-CG427MNZ.js.map → hydrate-N6ZIPOLK.js.map} +0 -0
  217. /package/dist/{init-LKJ7Q3KE.js.map → init-P42G52BR.js.map} +0 -0
  218. /package/dist/{install-skills-Y7ZEBQ4B.js.map → install-skills-N63CWTOH.js.map} +0 -0
  219. /package/dist/{keep-JMNCVOCH.js.map → keep-HZC6HIWF.js.map} +0 -0
  220. /package/dist/{list-MYI7QDKY.js.map → list-UAQKE4BT.js.map} +0 -0
  221. /package/dist/{move-MVK2WDN7.js.map → move-TUX7SKKM.js.map} +0 -0
  222. /package/dist/{note-NXG6Z5LQ.js.map → note-SLVYVDC5.js.map} +0 -0
  223. /package/dist/{overlaps-CJ36PVM3.js.map → overlaps-HC7GB3OL.js.map} +0 -0
  224. /package/dist/{pin-QYIOKDK2.js.map → pin-73FSKVDV.js.map} +0 -0
  225. /package/dist/{pr-M6JTV3NH.js.map → pr-FJHTWA6C.js.map} +0 -0
  226. /package/dist/{prune-FJU4XJRN.js.map → prune-4DG3YNHQ.js.map} +0 -0
  227. /package/dist/{pty-host-AITKXZQR.js.map → pty-host-3UNFCKXJ.js.map} +0 -0
  228. /package/dist/{read-7GP5NZSX.js.map → read-VFPXCEP6.js.map} +0 -0
  229. /package/dist/{recent-JB3MBZLK.js.map → recent-MT4K3M7A.js.map} +0 -0
  230. /package/dist/{remove-ABLKC5UR.js.map → remove-CTXCSMMJ.js.map} +0 -0
  231. /package/dist/{report-UHMW7J32.js.map → report-OZN3UE3W.js.map} +0 -0
  232. /package/dist/{restart-YQANH2WJ.js.map → restart-P3HCOUJY.js.map} +0 -0
  233. /package/dist/{resume-UXRWNLAD.js.map → resume-IQTLSLS3.js.map} +0 -0
  234. /package/dist/{review-3PKQCRR2.js.map → review-RAFSZBOC.js.map} +0 -0
  235. /package/dist/{review-now-KZDBETZK.js.map → review-now-K4UWD7A5.js.map} +0 -0
  236. /package/dist/{run-E3CJHPE4.js.map → run-UYTHFJ7P.js.map} +0 -0
  237. /package/dist/{screen-5HGHIKGY.js.map → screen-A33PDNY4.js.map} +0 -0
  238. /package/dist/{search-DL3UJDI7.js.map → search-RIZJANOI.js.map} +0 -0
  239. /package/dist/{section-DIUSRPSJ.js.map → section-XOWMNRLK.js.map} +0 -0
  240. /package/dist/{send-S3MQNHU6.js.map → send-DTHWOC4Z.js.map} +0 -0
  241. /package/dist/{sessions-AQCTVE7I.js.map → sessions-PP555IEM.js.map} +0 -0
  242. /package/dist/{show-5Q7AXKHA.js.map → show-ZY2X46TS.js.map} +0 -0
  243. /package/dist/{snooze-TC3DIXDD.js.map → snooze-F43627DM.js.map} +0 -0
  244. /package/dist/{start-UZCUYCQD.js.map → start-LQP5L2UY.js.map} +0 -0
  245. /package/dist/{state-TOTGEK7J.js.map → state-GM22X3RN.js.map} +0 -0
  246. /package/dist/{status-FEDX5R7G.js.map → status-U3OJRC4Y.js.map} +0 -0
  247. /package/dist/{statusline-QZKHVDHR.js.map → statusline-QJ6CJGHB.js.map} +0 -0
  248. /package/dist/{stop-3PSA22QB.js.map → stop-EQCUYVUF.js.map} +0 -0
  249. /package/dist/{sync-22S2MXDN.js.map → sync-GQBVRSSD.js.map} +0 -0
  250. /package/dist/{time-Z7YGB42L.js.map → time-FOC4HMSX.js.map} +0 -0
  251. /package/dist/{time-actions-HY3AML3Y.js.map → time-actions-IXZRVKKQ.js.map} +0 -0
  252. /package/dist/{timesheet-7LJHWOO3.js.map → timesheet-YEKW5L2L.js.map} +0 -0
  253. /package/dist/{todo-QY5ZPN24.js.map → todo-ZBFRL2A5.js.map} +0 -0
  254. /package/dist/{tree-GXAC2Z7V.js.map → tree-2L6ZCDCE.js.map} +0 -0
  255. /package/dist/{update-PGBQTMWS.js.map → update-RO7OB54G.js.map} +0 -0
  256. /package/dist/{usage-ZILA3OVK.js.map → usage-2OYLKV6R.js.map} +0 -0
  257. /package/dist/{usage-ask-C3QLGFC5.js.map → usage-ask-52X2RMQC.js.map} +0 -0
  258. /package/dist/{version-3UR4YFMC.js.map → version-6A3FWFQR.js.map} +0 -0
  259. /package/dist/{wait-WHZK42TW.js.map → wait-4LZJ5WNQ.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/core/rail/rail-layout.ts","../src/core/platform/config.ts","../src/core/sessions/saved-prompts.ts","../src/core/time/allocate.ts"],"sourcesContent":["/**\n * PURE — shared by the SPA, the demo and the server; keep it import-free.\n *\n * The rail's pins and sections: a few sessions pinned to the top, and your\n * own headings (\"Client X\", \"Waiting on review\") with sessions under them.\n * And colors: a mark you put on a session that moves nothing (a bar down its\n * rail row's edge, a square in the lists), so a group of yours stays visible\n * wherever its sessions are, pinned or in a section. Stored in state.db\n * (rail-store.ts): the sections in `meta`, each session's place in\n * `rail_place` (gone with the session). Within a group, rows keep the rail's\n * order (your drag order, else the stable one).\n */\n\nexport interface RailSection {\n id: string;\n name: string;\n}\n\n/** Finder's six: told apart at a glance, a light and a dark shade each (the SPA's `--tag-<color>`). */\nexport const RAIL_COLORS = ['red', 'orange', 'yellow', 'green', 'blue', 'purple'] as const;\nexport type RailColor = (typeof RAIL_COLORS)[number];\n\n/** Each color's name, for its tooltip and screen readers (never the color alone). */\nexport const RAIL_COLOR_LABEL: Record<RailColor, string> = {\n red: 'Red',\n orange: 'Orange',\n yellow: 'Yellow',\n green: 'Green',\n blue: 'Blue',\n purple: 'Purple',\n};\n\nexport function isRailColor(v: unknown): v is RailColor {\n return typeof v === 'string' && (RAIL_COLORS as readonly string[]).includes(v);\n}\n\n/** Where one session sits (pinned wins over a section), and its color. */\nexport interface RailPlace {\n pinned?: boolean;\n section?: string;\n color?: RailColor;\n}\n\nexport interface RailLayout {\n sections: RailSection[];\n /** By session id; a session without one is in no section and not pinned. */\n places: Record<string, RailPlace>;\n /** A project's colour (a repo alias or a group's name → colour; config `colors`): its sessions' colour unless one has its own. */\n projectColors?: Record<string, RailColor>;\n}\n\nexport const EMPTY_RAIL_LAYOUT: RailLayout = { sections: [], places: {} };\nexport const MAX_SECTIONS = 30;\nexport const MAX_SECTION_NAME = 40;\n\nexport interface RailGroup<T> {\n /** 'pinned', 'rest', or `section:<id>`. */\n key: string;\n /** Null for the rest when there are no sections (nothing to tell it from). */\n title: string | null;\n sectionId?: string;\n sessions: T[];\n}\n\n/**\n * The rail in groups: Pinned, then each section in your order (empty ones\n * too — something to drop a row into), then the rest. A place naming a\n * section that is gone counts as the rest. Pure.\n */\nexport function groupRail<T extends { id: string }>(list: readonly T[], layout: RailLayout): RailGroup<T>[] {\n const known = new Set(layout.sections.map((s) => s.id));\n const pinned: T[] = [];\n const bySection = new Map<string, T[]>();\n const rest: T[] = [];\n for (const s of list) {\n const p = layout.places[s.id];\n if (p?.pinned) pinned.push(s);\n else if (p?.section && known.has(p.section)) bySection.set(p.section, [...(bySection.get(p.section) ?? []), s]);\n else rest.push(s);\n }\n const out: RailGroup<T>[] = [];\n if (pinned.length) out.push({ key: 'pinned', title: 'Pinned', sessions: pinned });\n for (const sec of layout.sections)\n out.push({ key: `section:${sec.id}`, title: sec.name, sectionId: sec.id, sessions: bySection.get(sec.id) ?? [] });\n // The rest: untitled when nothing tells it apart (no sections, and it has\n // rows under the pins). Kept even when empty once something is placed, as\n // somewhere to drag a row out of its section or pin.\n if (rest.length || out.length === 0 || pinned.length || layout.sections.length) {\n out.push({ key: 'rest', title: layout.sections.length || rest.length === 0 ? 'Other' : null, sessions: rest });\n }\n return out;\n}\n\n/** What dropping a row into a group means for its place (its color stays). */\nexport function placeForGroup(group: Pick<RailGroup<unknown>, 'key' | 'sectionId'>): PlacePatch {\n if (group.key === 'pinned') return { pinned: true };\n if (group.sectionId) return { pinned: false, section: group.sectionId };\n return { pinned: false, section: null };\n}\n\n/** A change to one session's place; `section: null` takes it out of its section, `color: null` its color off. */\nexport interface PlacePatch {\n pinned?: boolean;\n section?: string | null;\n color?: RailColor | null;\n}\n\n/** What a refused place change is told (both servers). */\nexport const PLACE_PATCH_EXPECTED = `expected {pinned?: boolean, section?: string | null, color?: ${RAIL_COLORS.join(' | ')} | null}`;\n\n/** Validate a PUT body's place change; null when it isn't one. */\nexport function cleanPlacePatch(raw: unknown): PlacePatch | null {\n if (!raw || typeof raw !== 'object') return null;\n const o = raw as Record<string, unknown>;\n const out: PlacePatch = {};\n if ('pinned' in o) {\n if (typeof o.pinned !== 'boolean') return null;\n out.pinned = o.pinned;\n }\n if ('section' in o) {\n if (o.section !== null && (typeof o.section !== 'string' || !o.section || o.section.length > 64)) return null;\n out.section = o.section as string | null;\n }\n if ('color' in o) {\n if (o.color !== null && !isRailColor(o.color)) return null;\n out.color = o.color;\n }\n return 'pinned' in out || 'section' in out || 'color' in out ? out : null;\n}\n\n/** The place after a patch, or null when it is back to nowhere (no row to keep). */\nexport function applyPlacePatch(prev: RailPlace | undefined, patch: PlacePatch): RailPlace | null {\n const next: RailPlace = { ...prev };\n if (patch.pinned !== undefined) {\n if (patch.pinned) next.pinned = true;\n else delete next.pinned;\n }\n if (patch.section !== undefined) {\n if (patch.section) next.section = patch.section;\n else delete next.section;\n }\n if (patch.color !== undefined) {\n if (patch.color) next.color = patch.color;\n else delete next.color;\n }\n return next.pinned || next.section || next.color ? next : null;\n}\n\n/** Validate the section list (names trimmed, ids unique, bounded); null when it isn't one. */\nexport function cleanSections(raw: unknown): RailSection[] | null {\n if (!Array.isArray(raw) || raw.length > MAX_SECTIONS) return null;\n const seen = new Set<string>();\n const out: RailSection[] = [];\n for (const x of raw) {\n const o = x as Record<string, unknown> | null;\n if (!o || typeof o.id !== 'string' || !/^[\\w-]{1,64}$/.test(o.id) || typeof o.name !== 'string') return null;\n const name = o.name.trim().slice(0, MAX_SECTION_NAME);\n if (!name || seen.has(o.id)) return null;\n seen.add(o.id);\n out.push({ id: o.id, name });\n }\n return out;\n}\n\n/** A stored place, shape-checked (a row from state.db). */\nexport function asRailPlace(v: unknown): RailPlace | null {\n const o = v as Record<string, unknown> | null;\n if (!o || typeof o !== 'object') return null;\n const out: RailPlace = {};\n if (o.pinned === true) out.pinned = true;\n if (typeof o.section === 'string' && o.section) out.section = o.section;\n if (isRailColor(o.color)) out.color = o.color;\n return out.pinned || out.section || out.color ? out : null;\n}\n\n/**\n * One change to your sections, applied by the server to the list as it is\n * then (not a whole list from a window that may be out of date: two windows\n * editing at once would otherwise lose one's change, and a removed section's\n * sessions with it).\n */\nexport type SectionOp =\n | { op: 'add'; id: string; name: string }\n | { op: 'rename'; id: string; name: string }\n | { op: 'move'; id: string; by: -1 | 1 }\n | { op: 'remove'; id: string };\n\n/** Validate a request body as a section change; null when it isn't one. */\nexport function cleanSectionOp(raw: unknown): SectionOp | null {\n const o = raw as Record<string, unknown> | null;\n if (!o || typeof o !== 'object' || typeof o.id !== 'string' || !/^[\\w-]{1,64}$/.test(o.id)) return null;\n const name = typeof o.name === 'string' ? o.name.trim().slice(0, MAX_SECTION_NAME) : '';\n if (o.op === 'add' || o.op === 'rename') return name ? { op: o.op, id: o.id, name } : null;\n if (o.op === 'move') return o.by === 1 || o.by === -1 ? { op: 'move', id: o.id, by: o.by } : null;\n if (o.op === 'remove') return { op: 'remove', id: o.id };\n return null;\n}\n\n/** The list after one change; an error when it no longer fits (a section another window removed, a duplicate, too many). */\nexport function applySectionOp(\n sections: readonly RailSection[],\n op: SectionOp,\n): { ok: true; sections: RailSection[] } | { ok: false; error: string } {\n const i = sections.findIndex((s) => s.id === op.id);\n if (op.op === 'add') {\n if (i !== -1) return { ok: false, error: 'that section already exists' };\n if (sections.length >= MAX_SECTIONS) return { ok: false, error: `at most ${MAX_SECTIONS} sections` };\n return { ok: true, sections: [...sections, { id: op.id, name: op.name }] };\n }\n if (i === -1) return { ok: false, error: 'no such section (removed in another window?)' };\n if (op.op === 'rename') return { ok: true, sections: sections.map((s) => (s.id === op.id ? { ...s, name: op.name } : s)) };\n if (op.op === 'remove') return { ok: true, sections: sections.filter((s) => s.id !== op.id) };\n const j = i + op.by;\n if (j < 0 || j >= sections.length) return { ok: true, sections: [...sections] };\n const next = [...sections];\n [next[i], next[j]] = [next[j], next[i]];\n return { ok: true, sections: next };\n}\n\n/** A short random id for a new section (ids only need to be unique among yours). */\nexport function newSectionId(): string {\n return `s${Date.now().toString(36)}${Math.random().toString(36).slice(2, 6)}`;\n}\n\n/**\n * The colour a session shows: its own (you coloured it), else its project's (asked for: a default colour per repo, to\n * tell projects apart). None: no colour. Pure.\n */\nexport function sessionColor(\n layout: Pick<RailLayout, 'places' | 'projectColors'> | null | undefined,\n s: { id: string; target: string },\n): RailColor | undefined {\n return layout?.places[s.id]?.color ?? layout?.projectColors?.[s.target];\n}\n\n/** A config's `colors` as project colours: only names with one of the six. Pure. */\nexport function projectColorsOf(raw: unknown): Record<string, RailColor> {\n if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return {};\n return Object.fromEntries(Object.entries(raw as Record<string, unknown>).filter((e): e is [string, RailColor] => isRailColor(e[1])));\n}\n","import { projectColorsOf } from '../rail/rail-layout.js';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { atomicWriteFile } from './fs-safe.js';\nimport { validatePrompts } from '../sessions/saved-prompts.js';\nimport { isIssueKey } from '../time/allocate.js';\nimport { getConfigDir } from './config-dir.js';\nimport type { SavedPrompt } from '../api-types.js';\n\n/**\n * An opt-in shell command that runs when a session changes status. The command\n * runs with the session's directory as its cwd (passed as the spawn `cwd`\n * option, never interpolated into the command string).\n */\nexport interface StatusHook {\n on: 'idle' | 'needs_input';\n command: string;\n}\n\nexport interface WorkConfig {\n worktreesRoot: string;\n repos: Record<string, string>;\n groups: Record<string, string[]>;\n copyFiles: string[];\n /** Folders the Repos page scans for git repos (repo-scan.ts); default: the one the worktrees root sits in. */\n scanRoots?: string[];\n /** Repos you chose not to enrol (paths), so the Repos page stops offering them. */\n ignoredRepos?: string[];\n /** The Jira watch (jira-watch.ts; turned on and off in the Jira tab): at most this many automatic starts a day (default 5). */\n jiraWatch?: { maxPerDay?: number };\n /** Where issues start (core/issues/issue-place.ts): your rules, a line each (`jira:PAY -> api`). */\n issues?: { rules?: string[] };\n /** The Time tab's rules (core/time/allocate.ts, defaults in DEFAULT_TIME_SETTINGS), and the Jira\n * projects whose keys count in commit subjects (default: the projects of your sessions' keys). */\n time?: Partial<import('../time/allocate.js').TimeSettings> & {\n projects?: string[];\n /** How many days back the Time tab gathers (default 14, at most 92; Claude's own transcripts go back about 30). */\n catchUpDays?: number;\n /** Tickets a workstream maps to when nothing names them (the timesheet tool's TICKET_HINTS), by key. */\n hints?: Record<string, import('../time/hints.js').TicketHint>;\n /** Posting to Tempo: the env variable with the token (default TEMPO_API_TOKEN) and your Jira account id (else JIRA_ACCOUNT_ID). */\n tempo?: { tokenEnv?: string; accountId?: string };\n /** Outlook and Teams through Microsoft Graph: the app registration to sign in with (else GRAPH_CLIENT_ID / GRAPH_TENANT_ID). */\n graph?: { clientId?: string; tenantId?: string };\n /** The Jira field holding story points (`customfield_…`, each site its own): read for tasks, they weigh the day's split. */\n storyPointsField?: string;\n };\n /** Stacked sessions (stack-sync.ts): bring a parent's new commits into the sessions stacked on it (default true). */\n stacks?: { autoUpdate?: boolean };\n /** Usage meters: `statusLine: false` leaves Claude's status line alone (work otherwise wraps it to read the rate limits). */\n usage?: { statusLine?: boolean };\n /** Claude Code accounts besides the default `~/.claude`: name → its config folder (`CLAUDE_CONFIG_DIR`), as written; agents/claude/accounts.ts checks them. */\n claudeAccounts?: Record<string, string>;\n /** The account new sessions and work's own Claude runs use: `default` or a key of `claudeAccounts`. */\n claudeAccount?: string;\n /** The status line under the Claudes work starts: `work`'s own (work-line.ts) or the user's (`own`); unset: never asked, the user's. */\n claudeStatusLine?: 'work' | 'own';\n /** The agent that writes work's own summaries — checkpoint names, catch-up, archive summaries, the Jira watch's choice (default `claude`; one without one-shot runs writes none). */\n internalAgent?: string;\n /** The agent the Ctrl+K assistant runs (an adapter's id; Claude Code by default). */\n assistantAgent?: string;\n /**\n * PR reviews prepared in the background (#64, core/review/): per project (a repo alias or a group) `all` open PRs\n * (the default), only those `asked` of you, or `off`; the day's cap and the size above which a review waits for a\n * click; and kind-of-change rules before the defaults (change-kinds.ts).\n */\n reviews?: {\n projects?: Record<string, 'all' | 'asked' | 'off'>;\n maxPerDay?: number;\n maxLines?: number;\n rules?: unknown[];\n /** What every review's AI step is told to pay attention to (your words: instructions to it), and per repo alias besides. */\n focus?: string[];\n focusFor?: Record<string, string[]>;\n };\n /**\n * The git host of an origin whose URL no adapter claims (core/hosts/index.ts): its hostname (lower case) → a host\n * id. Only a host that can work with such a server needs it (one registered at run time); GitHub Enterprise needs\n * no entry — an unclaimed origin is asked as GitHub already, and gh finds its server from the repo's folder. The\n * registry reads it from the raw config.\n */\n gitHosts?: Record<string, string>;\n /** Environment variable names to keep for a session restored after a reboot (the launching shell's values; secret-looking names are never kept). */\n hostEnv?: string[];\n /** Writing session time to Jira as worklogs (jira-worklog.ts): the site, your email, and the API token (from the env var `tokenEnv`, default JIRA_API_TOKEN, or `token`). */\n jiraWorklog?: { site: string; email: string; tokenEnv?: string; token?: string };\n /**\n * AI tool command to launch in worktrees. May include extra args, e.g.\n * \"claude\" (default), \"gemini\", \"codex\", or \"my-tool --some-flag\".\n */\n aiCommand?: string;\n /**\n * Launch `work tree`'s AI session inside the PTY host and attach this\n * terminal to it (like `work attach`), so it survives closing the tab and\n * the dashboard shows the same screen. Default on; `false` launches\n * directly in the terminal. Per call: `--host` / `--no-host`.\n */\n launchViaHost?: boolean;\n /**\n * Experimental, off by default: NEW sessions are made as a folder with one\n * subfolder per repo — a single repo too (`<root>/<branch>-<id6>/<repo>/`, session-folder.ts) —\n * and the agent runs in the folder, whose instructions file imports each\n * repo's own. Existing sessions keep the layout they were made with.\n */\n sessionFolders?: boolean;\n /**\n * Per-tool flag overrides. Defaults come from the preset matching the\n * binary in `aiCommand` (see AI_TOOL_PRESETS in core/ai-launcher.ts).\n * Set any value to an empty string to disable that flag for the configured tool.\n */\n aiCommandFlags?: {\n /** Flag for resuming the most recent session. */\n resume?: string;\n /** Flag for passing an initial prompt as a file path. */\n promptFile?: string;\n /** Flag for passing an inline prompt; empty string = positional arg. */\n prompt?: string;\n };\n /** Editor command for opening worktrees. Default: \"code\" */\n editor?: string;\n /**\n * Range of dev-server ports to allocate to worktrees (inclusive).\n * Each worktree gets a stable port exposed as $PORT to the launched process.\n * Default when unset: { start: 3000, end: 3099 }.\n */\n portRange?: { start: number; end: number };\n /**\n * Dev-server command per repo alias, run from the dashboard with this\n * worktree's $PORT (e.g. `{ \"web\": \"npm run dev -- --port $PORT\" }`).\n */\n devCommands?: Record<string, string>;\n /** A project's colour (a repo alias or a group's name → red, orange, yellow, green, blue or purple): its sessions' colour in the rail and the lists unless one has its own (rail-layout.ts sessionColor). */\n colors?: Record<string, import('../rail/rail-layout.js').RailColor>;\n /**\n * Stop a session's Claude in the PTY host after this many minutes idle with\n * no window attached; opening the session resumes its conversation. Frees\n * memory (each Claude holds a few hundred MB). Default 10, at least 5; 0 = never.\n * Only a truly idle one: never working, waiting on you, or with background work still running (idle-sleep.ts).\n */\n sleepIdleAfterMinutes?: number;\n /**\n * Windows: start terminals on the ConPTY node-pty ships (`conpty.dll` + `OpenConsole.exe`, the one Windows Terminal\n * uses) instead of the one built into Windows, whose console start can hang — and with it the PTY host. Read at\n * each terminal start; nothing restarts. Default off (node-pty calls it experimental).\n */\n useBundledConpty?: boolean;\n /**\n * Start each session's agent below normal priority, so the builds and tests it runs take the idle cores and give way\n * to what you look at (the dashboard, your editor). Read at each agent start; a running one keeps what it has.\n * Default off.\n */\n agentsLowPriority?: boolean;\n /**\n * Archived conversations (archive-retention.ts): gzip them once this many\n * days old (default 30; 0 = never; lossless), and delete them after this\n * many (default 0 = never; the summary and prompts stay).\n */\n archive?: { compressAfterDays?: number; dropTranscriptsAfterDays?: number };\n /**\n * Background PR watch in `work web` (both default on): archive a session\n * once all its PRs merged, and tell its Claude when CI fails or reviewers\n * leave feedback.\n */\n prWatch?: {\n autoArchive?: boolean;\n fixCi?: boolean;\n /** A PR of the session's that turns conflicting: its Claude is asked to merge the base in and\n * resolve it (DECISION NEEDED when it isn't clear-cut). Default on. */\n fixConflicts?: boolean;\n reviewComments?: boolean;\n /** Review bots whose comments go to Claude like a colleague's (logins,\n * e.g. \"copilot-pull-request-reviewer\"). Default: Copilot and\n * github-actions (pr-review.ts DEFAULT_TRUSTED_BOTS); [] = none. */\n trustedBots?: string[];\n /** Start a session's Claude (resuming its conversation) when feedback\n * arrives and it isn't running, so it works on it at once. Default on. */\n wakeClaude?: boolean;\n /**\n * The checks that count, per repo (its alias, or the host's `owner/name`), for a repo whose host requires none\n * (GitHub's branch protection or rulesets list no required checks): a failed check not named here doesn't make\n * the PR's checks fail — shown grey as \"not required\", never asked of Claude. The host's own list, when it has\n * one, wins; a repo with neither counts every check.\n */\n requiredChecks?: Record<string, string[]>;\n };\n /**\n * Opt-in desktop notifications. When true, the dashboard fires an OS\n * notification when a session goes idle or needs input. Default: off.\n */\n notifications?: boolean;\n /**\n * Opt-in shell commands run when a session changes status (idle /\n * needs_input). Each command runs with the session dir as its cwd.\n * Generalizes `notifications`; both paths work independently. Default: none.\n */\n statusHooks?: StatusHook[];\n /**\n * One-click instructions in a session's \"Prompts ▾\" menu, replacing the\n * built-in ones: `[{ \"label\": \"Add tests\", \"prompt\": \"…\", \"repos\": [\"api\"] }]`\n * (`repos` optional: only for those repo aliases / group names).\n */\n prompts?: SavedPrompt[];\n}\n\n/** Lowest port we allow to be configured (avoid privileged ports < 1024). */\nconst MIN_PORT = 1024;\n/** Highest valid TCP port. */\nconst MAX_PORT = 65535;\n\n/**\n * Validate a configured port range. Returns the normalized range when it is a\n * pair of integers with `MIN_PORT <= start <= end <= MAX_PORT`, otherwise\n * undefined (callers then fall back to the default range). Rejects non-integers,\n * privileged/out-of-bounds ports, and reversed ranges.\n */\nexport function validatePortRange(value: unknown): { start: number; end: number } | undefined {\n if (!value || typeof value !== 'object') return undefined;\n const { start, end } = value as { start?: unknown; end?: unknown };\n if (typeof start !== 'number' || typeof end !== 'number') return undefined;\n if (!Number.isInteger(start) || !Number.isInteger(end)) return undefined;\n if (start < MIN_PORT || end > MAX_PORT) return undefined;\n if (start > end) return undefined;\n return { start, end };\n}\n\nexport { getConfigDir };\n\n/** An agent named in config (`internalAgent`, `assistantAgent`): an adapter's id, a plain word — never a path or a command line. */\nexport function isAgentId(v: unknown): v is string {\n return typeof v === 'string' && /^[\\w.-]+$/.test(v);\n}\n\nexport function getConfigPath(): string {\n return path.join(getConfigDir(), 'config.json');\n}\n\nfunction validateDevCommands(raw: unknown): Record<string, string> | undefined {\n if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return undefined;\n const out: Record<string, string> = {};\n for (const [alias, cmd] of Object.entries(raw)) if (typeof cmd === 'string' && cmd.trim()) out[alias] = cmd;\n return out;\n}\n\n/** The Time tab's section as written: only well-formed values (a bad one is left to its default). */\nexport function validateTime(raw: unknown): WorkConfig['time'] {\n if (!raw || typeof raw !== 'object') return undefined;\n const t = raw as Record<string, unknown>;\n const num = (k: string, min: number) => (typeof t[k] === 'number' && (t[k] as number) >= min ? { [k]: t[k] as number } : {});\n const key = (k: string) => (typeof t[k] === 'string' && isIssueKey(t[k] as string) ? { [k]: t[k] as string } : {});\n const strs = (o: unknown, keys: string[]) => {\n if (!o || typeof o !== 'object') return undefined;\n const out: Record<string, string> = {};\n for (const k of keys) {\n const v = (o as Record<string, unknown>)[k];\n if (typeof v === 'string' && v.trim()) out[k] = v.trim();\n }\n return Object.keys(out).length ? out : undefined;\n };\n const days = stringList(t.holidays)?.filter((d) => /^\\d{4}-\\d{2}-\\d{2}$/.test(d));\n const vacation = stringList(t.vacation)?.filter((d) => /^\\d{4}-\\d{2}-\\d{2}$/.test(d));\n const hints = validateHints(t.hints);\n const catchUp = typeof t.catchUpDays === 'number' && t.catchUpDays >= 1 ? { catchUpDays: Math.min(92, Math.floor(t.catchUpDays)) } : {};\n const projects = stringList(t.projects)?.filter((p) => /^[A-Z][A-Z0-9]{1,9}$/.test(p));\n const desk = stringList(t.deskProjects)?.filter((p) => /^[A-Z][A-Z0-9]{1,9}$/.test(p));\n const tempo = strs(t.tempo, ['tokenEnv', 'accountId']);\n const graph = strs(t.graph, ['clientId', 'tenantId']);\n return {\n ...num('dayHours', 0.25),\n ...num('multiplier', 0),\n ...num('capHours', 0),\n ...num('stepHours', 0.01),\n ...num('minHours', 0),\n ...key('gapTicket'),\n ...key('timeOffTicket'),\n ...(days ? { holidays: days } : {}),\n ...(vacation ? { vacation } : {}),\n ...(typeof t.effort === 'boolean' ? { effort: t.effort } : {}),\n ...(desk ? { deskProjects: desk } : {}),\n ...(t.taskMinHours === null || (typeof t.taskMinHours === 'number' && t.taskMinHours >= 0)\n ? { taskMinHours: t.taskMinHours as number | null }\n : {}),\n ...num('pointsWeight', 0),\n ...(typeof t.storyPointsField === 'string' && /^customfield_\\d+$/.test(t.storyPointsField)\n ? { storyPointsField: t.storyPointsField }\n : {}),\n ...catchUp,\n ...(hints ? { hints } : {}),\n ...(projects ? { projects } : {}),\n ...(tempo ? { tempo } : {}),\n ...(graph ? { graph } : {}),\n };\n}\n\n/** `time.hints`: each a real issue key with what matches it (text found in a session, commit, meeting or chat). */\nfunction validateHints(raw: unknown): Record<string, import('../time/hints.js').TicketHint> | undefined {\n if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return undefined;\n const out: Record<string, import('../time/hints.js').TicketHint> = {};\n for (const [k, v] of Object.entries(raw as Record<string, unknown>)) {\n const h = v as Record<string, unknown> | null;\n const matches = stringList(h?.matches)\n ?.map((m) => m.trim())\n .filter((m) => m.length >= 3);\n if (!isIssueKey(k) || !matches?.length) continue;\n out[k] = {\n matches,\n ...(typeof h?.summary === 'string' && h.summary.trim() ? { summary: h.summary.trim() } : {}),\n ...(h?.placeholder === true ? { placeholder: true } : {}),\n };\n }\n return Object.keys(out).length ? out : undefined;\n}\n\n/** A list of non-empty strings, or undefined (not a list). */\nfunction stringList(raw: unknown): string[] | undefined {\n return Array.isArray(raw) ? raw.filter((x): x is string => typeof x === 'string' && x.trim().length > 0) : undefined;\n}\n\n/** `default` is the account at `~/.claude` (a session that records no account runs on it); it can't be a configured name. */\nexport const DEFAULT_ACCOUNT = 'default';\n\n/**\n * `claudeAccounts` as written: the entries whose folder is a string. What makes one an account (a name, a folder that\n * can be one) is Claude's to say (agents/claude/accounts.ts), which checks them where they are read.\n */\nfunction stringRecord(raw: unknown): Record<string, string> | undefined {\n if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return undefined;\n const out = Object.fromEntries(\n Object.entries(raw as Record<string, unknown>).filter((e): e is [string, string] => typeof e[1] === 'string'),\n );\n return Object.keys(out).length ? out : undefined;\n}\n\nexport function loadConfig(): WorkConfig | null {\n const configPath = getConfigPath();\n if (!fs.existsSync(configPath)) {\n return null;\n }\n\n try {\n const raw = fs.readFileSync(configPath, 'utf-8');\n const parsed = JSON.parse(raw);\n return {\n worktreesRoot: parsed.worktreesRoot ?? '',\n repos: parsed.repos ?? {},\n groups: parsed.groups ?? {},\n copyFiles: parsed.copyFiles ?? [],\n scanRoots: stringList(parsed.scanRoots),\n ignoredRepos: stringList(parsed.ignoredRepos),\n aiCommand: parsed.aiCommand,\n aiCommandFlags: parsed.aiCommandFlags,\n editor: parsed.editor,\n portRange: validatePortRange(parsed.portRange),\n notifications: parsed.notifications === true,\n statusHooks: Array.isArray(parsed.statusHooks) ? parsed.statusHooks : [],\n launchViaHost: typeof parsed.launchViaHost === 'boolean' ? parsed.launchViaHost : undefined,\n sessionFolders: typeof parsed.sessionFolders === 'boolean' ? parsed.sessionFolders : undefined,\n devCommands: validateDevCommands(parsed.devCommands),\n colors: Object.keys(projectColorsOf(parsed.colors)).length ? projectColorsOf(parsed.colors) : undefined,\n sleepIdleAfterMinutes:\n typeof parsed.sleepIdleAfterMinutes === 'number' && parsed.sleepIdleAfterMinutes >= 0 ? parsed.sleepIdleAfterMinutes : undefined,\n useBundledConpty: typeof parsed.useBundledConpty === 'boolean' ? parsed.useBundledConpty : undefined,\n agentsLowPriority: typeof parsed.agentsLowPriority === 'boolean' ? parsed.agentsLowPriority : undefined,\n prompts: validatePrompts(parsed.prompts),\n time: validateTime(parsed.time),\n archive:\n parsed.archive && typeof parsed.archive === 'object'\n ? {\n ...(typeof parsed.archive.compressAfterDays === 'number' && parsed.archive.compressAfterDays >= 0\n ? { compressAfterDays: parsed.archive.compressAfterDays }\n : {}),\n ...(typeof parsed.archive.dropTranscriptsAfterDays === 'number' && parsed.archive.dropTranscriptsAfterDays >= 0\n ? { dropTranscriptsAfterDays: parsed.archive.dropTranscriptsAfterDays }\n : {}),\n }\n : undefined,\n stacks: parsed.stacks && typeof parsed.stacks === 'object' ? { autoUpdate: parsed.stacks.autoUpdate !== false } : undefined,\n usage: parsed.usage && typeof parsed.usage === 'object' ? { statusLine: parsed.usage.statusLine !== false } : undefined,\n claudeAccounts: stringRecord(parsed.claudeAccounts),\n claudeAccount: typeof parsed.claudeAccount === 'string' ? parsed.claudeAccount : undefined,\n claudeStatusLine: parsed.claudeStatusLine === 'work' || parsed.claudeStatusLine === 'own' ? parsed.claudeStatusLine : undefined,\n internalAgent: isAgentId(parsed.internalAgent) ? parsed.internalAgent : undefined,\n assistantAgent: isAgentId(parsed.assistantAgent) ? parsed.assistantAgent : undefined,\n reviews:\n parsed.reviews && typeof parsed.reviews === 'object' && !Array.isArray(parsed.reviews)\n ? {\n ...(parsed.reviews.projects && typeof parsed.reviews.projects === 'object' && !Array.isArray(parsed.reviews.projects)\n ? {\n projects: Object.fromEntries(\n Object.entries(parsed.reviews.projects as Record<string, unknown>).filter(\n (e): e is [string, 'all' | 'asked' | 'off'] => e[1] === 'all' || e[1] === 'asked' || e[1] === 'off',\n ),\n ),\n }\n : {}),\n ...(typeof parsed.reviews.maxPerDay === 'number' && parsed.reviews.maxPerDay >= 0\n ? { maxPerDay: parsed.reviews.maxPerDay }\n : {}),\n ...(typeof parsed.reviews.maxLines === 'number' && parsed.reviews.maxLines > 0 ? { maxLines: parsed.reviews.maxLines } : {}),\n ...(Array.isArray(parsed.reviews.rules) ? { rules: parsed.reviews.rules as unknown[] } : {}),\n ...(Array.isArray(parsed.reviews.focus)\n ? { focus: (parsed.reviews.focus as unknown[]).filter((x): x is string => typeof x === 'string' && !!x.trim()) }\n : {}),\n ...(parsed.reviews.focusFor && typeof parsed.reviews.focusFor === 'object' && !Array.isArray(parsed.reviews.focusFor)\n ? {\n focusFor: Object.fromEntries(\n Object.entries(parsed.reviews.focusFor as Record<string, unknown>)\n .filter((e): e is [string, unknown[]] => Array.isArray(e[1]))\n .map(([alias, list]) => [alias, list.filter((x): x is string => typeof x === 'string' && !!x.trim())]),\n ),\n }\n : {}),\n }\n : undefined,\n gitHosts:\n parsed.gitHosts && typeof parsed.gitHosts === 'object' && !Array.isArray(parsed.gitHosts)\n ? Object.fromEntries(\n Object.entries(parsed.gitHosts as Record<string, unknown>).filter((e): e is [string, string] => typeof e[1] === 'string'),\n )\n : undefined,\n hostEnv: Array.isArray(parsed.hostEnv)\n ? parsed.hostEnv.filter((n: unknown): n is string => typeof n === 'string' && /^[A-Za-z_][A-Za-z0-9_]*$/.test(n))\n : undefined,\n issues:\n parsed.issues && typeof parsed.issues === 'object' && Array.isArray(parsed.issues.rules)\n ? { rules: (parsed.issues.rules as unknown[]).filter((x): x is string => typeof x === 'string' && !!x.trim()) }\n : undefined,\n // The Settings page writes it (reported: it saved and nothing read it).\n jiraWatch:\n parsed.jiraWatch && typeof parsed.jiraWatch === 'object' && typeof parsed.jiraWatch.maxPerDay === 'number'\n ? Number.isInteger(parsed.jiraWatch.maxPerDay) && parsed.jiraWatch.maxPerDay >= 0 && parsed.jiraWatch.maxPerDay <= 100\n ? { maxPerDay: parsed.jiraWatch.maxPerDay }\n : undefined\n : undefined,\n jiraWorklog:\n parsed.jiraWorklog &&\n typeof parsed.jiraWorklog === 'object' &&\n typeof parsed.jiraWorklog.site === 'string' &&\n typeof parsed.jiraWorklog.email === 'string'\n ? {\n site: parsed.jiraWorklog.site,\n email: parsed.jiraWorklog.email,\n ...(typeof parsed.jiraWorklog.tokenEnv === 'string' ? { tokenEnv: parsed.jiraWorklog.tokenEnv } : {}),\n ...(typeof parsed.jiraWorklog.token === 'string' ? { token: parsed.jiraWorklog.token } : {}),\n }\n : undefined,\n prWatch:\n parsed.prWatch && typeof parsed.prWatch === 'object'\n ? {\n autoArchive: parsed.prWatch.autoArchive !== false,\n fixCi: parsed.prWatch.fixCi !== false,\n fixConflicts: parsed.prWatch.fixConflicts !== false,\n reviewComments: parsed.prWatch.reviewComments !== false,\n ...(Array.isArray(parsed.prWatch.trustedBots)\n ? {\n trustedBots: parsed.prWatch.trustedBots.filter(\n (b: unknown): b is string => typeof b === 'string' && b.trim().length > 0,\n ),\n }\n : {}),\n wakeClaude: parsed.prWatch.wakeClaude !== false,\n ...(cleanRequiredChecks(parsed.prWatch.requiredChecks)\n ? { requiredChecks: cleanRequiredChecks(parsed.prWatch.requiredChecks)! }\n : {}),\n }\n : undefined,\n };\n } catch {\n return null;\n }\n}\n\n/** `prWatch.requiredChecks` as written: repo → check names (strings only, none empty); null when there's none. */\nexport function cleanRequiredChecks(raw: unknown): Record<string, string[]> | null {\n if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return null;\n const out: Record<string, string[]> = {};\n for (const [repo, names] of Object.entries(raw as Record<string, unknown>)) {\n if (!repo.trim() || !Array.isArray(names)) continue;\n const list = names.filter((n): n is string => typeof n === 'string' && n.trim().length > 0).map((n) => n.trim());\n if (list.length) out[repo] = list;\n }\n return Object.keys(out).length ? out : null;\n}\n\nexport function saveConfig(config: WorkConfig): void {\n // Atomic (write temp + rename): a crash or a concurrent reader can never\n // see a half-written config (§5.3 — history/tasks already did this).\n atomicWriteFile(getConfigPath(), JSON.stringify(config, null, 2));\n}\n\nexport function ensureConfig(): WorkConfig {\n const config = loadConfig();\n if (!config) {\n throw new Error('Configuration not found. Run \"work init\" to set up.');\n }\n return config;\n}\n","import type { SavedPrompt } from '../api-types.js';\n\nexport type { SavedPrompt } from '../api-types.js';\n\n/**\n * One-click instructions for a session (\"Prompts ▾\" in its header). Sent\n * like a review comment, so they reach Claude the same safe way: pushed to\n * a terminal the dashboard owns, or on the session's next turn — never\n * typed over a permission prompt. Pure (the demo uses it too).\n *\n * `prompts` in config.json replaces these defaults; `repos` limits one to\n * those repo aliases / group names.\n */\nexport const DEFAULT_PROMPTS: SavedPrompt[] = [\n {\n label: 'Review your changes',\n prompt:\n 'Review the changes on this branch as a strict reviewer would: bugs, missing edge cases, missing tests, leftovers (debug output, TODOs, dead code). Fix what you find, then tell me briefly what you changed.',\n },\n {\n label: 'Add tests',\n prompt:\n 'Add tests for what changed on this branch, following the existing test patterns in this repo. Run them and fix anything that fails.',\n },\n {\n label: 'Run checks and fix',\n prompt:\n \"Run this repo's type check, lint and tests (whatever it has). Fix what fails, and tell me if something is failing for a reason outside this change.\",\n },\n {\n label: 'Commit',\n prompt: \"Commit the current changes with a clear message in this repo's commit style. Don't push.\",\n },\n {\n label: 'Open a pull request',\n prompt:\n 'Push this branch and open a pull request for it with the CLI of the git host its origin is on. Write the title and description yourself from what we did in this conversation: what changed and why, how it was tested, anything a reviewer should look at first. Put the Jira key in the title if the branch or our conversation has one. Open it ready for review, not as a draft, and give me its link.',\n },\n {\n label: 'Rebase on the default branch',\n prompt:\n \"Fetch, then rebase this branch on origin's default branch. Resolve conflicts keeping both sides' intent, run the tests, and tell me about any conflict you weren't sure of.\",\n },\n];\n\nconst MAX_PROMPT = 20_000;\n\n/** The configured list, validated; undefined (use the defaults) when absent. */\nexport function validatePrompts(raw: unknown): SavedPrompt[] | undefined {\n if (!Array.isArray(raw)) return undefined;\n const out: SavedPrompt[] = [];\n for (const p of raw) {\n if (!p || typeof p !== 'object') continue;\n const { label, prompt, repos } = p as Record<string, unknown>;\n if (typeof label !== 'string' || !label.trim() || typeof prompt !== 'string' || !prompt.trim()) continue;\n const item: SavedPrompt = { label: label.trim(), prompt: prompt.trim().slice(0, MAX_PROMPT) };\n if (Array.isArray(repos)) {\n const names = repos.filter((r): r is string => typeof r === 'string' && r.length > 0);\n if (names.length) item.repos = names;\n }\n out.push(item);\n }\n return out;\n}\n\n/** The prompts that apply to a session: unscoped ones, and those naming\n * its target (a repo alias or group name) or one of its repos. */\nexport function promptsForSession(prompts: SavedPrompt[], target: string, repoNames: string[] = []): SavedPrompt[] {\n const names = new Set([target, ...repoNames]);\n return prompts.filter((p) => !p.repos || p.repos.some((r) => names.has(r)));\n}\n","/**\n * A day's suggested hours, from what was worked on (pure; the SPA and the\n * demo use it too). The timesheet tool's rules, as settings: a day of\n * `dayHours`, measured Claude time scaled by `multiplier` (an hour of Claude\n * at work stands for more of yours: reading, testing, talking), all of it\n * capped at `capHours`, in `stepHours` steps with at least `minHours` a\n * ticket, and what's left to the `gapTicket` (meetings, reviews, the rest).\n * A ticket touched with no measured time (a commit, an issue moved) gets the\n * minimum. Unlike the tool, it never goes over the day — too many tickets\n * trim the biggest first, then drop the smallest — and nothing is taken out\n * of one entry alone.\n */\n\nexport interface TimeSettings {\n /** A workday's hours. */\n dayHours: number;\n /** Measured Claude minutes × this = your hours on it. */\n multiplier: number;\n /** At most this much of a day to tickets (the gap ticket keeps the rest). */\n capHours: number;\n stepHours: number;\n /** A ticket that gets time gets at least this. */\n minHours: number;\n /** Gets what's left of the day (null: left unallocated). */\n gapTicket: string | null;\n /** A day off is booked to it (null: a day off books nothing). */\n timeOffTicket: string | null;\n /** Days that aren't workdays besides weekends (`YYYY-MM-DD`). */\n holidays: string[];\n /** Your days off (`YYYY-MM-DD`): booked whole to the time-off ticket, whatever else happened (the timesheet tool's VACATION_DAYS). */\n vacation: string[];\n /**\n * Hours as measured (the timesheet tool's `build --effort`): Claude minutes 1:1 in steps, no multiplier and no\n * minimum beyond a step, a ticket only touched gets no row; the gap ticket takes the rest of the day.\n */\n effort: boolean;\n /** Projects whose tickets are service desk (keep `minHours`); any other project's ticket is a task. */\n deskProjects: string[];\n /** A task's row on a day is at least this (null: tasks get `minHours` like any ticket). */\n taskMinHours: number | null;\n /** A task's measured hours × (1 + this × (story points − 1)) before the day is shared out (0: points don't count). */\n pointsWeight: number;\n}\n\nexport const DEFAULT_TIME_SETTINGS: TimeSettings = {\n dayHours: 7.5,\n multiplier: 5,\n capHours: 7,\n stepHours: 0.25,\n minHours: 0.5,\n gapTicket: null,\n timeOffTicket: null,\n holidays: [],\n vacation: [],\n effort: false,\n deskProjects: [],\n taskMinHours: null,\n pointsWeight: 0.25,\n};\n\n/** A ticket that isn't service desk, the gap ticket or time off: a task (its own minimum, its story points count). */\nexport function isTask(key: string, s: Pick<TimeSettings, 'deskProjects' | 'gapTicket' | 'timeOffTicket'>): boolean {\n return key !== s.gapTicket && key !== s.timeOffTicket && !s.deskProjects.includes(key.split('-')[0]);\n}\n\n/** What a ticket got that day: measured Claude minutes (× multiplier), your own minutes on it (a meeting: 1:1), or only touched (0). */\nexport interface TicketActivity {\n key: string;\n minutes: number;\n direct?: number;\n}\n\nexport interface TimeEntry {\n key: string;\n hours: number;\n}\n\nexport interface DaySuggestion {\n entries: TimeEntry[];\n /** Hours of the day no ticket got (no gap ticket set). */\n unallocated: number;\n /** How each row got its hours, in words, by key: \"51 min of Claude × 5 = 4.25 h\". */\n why: Record<string, string>;\n}\n\n/** \"4.25 h\". */\nconst h2 = (h: number) => `${Math.round(h * 100) / 100} h`;\n\n/**\n * A day's suggestion. `dayOff`: all of it to the time-off ticket.\n * `reserveMinutes`: meetings no ticket got — kept for the gap ticket, so\n * the tickets' share shrinks to leave them room.\n */\nexport function suggestDay(\n activity: readonly TicketActivity[],\n s: TimeSettings,\n opts: { dayOff?: boolean; reserveMinutes?: number; points?: Record<string, number> } = {},\n): DaySuggestion {\n // Whole steps, so sums are exact.\n const units = (h: number) => Math.round(h / s.stepHours);\n const day = units(s.dayHours);\n const hours = (u: number) => Math.round(u * s.stepHours * 100) / 100;\n if (opts.dayOff)\n return s.timeOffTicket\n ? { entries: [{ key: s.timeOffTicket, hours: s.dayHours }], unallocated: 0, why: { [s.timeOffTicket]: 'a day off: the whole day' } }\n : { entries: [], unallocated: s.dayHours, why: {} };\n\n // One row per ticket; the gap ticket's own time goes into what it gets at the end.\n const minutes = new Map<string, { claude: number; direct: number }>();\n for (const a of activity) {\n if (!a.key || a.key === s.gapTicket) continue;\n const m = minutes.get(a.key) ?? { claude: 0, direct: 0 };\n m.claude += Math.max(0, a.minutes);\n m.direct += Math.max(0, a.direct ?? 0);\n minutes.set(a.key, m);\n }\n const min = s.effort ? 1 : Math.max(1, units(s.minHours));\n // A task's own minimum (as measured, none beyond a step).\n const task = (key: string) => !s.effort && s.taskMinHours !== null && isTask(key, s);\n const minFor = (key: string) => (task(key) ? Math.max(min, units(s.taskMinHours!)) : min);\n // Story points weigh a task's share: × (1 + weight × (points − 1)); unknown points, a desk ticket: × 1.\n const factorFor = (key: string) => {\n const p = opts.points?.[key];\n return !s.effort && p !== undefined && p > 0 && isTask(key, s) ? Math.max(0, 1 + s.pointsWeight * (p - 1)) : 1;\n };\n const multiplier = s.effort ? 1 : s.multiplier;\n // Room for tickets: the cap, and the day less what the gap ticket keeps (its minimum, or the meetings it has).\n const reserve = s.gapTicket ? Math.max(min, units((opts.reserveMinutes ?? 0) / 60)) : 0;\n const room = Math.max(0, Math.min(units(s.capHours), day - reserve));\n const raw = [...minutes].map(([key, m]) => {\n const h = ((m.claude / 60) * multiplier + m.direct / 60) * factorFor(key);\n // Only touched (a commit, an issue moved): the minimum — or, measuring effort, nothing.\n return { key, raw: h > 0 ? h : s.effort ? 0 : s.minHours };\n });\n const total = raw.reduce((n, r) => n + r.raw, 0);\n const scale = total > room * s.stepHours && total > 0 ? (room * s.stepHours) / total : 1;\n let rows = raw\n .map((r) => {\n const scaled = r.raw * scale;\n const u = units(scaled);\n // Under its minimum: the minimum when it's at least a step's worth, else nothing.\n const least = minFor(r.key);\n return { key: r.key, raw: scaled, u: u >= least ? u : scaled >= s.stepHours ? least : 0, first: 0 };\n })\n .filter((r) => r.u > 0);\n for (const r of rows) r.first = r.u;\n // Rounding up to minimums can overshoot the room: trim the biggest a step at a time, then drop the smallest.\n let used = rows.reduce((n, r) => n + r.u, 0);\n const dropped: string[] = [];\n while (used > room && rows.length) {\n const big = rows.filter((r) => r.u > minFor(r.key)).sort((a, b) => b.u - a.u || a.key.localeCompare(b.key))[0];\n if (big) big.u--;\n else {\n rows = rows.sort((a, b) => a.raw - b.raw);\n dropped.push(rows[0].key);\n rows = rows.slice(1);\n }\n used = rows.reduce((n, r) => n + r.u, 0);\n }\n const entries = rows.sort((a, b) => b.u - a.u || a.key.localeCompare(b.key)).map((r) => ({ key: r.key, hours: hours(r.u) }));\n\n // The words: what it measured, how that became hours, and every step after (cut to fit, a minimum, trimmed).\n const why: Record<string, string> = {};\n const roomWhy =\n room === units(s.capHours) && units(s.capHours) <= day - reserve\n ? `the ${h2(s.capHours)} cap for tickets`\n : `the ${h2(s.dayHours)} day less ${h2(hours(reserve))} kept for ${s.gapTicket}${(opts.reserveMinutes ?? 0) > 0 ? ' (meetings no ticket got)' : ''}`;\n for (const r of rows) {\n const m = minutes.get(r.key)!;\n const parts: string[] = [];\n if (m.claude > 0)\n parts.push(s.effort ? `${Math.round(m.claude)} min of Claude, as measured` : `${Math.round(m.claude)} min of Claude × ${multiplier}`);\n if (m.direct > 0) parts.push(`${Math.round(m.direct)} min of meetings`);\n const measured = (m.claude / 60) * multiplier + m.direct / 60;\n const factor = factorFor(r.key);\n const steps: string[] = [\n measured > 0\n ? `${parts.join(' + ')} = ${h2(measured)}`\n : `only touched (a commit, an issue moved, a chat): the ${h2(s.minHours)} minimum`,\n ];\n if (measured > 0 && factor !== 1)\n steps.push(`× ${Math.round(factor * 100) / 100} for ${opts.points![r.key]} story points = ${h2(measured * factor)}`);\n if (scale < 1) steps.push(`all tickets came to ${h2(total)}, over ${roomWhy}: each cut to ${Math.round(scale * 100)}%`);\n const least = minFor(r.key);\n if (r.first === least && units(r.raw) < least && (measured > 0 || least > min))\n steps.push(least > min ? `raised to the ${h2(hours(least))} minimum for a task` : `raised to the ${h2(s.minHours)} minimum`);\n if (r.u < r.first) steps.push(`trimmed ${h2(hours(r.first - r.u))} so the day adds up`);\n why[r.key] = `${steps.join('; ')} → ${h2(hours(r.u))}`;\n }\n\n const left = day - used;\n if (s.gapTicket && left > 0) {\n why[s.gapTicket] =\n (dropped.length ? `no room left for ${dropped.join(', ')} (each under its minimum); ` : '') +\n `the rest of the ${h2(s.dayHours)} day${(opts.reserveMinutes ?? 0) > 0 ? `, ${Math.round(opts.reserveMinutes ?? 0)} min of it meetings no ticket got` : ''} → ${h2(hours(left))}`;\n return { entries: [...entries, { key: s.gapTicket, hours: hours(left) }], unallocated: 0, why };\n }\n return { entries, unallocated: hours(Math.max(0, left)), why };\n}\n\n/** Sum of a day's entries, in hours (to two decimals). */\nexport function totalHours(entries: readonly TimeEntry[]): number {\n return Math.round(entries.reduce((n, e) => n + e.hours, 0) * 100) / 100;\n}\n\n/** Monday to Friday, and not a holiday. */\nexport function isWorkday(day: string, s: Pick<TimeSettings, 'holidays'>): boolean {\n const d = new Date(`${day}T12:00:00`);\n const wd = d.getDay();\n return wd !== 0 && wd !== 6 && !s.holidays.includes(day);\n}\n\n/** A Jira issue key, as found in a branch, a commit subject or a title. */\nexport const ISSUE_KEY = /\\b([A-Z][A-Z0-9]{1,9}-\\d+)\\b/g;\n\n/** Whether a string is one issue key, whole (a row's key, a configured ticket). */\nexport function isIssueKey(s: string): boolean {\n return new RegExp(`^${ISSUE_KEY.source}$`).test(s);\n}\n\n/** The issue keys in a text, only of the given projects when any are given (`UTF-8` isn't an issue). */\nexport function issueKeys(text: string, projects?: ReadonlySet<string>): string[] {\n const out: string[] = [];\n for (const m of text.matchAll(ISSUE_KEY)) {\n const key = m[1];\n if (projects && projects.size && !projects.has(key.split('-')[0])) continue;\n if (!out.includes(key)) out.push(key);\n }\n return out;\n}\n"],"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E;AAAA,QACF,IACA,CAAC;AAAA,QACL,YAAY,OAAO,QAAQ,eAAe;AAAA,QAC1C,GAAI,oBAAoB,OAAO,QAAQ,cAAc,IACjD,EAAE,gBAAgB,oBAAoB,OAAO,QAAQ,cAAc,EAAG,IACtE,CAAC;AAAA,MACP,IACA;AAAA,IACR;AAAA,EACF,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGO,SAAS,oBAAoB,KAA+C;AACjF,MAAI,CAAC,OAAO,OAAO,QAAQ,YAAY,MAAM,QAAQ,GAAG,EAAG,QAAO;AAClE,QAAM,MAAgC,CAAC;AACvC,aAAW,CAAC,MAAM,KAAK,KAAK,OAAO,QAAQ,GAA8B,GAAG;AAC1E,QAAI,CAAC,KAAK,KAAK,KAAK,CAAC,MAAM,QAAQ,KAAK,EAAG;AAC3C,UAAM,OAAO,MAAM,OAAO,CAAC,MAAmB,OAAO,MAAM,YAAY,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC;AAC/G,QAAI,KAAK,OAAQ,KAAI,IAAI,IAAI;AAAA,EAC/B;AACA,SAAO,OAAO,KAAK,GAAG,EAAE,SAAS,MAAM;AACzC;AAEO,SAAS,WAAW,QAA0B;AAGnD,kBAAgB,cAAc,GAAG,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC;AAClE;AAEO,SAAS,eAA2B;AACzC,QAAM,SAAS,WAAW;AAC1B,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI,MAAM,qDAAqD;AAAA,EACvE;AACA,SAAO;AACT;","names":[]}
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/version.ts
4
- var VERSION = true ? "2.20.2" : "dev";
5
-
6
- export {
7
- VERSION
8
- };
9
- //# sourceMappingURL=chunk-NVHSGKL3.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/core/sessions/session-branches.ts","../src/core/git/reflog.ts"],"sourcesContent":["import path from 'node:path';\nimport { json, tx, withDb } from '../platform/db.js';\nimport { checkedOutBranch, gitDirs } from '../git/git-head.js';\nimport { branchCreatedFrom, branchLogChangedSince, branchStart, checkoutBranchHistory } from '../git/reflog.js';\nimport type { WorktreeSession } from './session-types.js';\nimport { sessionIdFor } from './session-id.js';\n\n/**\n * Every branch a session's repos have been on, recorded as it goes — so the\n * dashboard shows the work on all of them without asking git each time.\n * Claude often moves on in the same worktree: a PR merges, and the next fix\n * is a new branch made from origin/dev, then another. Only the checked-out\n * branch was ever looked at, so the earlier one's commits and PR (and the\n * first new one's, once a second came) vanished from the session.\n *\n * Per session in state.db `session_branches` (schema v12, gone with the\n * session: purgeSessionRows): each repo's branches with when they were first\n * and last checked out, and where they were made from when the reflog says.\n * Written at each turn's end (the turn-end hook reads HEAD files, no git),\n * when work checks a branch out (setupWorktree, Update), and once from the\n * reflog for a session recorded before (`backfilled`).\n */\n\nexport interface RecordedBranch {\n /** The repo, as the session names it (Ship and the PR watch): a group's folder, else the target. */\n repo: string;\n name: string;\n /** ISO. */\n firstSeen: string;\n lastSeen: string;\n /** The branch or ref it was made from (`origin/dev`), when known. */\n from?: string;\n /** When it was first seen deleted (the branch facts' look): a merged one stops showing after a while. */\n gone?: string;\n /** It was seen merged (its commits in main, or its PR merged): kept so a deleted one still reads merged. */\n merged?: true;\n /** It was seen on origin once: its PR is asked about even after origin's copy was deleted (a merge's tidy-up). */\n pushed?: true;\n /** The commit it was made at (its reflog's first line): its own work is what it has beyond it, merged or not. */\n start?: string;\n /** Its tip when last looked at (the branch facts): what the Diff tab shows of it once it is deleted. */\n tip?: string;\n}\n\nexport interface SessionBranches {\n branches: RecordedBranch[];\n /** When its reflog was read for the branches before the record began (once per session). */\n backfilled?: string;\n}\n\n/** Most branches kept per repo: the ones last seen longest ago go. */\nexport const MAX_BRANCHES_PER_REPO = 30;\n\nconst isIso = (v: unknown): v is string => typeof v === 'string' && Number.isFinite(Date.parse(v));\nconst isSha = (v: unknown): v is string => typeof v === 'string' && /^[0-9a-f]{40,64}$/.test(v);\n\n/** A stored record, shape-checked; entries that don't hold up are dropped, not the record. */\nexport function cleanBranches(raw: unknown): SessionBranches | null {\n const o = raw as { branches?: unknown; backfilled?: unknown } | null;\n if (!o || typeof o !== 'object' || !Array.isArray(o.branches)) return null;\n const branches: RecordedBranch[] = [];\n for (const b of o.branches as unknown[]) {\n const x = b as Partial<Record<keyof RecordedBranch, unknown>> | null;\n if (!x || typeof x !== 'object' || typeof x.repo !== 'string' || !x.repo || typeof x.name !== 'string' || !x.name) continue;\n if (!isIso(x.firstSeen) || !isIso(x.lastSeen)) continue;\n branches.push({\n repo: x.repo,\n name: x.name,\n firstSeen: x.firstSeen,\n lastSeen: x.lastSeen,\n ...(typeof x.from === 'string' && x.from ? { from: x.from } : {}),\n ...(isIso(x.gone) ? { gone: x.gone } : {}),\n ...(x.merged === true ? { merged: true as const } : {}),\n ...(x.pushed === true ? { pushed: true as const } : {}),\n ...(isSha(x.start) ? { start: x.start } : {}),\n ...(isSha(x.tip) ? { tip: x.tip } : {}),\n });\n }\n return { branches, ...(isIso(o.backfilled) ? { backfilled: o.backfilled } : {}) };\n}\n\nexport function readSessionBranches(sessionId: string): SessionBranches | null {\n const row = withDb(\n (d) => d.prepare('SELECT data FROM session_branches WHERE session_id = ?').get(sessionId) as { data: string } | undefined,\n );\n return row ? cleanBranches(json.parse(row.data)) : null;\n}\n\n/** Every session's record, in one query (the sessions list reads them per build). */\nexport function allSessionBranches(): Map<string, SessionBranches> {\n const rows = withDb(\n (d) => d.prepare('SELECT session_id, data FROM session_branches').all() as Array<{ session_id: string; data: string }>,\n );\n const out = new Map<string, SessionBranches>();\n for (const r of rows) {\n const b = cleanBranches(json.parse(r.data));\n if (b) out.set(r.session_id, b);\n }\n return out;\n}\n\n/** A branch seen checked out (or found in the reflog): its repo, name, and when. */\nexport interface BranchSighting {\n repo: string;\n name: string;\n /** ISO; default now. */\n firstSeen?: string;\n lastSeen?: string;\n from?: string;\n /** The commit it was made at, when its reflog says. */\n start?: string;\n}\n\n/** lastSeen is written again only when it moved this much: a turn's end needn't write the row every time. */\nexport const LAST_SEEN_STEP_MS = 10 * 60_000;\n\n/**\n * The record with these sightings: a new branch appended, a known one's first\n * and last sighting widened, its `from` filled in when it had none; a branch\n * seen again un-gone. Returns the record unchanged (the same object) when\n * nothing worth a write moved. Pure.\n */\nexport function withSightings(\n rec: SessionBranches | null,\n seen: BranchSighting[],\n now: Date,\n opts: { backfilled?: boolean } = {},\n): SessionBranches {\n const base: SessionBranches = rec ?? { branches: [] };\n let changed = !rec || (opts.backfilled === true && !base.backfilled);\n const branches = base.branches.map((b) => ({ ...b }));\n const nowIso = now.toISOString();\n for (const s of seen) {\n const first = s.firstSeen ?? nowIso;\n const last = s.lastSeen ?? nowIso;\n const b = branches.find((x) => x.repo === s.repo && x.name === s.name);\n if (!b) {\n branches.push({\n repo: s.repo,\n name: s.name,\n firstSeen: first,\n lastSeen: last,\n ...(s.from ? { from: s.from } : {}),\n ...(s.start ? { start: s.start } : {}),\n });\n changed = true;\n continue;\n }\n if (Date.parse(first) < Date.parse(b.firstSeen)) {\n b.firstSeen = first;\n changed = true;\n }\n if (Date.parse(last) - Date.parse(b.lastSeen) >= LAST_SEEN_STEP_MS) {\n b.lastSeen = last;\n changed = true;\n }\n if (s.from && !b.from) {\n b.from = s.from;\n changed = true;\n }\n // Where its own work begins moves when it is rebased or fast-forwarded: the newest reading wins.\n if (s.start && b.start !== s.start) {\n b.start = s.start;\n changed = true;\n }\n if (b.gone && s.lastSeen === undefined) {\n // Checked out now: it exists again.\n delete b.gone;\n changed = true;\n }\n }\n if (!changed) return base;\n // Per repo, the most recent MAX_BRANCHES_PER_REPO.\n const kept: RecordedBranch[] = [];\n for (const repo of [...new Set(branches.map((b) => b.repo))]) {\n const mine = branches.filter((b) => b.repo === repo);\n const keep = new Set([...mine].sort((a, b) => Date.parse(b.lastSeen) - Date.parse(a.lastSeen)).slice(0, MAX_BRANCHES_PER_REPO));\n kept.push(...mine.filter((b) => keep.has(b)));\n }\n return {\n branches: kept,\n ...(base.backfilled ? { backfilled: base.backfilled } : opts.backfilled ? { backfilled: nowIso } : {}),\n };\n}\n\nfunction write(sessionId: string, rec: SessionBranches): void {\n withDb((d) => d.prepare('INSERT OR REPLACE INTO session_branches (session_id, data) VALUES (?, ?)').run(sessionId, JSON.stringify(rec)));\n}\n\n/** Record sightings, in one transaction over the row as it is now. Returns the record after; writes only when something moved. */\nexport function noteBranches(\n sessionId: string,\n seen: BranchSighting[],\n now = new Date(),\n opts: { backfilled?: boolean } = {},\n): SessionBranches {\n return tx((d) => {\n const row = d.prepare('SELECT data FROM session_branches WHERE session_id = ?').get(sessionId) as { data: string } | undefined;\n const old = row ? cleanBranches(json.parse(row.data)) : null;\n const next = withSightings(old, seen, now, opts);\n if (next !== old) write(sessionId, next);\n return next;\n });\n}\n\n/**\n * What the branch facts saw of recorded branches: deleted (gone, from when it\n * was first seen so), or merged. One transaction; writes only a change.\n */\nexport function noteBranchFacts(\n sessionId: string,\n facts: Array<{ repo: string; name: string; exists: boolean; merged: boolean; pushed?: boolean; sha?: string | null }>,\n now = new Date(),\n): void {\n tx((d) => {\n const row = d.prepare('SELECT data FROM session_branches WHERE session_id = ?').get(sessionId) as { data: string } | undefined;\n const rec = row ? cleanBranches(json.parse(row.data)) : null;\n if (!rec) return;\n let changed = false;\n for (const f of facts) {\n const b = rec.branches.find((x) => x.repo === f.repo && x.name === f.name);\n if (!b) continue;\n if (!f.exists && !b.gone) {\n b.gone = now.toISOString();\n changed = true;\n } else if (f.exists && b.gone) {\n delete b.gone;\n changed = true;\n }\n if (f.merged && !b.merged) {\n b.merged = true;\n changed = true;\n }\n if (f.pushed && !b.pushed) {\n b.pushed = true;\n changed = true;\n }\n if (f.exists && f.sha && isSha(f.sha) && b.tip !== f.sha) {\n b.tip = f.sha;\n changed = true;\n }\n }\n if (changed) write(sessionId, rec);\n });\n}\n\n/** A session's repo as Ship and the PR watch name it: a group's folder, a single repo's target. */\nexport const repoNameOf = (s: Pick<WorktreeSession, 'isGroup' | 'target'>, checkout: string): string =>\n s.isGroup ? path.basename(checkout) : s.target;\n\n/**\n * The start a turn's sighting carries: only one read now, when the branch's reflog moved (`stale`) — never the\n * record's own, read before the write: carried into it, that would overwrite a newer start another process stored\n * meanwhile (the write is its own transaction, and a sighting with no start keeps the stored one). Pure but for `read`.\n */\nexport function sightingStart(stale: boolean, read: () => string | undefined): string | undefined {\n return stale ? read() : undefined;\n}\n\n/**\n * Record the branch each of the session's repos has checked out now (HEAD\n * files: no git), and for a branch new to the record, where it was made from\n * (its reflog's first line). The turn-end hook's step; cheap. Returns the\n * record after, or null when nothing is checked out on a branch.\n */\nexport function recordCheckedOutBranches(\n s: Pick<WorktreeSession, 'target' | 'branch' | 'isGroup' | 'paths' | 'archivedAt'>,\n now = new Date(),\n): SessionBranches | null {\n if (s.archivedAt) return null;\n const id = sessionIdFor(s);\n const seen: BranchSighting[] = [];\n const known = readSessionBranches(id);\n for (const p of s.paths) {\n const name = checkedOutBranch(p);\n if (!name) continue;\n const repo = repoNameOf(s, p);\n const had = known?.branches.find((b) => b.repo === repo && b.name === name);\n const dirs = gitDirs(p);\n // A new branch: where it came from. Every turn: where its own work begins (a rebase or fast-forward moves it),\n // kept so the Diff tab still has it once the branch — and its reflog — are deleted.\n const from = (!had && dirs && branchCreatedFrom(dirs.commonDir, name)) || undefined;\n // Read only when its reflog was written since the record last saw it (a stat): a repo's own main has a reflog\n // of thousands of lines, and this runs at every turn's end of every Claude.\n const stale = !had?.start || (dirs ? branchLogChangedSince(dirs.commonDir, name, had.lastSeen) : false);\n const start = sightingStart(stale, () => (dirs && branchStart(dirs.commonDir, name)) || undefined);\n seen.push({ repo, name, ...(from && from !== name ? { from } : {}), ...(start ? { start } : {}) });\n }\n if (!seen.length) return null;\n // Nothing moved (the usual turn end): no write transaction at all.\n if (known && withSightings(known, seen, now) === known) return known;\n return noteBranches(id, seen, now);\n}\n\n/**\n * Once per session recorded before the list began: the branches its repos'\n * reflogs show they were on (the session's own branch included), merged into\n * the record and marked backfilled. File reads only; run it in the\n * background, never on a request's path. Returns the record after.\n */\nexport function backfillSessionBranches(\n s: Pick<WorktreeSession, 'target' | 'branch' | 'isGroup' | 'paths' | 'createdAt'>,\n now = new Date(),\n): SessionBranches {\n const id = sessionIdFor(s);\n const seen: BranchSighting[] = [];\n for (const p of s.paths) {\n const repo = repoNameOf(s, p);\n const history = checkoutBranchHistory(p, s.branch);\n if (!history.some((b) => b.name === s.branch) && s.createdAt) {\n // The session's own branch, even when its reflog is gone or cut short.\n seen.push({ repo, name: s.branch, firstSeen: s.createdAt, lastSeen: s.createdAt });\n }\n for (const b of history) {\n seen.push({\n repo,\n name: b.name,\n firstSeen: new Date(b.firstSeen || Date.parse(s.createdAt) || now.getTime()).toISOString(),\n lastSeen: new Date(b.lastSeen || b.firstSeen || now.getTime()).toISOString(),\n ...(b.from ? { from: b.from } : {}),\n ...(b.start ? { start: b.start } : {}),\n });\n }\n }\n return noteBranches(id, seen, now, { backfilled: true });\n}\n\n/** A recorded branch that was seen on origin once (its PR is worth asking about even with origin's copy gone). */\nexport function wasPushed(rec: SessionBranches | null | undefined, repo: string, name: string): boolean {\n return !!rec?.branches.some((b) => b.repo === repo && b.name === name && b.pushed);\n}\n\n/** How long a merged branch that was deleted goes on showing. */\nexport const GONE_SHOWN_MS = 3 * 24 * 3600_000;\n\n/** How long a branch merged or deleted, and not checked out since, goes on showing. */\nexport const DONE_SHOWN_MS = 30 * 24 * 3600_000;\n\n/**\n * A recorded branch no longer worth showing (kept in the record): merged and deleted `GONE_SHOWN_MS` ago; or merged\n * or deleted, not checked out now (`current`), and last checked out `DONE_SHOWN_MS` ago (reported: a repo's own\n * checkout on main listed, and showed the PR of, a branch it was on a month before). Pure.\n */\nexport function branchHidden(\n b: Pick<RecordedBranch, 'gone' | 'merged' | 'lastSeen'>,\n now: number,\n prMerged = false,\n current = false,\n): boolean {\n const merged = b.merged || prMerged;\n if (b.gone && merged && now - Date.parse(b.gone) >= GONE_SHOWN_MS) return true;\n return !current && (merged || !!b.gone) && now - Date.parse(b.lastSeen) >= DONE_SHOWN_MS;\n}\n\n/** How long after it was last checked out another branch is still looked at (the PR watch's window). */\nexport const BRANCH_WATCH_MS = 30 * 24 * 3600_000;\n\n/** At most this many other branches per repo are asked about (git facts, the host's PR). */\nexport const MAX_WATCHED_BRANCHES = 5;\n\n/**\n * A repo's recorded branches other than the one checked out that are worth a\n * look: seen within `withinMs`, not hidden, newest first, at most\n * MAX_WATCHED_BRANCHES. Pure.\n */\nexport function otherBranchesToWatch(\n rec: SessionBranches | null | undefined,\n repo: string,\n current: string | null,\n now: number,\n withinMs: number,\n): string[] {\n return (rec?.branches ?? [])\n .filter((b) => b.repo === repo && b.name !== current && now - Date.parse(b.lastSeen) <= withinMs && !branchHidden(b, now))\n .sort((a, b) => Date.parse(b.lastSeen) - Date.parse(a.lastSeen))\n .slice(0, MAX_WATCHED_BRANCHES)\n .map((b) => b.name);\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\nimport { checkedOutBranch, gitDirs } from './git-head.js';\n\n/**\n * Which branches a checkout has been on, read from its reflog files — no\n * `git` process. A checkout's own `logs/HEAD` has a line per move of HEAD\n * (`checkout: moving from feat/x to fix/y`, a commit, a reset…), each with\n * its time; a branch's own reflog in the shared folder\n * (`logs/refs/heads/<name>`) starts with where it was made from\n * (`branch: Created from origin/dev`). The parsing is pure; the reads are\n * small files.\n */\n\nexport interface ReflogLine {\n /** When, in ms. */\n at: number;\n /** What git wrote after the tab: `checkout: moving from a to b`, `commit: …`. */\n message: string;\n /** The commit it moved to (the line's second object name), when the line has one. */\n sha?: string;\n}\n\n/** `<old> <new> Name <email> 1793784300 +0100\\t<message>` → its time and message; null for a line that isn't one. */\nexport function parseReflogLine(line: string): ReflogLine | null {\n const tab = line.indexOf('\\t');\n if (tab < 0) return null;\n const m = /\\s(\\d+)\\s+[+-]\\d{4}\\s*$/.exec(line.slice(0, tab));\n if (!m) return null;\n const sha = /^[0-9a-f]{40,64} ([0-9a-f]{40,64}) /.exec(line)?.[1];\n return { at: Number(m[1]) * 1000, message: line.slice(tab + 1).trim(), ...(sha && !/^0+$/.test(sha) ? { sha } : {}) };\n}\n\n/** A checkout target that names a branch: not a commit (detached), not a remote-tracking ref, not HEAD. */\nexport function looksLikeBranch(name: string): boolean {\n if (!name || name === 'HEAD' || /\\s/.test(name)) return false;\n if (/^[0-9a-f]{7,40}$/.test(name)) return false;\n if (/^(?:origin|upstream)\\//.test(name) || name.startsWith('refs/remotes/')) return false;\n return true;\n}\n\nexport interface ReflogBranch {\n name: string;\n /** When HEAD first came to it (ms): its first sighting in this reflog. */\n firstSeen: number;\n /** When HEAD was last on it (ms): the last line written while it was checked out. */\n lastSeen: number;\n /** The branch HEAD left to come to it, the first time. */\n movedFrom?: string;\n}\n\n/**\n * The branches a checkout's HEAD reflog shows it on, in the order it came to\n * them. `start`: the branch it was on before the first move the reflog shows\n * (the session's own); `current`: what HEAD names now — a reflog cut short\n * still has it. Pure.\n */\nexport function branchesFromReflog(lines: ReflogLine[], opts: { start?: string | null; current?: string | null } = {}): ReflogBranch[] {\n const out = new Map<string, ReflogBranch>();\n const firstMove = lines.map((l) => moveOf(l.message)).find((m) => m !== null);\n // Before the first move HEAD was on the branch it moved from — the start branch, when the reflog has no move.\n let on: string | null = firstMove?.from ?? opts.start ?? opts.current ?? null;\n const see = (name: string | null, at: number, from?: string) => {\n if (!name || !looksLikeBranch(name)) return;\n const b = out.get(name);\n if (b) b.lastSeen = Math.max(b.lastSeen, at);\n else out.set(name, { name, firstSeen: at, lastSeen: at, ...(from && looksLikeBranch(from) ? { movedFrom: from } : {}) });\n };\n for (const l of lines) {\n const move = moveOf(l.message);\n if (move) {\n see(on, l.at);\n on = move.to;\n see(on, l.at, move.from);\n continue;\n }\n // `rebase (finish): returning to refs/heads/x`: back on x after a rebase's detached steps.\n const back = /returning to refs\\/heads\\/(.+)$/.exec(l.message);\n if (back) on = back[1].trim();\n see(on, l.at);\n }\n if (opts.current && !out.has(opts.current) && looksLikeBranch(opts.current)) {\n const at = lines.length ? lines[lines.length - 1].at : 0;\n out.set(opts.current, { name: opts.current, firstSeen: at, lastSeen: at });\n }\n return [...out.values()];\n}\n\nfunction moveOf(message: string): { from: string; to: string } | null {\n const m = /^checkout: moving from (\\S+) to (\\S+)$/.exec(message);\n return m ? { from: m[1], to: m[2] } : null;\n}\n\n/** `branch: Created from origin/dev` (a branch's own reflog, its first line) → `origin/dev`; null when it says nothing of the kind. */\nexport function createdFromLine(message: string): string | null {\n const m = /^branch: Created from (\\S+)$/.exec(message);\n return m ? m[1] : null;\n}\n\n/** Lines of a reflog file, oldest first; [] when it isn't there. At most the last `max` lines (a reflog grows for good). */\nexport function readReflog(file: string, max = 5000): ReflogLine[] {\n let text: string;\n try {\n text = fs.readFileSync(file, 'utf8');\n } catch {\n return [];\n }\n const lines = text.split(/\\r?\\n/);\n return lines\n .slice(Math.max(0, lines.length - max))\n .map(parseReflogLine)\n .filter((l): l is ReflogLine => l !== null);\n}\n\n/**\n * Where a branch was made from, as its own reflog says (`origin/dev`), or —\n * made from HEAD (`Created from HEAD`) — the branch HEAD left for it\n * (`movedFrom`). Null when neither says. Reads one small file.\n */\nexport function branchCreatedFrom(commonDir: string, name: string, movedFrom?: string): string | null {\n const first = readReflog(path.join(commonDir, 'logs', 'refs', 'heads', ...name.split('/')), 50)[0];\n const from = first ? createdFromLine(first.message) : null;\n if (from && from !== 'HEAD') return from;\n return movedFrom ?? null;\n}\n\n/**\n * Where a branch's own work begins, from its own reflog: the newest point it was put onto from outside — made\n * (`branch: Created from …`), fast-forwarded (`merge origin/dev: Fast-forward`, `pull: Fast-forward`), reset,\n * or rebased (`rebase (finish): … onto <sha>`: what it was replayed on). Its own work is what it has beyond that,\n * along its first parents, even once it is merged into what it was made from; a merge of its base into it isn't\n * a new start (first parents step over it). Null when the reflog says none (cut short, or never made here). Pure.\n *\n * Reported: a branch made from dev, fast-forwarded and rebased onto newer dev before its first commit listed dev's\n * own merges as its work, read from where it was made.\n *\n * Moves within its own work aren't from outside: a reset or rebase onto a commit the branch itself was at since its\n * start (`reset --soft HEAD~1`, `rebase -i HEAD~2`: a squash) keeps the start, or its earlier commits would drop out\n * of its work; and so does a fast-forward from its own copy (`merge origin/<name>`, `pull origin <name>`: a\n * colleague's commits on the same branch are its work too). `name`: the branch's own name; without it every\n * fast-forward moves the start.\n */\nexport function startFromReflog(lines: ReflogLine[], name?: string, upstream?: string | null): string | null {\n let start: string | null = null;\n // The commits the branch itself was at since its start: a move back onto one of them is within its own work.\n let own = new Set<string>();\n const moveTo = (sha: string) => {\n if (own.has(sha)) return;\n start = sha;\n own = new Set([sha]);\n };\n for (const l of lines) {\n const onto = /\\bonto ([0-9a-f]{40,64})\\s*$/.exec(l.message);\n // `rebase (finish)`, `pull --rebase (finish)`, and `pull --quiet (finish)` — a plain pull with pull.rebase set\n // (work's own re-entry pull) — all replay the branch onto what follows `onto`.\n if (onto && /^(?:rebase|pull)\\b[^:]*\\(finish\\)|^rebase finished/.test(l.message)) moveTo(onto[1]);\n else if (l.sha && createdFromLine(l.message) !== null) {\n start = l.sha;\n own = new Set([l.sha]);\n } else if (l.sha && /: Fast-forward\\b/.test(l.message) && !fromItsOwnCopy(l.message, name, upstream)) moveTo(l.sha);\n else if (l.sha && (/^reset: moving to /.test(l.message) || /^branch: Reset to /.test(l.message))) moveTo(l.sha);\n if (l.sha && start) own.add(l.sha);\n }\n return start;\n}\n\n/**\n * `merge origin/fix/x: Fast-forward`, `pull origin fix/x: Fast-forward`: the branch's own copy brought in. A pull\n * that names no ref (`pull: Fast-forward`, `pull --quiet: Fast-forward` — options aren't refs) took its upstream:\n * its own copy when that is the branch of its own name (`upstream`, branch.<name>.merge), not when it tracks\n * origin/main as work's new branches do.\n */\nfunction fromItsOwnCopy(message: string, name: string | undefined, upstream?: string | null): boolean {\n if (!name) return false;\n const m = /^(merge|pull)\\b(.*?):\\s*Fast-forward/.exec(message);\n if (!m) return false;\n const words = m[2]\n .trim()\n .split(/\\s+/)\n .filter((w) => w && !w.startsWith('-'));\n const ref = words[words.length - 1] ?? (m[1] === 'pull' ? (upstream ?? undefined) : undefined);\n return !!ref && (ref === name || ref.endsWith(`/${name}`));\n}\n\n/**\n * The branch a branch pulls from (`branch.<name>.merge`, `refs/heads/` taken off), read from the repo's config\n * file — no git. Null when it has none or the file can't be read.\n */\nexport function branchUpstream(commonDir: string, name: string): string | null {\n let text: string;\n try {\n text = fs.readFileSync(path.join(commonDir, 'config'), 'utf8');\n } catch {\n return null;\n }\n let inIt = false;\n let merge: string | null = null;\n for (const raw of text.split(/\\r?\\n/)) {\n const line = raw.trim();\n const section = /^\\[\\s*([A-Za-z0-9.-]+)(?:\\s+\"((?:[^\"\\\\]|\\\\.)*)\")?\\s*\\]/.exec(line);\n if (section) {\n inIt = section[1].toLowerCase() === 'branch' && section[2]?.replace(/\\\\(.)/g, '$1') === name;\n continue;\n }\n if (!inIt) continue;\n const kv = /^merge\\s*=\\s*(.*?)\\s*$/i.exec(line);\n if (kv) merge = kv[1].replace(/^\"(.*)\"$/, '$1'); // the last one wins, as git reads it\n }\n return merge ? merge.replace(/^refs\\/heads\\//, '') : null;\n}\n\n/** A branch's own reflog file. */\nconst branchLogFile = (commonDir: string, name: string): string => path.join(commonDir, 'logs', 'refs', 'heads', ...name.split('/'));\n\n/** startFromReflog over a branch's reflog file. Reads one small file. */\nexport function branchStart(commonDir: string, name: string): string | null {\n return startFromReflog(readReflog(branchLogFile(commonDir, name)), name, branchUpstream(commonDir, name));\n}\n\n/**\n * Whether a branch's reflog was written after `since` (ISO): what it says may have moved. True when it can't be\n * told (no file, a bad date). A stat, no read: the turn-end hook asks it for every repo of every session.\n */\nexport function branchLogChangedSince(commonDir: string, name: string, since: string): boolean {\n const at = Date.parse(since);\n if (!at) return true;\n try {\n return fs.statSync(branchLogFile(commonDir, name)).mtimeMs > at;\n } catch {\n return true;\n }\n}\n\n/**\n * The branches a checkout has been on (its HEAD reflog), each with where it\n * was made from when its own reflog says, and the commit it was made at. File reads only. `start`: the\n * session's branch. [] when it isn't a checkout.\n */\nexport function checkoutBranchHistory(checkout: string, start?: string | null): Array<ReflogBranch & { from?: string; start?: string }> {\n const dirs = gitDirs(checkout);\n if (!dirs) return [];\n const lines = readReflog(path.join(dirs.gitDir, 'logs', 'HEAD'));\n return branchesFromReflog(lines, { start: start ?? null, current: checkedOutBranch(checkout) }).map((b) => {\n const from = branchCreatedFrom(dirs.commonDir, b.name, b.movedFrom);\n const at = branchStart(dirs.commonDir, b.name);\n return { ...b, ...(from && from !== b.name ? { from } : {}), ...(at ? { start: at } : {}) };\n });\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,OAAOA,WAAU;;;ACAjB,OAAO,QAAQ;AACf,OAAO,UAAU;AAuBV,SAAS,gBAAgB,MAAiC;AAC/D,QAAM,MAAM,KAAK,QAAQ,GAAI;AAC7B,MAAI,MAAM,EAAG,QAAO;AACpB,QAAM,IAAI,0BAA0B,KAAK,KAAK,MAAM,GAAG,GAAG,CAAC;AAC3D,MAAI,CAAC,EAAG,QAAO;AACf,QAAM,MAAM,sCAAsC,KAAK,IAAI,IAAI,CAAC;AAChE,SAAO,EAAE,IAAI,OAAO,EAAE,CAAC,CAAC,IAAI,KAAM,SAAS,KAAK,MAAM,MAAM,CAAC,EAAE,KAAK,GAAG,GAAI,OAAO,CAAC,OAAO,KAAK,GAAG,IAAI,EAAE,IAAI,IAAI,CAAC,EAAG;AACtH;AAGO,SAAS,gBAAgB,MAAuB;AACrD,MAAI,CAAC,QAAQ,SAAS,UAAU,KAAK,KAAK,IAAI,EAAG,QAAO;AACxD,MAAI,mBAAmB,KAAK,IAAI,EAAG,QAAO;AAC1C,MAAI,yBAAyB,KAAK,IAAI,KAAK,KAAK,WAAW,eAAe,EAAG,QAAO;AACpF,SAAO;AACT;AAkBO,SAAS,mBAAmB,OAAqB,OAA2D,CAAC,GAAmB;AACrI,QAAM,MAAM,oBAAI,IAA0B;A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QAAO;AAC1E,SAAO,CAAC,YAAY,UAAU,CAAC,CAAC,EAAE,SAAS,MAAM,KAAK,MAAM,EAAE,QAAQ,KAAK;AAC7E;AAGO,IAAM,kBAAkB,KAAK,KAAK;AAGlC,IAAM,uBAAuB;AAO7B,SAAS,qBACd,KACA,MACA,SACA,KACA,UACU;AACV,UAAQ,KAAK,YAAY,CAAC,GACvB,OAAO,CAAC,MAAM,EAAE,SAAS,QAAQ,EAAE,SAAS,WAAW,MAAM,KAAK,MAAM,EAAE,QAAQ,KAAK,YAAY,CAAC,aAAa,GAAG,GAAG,CAAC,EACxH,KAAK,CAAC,GAAG,MAAM,KAAK,MAAM,EAAE,QAAQ,IAAI,KAAK,MAAM,EAAE,QAAQ,CAAC,EAC9D,MAAM,GAAG,oBAAoB,EAC7B,IAAI,CAAC,MAAM,EAAE,IAAI;AACtB;","names":["path","path"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/core/stacks/branch-facts.ts"],"sourcesContent":["import { defaultRunner, type CommandRunner } from '../platform/command-runner.js';\nimport { bestEffort, logSwallowed } from '../platform/best-effort.js';\nimport type { SessionBranchWire, SessionCi, ShipPr } from '../api-types.js';\nimport { stageOfPr } from '../pr/pr-stage.js';\nimport {\n backfillSessionBranches,\n branchHidden,\n MAX_WATCHED_BRANCHES,\n noteBranchFacts,\n readSessionBranches,\n repoNameOf,\n type SessionBranches,\n} from '../sessions/session-branches.js';\nimport { checkedOutBranch } from '../git/git-head.js';\nimport { sessionIdFor } from '../sessions/session-id.js';\nimport type { WorktreeSession } from '../sessions/session-types.js';\n\n/**\n * What a session's other branches hold (session-branches.ts records them):\n * still there, pushed, how many commits its base lacks, how many origin\n * lacks, merged. Git through a CommandRunner (argv only), a few runs per\n * branch — so read in the background (BranchFactsCache, beside behind-main's)\n * and by the PR watch's preflight, never on a request's path.\n */\n\nexport interface BranchFacts {\n exists: boolean;\n /** Its tip, when it exists. */\n sha: string | null;\n /** `origin/<name>` exists. */\n pushed: boolean;\n /** Commits on it that its base (origin/HEAD) doesn't have; null: unknown. */\n commits: number | null;\n /** Commits on it that origin doesn't have (all of `commits` when never pushed); null: unknown. */\n unpushed: number | null;\n /** Its commits are all in its base, and it was pushed (a branch merged the usual way). Never the base itself. */\n merged: boolean;\n /** It is the repo's main line itself (`main` when origin/HEAD is origin/main): never \"merged\" into itself. */\n base?: true;\n}\n\n/** The repo's main line (`origin/main`), as origin/HEAD names it; null when it doesn't. */\nexport async function repoBase(repo: string, run: CommandRunner = defaultRunner): Promise<string | null> {\n const head = await run('git', ['-C', repo, 'rev-parse', '--abbrev-ref', 'origin/HEAD'], repo);\n const base = head.code === 0 ? head.stdout.trim() : '';\n return base && base !== 'origin/HEAD' ? base : null;\n}\n\nconst count = (out: { code: number; stdout: string }) =>\n out.code === 0 && /^\\d+$/.test(out.stdout.trim()) ? Number(out.stdout.trim()) : null;\n\n/** One branch of one repo. `base`: the repo's main line (repoBase), passed so a repo's branches ask it once. */\nexport async function branchFacts(\n repo: string,\n name: string,\n run: CommandRunner = defaultRunner,\n base?: string | null,\n): Promise<BranchFacts> {\n const git = (...args: string[]) => run('git', ['-C', repo, ...args], repo);\n const local = `refs/heads/${name}`;\n const remote = `refs/remotes/origin/${name}`;\n const tip = await git('rev-parse', '--verify', '--quiet', local);\n const exists = tip.code === 0;\n const pushed = (await git('rev-parse', '--verify', '--quiet', remote)).code === 0;\n if (!exists) return { exists, sha: null, pushed, commits: null, unpushed: null, merged: false };\n const main = base === undefined ? await repoBase(repo, run) : base;\n const commits = main ? count(await git('rev-list', '--count', `${main}..${local}`)) : null;\n const unpushed = pushed ? count(await git('rev-list', '--count', `${remote}..${local}`)) : commits;\n // The main line itself is level with origin/main whenever it's pushed: that isn't a merge (it read \"merged\").\n const isBase = !!main && main === `origin/${name}`;\n return {\n exists,\n sha: tip.stdout.trim() || null,\n pushed,\n commits,\n unpushed,\n merged: !isBase && pushed && commits === 0,\n ...(isBase ? { base: true as const } : {}),\n };\n}\n\n/** A repo's other branches to look at: by name, in its checkout. */\nexport interface BranchJob {\n repo: string;\n path: string;\n name: string;\n}\n\nexport const factsKey = (repo: string, name: string) => `${repo}\\u0000${name}`;\n\n/**\n * Per session, refreshed in the background a couple of sessions at a time;\n * reads never wait (BehindCache's way). `onFacts`: what a look found, to keep\n * (a branch seen deleted, or merged: session-branches.ts `noteBranchFacts`).\n */\nexport class BranchFactsCache {\n private readonly entries = new Map<string, { value: Map<string, BranchFacts>; at: number; inFlight: boolean; key: string }>();\n private running = 0;\n private readonly queue: Array<{ id: string; jobs: BranchJob[] }> = [];\n\n constructor(\n private readonly opts: {\n ttlMs?: number;\n concurrency?: number;\n run?: CommandRunner;\n onChange?: () => void;\n onFacts?: (id: string, facts: Array<BranchJob & BranchFacts>) => void;\n now?: () => number;\n } = {},\n ) {}\n\n /** What the last look found (an empty map before the first); schedules one when stale or the branches changed. */\n get(id: string, jobs: BranchJob[]): Map<string, BranchFacts> {\n const now = (this.opts.now ?? Date.now)();\n const key = jobs.map((j) => factsKey(j.repo, j.name)).join('|');\n const e = this.entries.get(id);\n const moved = !!e && e.key !== key;\n if (!e || moved || (!e.inFlight && now - e.at > (this.opts.ttlMs ?? 5 * 60_000))) this.schedule(id, jobs, key);\n return this.entries.get(id)?.value ?? new Map();\n }\n\n /** Look again soon (a turn ended, a push). */\n invalidate(id: string): void {\n const e = this.entries.get(id);\n if (e) e.at = 0;\n }\n\n async idle(): Promise<void> {\n while (this.running > 0 || this.queue.length > 0) await new Promise((r) => setTimeout(r, 5));\n }\n\n private schedule(id: string, jobs: BranchJob[], key: string): void {\n const e = this.entries.get(id) ?? { value: new Map<string, BranchFacts>(), at: 0, inFlight: false, key };\n if (e.inFlight && e.key === key) return;\n e.inFlight = true;\n e.key = key;\n this.entries.set(id, e);\n this.queue.push({ id, jobs });\n this.pump();\n }\n\n private pump(): void {\n while (this.running < (this.opts.concurrency ?? 2) && this.queue.length > 0) {\n const job = this.queue.shift()!;\n this.running++;\n void lookAt(job.jobs, this.opts.run)\n .catch((err) => {\n logSwallowed(`branch facts for ${job.id}`, err);\n return null;\n })\n .then((found) => {\n const e = this.entries.get(job.id)!;\n e.inFlight = false;\n e.at = (this.opts.now ?? Date.now)();\n if (!found) return;\n const value = new Map(found.map((f) => [factsKey(f.repo, f.name), strip(f)]));\n const changed = JSON.stringify([...e.value]) !== JSON.stringify([...value]);\n e.value = value;\n this.opts.onFacts?.(job.id, found);\n if (changed) this.opts.onChange?.();\n })\n .finally(() => {\n this.running--;\n this.pump();\n });\n }\n }\n}\n\nconst strip = (f: BranchJob & BranchFacts): BranchFacts => ({\n exists: f.exists,\n sha: f.sha,\n pushed: f.pushed,\n commits: f.commits,\n unpushed: f.unpushed,\n merged: f.merged,\n});\n\nasync function lookAt(jobs: BranchJob[], run?: CommandRunner): Promise<Array<BranchJob & BranchFacts>> {\n const bases = new Map<string, string | null>();\n const out: Array<BranchJob & BranchFacts> = [];\n for (const j of jobs) {\n if (!bases.has(j.path)) bases.set(j.path, await repoBase(j.path, run));\n out.push({ ...j, ...(await branchFacts(j.path, j.name, run, bases.get(j.path))) });\n }\n return out;\n}\n\n/** The PR of a repo's branch, from the PR watch's last check: the checked-out one's, or another's. */\nexport function prOfBranch(ci: SessionCi | null | undefined, repo: string, name: string): ShipPr | null {\n const r = ci?.repos.find((x) => x.name === repo);\n if (!r) return null;\n if (r.branch === name && r.pr) return r.pr;\n return r.otherPrs?.find((o) => o.branch === name)?.pr ?? null;\n}\n\n/**\n * The branches a session's row shows: every recorded one not hidden (merged\n * and deleted a while ago), each with its facts and PR, the checked-out ones\n * first, the rest newest first. Null unless some repo has been on more than\n * one: a session that stayed on its branch shows nothing new. Pure.\n */\nexport function branchesWire(\n rec: SessionBranches | null | undefined,\n current: (repo: string) => string | null,\n facts: Map<string, BranchFacts>,\n ci: SessionCi | null | undefined,\n now: number,\n): SessionBranchWire[] | null {\n if (!rec?.branches.length) return null;\n const rows: SessionBranchWire[] = [];\n for (const b of rec.branches) {\n const pr = prOfBranch(ci, b.repo, b.name);\n const f = facts.get(factsKey(b.repo, b.name));\n // Merged as kept once seen — unless the branch, there now, has work of its own again (commits its base\n // lacks) or is the main line itself: a repo's own main read \"6 commits · 6 not pushed · merged\". Its PR\n // merged still says so (a squash merge leaves its commits unmerged).\n const merged = f\n ? pr?.state === 'MERGED' || (!(f.exists && (f.base || (f.commits ?? 0) > 0)) && (f.merged || !!b.merged))\n : !!b.merged || pr?.state === 'MERGED';\n // Hidden by its merged as shown (a branch with work of its own again isn't done), deleted as the record says.\n const { merged: _kept, ...rest } = b;\n const seen = { ...rest, ...(merged ? { merged: true as const } : {}) };\n if (branchHidden(seen, now, false, current(b.repo) === b.name)) continue;\n rows.push({\n repo: b.repo,\n name: b.name,\n current: current(b.repo) === b.name,\n firstSeen: b.firstSeen,\n lastSeen: b.lastSeen,\n ...(b.from ? { from: b.from } : {}),\n ...(f\n ? {\n exists: f.exists,\n pushed: f.pushed,\n commits: f.commits,\n unpushed: f.unpushed,\n merged,\n }\n : merged\n ? { merged: true }\n : {}),\n ...(pr ? { pr: { number: pr.number, url: pr.url, state: pr.state, kind: stageOfPr(pr) } } : {}),\n });\n }\n const repos = new Set(rows.map((r) => r.repo));\n if (![...repos].some((repo) => rows.filter((r) => r.repo === repo).length > 1)) return null;\n return rows.sort(\n (a, b) => Number(b.current) - Number(a.current) || Date.parse(b.lastSeen) - Date.parse(a.lastSeen) || a.repo.localeCompare(b.repo),\n );\n}\n\n/**\n * The sessions list's branches (work web): each row's recorded branches with\n * their facts — read in the background (BranchFactsCache), what it finds kept\n * (deleted, merged, pushed once) — and, once per session recorded before the\n * list began, its reflog read into the record (backfillSessionBranches), one\n * session at a time, off the request's path. `wire` never runs git.\n */\nexport function createSessionBranches(\n opts: {\n onChange?: () => void;\n run?: CommandRunner;\n now?: () => number;\n /** Tests: the reflog read and the fact keeping (default: session-branches.ts). */\n backfill?: (s: WorktreeSession) => SessionBranches | void;\n keepFacts?: (id: string, facts: Array<BranchJob & BranchFacts>) => void;\n } = {},\n) {\n const now = opts.now ?? Date.now;\n const facts = new BranchFactsCache({\n ...(opts.run ? { run: opts.run } : {}),\n now,\n onChange: opts.onChange,\n onFacts: (id, found) =>\n bestEffort(`keep the branch facts of ${id}`, () => (opts.keepFacts ?? ((sid, f) => noteBranchFacts(sid, f)))(id, found)),\n });\n const backfill = opts.backfill ?? ((s: WorktreeSession) => backfillSessionBranches(s));\n const asked = new Set<string>();\n const waiting: WorktreeSession[] = [];\n let busy = false;\n const pump = () => {\n if (busy) return;\n const s = waiting.shift();\n if (!s) return;\n busy = true;\n setImmediate(() => {\n const rec = bestEffort(`read the branches of ${s.target}:${s.branch} from its reflog`, () => backfill(s));\n busy = false;\n // Only a session that turns out to have worked on more than one branch looks any different.\n if (rec && branchJobs(s, rec, now())) opts.onChange?.();\n pump();\n });\n };\n return {\n /** The row's branches (branchesWire), from what was recorded and last looked at. */\n wire(s: WorktreeSession, rec: SessionBranches | null | undefined, ci: SessionCi | null | undefined): SessionBranchWire[] | null {\n if (s.archivedAt) return null;\n const id = sessionIdFor(s);\n if (!rec?.backfilled && !asked.has(id)) {\n asked.add(id);\n waiting.push(s);\n pump();\n }\n const plan = branchJobs(s, rec, now());\n return plan ? branchesWire(rec, plan.current, facts.get(id, plan.jobs), ci, now()) : null;\n },\n invalidate: (id: string) => facts.invalidate(id),\n async idle(): Promise<void> {\n await facts.idle();\n while (busy || waiting.length) await new Promise((r) => setTimeout(r, 5));\n },\n };\n}\n\n/**\n * What to look at for a session's row: each repo's visible recorded branches (the checked-out one first, then\n * the most recent, at most MAX_WATCHED_BRANCHES others), and what each repo has checked out (HEAD files). Null\n * when no repo has been on more than one branch. No git.\n */\nexport function branchJobs(\n s: Pick<WorktreeSession, 'target' | 'isGroup' | 'paths'>,\n rec: SessionBranches | null | undefined,\n now: number,\n): { jobs: BranchJob[]; current: (repo: string) => string | null } | null {\n if (!rec?.branches.length) return null;\n const currentOf = new Map(s.paths.map((p) => [repoNameOf(s, p), checkedOutBranch(p)]));\n const visible = rec.branches.filter((b) => !branchHidden(b, now, false, currentOf.get(b.repo) === b.name));\n const repos = new Set(visible.map((b) => b.repo));\n if (![...repos].some((r) => visible.filter((b) => b.repo === r).length > 1)) return null;\n const pathOf = new Map(s.paths.map((p) => [repoNameOf(s, p), p]));\n const jobs: BranchJob[] = [];\n for (const repo of repos) {\n const p = pathOf.get(repo);\n if (!p) continue;\n const isCurrent = (name: string) => Number(name === currentOf.get(repo));\n const mine = visible\n .filter((b) => b.repo === repo)\n .sort((a, b) => isCurrent(b.name) - isCurrent(a.name) || Date.parse(b.lastSeen) - Date.parse(a.lastSeen))\n .slice(0, MAX_WATCHED_BRANCHES + 1);\n for (const b of mine) jobs.push({ repo, path: p, name: b.name });\n }\n return { jobs, current: (repo) => currentOf.get(repo) ?? null };\n}\n\n/**\n * The same now, for the CLI (`work sessions --json`, `work status`): the record (read from the reflog first\n * when it never was), each branch looked at with git, the PR from the PR watch's last check. Null when it stayed\n * on one branch.\n */\nexport async function sessionBranchesNow(\n s: WorktreeSession,\n ci: SessionCi | null | undefined,\n run: CommandRunner = defaultRunner,\n now = Date.now(),\n): Promise<SessionBranchWire[] | null> {\n if (s.archivedAt) return null;\n let rec = readSessionBranches(sessionIdFor(s));\n if (!rec?.backfilled) rec = bestEffort(`read the branches of ${s.target}:${s.branch}`, () => backfillSessionBranches(s), rec) ?? rec;\n const plan = branchJobs(s, rec, now);\n if (!plan) return null;\n const found = await lookAt(plan.jobs, run);\n return branchesWire(rec, plan.current, new Map(found.map((f) => [factsKey(f.repo, f.name), strip(f)])), ci, now);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,eAAsB,SAAS,MAAc,MAAqB,eAAuC;AACvG,QAAM,OAAO,MAAM,IAAI,OAAO,CAAC,MAAM,MAAM,aAAa,gBAAgB,aAAa,GAAG,IAAI;AAC5F,QAAM,OAAO,KAAK,SAAS,IAAI,KAAK,OAAO,KAAK,IAAI;AACpD,SAAO,QAAQ,SAAS,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AC;AAC7C,MAAI,CAAC,KAAK,WAAY,OAAM,WAAW,wBAAwB,EAAE,MAAM,IAAI,EAAE,MAAM,IAAI,MAAM,wBAAwB,CAAC,GAAG,GAAG,KAAK;AACjI,QAAM,OAAO,WAAW,GAAG,KAAK,GAAG;AACnC,MAAI,CAAC,KAAM,QAAO;AAClB,QAAM,QAAQ,MAAM,OAAO,KAAK,MAAM,GAAG;AACzC,SAAO,aAAa,KAAK,KAAK,SAAS,IAAI,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG;AACjH;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/core/sessions/session-wire.ts","../src/core/comments/linked-stores.ts","../src/core/sessions/session-meta.ts","../src/core/conversations/context-usage.ts","../src/core/conversations/session-title.ts"],"sourcesContent":["import { sessionIssue } from '../issues/issue-source.js';\nimport type { SessionLocalReviewWire } from '../api-types.js';\nimport fs from 'node:fs';\nimport { agentOf, agentWire } from '../agents/index.js';\nimport { readStatus } from '../status/session-status.js';\nimport { snoozeActive, type Snooze } from '../rail/snooze.js';\nimport { idleFrom, withLiveClaude } from '../status/session-status.js';\nimport path from 'node:path';\nimport { readSessionMeta } from './session-meta.js';\nimport { checkedOutBranch } from '../git/git-head.js';\nimport { sessionIdFor } from './web-state.js';\nimport { readContextUsage } from '../conversations/context-usage.js';\nimport { bestEffort } from '../platform/best-effort.js';\nimport type { WorktreeSession } from './history.js';\nimport type {\n DiffStat,\n SessionArchiveInfo,\n SessionAttention,\n SessionClaudes,\n SessionWire,\n BlockerWire,\n PrStageWire,\n SessionBranchWire,\n ElsewherePr,\n} from '../api-types.js';\nimport { archiveDirFor, archivedByOf, keptList, readArchive } from '../archive/session-archive.js';\nimport { isArchiving, isRestoring } from '../archive/archiving.js';\nimport { sessionTitle } from '../conversations/session-title.js';\nimport { prStageOf, stageRepos, STAGE_WANTS_YOU, type StagePr } from '../pr/pr-stage.js';\nimport { stageInputOf } from '../pr/branch-work.js';\nimport { isLeftover } from '../worktree/leftover.js';\nimport { recordedRepos, sessionRepos } from './session-repos.js';\nimport { DEFAULT_ACCOUNT, getConfigPath, loadConfig, type WorkConfig } from '../platform/config.js';\n\n/**\n * One session as every client sees it — the dashboard's /api/sessions rows\n * and `work sessions --json` alike: identity, status, activity, comments,\n * context, archive state. Built in one place so the two can't drift.\n */\nexport interface SessionWireOptions {\n /** The account a switch waiting for its turn will move it to (account-switch.ts), or null. */\n accountPendingFor?: (id: string) => string | null;\n /** The session's `+N −M`, when the caller has one (the web cache). */\n diffStatFor?: (id: string, s: WorktreeSession, hasStatus: boolean) => DiffStat | null;\n /** Whether its Claude runs in the PTY host (the CLI asks the host; the\n * web server's pool knows it already). */\n ptyLive?: (id: string) => boolean;\n /** Its running Claudes, wherever they were started (live-claudes.ts). */\n claudesFor?: (id: string) => SessionClaudes | null;\n /** It shares its folder with another session that owns it\n * (shared-folders.ts): the folder's activity isn't this one's. */\n shadowed?: (id: string) => boolean;\n /** Unresolved review threads on its open PRs (the PR watch's last check). */\n reviewThreadsFor?: (id: string) => number;\n /** Reply drafts its Claude wrote for you to post (pr-replies.ts). */\n replyDraftsFor?: (id: string) => number;\n /** Where its own review stands (local-review.ts `row`); null: it has none. */\n localReviewFor?: (id: string) => SessionLocalReviewWire | null;\n /** Where its PR stands (pr-stage.ts over the PR watch's last check), and whether you've seen it there. */\n prStageFor?: (id: string) => PrStageWire | null;\n /** You have notes on it (session-notes.ts). */\n hasNote?: (id: string) => boolean;\n /** What it waits on that isn't done yet (session-blocks.ts). */\n blockedByFor?: (id: string) => BlockerWire[];\n /** The running Claudes were read against a real process list, so \"none\" means none. */\n liveKnown?: boolean;\n /** A Claude of ours runs for it (PTY host), whether or not Claude Code's file shows it yet. */\n hostedLive?: (id: string) => boolean;\n /** A question its agent is stopped at before its first turn (startup-question.ts): it needs you, whatever was recorded. */\n startupQuestionFor?: (id: string) => { what: string; since: string } | null;\n /** A status read from its terminal output, for a tool with no hooks (output-status.ts). */\n outputStatusFor?: (id: string) => SessionAttention | null;\n /** Its snooze, if any (snooze-store.ts); shown only while it holds. */\n snoozeFor?: (id: string) => Snooze | null;\n /** How far behind main — or the session it is stacked on — it is (behind-main.ts's cache). */\n /** `lastActivity`: its agent's last write (ms; 0 none), so a session entered long ago but worked in today counts as in use. */\n behindFor?: (\n id: string,\n s: WorktreeSession,\n lastActivity: number,\n ) => { base: string; commits: number; conflicts: boolean; stacked?: true } | null;\n /** Every branch it worked on, with what's known of each (branch-facts.ts `createSessionBranches`); null when\n * it stayed on one. */\n branchesFor?: (id: string, s: WorktreeSession) => SessionBranchWire[] | null;\n /** Where it sits in a stack (stack-sessions.ts). */\n stackFor?: (id: string) => {\n parent: { id: string; branch: string; title?: string } | null;\n children: number;\n merged?: { id: string; branch: string } | null;\n };\n}\n\nexport function sessionWire(s: WorktreeSession, opts: SessionWireOptions = {}): SessionWire {\n const id = sessionIdFor(s);\n const meta = readSessionMeta(id, s);\n const shadowed = opts.shadowed?.(id) ?? false;\n const claudes = shadowed ? null : (opts.claudesFor?.(id) ?? null);\n const reviewThreads = s.archivedAt ? 0 : (opts.reviewThreadsFor?.(id) ?? 0);\n const replyDrafts = s.archivedAt ? 0 : (opts.replyDraftsFor?.(id) ?? 0);\n const prStage = s.archivedAt ? null : (opts.prStageFor?.(id) ?? null);\n const localReview = s.archivedAt ? null : (opts.localReviewFor?.(id) ?? null);\n const startup = s.archivedAt || shadowed ? null : (opts.startupQuestionFor?.(id) ?? null);\n const wire: SessionWire = {\n id,\n target: s.target,\n branch: s.branch,\n isGroup: s.isGroup,\n paths: s.paths,\n repos: wireRepos(s),\n folder: s.isGroup,\n baseBranch: s.baseBranch,\n issueKey: s.issueKey,\n // Its issue whatever it came from (a Jira key is one): what a row links to.\n ...(sessionIssue(s) ? { issue: sessionIssue(s)! } : {}),\n createdAt: s.createdAt,\n lastAccessedAt: s.lastAccessedAt,\n draftCount: meta.draftCount,\n commentCount: meta.commentCount,\n claudeCount: meta.claudeCount,\n ptyStatus: opts.ptyLive ? (opts.ptyLive(id) ? 'running' : 'idle') : meta.ptyStatus,\n lastActivity: shadowed ? null : meta.lastActivity,\n // A running Claude is open even when it writes nothing (idle at its prompt).\n activityState: shadowed\n ? 'stale'\n : claudes\n ? claudes.busy\n ? 'active'\n : meta.activityState === 'active'\n ? 'active'\n : 'open'\n : meta.activityState,\n ...(claudes ? { agents: claudes, claudes } : {}),\n agent: agentWire(agentOf(s)),\n // Only a session on an account other than the default says which.\n ...(s.account && s.account !== DEFAULT_ACCOUNT ? { account: s.account } : {}),\n ...(!s.archivedAt && opts.accountPendingFor?.(id) ? { accountPending: opts.accountPendingFor(id)! } : {}),\n ...(s.archivedAt ? archiveInfo(id) : {}),\n title: bestEffort(\n `title of ${s.target}:${s.branch}`,\n () => sessionTitle(s, s.archivedAt ? readArchive(id)?.summary.prompts[0]?.text : null),\n null,\n ),\n ...(s.title ? { titleIsYours: true } : {}),\n pendingForClaudeCount: meta.pendingForClaudeCount,\n // Stopped at its own question before any turn (no hook says so): it waits for you, whatever was recorded before.\n // Else Claude Code's own state file over what the hooks recorded, when newer.\n attention: startup\n ? { state: 'needs_input', seen: false, since: startup.since, updatedAt: startup.since, stale: false, summary: startup.what }\n : meta.attention && !shadowed && opts.claudesFor\n ? withLiveClaude(meta.attention, claudes, {\n known: opts.liveKnown === true,\n hosted: opts.hostedLive?.(id) ?? true,\n background: () => agentOf(s).conversation?.backgroundWorkSince?.(s, idleFrom(meta.attention!)) ?? null,\n commands: () =>\n bestEffort(\n `background commands of ${s.target}:${s.branch}`,\n () => agentOf(s).conversation?.backgroundCommandNames?.(s, 0) ?? [],\n [],\n ) ?? [],\n })\n : (meta.attention ?? (shadowed || s.archivedAt ? null : (opts.outputStatusFor?.(id) ?? null))),\n diffStat: opts.diffStatFor ? opts.diffStatFor(id, s, meta.attention !== null) : null,\n archivedAt: s.archivedAt ?? null,\n port: s.port ?? null,\n context: s.archivedAt ? null : bestEffort(`context usage for ${s.target}:${s.branch}`, () => readContextUsage(s), null),\n ...(reviewThreads > 0 ? { openReviewThreads: reviewThreads } : {}),\n ...(replyDrafts > 0 ? { replyDrafts } : {}),\n ...(prStage ? { prStage } : {}),\n ...(localReview ? { localReview } : {}),\n ...otherBranches(s),\n };\n // Snoozed: only while it holds (a time not yet reached, or the status it\n // was snoozed in). \"Its status\" is what the hooks recorded — the same the\n // snooze was taken against — not the shown one, which a live Claude's state\n // file can override (that would end a snooze the moment it was set).\n const snooze = s.archivedAt ? null : (opts.snoozeFor?.(id) ?? null);\n if (snooze && snoozeActive(snooze, { attention: readStatus(id), openReviewThreads: wire.openReviewThreads, prStage: wire.prStage }))\n wire.snoozed = { until: snooze.until };\n const behind = s.archivedAt ? null : (opts.behindFor?.(id, s, wire.lastActivity ?? 0) ?? null);\n if (behind && behind.commits > 0) wire.behind = behind;\n const stack = s.archivedAt ? null : (opts.stackFor?.(id) ?? null);\n if (stack?.parent) wire.stackedOn = stack.parent;\n if (stack?.children) wire.stackedChildren = stack.children;\n if (stack?.merged) wire.stackParentMerged = stack.merged;\n const branches = s.archivedAt ? null : (opts.branchesFor?.(id, s) ?? null);\n if (branches?.length) wire.branches = branches;\n if (opts.hasNote?.(id)) wire.hasNote = true;\n if (s.keepAfterMerge && !s.archivedAt) wire.keepAfterMerge = true;\n if (isArchiving(id)) wire.archiving = true;\n if (!s.archivedAt && isAsleep(readStatus(id)?.stoppedAt, wire.ptyStatus === 'running', wire.lastActivity ?? 0)) wire.asleep = true;\n const blockers = s.archivedAt ? [] : (opts.blockedByFor?.(id) ?? []);\n if (blockers.length) wire.blockedBy = blockers;\n return wire;\n}\n\n/**\n * Asleep: work stopped its Claude (idle sleep, `work stop`: `stoppedAt`), it\n * isn't running now, and its conversation wasn't written since — one started\n * again (opened, sent a note, started in a terminal) is awake. Pure.\n */\nexport function isAsleep(stoppedAt: string | undefined, ptyRunning: boolean, lastActivityMs: number): boolean {\n const stopped = stoppedAt ? Date.parse(stoppedAt) : NaN;\n return Number.isFinite(stopped) && !ptyRunning && lastActivityMs <= stopped;\n}\n\n/** The row, marked Restoring while a Restore of it runs (a copy: archived rows are cached). */\nexport function withRestoring(w: SessionWire): SessionWire {\n return isRestoring(w.id) ? { ...w, restoring: true } : w;\n}\n\n/**\n * Its repos' aliases, one per path (`sessionRepos`). A recorded list needs no\n * config; a group's row from before reads the group's members from the\n * config, read once per change of the file (this runs per row of every list).\n */\nexport function wireRepos(\n s: Pick<WorktreeSession, 'target' | 'isGroup' | 'paths' | 'repos'>,\n config: () => Pick<WorkConfig, 'repos' | 'groups'> | null = repoConfig,\n): string[] {\n const recorded = recordedRepos(s);\n if (recorded) return recorded.map((r) => r.alias);\n return sessionRepos(s, s.isGroup ? config() : null).map((r) => r.alias);\n}\n\nlet configCache: { key: string; value: Pick<WorkConfig, 'repos' | 'groups'> | null } | null = null;\n\nfunction repoConfig(): Pick<WorkConfig, 'repos' | 'groups'> | null {\n const file = getConfigPath();\n let key: string;\n try {\n const st = fs.statSync(file);\n key = `${file}|${st.size}|${st.mtimeMs}`;\n } catch {\n return null;\n }\n if (configCache?.key === key) return configCache.value;\n const cfg = bestEffort('config for session repos', () => loadConfig(), null);\n configCache = { key, value: cfg ? { repos: cfg.repos, groups: cfg.groups } : null };\n return configCache.value;\n}\n\n/**\n * Repos of the session checked out on another branch than the session's\n * (read from HEAD files, no git). Ship and the PR watch follow the real\n * branch already; this is so the dashboard says so.\n */\nexport function otherBranches(s: Pick<WorktreeSession, 'branch' | 'paths' | 'target' | 'isGroup' | 'archivedAt'>): {\n onOtherBranch?: Array<{ repo: string; branch: string | null; noGit?: true }>;\n} {\n if (s.archivedAt || !s.branch) return {};\n const out: Array<{ repo: string; branch: string | null; noGit?: true }> = [];\n for (const p of s.paths) {\n if (!fs.existsSync(p)) continue;\n // A folder with no git left in it (a removal that stopped halfway) is on no branch at all.\n if (isLeftover(p)) {\n out.push({ repo: s.isGroup ? path.basename(p) : s.target, branch: null, noGit: true });\n continue;\n }\n const branch = checkedOutBranch(p);\n if (branch !== s.branch) out.push({ repo: s.isGroup ? path.basename(p) : s.target, branch });\n }\n return out.length ? { onOtherBranch: out } : {};\n}\n\n/** A session's unresolved review threads, from the PR watch's per-repo counts (open PRs only). */\nexport function reviewThreadsOf(ci: { repos: Array<{ pr: { state: string } | null; openThreads?: number }> } | null | undefined): number {\n return (ci?.repos ?? []).reduce((n, r) => n + (r.pr?.state === 'OPEN' ? (r.openThreads ?? 0) : 0), 0);\n}\n\n/** The `pr_watch_seen` key that says you saw a session at a PR stage. */\nexport const stageSeenKey = (stageKey: string) => `stage:${stageKey}`;\n\n/**\n * A session's PR stage from the PR watch's last check, with `seen` read only\n * for a stage that would bring it back to the Inbox (one lookup, not one per row).\n */\nexport function prStageWire(\n ci:\n | {\n repos: Array<{ name: string; pr: StagePr | null; branch?: string; otherPrs?: Array<{ branch: string; pr: StagePr }> }>;\n elsewhere?: ElsewherePr[];\n }\n | null\n | undefined,\n seen: (key: string) => boolean,\n): PrStageWire | null {\n // Every open PR across the branches it worked on (stageRepos), and its listed PRs in repos it doesn't have.\n const stage = prStageOf(stageRepos(stageInputOf(ci)));\n if (!stage) return null;\n return STAGE_WANTS_YOU.has(stage.kind) && seen(stageSeenKey(stage.key)) ? { ...stage, seen: true } : stage;\n}\n\n/** Saved uncommitted files a Restore hasn't put back yet. */\nfunction savedFiles(saved: Record<string, { files: number; restoredAt?: string; restoreError?: string }> | undefined): {\n savedUncommitted?: number;\n} {\n const n = Object.values(saved ?? {})\n .filter((u) => !u.restoredAt && !u.restoreError)\n .reduce((sum, u) => sum + u.files, 0);\n return n ? { savedUncommitted: n } : {};\n}\n\nfunction archiveInfo(id: string): { archive?: SessionArchiveInfo } {\n const rec = readArchive(id);\n if (!rec) return {};\n const by = archivedByOf(rec);\n const kept = keptList(rec.kept);\n return {\n archive: {\n ...(by ? { by } : {}),\n worktreeRemoved: rec.worktreeRemoved,\n keptBecause: rec.keptBecause,\n promptCount: rec.summary.promptCount,\n prompts: rec.summary.prompts.map((p) => p.text),\n lastSummary: rec.summary.lastSummary,\n ...(rec.summary.written ? { written: rec.summary.written } : {}),\n ...(rec.buildFolders ? { buildFolders: rec.buildFolders } : {}),\n ...savedFiles(rec.uncommitted),\n ...(kept ? { kept } : {}),\n },\n };\n}\n\n/** Newest sign of life (ms): the hook update, Claude's last write, the\n * `work tree` entry — the same rule as the dashboard's \"Last active\". */\nexport function lastActiveMs(w: Pick<SessionWire, 'lastAccessedAt' | 'lastActivity' | 'attention'>): number {\n return Math.max(Date.parse(w.lastAccessedAt) || 0, w.lastActivity ?? 0, w.attention ? Date.parse(w.attention.updatedAt) || 0 : 0);\n}\n\n/**\n * Archived sessions' rows, kept between builds of the list: an archived\n * session doesn't change — its Claude is stopped, its worktree mostly gone —\n * and building its row reads its archive (2/3 of /api/sessions' time with\n * fifty of them). A row is built again when its archive file was written\n * (the summary lands after archiving, a Restore records what came back), it\n * was renamed or entered, or your note on it came or went.\n */\nexport function createArchivedRows(\n archiveFile: (id: string) => string = (id) => path.join(archiveDirFor(id), 'archive.json'),\n): (s: WorktreeSession, extra: { hasNote: boolean }, build: () => SessionWire) => SessionWire {\n const rows = new Map<string, { key: string; row: SessionWire }>();\n return (s, extra, build) => {\n if (!s.archivedAt) return build();\n const id = sessionIdFor(s);\n let mtime = 0;\n try {\n mtime = fs.statSync(archiveFile(id)).mtimeMs;\n } catch {\n /* none yet */\n }\n const key = `${s.archivedAt}|${mtime}|${s.title ?? ''}|${s.lastAccessedAt}|${extra.hasNote}`;\n const hit = rows.get(id);\n if (hit?.key === key) return hit.row;\n const row = build();\n rows.set(id, { key, row });\n return row;\n };\n}\n","import type { WorktreeSession } from '../sessions/history.js';\nimport { sessionIdFor } from '../sessions/session-id.js';\nimport { readStoresComments } from './comment-file-store.js';\nimport { scopeStoreIdsForPaths } from './pending-delivery.js';\nimport type { Comment } from './comment-types.js';\n\n/**\n * One worktree's comments live in two kinds of store: the session's own (the\n * dashboard's Diff tab posts there) and a `wd` scope's (`scope-<hash>`: the\n * browser diff page, `/diff/<hash>`, posts there). Claude was handed both\n * (`readPendingForWorktree`), but each view showed only its own, so a comment\n * made on one wasn't there on the other. Each view now lists its own store\n * first and the linked ones after: the session's view its scope stores, a\n * scope's view the session(s) whose worktree it covers.\n *\n * The stores stay separate — a new `wd -c` run clears its scope's comments\n * (`ensureScope`), which must never clear the session's.\n */\n\n/** A session as these lookups need it: its id (its store's) and its worktree paths. */\nexport interface LinkedSession {\n id: string;\n paths: string[];\n}\n\nexport const linkedSession = (s: WorktreeSession): LinkedSession => ({ id: sessionIdFor(s), paths: s.paths });\n\n/** The session's store, then every scope store over its paths. */\nexport function sessionLinkedStoreIds(session: LinkedSession): string[] {\n return [session.id, ...scopeStoreIdsForPaths(session.paths)];\n}\n\n/** The scope's store, then each session whose paths that scope covers (the whole worktree, or one repo of a group). */\nexport function scopeLinkedStoreIds(hash: string, sessions: LinkedSession[]): string[] {\n const own = `scope-${hash}`;\n return [own, ...new Set(sessions.filter((s) => scopeStoreIdsForPaths(s.paths).includes(own)).map((s) => s.id))];\n}\n\nexport type Read = (storeId: string) => Comment[];\n\n/** These stores read in one query (they're mostly empty: a scope store has rows only once its page was commented on). */\nexport function readerFor(storeIds: string[]): Read {\n const rows = readStoresComments(storeIds);\n return (id) => rows.get(id) ?? [];\n}\n\n/**\n * Every comment the view shows: the first store's whole, the linked ones'\n * without their drafts (a draft is that view's unsent review; this view's\n * Submit wouldn't send it). Oldest first, each comment once.\n */\nexport function linkedComments(storeIds: string[], read: Read = readerFor(storeIds)): Comment[] {\n const seen = new Set<string>();\n const out: Comment[] = [];\n storeIds.forEach((id, i) => {\n for (const c of read(id)) {\n if (seen.has(c.id) || (i > 0 && c.status === 'draft')) continue;\n seen.add(c.id);\n out.push(c);\n }\n });\n return out.sort((a, b) => a.createdAt.localeCompare(b.createdAt));\n}\n\n/** Which of these stores holds the comment (a delete, a resolve or a reply acts there), or null. */\nexport function storeHolding(storeIds: string[], commentId: string, read: Read = readerFor(storeIds)): string | null {\n return storeIds.find((id) => read(id).some((c) => c.id === commentId)) ?? null;\n}\n\n/** Who to tell a store changed: the sessions and scopes whose views list it. */\nexport function viewersOf(storeId: string, sessions: LinkedSession[]): { sessionIds: string[]; scopeHashes: string[] } {\n if (storeId.startsWith('scope-')) {\n return {\n sessionIds: [...new Set(sessions.filter((s) => scopeStoreIdsForPaths(s.paths).includes(storeId)).map((s) => s.id))],\n scopeHashes: [storeId.slice('scope-'.length)],\n };\n }\n const session = sessions.find((s) => s.id === storeId);\n return {\n sessionIds: [storeId],\n scopeHashes: session ? scopeStoreIdsForPaths(session.paths).map((id) => id.slice('scope-'.length)) : [],\n };\n}\n\n/** How a front-end tells a view its comments changed: a session's Diff tab by id, a scope page on its own stream. */\nexport interface Tell {\n session: (sessionId: string, data: Record<string, unknown>) => void;\n scope: (scopeHash: string, data: Record<string, unknown>) => void;\n}\n\n/** A store changed: every view listing it is told (both comment routes use this, so they can't drift apart). */\nexport function announceChange(storeId: string, sessions: LinkedSession[], tell: Tell, data: Record<string, unknown>): void {\n const { sessionIds, scopeHashes } = viewersOf(storeId, sessions);\n for (const sessionId of sessionIds) tell.session(sessionId, { ...data, sessionId });\n for (const scopeHash of scopeHashes) tell.scope(scopeHash, { ...data, scopeHash });\n}\n","import { peekPty } from '../pty/pty-pool.js';\nimport { sessionStatusView } from '../status/turn-activity.js';\nimport type { ActivityState } from '../api-types.js';\nimport { readSessionActivity } from './session-activity.js';\nimport { linkedComments, sessionLinkedStoreIds } from '../comments/linked-stores.js';\nimport { readPendingForWorktree } from '../comments/pending-delivery.js';\nimport type { WorktreeSession } from './history.js';\nimport { readStatus, type EffectiveStatus } from '../status/session-status.js';\n\nexport type { PtyStatus } from '../api-types.js';\nimport type { PtyStatus } from '../api-types.js';\n\nexport interface SessionMeta {\n draftCount: number;\n /** Open comment threads (top-level, not resolved): the Diff tab's badge. */\n commentCount: number;\n /** Comments authored by claude — used by the client to compute unread. */\n claudeCount: number;\n /** Set when *our* PTY pool has a live Claude for this session. Doesn't\n * catch external terminals — `activityState` does. */\n ptyStatus: PtyStatus;\n /** ms since epoch of Claude's last write across this worktree, or null. */\n lastActivity: number | null;\n /** Derived from `lastActivity`: 'active' (≤30 s), 'open' (≤5 min), 'stale'. */\n activityState: ActivityState;\n /** Published user comments not yet surfaced to Claude via the\n * UserPromptSubmit hook. Drops to zero after Claude takes its next turn. */\n pendingForClaudeCount: number;\n /** Hook-driven agent status for the attention inbox; null until the\n * session's Claude has fired a hook under a full `work web`. */\n attention: EffectiveStatus | null;\n}\n\n/**\n * Cheap per-session metadata. Goes through the file-store cache so badge\n * counts reflect in-flight writes that haven't yet hit disk — reading the\n * raw JSON behind the cache's back produced stale counts under load.\n *\n * `session` is required because we need the worktree paths to look up\n * Claude's transcript directory (the sessionId hash alone isn't enough).\n */\nexport function readSessionMeta(sessionId: string, session: WorktreeSession): SessionMeta {\n // As the Diff tab lists them: with those made on the browser diff page (linked-stores.ts).\n const comments = linkedComments(sessionLinkedStoreIds({ id: sessionId, paths: session.paths }));\n let drafts = 0;\n let claude = 0;\n let open = 0;\n for (const c of comments) {\n if (c.status === 'draft') drafts++;\n if (c.author === 'claude') claude++;\n // The Diff tab's badge: threads still open. One Claude worked through is resolved (resolveAddressed).\n if (!c.parentId && !c.resolved) open++;\n }\n const activity = readSessionActivity(session);\n // What the hooks will hand over: the session's and its scopes' (readPendingForWorktree), as the badges count.\n const pending = readPendingForWorktree(session, sessionId).length;\n const status = readStatus(sessionId);\n return {\n draftCount: drafts,\n commentCount: open,\n claudeCount: claude,\n ptyStatus: peekPty(sessionId) ? 'running' : 'idle',\n lastActivity: activity.lastActivity,\n activityState: activity.state,\n pendingForClaudeCount: pending,\n attention: status ? sessionStatusView(status, session, activity.lastActivity ?? 0) : null,\n };\n}\n","import { readJsonlTail } from './jsonl.js';\nimport { agentOf } from '../agents/index.js';\nimport type { ConversationEntry } from '../agents/types.js';\nimport type { ContextUsage } from '../api-types.js';\nimport type { WorktreeSession } from '../sessions/session-types.js';\n\nexport type { ContextUsage } from '../api-types.js';\n\n/**\n * How full a session's conversation is. Every assistant message in the\n * transcript carries the token usage of the request that produced it, so\n * the newest one says how big the context is now: its prompt (input +\n * cache reads + cache writes) plus its reply, which the next turn carries.\n * Near the window Claude Code compacts the conversation, and answers get\n * worse before that — the dashboard shows when to start fresh.\n */\n\n/** From conversation entries (oldest first): the newest main-thread usage, in the agent's window (`window`). */\nexport function contextUsageFrom(\n entries: readonly ConversationEntry[],\n window: (model: string | undefined, used: number) => number,\n): ContextUsage | null {\n for (let i = entries.length - 1; i >= 0; i--) {\n const e = entries[i];\n // Subagent (Task) turns run in their own context.\n if (e.role !== 'agent' || e.sidechain || !e.usage) continue;\n const used = e.usage.prompt + e.usage.reply;\n if (used === 0) continue;\n return { used, window: window(e.model, used), ...(e.model ? { model: e.model } : {}) };\n }\n return null;\n}\n\n// Claude Code's transcript files, for the callers that still read Claude's own records (turn activity): agents/claude-files.ts.\nexport type { ConversationFile as TranscriptFile } from '../agents/types.js';\n\n/** Only the tail is read — a usage line is always near the end. */\nconst USAGE_TAIL_BYTES = 64 * 1024;\nconst cache = new Map<string, { key: string; usage: ContextUsage | null }>();\n\n/** The session's context usage now, through its agent; re-reads a conversation only after it changed. Null when work can't read its agent's conversations. */\nexport function readContextUsage(session: WorktreeSession): ContextUsage | null {\n const conv = agentOf(session).conversation;\n if (!conv) return null;\n let t: { file: string; size: number; mtimeMs: number } | null = null;\n for (const f of conv.files(session)) if (!t || f.mtimeMs > t.mtimeMs) t = f;\n if (!t) return null;\n const key = `${t.file}:${t.size}:${t.mtimeMs}`;\n const id = session.paths.join('|');\n const hit = cache.get(id);\n if (hit?.key === key) return hit.usage;\n const usage = contextUsageFrom(conv.entries(readJsonlTail(t.file, USAGE_TAIL_BYTES)), conv.contextWindow);\n cache.set(id, { key, usage });\n return usage;\n}\n","import fs from 'node:fs';\nimport { promptsSince } from './digest.js';\nimport { agentOf } from '../agents/index.js';\nimport type { ConversationEntry } from '../agents/types.js';\nimport type { WorktreeSession } from '../sessions/session-types.js';\n\n/**\n * A human name for a session, beside its branch: the name you gave it, or\n * else what you first asked its Claude (\"Rotate the terminal encryption\n * keys\"), or else its Jira key. Worked out when read — the first prompt is\n * read from the start of its oldest transcript, cached per file — so a GET\n * writes nothing; only a rename is stored.\n */\n\nconst TITLE_CHARS = 80;\nconst HEAD_BYTES = 256 * 1024;\nconst cache = new Map<string, { size: number; title: string | null }>();\n\n/** The first prompt in a conversation file (read from its start), its lines read by `toEntries` (the agent's). */\nexport function firstPromptOf(file: string, toEntries: (lines: readonly unknown[]) => ConversationEntry[]): string | null {\n let size: number;\n try {\n size = fs.statSync(file).size;\n } catch {\n return null;\n }\n const hit = cache.get(file);\n // The start of a file doesn't change as it grows, unless it was replaced\n // (smaller). \"No prompt in it\" holds as long as the file is the same, or\n // its whole head was read already: re-reading 256 KB of every such\n // transcript on every session-list build cost the most of all.\n if (hit && size >= hit.size && (hit.title !== null || size === hit.size || hit.size >= HEAD_BYTES)) return hit.title;\n let text: string;\n try {\n const fd = fs.openSync(file, 'r');\n try {\n const buf = Buffer.alloc(Math.min(size, HEAD_BYTES));\n fs.readSync(fd, buf, 0, buf.length, 0);\n text = buf.toString('utf8');\n } finally {\n fs.closeSync(fd);\n }\n } catch {\n return null;\n }\n const lines: unknown[] = [];\n for (const line of text.split('\\n')) {\n try {\n lines.push(JSON.parse(line));\n } catch {\n /* the last, cut-off line */\n }\n }\n const first = promptsSince([toEntries(lines)], 0)[0]?.text ?? null;\n const readable = first ? titleText(first) : null;\n const title = readable ? clip(readable) : null;\n cache.set(file, { size, title });\n return title;\n}\n\nconst clip = (s: string) => (s.length > TITLE_CHARS ? s.slice(0, TITLE_CHARS - 1).trimEnd() + '…' : s);\n\n/**\n * A prompt as a name: what you wrote, without markup. A pasted block\n * (`<pasted_content …>…</pasted_content>`, a log or code you pasted) is left\n * out when you also wrote something; a prompt that is only a paste keeps its\n * text. Other tags are dropped, their text kept. Null when nothing is left.\n */\nexport function titleText(prompt: string): string | null {\n const flat = (s: string) =>\n s\n .replace(/<\\/?[A-Za-z][\\w-]*(?:\\s[^>]*)?>/g, ' ')\n .replace(/\\s+/g, ' ')\n .trim();\n const outside = flat(prompt.replace(/<pasted_content\\b[^>]*>[\\s\\S]*?<\\/pasted_content>/g, ' '));\n const text = outside || flat(prompt);\n return text ? text : null;\n}\n\n/** The session's name: yours, else its first prompt, else its Jira key. */\nexport function sessionTitle(s: WorktreeSession, fallbackPrompt?: string | null): string | null {\n if (s.title?.trim()) return s.title.trim();\n const conv = agentOf(s).conversation;\n const oldestFirst = (conv?.files(s) ?? []).sort((a, b) => a.mtimeMs - b.mtimeMs);\n for (const t of oldestFirst) {\n const p = firstPromptOf(t.file, conv!.entries);\n if (p) return p;\n }\n const fallback = fallbackPrompt ? titleText(fallbackPrompt) : null;\n if (fallback) return clip(fallback);\n return s.issueKey ?? null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAOA,SAAQ;AAKf,OAAO,UAAU;;;ACkBV,IAAM,gBAAgB,CAAC,OAAuC,EAAE,IAAI,aAAa,CAAC,GAAG,OAAO,EAAE,MAAM;AAGpG,SAAS,sBAAsB,SAAkC;AACtE,SAAO,CAAC,QAAQ,IAAI,GAAG,sBAAsB,QAAQ,KAAK,CAAC;AAC7D;AAGO,SAAS,oBAAoB,MAAc,UAAqC;AACrF,QAAM,MAAM,SAAS,IAAI;AACzB,SAAO,CAAC,KAAK,GAAG,IAAI,IAAI,SAAS,OAAO,CAAC,MAAM,sBAAsB,EAAE,KAAK,EAAE,SAAS,GAAG,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAChH;AAKO,SAAS,UAAU,UAA0B;AAClD,QAAM,OAAO,mBAAmB,QAAQ;AACxC,SAAO,CAAC,OAAO,KAAK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