@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
|
@@ -5,7 +5,10 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
isPidAlive,
|
|
7
7
|
killTreeAsync
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-63ZLPXRL.js";
|
|
9
|
+
import {
|
|
10
|
+
programPath
|
|
11
|
+
} from "./chunk-EL3XL2OC.js";
|
|
9
12
|
import {
|
|
10
13
|
getConfigDir
|
|
11
14
|
} from "./chunk-6THUVP6T.js";
|
|
@@ -190,7 +193,7 @@ async function linuxProcesses() {
|
|
|
190
193
|
}
|
|
191
194
|
var run = (cmd, args) => new Promise(
|
|
192
195
|
(resolve) => execFile(
|
|
193
|
-
cmd,
|
|
196
|
+
programPath(cmd),
|
|
194
197
|
args,
|
|
195
198
|
{ encoding: "utf-8", windowsHide: true, timeout: 2e4, maxBuffer: 64 * 1024 * 1024 },
|
|
196
199
|
(_err, stdout) => resolve(stdout ?? "")
|
|
@@ -247,4 +250,4 @@ export {
|
|
|
247
250
|
runningFromNames,
|
|
248
251
|
stopRunningFrom
|
|
249
252
|
};
|
|
250
|
-
//# sourceMappingURL=chunk-
|
|
253
|
+
//# sourceMappingURL=chunk-JNBMANFM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/platform/running-from.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { execFile } from 'node:child_process';\nimport { programPath } from './program-path.js';\nimport { isPidAlive, killTreeAsync } from './process.js';\nimport { packageRoot } from './package-root.js';\nimport { getConfigDir } from './config.js';\n\n/**\n * Processes running from a folder — a dev server, a watcher, a built app\n * Claude started in a worktree — and what keeps a folder in use on Windows.\n * Archiving stops Claude, but not what it started in the background (`vite`\n * with `run_in_background`): that held a file in `node_modules`, so git\n * removed the worktree only in part, and Restore couldn't move what was left.\n *\n * Two kinds, kept apart on purpose:\n * - runs from it: its program is in the folder — the executable, or an\n * interpreter's script (`node <dir>/node_modules/vite/bin/vite.js`,\n * `dotnet <dir>/bin/App.dll`). Work's to stop, with the session's work.\n * - mentions it: anything else naming the folder (an editor opened on it,\n * a terminal). Named in a message, never stopped: it's the user's.\n */\n\nexport interface RunningProcess {\n pid: number;\n ppid: number;\n /** Its executable's file name (\"node.exe\"). */\n name: string;\n /** Its executable's full path, when the system says. */\n exe: string | null;\n /** Its command line ('' when it can't be read). */\n command: string;\n /** Its working folder, where the system says (Linux): a relative script (`node dist/server.js`) is under it. */\n cwd?: string | null;\n}\n\n/** Interpreters whose script is the program: the first argument that isn't an option. */\nconst INTERPRETERS = new Set(['node', 'bun', 'deno', 'python', 'python3', 'pythonw', 'py', 'dotnet', 'java', 'javaw', 'ruby', 'php']);\n\nconst win = process.platform === 'win32';\n\n/** A path as compared: absolute, normalised, `\\` and case-blind on Windows. */\nexport function normDir(p: string, windows = win): string {\n if (windows) return path.win32.normalize(p.replace(/\\//g, '\\\\')).replace(/\\\\+$/, '').toLowerCase();\n return path.posix.normalize(p).replace(/\\/+$/, '');\n}\n\nfunction under(p: string, dir: string, windows: boolean): boolean {\n const a = normDir(p, windows);\n const sep = windows ? '\\\\' : '/';\n return a === dir || a.startsWith(dir + sep);\n}\n\n/** A command line's words: quotes group, and are dropped (Windows' rules, roughly; enough to find a path). */\nexport function commandWords(command: string): string[] {\n const out: string[] = [];\n for (const m of command.matchAll(/\"([^\"]*)\"|(\\S+)/g)) out.push(m[1] ?? m[2]);\n return out;\n}\n\nconst bare = (file: string) =>\n file\n .split(/[\\\\/]/)\n .pop()!\n .toLowerCase()\n .replace(/\\.exe$/, '');\n\n/** Its program is in one of `dirs` (normalised with normDir): the executable, or an interpreter's script. */\nexport function runsFrom(p: RunningProcess, dirs: string[], windows = win): boolean {\n const words = commandWords(p.command);\n const exe = p.exe ?? words[0] ?? '';\n if (exe && dirs.some((d) => under(exe, d, windows))) return true;\n // Its version gone: python3.12, node22 (Linux names the binary itself).\n if (!INTERPRETERS.has(bare(exe || p.name).replace(/[\\d.]+$/, ''))) return false;\n // Its script: the first argument that isn't an option, or the first that names a program file (an option's value\n // comes first in `node -r ts-node/register <dir>/src/index.ts`). Not any later one: `node C:\\tools\\fmt.js <dir>\\a.ts`\n // runs a tool of yours on a file there, its program elsewhere.\n const args = words.slice(1);\n const first = args.find((w) => !w.startsWith('-'));\n const relative = (w: string) => !(windows ? path.win32.isAbsolute(w) : w.startsWith('/'));\n const scripts = [first, args.find((w) => SCRIPT_FILE.test(w))]\n .filter((w): w is string => !!w && (/[\\\\/]/.test(w) || (!!p.cwd && SCRIPT_FILE.test(w))))\n // A relative one is where the process works (`node dist/server.js`, `python manage.py`), when that's known.\n .map((w) => (relative(w) && p.cwd ? (windows ? path.win32.resolve(p.cwd, w) : path.posix.resolve(p.cwd, w)) : w));\n return scripts.some((w) => dirs.some((d) => under(w, d, windows)));\n}\n\nconst SCRIPT_FILE = /\\.(c|m)?(js|ts)$|\\.(py|dll|jar|rb|php)$/i;\n\n/** node-pty's own processes (the console it gives a terminal): work's, when it runs from a checkout. */\nexport function isPtyHelper(p: RunningProcess): boolean {\n return /[\\\\/]node-pty[\\\\/]/i.test(`${p.exe ?? ''} ${p.command}`) || /^(conpty|openconsole|winpty-agent)(\\.exe)?$/i.test(p.name);\n}\n\n/**\n * An editor's helper — a language server, the TypeScript server — even one running the worktree's own copy\n * (`node <wt>/node_modules/typescript/lib/tsserver.js`, VS Code's \"use the workspace version\"): the editor's, which\n * the user closes; stopping it only makes the editor report a crash. Known by what editors start them with.\n */\nexport function isEditorHelper(p: RunningProcess): boolean {\n const words = commandWords(p.command);\n if (words.some((w) => /^--(useNodeIpc|node-ipc|clientProcessId(=.*)?|cancellationPipeName)$/i.test(w))) return true;\n return words.slice(1).some((w) => /[\\\\/](tsserver|typingsInstaller)\\.js$|language-?server|langserver/i.test(w));\n}\n\n/** Where this work runs from: its `dist/bin.js` (an npm install, a linked checkout, the desktop app's copy). */\nexport function workBinPaths(): string[] {\n const root = packageRoot();\n return root ? [normDir(path.join(root, 'dist', 'bin.js'))] : [];\n}\n\n/**\n * One of work's own (the PTY host, a work web, a hook): this work's own `bin.js` running one of those — never\n * stopped, wherever it's installed (stopping the PTY host stops every session's Claude). Not any `bin.js web`:\n * a project's own would be spared, and keep its worktree in use.\n */\nexport function isWorkProcess(p: RunningProcess, bins: string[] = workBinPaths(), windows = win): boolean {\n if (bins.length === 0) return false;\n const raw = commandWords(p.command);\n return raw.some((w, i) => /^(pty-host|web|hook)$/.test(raw[i + 1] ?? '') && bins.includes(normDir(w, windows)));\n}\n\n/** It names one of `dirs` somewhere in its command line or executable path. */\nexport function mentions(p: RunningProcess, dirs: string[], windows = win): boolean {\n const norm = (s: string) => (windows ? s.replace(/\\//g, '\\\\').toLowerCase() : s);\n const text = `${norm(p.exe ?? '')} ${norm(p.command)}`;\n // The folder itself, or inside it: anything but more of a name may follow (a separator, a quote, `&`, `;`, the\n // end) — not feat-x2 or feat-x-old, which are other folders.\n return dirs.some((d) => {\n for (let at = text.indexOf(d); at >= 0; at = text.indexOf(d, at + 1)) {\n const next = text[at + d.length];\n if (next === undefined || !/[\\w.-]/.test(next)) return true;\n }\n return false;\n });\n}\n\nexport interface Holders {\n /** Run from the folders: stop these (each the top of its tree — its children go with it on Windows). */\n stoppable: RunningProcess[];\n /** Every one that runs from them, children too: POSIX kills one process at a time. */\n running?: RunningProcess[];\n /** Name the folders but run from elsewhere (an editor, a shell): the user's to close. */\n others: RunningProcess[];\n}\n\n/**\n * What runs from or names `dirs`, in `procs`. Never this process or one it runs under, never one in `spare` (the\n * PTY host and work web by their recorded pids) or under it, and never one of work's own by its command line\n * (isWorkProcess) — whatever folder they run from.\n */\nexport function holdersOf(\n procs: RunningProcess[],\n dirs: string[],\n self = process.pid,\n windows = win,\n spare: ReadonlySet<number> = new Set(),\n bins: string[] = workBinPaths(),\n): Holders {\n const norm = dirs.map((d) => normDir(d, windows));\n const byPid = new Map(procs.map((p) => [p.pid, p]));\n const mine = new Set<number>();\n for (let pid: number | undefined = self; pid && !mine.has(pid); pid = byPid.get(pid)?.ppid) mine.add(pid);\n // work's own (by pid or command line), and the terminal helpers they run (node-pty's, from where work is\n // installed — a checkout's node_modules). Not everything under them: a dev server a Claude started is a\n // descendant of the PTY host until that Claude is gone, and stopping it is the point.\n const ownWork = (q: RunningProcess) => spare.has(q.pid) || isWorkProcess(q, bins, windows);\n const spared = (p: RunningProcess): boolean => {\n if (ownWork(p)) return true;\n if (!isPtyHelper(p)) return false;\n const seen = new Set<number>();\n for (let q = byPid.get(p.ppid); q && !seen.has(q.pid); q = byPid.get(q.ppid)) {\n if (ownWork(q)) return true;\n seen.add(q.pid);\n }\n return false;\n };\n const candidates = procs.filter((p) => !mine.has(p.pid) && !spared(p));\n // An editor's helper is the user's, like the editor: named, never stopped.\n const running = candidates.filter((p) => runsFrom(p, norm, windows) && !isEditorHelper(p));\n const runningPids = new Set(running.map((p) => p.pid));\n return {\n stoppable: running.filter((p) => !runningPids.has(p.ppid)),\n running,\n others: candidates.filter((p) => !runningPids.has(p.pid) && mentions(p, norm, windows)),\n };\n}\n\n/** The pids work recorded for its PTY host and work web (and the dev server's): spared by every stop. */\nexport function workPids(dir = getConfigDir()): Set<number> {\n const out = new Set<number>();\n for (const file of ['pty-host.json', 'web.pid', 'web-dev.pid']) {\n try {\n const raw = fs.readFileSync(path.join(dir, file), 'utf-8').trim();\n const pid = raw.startsWith('{') ? (JSON.parse(raw) as { pid?: unknown }).pid : Number(raw.split(/\\s/)[0]);\n if (typeof pid === 'number' && Number.isInteger(pid) && pid > 0) out.add(pid);\n } catch {\n /* not running, or not recorded */\n }\n }\n return out;\n}\n\n/** \"node …\\vite\\bin\\vite.js --mode demo (PID 35464)\": its name and command, the folder shortened to \"…\". */\nexport function describeProcess(p: RunningProcess, dirs: string[], windows = win): string {\n const words = commandWords(p.command).slice(1);\n let args = words.join(' ');\n // The folder (normalised as normDir: `\\`, lower case on Windows) wherever it appears, as typed.\n for (const d of dirs) {\n // Char by char, and only where lower case keeps the length (an İ doesn't): the positions stay those of `args`.\n const fold = (s: string) =>\n windows\n ? [...s]\n .map((c) => {\n const l = (c === '/' ? '\\\\' : c).toLowerCase();\n return l.length === c.length ? l : c;\n })\n .join('')\n : s;\n for (let at = fold(args).indexOf(d); at >= 0; at = fold(args).indexOf(d)) args = args.slice(0, at) + '…' + args.slice(at + d.length);\n }\n if (args.length > 90) args = `${args.slice(0, 89)}…`;\n const name = bare(p.name || p.exe || '?');\n return `${name}${args ? ` ${args}` : ''} (PID ${p.pid})`;\n}\n\n/** Windows: `Get-CimInstance Win32_Process` as JSON (one object, or a list). */\nexport function parseCimProcesses(json: string): RunningProcess[] {\n let data: unknown;\n try {\n data = JSON.parse(json);\n } catch {\n return [];\n }\n const rows = Array.isArray(data) ? data : data ? [data] : [];\n const out: RunningProcess[] = [];\n for (const r of rows) {\n if (!r || typeof r !== 'object') continue;\n const o = r as Record<string, unknown>;\n if (typeof o.ProcessId !== 'number') continue;\n out.push({\n pid: o.ProcessId,\n ppid: typeof o.ParentProcessId === 'number' ? o.ParentProcessId : 0,\n name: typeof o.Name === 'string' ? o.Name : '',\n exe: typeof o.ExecutablePath === 'string' ? o.ExecutablePath : null,\n command: typeof o.CommandLine === 'string' ? o.CommandLine : '',\n });\n }\n return out;\n}\n\n/** macOS: `ps -A -o pid=,ppid=,args=`. */\nexport function parsePsProcesses(stdout: string): RunningProcess[] {\n const out: RunningProcess[] = [];\n for (const line of stdout.split(/\\r?\\n/)) {\n const m = /^\\s*(\\d+)\\s+(\\d+)\\s+(.*)$/.exec(line);\n if (!m) continue;\n const command = m[3].trim();\n const first = commandWords(command)[0] ?? '';\n out.push({\n pid: Number(m[1]),\n ppid: Number(m[2]),\n name: path.posix.basename(first),\n exe: first.startsWith('/') ? first : null,\n command,\n });\n }\n return out;\n}\n\n/** Read asynchronously: work web's requests wait behind a synchronous walk of /proc. */\nasync function linuxProcesses(): Promise<RunningProcess[]> {\n const out: RunningProcess[] = [];\n let pids: string[];\n try {\n pids = (await fs.promises.readdir('/proc')).filter((d) => /^\\d+$/.test(d));\n } catch {\n return out;\n }\n for (const d of pids) {\n try {\n const stat = await fs.promises.readFile(`/proc/${d}/stat`, 'utf-8');\n const ppid = Number(stat.slice(stat.lastIndexOf(')') + 2).split(' ')[1]);\n const command = (await fs.promises.readFile(`/proc/${d}/cmdline`, 'utf-8'))\n .split('\\0')\n .filter(Boolean)\n .map((w) => (/\\s/.test(w) ? `\"${w}\"` : w))\n .join(' ');\n let exe: string | null = null;\n let cwd: string | null = null;\n try {\n exe = await fs.promises.readlink(`/proc/${d}/exe`);\n cwd = await fs.promises.readlink(`/proc/${d}/cwd`);\n } catch {\n /* another user's */\n }\n out.push({ pid: Number(d), ppid, name: exe ? path.posix.basename(exe) : '', exe, command, cwd });\n } catch {\n /* gone meanwhile */\n }\n }\n return out;\n}\n\nconst run = (cmd: string, args: string[]): Promise<string> =>\n new Promise((resolve) =>\n execFile(\n programPath(cmd),\n args,\n { encoding: 'utf-8', windowsHide: true, timeout: 20_000, maxBuffer: 64 * 1024 * 1024 },\n (_err, stdout) => resolve(stdout ?? ''),\n ),\n );\n\n/** Every process with its parent, executable and command line. Empty when they can't be read. */\nexport async function listProcesses(): Promise<RunningProcess[]> {\n if (process.platform === 'linux') return linuxProcesses();\n if (process.platform === 'win32') {\n return parseCimProcesses(\n await run('powershell', [\n '-NoProfile',\n '-NonInteractive',\n '-Command',\n // UTF-8 out: the console's code page would turn a path with Š or č into ?.\n '[Console]::OutputEncoding = [Text.Encoding]::UTF8; Get-CimInstance Win32_Process | Select-Object ProcessId,ParentProcessId,Name,ExecutablePath,CommandLine | ConvertTo-Json -Compress',\n ]),\n );\n }\n return parsePsProcesses(await run('ps', ['-A', '-o', 'pid=,ppid=,args=']));\n}\n\n/** Look up what runs from or names `dirs` now. */\nexport async function findHolders(\n dirs: string[],\n list: () => Promise<RunningProcess[]> = listProcesses,\n spare: ReadonlySet<number> = workPids(),\n): Promise<Holders> {\n const existing = dirs.filter((d) => fs.existsSync(d));\n if (existing.length === 0) return { stoppable: [], running: [], others: [] };\n return holdersOf(await list(), existing, process.pid, win, spare);\n}\n\n/**\n * What runs from `dirs`, by name, stopping nothing. Throws when the processes can't be read (none listed: there are\n * always some), so \"nothing runs there\" is never a guess.\n */\nexport async function runningFromNames(dirs: string[], list: () => Promise<RunningProcess[]> = listProcesses): Promise<string[]> {\n const procs = await list();\n if (procs.length === 0) throw new Error(\"couldn't read the running processes\");\n const h = await findHolders(dirs, async () => procs);\n const norm = dirs.map((d) => normDir(d));\n return h.stoppable.map((p) => describeProcess(p, norm));\n}\n\n/** How long a stop waits for what it stopped to be gone (its files let go) before going on. */\nconst EXIT_WAIT_MS = 3000;\n\n/**\n * Stop what runs from `dirs`, and say what: [\"node …\\vite\\bin\\vite.js --mode demo (PID 35464)\"]. Only processes\n * whose program is in the folders — never an editor open on them, never one of work's own. Windows stops each\n * tree; POSIX each process (a kill there is one process). Waits a moment for them to be gone, so the folder is\n * free when it returns.\n */\nexport async function stopRunningFrom(\n dirs: string[],\n io: {\n list?: () => Promise<RunningProcess[]>;\n kill?: (pid: number) => Promise<boolean> | boolean;\n alive?: (pid: number) => boolean;\n spare?: ReadonlySet<number>;\n waitMs?: number;\n } = {},\n): Promise<string[]> {\n const h = await findHolders(dirs, io.list, io.spare);\n const kill = io.kill ?? killTreeAsync;\n const alive = io.alive ?? isPidAlive;\n const targets = win ? h.stoppable : (h.running ?? h.stoppable);\n // All at once, and off the event loop (taskkill takes a few hundred ms each; work web answers meanwhile).\n const killed = await Promise.all(targets.map((p) => Promise.resolve(kill(p.pid)).catch(() => false)));\n const stopped = targets.filter((_, i) => killed[i]);\n for (const until = Date.now() + (io.waitMs ?? EXIT_WAIT_MS); stopped.some((p) => alive(p.pid)) && Date.now() < until;) {\n await new Promise((r) => setTimeout(r, 100));\n }\n const norm = dirs.map((d) => normDir(d));\n const named = new Set(h.stoppable.map((p) => p.pid));\n return stopped.filter((p) => named.has(p.pid)).map((p) => describeProcess(p, norm));\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,gBAAgB;AAmCzB,IAAM,eAAe,oBAAI,IAAI,CAAC,QAAQ,OAAO,QAAQ,UAAU,WAAW,WAAW,MAAM,UAAU,QAAQ,SAAS,QAAQ,KAAK,CAAC;AAEpI,IAAM,MAAM,QAAQ,aAAa;AAG1B,SAAS,QAAQ,GAAW,UAAU,KAAa;AACxD,MAAI,QAAS,QAAO,KAAK,MAAM,UAAU,EAAE,QAAQ,OAAO,IAAI,CAAC,EAAE,QAAQ,QAAQ,EAAE,EAAE,YAAY;AACjG,SAAO,KAAK,MAAM,UAAU,CAAC,EAAE,QAAQ,QAAQ,EAAE;AACnD;AAEA,SAAS,MAAM,GAAW,KAAa,SAA2B;AAChE,QAAM,IAAI,QAAQ,GAAG,OAAO;AAC5B,QAAM,MAAM,UAAU,OAAO;AAC7B,SAAO,MAAM,OAAO,EAAE,WAAW,MAAM,GAAG;AAC5C;AAGO,SAAS,aAAa,SAA2B;AACtD,QAAM,MAAgB,CAAC;AACvB,aAAW,KAAK,QAAQ,SAAS,kBAAkB,EAAG,KAAI,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;AAC3E,SAAO;AACT;AAEA,IAAM,OAAO,CAAC,SACZ,KACG,MAAM,OAAO,EACb,IAAI,EACJ,YAAY,EACZ,QAAQ,UAAU,EAAE;AAGlB,SAAS,SAAS,GAAmB,MAAgB,UAAU,KAAc;AAClF,QAAM,QAAQ,aAAa,EAAE,OAAO;AACpC,QAAM,MAAM,EAAE,OAAO,MAAM,CAAC,KAAK;AACjC,MAAI,OAAO,KA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AI,QAAQ,CAAC,MAAM,WAAW,GAAG,GAAG,CAAC;AAAA,EAC7C;AACA,QAAM,OAAO,KAAK,IAAI,CAAC,MAAM,QAAQ,CAAC,CAAC;AACvC,QAAM,QAAQ,IAAI,IAAI,EAAE,UAAU,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC;AACnD,SAAO,QAAQ,OAAO,CAAC,MAAM,MAAM,IAAI,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC;AACpF;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/core/time/fence.ts
|
|
4
|
+
function asData(text, max = 300) {
|
|
5
|
+
return text.replace(/\s+/g, " ").replace(/<{3,}|>{3,}/g, (m) => m.replace(/[<>]/g, (c) => c === "<" ? "\u2039" : "\u203A")).trim().slice(0, max);
|
|
6
|
+
}
|
|
7
|
+
function asDataBlock(text) {
|
|
8
|
+
return text.replace(/<{3,}|>{3,}/g, (m) => m.replace(/[<>]/g, (c) => c === "<" ? "\u2039" : "\u203A"));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
asData,
|
|
13
|
+
asDataBlock
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=chunk-JVE2JFLV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/time/fence.ts"],"sourcesContent":["/**\n * Text written by others (meeting subjects, Jira titles, chat names, commit\n * subjects), made safe to put between a prompt's `<<<` and `>>>` data fence:\n * one line (a newline could start what reads as a line of the prompt's own),\n * and no fence marker (a `>>>` in a subject would close the fence early and\n * put what follows outside it). Pure (the server, the demo and the CLI share it).\n */\nexport function asData(text: string, max = 300): string {\n return text\n .replace(/\\s+/g, ' ')\n .replace(/<{3,}|>{3,}/g, (m) => m.replace(/[<>]/g, (c) => (c === '<' ? '‹' : '›')))\n .trim()\n .slice(0, max);\n}\n\n/**\n * Many lines of text written by others (a diff), made safe to put between `<<<` and `>>>`: its lines kept, only a\n * fence marker changed (`>>>` → `›››`), so nothing in it can close the fence early. Pure.\n */\nexport function asDataBlock(text: string): string {\n return text.replace(/<{3,}|>{3,}/g, (m) => m.replace(/[<>]/g, (c) => (c === '<' ? '‹' : '›')));\n}\n"],"mappings":";;;AAOO,SAAS,OAAO,MAAc,MAAM,KAAa;AACtD,SAAO,KACJ,QAAQ,QAAQ,GAAG,EACnB,QAAQ,gBAAgB,CAAC,MAAM,EAAE,QAAQ,SAAS,CAAC,MAAO,MAAM,MAAM,WAAM,QAAI,CAAC,EACjF,KAAK,EACL,MAAM,GAAG,GAAG;AACjB;AAMO,SAAS,YAAY,MAAsB;AAChD,SAAO,KAAK,QAAQ,gBAAgB,CAAC,MAAM,EAAE,QAAQ,SAAS,CAAC,MAAO,MAAM,MAAM,WAAM,QAAI,CAAC;AAC/F;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
sessionIdFor
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-RUYTU2WJ.js";
|
|
5
5
|
|
|
6
6
|
// src/core/worktree/session-folder.ts
|
|
7
7
|
import path from "path";
|
|
@@ -30,4 +30,4 @@ export {
|
|
|
30
30
|
sessionFolderPath,
|
|
31
31
|
flatFolderOwner
|
|
32
32
|
};
|
|
33
|
-
//# sourceMappingURL=chunk-
|
|
33
|
+
//# sourceMappingURL=chunk-JVHHSKBJ.js.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
launchFor
|
|
4
|
+
} from "./chunk-DAKJTB6N.js";
|
|
5
|
+
import {
|
|
6
|
+
spawn_default
|
|
7
|
+
} from "./chunk-EL3XL2OC.js";
|
|
8
|
+
|
|
9
|
+
// src/core/platform/command-runner.ts
|
|
10
|
+
var RUN_TIMED_OUT = 124;
|
|
11
|
+
var defaultRunner = (cmd, args, cwd, env) => new Promise((resolve) => {
|
|
12
|
+
const launch = launchFor(cmd, args);
|
|
13
|
+
if ("refused" in launch) {
|
|
14
|
+
resolve({ code: 1, stdout: "", stderr: launch.refused });
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
let stdout = "";
|
|
18
|
+
let stderr = "";
|
|
19
|
+
let settled = false;
|
|
20
|
+
const done = (r) => {
|
|
21
|
+
if (settled) return;
|
|
22
|
+
settled = true;
|
|
23
|
+
clearTimeout(timer);
|
|
24
|
+
resolve(r);
|
|
25
|
+
};
|
|
26
|
+
const child = spawn_default(launch.cmd, launch.args, { cwd, windowsHide: true, ...env ? { env: { ...process.env, ...env } } : {} });
|
|
27
|
+
const timer = setTimeout(() => {
|
|
28
|
+
child.kill();
|
|
29
|
+
done({ code: RUN_TIMED_OUT, stdout, stderr: stderr || `${cmd} timed out` });
|
|
30
|
+
}, 6e4);
|
|
31
|
+
child.stdout?.on("data", (d) => {
|
|
32
|
+
stdout += d.toString();
|
|
33
|
+
});
|
|
34
|
+
child.stderr?.on("data", (d) => {
|
|
35
|
+
stderr += d.toString();
|
|
36
|
+
});
|
|
37
|
+
child.on("error", (err) => {
|
|
38
|
+
done({ code: err.code === "ENOENT" ? 127 : 1, stdout, stderr: err.message });
|
|
39
|
+
});
|
|
40
|
+
child.on("close", (code) => done({ code: code ?? 1, stdout, stderr }));
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export {
|
|
44
|
+
RUN_TIMED_OUT,
|
|
45
|
+
defaultRunner
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=chunk-KSVYR4G2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/platform/command-runner.ts"],"sourcesContent":["import { launchFor } from './batch-launch.js';\nimport crossSpawn from './spawn.js';\n\n/**\n * How work runs a CLI (git, a git host's CLI, acli) for a decision it makes:\n * argv only, never a shell (§1.1), injectable so the decision logic is\n * unit-testable. Moved from core/pr/ship.ts, which re-exports it.\n */\n\nexport interface RunResult {\n code: number;\n stdout: string;\n stderr: string;\n}\n/** `env`: variables set for this run, over the process's own (a runner that can't set them ignores them). */\nexport type CommandRunner = (cmd: string, args: string[], cwd: string, env?: Record<string, string>) => Promise<RunResult>;\n\n/** The exit code a run that timed out reports (as coreutils' `timeout` does): what it was doing may have happened. */\nexport const RUN_TIMED_OUT = 124;\n\n/**\n * Real runner: cross-spawn, not execFile — on Windows execFile only finds\n * .exe files, so a `gh` installed as a .cmd shim (scoop, wrappers) would\n * look \"not installed\"; cross-spawn resolves shims like `work tree` does,\n * with cmd-escaped args. Exit code 127 = the binary itself is missing.\n * On Windows it starts what `launchFor` (batch-launch.ts) resolved — the\n * absolute file on PATH, never the bare name (cross-spawn would look that up\n * again, the working folder first: a worktree's own `git.cmd` would run) —\n * and a batch file is never handed cmd.exe's special characters: a Python\n * or Node shim (`az.cmd`, npm's) is skipped for its interpreter, any other\n * refuses such an argument (exit 1, said why).\n */\nexport const defaultRunner: CommandRunner = (cmd, args, cwd, env) =>\n new Promise((resolve) => {\n const launch = launchFor(cmd, args);\n if ('refused' in launch) {\n resolve({ code: 1, stdout: '', stderr: launch.refused });\n return;\n }\n let stdout = '';\n let stderr = '';\n let settled = false;\n const done = (r: RunResult) => {\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n resolve(r);\n };\n const child = crossSpawn(launch.cmd, launch.args, { cwd, windowsHide: true, ...(env ? { env: { ...process.env, ...env } } : {}) });\n const timer = setTimeout(() => {\n child.kill();\n done({ code: RUN_TIMED_OUT, stdout, stderr: stderr || `${cmd} timed out` });\n }, 60_000);\n child.stdout?.on('data', (d: Buffer) => {\n stdout += d.toString();\n });\n child.stderr?.on('data', (d: Buffer) => {\n stderr += d.toString();\n });\n child.on('error', (err: NodeJS.ErrnoException) => {\n done({ code: err.code === 'ENOENT' ? 127 : 1, stdout, stderr: err.message });\n });\n child.on('close', (code) => done({ code: code ?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in/env node
|
|
2
|
+
import {
|
|
3
|
+
stillUnsafeMessage
|
|
4
|
+
} from "./chunk-FZHFD2AY.js";
|
|
2
5
|
|
|
3
6
|
// src/core/sessions/session-control.ts
|
|
4
7
|
var MAX_SEND_CHARS = 2e4;
|
|
@@ -7,13 +10,8 @@ async function sendToSession(id, text, deps, opts = {}) {
|
|
|
7
10
|
if (!body) return { ok: false, status: 400, error: "the message is empty" };
|
|
8
11
|
if (body.length > MAX_SEND_CHARS) return { ok: false, status: 400, error: `the message is over ${MAX_SEND_CHARS} characters` };
|
|
9
12
|
if (deps.archived(id)) return { ok: false, status: 409, error: "it is archived: restore it first" };
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
ok: false,
|
|
13
|
-
status: 409,
|
|
14
|
-
error: "its Claude runs with permission checks off (--unsafe), so it would act on this without asking you; send with --force if you mean it"
|
|
15
|
-
};
|
|
16
|
-
}
|
|
13
|
+
const unsafe = deps.stillUnsafe?.(id);
|
|
14
|
+
if (unsafe) return { ok: false, status: 409, error: stillUnsafeMessage(unsafe) };
|
|
17
15
|
const sentAt = (opts.now?.() ?? /* @__PURE__ */ new Date()).toISOString();
|
|
18
16
|
const delivered = await deps.post(id, body);
|
|
19
17
|
if (delivered) return { ok: true, how: delivered, sentAt };
|
|
@@ -64,4 +62,4 @@ export {
|
|
|
64
62
|
pendingRequest,
|
|
65
63
|
parseDuration
|
|
66
64
|
};
|
|
67
|
-
//# sourceMappingURL=chunk-
|
|
65
|
+
//# sourceMappingURL=chunk-KWHHB737.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/sessions/session-control.ts"],"sourcesContent":["import type { AgentState } from '../status/attention.js';\nimport type { PermissionRequest, SendHow } from '../api-types.js';\nimport { stillUnsafeMessage, type LegacyUnsafe } from './legacy-unsafe.js';\n\n/**\n * Driving a session from outside its terminal — another Claude, a script,\n * you in a shell: send it a message, wait for its turn to end, answer its\n * permission prompt. The policy is here; I/O is passed in (the routes in\n * session-control-routes.ts give the real one, tests a fake).\n *\n * A message goes the way every note to a session goes (§ saved prompts): a\n * published comment, which the dashboard types into a terminal it owns when\n * that Claude is idle, or which the prompt hook hands over on its next turn.\n * Never typed into a terminal directly.\n */\n\nexport const MAX_SEND_CHARS = 20_000;\n\nexport type { SendHow } from '../api-types.js';\n\nexport interface SendDeps {\n /** Queue it as a published comment (the comment route), resolving to what that route did with it: typed into an idle host Claude, left for the end of its turn, or null (no host terminal). */\n post: (id: string, body: string) => Promise<'typed' | 'next-turn' | null>;\n /** Its Claude runs in the PTY host. */\n hostRuns: (id: string) => boolean;\n /** Its Claude runs in a terminal outside work (seen in Claude Code's process files). */\n runningOutside: (id: string) => boolean;\n /** Start its Claude in the host, resuming its conversation, its first message saying a note is attached (NOTE_NUDGE). */\n start: (id: string) => Promise<boolean>;\n state: (id: string) => AgentState | null;\n archived: (id: string) => boolean;\n /** Its agent still runs as started `--unsafe` before the retirement (legacy-unsafe.ts). REMOVE IN THE NEXT RELEASE. */\n stillUnsafe?: (id: string) => LegacyUnsafe | null;\n}\n\nexport type SendResult = { ok: true; how: SendHow; sentAt: string } | { ok: false; status: 400 | 409 | 502; error: string };\n\nexport async function sendToSession(id: string, text: string, deps: SendDeps, opts: { now?: () => Date } = {}): Promise<SendResult> {\n const body = text.trim();\n if (!body) return { ok: false, status: 400, error: 'the message is empty' };\n if (body.length > MAX_SEND_CHARS) return { ok: false, status: 400, error: `the message is over ${MAX_SEND_CHARS} characters` };\n if (deps.archived(id)) return { ok: false, status: 409, error: 'it is archived: restore it first' };\n // It would act on this unreviewed, and it may have come from another agent (legacy-unsafe.ts; remove next release).\n const unsafe = deps.stillUnsafe?.(id);\n if (unsafe) return { ok: false, status: 409, error: stillUnsafeMessage(unsafe) };\n const sentAt = (opts.now?.() ?? new Date()).toISOString();\n // What the comment route did, as it decided it — not a second look at the state.\n const delivered = await deps.post(id, body);\n if (delivered) return { ok: true, how: delivered, sentAt };\n if (deps.hostRuns(id)) return { ok: true, how: 'next-turn', sentAt };\n if (deps.runningOutside(id)) return { ok: true, how: 'outside', sentAt };\n if (!(await deps.start(id)))\n return { ok: false, status: 502, error: 'queued, but its Claude could not be started: it gets it when you open the session' };\n return { ok: true, how: 'started', sentAt };\n}\n\n/** What `how` means, in a line. */\nexport function sendHowText(how: SendHow): string {\n switch (how) {\n case 'typed':\n return 'sent: typed into its terminal';\n case 'next-turn':\n return 'queued: it is working, so it gets this when the turn ends';\n case 'outside':\n return 'queued: its Claude runs in a terminal outside work, and gets this on its next turn there';\n case 'started':\n return 'sent: its Claude was started (resuming its conversation) with this as the first message';\n }\n}\n\nexport interface TurnStatus {\n state: AgentState;\n /** When it entered that state (ISO). */\n since: string;\n summary?: string;\n}\n\nexport interface WaitDeps {\n status: (id: string) => TurnStatus | null;\n sleep: (ms: number) => Promise<void>;\n now: () => number;\n}\n\nexport type WaitResult = { ok: true; status: TurnStatus } | { ok: false; reason: 'timeout'; status: TurnStatus | null };\n\n/**\n * Wait until the session isn't working: its turn ended (idle) or it asks\n * you something (needs input). With `after` (when a message was sent), only\n * a state entered after it counts — the turn that message started, not the\n * one before.\n */\nexport async function waitForTurn(\n id: string,\n deps: WaitDeps,\n opts: { after?: string; timeoutMs: number; pollMs?: number },\n): Promise<WaitResult> {\n const deadline = deps.now() + opts.timeoutMs;\n const after = opts.after ? Date.parse(opts.after) : null;\n for (;;) {\n const s = deps.status(id);\n const fresh = after === null || (!!s && Date.parse(s.since) > after);\n if (s && s.state !== 'working' && fresh) return { ok: true, status: s };\n if (deps.now() >= deadline) return { ok: false, reason: 'timeout', status: s };\n await deps.sleep(opts.pollMs ?? 1000);\n }\n}\n\n/** The permission prompt it is waiting on, if any (what `work answer` shows, and must send back). */\nexport function pendingRequest(status: { state: AgentState; request?: PermissionRequest } | null): PermissionRequest | null {\n return status?.state === 'needs_input' && status.request ? status.request : null;\n}\n\n/** Parse \"15m\", \"90s\", \"2h\", or a number of seconds. */\nexport function parseDuration(text: string): number | null {\n const m = /^\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.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-LHM3GB5K.js.map
|
|
@@ -1,44 +1,57 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
dbPtySessions,
|
|
4
|
-
forgetPersistedSession
|
|
5
|
-
} from "./chunk-MG5TTLYZ.js";
|
|
6
2
|
import {
|
|
7
3
|
PtyHostBusyError,
|
|
8
4
|
PtyHostClient,
|
|
9
5
|
PtyHostVersionError,
|
|
10
6
|
ensureHost,
|
|
11
7
|
findHost,
|
|
12
|
-
findHostPatient
|
|
8
|
+
findHostPatient
|
|
9
|
+
} from "./chunk-QLFJNYBV.js";
|
|
10
|
+
import {
|
|
11
|
+
findSession
|
|
12
|
+
} from "./chunk-YPXFDJ76.js";
|
|
13
|
+
import {
|
|
14
|
+
dbPtySessions,
|
|
15
|
+
forgetPersistedSession
|
|
16
|
+
} from "./chunk-LHM3GB5K.js";
|
|
17
|
+
import {
|
|
13
18
|
hostStartLockPath
|
|
14
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-2QLLPZ2L.js";
|
|
15
20
|
import {
|
|
16
21
|
ASSISTANT_ID,
|
|
17
22
|
prepareAssistantDir
|
|
18
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-7NNGYM3G.js";
|
|
19
24
|
import {
|
|
20
|
-
createFsWatcher,
|
|
21
|
-
findSessionById,
|
|
22
25
|
logSwallowed,
|
|
23
26
|
noClaudeBecause,
|
|
24
27
|
swallow
|
|
25
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-ZG2M4ECW.js";
|
|
26
29
|
import {
|
|
27
30
|
sessionIdFor
|
|
28
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-RUYTU2WJ.js";
|
|
29
32
|
import {
|
|
33
|
+
AccountAdminError,
|
|
30
34
|
agentFor,
|
|
31
35
|
agentSettings,
|
|
32
|
-
assistantAgent
|
|
36
|
+
assistantAgent
|
|
37
|
+
} from "./chunk-N4W34U3I.js";
|
|
38
|
+
import {
|
|
39
|
+
accountLoginId,
|
|
40
|
+
accountOfLoginId
|
|
41
|
+
} from "./chunk-SJBEIYLK.js";
|
|
42
|
+
import {
|
|
33
43
|
hasEnvDelta
|
|
34
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-DMGNJ73M.js";
|
|
35
45
|
import {
|
|
36
46
|
loadConfig
|
|
37
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-O5ZJY5BT.js";
|
|
38
48
|
import {
|
|
39
49
|
ensureFile,
|
|
40
50
|
withFileLock
|
|
41
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-D2J3AD6L.js";
|
|
52
|
+
import {
|
|
53
|
+
getConfigDir
|
|
54
|
+
} from "./chunk-6THUVP6T.js";
|
|
42
55
|
|
|
43
56
|
// src/core/pty/output-status.ts
|
|
44
57
|
var OUTPUT_WORKING_MS = 1e4;
|
|
@@ -58,64 +71,18 @@ function statusFromOutput(p, now) {
|
|
|
58
71
|
}
|
|
59
72
|
|
|
60
73
|
// src/core/pty/pty-pool.ts
|
|
61
|
-
import
|
|
74
|
+
import path2 from "path";
|
|
62
75
|
|
|
63
|
-
// src/core/
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
};
|
|
74
|
-
let entry = sessionWatchers.get(sessionId);
|
|
75
|
-
if (!entry) {
|
|
76
|
-
const subscribers = /* @__PURE__ */ new Set();
|
|
77
|
-
const newEntry = {
|
|
78
|
-
subscribers,
|
|
79
|
-
watcher: createFsWatcher({
|
|
80
|
-
roots: session.paths,
|
|
81
|
-
debounceMs: DEBOUNCE_MS,
|
|
82
|
-
onChange: () => {
|
|
83
|
-
for (const cb of subscribers) {
|
|
84
|
-
try {
|
|
85
|
-
cb();
|
|
86
|
-
} catch {
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
})
|
|
91
|
-
};
|
|
92
|
-
sessionWatchers.set(sessionId, newEntry);
|
|
93
|
-
entry = newEntry;
|
|
94
|
-
}
|
|
95
|
-
entry.subscribers.add(onChange);
|
|
96
|
-
let released = false;
|
|
97
|
-
return () => {
|
|
98
|
-
if (released) return;
|
|
99
|
-
released = true;
|
|
100
|
-
entry.subscribers.delete(onChange);
|
|
101
|
-
if (entry.subscribers.size === 0) {
|
|
102
|
-
entry.watcher.stop();
|
|
103
|
-
if (sessionWatchers.get(sessionId) === entry) {
|
|
104
|
-
sessionWatchers.delete(sessionId);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
async function disposeSessionWatcher(sessionId) {
|
|
110
|
-
const entry = sessionWatchers.get(sessionId);
|
|
111
|
-
if (!entry) return;
|
|
112
|
-
sessionWatchers.delete(sessionId);
|
|
113
|
-
entry.subscribers.clear();
|
|
114
|
-
entry.watcher.stop();
|
|
115
|
-
}
|
|
116
|
-
function disposeAllWatchers() {
|
|
117
|
-
for (const [, entry] of sessionWatchers) entry.watcher.stop();
|
|
118
|
-
sessionWatchers.clear();
|
|
76
|
+
// src/core/pty/account-login.ts
|
|
77
|
+
import fs from "fs";
|
|
78
|
+
import path from "path";
|
|
79
|
+
var accountLoginDir = () => path.join(getConfigDir(), "account-login");
|
|
80
|
+
function accountLoginSpec(name, accounts, dir = accountLoginDir()) {
|
|
81
|
+
if (!accounts?.admin) throw new AccountAdminError("its accounts are not managed by work");
|
|
82
|
+
if (!accounts.has(name)) throw new AccountAdminError(`no account \u201C${name}\u201D`);
|
|
83
|
+
const { tool, agentEnv } = accounts.admin.loginLaunch(name);
|
|
84
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
85
|
+
return { cwd: dir, tool, fresh: true, ...hasEnvDelta(agentEnv) ? { agentEnv } : {} };
|
|
119
86
|
}
|
|
120
87
|
|
|
121
88
|
// src/core/pty/pty-pool.ts
|
|
@@ -220,17 +187,19 @@ function assistantSpec() {
|
|
|
220
187
|
function spawnSpecFor(session) {
|
|
221
188
|
const first = session.paths[0];
|
|
222
189
|
if (!first) return null;
|
|
223
|
-
const cwd = session.isGroup ?
|
|
190
|
+
const cwd = session.isGroup ? path2.dirname(first) : first;
|
|
224
191
|
const config = loadConfig();
|
|
225
192
|
const launch = agentFor(config, session).launch;
|
|
226
193
|
const agentEnv = launch.env?.(session);
|
|
227
194
|
return { cwd, tool: launch.tool(config), port: session.port, ...hasEnvDelta(agentEnv) ? { agentEnv } : {} };
|
|
228
195
|
}
|
|
229
196
|
async function ensurePty(sessionId, extra = {}) {
|
|
230
|
-
const
|
|
231
|
-
const
|
|
197
|
+
const loginFor = accountOfLoginId(sessionId);
|
|
198
|
+
const notASession = sessionId === ASSISTANT_ID || loginFor !== null;
|
|
199
|
+
const session = notASession ? null : findSession(sessionId);
|
|
200
|
+
const refused = notASession ? null : noClaudeBecause(session, sessionId);
|
|
232
201
|
if (refused) throw new Error(refused);
|
|
233
|
-
const base = sessionId === ASSISTANT_ID ? assistantSpec() : session ? spawnSpecFor(session) : null;
|
|
202
|
+
const base = loginFor !== null ? accountLoginSpec(loginFor, agentFor(loadConfig()).accounts) : sessionId === ASSISTANT_ID ? assistantSpec() : session ? spawnSpecFor(session) : null;
|
|
234
203
|
if (!base) return null;
|
|
235
204
|
const spec = extra.initialPrompt ? { ...base, initialPrompt: extra.initialPrompt } : base;
|
|
236
205
|
let c = await getClient(true);
|
|
@@ -247,6 +216,14 @@ async function ensurePty(sessionId, extra = {}) {
|
|
|
247
216
|
live.add(sessionId);
|
|
248
217
|
return c.attachUrl(sessionId);
|
|
249
218
|
}
|
|
219
|
+
async function startAccountLogin(name) {
|
|
220
|
+
const id = accountLoginId(name);
|
|
221
|
+
if (!await ensurePty(id)) throw new Error("the PTY host could not be started");
|
|
222
|
+
return id;
|
|
223
|
+
}
|
|
224
|
+
async function stopAccountLogin(name) {
|
|
225
|
+
await disposePty(accountLoginId(name));
|
|
226
|
+
}
|
|
250
227
|
async function listHostPtys() {
|
|
251
228
|
const c = await getClient(false);
|
|
252
229
|
return c ? c.list() : [];
|
|
@@ -407,10 +384,6 @@ function detachPtyPool() {
|
|
|
407
384
|
}
|
|
408
385
|
|
|
409
386
|
export {
|
|
410
|
-
findSession,
|
|
411
|
-
subscribeSession,
|
|
412
|
-
disposeSessionWatcher,
|
|
413
|
-
disposeAllWatchers,
|
|
414
387
|
statusFromOutput,
|
|
415
388
|
hostBeat,
|
|
416
389
|
configurePtyPool,
|
|
@@ -420,6 +393,8 @@ export {
|
|
|
420
393
|
resumePersistedSessions,
|
|
421
394
|
spawnSpecFor,
|
|
422
395
|
ensurePty,
|
|
396
|
+
startAccountLogin,
|
|
397
|
+
stopAccountLogin,
|
|
423
398
|
listHostPtys,
|
|
424
399
|
ptyPids,
|
|
425
400
|
outputStatus,
|
|
@@ -436,4 +411,4 @@ export {
|
|
|
436
411
|
stopSessionPty,
|
|
437
412
|
detachPtyPool
|
|
438
413
|
};
|
|
439
|
-
//# sourceMappingURL=chunk-
|
|
414
|
+
//# sourceMappingURL=chunk-LQNHIMJM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/pty/output-status.ts","../src/core/pty/pty-pool.ts","../src/core/pty/account-login.ts"],"sourcesContent":["import type { SessionAttention } from '../api-types.js';\n\n/**\n * A status for a session whose tool isn't Claude Code (config `aiCommand`,\n * e.g. opencode): no hooks report its turns, so the PTY host's \"last printed\n * anything\" stands in — a working agent redraws its spinner, an idle one\n * prints nothing. Working while it printed in the last `OUTPUT_WORKING_MS`,\n * idle after; never \"done, unseen\" or \"needs input\" (output can't tell a\n * finished turn from a question). Pure.\n */\n\nexport const OUTPUT_WORKING_MS = 10_000;\n\nexport interface PtyOutput {\n /** The tool's binary (the host's spawn spec). */\n tool?: string;\n /** When it last printed (ISO). */\n lastOutputAt?: string;\n startedAt: string;\n}\n\nexport function statusFromOutput(p: PtyOutput, now: number): SessionAttention | null {\n if (!p.tool || p.tool === 'claude' || !p.lastOutputAt) return null;\n const at = Date.parse(p.lastOutputAt);\n if (!Number.isFinite(at)) return null;\n const working = now - at < OUTPUT_WORKING_MS;\n return {\n state: working ? 'working' : 'idle',\n seen: true,\n since: p.lastOutputAt,\n updatedAt: p.lastOutputAt,\n stale: false,\n summary: `${working ? 'Printing' : 'Quiet'} — from its terminal output (${p.tool} has no status hooks)`,\n };\n}\n","import path from 'node:path';\nimport type { AgentAdapter } from '../agents/types.js';\nimport { agentFor, agentSettings, assistantAgent } from '../agents/index.js';\nimport { statusFromOutput, type PtyOutput } from './output-status.js';\nimport type { SessionAttention } from '../api-types.js';\nimport type { HostBeat } from './host-health.js';\nimport { PtyHostBusyError } from './pty-host-client.js';\nimport { noClaudeBecause } from '../archive/archiving.js';\nimport { findSession, sessionIdFor } from '../sessions/web-state.js';\nimport type { WorktreeSession } from '../sessions/history.js';\nimport { hostStartLockPath, type SpawnSpec, type HostInfo, type PtyInfo } from './pty-host-protocol.js';\nimport { dbPtySessions } from './pty-sessions-file.js';\nimport { ensureFile, withFileLock } from '../platform/fs-safe.js';\nimport { forgetPersistedSession } from './pty-sessions-file.js';\nimport { loadConfig } from '../platform/config.js';\nimport { hasEnvDelta, type EnvDelta } from '../platform/env-delta.js';\nimport { ensureHost, findHost, PtyHostClient, findHostPatient, PtyHostVersionError } from './pty-host-client.js';\nimport { logSwallowed, swallow } from '../platform/best-effort.js';\nimport { ASSISTANT_ID, prepareAssistantDir } from '../agents/assistant.js';\nimport { accountLoginId, accountOfLoginId } from './account-login-id.js';\nimport { accountLoginSpec } from './account-login.js';\n\n/**\n * `work web`'s view of the Claude PTYs. The PTYs themselves live in the\n * PTY host (`work pty-host`, see core/pty-host.ts), a separate long-lived\n * process — so restarting or rebuilding `work web` never kills an agent,\n * and a real terminal (`work attach`) can share the same session.\n *\n * This module resolves a dashboard session to a spawn spec, asks the host\n * to spawn it on first attach, and keeps a small cache of which sessions\n * have a live PTY for the synchronous badge path (`peekPty`).\n */\n\nlet workBin = process.argv[1] ?? '';\n/** Whether this server may start the PTY host when none runs (not the dev server: see configurePtyPool). */\nlet mayStartHost = true;\nlet client: PtyHostClient | null = null;\nlet live = new Set<string>();\n/** The pids of those PTYs' processes (the Claudes the app runs). */\nlet livePids = new Set<number>();\n/** Each live PTY's tool and last output (for output-status.ts). */\nlet outputs = new Map<string, PtyOutput & { pid: number }>();\nlet refreshTimer: NodeJS.Timeout | null = null;\n/** The heartbeat (host-health.ts): each list request is one. */\nconst beat: HostBeat = { known: false, lastOkAt: null, latencyMs: null, lastError: null, hostVersion: null };\n\n/** How the host answered lately (for GET /api/pty-host/health). */\nexport function hostBeat(): HostBeat {\n return { ...beat };\n}\nconst REFRESH_MS = 2000;\n\n/** Called by `work web` at startup with the resolved `work` binary path,\n * which is what the host is spawned from. */\nexport function configurePtyPool(opts: { workBin: string; startHost?: boolean }): void {\n workBin = opts.workBin;\n // The dev server (`work web --dev`) uses the host that runs and never starts one: started\n // from a checkout's build, the long-lived host that owns every Claude would outlive it,\n // and the installed work would become a client of the checkout's code.\n mayStartHost = opts.startHost ?? true;\n}\n\n/** The `work` binary path, for routes that launch `work attach`. */\nexport function getWorkBin(): string {\n return workBin;\n}\n\nasync function getClient(spawnIfMissing: boolean): Promise<PtyHostClient | null> {\n if (client) {\n // Cheap liveness re-check happens in refresh(); a dead host surfaces\n // as a failed call, which resets `client` below.\n return client;\n }\n const info = spawnIfMissing && mayStartHost ? await ensureHost(workBin) : await findHost();\n if (!info && spawnIfMissing && !mayStartHost)\n throw new Error(\n \"No PTY host is running, and the dev server doesn't start one: start the installed work (its app or `work web`) first.\",\n );\n if (!info) return null;\n client = new PtyHostClient(info);\n startRefresh();\n return client;\n}\n\nasync function refresh(): Promise<void> {\n const t0 = Date.now();\n try {\n const c = await getClient(false);\n if (!c) {\n beat.known = false;\n beat.hostVersion = null; // gone: the next host says its own\n live = new Set();\n livePids = new Set();\n outputs = new Map();\n return;\n }\n beat.known = true;\n const ptys = await c.list();\n beat.lastOkAt = Date.now();\n beat.latencyMs = beat.lastOkAt - t0;\n beat.lastError = null;\n // Asked once per host (the client keeps it): the release it runs, to say when it's older than this work.\n beat.hostVersion = await c.workVersion();\n live = new Set(ptys.filter((p) => !p.exited).map((p) => p.id));\n livePids = new Set(ptys.filter((p) => !p.exited).map((p) => p.pid));\n outputs = new Map(\n ptys.filter((p) => !p.exited).map((p) => [p.id, { tool: p.tool, lastOutputAt: p.lastOutputAt, startedAt: p.startedAt, pid: p.pid }]),\n );\n } catch (err) {\n // Host went away (or was restarted on a new port) — rediscover next tick.\n // A busy host is still a host (it is there, just not answering).\n beat.known = beat.known || err instanceof PtyHostBusyError;\n beat.lastError = (err as Error).message;\n client = null;\n beat.hostVersion = null;\n live = new Set();\n livePids = new Set();\n outputs = new Map();\n }\n}\n\nfunction startRefresh(): void {\n if (refreshTimer) return;\n refreshTimer = setInterval(() => void refresh(), REFRESH_MS);\n refreshTimer.unref?.();\n}\n\n/** Connect to an already-running host at `work web` startup so badges for\n * PTYs that survived a web restart show immediately. Never spawns. */\n/** Re-read the host's PTY list now (the periodic refresh can be seconds old,\n * or not have run at all right after `work web` started). */\nexport async function syncPtyPool(): Promise<void> {\n await refresh();\n}\n\nexport async function initPtyPool(): Promise<void> {\n await refresh().catch(() => {});\n startRefresh();\n}\n\n/**\n * After a reboot (or a host crash) nothing is running but\n * `pty-sessions.json` still lists the sessions that were live. Starting the\n * host restores them; do that when there's something to restore, so\n * reopening `work web` picks up where you left off. Returns how many\n * sessions the host will bring back (0 = nothing to do).\n */\nexport async function resumePersistedSessions(): Promise<number> {\n let count: number;\n try {\n count = Object.keys(dbPtySessions.read()).length;\n } catch {\n return 0;\n }\n if (count === 0) return 0;\n if (await findHost().catch(() => true)) return 0; // already running\n await getClient(true);\n await refresh();\n return count;\n}\n\n/**\n * Where Claude runs for a session — the same directory `work tree` launches\n * in: the worktree for a single repo, the group root (parent of the\n * sub-repos) for a group.\n */\nexport { ASSISTANT_ID };\n\n/** The assistant runs config `assistantAgent` (Claude Code by default), in its folder written for that agent. */\nexport function assistantSpec(): { cwd: string; tool: ReturnType<AgentAdapter['launch']['tool']>; agentEnv?: EnvDelta } {\n const settings = agentSettings();\n const agent = assistantAgent(settings);\n // Work's own session, not any session's: the configured default account (`launch.env(null)`).\n const agentEnv = agent.launch.env?.(null);\n return { cwd: prepareAssistantDir(agent), tool: agent.launch.tool(settings), ...(hasEnvDelta(agentEnv) ? { agentEnv } : {}) };\n}\n\nexport function spawnSpecFor(session: WorktreeSession): SpawnSpec | null {\n const first = session.paths[0];\n if (!first) return null;\n const cwd = session.isGroup ? path.dirname(first) : first;\n const config = loadConfig();\n const launch = agentFor(config, session).launch;\n // The session's account: its agent's folder env, applied by the host over whatever environment it starts with.\n const agentEnv = launch.env?.(session);\n return { cwd, tool: launch.tool(config), port: session.port, ...(hasEnvDelta(agentEnv) ? { agentEnv } : {}) };\n}\n\n/**\n * Ensure a live PTY exists for the session (spawning Claude in the host if\n * needed) and return the host WebSocket URL to attach to. Null for an\n * unknown session.\n */\nexport async function ensurePty(sessionId: string, extra: { initialPrompt?: string } = {}): Promise<string | null> {\n // An account's login terminal (the Accounts page) is no session: the agent's own CLI on that account (account-login.ts).\n const loginFor = accountOfLoginId(sessionId);\n // The dashboard assistant (Ctrl+K) is not a worktree: it runs in its own\n // folder, which is (re)written first (assistant.ts).\n const notASession = sessionId === ASSISTANT_ID || loginFor !== null;\n const session = notASession ? null : findSession(sessionId);\n // Not for a session being archived, or archived: its Claude was stopped on\n // purpose (a Terminal tab still open on it reconnects and would start it).\n const refused = notASession ? null : noClaudeBecause(session, sessionId);\n if (refused) throw new Error(refused);\n const base =\n loginFor !== null\n ? accountLoginSpec(loginFor, agentFor(loadConfig()).accounts)\n : sessionId === ASSISTANT_ID\n ? assistantSpec()\n : session\n ? spawnSpecFor(session)\n : null;\n if (!base) return null;\n // The first prompt only applies to a fresh spawn (the host ignores the\n // spec when the session's PTY is already running).\n const spec = extra.initialPrompt ? { ...base, initialPrompt: extra.initialPrompt } : base;\n\n let c = await getClient(true);\n if (!c) return null;\n // A host from before accounts would start it on its own environment — another account than the session's.\n if (setsEnv(spec.agentEnv) && !(await hostTakesAgentEnv(c)) && !(await runsIn(c, sessionId))) throw new Error(OLD_HOST_ACCOUNTS);\n try {\n await c.spawn(sessionId, spec);\n } catch (err) {\n // Stale client (host restarted on a new port) — retry once, fresh.\n client = null;\n c = await getClient(true);\n if (!c) throw err;\n await c.spawn(sessionId, spec);\n }\n live.add(sessionId);\n return c.attachUrl(sessionId);\n}\n\n/** Start an account's login terminal in the PTY host (or find it running); its id, for the terminal WebSocket. */\nexport async function startAccountLogin(name: string): Promise<string> {\n const id = accountLoginId(name);\n if (!(await ensurePty(id))) throw new Error('the PTY host could not be started');\n return id;\n}\n\n/** Stop an account's login terminal (nothing when none runs). */\nexport async function stopAccountLogin(name: string): Promise<void> {\n await disposePty(accountLoginId(name));\n}\n\n/** Side-effect-free check: does an active (non-exited) PTY exist for this\n * session? Served from the refresh cache — used by session-meta for the\n * \"running/idle\" badge, which must stay synchronous. */\n/** Every PTY in the host, fresh (never starts a host; [] without one). */\nexport async function listHostPtys(): Promise<PtyInfo[]> {\n const c = await getClient(false);\n return c ? c.list() : [];\n}\n\n/** Pids of the Claudes running in the PTY host (from the refresh cache). */\nexport function ptyPids(): ReadonlySet<number> {\n return livePids;\n}\n\n/** A status from its terminal output, for a session whose tool has no hooks (output-status.ts); null for Claude or no PTY. */\nexport function outputStatus(sessionId: string, now = Date.now()): SessionAttention | null {\n const o = outputs.get(sessionId);\n return o ? statusFromOutput(o, now) : null;\n}\n\n/** When a session's terminal last printed (ms, from the refresh cache); null with no PTY or a host that doesn't say. */\nexport function ptyLastOutputMs(sessionId: string): number | null {\n const at = outputs.get(sessionId)?.lastOutputAt;\n const ms = at ? Date.parse(at) : NaN;\n return Number.isFinite(ms) ? ms : null;\n}\n\n/** Its agent's process id in the host (from the refresh cache); null with no PTY. */\nexport function ptyPid(sessionId: string): number | null {\n return outputs.get(sessionId)?.pid ?? null;\n}\n\nexport function peekPty(sessionId: string): boolean {\n return live.has(sessionId);\n}\n\n/** A session's live PTY screen as text; null when there is none (never spawns). */\nexport async function readPtyScreen(sessionId: string): Promise<string | null> {\n if (!live.has(sessionId)) return null;\n const c = await getClient(false);\n return c ? c.screen(sessionId) : null;\n}\n\n/** Write to a session's live PTY. False when there is none (never spawns). */\nexport async function writeToPty(sessionId: string, data: string): Promise<boolean> {\n if (!live.has(sessionId)) return false;\n const c = await getClient(false);\n return c ? c.write(sessionId, data) : false;\n}\n\n/**\n * Restart a session's agent in the host, resuming its conversation, its terminals\n * kept attached (agent-restart.ts). A host from before that call: stopped and\n * started again (an open Terminal tab then offers Enter, as after a stop).\n */\nexport async function restartPty(sessionId: string): Promise<string | void> {\n let c = await getClient(false);\n if (!c) throw new Error('the PTY host is not running');\n let how: Awaited<ReturnType<PtyHostClient['restart']>>;\n try {\n how = await c.restart(sessionId);\n } catch (err) {\n // A stale client (the host restarted on a new port before the refresh noticed): once more, fresh.\n client = null;\n c = await getClient(false);\n if (!c) throw err;\n how = await c.restart(sessionId);\n }\n if (how === 'not-running') throw new Error('its agent is not running in the PTY host');\n if (how === 'unsupported') {\n await disposePty(sessionId);\n if (!(await ensurePty(sessionId))) throw new Error('its agent could not be started again');\n return OLD_HOST_RESTART;\n }\n}\n\n/**\n * Stop a session's agent and keep its session in the host (entry, restore record, attached terminals) until `resumePty`:\n * a switch of account moves its conversation files in between. `stopped`: a host from before the call stopped it the old\n * way (its terminals were told it ended; `resumePtyOnAccount` then starts it fresh); `gone`: nothing was running.\n */\nexport async function haltPty(sessionId: string): Promise<'halted' | 'stopped' | 'gone'> {\n let c = await getClient(false);\n if (!c) throw new Error('the PTY host is not running');\n let how: Awaited<ReturnType<PtyHostClient['halt']>>;\n try {\n how = await c.halt(sessionId);\n } catch (err) {\n // A stale client (the host restarted on a new port before the refresh noticed): once more, fresh.\n client = null;\n c = await getClient(false);\n if (!c) throw err;\n how = await c.halt(sessionId);\n }\n if (how === 'not-running') return 'gone';\n if (how === 'unsupported') {\n await disposePty(sessionId);\n return 'stopped';\n }\n return 'halted';\n}\n\n/** Why a switch of account can't be done in this PTY host now (it is from before accounts), or null: asked before halting. */\nexport async function accountSwitchRefusal(): Promise<string | null> {\n const c = await getClient(false);\n return c && !(await hostTakesAgentEnv(c)) ? OLD_HOST_ACCOUNTS : null;\n}\n\n/**\n * Start a halted session's agent again in place, on `opts.agentEnv` (its terminals carry on). `not-halted`: it isn't\n * halted any more — the host started it again by itself (HALT_RESUME_MS) or restarted, on its old spec.\n */\nexport async function resumePty(sessionId: string, opts: { agentEnv?: EnvDelta } = {}): Promise<'resumed' | 'not-halted'> {\n let c = await getClient(false);\n if (!c) throw new Error('the PTY host is not running');\n if (hasEnvDelta(opts.agentEnv) && !(await hostTakesAgentEnv(c))) throw new Error(OLD_HOST_ACCOUNTS);\n let how: Awaited<ReturnType<PtyHostClient['resume']>>;\n try {\n how = await c.resume(sessionId, opts);\n } catch (err) {\n client = null;\n c = await getClient(false);\n if (!c) throw err;\n how = await c.resume(sessionId, opts);\n }\n return how;\n}\n\n/**\n * Start the agent of a session `haltPty` stopped, on the account the session records NOW (after a switch: the new one;\n * after one that failed: the old): resumed in place with that environment, or — `stopped`, an older host — started\n * again from a fresh spec (its terminals show it ended; opening the session reconnects).\n */\nexport async function resumePtyOnAccount(sessionId: string, how: 'halted' | 'stopped'): Promise<string | void> {\n if (how === 'stopped') {\n if (!(await ensurePty(sessionId))) throw new Error('its agent could not be started again');\n return OLD_HOST_RESTART;\n }\n const session = findSession(sessionId);\n const spec = session ? spawnSpecFor(session) : null;\n if (!spec) throw new Error('unknown session');\n // Nothing in the delta means no account change to apply (the default, with no accounts configured): a plain resume.\n const agentEnv = hasEnvDelta(spec.agentEnv) ? spec.agentEnv : undefined;\n if ((await resumePty(sessionId, agentEnv ? { agentEnv } : {})) === 'resumed') return;\n // Started again meanwhile on its OLD spec (the host's own resume after HALT_RESUME_MS — a long move —, or a host\n // restart's restore): restarted in place on the account the session records now, so it doesn't stay on the old one.\n const c = await getClient(false);\n if (!c) throw new Error('the PTY host is not running');\n const restarted = await c.restart(sessionId, agentEnv ? { agentEnv } : {});\n if (restarted === 'restarted') return RESTARTED_AFTER_AUTO_RESUME;\n // Not running now (it ended), or a host that couldn't take the environment in place: started fresh from the new spec.\n if (restarted === 'unsupported') await disposePty(sessionId);\n if (!(await ensurePty(sessionId))) throw new Error('its agent could not be started again');\n return RESTARTED_AFTER_AUTO_RESUME;\n}\n\n/** What a switch says when its halted Claude had been started again (on the old account) before the move was done. */\nexport const RESTARTED_AFTER_AUTO_RESUME =\n 'it had been started again on its old account while the conversation moved, so it was restarted on the new one';\n\n/** Said when a session on a named account would start in a PTY host that drops the account (one from before accounts). */\nexport const OLD_HOST_ACCOUNTS = 'the PTY host is from before Claude accounts: run `work pty-host --restart`';\n\n/** The delta sets a variable (a session on a named account): what an older host would drop, starting it elsewhere. */\nconst setsEnv = (d: EnvDelta | undefined): boolean => !!d && Object.values(d).some((v) => typeof v === 'string');\n\n/** The host applies `agentEnv`; one that can't be asked right now is given the benefit of the doubt (its restart says). */\nasync function hostTakesAgentEnv(c: PtyHostClient): Promise<boolean> {\n const f = await c.features();\n return f === null || f.includes('agentEnv');\n}\n\n/** Its agent runs in this host now (a spawn would only attach to it). */\nasync function runsIn(c: PtyHostClient, sessionId: string): Promise<boolean> {\n return (await c.list()).some((p) => p.id === sessionId && !p.exited);\n}\n\n/** How a restart on a PTY host from before restart-in-place went: what differs, and the way to the real thing. */\nexport const OLD_HOST_RESTART =\n 'stopped and started again (an older PTY host: open terminals show it ended, and it runs with only the variables `hostEnv` keeps; `work pty-host --restart` gets restarts in place)';\n\n/** Kill one session's PTY (if any). Called before removing a worktree so\n * the Claude process doesn't hold its cwd open (Windows refuses to delete\n * a directory that is some process's working directory). */\nexport async function disposePty(sessionId: string): Promise<void> {\n live.delete(sessionId);\n let c = client;\n if (!c) {\n // A busy host (mid-restore) is waited for, not skipped: skipping left\n // Claude running inside the worktree about to be deleted. A host from\n // another build can't be talked to — nothing to do but proceed.\n let info: HostInfo | null;\n try {\n info = await findHostPatient();\n } catch (err) {\n if (err instanceof PtyHostVersionError) return;\n throw err; // still busy after waiting: let the caller report it\n }\n if (!info) return;\n c = new PtyHostClient(info);\n }\n await c.kill(sessionId).catch(swallow(`stop session ${sessionId} in the PTY host`));\n}\n\n/**\n * Stop a session's Claude in the PTY host before its worktree is deleted —\n * from any caller, including the CLI (`work remove` / prune / sync), which\n * doesn't run a pool. Never starts a host; waits for the process to exit\n * (the host's kill does) so Windows can then delete the directory.\n * Best-effort: no host, or a host that can't be reached, is a no-op.\n */\nexport async function stopSessionPty(target: string, branch: string): Promise<void> {\n const id = sessionIdFor({ target, branch } as WorktreeSession);\n live.delete(id);\n // Under the host START lock: a host that's starting holds it until it has\n // restored, so we either see it running (and kill the session) or know\n // none is — and then drop the session from the saved list so a later\n // start doesn't restore Claude into a worktree that's being deleted.\n const lock = hostStartLockPath();\n ensureFile(lock, '');\n await withFileLock(lock, async () => {\n let info;\n try {\n info = await findHostPatient();\n } catch (err) {\n // A host from another build can't be talked to; one still busy after\n // waiting is running and owns the session — leave both alone (and\n // never drop the saved entry: the host is what it belongs to).\n logSwallowed(`stop session ${id}: PTY host`, err);\n return;\n }\n if (info) await new PtyHostClient(info).kill(id).catch(swallow(`stop session ${id} in the PTY host`));\n else await forgetPersistedSession(id).catch(swallow(`forget saved session ${id}`));\n }).catch(swallow(`stop session ${id}: host start lock`));\n}\n\n/** `work web` shutdown. Deliberately does NOT kill anything: the PTYs belong\n * to the host and outlive the dashboard. Just stops polling. */\nexport function detachPtyPool(): void {\n if (refreshTimer) clearInterval(refreshTimer);\n refreshTimer = null;\n client = null;\n live = new Set();\n livePids = new Set();\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\nimport { AccountAdminError, type AgentAccounts } from '../agents/types.js';\nimport { getConfigDir } from '../platform/config.js';\nimport { hasEnvDelta } from '../platform/env-delta.js';\nimport type { SpawnSpec } from './pty-host-protocol.js';\n\n/**\n * The dashboard's login terminal for an account (the Accounts page's Add / Log in): the agent's own CLI on that account\n * (`admin.loginLaunch`, what `work account add` runs in your terminal), started in the PTY host under\n * `accountLoginId(name)` (account-login-id.ts) so the page can show it. A new conversation every time (`fresh`): there is\n * nothing to resume, and it runs in a folder of its own, never a worktree. Never restored by a host restart\n * (pty-registry.ts), and stopped when its panel closes. The agent starts in its own permission mode, as every start.\n */\n\n/** Where the login terminal runs: a folder of work's own (an agent may ask once whether to trust it). */\nexport const accountLoginDir = (): string => path.join(getConfigDir(), 'account-login');\n\n/** The host's spawn spec for an account's login terminal. Throws an AccountAdminError for an account work can't log in to. */\nexport function accountLoginSpec(\n name: string,\n accounts: Pick<AgentAccounts, 'has' | 'admin'> | undefined,\n dir: string = accountLoginDir(),\n): SpawnSpec {\n if (!accounts?.admin) throw new AccountAdminError('its accounts are not managed by work');\n if (!accounts.has(name)) throw new AccountAdminError(`no account “${name}”`);\n const { tool, agentEnv } = accounts.admin.loginLaunch(name);\n fs.mkdirSync(dir, { recursive: true });\n return { cwd: dir, tool, fresh: true, ...(hasEnvDelta(agentEnv) ? { agentEnv } : {}) };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWO,IAAM,oBAAoB;AAU1B,SAAS,iBAAiB,GAAc,KAAsC;AACnF,MAAI,CAAC,EAAE,QAAQ,EAAE,SAAS,YAAY,CAAC,EAAE,aAAc,QAAO;AAC9D,QAAM,KAAK,KAAK,MAAM,EAAE,YAAY;AACpC,MAAI,CAAC,OAAO,SA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
9
|
import {
|
|
10
10
|
report
|
|
11
11
|
} from "./chunk-AU27USPZ.js";
|
|
@@ -131,4 +131,4 @@ export {
|
|
|
131
131
|
isStaleEntry,
|
|
132
132
|
tag
|
|
133
133
|
};
|
|
134
|
-
//# sourceMappingURL=chunk-
|
|
134
|
+
//# sourceMappingURL=chunk-MKJH2D4V.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
BUILD_DIR_NAMES
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-I6MILNM5.js";
|
|
5
5
|
|
|
6
6
|
// src/core/worktree/repo-rules.ts
|
|
7
7
|
var baseName = (p) => p.replace(/[\\/]+$/, "").split(/[\\/]/).pop() ?? p;
|
|
@@ -143,4 +143,4 @@ export {
|
|
|
143
143
|
readGitConfig,
|
|
144
144
|
scanForRepos
|
|
145
145
|
};
|
|
146
|
-
//# sourceMappingURL=chunk-
|
|
146
|
+
//# sourceMappingURL=chunk-MQCDFSVF.js.map
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
spawn_default
|
|
4
|
+
} from "./chunk-EL3XL2OC.js";
|
|
2
5
|
|
|
3
6
|
// src/commands/shared/setup-completions.ts
|
|
4
7
|
import fs from "fs";
|
|
5
8
|
import path from "path";
|
|
6
9
|
import os from "os";
|
|
7
10
|
import chalk from "chalk";
|
|
8
|
-
import spawn from "cross-spawn";
|
|
9
11
|
var PS_COMPLETION_LINE = "work completion --shell powershell | Out-String | Invoke-Expression";
|
|
10
12
|
var BASH_COMPLETION_LINE = 'eval "$(work completion)"';
|
|
11
13
|
var ZSH_COMPLETION_LINE = 'eval "$(work completion --shell zsh)"';
|
|
@@ -21,7 +23,7 @@ var MARKER = "# work tab completions";
|
|
|
21
23
|
var LEGACY_MARKER = "# work2 tab completions";
|
|
22
24
|
function getWindowsDocumentsFolder() {
|
|
23
25
|
for (const exe of ["pwsh", "powershell"]) {
|
|
24
|
-
const result =
|
|
26
|
+
const result = spawn_default.sync(exe, ["-NoProfile", "-Command", "[Environment]::GetFolderPath('MyDocuments')"], {
|
|
25
27
|
encoding: "utf-8",
|
|
26
28
|
stdio: ["pipe", "pipe", "pipe"],
|
|
27
29
|
windowsHide: true
|
|
@@ -35,7 +37,7 @@ function getWindowsDocumentsFolder() {
|
|
|
35
37
|
}
|
|
36
38
|
function executableExists(name) {
|
|
37
39
|
const cmd = process.platform === "win32" ? "where" : "which";
|
|
38
|
-
const result =
|
|
40
|
+
const result = spawn_default.sync(cmd, [name], {
|
|
39
41
|
encoding: "utf-8",
|
|
40
42
|
stdio: ["pipe", "pipe", "pipe"],
|
|
41
43
|
windowsHide: true
|
|
@@ -174,4 +176,4 @@ export {
|
|
|
174
176
|
printCompletionResults,
|
|
175
177
|
printManualInstructions
|
|
176
178
|
};
|
|
177
|
-
//# sourceMappingURL=chunk-
|
|
179
|
+
//# sourceMappingURL=chunk-MSJWQC7H.js.map
|