@moberg_hr/work-tree 2.9.3 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (372) hide show
  1. package/dist/{account-NG75VLRU.js → account-Q5Y3YKI7.js} +83 -100
  2. package/dist/account-Q5Y3YKI7.js.map +1 -0
  3. package/dist/{add-repo-EDU3QEYI.js → add-repo-L4ZTGBLO.js} +35 -31
  4. package/dist/{add-repo-EDU3QEYI.js.map → add-repo-L4ZTGBLO.js.map} +1 -1
  5. package/dist/{answer-MHOJ2J6S.js → answer-GNR4ZBWV.js} +18 -15
  6. package/dist/{answer-MHOJ2J6S.js.map → answer-GNR4ZBWV.js.map} +1 -1
  7. package/dist/{attach-37JOJ4C3.js → attach-QNSDKRW7.js} +27 -21
  8. package/dist/{attach-37JOJ4C3.js.map → attach-QNSDKRW7.js.map} +1 -1
  9. package/dist/bin.js +5 -5
  10. package/dist/{block-D5CAR53T.js → block-3YUIMA62.js} +23 -15
  11. package/dist/block-3YUIMA62.js.map +1 -0
  12. package/dist/{broadcast-LLYHUWXA.js → broadcast-DR3JFINO.js} +13 -11
  13. package/dist/{broadcast-LLYHUWXA.js.map → broadcast-DR3JFINO.js.map} +1 -1
  14. package/dist/{catchup-2SL3JGA7.js → catchup-YG2UOZBL.js} +19 -17
  15. package/dist/{catchup-2SL3JGA7.js.map → catchup-YG2UOZBL.js.map} +1 -1
  16. package/dist/{chunk-P6BHOAQG.js → chunk-246OTVRR.js} +2 -2
  17. package/dist/{chunk-KSUOVFO3.js → chunk-26YZYL77.js} +16 -9
  18. package/dist/chunk-26YZYL77.js.map +1 -0
  19. package/dist/{chunk-TPSFJSO7.js → chunk-2KN5ECHJ.js} +13 -10
  20. package/dist/chunk-2KN5ECHJ.js.map +1 -0
  21. package/dist/chunk-2QLLPZ2L.js +59 -0
  22. package/dist/chunk-2QLLPZ2L.js.map +1 -0
  23. package/dist/chunk-2ZQRD73B.js +376 -0
  24. package/dist/chunk-2ZQRD73B.js.map +1 -0
  25. package/dist/{chunk-GNGXYXBC.js → chunk-33XSEAHO.js} +2 -2
  26. package/dist/{chunk-IPGH7TXJ.js → chunk-4CNBSPNL.js} +2 -2
  27. package/dist/{chunk-J36ULZBO.js → chunk-4K4S53KX.js} +2 -2
  28. package/dist/chunk-5PAMO6OG.js +9 -0
  29. package/dist/{chunk-NWIVXGSL.js.map → chunk-5PAMO6OG.js.map} +1 -1
  30. package/dist/chunk-63ZLPXRL.js +199 -0
  31. package/dist/chunk-63ZLPXRL.js.map +1 -0
  32. package/dist/{chunk-P2HOLCBF.js → chunk-6UTH3A76.js} +18 -2
  33. package/dist/{chunk-P2HOLCBF.js.map → chunk-6UTH3A76.js.map} +1 -1
  34. package/dist/{chunk-5QGCF3PS.js → chunk-7DUGVGUZ.js} +2 -2
  35. package/dist/chunk-7E5XPDKX.js +22 -0
  36. package/dist/chunk-7E5XPDKX.js.map +1 -0
  37. package/dist/{chunk-6FVYSW3E.js → chunk-7NNGYM3G.js} +21 -6
  38. package/dist/chunk-7NNGYM3G.js.map +1 -0
  39. package/dist/{chunk-DQCUYCMX.js → chunk-7NNOGTMC.js} +3 -3
  40. package/dist/{chunk-OMIMK3LB.js → chunk-7OFVXQSM.js} +2 -2
  41. package/dist/chunk-7QNVFVG6.js +196 -0
  42. package/dist/chunk-7QNVFVG6.js.map +1 -0
  43. package/dist/chunk-7RHC5U7X.js +1578 -0
  44. package/dist/chunk-7RHC5U7X.js.map +1 -0
  45. package/dist/{chunk-KUCMJHQW.js → chunk-AHYCZUPI.js} +2 -2
  46. package/dist/chunk-B6MWNZCN.js +415 -0
  47. package/dist/chunk-B6MWNZCN.js.map +1 -0
  48. package/dist/{chunk-CCTALU3C.js → chunk-BLGCU4HT.js} +2 -2
  49. package/dist/{chunk-RCGFHJM7.js → chunk-CBCOVIXZ.js} +2 -2
  50. package/dist/{chunk-WTQ2QCAG.js → chunk-CDYCZ3PR.js} +4 -5
  51. package/dist/chunk-CDYCZ3PR.js.map +1 -0
  52. package/dist/{chunk-HCVONKJI.js → chunk-CR4LUAP4.js} +15 -17
  53. package/dist/{chunk-HCVONKJI.js.map → chunk-CR4LUAP4.js.map} +1 -1
  54. package/dist/{chunk-ZXHMC7UO.js → chunk-D2J3AD6L.js} +3 -5
  55. package/dist/chunk-D2J3AD6L.js.map +1 -0
  56. package/dist/chunk-DAKJTB6N.js +76 -0
  57. package/dist/chunk-DAKJTB6N.js.map +1 -0
  58. package/dist/{chunk-3N3UQEC4.js → chunk-DCCC7LEP.js} +4 -3
  59. package/dist/chunk-DCCC7LEP.js.map +1 -0
  60. package/dist/{chunk-S3BAD4IR.js → chunk-DGVCN7HB.js} +2 -2
  61. package/dist/chunk-DMGNJ73M.js +84 -0
  62. package/dist/chunk-DMGNJ73M.js.map +1 -0
  63. package/dist/{chunk-QL36KN7X.js → chunk-DYQQLUSB.js} +3 -3
  64. package/dist/{chunk-IWJXFNM4.js → chunk-DZ4LX2EK.js} +16 -24
  65. package/dist/chunk-DZ4LX2EK.js.map +1 -0
  66. package/dist/{chunk-3C3BKZ3H.js → chunk-EDIHBLZY.js} +51 -29
  67. package/dist/chunk-EDIHBLZY.js.map +1 -0
  68. package/dist/chunk-EL3XL2OC.js +150 -0
  69. package/dist/chunk-EL3XL2OC.js.map +1 -0
  70. package/dist/{chunk-T7AFYEQ7.js → chunk-F2CDUWZU.js} +5 -5
  71. package/dist/chunk-F2NOCGMA.js +243 -0
  72. package/dist/chunk-F2NOCGMA.js.map +1 -0
  73. package/dist/chunk-FGPXMAYU.js +25 -0
  74. package/dist/chunk-FGPXMAYU.js.map +1 -0
  75. package/dist/{chunk-ICJPVSRY.js → chunk-FLHMFRZB.js} +51 -51
  76. package/dist/chunk-FLHMFRZB.js.map +1 -0
  77. package/dist/{chunk-CLBQ7ZC4.js → chunk-FR7B7QH6.js} +3 -3
  78. package/dist/chunk-FZHFD2AY.js +27 -0
  79. package/dist/chunk-FZHFD2AY.js.map +1 -0
  80. package/dist/{chunk-7OUIZ2YQ.js → chunk-G4QUJO7W.js} +56 -58
  81. package/dist/chunk-G4QUJO7W.js.map +1 -0
  82. package/dist/{chunk-26OVU2AE.js → chunk-G4ZR5YZL.js} +8 -8
  83. package/dist/{chunk-P4EQWC5W.js → chunk-GG4VKPAX.js} +2 -2
  84. package/dist/{chunk-INQQGV2G.js → chunk-GZNF6762.js} +4 -4
  85. package/dist/{chunk-QHTXLCG7.js → chunk-H3LP3Z4U.js} +19 -13
  86. package/dist/chunk-H3LP3Z4U.js.map +1 -0
  87. package/dist/{chunk-6E2I2FBJ.js → chunk-HJKYE57I.js} +22 -22
  88. package/dist/{chunk-CYWI3ZW7.js → chunk-I5FZXDCO.js} +4 -4
  89. package/dist/{chunk-5WM24P5N.js → chunk-I6MILNM5.js} +2 -2
  90. package/dist/chunk-I6MILNM5.js.map +1 -0
  91. package/dist/{chunk-BSP2Z7B7.js → chunk-IQ4MITHC.js} +6 -6
  92. package/dist/chunk-J3GEINBH.js +307 -0
  93. package/dist/chunk-J3GEINBH.js.map +1 -0
  94. package/dist/{chunk-WXE7D44E.js → chunk-JCFCEJ2D.js} +8 -8
  95. package/dist/chunk-JCFCEJ2D.js.map +1 -0
  96. package/dist/{chunk-WXMWZRBH.js → chunk-JF25PSYF.js} +24 -8
  97. package/dist/chunk-JF25PSYF.js.map +1 -0
  98. package/dist/{chunk-SG5LUMGE.js → chunk-JNBMANFM.js} +6 -3
  99. package/dist/chunk-JNBMANFM.js.map +1 -0
  100. package/dist/chunk-JVE2JFLV.js +15 -0
  101. package/dist/chunk-JVE2JFLV.js.map +1 -0
  102. package/dist/{chunk-RGUSVBGN.js → chunk-JVHHSKBJ.js} +2 -2
  103. package/dist/chunk-KSVYR4G2.js +47 -0
  104. package/dist/chunk-KSVYR4G2.js.map +1 -0
  105. package/dist/{chunk-RYNBBSLY.js → chunk-KWHHB737.js} +6 -8
  106. package/dist/chunk-KWHHB737.js.map +1 -0
  107. package/dist/{chunk-MG5TTLYZ.js → chunk-LHM3GB5K.js} +3 -3
  108. package/dist/{chunk-PSUJZUYX.js → chunk-LM2T5OR3.js} +3 -2
  109. package/dist/{chunk-GRLKPVTP.js → chunk-LQNHIMJM.js} +56 -81
  110. package/dist/chunk-LQNHIMJM.js.map +1 -0
  111. package/dist/{chunk-UBOKRHNV.js → chunk-MKJH2D4V.js} +2 -2
  112. package/dist/{chunk-HMK3INUS.js → chunk-MQCDFSVF.js} +2 -2
  113. package/dist/{chunk-VJ7SVDED.js → chunk-MSJWQC7H.js} +6 -4
  114. package/dist/chunk-MSJWQC7H.js.map +1 -0
  115. package/dist/chunk-MXOHW4U2.js +187 -0
  116. package/dist/chunk-MXOHW4U2.js.map +1 -0
  117. package/dist/{chunk-VUAVPBFR.js → chunk-N4W34U3I.js} +78 -60
  118. package/dist/chunk-N4W34U3I.js.map +1 -0
  119. package/dist/{chunk-72IBYKIY.js → chunk-NFWSJFYY.js} +16 -5
  120. package/dist/chunk-NFWSJFYY.js.map +1 -0
  121. package/dist/{chunk-2JNW2AQ2.js → chunk-O5ZJY5BT.js} +32 -4
  122. package/dist/chunk-O5ZJY5BT.js.map +1 -0
  123. package/dist/{chunk-CMO5YUZR.js → chunk-OY46QHLX.js} +4 -4
  124. package/dist/{chunk-OTAZOIXK.js → chunk-PKQROEFP.js} +2 -2
  125. package/dist/{chunk-4NITDMDH.js → chunk-PPZP7CA7.js} +9 -186
  126. package/dist/chunk-PPZP7CA7.js.map +1 -0
  127. package/dist/chunk-QBI6K23L.js +50 -0
  128. package/dist/chunk-QBI6K23L.js.map +1 -0
  129. package/dist/{chunk-AAYWHIIT.js → chunk-QLFJNYBV.js} +9 -56
  130. package/dist/chunk-QLFJNYBV.js.map +1 -0
  131. package/dist/{chunk-PRDRRU2B.js → chunk-R5JCCRGD.js} +5 -5
  132. package/dist/{chunk-X4AXKO3A.js → chunk-RGLIW45S.js} +2 -2
  133. package/dist/{chunk-YYBXQBW2.js → chunk-RUYTU2WJ.js} +17 -3
  134. package/dist/chunk-RUYTU2WJ.js.map +1 -0
  135. package/dist/chunk-S3CTXKSN.js +17 -0
  136. package/dist/chunk-S3CTXKSN.js.map +1 -0
  137. package/dist/chunk-SJBEIYLK.js +16 -0
  138. package/dist/chunk-SJBEIYLK.js.map +1 -0
  139. package/dist/{chunk-WC534PXU.js → chunk-SPP7MA3D.js} +36 -25
  140. package/dist/chunk-SPP7MA3D.js.map +1 -0
  141. package/dist/{chunk-RFINYWID.js → chunk-TEL27NRC.js} +16 -6
  142. package/dist/chunk-TEL27NRC.js.map +1 -0
  143. package/dist/{chunk-ATED7SAH.js → chunk-TEVCBUEN.js} +36 -25
  144. package/dist/chunk-TEVCBUEN.js.map +1 -0
  145. package/dist/{chunk-QSOEMCWQ.js → chunk-URGHBFB3.js} +18 -11
  146. package/dist/chunk-URGHBFB3.js.map +1 -0
  147. package/dist/{chunk-S3FMTEFR.js → chunk-VAMLU5VH.js} +13 -6
  148. package/dist/chunk-VAMLU5VH.js.map +1 -0
  149. package/dist/{chunk-ZI2KXTKM.js → chunk-VJ5XMYXE.js} +6 -10
  150. package/dist/chunk-VJ5XMYXE.js.map +1 -0
  151. package/dist/{chunk-QEVYCCKD.js → chunk-VRQKIIC2.js} +12 -34
  152. package/dist/chunk-VRQKIIC2.js.map +1 -0
  153. package/dist/{chunk-63VY4YJM.js → chunk-W7MGB3Q2.js} +34 -9
  154. package/dist/chunk-W7MGB3Q2.js.map +1 -0
  155. package/dist/{chunk-HEPBANFJ.js → chunk-X3RHLYGI.js} +93 -196
  156. package/dist/chunk-X3RHLYGI.js.map +1 -0
  157. package/dist/chunk-YKQLHFY4.js +1478 -0
  158. package/dist/chunk-YKQLHFY4.js.map +1 -0
  159. package/dist/chunk-YPXFDJ76.js +71 -0
  160. package/dist/chunk-YPXFDJ76.js.map +1 -0
  161. package/dist/{chunk-XVNRP7XE.js → chunk-YQBBFX7D.js} +11 -11
  162. package/dist/{chunk-37XQIG7F.js → chunk-ZG2M4ECW.js} +569 -55
  163. package/dist/chunk-ZG2M4ECW.js.map +1 -0
  164. package/dist/{cleanup-5PSLKZLF.js → cleanup-X7G66SPY.js} +49 -37
  165. package/dist/{cleanup-5PSLKZLF.js.map → cleanup-X7G66SPY.js.map} +1 -1
  166. package/dist/cli-RJVX6HVT.js +19 -0
  167. package/dist/{command-hook-installer-7Q7UD7AU.js → command-hook-installer-GMQ4IVDE.js} +3 -3
  168. package/dist/{completion-MXX5TRIV.js → completion-IAH7WRKJ.js} +3 -2
  169. package/dist/{completion-MXX5TRIV.js.map → completion-IAH7WRKJ.js.map} +1 -1
  170. package/dist/{config-6MSITKGB.js → config-ZBU5PHMG.js} +18 -15
  171. package/dist/{config-6MSITKGB.js.map → config-ZBU5PHMG.js.map} +1 -1
  172. package/dist/{diff-Q7MV6YGJ.js → diff-ADSD4SNQ.js} +25 -22
  173. package/dist/{diff-Q7MV6YGJ.js.map → diff-ADSD4SNQ.js.map} +1 -1
  174. package/dist/{digest-KUMVYXKZ.js → digest-ORN6JFNE.js} +15 -13
  175. package/dist/{digest-KUMVYXKZ.js.map → digest-ORN6JFNE.js.map} +1 -1
  176. package/dist/{fork-OFENISEM.js → fork-VWHAU76U.js} +44 -31
  177. package/dist/{fork-OFENISEM.js.map → fork-VWHAU76U.js.map} +1 -1
  178. package/dist/{history-5WKRWARZ.js → history-PP7RHA2V.js} +14 -12
  179. package/dist/{hook-ARS32DG2.js → hook-6AL5LIQO.js} +56 -22
  180. package/dist/hook-6AL5LIQO.js.map +1 -0
  181. package/dist/{hydrate-LCT6DVB3.js → hydrate-JW5MIWLZ.js} +16 -14
  182. package/dist/{hydrate-LCT6DVB3.js.map → hydrate-JW5MIWLZ.js.map} +1 -1
  183. package/dist/{init-FJKPEY5N.js → init-SIIKJF3K.js} +29 -21
  184. package/dist/{init-FJKPEY5N.js.map → init-SIIKJF3K.js.map} +1 -1
  185. package/dist/install-skills-KS6N4U6L.js +22 -0
  186. package/dist/install-skills-bin.js +10 -8
  187. package/dist/install-skills-bin.js.map +1 -1
  188. package/dist/{list-GTKP5FAW.js → list-UTQF7KHP.js} +17 -15
  189. package/dist/{list-GTKP5FAW.js.map → list-UTQF7KHP.js.map} +1 -1
  190. package/dist/{move-GOCLEFGZ.js → move-P6WOVUGF.js} +35 -26
  191. package/dist/{move-GOCLEFGZ.js.map → move-P6WOVUGF.js.map} +1 -1
  192. package/dist/{note-B7TQBXQF.js → note-GEFCZKMT.js} +16 -14
  193. package/dist/{note-B7TQBXQF.js.map → note-GEFCZKMT.js.map} +1 -1
  194. package/dist/{overlaps-UKQHIJMU.js → overlaps-QMI2RJSG.js} +23 -13
  195. package/dist/{overlaps-UKQHIJMU.js.map → overlaps-QMI2RJSG.js.map} +1 -1
  196. package/dist/{pin-UZZCDK7M.js → pin-ZALBX2XK.js} +16 -14
  197. package/dist/{pin-UZZCDK7M.js.map → pin-ZALBX2XK.js.map} +1 -1
  198. package/dist/{pr-NU2ME2XW.js → pr-D3EZ7C5H.js} +48 -23
  199. package/dist/pr-D3EZ7C5H.js.map +1 -0
  200. package/dist/{prune-IZGEYTSB.js → prune-ZCOBL7IB.js} +47 -35
  201. package/dist/{prune-IZGEYTSB.js.map → prune-ZCOBL7IB.js.map} +1 -1
  202. package/dist/{pty-host-AWDIKPQN.js → pty-host-UCM6GV42.js} +104 -40
  203. package/dist/pty-host-UCM6GV42.js.map +1 -0
  204. package/dist/{read-U6GBGA5E.js → read-NHRSGZI4.js} +15 -13
  205. package/dist/{read-U6GBGA5E.js.map → read-NHRSGZI4.js.map} +1 -1
  206. package/dist/{recent-2DUMLUDG.js → recent-V4JVL4Y2.js} +36 -27
  207. package/dist/recent-V4JVL4Y2.js.map +1 -0
  208. package/dist/{remove-OXUP4O33.js → remove-YNO2I3HR.js} +51 -39
  209. package/dist/{remove-OXUP4O33.js.map → remove-YNO2I3HR.js.map} +1 -1
  210. package/dist/{restart-QEW4DJC3.js → restart-6YKAD7QQ.js} +19 -17
  211. package/dist/{restart-QEW4DJC3.js.map → restart-6YKAD7QQ.js.map} +1 -1
  212. package/dist/{resume-K45IT4QO.js → resume-PNZ7BRXJ.js} +36 -21
  213. package/dist/resume-PNZ7BRXJ.js.map +1 -0
  214. package/dist/review-now-HHQIBVUS.js +22 -0
  215. package/dist/review-now-HHQIBVUS.js.map +1 -0
  216. package/dist/{run-42LORGPS.js → run-3QYP7GBN.js} +23 -17
  217. package/dist/run-3QYP7GBN.js.map +1 -0
  218. package/dist/{screen-2TLIUH3G.js → screen-I6N6FKMF.js} +16 -14
  219. package/dist/{screen-2TLIUH3G.js.map → screen-I6N6FKMF.js.map} +1 -1
  220. package/dist/{search-7E4B2KX6.js → search-MLLK3ZCW.js} +12 -10
  221. package/dist/{search-7E4B2KX6.js.map → search-MLLK3ZCW.js.map} +1 -1
  222. package/dist/{section-OVA5VD7L.js → section-EQOZ36FS.js} +16 -14
  223. package/dist/{section-OVA5VD7L.js.map → section-EQOZ36FS.js.map} +1 -1
  224. package/dist/{send-BJY5CYLO.js → send-LET73FB6.js} +21 -18
  225. package/dist/send-LET73FB6.js.map +1 -0
  226. package/dist/{sessions-4A24ZORW.js → sessions-MDOJJZCK.js} +60 -25
  227. package/dist/sessions-MDOJJZCK.js.map +1 -0
  228. package/dist/{snooze-WIVKB3GH.js → snooze-TNA7QTXS.js} +15 -13
  229. package/dist/{snooze-WIVKB3GH.js.map → snooze-TNA7QTXS.js.map} +1 -1
  230. package/dist/{start-G6GR533S.js → start-OV6LZJ2V.js} +16 -14
  231. package/dist/{start-G6GR533S.js.map → start-OV6LZJ2V.js.map} +1 -1
  232. package/dist/{state-S3DGLT4J.js → state-BR43ONIH.js} +18 -6
  233. package/dist/state-BR43ONIH.js.map +1 -0
  234. package/dist/{status-BTAWY6JQ.js → status-HDDGCX4J.js} +40 -15
  235. package/dist/status-HDDGCX4J.js.map +1 -0
  236. package/dist/{statusline-WLXEU5DM.js → statusline-WKKYCH7O.js} +13 -12
  237. package/dist/{statusline-WLXEU5DM.js.map → statusline-WKKYCH7O.js.map} +1 -1
  238. package/dist/{statusline-hook-OVWHHFBV.js → statusline-hook-K7KPN2H6.js} +6 -5
  239. package/dist/{statusline-hook-OVWHHFBV.js.map → statusline-hook-K7KPN2H6.js.map} +1 -1
  240. package/dist/{stop-FN6EPFJ4.js → stop-3TJWZBJB.js} +16 -14
  241. package/dist/{stop-FN6EPFJ4.js.map → stop-3TJWZBJB.js.map} +1 -1
  242. package/dist/{sync-T3BSHX6Q.js → sync-67AOBEYR.js} +47 -35
  243. package/dist/{sync-T3BSHX6Q.js.map → sync-67AOBEYR.js.map} +1 -1
  244. package/dist/{time-5CH5O5MZ.js → time-F6SLY6HR.js} +17 -15
  245. package/dist/{time-5CH5O5MZ.js.map → time-F6SLY6HR.js.map} +1 -1
  246. package/dist/{time-actions-XEUQ3UF7.js → time-actions-YOXF5WC7.js} +6 -5
  247. package/dist/{timesheet-FMQKPS5S.js → timesheet-QUEDQSJ2.js} +26 -17
  248. package/dist/{timesheet-FMQKPS5S.js.map → timesheet-QUEDQSJ2.js.map} +1 -1
  249. package/dist/{todo-23COLGR2.js → todo-TALKJYK6.js} +5 -5
  250. package/dist/{tree-T33VU473.js → tree-FOOQBNVW.js} +66 -47
  251. package/dist/tree-FOOQBNVW.js.map +1 -0
  252. package/dist/{update-PJRSKQZ2.js → update-5O3I5P4N.js} +26 -16
  253. package/dist/{update-PJRSKQZ2.js.map → update-5O3I5P4N.js.map} +1 -1
  254. package/dist/{usage-TL66LWO4.js → usage-DVKHDT5J.js} +15 -13
  255. package/dist/{usage-TL66LWO4.js.map → usage-DVKHDT5J.js.map} +1 -1
  256. package/dist/version-TVT6GSRF.js +115 -0
  257. package/dist/version-TVT6GSRF.js.map +1 -0
  258. package/dist/{wait-YIEJO6YM.js → wait-5HZZPKNM.js} +18 -15
  259. package/dist/{wait-YIEJO6YM.js.map → wait-5HZZPKNM.js.map} +1 -1
  260. package/dist/wd-bin.js +7 -7
  261. package/dist/web/assets/{PtyView-DnDd6jLI.js → PtyView-DIGlBtjg.js} +2 -2
  262. package/dist/web/assets/{PtyView-DnDd6jLI.js.map → PtyView-DIGlBtjg.js.map} +1 -1
  263. package/dist/web/assets/index-CpqiTeqj.css +1 -0
  264. package/dist/web/assets/index-Cx0PMo6D.js +126 -0
  265. package/dist/web/assets/index-Cx0PMo6D.js.map +1 -0
  266. package/dist/web/index.html +2 -2
  267. package/dist/{web-IYUNJMQD.js → web-T7UPV3QY.js} +5158 -1822
  268. package/dist/web-T7UPV3QY.js.map +1 -0
  269. package/npm-shrinkwrap.json +2 -2
  270. package/package.json +1 -1
  271. package/plugins/work-tree/skills/wd-review/SKILL.md +1 -1
  272. package/plugins/work-tree/skills/work-sessions/SKILL.md +2 -2
  273. package/dist/account-NG75VLRU.js.map +0 -1
  274. package/dist/block-D5CAR53T.js.map +0 -1
  275. package/dist/chunk-2JNW2AQ2.js.map +0 -1
  276. package/dist/chunk-37XQIG7F.js.map +0 -1
  277. package/dist/chunk-3C3BKZ3H.js.map +0 -1
  278. package/dist/chunk-3GIH4WTA.js +0 -314
  279. package/dist/chunk-3GIH4WTA.js.map +0 -1
  280. package/dist/chunk-3N3UQEC4.js.map +0 -1
  281. package/dist/chunk-4NITDMDH.js.map +0 -1
  282. package/dist/chunk-5WM24P5N.js.map +0 -1
  283. package/dist/chunk-63VY4YJM.js.map +0 -1
  284. package/dist/chunk-6FVYSW3E.js.map +0 -1
  285. package/dist/chunk-72IBYKIY.js.map +0 -1
  286. package/dist/chunk-7OUIZ2YQ.js.map +0 -1
  287. package/dist/chunk-AAYWHIIT.js.map +0 -1
  288. package/dist/chunk-ATED7SAH.js.map +0 -1
  289. package/dist/chunk-GRLKPVTP.js.map +0 -1
  290. package/dist/chunk-HEPBANFJ.js.map +0 -1
  291. package/dist/chunk-ICJPVSRY.js.map +0 -1
  292. package/dist/chunk-IWJXFNM4.js.map +0 -1
  293. package/dist/chunk-KSUOVFO3.js.map +0 -1
  294. package/dist/chunk-NWIVXGSL.js +0 -9
  295. package/dist/chunk-PTWVOT7A.js +0 -551
  296. package/dist/chunk-PTWVOT7A.js.map +0 -1
  297. package/dist/chunk-QEVYCCKD.js.map +0 -1
  298. package/dist/chunk-QHTXLCG7.js.map +0 -1
  299. package/dist/chunk-QSOEMCWQ.js.map +0 -1
  300. package/dist/chunk-RCYI7SRA.js +0 -15
  301. package/dist/chunk-RCYI7SRA.js.map +0 -1
  302. package/dist/chunk-RFINYWID.js.map +0 -1
  303. package/dist/chunk-RYNBBSLY.js.map +0 -1
  304. package/dist/chunk-S3FMTEFR.js.map +0 -1
  305. package/dist/chunk-SG5LUMGE.js.map +0 -1
  306. package/dist/chunk-TPSFJSO7.js.map +0 -1
  307. package/dist/chunk-VJ7SVDED.js.map +0 -1
  308. package/dist/chunk-VTLDYH3C.js +0 -227
  309. package/dist/chunk-VTLDYH3C.js.map +0 -1
  310. package/dist/chunk-VUAVPBFR.js.map +0 -1
  311. package/dist/chunk-WC534PXU.js.map +0 -1
  312. package/dist/chunk-WTQ2QCAG.js.map +0 -1
  313. package/dist/chunk-WXE7D44E.js.map +0 -1
  314. package/dist/chunk-WXMWZRBH.js.map +0 -1
  315. package/dist/chunk-YYBXQBW2.js.map +0 -1
  316. package/dist/chunk-ZDMJPEBO.js +0 -31
  317. package/dist/chunk-ZDMJPEBO.js.map +0 -1
  318. package/dist/chunk-ZI2KXTKM.js.map +0 -1
  319. package/dist/chunk-ZXHMC7UO.js.map +0 -1
  320. package/dist/cli-AF7636FA.js +0 -19
  321. package/dist/hook-ARS32DG2.js.map +0 -1
  322. package/dist/install-skills-UYAFVJBA.js +0 -20
  323. package/dist/pr-NU2ME2XW.js.map +0 -1
  324. package/dist/pty-host-AWDIKPQN.js.map +0 -1
  325. package/dist/recent-2DUMLUDG.js.map +0 -1
  326. package/dist/resume-K45IT4QO.js.map +0 -1
  327. package/dist/run-42LORGPS.js.map +0 -1
  328. package/dist/send-BJY5CYLO.js.map +0 -1
  329. package/dist/sessions-4A24ZORW.js.map +0 -1
  330. package/dist/state-S3DGLT4J.js.map +0 -1
  331. package/dist/status-BTAWY6JQ.js.map +0 -1
  332. package/dist/tree-T33VU473.js.map +0 -1
  333. package/dist/web/assets/index-DxozAoUO.css +0 -1
  334. package/dist/web/assets/index-InmdAx6g.js +0 -120
  335. package/dist/web/assets/index-InmdAx6g.js.map +0 -1
  336. package/dist/web-IYUNJMQD.js.map +0 -1
  337. /package/dist/{chunk-P6BHOAQG.js.map → chunk-246OTVRR.js.map} +0 -0
  338. /package/dist/{chunk-GNGXYXBC.js.map → chunk-33XSEAHO.js.map} +0 -0
  339. /package/dist/{chunk-IPGH7TXJ.js.map → chunk-4CNBSPNL.js.map} +0 -0
  340. /package/dist/{chunk-J36ULZBO.js.map → chunk-4K4S53KX.js.map} +0 -0
  341. /package/dist/{chunk-5QGCF3PS.js.map → chunk-7DUGVGUZ.js.map} +0 -0
  342. /package/dist/{chunk-DQCUYCMX.js.map → chunk-7NNOGTMC.js.map} +0 -0
  343. /package/dist/{chunk-OMIMK3LB.js.map → chunk-7OFVXQSM.js.map} +0 -0
  344. /package/dist/{chunk-KUCMJHQW.js.map → chunk-AHYCZUPI.js.map} +0 -0
  345. /package/dist/{chunk-CCTALU3C.js.map → chunk-BLGCU4HT.js.map} +0 -0
  346. /package/dist/{chunk-RCGFHJM7.js.map → chunk-CBCOVIXZ.js.map} +0 -0
  347. /package/dist/{chunk-S3BAD4IR.js.map → chunk-DGVCN7HB.js.map} +0 -0
  348. /package/dist/{chunk-QL36KN7X.js.map → chunk-DYQQLUSB.js.map} +0 -0
  349. /package/dist/{chunk-T7AFYEQ7.js.map → chunk-F2CDUWZU.js.map} +0 -0
  350. /package/dist/{chunk-CLBQ7ZC4.js.map → chunk-FR7B7QH6.js.map} +0 -0
  351. /package/dist/{chunk-26OVU2AE.js.map → chunk-G4ZR5YZL.js.map} +0 -0
  352. /package/dist/{chunk-P4EQWC5W.js.map → chunk-GG4VKPAX.js.map} +0 -0
  353. /package/dist/{chunk-INQQGV2G.js.map → chunk-GZNF6762.js.map} +0 -0
  354. /package/dist/{chunk-6E2I2FBJ.js.map → chunk-HJKYE57I.js.map} +0 -0
  355. /package/dist/{chunk-CYWI3ZW7.js.map → chunk-I5FZXDCO.js.map} +0 -0
  356. /package/dist/{chunk-BSP2Z7B7.js.map → chunk-IQ4MITHC.js.map} +0 -0
  357. /package/dist/{chunk-RGUSVBGN.js.map → chunk-JVHHSKBJ.js.map} +0 -0
  358. /package/dist/{chunk-MG5TTLYZ.js.map → chunk-LHM3GB5K.js.map} +0 -0
  359. /package/dist/{chunk-PSUJZUYX.js.map → chunk-LM2T5OR3.js.map} +0 -0
  360. /package/dist/{chunk-UBOKRHNV.js.map → chunk-MKJH2D4V.js.map} +0 -0
  361. /package/dist/{chunk-HMK3INUS.js.map → chunk-MQCDFSVF.js.map} +0 -0
  362. /package/dist/{chunk-CMO5YUZR.js.map → chunk-OY46QHLX.js.map} +0 -0
  363. /package/dist/{chunk-OTAZOIXK.js.map → chunk-PKQROEFP.js.map} +0 -0
  364. /package/dist/{chunk-PRDRRU2B.js.map → chunk-R5JCCRGD.js.map} +0 -0
  365. /package/dist/{chunk-X4AXKO3A.js.map → chunk-RGLIW45S.js.map} +0 -0
  366. /package/dist/{chunk-XVNRP7XE.js.map → chunk-YQBBFX7D.js.map} +0 -0
  367. /package/dist/{cli-AF7636FA.js.map → cli-RJVX6HVT.js.map} +0 -0
  368. /package/dist/{command-hook-installer-7Q7UD7AU.js.map → command-hook-installer-GMQ4IVDE.js.map} +0 -0
  369. /package/dist/{history-5WKRWARZ.js.map → history-PP7RHA2V.js.map} +0 -0
  370. /package/dist/{install-skills-UYAFVJBA.js.map → install-skills-KS6N4U6L.js.map} +0 -0
  371. /package/dist/{time-actions-XEUQ3UF7.js.map → time-actions-YOXF5WC7.js.map} +0 -0
  372. /package/dist/{todo-23COLGR2.js.map → todo-TALKJYK6.js.map} +0 -0
