@moberg_hr/work-tree 2.9.3 → 2.11.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-NG75VLRU.js → account-Q5Y3YKI7.js} +83 -100
- package/dist/account-Q5Y3YKI7.js.map +1 -0
- package/dist/{add-repo-EDU3QEYI.js → add-repo-L4ZTGBLO.js} +35 -31
- package/dist/{add-repo-EDU3QEYI.js.map → add-repo-L4ZTGBLO.js.map} +1 -1
- package/dist/{answer-MHOJ2J6S.js → answer-GNR4ZBWV.js} +18 -15
- package/dist/{answer-MHOJ2J6S.js.map → answer-GNR4ZBWV.js.map} +1 -1
- package/dist/{attach-37JOJ4C3.js → attach-QNSDKRW7.js} +27 -21
- package/dist/{attach-37JOJ4C3.js.map → attach-QNSDKRW7.js.map} +1 -1
- package/dist/bin.js +5 -5
- package/dist/{block-D5CAR53T.js → block-3YUIMA62.js} +23 -15
- package/dist/block-3YUIMA62.js.map +1 -0
- package/dist/{broadcast-LLYHUWXA.js → broadcast-DR3JFINO.js} +13 -11
- package/dist/{broadcast-LLYHUWXA.js.map → broadcast-DR3JFINO.js.map} +1 -1
- package/dist/{catchup-2SL3JGA7.js → catchup-YG2UOZBL.js} +19 -17
- package/dist/{catchup-2SL3JGA7.js.map → catchup-YG2UOZBL.js.map} +1 -1
- package/dist/{chunk-P6BHOAQG.js → chunk-246OTVRR.js} +2 -2
- package/dist/{chunk-KSUOVFO3.js → chunk-26YZYL77.js} +16 -9
- package/dist/chunk-26YZYL77.js.map +1 -0
- package/dist/{chunk-TPSFJSO7.js → chunk-2KN5ECHJ.js} +13 -10
- package/dist/chunk-2KN5ECHJ.js.map +1 -0
- package/dist/chunk-2QLLPZ2L.js +59 -0
- package/dist/chunk-2QLLPZ2L.js.map +1 -0
- package/dist/chunk-2ZQRD73B.js +376 -0
- package/dist/chunk-2ZQRD73B.js.map +1 -0
- package/dist/{chunk-GNGXYXBC.js → chunk-33XSEAHO.js} +2 -2
- package/dist/{chunk-IPGH7TXJ.js → chunk-4CNBSPNL.js} +2 -2
- package/dist/{chunk-J36ULZBO.js → chunk-4K4S53KX.js} +2 -2
- package/dist/chunk-5PAMO6OG.js +9 -0
- package/dist/{chunk-NWIVXGSL.js.map → chunk-5PAMO6OG.js.map} +1 -1
- package/dist/chunk-63ZLPXRL.js +199 -0
- package/dist/chunk-63ZLPXRL.js.map +1 -0
- package/dist/{chunk-P2HOLCBF.js → chunk-6UTH3A76.js} +18 -2
- package/dist/{chunk-P2HOLCBF.js.map → chunk-6UTH3A76.js.map} +1 -1
- package/dist/{chunk-5QGCF3PS.js → chunk-7DUGVGUZ.js} +2 -2
- package/dist/chunk-7E5XPDKX.js +22 -0
- package/dist/chunk-7E5XPDKX.js.map +1 -0
- package/dist/{chunk-6FVYSW3E.js → chunk-7NNGYM3G.js} +21 -6
- package/dist/chunk-7NNGYM3G.js.map +1 -0
- package/dist/{chunk-DQCUYCMX.js → chunk-7NNOGTMC.js} +3 -3
- package/dist/{chunk-OMIMK3LB.js → chunk-7OFVXQSM.js} +2 -2
- package/dist/chunk-7QNVFVG6.js +196 -0
- package/dist/chunk-7QNVFVG6.js.map +1 -0
- package/dist/chunk-7RHC5U7X.js +1578 -0
- package/dist/chunk-7RHC5U7X.js.map +1 -0
- package/dist/{chunk-KUCMJHQW.js → chunk-AHYCZUPI.js} +2 -2
- package/dist/chunk-B6MWNZCN.js +415 -0
- package/dist/chunk-B6MWNZCN.js.map +1 -0
- package/dist/{chunk-CCTALU3C.js → chunk-BLGCU4HT.js} +2 -2
- package/dist/{chunk-RCGFHJM7.js → chunk-CBCOVIXZ.js} +2 -2
- package/dist/{chunk-WTQ2QCAG.js → chunk-CDYCZ3PR.js} +4 -5
- package/dist/chunk-CDYCZ3PR.js.map +1 -0
- package/dist/{chunk-HCVONKJI.js → chunk-CR4LUAP4.js} +15 -17
- package/dist/{chunk-HCVONKJI.js.map → chunk-CR4LUAP4.js.map} +1 -1
- package/dist/{chunk-ZXHMC7UO.js → chunk-D2J3AD6L.js} +3 -5
- package/dist/chunk-D2J3AD6L.js.map +1 -0
- package/dist/chunk-DAKJTB6N.js +76 -0
- package/dist/chunk-DAKJTB6N.js.map +1 -0
- package/dist/{chunk-3N3UQEC4.js → chunk-DCCC7LEP.js} +4 -3
- package/dist/chunk-DCCC7LEP.js.map +1 -0
- package/dist/{chunk-S3BAD4IR.js → chunk-DGVCN7HB.js} +2 -2
- package/dist/chunk-DMGNJ73M.js +84 -0
- package/dist/chunk-DMGNJ73M.js.map +1 -0
- package/dist/{chunk-QL36KN7X.js → chunk-DYQQLUSB.js} +3 -3
- package/dist/{chunk-IWJXFNM4.js → chunk-DZ4LX2EK.js} +16 -24
- package/dist/chunk-DZ4LX2EK.js.map +1 -0
- package/dist/{chunk-3C3BKZ3H.js → chunk-EDIHBLZY.js} +51 -29
- package/dist/chunk-EDIHBLZY.js.map +1 -0
- package/dist/chunk-EL3XL2OC.js +150 -0
- package/dist/chunk-EL3XL2OC.js.map +1 -0
- package/dist/{chunk-T7AFYEQ7.js → chunk-F2CDUWZU.js} +5 -5
- package/dist/chunk-F2NOCGMA.js +243 -0
- package/dist/chunk-F2NOCGMA.js.map +1 -0
- package/dist/chunk-FGPXMAYU.js +25 -0
- package/dist/chunk-FGPXMAYU.js.map +1 -0
- package/dist/{chunk-ICJPVSRY.js → chunk-FLHMFRZB.js} +51 -51
- package/dist/chunk-FLHMFRZB.js.map +1 -0
- package/dist/{chunk-CLBQ7ZC4.js → chunk-FR7B7QH6.js} +3 -3
- package/dist/chunk-FZHFD2AY.js +27 -0
- package/dist/chunk-FZHFD2AY.js.map +1 -0
- package/dist/{chunk-7OUIZ2YQ.js → chunk-G4QUJO7W.js} +56 -58
- package/dist/chunk-G4QUJO7W.js.map +1 -0
- package/dist/{chunk-26OVU2AE.js → chunk-G4ZR5YZL.js} +8 -8
- package/dist/{chunk-P4EQWC5W.js → chunk-GG4VKPAX.js} +2 -2
- package/dist/{chunk-INQQGV2G.js → chunk-GZNF6762.js} +4 -4
- package/dist/{chunk-QHTXLCG7.js → chunk-H3LP3Z4U.js} +19 -13
- package/dist/chunk-H3LP3Z4U.js.map +1 -0
- package/dist/{chunk-6E2I2FBJ.js → chunk-HJKYE57I.js} +22 -22
- package/dist/{chunk-CYWI3ZW7.js → chunk-I5FZXDCO.js} +4 -4
- package/dist/{chunk-5WM24P5N.js → chunk-I6MILNM5.js} +2 -2
- package/dist/chunk-I6MILNM5.js.map +1 -0
- package/dist/{chunk-BSP2Z7B7.js → chunk-IQ4MITHC.js} +6 -6
- package/dist/chunk-J3GEINBH.js +307 -0
- package/dist/chunk-J3GEINBH.js.map +1 -0
- package/dist/{chunk-WXE7D44E.js → chunk-JCFCEJ2D.js} +8 -8
- package/dist/chunk-JCFCEJ2D.js.map +1 -0
- package/dist/{chunk-WXMWZRBH.js → chunk-JF25PSYF.js} +24 -8
- package/dist/chunk-JF25PSYF.js.map +1 -0
- package/dist/{chunk-SG5LUMGE.js → chunk-JNBMANFM.js} +6 -3
- package/dist/chunk-JNBMANFM.js.map +1 -0
- package/dist/chunk-JVE2JFLV.js +15 -0
- package/dist/chunk-JVE2JFLV.js.map +1 -0
- package/dist/{chunk-RGUSVBGN.js → chunk-JVHHSKBJ.js} +2 -2
- package/dist/chunk-KSVYR4G2.js +47 -0
- package/dist/chunk-KSVYR4G2.js.map +1 -0
- package/dist/{chunk-RYNBBSLY.js → chunk-KWHHB737.js} +6 -8
- package/dist/chunk-KWHHB737.js.map +1 -0
- package/dist/{chunk-MG5TTLYZ.js → chunk-LHM3GB5K.js} +3 -3
- package/dist/{chunk-PSUJZUYX.js → chunk-LM2T5OR3.js} +3 -2
- package/dist/{chunk-GRLKPVTP.js → chunk-LQNHIMJM.js} +56 -81
- package/dist/chunk-LQNHIMJM.js.map +1 -0
- package/dist/{chunk-UBOKRHNV.js → chunk-MKJH2D4V.js} +2 -2
- package/dist/{chunk-HMK3INUS.js → chunk-MQCDFSVF.js} +2 -2
- package/dist/{chunk-VJ7SVDED.js → chunk-MSJWQC7H.js} +6 -4
- package/dist/chunk-MSJWQC7H.js.map +1 -0
- package/dist/chunk-MXOHW4U2.js +187 -0
- package/dist/chunk-MXOHW4U2.js.map +1 -0
- package/dist/{chunk-VUAVPBFR.js → chunk-N4W34U3I.js} +78 -60
- package/dist/chunk-N4W34U3I.js.map +1 -0
- package/dist/{chunk-72IBYKIY.js → chunk-NFWSJFYY.js} +16 -5
- package/dist/chunk-NFWSJFYY.js.map +1 -0
- package/dist/{chunk-2JNW2AQ2.js → chunk-O5ZJY5BT.js} +32 -4
- package/dist/chunk-O5ZJY5BT.js.map +1 -0
- package/dist/{chunk-CMO5YUZR.js → chunk-OY46QHLX.js} +4 -4
- package/dist/{chunk-OTAZOIXK.js → chunk-PKQROEFP.js} +2 -2
- package/dist/{chunk-4NITDMDH.js → chunk-PPZP7CA7.js} +9 -186
- package/dist/chunk-PPZP7CA7.js.map +1 -0
- package/dist/chunk-QBI6K23L.js +50 -0
- package/dist/chunk-QBI6K23L.js.map +1 -0
- package/dist/{chunk-AAYWHIIT.js → chunk-QLFJNYBV.js} +9 -56
- package/dist/chunk-QLFJNYBV.js.map +1 -0
- package/dist/{chunk-PRDRRU2B.js → chunk-R5JCCRGD.js} +5 -5
- package/dist/{chunk-X4AXKO3A.js → chunk-RGLIW45S.js} +2 -2
- package/dist/{chunk-YYBXQBW2.js → chunk-RUYTU2WJ.js} +17 -3
- package/dist/chunk-RUYTU2WJ.js.map +1 -0
- package/dist/chunk-S3CTXKSN.js +17 -0
- package/dist/chunk-S3CTXKSN.js.map +1 -0
- package/dist/chunk-SJBEIYLK.js +16 -0
- package/dist/chunk-SJBEIYLK.js.map +1 -0
- package/dist/{chunk-WC534PXU.js → chunk-SPP7MA3D.js} +36 -25
- package/dist/chunk-SPP7MA3D.js.map +1 -0
- package/dist/{chunk-RFINYWID.js → chunk-TEL27NRC.js} +16 -6
- package/dist/chunk-TEL27NRC.js.map +1 -0
- package/dist/{chunk-ATED7SAH.js → chunk-TEVCBUEN.js} +36 -25
- package/dist/chunk-TEVCBUEN.js.map +1 -0
- package/dist/{chunk-QSOEMCWQ.js → chunk-URGHBFB3.js} +18 -11
- package/dist/chunk-URGHBFB3.js.map +1 -0
- package/dist/{chunk-S3FMTEFR.js → chunk-VAMLU5VH.js} +13 -6
- package/dist/chunk-VAMLU5VH.js.map +1 -0
- package/dist/{chunk-ZI2KXTKM.js → chunk-VJ5XMYXE.js} +6 -10
- package/dist/chunk-VJ5XMYXE.js.map +1 -0
- package/dist/{chunk-QEVYCCKD.js → chunk-VRQKIIC2.js} +12 -34
- package/dist/chunk-VRQKIIC2.js.map +1 -0
- package/dist/{chunk-63VY4YJM.js → chunk-W7MGB3Q2.js} +34 -9
- package/dist/chunk-W7MGB3Q2.js.map +1 -0
- package/dist/{chunk-HEPBANFJ.js → chunk-X3RHLYGI.js} +93 -196
- package/dist/chunk-X3RHLYGI.js.map +1 -0
- package/dist/chunk-YKQLHFY4.js +1478 -0
- package/dist/chunk-YKQLHFY4.js.map +1 -0
- package/dist/chunk-YPXFDJ76.js +71 -0
- package/dist/chunk-YPXFDJ76.js.map +1 -0
- package/dist/{chunk-XVNRP7XE.js → chunk-YQBBFX7D.js} +11 -11
- package/dist/{chunk-37XQIG7F.js → chunk-ZG2M4ECW.js} +569 -55
- package/dist/chunk-ZG2M4ECW.js.map +1 -0
- package/dist/{cleanup-5PSLKZLF.js → cleanup-X7G66SPY.js} +49 -37
- package/dist/{cleanup-5PSLKZLF.js.map → cleanup-X7G66SPY.js.map} +1 -1
- package/dist/cli-RJVX6HVT.js +19 -0
- package/dist/{command-hook-installer-7Q7UD7AU.js → command-hook-installer-GMQ4IVDE.js} +3 -3
- package/dist/{completion-MXX5TRIV.js → completion-IAH7WRKJ.js} +3 -2
- package/dist/{completion-MXX5TRIV.js.map → completion-IAH7WRKJ.js.map} +1 -1
- package/dist/{config-6MSITKGB.js → config-ZBU5PHMG.js} +18 -15
- package/dist/{config-6MSITKGB.js.map → config-ZBU5PHMG.js.map} +1 -1
- package/dist/{diff-Q7MV6YGJ.js → diff-ADSD4SNQ.js} +25 -22
- package/dist/{diff-Q7MV6YGJ.js.map → diff-ADSD4SNQ.js.map} +1 -1
- package/dist/{digest-KUMVYXKZ.js → digest-ORN6JFNE.js} +15 -13
- package/dist/{digest-KUMVYXKZ.js.map → digest-ORN6JFNE.js.map} +1 -1
- package/dist/{fork-OFENISEM.js → fork-VWHAU76U.js} +44 -31
- package/dist/{fork-OFENISEM.js.map → fork-VWHAU76U.js.map} +1 -1
- package/dist/{history-5WKRWARZ.js → history-PP7RHA2V.js} +14 -12
- package/dist/{hook-ARS32DG2.js → hook-6AL5LIQO.js} +56 -22
- package/dist/hook-6AL5LIQO.js.map +1 -0
- package/dist/{hydrate-LCT6DVB3.js → hydrate-JW5MIWLZ.js} +16 -14
- package/dist/{hydrate-LCT6DVB3.js.map → hydrate-JW5MIWLZ.js.map} +1 -1
- package/dist/{init-FJKPEY5N.js → init-SIIKJF3K.js} +29 -21
- package/dist/{init-FJKPEY5N.js.map → init-SIIKJF3K.js.map} +1 -1
- package/dist/install-skills-KS6N4U6L.js +22 -0
- package/dist/install-skills-bin.js +10 -8
- package/dist/install-skills-bin.js.map +1 -1
- package/dist/{list-GTKP5FAW.js → list-UTQF7KHP.js} +17 -15
- package/dist/{list-GTKP5FAW.js.map → list-UTQF7KHP.js.map} +1 -1
- package/dist/{move-GOCLEFGZ.js → move-P6WOVUGF.js} +35 -26
- package/dist/{move-GOCLEFGZ.js.map → move-P6WOVUGF.js.map} +1 -1
- package/dist/{note-B7TQBXQF.js → note-GEFCZKMT.js} +16 -14
- package/dist/{note-B7TQBXQF.js.map → note-GEFCZKMT.js.map} +1 -1
- package/dist/{overlaps-UKQHIJMU.js → overlaps-QMI2RJSG.js} +23 -13
- package/dist/{overlaps-UKQHIJMU.js.map → overlaps-QMI2RJSG.js.map} +1 -1
- package/dist/{pin-UZZCDK7M.js → pin-ZALBX2XK.js} +16 -14
- package/dist/{pin-UZZCDK7M.js.map → pin-ZALBX2XK.js.map} +1 -1
- package/dist/{pr-NU2ME2XW.js → pr-D3EZ7C5H.js} +48 -23
- package/dist/pr-D3EZ7C5H.js.map +1 -0
- package/dist/{prune-IZGEYTSB.js → prune-ZCOBL7IB.js} +47 -35
- package/dist/{prune-IZGEYTSB.js.map → prune-ZCOBL7IB.js.map} +1 -1
- package/dist/{pty-host-AWDIKPQN.js → pty-host-UCM6GV42.js} +104 -40
- package/dist/pty-host-UCM6GV42.js.map +1 -0
- package/dist/{read-U6GBGA5E.js → read-NHRSGZI4.js} +15 -13
- package/dist/{read-U6GBGA5E.js.map → read-NHRSGZI4.js.map} +1 -1
- package/dist/{recent-2DUMLUDG.js → recent-V4JVL4Y2.js} +36 -27
- package/dist/recent-V4JVL4Y2.js.map +1 -0
- package/dist/{remove-OXUP4O33.js → remove-YNO2I3HR.js} +51 -39
- package/dist/{remove-OXUP4O33.js.map → remove-YNO2I3HR.js.map} +1 -1
- package/dist/{restart-QEW4DJC3.js → restart-6YKAD7QQ.js} +19 -17
- package/dist/{restart-QEW4DJC3.js.map → restart-6YKAD7QQ.js.map} +1 -1
- package/dist/{resume-K45IT4QO.js → resume-PNZ7BRXJ.js} +36 -21
- package/dist/resume-PNZ7BRXJ.js.map +1 -0
- package/dist/review-now-HHQIBVUS.js +22 -0
- package/dist/review-now-HHQIBVUS.js.map +1 -0
- package/dist/{run-42LORGPS.js → run-3QYP7GBN.js} +23 -17
- package/dist/run-3QYP7GBN.js.map +1 -0
- package/dist/{screen-2TLIUH3G.js → screen-I6N6FKMF.js} +16 -14
- package/dist/{screen-2TLIUH3G.js.map → screen-I6N6FKMF.js.map} +1 -1
- package/dist/{search-7E4B2KX6.js → search-MLLK3ZCW.js} +12 -10
- package/dist/{search-7E4B2KX6.js.map → search-MLLK3ZCW.js.map} +1 -1
- package/dist/{section-OVA5VD7L.js → section-EQOZ36FS.js} +16 -14
- package/dist/{section-OVA5VD7L.js.map → section-EQOZ36FS.js.map} +1 -1
- package/dist/{send-BJY5CYLO.js → send-LET73FB6.js} +21 -18
- package/dist/send-LET73FB6.js.map +1 -0
- package/dist/{sessions-4A24ZORW.js → sessions-MDOJJZCK.js} +60 -25
- package/dist/sessions-MDOJJZCK.js.map +1 -0
- package/dist/{snooze-WIVKB3GH.js → snooze-TNA7QTXS.js} +15 -13
- package/dist/{snooze-WIVKB3GH.js.map → snooze-TNA7QTXS.js.map} +1 -1
- package/dist/{start-G6GR533S.js → start-OV6LZJ2V.js} +16 -14
- package/dist/{start-G6GR533S.js.map → start-OV6LZJ2V.js.map} +1 -1
- package/dist/{state-S3DGLT4J.js → state-BR43ONIH.js} +18 -6
- package/dist/state-BR43ONIH.js.map +1 -0
- package/dist/{status-BTAWY6JQ.js → status-HDDGCX4J.js} +40 -15
- package/dist/status-HDDGCX4J.js.map +1 -0
- package/dist/{statusline-WLXEU5DM.js → statusline-WKKYCH7O.js} +13 -12
- package/dist/{statusline-WLXEU5DM.js.map → statusline-WKKYCH7O.js.map} +1 -1
- package/dist/{statusline-hook-OVWHHFBV.js → statusline-hook-K7KPN2H6.js} +6 -5
- package/dist/{statusline-hook-OVWHHFBV.js.map → statusline-hook-K7KPN2H6.js.map} +1 -1
- package/dist/{stop-FN6EPFJ4.js → stop-3TJWZBJB.js} +16 -14
- package/dist/{stop-FN6EPFJ4.js.map → stop-3TJWZBJB.js.map} +1 -1
- package/dist/{sync-T3BSHX6Q.js → sync-67AOBEYR.js} +47 -35
- package/dist/{sync-T3BSHX6Q.js.map → sync-67AOBEYR.js.map} +1 -1
- package/dist/{time-5CH5O5MZ.js → time-F6SLY6HR.js} +17 -15
- package/dist/{time-5CH5O5MZ.js.map → time-F6SLY6HR.js.map} +1 -1
- package/dist/{time-actions-XEUQ3UF7.js → time-actions-YOXF5WC7.js} +6 -5
- package/dist/{timesheet-FMQKPS5S.js → timesheet-QUEDQSJ2.js} +26 -17
- package/dist/{timesheet-FMQKPS5S.js.map → timesheet-QUEDQSJ2.js.map} +1 -1
- package/dist/{todo-23COLGR2.js → todo-TALKJYK6.js} +5 -5
- package/dist/{tree-T33VU473.js → tree-FOOQBNVW.js} +66 -47
- package/dist/tree-FOOQBNVW.js.map +1 -0
- package/dist/{update-PJRSKQZ2.js → update-5O3I5P4N.js} +26 -16
- package/dist/{update-PJRSKQZ2.js.map → update-5O3I5P4N.js.map} +1 -1
- package/dist/{usage-TL66LWO4.js → usage-DVKHDT5J.js} +15 -13
- package/dist/{usage-TL66LWO4.js.map → usage-DVKHDT5J.js.map} +1 -1
- package/dist/version-TVT6GSRF.js +115 -0
- package/dist/version-TVT6GSRF.js.map +1 -0
- package/dist/{wait-YIEJO6YM.js → wait-5HZZPKNM.js} +18 -15
- package/dist/{wait-YIEJO6YM.js.map → wait-5HZZPKNM.js.map} +1 -1
- package/dist/wd-bin.js +7 -7
- package/dist/web/assets/{PtyView-DnDd6jLI.js → PtyView-DIGlBtjg.js} +2 -2
- package/dist/web/assets/{PtyView-DnDd6jLI.js.map → PtyView-DIGlBtjg.js.map} +1 -1
- package/dist/web/assets/index-CpqiTeqj.css +1 -0
- package/dist/web/assets/index-Cx0PMo6D.js +126 -0
- package/dist/web/assets/index-Cx0PMo6D.js.map +1 -0
- package/dist/web/index.html +2 -2
- package/dist/{web-IYUNJMQD.js → web-T7UPV3QY.js} +5158 -1822
- package/dist/web-T7UPV3QY.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/plugins/work-tree/skills/wd-review/SKILL.md +1 -1
- package/plugins/work-tree/skills/work-sessions/SKILL.md +2 -2
- package/dist/account-NG75VLRU.js.map +0 -1
- package/dist/block-D5CAR53T.js.map +0 -1
- package/dist/chunk-2JNW2AQ2.js.map +0 -1
- package/dist/chunk-37XQIG7F.js.map +0 -1
- package/dist/chunk-3C3BKZ3H.js.map +0 -1
- package/dist/chunk-3GIH4WTA.js +0 -314
- package/dist/chunk-3GIH4WTA.js.map +0 -1
- package/dist/chunk-3N3UQEC4.js.map +0 -1
- package/dist/chunk-4NITDMDH.js.map +0 -1
- package/dist/chunk-5WM24P5N.js.map +0 -1
- package/dist/chunk-63VY4YJM.js.map +0 -1
- package/dist/chunk-6FVYSW3E.js.map +0 -1
- package/dist/chunk-72IBYKIY.js.map +0 -1
- package/dist/chunk-7OUIZ2YQ.js.map +0 -1
- package/dist/chunk-AAYWHIIT.js.map +0 -1
- package/dist/chunk-ATED7SAH.js.map +0 -1
- package/dist/chunk-GRLKPVTP.js.map +0 -1
- package/dist/chunk-HEPBANFJ.js.map +0 -1
- package/dist/chunk-ICJPVSRY.js.map +0 -1
- package/dist/chunk-IWJXFNM4.js.map +0 -1
- package/dist/chunk-KSUOVFO3.js.map +0 -1
- package/dist/chunk-NWIVXGSL.js +0 -9
- package/dist/chunk-PTWVOT7A.js +0 -551
- package/dist/chunk-PTWVOT7A.js.map +0 -1
- package/dist/chunk-QEVYCCKD.js.map +0 -1
- package/dist/chunk-QHTXLCG7.js.map +0 -1
- package/dist/chunk-QSOEMCWQ.js.map +0 -1
- package/dist/chunk-RCYI7SRA.js +0 -15
- package/dist/chunk-RCYI7SRA.js.map +0 -1
- package/dist/chunk-RFINYWID.js.map +0 -1
- package/dist/chunk-RYNBBSLY.js.map +0 -1
- package/dist/chunk-S3FMTEFR.js.map +0 -1
- package/dist/chunk-SG5LUMGE.js.map +0 -1
- package/dist/chunk-TPSFJSO7.js.map +0 -1
- package/dist/chunk-VJ7SVDED.js.map +0 -1
- package/dist/chunk-VTLDYH3C.js +0 -227
- package/dist/chunk-VTLDYH3C.js.map +0 -1
- package/dist/chunk-VUAVPBFR.js.map +0 -1
- package/dist/chunk-WC534PXU.js.map +0 -1
- package/dist/chunk-WTQ2QCAG.js.map +0 -1
- package/dist/chunk-WXE7D44E.js.map +0 -1
- package/dist/chunk-WXMWZRBH.js.map +0 -1
- package/dist/chunk-YYBXQBW2.js.map +0 -1
- package/dist/chunk-ZDMJPEBO.js +0 -31
- package/dist/chunk-ZDMJPEBO.js.map +0 -1
- package/dist/chunk-ZI2KXTKM.js.map +0 -1
- package/dist/chunk-ZXHMC7UO.js.map +0 -1
- package/dist/cli-AF7636FA.js +0 -19
- package/dist/hook-ARS32DG2.js.map +0 -1
- package/dist/install-skills-UYAFVJBA.js +0 -20
- package/dist/pr-NU2ME2XW.js.map +0 -1
- package/dist/pty-host-AWDIKPQN.js.map +0 -1
- package/dist/recent-2DUMLUDG.js.map +0 -1
- package/dist/resume-K45IT4QO.js.map +0 -1
- package/dist/run-42LORGPS.js.map +0 -1
- package/dist/send-BJY5CYLO.js.map +0 -1
- package/dist/sessions-4A24ZORW.js.map +0 -1
- package/dist/state-S3DGLT4J.js.map +0 -1
- package/dist/status-BTAWY6JQ.js.map +0 -1
- package/dist/tree-T33VU473.js.map +0 -1
- package/dist/web/assets/index-DxozAoUO.css +0 -1
- package/dist/web/assets/index-InmdAx6g.js +0 -120
- package/dist/web/assets/index-InmdAx6g.js.map +0 -1
- package/dist/web-IYUNJMQD.js.map +0 -1
- /package/dist/{chunk-P6BHOAQG.js.map → chunk-246OTVRR.js.map} +0 -0
- /package/dist/{chunk-GNGXYXBC.js.map → chunk-33XSEAHO.js.map} +0 -0
- /package/dist/{chunk-IPGH7TXJ.js.map → chunk-4CNBSPNL.js.map} +0 -0
- /package/dist/{chunk-J36ULZBO.js.map → chunk-4K4S53KX.js.map} +0 -0
- /package/dist/{chunk-5QGCF3PS.js.map → chunk-7DUGVGUZ.js.map} +0 -0
- /package/dist/{chunk-DQCUYCMX.js.map → chunk-7NNOGTMC.js.map} +0 -0
- /package/dist/{chunk-OMIMK3LB.js.map → chunk-7OFVXQSM.js.map} +0 -0
- /package/dist/{chunk-KUCMJHQW.js.map → chunk-AHYCZUPI.js.map} +0 -0
- /package/dist/{chunk-CCTALU3C.js.map → chunk-BLGCU4HT.js.map} +0 -0
- /package/dist/{chunk-RCGFHJM7.js.map → chunk-CBCOVIXZ.js.map} +0 -0
- /package/dist/{chunk-S3BAD4IR.js.map → chunk-DGVCN7HB.js.map} +0 -0
- /package/dist/{chunk-QL36KN7X.js.map → chunk-DYQQLUSB.js.map} +0 -0
- /package/dist/{chunk-T7AFYEQ7.js.map → chunk-F2CDUWZU.js.map} +0 -0
- /package/dist/{chunk-CLBQ7ZC4.js.map → chunk-FR7B7QH6.js.map} +0 -0
- /package/dist/{chunk-26OVU2AE.js.map → chunk-G4ZR5YZL.js.map} +0 -0
- /package/dist/{chunk-P4EQWC5W.js.map → chunk-GG4VKPAX.js.map} +0 -0
- /package/dist/{chunk-INQQGV2G.js.map → chunk-GZNF6762.js.map} +0 -0
- /package/dist/{chunk-6E2I2FBJ.js.map → chunk-HJKYE57I.js.map} +0 -0
- /package/dist/{chunk-CYWI3ZW7.js.map → chunk-I5FZXDCO.js.map} +0 -0
- /package/dist/{chunk-BSP2Z7B7.js.map → chunk-IQ4MITHC.js.map} +0 -0
- /package/dist/{chunk-RGUSVBGN.js.map → chunk-JVHHSKBJ.js.map} +0 -0
- /package/dist/{chunk-MG5TTLYZ.js.map → chunk-LHM3GB5K.js.map} +0 -0
- /package/dist/{chunk-PSUJZUYX.js.map → chunk-LM2T5OR3.js.map} +0 -0
- /package/dist/{chunk-UBOKRHNV.js.map → chunk-MKJH2D4V.js.map} +0 -0
- /package/dist/{chunk-HMK3INUS.js.map → chunk-MQCDFSVF.js.map} +0 -0
- /package/dist/{chunk-CMO5YUZR.js.map → chunk-OY46QHLX.js.map} +0 -0
- /package/dist/{chunk-OTAZOIXK.js.map → chunk-PKQROEFP.js.map} +0 -0
- /package/dist/{chunk-PRDRRU2B.js.map → chunk-R5JCCRGD.js.map} +0 -0
- /package/dist/{chunk-X4AXKO3A.js.map → chunk-RGLIW45S.js.map} +0 -0
- /package/dist/{chunk-XVNRP7XE.js.map → chunk-YQBBFX7D.js.map} +0 -0
- /package/dist/{cli-AF7636FA.js.map → cli-RJVX6HVT.js.map} +0 -0
- /package/dist/{command-hook-installer-7Q7UD7AU.js.map → command-hook-installer-GMQ4IVDE.js.map} +0 -0
- /package/dist/{history-5WKRWARZ.js.map → history-PP7RHA2V.js.map} +0 -0
- /package/dist/{install-skills-UYAFVJBA.js.map → install-skills-KS6N4U6L.js.map} +0 -0
- /package/dist/{time-actions-XEUQ3UF7.js.map → time-actions-YOXF5WC7.js.map} +0 -0
- /package/dist/{todo-23COLGR2.js.map → todo-TALKJYK6.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/pty/agent-restart.ts","../src/core/sessions/account-switch-rules.ts","../src/core/sessions/account-switch.ts","../src/core/sessions/account-switch-deps.ts"],"sourcesContent":["import fs from 'node:fs';\nimport { findOnPath } from '../platform/find-on-path.js';\nimport type { PtyInfo } from './pty-host-protocol.js';\nimport { LATER_TEXT, restartCountsText } from './restart-view.js';\n\n/**\n * Restarting the agents in the PTY host — after their tool updated (Claude Code\n * replaced its binary; a running Claude keeps the old one until it starts again),\n * or when asked. A restart is its agent stopped and started again in place,\n * resuming its conversation; never in the middle of a turn: a session working or\n * waiting on you restarts when its turn ends.\n */\n\n/** Before this, an mtime isn't when the file was installed: npm unpacks every file dated 1985-10-26. */\nconst PACKED_MTIME_BEFORE = Date.parse('1990-01-01T00:00:00Z');\n\n/**\n * When the file a tool's command runs was installed, following links\n * (`~/.local/bin/claude` → `versions/2.1.296`): the later of its modification time\n * and its creation — an updater that copies the new file keeping its build date\n * still creates it now. A file npm unpacked with its fixed old date, on a system\n * that doesn't record creation, falls back to its change time (the unpacking).\n * Not the change time otherwise: a chmod or a relink moves it, and every running\n * agent would read as outdated. Null when it isn't on PATH.\n */\nexport function installedAt(cmd: string, find: (cmd: string) => string | null = findOnPath): number | null {\n const file = find(cmd);\n if (!file) return null;\n try {\n return installTime(fs.statSync(fs.realpathSync(file)));\n } catch {\n return null;\n }\n}\n\n/** installedAt's rule on a file's times. Pure. */\nexport function installTime(st: { mtimeMs: number; ctimeMs: number; birthtimeMs: number }): number {\n const real = (ms: number) => (ms >= PACKED_MTIME_BEFORE ? ms : null);\n const known = [real(st.mtimeMs), real(st.birthtimeMs)].filter((x): x is number => x !== null);\n return known.length ? Math.max(...known) : st.ctimeMs;\n}\n\n/**\n * `installedAt` per tool, read again only after `ttlMs`: a lookup walks PATH with a\n * stat per folder and extension, synchronously, and the dashboard asks every few\n * minutes per window.\n */\nexport function installedAtCache(ttlMs = 60_000, look: (cmd: string) => number | null = installedAt, now: () => number = Date.now) {\n const cache = new Map<string, { at: number | null; read: number }>();\n return (cmd: string): number | null => {\n const hit = cache.get(cmd);\n if (hit && now() - hit.read < ttlMs) return hit.at;\n const at = look(cmd);\n cache.set(cmd, { at, read: now() });\n return at;\n };\n}\n\n/**\n * The live PTYs whose process started before its tool's file was installed: they\n * run the version from before. A PTY whose tool isn't known (a host from before\n * `tool`) or isn't on PATH is left out: nothing says it's outdated. Pure.\n */\nexport function outdatedPtys(ptys: readonly PtyInfo[], toolInstalledAt: (tool: string) => number | null): PtyInfo[] {\n return ptys.filter((p) => {\n if (p.exited || !p.tool) return false;\n const at = toolInstalledAt(p.tool);\n const started = Date.parse(p.startedAt);\n return at !== null && Number.isFinite(started) && started < at;\n });\n}\n\n/** How recently a terminal printed for its agent to count as at work: a working one redraws its spinner, an idle one prints nothing. */\nexport const PRINTING_MS = 10_000;\n\n/**\n * At work, for a restart: what the agent itself says (Claude Code's own state for its process: mid-turn, or\n * waiting on you; at a permission dialog it prints nothing, so only this tells), or its status (the hooks' as\n * the dashboard reads it, corrected by the transcript and decayed) is working or waiting on you, or its\n * terminal printed in the last few seconds, which catches a turn both missed. An agent that says nothing and\n * has no status (a tool with no hooks or process state) has only the last: one silent at a prompt of its own\n * can't be told from idle. Pure.\n */\nexport function busyForRestart(\n state: 'working' | 'needs_input' | 'idle' | null,\n lastOutputMs: number | null,\n now = Date.now(),\n live: 'busy' | 'idle' | 'waiting' | null = null,\n): boolean {\n if (live === 'busy' || live === 'waiting') return true;\n if (state === 'working' || state === 'needs_input') return true;\n return lastOutputMs !== null && now - lastOutputMs < PRINTING_MS;\n}\n\n/** Which of `ids` restart now and which after their turn (working, or waiting on you). Pure. */\nexport function restartPlan(ids: readonly string[], busy: (id: string) => boolean): { now: string[]; later: string[] } {\n const now: string[] = [];\n const later: string[] = [];\n for (const id of new Set(ids)) (busy(id) ? later : now).push(id);\n return { now, later };\n}\n\n/** Restarts run this many at a time. */\nexport const RESTART_AT_ONCE = 3;\n\nexport interface RestarterDeps {\n /** Restart its agent in place (the host keeps attached terminals); a string: how it went instead (an older host). */\n restart: (id: string) => Promise<string | void>;\n /** Working, or waiting on you: not now. `turnEnded`: its turn just ended (the Stop), so the final message it\n * printed a moment ago isn't work going on. */\n busy: (id: string, opts?: { turnEnded?: boolean }) => boolean;\n /** Its agent runs in the host (a queued one stopped meanwhile needs nothing). */\n running: (id: string) => boolean;\n /** What one request (or one turn's end) decided, at once: one Activity run, not one per session. */\n report?: (notes: RestartNote[]) => void;\n /** When the waiting ones are looked at next (the Activity panel's schedule); null when nothing waits. */\n scheduled?: (nextAt: number | null) => void;\n changed?: () => void;\n /** A look again a little later (default setTimeout, unref'd): a turn-end the status hasn't caught up with yet. */\n later?: (fn: () => void, ms: number) => void;\n /**\n * Something else that restarts its agent anyway is waiting or under way (a switch of account, account-switch.ts): what\n * it is, in a few words; null: nothing. A restart asked for then is folded into it (answered as waiting, never a\n * second restart), and a queued one is dropped when its turn comes.\n */\n foldedInto?: (id: string) => string | null;\n}\n\nexport interface RestartNote {\n id: string;\n text: string;\n level: 'action' | 'info' | 'warn';\n}\n\ntype OneRestart = { ok: true; how: string } | { ok: false; error: string };\n\nexport interface RestartOutcome {\n now: string[];\n later: string[];\n failed: Array<{ id: string; error: string }>;\n}\n\n/** One request's decisions in a line, for its Activity run (restart-view.ts's wording). Pure. */\nexport function restartNotesSummary(notes: readonly RestartNote[]): string {\n const n = (level: RestartNote['level']) => notes.filter((x) => x.level === level).length;\n return restartCountsText({ restarted: n('action'), later: n('info'), failed: n('warn') });\n}\n\n/** While anything waits, how often it is looked at again: a turn whose end no hook reported, or a terminal that was\n * only redrawing (the printing check) — never left for the 5-minute sweep, which `--dev` and lean don't run. */\nexport const QUEUE_RECHECK_MS = 15_000;\n/** After a turn ends, how long before its agent is restarted: the Stop's own hooks (`work hook turn-end`: the\n * checkpoint, the status) run as its children, and stopping it at once would kill them mid-way. */\nexport const TURN_END_GRACE_MS = 10_000;\n\n/**\n * Restarts now what can go now, and the rest when their turn ends (`turnEnded`,\n * from the status hook — and once more a little later, should the status still\n * say working then) or on a later `retry` (a turn whose end no hook reported).\n * One restart per session at a time: asked again meanwhile, it shares that one's\n * outcome.\n */\nexport function createRestarter(deps: RestarterDeps) {\n const queued = new Set<string>();\n const inFlight = new Map<string, Promise<OneRestart>>();\n const later = deps.later ?? ((fn: () => void, ms: number) => void setTimeout(fn, ms).unref?.());\n\n /** Restart one: how it went (a different way, on an older host), or why not. */\n const one = (id: string): Promise<OneRestart> => {\n const running = inFlight.get(id);\n if (running) return running;\n queued.delete(id);\n const p = deps.restart(id).then(\n (how): OneRestart => ({ ok: true, how: how || 'restarted its agent (its conversation goes on)' }),\n (err: Error): OneRestart => ({ ok: false, error: err.message }),\n );\n inFlight.set(id, p);\n void p.finally(() => inFlight.delete(id));\n return p;\n };\n\n /** Restart these, RESTART_AT_ONCE at a time; each waits for its old process to exit. */\n const run = async (ids: string[], notes: RestartNote[]) => {\n const failed: RestartOutcome['failed'] = [];\n const ok = new Set<string>();\n const queue = [...ids];\n const worker = async () => {\n for (let id = queue.shift(); id !== undefined; id = queue.shift()) {\n const r = await one(id);\n if (r.ok) {\n ok.add(id);\n notes.push({ id, text: r.how, level: 'action' });\n } else {\n failed.push({ id, error: r.error });\n notes.push({ id, text: `couldn't restart its agent: ${r.error}`, level: 'warn' });\n }\n }\n };\n await Promise.all(Array.from({ length: Math.min(RESTART_AT_ONCE, queue.length) }, worker));\n return { done: ids.filter((id) => ok.has(id)), failed };\n };\n\n const finish = (notes: RestartNote[]) => {\n if (!notes.length) return;\n deps.report?.(notes);\n deps.changed?.();\n };\n\n /** Restart these (the caller found them running in the host: its list is fresh, `running` is a cache). */\n const request = async (ids: readonly string[]): Promise<RestartOutcome> => {\n const notes: RestartNote[] = [];\n const folded: string[] = [];\n for (const id of ids) {\n const into = deps.foldedInto?.(id);\n if (!into) continue;\n folded.push(id);\n notes.push({ id, text: `restarts with ${into} (no second restart)`, level: 'info' });\n }\n const plan = restartPlan(\n ids.filter((id) => !folded.includes(id)),\n (id) => deps.busy(id),\n );\n for (const id of plan.later) {\n queued.add(id);\n notes.push({ id, text: `${LATER_TEXT} (it is working or waiting on you)`, level: 'info' });\n }\n const { done, failed } = await run(plan.now, notes);\n finish(notes);\n tick();\n return { now: done, later: [...folded, ...plan.later], failed };\n };\n\n // While anything waits, it is looked at again every QUEUE_RECHECK_MS.\n let ticking = false;\n const tick = () => {\n if (ticking) return;\n if (queued.size === 0) {\n deps.scheduled?.(null);\n return;\n }\n ticking = true;\n deps.scheduled?.(Date.now() + QUEUE_RECHECK_MS);\n later(() => {\n ticking = false;\n void retry()\n .catch(() => {})\n .finally(tick);\n }, QUEUE_RECHECK_MS);\n };\n\n /** Restart the queued ones (or `only`) that can go now; a queued one stopped meanwhile is dropped. */\n const retry = async (only?: string, opts?: { turnEnded?: boolean }): Promise<void> => {\n const notes: RestartNote[] = [];\n const ready: string[] = [];\n for (const id of [...queued]) {\n if (only !== undefined && id !== only) continue;\n if (!deps.running(id)) {\n queued.delete(id);\n notes.push({ id, text: 'no longer waits to restart: it was stopped meanwhile (it starts on the new version)', level: 'info' });\n continue;\n }\n const into = deps.foldedInto?.(id);\n if (into) {\n queued.delete(id);\n notes.push({ id, text: `no longer waits to restart: ${into} restarts it`, level: 'info' });\n continue;\n }\n if (!deps.busy(id, opts)) ready.push(id);\n }\n await run(ready, notes);\n finish(notes);\n };\n\n return {\n request,\n retry: () => retry(),\n /** A session's turn ended: restart it if it was waiting for that — and if it still reads as busy, look again shortly. */\n turnEnded: (id: string): void => {\n if (!queued.has(id)) return;\n later(() => void retry(id, { turnEnded: true }).catch(() => {}), TURN_END_GRACE_MS);\n },\n queued: (): string[] => [...queued],\n /** Take one off the queue (it no longer waits for its turn); false when it wasn't waiting (not queued, or running now). */\n cancel: (id: string): boolean => {\n if (!queued.delete(id)) return false;\n if (queued.size === 0) deps.scheduled?.(null);\n deps.changed?.();\n return true;\n },\n /** Being restarted now (the host lists them as exited meanwhile: still this session's). */\n restarting: (): string[] => [...inFlight.keys()],\n };\n}\n\nexport type Restarter = ReturnType<typeof createRestarter>;\n","/**\n * When a switch of account is refused before anything is stopped or moved — the rules the real switch\n * (account-switch.ts) and the demo's (server/demo/demo-accounts.ts) share. Pure: no imports.\n */\n\n/** An account as the rules see it (agents/types.ts `AccountInfo`; the wire's `AccountWire`). */\nexport interface SwitchAccountInfo {\n name: string;\n /** Logged in; null: can't tell (macOS keeps Claude's credentials in the keychain) — allowed. */\n loggedIn: boolean | null;\n}\n\nexport interface SwitchFacts {\n /** Archived, or being archived right now. */\n archived: boolean;\n /** Its agent's accounts and the one it is on; null: its agent has none. */\n accounts: { list: readonly SwitchAccountInfo[]; current: string } | null;\n /** Where a switch already waiting for its turn (or being done now) goes; null: none. */\n pendingTo: string | null;\n /** Its agent runs in the PTY host (a switch can stop and start it there). */\n inHost: boolean;\n /** Its agent runs in a terminal outside work. */\n runningOutside: boolean;\n}\n\nexport type SwitchRefusal = { status: 400 | 409; error: string };\n\n/** Why the session can't be moved to `to` (status and reason), or null. In the order the user is told them. */\nexport function switchRefusal(to: string, f: SwitchFacts): SwitchRefusal | null {\n if (f.archived) return { status: 409, error: 'it is archived: restore it first' };\n if (!f.accounts) return { status: 409, error: \"its agent doesn't have accounts\" };\n const target = f.accounts.list.find((a) => a.name === to);\n if (!target) return { status: 400, error: `no account “${to}” (see \\`work account list\\`)` };\n if (target.loggedIn === false)\n return { status: 409, error: `nobody is logged in on “${to}”: run \\`work account add ${to}\\` again to log in, or /login on it` };\n if (f.pendingTo !== null)\n return { status: 409, error: `a switch is already waiting for its turn to end (to ${f.pendingTo || 'another account'})` };\n if (f.accounts.current === to) return { status: 409, error: `it already runs on “${to}”` };\n if (!f.inHost && f.runningOutside)\n return {\n status: 409,\n error: 'its Claude runs in a terminal outside work: stop it there first (its conversation would be moved from under it)',\n };\n return null;\n}\n","import type { AccountInfo } from '../agents/types.js';\nimport { createRestarter, type Restarter } from '../pty/agent-restart.js';\nimport type { WorktreeSession } from './session-types.js';\nimport type { ActivityLog } from '../platform/activity.js';\nimport { switchRefusal } from './account-switch-rules.js';\n\n/**\n * Moving a session to another account of its agent (Claude: another login, for when the first one's limit runs out).\n * The policy is here; I/O is passed in (account-routes.ts and web-server.ts give the real one, tests a fake).\n *\n * Refused: an unknown or archived session, an agent with no accounts, an unknown account, one nobody is logged in to, the\n * account it is on, a Claude running in a terminal outside work (a switch can't stop it), one switch already waiting.\n *\n * Not running in the PTY host: its conversations move and the account is recorded — the next start uses it. Running and\n * idle: its Claude is halted in the host (stopped, its terminals kept), the conversations move, the account is recorded, and it\n * is resumed in place on the new account — in that order, so nothing writes into the old folder while it moves. Working, or waiting\n * on you: after its turn — through the agent restarter's queue (agent-restart.ts), so the rule for \"not mid-turn\" is the\n * restart's own, with a switch as the thing that runs when its turn ends.\n */\n\nexport interface AccountSwitchDeps {\n session: (id: string) => WorktreeSession | null;\n /** Being archived right now (its Claude was stopped on purpose, and mustn't be started again). */\n beingArchived: (id: string) => boolean;\n /** Its agent's accounts; null: its agent has none. */\n accounts: (session: WorktreeSession) => { list: AccountInfo[]; current: string } | null;\n /** Move its conversations to `to`'s folders (puts back what it moved when it fails, and throws). */\n switchFiles: (session: WorktreeSession, to: string) => Promise<{ moved: string[] }>;\n /** Record the account on the session, in one transaction. */\n record: (session: WorktreeSession, to: string) => Promise<void>;\n /** Its Claude runs in the PTY host. */\n hostRuns: (id: string) => boolean;\n /** Its Claude runs in a terminal outside work. */\n runningOutside: (id: string) => boolean;\n /** A folder whose conversations the switch would move where another agent (of any account, not this session's own in\n * the host) runs now — its files would move from under it; null: none. */\n othersRunningIn?: (session: WorktreeSession, id: string) => string | null;\n /** Why the PTY host can't run it on another account (one from before accounts), or null. Asked before anything stops. */\n hostRefusal?: () => Promise<string | null>;\n /** Working, or waiting on you (`turnEnded`: its turn just ended, so what it printed a moment ago isn't work going on). */\n busy: (id: string, opts?: { turnEnded?: boolean }) => boolean;\n /** Stop its Claude in the host and keep its session (terminals attached) until `resume`: the files move only after it is stopped.\n * `stopped`: an older host stopped it the old way; `gone`: nothing was running. */\n halt: (id: string) => Promise<'halted' | 'stopped' | 'gone'>;\n /** Start it again after `halt`, on the account the session records now (so the old one after a switch that failed): in place\n * when it was `halted` (its terminals carry on), from a fresh spec when `stopped` (an older host). A string: how it went instead. */\n resume: (id: string, how: 'halted' | 'stopped') => Promise<string | void>;\n /** One line of what a switch decided, for the Activity panel. */\n note?: (id: string, text: string, level: 'action' | 'info' | 'warn') => void;\n changed?: () => void;\n scheduled?: (nextAt: number | null) => void;\n /** A look again a little later (the restarter's own default: setTimeout). */\n later?: (fn: () => void, ms: number) => void;\n /** Drop an agent restart waiting for its turn (agent-restart.ts): the switch restarts it anyway. True when one was waiting. */\n cancelRestart?: (id: string) => boolean;\n}\n\nexport type SwitchOutcome = 'switched' | 'queued' | 'recorded';\n\nexport type SwitchResult =\n { ok: true; outcome: SwitchOutcome; moved?: number } | { ok: false; status: 400 | 404 | 409 | 502; error: string };\n\nconst msg = (err: unknown) => (err instanceof Error ? err.message : String(err));\n\nexport function createAccountSwitcher(deps: AccountSwitchDeps) {\n /** Where each waiting (or running) switch goes. */\n const targets = new Map<string, string>();\n /** How many entries each finished switch moved, for the answer. */\n const movedBy = new Map<string, number>();\n\n const name = (s: WorktreeSession) => `${s.target} ${s.branch}`;\n\n /** Move the files and record the account; a failed record puts the files back. Returns how many entries moved. */\n const moveAndRecord = async (s: WorktreeSession, to: string, from: string): Promise<number> => {\n const { moved } = await deps.switchFiles(s, to);\n try {\n await deps.record(s, to);\n } catch (err) {\n // The files are in the new account's folders and the session still says the old one: back, or its --continue finds\n // nothing. A move back that fails is said with the error (its message names what is stuck where).\n const back = await deps.switchFiles({ ...s, account: to }, from).then(\n () => '',\n (e2: unknown) => `; and its conversations couldn't all be moved back: ${msg(e2)}`,\n );\n throw new Error(`${msg(err)}${back}`, { cause: err });\n }\n return moved.length;\n };\n\n /** What the restarter runs for a session (at once when idle, after its turn when not): the move, the record, the restart. */\n const perform = async (id: string): Promise<string | void> => {\n const to = targets.get(id);\n const s = deps.session(id);\n try {\n if (!to || !s) throw new Error('the session is gone');\n if (s.archivedAt || deps.beingArchived(id)) throw new Error('it was archived meanwhile');\n const acc = deps.accounts(s);\n if (!acc) throw new Error('its agent has no accounts');\n const from = acc.current;\n if (from === to) return `already on ${to}`;\n const before = await refusalBeforeStop(s, id);\n if (before) throw new Error(`stays on ${from}: ${before}`);\n // A restart of its agent that waited for this turn too would stop it a second time: the switch's restart does its job.\n if (deps.cancelRestart?.(id)) deps.note?.(id, 'its agent restart that waited for this turn is done by the switch instead', 'info');\n // Stopped first: a running (or just exiting) Claude writes to its transcript, and on Windows holds the file.\n let halted: 'halted' | 'stopped' | null = null;\n if (deps.hostRuns(id)) {\n let h: 'halted' | 'stopped' | 'gone';\n try {\n h = await deps.halt(id);\n } catch (err) {\n throw new Error(`stays on ${from}: couldn't stop its Claude: ${msg(err)}`, { cause: err });\n }\n if (h !== 'gone') halted = h;\n }\n /** Start it again on the account the session records (still the old one until the record is made). */\n const resume = async (): Promise<string | void> => (halted ? deps.resume(id, halted) : undefined);\n let moved: number;\n try {\n moved = await moveAndRecord(s, to, from);\n } catch (err) {\n // Put back (the move rolled itself back, a failed record moved the files back): it goes on running on the account it has.\n const back = await resume().then(\n () => '',\n (e2: unknown) => ` (and couldn't start its Claude again: ${msg(e2)}; opening the session starts it)`,\n );\n throw new Error(`stays on ${from}: ${msg(err)}${back}`, { cause: err });\n }\n movedBy.set(id, moved);\n if (!halted) {\n deps.note?.(id, `moved to the ${to} account (${moved} entries moved; its next start uses it)`, 'action');\n return `moved to the ${to} account`;\n }\n try {\n const how = await resume();\n deps.note?.(id, `moved to the ${to} account: its Claude restarted on it${how ? ` (${how})` : ''}`, 'action');\n return how || `moved to the ${to} account: its Claude restarted on it`;\n } catch (err) {\n // The account is recorded and the files are there: opening the session starts it on the new one.\n const why = `moved to the ${to} account, but its Claude couldn't be restarted: ${msg(err)} (opening the session starts it on ${to})`;\n deps.note?.(id, why, 'warn');\n throw new Error(why, { cause: err });\n }\n } catch (err) {\n if (s && !String(msg(err)).startsWith('moved to')) deps.note?.(id, `couldn't switch: ${msg(err)}`, 'warn');\n throw err;\n } finally {\n targets.delete(id);\n }\n };\n\n const restarter: Restarter = createRestarter({\n restart: perform,\n busy: deps.busy,\n // A queued switch is never dropped as \"stopped meanwhile\": perform handles a Claude no longer running (it records the account).\n running: () => true,\n changed: deps.changed,\n scheduled: deps.scheduled,\n later: deps.later,\n });\n\n /** What stops a switch before anything is stopped or moved: an older PTY host, another Claude in one of its folders. */\n const refusalBeforeStop = async (s: WorktreeSession, id: string): Promise<string | null> => {\n const other = deps.othersRunningIn?.(s, id);\n if (other) return `a Claude outside this session runs in ${other}`;\n return deps.hostRuns(id) ? ((await deps.hostRefusal?.()) ?? null) : null;\n };\n\n const pending = (id: string) => restarter.queued().includes(id) || restarter.restarting().includes(id);\n\n async function switchAccount(id: string, to: string): Promise<SwitchResult> {\n const s = deps.session(id);\n if (!s) return { ok: false, status: 404, error: 'unknown session' };\n const acc = deps.accounts(s);\n const inHost = deps.hostRuns(id);\n const refused = switchRefusal(to, {\n archived: !!s.archivedAt || deps.beingArchived(id),\n accounts: acc,\n pendingTo: pending(id) ? (targets.get(id) ?? '') : null,\n inHost,\n runningOutside: !inHost && deps.runningOutside(id),\n });\n if (refused) return { ok: false, ...refused };\n if (!acc) return { ok: false, status: 409, error: \"its agent doesn't have accounts\" }; // (refused above: for the type)\n\n const before = await refusalBeforeStop(s, id);\n if (before) return { ok: false, status: 409, error: `stays on ${acc.current}: ${before}` };\n\n if (!inHost) {\n // Nothing to stop: the files move and the account is recorded; the next start uses it.\n try {\n const moved = await moveAndRecord(s, to, acc.current);\n deps.note?.(id, `${name(s)}: moved to the ${to} account (${moved} entries moved; its next start uses it)`, 'action');\n deps.changed?.();\n return { ok: true, outcome: 'recorded', moved };\n } catch (err) {\n deps.note?.(id, `couldn't switch: ${msg(err)}`, 'warn');\n return { ok: false, status: 502, error: `stays on ${acc.current}: ${msg(err)}` };\n }\n }\n\n targets.set(id, to);\n movedBy.delete(id);\n const r = await restarter.request([id]);\n if (r.later.includes(id)) {\n deps.note?.(id, `will move to the ${to} account when its turn ends (it is working or waiting on you)`, 'info');\n return { ok: true, outcome: 'queued' };\n }\n const failed = r.failed.find((f) => f.id === id);\n if (failed) return { ok: false, status: 502, error: failed.error };\n return { ok: true, outcome: 'switched', moved: movedBy.get(id) };\n }\n\n return {\n switchAccount,\n /** Its turn ended: do the switch that waited for it. */\n turnEnded: (id: string) => restarter.turnEnded(id),\n /** Do the waiting switches that can go now (a turn whose end no hook reported). */\n retry: () => restarter.retry(),\n /** Sessions waiting for their turn to end, and where each goes. */\n waiting: (): Array<{ id: string; to: string }> => restarter.queued().map((id) => ({ id, to: targets.get(id) ?? '' })),\n /** The account a switch waiting for its turn, or being done now, moves it to; null: none. Either way its agent restarts. */\n restartsAnyway: (id: string): string | null => (pending(id) ? (targets.get(id) ?? '') : null),\n /** The account a session is waiting to move to (its turn first), or null. Kept in memory: a work web restart drops it. */\n pendingFor: (id: string): string | null => (restarter.queued().includes(id) ? (targets.get(id) ?? null) : null),\n /**\n * Drop the switch waiting for its turn to end. `running`: it is being done right now (too late to cancel); `none`:\n * nothing waits for it.\n */\n cancel: (id: string): 'cancelled' | 'running' | 'none' => {\n if (restarter.restarting().includes(id)) return 'running';\n const to = targets.get(id);\n if (!restarter.cancel(id)) return 'none';\n targets.delete(id);\n deps.note?.(id, `no longer moves to the ${to ?? 'other'} account: the switch was cancelled`, 'info');\n return 'cancelled';\n },\n };\n}\n\nexport type AccountSwitcher = ReturnType<typeof createAccountSwitcher>;\n\n/**\n * The switcher's `note` as Activity runs: one run per note, a failure (`warn`) failing it — so a switch that waited for its\n * turn and then couldn't be done lights the Activity dot, rather than passing as a run that went fine.\n */\nexport function accountSwitchNote(\n activity: Pick<ActivityLog, 'start'>,\n label: (id: string) => string | null,\n): NonNullable<AccountSwitchDeps['note']> {\n return (id, text, level) => {\n const name = label(id);\n const run = activity.start('accounts', 'Switching a Claude account');\n run.note(`${name ?? id}: ${text}`, { level, sessionId: name ? id : undefined });\n if (level === 'warn') run.fail(text);\n else run.done(text);\n };\n}\n","import path from 'node:path';\nimport { agentOf, liveAgents } from '../agents/index.js';\nimport { isArchiving } from '../archive/archiving.js';\nimport { accountSwitchRefusal, peekPty, ptyPid, ptyPids, haltPty, resumePtyOnAccount } from '../pty/pty-pool.js';\nimport type { AccountSwitchDeps } from './account-switch.js';\nimport { loadHistory, setSessionAccount } from './history.js';\nimport { agentsBySession } from './live-agents.js';\nimport { findSession } from './web-state.js';\n\n/** The real inputs of createAccountSwitcher (account-switch.ts); work web gives `busy`, the Activity notes and the broadcast. */\nexport function defaultAccountSwitchDeps(opts: Pick<AccountSwitchDeps, 'busy'> & Partial<AccountSwitchDeps>): AccountSwitchDeps {\n return {\n session: findSession,\n beingArchived: isArchiving,\n accounts: (s) => {\n const accounts = agentOf(s).accounts;\n return accounts ? { list: accounts.list(), current: accounts.current(s) } : null;\n },\n switchFiles: (s, to) => {\n const accounts = agentOf(s).accounts;\n if (!accounts) throw new Error('its agent has no accounts');\n return accounts.switchFiles(s, to);\n },\n record: async (s, to) => {\n if (!(await setSessionAccount(s.target, s.branch, to))) throw new Error('unknown session');\n },\n hostRuns: peekPty,\n // Claude Code's process files say one runs for it that isn't the host's (terminal-ws.ts, session-control-routes.ts).\n runningOutside: (id) => {\n const hostPids = ptyPids();\n return (agentsBySession(liveAgents(), loadHistory()).get(id) ?? []).some((c) => !hostPids.has(c.pid));\n },\n othersRunningIn: (s, id) => {\n const folders = agentOf(s).accounts?.folders(s) ?? [];\n if (!folders.length) return null;\n const own = ptyPid(id);\n const key = (p: string) => {\n const r = path.resolve(p).replace(/[\\\\/]+$/, '');\n return process.platform === 'win32' ? r.toLowerCase() : r;\n };\n const wanted = new Map(folders.map((f) => [key(f), f]));\n const other = liveAgents().find((a) => a.pid !== own && wanted.has(key(a.cwd)));\n return other ? (wanted.get(key(other.cwd)) ?? other.cwd) : null;\n },\n hostRefusal: accountSwitchRefusal,\n halt: haltPty,\n resume: resumePtyOnAccount,\n ...opts,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ;AAcf,IAAM,sBAAsB,KAAK,MAAM,sBAAsB;AAWtD,SAAS,YAAY,KAAa,OAAuC,YAA2B;AACzG,QAAM,OAAO,KAAK,GAAG;AACrB,MAAI,CAAC,KAAM,QAAO;AAClB,MAAI;AACF,WAAO,YAAY,GAAG,SAAS,GAAG,aAAa,IAAI,CAAC,CAAC;AAAA,EACvD,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGO,SAAS,YAAY,IAAuE;AACjG,QAAM,OAAO,CAAC,OAAgB,MAAM,sBAAsB,KAAK;AAC/D,QAAM,QAAQ,CAAC,KAAK,GAAG,OAAO,GAAG,KAAK,GAAG,WAAW,CAAC,EAAE,OAAO,CAAC,MAAmB,MAAM,IAAI;AAC5F,SAAO,MAAM,SAAS,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG;AAChD;AAOO,SAAS,iBAAiB,QAAQ,KAAQ,OAAuC,aAAa,MAAoB,KAAK,KAAK;AACjI,QAAM,QAAQ,oBAAI,IAAiD;AACnE,SAAO,CAAC,QAA+B;AACrC,UAAM,MAAM,MAAM,IAAI,GAAG;AACzB,QAAI,OAAO,IAAI,IAAI,IAAI,OAAO,MAAO,QAAO,IAAI;AAChD,UAAM,KAAK,KAAK,GAAG;AACnB,UAAM,IAAI,KAAK,EAAE,IAA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AAiB,CAAC,GAAG,OAAO;AAC1B,YAAM,UAAU,QAAQ,CAAC,EAAE,UAAU,QAAQ,CAAC,KAAK,CAAC;AACpD,UAAI,CAAC,QAAQ,OAAQ,QAAO;AAC5B,YAAM,MAAM,OAAO,EAAE;AACrB,YAAM,MAAM,CAAC,MAAc;AACzB,cAAM,IAAI,KAAK,QAAQ,CAAC,EAAE,QAAQ,WAAW,EAAE;AAC/C,eAAO,QAAQ,aAAa,UAAU,EAAE,YAAY,IAAI;AAAA,MAC1D;AACA,YAAM,SAAS,IAAI,IAAI,QAAQ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACtD,YAAM,QAAQ,WAAW,EAAE,KAAK,CAAC,MAAM,EAAE,QAAQ,OAAO,OAAO,IAAI,IAAI,EAAE,GAAG,CAAC,CAAC;AAC9E,aAAO,QAAS,OAAO,IAAI,IAAI,MAAM,GAAG,CAAC,KAAK,MAAM,MAAO;AAAA,IAC7D;AAAA,IACA,aAAa;AAAA,IACb,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,GAAG;AAAA,EACL;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/archive/restore-leftovers.ts","../src/core/pr/pr-ref.ts","../src/core/pr/pr-start.ts"],"sourcesContent":["import { isLeftover } from '../worktree/leftover.js';\nimport { describeProcess, findHolders, normDir, stopRunningFrom, type Holders } from '../platform/running-from.js';\n\n/**\n * Before a Restore makes a worktree again over what git left of it (a folder\n * it removed only in part, leftover.ts): that folder has to be moved out of\n * the way, and can't be while something runs from it — a dev server its\n * Claude left running. One place for both front-ends: the dashboard's\n * Restore (which asks \"Stop it and restore?\") and `work tree` (which says\n * what to stop).\n */\n\nexport interface LeftoverIo {\n /** What runs from or names the folders (running-from.ts). */\n holders?: (dirs: string[]) => Promise<Holders>;\n /** Stop what runs from them, saying what. */\n stop?: (dirs: string[]) => Promise<string[]>;\n}\n\n/** The session's folders git removed only in part. */\nexport function leftoversOf(paths: string[]): string[] {\n return paths.filter((p) => isLeftover(p));\n}\n\nconst names = (procs: Holders['stoppable'], dirs: string[]) =>\n procs.map((p) =>\n describeProcess(\n p,\n dirs.map((d) => normDir(d)),\n ),\n );\n\n/** What runs from the leftovers, and what has them open: one look at the processes (null: no answer). */\nexport async function lookAtLeftovers(leftovers: string[], io: LeftoverIo = {}): Promise<{ running: string[]; open: string[] } | null> {\n if (leftovers.length === 0) return { running: [], open: [] };\n const h = await (io.holders ?? ((d: string[]) => findHolders(d)))(leftovers).catch(() => null);\n if (!h) return null;\n const running = names(h.stoppable, leftovers);\n return { running, open: [...running, ...names(h.others, leftovers)] };\n}\n\n/** What runs from the leftovers now (\"node …\\vite\\bin\\vite.js --mode demo (PID 35464)\"): none to wait for, []. */\nexport async function runningFromLeftovers(leftovers: string[], io: LeftoverIo = {}): Promise<string[]> {\n return (await lookAtLeftovers(leftovers, io))?.running ?? [];\n}\n\n/** Stop what runs from the leftovers (asked for), saying what. */\nexport async function freeLeftovers(leftovers: string[], io: LeftoverIo = {}): Promise<string[]> {\n if (leftovers.length === 0) return [];\n return (io.stop ?? ((d: string[]) => stopRunningFrom(d)))(leftovers).catch(() => []);\n}\n\n/** Everything that has the leftovers open — what runs from them and what only names them (an editor) — for a failure's message. */\nexport async function openInLeftovers(leftovers: string[], io: LeftoverIo = {}): Promise<string[]> {\n return (await lookAtLeftovers(leftovers, io))?.open ?? [];\n}\n","/**\n * Starting a session on someone else's pull request — on their branch, so\n * what you push lands in their PR. Pure (the SPA and the demo use it): how a\n * PR is named, and what its session's Claude is told first. The lookup\n * (`gh pr view`) is `pr-start.ts`.\n */\n\nimport type { PrToStart } from '../api-types.js';\n\nexport type { PrToStart };\n\n/** A PR as you'd name it: its link (repo known), or its number (in a repo you pick). */\nexport interface PrRef {\n /** `owner/name`, lowercase, from a link. */\n repo?: string;\n number: number;\n}\n\n/** A PR link (`https://github.com/owner/repo/pull/123`, any tail), `#123` or `123`; null for anything else. */\nexport function parsePrRef(input: string): PrRef | null {\n const s = input.trim();\n const url = /^(?:https?:\\/\\/)?(?:www\\.)?github\\.com\\/([^/\\s]+)\\/([^/\\s]+)\\/pull\\/(\\d+)(?:[/?#].*)?$/i.exec(s);\n if (url) return { repo: `${url[1]}/${url[2]}`.toLowerCase(), number: Number(url[3]) };\n const n = /^#?(\\d+)$/.exec(s);\n return n && Number(n[1]) > 0 ? { number: Number(n[1]) } : null;\n}\n\n/**\n * The first message to the session's Claude: whose PR this is, that what it\n * pushes lands there, and to get up to speed — then do `instruction`, or\n * with none, say where it stands and wait for what the user wants. Nothing\n * on GitHub (no comments, reviews or replies): that's the author's\n * conversation.\n */\nexport function workOnPrPrompt(pr: Pick<PrToStart, 'number' | 'title' | 'url'> & { author?: string }, instruction?: string): string {\n const who = pr.author ? `@${pr.author}` : 'its author';\n const todo = instruction?.trim();\n const upToSpeed = `Get up to speed first (gh pr view ${pr.number}, gh pr diff ${pr.number})`;\n return [\n `Work on PR #${pr.number} by ${who}: ${pr.title}`,\n pr.url,\n '',\n `This worktree is on ${who}'s branch: what you commit and push lands in their PR.`,\n ...(todo ? [`${upToSpeed}, then:`, '', todo, ''] : [`${upToSpeed}, tell me where it stands, and wait for what I want done.`]),\n \"Don't post on GitHub (no comments, reviews or replies).\",\n ].join('\\n');\n}\n","import type { WorkConfig } from '../platform/config.js';\nimport { githubRepoOf } from './pr.js';\nimport { readGitConfig } from '../worktree/repo-scan.js';\nimport { parsePrRef, type PrToStart } from './pr-ref.js';\nimport { defaultRunner, type CommandRunner } from './ship.js';\n\nexport type PrStartResult = { ok: true; pr: PrToStart } | { ok: false; error: string };\n\nexport interface PrStartDeps {\n run?: CommandRunner;\n /** A repo's `.git/config` text (tests pass their own). */\n gitConfig?: (repoPath: string) => string | null;\n}\n\n/** The fields of `gh pr view --json …` this reads; all optional — it is someone else's output. */\ninterface GhPrView {\n number?: number;\n title?: string;\n url?: string;\n headRefName?: string;\n headRefOid?: string;\n baseRefName?: string;\n state?: string;\n isCrossRepository?: boolean;\n author?: { login?: string } | null;\n headRepositoryOwner?: { login?: string } | null;\n}\n\n/**\n * Which of your repos a PR is in, and its branch: from its link (the repo\n * matched by its origin) or its number (in `target`, a repo). Refused: a\n * repo you haven't enrolled, a group as the repo of a bare number, a PR\n * that isn't open, and one from a fork — its branch isn't on origin, so the\n * session couldn't push to it (and `work tree` would make a new, empty\n * branch of that name instead).\n */\nexport async function resolvePrToStart(\n input: string,\n config: Pick<WorkConfig, 'repos' | 'groups'>,\n target?: string,\n deps: PrStartDeps = {},\n): Promise<PrStartResult> {\n const run = deps.run ?? defaultRunner;\n const gitConfig = deps.gitConfig ?? readGitConfig;\n const ref = parsePrRef(input);\n if (!ref) return { ok: false, error: 'Give a pull request link (https://github.com/owner/repo/pull/123), or its number with a repo.' };\n\n const repoOf = (alias: string) => githubRepoOf(gitConfig(config.repos[alias]) ?? '');\n let alias: string | undefined;\n if (ref.repo) {\n const matches = Object.keys(config.repos).filter((a) => repoOf(a) === ref.repo);\n if (!matches.length) return { ok: false, error: `${ref.repo} isn't one of your repos: add it first (work config add <alias> <path>).` };\n // A target named beside a link must hold it: the repo itself, or a group with it among its repos.\n const within = target ? (config.groups?.[target] ?? [target]) : matches;\n alias = matches.find((a) => within.includes(a));\n if (!alias) return { ok: false, error: `PR #${ref.number} is in ${matches.join(' / ')} (${ref.repo}), not ${target}.` };\n } else {\n if (!target) return { ok: false, error: `PR #${ref.number}: which repo? Give its link, or pick the repo.` };\n if (config.groups?.[target])\n return { ok: false, error: `${target} is a group: a PR is one repo's. Give its link, or one of the group's repos.` };\n if (!config.repos[target]) return { ok: false, error: `${target} isn't one of your repos.` };\n alias = target;\n }\n const github = repoOf(alias);\n if (!github) return { ok: false, error: `${alias} isn't on github.com: work can only look up GitHub PRs.` };\n\n const view = await run(\n 'gh',\n [\n 'pr',\n 'view',\n String(ref.number),\n '--repo',\n github,\n '--json',\n 'number,title,url,headRefName,headRefOid,baseRefName,state,isCrossRepository,author,headRepositoryOwner',\n ],\n config.repos[alias],\n );\n if (view.code === 127) return { ok: false, error: 'GitHub CLI (gh) not found: install it to start from a PR.' };\n if (view.code !== 0)\n return { ok: false, error: `PR #${ref.number} in ${github}: ${view.stderr.trim().split('\\n')[0] || 'gh pr view failed'}` };\n let pr: GhPrView;\n try {\n pr = JSON.parse(view.stdout) as GhPrView;\n } catch {\n return { ok: false, error: \"Couldn't read what gh said about the PR.\" };\n }\n if (pr.state && pr.state !== 'OPEN') return { ok: false, error: `PR #${ref.number} is ${pr.state.toLowerCase()}.` };\n if (pr.isCrossRepository) {\n const owner = pr.headRepositoryOwner?.login ?? 'a fork';\n return {\n ok: false,\n error: `PR #${ref.number} comes from a fork (${owner}): its branch isn't on origin, so a session couldn't push to it.`,\n };\n }\n if (!pr.headRefName) return { ok: false, error: `PR #${ref.number}: gh didn't say its branch.` };\n const stale = await localGoneOtherWay(run, config.repos[alias], pr.headRefName, pr.headRefOid);\n if (stale) return { ok: false, error: stale };\n return {\n ok: true,\n pr: {\n alias,\n number: pr.number ?? ref.number,\n title: pr.title ?? '',\n url: pr.url ?? '',\n branch: pr.headRefName,\n base: pr.baseRefName ?? '',\n author: (pr.author?.login ?? '').replace(/^app\\//, ''),\n },\n };\n}\n\n/**\n * `work tree` takes a local branch of that name over origin's, moving it\n * forward when it can. One that has gone another way than the PR (the author\n * force-pushed, or an unrelated branch of the same name) would open on the\n * wrong commits, and what's pushed from it wouldn't go. Ahead (your commits\n * on top) or behind (it fast-forwards) is fine; when git can't tell (no\n * fetch), the usual warning on entering is left to say it.\n */\nasync function localGoneOtherWay(run: CommandRunner, repoPath: string, branch: string, headOid?: string): Promise<string | null> {\n if (!headOid) return null;\n const local = await run('git', ['rev-parse', '--verify', '--quiet', `refs/heads/${branch}`], repoPath);\n if (local.code !== 0) return null;\n await run('git', ['fetch', '--quiet', 'origin', branch], repoPath);\n const contains = await run('git', ['merge-base', '--is-ancestor', headOid, `refs/heads/${branch}`], repoPath);\n if (contains.code === 0) return null;\n const behind = await run('git', ['merge-base', '--is-ancestor', `refs/heads/${branch}`, headOid], repoPath);\n if (behind.code !== 1 || contains.code !== 1) return null; // 1 = not an ancestor; anything else: git couldn't say\n return `Your local branch ${branch} and the PR's have gone separate ways (a force-push, or another branch of that name): rename yours (git branch -m ${branch} ${branch}-old) and try again, or go into its session as it is (work tree <repo> ${branch}).`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoBO,SAAS,YAAY,OAA2B;AACrD,SAAO,MAAM,OAAO,CAAC,MAAM,WAAW,CAAC,CAAC;AAC1C;AAEA,IAAM,QAAQ,CAAC,OAA6B,SAC1C,MAAM;AAAA,EAAI,CAAC,MACT;AAAA,IACE;AAAA,IACA,KAAK,IAAI,CAAC,MAAM,QAAQ,CAAC,CAAC;AAAA,EAC5B;AACF;AAGF,eAAsB,gBAAgB,WAAqB,KAAiB,CAAC,GAA0D;AACrI,MAAI,UAAU,WAAW,EAAG,QAAO,EAAE,SAAS,CAAC,GAAG,MAAM,CAAC,EAAE;AAC3D,QAAM,IAAI,OAAO,GAAG,YAAY,CAAC,MAAgB,YAAY,CAAC,IAAI,SAAS,EAAE,MAAM,MAAM,IAAI;AAC7F,MAAI,CAAC,EAAG,QAAO;AACf,QAAM,UAAU,MAAM,EAAE,WAAW,SAAS;AAC5C,SAAO,EAAE,SAAS,MAAM,CAAC,GAAG,SAAS,GAAG,MAAM,EAAE,QAAQ,SAAS,CAAC,EAAE;AACtE;AAQA,eAAsB,cAAc,WAAqB,KAAiB,CAAC,GAAsB;AAC/F,MAAI,UAAU,WAAW,EAAG,QAAO,CAAC;AACpC,UAAQ,GAAG,SAAS,CAAC,MAAgB,gBAAgB,CAAC,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC,CAAC;AACrF;AAGA,eAAsB,gBAAgB,WAAqB,KAAiB,CAAC,GAAsB;AACjG,UAAQ,MAAM,gBAAgB,WAAW,EAAE,IAAI,QAAQ,CAAC;AAC1D;;;ACpCO,S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,WAAW,MAAM,IAAI,OAAO,CAAC,cAAc,iBAAiB,SAAS,cAAc,MAAM,EAAE,GAAG,QAAQ;AAC5G,MAAI,SAAS,SAAS,EAAG,QAAO;AAChC,QAAM,SAAS,MAAM,IAAI,OAAO,CAAC,cAAc,iBAAiB,cAAc,MAAM,IAAI,OAAO,GAAG,QAAQ;AAC1G,MAAI,OAAO,SAAS,KAAK,SAAS,SAAS,EAAG,QAAO;AACrD,SAAO,qBAAqB,MAAM,qHAAqH,MAAM,IAAI,MAAM,0EAA0E,MAAM;AACzP;","names":["alias"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/cleanup/build-folders-scan.ts","../src/core/cleanup/build-folders-deps.ts","../src/core/cleanup/branch-tidy.ts","../src/core/cleanup/branch-tidy-deps.ts"],"sourcesContent":["import fs from 'node:fs';\nimport { buildFoldersOf, clearBuildFolders } from './build-folders.js';\nimport type { BuildFolder, BuildFolderCandidate, BuildFoldersApplyResult, BuildFoldersState } from '../api-types.js';\nimport type { CommandRunner } from '../pr/ship.js';\nimport type { ActivityLog } from '../platform/activity.js';\n\n/** Sessions idle at least this long are offered (a week). */\nexport const BUILD_FOLDERS_IDLE_MS = 7 * 24 * 60 * 60 * 1000;\n\nexport interface BuildFolderSession {\n id: string;\n target: string;\n branch: string;\n paths: string[];\n lastActiveMs: number;\n /** A Claude runs in it now: left alone (it may be building). */\n running: boolean;\n /** A repo's own checkout rather than a worktree. */\n baseCheckout?: boolean;\n}\n\nexport interface BuildFoldersDeps {\n sessions: () => Promise<BuildFolderSession[]>;\n run?: CommandRunner;\n now?: () => number;\n}\n\n/** Idle long enough, and no Claude in it: the rule for offering AND for clearing. */\nconst idleEnough = (s: BuildFolderSession, now: number) => !s.running && now - s.lastActiveMs >= BUILD_FOLDERS_IDLE_MS;\n\n/** The worktrees idle a week or more, and the build folders they hold, biggest first. */\nexport async function scanBuildFolders(\n deps: BuildFoldersDeps,\n onProgress?: (checked: number, total: number) => void,\n): Promise<BuildFolderCandidate[]> {\n const now = (deps.now ?? Date.now)();\n const eligible = (await deps.sessions()).filter((s) => idleEnough(s, now) && s.paths.some((p) => fs.existsSync(p)));\n const out: BuildFolderCandidate[] = [];\n let checked = 0;\n for (const s of eligible) {\n const folders: BuildFolder[] = [];\n for (const p of s.paths) if (fs.existsSync(p)) folders.push(...(await buildFoldersOf(p, deps.run)));\n const bytes = folders.reduce((n, f) => n + f.bytes, 0);\n if (bytes > 0)\n out.push({\n sessionId: s.id,\n target: s.target,\n branch: s.branch,\n ...(s.baseCheckout ? { baseCheckout: true } : {}),\n lastActive: new Date(s.lastActiveMs).toISOString(),\n folders,\n bytes,\n });\n onProgress?.(++checked, eligible.length);\n }\n return out.sort((a, b) => b.bytes - a.bytes);\n}\n\n/** One scan at a time; its latest result kept for the view. */\nexport function createBuildFoldersJob(deps: BuildFoldersDeps, activity?: ActivityLog) {\n let state: BuildFoldersState = { scanning: false, checked: 0, total: 0, scannedAt: null, candidates: [] };\n return {\n state: () => state,\n scan: () => {\n if (state.scanning) return;\n state = { ...state, scanning: true, checked: 0, total: 0 };\n const run = activity?.start('build-folders', 'Measuring build folders in idle worktrees');\n void scanBuildFolders(deps, (checked, total) => {\n state = { ...state, checked, total };\n run?.progress(checked, total);\n })\n .then((candidates) => {\n state = { ...state, scanning: false, candidates, scannedAt: new Date().toISOString() };\n const gb = candidates.reduce((n, c) => n + c.bytes, 0) / 1e9;\n run?.done(`${candidates.length} idle worktree${candidates.length === 1 ? '' : 's'} with build output · ${gb.toFixed(1)} GB`);\n })\n .catch((err: Error) => {\n state = { ...state, scanning: false };\n run?.fail(err.message);\n });\n },\n /** Clear the build folders of these sessions (each checked again as it goes). */\n apply: async (ids: string[]) => {\n const sessions = new Map((await deps.sessions()).map((s) => [s.id, s]));\n const results: BuildFoldersApplyResult[] = [];\n for (const id of ids) {\n const s = sessions.get(id);\n if (!s) {\n results.push({ sessionId: id, ok: false, removed: 0, message: 'Unknown session.' });\n continue;\n }\n if (s.running) {\n results.push({ sessionId: id, ok: false, removed: 0, message: 'Its Claude is running now: left alone.' });\n continue;\n }\n // Checked again, not trusted from the scan (or the caller): used since → left alone.\n if (!idleEnough(s, (deps.now ?? Date.now)())) {\n results.push({ sessionId: id, ok: false, removed: 0, message: 'Used in the last week: left alone.' });\n continue;\n }\n let removed = 0;\n const failed: string[] = [];\n for (const p of s.paths) {\n if (!fs.existsSync(p)) continue;\n const r = await clearBuildFolders(p, deps.run);\n removed += r.removed.length;\n failed.push(...r.failed.map((f) => f.path));\n }\n results.push({\n sessionId: id,\n ok: failed.length === 0,\n removed,\n message: failed.length ? `Could not remove: ${failed.join(', ')}` : `Removed ${removed} folder(s)`,\n });\n }\n const done = new Set(results.filter((r) => r.ok).map((r) => r.sessionId));\n state = { ...state, candidates: state.candidates.filter((c) => !done.has(c.sessionId)) };\n return results;\n },\n };\n}\n","import { defaultCleanupDeps } from './cleanup-deps.js';\nimport { normPath } from './cleanup.js';\nimport { loadConfig } from '../platform/config.js';\nimport { agentsBySession } from '../sessions/live-agents.js';\nimport { liveAgents } from '../agents/index.js';\nimport { loadHistory } from '../sessions/history.js';\nimport type { BuildFoldersDeps } from './build-folders-scan.js';\n\n/** The real inputs for the build-folder scan: cleanup's session list (with\n * \"last active\"), and which of them have a Claude running now. The same for\n * the dashboard and `work cleanup --build-folders`. */\nexport function defaultBuildFoldersDeps(): BuildFoldersDeps {\n const cleanup = defaultCleanupDeps();\n return {\n sessions: async () => {\n const running = agentsBySession(liveAgents(), loadHistory());\n const repos = new Set(Object.values(loadConfig()?.repos ?? {}).map(normPath));\n return (await cleanup.sessions()).map((s) => ({\n id: s.id,\n target: s.target,\n branch: s.branch,\n paths: s.paths,\n lastActiveMs: s.lastActiveMs,\n running: running.has(s.id),\n baseCheckout: s.paths.some((p) => repos.has(normPath(p))),\n }));\n },\n };\n}\n","import type { BranchCandidate } from '../api-types.js';\nimport { defaultRunner, type CommandRunner } from '../pr/ship.js';\n\n/**\n * Local branches whose work is already in the main branch, left behind after\n * their PR merged. Offered for deletion only when that is certain:\n *\n * - merged: `git branch --merged <origin's default>` lists it, or\n * - squash-merged: its upstream is gone and GitHub has a MERGED PR whose\n * head is exactly this branch's tip (a squash merge leaves no merge\n * commit to find).\n *\n * Never offered: a branch checked out in any worktree, one a current (not\n * archived) session uses, the default branch, or a long-lived name (main,\n * master, dev, develop, staging, production, …). An archived session's\n * branch is offered with a warning: its Restore needs the branch.\n */\n\nconst LONG_LIVED = /^(main|master|dev|develop|development|staging|stage|production|prod|release|trunk)$/;\n\nexport interface BranchRepo {\n alias: string;\n path: string;\n}\n\nexport interface BranchTidyDeps {\n repos: () => BranchRepo[];\n /** Branches sessions use, per repo alias → branch → the session. */\n sessionBranches: () => Map<string, Map<string, { id: string; archived: boolean }>>;\n run?: CommandRunner;\n}\n\nasync function git(run: CommandRunner, cwd: string, ...args: string[]) {\n return run('git', ['-C', cwd, ...args], cwd);\n}\n\n/** origin's default branch as a ref (origin/main), else a local main/master. */\nasync function baseRef(run: CommandRunner, repo: string): Promise<string | null> {\n const head = await git(run, repo, 'rev-parse', '--abbrev-ref', 'origin/HEAD');\n if (head.code === 0 && head.stdout.trim() && head.stdout.trim() !== 'origin/HEAD') return head.stdout.trim();\n for (const b of ['origin/main', 'origin/master', 'main', 'master']) {\n if ((await git(run, repo, 'rev-parse', '--verify', '--quiet', b)).code === 0) return b;\n }\n return null;\n}\n\n/** `only`: look at just these branches (the re-check before deleting), not every repo's. */\nexport async function findMergedBranches(deps: BranchTidyDeps, only?: Array<{ repo: string; branch: string }>): Promise<BranchCandidate[]> {\n const run = deps.run ?? defaultRunner;\n const sessions = deps.sessionBranches();\n const out: BranchCandidate[] = [];\n const wanted = only && new Set(only.map((o) => `${o.repo}\\0${o.branch}`));\n for (const repo of deps.repos()) {\n if (only && !only.some((o) => o.repo === repo.alias)) continue;\n const base = await baseRef(run, repo.path);\n if (!base) continue;\n const baseName = base.replace(/^origin\\//, '');\n const checkedOut = new Set(\n (await git(run, repo.path, 'worktree', 'list', '--porcelain')).stdout\n .split('\\n')\n .map((l) => /^branch refs\\/heads\\/(.+)$/.exec(l.trim())?.[1])\n .filter((b): b is string => !!b),\n );\n const merged = new Set(\n (await git(run, repo.path, 'branch', '--merged', base, '--format=%(refname:short)')).stdout\n .split('\\n')\n .map((l) => l.trim())\n .filter(Boolean),\n );\n const refs = (\n await git(run, repo.path, 'for-each-ref', '--format=%(refname:short)%09%(objectname)%09%(upstream:track)', 'refs/heads')\n ).stdout\n .split('\\n')\n .map((l) => l.split('\\t'))\n .filter((p) => p[0]);\n const used = sessions.get(repo.alias) ?? new Map();\n for (const [branch, tip, track] of refs) {\n if (wanted && !wanted.has(`${repo.alias}\\0${branch}`)) continue;\n if (branch === baseName || LONG_LIVED.test(branch) || checkedOut.has(branch)) continue;\n const session = used.get(branch);\n if (session && !session.archived) continue;\n let reason: BranchCandidate['reason'] | null = null;\n let prNumber: number | undefined;\n if (merged.has(branch)) reason = 'merged';\n else if ((track ?? '').includes('gone')) {\n const pr = await run(\n 'gh',\n ['pr', 'list', '--state', 'merged', '--head', branch, '--json', 'number,headRefOid', '--limit', '5'],\n repo.path,\n );\n if (pr.code === 0) {\n try {\n const list = JSON.parse(pr.stdout) as Array<{ number: number; headRefOid: string }>;\n const hit = list.find((p) => p.headRefOid === tip);\n if (hit) {\n reason = 'squash-merged';\n prNumber = hit.number;\n }\n } catch {\n /* not JSON: not certain, not offered */\n }\n }\n }\n if (!reason) continue;\n out.push({\n repo: repo.alias,\n repoPath: repo.path,\n branch,\n tip,\n reason,\n ...(prNumber ? { prNumber } : {}),\n ...(session ? { archivedSession: session.id } : {}),\n });\n }\n }\n return out;\n}\n\n/**\n * Delete the chosen branches — each checked again first (still merged, still\n * not checked out, and at the `tip` you were shown when one is given), then\n * `git branch -D` (a squash merge is not \"merged\" to git, so -d would refuse\n * what we just verified).\n */\nexport async function deleteMergedBranches(\n chosen: Array<{ repo: string; branch: string; tip?: string }>,\n deps: BranchTidyDeps,\n): Promise<Array<{ repo: string; branch: string; ok: boolean; message: string }>> {\n const run = deps.run ?? defaultRunner;\n const fresh = await findMergedBranches(deps, chosen);\n const results: Array<{ repo: string; branch: string; ok: boolean; message: string }> = [];\n for (const { repo, branch, tip } of chosen) {\n const now = fresh.find((f) => f.repo === repo && f.branch === branch);\n if (!now) {\n results.push({ repo, branch, ok: false, message: 'Not deleted: no longer certain it is merged (or it is in use).' });\n continue;\n }\n if (tip && now.tip !== tip) {\n results.push({ repo, branch, ok: false, message: 'Not deleted: it has moved since you looked.' });\n continue;\n }\n const r = await git(run, now.repoPath, 'branch', '-D', now.branch);\n results.push({\n repo,\n branch,\n ok: r.code === 0,\n message: r.code === 0 ? `Deleted (was ${now.tip.slice(0, 8)})` : r.stderr.trim() || 'git refused',\n });\n }\n return results;\n}\n","import fs from 'node:fs';\nimport { loadConfig } from '../platform/config.js';\nimport { loadHistory } from '../sessions/history.js';\nimport { sessionIdFor } from '../sessions/session-id.js';\nimport type { WorktreeSession } from '../sessions/session-types.js';\nimport type { BranchTidyDeps } from './branch-tidy.js';\nimport { sessionAliases } from '../sessions/session-repos.js';\n\n/**\n * Which branches sessions use, per repo alias. A repo + branch can belong to\n * several sessions (a single-repo one and a group's): a current one's use\n * wins over an archived one's, whatever order the history lists them in.\n */\nexport function sessionBranchUse(\n sessions: WorktreeSession[],\n groups: Record<string, string[]>,\n): Map<string, Map<string, { id: string; archived: boolean }>> {\n const out = new Map<string, Map<string, { id: string; archived: boolean }>>();\n for (const s of sessions) {\n // Its own repos (a row from before: the group's config members).\n const aliases = sessionAliases(s, { groups });\n for (const a of aliases) {\n const m = out.get(a) ?? new Map<string, { id: string; archived: boolean }>();\n if (m.get(s.branch)?.archived !== false) m.set(s.branch, { id: sessionIdFor(s), archived: !!s.archivedAt });\n out.set(a, m);\n }\n }\n return out;\n}\n\n/** The real inputs: the configured repos, and which branches sessions use (per repo alias). */\nexport function defaultBranchTidyDeps(): BranchTidyDeps {\n return {\n repos: () =>\n Object.entries(loadConfig()?.repos ?? {})\n .filter(([, p]) => fs.existsSync(p))\n .map(([alias, path]) => ({ alias, path })),\n sessionBranches: () => sessionBranchUse(loadHistory(), loadConfig()?.groups ?? {}),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ;AAOR,IAAM,wBAAwB,IAAI,KAAK,KAAK,KAAK;AAqBxD,IAAM,aAAa,CAAC,GAAuB,QAAgB,CAAC,EAAE,WAAW,MAAM,EAAE,gBAAgB;AAGjG,eAAsB,iBACpB,MACA,YACiC;AACjC,QAAM,OAAO,KAAK,OAAO,KAAK,KAAK;AACnC,QAAM,YAAY,MAAM,KAAK,SAAS,GAAG,OAAO,CAAC,MAAM,WAAW,GAAG,GAAG,KAAK,EAAE,MAAM,KAAK,CAAC,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC;AAClH,QAAM,MAA8B,CAAC;AACrC,MAAI,UAAU;AACd,aAAW,KAAK,UAAU;AACxB,UAAM,UAAyB,CAAC;AAChC,eAAW,KAAK,EAAE,MAAO,KAAI,GAAG,WAAW,CAAC,EAAG,SAAQ,KAAK,GAAI,MAAM,eAAe,GAAG,KAAK,GAAG,CAAE;AAClG,UAAM,QAAQ,QAAQ,OAAO,CAAC,GAAG,MAAM,IAAI,EAAE,OAAO,CAAC;AACrD,QAAI,QAAQ;AACV,UAAI,KAAK;AAAA,QACP,WAAW,EAAE;AAAA,QACb,QAAQ,EAAE;AAAA,QACV,QAAQ,EAAE;AAAA,QACV,GAAI,EAAE,eAAe,EAAE,cAAc,KAAK,IAAI,CAAC;AAAA,QAC/C,YAAY,IAAI,KAAK,EAAE,YAAY,EAAE,YAAY;AAAA,QACjD;AAAA,QACA;AAAA,MACF,CAAC;AACH,iBAAa,EAAE,SAAS,SAAS,MAAM;AAAA,EACzC;AACA,SAAO,IAAI,KAAK,CAAC,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK;AAC7C;AAGO,SAAS,sBAAsB,M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,KAAK;AAAA,MACX;AAAA,MACA;AAAA,MACA,IAAI,EAAE,SAAS;AAAA,MACf,SAAS,EAAE,SAAS,IAAI,gBAAgB,IAAI,IAAI,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,OAAO,KAAK,KAAK;AAAA,IACtF,CAAC;AAAA,EACH;AACA,SAAO;AACT;;;ACtJA,OAAOA,SAAQ;AAaR,SAAS,iBACd,UACA,QAC6D;AAC7D,QAAM,MAAM,oBAAI,IAA4D;AAC5E,aAAW,KAAK,UAAU;AAExB,UAAM,UAAU,eAAe,GAAG,EAAE,OAAO,CAAC;AAC5C,eAAW,KAAK,SAAS;AACvB,YAAM,IAAI,IAAI,IAAI,CAAC,KAAK,oBAAI,IAA+C;AAC3E,UAAI,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,MAAO,GAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,aAAa,CAAC,GAAG,UAAU,CAAC,CAAC,EAAE,WAAW,CAAC;AAC1G,UAAI,IAAI,GAAG,CAAC;AAAA,IACd;AAAA,EACF;AACA,SAAO;AACT;AAGO,SAAS,wBAAwC;AACtD,SAAO;AAAA,IACL,OAAO,MACL,OAAO,QAAQ,WAAW,GAAG,SAAS,CAAC,CAAC,EACrC,OAAO,CAAC,CAAC,EAAE,CAAC,MAAMC,IAAG,WAAW,CAAC,CAAC,EAClC,IAAI,CAAC,CAAC,OAAO,IAAI,OAAO,EAAE,OAAO,KAAK,EAAE;AAAA,IAC7C,iBAAiB,MAAM,iBAAiB,YAAY,GAAG,WAAW,GAAG,UAAU,CAAC,CAAC;AAAA,EACnF;AACF;","names":["fs","fs"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/platform/launch.ts"],"sourcesContent":["import spawn from './spawn.js';\nimport { detachHere } from './process.js';\nimport { applyEnvDelta, hasEnvDelta, type EnvDelta } from './env-delta.js';\nimport { buildAiLaunchArgs, type AiLaunchOpts, type AiToolSpec } from './ai-launcher.js';\n\n/** Get the platform-appropriate default editor. */\nexport function getEditor(): string {\n return process.env.EDITOR ?? process.env.VISUAL ?? (process.platform === 'win32' ? 'notepad' : 'vi');\n}\n\n/** Open a file in the user's editor. */\nexport function openInEditor(filePath: string): void {\n const editor = getEditor();\n // This terminal's (vi) or a window of its own (notepad): to be seen.\n spawn.sync(editor, [filePath], { stdio: 'inherit', windowsHide: false });\n}\n\n/** Open a URL in the default browser. */\nexport function openUrl(url: string): void {\n const cmd = process.platform === 'win32' ? 'cmd' : process.platform === 'darwin' ? 'open' : 'xdg-open';\n const args = process.platform === 'win32' ? ['/c', 'start', '', url] : [url];\n // `cmd /c start` is a console program: hidden, or a window flashes before the browser opens.\n spawn(cmd, args, { stdio: 'ignore', detached: detachHere(), windowsHide: true }).unref();\n}\n\n/** VS Code and the editors built on it: the folder, then `--goto file:line`, opens the file at its line in that folder's window. */\nconst VSCODE_LIKE = /^(code|code-insiders|codium|vscodium|cursor|windsurf)$/i;\n/** JetBrains' launchers: `--line N file`. */\nconst JETBRAINS = /^(idea|rider|webstorm|pycharm|goland|clion|phpstorm|rubymine|datagrip)(64)?$/i;\n/** Sublime Text: `file:line`. */\nconst SUBLIME = /^(subl|sublime_text)$/i;\n\n/**\n * The arguments that open `folder` in `editor`, or a file in it at a line. An editor work doesn't know how to send\n * to a line gets the file alone (it opens at the top); with no file, the folder, as before.\n */\nexport function editorArgs(editor: string, folder: string, file?: { path: string; line?: number }): string[] {\n if (!file) return [folder];\n // Either separator, whatever this platform's: a config written on Windows names `C:\\…\\code.cmd`.\n const name = (editor.trim().split(/[\\\\/]/).pop() ?? '').replace(/\\.(cmd|bat|exe|sh)$/i, '');\n const line = file.line && file.line > 0 ? Math.floor(file.line) : undefined;\n if (VSCODE_LIKE.test(name)) return [folder, '--goto', line ? `${file.path}:${line}` : file.path];\n if (JETBRAINS.test(name)) return line ? [folder, '--line', String(line), file.path] : [folder, file.path];\n if (SUBLIME.test(name)) return [folder, line ? `${file.path}:${line}` : file.path];\n return [file.path];\n}\n\n/** Open VS Code in the given directory. */\nexport function openVSCode(dir: string): void {\n spawn.sync('code', ['.'], { cwd: dir, stdio: 'inherit', windowsHide: false }); // the editor's window is the point\n}\n\n/**\n * Launch the configured AI tool in the given directory.\n *\n * When `port` is provided it is injected as `$PORT` into the launched process\n * so dev servers started by parallel agent sessions don't collide.\n */\nexport function launchAi(cwd: string, tool: AiToolSpec, opts: AiLaunchOpts = {}, port?: number, agentEnv?: EnvDelta): void {\n const { cmd, args } = buildAiLaunchArgs(tool, opts);\n // This terminal's environment, with the session's account change over it (agent.launch.env) and its port.\n const env =\n hasEnvDelta(agentEnv) || port !== undefined\n ? { ...applyEnvDelta(process.env, agentEnv), ...(port !== undefined ? { PORT: String(port) } : {}) }\n : undefined;\n const spawnOpts: Parameters<typeof spawn.sync>[2] =\n // The AI tool runs in this terminal: nothing to hide.\n env ? { cwd, stdio: 'inherit', windowsHide: false, env: env as NodeJS.ProcessEnv } : { cwd, stdio: 'inherit', windowsHide: false };\n spawn.sync(cmd, args, spawnOpts);\n}\n"],"mappings":";;;;;;;;;;;;;;AAMO,SAAS,YAAoB;AAClC,SAAO,QAAQ,IAAI,UAAU,QAAQ,IAAI,WAAW,QAAQ,aAAa,UAAU,YAAY;AACjG;AAGO,SAAS,aAAa,UAAwB;AACnD,QAAM,SAAS,UAAU;AAEzB,gBAAM,KAAK,QAAQ,CAAC,QAAQ,GAAG,EAAE,OAAO,WAAW,aAAa,MAAM,CAAC;AACzE;AAGO,SAAS,QAAQ,KAAmB;AACzC,QAAM,MAAM,QAAQ,aAAa,UAAU,QAAQ,QAAQ,aAAa,WAAW,SAAS;AAC5F,QAAM,OAAO,QAAQ,aAAa,UAAU,CAAC,MAAM,SAAS,IAAI,GAAG,IAAI,CAAC,GAAG;AAE3E,gBAAM,KAAK,MAAM,EAAE,OAAO,UAAU,UAAU,WAAW,GAAG,aAAa,KAAK,CAAC,EAAE,MAAM;AACzF;AAGA,IAAM,cAAc;AAEpB,IAAM,Y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