@moberg_hr/work-tree 2.22.5 → 2.23.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-J55P3HXH.js → account-FKQZQP3W.js} +20 -17
- package/dist/{account-J55P3HXH.js.map → account-FKQZQP3W.js.map} +1 -1
- package/dist/{add-repo-ALVEGU25.js → add-repo-VJ2OPGRB.js} +10 -10
- package/dist/{answer-CI2SPQQL.js → answer-HQGVCGOF.js} +8 -8
- package/dist/{attach-7LBIFBLX.js → attach-M46SZYRL.js} +18 -15
- package/dist/{attach-7LBIFBLX.js.map → attach-M46SZYRL.js.map} +1 -1
- package/dist/bin.js +3 -3
- package/dist/{block-TVIYWRJ5.js → block-B2WNCH52.js} +10 -10
- package/dist/{broadcast-GZNMZFOY.js → broadcast-JD755S3I.js} +6 -6
- package/dist/{catchup-ZURJI6BF.js → catchup-PTV2VTWT.js} +11 -11
- package/dist/{child-K6YYF6MQ.js → child-XFLJLJ6I.js} +8 -8
- package/dist/{chunk-RTCTD5PJ.js → chunk-26BZGPFZ.js} +3 -3
- package/dist/{chunk-EVTMZ5IH.js → chunk-336YLJ5L.js} +60 -60
- package/dist/{chunk-OCUUM755.js → chunk-4FOC35LW.js} +2 -2
- package/dist/{chunk-B2WV5RAL.js → chunk-4GIAERRK.js} +5 -5
- package/dist/{chunk-BQS73CWR.js → chunk-4LZLVHZE.js} +2 -2
- package/dist/{chunk-DCENKA6E.js → chunk-4VTRRZWZ.js} +2 -2
- package/dist/{chunk-GNERWNZY.js → chunk-5IZMEAKN.js} +4 -4
- package/dist/{chunk-ATQB6PTV.js → chunk-5THKIWZU.js} +3 -3
- package/dist/{chunk-NOQA7MJ4.js → chunk-6HVDHGNE.js} +3 -3
- package/dist/{chunk-NYGKSOQ4.js → chunk-6ISLCEBR.js} +6 -6
- package/dist/chunk-6KMG4WNW.js +87 -0
- package/dist/chunk-6KMG4WNW.js.map +1 -0
- package/dist/{chunk-F4UIKOU6.js → chunk-6RFDASKQ.js} +4 -4
- package/dist/{chunk-5P27YL64.js → chunk-7I2UHJJF.js} +8 -8
- package/dist/{chunk-FV7BSQPQ.js → chunk-AEH72XTU.js} +2 -2
- package/dist/{chunk-3ZPVKUYD.js → chunk-ASGJ3MCL.js} +6 -1
- package/dist/chunk-ASGJ3MCL.js.map +1 -0
- package/dist/{chunk-DF4GOVDE.js → chunk-AUIHERJ7.js} +2 -2
- package/dist/{chunk-6Y3VLCKA.js → chunk-AZF7HIDT.js} +3 -3
- package/dist/chunk-BCYBF7KJ.js +207 -0
- package/dist/chunk-BCYBF7KJ.js.map +1 -0
- package/dist/{chunk-KQMHGEI2.js → chunk-BS6GTKF2.js} +51 -13
- package/dist/chunk-BS6GTKF2.js.map +1 -0
- package/dist/{chunk-AIYZJ7XD.js → chunk-BTGPUOF7.js} +5 -5
- package/dist/chunk-CJFAJV2K.js +9 -0
- package/dist/{chunk-VQDE3DRG.js → chunk-DHZ5DF6Y.js} +6 -2
- package/dist/{chunk-VQDE3DRG.js.map → chunk-DHZ5DF6Y.js.map} +1 -1
- package/dist/{chunk-LV5JRLBM.js → chunk-DP6YMZUL.js} +2 -2
- package/dist/{chunk-Z4FWXDJG.js → chunk-DSDPJATB.js} +3 -3
- package/dist/{chunk-RLPC3YKZ.js → chunk-EE744F4B.js} +2 -2
- package/dist/{chunk-QOLHDDM2.js → chunk-EEMPMVCP.js} +4 -4
- package/dist/{chunk-SDYY5MHW.js → chunk-EJZMCAM2.js} +7 -7
- package/dist/{chunk-EYJ42LDG.js → chunk-EOXYDFBB.js} +4 -4
- package/dist/{chunk-DC73NF67.js → chunk-ETO7CUIS.js} +3 -3
- package/dist/{chunk-ZO7TF5OL.js → chunk-ETRKZHM5.js} +4 -4
- package/dist/{chunk-HI674QZF.js → chunk-EVGYDJI2.js} +2 -2
- package/dist/{chunk-PUJSLL6R.js → chunk-FEI73IPX.js} +4 -4
- package/dist/{chunk-KU3TQAA7.js → chunk-FRFS6JC4.js} +8 -10
- package/dist/{chunk-KU3TQAA7.js.map → chunk-FRFS6JC4.js.map} +1 -1
- package/dist/{chunk-4QMWNAEJ.js → chunk-HCYES6U7.js} +2 -2
- package/dist/{chunk-WRDULHAN.js → chunk-HTV7366A.js} +117 -16
- package/dist/chunk-HTV7366A.js.map +1 -0
- package/dist/{chunk-5FIUVBUC.js → chunk-JIMD77FI.js} +7 -7
- package/dist/{chunk-TOMDOA4P.js → chunk-K76NOSEX.js} +2 -2
- package/dist/{chunk-FGBLFF4O.js → chunk-KUYEYPO4.js} +2 -2
- package/dist/{chunk-Z4P23XG3.js → chunk-L5U47Q63.js} +5 -5
- package/dist/{chunk-YO3BNAAK.js → chunk-LZJ5VDUD.js} +26 -4
- package/dist/chunk-LZJ5VDUD.js.map +1 -0
- package/dist/{chunk-USENBMUV.js → chunk-NS7WH53I.js} +1 -1
- package/dist/chunk-NS7WH53I.js.map +1 -0
- package/dist/{chunk-EA4C6TVY.js → chunk-O7BXNXU2.js} +3 -3
- package/dist/{chunk-ZTWZS5RK.js → chunk-OETBYJFV.js} +3 -3
- package/dist/chunk-PCJVBGRS.js +64 -0
- package/dist/chunk-PCJVBGRS.js.map +1 -0
- package/dist/{chunk-RNPNBGVX.js → chunk-QPQV3IU2.js} +3 -5
- package/dist/{chunk-RNPNBGVX.js.map → chunk-QPQV3IU2.js.map} +1 -1
- package/dist/chunk-R7IENU76.js +79 -0
- package/dist/chunk-R7IENU76.js.map +1 -0
- package/dist/{chunk-23QLXVH6.js → chunk-R7JIKEIL.js} +12 -14
- package/dist/{chunk-23QLXVH6.js.map → chunk-R7JIKEIL.js.map} +1 -1
- package/dist/{chunk-CA56ETYX.js → chunk-TVIM5VV5.js} +5 -5
- package/dist/{chunk-PTAG6WIE.js → chunk-UGDTSOPX.js} +17 -3
- package/dist/chunk-UGDTSOPX.js.map +1 -0
- package/dist/{chunk-D2SVBU7R.js → chunk-ULI54QYZ.js} +2 -2
- package/dist/{chunk-7Q5PBXF6.js → chunk-V56WW2LA.js} +51 -10
- package/dist/chunk-V56WW2LA.js.map +1 -0
- package/dist/{chunk-G4T2HGLJ.js → chunk-V6FD76AQ.js} +4 -4
- package/dist/{chunk-QNOJOZYK.js → chunk-VVJY6IKW.js} +2 -2
- package/dist/{chunk-Q2B3NUSM.js → chunk-WLYWO6JH.js} +4 -4
- package/dist/{chunk-IU6LA6EB.js → chunk-WYCGV5Z7.js} +4 -4
- package/dist/{chunk-AITL3JYB.js → chunk-XJQ7XJJC.js} +398 -68
- package/dist/chunk-XJQ7XJJC.js.map +1 -0
- package/dist/{chunk-CMRTNTMU.js → chunk-Z3JSYKOS.js} +6 -6
- package/dist/{chunk-UAF2YFLZ.js → chunk-ZBVM57LO.js} +6 -6
- package/dist/{chunk-GQ5WECPJ.js → chunk-ZDTFAMD2.js} +2 -2
- package/dist/{chunk-EEHPZMS3.js → chunk-ZIZ5ZTEN.js} +2 -2
- package/dist/{cleanup-G4WQACD6.js → cleanup-RVQ2PPCC.js} +30 -29
- package/dist/{cleanup-G4WQACD6.js.map → cleanup-RVQ2PPCC.js.map} +1 -1
- package/dist/{cli-OPORB5PF.js → cli-RQ7LQXRX.js} +4 -4
- package/dist/{color-C223W3Z6.js → color-37SJ7NPH.js} +9 -9
- package/dist/{config-KQYXQCQA.js → config-QMNCPBT7.js} +8 -8
- package/dist/{coordinate-4E5GIMC6.js → coordinate-22N2UBE4.js} +9 -9
- package/dist/{diff-HEOLTXO2.js → diff-VSM47DNB.js} +9 -10
- package/dist/{diff-HEOLTXO2.js.map → diff-VSM47DNB.js.map} +1 -1
- package/dist/{digest-GYF4YLUH.js → digest-H5YMEW54.js} +8 -8
- package/dist/{fork-B35ONP3Z.js → fork-Q2AEFG5M.js} +27 -24
- package/dist/{fork-B35ONP3Z.js.map → fork-Q2AEFG5M.js.map} +1 -1
- package/dist/{history-25DNQKKC.js → history-E34WUNZO.js} +6 -6
- package/dist/{hook-B4JO2X57.js → hook-IMBHXXH2.js} +17 -17
- package/dist/{hydrate-IJEKNZIP.js → hydrate-IPNTSEDA.js} +6 -6
- package/dist/{init-UJVOUDJI.js → init-V7Z3RVHQ.js} +10 -10
- package/dist/{install-skills-FV2L5QHE.js → install-skills-PP7WYASM.js} +6 -7
- package/dist/install-skills-bin.js +5 -6
- package/dist/install-skills-bin.js.map +1 -1
- package/dist/{keep-PKXGFZO2.js → keep-JZBFDYC5.js} +8 -8
- package/dist/{list-VYQ3QE2H.js → list-D6GWBNUI.js} +6 -6
- package/dist/{move-IAZY23ZX.js → move-T6IVLRRI.js} +13 -13
- package/dist/{note-6HQUKUYY.js → note-L4YF6DYN.js} +8 -8
- package/dist/{overlaps-CGP3RJOW.js → overlaps-33U2T7IV.js} +11 -11
- package/dist/{pin-PAWGQ4Q2.js → pin-BVNCXHQI.js} +9 -9
- package/dist/{pr-OJOGE3A3.js → pr-DBTWVMRE.js} +19 -18
- package/dist/{pr-OJOGE3A3.js.map → pr-DBTWVMRE.js.map} +1 -1
- package/dist/{prune-42MS36OR.js → prune-HUYBTMZM.js} +27 -27
- package/dist/pty-host-IJFDGRA4.js +2653 -0
- package/dist/pty-host-IJFDGRA4.js.map +1 -0
- package/dist/{read-ATNCW4KH.js → read-4OUYRSKS.js} +8 -8
- package/dist/{recent-MTBFQT36.js → recent-PB233FPD.js} +14 -13
- package/dist/{recent-MTBFQT36.js.map → recent-PB233FPD.js.map} +1 -1
- package/dist/{remove-GLDJOKUI.js → remove-YCQLIDTS.js} +28 -28
- package/dist/{report-AK7Z2Y4S.js → report-XMESBL7C.js} +8 -8
- package/dist/{restart-DEPDGEZB.js → restart-NQ5DJ3TN.js} +8 -8
- package/dist/{resume-C2QPKKFN.js → resume-KL5JCKVD.js} +14 -13
- package/dist/{resume-C2QPKKFN.js.map → resume-KL5JCKVD.js.map} +1 -1
- package/dist/{review-RYAGH3PY.js → review-MIKB545E.js} +7 -7
- package/dist/{review-now-K4UWD7A5.js → review-now-VF6X6M64.js} +2 -2
- package/dist/{run-WNP2SMNW.js → run-Y255ESUN.js} +6 -6
- package/dist/{screen-P746M4F2.js → screen-AZFHPOCB.js} +8 -8
- package/dist/{search-XQ2WMK5X.js → search-DAFKJTLY.js} +6 -6
- package/dist/{section-Q7TPOV7U.js → section-WCC35C44.js} +9 -9
- package/dist/{send-EGG23J2B.js → send-MYEMZU7Z.js} +9 -9
- package/dist/{sessions-2NNCWIND.js → sessions-P3D46QLP.js} +24 -22
- package/dist/{sessions-2NNCWIND.js.map → sessions-P3D46QLP.js.map} +1 -1
- package/dist/{show-KSMC7AJL.js → show-JOO5OT2F.js} +7 -7
- package/dist/{snooze-4LVYUQEX.js → snooze-7KLABMIG.js} +8 -8
- package/dist/{start-YKLLXW3L.js → start-PGVZZJQT.js} +8 -8
- package/dist/{state-GM22X3RN.js → state-XHTOESKK.js} +3 -3
- package/dist/state-XHTOESKK.js.map +1 -0
- package/dist/{status-4HGP4ZEF.js → status-CXIRNRMP.js} +9 -9
- package/dist/{statusline-QJ6CJGHB.js → statusline-HPH2ORNT.js} +3 -3
- package/dist/{stop-YBQL6NFF.js → stop-IJNUSRIG.js} +8 -8
- package/dist/{sync-DUXN2MFJ.js → sync-3HMCC55V.js} +27 -27
- package/dist/{time-Q42HPZZ3.js → time-DUDNSHM3.js} +9 -9
- package/dist/{time-actions-IXZRVKKQ.js → time-actions-M4QTTH4M.js} +3 -3
- package/dist/{timesheet-YJ6O3GUU.js → timesheet-BMKDX5KZ.js} +12 -12
- package/dist/{todo-ZBFRL2A5.js → todo-QMXJ5R3E.js} +2 -2
- package/dist/{tree-H2UYE6LH.js → tree-TL4GISI5.js} +28 -26
- package/dist/{tree-H2UYE6LH.js.map → tree-TL4GISI5.js.map} +1 -1
- package/dist/{update-RGNKMRUL.js → update-3TODL7J3.js} +13 -13
- package/dist/{usage-YZRZKJ3H.js → usage-YFTN2IS7.js} +8 -8
- package/dist/{usage-ask-BYPNLA2B.js → usage-ask-EZR3W3UW.js} +3 -3
- package/dist/{version-4IOMOIDP.js → version-LNHKXZBP.js} +4 -4
- package/dist/{wait-YOHPFWVJ.js → wait-B37BTCVG.js} +9 -9
- package/dist/wd-bin.js +3 -3
- package/dist/web/assets/{PtyView-CYAhB_pW.js → PtyView-C8yW4SST.js} +26 -28
- package/dist/web/assets/PtyView-C8yW4SST.js.map +1 -0
- package/dist/web/assets/index-DDZCgbD-.js +129 -0
- package/dist/web/assets/index-DDZCgbD-.js.map +1 -0
- package/dist/web/assets/index-yBTfBzDm.css +1 -0
- package/dist/web/index.html +2 -2
- package/dist/{web-Q672AIMZ.js → web-JAAXINIU.js} +468 -492
- package/dist/web-JAAXINIU.js.map +1 -0
- package/npm-shrinkwrap.json +3 -4
- package/package.json +2 -2
- package/dist/chunk-3ZPVKUYD.js.map +0 -1
- package/dist/chunk-7Q5PBXF6.js.map +0 -1
- package/dist/chunk-7ZOY2QQN.js +0 -43
- package/dist/chunk-7ZOY2QQN.js.map +0 -1
- package/dist/chunk-AITL3JYB.js.map +0 -1
- package/dist/chunk-EXZ4A6VJ.js +0 -9
- package/dist/chunk-ICEP4WAK.js +0 -256
- package/dist/chunk-ICEP4WAK.js.map +0 -1
- package/dist/chunk-KQMHGEI2.js.map +0 -1
- package/dist/chunk-LNHSBM4L.js +0 -26
- package/dist/chunk-LNHSBM4L.js.map +0 -1
- package/dist/chunk-PTAG6WIE.js.map +0 -1
- package/dist/chunk-USENBMUV.js.map +0 -1
- package/dist/chunk-WRDULHAN.js.map +0 -1
- package/dist/chunk-YO3BNAAK.js.map +0 -1
- package/dist/pty-host-EAWW62U4.js +0 -1235
- package/dist/pty-host-EAWW62U4.js.map +0 -1
- package/dist/state-GM22X3RN.js.map +0 -1
- package/dist/web/assets/PtyView-CYAhB_pW.js.map +0 -1
- package/dist/web/assets/index-Ca7KbCED.css +0 -1
- package/dist/web/assets/index-iBmmgBZv.js +0 -129
- package/dist/web/assets/index-iBmmgBZv.js.map +0 -1
- package/dist/web-Q672AIMZ.js.map +0 -1
- /package/dist/{add-repo-ALVEGU25.js.map → add-repo-VJ2OPGRB.js.map} +0 -0
- /package/dist/{answer-CI2SPQQL.js.map → answer-HQGVCGOF.js.map} +0 -0
- /package/dist/{block-TVIYWRJ5.js.map → block-B2WNCH52.js.map} +0 -0
- /package/dist/{broadcast-GZNMZFOY.js.map → broadcast-JD755S3I.js.map} +0 -0
- /package/dist/{catchup-ZURJI6BF.js.map → catchup-PTV2VTWT.js.map} +0 -0
- /package/dist/{child-K6YYF6MQ.js.map → child-XFLJLJ6I.js.map} +0 -0
- /package/dist/{chunk-RTCTD5PJ.js.map → chunk-26BZGPFZ.js.map} +0 -0
- /package/dist/{chunk-EVTMZ5IH.js.map → chunk-336YLJ5L.js.map} +0 -0
- /package/dist/{chunk-OCUUM755.js.map → chunk-4FOC35LW.js.map} +0 -0
- /package/dist/{chunk-B2WV5RAL.js.map → chunk-4GIAERRK.js.map} +0 -0
- /package/dist/{chunk-BQS73CWR.js.map → chunk-4LZLVHZE.js.map} +0 -0
- /package/dist/{chunk-DCENKA6E.js.map → chunk-4VTRRZWZ.js.map} +0 -0
- /package/dist/{chunk-GNERWNZY.js.map → chunk-5IZMEAKN.js.map} +0 -0
- /package/dist/{chunk-ATQB6PTV.js.map → chunk-5THKIWZU.js.map} +0 -0
- /package/dist/{chunk-NOQA7MJ4.js.map → chunk-6HVDHGNE.js.map} +0 -0
- /package/dist/{chunk-NYGKSOQ4.js.map → chunk-6ISLCEBR.js.map} +0 -0
- /package/dist/{chunk-F4UIKOU6.js.map → chunk-6RFDASKQ.js.map} +0 -0
- /package/dist/{chunk-5P27YL64.js.map → chunk-7I2UHJJF.js.map} +0 -0
- /package/dist/{chunk-FV7BSQPQ.js.map → chunk-AEH72XTU.js.map} +0 -0
- /package/dist/{chunk-DF4GOVDE.js.map → chunk-AUIHERJ7.js.map} +0 -0
- /package/dist/{chunk-6Y3VLCKA.js.map → chunk-AZF7HIDT.js.map} +0 -0
- /package/dist/{chunk-AIYZJ7XD.js.map → chunk-BTGPUOF7.js.map} +0 -0
- /package/dist/{chunk-EXZ4A6VJ.js.map → chunk-CJFAJV2K.js.map} +0 -0
- /package/dist/{chunk-LV5JRLBM.js.map → chunk-DP6YMZUL.js.map} +0 -0
- /package/dist/{chunk-Z4FWXDJG.js.map → chunk-DSDPJATB.js.map} +0 -0
- /package/dist/{chunk-RLPC3YKZ.js.map → chunk-EE744F4B.js.map} +0 -0
- /package/dist/{chunk-QOLHDDM2.js.map → chunk-EEMPMVCP.js.map} +0 -0
- /package/dist/{chunk-SDYY5MHW.js.map → chunk-EJZMCAM2.js.map} +0 -0
- /package/dist/{chunk-EYJ42LDG.js.map → chunk-EOXYDFBB.js.map} +0 -0
- /package/dist/{chunk-DC73NF67.js.map → chunk-ETO7CUIS.js.map} +0 -0
- /package/dist/{chunk-ZO7TF5OL.js.map → chunk-ETRKZHM5.js.map} +0 -0
- /package/dist/{chunk-HI674QZF.js.map → chunk-EVGYDJI2.js.map} +0 -0
- /package/dist/{chunk-PUJSLL6R.js.map → chunk-FEI73IPX.js.map} +0 -0
- /package/dist/{chunk-4QMWNAEJ.js.map → chunk-HCYES6U7.js.map} +0 -0
- /package/dist/{chunk-5FIUVBUC.js.map → chunk-JIMD77FI.js.map} +0 -0
- /package/dist/{chunk-TOMDOA4P.js.map → chunk-K76NOSEX.js.map} +0 -0
- /package/dist/{chunk-FGBLFF4O.js.map → chunk-KUYEYPO4.js.map} +0 -0
- /package/dist/{chunk-Z4P23XG3.js.map → chunk-L5U47Q63.js.map} +0 -0
- /package/dist/{chunk-EA4C6TVY.js.map → chunk-O7BXNXU2.js.map} +0 -0
- /package/dist/{chunk-ZTWZS5RK.js.map → chunk-OETBYJFV.js.map} +0 -0
- /package/dist/{chunk-CA56ETYX.js.map → chunk-TVIM5VV5.js.map} +0 -0
- /package/dist/{chunk-D2SVBU7R.js.map → chunk-ULI54QYZ.js.map} +0 -0
- /package/dist/{chunk-G4T2HGLJ.js.map → chunk-V6FD76AQ.js.map} +0 -0
- /package/dist/{chunk-QNOJOZYK.js.map → chunk-VVJY6IKW.js.map} +0 -0
- /package/dist/{chunk-Q2B3NUSM.js.map → chunk-WLYWO6JH.js.map} +0 -0
- /package/dist/{chunk-IU6LA6EB.js.map → chunk-WYCGV5Z7.js.map} +0 -0
- /package/dist/{chunk-CMRTNTMU.js.map → chunk-Z3JSYKOS.js.map} +0 -0
- /package/dist/{chunk-UAF2YFLZ.js.map → chunk-ZBVM57LO.js.map} +0 -0
- /package/dist/{chunk-GQ5WECPJ.js.map → chunk-ZDTFAMD2.js.map} +0 -0
- /package/dist/{chunk-EEHPZMS3.js.map → chunk-ZIZ5ZTEN.js.map} +0 -0
- /package/dist/{cli-OPORB5PF.js.map → cli-RQ7LQXRX.js.map} +0 -0
- /package/dist/{color-C223W3Z6.js.map → color-37SJ7NPH.js.map} +0 -0
- /package/dist/{config-KQYXQCQA.js.map → config-QMNCPBT7.js.map} +0 -0
- /package/dist/{coordinate-4E5GIMC6.js.map → coordinate-22N2UBE4.js.map} +0 -0
- /package/dist/{digest-GYF4YLUH.js.map → digest-H5YMEW54.js.map} +0 -0
- /package/dist/{history-25DNQKKC.js.map → history-E34WUNZO.js.map} +0 -0
- /package/dist/{hook-B4JO2X57.js.map → hook-IMBHXXH2.js.map} +0 -0
- /package/dist/{hydrate-IJEKNZIP.js.map → hydrate-IPNTSEDA.js.map} +0 -0
- /package/dist/{init-UJVOUDJI.js.map → init-V7Z3RVHQ.js.map} +0 -0
- /package/dist/{install-skills-FV2L5QHE.js.map → install-skills-PP7WYASM.js.map} +0 -0
- /package/dist/{keep-PKXGFZO2.js.map → keep-JZBFDYC5.js.map} +0 -0
- /package/dist/{list-VYQ3QE2H.js.map → list-D6GWBNUI.js.map} +0 -0
- /package/dist/{move-IAZY23ZX.js.map → move-T6IVLRRI.js.map} +0 -0
- /package/dist/{note-6HQUKUYY.js.map → note-L4YF6DYN.js.map} +0 -0
- /package/dist/{overlaps-CGP3RJOW.js.map → overlaps-33U2T7IV.js.map} +0 -0
- /package/dist/{pin-PAWGQ4Q2.js.map → pin-BVNCXHQI.js.map} +0 -0
- /package/dist/{prune-42MS36OR.js.map → prune-HUYBTMZM.js.map} +0 -0
- /package/dist/{read-ATNCW4KH.js.map → read-4OUYRSKS.js.map} +0 -0
- /package/dist/{remove-GLDJOKUI.js.map → remove-YCQLIDTS.js.map} +0 -0
- /package/dist/{report-AK7Z2Y4S.js.map → report-XMESBL7C.js.map} +0 -0
- /package/dist/{restart-DEPDGEZB.js.map → restart-NQ5DJ3TN.js.map} +0 -0
- /package/dist/{review-RYAGH3PY.js.map → review-MIKB545E.js.map} +0 -0
- /package/dist/{review-now-K4UWD7A5.js.map → review-now-VF6X6M64.js.map} +0 -0
- /package/dist/{run-WNP2SMNW.js.map → run-Y255ESUN.js.map} +0 -0
- /package/dist/{screen-P746M4F2.js.map → screen-AZFHPOCB.js.map} +0 -0
- /package/dist/{search-XQ2WMK5X.js.map → search-DAFKJTLY.js.map} +0 -0
- /package/dist/{section-Q7TPOV7U.js.map → section-WCC35C44.js.map} +0 -0
- /package/dist/{send-EGG23J2B.js.map → send-MYEMZU7Z.js.map} +0 -0
- /package/dist/{show-KSMC7AJL.js.map → show-JOO5OT2F.js.map} +0 -0
- /package/dist/{snooze-4LVYUQEX.js.map → snooze-7KLABMIG.js.map} +0 -0
- /package/dist/{start-YKLLXW3L.js.map → start-PGVZZJQT.js.map} +0 -0
- /package/dist/{status-4HGP4ZEF.js.map → status-CXIRNRMP.js.map} +0 -0
- /package/dist/{statusline-QJ6CJGHB.js.map → statusline-HPH2ORNT.js.map} +0 -0
- /package/dist/{stop-YBQL6NFF.js.map → stop-IJNUSRIG.js.map} +0 -0
- /package/dist/{sync-DUXN2MFJ.js.map → sync-3HMCC55V.js.map} +0 -0
- /package/dist/{time-Q42HPZZ3.js.map → time-DUDNSHM3.js.map} +0 -0
- /package/dist/{time-actions-IXZRVKKQ.js.map → time-actions-M4QTTH4M.js.map} +0 -0
- /package/dist/{timesheet-YJ6O3GUU.js.map → timesheet-BMKDX5KZ.js.map} +0 -0
- /package/dist/{todo-ZBFRL2A5.js.map → todo-QMXJ5R3E.js.map} +0 -0
- /package/dist/{update-RGNKMRUL.js.map → update-3TODL7J3.js.map} +0 -0
- /package/dist/{usage-YZRZKJ3H.js.map → usage-YFTN2IS7.js.map} +0 -0
- /package/dist/{usage-ask-BYPNLA2B.js.map → usage-ask-EZR3W3UW.js.map} +0 -0
- /package/dist/{version-4IOMOIDP.js.map → version-LNHKXZBP.js.map} +0 -0
- /package/dist/{wait-YOHPFWVJ.js.map → wait-B37BTCVG.js.map} +0 -0
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
PROGRESS_INDETERMINATE,
|
|
4
|
+
PROGRESS_SET,
|
|
5
|
+
streamSignalFrom
|
|
6
|
+
} from "./chunk-BCYBF7KJ.js";
|
|
2
7
|
import {
|
|
3
8
|
PtyHostBusyError,
|
|
4
9
|
PtyHostClient,
|
|
@@ -6,17 +11,17 @@ import {
|
|
|
6
11
|
ensureHost,
|
|
7
12
|
findHost,
|
|
8
13
|
findHostPatient
|
|
9
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-ZDTFAMD2.js";
|
|
10
15
|
import {
|
|
11
16
|
findSession
|
|
12
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-4FOC35LW.js";
|
|
13
18
|
import {
|
|
14
19
|
dbPtySessions,
|
|
15
20
|
forgetPersistedSession
|
|
16
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-HCYES6U7.js";
|
|
17
22
|
import {
|
|
18
23
|
hostStartLockPath
|
|
19
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-NS7WH53I.js";
|
|
20
25
|
import {
|
|
21
26
|
accountLoginId,
|
|
22
27
|
accountOfLoginId
|
|
@@ -24,10 +29,14 @@ import {
|
|
|
24
29
|
import {
|
|
25
30
|
ASSISTANT_ID,
|
|
26
31
|
prepareAssistantDir
|
|
27
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-K76NOSEX.js";
|
|
33
|
+
import {
|
|
34
|
+
parentOf
|
|
35
|
+
} from "./chunk-DHZ5DF6Y.js";
|
|
28
36
|
import {
|
|
37
|
+
STALE_WORKING_MS,
|
|
29
38
|
noClaudeBecause
|
|
30
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-XJQ7XJJC.js";
|
|
31
40
|
import {
|
|
32
41
|
sessionIdFor
|
|
33
42
|
} from "./chunk-QGUBOOEN.js";
|
|
@@ -36,17 +45,18 @@ import {
|
|
|
36
45
|
agentFor,
|
|
37
46
|
agentSettings,
|
|
38
47
|
assistantAgent,
|
|
48
|
+
bestEffort,
|
|
39
49
|
logSwallowed,
|
|
40
50
|
sessionToolFor,
|
|
41
51
|
swallow,
|
|
42
52
|
trustAgentFolder
|
|
43
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-BS6GTKF2.js";
|
|
44
54
|
import {
|
|
45
55
|
hasEnvDelta
|
|
46
56
|
} from "./chunk-ED6YLB4S.js";
|
|
47
57
|
import {
|
|
48
58
|
loadConfig
|
|
49
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-ASGJ3MCL.js";
|
|
50
60
|
import {
|
|
51
61
|
ensureFile,
|
|
52
62
|
withFileLock
|
|
@@ -58,19 +68,74 @@ import {
|
|
|
58
68
|
// src/core/pty/output-status.ts
|
|
59
69
|
var OUTPUT_WORKING_MS = 1e4;
|
|
60
70
|
function statusFromOutput(p, now) {
|
|
61
|
-
if (!p.tool || p.tool === "claude"
|
|
71
|
+
if (!p.tool || p.tool === "claude") return null;
|
|
72
|
+
const said = p.signal ? statusFromSignal(p.signal, p.tool, p.lastOutputAt, now) : null;
|
|
73
|
+
if (said) return said;
|
|
74
|
+
if (!p.lastOutputAt) return null;
|
|
62
75
|
const at = Date.parse(p.lastOutputAt);
|
|
63
76
|
if (!Number.isFinite(at)) return null;
|
|
64
|
-
const
|
|
77
|
+
const working2 = now - at < OUTPUT_WORKING_MS;
|
|
65
78
|
return {
|
|
66
|
-
state:
|
|
79
|
+
state: working2 ? "working" : "idle",
|
|
67
80
|
seen: true,
|
|
68
81
|
since: p.lastOutputAt,
|
|
69
82
|
updatedAt: p.lastOutputAt,
|
|
70
83
|
stale: false,
|
|
71
|
-
summary: `${
|
|
84
|
+
summary: `${working2 ? "Printing" : "Quiet"} \u2014 from its terminal output (${p.tool} has no status hooks)`
|
|
72
85
|
};
|
|
73
86
|
}
|
|
87
|
+
var WAITING_FOR = /* @__PURE__ */ new Map([
|
|
88
|
+
["permission", "your permission"],
|
|
89
|
+
["question", "your answer"],
|
|
90
|
+
["auth", "you to sign in"]
|
|
91
|
+
]);
|
|
92
|
+
function statusFromSignal(signal, tool, lastOutputAt, now) {
|
|
93
|
+
const by = `${tool} says so in its terminal`;
|
|
94
|
+
const program = signal.program;
|
|
95
|
+
if (program) {
|
|
96
|
+
const percent = program.progress !== void 0 ? `, ${program.progress}%` : "";
|
|
97
|
+
const base = {
|
|
98
|
+
since: program.since,
|
|
99
|
+
updatedAt: lastOutputAt ?? program.since,
|
|
100
|
+
...program.progress !== void 0 ? { progress: program.progress } : {}
|
|
101
|
+
};
|
|
102
|
+
switch (program.state) {
|
|
103
|
+
case "working":
|
|
104
|
+
return working(base, lastOutputAt, now, `Working${percent}`, by);
|
|
105
|
+
case "blocked":
|
|
106
|
+
return {
|
|
107
|
+
...base,
|
|
108
|
+
state: "needs_input",
|
|
109
|
+
seen: false,
|
|
110
|
+
stale: false,
|
|
111
|
+
summary: program.message ?? `Waiting for ${WAITING_FOR.get(program.kind ?? "") ?? "you"}${percent} \u2014 ${by}`
|
|
112
|
+
};
|
|
113
|
+
case "done":
|
|
114
|
+
return { ...base, state: "idle", seen: true, stale: false, summary: program.message ?? `Finished \u2014 ${by}` };
|
|
115
|
+
case "error":
|
|
116
|
+
return { ...base, state: "idle", seen: true, stale: false, summary: program.message ?? `Stopped on an error \u2014 ${by}` };
|
|
117
|
+
case "idle":
|
|
118
|
+
return { ...base, state: "idle", seen: true, stale: false, summary: `Idle \u2014 ${by}` };
|
|
119
|
+
default:
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const bar = signal.progress;
|
|
124
|
+
if (bar && (bar.state === PROGRESS_SET || bar.state === PROGRESS_INDETERMINATE)) {
|
|
125
|
+
const set = bar.state === PROGRESS_SET;
|
|
126
|
+
const base = { since: bar.since, updatedAt: lastOutputAt ?? bar.since, ...set ? { progress: bar.percent } : {} };
|
|
127
|
+
return working(base, lastOutputAt, now, `Busy${set ? `, ${bar.percent}%` : ""}`, `its progress bar (${tool})`);
|
|
128
|
+
}
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
function working(base, lastOutputAt, now, what, by) {
|
|
132
|
+
const last = Date.parse(lastOutputAt ?? base.since);
|
|
133
|
+
if (Number.isFinite(last) && now - last > STALE_WORKING_MS) {
|
|
134
|
+
const quiet = `${Math.round(STALE_WORKING_MS / 6e4)} min`;
|
|
135
|
+
return { ...base, state: "idle", seen: true, stale: true, summary: `Said it was working, then printed nothing for ${quiet} \u2014 ${by}` };
|
|
136
|
+
}
|
|
137
|
+
return { ...base, state: "working", seen: true, stale: false, summary: `${what} \u2014 ${by}` };
|
|
138
|
+
}
|
|
74
139
|
|
|
75
140
|
// src/core/pty/pty-pool.ts
|
|
76
141
|
import path2 from "path";
|
|
@@ -142,7 +207,10 @@ async function refresh() {
|
|
|
142
207
|
live = new Set(ptys.filter((p) => !p.exited).map((p) => p.id));
|
|
143
208
|
livePids = new Set(ptys.filter((p) => !p.exited).map((p) => p.pid));
|
|
144
209
|
outputs = new Map(
|
|
145
|
-
ptys.filter((p) => !p.exited).map((p) =>
|
|
210
|
+
ptys.filter((p) => !p.exited).map((p) => {
|
|
211
|
+
const signal = streamSignalFrom(p.signal);
|
|
212
|
+
return [p.id, { tool: p.tool, lastOutputAt: p.lastOutputAt, startedAt: p.startedAt, pid: p.pid, ...signal ? { signal } : {} }];
|
|
213
|
+
})
|
|
146
214
|
);
|
|
147
215
|
} catch (err) {
|
|
148
216
|
beat.known = beat.known || err instanceof PtyHostBusyError;
|
|
@@ -190,6 +258,17 @@ function assistantSpec() {
|
|
|
190
258
|
...hasEnvDelta(agentEnv) ? { agentEnv } : {}
|
|
191
259
|
};
|
|
192
260
|
}
|
|
261
|
+
function coordinatorFolders(session) {
|
|
262
|
+
return bestEffort(
|
|
263
|
+
`coordinator folders of ${session.target}:${session.branch}`,
|
|
264
|
+
() => {
|
|
265
|
+
const link = parentOf(sessionIdFor(session));
|
|
266
|
+
const parent = link ? findSession(link.parentId) : null;
|
|
267
|
+
return parent ? agentFor(loadConfig(), parent).tempFolders?.(parent) ?? [] : [];
|
|
268
|
+
},
|
|
269
|
+
[]
|
|
270
|
+
) ?? [];
|
|
271
|
+
}
|
|
193
272
|
function spawnSpecFor(session) {
|
|
194
273
|
const first = session.paths[0];
|
|
195
274
|
if (!first) return null;
|
|
@@ -199,7 +278,9 @@ function spawnSpecFor(session) {
|
|
|
199
278
|
const launch = agent.launch;
|
|
200
279
|
trustAgentFolder(agent, session, cwd);
|
|
201
280
|
const agentEnv = launch.env?.(session);
|
|
202
|
-
const
|
|
281
|
+
const shared = coordinatorFolders(session);
|
|
282
|
+
const base = sessionToolFor(launch.tool(config), { write: mayStartHost });
|
|
283
|
+
const tool = shared.length && launch.withFolders ? launch.withFolders(base, shared) : base;
|
|
203
284
|
return { cwd, tool, port: session.port, ...hasEnvDelta(agentEnv) ? { agentEnv } : {} };
|
|
204
285
|
}
|
|
205
286
|
async function ensurePty(sessionId, extra = {}) {
|
|
@@ -210,7 +291,12 @@ async function ensurePty(sessionId, extra = {}) {
|
|
|
210
291
|
if (refused) throw new Error(refused);
|
|
211
292
|
const base = loginFor !== null ? accountLoginSpec(loginFor, agentFor(loadConfig()).accounts) : sessionId === ASSISTANT_ID ? assistantSpec() : session ? spawnSpecFor(session) : null;
|
|
212
293
|
if (!base) return null;
|
|
213
|
-
|
|
294
|
+
if (extra.attachOnly) return attachToRunning(sessionId);
|
|
295
|
+
const spec = {
|
|
296
|
+
...base,
|
|
297
|
+
...extra.initialPrompt ? { initialPrompt: extra.initialPrompt } : {},
|
|
298
|
+
...extra.grid ? { cols: extra.grid.cols, rows: extra.grid.rows } : {}
|
|
299
|
+
};
|
|
214
300
|
let c = await getClient(true);
|
|
215
301
|
if (!c) return null;
|
|
216
302
|
if (setsEnv(spec.agentEnv) && !await hostTakesAgentEnv(c) && !await runsIn(c, sessionId)) throw new Error(OLD_HOST_ACCOUNTS);
|
|
@@ -225,6 +311,21 @@ async function ensurePty(sessionId, extra = {}) {
|
|
|
225
311
|
live.add(sessionId);
|
|
226
312
|
return c.attachUrl(sessionId);
|
|
227
313
|
}
|
|
314
|
+
async function attachToRunning(sessionId) {
|
|
315
|
+
const look = async () => {
|
|
316
|
+
const c = await getClient(false);
|
|
317
|
+
return c ? { c, info: await c.get(sessionId) } : null;
|
|
318
|
+
};
|
|
319
|
+
let found = await look();
|
|
320
|
+
if (found && !found.info) {
|
|
321
|
+
client = null;
|
|
322
|
+
found = await look();
|
|
323
|
+
}
|
|
324
|
+
if (!found?.info || found.info.exited) throw new Error(NOT_RUNNING);
|
|
325
|
+
live.add(sessionId);
|
|
326
|
+
return found.c.attachUrl(sessionId);
|
|
327
|
+
}
|
|
328
|
+
var NOT_RUNNING = "its terminal is not running";
|
|
228
329
|
async function terminalTicketUrl(sessionId, origin) {
|
|
229
330
|
const c = await getClient(false);
|
|
230
331
|
return c ? c.ticketUrl(sessionId, origin).catch(() => null) : null;
|
|
@@ -429,4 +530,4 @@ export {
|
|
|
429
530
|
stopSessionPty,
|
|
430
531
|
detachPtyPool
|
|
431
532
|
};
|
|
432
|
-
//# sourceMappingURL=chunk-
|
|
533
|
+
//# sourceMappingURL=chunk-HTV7366A.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';\nimport { STALE_WORKING_MS } from '../status/session-status.js';\nimport { PROGRESS_INDETERMINATE, PROGRESS_SET, type ProgramKind, type StreamSignal } from './stream-status.js';\n\n/**\n * A status for a session whose tool isn't Claude Code (config `aiCommand`, e.g. opencode, codex): no hooks report its\n * turns, so its terminal stands in. First what the agent says about itself in its output (`statusFromSignal`: OSC 7501\n * program status, else an OSC 9;4 bar), then the PTY host's \"last printed anything\" — a working agent redraws its\n * spinner, an idle one prints nothing: working while it printed in the last `OUTPUT_WORKING_MS`, idle after, never\n * \"done, unseen\" or \"needs input\" (output can't tell a finished turn from a question). Hooks beat both: this is only\n * asked when no hook status exists (session-wire.ts). 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 /** What it says about itself in its output (PtyInfo.signal). */\n signal?: StreamSignal;\n}\n\nexport function statusFromOutput(p: PtyOutput, now: number): SessionAttention | null {\n if (!p.tool || p.tool === 'claude') return null;\n const said = p.signal ? statusFromSignal(p.signal, p.tool, p.lastOutputAt, now) : null;\n if (said) return said;\n if (!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\n/** What a blocked agent waits for, by its `kind`; any other (or none): \"you\". */\nconst WAITING_FOR = new Map<string, string>([\n ['permission', 'your permission'],\n ['question', 'your answer'],\n ['auth', 'you to sign in'],\n] satisfies Array<[ProgramKind, string]>);\n\n/**\n * What the agent said in-band, as a status; null where it says nothing that decides one (no signal, a cleared one, a\n * bar in error or paused), and the output guess decides.\n *\n * - OSC 7501: working → working; blocked → needs input (its `msg` as the summary); idle, done and error → idle, seen.\n * `done` is \"finished, not seen yet\", but nothing here could mark it seen (no status row: `markSeen`), and the agent\n * itself turns it into idle at your next key — so it is shown as idle, its summary saying it finished.\n * - OSC 9;4: a bar with a percent (1) or indeterminate (3) → working. 2 (error) and 4 (paused) don't say whether it is\n * still at work; 0 is no bar.\n *\n * A \"working\" never outlives `STALE_WORKING_MS` of silence: an agent at work redraws something (Codex its elapsed\n * time, Claude Code and opencode a spinner), so a terminal that said working and then printed nothing for 15 minutes\n * went away without saying (killed, crashed under a shell that lives on). It is shown idle and `stale`, as a hook's\n * working is after the same quiet (session-status.ts). The spec forbids requiring a heartbeat; this asks none — any\n * output at all keeps it. Blocked has no expiry: waiting on you is quiet by nature, and a new process (a new mirror)\n * or the agent's next report ends it.\n */\nexport function statusFromSignal(\n signal: StreamSignal,\n tool: string,\n lastOutputAt: string | undefined,\n now: number,\n): SessionAttention | null {\n const by = `${tool} says so in its terminal`;\n const program = signal.program;\n if (program) {\n const percent = program.progress !== undefined ? `, ${program.progress}%` : '';\n const base = {\n since: program.since,\n updatedAt: lastOutputAt ?? program.since,\n ...(program.progress !== undefined ? { progress: program.progress } : {}),\n };\n switch (program.state) {\n case 'working':\n return working(base, lastOutputAt, now, `Working${percent}`, by);\n case 'blocked':\n return {\n ...base,\n state: 'needs_input',\n seen: false,\n stale: false,\n summary: program.message ?? `Waiting for ${WAITING_FOR.get(program.kind ?? '') ?? 'you'}${percent} — ${by}`,\n };\n case 'done':\n return { ...base, state: 'idle', seen: true, stale: false, summary: program.message ?? `Finished — ${by}` };\n case 'error':\n return { ...base, state: 'idle', seen: true, stale: false, summary: program.message ?? `Stopped on an error — ${by}` };\n case 'idle':\n return { ...base, state: 'idle', seen: true, stale: false, summary: `Idle — ${by}` };\n default:\n return null; // a newer host's state this build doesn't know: the guess decides\n }\n }\n const bar = signal.progress;\n if (bar && (bar.state === PROGRESS_SET || bar.state === PROGRESS_INDETERMINATE)) {\n const set = bar.state === PROGRESS_SET;\n const base = { since: bar.since, updatedAt: lastOutputAt ?? bar.since, ...(set ? { progress: bar.percent } : {}) };\n return working(base, lastOutputAt, now, `Busy${set ? `, ${bar.percent}%` : ''}`, `its progress bar (${tool})`);\n }\n return null;\n}\n\nfunction working(\n base: Pick<SessionAttention, 'since' | 'updatedAt' | 'progress'>,\n lastOutputAt: string | undefined,\n now: number,\n what: string,\n by: string,\n): SessionAttention {\n const last = Date.parse(lastOutputAt ?? base.since);\n if (Number.isFinite(last) && now - last > STALE_WORKING_MS) {\n const quiet = `${Math.round(STALE_WORKING_MS / 60_000)} min`;\n return { ...base, state: 'idle', seen: true, stale: true, summary: `Said it was working, then printed nothing for ${quiet} — ${by}` };\n }\n return { ...base, state: 'working', seen: true, stale: false, summary: `${what} — ${by}` };\n}\n","import path from 'node:path';\nimport type { AgentAdapter } from '../agents/types.js';\nimport { agentFor, agentSettings, assistantAgent, sessionToolFor, trustAgentFolder } 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 { parentOf } from '../sessions/session-children.js';\nimport { bestEffort } from '../platform/best-effort.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';\nimport type { Grid } from './terminal-size.js';\nimport { streamSignalFrom } from './stream-status.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, last output and what it says about itself (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 // The signal is the host's data (another build's, maybe): shape-checked, what doesn't fit dropped (stream-status.ts).\n outputs = new Map(\n ptys\n .filter((p) => !p.exited)\n .map((p) => {\n const signal = streamSignalFrom(p.signal);\n return [p.id, { tool: p.tool, lastOutputAt: p.lastOutputAt, startedAt: p.startedAt, pid: p.pid, ...(signal ? { signal } : {}) }];\n }),\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 {\n cwd: prepareAssistantDir(agent),\n tool: sessionToolFor(agent.launch.tool(settings), { write: mayStartHost }),\n ...(hasEnvDelta(agentEnv) ? { agentEnv } : {}),\n };\n}\n\n/** The scratch folders of the session that started this one (session-children.ts), that exist and are safe to name; none for one nobody started. */\nexport function coordinatorFolders(session: WorktreeSession): string[] {\n return (\n bestEffort(\n `coordinator folders of ${session.target}:${session.branch}`,\n () => {\n const link = parentOf(sessionIdFor(session));\n const parent = link ? findSession(link.parentId) : null;\n return parent ? (agentFor(loadConfig(), parent).tempFolders?.(parent) ?? []) : [];\n },\n [],\n ) ?? []\n );\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 agent = agentFor(config, session);\n const launch = agent.launch;\n // Its folder trusted on its account before it starts there (a worktree work made, a repo you added): no \"do you trust\n // this folder?\" stop for a folder of work's own (claude/folder-trust.ts).\n trustAgentFolder(agent, session, cwd);\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 // Its hooks in the spec itself (`--settings`, agents/session-hooks.ts), so a PTY host from before this build — it\n // outlives updates — starts it with them too; a current host replaces the flag with its own, never twice. The dev\n // server names the file the installed work wrote, never its own build (`write: false`).\n // A child session reads and writes its coordinator's scratch folders as its own (the task files are there, and what\n // they hand each other): otherwise every read there stops at \"read outside the working directories?\", which its\n // coordinator may not answer (reported: a child of grunnur's main session sat at that question).\n const shared = coordinatorFolders(session);\n const base = sessionToolFor(launch.tool(config), { write: mayStartHost });\n const tool = shared.length && launch.withFolders ? launch.withFolders(base, shared) : base;\n return { cwd, tool, 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(\n sessionId: string,\n extra: { initialPrompt?: string; grid?: Grid; attachOnly?: boolean } = {},\n): 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 // A terminal reconnecting with its screen kept (`attachOnly`, resume.ts) attaches to what runs and starts nothing,\n // neither a host nor an agent: one stopped on purpose (`work pty-host --stop`, a session that ended) stays stopped,\n // and the tab says the connection closed, as before.\n if (extra.attachOnly) return attachToRunning(sessionId);\n // The first prompt only applies to a fresh spawn (the host ignores the\n // spec when the session's PTY is already running), and so does the grid: the Terminal tab's that starts it\n // (terminal-size.ts), so its agent doesn't start at another size and paint again a moment later. None (a start\n // with no tab): the host takes the last grid a client used.\n const spec = {\n ...base,\n ...(extra.initialPrompt ? { initialPrompt: extra.initialPrompt } : {}),\n ...(extra.grid ? { cols: extra.grid.cols, rows: extra.grid.rows } : {}),\n };\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/** The host's attach address of a terminal that runs now; throws NOT_RUNNING when none does. Never starts anything. */\nasync function attachToRunning(sessionId: string): Promise<string> {\n const look = async (): Promise<{ c: PtyHostClient; info: PtyInfo | null } | null> => {\n const c = await getClient(false);\n return c ? { c, info: await c.get(sessionId) } : null;\n };\n let found = await look();\n if (found && !found.info) {\n // Not there, or a client of a host that was replaced since (another port, its calls fail): asked once more, fresh.\n client = null;\n found = await look();\n }\n if (!found?.info || found.info.exited) throw new Error(NOT_RUNNING);\n live.add(sessionId);\n return found.c.attachUrl(sessionId);\n}\n\n/** What a reconnect is told when its terminal no longer runs (nothing is started for it). */\nexport const NOT_RUNNING = 'its terminal is not running';\n\n/**\n * Where a dashboard page connects a terminal straight to the PTY host (with a one-time ticket for its origin), once\n * `ensurePty` has it running. Null when the host can't give one (from before tickets): the page goes through work\n * web's relay as before.\n */\nexport async function terminalTicketUrl(sessionId: string, origin: string): Promise<string | null> {\n const c = await getClient(false);\n return c ? c.ticketUrl(sessionId, origin).catch(() => null) : null;\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/** The live terminals with when each started and last printed (from the refresh cache), for startup-question.ts. */\nexport function ptyTerminals(): Array<{ id: string; startedAt: string; lastOutputAt?: string }> {\n return [...outputs].map(([id, o]) => ({ id, startedAt: o.startedAt, ...(o.lastOutputAt ? { lastOutputAt: o.lastOutputAt } : {}) }));\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaO,IAAM,oBAAoB;AAY1B,SAAS,iBAAiB,GAAc,KAAsC;AACnF,MAAI,CAAC,EAAE,QAAQ,EAAE,SAAS,SAAU,QAAO;AAC3C,QAAM,OAAO,EAAE,SAAS,iBAAiB,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,GAAG,IAAI;AAClF,MAAI,KAAM,QAAO;AACjB,MAAI,CAAC,EAAE,aAAc,QAAO;AAC5B,QAAM,KAAK,KAAK,MAAM,EAAE,YAAY;AACpC,MAAI,CAAC,OAAO,SAAS,EAAE,EAAG,QAAO;AACjC,QAAMA,WAAU,MAAM,KAAK;AAC3B,SAAO;AAAA,IACL,OA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AAI;AACJ,QAAI;AACF,aAAO,MAAM,gBAAgB;AAAA,IAC/B,SAAS,KAAK;AACZ,UAAI,eAAe,oBAAqB;AACxC,YAAM;AAAA,IACR;AACA,QAAI,CAAC,KAAM;AACX,QAAI,IAAI,cAAc,IAAI;AAAA,EAC5B;AACA,QAAM,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,gBAAgB,SAAS,kBAAkB,CAAC;AACpF;AASA,eAAsB,eAAe,QAAgB,QAA+B;AAClF,QAAM,KAAK,aAAa,EAAE,QAAQ,OAAO,CAAoB;AAC7D,OAAK,OAAO,EAAE;AAKd,QAAM,OAAO,kBAAkB;AAC/B,aAAW,MAAM,EAAE;AACnB,QAAM,aAAa,MAAM,YAAY;AACnC,QAAI;AACJ,QAAI;AACF,aAAO,MAAM,gBAAgB;AAAA,IAC/B,SAAS,KAAK;AAIZ,mBAAa,gBAAgB,EAAE,cAAc,GAAG;AAChD;AAAA,IACF;AACA,QAAI,KAAM,OAAM,IAAI,cAAc,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,QAAQ,gBAAgB,EAAE,kBAAkB,CAAC;AAAA,QAC/F,OAAM,uBAAuB,EAAE,EAAE,MAAM,QAAQ,wBAAwB,EAAE,EAAE,CAAC;AAAA,EACnF,CAAC,EAAE,MAAM,QAAQ,gBAAgB,EAAE,mBAAmB,CAAC;AACzD;AAIO,SAAS,gBAAsB;AACpC,MAAI,aAAc,eAAc,YAAY;AAC5C,iBAAe;AACf,WAAS;AACT,SAAO,oBAAI,IAAI;AACf,aAAW,oBAAI,IAAI;AACrB;","names":["working","path","path"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
sessionWorkTime
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-O7BXNXU2.js";
|
|
5
5
|
import {
|
|
6
6
|
runInternal
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-FEI73IPX.js";
|
|
8
8
|
import {
|
|
9
9
|
DEFAULT_CATCH_UP_DAYS,
|
|
10
10
|
MAX_RANGE_DAYS,
|
|
@@ -19,14 +19,14 @@ import {
|
|
|
19
19
|
readIssueIds,
|
|
20
20
|
rememberIssueId,
|
|
21
21
|
timeSettings
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-4LZLVHZE.js";
|
|
23
23
|
import {
|
|
24
24
|
knownHosts
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-6HVDHGNE.js";
|
|
26
26
|
import {
|
|
27
27
|
loadHistory,
|
|
28
28
|
runGitAsync
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-XJQ7XJJC.js";
|
|
30
30
|
import {
|
|
31
31
|
sessionIdFor
|
|
32
32
|
} from "./chunk-QGUBOOEN.js";
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
isIssueKey,
|
|
35
35
|
issueKeys,
|
|
36
36
|
loadConfig
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-ASGJ3MCL.js";
|
|
38
38
|
import {
|
|
39
39
|
explainNotOnPath,
|
|
40
40
|
programPath
|
|
@@ -744,4 +744,4 @@ export {
|
|
|
744
744
|
finishDeviceLogin,
|
|
745
745
|
defaultTimeDeps
|
|
746
746
|
};
|
|
747
|
-
//# sourceMappingURL=chunk-
|
|
747
|
+
//# sourceMappingURL=chunk-JIMD77FI.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
DISPLAY_LABEL,
|
|
7
7
|
displayStatus
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-AEH72XTU.js";
|
|
9
9
|
import {
|
|
10
10
|
workCommand
|
|
11
11
|
} from "./chunk-HK6AZQ5Z.js";
|
|
@@ -167,4 +167,4 @@ export {
|
|
|
167
167
|
assistantContextReview,
|
|
168
168
|
readAssistantContext
|
|
169
169
|
};
|
|
170
|
-
//# sourceMappingURL=chunk-
|
|
170
|
+
//# sourceMappingURL=chunk-K76NOSEX.js.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
accountEnv,
|
|
8
8
|
defaultAccountName
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-EVGYDJI2.js";
|
|
10
10
|
|
|
11
11
|
// src/core/agents/claude/internal.ts
|
|
12
12
|
import path from "path";
|
|
@@ -102,4 +102,4 @@ export {
|
|
|
102
102
|
CLAUDE_READ_ONLY_LOCAL_LINES,
|
|
103
103
|
claudeReadDenyRules
|
|
104
104
|
};
|
|
105
|
-
//# sourceMappingURL=chunk-
|
|
105
|
+
//# sourceMappingURL=chunk-KUYEYPO4.js.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
createInProcess
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-EEMPMVCP.js";
|
|
5
5
|
import {
|
|
6
6
|
ensurePty,
|
|
7
7
|
peekPty
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-HTV7366A.js";
|
|
9
9
|
import {
|
|
10
10
|
getCommentFileStore
|
|
11
11
|
} from "./chunk-UPS7NHKI.js";
|
|
12
12
|
import {
|
|
13
13
|
recordedRepos,
|
|
14
14
|
sessionAliases
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-XJQ7XJJC.js";
|
|
16
16
|
import {
|
|
17
17
|
sessionIdFor
|
|
18
18
|
} from "./chunk-QGUBOOEN.js";
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
import {
|
|
30
30
|
DEFAULT_ACCOUNT,
|
|
31
31
|
loadConfig
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-ASGJ3MCL.js";
|
|
33
33
|
|
|
34
34
|
// src/core/sessions/fork.ts
|
|
35
35
|
import path from "path";
|
|
@@ -174,4 +174,4 @@ export {
|
|
|
174
174
|
uncommittedFiles,
|
|
175
175
|
defaultForkDeps
|
|
176
176
|
};
|
|
177
|
-
//# sourceMappingURL=chunk-
|
|
177
|
+
//# sourceMappingURL=chunk-L5U47Q63.js.map
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
validGrid
|
|
4
|
+
} from "./chunk-6KMG4WNW.js";
|
|
2
5
|
import {
|
|
3
6
|
ensureHost,
|
|
4
7
|
probeHostDetailed
|
|
5
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ZDTFAMD2.js";
|
|
6
9
|
import {
|
|
7
10
|
hostInfoPath,
|
|
8
11
|
readHostInfo
|
|
9
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-NS7WH53I.js";
|
|
10
13
|
import {
|
|
11
14
|
agentFor,
|
|
12
15
|
agentSettings,
|
|
13
16
|
assistantAgent,
|
|
14
17
|
internalAgent
|
|
15
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-BS6GTKF2.js";
|
|
16
19
|
import {
|
|
17
20
|
detachHere,
|
|
18
21
|
isPidAlive,
|
|
@@ -164,9 +167,28 @@ function ensureAgentPath(deps = {}) {
|
|
|
164
167
|
}
|
|
165
168
|
}
|
|
166
169
|
|
|
170
|
+
// src/core/pty/resume.ts
|
|
171
|
+
var RESUME_PARAM = "resume";
|
|
172
|
+
var FORMAT = /^([0-9a-f]{8,64})-(\d{1,15})-(\d{1,4})x(\d{1,4})$/;
|
|
173
|
+
function withResume(url, at) {
|
|
174
|
+
if (!at) return url;
|
|
175
|
+
const value = `${at.stream}-${at.offset}-${at.cols}x${at.rows}`;
|
|
176
|
+
return `${url}${url.includes("?") ? "&" : "?"}${RESUME_PARAM}=${value}`;
|
|
177
|
+
}
|
|
178
|
+
function resumeFromParams(params) {
|
|
179
|
+
const m = FORMAT.exec(params.get(RESUME_PARAM) ?? "");
|
|
180
|
+
if (!m) return null;
|
|
181
|
+
const offset = Number(m[2]);
|
|
182
|
+
const grid = validGrid(Number(m[3]), Number(m[4]));
|
|
183
|
+
if (!Number.isSafeInteger(offset) || !grid) return null;
|
|
184
|
+
return { stream: m[1], offset, cols: grid.cols, rows: grid.rows };
|
|
185
|
+
}
|
|
186
|
+
|
|
167
187
|
export {
|
|
188
|
+
withResume,
|
|
189
|
+
resumeFromParams,
|
|
168
190
|
stopHost,
|
|
169
191
|
restartHost,
|
|
170
192
|
ensureAgentPath
|
|
171
193
|
};
|
|
172
|
-
//# sourceMappingURL=chunk-
|
|
194
|
+
//# sourceMappingURL=chunk-LZJ5VDUD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/pty/host-control.ts","../src/core/platform/shell-path.ts","../src/core/agents/agent-path.ts","../src/core/pty/resume.ts"],"sourcesContent":["import fs from 'node:fs';\nimport { execFile } from 'node:child_process';\nimport { programPath } from '../platform/program-path.js';\nimport { ensureHost, probeHostDetailed } from './pty-host-client.js';\nimport { hostInfoPath, readHostInfo } from './pty-host-protocol.js';\nimport { isPidAlive, killTree } from '../platform/process.js';\n\n/**\n * Stopping and restarting the PTY host — the CLI's `work pty-host\n * --stop/--restart` and the dashboard's Restart share it. The persisted\n * session list stays, so the next host restores them with --continue.\n */\n\nexport type StopOutcome = 'stopped' | 'not-running' | 'stale-file' | 'unresponsive' | 'failed';\n\n/** A process's command line, or null when it isn't running or can't be read (Windows: CIM; elsewhere: ps). */\nexport function commandLineOf(pid: number): Promise<string | null> {\n return new Promise((resolve) => {\n const done = (err: Error | null, out: string) => resolve(err ? null : out.trim() || null);\n if (process.platform === 'win32')\n execFile(\n programPath('powershell'),\n ['-NoProfile', '-Command', `(Get-CimInstance Win32_Process -Filter 'ProcessId=${Math.trunc(pid)}').CommandLine`],\n { windowsHide: true, timeout: 15_000 },\n (err, out) => done(err, String(out)),\n );\n else\n execFile(programPath('ps'), ['-o', 'args=', '-p', String(Math.trunc(pid))], { windowsHide: true, timeout: 5000 }, (err, out) =>\n done(err, String(out)),\n );\n });\n}\n\n/**\n * The recorded pid really is a running PTY host of work's: alive, and its command line runs `pty-host` (not a\n * `--stop`/`--restart`/`--status` call). Pids get reused — on Windows fast — so a host that doesn't answer is only\n * force-stopped after this: blind, it could take down any process that took its number. Pure over its inputs.\n */\nexport function looksLikeHost(commandLine: string | null): boolean {\n return (\n !!commandLine && /(^|\\s|[\"'\\\\/])pty-host(\\s|$|[\"'])/.test(commandLine) && !/\\bpty-host\\b.*--(stop|restart|status)\\b/.test(commandLine)\n );\n}\n\n/**\n * Kill the running host and its PTYs. Only a PID that proves it's our host gets killed: it answers /health with the\n * discovery file's token and that same PID — or, with `force`, it doesn't answer at all (hung: a ConPTY start that\n * blocked its event loop) but its process is alive and runs `work pty-host` (`looksLikeHost`). The file survives\n * crashes and reboots (TerminateProcess skips cleanup), and Windows reuses PIDs. A stale file is just removed.\n */\nexport async function stopHost(\n kill: (pid: number) => boolean = killTree,\n probeTimeoutMs = 5000,\n opts: { force?: boolean; isOurHost?: (pid: number) => Promise<boolean> } = {},\n): Promise<StopOutcome> {\n const hostInfo = readHostInfo();\n if (!hostInfo) return 'not-running';\n // A busy host (restoring many sessions) can miss a short probe; give it\n // longer before concluding anything.\n const probe = await probeHostDetailed(hostInfo, probeTimeoutMs);\n if (probe.kind === 'timeout') {\n // Alive-but-slow must NOT be treated as stale: deleting the file would\n // orphan a live host, and --restart would then start a second one that\n // restores every session again. Keep the file, kill nothing — unless\n // asked to stop a hung one, and it proves to be ours.\n const ours = opts.isOurHost ?? (async (pid: number) => isPidAlive(pid) && looksLikeHost(await commandLineOf(pid)));\n if (!opts.force || !(await ours(hostInfo.pid))) return 'unresponsive';\n return killAndForget(kill, hostInfo.pid);\n }\n if (probe.kind !== 'host' || probe.pid !== hostInfo.pid) {\n // Nothing listening, or someone else on that port: the file is stale\n // (reboot, crash, PID/port reused). Remove it; kill nothing.\n removeInfo();\n return 'stale-file';\n }\n return killAndForget(kill, hostInfo.pid);\n}\n\nfunction killAndForget(kill: (pid: number) => boolean, pid: number): StopOutcome {\n const ok = kill(pid);\n // TerminateProcess means the host never runs its own cleanup.\n removeInfo();\n return ok ? 'stopped' : 'failed';\n}\n\nfunction removeInfo(): void {\n try {\n fs.unlinkSync(hostInfoPath());\n } catch {\n /* */\n }\n}\n\n/**\n * Stop the host and start a new one, which restores every saved session with --continue. `force`: a host that\n * doesn't answer is stopped too (see stopHost). Never starts a second host beside one it couldn't stop.\n */\nexport async function restartHost(\n workBin: string,\n opts: { force?: boolean } = {},\n steps: { stop?: (force: boolean) => Promise<StopOutcome>; start?: (workBin: string) => Promise<{ pid: number }>; pauseMs?: number } = {},\n): Promise<{ outcome: StopOutcome; pid: number | null }> {\n const outcome = await (steps.stop ?? ((force) => stopHost(killTree, 5000, { force })))(!!opts.force);\n if (outcome === 'failed' || outcome === 'unresponsive') return { outcome, pid: null };\n // The old one's port and lock let go before the new one takes them.\n await new Promise((r) => setTimeout(r, steps.pauseMs ?? 500));\n const host = await (steps.start ?? ensureHost)(workBin);\n return { outcome, pid: host.pid };\n}\n","import { spawnSync, type SpawnSyncOptionsWithStringEncoding } from 'node:child_process';\nimport path from 'node:path';\nimport { findOnPath } from './find-on-path.js';\nimport { report } from './report.js';\nimport { debugLog } from './logger.js';\nimport { detachHere } from './process.js';\n\n/**\n * The PATH of the user's login shell, for a work started without one.\n *\n * Reported from a Mac: every session ended at once with \"session exited with code 1\", and Enter\n * gave the same. The desktop app started from the Dock or Finder gets the system's minimal PATH\n * (/usr/bin:/bin:/usr/sbin:/sbin), not the one the user's shell sets up, and passes it on to work\n * web, the PTY host and every Claude: `claude` (in ~/.local/bin, /opt/homebrew/bin, an nvm folder…)\n * isn't found, and node-pty's child exits with 1 when its exec fails. So when work web or the PTY\n * host starts on macOS or Linux and the agent's command isn't on its PATH, it asks the login shell\n * for its PATH (`$SHELL -ilc`, as a terminal would set it up) and puts it first. Started from a\n * terminal, the command is found and nothing is asked.\n */\n\nconst MARK = '__WORK_SHELL_PATH__';\n\n/** The shell's PATH first, then what we had that it lacks (e.g. the app's ~/.work/bin). */\nexport function mergePath(current: string | undefined, shellPath: string, sep = path.delimiter): string {\n const out: string[] = [];\n for (const d of [...shellPath.split(sep), ...(current ?? '').split(sep)]) if (d && !out.includes(d)) out.push(d);\n return out.join(sep);\n}\n\n/** The PATH between the markers of the shell's output (an interactive shell may print a greeting around it). */\nexport function parseShellPath(stdout: string): string | null {\n const m = new RegExp(`${MARK}(.*?)${MARK}`, 's').exec(stdout);\n const p = m?.[1].trim();\n return p ? p : null;\n}\n\n/** How long the login shell may take to say its PATH. */\nexport const SHELL_PATH_TIMEOUT_MS = 5_000;\n\n/** The shell's arguments: a login, interactive shell (what a terminal runs) printing its PATH between markers. */\nexport const shellPathArgs = (): string[] => ['-ilc', `printf '%s%s%s' '${MARK}' \"$PATH\" '${MARK}'`];\n\n/**\n * How it's started. `killSignal: SIGKILL`: an interactive bash or zsh ignores SIGTERM (spawnSync's\n * default at the timeout), and Node then waits for it — a stuck profile held work web up for as long as\n * it hung (reproduced: a 2 s timeout returned after 8 s). `detached` (POSIX): its own session, so it\n * never takes this terminal's foreground group — killed while holding it, it left `work web` in the\n * background, where Ctrl+C no longer reached it (reproduced).\n */\nexport const shellPathSpawnOptions = (timeoutMs = SHELL_PATH_TIMEOUT_MS): SpawnSyncOptionsWithStringEncoding =>\n // `detached` isn't in @types/node's spawnSync options, but spawnSync honors it (spawn_sync reads it).\n ({\n encoding: 'utf8',\n timeout: timeoutMs,\n killSignal: 'SIGKILL',\n detached: detachHere(),\n stdio: ['ignore', 'pipe', 'ignore'],\n windowsHide: true,\n }) as SpawnSyncOptionsWithStringEncoding;\n\ntype ShellRun = (cmd: string, args: string[]) => { stdout?: string | null; status?: number | null; signal?: string | null; error?: Error };\n\n/** Ask the login shell for its PATH: its PATH, or why it couldn't say (a timeout, no such shell, no markers). */\nexport function readShellPath(\n shell = process.env.SHELL || '/bin/zsh',\n run: ShellRun = (cmd, args) => spawnSync(cmd, args, shellPathSpawnOptions()),\n): { path: string } | { why: string } {\n try {\n const r = run(shell, shellPathArgs());\n const p = parseShellPath(r.stdout ?? '');\n if (p) return { path: p };\n const how = r.error\n ? r.error.message\n : r.signal\n ? `stopped by ${r.signal} (over ${SHELL_PATH_TIMEOUT_MS / 1000} s?)`\n : `exit ${r.status ?? '?'}, no PATH printed`;\n return { why: `${shell} -ilc: ${how}` };\n } catch (err) {\n return { why: `${shell} -ilc: ${(err as Error).message}` };\n }\n}\n\n/**\n * Make sure the commands in `need` (the agent's binary) can be found: on macOS and Linux, when one\n * isn't on PATH, the login shell's PATH is merged into this process's (which everything it starts\n * inherits). Says what it did; never throws.\n */\nexport function ensureShellPath(\n need: string[],\n opts: {\n platform?: NodeJS.Platform;\n env?: NodeJS.ProcessEnv;\n readPath?: () => { path: string } | { why: string };\n find?: (cmd: string, env: NodeJS.ProcessEnv) => string | null;\n } = {},\n): 'found' | 'added' | 'unavailable' {\n const platform = opts.platform ?? process.platform;\n const env = opts.env ?? process.env;\n if (platform === 'win32') return 'found';\n const find = opts.find ?? ((c: string, e: NodeJS.ProcessEnv) => findOnPath(c, e, platform));\n const missing = need.filter((c) => !find(c, env));\n if (!missing.length) return 'found';\n // Said in the debug log too: started by the desktop app, nothing shows what a reporter prints.\n const say = (level: 'info' | 'warn', text: string) => {\n report(level, text);\n debugLog(level === 'warn' ? 'WARN' : 'INFO', text);\n };\n const read = (opts.readPath ?? (() => readShellPath(env.SHELL)))();\n if ('why' in read) {\n say('warn', `${missing.join(', ')} isn't on PATH (${env.PATH ?? ''}), and the login shell's PATH couldn't be read: ${read.why}`);\n return 'unavailable';\n }\n env.PATH = mergePath(env.PATH, read.path);\n const still = missing.filter((c) => !find(c, env));\n say(\n still.length ? 'warn' : 'info',\n still.length\n ? `${still.join(', ')} isn't on PATH, even with the login shell's (${env.PATH})`\n : `${missing.join(', ')} found with the login shell's PATH: using it (${env.PATH})`,\n );\n return 'added';\n}\n","import { agentFor, agentSettings, assistantAgent, internalAgent } from './index.js';\nimport type { AgentSettings } from './index.js';\nimport { ensureShellPath } from '../platform/shell-path.js';\nimport { debugLog } from '../platform/logger.js';\n\n/**\n * The agents' commands, found on PATH before work web or the PTY host starts any of them\n * (`core/platform/shell-path.ts` says why: the Mac app from the Dock gets the system's PATH).\n */\n\n/** The commands work starts agents with, from the registry: new sessions', the Ctrl+K assistant's, the summaries'. */\nexport function agentCommands(settings: AgentSettings = agentSettings()): string[] {\n return [...new Set([agentFor(settings), assistantAgent(settings), internalAgent(settings)].map((a) => a.launch.tool(settings).cmd))];\n}\n\n/** For `work web` and the PTY host as they start (not wd's lean server: it starts no agent). Never throws. */\nexport function ensureAgentPath(\n deps: { commands?: () => string[]; ensure?: (need: string[]) => ReturnType<typeof ensureShellPath> } = {},\n): ReturnType<typeof ensureShellPath> | 'failed' {\n try {\n return (deps.ensure ?? ensureShellPath)((deps.commands ?? agentCommands)());\n } catch (err) {\n debugLog('WARN', 'finding the agents on PATH failed:', err);\n return 'failed';\n }\n}\n","import { validGrid } from './terminal-size.js';\n\n/**\n * Reattach where a client left off (terminal-rendering.md, \"Reattach where you left off\"). Pure; the Terminal tab and\n * the PTY host share it.\n *\n * Every screen the host sends (the `replay` frame) says which output stream it belongs to (`stream`: one per PTY entry\n * in one host, so a new spawn under the same id after the entry ended, or a host started again, is another stream) and\n * the offset it stands at (`offset`: characters of output since the entry was spawned, the pacer's unit, UTF-16 code\n * units). A restart or halt of its agent in place keeps the entry, and so the stream and the count: the clients attached\n * through it are sent the new process's output as it continues the old one's, with no screen in between, and a client\n * resuming across it is sent the same characters from its offset (pty-registry.test.ts, \"across a restart\"). Live\n * output follows in frames that are contiguous slices of that output, so a client knows its offset without any stamp\n * on them: the screen's offset plus what it was sent since (`utf16Length` of each binary frame, flow-control.ts).\n *\n * Reconnecting, a client that kept its screen states `?resume=<stream>-<offset>-<cols>x<rows>`: it has drawn\n * everything of that stream up to that offset, and its terminal is that grid. If the host can prove that sending what\n * came since is all it needs, it sends that (`replay` with `resumed: true`) and no screen; otherwise a screen as on\n * any attach. Absent, or from an older host or client, nothing changes: a screen.\n */\n\n/** The attach address's parameter a reconnecting client states its position in. An older host ignores it. */\nexport const RESUME_PARAM = 'resume';\n\n/** Where a client stands in a PTY's output: it has drawn all of `stream` up to `offset`, at this grid. */\nexport interface ResumePoint {\n stream: string;\n offset: number;\n cols: number;\n rows: number;\n}\n\n/** A stream id: what the host makes (pty-registry.ts), hex. */\nconst STREAM = /^[0-9a-f]{8,64}$/;\nconst FORMAT = /^([0-9a-f]{8,64})-(\\d{1,15})-(\\d{1,4})x(\\d{1,4})$/;\n\nexport function isStreamId(s: unknown): s is string {\n return typeof s === 'string' && STREAM.test(s);\n}\n\n/** `url` with the client's position added (`?resume=…`). */\nexport function withResume(url: string, at: ResumePoint | null | undefined): string {\n if (!at) return url;\n const value = `${at.stream}-${at.offset}-${at.cols}x${at.rows}`;\n return `${url}${url.includes('?') ? '&' : '?'}${RESUME_PARAM}=${value}`;\n}\n\n/** The position stated on an attach address, or null when there is none or it isn't one (then: a screen). */\nexport function resumeFromParams(params: URLSearchParams): ResumePoint | null {\n const m = FORMAT.exec(params.get(RESUME_PARAM) ?? '');\n if (!m) return null;\n const offset = Number(m[2]);\n const grid = validGrid(Number(m[3]), Number(m[4]));\n if (!Number.isSafeInteger(offset) || !grid) return null;\n return { stream: m[1], offset, cols: grid.cols, rows: grid.rows };\n}\n\n/** What a `replay` frame says about the stream (fields a host from before sends none of). */\nexport interface ReplayPosition {\n stream?: unknown;\n offset?: unknown;\n resumed?: unknown;\n}\n\n/**\n * A client's position in the PTY's output, as it receives it: set by each `replay` frame (a screen, or what it missed),\n * moved on by each binary frame. Unknown (null) when the host said nothing of it (an older host): then the client\n * never asks to resume.\n */\nexport class StreamPosition {\n private stream: string | null = null;\n private at = 0;\n\n /** A `replay` frame: it stands at its offset now (a screen replaces what was drawn; what was missed continues it). */\n replay(msg: ReplayPosition): void {\n const ok = isStreamId(msg.stream) && typeof msg.offset === 'number' && Number.isSafeInteger(msg.offset) && msg.offset >= 0;\n this.stream = ok ? (msg.stream as string) : null;\n this.at = ok ? (msg.offset as number) : 0;\n }\n\n /** A frame of live output, `chars` long in the host's unit (`utf16Length` of its bytes). */\n output(chars: number): void {\n if (this.stream !== null && chars > 0) this.at += chars;\n }\n\n /** Where it stands, at its terminal's grid; null when unknown. */\n point(cols: number, rows: number): ResumePoint | null {\n if (this.stream === null) return null;\n const grid = validGrid(cols, rows);\n return grid ? { stream: this.stream, offset: this.at, cols: grid.cols, rows: grid.rows } : null;\n }\n\n /** Forget it (the screen will be replaced whatever the host says: a fresh terminal). */\n forget(): void {\n this.stream = null;\n this.at = 0;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ;AACf,SAAS,gBAAgB;AAelB,SAAS,cAAc,KAAqC;AACjE,SAAO,IAAI,QAAQ,CAAC,YAAY;AAC9B,UAAM,OAAO,CAAC,KAAmB,QAAgB,QAAQ,MAAM,OAAO,IAAI,KAAK,KAAK,IAAI;AACxF,QAAI,QAAQ,aAAa;AACvB;AAAA,QACE,YAAY,YAAY;AAAA,QACxB,CAAC,cAAc,YAAY,qDAAqD,KAAK,MAAM,GAAG,CAAC,gBAAgB;AAAA,QAC/G,EAAE,aAAa,MAAM,SAAS,KAAO;AAAA,QACrC,CAAC,KAAK,QAAQ,KAAK,KAAK,OAAO,GAAG,CAAC;AAAA,MACrC;AAAA;AAEA;AAAA,QAAS,YAAY,IAAI;AAAA,QAAG,CAAC,MAAM,SAAS,MAAM,OAAO,KAAK,MAAM,GAAG,CAAC,CAAC;AAAA,QAAG,EAAE,aAAa,MAAM,SAAS,IAAK;AAAA,QAAG,CAAC,KAAK,QACtH,KAAK,KAAK,OAAO,GAAG,CAAC;AAAA,MACvB;AAAA,EACJ,CAAC;AACH;AAOO,SAAS,cAAc,aAAqC;AACjE,SACE,CAAC,CAAC,eAAe,oCAAoC,KAAK,WAAW,KAAK,CAAC,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EAAE,OAAO,KAAK,QAAQ,EAAE,GAAG,CAAC,CAAC;AACrI;AAGO,SAAS,gBACd,OAAuG,CAAC,GACzD;AAC/C,MAAI;AACF,YAAQ,KAAK,UAAU,kBAAkB,KAAK,YAAY,eAAe,CAAC;AAAA,EAC5E,SAAS,KAAK;AACZ,aAAS,QAAQ,sCAAsC,GAAG;AAC1D,WAAO;AAAA,EACT;AACF;;;ACHO,IAAM,eAAe;AAY5B,IAAM,SAAS;AAOR,SAAS,WAAW,KAAa,IAA4C;AAClF,MAAI,CAAC,GAAI,QAAO;AAChB,QAAM,QAAQ,GAAG,GAAG,MAAM,IAAI,GAAG,MAAM,IAAI,GAAG,IAAI,IAAI,GAAG,IAAI;AAC7D,SAAO,GAAG,GAAG,GAAG,IAAI,SAAS,GAAG,IAAI,MAAM,GAAG,GAAG,YAAY,IAAI,KAAK;AACvE;AAGO,SAAS,iBAAiB,QAA6C;AAC5E,QAAM,IAAI,OAAO,KAAK,OAAO,IAAI,YAAY,KAAK,EAAE;AACpD,MAAI,CAAC,EAAG,QAAO;AACf,QAAM,SAAS,OAAO,EAAE,CAAC,CAAC;AAC1B,QAAM,OAAO,UAAU,OAAO,EAAE,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC;AACjD,MAAI,CAAC,OAAO,cAAc,MAAM,KAAK,CAAC,KAAM,QAAO;AACnD,SAAO,EAAE,QAAQ,EAAE,CAAC,GAAG,QAAQ,MAAM,KAAK,MAAM,MAAM,KAAK,KAAK;AAClE;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/pty/pty-host-protocol.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { getConfigDir } from '../platform/config.js';\nimport type { AiToolSpec } from '../platform/ai-launcher.js';\nimport { isEnvDelta, type EnvDelta } from '../platform/env-delta.js';\nimport type { WindowsPty } from './terminal-size.js';\nimport type { StreamSignal } from './stream-status.js';\n\n/**\n * Wire contract between the PTY host (`work pty-host`, the long-lived\n * process that owns every Claude PTY) and its clients (`work web`,\n * `work attach`). Bump PROTOCOL_VERSION on any incompatible change: a\n * client that finds an older host running tells the user to restart it\n * (`work pty-host --restart`) instead of silently misbehaving — the host\n * outlives rebuilds by design.\n *\n * 2: the restore list moved from pty-sessions.json into state.db. A v1 host\n * still writes the file, which a v2 host adopts on start\n * (adoptLegacyRestoreList).\n */\nexport const PROTOCOL_VERSION = 2;\n\n/**\n * What this host can do beyond PROTOCOL_VERSION, answered by `/health` (additive: a host from before answers none).\n * `agentEnv`: it applies a spawn's / restart's / resume's `agentEnv` (a session's Claude account); `halt`: halt / resume.\n * A client asks before sending something an older host would silently drop (pty-pool.ts).\n */\nexport const HOST_FEATURES = ['agentEnv', 'halt', 'tickets'] as const;\nexport type HostFeature = (typeof HOST_FEATURES)[number];\n\n/** Discovery file: where the running host listens and its auth token. */\nexport interface HostInfo {\n pid: number;\n port: number;\n token: string;\n version: number;\n}\n\n/** What a client asks the host to spawn. The host decides `--continue`\n * itself (see `hasClaudeConversation`) so restores after a reboot make\n * the same call a fresh spawn would. */\nexport interface SpawnSpec {\n cwd: string;\n tool: AiToolSpec;\n port?: number;\n /**\n * The grid to start at: the terminal it is started for (a Terminal tab's, `work attach`'s), or the one it was used at\n * last (a restore). None: the last grid a client set in this host, else 120 × 32 (pty-registry.ts). Persisted with\n * each restore-list entry (additive: a host from before writes none and starts a restore at 120 × 32).\n */\n cols?: number;\n rows?: number;\n // No `unsafe` any more: every agent starts in its own permission mode. An older client may still send\n // `unsafe: true`, and a restore list written by an older host may hold it (and its tool an `unsafeFlag`): extra\n // fields, so no PROTOCOL_VERSION bump. A current host starts nothing from them and drops both when it restores or\n // restarts a session (pty-registry.ts); for one release legacy-unsafe.ts reads an entry's `unsafe: true` as \"an\n // older host still runs this agent without permission prompts\" and keeps its guards (REMOVE IN THE NEXT RELEASE).\n /** `--fresh`: start a new conversation even if one exists. First spawn\n * only — a restore always continues. */\n fresh?: boolean;\n /** `--prompt` / `--prompt-file` contents. First spawn only. */\n initialPrompt?: string;\n /** The launching shell's environment. First spawn only and never\n * persisted — it can hold secrets; a restore after reboot uses the\n * host's own environment. */\n env?: Record<string, string>;\n /**\n * What the agent's environment differs by for this session (its account's `CLAUDE_CONFIG_DIR`: set, or `null` = taken\n * out), applied over whatever environment the process starts with — the shell's, or the host's own. Persisted (a\n * folder path is no secret), so a restore keeps it. Additive, no PROTOCOL_VERSION bump: a host from before ignores\n * it and starts the agent on the environment it inherits (`work pty-host --restart` after upgrading).\n */\n agentEnv?: EnvDelta;\n}\n\n/** One entry of the host's restore list: how to respawn a session. The\n * spec as launched, minus `env` (never persisted: it can hold secrets) —\n * except the variables config `hostEnv` names (`keptEnv`), which a restore\n * after a reboot puts back over the host's own environment. */\nexport interface PersistedPty extends SpawnSpec {\n startedAt: string;\n keptEnv?: Record<string, string>;\n}\n\n/** Names that look like secrets (or carry them, as a connection string does): never kept on disk, whatever `hostEnv` says. */\nconst SECRET_NAME =\n /TOKEN|SECRET|PASS|PWD|CREDENTIAL|PRIVATE|KEY|AUTH|BEARER|COOKIE|SESSION|CERT|SIGN|SALT|(^|_)PAT($|_)|DSN|CONN|DATABASE_URL|_URI$|_URL$/i;\n/** Values that carry a password whatever their name: `scheme://user:pass@host`. */\nconst SECRET_VALUE = /:\\/\\/[^/\\s:@]+:[^/\\s@]+@/;\n\n/** Always kept for a restore, whatever `hostEnv` says: the agent's account folder (a path, not a secret — SECRET_VALUE still applies). */\nexport const ALWAYS_KEPT_ENV = ['CLAUDE_CONFIG_DIR'] as const;\n\n/** The variables of `env` to keep for a restore: the ones named (and `ALWAYS_KEPT_ENV`), that exist, and look like neither a secret nor a URL with a password in it. Pure. */\nexport function keepEnv(env: Record<string, string> | undefined, names: readonly string[]): Record<string, string> | undefined {\n if (!env) return undefined;\n const kept = Object.fromEntries(\n [...new Set([...names, ...ALWAYS_KEPT_ENV])]\n .filter((n) => !SECRET_NAME.test(n) && typeof env[n] === 'string' && !SECRET_VALUE.test(env[n]))\n .map((n) => [n, env[n]]),\n );\n return Object.keys(kept).length ? kept : undefined;\n}\nexport type PersistedPtys = Record<string, PersistedPty>;\n\n/** Shape check for a restore-list entry read back from storage. */\nexport function isPersistedPty(x: unknown): x is PersistedPty {\n const e = x as PersistedPty | null;\n return (\n !!e &&\n typeof e === 'object' &&\n typeof e.cwd === 'string' &&\n !!e.tool &&\n typeof e.tool === 'object' &&\n (e.agentEnv === undefined || isEnvDelta(e.agentEnv)) &&\n (e.keptEnv === undefined ||\n (!!e.keptEnv && typeof e.keptEnv === 'object' && Object.values(e.keptEnv).every((v) => typeof v === 'string')))\n );\n}\n\nexport interface PtyInfo {\n id: string;\n cwd: string;\n pid: number;\n exited: boolean;\n cols: number;\n rows: number;\n startedAt: string;\n /** Respawned by the host on startup from the persisted session list\n * (after a crash, `--restart` or reboot), not by a client. */\n restored: boolean;\n /** Clients attached right now (dashboard Terminal tabs, `work attach`).\n * Additive: a host from before it sends none. */\n clients?: number;\n /** When the PTY last printed anything (ISO). Additive, like clients. */\n lastOutputAt?: string;\n /** The tool's binary (`claude`, `opencode`…). Additive, like clients. */\n tool?: string;\n /** What its agent says about itself in its output: OSC 7501 program status, else OSC 9;4 progress (stream-status.ts).\n * Absent when it says nothing, and from a host from before. Additive, like clients. */\n signal?: StreamSignal;\n}\n\n/** Client → host frames on the attach WebSocket (text, JSON). Host →\n * client PTY output is sent as binary frames; control frames as text.\n * `ack`: from a client that attached with `?flow=1` (flow-control.ts), the characters of output it finished drawing\n * since its last ack. Additive, no PROTOCOL_VERSION bump: an older host ignores the parameter and the frame. */\nexport type ClientFrame =\n | { type: 'input'; data: string }\n | { type: 'resize'; cols: number; rows: number }\n | { type: 'ack'; chars: number }\n /** ⋯ → Reconnect terminal, after its replay: ask the agent to draw its screen again (registry.redraw). Additive: an older host drops it. */\n | { type: 'redraw' };\n\nexport type HostControlFrame =\n /** Sent first on attach: the serialized screen and the grid it was\n * drawn for. Clients draw it at exactly cols×rows, then resize to their\n * own size (which makes Claude redraw), and only then send input. A client\n * that stated its grid as it attached (terminal-size.ts) is sent it at that\n * grid already: its resize after it changes nothing.\n * A client that acks is sent one again mid-session when it fell behind and caught up (output-pacer.ts): it resets\n * its screen (scrollback too) and draws it, and nothing else — no resize, no focus, no input held for it. */\n | {\n type: 'replay';\n data: string;\n cols: number;\n rows: number;\n /** The host runs on Windows: its PTYs are ConPTY's, which reflows lines itself (terminal-size.ts). Additive. */\n windowsPty?: WindowsPty;\n /**\n * The PTY's output stream and the offset this frame leaves the client at: the start of the live output that\n * follows (resume.ts). Additive: a host from before sends neither, and its clients never ask to resume.\n */\n stream?: string;\n offset?: number;\n /**\n * `data` is the output the client missed, to draw on its screen as it is — no reset, no resize — up to `offset`.\n * Its queries were answered when they came: the client doesn't answer them again. Sent to a client that asked to\n * resume (`?resume=…`), from where it said it stood; and mid-session to a paced client other than `work attach`\n * (`?flow=1`, no `catchup=screen`) that fell behind and caught up, from where its live output stopped. Also, mid-\n * session, to such a client whose catch-up screen couldn't be taken: `data` '' and `stream` '' — it keeps its\n * screen, and no longer knows where it stands (it never resumes from there).\n */\n resumed?: true;\n }\n | { type: 'exit'; code: number }\n | { type: 'error'; message: string };\n\nexport function hostInfoPath(): string {\n return path.join(getConfigDir(), 'pty-host.json');\n}\n\n/** Held by a starting host from \"is one running?\" through writing its\n * discovery file AND restoring the saved sessions — so two hosts can't\n * both start, and a `work remove` racing a start waits for the restore\n * instead of slipping between it (see stopSessionPty). */\nexport function hostStartLockPath(): string {\n return path.join(getConfigDir(), 'pty-host.start.lock');\n}\n\n/** The pre-SQLite restore list. Only the one-time import reads it now. */\nexport function ptySessionsPath(): string {\n return path.join(getConfigDir(), 'pty-sessions.json');\n}\n\nexport function readHostInfo(): HostInfo | null {\n try {\n const raw = JSON.parse(fs.readFileSync(hostInfoPath(), 'utf-8')) as HostInfo;\n if (typeof raw.port === 'number' && typeof raw.token === 'string' && typeof raw.pid === 'number') {\n return raw;\n }\n return null;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;AACF,UAAM,MAAM,KAAK,MAAM,GAAG,aAAa,aAAa,GAAG,OAAO,CAAC;AAC/D,QAAI,OAAO,IAAI,SAAS,YAAY,OAAO,IAAI,UAAU,YAAY,OAAO,IAAI,QAAQ,UAAU;AAChG,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
workSteps,
|
|
5
5
|
workedBetween,
|
|
6
6
|
workedByDay
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-XJQ7XJJC.js";
|
|
8
8
|
import {
|
|
9
9
|
dayKey
|
|
10
10
|
} from "./chunk-NEJVK5CF.js";
|
|
11
11
|
import {
|
|
12
12
|
agentOf
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-BS6GTKF2.js";
|
|
14
14
|
|
|
15
15
|
// src/core/conversations/work-time-source.ts
|
|
16
16
|
import fs from "fs";
|
|
@@ -153,4 +153,4 @@ export {
|
|
|
153
153
|
sessionTokens,
|
|
154
154
|
sessionWorkTime
|
|
155
155
|
};
|
|
156
|
-
//# sourceMappingURL=chunk-
|
|
156
|
+
//# sourceMappingURL=chunk-O7BXNXU2.js.map
|