@@ -0,0 +1,199 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ programPath
4
+ } from "./chunk-EL3XL2OC.js";
5
+
6
+ // src/core/platform/process.ts
7
+ import fs from "fs";
8
+ import os from "os";
9
+ import { execFile, spawn, spawnSync } from "child_process";
10
+ function detachHere(platform = process.platform) {
11
+ return platform !== "win32";
12
+ }
13
+ function isPidAlive(pid) {
14
+ try {
15
+ process.kill(pid, 0);
16
+ } catch {
17
+ return false;
18
+ }
19
+ return !isZombie(pid);
20
+ }
21
+ function isZombie(pid, read = procFs, platform = process.platform) {
22
+ if (platform !== "linux") return false;
23
+ const stat = read.file(`/proc/${pid}/stat`) ?? "";
24
+ const close = stat.lastIndexOf(")");
25
+ return close >= 0 && stat[close + 2] === "Z";
26
+ }
27
+ var procFs = {
28
+ link: (p) => {
29
+ try {
30
+ return fs.readlinkSync(p);
31
+ } catch {
32
+ return null;
33
+ }
34
+ },
35
+ file: (p) => {
36
+ try {
37
+ return fs.readFileSync(p, "utf-8");
38
+ } catch {
39
+ return null;
40
+ }
41
+ },
42
+ pids: () => {
43
+ try {
44
+ return fs.readdirSync("/proc").filter((n) => /^\d+$/.test(n)).map(Number);
45
+ } catch {
46
+ return [];
47
+ }
48
+ }
49
+ };
50
+ var baseName = (p) => p.split("/").pop() || p;
51
+ function linuxProcessName(pid, read = procFs) {
52
+ const exe = read.link(`/proc/${pid}/exe`);
53
+ if (exe) return baseName(exe.replace(/ \(deleted\)$/, ""));
54
+ const argv0 = (read.file(`/proc/${pid}/cmdline`) ?? "").split("\0")[0];
55
+ if (argv0) return baseName(argv0.split(" ")[0]);
56
+ const comm = (read.file(`/proc/${pid}/comm`) ?? "").trim();
57
+ return comm || null;
58
+ }
59
+ function linuxProcessTable(read = procFs) {
60
+ const out = /* @__PURE__ */ new Map();
61
+ for (const pid of read.pids()) {
62
+ const name = linuxProcessName(pid, read);
63
+ if (name) out.set(pid, name);
64
+ }
65
+ return out;
66
+ }
67
+ function processName(pid) {
68
+ try {
69
+ if (process.platform === "win32") {
70
+ const r2 = spawnSync(programPath("tasklist"), ["/FI", `PID eq ${pid}`, "/FO", "CSV", "/NH"], {
71
+ encoding: "utf-8",
72
+ windowsHide: true,
73
+ timeout: 5e3
74
+ });
75
+ const m = /^"([^"]+)","(\d+)"/.exec((r2.stdout ?? "").trim());
76
+ return m && Number(m[2]) === pid ? m[1] : null;
77
+ }
78
+ if (process.platform === "linux") return isPidAlive(pid) ? linuxProcessName(pid) : null;
79
+ const r = spawnSync(programPath("ps"), ["-o", "comm=", "-p", String(pid)], { encoding: "utf-8", timeout: 5e3, windowsHide: true });
80
+ const name = (r.stdout ?? "").trim();
81
+ return r.status === 0 && name ? name.split("/").pop() : null;
82
+ } catch {
83
+ return null;
84
+ }
85
+ }
86
+ var recentTable = null;
87
+ var refreshingTable = null;
88
+ function recentProcessTable(maxAgeMs, now = Date.now()) {
89
+ if (!recentTable || now - recentTable.at >= maxAgeMs) {
90
+ refreshingTable ??= processTableAsync().then((table) => void (table.size > 0 && (recentTable = { at: Date.now(), table }))).finally(() => void (refreshingTable = null));
91
+ }
92
+ return recentTable?.table ?? null;
93
+ }
94
+ function processTableAsync() {
95
+ if (process.platform === "linux") return Promise.resolve(linuxProcessTable());
96
+ return new Promise((resolve) => {
97
+ const win = process.platform === "win32";
98
+ const [cmd, args] = win ? ["tasklist", ["/FO", "CSV", "/NH"]] : ["ps", ["-A", "-o", "pid=,comm="]];
99
+ execFile(
100
+ programPath(cmd),
101
+ args,
102
+ { encoding: "utf-8", windowsHide: true, timeout: 8e3, maxBuffer: 16 * 1024 * 1024 },
103
+ (_err, stdout) => {
104
+ resolve(parseProcessTable(stdout ?? "", win));
105
+ }
106
+ );
107
+ });
108
+ }
109
+ function parseProcessTable(stdout, win) {
110
+ const out = /* @__PURE__ */ new Map();
111
+ for (const line of stdout.split(/\r?\n/)) {
112
+ if (win) {
113
+ const m = /^"([^"]+)","(\d+)"/.exec(line);
114
+ if (m) out.set(Number(m[2]), m[1]);
115
+ } else {
116
+ const m = /^\s*(\d+)\s+(.+)$/.exec(line);
117
+ if (m) out.set(Number(m[1]), m[2].trim().split("/").pop());
118
+ }
119
+ }
120
+ return out;
121
+ }
122
+ function processTable() {
123
+ if (process.platform === "linux") return linuxProcessTable();
124
+ try {
125
+ const win = process.platform === "win32";
126
+ const r = win ? spawnSync(programPath("tasklist"), ["/FO", "CSV", "/NH"], {
127
+ encoding: "utf-8",
128
+ windowsHide: true,
129
+ timeout: 8e3,
130
+ maxBuffer: 16 * 1024 * 1024
131
+ }) : spawnSync(programPath("ps"), ["-A", "-o", "pid=,comm="], {
132
+ encoding: "utf-8",
133
+ timeout: 8e3,
134
+ windowsHide: true,
135
+ maxBuffer: 16 * 1024 * 1024
136
+ });
137
+ return parseProcessTable(r.stdout ?? "", win);
138
+ } catch {
139
+ return /* @__PURE__ */ new Map();
140
+ }
141
+ }
142
+ function bootTime() {
143
+ return Date.now() - os.uptime() * 1e3;
144
+ }
145
+ function killTree(pid) {
146
+ if (process.platform === "win32") {
147
+ return spawnSync(programPath("taskkill"), ["/PID", String(pid), "/T", "/F"], { stdio: "ignore", windowsHide: true }).status === 0;
148
+ }
149
+ try {
150
+ process.kill(pid);
151
+ return true;
152
+ } catch {
153
+ return false;
154
+ }
155
+ }
156
+ function killTreeAsync(pid) {
157
+ if (process.platform !== "win32") return Promise.resolve(killTree(pid) || !isPidAlive(pid));
158
+ return new Promise(
159
+ (resolve) => (
160
+ // taskkill fails the whole call when one child had already exited or won't go; the top gone is what counts.
161
+ execFile(
162
+ programPath("taskkill"),
163
+ ["/PID", String(pid), "/T", "/F"],
164
+ { windowsHide: true, timeout: 1e4 },
165
+ (err) => resolve(!err || !isPidAlive(pid))
166
+ )
167
+ )
168
+ );
169
+ }
170
+ function spawnDetachedWork(workBin, args, logFile) {
171
+ const log = fs.openSync(logFile, "a");
172
+ try {
173
+ const child = spawn(process.execPath, [workBin, ...args], {
174
+ detached: true,
175
+ stdio: ["ignore", log, log],
176
+ windowsHide: true,
177
+ // Not the caller's folder: a long-lived server working from it keeps it
178
+ // in use on Windows — a worktree then can't be removed, the desktop
179
+ // app's install folder can't be updated.
180
+ cwd: os.homedir()
181
+ });
182
+ child.unref();
183
+ } finally {
184
+ fs.closeSync(log);
185
+ }
186
+ }
187
+
188
+ export {
189
+ detachHere,
190
+ isPidAlive,
191
+ processName,
192
+ recentProcessTable,
193
+ processTable,
194
+ bootTime,
195
+ killTree,
196
+ killTreeAsync,
197
+ spawnDetachedWork
198
+ };
199
+ //# sourceMappingURL=chunk-63ZLPXRL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/platform/process.ts"],"sourcesContent":["import fs from 'node:fs';\nimport os from 'node:os';\nimport { execFile, spawn, spawnSync } from 'node:child_process';\nimport { programPath } from './program-path.js';\n\n/**\n * Process lifecycle rules for the long-lived pieces (work web, the PTY\n * host), in one place — they differ on Windows in ways that bit us:\n *\n * - Killing: process.kill on Windows is TerminateProcess of that one\n * process — its ConPTY children (Claudes) survive, orphaned. Kill the\n * tree with taskkill /T /F. Elsewhere SIGTERM lets the process clean up\n * its own children.\n * - Liveness: `process.kill(pid, 0)` works on both, but a live PID is not\n * proof it's OURS (Windows reuses PIDs fast) — callers that act on it\n * must also verify identity (e.g. the host's /health token check).\n * - Detached `work` children: `detached` + `windowsHide` so no console\n * window flashes and the child outlives the parent's terminal; output\n * goes to a log file, never the parent's stdio.\n * - Anything else started in the background (an editor, a URL, a toast, a\n * status hook): `detached` on POSIX only (`detachHere`). On Windows a\n * detached process has no console at all, so every console program it\n * starts — cmd.exe running code.cmd, PowerShell — opens a window of its\n * own, and `windowsHide` can't stop that (measured: detached flashed a\n * Windows Terminal window every time, hidden alone never). A child there\n * outlives its parent anyway.\n */\n\n/** Start a background program detached? POSIX yes (its own process group); Windows no — see above. */\nexport function detachHere(platform: NodeJS.Platform = process.platform): boolean {\n return platform !== 'win32';\n}\n\nexport function isPidAlive(pid: number): boolean {\n try {\n process.kill(pid, 0);\n } catch {\n return false;\n }\n return !isZombie(pid);\n}\n\n/**\n * Exited, but not yet collected by its parent (a zombie): `kill(pid, 0)` still\n * succeeds, though nothing runs. A server started by a parent that never\n * waits for it — the desktop app's work web, or a test's child while the test\n * blocks in spawnSync — is one once it stops, and `work web --dev --stop`\n * waited for it to go, then said it didn't. Linux only (/proc/<pid>/stat: the\n * state letter after the command's closing parenthesis); elsewhere false.\n */\nexport function isZombie(pid: number, read: Pick<ProcReader, 'file'> = procFs, platform: NodeJS.Platform = process.platform): boolean {\n if (platform !== 'linux') return false;\n const stat = read.file(`/proc/${pid}/stat`) ?? '';\n // The state follows the command name, which is in parentheses and may hold some.\n const close = stat.lastIndexOf(')');\n return close >= 0 && stat[close + 2] === 'Z';\n}\n\n/** How /proc is read (tests pass a fake one). */\nexport interface ProcReader {\n link: (p: string) => string | null;\n file: (p: string) => string | null;\n pids: () => number[];\n}\n\nconst procFs: ProcReader = {\n link: (p) => {\n try {\n return fs.readlinkSync(p);\n } catch {\n return null;\n }\n },\n file: (p) => {\n try {\n return fs.readFileSync(p, 'utf-8');\n } catch {\n return null;\n }\n },\n pids: () => {\n try {\n return fs\n .readdirSync('/proc')\n .filter((n) => /^\\d+$/.test(n))\n .map(Number);\n } catch {\n return [];\n }\n },\n};\n\nconst baseName = (p: string) => p.split('/').pop() || p;\n\n/**\n * On Linux, the program a process runs, from /proc: its executable when it\n * can be read (our own processes), else its command line's first word, else\n * its `comm`. Not `ps -o comm` alone: that is its main thread's name, which\n * Node 24 sets to \"MainThread\" — every node process, Claude Code's included,\n * read as that, and no Claude was ever found running.\n */\nexport function linuxProcessName(pid: number, read: ProcReader = procFs): string | null {\n const exe = read.link(`/proc/${pid}/exe`);\n if (exe) return baseName(exe.replace(/ \\(deleted\\)$/, ''));\n const argv0 = (read.file(`/proc/${pid}/cmdline`) ?? '').split('\\0')[0];\n if (argv0) return baseName(argv0.split(' ')[0]);\n const comm = (read.file(`/proc/${pid}/comm`) ?? '').trim();\n return comm || null;\n}\n\n/** On Linux, every process's program by pid (linuxProcessName), from /proc: no `ps` to run. */\nexport function linuxProcessTable(read: ProcReader = procFs): Map<number, string> {\n const out = new Map<number, string>();\n for (const pid of read.pids()) {\n const name = linuxProcessName(pid, read);\n if (name) out.set(pid, name);\n }\n return out;\n}\n\n/**\n * The executable name of a live process (\"cmd.exe\", \"sh\"), or null if it\n * isn't running or can't be read. For checking a remembered pid is still\n * the process we started before acting on it — pids get reused.\n */\nexport function processName(pid: number): string | null {\n try {\n if (process.platform === 'win32') {\n const r = spawnSync(programPath('tasklist'), ['/FI', `PID eq ${pid}`, '/FO', 'CSV', '/NH'], {\n encoding: 'utf-8',\n windowsHide: true,\n timeout: 5000,\n });\n const m = /^\"([^\"]+)\",\"(\\d+)\"/.exec((r.stdout ?? '').trim());\n return m && Number(m[2]) === pid ? m[1] : null;\n }\n if (process.platform === 'linux') return isPidAlive(pid) ? linuxProcessName(pid) : null;\n const r = spawnSync(programPath('ps'), ['-o', 'comm=', '-p', String(pid)], { encoding: 'utf-8', timeout: 5000, windowsHide: true });\n const name = (r.stdout ?? '').trim();\n return r.status === 0 && name ? name.split('/').pop()! : null;\n } catch {\n return null;\n }\n}\n\nlet recentTable: { at: number; table: Map<number, string> } | null = null;\nlet refreshingTable: Promise<void> | null = null;\n\n/**\n * The process table as of at most `maxAgeMs` ago, without waiting: a stale\n * or missing one starts a background refresh (one at a time) and the last\n * one is returned — null before the first is in. For views that refresh\n * often (the session list); a decision that must be right now (is a Claude\n * already running, before starting one?) uses processTable().\n */\nexport function recentProcessTable(maxAgeMs: number, now = Date.now()): Map<number, string> | null {\n if (!recentTable || now - recentTable.at >= maxAgeMs) {\n refreshingTable ??= processTableAsync()\n // An empty table is a failed or timed-out listing (there is always at\n // least this process): keep the last good one, and try again next time.\n .then((table) => void (table.size > 0 && (recentTable = { at: Date.now(), table })))\n .finally(() => void (refreshingTable = null));\n }\n return recentTable?.table ?? null;\n}\n\n/** processTable(), without blocking the event loop. */\nexport function processTableAsync(): Promise<Map<number, string>> {\n if (process.platform === 'linux') return Promise.resolve(linuxProcessTable());\n return new Promise((resolve) => {\n const win = process.platform === 'win32';\n const [cmd, args] = win ? ['tasklist', ['/FO', 'CSV', '/NH']] : ['ps', ['-A', '-o', 'pid=,comm=']];\n execFile(\n programPath(cmd as string),\n args as string[],\n { encoding: 'utf-8', windowsHide: true, timeout: 8000, maxBuffer: 16 * 1024 * 1024 },\n (_err, stdout) => {\n resolve(parseProcessTable(stdout ?? '', win));\n },\n );\n });\n}\n\nfunction parseProcessTable(stdout: string, win: boolean): Map<number, string> {\n const out = new Map<number, string>();\n for (const line of stdout.split(/\\r?\\n/)) {\n if (win) {\n const m = /^\"([^\"]+)\",\"(\\d+)\"/.exec(line);\n if (m) out.set(Number(m[2]), m[1]);\n } else {\n const m = /^\\s*(\\d+)\\s+(.+)$/.exec(line);\n if (m) out.set(Number(m[1]), m[2].trim().split('/').pop()!);\n }\n }\n return out;\n}\n\n/**\n * Every running process's executable name, by pid, in ONE call (tasklist /\n * ps) — for checking many remembered pids at once. Empty if it can't be read.\n */\nexport function processTable(): Map<number, string> {\n if (process.platform === 'linux') return linuxProcessTable();\n try {\n const win = process.platform === 'win32';\n const r = win\n ? spawnSync(programPath('tasklist'), ['/FO', 'CSV', '/NH'], {\n encoding: 'utf-8',\n windowsHide: true,\n timeout: 8000,\n maxBuffer: 16 * 1024 * 1024,\n })\n : spawnSync(programPath('ps'), ['-A', '-o', 'pid=,comm='], {\n encoding: 'utf-8',\n timeout: 8000,\n windowsHide: true,\n maxBuffer: 16 * 1024 * 1024,\n });\n return parseProcessTable(r.stdout ?? '', win);\n } catch {\n return new Map(); // unreadable: nothing is known to be alive\n }\n}\n\n/** When this machine last booted (ms since epoch, ±1 s). */\nexport function bootTime(): number {\n return Date.now() - os.uptime() * 1000;\n}\n\n/** Kill a process AND its children. True if the kill was delivered. */\nexport function killTree(pid: number): boolean {\n if (process.platform === 'win32') {\n return spawnSync(programPath('taskkill'), ['/PID', String(pid), '/T', '/F'], { stdio: 'ignore', windowsHide: true }).status === 0;\n }\n try {\n process.kill(pid);\n return true;\n } catch {\n return false;\n }\n}\n\n/** killTree, not blocking the event loop (taskkill takes a few hundred ms): for a server killing several at once. */\nexport function killTreeAsync(pid: number): Promise<boolean> {\n // Already gone counts as stopped, as with taskkill below: it's what the caller wanted.\n if (process.platform !== 'win32') return Promise.resolve(killTree(pid) || !isPidAlive(pid));\n return new Promise((resolve) =>\n // taskkill fails the whole call when one child had already exited or won't go; the top gone is what counts.\n execFile(programPath('taskkill'), ['/PID', String(pid), '/T', '/F'], { windowsHide: true, timeout: 10_000 }, (err) =>\n resolve(!err || !isPidAlive(pid)),\n ),\n );\n}\n\n/**\n * Start `node <workBin> ...args` detached, appending its output to\n * `logFile`. Returns immediately; the caller polls for readiness (a\n * discovery file / health check), because a detached child can't report\n * back directly.\n */\nexport function spawnDetachedWork(workBin: string, args: string[], logFile: string): void {\n const log = fs.openSync(logFile, 'a');\n try {\n const child = spawn(process.execPath, [workBin, ...args], {\n detached: true,\n stdio: ['ignore', log, log],\n windowsHide: true,\n // Not the caller's folder: a long-lived server working from it keeps it\n // in use on Windows — a worktree then can't be removed, the desktop\n // app's install folder can't be updated.\n cwd: os.homedir(),\n });\n child.unref();\n } finally {\n fs.closeSync(log);\n }\n}\n"],"mappings":";;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,QAAQ;AACf,SAAS,UAAU,OAAO,iBAAiB;AA2BpC,SAAS,WAAW,WAA4B,QAAQ,UAAmB;AAChF,SAAO,aAAa;AACtB;AAEO,SAAS,WAAW,KAAsB;AAC/C,MAAI;AACF,YAAQ,KAAK,KAAK,CAAC;AAAA,EACrB,QAAQ;AACN,WAAO;AAAA,EACT;AACA,SAAO,CAAC,SAAS,GAAG;AACtB;AAUO,SAAS,SAAS,KAAa,OAAiC,QAAQ,WAA4B,QAAQ,UAAmB;AACpI,MAAI,aAAa,QAAS,QAAO;AACjC,QAAM,OAAO,KAAK,KAAK,SAAS,GAAG,OAAO,KAAK;AAE/C,QAAM,QAAQ,KAAK,YAAY,GAAG;AAClC,SAAO,SAAS,KAAK,KAAK,QAAQ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GAAG;AAAA,EAClB;AACF;","names":["r"]}
@@ -25,10 +25,26 @@ function resetPhrase(resetsAt, now) {
25
25
  const d = new Date(at);
26
26
  return at - now < 24 * 36e5 ? `resets ${clock(d)}` : `resets ${WEEKDAYS[d.getDay()]} ${clock(d)}`;
27
27
  }
