@moberg_hr/work-tree 2.6.4 → 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-J2KNR7S3.js → add-repo-B4ITRH4Q.js} +38 -33
- package/dist/{add-repo-J2KNR7S3.js.map → add-repo-B4ITRH4Q.js.map} +1 -1
- package/dist/{answer-3INUTHDR.js → answer-JHK4SZAH.js} +16 -12
- package/dist/{answer-3INUTHDR.js.map → answer-JHK4SZAH.js.map} +1 -1
- package/dist/{attach-EQARDJEU.js → attach-3IU7O7YE.js} +19 -15
- package/dist/{attach-EQARDJEU.js.map → attach-3IU7O7YE.js.map} +1 -1
- package/dist/bin.js +12 -8
- package/dist/bin.js.map +1 -1
- package/dist/{block-K2RSDPMB.js → block-JTA7ULQS.js} +16 -12
- package/dist/{block-K2RSDPMB.js.map → block-JTA7ULQS.js.map} +1 -1
- package/dist/{broadcast-NIFOTFCC.js → broadcast-JKPTCLUZ.js} +13 -9
- package/dist/{broadcast-NIFOTFCC.js.map → broadcast-JKPTCLUZ.js.map} +1 -1
- package/dist/{catchup-OF2EBZCA.js → catchup-MT55LLAS.js} +19 -15
- package/dist/{catchup-OF2EBZCA.js.map → catchup-MT55LLAS.js.map} +1 -1
- package/dist/{chunk-GTVQYGY3.js → chunk-26MWJLDS.js} +3 -3
- package/dist/{chunk-IID3W5PI.js → chunk-27BDXWSY.js} +9 -5
- package/dist/{chunk-IID3W5PI.js.map → chunk-27BDXWSY.js.map} +1 -1
- package/dist/{chunk-TQKIAQJT.js → chunk-27UC5NXT.js} +20 -16
- package/dist/chunk-27UC5NXT.js.map +1 -0
- package/dist/{chunk-2FUNUN5C.js → chunk-2MQWAQ2D.js} +8 -8
- package/dist/{chunk-G635EV2D.js → chunk-3N3UQEC4.js} +2 -2
- package/dist/{chunk-SMZ7W34L.js → chunk-3TN77GOI.js} +9 -4
- package/dist/chunk-3TN77GOI.js.map +1 -0
- package/dist/{chunk-QLTENN7R.js → chunk-45DVD6HF.js} +17 -13
- package/dist/{chunk-QLTENN7R.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-EYUBVLPF.js → chunk-5QGCF3PS.js} +2 -2
- package/dist/{chunk-75MIXOUK.js → chunk-6THUVP6T.js} +27 -13
- package/dist/chunk-6THUVP6T.js.map +1 -0
- package/dist/{chunk-5ZGF2M52.js → chunk-7GGIVYWP.js} +7 -7
- package/dist/{chunk-MJNXAAJF.js → chunk-7NVEGPZT.js} +2 -2
- package/dist/{chunk-ZGXRWL7T.js → chunk-AU27USPZ.js} +2 -2
- package/dist/chunk-BOEAOIQT.js +43 -0
- package/dist/chunk-BOEAOIQT.js.map +1 -0
- package/dist/{chunk-HNFWIJRZ.js → chunk-BUX66OI7.js} +6 -6
- package/dist/{chunk-ZPJ5W2KB.js → chunk-C4T3F3XO.js} +4 -4
- package/dist/{chunk-ADGQADDE.js → chunk-CI4EAIMR.js} +23 -17
- package/dist/chunk-CI4EAIMR.js.map +1 -0
- package/dist/chunk-DJ2X4LKE.js +9 -0
- package/dist/{chunk-VESYLAVA.js → chunk-F6M255O5.js} +614 -314
- 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-4VVIBQ4P.js → chunk-FMCSF2QB.js} +58 -53
- package/dist/chunk-FMCSF2QB.js.map +1 -0
- package/dist/{chunk-OUUDQA7O.js → chunk-GNGXYXBC.js} +2 -2
- package/dist/{chunk-ZYTZBGBP.js → chunk-HN2QQMMX.js} +22 -22
- package/dist/{chunk-MYDQNX7W.js → chunk-ICJPVSRY.js} +2 -2
- package/dist/{chunk-5UICLGJK.js → chunk-IRKYLDMX.js} +89 -13
- package/dist/chunk-IRKYLDMX.js.map +1 -0
- package/dist/{chunk-YIWGKZOZ.js → chunk-IWO4DILT.js} +10 -6
- package/dist/{chunk-YIWGKZOZ.js.map → chunk-IWO4DILT.js.map} +1 -1
- package/dist/{chunk-MHHVNQB4.js → chunk-IXC7JM35.js} +4 -4
- package/dist/{chunk-FBJKFNKX.js → chunk-J2AZIO22.js} +2 -2
- package/dist/{chunk-CGVYVTGF.js → chunk-J36ULZBO.js} +2 -2
- package/dist/{chunk-FO7B466S.js → chunk-JU5T3JIN.js} +10 -7
- package/dist/chunk-JU5T3JIN.js.map +1 -0
- package/dist/{chunk-24GXAENC.js → chunk-KH3TRWUV.js} +7 -7
- package/dist/chunk-KLY6QDA5.js +135 -0
- package/dist/chunk-KLY6QDA5.js.map +1 -0
- package/dist/{chunk-4RDAWJZY.js → chunk-KNRGVUW7.js} +3 -3
- package/dist/{chunk-TQTMLZFT.js → chunk-LKZSPHAT.js} +2 -2
- package/dist/{chunk-XWRVIEFW.js → chunk-LXU24GCM.js} +5 -5
- package/dist/{chunk-DAQCIJHW.js → chunk-M6LJ3GE3.js} +76 -10
- package/dist/chunk-M6LJ3GE3.js.map +1 -0
- package/dist/{chunk-ZM7MVV4D.js → chunk-MJGKE7XZ.js} +36 -17
- package/dist/chunk-MJGKE7XZ.js.map +1 -0
- package/dist/{chunk-35VLAPL2.js → chunk-MMFXUIQQ.js} +2 -2
- package/dist/{chunk-FSNKCSXO.js → chunk-MXA2RZBC.js} +5 -5
- package/dist/{chunk-UDRKYWQL.js → chunk-MZTPKKTO.js} +4 -4
- package/dist/{chunk-LFH74AIE.js → chunk-NMAJM3C5.js} +3 -3
- package/dist/{chunk-U7EQ2O6C.js → chunk-NPCBJV7T.js} +7 -5
- package/dist/{chunk-U7EQ2O6C.js.map → chunk-NPCBJV7T.js.map} +1 -1
- package/dist/{chunk-376P7NDW.js → chunk-OAVHTRML.js} +6 -4
- package/dist/{chunk-376P7NDW.js.map → chunk-OAVHTRML.js.map} +1 -1
- package/dist/{chunk-CRPV5YCC.js → chunk-OMIMK3LB.js} +2 -2
- package/dist/chunk-P2HOLCBF.js +34 -0
- package/dist/chunk-P2HOLCBF.js.map +1 -0
- package/dist/{chunk-56P7G2DI.js → chunk-P4EQWC5W.js} +2 -2
- package/dist/{chunk-MSZQUJZZ.js → chunk-QLAVWIDJ.js} +45 -28
- package/dist/chunk-QLAVWIDJ.js.map +1 -0
- package/dist/chunk-RCGFHJM7.js +81 -0
- package/dist/chunk-RCGFHJM7.js.map +1 -0
- package/dist/{chunk-EUAJT7FS.js → chunk-RGUSVBGN.js} +2 -2
- package/dist/{chunk-ZO6MZNLI.js → chunk-S3BAD4IR.js} +2 -2
- package/dist/{chunk-BDIAIO3H.js → chunk-SDQI3QB3.js} +3 -3
- package/dist/{chunk-Z3NQJALE.js → chunk-SG5LUMGE.js} +3 -3
- package/dist/chunk-UBOKRHNV.js +134 -0
- 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-XEPH5FCH.js → chunk-WTF4CYHH.js} +7 -7
- package/dist/{chunk-TJFX5BWH.js → chunk-X4AXKO3A.js} +2 -2
- package/dist/{chunk-RYEPQLXQ.js → chunk-XNLQSW6J.js} +23 -115
- package/dist/chunk-XNLQSW6J.js.map +1 -0
- package/dist/{chunk-OUWKEJEC.js → chunk-YEXW2OCN.js} +11 -34
- package/dist/chunk-YEXW2OCN.js.map +1 -0
- package/dist/{chunk-2X5TDKGV.js → chunk-YKMURNKL.js} +11 -43
- package/dist/chunk-YKMURNKL.js.map +1 -0
- package/dist/{chunk-JSSQ3P73.js → chunk-YRW4YF4U.js} +60 -10
- package/dist/chunk-YRW4YF4U.js.map +1 -0
- package/dist/{chunk-JF72AS6T.js → chunk-YYBXQBW2.js} +3 -3
- package/dist/{chunk-TNU4PRE6.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-JYKSRN2G.js → cleanup-PNTCVB2S.js} +33 -28
- package/dist/{cleanup-JYKSRN2G.js.map → cleanup-PNTCVB2S.js.map} +1 -1
- package/dist/cli-OYO6OXNK.js +19 -0
- package/dist/command-hook-installer-7Q7UD7AU.js +98 -0
- package/dist/command-hook-installer-7Q7UD7AU.js.map +1 -0
- package/dist/{config-AABHS4J2.js → config-VILJYT6P.js} +20 -15
- package/dist/{config-AABHS4J2.js.map → config-VILJYT6P.js.map} +1 -1
- package/dist/{diff-NLYS5TIG.js → diff-J6VRJYKR.js} +18 -14
- package/dist/{diff-NLYS5TIG.js.map → diff-J6VRJYKR.js.map} +1 -1
- package/dist/{digest-SSY2TNMB.js → digest-GMJLCYTF.js} +15 -11
- package/dist/{digest-SSY2TNMB.js.map → digest-GMJLCYTF.js.map} +1 -1
- package/dist/{fork-KDMSZB5E.js → fork-NNHH2BXV.js} +35 -31
- package/dist/{fork-KDMSZB5E.js.map → fork-NNHH2BXV.js.map} +1 -1
- package/dist/{history-6KGCW2WA.js → history-52MGO5V5.js} +14 -8
- package/dist/{hook-5YZBX64G.js → hook-SWX7NXJN.js} +22 -20
- package/dist/{hook-5YZBX64G.js.map → hook-SWX7NXJN.js.map} +1 -1
- package/dist/{hydrate-FL2BCC7M.js → hydrate-F5XVXZ2T.js} +14 -10
- package/dist/{hydrate-FL2BCC7M.js.map → hydrate-F5XVXZ2T.js.map} +1 -1
- package/dist/{init-5RZXYR7N.js → init-MRGRQWQM.js} +15 -11
- package/dist/{init-5RZXYR7N.js.map → init-MRGRQWQM.js.map} +1 -1
- package/dist/install-skills-QTWYVAOZ.js +20 -0
- package/dist/install-skills-bin.js +9 -3
- package/dist/install-skills-bin.js.map +1 -1
- package/dist/{list-7QPCYMVP.js → list-5MMNVGNN.js} +14 -10
- package/dist/{list-7QPCYMVP.js.map → list-5MMNVGNN.js.map} +1 -1
- package/dist/{move-QTLHMYRT.js → move-DUYNTJP2.js} +47 -22
- package/dist/move-DUYNTJP2.js.map +1 -0
- package/dist/{note-QE3VB77M.js → note-SZCVRH4D.js} +16 -12
- package/dist/{note-QE3VB77M.js.map → note-SZCVRH4D.js.map} +1 -1
- package/dist/{overlaps-6QOJU37M.js → overlaps-QANRNFZC.js} +14 -10
- package/dist/{overlaps-6QOJU37M.js.map → overlaps-QANRNFZC.js.map} +1 -1
- package/dist/{pin-LS3I7W3V.js → pin-UZGC26LU.js} +16 -12
- package/dist/{pin-LS3I7W3V.js.map → pin-UZGC26LU.js.map} +1 -1
- package/dist/{pr-ARGKUTRB.js → pr-EKNBGR6X.js} +20 -16
- package/dist/{pr-ARGKUTRB.js.map → pr-EKNBGR6X.js.map} +1 -1
- package/dist/{prune-OAWQZHHQ.js → prune-AOR4R3CT.js} +31 -27
- package/dist/{prune-OAWQZHHQ.js.map → prune-AOR4R3CT.js.map} +1 -1
- package/dist/{pty-host-DVHFTOIW.js → pty-host-LYE546KI.js} +145 -39
- package/dist/pty-host-LYE546KI.js.map +1 -0
- package/dist/{read-QSUCR7Q2.js → read-APEM6NPD.js} +15 -11
- package/dist/{read-QSUCR7Q2.js.map → read-APEM6NPD.js.map} +1 -1
- package/dist/{recent-YQTDHLRE.js → recent-N7JQCDRG.js} +23 -12
- package/dist/recent-N7JQCDRG.js.map +1 -0
- package/dist/{remove-I3RJIOVP.js → remove-QM5CRMEG.js} +30 -26
- package/dist/{remove-I3RJIOVP.js.map → remove-QM5CRMEG.js.map} +1 -1
- package/dist/{report-JEG2FKOB.js → report-J7TUQRJS.js} +3 -4
- package/dist/{restart-UDXVORL2.js → restart-O6DYGEMN.js} +16 -12
- package/dist/{restart-UDXVORL2.js.map → restart-O6DYGEMN.js.map} +1 -1
- package/dist/{resume-LMOST4UO.js → resume-P5DQOZ2R.js} +17 -12
- package/dist/resume-P5DQOZ2R.js.map +1 -0
- package/dist/{run-LS4SS4D7.js → run-PSGYELSP.js} +12 -8
- package/dist/{run-LS4SS4D7.js.map → run-PSGYELSP.js.map} +1 -1
- package/dist/{screen-QTVQDNZM.js → screen-EBITKGXW.js} +16 -12
- package/dist/{screen-QTVQDNZM.js.map → screen-EBITKGXW.js.map} +1 -1
- package/dist/{search-CJA7VHRD.js → search-MM35D6P4.js} +12 -8
- package/dist/{search-CJA7VHRD.js.map → search-MM35D6P4.js.map} +1 -1
- package/dist/{section-NOTTKMKJ.js → section-6C6N7KKF.js} +16 -12
- package/dist/{section-NOTTKMKJ.js.map → section-6C6N7KKF.js.map} +1 -1
- package/dist/{send-O3YA6SGT.js → send-ASTESOMV.js} +23 -19
- package/dist/{send-O3YA6SGT.js.map → send-ASTESOMV.js.map} +1 -1
- package/dist/{sessions-C3IUXV5G.js → sessions-JTZF776H.js} +25 -21
- package/dist/{sessions-C3IUXV5G.js.map → sessions-JTZF776H.js.map} +1 -1
- package/dist/{snooze-2RSHIHKF.js → snooze-M2IOYZSD.js} +15 -11
- package/dist/{snooze-2RSHIHKF.js.map → snooze-M2IOYZSD.js.map} +1 -1
- package/dist/{start-RWRNHJQ4.js → start-HIBG7DYS.js} +16 -12
- package/dist/{start-RWRNHJQ4.js.map → start-HIBG7DYS.js.map} +1 -1
- package/dist/{state-2J4TR7IC.js → state-DC73V5TS.js} +6 -5
- package/dist/{state-2J4TR7IC.js.map → state-DC73V5TS.js.map} +1 -1
- package/dist/{status-RI6OCK7U.js → status-JSM6FETL.js} +13 -9
- package/dist/{status-RI6OCK7U.js.map → status-JSM6FETL.js.map} +1 -1
- package/dist/statusline-A2DTGLK5.js +105 -0
- 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-2SCT3PEV.js → stop-IEMNFVGW.js} +16 -12
- package/dist/{stop-2SCT3PEV.js.map → stop-IEMNFVGW.js.map} +1 -1
- package/dist/{sync-VFFDCH4N.js → sync-FP4J5ODY.js} +31 -27
- package/dist/{sync-VFFDCH4N.js.map → sync-FP4J5ODY.js.map} +1 -1
- package/dist/{time-ADXHL6QP.js → time-QHLGCYPZ.js} +17 -13
- package/dist/{time-ADXHL6QP.js.map → time-QHLGCYPZ.js.map} +1 -1
- package/dist/time-actions-4YP5DZKQ.js +16 -0
- package/dist/{timesheet-RCFXIWRZ.js → timesheet-LSUOCD6V.js} +19 -15
- package/dist/{timesheet-RCFXIWRZ.js.map → timesheet-LSUOCD6V.js.map} +1 -1
- package/dist/{todo-FXPXLXXW.js → todo-4VTGOCKH.js} +7 -6
- package/dist/{todo-FXPXLXXW.js.map → todo-4VTGOCKH.js.map} +1 -1
- package/dist/{tree-EYDQUMZY.js → tree-VTQRBC7I.js} +42 -30
- package/dist/tree-VTQRBC7I.js.map +1 -0
- package/dist/{update-OVZRE7IN.js → update-VL67LR6U.js} +18 -14
- package/dist/{update-OVZRE7IN.js.map → update-VL67LR6U.js.map} +1 -1
- package/dist/usage-EMZVZZEQ.js +84 -0
- package/dist/usage-EMZVZZEQ.js.map +1 -0
- package/dist/{wait-VSDT3KFB.js → wait-HQTY7OW5.js} +16 -12
- package/dist/{wait-VSDT3KFB.js.map → wait-HQTY7OW5.js.map} +1 -1
- package/dist/wd-bin.js +10 -9
- package/dist/wd-bin.js.map +1 -1
- package/dist/web/assets/{PtyView-Cl0maIsn.js → PtyView-BMRi1NT9.js} +2 -2
- package/dist/web/assets/{PtyView-Cl0maIsn.js.map → PtyView-BMRi1NT9.js.map} +1 -1
- package/dist/web/assets/index-BCCeJjez.css +1 -0
- 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-ZW37IV76.js → web-6QSSPH4I.js} +601 -385
- package/dist/web-6QSSPH4I.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/dist/chunk-2X5TDKGV.js.map +0 -1
- package/dist/chunk-4VVIBQ4P.js.map +0 -1
- package/dist/chunk-5UICLGJK.js.map +0 -1
- package/dist/chunk-75MIXOUK.js.map +0 -1
- package/dist/chunk-ADGQADDE.js.map +0 -1
- package/dist/chunk-DAQCIJHW.js.map +0 -1
- package/dist/chunk-FO7B466S.js.map +0 -1
- package/dist/chunk-GQVV3EMN.js +0 -9
- package/dist/chunk-JSSQ3P73.js.map +0 -1
- package/dist/chunk-MSZQUJZZ.js.map +0 -1
- package/dist/chunk-OUWKEJEC.js.map +0 -1
- package/dist/chunk-RYEPQLXQ.js.map +0 -1
- package/dist/chunk-SMZ7W34L.js.map +0 -1
- package/dist/chunk-TQKIAQJT.js.map +0 -1
- package/dist/chunk-TUFQJXXO.js +0 -19
- package/dist/chunk-TUFQJXXO.js.map +0 -1
- package/dist/chunk-VESYLAVA.js.map +0 -1
- package/dist/chunk-ZM7MVV4D.js.map +0 -1
- package/dist/cli-OTCENNUJ.js +0 -18
- package/dist/command-hook-installer-W7IEVT6V.js +0 -204
- package/dist/command-hook-installer-W7IEVT6V.js.map +0 -1
- package/dist/install-skills-TFP6EHI3.js +0 -14
- package/dist/move-QTLHMYRT.js.map +0 -1
- package/dist/pty-host-DVHFTOIW.js.map +0 -1
- package/dist/recent-YQTDHLRE.js.map +0 -1
- package/dist/resume-LMOST4UO.js.map +0 -1
- package/dist/time-actions-LMJUFDDR.js +0 -15
- package/dist/tree-EYDQUMZY.js.map +0 -1
- package/dist/web/assets/index-DywhirOd.css +0 -1
- package/dist/web/assets/index-mP4gis5R.js +0 -119
- package/dist/web/assets/index-mP4gis5R.js.map +0 -1
- package/dist/web-ZW37IV76.js.map +0 -1
- /package/dist/{chunk-GTVQYGY3.js.map → chunk-26MWJLDS.js.map} +0 -0
- /package/dist/{chunk-2FUNUN5C.js.map → chunk-2MQWAQ2D.js.map} +0 -0
- /package/dist/{chunk-G635EV2D.js.map → chunk-3N3UQEC4.js.map} +0 -0
- /package/dist/{chunk-EYUBVLPF.js.map → chunk-5QGCF3PS.js.map} +0 -0
- /package/dist/{chunk-5ZGF2M52.js.map → chunk-7GGIVYWP.js.map} +0 -0
- /package/dist/{chunk-MJNXAAJF.js.map → chunk-7NVEGPZT.js.map} +0 -0
- /package/dist/{chunk-ZGXRWL7T.js.map → chunk-AU27USPZ.js.map} +0 -0
- /package/dist/{chunk-HNFWIJRZ.js.map → chunk-BUX66OI7.js.map} +0 -0
- /package/dist/{chunk-ZPJ5W2KB.js.map → chunk-C4T3F3XO.js.map} +0 -0
- /package/dist/{chunk-GQVV3EMN.js.map → chunk-DJ2X4LKE.js.map} +0 -0
- /package/dist/{chunk-OUUDQA7O.js.map → chunk-GNGXYXBC.js.map} +0 -0
- /package/dist/{chunk-ZYTZBGBP.js.map → chunk-HN2QQMMX.js.map} +0 -0
- /package/dist/{chunk-MYDQNX7W.js.map → chunk-ICJPVSRY.js.map} +0 -0
- /package/dist/{chunk-MHHVNQB4.js.map → chunk-IXC7JM35.js.map} +0 -0
- /package/dist/{chunk-FBJKFNKX.js.map → chunk-J2AZIO22.js.map} +0 -0
- /package/dist/{chunk-CGVYVTGF.js.map → chunk-J36ULZBO.js.map} +0 -0
- /package/dist/{chunk-24GXAENC.js.map → chunk-KH3TRWUV.js.map} +0 -0
- /package/dist/{chunk-4RDAWJZY.js.map → chunk-KNRGVUW7.js.map} +0 -0
- /package/dist/{chunk-TQTMLZFT.js.map → chunk-LKZSPHAT.js.map} +0 -0
- /package/dist/{chunk-XWRVIEFW.js.map → chunk-LXU24GCM.js.map} +0 -0
- /package/dist/{chunk-35VLAPL2.js.map → chunk-MMFXUIQQ.js.map} +0 -0
- /package/dist/{chunk-FSNKCSXO.js.map → chunk-MXA2RZBC.js.map} +0 -0
- /package/dist/{chunk-UDRKYWQL.js.map → chunk-MZTPKKTO.js.map} +0 -0
- /package/dist/{chunk-LFH74AIE.js.map → chunk-NMAJM3C5.js.map} +0 -0
- /package/dist/{chunk-CRPV5YCC.js.map → chunk-OMIMK3LB.js.map} +0 -0
- /package/dist/{chunk-56P7G2DI.js.map → chunk-P4EQWC5W.js.map} +0 -0
- /package/dist/{chunk-EUAJT7FS.js.map → chunk-RGUSVBGN.js.map} +0 -0
- /package/dist/{chunk-ZO6MZNLI.js.map → chunk-S3BAD4IR.js.map} +0 -0
- /package/dist/{chunk-BDIAIO3H.js.map → chunk-SDQI3QB3.js.map} +0 -0
- /package/dist/{chunk-Z3NQJALE.js.map → chunk-SG5LUMGE.js.map} +0 -0
- /package/dist/{chunk-XEPH5FCH.js.map → chunk-WTF4CYHH.js.map} +0 -0
- /package/dist/{chunk-TJFX5BWH.js.map → chunk-X4AXKO3A.js.map} +0 -0
- /package/dist/{chunk-JF72AS6T.js.map → chunk-YYBXQBW2.js.map} +0 -0
- /package/dist/{chunk-TNU4PRE6.js.map → chunk-YZPP6354.js.map} +0 -0
- /package/dist/{cli-OTCENNUJ.js.map → cli-OYO6OXNK.js.map} +0 -0
- /package/dist/{history-6KGCW2WA.js.map → history-52MGO5V5.js.map} +0 -0
- /package/dist/{install-skills-TFP6EHI3.js.map → install-skills-QTWYVAOZ.js.map} +0 -0
- /package/dist/{report-JEG2FKOB.js.map → report-J7TUQRJS.js.map} +0 -0
- /package/dist/{time-actions-LMJUFDDR.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"],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
|
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,M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|
-
scopeHashFor
|
|
9
|
-
} from "./chunk-ZSHWP2VS.js";
|
|
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
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
agedWindow
|
|
4
|
+
} from "./chunk-P2HOLCBF.js";
|
|
5
|
+
import {
|
|
6
|
+
sessionTokens
|
|
7
|
+
} from "./chunk-YRW4YF4U.js";
|
|
8
|
+
import {
|
|
9
|
+
lastConversationWriteMs,
|
|
10
|
+
loadHistory,
|
|
11
|
+
logSwallowed
|
|
12
|
+
} from "./chunk-QLAVWIDJ.js";
|
|
13
|
+
import {
|
|
14
|
+
dayKey
|
|
15
|
+
} from "./chunk-NEJVK5CF.js";
|
|
16
|
+
import {
|
|
17
|
+
sessionIdFor
|
|
18
|
+
} from "./chunk-YYBXQBW2.js";
|
|
19
|
+
import {
|
|
20
|
+
knownAgents
|
|
21
|
+
} from "./chunk-F6M255O5.js";
|
|
22
|
+
|
|
23
|
+
// src/core/usage/usage-source.ts
|
|
24
|
+
var WEEK_DAYS = 7;
|
|
25
|
+
var TOP_SESSIONS = 5;
|
|
26
|
+
var zero = () => ({ input: 0, cached: 0, output: 0 });
|
|
27
|
+
function add(into, t) {
|
|
28
|
+
into.input += t.input;
|
|
29
|
+
into.cached += t.cached;
|
|
30
|
+
into.output += t.output;
|
|
31
|
+
}
|
|
32
|
+
function weekStartDay(now) {
|
|
33
|
+
const d = new Date(now);
|
|
34
|
+
d.setDate(d.getDate() - (WEEK_DAYS - 1));
|
|
35
|
+
return dayKey(d.getTime());
|
|
36
|
+
}
|
|
37
|
+
async function buildUsage(deps, now = Date.now()) {
|
|
38
|
+
const agents = [];
|
|
39
|
+
for (const a of deps.agents()) {
|
|
40
|
+
if (!a.usage) continue;
|
|
41
|
+
agents.push({
|
|
42
|
+
agent: a.id,
|
|
43
|
+
name: a.name,
|
|
44
|
+
accounts: a.usage.read().map((acc) => ({ ...acc, windows: acc.windows.map((w) => agedWindow(w, now)) }))
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
const today = dayKey(now);
|
|
48
|
+
const since = weekStartDay(now);
|
|
49
|
+
const todayTotal = zero();
|
|
50
|
+
const weekTotal = zero();
|
|
51
|
+
const models = /* @__PURE__ */ new Map();
|
|
52
|
+
const perSession = [];
|
|
53
|
+
for (const s of deps.sessions(now)) {
|
|
54
|
+
let days;
|
|
55
|
+
try {
|
|
56
|
+
days = await deps.tokens(s, since);
|
|
57
|
+
} catch (e) {
|
|
58
|
+
logSwallowed(`usage: tokens of ${sessionIdFor(s)}`, e);
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
const week = zero();
|
|
62
|
+
for (const [day, byModel] of Object.entries(days)) {
|
|
63
|
+
if (day < since || day > today) continue;
|
|
64
|
+
for (const [model, t] of Object.entries(byModel)) {
|
|
65
|
+
const m = models.get(model) ?? { today: zero(), week: zero() };
|
|
66
|
+
models.set(model, m);
|
|
67
|
+
add(m.week, t);
|
|
68
|
+
add(weekTotal, t);
|
|
69
|
+
add(week, t);
|
|
70
|
+
if (day === today) {
|
|
71
|
+
add(m.today, t);
|
|
72
|
+
add(todayTotal, t);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (week.input + week.output > 0) perSession.push({ id: sessionIdFor(s), label: deps.label(s), week });
|
|
77
|
+
}
|
|
78
|
+
const size = (t) => t.input + t.output;
|
|
79
|
+
return {
|
|
80
|
+
agents,
|
|
81
|
+
tokens: {
|
|
82
|
+
today: todayTotal,
|
|
83
|
+
week: weekTotal,
|
|
84
|
+
byModel: [...models].map(([model, v]) => ({ model, ...v })).sort((a, b) => size(b.week) - size(a.week)),
|
|
85
|
+
topSessions: perSession.sort((a, b) => size(b.week) - size(a.week)).slice(0, TOP_SESSIONS)
|
|
86
|
+
},
|
|
87
|
+
at: new Date(now).toISOString()
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function usageSessions(all, lastWriteMs, now) {
|
|
91
|
+
return all.filter((s) => !s.archivedAt && lastWriteMs(s) >= now - WEEK_DAYS * 24 * 36e5);
|
|
92
|
+
}
|
|
93
|
+
function realUsageDeps() {
|
|
94
|
+
return {
|
|
95
|
+
agents: () => knownAgents(),
|
|
96
|
+
sessions: (now) => usageSessions(loadHistory(), lastConversationWriteMs, now),
|
|
97
|
+
tokens: sessionTokens,
|
|
98
|
+
label: (s) => `${s.target} \xB7 ${s.title ? s.title : s.branch}`
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// src/core/usage/usage-setup.ts
|
|
103
|
+
async function setupAgentUsage(agents, config, lean) {
|
|
104
|
+
const enabled = config?.usage?.statusLine !== false;
|
|
105
|
+
const done = [];
|
|
106
|
+
for (const a of agents) {
|
|
107
|
+
if (!a.usage?.setup) continue;
|
|
108
|
+
try {
|
|
109
|
+
done.push({ agent: a.id, message: await a.usage.setup({ enabled, lean }) });
|
|
110
|
+
} catch (e) {
|
|
111
|
+
logSwallowed(`set up ${a.name}'s usage readings`, e);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return done;
|
|
115
|
+
}
|
|
116
|
+
async function restoreAgentUsage(agents) {
|
|
117
|
+
const out = [];
|
|
118
|
+
for (const a of agents) {
|
|
119
|
+
if (!a.usage?.restore) continue;
|
|
120
|
+
try {
|
|
121
|
+
out.push({ agent: a.id, name: a.name, ...await a.usage.restore() });
|
|
122
|
+
} catch (e) {
|
|
123
|
+
out.push({ agent: a.id, name: a.name, ok: false, message: e instanceof Error ? e.message : String(e) });
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return out;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export {
|
|
130
|
+
buildUsage,
|
|
131
|
+
realUsageDeps,
|
|
132
|
+
setupAgentUsage,
|
|
133
|
+
restoreAgentUsage
|
|
134
|
+
};
|
|
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;AAWrB,IAAM,OAAO,OAAoB,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,EAAE;AAElE,SAAS,IAAI,MAAmB,GAAsB;AACpD,OAAK,SAAS,EAAE;AAChB,OAAK,UAAU,EAAE;AACjB,OAAK,UAAU,EAAE;AACnB;AAGO,SAAS,aAAa,KAAqB;AAChD,QAAM,IAAI,IAAI,KAAK,GAAG;AACtB,IAAE,QAAQ,EAAE,QAAQ,KAAK,YAAY,EAAE;AACvC,SAAO,OAAO,EAAE,QAAQ,CAAC;AAC3B;AAEA,eAAsB,WAAW,MAAiB,MAAM,KAAK,IAAI,GAAuB;AACtF,QAAM,SAA8B,CAAC;AACrC,aAAW,KAAK,KAAK,OAAO,GAAG;AAC7B,QAAI,CAAC,EAAE,MAAO;AACd,WAAO,KAAK;AAAA,MACV,OAAO,EAAE;AAAA,MACT,MAAM,EAAE;AAAA,MACR,UAAU,EAAE,MAAM,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,GAAG,KAAK,SAAS,IAAI,QAAQ,IAAI,CAAC,MAAM,WAAW,GAAG,GAAG,CAAC,EAAE,EAAE;AAAA,IACzG,CAAC;AAAA,EACH;AAEA,QAAM,QAAQ,OAAO,GAAG;AACxB,QAAM,QAAQ,aAAa,GAAG;AAC9B,QAAM,aAAa,KAAK;AACxB,QAAM,YAAY,KAAK;AACvB,QAAM,SAAS,oBAAI,IAAuD;AAC1E,QAAM,aAAsE,CAAC;AAC7E,aAAW,KAAK,KAAK,SAAS,GAAG,GAAG;AAClC,QAAI;AACJ,QAAI;AACF,aAAO,MAAM,KAAK,OAAO,GAAG,KAAK;AAAA,IACnC,SAAS,GAAG;AACV,mBAAa,oBAAoB,aAAa,CAAC,CAA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ySessionsPath
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-M6LJ3GE3.js";
|
|
6
6
|
import {
|
|
7
7
|
json,
|
|
8
8
|
tx,
|
|
9
9
|
withDb
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./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
|