@moberg_hr/work-tree 2.7.0 → 2.8.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-SOJAHTL5.js +245 -0
- package/dist/account-SOJAHTL5.js.map +1 -0
- package/dist/{add-repo-E7KWNJJV.js → add-repo-B4ITRH4Q.js} +26 -22
- package/dist/{add-repo-E7KWNJJV.js.map → add-repo-B4ITRH4Q.js.map} +1 -1
- package/dist/{answer-2CBOWCL5.js → answer-JHK4SZAH.js} +15 -12
- package/dist/{answer-2CBOWCL5.js.map → answer-JHK4SZAH.js.map} +1 -1
- package/dist/{attach-AWRY4LSI.js → attach-3IU7O7YE.js} +19 -16
- package/dist/{attach-AWRY4LSI.js.map → attach-3IU7O7YE.js.map} +1 -1
- package/dist/bin.js +7 -5
- package/dist/bin.js.map +1 -1
- package/dist/{block-JTJX5QIO.js → block-JTA7ULQS.js} +15 -12
- package/dist/{block-JTJX5QIO.js.map → block-JTA7ULQS.js.map} +1 -1
- package/dist/{broadcast-3SF55HA6.js → broadcast-JKPTCLUZ.js} +12 -9
- package/dist/{broadcast-3SF55HA6.js.map → broadcast-JKPTCLUZ.js.map} +1 -1
- package/dist/{catchup-2WNHEMLD.js → catchup-MT55LLAS.js} +18 -15
- package/dist/{catchup-2WNHEMLD.js.map → catchup-MT55LLAS.js.map} +1 -1
- package/dist/{chunk-TPPTL7LA.js → chunk-26MWJLDS.js} +3 -3
- package/dist/{chunk-ZNXACRZ5.js → chunk-27BDXWSY.js} +9 -5
- package/dist/{chunk-ZNXACRZ5.js.map → chunk-27BDXWSY.js.map} +1 -1
- package/dist/{chunk-5GA3PFK5.js → chunk-27UC5NXT.js} +13 -9
- package/dist/chunk-27UC5NXT.js.map +1 -0
- package/dist/{chunk-KUVL75PL.js → chunk-2MQWAQ2D.js} +8 -8
- 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-J5CMORVD.js → chunk-45DVD6HF.js} +15 -11
- package/dist/{chunk-J5CMORVD.js.map → chunk-45DVD6HF.js.map} +1 -1
- 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-6THUVP6T.js +118 -0
- package/dist/chunk-6THUVP6T.js.map +1 -0
- package/dist/{chunk-MCSEYS2J.js → chunk-7GGIVYWP.js} +5 -5
- package/dist/{chunk-WIWO3YWP.js → chunk-7NVEGPZT.js} +2 -2
- package/dist/{chunk-JIYGGN2N.js → chunk-AU27USPZ.js} +2 -2
- package/dist/chunk-BOEAOIQT.js +43 -0
- package/dist/chunk-BOEAOIQT.js.map +1 -0
- package/dist/{chunk-5BNNPXID.js → chunk-BUX66OI7.js} +4 -4
- package/dist/{chunk-W4YWFAYC.js → chunk-C4T3F3XO.js} +4 -4
- package/dist/{chunk-QGKJXCEJ.js → chunk-CI4EAIMR.js} +19 -13
- package/dist/chunk-CI4EAIMR.js.map +1 -0
- package/dist/chunk-DJ2X4LKE.js +9 -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-USUQYM6V.js → chunk-FMCSF2QB.js} +58 -54
- package/dist/chunk-FMCSF2QB.js.map +1 -0
- package/dist/{chunk-YNHIMOE7.js → chunk-GNGXYXBC.js} +2 -2
- package/dist/{chunk-C5HPSURF.js → chunk-HN2QQMMX.js} +12 -12
- package/dist/{chunk-KU63EHZO.js → chunk-ICJPVSRY.js} +2 -2
- package/dist/{chunk-ZS6F6JLC.js → chunk-IRKYLDMX.js} +88 -12
- package/dist/chunk-IRKYLDMX.js.map +1 -0
- package/dist/{chunk-LDFICXOZ.js → chunk-IWO4DILT.js} +10 -6
- package/dist/{chunk-LDFICXOZ.js.map → chunk-IWO4DILT.js.map} +1 -1
- package/dist/{chunk-B2HUKRWX.js → chunk-IXC7JM35.js} +4 -4
- package/dist/{chunk-UHYIB6AV.js → chunk-J2AZIO22.js} +2 -2
- package/dist/{chunk-VEKEA3ER.js → chunk-J36ULZBO.js} +2 -2
- package/dist/{chunk-4PRPDACI.js → chunk-JU5T3JIN.js} +10 -7
- package/dist/chunk-JU5T3JIN.js.map +1 -0
- package/dist/{chunk-3UHKPHTB.js → chunk-KH3TRWUV.js} +4 -4
- package/dist/{chunk-DYJ4VJJD.js → chunk-KLY6QDA5.js} +8 -33
- package/dist/chunk-KLY6QDA5.js.map +1 -0
- package/dist/{chunk-TBY6ZFAV.js → chunk-KNRGVUW7.js} +3 -3
- package/dist/{chunk-TTTIKTNR.js → chunk-LKZSPHAT.js} +2 -2
- package/dist/{chunk-5WEDCEZG.js → chunk-LXU24GCM.js} +5 -5
- package/dist/{chunk-CFLMBFBO.js → chunk-M6LJ3GE3.js} +76 -10
- package/dist/chunk-M6LJ3GE3.js.map +1 -0
- package/dist/{chunk-BVJ2ZE7B.js → chunk-MJGKE7XZ.js} +34 -13
- package/dist/chunk-MJGKE7XZ.js.map +1 -0
- package/dist/{chunk-3PLWNCRM.js → chunk-MMFXUIQQ.js} +2 -2
- package/dist/{chunk-YJ4CAD3X.js → chunk-MXA2RZBC.js} +5 -5
- package/dist/{chunk-OFCY7RCM.js → chunk-MZTPKKTO.js} +4 -4
- package/dist/{chunk-2IKWNRMV.js → chunk-NMAJM3C5.js} +3 -3
- package/dist/{chunk-W7WC7UA2.js → chunk-NPCBJV7T.js} +5 -5
- package/dist/{chunk-BHU26CNH.js → chunk-OAVHTRML.js} +6 -4
- package/dist/{chunk-BHU26CNH.js.map → chunk-OAVHTRML.js.map} +1 -1
- 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-MGQK6BWH.js → chunk-QLAVWIDJ.js} +35 -18
- package/dist/chunk-QLAVWIDJ.js.map +1 -0
- 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-LQXGNO5X.js → chunk-SDQI3QB3.js} +3 -3
- package/dist/{chunk-B7C3RYSJ.js → chunk-SG5LUMGE.js} +3 -3
- package/dist/{chunk-5XSY3C6E.js → chunk-UBOKRHNV.js} +13 -13
- package/dist/chunk-UBOKRHNV.js.map +1 -0
- package/dist/chunk-UESDYZG3.js +442 -0
- package/dist/chunk-UESDYZG3.js.map +1 -0
- package/dist/{chunk-PIKOCEWX.js → chunk-WTF4CYHH.js} +5 -5
- package/dist/{chunk-DO5NW46X.js → chunk-X4AXKO3A.js} +2 -2
- package/dist/{chunk-KE2TFF7B.js → chunk-XNLQSW6J.js} +23 -212
- package/dist/chunk-XNLQSW6J.js.map +1 -0
- package/dist/{chunk-ZGPWIBSZ.js → chunk-YEXW2OCN.js} +9 -34
- package/dist/chunk-YEXW2OCN.js.map +1 -0
- package/dist/{chunk-AFW7HREX.js → chunk-YKMURNKL.js} +9 -41
- package/dist/chunk-YKMURNKL.js.map +1 -0
- package/dist/{chunk-LWKFZOCJ.js → chunk-YRW4YF4U.js} +3 -3
- package/dist/{chunk-COKQPFLB.js → chunk-YYBXQBW2.js} +3 -3
- package/dist/{chunk-3JY3QT4J.js → chunk-YZPP6354.js} +5 -5
- package/dist/chunk-ZDMJPEBO.js +31 -0
- package/dist/chunk-ZDMJPEBO.js.map +1 -0
- package/dist/chunk-ZXHMC7UO.js +106 -0
- package/dist/chunk-ZXHMC7UO.js.map +1 -0
- package/dist/{cleanup-PWN4XZ2F.js → cleanup-PNTCVB2S.js} +31 -27
- package/dist/{cleanup-PWN4XZ2F.js.map → cleanup-PNTCVB2S.js.map} +1 -1
- package/dist/cli-OYO6OXNK.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-VILJYT6P.js} +19 -15
- package/dist/{config-KGDVJKQN.js.map → config-VILJYT6P.js.map} +1 -1
- package/dist/{diff-ZORXBJDI.js → diff-J6VRJYKR.js} +16 -13
- package/dist/{diff-ZORXBJDI.js.map → diff-J6VRJYKR.js.map} +1 -1
- package/dist/{digest-PUUBJTD3.js → digest-GMJLCYTF.js} +14 -11
- package/dist/{digest-PUUBJTD3.js.map → digest-GMJLCYTF.js.map} +1 -1
- package/dist/{fork-7L76HZAS.js → fork-NNHH2BXV.js} +27 -24
- package/dist/{fork-7L76HZAS.js.map → fork-NNHH2BXV.js.map} +1 -1
- package/dist/{history-YX74IRQY.js → history-52MGO5V5.js} +13 -8
- package/dist/{hook-JCD6SDB3.js → hook-SWX7NXJN.js} +20 -19
- package/dist/{hook-JCD6SDB3.js.map → hook-SWX7NXJN.js.map} +1 -1
- package/dist/{hydrate-W4V5RJYU.js → hydrate-F5XVXZ2T.js} +14 -11
- package/dist/{hydrate-W4V5RJYU.js.map → hydrate-F5XVXZ2T.js.map} +1 -1
- package/dist/{init-5MMV2UF5.js → init-MRGRQWQM.js} +14 -11
- package/dist/{init-5MMV2UF5.js.map → init-MRGRQWQM.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-5MMNVGNN.js} +14 -11
- package/dist/{list-ZS3UWOGJ.js.map → list-5MMNVGNN.js.map} +1 -1
- package/dist/{move-ZTL7HAIU.js → move-DUYNTJP2.js} +42 -18
- package/dist/move-DUYNTJP2.js.map +1 -0
- package/dist/{note-B4FVZGJJ.js → note-SZCVRH4D.js} +15 -12
- package/dist/{note-B4FVZGJJ.js.map → note-SZCVRH4D.js.map} +1 -1
- package/dist/{overlaps-W3BLUG53.js → overlaps-QANRNFZC.js} +13 -10
- package/dist/{overlaps-W3BLUG53.js.map → overlaps-QANRNFZC.js.map} +1 -1
- package/dist/{pin-YYQV5OPS.js → pin-UZGC26LU.js} +15 -12
- package/dist/{pin-YYQV5OPS.js.map → pin-UZGC26LU.js.map} +1 -1
- package/dist/{pr-HQTMQOF5.js → pr-EKNBGR6X.js} +15 -12
- package/dist/{pr-HQTMQOF5.js.map → pr-EKNBGR6X.js.map} +1 -1
- package/dist/{prune-6BYOFOUR.js → prune-AOR4R3CT.js} +29 -26
- package/dist/{prune-6BYOFOUR.js.map → prune-AOR4R3CT.js.map} +1 -1
- package/dist/{pty-host-KSS45FVH.js → pty-host-LYE546KI.js} +142 -37
- package/dist/pty-host-LYE546KI.js.map +1 -0
- package/dist/{read-I5TGSBPC.js → read-APEM6NPD.js} +14 -11
- package/dist/{read-I5TGSBPC.js.map → read-APEM6NPD.js.map} +1 -1
- package/dist/{recent-GRKJEEKT.js → recent-N7JQCDRG.js} +22 -12
- package/dist/recent-N7JQCDRG.js.map +1 -0
- package/dist/{remove-64T6TMOE.js → remove-QM5CRMEG.js} +28 -25
- package/dist/{remove-64T6TMOE.js.map → remove-QM5CRMEG.js.map} +1 -1
- package/dist/{report-KAS2UEXO.js → report-J7TUQRJS.js} +3 -3
- package/dist/{restart-WJROWFMU.js → restart-O6DYGEMN.js} +15 -12
- package/dist/{restart-WJROWFMU.js.map → restart-O6DYGEMN.js.map} +1 -1
- package/dist/{resume-634R6KNE.js → resume-P5DQOZ2R.js} +16 -12
- package/dist/resume-P5DQOZ2R.js.map +1 -0
- package/dist/{run-57LGOBXQ.js → run-PSGYELSP.js} +11 -8
- package/dist/{run-57LGOBXQ.js.map → run-PSGYELSP.js.map} +1 -1
- package/dist/{screen-CX7WUVXM.js → screen-EBITKGXW.js} +15 -12
- package/dist/{screen-CX7WUVXM.js.map → screen-EBITKGXW.js.map} +1 -1
- package/dist/{search-JYAQWT6A.js → search-MM35D6P4.js} +11 -8
- package/dist/{search-JYAQWT6A.js.map → search-MM35D6P4.js.map} +1 -1
- package/dist/{section-4FICXE46.js → section-6C6N7KKF.js} +15 -12
- package/dist/{section-4FICXE46.js.map → section-6C6N7KKF.js.map} +1 -1
- package/dist/{send-RRTPY47A.js → send-ASTESOMV.js} +16 -13
- package/dist/{send-RRTPY47A.js.map → send-ASTESOMV.js.map} +1 -1
- package/dist/{sessions-UJNUCYND.js → sessions-JTZF776H.js} +21 -18
- package/dist/{sessions-UJNUCYND.js.map → sessions-JTZF776H.js.map} +1 -1
- package/dist/{snooze-DJEPOBT5.js → snooze-M2IOYZSD.js} +14 -11
- package/dist/{snooze-DJEPOBT5.js.map → snooze-M2IOYZSD.js.map} +1 -1
- package/dist/{start-YPEN5QI3.js → start-HIBG7DYS.js} +15 -12
- package/dist/{start-YPEN5QI3.js.map → start-HIBG7DYS.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-JSM6FETL.js} +13 -10
- package/dist/{status-4EOTN33T.js.map → status-JSM6FETL.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-IEMNFVGW.js} +15 -12
- package/dist/{stop-3UNZ22YA.js.map → stop-IEMNFVGW.js.map} +1 -1
- package/dist/{sync-XXZBP6PK.js → sync-FP4J5ODY.js} +29 -26
- package/dist/{sync-XXZBP6PK.js.map → sync-FP4J5ODY.js.map} +1 -1
- package/dist/{time-G5Z57AE5.js → time-QHLGCYPZ.js} +17 -14
- package/dist/{time-G5Z57AE5.js.map → time-QHLGCYPZ.js.map} +1 -1
- package/dist/time-actions-4YP5DZKQ.js +16 -0
- package/dist/{timesheet-NA7NQUVR.js → timesheet-LSUOCD6V.js} +19 -16
- package/dist/{timesheet-NA7NQUVR.js.map → timesheet-LSUOCD6V.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-VTQRBC7I.js} +41 -30
- package/dist/tree-VTQRBC7I.js.map +1 -0
- package/dist/{update-B3MQXQJ6.js → update-VL67LR6U.js} +16 -13
- package/dist/{update-B3MQXQJ6.js.map → update-VL67LR6U.js.map} +1 -1
- package/dist/{usage-2HE4RSVM.js → usage-EMZVZZEQ.js} +18 -13
- package/dist/usage-EMZVZZEQ.js.map +1 -0
- package/dist/{wait-2OPYJO3K.js → wait-HQTY7OW5.js} +15 -12
- package/dist/{wait-2OPYJO3K.js.map → wait-HQTY7OW5.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-BMRi1NT9.js} +2 -2
- package/dist/web/assets/{PtyView-DgdSx6WG.js.map → PtyView-BMRi1NT9.js.map} +1 -1
- package/dist/web/assets/{index-C5JNhi3-.css → index-BCCeJjez.css} +1 -1
- package/dist/web/assets/index-By_qebb-.js +119 -0
- package/dist/web/assets/index-By_qebb-.js.map +1 -0
- package/dist/web/index.html +2 -2
- package/dist/{web-QXQ4NGCJ.js → web-6QSSPH4I.js} +319 -253
- package/dist/web-6QSSPH4I.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-KE2TFF7B.js.map +0 -1
- package/dist/chunk-MGQK6BWH.js.map +0 -1
- package/dist/chunk-QGKJXCEJ.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-TPPTL7LA.js.map → chunk-26MWJLDS.js.map} +0 -0
- /package/dist/{chunk-KUVL75PL.js.map → chunk-2MQWAQ2D.js.map} +0 -0
- /package/dist/{chunk-O34CKSE4.js.map → chunk-3N3UQEC4.js.map} +0 -0
- /package/dist/{chunk-SNRP2MC3.js.map → chunk-5QGCF3PS.js.map} +0 -0
- /package/dist/{chunk-MCSEYS2J.js.map → chunk-7GGIVYWP.js.map} +0 -0
- /package/dist/{chunk-WIWO3YWP.js.map → chunk-7NVEGPZT.js.map} +0 -0
- /package/dist/{chunk-JIYGGN2N.js.map → chunk-AU27USPZ.js.map} +0 -0
- /package/dist/{chunk-5BNNPXID.js.map → chunk-BUX66OI7.js.map} +0 -0
- /package/dist/{chunk-W4YWFAYC.js.map → chunk-C4T3F3XO.js.map} +0 -0
- /package/dist/{chunk-3Q5RZCQW.js.map → chunk-DJ2X4LKE.js.map} +0 -0
- /package/dist/{chunk-YNHIMOE7.js.map → chunk-GNGXYXBC.js.map} +0 -0
- /package/dist/{chunk-C5HPSURF.js.map → chunk-HN2QQMMX.js.map} +0 -0
- /package/dist/{chunk-KU63EHZO.js.map → chunk-ICJPVSRY.js.map} +0 -0
- /package/dist/{chunk-B2HUKRWX.js.map → chunk-IXC7JM35.js.map} +0 -0
- /package/dist/{chunk-UHYIB6AV.js.map → chunk-J2AZIO22.js.map} +0 -0
- /package/dist/{chunk-VEKEA3ER.js.map → chunk-J36ULZBO.js.map} +0 -0
- /package/dist/{chunk-3UHKPHTB.js.map → chunk-KH3TRWUV.js.map} +0 -0
- /package/dist/{chunk-TBY6ZFAV.js.map → chunk-KNRGVUW7.js.map} +0 -0
- /package/dist/{chunk-TTTIKTNR.js.map → chunk-LKZSPHAT.js.map} +0 -0
- /package/dist/{chunk-5WEDCEZG.js.map → chunk-LXU24GCM.js.map} +0 -0
- /package/dist/{chunk-3PLWNCRM.js.map → chunk-MMFXUIQQ.js.map} +0 -0
- /package/dist/{chunk-YJ4CAD3X.js.map → chunk-MXA2RZBC.js.map} +0 -0
- /package/dist/{chunk-OFCY7RCM.js.map → chunk-MZTPKKTO.js.map} +0 -0
- /package/dist/{chunk-2IKWNRMV.js.map → chunk-NMAJM3C5.js.map} +0 -0
- /package/dist/{chunk-W7WC7UA2.js.map → chunk-NPCBJV7T.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-G2FE7HUB.js.map → chunk-RGUSVBGN.js.map} +0 -0
- /package/dist/{chunk-R3DASZQF.js.map → chunk-S3BAD4IR.js.map} +0 -0
- /package/dist/{chunk-LQXGNO5X.js.map → chunk-SDQI3QB3.js.map} +0 -0
- /package/dist/{chunk-B7C3RYSJ.js.map → chunk-SG5LUMGE.js.map} +0 -0
- /package/dist/{chunk-PIKOCEWX.js.map → chunk-WTF4CYHH.js.map} +0 -0
- /package/dist/{chunk-DO5NW46X.js.map → chunk-X4AXKO3A.js.map} +0 -0
- /package/dist/{chunk-LWKFZOCJ.js.map → chunk-YRW4YF4U.js.map} +0 -0
- /package/dist/{chunk-COKQPFLB.js.map → chunk-YYBXQBW2.js.map} +0 -0
- /package/dist/{chunk-3JY3QT4J.js.map → chunk-YZPP6354.js.map} +0 -0
- /package/dist/{cli-UTID323G.js.map → cli-OYO6OXNK.js.map} +0 -0
- /package/dist/{history-YX74IRQY.js.map → history-52MGO5V5.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-4YP5DZKQ.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/setup/first-run.ts"],"sourcesContent":["import fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\nimport { getConfigDir, getConfigPath, loadConfig } from '../platform/config.js';\nimport { atomicWriteFile, withFileLock } from '../platform/fs-safe.js';\nimport { loadHistory } from '../sessions/history.js';\nimport { defaultRunner, type CommandRunner } from '../pr/ship.js';\nimport type { SetupWire, ToolCheck } from '../api-types.js';\nimport { makeFolder } from '../worktree/worktrees-root.js';\n\n/**\n * First run (the dashboard's Welcome page, `work init`): where your repos\n * are, where worktrees go, and whether the tools work leans on are there.\n * Nothing here is needed again once the folders are set and a repo is in.\n */\n\n/** Files new worktrees get copied from the repo (local settings git ignores): `work init`'s defaults. */\nexport const DEFAULT_COPY_FILES = ['*.Development.json', '*.Local.json', '.claude/settings.local.json'];\n\n/** Where repos usually live, most likely first. */\nconst REPO_FOLDERS = [['source', 'repos'], ['repos'], ['src'], ['code'], ['projects'], ['dev'], ['git'], ['work']];\n\n/**\n * The folders to suggest: the first usual repos folder that exists under\n * home, and worktrees beside it (`…/source/repos` → `…/source/worktrees`).\n * With none, worktrees go under home and the repos folder is yours to name.\n */\nexport function suggestFolders(\n home: string,\n exists: (p: string) => boolean = fs.existsSync,\n): { reposFolder: string | null; worktreesRoot: string } {\n for (const parts of REPO_FOLDERS) {\n const p = path.join(home, ...parts);\n if (exists(p)) return { reposFolder: p, worktreesRoot: path.join(path.dirname(p), 'worktrees') };\n }\n return { reposFolder: null, worktreesRoot: path.join(home, 'worktrees') };\n}\n\n/** What a folder entered for setup is wrong with, or null. */\nexport function folderProblem(p: unknown, mustExist: boolean): string | null {\n if (typeof p !== 'string' || !p.trim()) return 'give a folder';\n if (!path.isAbsolute(p.trim())) return `${p} isn't a full path (start it from the drive or /)`;\n if (mustExist && !fs.existsSync(p.trim())) return `${p} doesn't exist`;\n return null;\n}\n\n/**\n * Set the folders: config.json made when there is none (with `work init`'s\n * defaults), else its worktrees root and scanned folder changed in place,\n * every other key as it was.\n */\nexport async function saveFolders(req: { worktreesRoot: string; reposFolder: string }): Promise<void> {\n const wt = folderProblem(req.worktreesRoot, false);\n if (wt) throw new Error(`Worktrees folder: ${wt}`);\n const rf = folderProblem(req.reposFolder, true);\n if (rf) throw new Error(`Repos folder: ${rf}`);\n const worktreesRoot = path.resolve(req.worktreesRoot.trim());\n const reposFolder = path.resolve(req.reposFolder.trim());\n const cantMake = makeFolder(worktreesRoot);\n if (cantMake) throw new Error(`Worktrees folder: ${cantMake} — pick a folder you own, e.g. under ${os.homedir()}`);\n getConfigDir();\n const file = getConfigPath();\n if (!fs.existsSync(file)) fs.writeFileSync(file, '{}', { flag: 'wx' });\n await withFileLock(file, () => {\n const raw = JSON.parse(fs.readFileSync(file, 'utf-8') || '{}') as Record<string, unknown>;\n raw.worktreesRoot = worktreesRoot;\n raw.scanRoots = [reposFolder];\n raw.repos ??= {};\n raw.groups ??= {};\n raw.copyFiles ??= DEFAULT_COPY_FILES;\n atomicWriteFile(file, JSON.stringify(raw, null, 2));\n });\n}\n\n/** One tool's check: its command, and what it means when it's missing. */\ninterface ToolSpec {\n id: ToolCheck['id'];\n label: string;\n needed: boolean;\n args: string[];\n cmd: string;\n missing: string;\n /** A failure that isn't \"not installed\" (gh logged out). */\n failing?: string;\n}\n\nconst TOOLS: ToolSpec[] = [\n { id: 'git', label: 'git', needed: true, cmd: 'git', args: ['--version'], missing: 'Install git: worktrees are git’s.' },\n {\n id: 'claude',\n label: 'Claude Code',\n needed: true,\n cmd: 'claude',\n args: ['--version'],\n missing: 'Install Claude Code (npm install -g @anthropic-ai/claude-code) and sign in once in a terminal.',\n },\n {\n id: 'gh',\n label: 'GitHub CLI',\n needed: false,\n cmd: 'gh',\n args: ['auth', 'status'],\n missing: 'Optional: install gh to see your pull requests, CI and review comments.',\n failing: 'Optional: run `gh auth login` so work can see your pull requests.',\n },\n {\n id: 'acli',\n label: 'Atlassian CLI',\n needed: false,\n cmd: 'acli',\n args: ['--version'],\n missing: 'Optional: install acli to start sessions from your Jira issues.',\n },\n];\n\n/** Whether each tool answers. A command not found is \"missing\"; one that runs and fails says why. */\nexport async function checkTools(run: CommandRunner = defaultRunner): Promise<ToolCheck[]> {\n return Promise.all(\n TOOLS.map(async (t): Promise<ToolCheck> => {\n const r = await run(t.cmd, t.args, os.tmpdir()).catch(() => ({ code: 127, stdout: '', stderr: '' }));\n const ok = r.code === 0;\n const notFound = r.code === 127 || /not (found|recognized)|ENOENT/i.test(r.stderr);\n return {\n id: t.id,\n label: t.label,\n needed: t.needed,\n ok,\n detail: ok ? (r.stdout || r.stderr).split('\\n')[0].trim() : notFound ? t.missing : (t.failing ?? t.missing),\n };\n }),\n );\n}\n\n/** Where setup stands: the folders, how many repos and sessions, the tools. */\nexport async function setupState(tools: () => Promise<ToolCheck[]> = () => checkTools()): Promise<SetupWire> {\n const config = loadConfig();\n const suggested = suggestFolders(os.homedir());\n const sessions = config ? loadHistory().filter((s) => !s.archivedAt).length : 0;\n return {\n configured: !!config && !!config.worktreesRoot,\n worktreesRoot: config?.worktreesRoot || null,\n reposFolder: config?.scanRoots?.[0] ?? (config?.worktreesRoot ? path.dirname(config.worktreesRoot) : null),\n repos: config ? Object.keys(config.repos).length : 0,\n sessions,\n suggested,\n tools: await tools(),\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/core/setup/first-run.ts"],"sourcesContent":["import fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\nimport { getConfigDir, getConfigPath, loadConfig } from '../platform/config.js';\nimport { atomicWriteFile, withFileLock } from '../platform/fs-safe.js';\nimport { loadHistory } from '../sessions/history.js';\nimport { defaultRunner, type CommandRunner } from '../pr/ship.js';\nimport type { SetupWire, ToolCheck } from '../api-types.js';\nimport { makeFolder } from '../worktree/worktrees-root.js';\n\n/**\n * First run (the dashboard's Welcome page, `work init`): where your repos\n * are, where worktrees go, and whether the tools work leans on are there.\n * Nothing here is needed again once the folders are set and a repo is in.\n */\n\n/** Files new worktrees get copied from the repo (local settings git ignores): `work init`'s defaults. */\nexport const DEFAULT_COPY_FILES = ['*.Development.json', '*.Local.json', '.claude/settings.local.json'];\n\n/** Where repos usually live, most likely first. */\nconst REPO_FOLDERS = [['source', 'repos'], ['repos'], ['src'], ['code'], ['projects'], ['dev'], ['git'], ['work']];\n\n/**\n * The folders to suggest: the first usual repos folder that exists under\n * home, and worktrees beside it (`…/source/repos` → `…/source/worktrees`).\n * With none, worktrees go under home and the repos folder is yours to name.\n */\nexport function suggestFolders(\n home: string,\n exists: (p: string) => boolean = fs.existsSync,\n): { reposFolder: string | null; worktreesRoot: string } {\n for (const parts of REPO_FOLDERS) {\n const p = path.join(home, ...parts);\n if (exists(p)) return { reposFolder: p, worktreesRoot: path.join(path.dirname(p), 'worktrees') };\n }\n return { reposFolder: null, worktreesRoot: path.join(home, 'worktrees') };\n}\n\n/** What a folder entered for setup is wrong with, or null. */\nexport function folderProblem(p: unknown, mustExist: boolean): string | null {\n if (typeof p !== 'string' || !p.trim()) return 'give a folder';\n if (!path.isAbsolute(p.trim())) return `${p} isn't a full path (start it from the drive or /)`;\n if (mustExist && !fs.existsSync(p.trim())) return `${p} doesn't exist`;\n return null;\n}\n\n/**\n * Set the folders: config.json made when there is none (with `work init`'s\n * defaults), else its worktrees root and scanned folder changed in place,\n * every other key as it was.\n */\nexport async function saveFolders(req: { worktreesRoot: string; reposFolder: string }): Promise<void> {\n const wt = folderProblem(req.worktreesRoot, false);\n if (wt) throw new Error(`Worktrees folder: ${wt}`);\n const rf = folderProblem(req.reposFolder, true);\n if (rf) throw new Error(`Repos folder: ${rf}`);\n const worktreesRoot = path.resolve(req.worktreesRoot.trim());\n const reposFolder = path.resolve(req.reposFolder.trim());\n const cantMake = makeFolder(worktreesRoot);\n if (cantMake) throw new Error(`Worktrees folder: ${cantMake} — pick a folder you own, e.g. under ${os.homedir()}`);\n getConfigDir();\n const file = getConfigPath();\n if (!fs.existsSync(file)) fs.writeFileSync(file, '{}', { flag: 'wx' });\n await withFileLock(file, () => {\n const raw = JSON.parse(fs.readFileSync(file, 'utf-8') || '{}') as Record<string, unknown>;\n raw.worktreesRoot = worktreesRoot;\n raw.scanRoots = [reposFolder];\n raw.repos ??= {};\n raw.groups ??= {};\n raw.copyFiles ??= DEFAULT_COPY_FILES;\n atomicWriteFile(file, JSON.stringify(raw, null, 2));\n });\n}\n\n/** One tool's check: its command, and what it means when it's missing. */\ninterface ToolSpec {\n id: ToolCheck['id'];\n label: string;\n needed: boolean;\n args: string[];\n cmd: string;\n missing: string;\n /** A failure that isn't \"not installed\" (gh logged out). */\n failing?: string;\n}\n\nconst TOOLS: ToolSpec[] = [\n { id: 'git', label: 'git', needed: true, cmd: 'git', args: ['--version'], missing: 'Install git: worktrees are git’s.' },\n {\n id: 'claude',\n label: 'Claude Code',\n needed: true,\n cmd: 'claude',\n args: ['--version'],\n missing: 'Install Claude Code (npm install -g @anthropic-ai/claude-code) and sign in once in a terminal.',\n },\n {\n id: 'gh',\n label: 'GitHub CLI',\n needed: false,\n cmd: 'gh',\n args: ['auth', 'status'],\n missing: 'Optional: install gh to see your pull requests, CI and review comments.',\n failing: 'Optional: run `gh auth login` so work can see your pull requests.',\n },\n {\n id: 'acli',\n label: 'Atlassian CLI',\n needed: false,\n cmd: 'acli',\n args: ['--version'],\n missing: 'Optional: install acli to start sessions from your Jira issues.',\n },\n];\n\n/** Whether each tool answers. A command not found is \"missing\"; one that runs and fails says why. */\nexport async function checkTools(run: CommandRunner = defaultRunner): Promise<ToolCheck[]> {\n return Promise.all(\n TOOLS.map(async (t): Promise<ToolCheck> => {\n const r = await run(t.cmd, t.args, os.tmpdir()).catch(() => ({ code: 127, stdout: '', stderr: '' }));\n const ok = r.code === 0;\n const notFound = r.code === 127 || /not (found|recognized)|ENOENT/i.test(r.stderr);\n return {\n id: t.id,\n label: t.label,\n needed: t.needed,\n ok,\n detail: ok ? (r.stdout || r.stderr).split('\\n')[0].trim() : notFound ? t.missing : (t.failing ?? t.missing),\n };\n }),\n );\n}\n\n/** Where setup stands: the folders, how many repos and sessions, the tools. */\nexport async function setupState(tools: () => Promise<ToolCheck[]> = () => checkTools()): Promise<SetupWire> {\n const config = loadConfig();\n const suggested = suggestFolders(os.homedir());\n const sessions = config ? loadHistory().filter((s) => !s.archivedAt).length : 0;\n return {\n configured: !!config && !!config.worktreesRoot,\n worktreesRoot: config?.worktreesRoot || null,\n reposFolder: config?.scanRoots?.[0] ?? (config?.worktreesRoot ? path.dirname(config.worktreesRoot) : null),\n repos: config ? Object.keys(config.repos).length : 0,\n sessions,\n suggested,\n tools: await tools(),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,QAAQ;AACf,OAAO,UAAU;AAeV,IAAM,qBAAqB,CAAC,sBAAsB,gBAAgB,6BAA6B;AAGtG,IAAM,eAAe,CAAC,CAAC,UAAU,OAAO,GAAG,CAAC,OAAO,GAAG,CAAC,KAAK,GAAG,CAAC,MAAM,GAAG,CAAC,UAAU,GAAG,CAAC,KAAK,GAAG,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC;AAO1G,SAAS,eACd,MACA,SAAiC,GAAG,YACmB;AACvD,aAAW,SAAS,cAAc;AAChC,UAAM,IAAI,KAAK,KAAK,MAAM,GAAG,KAAK;AAClC,QAAI,OAAO,CAAC,EAAG,QAAO,EAAE,aAAa,GAAG,eAAe,KAAK,KAAK,KAAK,QAAQ,CAAC,GAAG,WAAW,EAAE;AAAA,EACjG;AACA,SAAO,EAAE,aAAa,MAAM,eAAe,KAAK,KAAK,MAAM,WAAW,EAAE;AAC1E;AAGO,SAAS,cAAc,GAAY,WAAmC;AAC3E,MAAI,OAAO,MAAM,YAAY,CAAC,EAAE,KAAK,EAAG,QAAO;AAC/C,MAAI,CAAC,KAAK,WAAW,EAAE,KAAK,CAAC,EAAG,QAAO,GAAG,CAAC;AAC3C,MAAI,aAAa,CAAC,GAAG,WAAW,EAAE,KAAK,CAAC,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AI;AAAA,IACrG,OAAO,SAAS,OAAO,KAAK,OAAO,KAAK,EAAE,SAAS;AAAA,IACnD;AAAA,IACA;AAAA,IACA,OAAO,MAAM,MAAM;AAAA,EACrB;AACF;","names":[]}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
git
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3N3UQEC4.js";
|
|
5
5
|
import {
|
|
6
6
|
writeTempTree
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-QLAVWIDJ.js";
|
|
8
8
|
import {
|
|
9
9
|
spawn_default
|
|
10
10
|
} from "./chunk-RCYI7SRA.js";
|
|
11
11
|
import {
|
|
12
12
|
report
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-AU27USPZ.js";
|
|
14
14
|
|
|
15
15
|
// src/core/diff/diff-pipeline.ts
|
|
16
16
|
import fs2 from "fs";
|
|
@@ -534,4 +534,4 @@ export {
|
|
|
534
534
|
computeDiff,
|
|
535
535
|
computeRangeDiff
|
|
536
536
|
};
|
|
537
|
-
//# sourceMappingURL=chunk-
|
|
537
|
+
//# sourceMappingURL=chunk-IXC7JM35.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-3GIH4WTA.js";
|
|
5
5
|
import {
|
|
6
6
|
logSwallowed
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-QLAVWIDJ.js";
|
|
8
8
|
|
|
9
9
|
// src/core/diff/diff-stat.ts
|
|
10
10
|
import fs from "fs";
|
|
@@ -207,4 +207,4 @@ export {
|
|
|
207
207
|
wantsDiffStat,
|
|
208
208
|
findOverlaps
|
|
209
209
|
};
|
|
210
|
-
//# sourceMappingURL=chunk-
|
|
210
|
+
//# sourceMappingURL=chunk-J2AZIO22.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
getCurrentBranch,
|
|
4
4
|
getMainRepoRoot,
|
|
5
5
|
getWorktreeRoot
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-3N3UQEC4.js";
|
|
7
7
|
|
|
8
8
|
// src/core/worktree/resolve.ts
|
|
9
9
|
import fs from "fs";
|
|
@@ -120,4 +120,4 @@ export {
|
|
|
120
120
|
getAllTargetNames,
|
|
121
121
|
resolveFromCwd
|
|
122
122
|
};
|
|
123
|
-
//# sourceMappingURL=chunk-
|
|
123
|
+
//# sourceMappingURL=chunk-J36ULZBO.js.map
|
|
@@ -2,25 +2,25 @@
|
|
|
2
2
|
import {
|
|
3
3
|
openBaseCheckout,
|
|
4
4
|
setupWorktree
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-MJGKE7XZ.js";
|
|
6
6
|
import {
|
|
7
7
|
defaultRunner
|
|
8
8
|
} from "./chunk-3GIH4WTA.js";
|
|
9
9
|
import {
|
|
10
10
|
resolveProjectTarget
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-J36ULZBO.js";
|
|
12
12
|
import {
|
|
13
13
|
findSession,
|
|
14
14
|
loadHistory,
|
|
15
15
|
sessionAliases
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-QLAVWIDJ.js";
|
|
17
17
|
import {
|
|
18
18
|
spawn_default
|
|
19
19
|
} from "./chunk-RCYI7SRA.js";
|
|
20
20
|
import {
|
|
21
21
|
collectingReporter,
|
|
22
22
|
withReporter
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-AU27USPZ.js";
|
|
24
24
|
|
|
25
25
|
// src/core/worktree/setup-child.ts
|
|
26
26
|
import path from "path";
|
|
@@ -41,6 +41,7 @@ function invalidRequest(req) {
|
|
|
41
41
|
for (const [alias, b] of Object.entries(req.base?.perRepo ?? {}))
|
|
42
42
|
if (alias.startsWith("-") || b.startsWith("-")) return `not a valid base: ${alias}=${b}`;
|
|
43
43
|
if (req.base?.default?.startsWith("-")) return `not a valid base: ${req.base.default}`;
|
|
44
|
+
if (req.account?.startsWith("-")) return `not a Claude account: ${req.account}`;
|
|
44
45
|
for (const alias of req.repos ?? []) if (!alias || alias.startsWith("-") || alias.includes(",")) return `not a repo: ${alias}`;
|
|
45
46
|
return null;
|
|
46
47
|
}
|
|
@@ -60,7 +61,8 @@ function childArgs(req) {
|
|
|
60
61
|
...baseArgs(req.base),
|
|
61
62
|
...req.jiraKey ? [`--jira-key=${req.jiraKey}`] : [],
|
|
62
63
|
...req.name?.trim() ? [`--name=${req.name.trim()}`] : [],
|
|
63
|
-
...req.repos?.length ? [`--repos=${req.repos.join(",")}`] : []
|
|
64
|
+
...req.repos?.length ? [`--repos=${req.repos.join(",")}`] : [],
|
|
65
|
+
...req.account ? [`--account=${req.account}`] : []
|
|
64
66
|
];
|
|
65
67
|
}
|
|
66
68
|
function oneAtATime(create, queue = keyedQueue()) {
|
|
@@ -168,7 +170,7 @@ var createInProcess = async (req, config) => {
|
|
|
168
170
|
const invalid = invalidRequest(req);
|
|
169
171
|
if (invalid) return { ok: false, error: invalid };
|
|
170
172
|
if (!req.branch) {
|
|
171
|
-
const opened = await openBaseCheckout(req.target, config, { jiraKey: req.jiraKey, name: req.name });
|
|
173
|
+
const opened = await openBaseCheckout(req.target, config, { jiraKey: req.jiraKey, name: req.name, account: req.account });
|
|
172
174
|
return opened.ok ? { ok: true, branch: opened.branch, launchDir: opened.repoPath, paths: [opened.repoPath] } : { ok: false, error: opened.error };
|
|
173
175
|
}
|
|
174
176
|
const reports = collectingReporter();
|
|
@@ -176,6 +178,7 @@ var createInProcess = async (req, config) => {
|
|
|
176
178
|
reports,
|
|
177
179
|
() => setupWorktree(req.target, req.branch, config, req.base, req.jiraKey, {
|
|
178
180
|
name: req.name,
|
|
181
|
+
...req.account ? { account: req.account } : {},
|
|
179
182
|
...req.repos?.length ? { repos: req.repos } : {}
|
|
180
183
|
})
|
|
181
184
|
);
|
|
@@ -197,4 +200,4 @@ export {
|
|
|
197
200
|
createInChild,
|
|
198
201
|
createInProcess
|
|
199
202
|
};
|
|
200
|
-
//# sourceMappingURL=chunk-
|
|
203
|
+
//# sourceMappingURL=chunk-JU5T3JIN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/worktree/setup-child.ts"],"sourcesContent":["import path from 'node:path';\nimport crossSpawn from '../platform/spawn.js';\nimport type { BaseSpec } from '../git/base-spec.js';\nimport type { WorkConfig } from '../platform/config.js';\nimport { findSession, loadHistory } from '../sessions/history.js';\nimport { openBaseCheckout, setupWorktree } from './worktree.js';\nimport { collectingReporter, withReporter } from '../platform/report.js';\nimport { resolveProjectTarget } from './resolve.js';\nimport { defaultRunner } from '../pr/ship.js';\nimport { sessionAliases } from '../sessions/session-repos.js';\n\n/**\n * Creating a worktree runs git synchronously (fetch, pull, worktree add):\n * done inside work web, that held up every request — the dashboard, the\n * terminals' relays, the status hooks — for as long as the network took.\n * So work web runs it as `work tree … --setup-only` in a child process and\n * reads the result back from the history it wrote. The CLI and tests use\n * the in-process `createInProcess`; both answer the same way.\n */\n\nexport interface CreateRequest {\n target: string;\n /** Empty: the repo's own checkout, on the branch it has (`work tree <repo>`). */\n branch?: string;\n base?: BaseSpec;\n jiraKey?: string;\n name?: string;\n /** A new session's repos instead of its group's config (a fork of a session folder: the parent's own). */\n repos?: string[];\n /** The Claude account a new session runs on; unset: the configured default. */\n account?: string;\n}\n\nexport type CreateResult =\n { ok: true; branch: string; launchDir: string; paths: string[]; warnings?: string[] } | { ok: false; error: string };\n\n/** The line `work tree --setup-only` ends with on success: what it warned about (the parent reads only this). */\nexport const SETUP_WARNINGS = 'work-setup-warnings ';\n\n/** The warnings a `--setup-only` child printed (its last such line); none when there is none. Pure. */\nexport function setupWarningsOf(stdout: string): string[] {\n const line = stdout\n .split(/\\r?\\n/)\n .reverse()\n .find((l) => l.startsWith(SETUP_WARNINGS));\n if (!line) return [];\n try {\n const v: unknown = JSON.parse(line.slice(SETUP_WARNINGS.length));\n return Array.isArray(v) ? v.filter((x): x is string => typeof x === 'string') : [];\n } catch {\n return [];\n }\n}\nexport type CreateWorktree = (req: CreateRequest, config: WorkConfig) => Promise<CreateResult>;\n\n/**\n * A request the child's command line could misread: a project or branch\n * starting with `-` would be taken for a flag (`--unsafe` as a branch opened\n * the base checkout instead). Git refuses such branch names anyway. Pure.\n */\nexport function invalidRequest(req: CreateRequest): string | null {\n if (req.target.startsWith('-')) return `not a project: ${req.target}`;\n if (req.branch?.startsWith('-')) return `${req.branch} is not a valid branch name (it can't start with \"-\")`;\n for (const [alias, b] of Object.entries(req.base?.perRepo ?? {}))\n if (alias.startsWith('-') || b.startsWith('-')) return `not a valid base: ${alias}=${b}`;\n if (req.base?.default?.startsWith('-')) return `not a valid base: ${req.base.default}`;\n if (req.account?.startsWith('-')) return `not a Claude account: ${req.account}`;\n for (const alias of req.repos ?? []) if (!alias || alias.startsWith('-') || alias.includes(',')) return `not a repo: ${alias}`;\n return null;\n}\n\n/** `--base` flags for a base spec (`--base=dev`, `--base=backend=dev`). Pure. */\nexport function baseArgs(spec: BaseSpec | undefined): string[] {\n if (!spec) return [];\n const out: string[] = [];\n if (spec.default) out.push(`--base=${spec.default}`);\n for (const [alias, b] of Object.entries(spec.perRepo)) out.push(`--base=${alias}=${b}`);\n return out;\n}\n\n/**\n * The argv of the child `work tree` run (after node and the bin). Values go\n * as `--flag=value`: a name like `--unsafe` given as `--name --unsafe` would\n * be read as a flag of its own (and the name lost). Pure.\n */\nexport function childArgs(req: CreateRequest): string[] {\n return [\n 'tree',\n req.target,\n ...(req.branch ? [req.branch] : []),\n '--setup-only',\n ...baseArgs(req.base),\n ...(req.jiraKey ? [`--jira-key=${req.jiraKey}`] : []),\n ...(req.name?.trim() ? [`--name=${req.name.trim()}`] : []),\n ...(req.repos?.length ? [`--repos=${req.repos.join(',')}`] : []),\n ...(req.account ? [`--account=${req.account}`] : []),\n ];\n}\n\n/**\n * One creation at a time per project: they fetch, pull and add worktrees in\n * the same repos (git's own locks would turn two at once into a failure),\n * and a double-clicked create of the same branch gets the first one's answer.\n */\nexport function oneAtATime(create: CreateWorktree, queue: KeyedQueue = keyedQueue()): CreateWorktree {\n const same = new Map<string, Promise<CreateResult>>();\n return (req, config) => {\n const key = `${req.target}\\0${req.branch ?? ''}`;\n const running = same.get(key);\n if (running) return running;\n const job = queue(req.target, () => create(req, config));\n same.set(key, job);\n void job\n .catch(() => undefined)\n .then(() => {\n if (same.get(key) === job) same.delete(key);\n });\n return job;\n };\n}\n\n/** Runs jobs one after another per key (a project, or a repo), any number of keys at once. */\nexport type KeyedQueue = <T>(key: string, job: () => Promise<T>) => Promise<T>;\n\nexport function keyedQueue(): KeyedQueue {\n const queues = new Map<string, Promise<unknown>>();\n return <T>(key: string, job: () => Promise<T>): Promise<T> => {\n const before = queues.get(key) ?? Promise.resolve();\n const run = before.then(job);\n const tail = run.catch(() => undefined);\n queues.set(key, tail);\n void tail.then(() => {\n if (queues.get(key) === tail) queues.delete(key);\n });\n return run;\n };\n}\n\n/** What a child `work` run gave back. */\nexport interface ChildRun {\n stdout: string;\n stderr: string;\n code: number | null;\n /** Killed after its time ran out. */\n timedOut: boolean;\n /** It couldn't be started at all. */\n spawnError?: string;\n}\n\n/**\n * Run `node <work> <args…>` in a child process (no window, no colours),\n * killed after `timeoutMs` (5 min). This process's node flags go with it:\n * under tsx (dev) they are what loads a .ts entry (but not a debugger's,\n * whose port is taken).\n */\nexport function runWorkChild(\n workBin: string,\n args: string[],\n opts: { node?: string; execArgv?: string[]; timeoutMs?: number } = {},\n): Promise<ChildRun> {\n return new Promise((resolve) => {\n const child = crossSpawn(\n opts.node ?? process.execPath,\n [...(opts.execArgv ?? process.execArgv).filter((f) => !/^--inspect/.test(f)), workBin, ...args],\n { windowsHide: true, env: { ...process.env, NO_COLOR: '1', FORCE_COLOR: '0' } },\n );\n let stdout = '';\n let stderr = '';\n child.stdout?.on('data', (d: Buffer) => (stdout += d.toString()));\n child.stderr?.on('data', (d: Buffer) => (stderr += d.toString()));\n let timedOut = false;\n const timer = setTimeout(\n () => {\n timedOut = true;\n child.kill();\n },\n opts.timeoutMs ?? 5 * 60_000,\n );\n let settled = false;\n const done = (r: ChildRun) => {\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n resolve(r);\n };\n child.on('error', (err) => done({ stdout, stderr, code: null, timedOut, spawnError: err.message }));\n child.on('close', (code) => done({ stdout, stderr, code, timedOut }));\n });\n}\n\n/** What a child printed, in one line, its colours stripped. Pure. */\nexport function childText(text: string): string {\n return text\n .replace(ANSI, '')\n .split(/\\r?\\n/)\n .map((l) => l.trim())\n .filter(Boolean)\n .join(' ');\n}\n\nconst ANSI = /\\x1b\\[[0-9;]*m/g;\n\nconst norm = (p: string) => path.resolve(p).replace(/\\\\/g, '/').toLowerCase();\n\n/** What the run left in the history: the session it created or opened. */\nfunction resultFromHistory(req: CreateRequest, config: WorkConfig): CreateResult {\n const history = loadHistory();\n if (req.branch) {\n const s = findSession(history, req.target, req.branch);\n if (!s) return { ok: false, error: 'the worktree was set up, but its session is not in the history' };\n return { ok: true, branch: s.branch, launchDir: s.isGroup && s.paths[0] ? path.dirname(s.paths[0]) : s.paths[0], paths: s.paths };\n }\n const repo = config.repos[req.target];\n const s = repo\n ? history\n .filter((x) => !x.archivedAt && x.target === req.target && x.paths.some((p) => norm(p) === norm(repo)))\n .sort((a, b) => b.lastAccessedAt.localeCompare(a.lastAccessedAt))[0]\n : undefined;\n if (!s) return { ok: false, error: `opened ${req.target}, but its session is not in the history` };\n return { ok: true, branch: s.branch, launchDir: repo, paths: [repo] };\n}\n\n/** Out of process (work web): `node <work> tree … --setup-only`, then the history. */\nexport function createInChild(workBin: string, opts: { node?: string; execArgv?: string[]; timeoutMs?: number } = {}): CreateWorktree {\n return async (req, config) => {\n const invalid = invalidRequest(req);\n if (invalid) return { ok: false, error: invalid };\n const r = await runWorkChild(workBin, childArgs(req), opts);\n if (r.spawnError) return { ok: false, error: `could not run work: ${r.spawnError}` };\n if (r.timedOut) {\n // Killed from outside, its own rollback never ran: drop what a\n // half-made `git worktree add` registered, so a retry can make it.\n await pruneWorktrees(req.target, req.branch, config, req.repos);\n return { ok: false, error: 'setting it up took too long (stopped; run it again, or `work tree` it from a terminal to see why)' };\n }\n if (r.code === 0) {\n const made = resultFromHistory(req, config);\n const warnings = setupWarningsOf(r.stdout);\n return made.ok && warnings.length ? { ...made, warnings } : made;\n }\n // Its errors, as the CLI printed them (the reporter sends errors to stderr).\n const why = childText(r.stderr || r.stdout);\n return { ok: false, error: why || (r.code === null ? 'setting it up took too long' : `work tree exited ${r.code}`) };\n };\n}\n\n/**\n * `git worktree prune` in each repo of the session (best effort): its own\n * repos when it has a row (sessionAliases: one added to it, or a fork's list),\n * else the project's.\n */\nexport async function pruneWorktrees(\n target: string,\n branch: string | undefined,\n config: WorkConfig,\n /** The repos the run was asked for (a fork of a session folder: its own), when it has no row yet. */\n repos?: string[],\n): Promise<void> {\n const known = branch ? findSession(loadHistory(), target, branch) : undefined;\n const aliases = known ? sessionAliases(known, config) : repos?.length ? repos : (resolveProjectTarget(target, config)?.repoAliases ?? []);\n for (const alias of aliases) {\n const repo = config.repos[alias];\n if (repo) await defaultRunner('git', ['-C', repo, 'worktree', 'prune'], repo).catch(() => undefined);\n }\n}\n\n/** In process (the CLI, tests): the same core calls `work tree` makes. */\nexport const createInProcess: CreateWorktree = async (req, config) => {\n const invalid = invalidRequest(req);\n if (invalid) return { ok: false, error: invalid };\n if (!req.branch) {\n const opened = await openBaseCheckout(req.target, config, { jiraKey: req.jiraKey, name: req.name, account: req.account });\n return opened.ok\n ? { ok: true, branch: opened.branch, launchDir: opened.repoPath, paths: [opened.repoPath] }\n : { ok: false, error: opened.error };\n }\n // Keep what core reports, so a failure says why.\n const reports = collectingReporter();\n const created = await withReporter(reports, () =>\n setupWorktree(req.target, req.branch!, config, req.base, req.jiraKey, {\n name: req.name,\n ...(req.account ? { account: req.account } : {}),\n ...(req.repos?.length ? { repos: req.repos } : {}),\n }),\n );\n const warnings = reports.entries.filter((e) => e.level === 'warn' && e.text.trim()).map((e) => e.text.trim());\n if (!created)\n return {\n ok: false,\n error:\n reports\n .errors()\n .map((e) => e.trim())\n .join(' ') || 'setup failed (target not found?)',\n };\n return { ok: true, branch: req.branch, launchDir: created.launchDir, paths: created.paths, ...(warnings.length ? { warnings } : {}) };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,UAAU;AAqCV,IAAM,iBAAiB;AAGvB,SAAS,gBAAgB,QAA0B;AACxD,QAAM,OAAO,OACV,MAAM,OAAO,EACb,QAAQ,EACR,KAAK,CAAC,MAAM,EAAE,WAAW,cAAc,CAAC;AAC3C,MAAI,CAAC,KAAM,QAAO,CAAC;AACnB,MAAI;AACF,UAAM,IAAa,KAAK,MAAM,KAAK,MAAM,eAAe,MAAM,CAAC;AAC/D,WAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,MAAmB,OAAO,MAAM,QAAQ,IAAI,CAAC;AAAA,EACnF,QAAQ;AACN,WAAO,CAAC;AAAA,EACV;AACF;AAQO,SAAS,eAAe,KAAmC;AAChE,MAAI,IAAI,OAAO,WAAW,GAAG,EAAG,QAAO,kBAAkB,IAAI,MAAM;AACnE,MAAI,IAAI,QAAQ,WAAW,GAAG,EAAG,QAAO,GAAG,IAAI,MAAM;AACrD,aAAW,CAAC,OAAO,CAAC,KAAK,OAAO,QAAQ,IAAI,MAAM,WAAW,CAAC,CAAC;AAC7D,QAAI,MAAM,WAAW,GAAG,KAAK,EAAE,WAAW,GAAG,EAAG,QAAO,qBAAqB,KAAK,IAAI,CAAC;AACxF,MAAI,IAAI,MAAM,SAAS,WAAW,GAAG,EAAG,QAAO,qBAAqB,IAAI,KAAK,OAAO;AACpF,MAAI,IAAI,SAAS,WAAW,GAAG,EAAG,QAAO,yBAAyB,IAAI,OAAO;AAC7E,aAAW,SAAS,IAAI,SAAS,CAAC,EAAG,KAAI,CAAC,SAAS,MAAM,WAAW,GAA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I,MAAM,QAAQ,IAAI,QAAQ,WAAW,QAAQ,WAAW,OAAO,QAAQ,OAAO,GAAI,SAAS,SAAS,EAAE,SAAS,IAAI,CAAC,EAAG;AACtI;","names":["s"]}
|
|
@@ -6,15 +6,15 @@ import {
|
|
|
6
6
|
getCommentFileStore,
|
|
7
7
|
readStoreComments,
|
|
8
8
|
readStoresComments
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-5QGCF3PS.js";
|
|
10
10
|
import {
|
|
11
11
|
loadHistory
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-QLAVWIDJ.js";
|
|
13
13
|
import {
|
|
14
14
|
sessionIdFor,
|
|
15
15
|
tx,
|
|
16
16
|
withDb
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-YYBXQBW2.js";
|
|
18
18
|
|
|
19
19
|
// src/core/git/git-head.ts
|
|
20
20
|
import fs from "fs";
|
|
@@ -206,4 +206,4 @@ export {
|
|
|
206
206
|
claimForDelivery,
|
|
207
207
|
formatPendingForPrompt
|
|
208
208
|
};
|
|
209
|
-
//# sourceMappingURL=chunk-
|
|
209
|
+
//# sourceMappingURL=chunk-KH3TRWUV.js.map
|
|
@@ -1,47 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
agedWindow
|
|
4
|
+
} from "./chunk-P2HOLCBF.js";
|
|
2
5
|
import {
|
|
3
6
|
sessionTokens
|
|
4
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-YRW4YF4U.js";
|
|
5
8
|
import {
|
|
6
9
|
lastConversationWriteMs,
|
|
7
10
|
loadHistory,
|
|
8
11
|
logSwallowed
|
|
9
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-QLAVWIDJ.js";
|
|
10
13
|
import {
|
|
11
14
|
dayKey
|
|
12
15
|
} from "./chunk-NEJVK5CF.js";
|
|
13
16
|
import {
|
|
14
17
|
sessionIdFor
|
|
15
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-YYBXQBW2.js";
|
|
16
19
|
import {
|
|
17
20
|
knownAgents
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
|
|
20
|
-
// src/core/usage/usage.ts
|
|
21
|
-
function agedWindow(w, now) {
|
|
22
|
-
if (w.resetsAt === null) return w;
|
|
23
|
-
const at = Date.parse(w.resetsAt);
|
|
24
|
-
if (!Number.isFinite(at) || at > now) return w;
|
|
25
|
-
return { ...w, usedPercent: 0, reset: true };
|
|
26
|
-
}
|
|
27
|
-
function formatTokens(n) {
|
|
28
|
-
const one = (v) => String(Math.round(v * 10) / 10);
|
|
29
|
-
const x = Math.max(0, Math.round(n));
|
|
30
|
-
if (x < 1e3) return String(x);
|
|
31
|
-
if (x < 1e4) return `${one(x / 1e3)}k`;
|
|
32
|
-
if (Math.round(x / 1e3) < 1e3) return `${Math.round(x / 1e3)}k`;
|
|
33
|
-
if (x < 1e7) return `${one(x / 1e6)}M`;
|
|
34
|
-
if (Math.round(x / 1e6) < 1e3) return `${Math.round(x / 1e6)}M`;
|
|
35
|
-
return `${one(x / 1e9)}B`;
|
|
36
|
-
}
|
|
37
|
-
var WEEKDAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
38
|
-
var clock = (d) => `${String(d.getHours()).padStart(2, "0")}:${String(d.getMinutes()).padStart(2, "0")}`;
|
|
39
|
-
function resetPhrase(resetsAt, now) {
|
|
40
|
-
const at = resetsAt ? Date.parse(resetsAt) : NaN;
|
|
41
|
-
if (!Number.isFinite(at)) return "";
|
|
42
|
-
const d = new Date(at);
|
|
43
|
-
return at - now < 24 * 36e5 ? `resets ${clock(d)}` : `resets ${WEEKDAYS[d.getDay()]} ${clock(d)}`;
|
|
44
|
-
}
|
|
21
|
+
} from "./chunk-F6M255O5.js";
|
|
45
22
|
|
|
46
23
|
// src/core/usage/usage-source.ts
|
|
47
24
|
var WEEK_DAYS = 7;
|
|
@@ -150,11 +127,9 @@ async function restoreAgentUsage(agents) {
|
|
|
150
127
|
}
|
|
151
128
|
|
|
152
129
|
export {
|
|
153
|
-
formatTokens,
|
|
154
|
-
resetPhrase,
|
|
155
130
|
buildUsage,
|
|
156
131
|
realUsageDeps,
|
|
157
132
|
setupAgentUsage,
|
|
158
133
|
restoreAgentUsage
|
|
159
134
|
};
|
|
160
|
-
//# sourceMappingURL=chunk-
|
|
135
|
+
//# sourceMappingURL=chunk-KLY6QDA5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/usage/usage-source.ts","../src/core/usage/usage-setup.ts"],"sourcesContent":["import { knownAgents } from '../agents/index.js';\nimport { sessionTokens } from '../conversations/work-time-source.js';\nimport { dayKey } from '../conversations/work-time-view.js';\nimport { loadHistory } from '../sessions/history.js';\nimport { sessionIdFor } from '../sessions/session-id.js';\nimport { logSwallowed } from '../platform/best-effort.js';\nimport { lastConversationWriteMs } from '../sessions/session-activity.js';\nimport type { WorktreeSession } from '../sessions/session-types.js';\nimport type { TokenTotals, UsageWire } from '../api-types.js';\nimport type { AgentUsageSource } from '../agents/types.js';\nimport { agedWindow } from './usage.js';\n\n/**\n * What GET /api/usage and `work usage` answer: each agent's plan limits as\n * the last reading says (aged to now) and the tokens its sessions' transcripts\n * show, today and over the last 7 days. The I/O comes in through `deps`.\n */\n\nconst WEEK_DAYS = 7;\nconst TOP_SESSIONS = 5;\n\nexport interface UsageDeps {\n /** The agents that may have a usage part. */\n agents(): Array<{ id: string; name: string; usage?: Pick<AgentUsageSource, 'read'> }>;\n /** Sessions worth reading: live ones its agent wrote in lately. */\n sessions(now: number): WorktreeSession[];\n tokens(s: WorktreeSession, sinceDay: string): Promise<Record<string, Record<string, TokenTotals>>>;\n label(s: WorktreeSession): string;\n}\n\nconst zero = (): TokenTotals => ({ input: 0, cached: 0, output: 0 });\n\nfunction add(into: TokenTotals, t: TokenTotals): void {\n into.input += t.input;\n into.cached += t.cached;\n into.output += t.output;\n}\n\n/** The `week` days begin at: today and the 6 local days before it (by the calendar, not 24 h steps). */\nexport function weekStartDay(now: number): string {\n const d = new Date(now);\n d.setDate(d.getDate() - (WEEK_DAYS - 1));\n return dayKey(d.getTime());\n}\n\nexport async function buildUsage(deps: UsageDeps, now = Date.now()): Promise<UsageWire> {\n const agents: UsageWire['agents'] = [];\n for (const a of deps.agents()) {\n if (!a.usage) continue;\n agents.push({\n agent: a.id,\n name: a.name,\n accounts: a.usage.read().map((acc) => ({ ...acc, windows: acc.windows.map((w) => agedWindow(w, now)) })),\n });\n }\n\n const today = dayKey(now);\n const since = weekStartDay(now);\n const todayTotal = zero();\n const weekTotal = zero();\n const models = new Map<string, { today: TokenTotals; week: TokenTotals }>();\n const perSession: Array<{ id: string; label: string; week: TokenTotals }> = [];\n for (const s of deps.sessions(now)) {\n let days: Record<string, Record<string, TokenTotals>>;\n try {\n days = await deps.tokens(s, since);\n } catch (e) {\n logSwallowed(`usage: tokens of ${sessionIdFor(s)}`, e);\n continue; // one unreadable session doesn't hide the rest\n }\n const week = zero();\n for (const [day, byModel] of Object.entries(days)) {\n if (day < since || day > today) continue;\n for (const [model, t] of Object.entries(byModel)) {\n const m = models.get(model) ?? { today: zero(), week: zero() };\n models.set(model, m);\n add(m.week, t);\n add(weekTotal, t);\n add(week, t);\n if (day === today) {\n add(m.today, t);\n add(todayTotal, t);\n }\n }\n }\n if (week.input + week.output > 0) perSession.push({ id: sessionIdFor(s), label: deps.label(s), week });\n }\n\n const size = (t: TokenTotals) => t.input + t.output;\n return {\n agents,\n tokens: {\n today: todayTotal,\n week: weekTotal,\n byModel: [...models].map(([model, v]) => ({ model, ...v })).sort((a, b) => size(b.week) - size(a.week)),\n topSessions: perSession.sort((a, b) => size(b.week) - size(a.week)).slice(0, TOP_SESSIONS),\n },\n at: new Date(now).toISOString(),\n };\n}\n\n/** The sessions whose tokens can fall in the week: not archived, and their agent wrote in the last 7 days. */\nexport function usageSessions(all: WorktreeSession[], lastWriteMs: (s: WorktreeSession) => number, now: number): WorktreeSession[] {\n return all.filter((s) => !s.archivedAt && lastWriteMs(s) >= now - WEEK_DAYS * 24 * 3_600_000);\n}\n\nexport function realUsageDeps(): UsageDeps {\n return {\n agents: () => knownAgents(),\n sessions: (now) => usageSessions(loadHistory(), lastConversationWriteMs, now),\n tokens: sessionTokens,\n label: (s) => `${s.target} · ${s.title ? s.title : s.branch}`,\n };\n}\n","import { logSwallowed } from '../platform/best-effort.js';\nimport type { AgentUsageSource } from '../agents/types.js';\n\n/** What setup and restore need of an agent: its name and usage part (AgentAdapter fits). */\nexport interface UsageAgent {\n id: string;\n name: string;\n usage?: Pick<AgentUsageSource, 'setup' | 'restore'>;\n}\n\n/**\n * Work web's start: every agent with a usage part puts in place (or, with config `usage.statusLine: false`, takes away)\n * what records its readings. One agent's failure is logged and the rest go on; what each did is returned.\n */\nexport async function setupAgentUsage(\n agents: readonly UsageAgent[],\n config: { usage?: { statusLine?: boolean } } | null,\n lean: boolean,\n): Promise<Array<{ agent: string; message: string }>> {\n const enabled = config?.usage?.statusLine !== false;\n const done: Array<{ agent: string; message: string }> = [];\n for (const a of agents) {\n if (!a.usage?.setup) continue;\n try {\n done.push({ agent: a.id, message: await a.usage.setup({ enabled, lean }) });\n } catch (e) {\n logSwallowed(`set up ${a.name}'s usage readings`, e);\n }\n }\n return done;\n}\n\n/** `work usage --restore`: each agent gives its own setting back. A failure is that agent's `ok: false`, with why. */\nexport async function restoreAgentUsage(\n agents: readonly UsageAgent[],\n): Promise<Array<{ agent: string; name: string; ok: boolean; message: string }>> {\n const out: Array<{ agent: string; name: string; ok: boolean; message: string }> = [];\n for (const a of agents) {\n if (!a.usage?.restore) continue;\n try {\n out.push({ agent: a.id, name: a.name, ...(await a.usage.restore()) });\n } catch (e) {\n out.push({ agent: a.id, name: a.name, ok: false, message: e instanceof Error ? e.message : String(e) });\n }\n }\n return out;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAkBA,IAAM,YAAY;AAClB,IAAM,eAAe;AAW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./chunk-YYBXQBW2.js";
|
|
11
11
|
|
|
12
12
|
// src/core/pty/pty-sessions-file.ts
|
|
13
13
|
import fs from "fs";
|
|
@@ -73,4 +73,4 @@ export {
|
|
|
73
73
|
adoptLegacyRestoreList,
|
|
74
74
|
forgetPersistedSession
|
|
75
75
|
};
|
|
76
|
-
//# sourceMappingURL=chunk-
|
|
76
|
+
//# sourceMappingURL=chunk-KNRGVUW7.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
isFolderSession,
|
|
4
4
|
sessionRepos
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-QLAVWIDJ.js";
|
|
6
6
|
|
|
7
7
|
// src/core/worktree/add-repo-rules.ts
|
|
8
8
|
import path from "path";
|
|
@@ -36,4 +36,4 @@ export {
|
|
|
36
36
|
addRepoRefusal,
|
|
37
37
|
addedRepoNote
|
|
38
38
|
};
|
|
39
|
-
//# sourceMappingURL=chunk-
|
|
39
|
+
//# sourceMappingURL=chunk-LKZSPHAT.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
shownState
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BUX66OI7.js";
|
|
5
5
|
import {
|
|
6
6
|
defaultRunner
|
|
7
7
|
} from "./chunk-3GIH4WTA.js";
|
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
readArchive,
|
|
13
13
|
sessionAliases,
|
|
14
14
|
setSessionBase
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-QLAVWIDJ.js";
|
|
16
16
|
import {
|
|
17
17
|
sessionIdFor
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-YYBXQBW2.js";
|
|
19
19
|
import {
|
|
20
20
|
loadConfig
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-XNLQSW6J.js";
|
|
22
22
|
|
|
23
23
|
// src/core/stacks/session-update.ts
|
|
24
24
|
import path4 from "path";
|
|
@@ -419,4 +419,4 @@ export {
|
|
|
419
419
|
moveOntoMain,
|
|
420
420
|
updateSession
|
|
421
421
|
};
|
|
422
|
-
//# sourceMappingURL=chunk-
|
|
422
|
+
//# sourceMappingURL=chunk-LXU24GCM.js.map
|
|
@@ -1,30 +1,37 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
isEnvDelta
|
|
4
|
+
} from "./chunk-F6M255O5.js";
|
|
2
5
|
import {
|
|
3
6
|
isPidAlive,
|
|
4
7
|
spawnDetachedWork
|
|
5
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-4NITDMDH.js";
|
|
6
9
|
import {
|
|
7
10
|
ensureFile,
|
|
8
|
-
getConfigDir,
|
|
9
11
|
withFileLock
|
|
10
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ZXHMC7UO.js";
|
|
13
|
+
import {
|
|
14
|
+
getConfigDir
|
|
15
|
+
} from "./chunk-6THUVP6T.js";
|
|
11
16
|
|
|
12
17
|
// src/core/pty/pty-host-protocol.ts
|
|
13
18
|
import fs from "fs";
|
|
14
19
|
import path from "path";
|
|
15
20
|
var PROTOCOL_VERSION = 2;
|
|
21
|
+
var HOST_FEATURES = ["agentEnv", "halt"];
|
|
16
22
|
var SECRET_NAME = /TOKEN|SECRET|PASS|PWD|CREDENTIAL|PRIVATE|KEY|AUTH|BEARER|COOKIE|SESSION|CERT|SIGN|SALT|(^|_)PAT($|_)|DSN|CONN|DATABASE_URL|_URI$|_URL$/i;
|
|
17
23
|
var SECRET_VALUE = /:\/\/[^/\s:@]+:[^/\s@]+@/;
|
|
24
|
+
var ALWAYS_KEPT_ENV = ["CLAUDE_CONFIG_DIR"];
|
|
18
25
|
function keepEnv(env, names) {
|
|
19
26
|
if (!env) return void 0;
|
|
20
27
|
const kept = Object.fromEntries(
|
|
21
|
-
names.filter((n) => !SECRET_NAME.test(n) && typeof env[n] === "string" && !SECRET_VALUE.test(env[n])).map((n) => [n, env[n]])
|
|
28
|
+
[.../* @__PURE__ */ new Set([...names, ...ALWAYS_KEPT_ENV])].filter((n) => !SECRET_NAME.test(n) && typeof env[n] === "string" && !SECRET_VALUE.test(env[n])).map((n) => [n, env[n]])
|
|
22
29
|
);
|
|
23
30
|
return Object.keys(kept).length ? kept : void 0;
|
|
24
31
|
}
|
|
25
32
|
function isPersistedPty(x) {
|
|
26
33
|
const e = x;
|
|
27
|
-
return !!e && typeof e === "object" && typeof e.cwd === "string" && !!e.tool && typeof e.tool === "object" && (e.keptEnv === void 0 || !!e.keptEnv && typeof e.keptEnv === "object" && Object.values(e.keptEnv).every((v) => typeof v === "string"));
|
|
34
|
+
return !!e && typeof e === "object" && typeof e.cwd === "string" && !!e.tool && typeof e.tool === "object" && (e.agentEnv === void 0 || isEnvDelta(e.agentEnv)) && (e.keptEnv === void 0 || !!e.keptEnv && typeof e.keptEnv === "object" && Object.values(e.keptEnv).every((v) => typeof v === "string"));
|
|
28
35
|
}
|
|
29
36
|
function hostInfoPath() {
|
|
30
37
|
return path.join(getConfigDir(), "pty-host.json");
|
|
@@ -162,6 +169,28 @@ var PtyHostClient = class {
|
|
|
162
169
|
constructor(info) {
|
|
163
170
|
this.info = info;
|
|
164
171
|
}
|
|
172
|
+
/** What the host said it supports (`/health`'s `features`), asked once per host (a client is one host). */
|
|
173
|
+
featureList = null;
|
|
174
|
+
/**
|
|
175
|
+
* The host's features (HOST_FEATURES): [] for a host from before they were answered. Null when it couldn't be asked
|
|
176
|
+
* (not answering in time): unknown, asked again next time.
|
|
177
|
+
*/
|
|
178
|
+
async features() {
|
|
179
|
+
if (this.featureList) return this.featureList;
|
|
180
|
+
try {
|
|
181
|
+
const res = await fetch(`http://127.0.0.1:${this.info.port}/health`, {
|
|
182
|
+
headers: { "x-work-token": this.info.token },
|
|
183
|
+
signal: AbortSignal.timeout(5e3)
|
|
184
|
+
});
|
|
185
|
+
if (!res.ok) return null;
|
|
186
|
+
const body = await res.json();
|
|
187
|
+
const list = Array.isArray(body.features) ? body.features.filter((f) => typeof f === "string") : [];
|
|
188
|
+
this.featureList = list;
|
|
189
|
+
return list;
|
|
190
|
+
} catch {
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
165
194
|
async call(method, p, body) {
|
|
166
195
|
const res = await fetch(`http://127.0.0.1:${this.info.port}${p}`, {
|
|
167
196
|
method,
|
|
@@ -205,21 +234,57 @@ var PtyHostClient = class {
|
|
|
205
234
|
}
|
|
206
235
|
/**
|
|
207
236
|
* Its agent restarted in place, the attached terminals kept (registry.restart).
|
|
208
|
-
* `unsupported`: a host from before the call (404) — stop and start it instead.
|
|
237
|
+
* `unsupported`: a host from before the call (404) — stop and start it instead. With `agentEnv` (a session moved to
|
|
238
|
+
* another account) a host that restarted it without taking the environment (one from before it) is `unsupported` too:
|
|
239
|
+
* what runs now is on the old account, and the caller starts it again.
|
|
209
240
|
*/
|
|
210
|
-
async restart(id) {
|
|
241
|
+
async restart(id, opts = {}) {
|
|
211
242
|
const res = await fetch(`http://127.0.0.1:${this.info.port}/ptys/${encodeURIComponent(id)}/restart`, {
|
|
212
243
|
method: "POST",
|
|
213
|
-
headers: { "x-work-token": this.info.token },
|
|
244
|
+
headers: { "x-work-token": this.info.token, ...opts.agentEnv ? { "content-type": "application/json" } : {} },
|
|
245
|
+
...opts.agentEnv ? { body: JSON.stringify({ agentEnv: opts.agentEnv }) } : {},
|
|
214
246
|
// Waits for the old process to exit (up to 3 s) before the new one starts.
|
|
215
247
|
signal: AbortSignal.timeout(15e3)
|
|
216
248
|
});
|
|
217
|
-
if (res.ok)
|
|
249
|
+
if (res.ok) {
|
|
250
|
+
if (!opts.agentEnv) return "restarted";
|
|
251
|
+
const json2 = await res.json().catch(() => null);
|
|
252
|
+
return json2?.agentEnvApplied === true ? "restarted" : "unsupported";
|
|
253
|
+
}
|
|
218
254
|
if (res.status === 409) return "not-running";
|
|
219
255
|
if (res.status === 404) return "unsupported";
|
|
220
256
|
const json = await res.json().catch(() => ({}));
|
|
221
257
|
throw new Error(json.error ?? `PTY host restart ${id}: ${res.status}`);
|
|
222
258
|
}
|
|
259
|
+
/**
|
|
260
|
+
* Stop its agent and keep the session (entry, terminals) until `resume`. `unsupported`: a host from before the call (404):
|
|
261
|
+
* nothing was stopped — the caller stops it the old way.
|
|
262
|
+
*/
|
|
263
|
+
async halt(id) {
|
|
264
|
+
const res = await fetch(`http://127.0.0.1:${this.info.port}/ptys/${encodeURIComponent(id)}/halt`, {
|
|
265
|
+
method: "POST",
|
|
266
|
+
headers: { "x-work-token": this.info.token },
|
|
267
|
+
signal: AbortSignal.timeout(15e3)
|
|
268
|
+
});
|
|
269
|
+
if (res.ok) return "halted";
|
|
270
|
+
if (res.status === 409) return "not-running";
|
|
271
|
+
if (res.status === 404) return "unsupported";
|
|
272
|
+
const json = await res.json().catch(() => ({}));
|
|
273
|
+
throw new Error(json.error ?? `PTY host halt ${id}: ${res.status}`);
|
|
274
|
+
}
|
|
275
|
+
/** Start a halted agent again in place (`--continue`), on `agentEnv` when given. `not-halted`: it isn't halted (resumed already, or gone). */
|
|
276
|
+
async resume(id, opts = {}) {
|
|
277
|
+
const res = await fetch(`http://127.0.0.1:${this.info.port}/ptys/${encodeURIComponent(id)}/resume`, {
|
|
278
|
+
method: "POST",
|
|
279
|
+
headers: { "x-work-token": this.info.token, "content-type": "application/json" },
|
|
280
|
+
body: JSON.stringify(opts.agentEnv ? { agentEnv: opts.agentEnv } : {}),
|
|
281
|
+
signal: AbortSignal.timeout(15e3)
|
|
282
|
+
});
|
|
283
|
+
if (res.ok) return "resumed";
|
|
284
|
+
if (res.status === 409) return "not-halted";
|
|
285
|
+
const json = await res.json().catch(() => ({}));
|
|
286
|
+
throw new Error(json.error ?? `PTY host resume ${id}: ${res.status}`);
|
|
287
|
+
}
|
|
223
288
|
async kill(id) {
|
|
224
289
|
await this.call("DELETE", `/ptys/${encodeURIComponent(id)}`);
|
|
225
290
|
}
|
|
@@ -230,6 +295,7 @@ var PtyHostClient = class {
|
|
|
230
295
|
|
|
231
296
|
export {
|
|
232
297
|
PROTOCOL_VERSION,
|
|
298
|
+
HOST_FEATURES,
|
|
233
299
|
keepEnv,
|
|
234
300
|
isPersistedPty,
|
|
235
301
|
hostInfoPath,
|
|
@@ -244,4 +310,4 @@ export {
|
|
|
244
310
|
ensureHost,
|
|
245
311
|
PtyHostClient
|
|
246
312
|
};
|
|
247
|
-
//# sourceMappingURL=chunk-
|
|
313
|
+
//# sourceMappingURL=chunk-M6LJ3GE3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/pty/pty-host-protocol.ts","../src/core/pty/pty-host-client.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { getConfigDir } from '../platform/config.js';\nimport type { AiToolSpec } from '../platform/ai-launcher.js';\nimport { isEnvDelta, type EnvDelta } from '../platform/env-delta.js';\n\n/**\n * Wire contract between the PTY host (`work pty-host`, the long-lived\n * process that owns every Claude PTY) and its clients (`work web`,\n * `work attach`). Bump PROTOCOL_VERSION on any incompatible change: a\n * client that finds an older host running tells the user to restart it\n * (`work pty-host --restart`) instead of silently misbehaving — the host\n * outlives rebuilds by design.\n *\n * 2: the restore list moved from pty-sessions.json into state.db. A v1 host\n * still writes the file, which a v2 host adopts on start\n * (adoptLegacyRestoreList).\n */\nexport const PROTOCOL_VERSION = 2;\n\n/**\n * What this host can do beyond PROTOCOL_VERSION, answered by `/health` (additive: a host from before answers none).\n * `agentEnv`: it applies a spawn's / restart's / resume's `agentEnv` (a session's Claude account); `halt`: halt / resume.\n * A client asks before sending something an older host would silently drop (pty-pool.ts).\n */\nexport const HOST_FEATURES = ['agentEnv', 'halt'] as const;\nexport type HostFeature = (typeof HOST_FEATURES)[number];\n\n/** Discovery file: where the running host listens and its auth token. */\nexport interface HostInfo {\n pid: number;\n port: number;\n token: string;\n version: number;\n}\n\n/** What a client asks the host to spawn. The host decides `--continue`\n * itself (see `hasClaudeConversation`) so restores after a reboot make\n * the same call a fresh spawn would. */\nexport interface SpawnSpec {\n cwd: string;\n tool: AiToolSpec;\n port?: number;\n cols?: number;\n rows?: number;\n /** `--unsafe`: the tool's skip-permissions flag. Persisted, so a restore\n * comes back with the same permission mode. */\n unsafe?: boolean;\n /** `--fresh`: start a new conversation even if one exists. First spawn\n * only — a restore always continues. */\n fresh?: boolean;\n /** `--prompt` / `--prompt-file` contents. First spawn only. */\n initialPrompt?: string;\n /** The launching shell's environment. First spawn only and never\n * persisted — it can hold secrets; a restore after reboot uses the\n * host's own environment. */\n env?: Record<string, string>;\n /**\n * What the agent's environment differs by for this session (its account's `CLAUDE_CONFIG_DIR`: set, or `null` = taken\n * out), applied over whatever environment the process starts with — the shell's, or the host's own. Persisted (a\n * folder path is no secret), so a restore keeps it. Additive, no PROTOCOL_VERSION bump: a host from before ignores\n * it and starts the agent on the environment it inherits (`work pty-host --restart` after upgrading).\n */\n agentEnv?: EnvDelta;\n}\n\n/** One entry of the host's restore list: how to respawn a session. The\n * spec as launched, minus `env` (never persisted: it can hold secrets) —\n * except the variables config `hostEnv` names (`keptEnv`), which a restore\n * after a reboot puts back over the host's own environment. */\nexport interface PersistedPty extends SpawnSpec {\n startedAt: string;\n keptEnv?: Record<string, string>;\n}\n\n/** Names that look like secrets (or carry them, as a connection string does): never kept on disk, whatever `hostEnv` says. */\nconst SECRET_NAME =\n /TOKEN|SECRET|PASS|PWD|CREDENTIAL|PRIVATE|KEY|AUTH|BEARER|COOKIE|SESSION|CERT|SIGN|SALT|(^|_)PAT($|_)|DSN|CONN|DATABASE_URL|_URI$|_URL$/i;\n/** Values that carry a password whatever their name: `scheme://user:pass@host`. */\nconst SECRET_VALUE = /:\\/\\/[^/\\s:@]+:[^/\\s@]+@/;\n\n/** Always kept for a restore, whatever `hostEnv` says: the agent's account folder (a path, not a secret — SECRET_VALUE still applies). */\nexport const ALWAYS_KEPT_ENV = ['CLAUDE_CONFIG_DIR'] as const;\n\n/** The variables of `env` to keep for a restore: the ones named (and `ALWAYS_KEPT_ENV`), that exist, and look like neither a secret nor a URL with a password in it. Pure. */\nexport function keepEnv(env: Record<string, string> | undefined, names: readonly string[]): Record<string, string> | undefined {\n if (!env) return undefined;\n const kept = Object.fromEntries(\n [...new Set([...names, ...ALWAYS_KEPT_ENV])]\n .filter((n) => !SECRET_NAME.test(n) && typeof env[n] === 'string' && !SECRET_VALUE.test(env[n]))\n .map((n) => [n, env[n]]),\n );\n return Object.keys(kept).length ? kept : undefined;\n}\nexport type PersistedPtys = Record<string, PersistedPty>;\n\n/** Shape check for a restore-list entry read back from storage. */\nexport function isPersistedPty(x: unknown): x is PersistedPty {\n const e = x as PersistedPty | null;\n return (\n !!e &&\n typeof e === 'object' &&\n typeof e.cwd === 'string' &&\n !!e.tool &&\n typeof e.tool === 'object' &&\n (e.agentEnv === undefined || isEnvDelta(e.agentEnv)) &&\n (e.keptEnv === undefined ||\n (!!e.keptEnv && typeof e.keptEnv === 'object' && Object.values(e.keptEnv).every((v) => typeof v === 'string')))\n );\n}\n\nexport interface PtyInfo {\n id: string;\n cwd: string;\n pid: number;\n exited: boolean;\n cols: number;\n rows: number;\n startedAt: string;\n /** Respawned by the host on startup from the persisted session list\n * (after a crash, `--restart` or reboot), not by a client. */\n restored: boolean;\n /** Clients attached right now (dashboard Terminal tabs, `work attach`).\n * Additive: a host from before it sends none. */\n clients?: number;\n /** When the PTY last printed anything (ISO). Additive, like clients. */\n lastOutputAt?: string;\n /** The tool's binary (`claude`, `opencode`…). Additive, like clients. */\n tool?: string;\n}\n\n/** Client → host frames on the attach WebSocket (text, JSON). Host →\n * client PTY output is sent as binary frames; control frames as text. */\nexport type ClientFrame = { type: 'input'; data: string } | { type: 'resize'; cols: number; rows: number };\n\nexport type HostControlFrame =\n /** Sent once, first, on attach: the serialized screen and the grid it was\n * drawn for. Clients draw it at exactly cols×rows, then resize to their\n * own size (which makes Claude redraw), and only then send input. */\n { type: 'replay'; data: string; cols: number; rows: number } | { type: 'exit'; code: number } | { type: 'error'; message: string };\n\nexport function hostInfoPath(): string {\n return path.join(getConfigDir(), 'pty-host.json');\n}\n\n/** Held by a starting host from \"is one running?\" through writing its\n * discovery file AND restoring the saved sessions — so two hosts can't\n * both start, and a `work remove` racing a start waits for the restore\n * instead of slipping between it (see stopSessionPty). */\nexport function hostStartLockPath(): string {\n return path.join(getConfigDir(), 'pty-host.start.lock');\n}\n\n/** The pre-SQLite restore list. Only the one-time import reads it now. */\nexport function ptySessionsPath(): string {\n return path.join(getConfigDir(), 'pty-sessions.json');\n}\n\nexport function readHostInfo(): HostInfo | null {\n try {\n const raw = JSON.parse(fs.readFileSync(hostInfoPath(), 'utf-8')) as HostInfo;\n if (typeof raw.port === 'number' && typeof raw.token === 'string' && typeof raw.pid === 'number') {\n return raw;\n }\n return null;\n } catch {\n return null;\n }\n}\n","import path from 'node:path';\nimport { spawnDetachedWork } from '../platform/process.js';\nimport { getConfigDir } from '../platform/config.js';\nimport { isPidAlive } from '../platform/process.js';\nimport { ensureFile, withFileLock } from '../platform/fs-safe.js';\nimport type { EnvDelta } from '../platform/env-delta.js';\nimport { PROTOCOL_VERSION, readHostInfo, type HostInfo, type PtyInfo, type SpawnSpec } from './pty-host-protocol.js';\n\nexport class PtyHostVersionError extends Error {\n constructor(readonly hostVersion: number) {\n super(\n `A PTY host from an older build (protocol v${hostVersion}, need v${PROTOCOL_VERSION}) ` +\n 'is running. Restart it with `work pty-host --restart` — sessions come back via --continue.',\n );\n }\n}\n\n/**\n * Ask whoever listens on the discovery file's port whether it's our host:\n * it must answer /health with our token. Returns what it reports (its\n * protocol version and pid), or null if nothing answers / the token is\n * wrong — i.e. the discovery file is stale.\n */\nexport async function probeHost(info: HostInfo, timeoutMs = 800): Promise<{ version: number; pid: number } | null> {\n const r = await probeHostDetailed(info, timeoutMs);\n return r.kind === 'host' ? { version: r.version, pid: r.pid } : null;\n}\n\nexport type ProbeResult =\n | { kind: 'host'; version: number; pid: number }\n /** Nothing listens on the port (connection refused): definitely gone. */\n | { kind: 'refused' }\n /** Something answered, but not as our host (wrong token, bad body). */\n | { kind: 'not-ours' }\n /** No answer in time — could be a BUSY host (e.g. restoring many\n * sessions). Never treat this as proof the host is gone. */\n | { kind: 'timeout' };\n\nexport async function probeHostDetailed(info: HostInfo, timeoutMs = 800): Promise<ProbeResult> {\n try {\n const res = await fetch(`http://127.0.0.1:${info.port}/health`, {\n headers: { 'x-work-token': info.token },\n signal: AbortSignal.timeout(timeoutMs),\n });\n if (!res.ok) return { kind: 'not-ours' };\n const body = (await res.json()) as { version?: number; pid?: number };\n if (typeof body.version !== 'number' || typeof body.pid !== 'number') return { kind: 'not-ours' };\n return { kind: 'host', version: body.version, pid: body.pid };\n } catch (err) {\n const e = err as { name?: string; cause?: { code?: string } };\n if (e.cause?.code === 'ECONNREFUSED') return { kind: 'refused' };\n if (e.name === 'TimeoutError' || e.name === 'AbortError') return { kind: 'timeout' };\n return { kind: 'refused' };\n }\n}\n\n/** A host is there but didn't answer in time (event loop busy: a ConPTY\n * spawn, restoring many sessions). It is RUNNING — never start another. */\nexport class PtyHostBusyError extends Error {\n constructor() {\n super('The PTY host is running but not answering (busy?). Try again in a moment.');\n this.name = 'PtyHostBusyError';\n }\n}\n\n/**\n * The running host, or null when there is none. Throws PtyHostVersionError\n * on a mismatch, and PtyHostBusyError when a host holds the port but\n * doesn't answer even a patient second probe — treating that as \"no host\"\n * would start a second one, which restores every session again (two\n * Claudes per conversation).\n */\nexport async function findHost(timeoutsMs: number[] = [800, 5000]): Promise<HostInfo | null> {\n const info = readHostInfo();\n if (!info) return null;\n let probe: ProbeResult = { kind: 'timeout' };\n for (const t of timeoutsMs) {\n probe = await probeHostDetailed(info, t);\n if (probe.kind !== 'timeout') break;\n }\n if (probe.kind === 'timeout') {\n // No answer: a host whose process is alive is busy — but a dead one\n // (crashed, killed) left a stale file, and whatever now holds that port\n // is not our host. Calling THAT busy would make the host unstartable.\n if (!isPidAlive(info.pid)) return null;\n throw new PtyHostBusyError();\n }\n if (probe.kind !== 'host' || probe.pid !== info.pid) return null;\n if (probe.version !== PROTOCOL_VERSION) throw new PtyHostVersionError(probe.version);\n return info;\n}\n\n/**\n * findHost that waits out a busy host: retries until it answers or\n * `timeoutMs` passes, then throws PtyHostBusyError. For callers that must\n * reach the host (stopping a session before its worktree is deleted).\n */\nexport async function findHostPatient(timeoutMs = 20_000): Promise<HostInfo | null> {\n const deadline = Date.now() + timeoutMs;\n for (;;) {\n try {\n return await findHost();\n } catch (err) {\n if (!(err instanceof PtyHostBusyError) || Date.now() >= deadline) throw err;\n await new Promise((r) => setTimeout(r, 250));\n }\n }\n}\n\n/** findHost for \"should I start one?\": a busy host counts as running. */\nasync function findHostOrBusy(): Promise<HostInfo | 'busy' | null> {\n try {\n return await findHost();\n } catch (err) {\n if (err instanceof PtyHostBusyError) return 'busy';\n throw err;\n }\n}\n\n/** Serializes host spawning across `work` processes (see ensureHost). */\nexport function hostSpawnLockPath(): string {\n return path.join(getConfigDir(), 'pty-host.spawn.lock');\n}\n\nlet inFlight: Promise<HostInfo> | null = null;\n\n/**\n * Return the running host, spawning a detached one if none is. `workBin` is\n * the path to the `work` binary (dist/bin.js) — passed in rather than\n * derived because core can't reach the commands layer's resolver (§2.1).\n *\n * Exactly one host may start: two hosts would each restore every saved\n * session — two Claudes on one conversation. So spawning is single-flight\n * within this process (concurrent callers share one attempt) and serialized\n * across processes by a file lock held from \"is one running?\" until the new\n * host answers; a caller that waited on the lock re-checks and finds it.\n */\n// A cold host start loads the whole `work` bundle; on a busy machine (right\n// after login with autostart, or a loaded test run) that can pass 8 s.\nexport function ensureHost(workBin: string, timeoutMs = 20_000): Promise<HostInfo> {\n if (!inFlight) {\n inFlight = ensureHostLocked(workBin, timeoutMs).finally(() => {\n inFlight = null;\n });\n }\n return inFlight;\n}\n\nasync function ensureHostLocked(workBin: string, timeoutMs: number): Promise<HostInfo> {\n const existing = await findHostOrBusy();\n if (existing === 'busy') return waitForHost(timeoutMs); // it's there; wait for it to answer\n if (existing) return existing;\n const lock = hostSpawnLockPath();\n ensureFile(lock, '');\n try {\n return await withFileLock(lock, async () => {\n // Another process may have started it while we waited for the lock.\n const started = await findHostOrBusy();\n if (started === 'busy') return waitForHost(timeoutMs);\n if (started) return started;\n spawnHost(workBin);\n return waitForHost(timeoutMs);\n });\n } catch (err) {\n // Couldn't get the lock in time (another process is mid-spawn and slow):\n // don't spawn a second one — wait for theirs.\n if ((err as { code?: string }).code === 'ELOCKED') return waitForHost(timeoutMs);\n throw err;\n }\n}\n\nfunction spawnHost(workBin: string): void {\n spawnDetachedWork(workBin, ['pty-host'], path.join(getConfigDir(), 'pty-host.log'));\n}\n\nasync function waitForHost(timeoutMs: number): Promise<HostInfo> {\n const deadline = Date.now() + timeoutMs;\n while (Date.now() < deadline) {\n const found = await findHost().catch(() => null);\n if (found) return found;\n await new Promise((r) => setTimeout(r, 100));\n }\n throw new Error('PTY host did not start (see ~/.work/pty-host.log)');\n}\n\nexport class PtyHostClient {\n constructor(readonly info: HostInfo) {}\n\n /** What the host said it supports (`/health`'s `features`), asked once per host (a client is one host). */\n private featureList: readonly string[] | null = null;\n\n /**\n * The host's features (HOST_FEATURES): [] for a host from before they were answered. Null when it couldn't be asked\n * (not answering in time): unknown, asked again next time.\n */\n async features(): Promise<readonly string[] | null> {\n if (this.featureList) return this.featureList;\n try {\n const res = await fetch(`http://127.0.0.1:${this.info.port}/health`, {\n headers: { 'x-work-token': this.info.token },\n signal: AbortSignal.timeout(5000),\n });\n if (!res.ok) return null;\n const body = (await res.json()) as { features?: unknown };\n const list = Array.isArray(body.features) ? body.features.filter((f): f is string => typeof f === 'string') : [];\n this.featureList = list;\n return list;\n } catch {\n return null;\n }\n }\n\n private async call<T>(method: string, p: string, body?: unknown): Promise<T> {\n const res = await fetch(`http://127.0.0.1:${this.info.port}${p}`, {\n method,\n headers: {\n 'x-work-token': this.info.token,\n ...(body !== undefined ? { 'Content-Type': 'application/json' } : {}),\n },\n body: body !== undefined ? JSON.stringify(body) : undefined,\n signal: AbortSignal.timeout(5000),\n });\n const json = (await res.json().catch(() => ({}))) as T & { error?: string };\n if (!res.ok) throw new Error(json.error ?? `PTY host ${method} ${p}: ${res.status}`);\n return json;\n }\n\n list(): Promise<PtyInfo[]> {\n return this.call('GET', '/ptys');\n }\n\n get(id: string): Promise<PtyInfo | null> {\n return this.call<PtyInfo>('GET', `/ptys/${encodeURIComponent(id)}`).catch(() => null);\n }\n\n spawn(id: string, spec: SpawnSpec): Promise<PtyInfo> {\n return this.call('POST', `/ptys/${encodeURIComponent(id)}`, spec);\n }\n\n /** The session's visible screen as text; null when it has none — or the\n * host predates this call (404 either way: nothing to answer by key). */\n async screen(id: string): Promise<string | null> {\n try {\n const r = await this.call<{ text?: unknown }>('GET', `/ptys/${encodeURIComponent(id)}/screen`);\n return typeof r.text === 'string' ? r.text : null;\n } catch {\n return null;\n }\n }\n\n async write(id: string, data: string): Promise<boolean> {\n try {\n await this.call('POST', `/ptys/${encodeURIComponent(id)}/write`, { data });\n return true;\n } catch {\n return false;\n }\n }\n\n /**\n * Its agent restarted in place, the attached terminals kept (registry.restart).\n * `unsupported`: a host from before the call (404) — stop and start it instead. With `agentEnv` (a session moved to\n * another account) a host that restarted it without taking the environment (one from before it) is `unsupported` too:\n * what runs now is on the old account, and the caller starts it again.\n */\n async restart(id: string, opts: { agentEnv?: EnvDelta } = {}): Promise<'restarted' | 'not-running' | 'unsupported'> {\n const res = await fetch(`http://127.0.0.1:${this.info.port}/ptys/${encodeURIComponent(id)}/restart`, {\n method: 'POST',\n headers: { 'x-work-token': this.info.token, ...(opts.agentEnv ? { 'content-type': 'application/json' } : {}) },\n ...(opts.agentEnv ? { body: JSON.stringify({ agentEnv: opts.agentEnv }) } : {}),\n // Waits for the old process to exit (up to 3 s) before the new one starts.\n signal: AbortSignal.timeout(15_000),\n });\n if (res.ok) {\n if (!opts.agentEnv) return 'restarted';\n const json = (await res.json().catch(() => null)) as { agentEnvApplied?: unknown } | null;\n return json?.agentEnvApplied === true ? 'restarted' : 'unsupported';\n }\n if (res.status === 409) return 'not-running';\n if (res.status === 404) return 'unsupported';\n const json = (await res.json().catch(() => ({}))) as { error?: string };\n throw new Error(json.error ?? `PTY host restart ${id}: ${res.status}`);\n }\n\n /**\n * Stop its agent and keep the session (entry, terminals) until `resume`. `unsupported`: a host from before the call (404):\n * nothing was stopped — the caller stops it the old way.\n */\n async halt(id: string): Promise<'halted' | 'not-running' | 'unsupported'> {\n const res = await fetch(`http://127.0.0.1:${this.info.port}/ptys/${encodeURIComponent(id)}/halt`, {\n method: 'POST',\n headers: { 'x-work-token': this.info.token },\n signal: AbortSignal.timeout(15_000),\n });\n if (res.ok) return 'halted';\n if (res.status === 409) return 'not-running';\n if (res.status === 404) return 'unsupported';\n const json = (await res.json().catch(() => ({}))) as { error?: string };\n throw new Error(json.error ?? `PTY host halt ${id}: ${res.status}`);\n }\n\n /** Start a halted agent again in place (`--continue`), on `agentEnv` when given. `not-halted`: it isn't halted (resumed already, or gone). */\n async resume(id: string, opts: { agentEnv?: EnvDelta } = {}): Promise<'resumed' | 'not-halted'> {\n const res = await fetch(`http://127.0.0.1:${this.info.port}/ptys/${encodeURIComponent(id)}/resume`, {\n method: 'POST',\n headers: { 'x-work-token': this.info.token, 'content-type': 'application/json' },\n body: JSON.stringify(opts.agentEnv ? { agentEnv: opts.agentEnv } : {}),\n signal: AbortSignal.timeout(15_000),\n });\n if (res.ok) return 'resumed';\n if (res.status === 409) return 'not-halted';\n const json = (await res.json().catch(() => ({}))) as { error?: string };\n throw new Error(json.error ?? `PTY host resume ${id}: ${res.status}`);\n }\n\n async kill(id: string): Promise<void> {\n await this.call('DELETE', `/ptys/${encodeURIComponent(id)}`);\n }\n\n attachUrl(id: string): string {\n return `ws://127.0.0.1:${this.info.port}/ptys/${encodeURIComponent(id)}/attach?token=${this.info.token}`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ;AAC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