28
+ function ageText(ms) {
29
+ const min = Math.round(ms / 6e4);
30
+ if (min < 1) return "just now";
31
+ if (min < 60) return `${min} min ago`;
32
+ const h = Math.round(min / 60);
33
+ if (h < 48) return `${h} h ago`;
34
+ return `${Math.round(h / 24)} days ago`;
35
+ }
36
+ function usageText(reading, now) {
37
+ if (!reading || reading.windows.length === 0) return "no usage reading yet";
38
+ const windows = reading.windows.map((w) => `${w.label} ${Math.round(agedWindow(w, now).usedPercent)}%`);
39
+ const at = Date.parse(reading.at);
40
+ return [...windows, Number.isFinite(at) ? `read ${ageText(now - at)}` : ""].filter(Boolean).join(" \xB7 ");
41
+ }
28
42
 
29
43
  export {
30
44
  agedWindow,
31
45
  formatTokens,
32
- resetPhrase
46
+ resetPhrase,
47
+ ageText,
48
+ usageText
33
49
  };
34
- //# sourceMappingURL=chunk-P2HOLCBF.js.map
50
+ //# sourceMappingURL=chunk-6UTH3A76.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/core/usage/usage.ts"],"sourcesContent":["// What an agent's plan limits look like (5-hour, weekly, spend) and how work shows them. Pure and agent-neutral: the SPA and the demo import it (each agent parses its own, e.g. agents/claude/rate-limits.ts).\n\nexport interface UsageWindow {\n id: string;\n label: string;\n usedPercent: number;\n /** ISO time the window resets; null when the agent didn't say. */\n resetsAt: string | null;\n /** Set when the reset time has passed since the reading: the percent is shown as 0. */\n reset?: true;\n}\n\n/** One account's last reading of an agent's plan limits (each config folder an agent runs with is an account). */\nexport interface UsageAccount {\n /** The account's name (the agent's own, e.g. a Claude account in config `claudeAccounts`; `default`), or the key a reading was kept under when it names none. */\n account: string;\n /** The account new sessions use (set on the one only). */\n isDefault?: true;\n at: string;\n windows: UsageWindow[];\n}\n\n/** An agent's readings, one per account: what the meter picks from. */\nexport interface AgentUsage {\n agent: string;\n name: string;\n accounts: UsageAccount[];\n}\n\n/** A window whose reset has passed since it was read starts over at 0. */\nexport function agedWindow(w: UsageWindow, now: number): UsageWindow {\n if (w.resetsAt === null) return w;\n const at = Date.parse(w.resetsAt);\n if (!Number.isFinite(at) || at > now) return w;\n return { ...w, usedPercent: 0, reset: true };\n}\n\n/** The window closest to its limit across every agent and account, for the top bar. Ties go to the one resetting later. */\nexport function meterWindow(\n agents: AgentUsage[],\n now: number,\n): { agent: string; name: string; account: string; window: UsageWindow } | null {\n let best: { agent: string; name: string; account: string; window: UsageWindow } | null = null;\n const resetMs = (w: UsageWindow) => (w.resetsAt === null ? -Infinity : Date.parse(w.resetsAt) || -Infinity);\n for (const a of agents) {\n for (const acc of a.accounts) {\n for (const raw of acc.windows) {\n const window = agedWindow(raw, now);\n if (\n !best ||\n window.usedPercent > best.window.usedPercent ||\n (window.usedPercent === best.window.usedPercent && resetMs(window) > resetMs(best.window))\n ) {\n best = { agent: a.agent, name: a.name, account: acc.account, window };\n }\n }\n }\n }\n return best;\n}\n\n/** 273, 1.7k, 48k, 1.6M, 48M, 1.2B: the size of a token count, short enough for a panel row. */\nexport function formatTokens(n: number): string {\n const one = (v: number) => String(Math.round(v * 10) / 10);\n const x = Math.max(0, Math.round(n));\n if (x < 1e3) return String(x);\n if (x < 1e4) return `${one(x / 1e3)}k`;\n if (Math.round(x / 1e3) < 1e3) return `${Math.round(x / 1e3)}k`;\n if (x < 1e7) return `${one(x / 1e6)}M`;\n if (Math.round(x / 1e6) < 1e3) return `${Math.round(x / 1e6)}M`;\n return `${one(x / 1e9)}B`;\n}\n\nconst WEEKDAYS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];\nconst clock = (d: Date) => `${String(d.getHours()).padStart(2, '0')}:${String(d.getMinutes()).padStart(2, '0')}`;\n\n/** \"resets 15:10\" within a day, \"resets Mon 09:00\" after that (local time); '' when there is no valid time. */\nexport function resetPhrase(resetsAt: string | null, now: number): string {\n const at = resetsAt ? Date.parse(resetsAt) : NaN;\n if (!Number.isFinite(at)) return '';\n const d = new Date(at);\n return at - now < 24 * 3_600_000 ? `resets ${clock(d)}` : `resets ${WEEKDAYS[d.getDay()]} ${clock(d)}`;\n}\n"],"mappings":";;;AA8BO,SAAS,WAAW,GAAgB,KAA0B;AACnE,MAAI,EAAE,aAAa,KAAM,QAAO;AAChC,QAAM,KAAK,KAAK,MAAM,EAAE,QAAQ;AAChC,MAAI,CAAC,OAAO,SAAS,EAAE,KAAK,KAAK,IAAK,QAAO;AAC7C,SAAO,EAAE,GAAG,GAAG,aAAa,GAAG,OAAO,KAAK;AAC7C;AA2BO,SAAS,aAAa,GAAmB;AAC9C,QAAM,MAAM,CAAC,MAAc,OAAO,KAAK,MAAM,IAAI,EAAE,IAAI,EAAE;AACzD,QAAM,IAAI,KAAK,IAAI,GAAG,KAAK,MAAM,CAAC,CAAC;AACnC,MAAI,IAAI,IAAK,QAAO,OAAO,CAAC;AAC5B,MAAI,IAAI,IAAK,QAAO,GAAG,IAAI,IAAI,GAAG,CAAC;AACnC,MAAI,KAAK,MAAM,IAAI,GAAG,IAAI,IAAK,QAAO,GAAG,KAAK,MAAM,IAAI,GAAG,CAAC;AAC5D,MAAI,IAAI,IAAK,QAAO,GAAG,IAAI,IAAI,GAAG,CAAC;AACnC,MAAI,KAAK,MAAM,IAAI,GAAG,IAAI,IAAK,QAAO,GAAG,KAAK,MAAM,IAAI,GAAG,CAAC;AAC5D,SAAO,GAAG,IAAI,IAAI,GAAG,CAAC;AACxB;AAEA,IAAM,WAAW,CAAC,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,KAAK;AACjE,IAAM,QAAQ,CAAC,MAAY,GAAG,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC,IAAI,OAAO,EAAE,WAAW,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;AAGvG,SAAS,YAAY,UAAyB,KAAqB;AACxE,QAAM,KAAK,WAAW,KAAK,MAAM,QAAQ,IAAI;AAC7C,MAAI,CAAC,OAAO,SAAS,EAAE,EAAG,QAAO;AACjC,QAAM,IAAI,IAAI,KAAK,EAAE;AACrB,SAAO,KAAK,MAAM,KAAK,OAAY,UAAU,MAAM,CAAC,CAAC,KAAK,UAAU,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC;AACtG;","names":[]}
1
+ {"version":3,"sources":["../src/core/usage/usage.ts"],"sourcesContent":["// What an agent's plan limits look like (5-hour, weekly, spend) and how work shows them. Pure and agent-neutral: the SPA and the demo import it (each agent parses its own, e.g. agents/claude/rate-limits.ts).\n\nexport interface UsageWindow {\n id: string;\n label: string;\n usedPercent: number;\n /** ISO time the window resets; null when the agent didn't say. */\n resetsAt: string | null;\n /** Set when the reset time has passed since the reading: the percent is shown as 0. */\n reset?: true;\n}\n\n/** One account's last reading of an agent's plan limits (each config folder an agent runs with is an account). */\nexport interface UsageAccount {\n /** The account's name (the agent's own, e.g. a Claude account in config `claudeAccounts`; `default`), or the key a reading was kept under when it names none. */\n account: string;\n /** The account new sessions use (set on the one only). */\n isDefault?: true;\n at: string;\n windows: UsageWindow[];\n}\n\n/** An agent's readings, one per account: what the meter picks from. */\nexport interface AgentUsage {\n agent: string;\n name: string;\n accounts: UsageAccount[];\n}\n\n/** A window whose reset has passed since it was read starts over at 0. */\nexport function agedWindow(w: UsageWindow, now: number): UsageWindow {\n if (w.resetsAt === null) return w;\n const at = Date.parse(w.resetsAt);\n if (!Number.isFinite(at) || at > now) return w;\n return { ...w, usedPercent: 0, reset: true };\n}\n\n/** The window closest to its limit across every agent and account, for the top bar. Ties go to the one resetting later. */\nexport function meterWindow(\n agents: AgentUsage[],\n now: number,\n): { agent: string; name: string; account: string; window: UsageWindow } | null {\n let best: { agent: string; name: string; account: string; window: UsageWindow } | null = null;\n const resetMs = (w: UsageWindow) => (w.resetsAt === null ? -Infinity : Date.parse(w.resetsAt) || -Infinity);\n for (const a of agents) {\n for (const acc of a.accounts) {\n for (const raw of acc.windows) {\n const window = agedWindow(raw, now);\n if (\n !best ||\n window.usedPercent > best.window.usedPercent ||\n (window.usedPercent === best.window.usedPercent && resetMs(window) > resetMs(best.window))\n ) {\n best = { agent: a.agent, name: a.name, account: acc.account, window };\n }\n }\n }\n }\n return best;\n}\n\n/** 273, 1.7k, 48k, 1.6M, 48M, 1.2B: the size of a token count, short enough for a panel row. */\nexport function formatTokens(n: number): string {\n const one = (v: number) => String(Math.round(v * 10) / 10);\n const x = Math.max(0, Math.round(n));\n if (x < 1e3) return String(x);\n if (x < 1e4) return `${one(x / 1e3)}k`;\n if (Math.round(x / 1e3) < 1e3) return `${Math.round(x / 1e3)}k`;\n if (x < 1e7) return `${one(x / 1e6)}M`;\n if (Math.round(x / 1e6) < 1e3) return `${Math.round(x / 1e6)}M`;\n return `${one(x / 1e9)}B`;\n}\n\nconst WEEKDAYS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];\nconst clock = (d: Date) => `${String(d.getHours()).padStart(2, '0')}:${String(d.getMinutes()).padStart(2, '0')}`;\n\n/** \"resets 15:10\" within a day, \"resets Mon 09:00\" after that (local time); '' when there is no valid time. */\nexport function resetPhrase(resetsAt: string | null, now: number): string {\n const at = resetsAt ? Date.parse(resetsAt) : NaN;\n if (!Number.isFinite(at)) return '';\n const d = new Date(at);\n return at - now < 24 * 3_600_000 ? `resets ${clock(d)}` : `resets ${WEEKDAYS[d.getDay()]} ${clock(d)}`;\n}\n\n/** How long ago, in a few words (\"3 min ago\"). */\nexport function ageText(ms: number): string {\n const min = Math.round(ms / 60_000);\n if (min < 1) return 'just now';\n if (min < 60) return `${min} min ago`;\n const h = Math.round(min / 60);\n if (h < 48) return `${h} h ago`;\n return `${Math.round(h / 24)} days ago`;\n}\n\n/** An account's last reading in a line (\"5-hour limit 42% · Weekly limit 18% · read 3 min ago\"); a window past its reset reads 0. */\nexport function usageText(reading: Pick<UsageAccount, 'at' | 'windows'> | null | undefined, now: number): string {\n if (!reading || reading.windows.length === 0) return 'no usage reading yet';\n const windows = reading.windows.map((w) => `${w.label} ${Math.round(agedWindow(w, now).usedPercent)}%`);\n const at = Date.parse(reading.at);\n return [...windows, Number.isFinite(at) ? `read ${ageText(now - at)}` : ''].filter(Boolean).join(' · ');\n}\n"],"mappings":";;;AA8BO,SAAS,WAAW,GAAgB,KAA0B;AACnE,MAAI,EAAE,aAAa,KAAM,QAAO;AAChC,QAAM,KAAK,KAAK,MAAM,EAAE,QAAQ;AAChC,MAAI,CAAC,OAAO,SAAS,EAAE,KAAK,KAAK,IAAK,QAAO;AAC7C,SAAO,EAAE,GAAG,GAAG,aAAa,GAAG,OAAO,KAAK;AAC7C;AA2BO,SAAS,aAAa,GAAmB;AAC9C,QAAM,MAAM,CAAC,MAAc,OAAO,KAAK,MAAM,IAAI,EAAE,IAAI,EAAE;AACzD,QAAM,IAAI,KAAK,IAAI,GAAG,KAAK,MAAM,CAAC,CAAC;AACnC,MAAI,IAAI,IAAK,QAAO,OAAO,CAAC;AAC5B,MAAI,IAAI,IAAK,QAAO,GAAG,IAAI,IAAI,GAAG,CAAC;AACnC,MAAI,KAAK,MAAM,IAAI,GAAG,IAAI,IAAK,QAAO,GAAG,KAAK,MAAM,IAAI,GAAG,CAAC;AAC5D,MAAI,IAAI,IAAK,QAAO,GAAG,IAAI,IAAI,GAAG,CAAC;AACnC,MAAI,KAAK,MAAM,IAAI,GAAG,IAAI,IAAK,QAAO,GAAG,KAAK,MAAM,IAAI,GAAG,CAAC;AAC5D,SAAO,GAAG,IAAI,IAAI,GAAG,CAAC;AACxB;AAEA,IAAM,WAAW,CAAC,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,KAAK;AACjE,IAAM,QAAQ,CAAC,MAAY,GAAG,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC,IAAI,OAAO,EAAE,WAAW,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;AAGvG,SAAS,YAAY,UAAyB,KAAqB;AACxE,QAAM,KAAK,WAAW,KAAK,MAAM,QAAQ,IAAI;AAC7C,MAAI,CAAC,OAAO,SAAS,EAAE,EAAG,QAAO;AACjC,QAAM,IAAI,IAAI,KAAK,EAAE;AACrB,SAAO,KAAK,MAAM,KAAK,OAAY,UAAU,MAAM,CAAC,CAAC,KAAK,UAAU,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC;AACtG;AAGO,SAAS,QAAQ,IAAoB;AAC1C,QAAM,MAAM,KAAK,MAAM,KAAK,GAAM;AAClC,MAAI,MAAM,EAAG,QAAO;AACpB,MAAI,MAAM,GAAI,QAAO,GAAG,GAAG;AAC3B,QAAM,IAAI,KAAK,MAAM,MAAM,EAAE;AAC7B,MAAI,IAAI,GAAI,QAAO,GAAG,CAAC;AACvB,SAAO,GAAG,KAAK,MAAM,IAAI,EAAE,CAAC;AAC9B;AAGO,SAAS,UAAU,SAAkE,KAAqB;AAC/G,MAAI,CAAC,WAAW,QAAQ,QAAQ,WAAW,EAAG,QAAO;AACrD,QAAM,UAAU,QAAQ,QAAQ,IAAI,CAAC,MAAM,GAAG,EAAE,KAAK,IAAI,KAAK,MAAM,WAAW,GAAG,GAAG,EAAE,WAAW,CAAC,GAAG;AACtG,QAAM,KAAK,KAAK,MAAM,QAAQ,EAAE;AAChC,SAAO,CAAC,GAAG,SAAS,OAAO,SAAS,EAAE,IAAI,QAAQ,QAAQ,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,OAAO,OAAO,EAAE,KAAK,QAAK;AACxG;","names":[]}
@@ -6,7 +6,7 @@ import {
6
6
  json,
7
7
  tx,
8
8
  withDb
9
- } from "./chunk-YYBXQBW2.js";
9
+ } from "./chunk-RUYTU2WJ.js";
10
10
 
