@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,372 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
spawn_default
|
|
4
|
+
} from "./chunk-RCYI7SRA.js";
|
|
5
|
+
import {
|
|
6
|
+
getConfigDir
|
|
7
|
+
} from "./chunk-6THUVP6T.js";
|
|
8
|
+
|
|
9
|
+
// src/core/agents/claude/rate-limits.ts
|
|
10
|
+
import os from "os";
|
|
11
|
+
import path from "path";
|
|
12
|
+
import { createHash } from "crypto";
|
|
13
|
+
var isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
14
|
+
var clampPercent = (n) => Math.round(Math.min(100, Math.max(0, n)) * 10) / 10;
|
|
15
|
+
function resetIso(v) {
|
|
16
|
+
let ms;
|
|
17
|
+
if (typeof v === "number" && Number.isFinite(v)) ms = v < 1e12 ? v * 1e3 : v;
|
|
18
|
+
else if (typeof v === "string" && v.trim() !== "") ms = Date.parse(v);
|
|
19
|
+
else return null;
|
|
20
|
+
return Number.isFinite(ms) ? new Date(ms).toISOString() : null;
|
|
21
|
+
}
|
|
22
|
+
var capitalise = (s) => s.charAt(0).toUpperCase() + s.slice(1);
|
|
23
|
+
function labelOf(key) {
|
|
24
|
+
if (key === "five_hour") return "5-hour limit";
|
|
25
|
+
if (key === "seven_day") return "Weekly limit";
|
|
26
|
+
const named = /^seven_day_(.+)$/.exec(key);
|
|
27
|
+
if (named) return `Weekly ${capitalise(named[1].replace(/_/g, " "))} limit`;
|
|
28
|
+
const span = /^(\d+)_(hour|day)$/.exec(key);
|
|
29
|
+
if (span) return `${span[1]}-${span[2]} limit`;
|
|
30
|
+
return `${capitalise(key.replace(/_/g, " "))} limit`;
|
|
31
|
+
}
|
|
32
|
+
var rank = (key) => key === "five_hour" ? 0 : key === "seven_day" ? 1 : 2;
|
|
33
|
+
function parseClaudeRateLimits(raw) {
|
|
34
|
+
if (!isRecord(raw)) return [];
|
|
35
|
+
const windows = [];
|
|
36
|
+
const keys = Object.keys(raw).filter((k) => k !== "spend_limit").sort((a, b) => rank(a) - rank(b) || a.localeCompare(b));
|
|
37
|
+
for (const key of keys) {
|
|
38
|
+
const w = raw[key];
|
|
39
|
+
if (!isRecord(w) || typeof w.used_percentage !== "number" || !Number.isFinite(w.used_percentage)) continue;
|
|
40
|
+
windows.push({ id: key, label: labelOf(key), usedPercent: clampPercent(w.used_percentage), resetsAt: resetIso(w.resets_at) });
|
|
41
|
+
}
|
|
42
|
+
const spend = raw.spend_limit;
|
|
43
|
+
if (isRecord(spend)) {
|
|
44
|
+
const { used_percentage: pct, used_usd: used, limit_usd: limit } = spend;
|
|
45
|
+
let percent = null;
|
|
46
|
+
if (typeof pct === "number" && Number.isFinite(pct)) percent = pct;
|
|
47
|
+
else if (typeof used === "number" && typeof limit === "number" && Number.isFinite(used) && Number.isFinite(limit) && limit > 0)
|
|
48
|
+
percent = used / limit * 100;
|
|
49
|
+
if (percent !== null) {
|
|
50
|
+
windows.push({ id: "spend_limit", label: "Spend limit", usedPercent: clampPercent(percent), resetsAt: resetIso(spend.resets_at) });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return windows;
|
|
54
|
+
}
|
|
55
|
+
function accountOf(configDir) {
|
|
56
|
+
if (!configDir) return "default";
|
|
57
|
+
const norm = (p) => process.platform === "win32" ? path.resolve(p).toLowerCase() : path.resolve(p);
|
|
58
|
+
const resolved = norm(configDir);
|
|
59
|
+
if (resolved === norm(path.join(os.homedir(), ".claude"))) return "default";
|
|
60
|
+
const hash = createHash("sha1").update(resolved).digest("hex");
|
|
61
|
+
return `cfg-${hash.slice(0, 8)}`;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// src/core/platform/process.ts
|
|
65
|
+
import fs from "fs";
|
|
66
|
+
import os2 from "os";
|
|
67
|
+
import { execFile, spawn, spawnSync } from "child_process";
|
|
68
|
+
function detachHere(platform = process.platform) {
|
|
69
|
+
return platform !== "win32";
|
|
70
|
+
}
|
|
71
|
+
function isPidAlive(pid) {
|
|
72
|
+
try {
|
|
73
|
+
process.kill(pid, 0);
|
|
74
|
+
} catch {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
return !isZombie(pid);
|
|
78
|
+
}
|
|
79
|
+
function isZombie(pid, read = procFs, platform = process.platform) {
|
|
80
|
+
if (platform !== "linux") return false;
|
|
81
|
+
const stat = read.file(`/proc/${pid}/stat`) ?? "";
|
|
82
|
+
const close = stat.lastIndexOf(")");
|
|
83
|
+
return close >= 0 && stat[close + 2] === "Z";
|
|
84
|
+
}
|
|
85
|
+
var procFs = {
|
|
86
|
+
link: (p) => {
|
|
87
|
+
try {
|
|
88
|
+
return fs.readlinkSync(p);
|
|
89
|
+
} catch {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
file: (p) => {
|
|
94
|
+
try {
|
|
95
|
+
return fs.readFileSync(p, "utf-8");
|
|
96
|
+
} catch {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
pids: () => {
|
|
101
|
+
try {
|
|
102
|
+
return fs.readdirSync("/proc").filter((n) => /^\d+$/.test(n)).map(Number);
|
|
103
|
+
} catch {
|
|
104
|
+
return [];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
var baseName = (p) => p.split("/").pop() || p;
|
|
109
|
+
function linuxProcessName(pid, read = procFs) {
|
|
110
|
+
const exe = read.link(`/proc/${pid}/exe`);
|
|
111
|
+
if (exe) return baseName(exe.replace(/ \(deleted\)$/, ""));
|
|
112
|
+
const argv0 = (read.file(`/proc/${pid}/cmdline`) ?? "").split("\0")[0];
|
|
113
|
+
if (argv0) return baseName(argv0.split(" ")[0]);
|
|
114
|
+
const comm = (read.file(`/proc/${pid}/comm`) ?? "").trim();
|
|
115
|
+
return comm || null;
|
|
116
|
+
}
|
|
117
|
+
function linuxProcessTable(read = procFs) {
|
|
118
|
+
const out = /* @__PURE__ */ new Map();
|
|
119
|
+
for (const pid of read.pids()) {
|
|
120
|
+
const name = linuxProcessName(pid, read);
|
|
121
|
+
if (name) out.set(pid, name);
|
|
122
|
+
}
|
|
123
|
+
return out;
|
|
124
|
+
}
|
|
125
|
+
function processName(pid) {
|
|
126
|
+
try {
|
|
127
|
+
if (process.platform === "win32") {
|
|
128
|
+
const r2 = spawnSync("tasklist", ["/FI", `PID eq ${pid}`, "/FO", "CSV", "/NH"], {
|
|
129
|
+
encoding: "utf-8",
|
|
130
|
+
windowsHide: true,
|
|
131
|
+
timeout: 5e3
|
|
132
|
+
});
|
|
133
|
+
const m = /^"([^"]+)","(\d+)"/.exec((r2.stdout ?? "").trim());
|
|
134
|
+
return m && Number(m[2]) === pid ? m[1] : null;
|
|
135
|
+
}
|
|
136
|
+
if (process.platform === "linux") return isPidAlive(pid) ? linuxProcessName(pid) : null;
|
|
137
|
+
const r = spawnSync("ps", ["-o", "comm=", "-p", String(pid)], { encoding: "utf-8", timeout: 5e3, windowsHide: true });
|
|
138
|
+
const name = (r.stdout ?? "").trim();
|
|
139
|
+
return r.status === 0 && name ? name.split("/").pop() : null;
|
|
140
|
+
} catch {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
var recentTable = null;
|
|
145
|
+
var refreshingTable = null;
|
|
146
|
+
function recentProcessTable(maxAgeMs, now = Date.now()) {
|
|
147
|
+
if (!recentTable || now - recentTable.at >= maxAgeMs) {
|
|
148
|
+
refreshingTable ??= processTableAsync().then((table) => void (table.size > 0 && (recentTable = { at: Date.now(), table }))).finally(() => void (refreshingTable = null));
|
|
149
|
+
}
|
|
150
|
+
return recentTable?.table ?? null;
|
|
151
|
+
}
|
|
152
|
+
function processTableAsync() {
|
|
153
|
+
if (process.platform === "linux") return Promise.resolve(linuxProcessTable());
|
|
154
|
+
return new Promise((resolve) => {
|
|
155
|
+
const win = process.platform === "win32";
|
|
156
|
+
const [cmd, args] = win ? ["tasklist", ["/FO", "CSV", "/NH"]] : ["ps", ["-A", "-o", "pid=,comm="]];
|
|
157
|
+
execFile(
|
|
158
|
+
cmd,
|
|
159
|
+
args,
|
|
160
|
+
{ encoding: "utf-8", windowsHide: true, timeout: 8e3, maxBuffer: 16 * 1024 * 1024 },
|
|
161
|
+
(_err, stdout) => {
|
|
162
|
+
resolve(parseProcessTable(stdout ?? "", win));
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
function parseProcessTable(stdout, win) {
|
|
168
|
+
const out = /* @__PURE__ */ new Map();
|
|
169
|
+
for (const line of stdout.split(/\r?\n/)) {
|
|
170
|
+
if (win) {
|
|
171
|
+
const m = /^"([^"]+)","(\d+)"/.exec(line);
|
|
172
|
+
if (m) out.set(Number(m[2]), m[1]);
|
|
173
|
+
} else {
|
|
174
|
+
const m = /^\s*(\d+)\s+(.+)$/.exec(line);
|
|
175
|
+
if (m) out.set(Number(m[1]), m[2].trim().split("/").pop());
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return out;
|
|
179
|
+
}
|
|
180
|
+
function processTable() {
|
|
181
|
+
if (process.platform === "linux") return linuxProcessTable();
|
|
182
|
+
try {
|
|
183
|
+
const win = process.platform === "win32";
|
|
184
|
+
const r = win ? spawnSync("tasklist", ["/FO", "CSV", "/NH"], { encoding: "utf-8", windowsHide: true, timeout: 8e3, maxBuffer: 16 * 1024 * 1024 }) : spawnSync("ps", ["-A", "-o", "pid=,comm="], { encoding: "utf-8", timeout: 8e3, windowsHide: true, maxBuffer: 16 * 1024 * 1024 });
|
|
185
|
+
return parseProcessTable(r.stdout ?? "", win);
|
|
186
|
+
} catch {
|
|
187
|
+
return /* @__PURE__ */ new Map();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function bootTime() {
|
|
191
|
+
return Date.now() - os2.uptime() * 1e3;
|
|
192
|
+
}
|
|
193
|
+
function killTree(pid) {
|
|
194
|
+
if (process.platform === "win32") {
|
|
195
|
+
return spawnSync("taskkill", ["/PID", String(pid), "/T", "/F"], { stdio: "ignore", windowsHide: true }).status === 0;
|
|
196
|
+
}
|
|
197
|
+
try {
|
|
198
|
+
process.kill(pid);
|
|
199
|
+
return true;
|
|
200
|
+
} catch {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
function killTreeAsync(pid) {
|
|
205
|
+
if (process.platform !== "win32") return Promise.resolve(killTree(pid) || !isPidAlive(pid));
|
|
206
|
+
return new Promise(
|
|
207
|
+
(resolve) => (
|
|
208
|
+
// taskkill fails the whole call when one child had already exited or won't go; the top gone is what counts.
|
|
209
|
+
execFile(
|
|
210
|
+
"taskkill",
|
|
211
|
+
["/PID", String(pid), "/T", "/F"],
|
|
212
|
+
{ windowsHide: true, timeout: 1e4 },
|
|
213
|
+
(err) => resolve(!err || !isPidAlive(pid))
|
|
214
|
+
)
|
|
215
|
+
)
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
function spawnDetachedWork(workBin, args, logFile) {
|
|
219
|
+
const log = fs.openSync(logFile, "a");
|
|
220
|
+
try {
|
|
221
|
+
const child = spawn(process.execPath, [workBin, ...args], {
|
|
222
|
+
detached: true,
|
|
223
|
+
stdio: ["ignore", log, log],
|
|
224
|
+
windowsHide: true,
|
|
225
|
+
// Not the caller's folder: a long-lived server working from it keeps it
|
|
226
|
+
// in use on Windows — a worktree then can't be removed, the desktop
|
|
227
|
+
// app's install folder can't be updated.
|
|
228
|
+
cwd: os2.homedir()
|
|
229
|
+
});
|
|
230
|
+
child.unref();
|
|
231
|
+
} finally {
|
|
232
|
+
fs.closeSync(log);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// src/core/agents/claude/statusline-run.ts
|
|
237
|
+
import fs2 from "fs";
|
|
238
|
+
import path2 from "path";
|
|
239
|
+
var WORK_STATUSLINE = "work hook statusline";
|
|
240
|
+
var NESTED_ENV = "WORK_STATUSLINE_NESTED";
|
|
241
|
+
var isRecord2 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
242
|
+
var savedPath = (configDir) => {
|
|
243
|
+
const account = accountOf(configDir);
|
|
244
|
+
return path2.join(getConfigDir(), account === "default" ? "statusline.json" : `statusline-${account}.json`);
|
|
245
|
+
};
|
|
246
|
+
var isOurs = (v) => isRecord2(v) && typeof v.command === "string" && /\bhook\s+statusline\b/.test(v.command);
|
|
247
|
+
function readSaved(configDir) {
|
|
248
|
+
let text;
|
|
249
|
+
try {
|
|
250
|
+
text = fs2.readFileSync(savedPath(configDir), "utf-8");
|
|
251
|
+
} catch (e) {
|
|
252
|
+
const code = e.code;
|
|
253
|
+
return code === "ENOENT" ? { kind: "missing" } : { kind: "unreadable", why: code ?? String(e) };
|
|
254
|
+
}
|
|
255
|
+
let v;
|
|
256
|
+
try {
|
|
257
|
+
v = JSON.parse(text);
|
|
258
|
+
} catch (e) {
|
|
259
|
+
return { kind: "unreadable", why: e instanceof Error ? e.message : String(e) };
|
|
260
|
+
}
|
|
261
|
+
if (!isRecord2(v) || !("original" in v)) return { kind: "unreadable", why: "no original in it" };
|
|
262
|
+
if (v.original === null) return { kind: "ok", original: null };
|
|
263
|
+
return isRecord2(v.original) ? { kind: "ok", original: v.original } : { kind: "unreadable", why: "original is not an object" };
|
|
264
|
+
}
|
|
265
|
+
function originalStatusLine(onDamage, configDir) {
|
|
266
|
+
let saved = readSaved(configDir);
|
|
267
|
+
if (saved.kind === "missing" && accountOf(configDir) !== "default") saved = readSaved();
|
|
268
|
+
if (saved.kind === "unreadable") onDamage?.(saved.why);
|
|
269
|
+
const o = saved.kind === "ok" ? saved.original : null;
|
|
270
|
+
return o && typeof o.command === "string" && o.command ? { command: o.command } : null;
|
|
271
|
+
}
|
|
272
|
+
function shellFor(platform = process.platform, env = process.env, exists = fs2.existsSync) {
|
|
273
|
+
const args = (cmd) => ["-c", cmd];
|
|
274
|
+
if (platform !== "win32") return { file: "/bin/sh", args };
|
|
275
|
+
const configured = env.CLAUDE_CODE_GIT_BASH_PATH;
|
|
276
|
+
if (configured && exists(configured)) return { file: configured, args };
|
|
277
|
+
for (const dir of (env.PATH ?? env.Path ?? "").split(";").filter(Boolean)) {
|
|
278
|
+
if (!exists(path2.win32.join(dir, "git.exe"))) continue;
|
|
279
|
+
for (const bash of [path2.win32.join(dir, "..", "bin", "bash.exe"), path2.win32.join(dir, "bash.exe")])
|
|
280
|
+
if (exists(bash)) return { file: bash, args };
|
|
281
|
+
}
|
|
282
|
+
const standard = "C:\\Program Files\\Git\\bin\\bash.exe";
|
|
283
|
+
return { file: exists(standard) ? standard : "bash", args };
|
|
284
|
+
}
|
|
285
|
+
var OUTPUT_CAP = 64 * 1024;
|
|
286
|
+
var EXIT_GRACE_MS = 100;
|
|
287
|
+
function killCommand(pid) {
|
|
288
|
+
if (detachHere()) {
|
|
289
|
+
try {
|
|
290
|
+
process.kill(-pid, "SIGKILL");
|
|
291
|
+
return;
|
|
292
|
+
} catch {
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
killTree(pid);
|
|
296
|
+
}
|
|
297
|
+
function runStatusLineCommand(cmd, stdin, o = {}) {
|
|
298
|
+
return new Promise((resolve) => {
|
|
299
|
+
let done = false;
|
|
300
|
+
const out = [];
|
|
301
|
+
let outBytes = 0;
|
|
302
|
+
let timer;
|
|
303
|
+
let grace;
|
|
304
|
+
let child;
|
|
305
|
+
const finish = (ok) => {
|
|
306
|
+
if (done) return;
|
|
307
|
+
done = true;
|
|
308
|
+
clearTimeout(timer);
|
|
309
|
+
clearTimeout(grace);
|
|
310
|
+
child?.stdout?.destroy();
|
|
311
|
+
child?.stdin?.destroy();
|
|
312
|
+
child?.unref();
|
|
313
|
+
resolve(ok ? Buffer.concat(out).subarray(0, OUTPUT_CAP).toString("utf-8") : "");
|
|
314
|
+
};
|
|
315
|
+
try {
|
|
316
|
+
const sh = shellFor();
|
|
317
|
+
child = spawn_default(sh.file, sh.args(cmd), {
|
|
318
|
+
stdio: ["pipe", "pipe", "ignore"],
|
|
319
|
+
windowsHide: true,
|
|
320
|
+
cwd: o.cwd,
|
|
321
|
+
// Its own process group on POSIX, so a timeout stops what it started too.
|
|
322
|
+
detached: detachHere(),
|
|
323
|
+
// Marked, so a command that runs work's hook again doesn't run itself (runStatusLineHook).
|
|
324
|
+
env: { ...process.env, [NESTED_ENV]: "1" }
|
|
325
|
+
});
|
|
326
|
+
const c = child;
|
|
327
|
+
timer = setTimeout(() => {
|
|
328
|
+
if (c.pid) killCommand(c.pid);
|
|
329
|
+
finish(false);
|
|
330
|
+
}, o.timeoutMs ?? 5e3);
|
|
331
|
+
c.on("error", () => finish(false));
|
|
332
|
+
c.stdout?.on("data", (d) => {
|
|
333
|
+
if (outBytes >= OUTPUT_CAP) return;
|
|
334
|
+
out.push(d);
|
|
335
|
+
outBytes += d.length;
|
|
336
|
+
});
|
|
337
|
+
c.on("exit", (code) => {
|
|
338
|
+
if (code !== 0) finish(false);
|
|
339
|
+
else grace ??= setTimeout(() => finish(true), EXIT_GRACE_MS);
|
|
340
|
+
});
|
|
341
|
+
c.on("close", (code) => finish(code === 0));
|
|
342
|
+
c.stdin?.on("error", () => {
|
|
343
|
+
});
|
|
344
|
+
c.stdin?.end(stdin);
|
|
345
|
+
} catch {
|
|
346
|
+
finish(false);
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export {
|
|
352
|
+
parseClaudeRateLimits,
|
|
353
|
+
accountOf,
|
|
354
|
+
detachHere,
|
|
355
|
+
isPidAlive,
|
|
356
|
+
processName,
|
|
357
|
+
recentProcessTable,
|
|
358
|
+
processTable,
|
|
359
|
+
bootTime,
|
|
360
|
+
killTree,
|
|
361
|
+
killTreeAsync,
|
|
362
|
+
spawnDetachedWork,
|
|
363
|
+
WORK_STATUSLINE,
|
|
364
|
+
NESTED_ENV,
|
|
365
|
+
isRecord2 as isRecord,
|
|
366
|
+
savedPath,
|
|
367
|
+
isOurs,
|
|
368
|
+
readSaved,
|
|
369
|
+
originalStatusLine,
|
|
370
|
+
runStatusLineCommand
|
|
371
|
+
};
|
|
372
|
+
//# sourceMappingURL=chunk-4NITDMDH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/agents/claude/rate-limits.ts","../src/core/platform/process.ts","../src/core/agents/claude/statusline-run.ts"],"sourcesContent":["import os from 'node:os';\nimport path from 'node:path';\nimport { createHash } from 'node:crypto';\nimport type { UsageWindow } from '../../usage/usage.js';\n\n// What Claude Code's status line says about its plan limits, and whose they are. Light on purpose: the status-line hook imports it on every refresh.\n\nconst isRecord = (v: unknown): v is Record<string, unknown> => typeof v === 'object' && v !== null && !Array.isArray(v);\n\nconst clampPercent = (n: number) => Math.round(Math.min(100, Math.max(0, n)) * 10) / 10;\n\n/** Epoch seconds below 1e12, milliseconds above; a string is parsed as a date. */\nfunction resetIso(v: unknown): string | null {\n let ms: number;\n if (typeof v === 'number' && Number.isFinite(v)) ms = v < 1e12 ? v * 1000 : v;\n else if (typeof v === 'string' && v.trim() !== '') ms = Date.parse(v);\n else return null;\n return Number.isFinite(ms) ? new Date(ms).toISOString() : null;\n}\n\nconst capitalise = (s: string) => s.charAt(0).toUpperCase() + s.slice(1);\n\nfunction labelOf(key: string): string {\n if (key === 'five_hour') return '5-hour limit';\n if (key === 'seven_day') return 'Weekly limit';\n const named = /^seven_day_(.+)$/.exec(key);\n if (named) return `Weekly ${capitalise(named[1]!.replace(/_/g, ' '))} limit`;\n const span = /^(\\d+)_(hour|day)$/.exec(key);\n if (span) return `${span[1]}-${span[2]} limit`;\n return `${capitalise(key.replace(/_/g, ' '))} limit`;\n}\n\nconst rank = (key: string) => (key === 'five_hour' ? 0 : key === 'seven_day' ? 1 : 2);\n\n/** Claude Code's status-line `rate_limits`; whatever doesn't fit is skipped. */\nexport function parseClaudeRateLimits(raw: unknown): UsageWindow[] {\n if (!isRecord(raw)) return [];\n const windows: UsageWindow[] = [];\n const keys = Object.keys(raw)\n .filter((k) => k !== 'spend_limit')\n .sort((a, b) => rank(a) - rank(b) || a.localeCompare(b));\n for (const key of keys) {\n const w = raw[key];\n if (!isRecord(w) || typeof w.used_percentage !== 'number' || !Number.isFinite(w.used_percentage)) continue;\n windows.push({ id: key, label: labelOf(key), usedPercent: clampPercent(w.used_percentage), resetsAt: resetIso(w.resets_at) });\n }\n const spend = raw.spend_limit;\n if (isRecord(spend)) {\n const { used_percentage: pct, used_usd: used, limit_usd: limit } = spend;\n let percent: number | null = null;\n if (typeof pct === 'number' && Number.isFinite(pct)) percent = pct;\n else if (typeof used === 'number' && typeof limit === 'number' && Number.isFinite(used) && Number.isFinite(limit) && limit > 0)\n percent = (used / limit) * 100;\n if (percent !== null) {\n windows.push({ id: 'spend_limit', label: 'Spend limit', usedPercent: clampPercent(percent), resetsAt: resetIso(spend.resets_at) });\n }\n }\n return windows;\n}\n\n/** The account a Claude runs as: `default` for its normal config folder (~/.claude), else a short stable name for its CLAUDE_CONFIG_DIR. */\nexport function accountOf(configDir: string | undefined): string {\n if (!configDir) return 'default';\n const norm = (p: string) => (process.platform === 'win32' ? path.resolve(p).toLowerCase() : path.resolve(p));\n const resolved = norm(configDir);\n // CLAUDE_CONFIG_DIR set to the folder Claude uses anyway is the same account.\n if (resolved === norm(path.join(os.homedir(), '.claude'))) return 'default';\n const hash = createHash('sha1').update(resolved).digest('hex');\n return `cfg-${hash.slice(0, 8)}`;\n}\n","import fs from 'node:fs';\nimport os from 'node:os';\nimport { execFile, spawn, spawnSync } from 'node:child_process';\n\n/**\n * Process lifecycle rules for the long-lived pieces (work web, the PTY\n * host), in one place — they differ on Windows in ways that bit us:\n *\n * - Killing: process.kill on Windows is TerminateProcess of that one\n * process — its ConPTY children (Claudes) survive, orphaned. Kill the\n * tree with taskkill /T /F. Elsewhere SIGTERM lets the process clean up\n * its own children.\n * - Liveness: `process.kill(pid, 0)` works on both, but a live PID is not\n * proof it's OURS (Windows reuses PIDs fast) — callers that act on it\n * must also verify identity (e.g. the host's /health token check).\n * - Detached `work` children: `detached` + `windowsHide` so no console\n * window flashes and the child outlives the parent's terminal; output\n * goes to a log file, never the parent's stdio.\n * - Anything else started in the background (an editor, a URL, a toast, a\n * status hook): `detached` on POSIX only (`detachHere`). On Windows a\n * detached process has no console at all, so every console program it\n * starts — cmd.exe running code.cmd, PowerShell — opens a window of its\n * own, and `windowsHide` can't stop that (measured: detached flashed a\n * Windows Terminal window every time, hidden alone never). A child there\n * outlives its parent anyway.\n */\n\n/** Start a background program detached? POSIX yes (its own process group); Windows no — see above. */\nexport function detachHere(platform: NodeJS.Platform = process.platform): boolean {\n return platform !== 'win32';\n}\n\nexport function isPidAlive(pid: number): boolean {\n try {\n process.kill(pid, 0);\n } catch {\n return false;\n }\n return !isZombie(pid);\n}\n\n/**\n * Exited, but not yet collected by its parent (a zombie): `kill(pid, 0)` still\n * succeeds, though nothing runs. A server started by a parent that never\n * waits for it — the desktop app's work web, or a test's child while the test\n * blocks in spawnSync — is one once it stops, and `work web --dev --stop`\n * waited for it to go, then said it didn't. Linux only (/proc/<pid>/stat: the\n * state letter after the command's closing parenthesis); elsewhere false.\n */\nexport function isZombie(pid: number, read: Pick<ProcReader, 'file'> = procFs, platform: NodeJS.Platform = process.platform): boolean {\n if (platform !== 'linux') return false;\n const stat = read.file(`/proc/${pid}/stat`) ?? '';\n // The state follows the command name, which is in parentheses and may hold some.\n const close = stat.lastIndexOf(')');\n return close >= 0 && stat[close + 2] === 'Z';\n}\n\n/** How /proc is read (tests pass a fake one). */\nexport interface ProcReader {\n link: (p: string) => string | null;\n file: (p: string) => string | null;\n pids: () => number[];\n}\n\nconst procFs: ProcReader = {\n link: (p) => {\n try {\n return fs.readlinkSync(p);\n } catch {\n return null;\n }\n },\n file: (p) => {\n try {\n return fs.readFileSync(p, 'utf-8');\n } catch {\n return null;\n }\n },\n pids: () => {\n try {\n return fs\n .readdirSync('/proc')\n .filter((n) => /^\\d+$/.test(n))\n .map(Number);\n } catch {\n return [];\n }\n },\n};\n\nconst baseName = (p: string) => p.split('/').pop() || p;\n\n/**\n * On Linux, the program a process runs, from /proc: its executable when it\n * can be read (our own processes), else its command line's first word, else\n * its `comm`. Not `ps -o comm` alone: that is its main thread's name, which\n * Node 24 sets to \"MainThread\" — every node process, Claude Code's included,\n * read as that, and no Claude was ever found running.\n */\nexport function linuxProcessName(pid: number, read: ProcReader = procFs): string | null {\n const exe = read.link(`/proc/${pid}/exe`);\n if (exe) return baseName(exe.replace(/ \\(deleted\\)$/, ''));\n const argv0 = (read.file(`/proc/${pid}/cmdline`) ?? '').split('\\0')[0];\n if (argv0) return baseName(argv0.split(' ')[0]);\n const comm = (read.file(`/proc/${pid}/comm`) ?? '').trim();\n return comm || null;\n}\n\n/** On Linux, every process's program by pid (linuxProcessName), from /proc: no `ps` to run. */\nexport function linuxProcessTable(read: ProcReader = procFs): Map<number, string> {\n const out = new Map<number, string>();\n for (const pid of read.pids()) {\n const name = linuxProcessName(pid, read);\n if (name) out.set(pid, name);\n }\n return out;\n}\n\n/**\n * The executable name of a live process (\"cmd.exe\", \"sh\"), or null if it\n * isn't running or can't be read. For checking a remembered pid is still\n * the process we started before acting on it — pids get reused.\n */\nexport function processName(pid: number): string | null {\n try {\n if (process.platform === 'win32') {\n const r = spawnSync('tasklist', ['/FI', `PID eq ${pid}`, '/FO', 'CSV', '/NH'], {\n encoding: 'utf-8',\n windowsHide: true,\n timeout: 5000,\n });\n const m = /^\"([^\"]+)\",\"(\\d+)\"/.exec((r.stdout ?? '').trim());\n return m && Number(m[2]) === pid ? m[1] : null;\n }\n if (process.platform === 'linux') return isPidAlive(pid) ? linuxProcessName(pid) : null;\n const r = spawnSync('ps', ['-o', 'comm=', '-p', String(pid)], { encoding: 'utf-8', timeout: 5000, windowsHide: true });\n const name = (r.stdout ?? '').trim();\n return r.status === 0 && name ? name.split('/').pop()! : null;\n } catch {\n return null;\n }\n}\n\nlet recentTable: { at: number; table: Map<number, string> } | null = null;\nlet refreshingTable: Promise<void> | null = null;\n\n/**\n * The process table as of at most `maxAgeMs` ago, without waiting: a stale\n * or missing one starts a background refresh (one at a time) and the last\n * one is returned — null before the first is in. For views that refresh\n * often (the session list); a decision that must be right now (is a Claude\n * already running, before starting one?) uses processTable().\n */\nexport function recentProcessTable(maxAgeMs: number, now = Date.now()): Map<number, string> | null {\n if (!recentTable || now - recentTable.at >= maxAgeMs) {\n refreshingTable ??= processTableAsync()\n // An empty table is a failed or timed-out listing (there is always at\n // least this process): keep the last good one, and try again next time.\n .then((table) => void (table.size > 0 && (recentTable = { at: Date.now(), table })))\n .finally(() => void (refreshingTable = null));\n }\n return recentTable?.table ?? null;\n}\n\n/** processTable(), without blocking the event loop. */\nexport function processTableAsync(): Promise<Map<number, string>> {\n if (process.platform === 'linux') return Promise.resolve(linuxProcessTable());\n return new Promise((resolve) => {\n const win = process.platform === 'win32';\n const [cmd, args] = win ? ['tasklist', ['/FO', 'CSV', '/NH']] : ['ps', ['-A', '-o', 'pid=,comm=']];\n execFile(\n cmd,\n args as string[],\n { encoding: 'utf-8', windowsHide: true, timeout: 8000, maxBuffer: 16 * 1024 * 1024 },\n (_err, stdout) => {\n resolve(parseProcessTable(stdout ?? '', win));\n },\n );\n });\n}\n\nfunction parseProcessTable(stdout: string, win: boolean): Map<number, string> {\n const out = new Map<number, string>();\n for (const line of stdout.split(/\\r?\\n/)) {\n if (win) {\n const m = /^\"([^\"]+)\",\"(\\d+)\"/.exec(line);\n if (m) out.set(Number(m[2]), m[1]);\n } else {\n const m = /^\\s*(\\d+)\\s+(.+)$/.exec(line);\n if (m) out.set(Number(m[1]), m[2].trim().split('/').pop()!);\n }\n }\n return out;\n}\n\n/**\n * Every running process's executable name, by pid, in ONE call (tasklist /\n * ps) — for checking many remembered pids at once. Empty if it can't be read.\n */\nexport function processTable(): Map<number, string> {\n if (process.platform === 'linux') return linuxProcessTable();\n try {\n const win = process.platform === 'win32';\n const r = win\n ? spawnSync('tasklist', ['/FO', 'CSV', '/NH'], { encoding: 'utf-8', windowsHide: true, timeout: 8000, maxBuffer: 16 * 1024 * 1024 })\n : spawnSync('ps', ['-A', '-o', 'pid=,comm='], { encoding: 'utf-8', timeout: 8000, windowsHide: true, maxBuffer: 16 * 1024 * 1024 });\n return parseProcessTable(r.stdout ?? '', win);\n } catch {\n return new Map(); // unreadable: nothing is known to be alive\n }\n}\n\n/** When this machine last booted (ms since epoch, ±1 s). */\nexport function bootTime(): number {\n return Date.now() - os.uptime() * 1000;\n}\n\n/** Kill a process AND its children. True if the kill was delivered. */\nexport function killTree(pid: number): boolean {\n if (process.platform === 'win32') {\n return spawnSync('taskkill', ['/PID', String(pid), '/T', '/F'], { stdio: 'ignore', windowsHide: true }).status === 0;\n }\n try {\n process.kill(pid);\n return true;\n } catch {\n return false;\n }\n}\n\n/** killTree, not blocking the event loop (taskkill takes a few hundred ms): for a server killing several at once. */\nexport function killTreeAsync(pid: number): Promise<boolean> {\n // Already gone counts as stopped, as with taskkill below: it's what the caller wanted.\n if (process.platform !== 'win32') return Promise.resolve(killTree(pid) || !isPidAlive(pid));\n return new Promise((resolve) =>\n // taskkill fails the whole call when one child had already exited or won't go; the top gone is what counts.\n execFile('taskkill', ['/PID', String(pid), '/T', '/F'], { windowsHide: true, timeout: 10_000 }, (err) =>\n resolve(!err || !isPidAlive(pid)),\n ),\n );\n}\n\n/**\n * Start `node <workBin> ...args` detached, appending its output to\n * `logFile`. Returns immediately; the caller polls for readiness (a\n * discovery file / health check), because a detached child can't report\n * back directly.\n */\nexport function spawnDetachedWork(workBin: string, args: string[], logFile: string): void {\n const log = fs.openSync(logFile, 'a');\n try {\n const child = spawn(process.execPath, [workBin, ...args], {\n detached: true,\n stdio: ['ignore', log, log],\n windowsHide: true,\n // Not the caller's folder: a long-lived server working from it keeps it\n // in use on Windows — a worktree then can't be removed, the desktop\n // app's install folder can't be updated.\n cwd: os.homedir(),\n });\n child.unref();\n } finally {\n fs.closeSync(log);\n }\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\nimport { getConfigDir } from '../../platform/config-dir.js';\nimport { detachHere, killTree } from '../../platform/process.js';\nimport spawn from '../../platform/spawn.js';\nimport { accountOf } from './rate-limits.js';\n\n// The status-line hook's half of statusline.ts: what runs on every refresh of every Claude. Light on purpose — no\n// settings editor, no locks, no registry; installing and removing the wrapper is statusline.ts.\n\nexport const WORK_STATUSLINE = 'work hook statusline';\n/** Set on the user's own command: a status line that runs work's hook again (it called `work hook statusline` itself) records, and runs nothing more. */\nexport const NESTED_ENV = 'WORK_STATUSLINE_NESTED';\n\nexport type StatusLine = Record<string, unknown>;\n\nexport const isRecord = (v: unknown): v is Record<string, unknown> => typeof v === 'object' && v !== null && !Array.isArray(v);\n/**\n * Where the user's own status line is saved: `statusline.json` for the default account, `statusline-<account>.json` for\n * another — named by `accountOf(CLAUDE_CONFIG_DIR)`, a short hash of the folder, the same name the hook computes from its\n * environment (it knows the folder, not the registry's name for it, and loads no config to find out; a renamed account\n * keeps its saved line).\n */\nexport const savedPath = (configDir?: string) => {\n const account = accountOf(configDir);\n return path.join(getConfigDir(), account === 'default' ? 'statusline.json' : `statusline-${account}.json`);\n};\n\n/**\n * work's hook under any path (`/usr/bin/work hook statusline`, `node …/bin.js hook statusline`), with or without the\n * user's line after `||` as its fallback: saved as \"the original\", it would run itself.\n */\nexport const isOurs = (v: unknown) => isRecord(v) && typeof v.command === 'string' && /\\bhook\\s+statusline\\b/.test(v.command);\n\n/** What ~/.work/statusline.json says: an original (null: there was none), nothing saved, or a file that can't be read. */\nexport type Saved = { kind: 'ok'; original: StatusLine | null } | { kind: 'missing' } | { kind: 'unreadable'; why: string };\n\nexport function readSaved(configDir?: string): Saved {\n let text: string;\n try {\n text = fs.readFileSync(savedPath(configDir), 'utf-8');\n } catch (e) {\n const code = (e as NodeJS.ErrnoException).code;\n return code === 'ENOENT' ? { kind: 'missing' } : { kind: 'unreadable', why: code ?? String(e) };\n }\n let v: unknown;\n try {\n v = JSON.parse(text);\n } catch (e) {\n return { kind: 'unreadable', why: e instanceof Error ? e.message : String(e) };\n }\n if (!isRecord(v) || !('original' in v)) return { kind: 'unreadable', why: 'no original in it' };\n if (v.original === null) return { kind: 'ok', original: null };\n return isRecord(v.original) ? { kind: 'ok', original: v.original } : { kind: 'unreadable', why: 'original is not an object' };\n}\n\n/**\n * The user's own status line command, when they had one — the one saved for the account of the Claude that runs it\n * (`configDir`: its `CLAUDE_CONFIG_DIR`). `onDamage` hears why a saved file couldn't be read.\n *\n * An account with nothing saved whose settings run work's line anyway — a settings.json copied from the default\n * account's, or a folder shared with it — falls back to the default account's saved original: that is the line its\n * settings came with, and without it the user's own line would show nowhere on that account.\n */\nexport function originalStatusLine(onDamage?: (why: string) => void, configDir?: string): { command: string } | null {\n let saved = readSaved(configDir);\n if (saved.kind === 'missing' && accountOf(configDir) !== 'default') saved = readSaved();\n if (saved.kind === 'unreadable') onDamage?.(saved.why);\n const o = saved.kind === 'ok' ? saved.original : null;\n return o && typeof o.command === 'string' && o.command ? { command: o.command } : null;\n}\n\n/** The shell Claude Code runs a status line in: sh on POSIX, Git Bash on Windows. */\nexport function shellFor(\n platform: NodeJS.Platform = process.platform,\n env: NodeJS.ProcessEnv = process.env,\n exists: (p: string) => boolean = fs.existsSync,\n): { file: string; args: (cmd: string) => string[] } {\n const args = (cmd: string) => ['-c', cmd];\n if (platform !== 'win32') return { file: '/bin/sh', args };\n const configured = env.CLAUDE_CODE_GIT_BASH_PATH;\n if (configured && exists(configured)) return { file: configured, args };\n for (const dir of (env.PATH ?? env.Path ?? '').split(';').filter(Boolean)) {\n if (!exists(path.win32.join(dir, 'git.exe'))) continue;\n for (const bash of [path.win32.join(dir, '..', 'bin', 'bash.exe'), path.win32.join(dir, 'bash.exe')])\n if (exists(bash)) return { file: bash, args };\n }\n const standard = 'C:\\\\Program Files\\\\Git\\\\bin\\\\bash.exe';\n return { file: exists(standard) ? standard : 'bash', args };\n}\n\nconst OUTPUT_CAP = 64 * 1024;\n/** After the command exits, how long what it printed may still be on its way: its stdout can stay open past its exit. */\nconst EXIT_GRACE_MS = 100;\n\n/** Stop the command and whatever it started: its process group on POSIX (a `cmd &` holding stdout keeps no hook alive), taskkill /T on Windows. */\nfunction killCommand(pid: number): void {\n if (detachHere()) {\n try {\n process.kill(-pid, 'SIGKILL');\n return;\n } catch {\n /* no group (it wasn't detached, or has gone): the process alone */\n }\n }\n killTree(pid);\n}\n\n/** Run the user's own status line with Claude's JSON on stdin. Its output, or '' when it fails or takes too long: never rejects. */\nexport function runStatusLineCommand(cmd: string, stdin: string, o: { timeoutMs?: number; cwd?: string } = {}): Promise<string> {\n return new Promise((resolve) => {\n let done = false;\n const out: Buffer[] = [];\n let outBytes = 0;\n let timer: NodeJS.Timeout | undefined;\n let grace: NodeJS.Timeout | undefined;\n let child: ReturnType<typeof spawn> | undefined;\n const finish = (ok: boolean) => {\n if (done) return;\n done = true;\n clearTimeout(timer);\n clearTimeout(grace);\n // Let go of it: a pipe still held by something it started would keep this process (Claude's hook) alive past its cap.\n child?.stdout?.destroy();\n child?.stdin?.destroy();\n child?.unref();\n resolve(ok ? Buffer.concat(out).subarray(0, OUTPUT_CAP).toString('utf-8') : '');\n };\n try {\n const sh = shellFor();\n child = spawn(sh.file, sh.args(cmd), {\n stdio: ['pipe', 'pipe', 'ignore'],\n windowsHide: true,\n cwd: o.cwd,\n // Its own process group on POSIX, so a timeout stops what it started too.\n detached: detachHere(),\n // Marked, so a command that runs work's hook again doesn't run itself (runStatusLineHook).\n env: { ...process.env, [NESTED_ENV]: '1' },\n });\n const c = child;\n timer = setTimeout(() => {\n if (c.pid) killCommand(c.pid);\n finish(false);\n }, o.timeoutMs ?? 5000);\n c.on('error', () => finish(false));\n c.stdout?.on('data', (d: Buffer) => {\n if (outBytes >= OUTPUT_CAP) return;\n out.push(d);\n outBytes += d.length;\n });\n // 'close' waits for stdout to end, and something the command left running (`cmd &`) holds it: the line would wait\n // for the cap, and be lost. Its exit decides; what it printed is read until stdout ends, or a moment more.\n c.on('exit', (code) => {\n if (code !== 0) finish(false);\n else grace ??= setTimeout(() => finish(true), EXIT_GRACE_MS);\n });\n c.on('close', (code) => finish(code === 0));\n c.stdin?.on('error', () => {\n /* it exited before reading: its exit code decides */\n });\n c.stdin?.end(stdin);\n } catch {\n finish(false);\n }\n });\n}\n"],"mappings":";;;;;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,kBAAkB;AAK3B,IAAM,WAAW,CAAC,MAA6C,OAAO,MAAM,YAAY,MAAM,QAAQ,CAAC,MAAM,QAAQ,CAAC;AAEtH,IAAM,eAAe,CAAC,MAAc,KAAK,MAAM,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI;AAGrF,SAAS,SAAS,GAA2B;AAC3C,MAAI;AACJ,MAAI,OAAO,MAAM,YAAY,OAAO,SAAS,CAAC,EAAG,MAAK,IAAI,OAAO,IAAI,MAAO;AAAA,WACnE,OAAO,MAAM,YAAY,EAAE,KAAK,MAAM,GAAI,MAAK,KAAK,MAAM,CAAC;AAAA,MAC/D,QAAO;AACZ,SAAO,OAAO,SAAS,EAAE,IAAI,IAAI,KAAK,EAAE,EAAE,YAAY,IAAI;AAC5D;AAEA,IAAM,aAAa,CAAC,MAAc,EAAE,OAAO,CAAC,EAAE,YAAY,IAAI,EAAE,MAAM,CAAC;AAEvE,SAAS,QAAQ,KAAqB;AACpC,MAAI,QAAQ,YAAa,QAAO;AAChC,MAAI,QAAQ,YAAa,QAAO;AAChC,QAAM,QAAQ,mBAAmB,KAAK,GAAG;AACzC,MAAI,MAAO,QAAO,UAAU,WAAW,MAAM,CAAC,EAAG,QAAQ,MAAM,GAAG,CAAC,CAAC;AACpE,QAAM,OAAO,qBAAqB,KAAK,GAAG;AAC1C,MAAI,KAAM,QAAO,GAAG,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC;AACtC,SAAO,GAAG,WAAW,IAAI,QAAQ,MAAM,GAAG,CAAC,CAAC;AAC9C;AAEA,IAAM,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;AAAA,QAErB,KAAK,EAAE,GAAG,QAAQ,KAAK,CAAC,UAAU,GAAG,IAAI;AAAA,MAC3C,CAAC;AACD,YAAM,IAAI;AACV,cAAQ,WAAW,MAAM;AACvB,YAAI,EAAE,IAAK,aAAY,EAAE,GAAG;AAC5B,eAAO,KAAK;AAAA,MACd,GAAG,EAAE,aAAa,GAAI;AACtB,QAAE,GAAG,SAAS,MAAM,OAAO,KAAK,CAAC;AACjC,QAAE,QAAQ,GAAG,QAAQ,CAAC,MAAc;AAClC,YAAI,YAAY,WAAY;AAC5B,YAAI,KAAK,CAAC;AACV,oBAAY,EAAE;AAAA,MAChB,CAAC;AAGD,QAAE,GAAG,QAAQ,CAAC,SAAS;AACrB,YAAI,SAAS,EAAG,QAAO,KAAK;AAAA,YACvB,WAAU,WAAW,MAAM,OAAO,IAAI,GAAG,aAAa;AAAA,MAC7D,CAAC;AACD,QAAE,GAAG,SAAS,CAAC,SAAS,OAAO,SAAS,CAAC,CAAC;AAC1C,QAAE,OAAO,GAAG,SAAS,MAAM;AAAA,MAE3B,CAAC;AACD,QAAE,OAAO,IAAI,KAAK;AAAA,IACpB,QAAQ;AACN,aAAO,KAAK;AAAA,IACd;AAAA,EACF,CAAC;AACH;","names":["os","r","fs","path","isRecord","path","fs"]}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
json,
|
|
7
7
|
tx,
|
|
8
8
|
withDb
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-YYBXQBW2.js";
|
|
10
10
|
|
|
11
11
|
// src/core/comments/comment-file-store.ts
|
|
12
12
|
function isComment(x) {
|
|
@@ -137,4 +137,4 @@ export {
|
|
|
137
137
|
getCommentFileStore,
|
|
138
138
|
moveStoreComments
|
|
139
139
|
};
|
|
140
|
-
//# sourceMappingURL=chunk-
|
|
140
|
+
//# sourceMappingURL=chunk-5QGCF3PS.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
dbPtySessions,
|
|
4
4
|
forgetPersistedSession
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-KNRGVUW7.js";
|
|
6
6
|
import {
|
|
7
7
|
PtyHostBusyError,
|
|
8
8
|
PtyHostClient,
|
|
@@ -11,31 +11,34 @@ import {
|
|
|
11
11
|
findHost,
|
|
12
12
|
findHostPatient,
|
|
13
13
|
hostStartLockPath
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-M6LJ3GE3.js";
|
|
15
15
|
import {
|
|
16
16
|
ASSISTANT_ID,
|
|
17
17
|
prepareAssistantDir
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-6XMH3WFY.js";
|
|
19
19
|
import {
|
|
20
20
|
createFsWatcher,
|
|
21
21
|
findSessionById,
|
|
22
22
|
logSwallowed,
|
|
23
23
|
noClaudeBecause,
|
|
24
24
|
swallow
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-CNE5SWFH.js";
|
|
26
26
|
import {
|
|
27
27
|
sessionIdFor
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-YYBXQBW2.js";
|
|
29
29
|
import {
|
|
30
30
|
agentFor,
|
|
31
31
|
agentSettings,
|
|
32
|
-
assistantAgent
|
|
33
|
-
|
|
32
|
+
assistantAgent,
|
|
33
|
+
hasEnvDelta
|
|
34
|
+
} from "./chunk-F6M255O5.js";
|
|
35
|
+
import {
|
|
36
|
+
loadConfig
|
|
37
|
+
} from "./chunk-XNLQSW6J.js";
|
|
34
38
|
import {
|
|
35
39
|
ensureFile,
|
|
36
|
-
loadConfig,
|
|
37
40
|
withFileLock
|
|
38
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-ZXHMC7UO.js";
|
|
39
42
|
|
|
40
43
|
// src/core/pty/output-status.ts
|
|
41
44
|
var OUTPUT_WORKING_MS = 1e4;
|
|
@@ -208,14 +211,17 @@ async function resumePersistedSessions() {
|
|
|
208
211
|
function assistantSpec() {
|
|
209
212
|
const settings = agentSettings();
|
|
210
213
|
const agent = assistantAgent(settings);
|
|
211
|
-
|
|
214
|
+
const agentEnv = agent.launch.env?.(null);
|
|
215
|
+
return { cwd: prepareAssistantDir(agent), tool: agent.launch.tool(settings), ...hasEnvDelta(agentEnv) ? { agentEnv } : {} };
|
|
212
216
|
}
|
|
213
217
|
function spawnSpecFor(session) {
|
|
214
218
|
const first = session.paths[0];
|
|
215
219
|
if (!first) return null;
|
|
216
220
|
const cwd = session.isGroup ? path.dirname(first) : first;
|
|
217
221
|
const config = loadConfig();
|
|
218
|
-
|
|
222
|
+
const launch = agentFor(config, session).launch;
|
|
223
|
+
const agentEnv = launch.env?.(session);
|
|
224
|
+
return { cwd, tool: launch.tool(config), port: session.port, ...hasEnvDelta(agentEnv) ? { agentEnv } : {} };
|
|
219
225
|
}
|
|
220
226
|
async function ensurePty(sessionId, extra = {}) {
|
|
221
227
|
const session = sessionId === ASSISTANT_ID ? null : findSession(sessionId);
|
|
@@ -226,6 +232,7 @@ async function ensurePty(sessionId, extra = {}) {
|
|
|
226
232
|
const spec = extra.initialPrompt ? { ...base, initialPrompt: extra.initialPrompt } : base;
|
|
227
233
|
let c = await getClient(true);
|
|
228
234
|
if (!c) return null;
|
|
235
|
+
if (setsEnv(spec.agentEnv) && !await hostTakesAgentEnv(c) && !await runsIn(c, sessionId)) throw new Error(OLD_HOST_ACCOUNTS);
|
|
229
236
|
try {
|
|
230
237
|
await c.spawn(sessionId, spec);
|
|
231
238
|
} catch (err) {
|
|
@@ -288,6 +295,72 @@ async function restartPty(sessionId) {
|
|
|
288
295
|
return OLD_HOST_RESTART;
|
|
289
296
|
}
|
|
290
297
|
}
|
|
298
|
+
async function haltPty(sessionId) {
|
|
299
|
+
let c = await getClient(false);
|
|
300
|
+
if (!c) throw new Error("the PTY host is not running");
|
|
301
|
+
let how;
|
|
302
|
+
try {
|
|
303
|
+
how = await c.halt(sessionId);
|
|
304
|
+
} catch (err) {
|
|
305
|
+
client = null;
|
|
306
|
+
c = await getClient(false);
|
|
307
|
+
if (!c) throw err;
|
|
308
|
+
how = await c.halt(sessionId);
|
|
309
|
+
}
|
|
310
|
+
if (how === "not-running") return "gone";
|
|
311
|
+
if (how === "unsupported") {
|
|
312
|
+
await disposePty(sessionId);
|
|
313
|
+
return "stopped";
|
|
314
|
+
}
|
|
315
|
+
return "halted";
|
|
316
|
+
}
|
|
317
|
+
async function accountSwitchRefusal() {
|
|
318
|
+
const c = await getClient(false);
|
|
319
|
+
return c && !await hostTakesAgentEnv(c) ? OLD_HOST_ACCOUNTS : null;
|
|
320
|
+
}
|
|
321
|
+
async function resumePty(sessionId, opts = {}) {
|
|
322
|
+
let c = await getClient(false);
|
|
323
|
+
if (!c) throw new Error("the PTY host is not running");
|
|
324
|
+
if (hasEnvDelta(opts.agentEnv) && !await hostTakesAgentEnv(c)) throw new Error(OLD_HOST_ACCOUNTS);
|
|
325
|
+
let how;
|
|
326
|
+
try {
|
|
327
|
+
how = await c.resume(sessionId, opts);
|
|
328
|
+
} catch (err) {
|
|
329
|
+
client = null;
|
|
330
|
+
c = await getClient(false);
|
|
331
|
+
if (!c) throw err;
|
|
332
|
+
how = await c.resume(sessionId, opts);
|
|
333
|
+
}
|
|
334
|
+
return how;
|
|
335
|
+
}
|
|
336
|
+
async function resumePtyOnAccount(sessionId, how) {
|
|
337
|
+
if (how === "stopped") {
|
|
338
|
+
if (!await ensurePty(sessionId)) throw new Error("its agent could not be started again");
|
|
339
|
+
return OLD_HOST_RESTART;
|
|
340
|
+
}
|
|
341
|
+
const session = findSession(sessionId);
|
|
342
|
+
const spec = session ? spawnSpecFor(session) : null;
|
|
343
|
+
if (!spec) throw new Error("unknown session");
|
|
344
|
+
const agentEnv = hasEnvDelta(spec.agentEnv) ? spec.agentEnv : void 0;
|
|
345
|
+
if (await resumePty(sessionId, agentEnv ? { agentEnv } : {}) === "resumed") return;
|
|
346
|
+
const c = await getClient(false);
|
|
347
|
+
if (!c) throw new Error("the PTY host is not running");
|
|
348
|
+
const restarted = await c.restart(sessionId, agentEnv ? { agentEnv } : {});
|
|
349
|
+
if (restarted === "restarted") return RESTARTED_AFTER_AUTO_RESUME;
|
|
350
|
+
if (restarted === "unsupported") await disposePty(sessionId);
|
|
351
|
+
if (!await ensurePty(sessionId)) throw new Error("its agent could not be started again");
|
|
352
|
+
return RESTARTED_AFTER_AUTO_RESUME;
|
|
353
|
+
}
|
|
354
|
+
var RESTARTED_AFTER_AUTO_RESUME = "it had been started again on its old account while the conversation moved, so it was restarted on the new one";
|
|
355
|
+
var OLD_HOST_ACCOUNTS = "the PTY host is from before Claude accounts: run `work pty-host --restart`";
|
|
356
|
+
var setsEnv = (d) => !!d && Object.values(d).some((v) => typeof v === "string");
|
|
357
|
+
async function hostTakesAgentEnv(c) {
|
|
358
|
+
const f = await c.features();
|
|
359
|
+
return f === null || f.includes("agentEnv");
|
|
360
|
+
}
|
|
361
|
+
async function runsIn(c, sessionId) {
|
|
362
|
+
return (await c.list()).some((p) => p.id === sessionId && !p.exited);
|
|
363
|
+
}
|
|
291
364
|
var OLD_HOST_RESTART = "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)";
|
|
292
365
|
async function disposePty(sessionId) {
|
|
293
366
|
live.delete(sessionId);
|
|
@@ -353,8 +426,11 @@ export {
|
|
|
353
426
|
readPtyScreen,
|
|
354
427
|
writeToPty,
|
|
355
428
|
restartPty,
|
|
429
|
+
haltPty,
|
|
430
|
+
accountSwitchRefusal,
|
|
431
|
+
resumePtyOnAccount,
|
|
356
432
|
disposePty,
|
|
357
433
|
stopSessionPty,
|
|
358
434
|
detachPtyPool
|
|
359
435
|
};
|
|
360
|
-
//# sourceMappingURL=chunk-
|
|
436
|
+
//# sourceMappingURL=chunk-6MJ6BDHL.js.map
|