@moberg_hr/work-tree 2.7.0 → 2.9.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.
- package/dist/account-FKNMH5IT.js +245 -0
- package/dist/account-FKNMH5IT.js.map +1 -0
- package/dist/{add-repo-E7KWNJJV.js → add-repo-SG4D3C76.js} +26 -22
- package/dist/{add-repo-E7KWNJJV.js.map → add-repo-SG4D3C76.js.map} +1 -1
- package/dist/{answer-2CBOWCL5.js → answer-M4YETVGV.js} +15 -12
- package/dist/{answer-2CBOWCL5.js.map → answer-M4YETVGV.js.map} +1 -1
- package/dist/{attach-AWRY4LSI.js → attach-3P3WQJKZ.js} +19 -16
- package/dist/{attach-AWRY4LSI.js.map → attach-3P3WQJKZ.js.map} +1 -1
- package/dist/bin.js +7 -5
- package/dist/bin.js.map +1 -1
- package/dist/{block-JTJX5QIO.js → block-2C3GZYAP.js} +15 -12
- package/dist/{block-JTJX5QIO.js.map → block-2C3GZYAP.js.map} +1 -1
- package/dist/{broadcast-3SF55HA6.js → broadcast-BH2H7UTU.js} +12 -9
- package/dist/{broadcast-3SF55HA6.js.map → broadcast-BH2H7UTU.js.map} +1 -1
- package/dist/{catchup-2WNHEMLD.js → catchup-PENTMANK.js} +18 -15
- package/dist/{catchup-2WNHEMLD.js.map → catchup-PENTMANK.js.map} +1 -1
- package/dist/{chunk-C5HPSURF.js → chunk-3JFRM4IY.js} +12 -12
- package/dist/{chunk-O34CKSE4.js → chunk-3N3UQEC4.js} +2 -2
- package/dist/{chunk-EPNYZJMM.js → chunk-3TN77GOI.js} +9 -6
- package/dist/chunk-3TN77GOI.js.map +1 -0
- package/dist/{chunk-YJ4CAD3X.js → chunk-44AU2STD.js} +5 -5
- package/dist/{chunk-TPPTL7LA.js → chunk-4M5TIZDC.js} +113 -6
- package/dist/chunk-4M5TIZDC.js.map +1 -0
- package/dist/chunk-4NITDMDH.js +372 -0
- package/dist/chunk-4NITDMDH.js.map +1 -0
- package/dist/{chunk-SNRP2MC3.js → chunk-5QGCF3PS.js} +2 -2
- package/dist/{chunk-ZS6F6JLC.js → chunk-6MJ6BDHL.js} +88 -12
- package/dist/chunk-6MJ6BDHL.js.map +1 -0
- package/dist/chunk-6THUVP6T.js +118 -0
- package/dist/chunk-6THUVP6T.js.map +1 -0
- package/dist/{chunk-BHU26CNH.js → chunk-6XMH3WFY.js} +6 -4
- package/dist/{chunk-BHU26CNH.js.map → chunk-6XMH3WFY.js.map} +1 -1
- package/dist/{chunk-DYJ4VJJD.js → chunk-A42MFPMC.js} +8 -33
- package/dist/chunk-A42MFPMC.js.map +1 -0
- package/dist/{chunk-JIYGGN2N.js → chunk-AU27USPZ.js} +2 -2
- package/dist/chunk-BBZ2DK6W.js +9 -0
- package/dist/{chunk-B2HUKRWX.js → chunk-BT7SZQQL.js} +4 -4
- package/dist/{chunk-MGQK6BWH.js → chunk-CNE5SWFH.js} +35 -18
- package/dist/chunk-CNE5SWFH.js.map +1 -0
- package/dist/chunk-D675JTUZ.js +442 -0
- package/dist/chunk-D675JTUZ.js.map +1 -0
- package/dist/{chunk-FUNZ7TOS.js → chunk-F6M255O5.js} +534 -121
- package/dist/chunk-F6M255O5.js.map +1 -0
- package/dist/chunk-FDKJFIUU.js +169 -0
- package/dist/chunk-FDKJFIUU.js.map +1 -0
- package/dist/{chunk-YNHIMOE7.js → chunk-GNGXYXBC.js} +2 -2
- package/dist/{chunk-KU63EHZO.js → chunk-ICJPVSRY.js} +2 -2
- package/dist/{chunk-VEKEA3ER.js → chunk-J36ULZBO.js} +2 -2
- package/dist/{chunk-UHYIB6AV.js → chunk-JEET43KM.js} +2 -2
- package/dist/{chunk-2IKWNRMV.js → chunk-K5QBU5CY.js} +3 -3
- package/dist/{chunk-LDFICXOZ.js → chunk-KC66FLGZ.js} +10 -6
- package/dist/{chunk-LDFICXOZ.js.map → chunk-KC66FLGZ.js.map} +1 -1
- package/dist/{chunk-TBY6ZFAV.js → chunk-KNRGVUW7.js} +3 -3
- package/dist/{chunk-AFW7HREX.js → chunk-KUO5ATYX.js} +9 -41
- package/dist/chunk-KUO5ATYX.js.map +1 -0
- package/dist/{chunk-WIWO3YWP.js → chunk-LCV62KMO.js} +2 -2
- package/dist/{chunk-3JY3QT4J.js → chunk-LZUFHLBF.js} +5 -5
- package/dist/{chunk-CFLMBFBO.js → chunk-M6LJ3GE3.js} +76 -10
- package/dist/chunk-M6LJ3GE3.js.map +1 -0
- package/dist/{chunk-3PLWNCRM.js → chunk-MMFXUIQQ.js} +2 -2
- package/dist/{chunk-J5CMORVD.js → chunk-NMSJJCOD.js} +28 -15
- package/dist/chunk-NMSJJCOD.js.map +1 -0
- package/dist/{chunk-46UTKL5L.js → chunk-OMIMK3LB.js} +2 -2
- package/dist/chunk-P2HOLCBF.js +34 -0
- package/dist/chunk-P2HOLCBF.js.map +1 -0
- package/dist/{chunk-PUTZR6F5.js → chunk-P4EQWC5W.js} +2 -2
- package/dist/{chunk-4PRPDACI.js → chunk-PC67UHUW.js} +10 -7
- package/dist/chunk-PC67UHUW.js.map +1 -0
- package/dist/{chunk-OFCY7RCM.js → chunk-QJLJH5DC.js} +4 -4
- package/dist/{chunk-ZMCU2PZN.js → chunk-RCGFHJM7.js} +5 -3
- package/dist/chunk-RCGFHJM7.js.map +1 -0
- package/dist/{chunk-G2FE7HUB.js → chunk-RGUSVBGN.js} +2 -2
- package/dist/{chunk-R3DASZQF.js → chunk-S3BAD4IR.js} +2 -2
- package/dist/{chunk-B7C3RYSJ.js → chunk-SG5LUMGE.js} +3 -3
- package/dist/{chunk-KUVL75PL.js → chunk-SVSRQ3R2.js} +8 -8
- package/dist/{chunk-QGKJXCEJ.js → chunk-T2ZB6I3Y.js} +19 -13
- package/dist/chunk-T2ZB6I3Y.js.map +1 -0
- package/dist/{chunk-5GA3PFK5.js → chunk-TGWUOZJL.js} +13 -9
- package/dist/chunk-TGWUOZJL.js.map +1 -0
- package/dist/{chunk-5XSY3C6E.js → chunk-UBOKRHNV.js} +13 -13
- package/dist/chunk-UBOKRHNV.js.map +1 -0
- package/dist/{chunk-TTTIKTNR.js → chunk-UMYB6DZX.js} +2 -2
- package/dist/{chunk-W4YWFAYC.js → chunk-VEWSK3FG.js} +4 -4
- package/dist/{chunk-BVJ2ZE7B.js → chunk-VQGHVXGL.js} +34 -13
- package/dist/chunk-VQGHVXGL.js.map +1 -0
- package/dist/{chunk-W7WC7UA2.js → chunk-VRHQMUPB.js} +5 -5
- package/dist/{chunk-LQXGNO5X.js → chunk-W7NCZ3VU.js} +3 -3
- package/dist/{chunk-3UHKPHTB.js → chunk-WM4JWBKJ.js} +4 -4
- package/dist/{chunk-MCSEYS2J.js → chunk-WPZTIF5C.js} +5 -5
- package/dist/{chunk-USUQYM6V.js → chunk-WVJASLMV.js} +58 -54
- package/dist/chunk-WVJASLMV.js.map +1 -0
- package/dist/{chunk-ZNXACRZ5.js → chunk-WZ4QXVCC.js} +9 -5
- package/dist/{chunk-ZNXACRZ5.js.map → chunk-WZ4QXVCC.js.map} +1 -1
- package/dist/{chunk-DO5NW46X.js → chunk-X4AXKO3A.js} +2 -2
- package/dist/{chunk-LWKFZOCJ.js → chunk-X63DS7BW.js} +3 -3
- package/dist/{chunk-5WEDCEZG.js → chunk-X7TWBG4X.js} +5 -5
- package/dist/{chunk-KE2TFF7B.js → chunk-XNLQSW6J.js} +23 -212
- package/dist/chunk-XNLQSW6J.js.map +1 -0
- package/dist/{chunk-5BNNPXID.js → chunk-YA3WCQ2A.js} +4 -4
- package/dist/{chunk-ZGPWIBSZ.js → chunk-YEXW2OCN.js} +9 -34
- package/dist/chunk-YEXW2OCN.js.map +1 -0
- package/dist/chunk-YEY2WKOE.js +43 -0
- package/dist/chunk-YEY2WKOE.js.map +1 -0
- package/dist/{chunk-COKQPFLB.js → chunk-YYBXQBW2.js} +3 -3
- package/dist/chunk-ZDMJPEBO.js +31 -0
- package/dist/chunk-ZDMJPEBO.js.map +1 -0
- package/dist/{chunk-PIKOCEWX.js → chunk-ZOGGTAOK.js} +5 -5
- package/dist/chunk-ZXHMC7UO.js +106 -0
- package/dist/chunk-ZXHMC7UO.js.map +1 -0
- package/dist/{cleanup-PWN4XZ2F.js → cleanup-HEUCA22O.js} +31 -27
- package/dist/{cleanup-PWN4XZ2F.js.map → cleanup-HEUCA22O.js.map} +1 -1
- package/dist/cli-Y4JSWLZ2.js +19 -0
- package/dist/{command-hook-installer-RJH5QLCD.js → command-hook-installer-7Q7UD7AU.js} +9 -8
- package/dist/command-hook-installer-7Q7UD7AU.js.map +1 -0
- package/dist/{config-KGDVJKQN.js → config-TPK3PXW6.js} +19 -15
- package/dist/{config-KGDVJKQN.js.map → config-TPK3PXW6.js.map} +1 -1
- package/dist/{diff-ZORXBJDI.js → diff-XGPISLYB.js} +16 -13
- package/dist/{diff-ZORXBJDI.js.map → diff-XGPISLYB.js.map} +1 -1
- package/dist/{digest-PUUBJTD3.js → digest-4IF376QE.js} +14 -11
- package/dist/{digest-PUUBJTD3.js.map → digest-4IF376QE.js.map} +1 -1
- package/dist/{fork-7L76HZAS.js → fork-DQMXZEQM.js} +27 -24
- package/dist/{fork-7L76HZAS.js.map → fork-DQMXZEQM.js.map} +1 -1
- package/dist/{history-YX74IRQY.js → history-OXEG6SOK.js} +13 -8
- package/dist/{hook-JCD6SDB3.js → hook-Z3THJRUB.js} +20 -19
- package/dist/{hook-JCD6SDB3.js.map → hook-Z3THJRUB.js.map} +1 -1
- package/dist/{hydrate-W4V5RJYU.js → hydrate-47IPPOYB.js} +14 -11
- package/dist/{hydrate-W4V5RJYU.js.map → hydrate-47IPPOYB.js.map} +1 -1
- package/dist/{init-5MMV2UF5.js → init-OZ6ARQJB.js} +14 -11
- package/dist/{init-5MMV2UF5.js.map → init-OZ6ARQJB.js.map} +1 -1
- package/dist/install-skills-QTWYVAOZ.js +20 -0
- package/dist/install-skills-bin.js +9 -5
- package/dist/install-skills-bin.js.map +1 -1
- package/dist/{list-ZS3UWOGJ.js → list-22MUAA6K.js} +14 -11
- package/dist/{list-ZS3UWOGJ.js.map → list-22MUAA6K.js.map} +1 -1
- package/dist/{move-ZTL7HAIU.js → move-7QGWP7FG.js} +42 -18
- package/dist/move-7QGWP7FG.js.map +1 -0
- package/dist/{note-B4FVZGJJ.js → note-PA7HHBXX.js} +15 -12
- package/dist/{note-B4FVZGJJ.js.map → note-PA7HHBXX.js.map} +1 -1
- package/dist/{overlaps-W3BLUG53.js → overlaps-FE36QGVQ.js} +13 -10
- package/dist/{overlaps-W3BLUG53.js.map → overlaps-FE36QGVQ.js.map} +1 -1
- package/dist/{pin-YYQV5OPS.js → pin-AD43POUY.js} +15 -12
- package/dist/{pin-YYQV5OPS.js.map → pin-AD43POUY.js.map} +1 -1
- package/dist/{pr-HQTMQOF5.js → pr-MCPGZ44W.js} +15 -12
- package/dist/{pr-HQTMQOF5.js.map → pr-MCPGZ44W.js.map} +1 -1
- package/dist/{prune-6BYOFOUR.js → prune-M4BMLYDQ.js} +29 -26
- package/dist/{prune-6BYOFOUR.js.map → prune-M4BMLYDQ.js.map} +1 -1
- package/dist/{pty-host-KSS45FVH.js → pty-host-BMQOW67M.js} +142 -37
- package/dist/pty-host-BMQOW67M.js.map +1 -0
- package/dist/{read-I5TGSBPC.js → read-VALY2SX6.js} +14 -11
- package/dist/{read-I5TGSBPC.js.map → read-VALY2SX6.js.map} +1 -1
- package/dist/{recent-GRKJEEKT.js → recent-SCQJX6DJ.js} +22 -12
- package/dist/recent-SCQJX6DJ.js.map +1 -0
- package/dist/{remove-64T6TMOE.js → remove-24KP2GMZ.js} +28 -25
- package/dist/{remove-64T6TMOE.js.map → remove-24KP2GMZ.js.map} +1 -1
- package/dist/{report-KAS2UEXO.js → report-J7TUQRJS.js} +3 -3
- package/dist/{restart-WJROWFMU.js → restart-SSOENWTH.js} +15 -12
- package/dist/{restart-WJROWFMU.js.map → restart-SSOENWTH.js.map} +1 -1
- package/dist/{resume-634R6KNE.js → resume-GM66FDEP.js} +16 -12
- package/dist/resume-GM66FDEP.js.map +1 -0
- package/dist/{run-57LGOBXQ.js → run-OATO7NBV.js} +11 -8
- package/dist/{run-57LGOBXQ.js.map → run-OATO7NBV.js.map} +1 -1
- package/dist/{screen-CX7WUVXM.js → screen-RV2SJGJP.js} +15 -12
- package/dist/{screen-CX7WUVXM.js.map → screen-RV2SJGJP.js.map} +1 -1
- package/dist/{search-JYAQWT6A.js → search-UHYMBMA7.js} +11 -8
- package/dist/{search-JYAQWT6A.js.map → search-UHYMBMA7.js.map} +1 -1
- package/dist/{section-4FICXE46.js → section-24WUAJKW.js} +15 -12
- package/dist/{section-4FICXE46.js.map → section-24WUAJKW.js.map} +1 -1
- package/dist/{send-RRTPY47A.js → send-GRTDUQIN.js} +16 -13
- package/dist/{send-RRTPY47A.js.map → send-GRTDUQIN.js.map} +1 -1
- package/dist/{sessions-UJNUCYND.js → sessions-FAYRQHXJ.js} +21 -18
- package/dist/{sessions-UJNUCYND.js.map → sessions-FAYRQHXJ.js.map} +1 -1
- package/dist/{snooze-DJEPOBT5.js → snooze-WPUVDSBY.js} +14 -11
- package/dist/{snooze-DJEPOBT5.js.map → snooze-WPUVDSBY.js.map} +1 -1
- package/dist/{start-YPEN5QI3.js → start-EDY2RTZ3.js} +15 -12
- package/dist/{start-YPEN5QI3.js.map → start-EDY2RTZ3.js.map} +1 -1
- package/dist/{state-UAW6DWWU.js → state-DC73V5TS.js} +6 -4
- package/dist/{state-UAW6DWWU.js.map → state-DC73V5TS.js.map} +1 -1
- package/dist/{status-4EOTN33T.js → status-KISVX264.js} +13 -10
- package/dist/{status-4EOTN33T.js.map → status-KISVX264.js.map} +1 -1
- package/dist/{statusline-EUT6VZLP.js → statusline-A2DTGLK5.js} +40 -28
- package/dist/statusline-A2DTGLK5.js.map +1 -0
- package/dist/statusline-hook-OVWHHFBV.js +63 -0
- package/dist/statusline-hook-OVWHHFBV.js.map +1 -0
- package/dist/{stop-3UNZ22YA.js → stop-YJCB5IOT.js} +15 -12
- package/dist/{stop-3UNZ22YA.js.map → stop-YJCB5IOT.js.map} +1 -1
- package/dist/{sync-XXZBP6PK.js → sync-GD6LFFCX.js} +29 -26
- package/dist/{sync-XXZBP6PK.js.map → sync-GD6LFFCX.js.map} +1 -1
- package/dist/{time-G5Z57AE5.js → time-YUSOOTR5.js} +17 -14
- package/dist/{time-G5Z57AE5.js.map → time-YUSOOTR5.js.map} +1 -1
- package/dist/time-actions-4XNIRNMH.js +16 -0
- package/dist/{timesheet-NA7NQUVR.js → timesheet-W6RIHJE7.js} +19 -16
- package/dist/{timesheet-NA7NQUVR.js.map → timesheet-W6RIHJE7.js.map} +1 -1
- package/dist/{todo-V7EVWHF2.js → todo-4VTGOCKH.js} +7 -5
- package/dist/{todo-V7EVWHF2.js.map → todo-4VTGOCKH.js.map} +1 -1
- package/dist/{tree-R5YXQTP7.js → tree-UVJP5XF4.js} +41 -30
- package/dist/tree-UVJP5XF4.js.map +1 -0
- package/dist/{update-B3MQXQJ6.js → update-2A4JGE3U.js} +16 -13
- package/dist/{update-B3MQXQJ6.js.map → update-2A4JGE3U.js.map} +1 -1
- package/dist/{usage-2HE4RSVM.js → usage-KJZAMQW5.js} +18 -13
- package/dist/usage-KJZAMQW5.js.map +1 -0
- package/dist/{wait-2OPYJO3K.js → wait-XA3ZS2WF.js} +15 -12
- package/dist/{wait-2OPYJO3K.js.map → wait-XA3ZS2WF.js.map} +1 -1
- package/dist/wd-bin.js +8 -6
- package/dist/wd-bin.js.map +1 -1
- package/dist/web/assets/{PtyView-DgdSx6WG.js → PtyView-BPk8N9xQ.js} +2 -2
- package/dist/web/assets/{PtyView-DgdSx6WG.js.map → PtyView-BPk8N9xQ.js.map} +1 -1
- package/dist/web/assets/{index-C5JNhi3-.css → index-CZwdUbxG.css} +1 -1
- package/dist/web/assets/index-vXchs7b4.js +119 -0
- package/dist/web/assets/index-vXchs7b4.js.map +1 -0
- package/dist/web/index.html +2 -2
- package/dist/{web-QXQ4NGCJ.js → web-QCHECDRD.js} +407 -262
- package/dist/web-QCHECDRD.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/dist/chunk-3Q5RZCQW.js +0 -9
- package/dist/chunk-3ZGZNZTY.js +0 -134
- package/dist/chunk-3ZGZNZTY.js.map +0 -1
- package/dist/chunk-4PRPDACI.js.map +0 -1
- package/dist/chunk-5GA3PFK5.js.map +0 -1
- package/dist/chunk-5XSY3C6E.js.map +0 -1
- package/dist/chunk-AFW7HREX.js.map +0 -1
- package/dist/chunk-BVJ2ZE7B.js.map +0 -1
- package/dist/chunk-CFLMBFBO.js.map +0 -1
- package/dist/chunk-DYJ4VJJD.js.map +0 -1
- package/dist/chunk-EPNYZJMM.js.map +0 -1
- package/dist/chunk-FUNZ7TOS.js.map +0 -1
- package/dist/chunk-J5CMORVD.js.map +0 -1
- package/dist/chunk-KE2TFF7B.js.map +0 -1
- package/dist/chunk-MGQK6BWH.js.map +0 -1
- package/dist/chunk-QGKJXCEJ.js.map +0 -1
- package/dist/chunk-TPPTL7LA.js.map +0 -1
- package/dist/chunk-TUFQJXXO.js +0 -19
- package/dist/chunk-TUFQJXXO.js.map +0 -1
- package/dist/chunk-USUQYM6V.js.map +0 -1
- package/dist/chunk-VMBWCDBA.js +0 -186
- package/dist/chunk-VMBWCDBA.js.map +0 -1
- package/dist/chunk-ZGPWIBSZ.js.map +0 -1
- package/dist/chunk-ZMCU2PZN.js.map +0 -1
- package/dist/chunk-ZS6F6JLC.js.map +0 -1
- package/dist/cli-UTID323G.js +0 -17
- package/dist/command-hook-installer-RJH5QLCD.js.map +0 -1
- package/dist/install-skills-7EHZBANC.js +0 -16
- package/dist/move-ZTL7HAIU.js.map +0 -1
- package/dist/pty-host-KSS45FVH.js.map +0 -1
- package/dist/recent-GRKJEEKT.js.map +0 -1
- package/dist/resume-634R6KNE.js.map +0 -1
- package/dist/statusline-EUT6VZLP.js.map +0 -1
- package/dist/statusline-hook-TZ7M762P.js +0 -118
- package/dist/statusline-hook-TZ7M762P.js.map +0 -1
- package/dist/time-actions-H5WCOYZG.js +0 -14
- package/dist/tree-R5YXQTP7.js.map +0 -1
- package/dist/usage-2HE4RSVM.js.map +0 -1
- package/dist/web/assets/index-O8yTaaWX.js +0 -119
- package/dist/web/assets/index-O8yTaaWX.js.map +0 -1
- package/dist/web-QXQ4NGCJ.js.map +0 -1
- /package/dist/{chunk-C5HPSURF.js.map → chunk-3JFRM4IY.js.map} +0 -0
- /package/dist/{chunk-O34CKSE4.js.map → chunk-3N3UQEC4.js.map} +0 -0
- /package/dist/{chunk-YJ4CAD3X.js.map → chunk-44AU2STD.js.map} +0 -0
- /package/dist/{chunk-SNRP2MC3.js.map → chunk-5QGCF3PS.js.map} +0 -0
- /package/dist/{chunk-JIYGGN2N.js.map → chunk-AU27USPZ.js.map} +0 -0
- /package/dist/{chunk-3Q5RZCQW.js.map → chunk-BBZ2DK6W.js.map} +0 -0
- /package/dist/{chunk-B2HUKRWX.js.map → chunk-BT7SZQQL.js.map} +0 -0
- /package/dist/{chunk-YNHIMOE7.js.map → chunk-GNGXYXBC.js.map} +0 -0
- /package/dist/{chunk-KU63EHZO.js.map → chunk-ICJPVSRY.js.map} +0 -0
- /package/dist/{chunk-VEKEA3ER.js.map → chunk-J36ULZBO.js.map} +0 -0
- /package/dist/{chunk-UHYIB6AV.js.map → chunk-JEET43KM.js.map} +0 -0
- /package/dist/{chunk-2IKWNRMV.js.map → chunk-K5QBU5CY.js.map} +0 -0
- /package/dist/{chunk-TBY6ZFAV.js.map → chunk-KNRGVUW7.js.map} +0 -0
- /package/dist/{chunk-WIWO3YWP.js.map → chunk-LCV62KMO.js.map} +0 -0
- /package/dist/{chunk-3JY3QT4J.js.map → chunk-LZUFHLBF.js.map} +0 -0
- /package/dist/{chunk-3PLWNCRM.js.map → chunk-MMFXUIQQ.js.map} +0 -0
- /package/dist/{chunk-46UTKL5L.js.map → chunk-OMIMK3LB.js.map} +0 -0
- /package/dist/{chunk-PUTZR6F5.js.map → chunk-P4EQWC5W.js.map} +0 -0
- /package/dist/{chunk-OFCY7RCM.js.map → chunk-QJLJH5DC.js.map} +0 -0
- /package/dist/{chunk-G2FE7HUB.js.map → chunk-RGUSVBGN.js.map} +0 -0
- /package/dist/{chunk-R3DASZQF.js.map → chunk-S3BAD4IR.js.map} +0 -0
- /package/dist/{chunk-B7C3RYSJ.js.map → chunk-SG5LUMGE.js.map} +0 -0
- /package/dist/{chunk-KUVL75PL.js.map → chunk-SVSRQ3R2.js.map} +0 -0
- /package/dist/{chunk-TTTIKTNR.js.map → chunk-UMYB6DZX.js.map} +0 -0
- /package/dist/{chunk-W4YWFAYC.js.map → chunk-VEWSK3FG.js.map} +0 -0
- /package/dist/{chunk-W7WC7UA2.js.map → chunk-VRHQMUPB.js.map} +0 -0
- /package/dist/{chunk-LQXGNO5X.js.map → chunk-W7NCZ3VU.js.map} +0 -0
- /package/dist/{chunk-3UHKPHTB.js.map → chunk-WM4JWBKJ.js.map} +0 -0
- /package/dist/{chunk-MCSEYS2J.js.map → chunk-WPZTIF5C.js.map} +0 -0
- /package/dist/{chunk-DO5NW46X.js.map → chunk-X4AXKO3A.js.map} +0 -0
- /package/dist/{chunk-LWKFZOCJ.js.map → chunk-X63DS7BW.js.map} +0 -0
- /package/dist/{chunk-5WEDCEZG.js.map → chunk-X7TWBG4X.js.map} +0 -0
- /package/dist/{chunk-5BNNPXID.js.map → chunk-YA3WCQ2A.js.map} +0 -0
- /package/dist/{chunk-COKQPFLB.js.map → chunk-YYBXQBW2.js.map} +0 -0
- /package/dist/{chunk-PIKOCEWX.js.map → chunk-ZOGGTAOK.js.map} +0 -0
- /package/dist/{cli-UTID323G.js.map → cli-Y4JSWLZ2.js.map} +0 -0
- /package/dist/{history-YX74IRQY.js.map → history-OXEG6SOK.js.map} +0 -0
- /package/dist/{install-skills-7EHZBANC.js.map → install-skills-QTWYVAOZ.js.map} +0 -0
- /package/dist/{report-KAS2UEXO.js.map → report-J7TUQRJS.js.map} +0 -0
- /package/dist/{time-actions-H5WCOYZG.js.map → time-actions-4XNIRNMH.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/pty/output-status.ts","../src/core/pty/pty-pool.ts","../src/core/sessions/web-state.ts"],"sourcesContent":["import type { SessionAttention } from '../api-types.js';\n\n/**\n * A status for a session whose tool isn't Claude Code (config `aiCommand`,\n * e.g. opencode): no hooks report its turns, so the PTY host's \"last printed\n * anything\" stands in — a working agent redraws its spinner, an idle one\n * prints nothing. Working while it printed in the last `OUTPUT_WORKING_MS`,\n * idle after; never \"done, unseen\" or \"needs input\" (output can't tell a\n * finished turn from a question). Pure.\n */\n\nexport const OUTPUT_WORKING_MS = 10_000;\n\nexport interface PtyOutput {\n /** The tool's binary (the host's spawn spec). */\n tool?: string;\n /** When it last printed (ISO). */\n lastOutputAt?: string;\n startedAt: string;\n}\n\nexport function statusFromOutput(p: PtyOutput, now: number): SessionAttention | null {\n if (!p.tool || p.tool === 'claude' || !p.lastOutputAt) return null;\n const at = Date.parse(p.lastOutputAt);\n if (!Number.isFinite(at)) return null;\n const working = now - at < OUTPUT_WORKING_MS;\n return {\n state: working ? 'working' : 'idle',\n seen: true,\n since: p.lastOutputAt,\n updatedAt: p.lastOutputAt,\n stale: false,\n summary: `${working ? 'Printing' : 'Quiet'} — from its terminal output (${p.tool} has no status hooks)`,\n };\n}\n","import path from 'node:path';\nimport type { AgentAdapter } from '../agents/types.js';\nimport { agentFor, agentSettings, assistantAgent } from '../agents/index.js';\nimport { statusFromOutput, type PtyOutput } from './output-status.js';\nimport type { SessionAttention } from '../api-types.js';\nimport type { HostBeat } from './host-health.js';\nimport { PtyHostBusyError } from './pty-host-client.js';\nimport { noClaudeBecause } from '../archive/archiving.js';\nimport { findSession, sessionIdFor } from '../sessions/web-state.js';\nimport type { WorktreeSession } from '../sessions/history.js';\nimport { hostStartLockPath, type SpawnSpec, type HostInfo, type PtyInfo } from './pty-host-protocol.js';\nimport { dbPtySessions } from './pty-sessions-file.js';\nimport { ensureFile, withFileLock } from '../platform/fs-safe.js';\nimport { forgetPersistedSession } from './pty-sessions-file.js';\nimport { loadConfig } from '../platform/config.js';\nimport { hasEnvDelta, type EnvDelta } from '../platform/env-delta.js';\nimport { ensureHost, findHost, PtyHostClient, findHostPatient, PtyHostVersionError } from './pty-host-client.js';\nimport { logSwallowed, swallow } from '../platform/best-effort.js';\nimport { ASSISTANT_ID, prepareAssistantDir } from '../agents/assistant.js';\n\n/**\n * `work web`'s view of the Claude PTYs. The PTYs themselves live in the\n * PTY host (`work pty-host`, see core/pty-host.ts), a separate long-lived\n * process — so restarting or rebuilding `work web` never kills an agent,\n * and a real terminal (`work attach`) can share the same session.\n *\n * This module resolves a dashboard session to a spawn spec, asks the host\n * to spawn it on first attach, and keeps a small cache of which sessions\n * have a live PTY for the synchronous badge path (`peekPty`).\n */\n\nlet workBin = process.argv[1] ?? '';\n/** Whether this server may start the PTY host when none runs (not the dev server: see configurePtyPool). */\nlet mayStartHost = true;\nlet client: PtyHostClient | null = null;\nlet live = new Set<string>();\n/** The pids of those PTYs' processes (the Claudes the app runs). */\nlet livePids = new Set<number>();\n/** Each live PTY's tool and last output (for output-status.ts). */\nlet outputs = new Map<string, PtyOutput & { pid: number }>();\nlet refreshTimer: NodeJS.Timeout | null = null;\n/** The heartbeat (host-health.ts): each list request is one. */\nconst beat: HostBeat = { known: false, lastOkAt: null, latencyMs: null, lastError: null };\n\n/** How the host answered lately (for GET /api/pty-host/health). */\nexport function hostBeat(): HostBeat {\n return { ...beat };\n}\nconst REFRESH_MS = 2000;\n\n/** Called by `work web` at startup with the resolved `work` binary path,\n * which is what the host is spawned from. */\nexport function configurePtyPool(opts: { workBin: string; startHost?: boolean }): void {\n workBin = opts.workBin;\n // The dev server (`work web --dev`) uses the host that runs and never starts one: started\n // from a checkout's build, the long-lived host that owns every Claude would outlive it,\n // and the installed work would become a client of the checkout's code.\n mayStartHost = opts.startHost ?? true;\n}\n\n/** The `work` binary path, for routes that launch `work attach`. */\nexport function getWorkBin(): string {\n return workBin;\n}\n\nasync function getClient(spawnIfMissing: boolean): Promise<PtyHostClient | null> {\n if (client) {\n // Cheap liveness re-check happens in refresh(); a dead host surfaces\n // as a failed call, which resets `client` below.\n return client;\n }\n const info = spawnIfMissing && mayStartHost ? await ensureHost(workBin) : await findHost();\n if (!info && spawnIfMissing && !mayStartHost)\n throw new Error(\n \"No PTY host is running, and the dev server doesn't start one: start the installed work (its app or `work web`) first.\",\n );\n if (!info) return null;\n client = new PtyHostClient(info);\n startRefresh();\n return client;\n}\n\nasync function refresh(): Promise<void> {\n const t0 = Date.now();\n try {\n const c = await getClient(false);\n if (!c) {\n beat.known = false;\n live = new Set();\n livePids = new Set();\n outputs = new Map();\n return;\n }\n beat.known = true;\n const ptys = await c.list();\n beat.lastOkAt = Date.now();\n beat.latencyMs = beat.lastOkAt - t0;\n beat.lastError = null;\n live = new Set(ptys.filter((p) => !p.exited).map((p) => p.id));\n livePids = new Set(ptys.filter((p) => !p.exited).map((p) => p.pid));\n outputs = new Map(\n ptys.filter((p) => !p.exited).map((p) => [p.id, { tool: p.tool, lastOutputAt: p.lastOutputAt, startedAt: p.startedAt, pid: p.pid }]),\n );\n } catch (err) {\n // Host went away (or was restarted on a new port) — rediscover next tick.\n // A busy host is still a host (it is there, just not answering).\n beat.known = beat.known || err instanceof PtyHostBusyError;\n beat.lastError = (err as Error).message;\n client = null;\n live = new Set();\n livePids = new Set();\n outputs = new Map();\n }\n}\n\nfunction startRefresh(): void {\n if (refreshTimer) return;\n refreshTimer = setInterval(() => void refresh(), REFRESH_MS);\n refreshTimer.unref?.();\n}\n\n/** Connect to an already-running host at `work web` startup so badges for\n * PTYs that survived a web restart show immediately. Never spawns. */\n/** Re-read the host's PTY list now (the periodic refresh can be seconds old,\n * or not have run at all right after `work web` started). */\nexport async function syncPtyPool(): Promise<void> {\n await refresh();\n}\n\nexport async function initPtyPool(): Promise<void> {\n await refresh().catch(() => {});\n startRefresh();\n}\n\n/**\n * After a reboot (or a host crash) nothing is running but\n * `pty-sessions.json` still lists the sessions that were live. Starting the\n * host restores them; do that when there's something to restore, so\n * reopening `work web` picks up where you left off. Returns how many\n * sessions the host will bring back (0 = nothing to do).\n */\nexport async function resumePersistedSessions(): Promise<number> {\n let count: number;\n try {\n count = Object.keys(dbPtySessions.read()).length;\n } catch {\n return 0;\n }\n if (count === 0) return 0;\n if (await findHost().catch(() => true)) return 0; // already running\n await getClient(true);\n await refresh();\n return count;\n}\n\n/**\n * Where Claude runs for a session — the same directory `work tree` launches\n * in: the worktree for a single repo, the group root (parent of the\n * sub-repos) for a group.\n */\nexport { ASSISTANT_ID };\n\n/** The assistant runs config `assistantAgent` (Claude Code by default), in its folder written for that agent. */\nexport function assistantSpec(): { cwd: string; tool: ReturnType<AgentAdapter['launch']['tool']>; agentEnv?: EnvDelta } {\n const settings = agentSettings();\n const agent = assistantAgent(settings);\n // Work's own session, not any session's: the configured default account (`launch.env(null)`).\n const agentEnv = agent.launch.env?.(null);\n return { cwd: prepareAssistantDir(agent), tool: agent.launch.tool(settings), ...(hasEnvDelta(agentEnv) ? { agentEnv } : {}) };\n}\n\nexport function spawnSpecFor(session: WorktreeSession): SpawnSpec | null {\n const first = session.paths[0];\n if (!first) return null;\n const cwd = session.isGroup ? path.dirname(first) : first;\n const config = loadConfig();\n const launch = agentFor(config, session).launch;\n // The session's account: its agent's folder env, applied by the host over whatever environment it starts with.\n const agentEnv = launch.env?.(session);\n return { cwd, tool: launch.tool(config), port: session.port, ...(hasEnvDelta(agentEnv) ? { agentEnv } : {}) };\n}\n\n/**\n * Ensure a live PTY exists for the session (spawning Claude in the host if\n * needed) and return the host WebSocket URL to attach to. Null for an\n * unknown session.\n */\nexport async function ensurePty(sessionId: string, extra: { initialPrompt?: string } = {}): Promise<string | null> {\n // The dashboard assistant (Ctrl+K) is not a worktree: it runs in its own\n // folder, which is (re)written first (assistant.ts).\n const session = sessionId === ASSISTANT_ID ? null : findSession(sessionId);\n // Not for a session being archived, or archived: its Claude was stopped on\n // purpose (a Terminal tab still open on it reconnects and would start it).\n const refused = sessionId === ASSISTANT_ID ? null : noClaudeBecause(session, sessionId);\n if (refused) throw new Error(refused);\n const base = sessionId === ASSISTANT_ID ? assistantSpec() : session ? spawnSpecFor(session) : null;\n if (!base) return null;\n // The first prompt only applies to a fresh spawn (the host ignores the\n // spec when the session's PTY is already running).\n const spec = extra.initialPrompt ? { ...base, initialPrompt: extra.initialPrompt } : base;\n\n let c = await getClient(true);\n if (!c) return null;\n // A host from before accounts would start it on its own environment — another account than the session's.\n if (setsEnv(spec.agentEnv) && !(await hostTakesAgentEnv(c)) && !(await runsIn(c, sessionId))) throw new Error(OLD_HOST_ACCOUNTS);\n try {\n await c.spawn(sessionId, spec);\n } catch (err) {\n // Stale client (host restarted on a new port) — retry once, fresh.\n client = null;\n c = await getClient(true);\n if (!c) throw err;\n await c.spawn(sessionId, spec);\n }\n live.add(sessionId);\n return c.attachUrl(sessionId);\n}\n\n/** Side-effect-free check: does an active (non-exited) PTY exist for this\n * session? Served from the refresh cache — used by session-meta for the\n * \"running/idle\" badge, which must stay synchronous. */\n/** Every PTY in the host, fresh (never starts a host; [] without one). */\nexport async function listHostPtys(): Promise<PtyInfo[]> {\n const c = await getClient(false);\n return c ? c.list() : [];\n}\n\n/** Pids of the Claudes running in the PTY host (from the refresh cache). */\nexport function ptyPids(): ReadonlySet<number> {\n return livePids;\n}\n\n/** A status from its terminal output, for a session whose tool has no hooks (output-status.ts); null for Claude or no PTY. */\nexport function outputStatus(sessionId: string, now = Date.now()): SessionAttention | null {\n const o = outputs.get(sessionId);\n return o ? statusFromOutput(o, now) : null;\n}\n\n/** When a session's terminal last printed (ms, from the refresh cache); null with no PTY or a host that doesn't say. */\nexport function ptyLastOutputMs(sessionId: string): number | null {\n const at = outputs.get(sessionId)?.lastOutputAt;\n const ms = at ? Date.parse(at) : NaN;\n return Number.isFinite(ms) ? ms : null;\n}\n\n/** Its agent's process id in the host (from the refresh cache); null with no PTY. */\nexport function ptyPid(sessionId: string): number | null {\n return outputs.get(sessionId)?.pid ?? null;\n}\n\nexport function peekPty(sessionId: string): boolean {\n return live.has(sessionId);\n}\n\n/** A session's live PTY screen as text; null when there is none (never spawns). */\nexport async function readPtyScreen(sessionId: string): Promise<string | null> {\n if (!live.has(sessionId)) return null;\n const c = await getClient(false);\n return c ? c.screen(sessionId) : null;\n}\n\n/** Write to a session's live PTY. False when there is none (never spawns). */\nexport async function writeToPty(sessionId: string, data: string): Promise<boolean> {\n if (!live.has(sessionId)) return false;\n const c = await getClient(false);\n return c ? c.write(sessionId, data) : false;\n}\n\n/**\n * Restart a session's agent in the host, resuming its conversation, its terminals\n * kept attached (agent-restart.ts). A host from before that call: stopped and\n * started again (an open Terminal tab then offers Enter, as after a stop).\n */\nexport async function restartPty(sessionId: string): Promise<string | void> {\n let c = await getClient(false);\n if (!c) throw new Error('the PTY host is not running');\n let how: Awaited<ReturnType<PtyHostClient['restart']>>;\n try {\n how = await c.restart(sessionId);\n } catch (err) {\n // A stale client (the host restarted on a new port before the refresh noticed): once more, fresh.\n client = null;\n c = await getClient(false);\n if (!c) throw err;\n how = await c.restart(sessionId);\n }\n if (how === 'not-running') throw new Error('its agent is not running in the PTY host');\n if (how === 'unsupported') {\n await disposePty(sessionId);\n if (!(await ensurePty(sessionId))) throw new Error('its agent could not be started again');\n return OLD_HOST_RESTART;\n }\n}\n\n/**\n * Stop a session's agent and keep its session in the host (entry, restore record, attached terminals) until `resumePty`:\n * a switch of account moves its conversation files in between. `stopped`: a host from before the call stopped it the old\n * way (its terminals were told it ended; `resumePtyOnAccount` then starts it fresh); `gone`: nothing was running.\n */\nexport async function haltPty(sessionId: string): Promise<'halted' | 'stopped' | 'gone'> {\n let c = await getClient(false);\n if (!c) throw new Error('the PTY host is not running');\n let how: Awaited<ReturnType<PtyHostClient['halt']>>;\n try {\n how = await c.halt(sessionId);\n } catch (err) {\n // A stale client (the host restarted on a new port before the refresh noticed): once more, fresh.\n client = null;\n c = await getClient(false);\n if (!c) throw err;\n how = await c.halt(sessionId);\n }\n if (how === 'not-running') return 'gone';\n if (how === 'unsupported') {\n await disposePty(sessionId);\n return 'stopped';\n }\n return 'halted';\n}\n\n/** Why a switch of account can't be done in this PTY host now (it is from before accounts), or null: asked before halting. */\nexport async function accountSwitchRefusal(): Promise<string | null> {\n const c = await getClient(false);\n return c && !(await hostTakesAgentEnv(c)) ? OLD_HOST_ACCOUNTS : null;\n}\n\n/**\n * Start a halted session's agent again in place, on `opts.agentEnv` (its terminals carry on). `not-halted`: it isn't\n * halted any more — the host started it again by itself (HALT_RESUME_MS) or restarted, on its old spec.\n */\nexport async function resumePty(sessionId: string, opts: { agentEnv?: EnvDelta } = {}): Promise<'resumed' | 'not-halted'> {\n let c = await getClient(false);\n if (!c) throw new Error('the PTY host is not running');\n if (hasEnvDelta(opts.agentEnv) && !(await hostTakesAgentEnv(c))) throw new Error(OLD_HOST_ACCOUNTS);\n let how: Awaited<ReturnType<PtyHostClient['resume']>>;\n try {\n how = await c.resume(sessionId, opts);\n } catch (err) {\n client = null;\n c = await getClient(false);\n if (!c) throw err;\n how = await c.resume(sessionId, opts);\n }\n return how;\n}\n\n/**\n * Start the agent of a session `haltPty` stopped, on the account the session records NOW (after a switch: the new one;\n * after one that failed: the old): resumed in place with that environment, or — `stopped`, an older host — started\n * again from a fresh spec (its terminals show it ended; opening the session reconnects).\n */\nexport async function resumePtyOnAccount(sessionId: string, how: 'halted' | 'stopped'): Promise<string | void> {\n if (how === 'stopped') {\n if (!(await ensurePty(sessionId))) throw new Error('its agent could not be started again');\n return OLD_HOST_RESTART;\n }\n const session = findSession(sessionId);\n const spec = session ? spawnSpecFor(session) : null;\n if (!spec) throw new Error('unknown session');\n // Nothing in the delta means no account change to apply (the default, with no accounts configured): a plain resume.\n const agentEnv = hasEnvDelta(spec.agentEnv) ? spec.agentEnv : undefined;\n if ((await resumePty(sessionId, agentEnv ? { agentEnv } : {})) === 'resumed') return;\n // Started again meanwhile on its OLD spec (the host's own resume after HALT_RESUME_MS — a long move —, or a host\n // restart's restore): restarted in place on the account the session records now, so it doesn't stay on the old one.\n const c = await getClient(false);\n if (!c) throw new Error('the PTY host is not running');\n const restarted = await c.restart(sessionId, agentEnv ? { agentEnv } : {});\n if (restarted === 'restarted') return RESTARTED_AFTER_AUTO_RESUME;\n // Not running now (it ended), or a host that couldn't take the environment in place: started fresh from the new spec.\n if (restarted === 'unsupported') await disposePty(sessionId);\n if (!(await ensurePty(sessionId))) throw new Error('its agent could not be started again');\n return RESTARTED_AFTER_AUTO_RESUME;\n}\n\n/** What a switch says when its halted Claude had been started again (on the old account) before the move was done. */\nexport const RESTARTED_AFTER_AUTO_RESUME =\n 'it had been started again on its old account while the conversation moved, so it was restarted on the new one';\n\n/** Said when a session on a named account would start in a PTY host that drops the account (one from before accounts). */\nexport const OLD_HOST_ACCOUNTS = 'the PTY host is from before Claude accounts: run `work pty-host --restart`';\n\n/** The delta sets a variable (a session on a named account): what an older host would drop, starting it elsewhere. */\nconst setsEnv = (d: EnvDelta | undefined): boolean => !!d && Object.values(d).some((v) => typeof v === 'string');\n\n/** The host applies `agentEnv`; one that can't be asked right now is given the benefit of the doubt (its restart says). */\nasync function hostTakesAgentEnv(c: PtyHostClient): Promise<boolean> {\n const f = await c.features();\n return f === null || f.includes('agentEnv');\n}\n\n/** Its agent runs in this host now (a spawn would only attach to it). */\nasync function runsIn(c: PtyHostClient, sessionId: string): Promise<boolean> {\n return (await c.list()).some((p) => p.id === sessionId && !p.exited);\n}\n\n/** How a restart on a PTY host from before restart-in-place went: what differs, and the way to the real thing. */\nexport const OLD_HOST_RESTART =\n 'stopped and started again (an older PTY host: open terminals show it ended, and it runs with only the variables `hostEnv` keeps; `work pty-host --restart` gets restarts in place)';\n\n/** Kill one session's PTY (if any). Called before removing a worktree so\n * the Claude process doesn't hold its cwd open (Windows refuses to delete\n * a directory that is some process's working directory). */\nexport async function disposePty(sessionId: string): Promise<void> {\n live.delete(sessionId);\n let c = client;\n if (!c) {\n // A busy host (mid-restore) is waited for, not skipped: skipping left\n // Claude running inside the worktree about to be deleted. A host from\n // another build can't be talked to — nothing to do but proceed.\n let info: HostInfo | null;\n try {\n info = await findHostPatient();\n } catch (err) {\n if (err instanceof PtyHostVersionError) return;\n throw err; // still busy after waiting: let the caller report it\n }\n if (!info) return;\n c = new PtyHostClient(info);\n }\n await c.kill(sessionId).catch(swallow(`stop session ${sessionId} in the PTY host`));\n}\n\n/**\n * Stop a session's Claude in the PTY host before its worktree is deleted —\n * from any caller, including the CLI (`work remove` / prune / sync), which\n * doesn't run a pool. Never starts a host; waits for the process to exit\n * (the host's kill does) so Windows can then delete the directory.\n * Best-effort: no host, or a host that can't be reached, is a no-op.\n */\nexport async function stopSessionPty(target: string, branch: string): Promise<void> {\n const id = sessionIdFor({ target, branch } as WorktreeSession);\n live.delete(id);\n // Under the host START lock: a host that's starting holds it until it has\n // restored, so we either see it running (and kill the session) or know\n // none is — and then drop the session from the saved list so a later\n // start doesn't restore Claude into a worktree that's being deleted.\n const lock = hostStartLockPath();\n ensureFile(lock, '');\n await withFileLock(lock, async () => {\n let info;\n try {\n info = await findHostPatient();\n } catch (err) {\n // A host from another build can't be talked to; one still busy after\n // waiting is running and owns the session — leave both alone (and\n // never drop the saved entry: the host is what it belongs to).\n logSwallowed(`stop session ${id}: PTY host`, err);\n return;\n }\n if (info) await new PtyHostClient(info).kill(id).catch(swallow(`stop session ${id} in the PTY host`));\n else await forgetPersistedSession(id).catch(swallow(`forget saved session ${id}`));\n }).catch(swallow(`stop session ${id}: host start lock`));\n}\n\n/** `work web` shutdown. Deliberately does NOT kill anything: the PTYs belong\n * to the host and outlive the dashboard. Just stops polling. */\nexport function detachPtyPool(): void {\n if (refreshTimer) clearInterval(refreshTimer);\n refreshTimer = null;\n client = null;\n live = new Set();\n livePids = new Set();\n}\n","import { createFsWatcher, type FsWatcher } from '../platform/fs-watcher.js';\nimport { findSessionById, type WorktreeSession } from './history.js';\n\nexport { sessionIdFor } from './session-id.js';\n\n/** A session by id — a primary-key lookup (every /api/sessions/:id/*\n * request does one; it used to load and hash every row). */\nexport function findSession(sessionId: string): WorktreeSession | null {\n return findSessionById(sessionId);\n}\n\ninterface WatcherEntry {\n watcher: FsWatcher;\n subscribers: Set<() => void>;\n}\n\nconst sessionWatchers = new Map<string, WatcherEntry>();\nconst DEBOUNCE_MS = 150;\n\n/**\n * Subscribe to filesystem changes for a session's worktree(s). The watch is\n * started on first subscriber and stopped when the last one leaves —\n * reference-counted so the cost stays proportional to what's actually being\n * viewed in the browser. It is the shared fs-watcher: dependency and build\n * folders (node_modules, bin/obj, dist, …) are left out, and on Windows and\n * macOS it is one recursive OS watch per root. A chokidar watch over the\n * whole worktree used to open one watch per folder, node_modules included.\n *\n * Returns an unsubscribe function. Safe to call multiple times.\n */\nexport function subscribeSession(sessionId: string, onChange: () => void): () => void {\n const session = findSession(sessionId);\n if (!session)\n return () => {\n /* unknown session */\n };\n\n let entry = sessionWatchers.get(sessionId);\n if (!entry) {\n const subscribers = new Set<() => void>();\n const newEntry: WatcherEntry = {\n subscribers,\n watcher: createFsWatcher({\n roots: session.paths,\n debounceMs: DEBOUNCE_MS,\n onChange: () => {\n for (const cb of subscribers) {\n try {\n cb();\n } catch {\n /* swallow */\n }\n }\n },\n }),\n };\n sessionWatchers.set(sessionId, newEntry);\n entry = newEntry;\n }\n\n entry.subscribers.add(onChange);\n\n let released = false;\n return () => {\n if (released) return;\n released = true;\n entry!.subscribers.delete(onChange);\n if (entry!.subscribers.size === 0) {\n entry!.watcher.stop();\n if (sessionWatchers.get(sessionId) === entry) {\n sessionWatchers.delete(sessionId);\n }\n }\n };\n}\n\n/**\n * Force-stop one session's watcher regardless of subscribers. Used before\n * removing a worktree: on Windows an open directory watch keeps a handle\n * on the tree and makes `git worktree remove` fail. Late unsubscribes from\n * the orphaned entry are harmless (see the identity check above).\n */\nexport async function disposeSessionWatcher(sessionId: string): Promise<void> {\n const entry = sessionWatchers.get(sessionId);\n if (!entry) return;\n sessionWatchers.delete(sessionId);\n entry.subscribers.clear();\n entry.watcher.stop();\n}\n\n/** Stop every active session watcher. Called on server shutdown. */\nexport function disposeAllWatchers(): void {\n for (const [, entry] of sessionWatchers) entry.watcher.stop();\n sessionWatchers.clear();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWO,IAAM,oBAAoB;AAU1B,SAAS,iBAAiB,GAAc,KAAsC;AACnF,MAAI,CAAC,EAAE,QAAQ,EAAE,SAAS,YAAY,CAAC,EAAE,aAAc,QAAO;AAC9D,QAAM,KAAK,KAAK,MAAM,EAAE,YAAY;AACpC,MAAI,CAAC,OAAO,SAAS,EAAE,EAAG,QAAO;AACjC,QAAM,UAAU,MAAM,KAAK;AAC3B,SAAO;AAAA,IACL,OAAO,UAAU,YAAY;AAAA,IAC7B,MAAM;AAAA,IACN,OAAO,EAAE;AAAA,IACT,WAAW,EAAE;AAAA,IACb,OAAO;AAAA,IACP,SAAS,GAAG,UAAU,aAAa,OAAO,qCAAgC,EAAE,IAAI;AAAA,EAClF;AACF;;;AClCA,OAAO,UAAU;;;ACOV,SAAS,YAAY,WAA2C;AACrE,SAAO,gBAAgB,SAAS;AAClC;AAOA,IAAM,kBAAkB,oBAAI,IAA0B;AACtD,IAAM,cAAc;AAab,SAAS,iBAAiB,WAAmB,UAAkC;AACpF,QAAM,UAAU,YAAY,SAAS;AACrC,MAAI,CAAC;AACH,WAAO,MAAM;AAAA,IAEb;AAEF,MAAI,QAAQ,gBAAgB,IAAI,SAAS;AACzC,MAAI,CAAC,OAAO;AACV,UAAM,cAAc,oBAAI,IAAgB;AACxC,UAAM,WAAyB;AAAA,MAC7B;AAAA,MACA,SAAS,gBAAgB;AAAA,QACvB,OAAO,QAAQ;AAAA,QACf,YAAY;AAAA,QACZ,UAAU,MAAM;AACd,qBAAW,MAAM,aAAa;AAC5B,gBAAI;AACF,iBAAG;AAAA,YACL,QAAQ;AAAA,YAER;AAAA,UACF;AAAA,QACF;AAA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nC,QAAI;AACJ,QAAI;AACF,aAAO,MAAM,gBAAgB;AAAA,IAC/B,SAAS,KAAK;AAIZ,mBAAa,gBAAgB,EAAE,cAAc,GAAG;AAChD;AAAA,IACF;AACA,QAAI,KAAM,OAAM,IAAI,cAAc,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,QAAQ,gBAAgB,EAAE,kBAAkB,CAAC;AAAA,QAC/F,OAAM,uBAAuB,EAAE,EAAE,MAAM,QAAQ,wBAAwB,EAAE,EAAE,CAAC;AAAA,EACnF,CAAC,EAAE,MAAM,QAAQ,gBAAgB,EAAE,mBAAmB,CAAC;AACzD;AAIO,SAAS,gBAAsB;AACpC,MAAI,aAAc,eAAc,YAAY;AAC5C,iBAAe;AACf,WAAS;AACT,SAAO,oBAAI,IAAI;AACf,aAAW,oBAAI,IAAI;AACrB;","names":[]}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/core/platform/config-dir.ts
|
|
4
|
+
import fs from "fs";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import os from "os";
|
|
7
|
+
function configDirPath() {
|
|
8
|
+
return path.join(os.homedir(), ".work");
|
|
9
|
+
}
|
|
10
|
+
function getConfigDir() {
|
|
11
|
+
const dir = path.join(os.homedir(), ".work");
|
|
12
|
+
if (!fs.existsSync(dir)) {
|
|
13
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
14
|
+
}
|
|
15
|
+
return dir;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// src/core/platform/logger.ts
|
|
19
|
+
import fs2 from "fs";
|
|
20
|
+
import path2 from "path";
|
|
21
|
+
var maxLogSize = 5 * 1024 * 1024;
|
|
22
|
+
var logPath = null;
|
|
23
|
+
var logFd = null;
|
|
24
|
+
var logBytes = 0;
|
|
25
|
+
function rotate(file) {
|
|
26
|
+
const prev = file + ".1";
|
|
27
|
+
try {
|
|
28
|
+
fs2.unlinkSync(prev);
|
|
29
|
+
} catch {
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
fs2.renameSync(file, prev);
|
|
33
|
+
} catch {
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function ensureLog() {
|
|
37
|
+
if (logFd !== null) return logFd;
|
|
38
|
+
try {
|
|
39
|
+
const dir = getConfigDir();
|
|
40
|
+
fs2.mkdirSync(dir, { recursive: true });
|
|
41
|
+
logPath = path2.join(dir, "debug.log");
|
|
42
|
+
let size = 0;
|
|
43
|
+
try {
|
|
44
|
+
size = fs2.statSync(logPath).size;
|
|
45
|
+
} catch {
|
|
46
|
+
}
|
|
47
|
+
if (size > maxLogSize) {
|
|
48
|
+
rotate(logPath);
|
|
49
|
+
size = 0;
|
|
50
|
+
}
|
|
51
|
+
logFd = fs2.openSync(logPath, "a");
|
|
52
|
+
logBytes = size;
|
|
53
|
+
return logFd;
|
|
54
|
+
} catch {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function timestamp() {
|
|
59
|
+
return (/* @__PURE__ */ new Date()).toISOString();
|
|
60
|
+
}
|
|
61
|
+
function stripAnsi(str) {
|
|
62
|
+
return str.replace(/\x1b\[[0-9;]*m/g, "");
|
|
63
|
+
}
|
|
64
|
+
function debugLog(level, ...args) {
|
|
65
|
+
const fd = ensureLog();
|
|
66
|
+
if (fd === null) return;
|
|
67
|
+
const msg = args.map((a) => typeof a === "string" ? stripAnsi(a) : JSON.stringify(a)).join(" ");
|
|
68
|
+
const line = `${timestamp()} [${level}] ${msg}
|
|
69
|
+
`;
|
|
70
|
+
try {
|
|
71
|
+
fs2.writeSync(fd, line);
|
|
72
|
+
} catch {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
logBytes += Buffer.byteLength(line);
|
|
76
|
+
if (logBytes > maxLogSize && logPath) {
|
|
77
|
+
closeLog();
|
|
78
|
+
rotate(logPath);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function installConsoleLogger() {
|
|
82
|
+
const origLog = console.log.bind(console);
|
|
83
|
+
const origError = console.error.bind(console);
|
|
84
|
+
const origWarn = console.warn.bind(console);
|
|
85
|
+
console.log = (...args) => {
|
|
86
|
+
origLog(...args);
|
|
87
|
+
debugLog("INFO", ...args);
|
|
88
|
+
};
|
|
89
|
+
console.error = (...args) => {
|
|
90
|
+
origError(...args);
|
|
91
|
+
debugLog("ERROR", ...args);
|
|
92
|
+
};
|
|
93
|
+
console.warn = (...args) => {
|
|
94
|
+
origWarn(...args);
|
|
95
|
+
debugLog("WARN", ...args);
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function debug(...args) {
|
|
99
|
+
debugLog("DEBUG", ...args);
|
|
100
|
+
}
|
|
101
|
+
function closeLog() {
|
|
102
|
+
if (logFd !== null) {
|
|
103
|
+
try {
|
|
104
|
+
fs2.closeSync(logFd);
|
|
105
|
+
} catch {
|
|
106
|
+
}
|
|
107
|
+
logFd = null;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export {
|
|
112
|
+
configDirPath,
|
|
113
|
+
getConfigDir,
|
|
114
|
+
debugLog,
|
|
115
|
+
installConsoleLogger,
|
|
116
|
+
debug
|
|
117
|
+
};
|
|
118
|
+
//# sourceMappingURL=chunk-6THUVP6T.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/platform/config-dir.ts","../src/core/platform/logger.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport os from 'node:os';\n\n/** `~/.work`, never made: for what only reads (an install must write nothing there). */\nexport function configDirPath(): string {\n return path.join(os.homedir(), '.work');\n}\n\n/** `~/.work`, made when missing. Its own module (config.ts re-exports it) so the logger can find it without importing config, which reports through the logger. */\nexport function getConfigDir(): string {\n const dir = path.join(os.homedir(), '.work');\n if (!fs.existsSync(dir)) {\n fs.mkdirSync(dir, { recursive: true });\n }\n return dir;\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\nimport { getConfigDir } from './config-dir.js';\n\nlet maxLogSize = 5 * 1024 * 1024; // 5MB, then debug.log → debug.log.1\n\nlet logPath: string | null = null;\n/** A plain file descriptor, written synchronously: a line is on disk when\n * debugLog returns (a buffered stream lost the last lines on exit), and\n * rotation can close the file before renaming it — Windows refuses to\n * rename a file that is still open. */\nlet logFd: number | null = null;\n/** Bytes in the current file: its size at open plus what we wrote since. */\nlet logBytes = 0;\n\n/** Tests shrink the cap to exercise rotation. */\nexport function setMaxLogSizeForTests(bytes: number): void {\n maxLogSize = bytes;\n}\n\nfunction rotate(file: string): void {\n const prev = file + '.1';\n try {\n fs.unlinkSync(prev);\n } catch {\n /* */\n }\n try {\n fs.renameSync(file, prev);\n } catch {\n /* another process has it open; next time */\n }\n}\n\nfunction ensureLog(): number | null {\n if (logFd !== null) return logFd;\n try {\n const dir = getConfigDir();\n fs.mkdirSync(dir, { recursive: true });\n logPath = path.join(dir, 'debug.log');\n let size = 0;\n try {\n size = fs.statSync(logPath).size;\n } catch {\n /* file doesn't exist yet */\n }\n if (size > maxLogSize) {\n rotate(logPath);\n size = 0;\n }\n logFd = fs.openSync(logPath, 'a');\n logBytes = size;\n return logFd;\n } catch {\n return null;\n }\n}\n\nfunction timestamp(): string {\n return new Date().toISOString();\n}\n\n// Strip ANSI escape codes for clean log output\nfunction stripAnsi(str: string): string {\n return str.replace(/\\x1b\\[[0-9;]*m/g, '');\n}\n\nexport function debugLog(level: 'INFO' | 'ERROR' | 'DEBUG' | 'WARN', ...args: unknown[]): void {\n const fd = ensureLog();\n if (fd === null) return;\n const msg = args.map((a) => (typeof a === 'string' ? stripAnsi(a) : JSON.stringify(a))).join(' ');\n const line = `${timestamp()} [${level}] ${msg}\\n`;\n try {\n fs.writeSync(fd, line);\n } catch {\n return; // best effort: logging must never break the host\n }\n logBytes += Buffer.byteLength(line);\n // Rotate while running too: work web and the PTY host run for days, and\n // the cap used to be checked only when a process opened the log.\n if (logBytes > maxLogSize && logPath) {\n closeLog();\n rotate(logPath);\n }\n}\n\n/**\n * Patch console.log and console.error to also write to the debug log.\n * Call once at startup.\n */\nexport function installConsoleLogger(): void {\n const origLog = console.log.bind(console);\n const origError = console.error.bind(console);\n const origWarn = console.warn.bind(console);\n\n console.log = (...args: unknown[]) => {\n origLog(...args);\n debugLog('INFO', ...args);\n };\n\n console.error = (...args: unknown[]) => {\n origError(...args);\n debugLog('ERROR', ...args);\n };\n\n console.warn = (...args: unknown[]) => {\n origWarn(...args);\n debugLog('WARN', ...args);\n };\n}\n\n/** Write a debug-only message (not shown to user). */\nexport function debug(...args: unknown[]): void {\n debugLog('DEBUG', ...args);\n}\n\n/** Get the log file path. */\nexport function getLogPath(): string {\n ensureLog();\n return logPath ?? path.join(getConfigDir(), 'debug.log');\n}\n\n/** Flush and close the log stream. */\nexport function closeLog(): void {\n if (logFd !== null) {\n try {\n fs.closeSync(logFd);\n } catch {\n /* */\n }\n logFd = null;\n }\n}\n"],"mappings":";;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,QAAQ;AAGR,SAAS,gBAAwB;AACtC,SAAO,KAAK,KAAK,GAAG,QAAQ,GAAG,OAAO;AACxC;AAGO,SAAS,eAAuB;AACrC,QAAM,MAAM,KAAK,KAAK,GAAG,QAAQ,GAAG,OAAO;AAC3C,MAAI,CAAC,GAAG,WAAW,GAAG,GAAG;AACvB,OAAG,UAAU,KAAK,EAAE,WAAW,KAAK,CAAC;AAAA,EACvC;AACA,SAAO;AACT;;;AChBA,OAAOA,SAAQ;AACf,OAAOC,WAAU;AAGjB,IAAI,aAAa,IAAI,OAAO;AAE5B,IAAI,UAAyB;AAK7B,IAAI,QAAuB;AAE3B,IAAI,WAAW;AAOf,SAAS,OAAO,MAAoB;AAClC,QAAM,OAAO,OAAO;AACpB,MAAI;AACF,IAAAC,IAAG,WAAW,IAAI;AAAA,EACpB,QAAQ;AAAA,EAER;AACA,MAAI;AACF,IAAAA,IAAG,WAAW,MAAM,IAAI;AAAA,E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AAM,IAAI,SAAoB;AACpC,YAAQ,GAAG,IAAI;AACf,aAAS,QAAQ,GAAG,IAAI;AAAA,EAC1B;AAEA,UAAQ,QAAQ,IAAI,SAAoB;AACtC,cAAU,GAAG,IAAI;AACjB,aAAS,SAAS,GAAG,IAAI;AAAA,EAC3B;AAEA,UAAQ,OAAO,IAAI,SAAoB;AACrC,aAAS,GAAG,IAAI;AAChB,aAAS,QAAQ,GAAG,IAAI;AAAA,EAC1B;AACF;AAGO,SAAS,SAAS,MAAuB;AAC9C,WAAS,SAAS,GAAG,IAAI;AAC3B;AASO,SAAS,WAAiB;AAC/B,MAAI,UAAU,MAAM;AAClB,QAAI;AACF,MAAAE,IAAG,UAAU,KAAK;AAAA,IACpB,QAAQ;AAAA,IAER;AACA,YAAQ;AAAA,EACV;AACF;","names":["fs","path","fs","path","fs"]}
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
owedToYou,
|
|
4
4
|
stageWaiting
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-CNE5SWFH.js";
|
|
6
|
+
import {
|
|
7
|
+
atomicWriteFile
|
|
8
|
+
} from "./chunk-ZXHMC7UO.js";
|
|
6
9
|
import {
|
|
7
|
-
atomicWriteFile,
|
|
8
10
|
getConfigDir
|
|
9
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-6THUVP6T.js";
|
|
10
12
|
|
|
11
13
|
// src/core/sessions/session-view.ts
|
|
12
14
|
var RECENT_MS = 24 * 36e5;
|
|
@@ -206,4 +208,4 @@ export {
|
|
|
206
208
|
assistantContextDay,
|
|
207
209
|
readAssistantContext
|
|
208
210
|
};
|
|
209
|
-
//# sourceMappingURL=chunk-
|
|
211
|
+
//# sourceMappingURL=chunk-6XMH3WFY.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/sessions/session-view.ts","../src/core/agents/assistant.ts"],"sourcesContent":["import type { SessionAttention, ActivityState } from '../api-types.js';\nimport { stageWaiting, type PrStageKind } from '../pr/pr-stage.js';\nimport { owedToYou, type Owed } from '../status/attention.js';\n\n/** What the status vocabulary reads from a session: a dashboard row or\n * a `work sessions` row (both are SessionWire-shaped). */\nexport interface SessionLike {\n lastAccessedAt: string;\n lastActivity?: number | null;\n activityState?: ActivityState;\n attention?: SessionAttention | null;\n /** Unresolved review threads on its open PRs (SessionWire). */\n openReviewThreads?: number;\n /** Replies drafted to its review threads, waiting for your Post (SessionWire). */\n replyDrafts?: number;\n /** Where its pull request stands (SessionWire, pr-stage.ts). */\n prStage?: { kind: PrStageKind; text: string; seen?: boolean; prs?: ReadonlyArray<{ kind: PrStageKind; checks?: string }> } | null;\n /** Being archived right now (SessionWire.archiving). */\n archiving?: boolean;\n /** Being restored right now (SessionWire.restoring). */\n restoring?: boolean;\n /** Its Claude was stopped while idle and hasn't run since (SessionWire.asleep). */\n asleep?: boolean;\n}\n\n/**\n * ONE status vocabulary for every view — pure, so the dashboard (it imports\n * this) and `work sessions` say the same thing — (rail, Sessions table, inbox, header\n * strip). Hook-driven attention wins when a session has it; otherwise we fall\n * back to the older transcript-activity signal, so a session never shows two\n * contradicting states in two places.\n *\n * archiving — being archived right now (its Claude stopped, the rest\n * being saved); it leaves the list when done\n * restoring — being restored (its worktree made again, the conversation\n * put back); in the rail again from the click\n * needs_input — blocked on you (permission / question)\n * done — finished a turn you haven't looked at\n * working — mid-turn\n * background — its turn ended, a background agent that turn started is\n * still at it: still busy, but its prompt is free\n * asleep — its Claude was stopped while idle (idle sleep, `work stop`)\n * and hasn't run since: opening it starts it again\n * quiet — finished, and you've seen it\n * active/open/recent/stale — no hook status yet (its Claude has not\n * taken a turn since the dashboard's hooks went in, or runs a tool\n * without them): transcript activity only. Active ≤ 30 s, Open ≤ 5 min,\n * Idle (recent) within a day, Stale after that.\n */\nexport type DisplayKind =\n | 'archiving'\n | 'restoring'\n | 'needs_input'\n | 'done'\n | 'working'\n | 'background'\n | 'asleep'\n | 'quiet'\n | 'active'\n | 'open'\n | 'recent'\n | 'stale';\n\n/** Used today = not stale, whatever the hooks know. */\nexport const RECENT_MS = 24 * 3_600_000;\n\n/** When the session last did anything: the newest of its hook update,\n * Claude's last transcript write and the `work tree` entry. (Reading only\n * the entry time called a session Active and \"1d\" at once.) */\nexport function lastActiveAt(s: SessionLike): string {\n const candidates = [Date.parse(s.lastAccessedAt) || 0, s.lastActivity ?? 0, s.attention ? Date.parse(s.attention.updatedAt) || 0 : 0];\n return new Date(Math.max(...candidates)).toISOString();\n}\n\nexport function displayStatus(s: SessionLike, now: number = Date.now()): DisplayKind {\n if (s.archiving) return 'archiving';\n if (s.restoring) return 'restoring';\n const a = s.attention;\n if (a) {\n if (a.state === 'needs_input') return 'needs_input';\n if (a.state === 'working') return a.background ? 'background' : 'working';\n }\n // A finished turn you haven't looked at is yours to review, not Claude's state: the blue \"review\" badge says it\n // (owedToYou's 'turn'); the icon says what its Claude is — idle, or asleep.\n if (s.asleep) return 'asleep';\n if (a) return 'quiet';\n if (s.activityState === 'active') return 'active';\n if (s.activityState === 'open') return 'open';\n return now - Date.parse(lastActiveAt(s)) < RECENT_MS ? 'recent' : 'stale';\n}\n\nexport const DISPLAY_LABEL: Record<DisplayKind, string> = {\n archiving: 'Archiving',\n restoring: 'Restoring',\n needs_input: 'Needs your input',\n done: 'Done',\n working: 'Working',\n background: 'In background',\n asleep: 'Asleep',\n quiet: 'Idle',\n active: 'Active',\n open: 'Open',\n recent: 'Idle',\n stale: 'Stale',\n};\n\n/** What each status means, in words — the legend and the dots' tooltips. */\nexport const DISPLAY_MEANING: Record<DisplayKind, string> = {\n archiving:\n 'Being archived: its Claude is stopped, its conversation and uncommitted files are saved, and its worktree goes once nothing would be lost. It leaves the list when done; Restore brings it back.',\n restoring:\n 'Being restored: its worktree is made again from its branch, with its uncommitted files and conversation put back. Then it carries on where it was.',\n needs_input: 'Its Claude is waiting for you: a permission prompt or a question.',\n done: \"Its Claude finished a turn you haven't looked at yet: the Inbox's Done section. On a row it's the blue review badge, beside what its Claude is now.\",\n working: 'Its Claude is working on your last instruction right now.',\n background:\n 'Its Claude finished its turn, and a background agent that turn started is still at work. Its prompt is free: you can talk to it. The agent’s result comes back as a new turn.',\n asleep:\n 'Its Claude was stopped to free memory: idle for a while, nothing attached, nothing of it still running. Opening the session starts it again, where it left off.',\n quiet: \"Its Claude finished, and you've seen it. Nothing to do.\",\n active: \"Its Claude wrote in the last 30 seconds (it isn't reporting its status, so this is from its transcript).\",\n open: 'Its Claude wrote in the last 5 minutes, or is open and idle at its prompt.',\n recent: 'Used in the last day; nothing running now.',\n stale: 'Not used for over a day.',\n};\n\n/** The legend's rows, most urgent first. Idle covers `quiet` and `recent` (same colour, same word). */\nexport const LEGEND_KINDS: readonly DisplayKind[] = [\n 'needs_input',\n 'done',\n 'working',\n 'background',\n 'asleep',\n 'archiving',\n 'restoring',\n 'active',\n 'open',\n 'quiet',\n 'stale',\n];\n\n/**\n * How full a Claude conversation may get before it matters: past WARN the\n * header shows it amber and the PR watch's notes ask Claude to hand\n * mechanical work to a sub-agent; past FULL it's red (Claude compacts near\n * the window, and answers get vaguer before that).\n */\nexport const CONTEXT_WARN = 0.7;\nexport const CONTEXT_FULL = 0.9;\n\n/** How long ago a session was used, for the Sessions table's sections. */\nexport type AgeBucket = 'now' | 'week' | 'older';\n\nexport const AGE_LABEL: Record<AgeBucket, string> = {\n now: 'Now',\n week: 'This week',\n older: 'Older',\n};\n\nexport const WEEK_MS = 7 * 24 * 3_600_000;\n\n/** Now: wants you, is working, or was used in the last day. This week:\n * used within 7 days. Older: everything else — cleanup material. */\nexport function ageBucket(s: SessionLike, now: number = Date.now()): AgeBucket {\n const kind = displayStatus(s, now);\n if (owedToYou(s).length) return 'now';\n if (\n kind === 'needs_input' ||\n kind === 'done' ||\n kind === 'working' ||\n kind === 'background' ||\n kind === 'archiving' ||\n kind === 'restoring' ||\n kind === 'active' ||\n kind === 'open'\n )\n return 'now';\n const age = now - Date.parse(lastActiveAt(s));\n if (age < RECENT_MS) return 'now';\n return age < WEEK_MS ? 'week' : 'older';\n}\n\n/** Coarse buckets the Sessions header counts and filters by. */\nexport type StatusBucket = 'needs' | 'working' | 'idle' | 'stale';\n\nexport function statusBucket(kind: DisplayKind): StatusBucket {\n switch (kind) {\n case 'needs_input':\n case 'done':\n return 'needs';\n case 'working':\n case 'background':\n case 'archiving':\n case 'restoring':\n case 'active':\n return 'working';\n case 'quiet':\n case 'asleep':\n case 'open':\n case 'recent':\n return 'idle';\n case 'stale':\n return 'stale';\n default: {\n // Every kind is named above: a new one fails the type check here instead of landing in \"stale\" unasked.\n const unknown: never = kind;\n return unknown;\n }\n }\n}\n\n/** Why a session shows Active / Open / Idle(recent) / Stale instead of a\n * real status: its Claude isn't reporting through work web's hooks. */\nexport const NO_HOOKS_HINT =\n \"Its Claude isn't reporting its status (it was started before work web's hooks were installed, or it isn't Claude), so this is from its transcript activity: Active = wrote in the last 30 s, Open = last 5 min. Restart it with `work tree <target> <branch>` (the conversation continues) to get Working / Needs your input / Done.\";\n\n/** The hint for a status that comes from activity only; undefined otherwise. */\nexport function statusHint(kind: DisplayKind): string | undefined {\n return kind === 'active' || kind === 'open' || kind === 'recent' || kind === 'stale' ? NO_HOOKS_HINT : undefined;\n}\n\n/**\n * The second signal: what waits on you about a session, beside what its\n * Claude is doing (attention.ts `owedToYou`), in words. The rail's badge is\n * the first thing (\"1 reply\", \"merge\"; \"+1\" when there's more), its tooltip\n * all of them; the Sessions table and the Inbox say the same.\n */\nexport const OWED_SHORT: Record<Owed['kind'], (n: number) => string> = {\n turn: () => 'review',\n reply: (n) => `${n} ${n === 1 ? 'reply' : 'replies'}`,\n thread: (n) => `${n} ${n === 1 ? 'thread' : 'threads'}`,\n conflict: () => 'conflict',\n checks: () => 'CI',\n merge: () => 'merge',\n};\nexport const OWED_LONG: Record<Owed['kind'], (n: number) => string> = {\n turn: () => 'a finished turn to review',\n reply: (n) => `${n} ${n === 1 ? 'reply' : 'replies'} to post`,\n thread: (n) => `${n} review ${n === 1 ? 'thread' : 'threads'} with no answer`,\n conflict: (n) => (n === 1 ? 'a merge conflict' : `${n} PRs with merge conflicts`),\n checks: (n) => (n === 1 ? 'checks failing' : `${n} PRs with checks failing`),\n merge: () => 'ready to merge',\n};\n\nexport interface OwedBadge {\n /** \"1 reply\", \"merge +1\", \"review\". */\n text: string;\n /** What it leads with: a finished turn to review is blue (Done's colour), the rest pink. */\n kind: Owed['kind'];\n /** \"Needs you: 1 reply to post · ready to merge\". */\n title: string;\n}\n\n/** The badge for what waits on you, or null when nothing does. */\nexport function owedBadge(s: SessionLike): OwedBadge | null {\n const owed = owedToYou(s);\n if (!owed.length) return null;\n const [first, ...more] = owed;\n return {\n kind: first.kind,\n text: OWED_SHORT[first.kind](first.count) + (more.length ? ` +${more.length}` : ''),\n title: `Needs you: ${owed.map((o) => OWED_LONG[o.kind](o.count)).join(' · ')}`,\n };\n}\n\n/** Nothing waits on you, and its PR waits on others (reviewers, checks): \"in review\", said quietly. */\nexport function waitingOnOthers(s: SessionLike): boolean {\n return !owedToYou(s).length && stageWaiting(s.prStage);\n}\n\n/** The Sessions table's status filter: what waits on you counts as \"needs you\", whatever Claude is doing. */\nexport function sessionBucket(s: SessionLike, now: number = Date.now()): StatusBucket {\n return owedToYou(s).length ? 'needs' : statusBucket(displayStatus(s, now));\n}\n","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';\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, never --unsafe: 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];\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 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>\\`. Explain the change first. 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 GitHub, 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}\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.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(text: string, now = Date.now(), day?: string): void {\n fs.mkdirSync(assistantDir(), { recursive: true });\n const stored: StoredContext = { at: new Date(now).toISOString(), text, ...(day ? { day } : {}) };\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\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 dashboard] ${s.text}${dayNow ? `\\n${dayNow}` : ''}`;\n}\n"],"mappings":";;;;;;;;;;;AAgEO,IAAM,YAAY,KAAK;AAKvB,SAAS,aAAa,GAAwB;AACnD,QAAM,aAAa,CAAC,KAAK,MAAM,EAAE,cAAc,KAAK,GAAG,EAAE,gBAAgB,GAAG,EAAE,YAAY,KAAK,MAAM,EAAE,UAAU,SAAS,KAAK,IAAI,CAAC;AACpI,SAAO,IAAI,KAAK,KAAK,IAAI,GAAG,UAAU,CAAC,EAAE,YAAY;AACvD;AAEO,SAAS,cAAc,GAAgB,MAAc,KAAK,IAAI,GAAgB;AACnF,MAAI,EAAE,UA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B,YAAY,GAAG,KAAK,UAAU,MAAM,CAAC;AACvD;AAGO,SAAS,oBAAoB,MAAM,KAAK,IAAI,GAAkB;AACnE,QAAM,IAAI,WAAW,GAAG;AACxB,SAAO,KAAK,OAAO,EAAE,QAAQ,YAAY,sBAAsB,KAAK,EAAE,GAAG,IAAI,EAAE,MAAM;AACvF;AAEA,SAAS,WAAW,KAA4C;AAC9D,MAAI;AACF,UAAM,IAAI,KAAK,MAAM,GAAG,aAAa,YAAY,GAAG,OAAO,CAAC;AAC5D,QAAI,CAAC,KAAK,OAAO,EAAE,SAAS,YAAY,OAAO,EAAE,OAAO,SAAU,QAAO;AACzE,WAAO,MAAM,KAAK,MAAM,EAAE,EAAE,IAAI,iBAAiB,OAAO;AAAA,EAC1D,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAOO,SAAS,qBAAqB,MAAM,KAAK,IAAI,GAAG,QAAuC;AAC5F,QAAM,IAAI,WAAW,GAAG;AACxB,MAAI,CAAC,EAAG,QAAO;AACf,SAAO,oBAAoB,EAAE,IAAI,GAAG,SAAS;AAAA,EAAK,MAAM,KAAK,EAAE;AACjE;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/core/sessions/session-view.ts","../src/core/agents/assistant.ts"],"sourcesContent":["import type { SessionAttention, ActivityState } from '../api-types.js';\nimport { stageWaiting, type PrStageKind } from '../pr/pr-stage.js';\nimport { owedToYou, type Owed } from '../status/attention.js';\n\n/** What the status vocabulary reads from a session: a dashboard row or\n * a `work sessions` row (both are SessionWire-shaped). */\nexport interface SessionLike {\n lastAccessedAt: string;\n lastActivity?: number | null;\n activityState?: ActivityState;\n attention?: SessionAttention | null;\n /** Unresolved review threads on its open PRs (SessionWire). */\n openReviewThreads?: number;\n /** Replies drafted to its review threads, waiting for your Post (SessionWire). */\n replyDrafts?: number;\n /** Where its pull request stands (SessionWire, pr-stage.ts). */\n prStage?: { kind: PrStageKind; text: string; seen?: boolean; prs?: ReadonlyArray<{ kind: PrStageKind; checks?: string }> } | null;\n /** Being archived right now (SessionWire.archiving). */\n archiving?: boolean;\n /** Being restored right now (SessionWire.restoring). */\n restoring?: boolean;\n /** Its Claude was stopped while idle and hasn't run since (SessionWire.asleep). */\n asleep?: boolean;\n}\n\n/**\n * ONE status vocabulary for every view — pure, so the dashboard (it imports\n * this) and `work sessions` say the same thing — (rail, Sessions table, inbox, header\n * strip). Hook-driven attention wins when a session has it; otherwise we fall\n * back to the older transcript-activity signal, so a session never shows two\n * contradicting states in two places.\n *\n * archiving — being archived right now (its Claude stopped, the rest\n * being saved); it leaves the list when done\n * restoring — being restored (its worktree made again, the conversation\n * put back); in the rail again from the click\n * needs_input — blocked on you (permission / question)\n * done — finished a turn you haven't looked at\n * working — mid-turn\n * background — its turn ended, a background agent that turn started is\n * still at it: still busy, but its prompt is free\n * asleep — its Claude was stopped while idle (idle sleep, `work stop`)\n * and hasn't run since: opening it starts it again\n * quiet — finished, and you've seen it\n * active/open/recent/stale — no hook status yet (its Claude has not\n * taken a turn since the dashboard's hooks went in, or runs a tool\n * without them): transcript activity only. Active ≤ 30 s, Open ≤ 5 min,\n * Idle (recent) within a day, Stale after that.\n */\nexport type DisplayKind =\n | 'archiving'\n | 'restoring'\n | 'needs_input'\n | 'done'\n | 'working'\n | 'background'\n | 'asleep'\n | 'quiet'\n | 'active'\n | 'open'\n | 'recent'\n | 'stale';\n\n/** Used today = not stale, whatever the hooks know. */\nexport const RECENT_MS = 24 * 3_600_000;\n\n/** When the session last did anything: the newest of its hook update,\n * Claude's last transcript write and the `work tree` entry. (Reading only\n * the entry time called a session Active and \"1d\" at once.) */\nexport function lastActiveAt(s: SessionLike): string {\n const candidates = [Date.parse(s.lastAccessedAt) || 0, s.lastActivity ?? 0, s.attention ? Date.parse(s.attention.updatedAt) || 0 : 0];\n return new Date(Math.max(...candidates)).toISOString();\n}\n\nexport function displayStatus(s: SessionLike, now: number = Date.now()): DisplayKind {\n if (s.archiving) return 'archiving';\n if (s.restoring) return 'restoring';\n const a = s.attention;\n if (a) {\n if (a.state === 'needs_input') return 'needs_input';\n if (a.state === 'working') return a.background ? 'background' : 'working';\n }\n // A finished turn you haven't looked at is yours to review, not Claude's state: the blue \"review\" badge says it\n // (owedToYou's 'turn'); the icon says what its Claude is — idle, or asleep.\n if (s.asleep) return 'asleep';\n if (a) return 'quiet';\n if (s.activityState === 'active') return 'active';\n if (s.activityState === 'open') return 'open';\n return now - Date.parse(lastActiveAt(s)) < RECENT_MS ? 'recent' : 'stale';\n}\n\nexport const DISPLAY_LABEL: Record<DisplayKind, string> = {\n archiving: 'Archiving',\n restoring: 'Restoring',\n needs_input: 'Needs your input',\n done: 'Done',\n working: 'Working',\n background: 'In background',\n asleep: 'Asleep',\n quiet: 'Idle',\n active: 'Active',\n open: 'Open',\n recent: 'Idle',\n stale: 'Stale',\n};\n\n/** What each status means, in words — the legend and the dots' tooltips. */\nexport const DISPLAY_MEANING: Record<DisplayKind, string> = {\n archiving:\n 'Being archived: its Claude is stopped, its conversation and uncommitted files are saved, and its worktree goes once nothing would be lost. It leaves the list when done; Restore brings it back.',\n restoring:\n 'Being restored: its worktree is made again from its branch, with its uncommitted files and conversation put back. Then it carries on where it was.',\n needs_input: 'Its Claude is waiting for you: a permission prompt or a question.',\n done: \"Its Claude finished a turn you haven't looked at yet: the Inbox's Done section. On a row it's the blue review badge, beside what its Claude is now.\",\n working: 'Its Claude is working on your last instruction right now.',\n background:\n 'Its Claude finished its turn, and a background agent that turn started is still at work. Its prompt is free: you can talk to it. The agent’s result comes back as a new turn.',\n asleep:\n 'Its Claude was stopped to free memory: idle for a while, nothing attached, nothing of it still running. Opening the session starts it again, where it left off.',\n quiet: \"Its Claude finished, and you've seen it. Nothing to do.\",\n active: \"Its Claude wrote in the last 30 seconds (it isn't reporting its status, so this is from its transcript).\",\n open: 'Its Claude wrote in the last 5 minutes, or is open and idle at its prompt.',\n recent: 'Used in the last day; nothing running now.',\n stale: 'Not used for over a day.',\n};\n\n/** The legend's rows, most urgent first. Idle covers `quiet` and `recent` (same colour, same word). */\nexport const LEGEND_KINDS: readonly DisplayKind[] = [\n 'needs_input',\n 'done',\n 'working',\n 'background',\n 'asleep',\n 'archiving',\n 'restoring',\n 'active',\n 'open',\n 'quiet',\n 'stale',\n];\n\n/**\n * How full a Claude conversation may get before it matters: past WARN the\n * header shows it amber and the PR watch's notes ask Claude to hand\n * mechanical work to a sub-agent; past FULL it's red (Claude compacts near\n * the window, and answers get vaguer before that).\n */\nexport const CONTEXT_WARN = 0.7;\nexport const CONTEXT_FULL = 0.9;\n\n/** How long ago a session was used, for the Sessions table's sections. */\nexport type AgeBucket = 'now' | 'week' | 'older';\n\nexport const AGE_LABEL: Record<AgeBucket, string> = {\n now: 'Now',\n week: 'This week',\n older: 'Older',\n};\n\nexport const WEEK_MS = 7 * 24 * 3_600_000;\n\n/** Now: wants you, is working, or was used in the last day. This week:\n * used within 7 days. Older: everything else — cleanup material. */\nexport function ageBucket(s: SessionLike, now: number = Date.now()): AgeBucket {\n const kind = displayStatus(s, now);\n if (owedToYou(s).length) return 'now';\n if (\n kind === 'needs_input' ||\n kind === 'done' ||\n kind === 'working' ||\n kind === 'background' ||\n kind === 'archiving' ||\n kind === 'restoring' ||\n kind === 'active' ||\n kind === 'open'\n )\n return 'now';\n const age = now - Date.parse(lastActiveAt(s));\n if (age < RECENT_MS) return 'now';\n return age < WEEK_MS ? 'week' : 'older';\n}\n\n/** Coarse buckets the Sessions header counts and filters by. */\nexport type StatusBucket = 'needs' | 'working' | 'idle' | 'stale';\n\nexport function statusBucket(kind: DisplayKind): StatusBucket {\n switch (kind) {\n case 'needs_input':\n case 'done':\n return 'needs';\n case 'working':\n case 'background':\n case 'archiving':\n case 'restoring':\n case 'active':\n return 'working';\n case 'quiet':\n case 'asleep':\n case 'open':\n case 'recent':\n return 'idle';\n case 'stale':\n return 'stale';\n default: {\n // Every kind is named above: a new one fails the type check here instead of landing in \"stale\" unasked.\n const unknown: never = kind;\n return unknown;\n }\n }\n}\n\n/** Why a session shows Active / Open / Idle(recent) / Stale instead of a\n * real status: its Claude isn't reporting through work web's hooks. */\nexport const NO_HOOKS_HINT =\n \"Its Claude isn't reporting its status (it was started before work web's hooks were installed, or it isn't Claude), so this is from its transcript activity: Active = wrote in the last 30 s, Open = last 5 min. Restart it with `work tree <target> <branch>` (the conversation continues) to get Working / Needs your input / Done.\";\n\n/** The hint for a status that comes from activity only; undefined otherwise. */\nexport function statusHint(kind: DisplayKind): string | undefined {\n return kind === 'active' || kind === 'open' || kind === 'recent' || kind === 'stale' ? NO_HOOKS_HINT : undefined;\n}\n\n/**\n * The second signal: what waits on you about a session, beside what its\n * Claude is doing (attention.ts `owedToYou`), in words. The rail's badge is\n * the first thing (\"1 reply\", \"merge\"; \"+1\" when there's more), its tooltip\n * all of them; the Sessions table and the Inbox say the same.\n */\nexport const OWED_SHORT: Record<Owed['kind'], (n: number) => string> = {\n turn: () => 'review',\n reply: (n) => `${n} ${n === 1 ? 'reply' : 'replies'}`,\n thread: (n) => `${n} ${n === 1 ? 'thread' : 'threads'}`,\n conflict: () => 'conflict',\n checks: () => 'CI',\n merge: () => 'merge',\n};\nexport const OWED_LONG: Record<Owed['kind'], (n: number) => string> = {\n turn: () => 'a finished turn to review',\n reply: (n) => `${n} ${n === 1 ? 'reply' : 'replies'} to post`,\n thread: (n) => `${n} review ${n === 1 ? 'thread' : 'threads'} with no answer`,\n conflict: (n) => (n === 1 ? 'a merge conflict' : `${n} PRs with merge conflicts`),\n checks: (n) => (n === 1 ? 'checks failing' : `${n} PRs with checks failing`),\n merge: () => 'ready to merge',\n};\n\nexport interface OwedBadge {\n /** \"1 reply\", \"merge +1\", \"review\". */\n text: string;\n /** What it leads with: a finished turn to review is blue (Done's colour), the rest pink. */\n kind: Owed['kind'];\n /** \"Needs you: 1 reply to post · ready to merge\". */\n title: string;\n}\n\n/** The badge for what waits on you, or null when nothing does. */\nexport function owedBadge(s: SessionLike): OwedBadge | null {\n const owed = owedToYou(s);\n if (!owed.length) return null;\n const [first, ...more] = owed;\n return {\n kind: first.kind,\n text: OWED_SHORT[first.kind](first.count) + (more.length ? ` +${more.length}` : ''),\n title: `Needs you: ${owed.map((o) => OWED_LONG[o.kind](o.count)).join(' · ')}`,\n };\n}\n\n/** Nothing waits on you, and its PR waits on others (reviewers, checks): \"in review\", said quietly. */\nexport function waitingOnOthers(s: SessionLike): boolean {\n return !owedToYou(s).length && stageWaiting(s.prStage);\n}\n\n/** The Sessions table's status filter: what waits on you counts as \"needs you\", whatever Claude is doing. */\nexport function sessionBucket(s: SessionLike, now: number = Date.now()): StatusBucket {\n return owedToYou(s).length ? 'needs' : statusBucket(displayStatus(s, now));\n}\n","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';\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, never --unsafe: 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];\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 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>\\`. Explain the change first. 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 GitHub, 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}\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.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(text: string, now = Date.now(), day?: string): void {\n fs.mkdirSync(assistantDir(), { recursive: true });\n const stored: StoredContext = { at: new Date(now).toISOString(), text, ...(day ? { day } : {}) };\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\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 dashboard] ${s.text}${dayNow ? `\\n${dayNow}` : ''}`;\n}\n"],"mappings":";;;;;;;;;;;;;AAgEO,IAAM,YAAY,KAAK;AAKvB,SAAS,aAAa,GAAwB;AACnD,QAAM,aAAa,CAAC,KAAK,MAAM,EAAE,cAAc,KAAK,GAAG,EAAE,gBAAgB,GAAG,EAAE,YAAY,KAAK,MAAM,EAAE,UAAU,SAAS,KAAK,IAAI,CAAC;AACpI,SAAO,IAAI,KAAK,KAAK,IAAI,GAAG,UAAU,CAAC,EAAE,YAAY;AACvD;AAEO,SAAS,cAAc,GAAgB,MAAc,KAAK,IAAI,GAAgB;AACnF,MAAI,EAAE,UAAW,QAAO;AACxB,MAAI,EAAE,UAAW,QAAO;AACxB,QAAM,IAAI,EAAE;AACZ,MAAI,GAAG;AACL,QAAI,EAAE,UAAU,cAAe,QAAO;AACtC,QAAI,EAAE,UAAU,UAAW,QAAO,EAAE,aAAa,eAAe;AAAA,EAClE;AAGA,MAAI,EAAE,OAAQ,QAAO;AACrB,MAAI,EAAG,QAAO;AACd,MAAI,EAAE,kBAAkB,SAAU,QAAO;AACzC,MAAI,EAAE,kBAAkB,OAAQ,QAAO;AACvC,SAAO,MAAM,KAAK,MAAM,aAAa,CAAC,CAAC,IAAI,YAAY,WAAW;AACpE;AAEO,IAAM,gBAA6C;AAAA,EAC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AAK,MAAM,EAAE,EAAE,IAAI,iBAAiB,OAAO;AAAA,EAC1D,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAOO,SAAS,qBAAqB,MAAM,KAAK,IAAI,GAAG,QAAuC;AAC5F,QAAM,IAAI,WAAW,GAAG;AACxB,MAAI,CAAC,EAAG,QAAO;AACf,SAAO,oBAAoB,EAAE,IAAI,GAAG,SAAS;AAAA,EAAK,MAAM,KAAK,EAAE;AACjE;","names":[]}
|
|
@@ -1,47 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
agedWindow
|
|
4
|
+
} from "./chunk-P2HOLCBF.js";
|
|
2
5
|
import {
|
|
3
6
|
sessionTokens
|
|
4
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-X63DS7BW.js";
|
|
5
8
|
import {
|
|
6
9
|
lastConversationWriteMs,
|
|
7
10
|
loadHistory,
|
|
8
11
|
logSwallowed
|
|
9
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-CNE5SWFH.js";
|
|
10
13
|
import {
|
|
11
14
|
dayKey
|
|
12
15
|
} from "./chunk-NEJVK5CF.js";
|
|
13
16
|
import {
|
|
14
17
|
sessionIdFor
|
|
15
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-YYBXQBW2.js";
|
|
16
19
|
import {
|
|
17
20
|
knownAgents
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
|
|
20
|
-
// src/core/usage/usage.ts
|
|
21
|
-
function agedWindow(w, now) {
|
|
22
|
-
if (w.resetsAt === null) return w;
|
|
23
|
-
const at = Date.parse(w.resetsAt);
|
|
24
|
-
if (!Number.isFinite(at) || at > now) return w;
|
|
25
|
-
return { ...w, usedPercent: 0, reset: true };
|
|
26
|
-
}
|
|
27
|
-
function formatTokens(n) {
|
|
28
|
-
const one = (v) => String(Math.round(v * 10) / 10);
|
|
29
|
-
const x = Math.max(0, Math.round(n));
|
|
30
|
-
if (x < 1e3) return String(x);
|
|
31
|
-
if (x < 1e4) return `${one(x / 1e3)}k`;
|
|
32
|
-
if (Math.round(x / 1e3) < 1e3) return `${Math.round(x / 1e3)}k`;
|
|
33
|
-
if (x < 1e7) return `${one(x / 1e6)}M`;
|
|
34
|
-
if (Math.round(x / 1e6) < 1e3) return `${Math.round(x / 1e6)}M`;
|
|
35
|
-
return `${one(x / 1e9)}B`;
|
|
36
|
-
}
|
|
37
|
-
var WEEKDAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
38
|
-
var clock = (d) => `${String(d.getHours()).padStart(2, "0")}:${String(d.getMinutes()).padStart(2, "0")}`;
|
|
39
|
-
function resetPhrase(resetsAt, now) {
|
|
40
|
-
const at = resetsAt ? Date.parse(resetsAt) : NaN;
|
|
41
|
-
if (!Number.isFinite(at)) return "";
|
|
42
|
-
const d = new Date(at);
|
|
43
|
-
return at - now < 24 * 36e5 ? `resets ${clock(d)}` : `resets ${WEEKDAYS[d.getDay()]} ${clock(d)}`;
|
|
44
|
-
}
|
|
21
|
+
} from "./chunk-F6M255O5.js";
|
|
45
22
|
|
|
46
23
|
// src/core/usage/usage-source.ts
|
|
47
24
|
var WEEK_DAYS = 7;
|
|
@@ -150,11 +127,9 @@ async function restoreAgentUsage(agents) {
|
|
|
150
127
|
}
|
|
151
128
|
|
|
152
129
|
export {
|
|
153
|
-
formatTokens,
|
|
154
|
-
resetPhrase,
|
|
155
130
|
buildUsage,
|
|
156
131
|
realUsageDeps,
|
|
157
132
|
setupAgentUsage,
|
|
158
133
|
restoreAgentUsage
|
|
159
134
|
};
|
|
160
|
-
//# sourceMappingURL=chunk-
|
|
135
|
+
//# sourceMappingURL=chunk-A42MFPMC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/usage/usage-source.ts","../src/core/usage/usage-setup.ts"],"sourcesContent":["import { knownAgents } from '../agents/index.js';\nimport { sessionTokens } from '../conversations/work-time-source.js';\nimport { dayKey } from '../conversations/work-time-view.js';\nimport { loadHistory } from '../sessions/history.js';\nimport { sessionIdFor } from '../sessions/session-id.js';\nimport { logSwallowed } from '../platform/best-effort.js';\nimport { lastConversationWriteMs } from '../sessions/session-activity.js';\nimport type { WorktreeSession } from '../sessions/session-types.js';\nimport type { TokenTotals, UsageWire } from '../api-types.js';\nimport type { AgentUsageSource } from '../agents/types.js';\nimport { agedWindow } from './usage.js';\n\n/**\n * What GET /api/usage and `work usage` answer: each agent's plan limits as\n * the last reading says (aged to now) and the tokens its sessions' transcripts\n * show, today and over the last 7 days. The I/O comes in through `deps`.\n */\n\nconst WEEK_DAYS = 7;\nconst TOP_SESSIONS = 5;\n\nexport interface UsageDeps {\n /** The agents that may have a usage part. */\n agents(): Array<{ id: string; name: string; usage?: Pick<AgentUsageSource, 'read'> }>;\n /** Sessions worth reading: live ones its agent wrote in lately. */\n sessions(now: number): WorktreeSession[];\n tokens(s: WorktreeSession, sinceDay: string): Promise<Record<string, Record<string, TokenTotals>>>;\n label(s: WorktreeSession): string;\n}\n\nconst zero = (): TokenTotals => ({ input: 0, cached: 0, output: 0 });\n\nfunction add(into: TokenTotals, t: TokenTotals): void {\n into.input += t.input;\n into.cached += t.cached;\n into.output += t.output;\n}\n\n/** The `week` days begin at: today and the 6 local days before it (by the calendar, not 24 h steps). */\nexport function weekStartDay(now: number): string {\n const d = new Date(now);\n d.setDate(d.getDate() - (WEEK_DAYS - 1));\n return dayKey(d.getTime());\n}\n\nexport async function buildUsage(deps: UsageDeps, now = Date.now()): Promise<UsageWire> {\n const agents: UsageWire['agents'] = [];\n for (const a of deps.agents()) {\n if (!a.usage) continue;\n agents.push({\n agent: a.id,\n name: a.name,\n accounts: a.usage.read().map((acc) => ({ ...acc, windows: acc.windows.map((w) => agedWindow(w, now)) })),\n });\n }\n\n const today = dayKey(now);\n const since = weekStartDay(now);\n const todayTotal = zero();\n const weekTotal = zero();\n const models = new Map<string, { today: TokenTotals; week: TokenTotals }>();\n const perSession: Array<{ id: string; label: string; week: TokenTotals }> = [];\n for (const s of deps.sessions(now)) {\n let days: Record<string, Record<string, TokenTotals>>;\n try {\n days = await deps.tokens(s, since);\n } catch (e) {\n logSwallowed(`usage: tokens of ${sessionIdFor(s)}`, e);\n continue; // one unreadable session doesn't hide the rest\n }\n const week = zero();\n for (const [day, byModel] of Object.entries(days)) {\n if (day < since || day > today) continue;\n for (const [model, t] of Object.entries(byModel)) {\n const m = models.get(model) ?? { today: zero(), week: zero() };\n models.set(model, m);\n add(m.week, t);\n add(weekTotal, t);\n add(week, t);\n if (day === today) {\n add(m.today, t);\n add(todayTotal, t);\n }\n }\n }\n if (week.input + week.output > 0) perSession.push({ id: sessionIdFor(s), label: deps.label(s), week });\n }\n\n const size = (t: TokenTotals) => t.input + t.output;\n return {\n agents,\n tokens: {\n today: todayTotal,\n week: weekTotal,\n byModel: [...models].map(([model, v]) => ({ model, ...v })).sort((a, b) => size(b.week) - size(a.week)),\n topSessions: perSession.sort((a, b) => size(b.week) - size(a.week)).slice(0, TOP_SESSIONS),\n },\n at: new Date(now).toISOString(),\n };\n}\n\n/** The sessions whose tokens can fall in the week: not archived, and their agent wrote in the last 7 days. */\nexport function usageSessions(all: WorktreeSession[], lastWriteMs: (s: WorktreeSession) => number, now: number): WorktreeSession[] {\n return all.filter((s) => !s.archivedAt && lastWriteMs(s) >= now - WEEK_DAYS * 24 * 3_600_000);\n}\n\nexport function realUsageDeps(): UsageDeps {\n return {\n agents: () => knownAgents(),\n sessions: (now) => usageSessions(loadHistory(), lastConversationWriteMs, now),\n tokens: sessionTokens,\n label: (s) => `${s.target} · ${s.title ? s.title : s.branch}`,\n };\n}\n","import { logSwallowed } from '../platform/best-effort.js';\nimport type { AgentUsageSource } from '../agents/types.js';\n\n/** What setup and restore need of an agent: its name and usage part (AgentAdapter fits). */\nexport interface UsageAgent {\n id: string;\n name: string;\n usage?: Pick<AgentUsageSource, 'setup' | 'restore'>;\n}\n\n/**\n * Work web's start: every agent with a usage part puts in place (or, with config `usage.statusLine: false`, takes away)\n * what records its readings. One agent's failure is logged and the rest go on; what each did is returned.\n */\nexport async function setupAgentUsage(\n agents: readonly UsageAgent[],\n config: { usage?: { statusLine?: boolean } } | null,\n lean: boolean,\n): Promise<Array<{ agent: string; message: string }>> {\n const enabled = config?.usage?.statusLine !== false;\n const done: Array<{ agent: string; message: string }> = [];\n for (const a of agents) {\n if (!a.usage?.setup) continue;\n try {\n done.push({ agent: a.id, message: await a.usage.setup({ enabled, lean }) });\n } catch (e) {\n logSwallowed(`set up ${a.name}'s usage readings`, e);\n }\n }\n return done;\n}\n\n/** `work usage --restore`: each agent gives its own setting back. A failure is that agent's `ok: false`, with why. */\nexport async function restoreAgentUsage(\n agents: readonly UsageAgent[],\n): Promise<Array<{ agent: string; name: string; ok: boolean; message: string }>> {\n const out: Array<{ agent: string; name: string; ok: boolean; message: string }> = [];\n for (const a of agents) {\n if (!a.usage?.restore) continue;\n try {\n out.push({ agent: a.id, name: a.name, ...(await a.usage.restore()) });\n } catch (e) {\n out.push({ agent: a.id, name: a.name, ok: false, message: e instanceof Error ? e.message : String(e) });\n }\n }\n return out;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAkBA,IAAM,YAAY;AAClB,IAAM,eAAe;AAWrB,IAAM,OAAO,OAAoB,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,EAAE;AAElE,SAAS,IAAI,MAAmB,GAAsB;AACpD,OAAK,SAAS,EAAE;AAChB,OAAK,UAAU,EAAE;AACjB,OAAK,UAAU,EAAE;AACnB;AAGO,SAAS,aAAa,KAAqB;AAChD,QAAM,IAAI,IAAI,KAAK,GAAG;AACtB,IAAE,QAAQ,EAAE,QAAQ,KAAK,YAAY,EAAE;AACvC,SAAO,OAAO,EAAE,QAAQ,CAAC;AAC3B;AAEA,eAAsB,WAAW,MAAiB,MAAM,KAAK,IAAI,GAAuB;AACtF,QAAM,SAA8B,CAAC;AACrC,aAAW,KAAK,KAAK,OAAO,GAAG;AAC7B,QAAI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AAS,GAAG;AACV,mBAAa,UAAU,EAAE,IAAI,qBAAqB,CAAC;AAAA,IACrD;AAAA,EACF;AACA,SAAO;AACT;AAGA,eAAsB,kBACpB,QAC+E;AAC/E,QAAM,MAA4E,CAAC;AACnF,aAAW,KAAK,QAAQ;AACtB,QAAI,CAAC,EAAE,OAAO,QAAS;AACvB,QAAI;AACF,UAAI,KAAK,EAAE,OAAO,EAAE,IAAI,MAAM,EAAE,MAAM,GAAI,MAAM,EAAE,MAAM,QAAQ,EAAG,CAAC;AAAA,IACtE,SAAS,GAAG;AACV,UAAI,KAAK,EAAE,OAAO,EAAE,IAAI,MAAM,EAAE,MAAM,IAAI,OAAO,SAAS,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC,EAAE,CAAC;AAAA,IACxG;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
debugLog
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6THUVP6T.js";
|
|
5
5
|
|
|
6
6
|
// src/core/platform/report.ts
|
|
7
7
|
import { AsyncLocalStorage } from "async_hooks";
|
|
@@ -48,4 +48,4 @@ export {
|
|
|
48
48
|
collectingReporter,
|
|
49
49
|
keepingWarnings
|
|
50
50
|
};
|
|
51
|
-
//# sourceMappingURL=chunk-
|
|
51
|
+
//# sourceMappingURL=chunk-AU27USPZ.js.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
git
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3N3UQEC4.js";
|
|
5
5
|
import {
|
|
6
6
|
writeTempTree
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-CNE5SWFH.js";
|
|
8
8
|
import {
|
|
9
9
|
spawn_default
|
|
10
10
|
} from "./chunk-RCYI7SRA.js";
|
|
11
11
|
import {
|
|
12
12
|
report
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-AU27USPZ.js";
|
|
14
14
|
|
|
15
15
|
// src/core/diff/diff-pipeline.ts
|
|
16
16
|
import fs2 from "fs";
|
|
@@ -534,4 +534,4 @@ export {
|
|
|
534
534
|
computeDiff,
|
|
535
535
|
computeRangeDiff
|
|
536
536
|
};
|
|
537
|
-
//# sourceMappingURL=chunk-
|
|
537
|
+
//# sourceMappingURL=chunk-BT7SZQQL.js.map
|