11
11
  // src/core/comments/comment-file-store.ts
12
12
  function isComment(x) {
@@ -137,4 +137,4 @@ export {
137
137
  getCommentFileStore,
138
138
  moveStoreComments
139
139
  };
140
- //# sourceMappingURL=chunk-5QGCF3PS.js.map
140
+ //# sourceMappingURL=chunk-7DUGVGUZ.js.map
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/core/sessions/branch-view.ts
4
+ function branchLine(b) {
5
+ const bits = [
6
+ ...b.current ? ["current"] : [],
7
+ ...b.exists === false ? ["deleted"] : [],
8
+ ...typeof b.commits === "number" && b.exists !== false ? [`${b.commits} commit${b.commits === 1 ? "" : "s"}`] : [],
9
+ ...b.exists !== false && b.pushed === false ? ["not pushed"] : b.unpushed ? [`${b.unpushed} unpushed`] : [],
10
+ ...b.pr ? [`PR #${b.pr.number} ${b.pr.state.toLowerCase()}`] : b.merged ? ["merged"] : []
11
+ ];
12
+ return `${b.name}${bits.length ? ` (${bits.join(", ")})` : ""}`;
13
+ }
14
+ function branchesText(branches, isGroup) {
15
+ return branches.map((b) => `${isGroup ? `${b.repo}: ` : ""}${branchLine(b)}`).join(" \xB7 ");
16
+ }
17
+
18
+ export {
19
+ branchLine,
20
+ branchesText
21
+ };
22
+ //# sourceMappingURL=chunk-7E5XPDKX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/sessions/branch-view.ts"],"sourcesContent":["import type { SessionBranchWire } from '../api-types.js';\n\n/**\n * A session's branches (session-branches.ts) in words, for `work sessions`, `work status` and the Ctrl+K\n * assistant's description. Pure, import-free but for types.\n */\n\n/** One branch in a word or two: \"fix/x (current, 1 commit, not pushed)\", \"feat/y (PR #12 merged)\". */\nexport function branchLine(b: SessionBranchWire): string {\n const bits = [\n ...(b.current ? ['current'] : []),\n ...(b.exists === false ? ['deleted'] : []),\n ...(typeof b.commits === 'number' && b.exists !== false ? [`${b.commits} commit${b.commits === 1 ? '' : 's'}`] : []),\n ...(b.exists !== false && b.pushed === false ? ['not pushed'] : b.unpushed ? [`${b.unpushed} unpushed`] : []),\n ...(b.pr ? [`PR #${b.pr.number} ${b.pr.state.toLowerCase()}`] : b.merged ? ['merged'] : []),\n ];\n return `${b.name}${bits.length ? ` (${bits.join(', ')})` : ''}`;\n}\n\n/** Every branch, repo by repo for a group: \"branches: fix/x (current, …) · feat/y (PR #12 merged)\". */\nexport function branchesText(branches: SessionBranchWire[], isGroup: boolean): string {\n return branches.map((b) => `${isGroup ? `${b.repo}: ` : ''}${branchLine(b)}`).join(' · ');\n}\n\n/** Another branch in Ship's dialog: \"fix/y — 2 commits, not pushed · PR #14 open\". */\nexport function otherBranchFact(b: {\n name: string;\n exists: boolean;\n pushed: boolean;\n commits: number | null;\n unpushed: number | null;\n merged: boolean;\n pr: { number: number; state: string } | null;\n ghError?: string;\n}): string {\n const bits: string[] = [];\n if (!b.exists) bits.push('deleted');\n else {\n if (typeof b.commits === 'number') bits.push(`${b.commits} commit${b.commits === 1 ? '' : 's'}`);\n if (!b.pushed) bits.push('not pushed');\n else if (b.unpushed) bits.push(`${b.unpushed} unpushed`);\n }\n if (b.pr) bits.push(`PR #${b.pr.number} ${b.pr.state.toLowerCase()}`);\n else if (b.merged) bits.push('merged');\n if (b.ghError) bits.push(`its PR unknown: ${b.ghError}`);\n return `${b.name}${bits.length ? ` — ${bits.join(', ')}` : ''}`;\n}\n"],"mappings":";;;AAQO,SAAS,WAAW,GAA8B;AACvD,QAAM,OAAO;AAAA,IACX,GAAI,EAAE,UAAU,CAAC,SAAS,IAAI,CAAC;AAAA,IAC/B,GAAI,EAAE,WAAW,QAAQ,CAAC,SAAS,IAAI,CAAC;AAAA,IACxC,GAAI,OAAO,EAAE,YAAY,YAAY,EAAE,WAAW,QAAQ,CAAC,GAAG,EAAE,OAAO,UAAU,EAAE,YAAY,IAAI,KAAK,GAAG,EAAE,IAAI,CAAC;AAAA,IAClH,GAAI,EAAE,WAAW,SAAS,EAAE,WAAW,QAAQ,CAAC,YAAY,IAAI,EAAE,WAAW,CAAC,GAAG,EAAE,QAAQ,WAAW,IAAI,CAAC;AAAA,IAC3G,GAAI,EAAE,KAAK,CAAC,OAAO,EAAE,GAAG,MAAM,IAAI,EAAE,GAAG,MAAM,YAAY,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,QAAQ,IAAI,CAAC;AAAA,EAC3F;AACA,SAAO,GAAG,EAAE,IAAI,GAAG,KAAK,SAAS,KAAK,KAAK,KAAK,IAAI,CAAC,MAAM,EAAE;AAC/D;AAGO,SAAS,aAAa,UAA+B,SAA0B;AACpF,SAAO,SAAS,IAAI,CAAC,MAAM,GAAG,UAAU,GAAG,EAAE,IAAI,OAAO,EAAE,GAAG,WAAW,CAAC,CAAC,EAAE,EAAE,KAAK,QAAK;AAC1F;","names":[]}
@@ -1,11 +1,14 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ branchesText
4
+ } from "./chunk-7E5XPDKX.js";
2
5
  import {
3
6
  DISPLAY_LABEL,
4
7
  displayStatus
5
- } from "./chunk-OTAZOIXK.js";
8
+ } from "./chunk-PKQROEFP.js";
6
9
  import {
7
10
  atomicWriteFile
8
- } from "./chunk-ZXHMC7UO.js";
11
+ } from "./chunk-D2J3AD6L.js";
9
12
  import {
10
13
  getConfigDir
11
14
  } from "./chunk-6THUVP6T.js";
