@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,442 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
findOnPath
|
|
4
|
+
} from "./chunk-ZDMJPEBO.js";
|
|
5
|
+
import {
|
|
6
|
+
agentsBySession
|
|
7
|
+
} from "./chunk-YEY2WKOE.js";
|
|
8
|
+
import {
|
|
9
|
+
LATER_TEXT,
|
|
10
|
+
restartCountsText
|
|
11
|
+
} from "./chunk-TNJF7T33.js";
|
|
12
|
+
import {
|
|
13
|
+
accountSwitchRefusal,
|
|
14
|
+
findSession,
|
|
15
|
+
haltPty,
|
|
16
|
+
peekPty,
|
|
17
|
+
ptyPid,
|
|
18
|
+
ptyPids,
|
|
19
|
+
resumePtyOnAccount
|
|
20
|
+
} from "./chunk-6MJ6BDHL.js";
|
|
21
|
+
import {
|
|
22
|
+
isArchiving,
|
|
23
|
+
loadHistory,
|
|
24
|
+
setSessionAccount
|
|
25
|
+
} from "./chunk-CNE5SWFH.js";
|
|
26
|
+
import {
|
|
27
|
+
agentOf,
|
|
28
|
+
liveAgents
|
|
29
|
+
} from "./chunk-F6M255O5.js";
|
|
30
|
+
|
|
31
|
+
// src/core/pty/agent-restart.ts
|
|
32
|
+
import fs from "fs";
|
|
33
|
+
var PACKED_MTIME_BEFORE = Date.parse("1990-01-01T00:00:00Z");
|
|
34
|
+
function installedAt(cmd, find = findOnPath) {
|
|
35
|
+
const file = find(cmd);
|
|
36
|
+
if (!file) return null;
|
|
37
|
+
try {
|
|
38
|
+
return installTime(fs.statSync(fs.realpathSync(file)));
|
|
39
|
+
} catch {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function installTime(st) {
|
|
44
|
+
const real = (ms) => ms >= PACKED_MTIME_BEFORE ? ms : null;
|
|
45
|
+
const known = [real(st.mtimeMs), real(st.birthtimeMs)].filter((x) => x !== null);
|
|
46
|
+
return known.length ? Math.max(...known) : st.ctimeMs;
|
|
47
|
+
}
|
|
48
|
+
function installedAtCache(ttlMs = 6e4, look = installedAt, now = Date.now) {
|
|
49
|
+
const cache = /* @__PURE__ */ new Map();
|
|
50
|
+
return (cmd) => {
|
|
51
|
+
const hit = cache.get(cmd);
|
|
52
|
+
if (hit && now() - hit.read < ttlMs) return hit.at;
|
|
53
|
+
const at = look(cmd);
|
|
54
|
+
cache.set(cmd, { at, read: now() });
|
|
55
|
+
return at;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function outdatedPtys(ptys, toolInstalledAt) {
|
|
59
|
+
return ptys.filter((p) => {
|
|
60
|
+
if (p.exited || !p.tool) return false;
|
|
61
|
+
const at = toolInstalledAt(p.tool);
|
|
62
|
+
const started = Date.parse(p.startedAt);
|
|
63
|
+
return at !== null && Number.isFinite(started) && started < at;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
var PRINTING_MS = 1e4;
|
|
67
|
+
function busyForRestart(state, lastOutputMs, now = Date.now(), live = null) {
|
|
68
|
+
if (live === "busy" || live === "waiting") return true;
|
|
69
|
+
if (state === "working" || state === "needs_input") return true;
|
|
70
|
+
return lastOutputMs !== null && now - lastOutputMs < PRINTING_MS;
|
|
71
|
+
}
|
|
72
|
+
function restartPlan(ids, busy) {
|
|
73
|
+
const now = [];
|
|
74
|
+
const later = [];
|
|
75
|
+
for (const id of new Set(ids)) (busy(id) ? later : now).push(id);
|
|
76
|
+
return { now, later };
|
|
77
|
+
}
|
|
78
|
+
var RESTART_AT_ONCE = 3;
|
|
79
|
+
function restartNotesSummary(notes) {
|
|
80
|
+
const n = (level) => notes.filter((x) => x.level === level).length;
|
|
81
|
+
return restartCountsText({ restarted: n("action"), later: n("info"), failed: n("warn") });
|
|
82
|
+
}
|
|
83
|
+
var QUEUE_RECHECK_MS = 15e3;
|
|
84
|
+
var TURN_END_GRACE_MS = 1e4;
|
|
85
|
+
function createRestarter(deps) {
|
|
86
|
+
const queued = /* @__PURE__ */ new Set();
|
|
87
|
+
const inFlight = /* @__PURE__ */ new Map();
|
|
88
|
+
const later = deps.later ?? ((fn, ms) => void setTimeout(fn, ms).unref?.());
|
|
89
|
+
const one = (id) => {
|
|
90
|
+
const running = inFlight.get(id);
|
|
91
|
+
if (running) return running;
|
|
92
|
+
queued.delete(id);
|
|
93
|
+
const p = deps.restart(id).then(
|
|
94
|
+
(how) => ({ ok: true, how: how || "restarted its agent (its conversation goes on)" }),
|
|
95
|
+
(err) => ({ ok: false, error: err.message })
|
|
96
|
+
);
|
|
97
|
+
inFlight.set(id, p);
|
|
98
|
+
void p.finally(() => inFlight.delete(id));
|
|
99
|
+
return p;
|
|
100
|
+
};
|
|
101
|
+
const run = async (ids, notes) => {
|
|
102
|
+
const failed = [];
|
|
103
|
+
const ok = /* @__PURE__ */ new Set();
|
|
104
|
+
const queue = [...ids];
|
|
105
|
+
const worker = async () => {
|
|
106
|
+
for (let id = queue.shift(); id !== void 0; id = queue.shift()) {
|
|
107
|
+
const r = await one(id);
|
|
108
|
+
if (r.ok) {
|
|
109
|
+
ok.add(id);
|
|
110
|
+
notes.push({ id, text: r.how, level: "action" });
|
|
111
|
+
} else {
|
|
112
|
+
failed.push({ id, error: r.error });
|
|
113
|
+
notes.push({ id, text: `couldn't restart its agent: ${r.error}`, level: "warn" });
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
await Promise.all(Array.from({ length: Math.min(RESTART_AT_ONCE, queue.length) }, worker));
|
|
118
|
+
return { done: ids.filter((id) => ok.has(id)), failed };
|
|
119
|
+
};
|
|
120
|
+
const finish = (notes) => {
|
|
121
|
+
if (!notes.length) return;
|
|
122
|
+
deps.report?.(notes);
|
|
123
|
+
deps.changed?.();
|
|
124
|
+
};
|
|
125
|
+
const request = async (ids) => {
|
|
126
|
+
const notes = [];
|
|
127
|
+
const folded = [];
|
|
128
|
+
for (const id of ids) {
|
|
129
|
+
const into = deps.foldedInto?.(id);
|
|
130
|
+
if (!into) continue;
|
|
131
|
+
folded.push(id);
|
|
132
|
+
notes.push({ id, text: `restarts with ${into} (no second restart)`, level: "info" });
|
|
133
|
+
}
|
|
134
|
+
const plan = restartPlan(
|
|
135
|
+
ids.filter((id) => !folded.includes(id)),
|
|
136
|
+
(id) => deps.busy(id)
|
|
137
|
+
);
|
|
138
|
+
for (const id of plan.later) {
|
|
139
|
+
queued.add(id);
|
|
140
|
+
notes.push({ id, text: `${LATER_TEXT} (it is working or waiting on you)`, level: "info" });
|
|
141
|
+
}
|
|
142
|
+
const { done, failed } = await run(plan.now, notes);
|
|
143
|
+
finish(notes);
|
|
144
|
+
tick();
|
|
145
|
+
return { now: done, later: [...folded, ...plan.later], failed };
|
|
146
|
+
};
|
|
147
|
+
let ticking = false;
|
|
148
|
+
const tick = () => {
|
|
149
|
+
if (ticking) return;
|
|
150
|
+
if (queued.size === 0) {
|
|
151
|
+
deps.scheduled?.(null);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
ticking = true;
|
|
155
|
+
deps.scheduled?.(Date.now() + QUEUE_RECHECK_MS);
|
|
156
|
+
later(() => {
|
|
157
|
+
ticking = false;
|
|
158
|
+
void retry().catch(() => {
|
|
159
|
+
}).finally(tick);
|
|
160
|
+
}, QUEUE_RECHECK_MS);
|
|
161
|
+
};
|
|
162
|
+
const retry = async (only, opts) => {
|
|
163
|
+
const notes = [];
|
|
164
|
+
const ready = [];
|
|
165
|
+
for (const id of [...queued]) {
|
|
166
|
+
if (only !== void 0 && id !== only) continue;
|
|
167
|
+
if (!deps.running(id)) {
|
|
168
|
+
queued.delete(id);
|
|
169
|
+
notes.push({ id, text: "no longer waits to restart: it was stopped meanwhile (it starts on the new version)", level: "info" });
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
const into = deps.foldedInto?.(id);
|
|
173
|
+
if (into) {
|
|
174
|
+
queued.delete(id);
|
|
175
|
+
notes.push({ id, text: `no longer waits to restart: ${into} restarts it`, level: "info" });
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
if (!deps.busy(id, opts)) ready.push(id);
|
|
179
|
+
}
|
|
180
|
+
await run(ready, notes);
|
|
181
|
+
finish(notes);
|
|
182
|
+
};
|
|
183
|
+
return {
|
|
184
|
+
request,
|
|
185
|
+
retry: () => retry(),
|
|
186
|
+
/** A session's turn ended: restart it if it was waiting for that — and if it still reads as busy, look again shortly. */
|
|
187
|
+
turnEnded: (id) => {
|
|
188
|
+
if (!queued.has(id)) return;
|
|
189
|
+
later(() => void retry(id, { turnEnded: true }).catch(() => {
|
|
190
|
+
}), TURN_END_GRACE_MS);
|
|
191
|
+
},
|
|
192
|
+
queued: () => [...queued],
|
|
193
|
+
/** Take one off the queue (it no longer waits for its turn); false when it wasn't waiting (not queued, or running now). */
|
|
194
|
+
cancel: (id) => {
|
|
195
|
+
if (!queued.delete(id)) return false;
|
|
196
|
+
if (queued.size === 0) deps.scheduled?.(null);
|
|
197
|
+
deps.changed?.();
|
|
198
|
+
return true;
|
|
199
|
+
},
|
|
200
|
+
/** Being restarted now (the host lists them as exited meanwhile: still this session's). */
|
|
201
|
+
restarting: () => [...inFlight.keys()]
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// src/core/sessions/account-switch-rules.ts
|
|
206
|
+
function switchRefusal(to, f) {
|
|
207
|
+
if (f.archived) return { status: 409, error: "it is archived: restore it first" };
|
|
208
|
+
if (!f.accounts) return { status: 409, error: "its agent doesn't have accounts" };
|
|
209
|
+
const target = f.accounts.list.find((a) => a.name === to);
|
|
210
|
+
if (!target) return { status: 400, error: `no account \u201C${to}\u201D (see \`work account list\`)` };
|
|
211
|
+
if (target.loggedIn === false)
|
|
212
|
+
return { status: 409, error: `nobody is logged in on \u201C${to}\u201D: run \`work account add ${to}\` again to log in, or /login on it` };
|
|
213
|
+
if (f.pendingTo !== null)
|
|
214
|
+
return { status: 409, error: `a switch is already waiting for its turn to end (to ${f.pendingTo || "another account"})` };
|
|
215
|
+
if (f.accounts.current === to) return { status: 409, error: `it already runs on \u201C${to}\u201D` };
|
|
216
|
+
if (!f.inHost && f.runningOutside)
|
|
217
|
+
return {
|
|
218
|
+
status: 409,
|
|
219
|
+
error: "its Claude runs in a terminal outside work: stop it there first (its conversation would be moved from under it)"
|
|
220
|
+
};
|
|
221
|
+
return null;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// src/core/sessions/account-switch.ts
|
|
225
|
+
var msg = (err) => err instanceof Error ? err.message : String(err);
|
|
226
|
+
function createAccountSwitcher(deps) {
|
|
227
|
+
const targets = /* @__PURE__ */ new Map();
|
|
228
|
+
const movedBy = /* @__PURE__ */ new Map();
|
|
229
|
+
const name = (s) => `${s.target} ${s.branch}`;
|
|
230
|
+
const moveAndRecord = async (s, to, from) => {
|
|
231
|
+
const { moved } = await deps.switchFiles(s, to);
|
|
232
|
+
try {
|
|
233
|
+
await deps.record(s, to);
|
|
234
|
+
} catch (err) {
|
|
235
|
+
const back = await deps.switchFiles({ ...s, account: to }, from).then(
|
|
236
|
+
() => "",
|
|
237
|
+
(e2) => `; and its conversations couldn't all be moved back: ${msg(e2)}`
|
|
238
|
+
);
|
|
239
|
+
throw new Error(`${msg(err)}${back}`, { cause: err });
|
|
240
|
+
}
|
|
241
|
+
return moved.length;
|
|
242
|
+
};
|
|
243
|
+
const perform = async (id) => {
|
|
244
|
+
const to = targets.get(id);
|
|
245
|
+
const s = deps.session(id);
|
|
246
|
+
try {
|
|
247
|
+
if (!to || !s) throw new Error("the session is gone");
|
|
248
|
+
if (s.archivedAt || deps.beingArchived(id)) throw new Error("it was archived meanwhile");
|
|
249
|
+
const acc = deps.accounts(s);
|
|
250
|
+
if (!acc) throw new Error("its agent has no accounts");
|
|
251
|
+
const from = acc.current;
|
|
252
|
+
if (from === to) return `already on ${to}`;
|
|
253
|
+
const before = await refusalBeforeStop(s, id);
|
|
254
|
+
if (before) throw new Error(`stays on ${from}: ${before}`);
|
|
255
|
+
if (deps.cancelRestart?.(id)) deps.note?.(id, "its agent restart that waited for this turn is done by the switch instead", "info");
|
|
256
|
+
let halted = null;
|
|
257
|
+
if (deps.hostRuns(id)) {
|
|
258
|
+
let h;
|
|
259
|
+
try {
|
|
260
|
+
h = await deps.halt(id);
|
|
261
|
+
} catch (err) {
|
|
262
|
+
throw new Error(`stays on ${from}: couldn't stop its Claude: ${msg(err)}`, { cause: err });
|
|
263
|
+
}
|
|
264
|
+
if (h !== "gone") halted = h;
|
|
265
|
+
}
|
|
266
|
+
const resume = async () => halted ? deps.resume(id, halted) : void 0;
|
|
267
|
+
let moved;
|
|
268
|
+
try {
|
|
269
|
+
moved = await moveAndRecord(s, to, from);
|
|
270
|
+
} catch (err) {
|
|
271
|
+
const back = await resume().then(
|
|
272
|
+
() => "",
|
|
273
|
+
(e2) => ` (and couldn't start its Claude again: ${msg(e2)}; opening the session starts it)`
|
|
274
|
+
);
|
|
275
|
+
throw new Error(`stays on ${from}: ${msg(err)}${back}`, { cause: err });
|
|
276
|
+
}
|
|
277
|
+
movedBy.set(id, moved);
|
|
278
|
+
if (!halted) {
|
|
279
|
+
deps.note?.(id, `moved to the ${to} account (${moved} entries moved; its next start uses it)`, "action");
|
|
280
|
+
return `moved to the ${to} account`;
|
|
281
|
+
}
|
|
282
|
+
try {
|
|
283
|
+
const how = await resume();
|
|
284
|
+
deps.note?.(id, `moved to the ${to} account: its Claude restarted on it${how ? ` (${how})` : ""}`, "action");
|
|
285
|
+
return how || `moved to the ${to} account: its Claude restarted on it`;
|
|
286
|
+
} catch (err) {
|
|
287
|
+
const why = `moved to the ${to} account, but its Claude couldn't be restarted: ${msg(err)} (opening the session starts it on ${to})`;
|
|
288
|
+
deps.note?.(id, why, "warn");
|
|
289
|
+
throw new Error(why, { cause: err });
|
|
290
|
+
}
|
|
291
|
+
} catch (err) {
|
|
292
|
+
if (s && !String(msg(err)).startsWith("moved to")) deps.note?.(id, `couldn't switch: ${msg(err)}`, "warn");
|
|
293
|
+
throw err;
|
|
294
|
+
} finally {
|
|
295
|
+
targets.delete(id);
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
const restarter = createRestarter({
|
|
299
|
+
restart: perform,
|
|
300
|
+
busy: deps.busy,
|
|
301
|
+
// A queued switch is never dropped as "stopped meanwhile": perform handles a Claude no longer running (it records the account).
|
|
302
|
+
running: () => true,
|
|
303
|
+
changed: deps.changed,
|
|
304
|
+
scheduled: deps.scheduled,
|
|
305
|
+
later: deps.later
|
|
306
|
+
});
|
|
307
|
+
const refusalBeforeStop = async (s, id) => {
|
|
308
|
+
const other = deps.othersRunningIn?.(s, id);
|
|
309
|
+
if (other) return `a Claude outside this session runs in ${other}`;
|
|
310
|
+
return deps.hostRuns(id) ? await deps.hostRefusal?.() ?? null : null;
|
|
311
|
+
};
|
|
312
|
+
const pending = (id) => restarter.queued().includes(id) || restarter.restarting().includes(id);
|
|
313
|
+
async function switchAccount(id, to) {
|
|
314
|
+
const s = deps.session(id);
|
|
315
|
+
if (!s) return { ok: false, status: 404, error: "unknown session" };
|
|
316
|
+
const acc = deps.accounts(s);
|
|
317
|
+
const inHost = deps.hostRuns(id);
|
|
318
|
+
const refused = switchRefusal(to, {
|
|
319
|
+
archived: !!s.archivedAt || deps.beingArchived(id),
|
|
320
|
+
accounts: acc,
|
|
321
|
+
pendingTo: pending(id) ? targets.get(id) ?? "" : null,
|
|
322
|
+
inHost,
|
|
323
|
+
runningOutside: !inHost && deps.runningOutside(id)
|
|
324
|
+
});
|
|
325
|
+
if (refused) return { ok: false, ...refused };
|
|
326
|
+
if (!acc) return { ok: false, status: 409, error: "its agent doesn't have accounts" };
|
|
327
|
+
const before = await refusalBeforeStop(s, id);
|
|
328
|
+
if (before) return { ok: false, status: 409, error: `stays on ${acc.current}: ${before}` };
|
|
329
|
+
if (!inHost) {
|
|
330
|
+
try {
|
|
331
|
+
const moved = await moveAndRecord(s, to, acc.current);
|
|
332
|
+
deps.note?.(id, `${name(s)}: moved to the ${to} account (${moved} entries moved; its next start uses it)`, "action");
|
|
333
|
+
deps.changed?.();
|
|
334
|
+
return { ok: true, outcome: "recorded", moved };
|
|
335
|
+
} catch (err) {
|
|
336
|
+
deps.note?.(id, `couldn't switch: ${msg(err)}`, "warn");
|
|
337
|
+
return { ok: false, status: 502, error: `stays on ${acc.current}: ${msg(err)}` };
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
targets.set(id, to);
|
|
341
|
+
movedBy.delete(id);
|
|
342
|
+
const r = await restarter.request([id]);
|
|
343
|
+
if (r.later.includes(id)) {
|
|
344
|
+
deps.note?.(id, `will move to the ${to} account when its turn ends (it is working or waiting on you)`, "info");
|
|
345
|
+
return { ok: true, outcome: "queued" };
|
|
346
|
+
}
|
|
347
|
+
const failed = r.failed.find((f) => f.id === id);
|
|
348
|
+
if (failed) return { ok: false, status: 502, error: failed.error };
|
|
349
|
+
return { ok: true, outcome: "switched", moved: movedBy.get(id) };
|
|
350
|
+
}
|
|
351
|
+
return {
|
|
352
|
+
switchAccount,
|
|
353
|
+
/** Its turn ended: do the switch that waited for it. */
|
|
354
|
+
turnEnded: (id) => restarter.turnEnded(id),
|
|
355
|
+
/** Do the waiting switches that can go now (a turn whose end no hook reported). */
|
|
356
|
+
retry: () => restarter.retry(),
|
|
357
|
+
/** Sessions waiting for their turn to end, and where each goes. */
|
|
358
|
+
waiting: () => restarter.queued().map((id) => ({ id, to: targets.get(id) ?? "" })),
|
|
359
|
+
/** The account a switch waiting for its turn, or being done now, moves it to; null: none. Either way its agent restarts. */
|
|
360
|
+
restartsAnyway: (id) => pending(id) ? targets.get(id) ?? "" : null,
|
|
361
|
+
/** The account a session is waiting to move to (its turn first), or null. Kept in memory: a work web restart drops it. */
|
|
362
|
+
pendingFor: (id) => restarter.queued().includes(id) ? targets.get(id) ?? null : null,
|
|
363
|
+
/**
|
|
364
|
+
* Drop the switch waiting for its turn to end. `running`: it is being done right now (too late to cancel); `none`:
|
|
365
|
+
* nothing waits for it.
|
|
366
|
+
*/
|
|
367
|
+
cancel: (id) => {
|
|
368
|
+
if (restarter.restarting().includes(id)) return "running";
|
|
369
|
+
const to = targets.get(id);
|
|
370
|
+
if (!restarter.cancel(id)) return "none";
|
|
371
|
+
targets.delete(id);
|
|
372
|
+
deps.note?.(id, `no longer moves to the ${to ?? "other"} account: the switch was cancelled`, "info");
|
|
373
|
+
return "cancelled";
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
function accountSwitchNote(activity, label) {
|
|
378
|
+
return (id, text, level) => {
|
|
379
|
+
const name = label(id);
|
|
380
|
+
const run = activity.start("accounts", "Switching a Claude account");
|
|
381
|
+
run.note(`${name ?? id}: ${text}`, { level, sessionId: name ? id : void 0 });
|
|
382
|
+
if (level === "warn") run.fail(text);
|
|
383
|
+
else run.done(text);
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
// src/core/sessions/account-switch-deps.ts
|
|
388
|
+
import path from "path";
|
|
389
|
+
function defaultAccountSwitchDeps(opts) {
|
|
390
|
+
return {
|
|
391
|
+
session: findSession,
|
|
392
|
+
beingArchived: isArchiving,
|
|
393
|
+
accounts: (s) => {
|
|
394
|
+
const accounts = agentOf(s).accounts;
|
|
395
|
+
return accounts ? { list: accounts.list(), current: accounts.current(s) } : null;
|
|
396
|
+
},
|
|
397
|
+
switchFiles: (s, to) => {
|
|
398
|
+
const accounts = agentOf(s).accounts;
|
|
399
|
+
if (!accounts) throw new Error("its agent has no accounts");
|
|
400
|
+
return accounts.switchFiles(s, to);
|
|
401
|
+
},
|
|
402
|
+
record: async (s, to) => {
|
|
403
|
+
if (!await setSessionAccount(s.target, s.branch, to)) throw new Error("unknown session");
|
|
404
|
+
},
|
|
405
|
+
hostRuns: peekPty,
|
|
406
|
+
// Claude Code's process files say one runs for it that isn't the host's (terminal-ws.ts, session-control-routes.ts).
|
|
407
|
+
runningOutside: (id) => {
|
|
408
|
+
const hostPids = ptyPids();
|
|
409
|
+
return (agentsBySession(liveAgents(), loadHistory()).get(id) ?? []).some((c) => !hostPids.has(c.pid));
|
|
410
|
+
},
|
|
411
|
+
othersRunningIn: (s, id) => {
|
|
412
|
+
const folders = agentOf(s).accounts?.folders(s) ?? [];
|
|
413
|
+
if (!folders.length) return null;
|
|
414
|
+
const own = ptyPid(id);
|
|
415
|
+
const key = (p) => {
|
|
416
|
+
const r = path.resolve(p).replace(/[\\/]+$/, "");
|
|
417
|
+
return process.platform === "win32" ? r.toLowerCase() : r;
|
|
418
|
+
};
|
|
419
|
+
const wanted = new Map(folders.map((f) => [key(f), f]));
|
|
420
|
+
const other = liveAgents().find((a) => a.pid !== own && wanted.has(key(a.cwd)));
|
|
421
|
+
return other ? wanted.get(key(other.cwd)) ?? other.cwd : null;
|
|
422
|
+
},
|
|
423
|
+
hostRefusal: accountSwitchRefusal,
|
|
424
|
+
halt: haltPty,
|
|
425
|
+
resume: resumePtyOnAccount,
|
|
426
|
+
...opts
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
export {
|
|
431
|
+
installedAtCache,
|
|
432
|
+
outdatedPtys,
|
|
433
|
+
busyForRestart,
|
|
434
|
+
restartNotesSummary,
|
|
435
|
+
QUEUE_RECHECK_MS,
|
|
436
|
+
createRestarter,
|
|
437
|
+
switchRefusal,
|
|
438
|
+
createAccountSwitcher,
|
|
439
|
+
accountSwitchNote,
|
|
440
|
+
defaultAccountSwitchDeps
|
|
441
|
+
};
|
|
442
|
+
//# sourceMappingURL=chunk-D675JTUZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/pty/agent-restart.ts","../src/core/sessions/account-switch-rules.ts","../src/core/sessions/account-switch.ts","../src/core/sessions/account-switch-deps.ts"],"sourcesContent":["import fs from 'node:fs';\nimport { findOnPath } from '../platform/find-on-path.js';\nimport type { PtyInfo } from './pty-host-protocol.js';\nimport { LATER_TEXT, restartCountsText } from './restart-view.js';\n\n/**\n * Restarting the agents in the PTY host — after their tool updated (Claude Code\n * replaced its binary; a running Claude keeps the old one until it starts again),\n * or when asked. A restart is its agent stopped and started again in place,\n * resuming its conversation; never in the middle of a turn: a session working or\n * waiting on you restarts when its turn ends.\n */\n\n/** Before this, an mtime isn't when the file was installed: npm unpacks every file dated 1985-10-26. */\nconst PACKED_MTIME_BEFORE = Date.parse('1990-01-01T00:00:00Z');\n\n/**\n * When the file a tool's command runs was installed, following links\n * (`~/.local/bin/claude` → `versions/2.1.296`): the later of its modification time\n * and its creation — an updater that copies the new file keeping its build date\n * still creates it now. A file npm unpacked with its fixed old date, on a system\n * that doesn't record creation, falls back to its change time (the unpacking).\n * Not the change time otherwise: a chmod or a relink moves it, and every running\n * agent would read as outdated. Null when it isn't on PATH.\n */\nexport function installedAt(cmd: string, find: (cmd: string) => string | null = findOnPath): number | null {\n const file = find(cmd);\n if (!file) return null;\n try {\n return installTime(fs.statSync(fs.realpathSync(file)));\n } catch {\n return null;\n }\n}\n\n/** installedAt's rule on a file's times. Pure. */\nexport function installTime(st: { mtimeMs: number; ctimeMs: number; birthtimeMs: number }): number {\n const real = (ms: number) => (ms >= PACKED_MTIME_BEFORE ? ms : null);\n const known = [real(st.mtimeMs), real(st.birthtimeMs)].filter((x): x is number => x !== null);\n return known.length ? Math.max(...known) : st.ctimeMs;\n}\n\n/**\n * `installedAt` per tool, read again only after `ttlMs`: a lookup walks PATH with a\n * stat per folder and extension, synchronously, and the dashboard asks every few\n * minutes per window.\n */\nexport function installedAtCache(ttlMs = 60_000, look: (cmd: string) => number | null = installedAt, now: () => number = Date.now) {\n const cache = new Map<string, { at: number | null; read: number }>();\n return (cmd: string): number | null => {\n const hit = cache.get(cmd);\n if (hit && now() - hit.read < ttlMs) return hit.at;\n const at = look(cmd);\n cache.set(cmd, { at, read: now() });\n return at;\n };\n}\n\n/**\n * The live PTYs whose process started before its tool's file was installed: they\n * run the version from before. A PTY whose tool isn't known (a host from before\n * `tool`) or isn't on PATH is left out: nothing says it's outdated. Pure.\n */\nexport function outdatedPtys(ptys: readonly PtyInfo[], toolInstalledAt: (tool: string) => number | null): PtyInfo[] {\n return ptys.filter((p) => {\n if (p.exited || !p.tool) return false;\n const at = toolInstalledAt(p.tool);\n const started = Date.parse(p.startedAt);\n return at !== null && Number.isFinite(started) && started < at;\n });\n}\n\n/** How recently a terminal printed for its agent to count as at work: a working one redraws its spinner, an idle one prints nothing. */\nexport const PRINTING_MS = 10_000;\n\n/**\n * At work, for a restart: what the agent itself says (Claude Code's own state for its process: mid-turn, or\n * waiting on you; at a permission dialog it prints nothing, so only this tells), or its status (the hooks' as\n * the dashboard reads it, corrected by the transcript and decayed) is working or waiting on you, or its\n * terminal printed in the last few seconds, which catches a turn both missed. An agent that says nothing and\n * has no status (a tool with no hooks or process state) has only the last: one silent at a prompt of its own\n * can't be told from idle. Pure.\n */\nexport function busyForRestart(\n state: 'working' | 'needs_input' | 'idle' | null,\n lastOutputMs: number | null,\n now = Date.now(),\n live: 'busy' | 'idle' | 'waiting' | null = null,\n): boolean {\n if (live === 'busy' || live === 'waiting') return true;\n if (state === 'working' || state === 'needs_input') return true;\n return lastOutputMs !== null && now - lastOutputMs < PRINTING_MS;\n}\n\n/** Which of `ids` restart now and which after their turn (working, or waiting on you). Pure. */\nexport function restartPlan(ids: readonly string[], busy: (id: string) => boolean): { now: string[]; later: string[] } {\n const now: string[] = [];\n const later: string[] = [];\n for (const id of new Set(ids)) (busy(id) ? later : now).push(id);\n return { now, later };\n}\n\n/** Restarts run this many at a time. */\nexport const RESTART_AT_ONCE = 3;\n\nexport interface RestarterDeps {\n /** Restart its agent in place (the host keeps attached terminals); a string: how it went instead (an older host). */\n restart: (id: string) => Promise<string | void>;\n /** Working, or waiting on you: not now. `turnEnded`: its turn just ended (the Stop), so the final message it\n * printed a moment ago isn't work going on. */\n busy: (id: string, opts?: { turnEnded?: boolean }) => boolean;\n /** Its agent runs in the host (a queued one stopped meanwhile needs nothing). */\n running: (id: string) => boolean;\n /** What one request (or one turn's end) decided, at once: one Activity run, not one per session. */\n report?: (notes: RestartNote[]) => void;\n /** When the waiting ones are looked at next (the Activity panel's schedule); null when nothing waits. */\n scheduled?: (nextAt: number | null) => void;\n changed?: () => void;\n /** A look again a little later (default setTimeout, unref'd): a turn-end the status hasn't caught up with yet. */\n later?: (fn: () => void, ms: number) => void;\n /**\n * Something else that restarts its agent anyway is waiting or under way (a switch of account, account-switch.ts): what\n * it is, in a few words; null: nothing. A restart asked for then is folded into it (answered as waiting, never a\n * second restart), and a queued one is dropped when its turn comes.\n */\n foldedInto?: (id: string) => string | null;\n}\n\nexport interface RestartNote {\n id: string;\n text: string;\n level: 'action' | 'info' | 'warn';\n}\n\ntype OneRestart = { ok: true; how: string } | { ok: false; error: string };\n\nexport interface RestartOutcome {\n now: string[];\n later: string[];\n failed: Array<{ id: string; error: string }>;\n}\n\n/** One request's decisions in a line, for its Activity run (restart-view.ts's wording). Pure. */\nexport function restartNotesSummary(notes: readonly RestartNote[]): string {\n const n = (level: RestartNote['level']) => notes.filter((x) => x.level === level).length;\n return restartCountsText({ restarted: n('action'), later: n('info'), failed: n('warn') });\n}\n\n/** While anything waits, how often it is looked at again: a turn whose end no hook reported, or a terminal that was\n * only redrawing (the printing check) — never left for the 5-minute sweep, which `--dev` and lean don't run. */\nexport const QUEUE_RECHECK_MS = 15_000;\n/** After a turn ends, how long before its agent is restarted: the Stop's own hooks (`work hook turn-end`: the\n * checkpoint, the status) run as its children, and stopping it at once would kill them mid-way. */\nexport const TURN_END_GRACE_MS = 10_000;\n\n/**\n * Restarts now what can go now, and the rest when their turn ends (`turnEnded`,\n * from the status hook — and once more a little later, should the status still\n * say working then) or on a later `retry` (a turn whose end no hook reported).\n * One restart per session at a time: asked again meanwhile, it shares that one's\n * outcome.\n */\nexport function createRestarter(deps: RestarterDeps) {\n const queued = new Set<string>();\n const inFlight = new Map<string, Promise<OneRestart>>();\n const later = deps.later ?? ((fn: () => void, ms: number) => void setTimeout(fn, ms).unref?.());\n\n /** Restart one: how it went (a different way, on an older host), or why not. */\n const one = (id: string): Promise<OneRestart> => {\n const running = inFlight.get(id);\n if (running) return running;\n queued.delete(id);\n const p = deps.restart(id).then(\n (how): OneRestart => ({ ok: true, how: how || 'restarted its agent (its conversation goes on)' }),\n (err: Error): OneRestart => ({ ok: false, error: err.message }),\n );\n inFlight.set(id, p);\n void p.finally(() => inFlight.delete(id));\n return p;\n };\n\n /** Restart these, RESTART_AT_ONCE at a time; each waits for its old process to exit. */\n const run = async (ids: string[], notes: RestartNote[]) => {\n const failed: RestartOutcome['failed'] = [];\n const ok = new Set<string>();\n const queue = [...ids];\n const worker = async () => {\n for (let id = queue.shift(); id !== undefined; id = queue.shift()) {\n const r = await one(id);\n if (r.ok) {\n ok.add(id);\n notes.push({ id, text: r.how, level: 'action' });\n } else {\n failed.push({ id, error: r.error });\n notes.push({ id, text: `couldn't restart its agent: ${r.error}`, level: 'warn' });\n }\n }\n };\n await Promise.all(Array.from({ length: Math.min(RESTART_AT_ONCE, queue.length) }, worker));\n return { done: ids.filter((id) => ok.has(id)), failed };\n };\n\n const finish = (notes: RestartNote[]) => {\n if (!notes.length) return;\n deps.report?.(notes);\n deps.changed?.();\n };\n\n /** Restart these (the caller found them running in the host: its list is fresh, `running` is a cache). */\n const request = async (ids: readonly string[]): Promise<RestartOutcome> => {\n const notes: RestartNote[] = [];\n const folded: string[] = [];\n for (const id of ids) {\n const into = deps.foldedInto?.(id);\n if (!into) continue;\n folded.push(id);\n notes.push({ id, text: `restarts with ${into} (no second restart)`, level: 'info' });\n }\n const plan = restartPlan(\n ids.filter((id) => !folded.includes(id)),\n (id) => deps.busy(id),\n );\n for (const id of plan.later) {\n queued.add(id);\n notes.push({ id, text: `${LATER_TEXT} (it is working or waiting on you)`, level: 'info' });\n }\n const { done, failed } = await run(plan.now, notes);\n finish(notes);\n tick();\n return { now: done, later: [...folded, ...plan.later], failed };\n };\n\n // While anything waits, it is looked at again every QUEUE_RECHECK_MS.\n let ticking = false;\n const tick = () => {\n if (ticking) return;\n if (queued.size === 0) {\n deps.scheduled?.(null);\n return;\n }\n ticking = true;\n deps.scheduled?.(Date.now() + QUEUE_RECHECK_MS);\n later(() => {\n ticking = false;\n void retry()\n .catch(() => {})\n .finally(tick);\n }, QUEUE_RECHECK_MS);\n };\n\n /** Restart the queued ones (or `only`) that can go now; a queued one stopped meanwhile is dropped. */\n const retry = async (only?: string, opts?: { turnEnded?: boolean }): Promise<void> => {\n const notes: RestartNote[] = [];\n const ready: string[] = [];\n for (const id of [...queued]) {\n if (only !== undefined && id !== only) continue;\n if (!deps.running(id)) {\n queued.delete(id);\n notes.push({ id, text: 'no longer waits to restart: it was stopped meanwhile (it starts on the new version)', level: 'info' });\n continue;\n }\n const into = deps.foldedInto?.(id);\n if (into) {\n queued.delete(id);\n notes.push({ id, text: `no longer waits to restart: ${into} restarts it`, level: 'info' });\n continue;\n }\n if (!deps.busy(id, opts)) ready.push(id);\n }\n await run(ready, notes);\n finish(notes);\n };\n\n return {\n request,\n retry: () => retry(),\n /** A session's turn ended: restart it if it was waiting for that — and if it still reads as busy, look again shortly. */\n turnEnded: (id: string): void => {\n if (!queued.has(id)) return;\n later(() => void retry(id, { turnEnded: true }).catch(() => {}), TURN_END_GRACE_MS);\n },\n queued: (): string[] => [...queued],\n /** Take one off the queue (it no longer waits for its turn); false when it wasn't waiting (not queued, or running now). */\n cancel: (id: string): boolean => {\n if (!queued.delete(id)) return false;\n if (queued.size === 0) deps.scheduled?.(null);\n deps.changed?.();\n return true;\n },\n /** Being restarted now (the host lists them as exited meanwhile: still this session's). */\n restarting: (): string[] => [...inFlight.keys()],\n };\n}\n\nexport type Restarter = ReturnType<typeof createRestarter>;\n","/**\n * When a switch of account is refused before anything is stopped or moved — the rules the real switch\n * (account-switch.ts) and the demo's (server/demo/demo-accounts.ts) share. Pure: no imports.\n */\n\n/** An account as the rules see it (agents/types.ts `AccountInfo`; the wire's `AccountWire`). */\nexport interface SwitchAccountInfo {\n name: string;\n /** Logged in; null: can't tell (macOS keeps Claude's credentials in the keychain) — allowed. */\n loggedIn: boolean | null;\n}\n\nexport interface SwitchFacts {\n /** Archived, or being archived right now. */\n archived: boolean;\n /** Its agent's accounts and the one it is on; null: its agent has none. */\n accounts: { list: readonly SwitchAccountInfo[]; current: string } | null;\n /** Where a switch already waiting for its turn (or being done now) goes; null: none. */\n pendingTo: string | null;\n /** Its agent runs in the PTY host (a switch can stop and start it there). */\n inHost: boolean;\n /** Its agent runs in a terminal outside work. */\n runningOutside: boolean;\n}\n\nexport type SwitchRefusal = { status: 400 | 409; error: string };\n\n/** Why the session can't be moved to `to` (status and reason), or null. In the order the user is told them. */\nexport function switchRefusal(to: string, f: SwitchFacts): SwitchRefusal | null {\n if (f.archived) return { status: 409, error: 'it is archived: restore it first' };\n if (!f.accounts) return { status: 409, error: \"its agent doesn't have accounts\" };\n const target = f.accounts.list.find((a) => a.name === to);\n if (!target) return { status: 400, error: `no account “${to}” (see \\`work account list\\`)` };\n if (target.loggedIn === false)\n return { status: 409, error: `nobody is logged in on “${to}”: run \\`work account add ${to}\\` again to log in, or /login on it` };\n if (f.pendingTo !== null)\n return { status: 409, error: `a switch is already waiting for its turn to end (to ${f.pendingTo || 'another account'})` };\n if (f.accounts.current === to) return { status: 409, error: `it already runs on “${to}”` };\n if (!f.inHost && f.runningOutside)\n return {\n status: 409,\n error: 'its Claude runs in a terminal outside work: stop it there first (its conversation would be moved from under it)',\n };\n return null;\n}\n","import type { AccountInfo } from '../agents/types.js';\nimport { createRestarter, type Restarter } from '../pty/agent-restart.js';\nimport type { WorktreeSession } from './session-types.js';\nimport type { ActivityLog } from '../platform/activity.js';\nimport { switchRefusal } from './account-switch-rules.js';\n\n/**\n * Moving a session to another account of its agent (Claude: another login, for when the first one's limit runs out).\n * The policy is here; I/O is passed in (account-routes.ts and web-server.ts give the real one, tests a fake).\n *\n * Refused: an unknown or archived session, an agent with no accounts, an unknown account, one nobody is logged in to, the\n * account it is on, a Claude running in a terminal outside work (a switch can't stop it), one switch already waiting.\n *\n * Not running in the PTY host: its conversations move and the account is recorded — the next start uses it. Running and\n * idle: its Claude is halted in the host (stopped, its terminals kept), the conversations move, the account is recorded, and it\n * is resumed in place on the new account — in that order, so nothing writes into the old folder while it moves. Working, or waiting\n * on you: after its turn — through the agent restarter's queue (agent-restart.ts), so the rule for \"not mid-turn\" is the\n * restart's own, with a switch as the thing that runs when its turn ends.\n */\n\nexport interface AccountSwitchDeps {\n session: (id: string) => WorktreeSession | null;\n /** Being archived right now (its Claude was stopped on purpose, and mustn't be started again). */\n beingArchived: (id: string) => boolean;\n /** Its agent's accounts; null: its agent has none. */\n accounts: (session: WorktreeSession) => { list: AccountInfo[]; current: string } | null;\n /** Move its conversations to `to`'s folders (puts back what it moved when it fails, and throws). */\n switchFiles: (session: WorktreeSession, to: string) => Promise<{ moved: string[] }>;\n /** Record the account on the session, in one transaction. */\n record: (session: WorktreeSession, to: string) => Promise<void>;\n /** Its Claude runs in the PTY host. */\n hostRuns: (id: string) => boolean;\n /** Its Claude runs in a terminal outside work. */\n runningOutside: (id: string) => boolean;\n /** A folder whose conversations the switch would move where another agent (of any account, not this session's own in\n * the host) runs now — its files would move from under it; null: none. */\n othersRunningIn?: (session: WorktreeSession, id: string) => string | null;\n /** Why the PTY host can't run it on another account (one from before accounts), or null. Asked before anything stops. */\n hostRefusal?: () => Promise<string | null>;\n /** Working, or waiting on you (`turnEnded`: its turn just ended, so what it printed a moment ago isn't work going on). */\n busy: (id: string, opts?: { turnEnded?: boolean }) => boolean;\n /** Stop its Claude in the host and keep its session (terminals attached) until `resume`: the files move only after it is stopped.\n * `stopped`: an older host stopped it the old way; `gone`: nothing was running. */\n halt: (id: string) => Promise<'halted' | 'stopped' | 'gone'>;\n /** Start it again after `halt`, on the account the session records now (so the old one after a switch that failed): in place\n * when it was `halted` (its terminals carry on), from a fresh spec when `stopped` (an older host). A string: how it went instead. */\n resume: (id: string, how: 'halted' | 'stopped') => Promise<string | void>;\n /** One line of what a switch decided, for the Activity panel. */\n note?: (id: string, text: string, level: 'action' | 'info' | 'warn') => void;\n changed?: () => void;\n scheduled?: (nextAt: number | null) => void;\n /** A look again a little later (the restarter's own default: setTimeout). */\n later?: (fn: () => void, ms: number) => void;\n /** Drop an agent restart waiting for its turn (agent-restart.ts): the switch restarts it anyway. True when one was waiting. */\n cancelRestart?: (id: string) => boolean;\n}\n\nexport type SwitchOutcome = 'switched' | 'queued' | 'recorded';\n\nexport type SwitchResult =\n { ok: true; outcome: SwitchOutcome; moved?: number } | { ok: false; status: 400 | 404 | 409 | 502; error: string };\n\nconst msg = (err: unknown) => (err instanceof Error ? err.message : String(err));\n\nexport function createAccountSwitcher(deps: AccountSwitchDeps) {\n /** Where each waiting (or running) switch goes. */\n const targets = new Map<string, string>();\n /** How many entries each finished switch moved, for the answer. */\n const movedBy = new Map<string, number>();\n\n const name = (s: WorktreeSession) => `${s.target} ${s.branch}`;\n\n /** Move the files and record the account; a failed record puts the files back. Returns how many entries moved. */\n const moveAndRecord = async (s: WorktreeSession, to: string, from: string): Promise<number> => {\n const { moved } = await deps.switchFiles(s, to);\n try {\n await deps.record(s, to);\n } catch (err) {\n // The files are in the new account's folders and the session still says the old one: back, or its --continue finds\n // nothing. A move back that fails is said with the error (its message names what is stuck where).\n const back = await deps.switchFiles({ ...s, account: to }, from).then(\n () => '',\n (e2: unknown) => `; and its conversations couldn't all be moved back: ${msg(e2)}`,\n );\n throw new Error(`${msg(err)}${back}`, { cause: err });\n }\n return moved.length;\n };\n\n /** What the restarter runs for a session (at once when idle, after its turn when not): the move, the record, the restart. */\n const perform = async (id: string): Promise<string | void> => {\n const to = targets.get(id);\n const s = deps.session(id);\n try {\n if (!to || !s) throw new Error('the session is gone');\n if (s.archivedAt || deps.beingArchived(id)) throw new Error('it was archived meanwhile');\n const acc = deps.accounts(s);\n if (!acc) throw new Error('its agent has no accounts');\n const from = acc.current;\n if (from === to) return `already on ${to}`;\n const before = await refusalBeforeStop(s, id);\n if (before) throw new Error(`stays on ${from}: ${before}`);\n // A restart of its agent that waited for this turn too would stop it a second time: the switch's restart does its job.\n if (deps.cancelRestart?.(id)) deps.note?.(id, 'its agent restart that waited for this turn is done by the switch instead', 'info');\n // Stopped first: a running (or just exiting) Claude writes to its transcript, and on Windows holds the file.\n let halted: 'halted' | 'stopped' | null = null;\n if (deps.hostRuns(id)) {\n let h: 'halted' | 'stopped' | 'gone';\n try {\n h = await deps.halt(id);\n } catch (err) {\n throw new Error(`stays on ${from}: couldn't stop its Claude: ${msg(err)}`, { cause: err });\n }\n if (h !== 'gone') halted = h;\n }\n /** Start it again on the account the session records (still the old one until the record is made). */\n const resume = async (): Promise<string | void> => (halted ? deps.resume(id, halted) : undefined);\n let moved: number;\n try {\n moved = await moveAndRecord(s, to, from);\n } catch (err) {\n // Put back (the move rolled itself back, a failed record moved the files back): it goes on running on the account it has.\n const back = await resume().then(\n () => '',\n (e2: unknown) => ` (and couldn't start its Claude again: ${msg(e2)}; opening the session starts it)`,\n );\n throw new Error(`stays on ${from}: ${msg(err)}${back}`, { cause: err });\n }\n movedBy.set(id, moved);\n if (!halted) {\n deps.note?.(id, `moved to the ${to} account (${moved} entries moved; its next start uses it)`, 'action');\n return `moved to the ${to} account`;\n }\n try {\n const how = await resume();\n deps.note?.(id, `moved to the ${to} account: its Claude restarted on it${how ? ` (${how})` : ''}`, 'action');\n return how || `moved to the ${to} account: its Claude restarted on it`;\n } catch (err) {\n // The account is recorded and the files are there: opening the session starts it on the new one.\n const why = `moved to the ${to} account, but its Claude couldn't be restarted: ${msg(err)} (opening the session starts it on ${to})`;\n deps.note?.(id, why, 'warn');\n throw new Error(why, { cause: err });\n }\n } catch (err) {\n if (s && !String(msg(err)).startsWith('moved to')) deps.note?.(id, `couldn't switch: ${msg(err)}`, 'warn');\n throw err;\n } finally {\n targets.delete(id);\n }\n };\n\n const restarter: Restarter = createRestarter({\n restart: perform,\n busy: deps.busy,\n // A queued switch is never dropped as \"stopped meanwhile\": perform handles a Claude no longer running (it records the account).\n running: () => true,\n changed: deps.changed,\n scheduled: deps.scheduled,\n later: deps.later,\n });\n\n /** What stops a switch before anything is stopped or moved: an older PTY host, another Claude in one of its folders. */\n const refusalBeforeStop = async (s: WorktreeSession, id: string): Promise<string | null> => {\n const other = deps.othersRunningIn?.(s, id);\n if (other) return `a Claude outside this session runs in ${other}`;\n return deps.hostRuns(id) ? ((await deps.hostRefusal?.()) ?? null) : null;\n };\n\n const pending = (id: string) => restarter.queued().includes(id) || restarter.restarting().includes(id);\n\n async function switchAccount(id: string, to: string): Promise<SwitchResult> {\n const s = deps.session(id);\n if (!s) return { ok: false, status: 404, error: 'unknown session' };\n const acc = deps.accounts(s);\n const inHost = deps.hostRuns(id);\n const refused = switchRefusal(to, {\n archived: !!s.archivedAt || deps.beingArchived(id),\n accounts: acc,\n pendingTo: pending(id) ? (targets.get(id) ?? '') : null,\n inHost,\n runningOutside: !inHost && deps.runningOutside(id),\n });\n if (refused) return { ok: false, ...refused };\n if (!acc) return { ok: false, status: 409, error: \"its agent doesn't have accounts\" }; // (refused above: for the type)\n\n const before = await refusalBeforeStop(s, id);\n if (before) return { ok: false, status: 409, error: `stays on ${acc.current}: ${before}` };\n\n if (!inHost) {\n // Nothing to stop: the files move and the account is recorded; the next start uses it.\n try {\n const moved = await moveAndRecord(s, to, acc.current);\n deps.note?.(id, `${name(s)}: moved to the ${to} account (${moved} entries moved; its next start uses it)`, 'action');\n deps.changed?.();\n return { ok: true, outcome: 'recorded', moved };\n } catch (err) {\n deps.note?.(id, `couldn't switch: ${msg(err)}`, 'warn');\n return { ok: false, status: 502, error: `stays on ${acc.current}: ${msg(err)}` };\n }\n }\n\n targets.set(id, to);\n movedBy.delete(id);\n const r = await restarter.request([id]);\n if (r.later.includes(id)) {\n deps.note?.(id, `will move to the ${to} account when its turn ends (it is working or waiting on you)`, 'info');\n return { ok: true, outcome: 'queued' };\n }\n const failed = r.failed.find((f) => f.id === id);\n if (failed) return { ok: false, status: 502, error: failed.error };\n return { ok: true, outcome: 'switched', moved: movedBy.get(id) };\n }\n\n return {\n switchAccount,\n /** Its turn ended: do the switch that waited for it. */\n turnEnded: (id: string) => restarter.turnEnded(id),\n /** Do the waiting switches that can go now (a turn whose end no hook reported). */\n retry: () => restarter.retry(),\n /** Sessions waiting for their turn to end, and where each goes. */\n waiting: (): Array<{ id: string; to: string }> => restarter.queued().map((id) => ({ id, to: targets.get(id) ?? '' })),\n /** The account a switch waiting for its turn, or being done now, moves it to; null: none. Either way its agent restarts. */\n restartsAnyway: (id: string): string | null => (pending(id) ? (targets.get(id) ?? '') : null),\n /** The account a session is waiting to move to (its turn first), or null. Kept in memory: a work web restart drops it. */\n pendingFor: (id: string): string | null => (restarter.queued().includes(id) ? (targets.get(id) ?? null) : null),\n /**\n * Drop the switch waiting for its turn to end. `running`: it is being done right now (too late to cancel); `none`:\n * nothing waits for it.\n */\n cancel: (id: string): 'cancelled' | 'running' | 'none' => {\n if (restarter.restarting().includes(id)) return 'running';\n const to = targets.get(id);\n if (!restarter.cancel(id)) return 'none';\n targets.delete(id);\n deps.note?.(id, `no longer moves to the ${to ?? 'other'} account: the switch was cancelled`, 'info');\n return 'cancelled';\n },\n };\n}\n\nexport type AccountSwitcher = ReturnType<typeof createAccountSwitcher>;\n\n/**\n * The switcher's `note` as Activity runs: one run per note, a failure (`warn`) failing it — so a switch that waited for its\n * turn and then couldn't be done lights the Activity dot, rather than passing as a run that went fine.\n */\nexport function accountSwitchNote(\n activity: Pick<ActivityLog, 'start'>,\n label: (id: string) => string | null,\n): NonNullable<AccountSwitchDeps['note']> {\n return (id, text, level) => {\n const name = label(id);\n const run = activity.start('accounts', 'Switching a Claude account');\n run.note(`${name ?? id}: ${text}`, { level, sessionId: name ? id : undefined });\n if (level === 'warn') run.fail(text);\n else run.done(text);\n };\n}\n","import path from 'node:path';\nimport { agentOf, liveAgents } from '../agents/index.js';\nimport { isArchiving } from '../archive/archiving.js';\nimport { accountSwitchRefusal, peekPty, ptyPid, ptyPids, haltPty, resumePtyOnAccount } from '../pty/pty-pool.js';\nimport type { AccountSwitchDeps } from './account-switch.js';\nimport { loadHistory, setSessionAccount } from './history.js';\nimport { agentsBySession } from './live-agents.js';\nimport { findSession } from './web-state.js';\n\n/** The real inputs of createAccountSwitcher (account-switch.ts); work web gives `busy`, the Activity notes and the broadcast. */\nexport function defaultAccountSwitchDeps(opts: Pick<AccountSwitchDeps, 'busy'> & Partial<AccountSwitchDeps>): AccountSwitchDeps {\n return {\n session: findSession,\n beingArchived: isArchiving,\n accounts: (s) => {\n const accounts = agentOf(s).accounts;\n return accounts ? { list: accounts.list(), current: accounts.current(s) } : null;\n },\n switchFiles: (s, to) => {\n const accounts = agentOf(s).accounts;\n if (!accounts) throw new Error('its agent has no accounts');\n return accounts.switchFiles(s, to);\n },\n record: async (s, to) => {\n if (!(await setSessionAccount(s.target, s.branch, to))) throw new Error('unknown session');\n },\n hostRuns: peekPty,\n // Claude Code's process files say one runs for it that isn't the host's (terminal-ws.ts, session-control-routes.ts).\n runningOutside: (id) => {\n const hostPids = ptyPids();\n return (agentsBySession(liveAgents(), loadHistory()).get(id) ?? []).some((c) => !hostPids.has(c.pid));\n },\n othersRunningIn: (s, id) => {\n const folders = agentOf(s).accounts?.folders(s) ?? [];\n if (!folders.length) return null;\n const own = ptyPid(id);\n const key = (p: string) => {\n const r = path.resolve(p).replace(/[\\\\/]+$/, '');\n return process.platform === 'win32' ? r.toLowerCase() : r;\n };\n const wanted = new Map(folders.map((f) => [key(f), f]));\n const other = liveAgents().find((a) => a.pid !== own && wanted.has(key(a.cwd)));\n return other ? (wanted.get(key(other.cwd)) ?? other.cwd) : null;\n },\n hostRefusal: accountSwitchRefusal,\n halt: haltPty,\n resume: resumePtyOnAccount,\n ...opts,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ;AAcf,IAAM,sBAAsB,KAAK,MAAM,sBAAsB;AAWtD,SAAS,YAAY,KAAa,OAAuC,YAA2B;AACzG,QAAM,OAAO,KAAK,GAAG;AACrB,MAAI,CA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