@@ -61,7 +64,7 @@ Ask before you change anything, and say exactly what will happen:
61
64
  - A day's hours: \`work timesheet set <day> KEY=HOURS \u2026\` (all its rows; quarter hours, the day's total as the user wants it), \`reset <day>\`, \`off <day>\`; several days: one command per day. Explain the change first. To look at a day again (its sessions, commits, Jira, meetings): \`work timesheet gather <day>\`, or \`gather <YYYY-MM>\` for a month's days not gathered yet. Posting to Tempo (\`work timesheet post <day>\`) only when the user asks for it.
62
65
  - Anything else (\`work remove\`, git, files in a worktree): only when asked, and show the command first.
63
66
 
64
- Don't post on GitHub, and don't send prompts to other sessions, unless the user asks. Keep answers short: the user is in the middle of something.
67
+ Don't post on a git host (comments, reviews, replies), and don't send prompts to other sessions, unless the user asks. Keep answers short: the user is in the middle of something.
65
68
  `;
66
69
  var writtenFile = () => path.join(assistantDir(), ".work-written.json");
67
70
  var BEFORE_THE_LIST = ["CLAUDE.md", path.join(".claude", "settings.json")];
@@ -100,6 +103,7 @@ function describeView(view, session, now = Date.now()) {
100
103
  ...session.diffStat?.files ? [` Uncommitted: +${session.diffStat.added} \u2212${session.diffStat.deleted} in ${session.diffStat.files} files.`] : [],
101
104
  ...session.overlaps?.length ? [` Changes the same files as: ${session.overlaps.map((o) => `${o.target} \xB7 ${o.branch}`).join(", ")}.`] : [],
102
105
  ...session.context ? [` Its conversation is ${Math.round(session.context.used / session.context.window * 100)}% full.`] : [],
106
+ ...session.branches?.length ? [` It has worked on more than one branch: ${branchesText(session.branches, session.isGroup)}.`] : [],
103
107
  ...session.archivedAt ? [" It is archived."] : [],
104
108
  ` Worktree: ${session.paths.join(", ")}`
105
109
  );
@@ -107,9 +111,15 @@ function describeView(view, session, now = Date.now()) {
107
111
  if (view.note) lines.push(view.note);
108
112
  return lines.join("\n");
109
113
  }
110
- function writeAssistantContext(text, now = Date.now(), day, month) {
114
+ function writeAssistantContext(text, now = Date.now(), day, month, review) {
111
115
  fs.mkdirSync(assistantDir(), { recursive: true });
112
- const stored = { at: new Date(now).toISOString(), text, ...day ? { day } : {}, ...month ? { month } : {} };
116
+ const stored = {
117
+ at: new Date(now).toISOString(),
118
+ text,
119
+ ...day ? { day } : {},
120
+ ...month ? { month } : {},
121
+ ...review ? { review } : {}
122
+ };
113
123
  atomicWriteFile(contextFile(), JSON.stringify(stored));
114
124
  }
115
125
  function assistantContextDay(now = Date.now()) {
@@ -120,6 +130,10 @@ function assistantContextMonth(now = Date.now()) {
120
130
  const s = readStored(now);
121
131
  return s && typeof s.month === "string" && /^\d{4}-(0[1-9]|1[0-2])$/.test(s.month) ? s.month : null;
122
132
  }
133
+ function assistantContextReview(now = Date.now()) {
134
+ const r = readStored(now)?.review;
135
+ return r && typeof r.repo === "string" && r.repo && typeof r.number === "number" && Number.isInteger(r.number) && r.number > 0 ? { repo: r.repo, number: r.number } : null;
136
+ }
123
137
  function readStored(now) {
124
138
  try {
125
139
  const s = JSON.parse(fs.readFileSync(contextFile(), "utf-8"));
@@ -144,6 +158,7 @@ export {
144
158
  writeAssistantContext,
145
159
  assistantContextDay,
146
160
  assistantContextMonth,
161
+ assistantContextReview,
147
162
  readAssistantContext
148
163
  };
149
- //# sourceMappingURL=chunk-6FVYSW3E.js.map
164
+ //# sourceMappingURL=chunk-7NNGYM3G.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/agents/assistant.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { getConfigDir } from '../platform/config.js';\nimport { atomicWriteFile } from '../platform/fs-safe.js';\nimport type { AssistantView, SessionWire } from '../api-types.js';\nimport { DISPLAY_LABEL, displayStatus } from '../sessions/session-view.js';\nimport type { AgentAdapter, AllowRule, WorkHook } from './types.js';\nimport { branchesText } from '../sessions/branch-view.js';\n\n/**\n * The dashboard assistant (Ctrl+K): a persistent agent session in the PTY\n * host, like any worktree's, with its own folder under ~/.work/assistant. It\n * runs config `assistantAgent` (Claude Code by default; `assistantAgent()`).\n *\n * That folder is written by work: the agent's instructions file (CLAUDE.md\n * for Claude) saying what it is for and how to get the data (the\n * `work … --json` commands), and through its adapter's `workspace` its own\n * settings: the read-only commands pre-allowed, and a hook at the start of\n * each turn that adds what the user is looking at in the dashboard to the\n * prompt (`work hook assistant-context`), so \"clean these up\" or \"why is this\n * one blocked?\" need no explaining. An agent without a workspace gets the\n * instructions only (it asks before every command, and sees no view).\n *\n * It runs in the agent's normal permission mode, as every session does: anything\n * not pre-allowed — `work cleanup --apply`, `work remove`, git — asks first,\n * in the panel (and the Inbox).\n */\n\nexport const ASSISTANT_ID = 'assistant';\n\n/** What the dashboard reported, kept this long for the hook. */\nexport const CONTEXT_TTL_MS = 30 * 60_000;\n\nexport function assistantDir(): string {\n return path.join(getConfigDir(), 'assistant');\n}\nconst contextFile = () => path.join(assistantDir(), 'context.json');\n\n/**\n * Read-only commands it may run without asking (each agent's adapter writes\n * them in its own terms). Exact forms for cleanup: a `work cleanup --json`\n * prefix rule would also allow `--apply`.\n */\nexport const ASSISTANT_ALLOW: AllowRule[] = [\n { command: 'work sessions', prefix: true },\n { command: 'work digest', prefix: true },\n { command: 'work overlaps', prefix: true },\n { command: 'work search', prefix: true },\n { command: 'work cleanup --json' },\n { command: 'work cleanup --json --no-fetch' },\n { command: 'work cleanup --no-fetch --json' },\n { command: 'work list', prefix: true },\n { command: 'work recent', prefix: true },\n // The Time tab's day, read only (set / reset / off / gather / post ask first).\n { command: 'work timesheet show', prefix: true },\n { command: 'work timesheet month', prefix: true },\n];\n\n/** Its hook: what the dashboard shows, added at the start of each turn. */\nexport const ASSISTANT_HOOKS: WorkHook[] = [\n { owner: 'assistant', edge: 'turn-start', command: 'work hook assistant-context', timeoutSec: 5 },\n];\n\nexport const ASSISTANT_INSTRUCTIONS = `# You are the work dashboard's assistant\n\nThe user opens you with Ctrl+K in \\`work web\\`, the dashboard over all their git worktrees and the coding agent session in each. Help them make sense of it and act on it: what needs them, what each session did, what can be cleaned up, which sessions will conflict.\n\n## Getting the data\n\nUse the \\`work\\` CLI with \\`--json\\` (see the work-sessions skill) and parse it; don't guess from the filesystem:\n\n- \\`work sessions --json\\` — every session: status (\\`view.label\\`), age, last active, context usage, archive state. \\`--changes\\` adds +N −M and same-file overlaps; \\`--all\\` adds older and archived ones.\n- \\`work digest --json --since today|yesterday|week\\` — what each session did (prompts, turns, PRs).\n- \\`work overlaps --json\\` — live sessions changing the same files.\n- \\`work cleanup --json\\` — which worktrees can go, and why.\n- \\`work timesheet show [day] --json\\` — the Time tab's day: hours per ticket, and why (sessions' Claude minutes, commits, Jira, meetings, chats). On the Time tab, the day on screen is described to you with each message.\n- \\`work timesheet month [YYYY-MM] --json\\` — a month: every day's rows with how each got its hours, the month's tickets, and what posting it would do. On the Month view, the month on screen is described to you with each message.\n- \\`work search <words> --json\\` — sessions whose conversation (live or archived, also older than the agent keeps) mentions it, with the matching lines: \"what did we do about X?\".\n\nEach prompt comes with what the user is looking at in the dashboard (the tab, the selected session). When they say \"this\", \"these\" or \"here\", that is what they mean.\n\n## Changing things\n\nAsk before you change anything, and say exactly what will happen:\n- Removing, archiving or forgetting worktrees: \\`work cleanup --apply <id>… --action delete|archive|forget --json\\`. Each is checked again right before it runs; report what was refused and why. Never \\`--force\\` unless the user asked for exactly that.\n- A day's hours: \\`work timesheet set <day> KEY=HOURS …\\` (all its rows; quarter hours, the day's total as the user wants it), \\`reset <day>\\`, \\`off <day>\\`; several days: one command per day. Explain the change first. To look at a day again (its sessions, commits, Jira, meetings): \\`work timesheet gather <day>\\`, or \\`gather <YYYY-MM>\\` for a month's days not gathered yet. Posting to Tempo (\\`work timesheet post <day>\\`) only when the user asks for it.\n- Anything else (\\`work remove\\`, git, files in a worktree): only when asked, and show the command first.\n\nDon't post on a git host (comments, reviews, replies), and don't send prompts to other sessions, unless the user asks. Keep answers short: the user is in the middle of something.\n`;\n\n/** What work wrote in the folder last time (relative paths), so files an earlier agent's setup left can go. */\nconst writtenFile = () => path.join(assistantDir(), '.work-written.json');\n/** What a work from before the list wrote: Claude's. */\nconst BEFORE_THE_LIST = ['CLAUDE.md', path.join('.claude', 'settings.json')];\n\nfunction readWritten(): string[] {\n try {\n const v = JSON.parse(fs.readFileSync(writtenFile(), 'utf-8')) as unknown;\n return Array.isArray(v) ? v.filter((x): x is string => typeof x === 'string') : [];\n } catch (err) {\n return (err as NodeJS.ErrnoException).code === 'ENOENT' ? BEFORE_THE_LIST : [];\n }\n}\n\n/**\n * Write (or refresh) the assistant's folder for the agent it runs; returns\n * it. Idempotent. Files work wrote there for another agent before (its\n * instructions, its settings with their allow rules and hooks) are removed:\n * after a switch they would be instructions and permissions nothing manages.\n * Only files work wrote and listed, inside the folder — never the user's own.\n */\nexport function prepareAssistantDir(agent: Pick<AgentAdapter, 'instructionsFile' | 'workspace'>): string {\n const dir = assistantDir();\n fs.mkdirSync(dir, { recursive: true });\n const before = readWritten();\n atomicWriteFile(path.join(dir, agent.instructionsFile), ASSISTANT_INSTRUCTIONS);\n const written = [agent.instructionsFile, ...(agent.workspace?.write(dir, { allow: ASSISTANT_ALLOW, hooks: ASSISTANT_HOOKS }) ?? [])].map(\n (f) => path.normalize(f),\n );\n const root = path.resolve(dir);\n for (const old of before.map((f) => path.normalize(f))) {\n const file = path.resolve(root, old);\n if (written.includes(old) || path.isAbsolute(old) || !file.startsWith(root + path.sep)) continue; // listed by us, inside the folder: nothing else\n fs.rmSync(file, { force: true });\n }\n atomicWriteFile(writtenFile(), JSON.stringify(written));\n return dir;\n}\n\ninterface StoredContext {\n at: string;\n text: string;\n /** The Time tab's day on screen: described afresh at each prompt (rows change by Save, Post, a rebuild). */\n day?: string;\n /** The Time tab's Month view on screen (`YYYY-MM`), described afresh the same way. */\n month?: string;\n /** The Reviews tab's PR on screen: its review described afresh at each prompt (a re-prepare, a submit change it). */\n review?: { repo: string; number: number };\n}\n\n/**\n * The dashboard view in words, for the hook: which tab, and the selected\n * session's state. Pure.\n */\nexport function describeView(view: AssistantView, session: SessionWire | null, now = Date.now()): string {\n const lines = [`The user is looking at the dashboard's ${view.tab} tab${view.sub ? ` (${view.sub})` : ''}.`];\n if (session) {\n const status = DISPLAY_LABEL[displayStatus(session, now)];\n lines.push(\n `Selected session: ${session.target} · ${session.branch} (id ${session.id}) — ${status}.`,\n ...(session.attention?.summary ? [` Its last line: ${session.attention.summary}`] : []),\n ...(session.diffStat?.files\n ? [` Uncommitted: +${session.diffStat.added} −${session.diffStat.deleted} in ${session.diffStat.files} files.`]\n : []),\n ...(session.overlaps?.length\n ? [` Changes the same files as: ${session.overlaps.map((o) => `${o.target} · ${o.branch}`).join(', ')}.`]\n : []),\n ...(session.context ? [` Its conversation is ${Math.round((session.context.used / session.context.window) * 100)}% full.`] : []),\n ...(session.branches?.length ? [` It has worked on more than one branch: ${branchesText(session.branches, session.isGroup)}.`] : []),\n ...(session.archivedAt ? [' It is archived.'] : []),\n ` Worktree: ${session.paths.join(', ')}`,\n );\n }\n if (view.note) lines.push(view.note);\n return lines.join('\\n');\n}\n\nexport function writeAssistantContext(\n text: string,\n now = Date.now(),\n day?: string,\n month?: string,\n review?: { repo: string; number: number },\n): void {\n fs.mkdirSync(assistantDir(), { recursive: true });\n const stored: StoredContext = {\n at: new Date(now).toISOString(),\n text,\n ...(day ? { day } : {}),\n ...(month ? { month } : {}),\n ...(review ? { review } : {}),\n };\n atomicWriteFile(contextFile(), JSON.stringify(stored));\n}\n\n/** The day on screen, if the Time tab is: for the hook to describe as it is now. */\nexport function assistantContextDay(now = Date.now()): string | null {\n const s = readStored(now);\n return s && typeof s.day === 'string' && /^\\d{4}-\\d{2}-\\d{2}$/.test(s.day) ? s.day : null;\n}\n\n/** The month on screen, if the Time tab's Month view is: for the hook to describe as it is now. */\nexport function assistantContextMonth(now = Date.now()): string | null {\n const s = readStored(now);\n return s && typeof s.month === 'string' && /^\\d{4}-(0[1-9]|1[0-2])$/.test(s.month) ? s.month : null;\n}\n\n/** The PR on screen, if the Reviews tab is: for the hook to describe its review as it is now. */\nexport function assistantContextReview(now = Date.now()): { repo: string; number: number } | null {\n const r = readStored(now)?.review as { repo?: unknown; number?: unknown } | undefined;\n return r && typeof r.repo === 'string' && r.repo && typeof r.number === 'number' && Number.isInteger(r.number) && r.number > 0\n ? { repo: r.repo, number: r.number }\n : null;\n}\n\nfunction readStored(now: number): Partial<StoredContext> | null {\n try {\n const s = JSON.parse(fs.readFileSync(contextFile(), 'utf-8')) as Partial<StoredContext> | null;\n if (!s || typeof s.text !== 'string' || typeof s.at !== 'string') return null;\n return now - Date.parse(s.at) > CONTEXT_TTL_MS ? null : s;\n } catch {\n return null;\n }\n}\n\n/**\n * What the hook adds to a prompt; null when the dashboard said nothing\n * lately. `dayNow` describes the Time tab's day as it is at this prompt\n * (the hook reads it from state.db), not as it was when the tab was opened.\n */\nexport function readAssistantContext(now = Date.now(), dayNow?: string | null): string | null {\n const s = readStored(now);\n if (!s) return null;\n return `[work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
3
3
  findSessionForCwd
4
- } from "./chunk-QEVYCCKD.js";
4
+ } from "./chunk-VRQKIIC2.js";
5
5
  import {
6
6
  sessionIdFor
7
- } from "./chunk-YYBXQBW2.js";
7
+ } from "./chunk-RUYTU2WJ.js";
8
8
 
9
9
  // src/core/sessions/live-agents.ts
10
10
  function agentsBySession(list, sessions) {
@@ -40,4 +40,4 @@ export {
40
40
  agentsBySession,
41
41
  summarizeAgents
42
42
  };
43
- //# sourceMappingURL=chunk-DQCUYCMX.js.map
43
+ //# sourceMappingURL=chunk-7NNOGTMC.js.map
@@ -3,7 +3,7 @@ import {
3
3
  json,
4
4
  tx,
5
5
  withDb
6
- } from "./chunk-YYBXQBW2.js";
6
+ } from "./chunk-RUYTU2WJ.js";
7
7
 
8
8
  // src/core/tasks.ts
9
9
  function isTask(x) {
@@ -87,4 +87,4 @@ export {
87
87
  removeTask,
88
88
  editTask
89
89
  };
90
- //# sourceMappingURL=chunk-OMIMK3LB.js.map
90
+ //# sourceMappingURL=chunk-7OFVXQSM.js.map