@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,8 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ensureAgentPath,
|
|
4
|
-
restartHost
|
|
5
|
-
|
|
4
|
+
restartHost,
|
|
5
|
+
resumeFromParams,
|
|
6
|
+
withResume
|
|
7
|
+
} from "./chunk-LZJ5VDUD.js";
|
|
6
8
|
import {
|
|
7
9
|
addTask,
|
|
8
10
|
completeTask,
|
|
@@ -24,7 +26,7 @@ import {
|
|
|
24
26
|
serveSpa,
|
|
25
27
|
sessionBaseForPath,
|
|
26
28
|
submitReviewSchema
|
|
27
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-5IZMEAKN.js";
|
|
28
30
|
import {
|
|
29
31
|
announceChange,
|
|
30
32
|
createArchivedRows,
|
|
@@ -39,25 +41,25 @@ import {
|
|
|
39
41
|
stageSeenKey,
|
|
40
42
|
storeHolding,
|
|
41
43
|
withRestoring
|
|
42
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-7I2UHJJF.js";
|
|
43
45
|
import {
|
|
44
46
|
createDigestSource
|
|
45
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-EOXYDFBB.js";
|
|
46
48
|
import {
|
|
47
49
|
createBuildFoldersJob,
|
|
48
50
|
defaultBranchTidyDeps,
|
|
49
51
|
defaultBuildFoldersDeps,
|
|
50
52
|
deleteMergedBranches,
|
|
51
53
|
findMergedBranches
|
|
52
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-EJZMCAM2.js";
|
|
53
55
|
import {
|
|
54
56
|
defaultCleanupDeps
|
|
55
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-Z3JSYKOS.js";
|
|
56
58
|
import {
|
|
57
59
|
DiffStatCache,
|
|
58
60
|
findOverlaps,
|
|
59
61
|
wantsDiffStat
|
|
60
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-ZIZ5ZTEN.js";
|
|
61
63
|
import {
|
|
62
64
|
dropLocalReview,
|
|
63
65
|
readLocalReview,
|
|
@@ -77,14 +79,14 @@ import {
|
|
|
77
79
|
graphProblem,
|
|
78
80
|
signOutGraph,
|
|
79
81
|
startDeviceLogin
|
|
80
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-JIMD77FI.js";
|
|
81
83
|
import {
|
|
82
84
|
anyOwnStatusLine,
|
|
83
85
|
buildUsage,
|
|
84
86
|
realUsageDeps,
|
|
85
87
|
refreshUsage,
|
|
86
88
|
setupAgentUsage
|
|
87
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-V6FD76AQ.js";
|
|
88
90
|
import {
|
|
89
91
|
archivedRefusal,
|
|
90
92
|
sendToSession
|
|
@@ -106,7 +108,7 @@ import {
|
|
|
106
108
|
removeBlocker,
|
|
107
109
|
sweepBlocks,
|
|
108
110
|
unblockedPrompt
|
|
109
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-OETBYJFV.js";
|
|
110
112
|
import {
|
|
111
113
|
jiraWorklogPoster,
|
|
112
114
|
logWorkDay,
|
|
@@ -115,7 +117,7 @@ import {
|
|
|
115
117
|
} from "./chunk-WIXY4EDH.js";
|
|
116
118
|
import {
|
|
117
119
|
sessionWorkTime
|
|
118
|
-
} from "./chunk-
|
|
120
|
+
} from "./chunk-O7BXNXU2.js";
|
|
119
121
|
import {
|
|
120
122
|
accountOverview,
|
|
121
123
|
accountSkillsNote,
|
|
@@ -128,7 +130,7 @@ import {
|
|
|
128
130
|
removeAgentAccount,
|
|
129
131
|
setDefaultAgentAccount,
|
|
130
132
|
switchRefusal
|
|
131
|
-
} from "./chunk-
|
|
133
|
+
} from "./chunk-ZBVM57LO.js";
|
|
132
134
|
import "./chunk-LK7HJGUC.js";
|
|
133
135
|
import {
|
|
134
136
|
freeLeftovers,
|
|
@@ -138,25 +140,27 @@ import {
|
|
|
138
140
|
parsePrRef,
|
|
139
141
|
resolvePrToStart,
|
|
140
142
|
workOnPrPrompt
|
|
141
|
-
} from "./chunk-
|
|
143
|
+
} from "./chunk-FRFS6JC4.js";
|
|
142
144
|
import {
|
|
143
145
|
legacyUnsafeCheck
|
|
144
|
-
} from "./chunk-
|
|
146
|
+
} from "./chunk-6ISLCEBR.js";
|
|
145
147
|
import {
|
|
146
148
|
howToLift
|
|
147
149
|
} from "./chunk-FZHFD2AY.js";
|
|
148
150
|
import {
|
|
149
151
|
agentsBySession,
|
|
152
|
+
stopBackgroundWork,
|
|
150
153
|
summarizeAgents
|
|
151
|
-
} from "./chunk-
|
|
154
|
+
} from "./chunk-R7IENU76.js";
|
|
155
|
+
import "./chunk-PCJVBGRS.js";
|
|
152
156
|
import {
|
|
153
157
|
removeWorktreeInChild
|
|
154
|
-
} from "./chunk-
|
|
158
|
+
} from "./chunk-ULI54QYZ.js";
|
|
155
159
|
import {
|
|
156
160
|
archiveMergedSession,
|
|
157
161
|
archiveWaiting,
|
|
158
162
|
defaultArchiveDeps
|
|
159
|
-
} from "./chunk-
|
|
163
|
+
} from "./chunk-R7JIKEIL.js";
|
|
160
164
|
import {
|
|
161
165
|
cleanupVerdict,
|
|
162
166
|
createCleanupJob
|
|
@@ -176,7 +180,7 @@ import {
|
|
|
176
180
|
retireResolvedReplies,
|
|
177
181
|
sessionRepoRefs,
|
|
178
182
|
withThreadContext
|
|
179
|
-
} from "./chunk-
|
|
183
|
+
} from "./chunk-TVIM5VV5.js";
|
|
180
184
|
import {
|
|
181
185
|
DEFAULT_TRUSTED_BOTS,
|
|
182
186
|
createCiStore,
|
|
@@ -186,21 +190,19 @@ import {
|
|
|
186
190
|
openThreadsOf,
|
|
187
191
|
reviewMessage,
|
|
188
192
|
subAgentHint
|
|
189
|
-
} from "./chunk-
|
|
190
|
-
import {
|
|
191
|
-
commandWords,
|
|
192
|
-
describeProcess,
|
|
193
|
-
isPtyHelper,
|
|
194
|
-
listProcesses,
|
|
195
|
-
normDir,
|
|
196
|
-
runningFromNames,
|
|
197
|
-
runsFrom
|
|
198
|
-
} from "./chunk-ICEP4WAK.js";
|
|
193
|
+
} from "./chunk-ETO7CUIS.js";
|
|
199
194
|
import {
|
|
200
195
|
defaultForkDeps,
|
|
201
196
|
forkSession,
|
|
202
197
|
startSessionWithPrompt
|
|
203
|
-
} from "./chunk-
|
|
198
|
+
} from "./chunk-L5U47Q63.js";
|
|
199
|
+
import {
|
|
200
|
+
FLOW_PARAM,
|
|
201
|
+
gridFromParams,
|
|
202
|
+
validGrid,
|
|
203
|
+
withFlow,
|
|
204
|
+
withGrid
|
|
205
|
+
} from "./chunk-6KMG4WNW.js";
|
|
204
206
|
import {
|
|
205
207
|
childText,
|
|
206
208
|
createInChild,
|
|
@@ -208,7 +210,7 @@ import {
|
|
|
208
210
|
keyedQueue,
|
|
209
211
|
oneAtATime,
|
|
210
212
|
runWorkChild
|
|
211
|
-
} from "./chunk-
|
|
213
|
+
} from "./chunk-EEMPMVCP.js";
|
|
212
214
|
import {
|
|
213
215
|
configurePtyPool,
|
|
214
216
|
detachPtyPool,
|
|
@@ -233,25 +235,26 @@ import {
|
|
|
233
235
|
syncPtyPool,
|
|
234
236
|
terminalTicketUrl,
|
|
235
237
|
writeToPty
|
|
236
|
-
} from "./chunk-
|
|
237
|
-
import "./chunk-
|
|
238
|
+
} from "./chunk-HTV7366A.js";
|
|
239
|
+
import "./chunk-BCYBF7KJ.js";
|
|
240
|
+
import "./chunk-ZDTFAMD2.js";
|
|
238
241
|
import {
|
|
239
242
|
disposeAllWatchers,
|
|
240
243
|
disposeSessionWatcher,
|
|
241
244
|
findSession as findSession2,
|
|
242
245
|
subscribeSession
|
|
243
|
-
} from "./chunk-
|
|
244
|
-
import "./chunk-
|
|
245
|
-
import "./chunk-
|
|
246
|
+
} from "./chunk-4FOC35LW.js";
|
|
247
|
+
import "./chunk-HCYES6U7.js";
|
|
248
|
+
import "./chunk-NS7WH53I.js";
|
|
246
249
|
import {
|
|
247
250
|
addRepoRefusal,
|
|
248
251
|
addedRepoNote
|
|
249
|
-
} from "./chunk-
|
|
252
|
+
} from "./chunk-4VTRRZWZ.js";
|
|
250
253
|
import {
|
|
251
254
|
teardownWorktree,
|
|
252
255
|
toBaseSpec,
|
|
253
256
|
wouldRefuseRemoval
|
|
254
|
-
} from "./chunk-
|
|
257
|
+
} from "./chunk-WYCGV5Z7.js";
|
|
255
258
|
import "./chunk-Y7PWSACJ.js";
|
|
256
259
|
import {
|
|
257
260
|
isWorktreeFolder
|
|
@@ -271,35 +274,36 @@ import {
|
|
|
271
274
|
stackedOn,
|
|
272
275
|
updateFromBase,
|
|
273
276
|
updateFromMain
|
|
274
|
-
} from "./chunk-
|
|
277
|
+
} from "./chunk-4GIAERRK.js";
|
|
275
278
|
import {
|
|
276
279
|
sessionStatusView,
|
|
277
280
|
shownState
|
|
278
|
-
} from "./chunk-
|
|
281
|
+
} from "./chunk-AZF7HIDT.js";
|
|
279
282
|
import {
|
|
280
283
|
askCatchUp,
|
|
281
284
|
cachedCatchUp,
|
|
282
285
|
catchUp,
|
|
283
286
|
catchUpFacts,
|
|
284
287
|
forgetCatchUp
|
|
285
|
-
} from "./chunk-
|
|
288
|
+
} from "./chunk-6RFDASKQ.js";
|
|
286
289
|
import {
|
|
287
290
|
internalReadOnly,
|
|
288
291
|
runInternal,
|
|
289
292
|
runInternalReadOnly,
|
|
290
293
|
summarizeCheckpoint,
|
|
291
294
|
throttleTrailing
|
|
292
|
-
} from "./chunk-
|
|
295
|
+
} from "./chunk-FEI73IPX.js";
|
|
293
296
|
import {
|
|
294
297
|
computeDiff,
|
|
295
298
|
computeRangeDiff,
|
|
296
299
|
parseGitDiff
|
|
297
|
-
} from "./chunk-
|
|
300
|
+
} from "./chunk-VVJY6IKW.js";
|
|
298
301
|
import {
|
|
299
302
|
changeRailSections,
|
|
300
303
|
placeSession,
|
|
301
|
-
readRailLayout
|
|
302
|
-
|
|
304
|
+
readRailLayout,
|
|
305
|
+
saveRailView
|
|
306
|
+
} from "./chunk-UGDTSOPX.js";
|
|
303
307
|
import {
|
|
304
308
|
QUEUE_RECHECK_MS,
|
|
305
309
|
busyForRestart,
|
|
@@ -337,7 +341,7 @@ import {
|
|
|
337
341
|
tempoSetup,
|
|
338
342
|
timeRange,
|
|
339
343
|
updateDay
|
|
340
|
-
} from "./chunk-
|
|
344
|
+
} from "./chunk-4LZLVHZE.js";
|
|
341
345
|
import {
|
|
342
346
|
DISCUSSION_OPEN_MIN_MS,
|
|
343
347
|
LEFT_OVER_SUBMIT,
|
|
@@ -386,6 +390,12 @@ import {
|
|
|
386
390
|
asData,
|
|
387
391
|
asDataBlock
|
|
388
392
|
} from "./chunk-JVE2JFLV.js";
|
|
393
|
+
import {
|
|
394
|
+
ASSISTANT_ID,
|
|
395
|
+
assistantDir,
|
|
396
|
+
describeView,
|
|
397
|
+
writeAssistantContext
|
|
398
|
+
} from "./chunk-K76NOSEX.js";
|
|
389
399
|
import {
|
|
390
400
|
childBrief,
|
|
391
401
|
childrenOf,
|
|
@@ -393,15 +403,9 @@ import {
|
|
|
393
403
|
newBranchCheck,
|
|
394
404
|
setParent,
|
|
395
405
|
spawnCheck
|
|
396
|
-
} from "./chunk-
|
|
397
|
-
import {
|
|
398
|
-
ASSISTANT_ID,
|
|
399
|
-
assistantDir,
|
|
400
|
-
describeView,
|
|
401
|
-
writeAssistantContext
|
|
402
|
-
} from "./chunk-TOMDOA4P.js";
|
|
406
|
+
} from "./chunk-DHZ5DF6Y.js";
|
|
403
407
|
import "./chunk-7E5XPDKX.js";
|
|
404
|
-
import "./chunk-
|
|
408
|
+
import "./chunk-AEH72XTU.js";
|
|
405
409
|
import {
|
|
406
410
|
clearDevWebDiscovery,
|
|
407
411
|
clearWebDiscovery,
|
|
@@ -419,7 +423,7 @@ import {
|
|
|
419
423
|
findSessionForCwd,
|
|
420
424
|
readPendingForSession,
|
|
421
425
|
readPendingForWorktree
|
|
422
|
-
} from "./chunk-
|
|
426
|
+
} from "./chunk-DP6YMZUL.js";
|
|
423
427
|
import "./chunk-ZSHWP2VS.js";
|
|
424
428
|
import {
|
|
425
429
|
getCommentFileStore
|
|
@@ -431,7 +435,7 @@ import {
|
|
|
431
435
|
checkTools,
|
|
432
436
|
saveFolders,
|
|
433
437
|
setupState
|
|
434
|
-
} from "./chunk-
|
|
438
|
+
} from "./chunk-WLYWO6JH.js";
|
|
435
439
|
import {
|
|
436
440
|
chooseWorktreesRoot,
|
|
437
441
|
expandHome
|
|
@@ -444,17 +448,17 @@ import {
|
|
|
444
448
|
stageInputOf,
|
|
445
449
|
withRequiredChecks,
|
|
446
450
|
workElsewhere
|
|
447
|
-
} from "./chunk-
|
|
451
|
+
} from "./chunk-BTGPUOF7.js";
|
|
448
452
|
import {
|
|
449
453
|
createSessionBranches
|
|
450
|
-
} from "./chunk-
|
|
454
|
+
} from "./chunk-DSDPJATB.js";
|
|
451
455
|
import {
|
|
452
456
|
defaultHost,
|
|
453
457
|
hostById,
|
|
454
458
|
hostForRepo,
|
|
455
459
|
hostOfPrUrl,
|
|
456
460
|
originHostname
|
|
457
|
-
} from "./chunk-
|
|
461
|
+
} from "./chunk-6HVDHGNE.js";
|
|
458
462
|
import {
|
|
459
463
|
MAX_THREAD_BODY
|
|
460
464
|
} from "./chunk-FGPXMAYU.js";
|
|
@@ -479,13 +483,13 @@ import {
|
|
|
479
483
|
setRepoIgnored,
|
|
480
484
|
setReviewMode,
|
|
481
485
|
setScanRoot
|
|
482
|
-
} from "./chunk-
|
|
486
|
+
} from "./chunk-5THKIWZU.js";
|
|
483
487
|
import {
|
|
484
488
|
openUrl,
|
|
485
489
|
openWithDefaultApp,
|
|
486
490
|
revealInFileManager,
|
|
487
491
|
startEditor
|
|
488
|
-
} from "./chunk-
|
|
492
|
+
} from "./chunk-26BZGPFZ.js";
|
|
489
493
|
import {
|
|
490
494
|
enrollProblem,
|
|
491
495
|
groupProblem,
|
|
@@ -517,6 +521,7 @@ import {
|
|
|
517
521
|
compressQuietCopies,
|
|
518
522
|
createFsWatcher,
|
|
519
523
|
createStageTracker,
|
|
524
|
+
describeProcess,
|
|
520
525
|
devLogTail,
|
|
521
526
|
devState,
|
|
522
527
|
disposeAllScopes,
|
|
@@ -527,15 +532,19 @@ import {
|
|
|
527
532
|
headAdvancedSinceInitial,
|
|
528
533
|
headBroughtInOtherWork,
|
|
529
534
|
hostName,
|
|
535
|
+
isPtyHelper,
|
|
530
536
|
isRestoring,
|
|
531
537
|
lastConversationWriteMs,
|
|
532
538
|
listIssues,
|
|
539
|
+
listProcessUsage,
|
|
540
|
+
listProcesses,
|
|
533
541
|
listScopes,
|
|
534
542
|
loadHistory,
|
|
535
543
|
loadManifest,
|
|
536
544
|
markAgentStopped,
|
|
537
545
|
markScopeEnded,
|
|
538
546
|
markSeen,
|
|
547
|
+
normDir,
|
|
539
548
|
notePrLooks,
|
|
540
549
|
noteSessionPrs,
|
|
541
550
|
notifyKindForTransition,
|
|
@@ -558,6 +567,8 @@ import {
|
|
|
558
567
|
restoreArchivedTranscripts,
|
|
559
568
|
reviveScope,
|
|
560
569
|
runGitAsync,
|
|
570
|
+
runningFromNames,
|
|
571
|
+
runsFrom,
|
|
561
572
|
scopeHashForPaths,
|
|
562
573
|
scopesForCwd,
|
|
563
574
|
scopesToSweep,
|
|
@@ -585,7 +596,7 @@ import {
|
|
|
585
596
|
updateCheckpoint,
|
|
586
597
|
whileRestoring,
|
|
587
598
|
writeArchiveRecord
|
|
588
|
-
} from "./chunk-
|
|
599
|
+
} from "./chunk-XJQ7XJJC.js";
|
|
589
600
|
import {
|
|
590
601
|
dayKey
|
|
591
602
|
} from "./chunk-NEJVK5CF.js";
|
|
@@ -597,9 +608,6 @@ import {
|
|
|
597
608
|
tx,
|
|
598
609
|
withDb
|
|
599
610
|
} from "./chunk-QGUBOOEN.js";
|
|
600
|
-
import {
|
|
601
|
-
packageRoot
|
|
602
|
-
} from "./chunk-LNHSBM4L.js";
|
|
603
611
|
import {
|
|
604
612
|
AccountAdminError,
|
|
605
613
|
RETIRED_HOOK_OWNERS,
|
|
@@ -615,16 +623,17 @@ import {
|
|
|
615
623
|
liveAgents,
|
|
616
624
|
logSwallowed,
|
|
617
625
|
ownsBranch,
|
|
626
|
+
packageRoot,
|
|
618
627
|
projectList,
|
|
619
628
|
readJsonlSince,
|
|
620
629
|
swallow
|
|
621
|
-
} from "./chunk-
|
|
630
|
+
} from "./chunk-BS6GTKF2.js";
|
|
622
631
|
import "./chunk-KGHWHAVF.js";
|
|
623
|
-
import "./chunk-
|
|
632
|
+
import "./chunk-KUYEYPO4.js";
|
|
624
633
|
import "./chunk-ED6YLB4S.js";
|
|
625
634
|
import {
|
|
626
635
|
VERSION
|
|
627
|
-
} from "./chunk-
|
|
636
|
+
} from "./chunk-CJFAJV2K.js";
|
|
628
637
|
import {
|
|
629
638
|
resolveProjectTarget
|
|
630
639
|
} from "./chunk-IPHADNF5.js";
|
|
@@ -646,7 +655,7 @@ import {
|
|
|
646
655
|
import {
|
|
647
656
|
DEFAULT_ACCOUNT_NAME,
|
|
648
657
|
accountNameProblem
|
|
649
|
-
} from "./chunk-
|
|
658
|
+
} from "./chunk-EVGYDJI2.js";
|
|
650
659
|
import {
|
|
651
660
|
DEFAULT_ACCOUNT,
|
|
652
661
|
DEFAULT_PROMPTS,
|
|
@@ -655,13 +664,14 @@ import {
|
|
|
655
664
|
RAIL_COLORS,
|
|
656
665
|
applyPlacePatch,
|
|
657
666
|
applySectionOp,
|
|
667
|
+
asRailView,
|
|
658
668
|
cleanPlacePatch,
|
|
659
669
|
cleanSectionOp,
|
|
660
670
|
getConfigPath,
|
|
661
671
|
isRailColor,
|
|
662
672
|
isWorkday,
|
|
663
673
|
loadConfig
|
|
664
|
-
} from "./chunk-
|
|
674
|
+
} from "./chunk-ASGJ3MCL.js";
|
|
665
675
|
import "./chunk-W4GDPHIF.js";
|
|
666
676
|
import "./chunk-BR6OWWAA.js";
|
|
667
677
|
import {
|
|
@@ -789,6 +799,12 @@ function realDeps(app) {
|
|
|
789
799
|
const agent = s ? agentOf(s) : null;
|
|
790
800
|
if (!s || !agent?.conversation) return { error: `work can't read ${agent?.name ?? "its agent"}'s conversations yet` };
|
|
791
801
|
return { text: lastReplyOf(agent.conversation.read(s, { last: 40 })) };
|
|
802
|
+
},
|
|
803
|
+
stopBackground: async (id) => {
|
|
804
|
+
const s = findSession2(id);
|
|
805
|
+
const toolShell = s ? agentOf(s).live?.toolShell : void 0;
|
|
806
|
+
if (!s || !toolShell) return { error: `work can't tell ${s ? agentOf(s).name : "its agent"}'s background commands apart yet` };
|
|
807
|
+
return stopBackgroundWork(agentsBySession(liveAgents(), loadHistory()).get(id) ?? [], toolShell);
|
|
792
808
|
}
|
|
793
809
|
};
|
|
794
810
|
}
|
|
@@ -836,6 +852,14 @@ function mountSessionControlRoutes(app, opts) {
|
|
|
836
852
|
opts.broadcast("sessions-changed", { ts: Date.now() });
|
|
837
853
|
return c.json({ how: "stopped" });
|
|
838
854
|
});
|
|
855
|
+
app.post("/api/sessions/:id/background/stop", async (c) => {
|
|
856
|
+
const id = c.req.param("id");
|
|
857
|
+
if (!findSession2(id)) return c.json({ error: "unknown session" }, 404);
|
|
858
|
+
const r = await deps.stopBackground(id);
|
|
859
|
+
if ("error" in r) return c.json(r, 409);
|
|
860
|
+
if (r.stopped.length) opts.broadcast("sessions-changed", { ts: Date.now() });
|
|
861
|
+
return c.json(r);
|
|
862
|
+
});
|
|
839
863
|
app.get("/api/sessions/:id/screen", async (c) => {
|
|
840
864
|
const id = c.req.param("id");
|
|
841
865
|
if (!findSession2(id)) return c.json({ error: "unknown session" }, 404);
|
|
@@ -852,12 +876,12 @@ function mountSessionControlRoutes(app, opts) {
|
|
|
852
876
|
// src/core/stacks/stack-sync.ts
|
|
853
877
|
var busyWhy = (state) => state === "working" ? "its Claude is working" : state === "needs_input" ? "its Claude is waiting for your answer" : null;
|
|
854
878
|
async function syncStackChild(child, parentBranch, deps) {
|
|
855
|
-
const
|
|
879
|
+
const run = deps.run ?? defaultRunner;
|
|
856
880
|
const busy = busyWhy(deps.shownState(child));
|
|
857
881
|
if (busy) return { updated: false, why: busy };
|
|
858
882
|
const behind = [];
|
|
859
883
|
for (const p of child.paths) {
|
|
860
|
-
const b = await behindMain(p,
|
|
884
|
+
const b = await behindMain(p, run, parentBranch);
|
|
861
885
|
if (b && b.commits > 0) behind.push({ path: p, b });
|
|
862
886
|
}
|
|
863
887
|
if (behind.length === 0) return { updated: false, why: `already on top of ${parentBranch}` };
|
|
@@ -865,9 +889,9 @@ async function syncStackChild(child, parentBranch, deps) {
|
|
|
865
889
|
return { updated: false, why: `bringing in ${parentBranch} would conflict: left for you (Update from ${parentBranch})` };
|
|
866
890
|
const heads = /* @__PURE__ */ new Map();
|
|
867
891
|
for (const { path: p } of behind) {
|
|
868
|
-
const st = await
|
|
892
|
+
const st = await run("git", ["-C", p, "status", "--porcelain"], p);
|
|
869
893
|
if (st.code !== 0 || st.stdout.trim()) return { updated: false, why: "it has uncommitted changes" };
|
|
870
|
-
const head = await
|
|
894
|
+
const head = await run("git", ["-C", p, "rev-parse", "HEAD"], p);
|
|
871
895
|
if (head.code !== 0) return { updated: false, why: `${p}: ${head.stderr.trim() || "no HEAD"}` };
|
|
872
896
|
heads.set(p, head.stdout.trim());
|
|
873
897
|
}
|
|
@@ -876,9 +900,9 @@ async function syncStackChild(child, parentBranch, deps) {
|
|
|
876
900
|
const done = [];
|
|
877
901
|
for (const { path: p } of behind) {
|
|
878
902
|
const nowBusy = busyWhy(deps.shownState(child));
|
|
879
|
-
const r = nowBusy ? null : await updateFromMain(p,
|
|
903
|
+
const r = nowBusy ? null : await updateFromMain(p, run, parentBranch);
|
|
880
904
|
if (!r || !r.ok) {
|
|
881
|
-
for (const q of done) await
|
|
905
|
+
for (const q of done) await run("git", ["-C", q, "reset", "--hard", "--quiet", heads.get(q)], q);
|
|
882
906
|
return {
|
|
883
907
|
updated: false,
|
|
884
908
|
why: nowBusy ?? `${r.repo}: ${r.reason}${done.length ? " (the others were put back)" : ""}`
|
|
@@ -900,15 +924,15 @@ async function syncStackChild(child, parentBranch, deps) {
|
|
|
900
924
|
return { updated: true, commits, how, told };
|
|
901
925
|
}
|
|
902
926
|
async function retargetIfMerged(child, parent, config, deps) {
|
|
903
|
-
const
|
|
927
|
+
const run = deps.run ?? defaultRunner;
|
|
904
928
|
const busy = busyWhy(deps.shownState(child));
|
|
905
929
|
if (busy) return { updated: false, why: busy };
|
|
906
930
|
const tips = /* @__PURE__ */ new Map();
|
|
907
|
-
for (const p of child.paths) tips.set(p, await parentTipFor(p, parent, config,
|
|
931
|
+
for (const p of child.paths) tips.set(p, await parentTipFor(p, parent, config, run));
|
|
908
932
|
for (const p of child.paths) {
|
|
909
933
|
const tip = tips.get(p);
|
|
910
934
|
if (!tip) return { updated: false, why: `${parent.branch} merged, but its tip is unknown here: Move onto main by hand` };
|
|
911
|
-
const blocker = await retargetBlocker(p, { branch: parent.branch, tip },
|
|
935
|
+
const blocker = await retargetBlocker(p, { branch: parent.branch, tip }, run);
|
|
912
936
|
if (blocker?.handOff) {
|
|
913
937
|
const key = `${sessionIdFor(child)}:${tip}`;
|
|
914
938
|
if (handedOff.has(key))
|
|
@@ -920,7 +944,7 @@ async function retargetIfMerged(child, parent, config, deps) {
|
|
|
920
944
|
await deps.tell(child, ontoMainPrompt(parent.branch)).catch((err) => logSwallowed(`asking ${child.branch} to move onto main`, err));
|
|
921
945
|
return { updated: false, why: `${parent.branch} was rewritten before it merged: its Claude was asked to move this branch onto main` };
|
|
922
946
|
}
|
|
923
|
-
if (!await retargetIsClean(p, { branch: parent.branch, tip },
|
|
947
|
+
if (!await retargetIsClean(p, { branch: parent.branch, tip }, run)) {
|
|
924
948
|
return {
|
|
925
949
|
updated: false,
|
|
926
950
|
why: `${parent.branch} merged; moving onto main isn't sure to go cleanly (a conflict, uncommitted changes, a rewritten parent, or an old git): left for you`
|
|
@@ -930,7 +954,7 @@ async function retargetIfMerged(child, parent, config, deps) {
|
|
|
930
954
|
const r = await retargetOntoMain(
|
|
931
955
|
child,
|
|
932
956
|
async (p) => ({ branch: parent.branch, tip: tips.get(p) ?? null }),
|
|
933
|
-
|
|
957
|
+
run,
|
|
934
958
|
() => busyWhy(deps.shownState(child))
|
|
935
959
|
);
|
|
936
960
|
if (!r.ok)
|
|
@@ -961,7 +985,7 @@ async function retargetChildrenOf(parentId, deps) {
|
|
|
961
985
|
const stacks = sessionStacks(history, config);
|
|
962
986
|
const children = history.filter((s) => stacks.mergedParentOf.get(sessionIdFor(s))?.id === parentId);
|
|
963
987
|
if (children.length === 0) return 0;
|
|
964
|
-
const
|
|
988
|
+
const run = deps.startRun();
|
|
965
989
|
let moved = 0;
|
|
966
990
|
for (const child of children) {
|
|
967
991
|
const id = sessionIdFor(child);
|
|
@@ -972,18 +996,18 @@ async function retargetChildrenOf(parentId, deps) {
|
|
|
972
996
|
if (r.updated) {
|
|
973
997
|
moved++;
|
|
974
998
|
deps.invalidate(id);
|
|
975
|
-
|
|
999
|
+
run.note(
|
|
976
1000
|
`${child.branch}: ${r.how} (its parent merged and was archived)${r.told ? "; its Claude was told" : " \u2014 telling its Claude failed"}`,
|
|
977
1001
|
{ sessionId: id, ...r.told ? {} : { level: "warn" } }
|
|
978
1002
|
);
|
|
979
|
-
} else
|
|
1003
|
+
} else run.note(`${child.branch}: left as it is \u2014 ${r.why}`, { sessionId: id });
|
|
980
1004
|
} catch (err) {
|
|
981
|
-
|
|
1005
|
+
run.note(`${child.branch}: ${err.message}`, { sessionId: id, level: "warn" });
|
|
982
1006
|
} finally {
|
|
983
1007
|
deps.busy.delete(id);
|
|
984
1008
|
}
|
|
985
1009
|
}
|
|
986
|
-
|
|
1010
|
+
run.done(moved ? `${moved} moved onto main` : "none could move by itself");
|
|
987
1011
|
return moved;
|
|
988
1012
|
}
|
|
989
1013
|
async function syncStacksAfterTurn(sessionId, deps) {
|
|
@@ -996,7 +1020,7 @@ async function syncStacksAfterTurn(sessionId, deps) {
|
|
|
996
1020
|
if (candidates2.length === 0 && !merged) return 0;
|
|
997
1021
|
for (const c of candidates2) deps.invalidate(sessionIdFor(c));
|
|
998
1022
|
if (config?.stacks?.autoUpdate === false) return 0;
|
|
999
|
-
const
|
|
1023
|
+
const run = deps.startRun();
|
|
1000
1024
|
let updated = 0;
|
|
1001
1025
|
if (self && merged && !deps.busy.has(sessionId)) {
|
|
1002
1026
|
deps.busy.add(sessionId);
|
|
@@ -1005,13 +1029,13 @@ async function syncStacksAfterTurn(sessionId, deps) {
|
|
|
1005
1029
|
if (r.updated) {
|
|
1006
1030
|
updated++;
|
|
1007
1031
|
deps.invalidate(sessionId);
|
|
1008
|
-
|
|
1032
|
+
run.note(`${self.branch}: ${r.how} (${merged.branch} merged)${r.told ? "; its Claude was told" : " \u2014 telling its Claude failed"}`, {
|
|
1009
1033
|
sessionId,
|
|
1010
1034
|
...r.told ? {} : { level: "warn" }
|
|
1011
1035
|
});
|
|
1012
|
-
} else
|
|
1036
|
+
} else run.note(`${self.branch}: left as it is \u2014 ${r.why}`, { sessionId });
|
|
1013
1037
|
} catch (err) {
|
|
1014
|
-
|
|
1038
|
+
run.note(`${self.branch}: ${err.message}`, { sessionId, level: "warn" });
|
|
1015
1039
|
} finally {
|
|
1016
1040
|
deps.busy.delete(sessionId);
|
|
1017
1041
|
}
|
|
@@ -1026,20 +1050,20 @@ async function syncStacksAfterTurn(sessionId, deps) {
|
|
|
1026
1050
|
if (r.updated) {
|
|
1027
1051
|
updated++;
|
|
1028
1052
|
deps.invalidate(childId);
|
|
1029
|
-
|
|
1053
|
+
run.note(
|
|
1030
1054
|
`${child.branch}: ${r.commits} commit${r.commits === 1 ? "" : "s"} from ${parent.branch} (${r.how})${r.told ? "; its Claude was told" : "; telling its Claude failed \u2014 it doesn't know yet"}`,
|
|
1031
1055
|
{ sessionId: childId, ...r.told ? {} : { level: "warn" } }
|
|
1032
1056
|
);
|
|
1033
1057
|
} else {
|
|
1034
|
-
|
|
1058
|
+
run.note(`${child.branch}: left as it is \u2014 ${r.why}`, { sessionId: childId });
|
|
1035
1059
|
}
|
|
1036
1060
|
} catch (err) {
|
|
1037
|
-
|
|
1061
|
+
run.note(`${child.branch}: ${err.message}`, { sessionId: childId, level: "warn" });
|
|
1038
1062
|
} finally {
|
|
1039
1063
|
deps.busy.delete(childId);
|
|
1040
1064
|
}
|
|
1041
1065
|
}
|
|
1042
|
-
|
|
1066
|
+
run.done(updated ? `${updated} brought up to date` : "nothing to bring in");
|
|
1043
1067
|
return updated;
|
|
1044
1068
|
}
|
|
1045
1069
|
|
|
@@ -2017,24 +2041,24 @@ async function readCodeFile(s, repo, rel, io = realIo) {
|
|
|
2017
2041
|
|
|
2018
2042
|
// src/core/worktree/terminal-path-refs.ts
|
|
2019
2043
|
function splitLine(raw) {
|
|
2020
|
-
let
|
|
2044
|
+
let path25 = raw;
|
|
2021
2045
|
let line;
|
|
2022
|
-
const m = /:(\d+)(?::\d+)?$/.exec(
|
|
2046
|
+
const m = /:(\d+)(?::\d+)?$/.exec(path25);
|
|
2023
2047
|
if (m) {
|
|
2024
|
-
|
|
2048
|
+
path25 = path25.slice(0, m.index);
|
|
2025
2049
|
const n = Number(m[1]);
|
|
2026
2050
|
if (n > 0) line = n;
|
|
2027
2051
|
}
|
|
2028
|
-
const url = /^file:\/\/([^/]*)(\/.*)?$/i.exec(
|
|
2052
|
+
const url = /^file:\/\/([^/]*)(\/.*)?$/i.exec(path25);
|
|
2029
2053
|
if (url) {
|
|
2030
|
-
|
|
2054
|
+
path25 = url[2] ?? "/";
|
|
2031
2055
|
try {
|
|
2032
|
-
|
|
2056
|
+
path25 = decodeURIComponent(path25);
|
|
2033
2057
|
} catch {
|
|
2034
2058
|
}
|
|
2035
|
-
if (/^\/[A-Za-z]:[\\/]/.test(
|
|
2059
|
+
if (/^\/[A-Za-z]:[\\/]/.test(path25)) path25 = path25.slice(1);
|
|
2036
2060
|
}
|
|
2037
|
-
return line === void 0 ? { path:
|
|
2061
|
+
return line === void 0 ? { path: path25 } : { path: path25, line };
|
|
2038
2062
|
}
|
|
2039
2063
|
|
|
2040
2064
|
// src/core/worktree/terminal-paths.ts
|
|
@@ -2463,77 +2487,6 @@ function reviewFocus(config, aliases) {
|
|
|
2463
2487
|
return attentionItems(r?.focus, ...[...new Set(aliases)].map((a) => r?.focusFor?.[a]));
|
|
2464
2488
|
}
|
|
2465
2489
|
|
|
2466
|
-
// src/core/platform/process-usage.ts
|
|
2467
|
-
import { execFile } from "child_process";
|
|
2468
|
-
import path8 from "path";
|
|
2469
|
-
var num = (v) => typeof v === "number" && Number.isFinite(v) && v >= 0 ? v : null;
|
|
2470
|
-
function parseCimUsage(json2) {
|
|
2471
|
-
let data;
|
|
2472
|
-
try {
|
|
2473
|
-
data = JSON.parse(json2);
|
|
2474
|
-
} catch {
|
|
2475
|
-
return [];
|
|
2476
|
-
}
|
|
2477
|
-
const rows = Array.isArray(data) ? data : data ? [data] : [];
|
|
2478
|
-
const out = [];
|
|
2479
|
-
for (const r of rows) {
|
|
2480
|
-
if (!r || typeof r !== "object") continue;
|
|
2481
|
-
const o = r;
|
|
2482
|
-
if (typeof o.ProcessId !== "number") continue;
|
|
2483
|
-
const started = num(o.Started);
|
|
2484
|
-
out.push({
|
|
2485
|
-
pid: o.ProcessId,
|
|
2486
|
-
ppid: typeof o.ParentProcessId === "number" ? o.ParentProcessId : 0,
|
|
2487
|
-
name: typeof o.Name === "string" ? o.Name : "",
|
|
2488
|
-
exe: typeof o.ExecutablePath === "string" ? o.ExecutablePath : null,
|
|
2489
|
-
command: typeof o.CommandLine === "string" ? o.CommandLine : "",
|
|
2490
|
-
memBytes: num(o.PrivatePageCount),
|
|
2491
|
-
// 0: a system process with no creation date.
|
|
2492
|
-
startedAt: started ? started : null
|
|
2493
|
-
});
|
|
2494
|
-
}
|
|
2495
|
-
return out;
|
|
2496
|
-
}
|
|
2497
|
-
function elapsedMs(etime) {
|
|
2498
|
-
const m = /^(?:(\d+)-)?(?:(\d+):)?(\d+):(\d+)$/.exec(etime.trim());
|
|
2499
|
-
if (!m) return null;
|
|
2500
|
-
const [days, hours, mins, secs] = [m[1], m[2], m[3], m[4]].map((x) => Number(x ?? 0));
|
|
2501
|
-
return (((days * 24 + hours) * 60 + mins) * 60 + secs) * 1e3;
|
|
2502
|
-
}
|
|
2503
|
-
function parsePsUsage(stdout, now) {
|
|
2504
|
-
const out = [];
|
|
2505
|
-
for (const line of stdout.split(/\r?\n/)) {
|
|
2506
|
-
const m = /^\s*(\d+)\s+(\d+)\s+(\d+)\s+(\S+)\s+(.*)$/.exec(line);
|
|
2507
|
-
if (!m) continue;
|
|
2508
|
-
const command = m[5].trim();
|
|
2509
|
-
const first = commandWords(command)[0] ?? "";
|
|
2510
|
-
const elapsed = elapsedMs(m[4]);
|
|
2511
|
-
out.push({
|
|
2512
|
-
pid: Number(m[1]),
|
|
2513
|
-
ppid: Number(m[2]),
|
|
2514
|
-
name: path8.posix.basename(first),
|
|
2515
|
-
exe: first.startsWith("/") ? first : null,
|
|
2516
|
-
command,
|
|
2517
|
-
memBytes: Number(m[3]) * 1024,
|
|
2518
|
-
startedAt: elapsed === null ? null : now - elapsed
|
|
2519
|
-
});
|
|
2520
|
-
}
|
|
2521
|
-
return out;
|
|
2522
|
-
}
|
|
2523
|
-
var run = (cmd, args) => new Promise(
|
|
2524
|
-
(resolve) => execFile(
|
|
2525
|
-
programPath(cmd),
|
|
2526
|
-
args,
|
|
2527
|
-
{ encoding: "utf-8", windowsHide: true, timeout: 2e4, maxBuffer: 64 * 1024 * 1024 },
|
|
2528
|
-
(_err, stdout) => resolve(stdout ?? "")
|
|
2529
|
-
)
|
|
2530
|
-
);
|
|
2531
|
-
var CIM_USAGE = "[Console]::OutputEncoding = [Text.Encoding]::UTF8; Get-CimInstance Win32_Process | Select-Object ProcessId,ParentProcessId,Name,ExecutablePath,CommandLine,PrivatePageCount,@{n='Started';e={ if ($_.CreationDate) { ([DateTimeOffset]$_.CreationDate).ToUnixTimeMilliseconds() } else { 0 } }} | ConvertTo-Json -Compress";
|
|
2532
|
-
async function listProcessUsage(now = Date.now()) {
|
|
2533
|
-
if (process.platform === "win32") return parseCimUsage(await run("powershell", ["-NoProfile", "-NonInteractive", "-Command", CIM_USAGE]));
|
|
2534
|
-
return parsePsUsage(await run("ps", ["-A", "-o", "pid=,ppid=,rss=,etime=,args="]), now);
|
|
2535
|
-
}
|
|
2536
|
-
|
|
2537
2490
|
// src/core/sessions/leftover-sweep.ts
|
|
2538
2491
|
async function sweepLeftovers(deps) {
|
|
2539
2492
|
const procs = await deps.list();
|
|
@@ -2635,9 +2588,9 @@ var NOT_NAMES = /* @__PURE__ */ new Set([
|
|
|
2635
2588
|
"typeof",
|
|
2636
2589
|
"await"
|
|
2637
2590
|
]);
|
|
2638
|
-
function declarationOf(
|
|
2591
|
+
function declarationOf(path25, text) {
|
|
2639
2592
|
for (const r of RULES) {
|
|
2640
|
-
if (!r.ext.test(
|
|
2593
|
+
if (!r.ext.test(path25)) continue;
|
|
2641
2594
|
const m = r.re.exec(text);
|
|
2642
2595
|
if (!m) continue;
|
|
2643
2596
|
const name = r.name(m);
|
|
@@ -2889,8 +2842,8 @@ function mountTerminalPathRoutes(app) {
|
|
|
2889
2842
|
app.post("/api/sessions/:id/terminal-paths/open", zValidator3("json", openSchema), async (c) => {
|
|
2890
2843
|
const session = findSession2(c.req.param("id"));
|
|
2891
2844
|
if (!session) return c.json({ error: "unknown session" }, 404);
|
|
2892
|
-
const { path:
|
|
2893
|
-
const r = await openTerminalPath(session,
|
|
2845
|
+
const { path: path25, how } = c.req.valid("json");
|
|
2846
|
+
const r = await openTerminalPath(session, path25, how);
|
|
2894
2847
|
if ("ok" in r) return c.json({ ok: true, opened: r.opened });
|
|
2895
2848
|
if (r.error === "failed") return c.json({ error: r.message ?? "could not open it" }, 500);
|
|
2896
2849
|
return c.json({ error: r.error }, 404);
|
|
@@ -3022,7 +2975,7 @@ function mountSetupRoutes(app, opts) {
|
|
|
3022
2975
|
|
|
3023
2976
|
// src/core/updates/update-source.ts
|
|
3024
2977
|
import fs7 from "fs";
|
|
3025
|
-
import
|
|
2978
|
+
import path8 from "path";
|
|
3026
2979
|
|
|
3027
2980
|
// src/core/updates/updates.ts
|
|
3028
2981
|
function parseVersion(v) {
|
|
@@ -3107,9 +3060,9 @@ function parseDesktopUpdate(text) {
|
|
|
3107
3060
|
var RELEASES_REPO = "moberghr/cli-work-tree-manager";
|
|
3108
3061
|
var RELEASES_URL = `https://api.github.com/repos/${RELEASES_REPO}/releases?per_page=30`;
|
|
3109
3062
|
var SEEN_KEY = "ui:seen-version";
|
|
3110
|
-
var desktopUpdatePath = () =>
|
|
3111
|
-
var desktopRequestPath = () =>
|
|
3112
|
-
async function fetchReleases(get = (url) => fetch(url, { headers: { "User-Agent": "work", Accept: "application/vnd.github+json" }, signal: AbortSignal.timeout(15e3) }),
|
|
3063
|
+
var desktopUpdatePath = () => path8.join(getConfigDir(), "desktop-update.json");
|
|
3064
|
+
var desktopRequestPath = () => path8.join(getConfigDir(), "desktop-request.json");
|
|
3065
|
+
async function fetchReleases(get = (url) => fetch(url, { headers: { "User-Agent": "work", Accept: "application/vnd.github+json" }, signal: AbortSignal.timeout(15e3) }), run = defaultRunner) {
|
|
3113
3066
|
const why = await get(RELEASES_URL).then(
|
|
3114
3067
|
async (res) => res.ok ? parseReleases(await res.json()) : res.status === 403 ? "GitHub's limit for this address is spent" : `GitHub answered ${res.status}`,
|
|
3115
3068
|
(err) => err
|
|
@@ -3118,7 +3071,7 @@ async function fetchReleases(get = (url) => fetch(url, { headers: { "User-Agent"
|
|
|
3118
3071
|
const offline = networkFailure(why);
|
|
3119
3072
|
if (offline) throw new Error(offline);
|
|
3120
3073
|
} else if (typeof why !== "string") return why;
|
|
3121
|
-
const r = await
|
|
3074
|
+
const r = await run("gh", ["api", `repos/${RELEASES_REPO}/releases?per_page=30`], process.cwd());
|
|
3122
3075
|
if (r.code === 0) {
|
|
3123
3076
|
try {
|
|
3124
3077
|
return parseReleases(JSON.parse(r.stdout));
|
|
@@ -3170,7 +3123,7 @@ function markSeenVersion(version) {
|
|
|
3170
3123
|
}
|
|
3171
3124
|
function installKind() {
|
|
3172
3125
|
const root = packageRoot();
|
|
3173
|
-
return installKindOf(root, getConfigDir(), !!root && fs7.existsSync(
|
|
3126
|
+
return installKindOf(root, getConfigDir(), !!root && fs7.existsSync(path8.join(root, ".git")));
|
|
3174
3127
|
}
|
|
3175
3128
|
var defaultDeps = () => ({
|
|
3176
3129
|
fetchReleases: () => fetchReleases(),
|
|
@@ -3221,12 +3174,12 @@ function createUpdates(deps = defaultDeps()) {
|
|
|
3221
3174
|
checkedAt: () => checkedAt
|
|
3222
3175
|
};
|
|
3223
3176
|
}
|
|
3224
|
-
async function lookForUpdates(updates,
|
|
3177
|
+
async function lookForUpdates(updates, run, changed) {
|
|
3225
3178
|
const before = updates.wire().latest;
|
|
3226
3179
|
await updates.refresh();
|
|
3227
3180
|
const w = updates.wire();
|
|
3228
|
-
if (w.checkError)
|
|
3229
|
-
else
|
|
3181
|
+
if (w.checkError) run.fail(w.checkError);
|
|
3182
|
+
else run.done(w.available ? `work ${w.available.version} is out (this is ${w.running})` : `up to date (${w.running})`);
|
|
3230
3183
|
if (w.latest !== before) changed();
|
|
3231
3184
|
}
|
|
3232
3185
|
|
|
@@ -3376,7 +3329,7 @@ function mountRepoRoutes(app, opts) {
|
|
|
3376
3329
|
const regenerate = (name) => {
|
|
3377
3330
|
const bin = opts.workBin?.();
|
|
3378
3331
|
if (!bin) return;
|
|
3379
|
-
const
|
|
3332
|
+
const run = opts.activity?.start("groups", `Writing ${name}'s combined instructions`);
|
|
3380
3333
|
const child = spawn_default(
|
|
3381
3334
|
process.execPath,
|
|
3382
3335
|
[...process.execArgv.filter((f) => !/^--inspect/.test(f)), bin, "config", "group", "regen", name],
|
|
@@ -3386,8 +3339,8 @@ function mountRepoRoutes(app, opts) {
|
|
|
3386
3339
|
env: { ...process.env, NO_COLOR: "1" }
|
|
3387
3340
|
}
|
|
3388
3341
|
);
|
|
3389
|
-
child.on("error", (e) =>
|
|
3390
|
-
child.on("close", (code) => code === 0 ?
|
|
3342
|
+
child.on("error", (e) => run?.fail(e.message));
|
|
3343
|
+
child.on("close", (code) => code === 0 ? run?.done("written") : run?.fail(`work config group regen exited ${code}`));
|
|
3391
3344
|
};
|
|
3392
3345
|
app.get("/api/repos", (c) => {
|
|
3393
3346
|
try {
|
|
@@ -3450,8 +3403,8 @@ var SETTING_PATTERNS = {
|
|
|
3450
3403
|
/** A font name or several, comma-separated (the terminal's font; it refuses what would end a CSS value). */
|
|
3451
3404
|
fontFamily: "^[^;{}<>\\\\]+$"
|
|
3452
3405
|
};
|
|
3453
|
-
var bool = (
|
|
3454
|
-
path:
|
|
3406
|
+
var bool = (path25, section, label, help, def, when) => ({
|
|
3407
|
+
path: path25,
|
|
3455
3408
|
section,
|
|
3456
3409
|
label,
|
|
3457
3410
|
help,
|
|
@@ -3921,7 +3874,7 @@ var SETTINGS = [
|
|
|
3921
3874
|
"when each Claude next starts"
|
|
3922
3875
|
)
|
|
3923
3876
|
];
|
|
3924
|
-
var settingAt = (
|
|
3877
|
+
var settingAt = (path25) => SETTINGS.find((f) => f.path === path25);
|
|
3925
3878
|
function checkSetting(field, raw) {
|
|
3926
3879
|
const checked = checkValue(field, raw);
|
|
3927
3880
|
if (checked.ok && checked.value === null && field.required) return { ok: false, error: "it can\u2019t be left empty" };
|
|
@@ -3967,16 +3920,16 @@ function checkValue(field, raw) {
|
|
|
3967
3920
|
return typeof raw === "string" && k.options.some((o) => o.value === raw) ? { ok: true, value: raw } : { ok: false, error: `one of ${k.options.map((o) => o.value).join(", ")}` };
|
|
3968
3921
|
}
|
|
3969
3922
|
}
|
|
3970
|
-
function valueAt(obj,
|
|
3923
|
+
function valueAt(obj, path25) {
|
|
3971
3924
|
let cur = obj;
|
|
3972
|
-
for (const key of
|
|
3925
|
+
for (const key of path25.split(".")) {
|
|
3973
3926
|
if (!cur || typeof cur !== "object" || Array.isArray(cur)) return void 0;
|
|
3974
3927
|
cur = cur[key];
|
|
3975
3928
|
}
|
|
3976
3929
|
return cur;
|
|
3977
3930
|
}
|
|
3978
|
-
function setValueAt(obj,
|
|
3979
|
-
const keys =
|
|
3931
|
+
function setValueAt(obj, path25, value) {
|
|
3932
|
+
const keys = path25.split(".");
|
|
3980
3933
|
const chain = [obj];
|
|
3981
3934
|
let cur = obj;
|
|
3982
3935
|
for (const key of keys.slice(0, -1)) {
|
|
@@ -4016,8 +3969,8 @@ function checkRepoSetting(key, raw) {
|
|
|
4016
3969
|
return raw === "all" || raw === "asked" || raw === "off" ? { ok: true, value: raw } : { ok: false, error: "all, asked or off" };
|
|
4017
3970
|
}
|
|
4018
3971
|
function repoSettingsOf(raw, alias) {
|
|
4019
|
-
const map = (
|
|
4020
|
-
const m = valueAt(raw,
|
|
3972
|
+
const map = (path25) => {
|
|
3973
|
+
const m = valueAt(raw, path25);
|
|
4021
3974
|
return m && typeof m === "object" && !Array.isArray(m) ? m : {};
|
|
4022
3975
|
};
|
|
4023
3976
|
const checks = map(REPO_SETTING_PATH.requiredChecks)[alias];
|
|
@@ -4078,7 +4031,7 @@ function mountSettingsRoutes(app, opts) {
|
|
|
4078
4031
|
|
|
4079
4032
|
// src/core/settings/settings-admin.ts
|
|
4080
4033
|
import fs9 from "fs";
|
|
4081
|
-
import
|
|
4034
|
+
import path9 from "path";
|
|
4082
4035
|
|
|
4083
4036
|
// src/core/settings/terminal-style.ts
|
|
4084
4037
|
var TERMINAL_COLOR_KEYS = [
|
|
@@ -4244,7 +4197,7 @@ var TERMINAL_THEMES = [
|
|
|
4244
4197
|
}
|
|
4245
4198
|
];
|
|
4246
4199
|
var DEFAULT_TERMINAL_THEME = "default";
|
|
4247
|
-
var DEFAULT_TERMINAL_FONT_FAMILY = '"Cascadia Code", "Cascadia Mono", SFMono-Regular, Consolas, "Liberation Mono", monospace';
|
|
4200
|
+
var DEFAULT_TERMINAL_FONT_FAMILY = '"Cascadia Code", "Cascadia Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace';
|
|
4248
4201
|
var DEFAULT_TERMINAL_FONT_SIZE = 13;
|
|
4249
4202
|
var TERMINAL_FONT_SIZE_RANGE = { min: 8, max: 32 };
|
|
4250
4203
|
var DEFAULT_TERMINAL_LINE_HEIGHT = 1;
|
|
@@ -4318,13 +4271,13 @@ function readSettings() {
|
|
|
4318
4271
|
const colors = checkTerminalColors(valueAt(raw, "terminal.colors"));
|
|
4319
4272
|
return { values, ...Object.keys(colors).length ? { terminalColors: colors } : {}, configPath: getConfigPath() };
|
|
4320
4273
|
}
|
|
4321
|
-
async function writeSetting(
|
|
4322
|
-
const field = settingAt(
|
|
4323
|
-
if (!field) throw new SettingsError(`no setting ${
|
|
4274
|
+
async function writeSetting(path25, value) {
|
|
4275
|
+
const field = settingAt(path25);
|
|
4276
|
+
if (!field) throw new SettingsError(`no setting ${path25}`, 404);
|
|
4324
4277
|
const checked = checkSetting(field, value);
|
|
4325
4278
|
if (!checked.ok) throw new SettingsError(`${field.label}: ${checked.error}`);
|
|
4326
|
-
const toWrite = checkedFolders(
|
|
4327
|
-
await editConfig((raw) => setValueAt(raw,
|
|
4279
|
+
const toWrite = checkedFolders(path25, checked.value);
|
|
4280
|
+
await editConfig((raw) => setValueAt(raw, path25, toWrite)).catch((err) => {
|
|
4328
4281
|
throw err instanceof RepoAdminError ? new SettingsError(err.message) : err;
|
|
4329
4282
|
});
|
|
4330
4283
|
return readSettings();
|
|
@@ -4338,9 +4291,9 @@ function checkedFolders(at, value) {
|
|
|
4338
4291
|
if (at === "scanRoots" && Array.isArray(value))
|
|
4339
4292
|
return value.map((v) => {
|
|
4340
4293
|
const p = expandHome(v);
|
|
4341
|
-
if (!
|
|
4294
|
+
if (!path9.isAbsolute(p))
|
|
4342
4295
|
throw new SettingsError(`Folders scanned for repos: ${v} isn't a full path (start it from the drive, / or ~)`);
|
|
4343
|
-
const full =
|
|
4296
|
+
const full = path9.resolve(p);
|
|
4344
4297
|
if (!fs9.statSync(full, { throwIfNoEntry: false })?.isDirectory())
|
|
4345
4298
|
throw new SettingsError(`Folders scanned for repos: ${full} isn't a folder`);
|
|
4346
4299
|
return full;
|
|
@@ -4396,7 +4349,7 @@ function withOwnStatusLine(source, own) {
|
|
|
4396
4349
|
}
|
|
4397
4350
|
|
|
4398
4351
|
// src/core/conversations/timeline-source.ts
|
|
4399
|
-
import
|
|
4352
|
+
import path10 from "path";
|
|
4400
4353
|
|
|
4401
4354
|
// src/core/conversations/timeline.ts
|
|
4402
4355
|
var SIZE_LABEL = /^(\d+ files? · \+\d+ −\d+|no changes)$/;
|
|
@@ -4437,19 +4390,19 @@ function order(k) {
|
|
|
4437
4390
|
var DAYS = 30;
|
|
4438
4391
|
var MAX_TRANSCRIPT_BYTES = 8 << 20;
|
|
4439
4392
|
var MAX_COMMITS = 100;
|
|
4440
|
-
async function commitsOf(repo, since,
|
|
4441
|
-
const git3 = (...args) =>
|
|
4393
|
+
async function commitsOf(repo, since, run) {
|
|
4394
|
+
const git3 = (...args) => run("git", ["-C", repo, ...args], repo);
|
|
4442
4395
|
const base = (await git3("merge-base", "HEAD", "origin/HEAD")).stdout.trim();
|
|
4443
4396
|
const range = base ? [`${base}..HEAD`] : [`--since=${since}`, "HEAD"];
|
|
4444
4397
|
const log = await git3("log", `--max-count=${MAX_COMMITS}`, "--format=%H%x09%aI%x09%s", ...range);
|
|
4445
4398
|
if (log.code !== 0) return [];
|
|
4446
4399
|
return log.stdout.split("\n").filter(Boolean).map((line) => {
|
|
4447
4400
|
const [sha, at, ...subject] = line.split(" ");
|
|
4448
|
-
return { repo:
|
|
4401
|
+
return { repo: path10.basename(repo), sha, at, subject: subject.join(" ") };
|
|
4449
4402
|
});
|
|
4450
4403
|
}
|
|
4451
4404
|
async function sessionTimeline(s, deps = {}) {
|
|
4452
|
-
const
|
|
4405
|
+
const run = deps.run ?? defaultRunner;
|
|
4453
4406
|
const since = Math.max(Date.parse(s.createdAt) || 0, (deps.now ?? Date.now()) - DAYS * 864e5);
|
|
4454
4407
|
const transcripts = [];
|
|
4455
4408
|
const conv = agentOf(s).conversation;
|
|
@@ -4460,7 +4413,7 @@ async function sessionTimeline(s, deps = {}) {
|
|
|
4460
4413
|
} catch {
|
|
4461
4414
|
}
|
|
4462
4415
|
}
|
|
4463
|
-
const commits = s.archivedAt ? [] : (await Promise.all(s.paths.map((p) => commitsOf(p, s.createdAt,
|
|
4416
|
+
const commits = s.archivedAt ? [] : (await Promise.all(s.paths.map((p) => commitsOf(p, s.createdAt, run).catch(() => [])))).flat();
|
|
4464
4417
|
const prs = (deps.ci?.repos ?? []).filter((r) => r.pr).map((r) => ({
|
|
4465
4418
|
repo: r.name,
|
|
4466
4419
|
number: r.pr.number,
|
|
@@ -4582,7 +4535,7 @@ function placeJira(issue, detail, cfg) {
|
|
|
4582
4535
|
|
|
4583
4536
|
// src/server/routes/jira-watch-routes.ts
|
|
4584
4537
|
import fs10 from "fs";
|
|
4585
|
-
import
|
|
4538
|
+
import path11 from "path";
|
|
4586
4539
|
|
|
4587
4540
|
// src/core/jira/jira-watch.ts
|
|
4588
4541
|
var START_PER_SWEEP = 2;
|
|
@@ -4785,14 +4738,14 @@ async function sweepJira(deps) {
|
|
|
4785
4738
|
var EVERY_MS = 5 * 6e4;
|
|
4786
4739
|
function aboutRepo(dir) {
|
|
4787
4740
|
try {
|
|
4788
|
-
const readme = ["README.md", "readme.md", "README"].map((n) =>
|
|
4741
|
+
const readme = ["README.md", "readme.md", "README"].map((n) => path11.join(dir, n)).find((f) => fs10.existsSync(f));
|
|
4789
4742
|
if (readme) {
|
|
4790
4743
|
const line = fs10.readFileSync(readme, "utf8").split(/\r?\n/).map(
|
|
4791
4744
|
(l) => l.replace(/^[#>*\-\s]+/, "").replace(/[`*_[\]]/g, "").trim()
|
|
4792
4745
|
).find((l) => l.length > 20 && !/^(!|<|http)/.test(l));
|
|
4793
4746
|
if (line) return line.slice(0, 160);
|
|
4794
4747
|
}
|
|
4795
|
-
const pkg =
|
|
4748
|
+
const pkg = path11.join(dir, "package.json");
|
|
4796
4749
|
if (fs10.existsSync(pkg)) {
|
|
4797
4750
|
const d = JSON.parse(fs10.readFileSync(pkg, "utf8")).description;
|
|
4798
4751
|
if (typeof d === "string" && d.trim()) return d.trim().slice(0, 160);
|
|
@@ -4806,7 +4759,7 @@ function watchTargets(cfg = loadConfig()) {
|
|
|
4806
4759
|
const repos = Object.entries(cfg.repos).map(([alias, dir]) => ({
|
|
4807
4760
|
name: alias,
|
|
4808
4761
|
kind: "repo",
|
|
4809
|
-
members: [
|
|
4762
|
+
members: [path11.basename(dir)],
|
|
4810
4763
|
about: aboutRepo(dir)
|
|
4811
4764
|
}));
|
|
4812
4765
|
const groups = Object.entries(cfg.groups).map(([name, aliases]) => ({ name, kind: "group", members: aliases }));
|
|
@@ -4838,7 +4791,7 @@ function mountJiraWatchRoutes(app, opts) {
|
|
|
4838
4791
|
running ??= (async () => {
|
|
4839
4792
|
try {
|
|
4840
4793
|
if (!readSettings2().enabled) return;
|
|
4841
|
-
const
|
|
4794
|
+
const run = opts.activity?.start("jira-watch", "Looking for newly assigned Jira issues");
|
|
4842
4795
|
const deps = {
|
|
4843
4796
|
// Throws when acli can't list them: the sweep fails (said in Activity) rather than reading "none".
|
|
4844
4797
|
fetchIssues: fetchMyIssuesOrThrow,
|
|
@@ -4848,17 +4801,17 @@ function mountJiraWatchRoutes(app, opts) {
|
|
|
4848
4801
|
place: (issue, detail) => placeJira(issue, detail, loadConfig()),
|
|
4849
4802
|
ask: (prompt) => runInternal(prompt, 9e4),
|
|
4850
4803
|
start: (target, branch, issue) => start(target, branch, issue, true),
|
|
4851
|
-
note: (text, level, sessionId) =>
|
|
4804
|
+
note: (text, level, sessionId) => run?.note(text, { level, ...sessionId ? { sessionId } : {} }),
|
|
4852
4805
|
maxPerDay: loadConfig()?.jiraWatch?.maxPerDay
|
|
4853
4806
|
};
|
|
4854
4807
|
try {
|
|
4855
4808
|
const r = await sweepJira(deps);
|
|
4856
|
-
|
|
4809
|
+
run?.done(
|
|
4857
4810
|
r.started || r.suggested || r.waiting ? `${r.started} started \xB7 ${r.suggested} to start yourself${r.waiting ? ` \xB7 ${r.waiting} waiting` : ""}` : "no new issues"
|
|
4858
4811
|
);
|
|
4859
4812
|
if (r.started || r.suggested) changed();
|
|
4860
4813
|
} catch (err) {
|
|
4861
|
-
|
|
4814
|
+
run?.fail(err.message);
|
|
4862
4815
|
}
|
|
4863
4816
|
lastRunAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4864
4817
|
} finally {
|
|
@@ -4984,7 +4937,7 @@ function describeStall(s) {
|
|
|
4984
4937
|
}
|
|
4985
4938
|
|
|
4986
4939
|
// src/server/web-server.ts
|
|
4987
|
-
import
|
|
4940
|
+
import path22 from "path";
|
|
4988
4941
|
import { Hono } from "hono";
|
|
4989
4942
|
import { streamSSE as streamSSE2 } from "hono/streaming";
|
|
4990
4943
|
|
|
@@ -5255,19 +5208,19 @@ function mountPanesRoutes(app, opts) {
|
|
|
5255
5208
|
const prsFetch = createSharedFetch(async () => {
|
|
5256
5209
|
const config = loadConfig();
|
|
5257
5210
|
if (!config) return { prs: [] };
|
|
5258
|
-
const
|
|
5211
|
+
const run = opts.activity?.start("pr-list", "Listing open pull requests");
|
|
5259
5212
|
try {
|
|
5260
5213
|
const { map, incomplete } = await fetchAllPullRequests(config.repos);
|
|
5261
5214
|
const prs = Array.from(map.values()).flat();
|
|
5262
5215
|
if (incomplete.length)
|
|
5263
|
-
|
|
5216
|
+
run?.note(
|
|
5264
5217
|
`couldn't list every PR of ${incomplete.join(", ")} (gh failed, or 100+ open): archiving isn't suggested for sessions there`,
|
|
5265
5218
|
{ level: "warn" }
|
|
5266
5219
|
);
|
|
5267
|
-
|
|
5220
|
+
run?.done(`${prs.length} open PR${prs.length === 1 ? "" : "s"} in ${Object.keys(config.repos).length} repos`);
|
|
5268
5221
|
return incomplete.length ? { prs, incomplete } : { prs };
|
|
5269
5222
|
} catch (err) {
|
|
5270
|
-
|
|
5223
|
+
run?.fail(err.message);
|
|
5271
5224
|
throw err;
|
|
5272
5225
|
}
|
|
5273
5226
|
}, PRS_TTL_MS);
|
|
@@ -5287,19 +5240,19 @@ function mountPanesRoutes(app, opts) {
|
|
|
5287
5240
|
let issuesInFlight = null;
|
|
5288
5241
|
app.get("/api/issues", async (c) => {
|
|
5289
5242
|
issuesInFlight ??= (async () => {
|
|
5290
|
-
const
|
|
5243
|
+
const run = opts.activity?.start("jira", "Fetching your issues");
|
|
5291
5244
|
try {
|
|
5292
5245
|
const r = await listIssues(issueSources(), loadConfig());
|
|
5293
5246
|
const down = r.sources.filter((s) => !s.available);
|
|
5294
5247
|
if (down.length && down.length === r.sources.length)
|
|
5295
|
-
|
|
5248
|
+
run?.fail(`${down.map((s) => s.name).join(", ")}: not available or not signed in`);
|
|
5296
5249
|
else
|
|
5297
|
-
|
|
5250
|
+
run?.done(
|
|
5298
5251
|
`${r.issues.length} issue${r.issues.length === 1 ? "" : "s"}${down.length ? ` \xB7 ${down.map((s) => s.name).join(", ")} not available` : ""}`
|
|
5299
5252
|
);
|
|
5300
5253
|
return r;
|
|
5301
5254
|
} catch (err) {
|
|
5302
|
-
|
|
5255
|
+
run?.fail(err.message);
|
|
5303
5256
|
throw err;
|
|
5304
5257
|
} finally {
|
|
5305
5258
|
issuesInFlight = null;
|
|
@@ -5315,7 +5268,7 @@ function mountPanesRoutes(app, opts) {
|
|
|
5315
5268
|
app.get("/api/jira", async (c) => {
|
|
5316
5269
|
if (!jiraInFlight) {
|
|
5317
5270
|
jiraInFlight = (async () => {
|
|
5318
|
-
const
|
|
5271
|
+
const run = opts.activity?.start("jira", "Fetching your Jira issues");
|
|
5319
5272
|
try {
|
|
5320
5273
|
const got = await fetchJiraPane();
|
|
5321
5274
|
const cfg = loadConfig();
|
|
@@ -5326,11 +5279,11 @@ function mountPanesRoutes(app, opts) {
|
|
|
5326
5279
|
return placed?.target ? { ...i, startsIn: placed.target } : i;
|
|
5327
5280
|
})
|
|
5328
5281
|
};
|
|
5329
|
-
if (!r.available)
|
|
5330
|
-
else
|
|
5282
|
+
if (!r.available) run?.fail("Jira CLI (acli) not available or not logged in");
|
|
5283
|
+
else run?.done(`${r.issues.length} issue${r.issues.length === 1 ? "" : "s"}`);
|
|
5331
5284
|
return r;
|
|
5332
5285
|
} catch (err) {
|
|
5333
|
-
|
|
5286
|
+
run?.fail(err.message);
|
|
5334
5287
|
throw err;
|
|
5335
5288
|
} finally {
|
|
5336
5289
|
jiraInFlight = null;
|
|
@@ -5392,7 +5345,7 @@ function mountPanesRoutes(app, opts) {
|
|
|
5392
5345
|
|
|
5393
5346
|
// src/server/routes/worktree-routes.ts
|
|
5394
5347
|
import fs11 from "fs";
|
|
5395
|
-
import
|
|
5348
|
+
import path12 from "path";
|
|
5396
5349
|
import { spawn } from "child_process";
|
|
5397
5350
|
|
|
5398
5351
|
// src/core/platform/started.ts
|
|
@@ -5415,12 +5368,12 @@ import { zValidator as zValidator6 } from "@hono/zod-validator";
|
|
|
5415
5368
|
import { z as z5 } from "zod";
|
|
5416
5369
|
var queues = /* @__PURE__ */ new Map();
|
|
5417
5370
|
function oneAtATime2(key, fn) {
|
|
5418
|
-
const
|
|
5419
|
-
queues.set(key,
|
|
5420
|
-
void
|
|
5421
|
-
if (queues.get(key) ===
|
|
5371
|
+
const run = (queues.get(key) ?? Promise.resolve()).catch(() => void 0).then(fn);
|
|
5372
|
+
queues.set(key, run);
|
|
5373
|
+
void run.finally(() => {
|
|
5374
|
+
if (queues.get(key) === run) queues.delete(key);
|
|
5422
5375
|
}).catch(() => void 0);
|
|
5423
|
-
return
|
|
5376
|
+
return run;
|
|
5424
5377
|
}
|
|
5425
5378
|
function mountWorktreeRoutes(app, opts) {
|
|
5426
5379
|
const createSchema = z5.object({
|
|
@@ -5500,7 +5453,11 @@ function mountWorktreeRoutes(app, opts) {
|
|
|
5500
5453
|
try {
|
|
5501
5454
|
started = await startSession(
|
|
5502
5455
|
id,
|
|
5503
|
-
parent ? childBrief(
|
|
5456
|
+
parent ? childBrief(
|
|
5457
|
+
parent.title?.trim() || `${parent.target} \xB7 ${parent.branch}`,
|
|
5458
|
+
prompt,
|
|
5459
|
+
agentOf(parent).tempFolders?.(parent) ?? []
|
|
5460
|
+
) : prompt.trim()
|
|
5504
5461
|
);
|
|
5505
5462
|
} catch (err) {
|
|
5506
5463
|
startError = err.message;
|
|
@@ -5623,7 +5580,7 @@ function mountWorktreeRoutes(app, opts) {
|
|
|
5623
5580
|
const wantsFile = !!body && typeof body === "object" && "path" in body;
|
|
5624
5581
|
const asked = wantsFile ? openFileSchema.safeParse(body) : null;
|
|
5625
5582
|
if (asked && !asked.success) return c.json({ error: "repo and path required" }, 400);
|
|
5626
|
-
const folder = session.isGroup ?
|
|
5583
|
+
const folder = session.isGroup ? path12.dirname(session.paths[0]) : session.paths[0];
|
|
5627
5584
|
let file;
|
|
5628
5585
|
if (asked?.success) {
|
|
5629
5586
|
const at = await codeFilePath(session, asked.data.repo, asked.data.path);
|
|
@@ -5670,7 +5627,7 @@ function mountWorktreeRoutes(app, opts) {
|
|
|
5670
5627
|
import { zValidator as zValidator7 } from "@hono/zod-validator";
|
|
5671
5628
|
import { z as z6 } from "zod";
|
|
5672
5629
|
import { EventEmitter } from "events";
|
|
5673
|
-
import
|
|
5630
|
+
import path13 from "path";
|
|
5674
5631
|
import { streamSSE } from "hono/streaming";
|
|
5675
5632
|
function mountScopeRoutes(app, opts) {
|
|
5676
5633
|
const background = /* @__PURE__ */ new Set();
|
|
@@ -5917,7 +5874,7 @@ function mountScopeRoutes(app, opts) {
|
|
|
5917
5874
|
const fromSha = fromEntry.repos[p] ?? "HEAD";
|
|
5918
5875
|
const toSha = toEntry === void 0 ? "working" : toEntry.repos[p] ?? "HEAD";
|
|
5919
5876
|
return {
|
|
5920
|
-
name:
|
|
5877
|
+
name: path13.basename(p),
|
|
5921
5878
|
root: p,
|
|
5922
5879
|
files: computeRangeDiff({ root: p, fromRef: fromSha, toRef: toSha })
|
|
5923
5880
|
};
|
|
@@ -5934,7 +5891,7 @@ function mountScopeRoutes(app, opts) {
|
|
|
5934
5891
|
}
|
|
5935
5892
|
const resolved = scope.paths.map((p) => resolveRepoDiff(p, base, sessionBaseForPath(p)));
|
|
5936
5893
|
const repos = scope.paths.map((p, i) => ({
|
|
5937
|
-
name:
|
|
5894
|
+
name: path13.basename(p),
|
|
5938
5895
|
root: p,
|
|
5939
5896
|
resolvedBase: resolved[i].resolvedBase,
|
|
5940
5897
|
files: computeDiff({ root: p, diffArg: resolved[i].diffArg })
|
|
@@ -5965,7 +5922,7 @@ function mountScopeRoutes(app, opts) {
|
|
|
5965
5922
|
if (!relPath || !Number.isInteger(start) || !Number.isInteger(end)) {
|
|
5966
5923
|
return c.json({ error: "bad path/start/end" }, 400);
|
|
5967
5924
|
}
|
|
5968
|
-
const root = scope.paths.length === 1 ? scope.paths[0] : scope.paths.find((p) =>
|
|
5925
|
+
const root = scope.paths.length === 1 ? scope.paths[0] : scope.paths.find((p) => path13.basename(p) === repoName);
|
|
5969
5926
|
if (!root) return c.json({ error: "unknown repo" }, 404);
|
|
5970
5927
|
const result = readContextLines({ root, relPath, start, end, ref });
|
|
5971
5928
|
if (!result) return c.json({ error: "cannot read file" }, 400);
|
|
@@ -6146,7 +6103,7 @@ function mountScopeRoutes(app, opts) {
|
|
|
6146
6103
|
// src/core/pty/terminal-perf.ts
|
|
6147
6104
|
var MAX_KEYS = 200;
|
|
6148
6105
|
var MAX_STALLS = 100;
|
|
6149
|
-
var
|
|
6106
|
+
var num = (x) => typeof x === "number" && Number.isFinite(x) && x >= 0 && x < 1e13;
|
|
6150
6107
|
function cleanPerfReport(x) {
|
|
6151
6108
|
if (!x || typeof x !== "object") return null;
|
|
6152
6109
|
const r = x;
|
|
@@ -6157,13 +6114,13 @@ function cleanPerfReport(x) {
|
|
|
6157
6114
|
const keys = [];
|
|
6158
6115
|
for (const k of r.keys.slice(0, MAX_KEYS)) {
|
|
6159
6116
|
const o = k;
|
|
6160
|
-
if (!o || !
|
|
6117
|
+
if (!o || !num(o.arrived) || !(o.shown === null || num(o.shown))) return null;
|
|
6161
6118
|
keys.push({ arrived: Math.round(o.arrived), shown: o.shown === null ? null : Math.round(o.shown) });
|
|
6162
6119
|
}
|
|
6163
6120
|
const stalls = [];
|
|
6164
6121
|
for (const s of r.stalls.slice(0, MAX_STALLS)) {
|
|
6165
6122
|
const o = s;
|
|
6166
|
-
if (!o || !
|
|
6123
|
+
if (!o || !num(o.at) || !num(o.ms) || !(o.blocking === null || num(o.blocking)) || typeof o.what !== "string") return null;
|
|
6167
6124
|
stalls.push({
|
|
6168
6125
|
at: o.at,
|
|
6169
6126
|
ms: Math.round(o.ms),
|
|
@@ -6198,15 +6155,17 @@ function mountTerminalRoutes(app, opts) {
|
|
|
6198
6155
|
app.post("/api/terminals/:id/ticket", async (c) => {
|
|
6199
6156
|
const id = c.req.param("id");
|
|
6200
6157
|
const body = await c.req.json().catch(() => ({}));
|
|
6158
|
+
const attachOnly = body.attachOnly === true;
|
|
6201
6159
|
const origin = c.req.header("origin");
|
|
6202
6160
|
if (!origin) return c.json({ fallback: true });
|
|
6203
|
-
if (body.force !== true) {
|
|
6161
|
+
if (body.force !== true && !attachOnly) {
|
|
6204
6162
|
const elsewhere = await opts.elsewhere(id);
|
|
6205
6163
|
if (elsewhere) return c.json({ elsewhere });
|
|
6206
6164
|
}
|
|
6207
6165
|
let running;
|
|
6208
6166
|
try {
|
|
6209
|
-
|
|
6167
|
+
const grid = validGrid(body.cols, body.rows) ?? void 0;
|
|
6168
|
+
running = await (attachOnly ? opts.ensure(id, grid, true) : opts.ensure(id, grid));
|
|
6210
6169
|
} catch (err) {
|
|
6211
6170
|
return c.json({ error: err.message }, 409);
|
|
6212
6171
|
}
|
|
@@ -6223,7 +6182,7 @@ function mountTerminalRoutes(app, opts) {
|
|
|
6223
6182
|
}
|
|
6224
6183
|
|
|
6225
6184
|
// src/server/routes/status-routes.ts
|
|
6226
|
-
import
|
|
6185
|
+
import path14 from "path";
|
|
6227
6186
|
|
|
6228
6187
|
// src/core/status/notifier.ts
|
|
6229
6188
|
var MESSAGES = {
|
|
@@ -6372,7 +6331,7 @@ function mountStatusRoutes(app, opts) {
|
|
|
6372
6331
|
const kind = notifyKindForTransition(status.prevState ? { state: status.prevState } : null, status);
|
|
6373
6332
|
if (kind) {
|
|
6374
6333
|
const config = loadConfig();
|
|
6375
|
-
const launchDir = session.isGroup && session.paths[0] ?
|
|
6334
|
+
const launchDir = session.isGroup && session.paths[0] ? path14.dirname(session.paths[0]) : session.paths[0] ?? body.cwd;
|
|
6376
6335
|
const name = `${session.target} \xB7 ${session.branch}`;
|
|
6377
6336
|
const snooze = readSnooze(id);
|
|
6378
6337
|
const route = snooze?.until && snoozeActive(snooze, { attention: status }) ? "none" : presence.route(id);
|
|
@@ -6694,16 +6653,16 @@ function createPrWatch(deps) {
|
|
|
6694
6653
|
const me = ci.repos.find((r) => r.name === f.repo)?.viewer ?? ci.viewer;
|
|
6695
6654
|
return !!me && me.toLowerCase() === author.toLowerCase();
|
|
6696
6655
|
}
|
|
6697
|
-
function check(id, session, act = true,
|
|
6656
|
+
function check(id, session, act = true, run) {
|
|
6698
6657
|
const running2 = inflight.get(id);
|
|
6699
6658
|
if (running2) return running2;
|
|
6700
|
-
const p = checkNow(id, session, act,
|
|
6659
|
+
const p = checkNow(id, session, act, run).finally(() => inflight.delete(id));
|
|
6701
6660
|
inflight.set(id, p);
|
|
6702
6661
|
return p;
|
|
6703
6662
|
}
|
|
6704
|
-
async function checkNow(id, session, act = true,
|
|
6663
|
+
async function checkNow(id, session, act = true, run) {
|
|
6705
6664
|
const name = `${session.target} ${session.branch}`;
|
|
6706
|
-
const note = (text, level = "info") =>
|
|
6665
|
+
const note = (text, level = "info") => run?.note(`${name}: ${text}`, { level, sessionId: id });
|
|
6707
6666
|
let pre;
|
|
6708
6667
|
try {
|
|
6709
6668
|
pre = await deps.preflight(session, { resting });
|
|
@@ -6971,20 +6930,20 @@ function createPrWatch(deps) {
|
|
|
6971
6930
|
if (!restingNames()) schedule?.resume();
|
|
6972
6931
|
const queue = due;
|
|
6973
6932
|
const ids = queue.map((q) => q.id);
|
|
6974
|
-
const
|
|
6933
|
+
const run = deps.activity?.start("pr-watch", "Checking pull requests");
|
|
6975
6934
|
let done = 0;
|
|
6976
|
-
|
|
6935
|
+
run?.progress(0, ids.length);
|
|
6977
6936
|
const worker = async () => {
|
|
6978
6937
|
for (let next = queue.shift(); next; next = queue.shift()) {
|
|
6979
|
-
await check(next.id, next.session, !deps.lookOnly,
|
|
6980
|
-
|
|
6938
|
+
await check(next.id, next.session, !deps.lookOnly, run);
|
|
6939
|
+
run?.progress(++done, ids.length);
|
|
6981
6940
|
}
|
|
6982
6941
|
};
|
|
6983
6942
|
try {
|
|
6984
6943
|
await Promise.all(Array.from({ length: CONCURRENCY }, worker));
|
|
6985
|
-
|
|
6944
|
+
run?.done(sweepSummary(ids));
|
|
6986
6945
|
} catch (err) {
|
|
6987
|
-
|
|
6946
|
+
run?.fail(err.message);
|
|
6988
6947
|
throw err;
|
|
6989
6948
|
}
|
|
6990
6949
|
})().finally(() => {
|
|
@@ -7045,7 +7004,7 @@ function repoServer(repoPath) {
|
|
|
7045
7004
|
const { origin } = hostForRepo(repoPath);
|
|
7046
7005
|
return origin ? originHostname(origin) : null;
|
|
7047
7006
|
}
|
|
7048
|
-
function viewerLogin(
|
|
7007
|
+
function viewerLogin(run, lookup = hostOf, serverOf = repoServer) {
|
|
7049
7008
|
const known = /* @__PURE__ */ new Map();
|
|
7050
7009
|
return async (hostId, repoPath) => {
|
|
7051
7010
|
const host = lookup(hostId);
|
|
@@ -7053,21 +7012,21 @@ function viewerLogin(run2, lookup = hostOf, serverOf = repoServer) {
|
|
|
7053
7012
|
${repoPath ? serverOf(repoPath) ?? "" : ""}`;
|
|
7054
7013
|
const was = known.get(key);
|
|
7055
7014
|
if (was) return was;
|
|
7056
|
-
const login = await host.viewer(
|
|
7015
|
+
const login = await host.viewer(run, repoPath ?? process.cwd()).catch(() => null);
|
|
7057
7016
|
if (login) known.set(key, login);
|
|
7058
7017
|
return login || null;
|
|
7059
7018
|
};
|
|
7060
7019
|
}
|
|
7061
|
-
async function fetchReviewFeedback(repoPath, prNumber,
|
|
7062
|
-
return hostForRepo(repoPath).host.reviewFeedback(
|
|
7020
|
+
async function fetchReviewFeedback(repoPath, prNumber, run) {
|
|
7021
|
+
return hostForRepo(repoPath).host.reviewFeedback(run, repoPath, prNumber);
|
|
7063
7022
|
}
|
|
7064
7023
|
function hostRateLimited(hostId, text) {
|
|
7065
7024
|
return hostOf(hostId).rateLimited(text);
|
|
7066
7025
|
}
|
|
7067
|
-
function prWatchHostDeps(
|
|
7026
|
+
function prWatchHostDeps(run) {
|
|
7068
7027
|
return {
|
|
7069
|
-
viewer: viewerLogin(
|
|
7070
|
-
reviewFeedback: (repoPath, n) => fetchReviewFeedback(repoPath, n,
|
|
7028
|
+
viewer: viewerLogin(run),
|
|
7029
|
+
reviewFeedback: (repoPath, n) => fetchReviewFeedback(repoPath, n, run),
|
|
7071
7030
|
rateLimited: hostRateLimited
|
|
7072
7031
|
};
|
|
7073
7032
|
}
|
|
@@ -7143,7 +7102,7 @@ function branchFactsOf(pre) {
|
|
|
7143
7102
|
}))
|
|
7144
7103
|
);
|
|
7145
7104
|
}
|
|
7146
|
-
function listedPrsIo(
|
|
7105
|
+
function listedPrsIo(run, opts = {}) {
|
|
7147
7106
|
return {
|
|
7148
7107
|
repoIdOf: (repoPath) => {
|
|
7149
7108
|
const { host, origin } = hostForRepo(repoPath);
|
|
@@ -7153,19 +7112,19 @@ function listedPrsIo(run2, opts = {}) {
|
|
|
7153
7112
|
const h = hostOfPrUrl(url)?.host;
|
|
7154
7113
|
return h ? h.id === DEFAULT_HOST ? void 0 : h.id : null;
|
|
7155
7114
|
},
|
|
7156
|
-
lookup: (cwd, host, ref) => hostOf(host).prForRef(
|
|
7115
|
+
lookup: (cwd, host, ref) => hostOf(host).prForRef(run, cwd ?? os3.tmpdir(), ref),
|
|
7157
7116
|
...opts
|
|
7158
7117
|
};
|
|
7159
7118
|
}
|
|
7160
|
-
async function shipPreflightWithListed(session,
|
|
7161
|
-
const pre = await (io.preflight ?? shipPreflight)(session,
|
|
7162
|
-
return (await withListedPrs(pre, readSessionPrs(sessionIdFor(session)), io.listed ?? listedPrsIo(
|
|
7119
|
+
async function shipPreflightWithListed(session, run, io = {}) {
|
|
7120
|
+
const pre = await (io.preflight ?? shipPreflight)(session, run);
|
|
7121
|
+
return (await withListedPrs(pre, readSessionPrs(sessionIdFor(session)), io.listed ?? listedPrsIo(run))).pre;
|
|
7163
7122
|
}
|
|
7164
|
-
async function watchPreflight(session,
|
|
7123
|
+
async function watchPreflight(session, run, opts = {}, io = {}) {
|
|
7165
7124
|
const id = sessionIdFor(session);
|
|
7166
7125
|
const last = opts.last ?? null;
|
|
7167
7126
|
const repoOf = (name) => last?.repos.find((x) => x.name === name);
|
|
7168
|
-
const pre = await (io.preflight ?? shipPreflight)(session,
|
|
7127
|
+
const pre = await (io.preflight ?? shipPreflight)(session, run, {
|
|
7169
7128
|
askGh: watchAskGh(opts.resting, (name) => !!repoOf(name)?.pr),
|
|
7170
7129
|
...watchBranchOptions(
|
|
7171
7130
|
readSessionBranches(id),
|
|
@@ -7177,7 +7136,7 @@ async function watchPreflight(session, run2, opts = {}, io = {}) {
|
|
|
7177
7136
|
const facts = branchFactsOf(pre);
|
|
7178
7137
|
if (facts.length) bestEffort(`keep the branch facts of ${id}`, () => noteBranchFacts(id, facts));
|
|
7179
7138
|
const previous = (url) => last ? prsOfCheck(last).find((p) => p.pr.url.toLowerCase() === url.toLowerCase())?.pr : void 0;
|
|
7180
|
-
const listed = io.listed ?? listedPrsIo(
|
|
7139
|
+
const listed = io.listed ?? listedPrsIo(run, { ...opts.resting ? { resting: opts.resting } : {}, previous });
|
|
7181
7140
|
const found2 = await withListedPrs(pre, readSessionPrs(id), listed);
|
|
7182
7141
|
const aliases = new Map(sessionRepos(session, loadConfig()).map((r) => [r.path, r.alias]));
|
|
7183
7142
|
const keys = new Map(pre.repos.map((r) => [r.name, [aliases.get(r.path), listed.repoIdOf(r.path)]]));
|
|
@@ -7289,7 +7248,7 @@ function mountShipRoutes(app, opts) {
|
|
|
7289
7248
|
selection,
|
|
7290
7249
|
body.method ?? "squash",
|
|
7291
7250
|
opts.run,
|
|
7292
|
-
(s,
|
|
7251
|
+
(s, run) => shipPreflightWithListed(s, run)
|
|
7293
7252
|
);
|
|
7294
7253
|
opts.onRepoChanged?.(id);
|
|
7295
7254
|
let archived = false;
|
|
@@ -7388,6 +7347,12 @@ function mountRailRoutes(app, opts) {
|
|
|
7388
7347
|
changed();
|
|
7389
7348
|
return c.json(r.layout);
|
|
7390
7349
|
});
|
|
7350
|
+
app.put("/api/rail/view", async (c) => {
|
|
7351
|
+
const body = await c.req.json().catch(() => null);
|
|
7352
|
+
const view = asRailView(body?.view);
|
|
7353
|
+
if (!view) return c.json({ error: "expected {view: mine|state|project}" }, 400);
|
|
7354
|
+
return c.json(saveRailView(view));
|
|
7355
|
+
});
|
|
7391
7356
|
app.put("/api/sessions/:id/rail", async (c) => {
|
|
7392
7357
|
const id = c.req.param("id");
|
|
7393
7358
|
if (!findSession2(id)) return c.json({ error: "unknown session" }, 404);
|
|
@@ -7402,8 +7367,8 @@ function mountRailRoutes(app, opts) {
|
|
|
7402
7367
|
|
|
7403
7368
|
// src/core/worktree/shared-folders.ts
|
|
7404
7369
|
import fs12 from "fs";
|
|
7405
|
-
import
|
|
7406
|
-
var norm3 = (p) =>
|
|
7370
|
+
import path15 from "path";
|
|
7371
|
+
var norm3 = (p) => path15.resolve(p).replace(/\\/g, "/").toLowerCase();
|
|
7407
7372
|
function shadowedSessions(sessions, branchCheckedOut2) {
|
|
7408
7373
|
const byFolder = /* @__PURE__ */ new Map();
|
|
7409
7374
|
for (const s of sessions) {
|
|
@@ -7422,14 +7387,14 @@ function shadowedSessions(sessions, branchCheckedOut2) {
|
|
|
7422
7387
|
}
|
|
7423
7388
|
function branchCheckedOut(dir) {
|
|
7424
7389
|
try {
|
|
7425
|
-
const dotGit =
|
|
7390
|
+
const dotGit = path15.join(dir, ".git");
|
|
7426
7391
|
let gitDir = dotGit;
|
|
7427
7392
|
if (fs12.statSync(dotGit).isFile()) {
|
|
7428
7393
|
const m = /^gitdir:\s*(.+)$/m.exec(fs12.readFileSync(dotGit, "utf8"));
|
|
7429
7394
|
if (!m) return null;
|
|
7430
|
-
gitDir =
|
|
7395
|
+
gitDir = path15.resolve(dir, m[1].trim());
|
|
7431
7396
|
}
|
|
7432
|
-
const head = fs12.readFileSync(
|
|
7397
|
+
const head = fs12.readFileSync(path15.join(gitDir, "HEAD"), "utf8");
|
|
7433
7398
|
const ref = /^ref:\s*refs\/heads\/(.+)$/m.exec(head);
|
|
7434
7399
|
return ref ? ref[1].trim() : null;
|
|
7435
7400
|
} catch {
|
|
@@ -7523,13 +7488,13 @@ function mountCleanupRoutes(app, opts) {
|
|
|
7523
7488
|
app.post("/api/cleanup/branches/scan", (c) => {
|
|
7524
7489
|
if (!branches.scanning) {
|
|
7525
7490
|
branches = { ...branches, scanning: true };
|
|
7526
|
-
const
|
|
7491
|
+
const run = opts.activity?.start("branches", "Looking for merged local branches");
|
|
7527
7492
|
void findMergedBranches(branchDeps).then((candidates2) => {
|
|
7528
7493
|
branches = { scanning: false, scannedAt: (/* @__PURE__ */ new Date()).toISOString(), candidates: candidates2 };
|
|
7529
|
-
|
|
7494
|
+
run?.done(`${candidates2.length} merged local branch${candidates2.length === 1 ? "" : "es"}`);
|
|
7530
7495
|
}).catch((err) => {
|
|
7531
7496
|
branches = { ...branches, scanning: false };
|
|
7532
|
-
|
|
7497
|
+
run?.fail(err.message);
|
|
7533
7498
|
});
|
|
7534
7499
|
}
|
|
7535
7500
|
return c.json(branches);
|
|
@@ -7540,10 +7505,10 @@ function mountCleanupRoutes(app, opts) {
|
|
|
7540
7505
|
(i) => !!i && typeof i.repo === "string" && typeof i.branch === "string"
|
|
7541
7506
|
).map((i) => ({ repo: i.repo, branch: i.branch, ...typeof i.tip === "string" ? { tip: i.tip } : {} })) : [];
|
|
7542
7507
|
if (items.length === 0) return c.json({ error: "items: [{repo, branch, tip?}]" }, 400);
|
|
7543
|
-
const
|
|
7508
|
+
const run = opts.activity?.start("branches", "Deleting merged local branches");
|
|
7544
7509
|
const results = await deleteMergedBranches(items, branchDeps);
|
|
7545
|
-
for (const r of results)
|
|
7546
|
-
|
|
7510
|
+
for (const r of results) run?.note(`${r.repo} ${r.branch}: ${r.message}`, { level: r.ok ? "action" : "warn" });
|
|
7511
|
+
run?.done(`${results.filter((r) => r.ok).length} of ${results.length} deleted`);
|
|
7547
7512
|
const gone = new Set(results.filter((r) => r.ok).map((r) => `${r.repo}\0${r.branch}`));
|
|
7548
7513
|
branches = { ...branches, candidates: branches.candidates.filter((b) => !gone.has(`${b.repo}\0${b.branch}`)) };
|
|
7549
7514
|
return c.json({ results, state: branches });
|
|
@@ -7593,14 +7558,14 @@ function createActivityLog(opts = {}) {
|
|
|
7593
7558
|
let recent = [];
|
|
7594
7559
|
const lastOk = /* @__PURE__ */ new Map();
|
|
7595
7560
|
const schedules = /* @__PURE__ */ new Map();
|
|
7596
|
-
const finish = (
|
|
7597
|
-
running.delete(
|
|
7598
|
-
recent = [
|
|
7561
|
+
const finish = (run) => {
|
|
7562
|
+
running.delete(run.id);
|
|
7563
|
+
recent = [run, ...recent].slice(0, keep);
|
|
7599
7564
|
changed();
|
|
7600
7565
|
};
|
|
7601
7566
|
return {
|
|
7602
7567
|
start(kind, label) {
|
|
7603
|
-
const
|
|
7568
|
+
const run = {
|
|
7604
7569
|
id: nextId++,
|
|
7605
7570
|
kind,
|
|
7606
7571
|
label,
|
|
@@ -7611,31 +7576,31 @@ function createActivityLog(opts = {}) {
|
|
|
7611
7576
|
summary: null,
|
|
7612
7577
|
notes: []
|
|
7613
7578
|
};
|
|
7614
|
-
running.set(
|
|
7579
|
+
running.set(run.id, run);
|
|
7615
7580
|
changed();
|
|
7616
|
-
const open = () =>
|
|
7581
|
+
const open = () => run.status === "running";
|
|
7617
7582
|
return {
|
|
7618
7583
|
progress(done, total) {
|
|
7619
7584
|
if (!open()) return;
|
|
7620
|
-
|
|
7585
|
+
run.progress = { done, total };
|
|
7621
7586
|
changed();
|
|
7622
7587
|
},
|
|
7623
7588
|
note(text, o = {}) {
|
|
7624
7589
|
if (!open()) return;
|
|
7625
7590
|
const n = { at: iso(), text, level: o.level ?? "info", ...o.sessionId ? { sessionId: o.sessionId } : {} };
|
|
7626
|
-
|
|
7591
|
+
run.notes = [...run.notes, n].slice(-KEEP_NOTES);
|
|
7627
7592
|
changed();
|
|
7628
7593
|
},
|
|
7629
7594
|
done(summary) {
|
|
7630
7595
|
if (!open()) return;
|
|
7631
|
-
Object.assign(
|
|
7632
|
-
lastOk.set(
|
|
7633
|
-
finish(
|
|
7596
|
+
Object.assign(run, { status: "done", endedAt: iso(), summary });
|
|
7597
|
+
lastOk.set(run.kind, run.endedAt);
|
|
7598
|
+
finish(run);
|
|
7634
7599
|
},
|
|
7635
7600
|
fail(error) {
|
|
7636
7601
|
if (!open()) return;
|
|
7637
|
-
Object.assign(
|
|
7638
|
-
finish(
|
|
7602
|
+
Object.assign(run, { status: "failed", endedAt: iso(), summary: error });
|
|
7603
|
+
finish(run);
|
|
7639
7604
|
}
|
|
7640
7605
|
};
|
|
7641
7606
|
},
|
|
@@ -7691,7 +7656,7 @@ function threadsWithoutDraft(open, replies) {
|
|
|
7691
7656
|
return open.filter((t) => !drafted.has(t.threadId));
|
|
7692
7657
|
}
|
|
7693
7658
|
function mountPrReplyRoutes(app, opts) {
|
|
7694
|
-
const
|
|
7659
|
+
const run = opts.run ?? defaultRunner;
|
|
7695
7660
|
const changed = (sessionId) => {
|
|
7696
7661
|
if (opts.watch) markPostedAnswered(sessionId, opts.watch);
|
|
7697
7662
|
opts.broadcast("replies-changed", { sessionId });
|
|
@@ -7713,7 +7678,7 @@ function mountPrReplyRoutes(app, opts) {
|
|
|
7713
7678
|
if (typeof b.body !== "string") return c.json({ error: "body: string" }, 400);
|
|
7714
7679
|
const r = await draftReply(id, c.req.param("thread"), b.body, {
|
|
7715
7680
|
repos: () => sessionRepoRefs(session),
|
|
7716
|
-
run
|
|
7681
|
+
run
|
|
7717
7682
|
});
|
|
7718
7683
|
if (!r.ok) return c.json({ error: r.error }, 400);
|
|
7719
7684
|
changed(id);
|
|
@@ -7736,7 +7701,7 @@ function mountPrReplyRoutes(app, opts) {
|
|
|
7736
7701
|
return c.json({ error: "body: the reply text" }, 400);
|
|
7737
7702
|
const thread = c.req.param("thread");
|
|
7738
7703
|
const cwd = replyFolder(session, listReplies(id).find((r2) => r2.threadId === thread)?.repo);
|
|
7739
|
-
const r = await postReply(id, thread, b.body, { resolve: b.resolve === true, cwd, run
|
|
7704
|
+
const r = await postReply(id, thread, b.body, { resolve: b.resolve === true, cwd, run });
|
|
7740
7705
|
if (!r.ok) return c.json({ error: r.error }, 502);
|
|
7741
7706
|
const act = opts.activity?.start("pr-watch", "Posting a review reply");
|
|
7742
7707
|
act?.note(`${session.target} ${session.branch}: posted your reply${r.resolved ? " and resolved the thread" : ""}`, {
|
|
@@ -7757,7 +7722,7 @@ function mountPrReplyRoutes(app, opts) {
|
|
|
7757
7722
|
|
|
7758
7723
|
// src/core/archive/archive-retention.ts
|
|
7759
7724
|
import fs14 from "fs";
|
|
7760
|
-
import
|
|
7725
|
+
import path16 from "path";
|
|
7761
7726
|
import zlib from "zlib";
|
|
7762
7727
|
var DEFAULT_COMPRESS_AFTER_DAYS = 30;
|
|
7763
7728
|
var DAY_MS = 24 * 36e5;
|
|
@@ -7778,14 +7743,14 @@ function applyArchiveRetention(opts) {
|
|
|
7778
7743
|
if (!rec) continue;
|
|
7779
7744
|
const age = now - Date.parse(rec.archivedAt);
|
|
7780
7745
|
if (!Number.isFinite(age)) continue;
|
|
7781
|
-
const ignored =
|
|
7746
|
+
const ignored = path16.join(archiveDirFor(id, root), "ignored");
|
|
7782
7747
|
if (compressAfter > 0 && age >= compressAfter * DAY_MS && !rec.ignoredDroppedAt && fs14.existsSync(ignored)) {
|
|
7783
7748
|
fs14.rmSync(ignored, { recursive: true, force: true });
|
|
7784
7749
|
rec.ignoredDroppedAt = new Date(now).toISOString();
|
|
7785
7750
|
writeArchiveRecord(rec, root);
|
|
7786
7751
|
}
|
|
7787
7752
|
if (rec.transcriptsDroppedAt) continue;
|
|
7788
|
-
const dir =
|
|
7753
|
+
const dir = path16.join(archiveDirFor(id, root), "transcripts");
|
|
7789
7754
|
if (dropAfter > 0 && age >= dropAfter * DAY_MS) {
|
|
7790
7755
|
out.bytesSaved += dirBytes(dir);
|
|
7791
7756
|
fs14.rmSync(dir, { recursive: true, force: true });
|
|
@@ -7796,7 +7761,7 @@ function applyArchiveRetention(opts) {
|
|
|
7796
7761
|
}
|
|
7797
7762
|
if (compressAfter <= 0 || rec.compressedAt || age < compressAfter * DAY_MS) continue;
|
|
7798
7763
|
for (const t of rec.transcripts) {
|
|
7799
|
-
const plain =
|
|
7764
|
+
const plain = path16.join(dir, t.file);
|
|
7800
7765
|
if (!fs14.existsSync(plain)) continue;
|
|
7801
7766
|
const data = fs14.readFileSync(plain);
|
|
7802
7767
|
const gz = zlib.gzipSync(data);
|
|
@@ -7817,7 +7782,7 @@ function applyArchiveRetention(opts) {
|
|
|
7817
7782
|
function dirBytes(dir) {
|
|
7818
7783
|
let n = 0;
|
|
7819
7784
|
try {
|
|
7820
|
-
for (const f of fs14.readdirSync(dir)) n += fs14.statSync(
|
|
7785
|
+
for (const f of fs14.readdirSync(dir)) n += fs14.statSync(path16.join(dir, f)).size;
|
|
7821
7786
|
} catch {
|
|
7822
7787
|
}
|
|
7823
7788
|
return n;
|
|
@@ -7841,7 +7806,7 @@ function createTimeKeeper(deps, opts) {
|
|
|
7841
7806
|
if (d === today) return true;
|
|
7842
7807
|
return needsBuild(d, builtAt.get(d));
|
|
7843
7808
|
});
|
|
7844
|
-
const
|
|
7809
|
+
const run2 = opts.activity?.start("time", days.length === 1 ? "Updating today" : `Building ${days.length} days`);
|
|
7845
7810
|
const failed = [];
|
|
7846
7811
|
let built = 0;
|
|
7847
7812
|
for (const d of days) {
|
|
@@ -7853,11 +7818,11 @@ function createTimeKeeper(deps, opts) {
|
|
|
7853
7818
|
}
|
|
7854
7819
|
}
|
|
7855
7820
|
if (built) opts.changed();
|
|
7856
|
-
if (failed.length)
|
|
7857
|
-
else
|
|
7821
|
+
if (failed.length) run2?.fail(`${failed.length} of ${days.length} not built \u2014 ${failed.join("; ")}`);
|
|
7822
|
+
else run2?.done(days.length === 1 ? "today updated" : `${days.length} days built`);
|
|
7858
7823
|
}
|
|
7859
7824
|
let again = null;
|
|
7860
|
-
const
|
|
7825
|
+
const run = (what = "all") => {
|
|
7861
7826
|
if (busy) {
|
|
7862
7827
|
again = again === "all" || what === "all" ? "all" : "local";
|
|
7863
7828
|
return busy;
|
|
@@ -7879,12 +7844,12 @@ function createTimeKeeper(deps, opts) {
|
|
|
7879
7844
|
return busy;
|
|
7880
7845
|
};
|
|
7881
7846
|
return {
|
|
7882
|
-
run
|
|
7847
|
+
run,
|
|
7883
7848
|
soon: () => {
|
|
7884
7849
|
if (timer) return;
|
|
7885
7850
|
timer = setTimeout(() => {
|
|
7886
7851
|
timer = null;
|
|
7887
|
-
void
|
|
7852
|
+
void run("local");
|
|
7888
7853
|
}, AFTER_TURN_MS);
|
|
7889
7854
|
timer.unref?.();
|
|
7890
7855
|
},
|
|
@@ -8123,14 +8088,14 @@ function settleLeftOverClaims(deps) {
|
|
|
8123
8088
|
function tidyLeftOverSubmits(deps, activity, changed) {
|
|
8124
8089
|
const done = settleLeftOverClaims(deps);
|
|
8125
8090
|
if (!done.length) return;
|
|
8126
|
-
const
|
|
8091
|
+
const run = activity?.start("reviews", "Submits left mid-way");
|
|
8127
8092
|
for (const r of done) {
|
|
8128
|
-
|
|
8093
|
+
run?.note(`${r.repo} #${r.number}: work stopped while submitting your review \u2014 look at the PR and say whether it went`, {
|
|
8129
8094
|
level: "warn"
|
|
8130
8095
|
});
|
|
8131
8096
|
changed(r);
|
|
8132
8097
|
}
|
|
8133
|
-
|
|
8098
|
+
run?.done(`${done.length} submit${done.length === 1 ? "" : "s"} in doubt`);
|
|
8134
8099
|
}
|
|
8135
8100
|
|
|
8136
8101
|
// src/core/review/review-fix.ts
|
|
@@ -8209,10 +8174,10 @@ async function fixItMyself(deps, repo, number, input) {
|
|
|
8209
8174
|
const no = claimRefused;
|
|
8210
8175
|
if (no) return { ok: false, ...no };
|
|
8211
8176
|
const release = () => deps.update(repo, number, (cur) => cur.fixing?.at === claimAt ? withoutFixClaim(cur) : cur);
|
|
8212
|
-
const
|
|
8177
|
+
const run = deps.activity?.start("reviews", `Fix it myself: ${repo} #${number}`);
|
|
8213
8178
|
const fail = (status, error, sessionId) => {
|
|
8214
8179
|
release();
|
|
8215
|
-
|
|
8180
|
+
run?.fail(error);
|
|
8216
8181
|
return { ok: false, status, error, ...sessionId ? { sessionId } : {} };
|
|
8217
8182
|
};
|
|
8218
8183
|
try {
|
|
@@ -8273,13 +8238,13 @@ async function fixItMyself(deps, repo, number, input) {
|
|
|
8273
8238
|
`${plural(left.length, "comment")} stayed on the review (posted, or a submit took ${left.length === 1 ? "it" : "them"} meanwhile): the session has ${left.length === 1 ? "it" : "them"} too`
|
|
8274
8239
|
);
|
|
8275
8240
|
const said = `${plural(moved, "comment")} on #${number} being fixed in ${label}${created ? " (new session)" : ""}`;
|
|
8276
|
-
|
|
8277
|
-
for (const w of warnings)
|
|
8278
|
-
|
|
8241
|
+
run?.note(said, { level: "action", sessionId });
|
|
8242
|
+
for (const w of warnings) run?.note(`${label}: ${w}`, { level: "warn", sessionId });
|
|
8243
|
+
run?.done(said);
|
|
8279
8244
|
return { ok: true, sessionId, created, review: next ?? claimed, ...warnings.length ? { warnings } : {} };
|
|
8280
8245
|
} catch (err) {
|
|
8281
8246
|
release();
|
|
8282
|
-
|
|
8247
|
+
run?.fail(err.message);
|
|
8283
8248
|
throw err;
|
|
8284
8249
|
}
|
|
8285
8250
|
}
|
|
@@ -8295,7 +8260,7 @@ function reviewModeOf(alias, config) {
|
|
|
8295
8260
|
return { mode: "all", from: "default" };
|
|
8296
8261
|
}
|
|
8297
8262
|
function reviewProjects(config) {
|
|
8298
|
-
return Object.entries(config.repos).map(([alias,
|
|
8263
|
+
return Object.entries(config.repos).map(([alias, path25]) => ({ alias, path: path25, mode: reviewModeOf(alias, config).mode }));
|
|
8299
8264
|
}
|
|
8300
8265
|
function reviewLimits(config) {
|
|
8301
8266
|
return {
|
|
@@ -8306,7 +8271,7 @@ function reviewLimits(config) {
|
|
|
8306
8271
|
var isReviewMode = (v) => v === "all" || v === "asked" || v === "off";
|
|
8307
8272
|
|
|
8308
8273
|
// src/server/routes/review-routes.ts
|
|
8309
|
-
var
|
|
8274
|
+
var num2 = (s) => /^\d+$/.test(s) ? Number(s) : null;
|
|
8310
8275
|
function mountReviewRoutes(app, deps) {
|
|
8311
8276
|
const changed = (repo, number) => deps.broadcast("reviews-changed", { repo, number });
|
|
8312
8277
|
app.get("/api/reviews", (c) => {
|
|
@@ -8327,13 +8292,13 @@ function mountReviewRoutes(app, deps) {
|
|
|
8327
8292
|
return c.json(deps.settings());
|
|
8328
8293
|
});
|
|
8329
8294
|
app.get("/api/reviews/:repo/:number", (c) => {
|
|
8330
|
-
const n =
|
|
8295
|
+
const n = num2(c.req.param("number"));
|
|
8331
8296
|
const r = n === null ? null : deps.read(c.req.param("repo"), n);
|
|
8332
8297
|
return r ? c.json(shownReview(deps, r)) : c.json({ error: "no review of that PR" }, 404);
|
|
8333
8298
|
});
|
|
8334
8299
|
app.get("/api/reviews/:repo/:number/diff", async (c) => {
|
|
8335
8300
|
const repo = c.req.param("repo");
|
|
8336
|
-
const n =
|
|
8301
|
+
const n = num2(c.req.param("number"));
|
|
8337
8302
|
const r = n === null ? null : deps.read(repo, n);
|
|
8338
8303
|
const at = deps.repoPath(repo);
|
|
8339
8304
|
if (!r || n === null || !r.mergeBase || !at) return c.json({ error: "no prepared review of that PR" }, 404);
|
|
@@ -8342,7 +8307,7 @@ function mountReviewRoutes(app, deps) {
|
|
|
8342
8307
|
});
|
|
8343
8308
|
app.post("/api/reviews/:repo/:number", async (c) => {
|
|
8344
8309
|
const repo = c.req.param("repo");
|
|
8345
|
-
const n =
|
|
8310
|
+
const n = num2(c.req.param("number"));
|
|
8346
8311
|
if (n === null) return c.json({ error: "not a PR number" }, 400);
|
|
8347
8312
|
const body = await c.req.json().catch(() => ({}));
|
|
8348
8313
|
if (body.also !== void 0 && typeof body.also !== "string") return c.json({ error: "also: string" }, 400);
|
|
@@ -8354,7 +8319,7 @@ function mountReviewRoutes(app, deps) {
|
|
|
8354
8319
|
});
|
|
8355
8320
|
app.post("/api/reviews/:repo/:number/discussion", async (c) => {
|
|
8356
8321
|
const repo = c.req.param("repo");
|
|
8357
|
-
const n =
|
|
8322
|
+
const n = num2(c.req.param("number"));
|
|
8358
8323
|
if (n === null || !deps.read(repo, n)) return c.json({ error: "no review of that PR" }, 404);
|
|
8359
8324
|
const was = deps.read(repo, n)?.discussion?.at;
|
|
8360
8325
|
const r = await deps.refreshDiscussion(repo, n);
|
|
@@ -8364,7 +8329,7 @@ function mountReviewRoutes(app, deps) {
|
|
|
8364
8329
|
});
|
|
8365
8330
|
app.post("/api/reviews/:repo/:number/drafts", async (c) => {
|
|
8366
8331
|
const repo = c.req.param("repo");
|
|
8367
|
-
const n =
|
|
8332
|
+
const n = num2(c.req.param("number"));
|
|
8368
8333
|
if (n === null || !deps.read(repo, n)) return c.json({ error: "no review of that PR" }, 404);
|
|
8369
8334
|
const body = await c.req.json().catch(() => null);
|
|
8370
8335
|
let error = null;
|
|
@@ -8382,7 +8347,7 @@ function mountReviewRoutes(app, deps) {
|
|
|
8382
8347
|
});
|
|
8383
8348
|
app.post("/api/reviews/:repo/:number/submit", async (c) => {
|
|
8384
8349
|
const repo = c.req.param("repo");
|
|
8385
|
-
const n =
|
|
8350
|
+
const n = num2(c.req.param("number"));
|
|
8386
8351
|
if (n === null) return c.json({ error: "no review of that PR" }, 404);
|
|
8387
8352
|
const input = await c.req.json().catch(() => null);
|
|
8388
8353
|
const out = await submitPrReview(deps, repo, n, input);
|
|
@@ -8392,7 +8357,7 @@ function mountReviewRoutes(app, deps) {
|
|
|
8392
8357
|
});
|
|
8393
8358
|
app.post("/api/reviews/:repo/:number/fix-myself", async (c) => {
|
|
8394
8359
|
const repo = c.req.param("repo");
|
|
8395
|
-
const n =
|
|
8360
|
+
const n = num2(c.req.param("number"));
|
|
8396
8361
|
if (n === null || !deps.read(repo, n)) return c.json({ error: "no review of that PR" }, 404);
|
|
8397
8362
|
if (!deps.fixMyself) return c.json({ error: "not available on this server" }, 501);
|
|
8398
8363
|
const input = await c.req.json().catch(() => null);
|
|
@@ -8405,7 +8370,7 @@ function mountReviewRoutes(app, deps) {
|
|
|
8405
8370
|
});
|
|
8406
8371
|
app.post("/api/reviews/:repo/:number/in-doubt", async (c) => {
|
|
8407
8372
|
const repo = c.req.param("repo");
|
|
8408
|
-
const n =
|
|
8373
|
+
const n = num2(c.req.param("number"));
|
|
8409
8374
|
if (n === null || !deps.read(repo, n)) return c.json({ error: "no review of that PR" }, 404);
|
|
8410
8375
|
const body = await c.req.json().catch(() => null);
|
|
8411
8376
|
if (!body || typeof body.went !== "boolean") return c.json({ error: "expected {went: true|false}" }, 400);
|
|
@@ -8416,7 +8381,7 @@ function mountReviewRoutes(app, deps) {
|
|
|
8416
8381
|
});
|
|
8417
8382
|
app.delete("/api/reviews/:repo/:number/dropped", (c) => {
|
|
8418
8383
|
const repo = c.req.param("repo");
|
|
8419
|
-
const n =
|
|
8384
|
+
const n = num2(c.req.param("number"));
|
|
8420
8385
|
const next = n === null ? null : deps.update(repo, n, clearDropped);
|
|
8421
8386
|
if (!next || n === null) return c.json({ error: "no review of that PR" }, 404);
|
|
8422
8387
|
changed(repo, n);
|
|
@@ -8424,7 +8389,7 @@ function mountReviewRoutes(app, deps) {
|
|
|
8424
8389
|
});
|
|
8425
8390
|
app.delete("/api/reviews/:repo/:number/drafts/:id", (c) => {
|
|
8426
8391
|
const repo = c.req.param("repo");
|
|
8427
|
-
const n =
|
|
8392
|
+
const n = num2(c.req.param("number"));
|
|
8428
8393
|
if (n === null || !deps.read(repo, n)) return c.json({ error: "no review of that PR" }, 404);
|
|
8429
8394
|
const id = c.req.param("id");
|
|
8430
8395
|
let refused = null;
|
|
@@ -8447,41 +8412,41 @@ function mountReviewRoutes(app, deps) {
|
|
|
8447
8412
|
// src/core/review/review-tree.ts
|
|
8448
8413
|
import { randomBytes } from "crypto";
|
|
8449
8414
|
import fs15 from "fs";
|
|
8450
|
-
import
|
|
8415
|
+
import path17 from "path";
|
|
8451
8416
|
|
|
8452
8417
|
// src/core/review/review-source.ts
|
|
8453
8418
|
var reviewRef = (number) => `refs/work/review/${number}`;
|
|
8454
8419
|
var ATTR_CHUNK = 200;
|
|
8455
|
-
var git2 = (
|
|
8456
|
-
async function preparePr(
|
|
8420
|
+
var git2 = (run, cwd, ...args) => run("git", args, cwd);
|
|
8421
|
+
async function preparePr(run, repoPath, host, pr) {
|
|
8457
8422
|
const ref = reviewRef(pr.number);
|
|
8458
|
-
const head = await git2(
|
|
8423
|
+
const head = await git2(run, repoPath, "fetch", "--quiet", "--no-tags", "origin", `+${host.prRef(pr.number)}:${ref}`);
|
|
8459
8424
|
if (head.code !== 0)
|
|
8460
8425
|
return { ok: false, error: `couldn't fetch the PR's code: ${head.stderr.trim().split("\n")[0] || "git fetch failed"}` };
|
|
8461
8426
|
if (host.prRefIsMerge) {
|
|
8462
|
-
const second = await git2(
|
|
8427
|
+
const second = await git2(run, repoPath, "rev-parse", "--verify", "--quiet", `${ref}^2`);
|
|
8463
8428
|
const tip = second.stdout.trim();
|
|
8464
8429
|
if (second.code !== 0 || !tip) return { ok: false, error: "the PR's merge ref has no second parent: can't tell its head" };
|
|
8465
|
-
const moved = await git2(
|
|
8430
|
+
const moved = await git2(run, repoPath, "update-ref", ref, tip);
|
|
8466
8431
|
if (moved.code !== 0) return { ok: false, error: `couldn't keep the PR's head: ${moved.stderr.trim().split(/\r?\n/)[0]}` };
|
|
8467
8432
|
}
|
|
8468
|
-
if (pr.base) await git2(
|
|
8469
|
-
const sha = (await git2(
|
|
8433
|
+
if (pr.base) await git2(run, repoPath, "fetch", "--quiet", "--no-tags", "origin", `+refs/heads/${pr.base}:refs/remotes/origin/${pr.base}`);
|
|
8434
|
+
const sha = (await git2(run, repoPath, "rev-parse", ref)).stdout.trim();
|
|
8470
8435
|
const baseRef = pr.base ? `refs/remotes/origin/${pr.base}` : "origin/HEAD";
|
|
8471
|
-
const mb = await git2(
|
|
8436
|
+
const mb = await git2(run, repoPath, "merge-base", baseRef, ref);
|
|
8472
8437
|
if (mb.code !== 0 || !mb.stdout.trim()) return { ok: false, error: `no common commit with ${pr.base || "the default branch"}` };
|
|
8473
8438
|
const mergeBase = mb.stdout.trim();
|
|
8474
|
-
const files = await reviewDiff(
|
|
8439
|
+
const files = await reviewDiff(run, repoPath, mergeBase, ref);
|
|
8475
8440
|
if (!files) return { ok: false, error: "git couldn't diff the PR" };
|
|
8476
|
-
return { ok: true, files, extras: await diffExtras(
|
|
8441
|
+
return { ok: true, files, extras: await diffExtras(run, repoPath, mergeBase, ref, files), mergeBase, headSha: sha };
|
|
8477
8442
|
}
|
|
8478
|
-
async function reviewDiff(
|
|
8479
|
-
const d = await git2(
|
|
8443
|
+
async function reviewDiff(run, repoPath, from, to) {
|
|
8444
|
+
const d = await git2(run, repoPath, "diff", "--no-color", "--no-ext-diff", "-M", from, to);
|
|
8480
8445
|
return d.code === 0 ? parseGitDiff(d.stdout) : null;
|
|
8481
8446
|
}
|
|
8482
|
-
async function diffExtras(
|
|
8447
|
+
async function diffExtras(run, repoPath, from, to, files) {
|
|
8483
8448
|
const changed = files.filter((f) => f.added + f.deleted > 0).map((f) => f.path);
|
|
8484
|
-
const w = await git2(
|
|
8449
|
+
const w = await git2(run, repoPath, "diff", "--no-color", "--no-ext-diff", "-M", "-w", "--name-only", from, to);
|
|
8485
8450
|
const real = new Set(
|
|
8486
8451
|
w.code === 0 ? w.stdout.split("\n").map((l) => l.trim()).filter(Boolean) : changed
|
|
8487
8452
|
);
|
|
@@ -8489,7 +8454,7 @@ async function diffExtras(run2, repoPath, from, to, files) {
|
|
|
8489
8454
|
const generated = /* @__PURE__ */ new Set();
|
|
8490
8455
|
const paths = files.map((f) => f.path);
|
|
8491
8456
|
for (let i = 0; i < paths.length; i += ATTR_CHUNK) {
|
|
8492
|
-
const attr = await git2(
|
|
8457
|
+
const attr = await git2(run, repoPath, "check-attr", `--source=${to}`, "linguist-generated", "--", ...paths.slice(i, i + ATTR_CHUNK));
|
|
8493
8458
|
if (attr.code !== 0) break;
|
|
8494
8459
|
for (const line of attr.stdout.split("\n")) {
|
|
8495
8460
|
const m = /^(.*): linguist-generated: (set|true)$/.exec(line.trim());
|
|
@@ -8498,18 +8463,18 @@ async function diffExtras(run2, repoPath, from, to, files) {
|
|
|
8498
8463
|
}
|
|
8499
8464
|
return { whitespaceOnly, generated };
|
|
8500
8465
|
}
|
|
8501
|
-
async function dropReviewRef(
|
|
8502
|
-
await git2(
|
|
8466
|
+
async function dropReviewRef(run, repoPath, number) {
|
|
8467
|
+
await git2(run, repoPath, "update-ref", "-d", reviewRef(number));
|
|
8503
8468
|
}
|
|
8504
8469
|
|
|
8505
8470
|
// src/core/review/review-tree.ts
|
|
8506
|
-
var reviewTreesDir = () =>
|
|
8471
|
+
var reviewTreesDir = () => path17.join(getConfigDir(), "review-trees");
|
|
8507
8472
|
var NO_HOOKS = ".no-hooks";
|
|
8508
8473
|
var NO_LFS = ["-c", "filter.lfs.smudge=", "-c", "filter.lfs.process=", "-c", "filter.lfs.required=false"];
|
|
8509
8474
|
var NO_LFS_ENV = { GIT_LFS_SKIP_SMUDGE: "1" };
|
|
8510
|
-
function reviewTreeName(alias, number, headSha,
|
|
8475
|
+
function reviewTreeName(alias, number, headSha, run) {
|
|
8511
8476
|
const safe = alias.replace(/[^A-Za-z0-9._-]/g, "_").replace(/^\.+/, "_") || "repo";
|
|
8512
|
-
const tag =
|
|
8477
|
+
const tag = run.replace(/[^A-Za-z0-9]/g, "");
|
|
8513
8478
|
return `${safe}-${number}-${headSha.slice(0, 8)}${tag ? `-${tag}` : ""}`;
|
|
8514
8479
|
}
|
|
8515
8480
|
var runSuffix = () => `${process.pid.toString(36)}${randomBytes(3).toString("hex")}`;
|
|
@@ -8521,13 +8486,13 @@ function rmTree(dir) {
|
|
|
8521
8486
|
}
|
|
8522
8487
|
return !fs15.existsSync(dir);
|
|
8523
8488
|
}
|
|
8524
|
-
async function createReviewTree(
|
|
8489
|
+
async function createReviewTree(run, at, opts) {
|
|
8525
8490
|
const root = opts.root ?? reviewTreesDir();
|
|
8526
|
-
const dir =
|
|
8527
|
-
const noHooks =
|
|
8491
|
+
const dir = path17.join(root, reviewTreeName(at.alias, at.number, at.headSha, opts.run ?? runSuffix()));
|
|
8492
|
+
const noHooks = path17.join(root, NO_HOOKS);
|
|
8528
8493
|
fs15.mkdirSync(noHooks, { recursive: true });
|
|
8529
|
-
if (fs15.existsSync(dir)) await removeReviewTree(
|
|
8530
|
-
const added = await
|
|
8494
|
+
if (fs15.existsSync(dir)) await removeReviewTree(run, at.repoPath, dir);
|
|
8495
|
+
const added = await run(
|
|
8531
8496
|
"git",
|
|
8532
8497
|
[
|
|
8533
8498
|
"-c",
|
|
@@ -8546,58 +8511,58 @@ async function createReviewTree(run2, at, opts) {
|
|
|
8546
8511
|
NO_LFS_ENV
|
|
8547
8512
|
);
|
|
8548
8513
|
if (added.code !== 0) {
|
|
8549
|
-
await removeReviewTree(
|
|
8514
|
+
await removeReviewTree(run, at.repoPath, dir);
|
|
8550
8515
|
return { ok: false, error: `couldn't check the PR out: ${firstLine(added.stderr) || "git worktree add failed"}` };
|
|
8551
8516
|
}
|
|
8552
|
-
const head = await
|
|
8517
|
+
const head = await run("git", ["rev-parse", "HEAD"], dir);
|
|
8553
8518
|
if (head.code !== 0 || head.stdout.trim() !== at.headSha) {
|
|
8554
|
-
await removeReviewTree(
|
|
8519
|
+
await removeReviewTree(run, at.repoPath, dir);
|
|
8555
8520
|
return { ok: false, error: "the checkout isn't at the reviewed commit (the PR moved meanwhile)" };
|
|
8556
8521
|
}
|
|
8557
|
-
const listed = await
|
|
8522
|
+
const listed = await run("git", ["ls-files", "-z"], dir);
|
|
8558
8523
|
if (listed.code !== 0) {
|
|
8559
|
-
await removeReviewTree(
|
|
8524
|
+
await removeReviewTree(run, at.repoPath, dir);
|
|
8560
8525
|
return { ok: false, error: "couldn't list the checkout's files to remove its settings" };
|
|
8561
8526
|
}
|
|
8562
8527
|
const removed = [];
|
|
8563
8528
|
for (const rel of listed.stdout.split("\0").filter((rel2) => opts.strip(rel2))) {
|
|
8564
|
-
const file =
|
|
8529
|
+
const file = path17.join(dir, rel);
|
|
8565
8530
|
fs15.rmSync(file, { recursive: true, force: true });
|
|
8566
8531
|
if (fs15.existsSync(file)) {
|
|
8567
|
-
await removeReviewTree(
|
|
8532
|
+
await removeReviewTree(run, at.repoPath, dir);
|
|
8568
8533
|
return { ok: false, error: `couldn't remove ${rel} from the checkout` };
|
|
8569
8534
|
}
|
|
8570
8535
|
removed.push(rel);
|
|
8571
8536
|
}
|
|
8572
8537
|
return { ok: true, dir, removed };
|
|
8573
8538
|
}
|
|
8574
|
-
async function removeReviewTree(
|
|
8575
|
-
if (fs15.existsSync(dir)) await
|
|
8539
|
+
async function removeReviewTree(run, repoPath, dir) {
|
|
8540
|
+
if (fs15.existsSync(dir)) await run("git", ["worktree", "remove", "--force", "--force", dir], repoPath);
|
|
8576
8541
|
const gone = rmTree(dir);
|
|
8577
|
-
await
|
|
8542
|
+
await run("git", ["worktree", "prune"], repoPath);
|
|
8578
8543
|
return gone;
|
|
8579
8544
|
}
|
|
8580
|
-
async function withReviewTree(
|
|
8581
|
-
const tree = await createReviewTree(
|
|
8545
|
+
async function withReviewTree(run, at, use, opts) {
|
|
8546
|
+
const tree = await createReviewTree(run, at, opts);
|
|
8582
8547
|
if (!tree.ok) return tree;
|
|
8583
8548
|
let value;
|
|
8584
8549
|
let gone;
|
|
8585
8550
|
try {
|
|
8586
8551
|
value = await use(tree.dir, tree.removed);
|
|
8587
8552
|
} finally {
|
|
8588
|
-
gone = await removeReviewTree(
|
|
8553
|
+
gone = await removeReviewTree(run, at.repoPath, tree.dir).catch(() => false);
|
|
8589
8554
|
}
|
|
8590
8555
|
return { ok: true, value, ...gone ? {} : { left: tree.dir } };
|
|
8591
8556
|
}
|
|
8592
8557
|
function gitDirOf(dir) {
|
|
8593
8558
|
try {
|
|
8594
|
-
const m = /^gitdir:\s*(.+)$/m.exec(fs15.readFileSync(
|
|
8595
|
-
return m ?
|
|
8559
|
+
const m = /^gitdir:\s*(.+)$/m.exec(fs15.readFileSync(path17.join(dir, ".git"), "utf8"));
|
|
8560
|
+
return m ? path17.resolve(dir, m[1].trim(), "..", "..") : null;
|
|
8596
8561
|
} catch {
|
|
8597
8562
|
return null;
|
|
8598
8563
|
}
|
|
8599
8564
|
}
|
|
8600
|
-
async function sweepReviewTrees(
|
|
8565
|
+
async function sweepReviewTrees(run, opts = {}) {
|
|
8601
8566
|
const root = opts.root ?? reviewTreesDir();
|
|
8602
8567
|
const now = opts.now?.() ?? Date.now();
|
|
8603
8568
|
const swept = [];
|
|
@@ -8609,14 +8574,14 @@ async function sweepReviewTrees(run2, opts = {}) {
|
|
|
8609
8574
|
return { swept, failed };
|
|
8610
8575
|
}
|
|
8611
8576
|
for (const name of names) {
|
|
8612
|
-
const dir =
|
|
8577
|
+
const dir = path17.join(root, name);
|
|
8613
8578
|
try {
|
|
8614
8579
|
if (opts.olderThanMs && now - fs15.statSync(dir).mtimeMs < opts.olderThanMs) continue;
|
|
8615
8580
|
} catch {
|
|
8616
8581
|
continue;
|
|
8617
8582
|
}
|
|
8618
8583
|
const gitDir = gitDirOf(dir);
|
|
8619
|
-
const gone = gitDir && fs15.existsSync(gitDir) ? await removeReviewTree(
|
|
8584
|
+
const gone = gitDir && fs15.existsSync(gitDir) ? await removeReviewTree(run, gitDir, dir) : rmTree(dir);
|
|
8620
8585
|
(gone ? swept : failed).push(name);
|
|
8621
8586
|
}
|
|
8622
8587
|
return { swept, failed };
|
|
@@ -8817,8 +8782,8 @@ function createReviewQueue(deps) {
|
|
|
8817
8782
|
}
|
|
8818
8783
|
}
|
|
8819
8784
|
async function sweepNow() {
|
|
8820
|
-
const
|
|
8821
|
-
const note = (text, level = "info") =>
|
|
8785
|
+
const run = deps.activity?.start("reviews", "Preparing PR reviews");
|
|
8786
|
+
const note = (text, level = "info") => run?.note(text, { level });
|
|
8822
8787
|
const { maxPerDay } = deps.limits();
|
|
8823
8788
|
const asked = [];
|
|
8824
8789
|
const open = /* @__PURE__ */ new Set();
|
|
@@ -8907,9 +8872,9 @@ function createReviewQueue(deps) {
|
|
|
8907
8872
|
note(`${talk.length - DISCUSSIONS_PER_SWEEP} more discussions to read again: the next sweep`);
|
|
8908
8873
|
if (read) note(`read the discussion of ${plural2(read, "PR")} again (moved on the host, or half an hour old)`);
|
|
8909
8874
|
deps.changed();
|
|
8910
|
-
|
|
8875
|
+
run?.done(todo.length ? `${plural2(todo.length, "PR")} looked at` : read ? `${plural2(read, "discussion")} read again` : "nothing new");
|
|
8911
8876
|
} catch (err) {
|
|
8912
|
-
|
|
8877
|
+
run?.fail(err.message);
|
|
8913
8878
|
}
|
|
8914
8879
|
}
|
|
8915
8880
|
return {
|
|
@@ -8927,11 +8892,11 @@ function createReviewQueue(deps) {
|
|
|
8927
8892
|
if (!list.ok) return { ok: false, error: list.error };
|
|
8928
8893
|
const pr = list.prs.find((p) => p.number === number);
|
|
8929
8894
|
if (!pr) return { ok: false, error: `#${number} isn't an open pull request of ${repo}` };
|
|
8930
|
-
const
|
|
8931
|
-
const note = (text, level = "info") =>
|
|
8895
|
+
const run = deps.activity?.start("reviews", `Preparing the review of ${repo} #${number}`);
|
|
8896
|
+
const note = (text, level = "info") => run?.note(text, { level });
|
|
8932
8897
|
const r = await oneAtATime3(() => prepareOne(project, metaOf(repo, host, pr), pr, false, note, also));
|
|
8933
|
-
if (r.ok)
|
|
8934
|
-
else
|
|
8898
|
+
if (r.ok) run?.done(`prepared${r.how ? `; ${r.how}` : ""}`);
|
|
8899
|
+
else run?.fail(r.error);
|
|
8935
8900
|
return r.ok ? { ok: true, review: r.review } : { ok: false, error: r.error };
|
|
8936
8901
|
},
|
|
8937
8902
|
async refreshDiscussion(repo, number) {
|
|
@@ -9094,7 +9059,7 @@ function startReviewSweeps(opts) {
|
|
|
9094
9059
|
}
|
|
9095
9060
|
|
|
9096
9061
|
// src/core/diff/session-history.ts
|
|
9097
|
-
import
|
|
9062
|
+
import path18 from "path";
|
|
9098
9063
|
|
|
9099
9064
|
// src/core/diff/diff-points.ts
|
|
9100
9065
|
var SHA = /^[0-9a-f]{7,40}$/;
|
|
@@ -9190,12 +9155,12 @@ async function sessionHistory(session, others = []) {
|
|
|
9190
9155
|
});
|
|
9191
9156
|
if (diffArg === "HEAD") continue;
|
|
9192
9157
|
const log = await g(["log", `-n${MAX_COMMITS2}`, "--format=%H%x1f%cI%x1f%s", `${diffArg}..HEAD`, "--"], root);
|
|
9193
|
-
if (log.ok && log.out) commits.push(...parseLog(log.out,
|
|
9158
|
+
if (log.ok && log.out) commits.push(...parseLog(log.out, path18.basename(root)));
|
|
9194
9159
|
}
|
|
9195
9160
|
for (const b of others) {
|
|
9196
9161
|
const tip = await tipOf(b);
|
|
9197
9162
|
if (!tip) continue;
|
|
9198
|
-
const repo =
|
|
9163
|
+
const repo = path18.basename(b.path);
|
|
9199
9164
|
const start = liveStart(b) ?? b.start;
|
|
9200
9165
|
let list = [];
|
|
9201
9166
|
let base;
|
|
@@ -9256,7 +9221,7 @@ function parseLog(stdout, repo) {
|
|
|
9256
9221
|
return out;
|
|
9257
9222
|
}
|
|
9258
9223
|
function computeSessionRange(session, from, to) {
|
|
9259
|
-
const paths = session.paths.map((p) =>
|
|
9224
|
+
const paths = session.paths.map((p) => path18.resolve(p));
|
|
9260
9225
|
const refs = rangeRefs(paths, loadManifest(scopeHashForPaths(paths)).entries, from, to);
|
|
9261
9226
|
if ("error" in refs) return refs;
|
|
9262
9227
|
return { repos: refs.map((r) => ({ name: r.name, root: r.root, files: computeRangeDiff(r) })) };
|
|
@@ -9275,17 +9240,17 @@ async function sessionHistoryWire(session) {
|
|
|
9275
9240
|
}
|
|
9276
9241
|
|
|
9277
9242
|
// src/server/routes/revert-routes.ts
|
|
9278
|
-
import
|
|
9243
|
+
import path20 from "path";
|
|
9279
9244
|
import { zValidator as zValidator8 } from "@hono/zod-validator";
|
|
9280
9245
|
import { z as z7 } from "zod";
|
|
9281
9246
|
|
|
9282
9247
|
// src/core/diff/revert.ts
|
|
9283
9248
|
import fs17 from "fs";
|
|
9284
|
-
import
|
|
9249
|
+
import path19 from "path";
|
|
9285
9250
|
function inside(root, rel) {
|
|
9286
|
-
const abs =
|
|
9287
|
-
const back =
|
|
9288
|
-
if (!back || back.startsWith("..") ||
|
|
9251
|
+
const abs = path19.resolve(root, rel);
|
|
9252
|
+
const back = path19.relative(path19.resolve(root), abs);
|
|
9253
|
+
if (!back || back.startsWith("..") || path19.isAbsolute(back)) return null;
|
|
9289
9254
|
return abs;
|
|
9290
9255
|
}
|
|
9291
9256
|
function inHead(root, rel) {
|
|
@@ -9398,8 +9363,8 @@ function mountRevertRoutes(app, opts) {
|
|
|
9398
9363
|
if (!session) return c.json({ error: "unknown session" }, 404);
|
|
9399
9364
|
const body = c.req.valid("json");
|
|
9400
9365
|
const repo = opts.uncommitted(session).find((r) => r.name === body.repo);
|
|
9401
|
-
const allowed = new Set(session.paths.map((p) =>
|
|
9402
|
-
if (!repo || !allowed.has(
|
|
9366
|
+
const allowed = new Set(session.paths.map((p) => path20.resolve(p).toLowerCase()));
|
|
9367
|
+
if (!repo || !allowed.has(path20.resolve(repo.root).toLowerCase())) {
|
|
9403
9368
|
return c.json({ error: `unknown repo: ${body.repo}` }, 404);
|
|
9404
9369
|
}
|
|
9405
9370
|
const file = repo.files.find((f) => f.path === body.path);
|
|
@@ -9557,10 +9522,10 @@ function mountCiRoutes(app, opts) {
|
|
|
9557
9522
|
|
|
9558
9523
|
// src/core/diff/diffs-sweep.ts
|
|
9559
9524
|
import fs19 from "fs";
|
|
9560
|
-
import
|
|
9525
|
+
import path21 from "path";
|
|
9561
9526
|
var SWEEP_AFTER_DAYS = 30;
|
|
9562
9527
|
var DISPOSABLE = /\.(html|log)$/i;
|
|
9563
|
-
function sweepOldDiffArtifacts(now = Date.now(), maxAgeDays = SWEEP_AFTER_DAYS, dir =
|
|
9528
|
+
function sweepOldDiffArtifacts(now = Date.now(), maxAgeDays = SWEEP_AFTER_DAYS, dir = path21.join(getConfigDir(), "diffs")) {
|
|
9564
9529
|
const cutoff = now - maxAgeDays * 24 * 60 * 60 * 1e3;
|
|
9565
9530
|
let removed = 0;
|
|
9566
9531
|
let bytes = 0;
|
|
@@ -9572,7 +9537,7 @@ function sweepOldDiffArtifacts(now = Date.now(), maxAgeDays = SWEEP_AFTER_DAYS,
|
|
|
9572
9537
|
}
|
|
9573
9538
|
for (const name of names) {
|
|
9574
9539
|
if (!DISPOSABLE.test(name)) continue;
|
|
9575
|
-
const file =
|
|
9540
|
+
const file = path21.join(dir, name);
|
|
9576
9541
|
try {
|
|
9577
9542
|
const st = fs19.statSync(file);
|
|
9578
9543
|
if (!st.isFile() || st.mtimeMs >= cutoff) continue;
|
|
@@ -9664,16 +9629,20 @@ function attachTerminalWs(httpServer, port, opts = {}) {
|
|
|
9664
9629
|
return;
|
|
9665
9630
|
}
|
|
9666
9631
|
const sessionId = decodeURIComponent(match[1]);
|
|
9667
|
-
const
|
|
9632
|
+
const params = new URLSearchParams(match[2] ?? "");
|
|
9633
|
+
const force = params.get("force") === "1";
|
|
9634
|
+
const flow = params.get(FLOW_PARAM) === "1";
|
|
9635
|
+
const grid = gridFromParams(params);
|
|
9636
|
+
const resume = resumeFromParams(params);
|
|
9668
9637
|
wss.handleUpgrade(req, socket, head, (ws) => {
|
|
9669
|
-
void bridgeToHost(ws, sessionId, force ? null : elsewhere(sessionId));
|
|
9638
|
+
void bridgeToHost(ws, sessionId, force || resume ? null : elsewhere(sessionId), flow, grid, resume);
|
|
9670
9639
|
});
|
|
9671
9640
|
});
|
|
9672
9641
|
return {
|
|
9673
9642
|
close: () => wss.close()
|
|
9674
9643
|
};
|
|
9675
9644
|
}
|
|
9676
|
-
async function bridgeToHost(ws, sessionId, pending) {
|
|
9645
|
+
async function bridgeToHost(ws, sessionId, pending, flow = false, grid = null, resume = null) {
|
|
9677
9646
|
const elsewhere = await pending;
|
|
9678
9647
|
if (ws.readyState !== WebSocket.OPEN) return;
|
|
9679
9648
|
if (elsewhere) {
|
|
@@ -9697,7 +9666,7 @@ async function bridgeToHost(ws, sessionId, pending) {
|
|
|
9697
9666
|
ws.on("error", drop);
|
|
9698
9667
|
let hostUrl;
|
|
9699
9668
|
try {
|
|
9700
|
-
hostUrl = await ensurePty(sessionId);
|
|
9669
|
+
hostUrl = await ensurePty(sessionId, { ...grid ? { grid } : {}, ...resume ? { attachOnly: true } : {} });
|
|
9701
9670
|
} catch (err) {
|
|
9702
9671
|
try {
|
|
9703
9672
|
ws.send(JSON.stringify({ type: "error", message: err.message }));
|
|
@@ -9715,7 +9684,7 @@ async function bridgeToHost(ws, sessionId, pending) {
|
|
|
9715
9684
|
return;
|
|
9716
9685
|
}
|
|
9717
9686
|
if (browserGone) return;
|
|
9718
|
-
upstream = new WebSocket(hostUrl);
|
|
9687
|
+
upstream = new WebSocket(withResume(withGrid(flow ? withFlow(hostUrl) : hostUrl, grid), resume));
|
|
9719
9688
|
const up = upstream;
|
|
9720
9689
|
const queued = [];
|
|
9721
9690
|
up.on("open", () => {
|
|
@@ -10001,9 +9970,9 @@ function mountAccountRoutes(app, opts) {
|
|
|
10001
9970
|
|
|
10002
9971
|
// src/core/sessions/account-skills-child.ts
|
|
10003
9972
|
var lastLine = (text) => text.split("\n").map((l) => l.trim()).filter(Boolean).pop() ?? "";
|
|
10004
|
-
function accountSkillsInChild(workBin,
|
|
9973
|
+
function accountSkillsInChild(workBin, run = runWorkChild) {
|
|
10005
9974
|
return async (name) => {
|
|
10006
|
-
const r = await
|
|
9975
|
+
const r = await run(workBin(), ["account", "skills", name], { timeoutMs: 5 * 6e4 });
|
|
10007
9976
|
if (r.spawnError) return { ok: false, message: `couldn't start work: ${r.spawnError}` };
|
|
10008
9977
|
if (r.timedOut) return { ok: false, message: "installing work\u2019s skills took too long" };
|
|
10009
9978
|
const said = lastLine(r.stdout) || lastLine(r.stderr);
|
|
@@ -10176,7 +10145,7 @@ var localReviewRow = () => null;
|
|
|
10176
10145
|
function computeSessionDiff(s, base) {
|
|
10177
10146
|
const resolved = s.paths.map((p) => resolveRepoDiff(p, base, s.baseBranches?.[p] ?? s.baseBranch));
|
|
10178
10147
|
const repos = s.paths.map((p, i) => ({
|
|
10179
|
-
name:
|
|
10148
|
+
name: path22.basename(p),
|
|
10180
10149
|
root: p,
|
|
10181
10150
|
resolvedBase: resolved[i].resolvedBase,
|
|
10182
10151
|
files: computeDiff({ root: p, diffArg: resolved[i].diffArg })
|
|
@@ -10280,7 +10249,7 @@ async function startWebServer(opts = {}) {
|
|
|
10280
10249
|
}, 500);
|
|
10281
10250
|
}
|
|
10282
10251
|
});
|
|
10283
|
-
const repoNames = (s) => s.isGroup ? s.paths.map((p) =>
|
|
10252
|
+
const repoNames = (s) => s.isGroup ? s.paths.map((p) => path22.basename(p)) : [s.target];
|
|
10284
10253
|
const diffStatFor = (id, s, hasStatus) => wantsDiffStat(s, hasStatus) ? diffStats.get(id, s.paths, repoNames(s)) : null;
|
|
10285
10254
|
const archivedRow = createArchivedRows();
|
|
10286
10255
|
app.get("/api/sessions", (c) => {
|
|
@@ -10454,12 +10423,12 @@ async function startWebServer(opts = {}) {
|
|
|
10454
10423
|
busy: restartBusy,
|
|
10455
10424
|
running: peekPty,
|
|
10456
10425
|
report: (notes) => {
|
|
10457
|
-
const
|
|
10426
|
+
const run = activity.start("agents", "Restarting agents");
|
|
10458
10427
|
for (const { id, text, level } of notes) {
|
|
10459
10428
|
const s = findSession2(id);
|
|
10460
|
-
|
|
10429
|
+
run.note(`${s ? `${s.target} ${s.branch}` : id}: ${text}`, { level, sessionId: s ? id : void 0 });
|
|
10461
10430
|
}
|
|
10462
|
-
|
|
10431
|
+
run.done(restartNotesSummary(notes));
|
|
10463
10432
|
},
|
|
10464
10433
|
changed: () => {
|
|
10465
10434
|
broadcast("agents-changed", { ts: Date.now() });
|
|
@@ -10514,7 +10483,7 @@ async function startWebServer(opts = {}) {
|
|
|
10514
10483
|
const minutes = loadConfig()?.sleepIdleAfterMinutes ?? DEFAULT_SLEEP_AFTER_MINUTES;
|
|
10515
10484
|
if (sleepAfterMs(minutes) === 0)
|
|
10516
10485
|
return activity.skip("idle-sleep", "Looking for idle Claudes", "turned off (sleepIdleAfterMinutes: 0)");
|
|
10517
|
-
const
|
|
10486
|
+
const run = activity.start("idle-sleep", "Looking for idle Claudes");
|
|
10518
10487
|
const ptys = await listHostPtys().catch(() => []);
|
|
10519
10488
|
const quiet = new Set(sleepCandidates(ptys, Date.now(), sleepAfterMs(minutes), agentBusy));
|
|
10520
10489
|
const plan = await sleepPlan(
|
|
@@ -10523,7 +10492,7 @@ async function startWebServer(opts = {}) {
|
|
|
10523
10492
|
);
|
|
10524
10493
|
for (const { id, why } of plan.awake) {
|
|
10525
10494
|
const s = findSession2(id);
|
|
10526
|
-
|
|
10495
|
+
run.note(`${s ? `${s.target} ${s.branch}` : id}: kept awake: ${why}`, { sessionId: s ? id : void 0 });
|
|
10527
10496
|
}
|
|
10528
10497
|
const ids = plan.sleep;
|
|
10529
10498
|
for (const id of ids) {
|
|
@@ -10533,16 +10502,16 @@ async function startWebServer(opts = {}) {
|
|
|
10533
10502
|
async () => {
|
|
10534
10503
|
await markAgentStopped(id).catch(() => {
|
|
10535
10504
|
});
|
|
10536
|
-
|
|
10505
|
+
run.note(
|
|
10537
10506
|
`${s ? `${s.target} ${s.branch}` : id}: put its Claude to sleep (printed nothing for ${sleepAfterMs(minutes) / 6e4} min, nothing attached; opening it resumes the conversation)`,
|
|
10538
10507
|
{ level: "action", sessionId: id }
|
|
10539
10508
|
);
|
|
10540
10509
|
},
|
|
10541
|
-
(err) =>
|
|
10510
|
+
(err) => run.note(`${id}: couldn't stop its Claude: ${err.message}`, { level: "warn", sessionId: id })
|
|
10542
10511
|
);
|
|
10543
10512
|
}
|
|
10544
10513
|
const slept = ids.length;
|
|
10545
|
-
|
|
10514
|
+
run.done(`${ptys.length} Claude${ptys.length === 1 ? "" : "s"} running \xB7 ${slept ? `${slept} put to sleep` : "none idle long enough"}`);
|
|
10546
10515
|
if (ids.length) broadcast("sessions-changed", { ts: Date.now() });
|
|
10547
10516
|
};
|
|
10548
10517
|
sleepSchedule?.next(Date.now() + SLEEP_EVERY_MS);
|
|
@@ -10601,15 +10570,15 @@ async function startWebServer(opts = {}) {
|
|
|
10601
10570
|
const archiveUpkeep = () => {
|
|
10602
10571
|
retentionSchedule?.next(Date.now() + RETENTION_EVERY_MS);
|
|
10603
10572
|
const cfg = loadConfig()?.archive;
|
|
10604
|
-
const
|
|
10573
|
+
const run = activity.start("archive", "Compressing old archived conversations");
|
|
10605
10574
|
try {
|
|
10606
10575
|
const r = applyArchiveRetention({ compressAfterDays: cfg?.compressAfterDays, dropAfterDays: cfg?.dropTranscriptsAfterDays });
|
|
10607
10576
|
const mb = Math.round(r.bytesSaved / 1e6);
|
|
10608
|
-
|
|
10577
|
+
run.done(
|
|
10609
10578
|
r.compressed.length || r.dropped.length ? `${r.compressed.length} compressed${r.dropped.length ? `, ${r.dropped.length} conversations deleted (config)` : ""} \xB7 ${mb} MB freed` : "nothing old enough"
|
|
10610
10579
|
);
|
|
10611
10580
|
} catch (err) {
|
|
10612
|
-
|
|
10581
|
+
run.fail(err.message);
|
|
10613
10582
|
}
|
|
10614
10583
|
};
|
|
10615
10584
|
const retentionFirst = !jobs ? null : setTimeout(archiveUpkeep, 3 * 6e4);
|
|
@@ -10625,18 +10594,18 @@ async function startWebServer(opts = {}) {
|
|
|
10625
10594
|
conversationsSchedule?.next(Date.now() + CONVERSATIONS_EVERY_MS);
|
|
10626
10595
|
if (conversationsBusy) return;
|
|
10627
10596
|
conversationsBusy = true;
|
|
10628
|
-
const
|
|
10597
|
+
const run = activity.start("conversations", "Copying new conversation lines");
|
|
10629
10598
|
try {
|
|
10630
10599
|
const r = await syncConversations(loadHistory().filter((s) => !s.archivedAt));
|
|
10631
10600
|
const packed = await compressQuietCopies();
|
|
10632
|
-
|
|
10601
|
+
run.done(
|
|
10633
10602
|
[
|
|
10634
10603
|
r.files ? `${r.sessions} session${r.sessions === 1 ? "" : "s"} \xB7 ${r.files} transcript${r.files === 1 ? "" : "s"} \xB7 ${Math.round(r.bytes / 1e3)} KB copied` : "all up to date",
|
|
10635
10604
|
packed.files ? `${packed.files} quiet one${packed.files === 1 ? "" : "s"} compressed \xB7 ${Math.round(packed.bytesSaved / 1e6)} MB freed` : ""
|
|
10636
10605
|
].filter(Boolean).join(" \xB7 ")
|
|
10637
10606
|
);
|
|
10638
10607
|
} catch (err) {
|
|
10639
|
-
|
|
10608
|
+
run.fail(err.message);
|
|
10640
10609
|
} finally {
|
|
10641
10610
|
conversationsBusy = false;
|
|
10642
10611
|
}
|
|
@@ -10702,7 +10671,7 @@ async function startWebServer(opts = {}) {
|
|
|
10702
10671
|
blocksSchedule?.next(Date.now() + BLOCKS_EVERY_MS);
|
|
10703
10672
|
if (blocksBusy || allBlocks().size === 0) return;
|
|
10704
10673
|
blocksBusy = true;
|
|
10705
|
-
const
|
|
10674
|
+
const run = activity.start("blocks", "Checking what sessions wait on");
|
|
10706
10675
|
try {
|
|
10707
10676
|
const history = loadHistory();
|
|
10708
10677
|
const live = new Set(history.filter((x) => !x.archivedAt).map((x) => sessionIdFor(x)));
|
|
@@ -10714,7 +10683,7 @@ async function startWebServer(opts = {}) {
|
|
|
10714
10683
|
const r = await blockedPrState(url, defaultRunner);
|
|
10715
10684
|
if (r && "rateLimited" in r) {
|
|
10716
10685
|
ghRestUntil = Date.now() + 10 * 6e4;
|
|
10717
|
-
|
|
10686
|
+
run.note(`${r.host} API limit reached: resting 10 minutes`, { level: "warn" });
|
|
10718
10687
|
return null;
|
|
10719
10688
|
}
|
|
10720
10689
|
return r?.state ?? null;
|
|
@@ -10722,7 +10691,7 @@ async function startWebServer(opts = {}) {
|
|
|
10722
10691
|
unblocked: async (id, done) => {
|
|
10723
10692
|
const s = history.find((x) => sessionIdFor(x) === id);
|
|
10724
10693
|
const name = s ? `${s.target} \xB7 ${s.branch}` : id;
|
|
10725
|
-
|
|
10694
|
+
run.note(`${name}: no longer waiting (${done.map((b) => b.label).join(", ")})`, { sessionId: id });
|
|
10726
10695
|
const event = {
|
|
10727
10696
|
sessionId: id,
|
|
10728
10697
|
kind: "unblocked",
|
|
@@ -10734,10 +10703,10 @@ async function startWebServer(opts = {}) {
|
|
|
10734
10703
|
if (s) await stackDeps.tell(s, unblockedPrompt(done)).catch((err) => logSwallowed(`telling ${name} it is unblocked`, err));
|
|
10735
10704
|
}
|
|
10736
10705
|
});
|
|
10737
|
-
|
|
10706
|
+
run.done(freed.length ? `${freed.length} unblocked` : "still waiting");
|
|
10738
10707
|
if (freed.length) broadcast("sessions-changed", { ts: Date.now() });
|
|
10739
10708
|
} catch (err) {
|
|
10740
|
-
|
|
10709
|
+
run.fail(err.message);
|
|
10741
10710
|
} finally {
|
|
10742
10711
|
blocksBusy = false;
|
|
10743
10712
|
}
|
|
@@ -10748,18 +10717,18 @@ async function startWebServer(opts = {}) {
|
|
|
10748
10717
|
leftoversSchedule?.next(Date.now() + LEFTOVERS_EVERY_MS);
|
|
10749
10718
|
if (leftoversBusy) return;
|
|
10750
10719
|
leftoversBusy = true;
|
|
10751
|
-
const
|
|
10720
|
+
const run = activity.start("processes", "Looking for processes left running");
|
|
10752
10721
|
try {
|
|
10753
10722
|
const found2 = await sweepLeftovers({
|
|
10754
10723
|
sessions: () => loadHistory().filter((x) => !x.archivedAt).map((x) => ({ id: sessionIdFor(x), name: `${x.target} \xB7 ${x.branch}`, paths: x.paths })),
|
|
10755
10724
|
list: () => listProcessUsage(),
|
|
10756
10725
|
agentPid: ptyPid,
|
|
10757
|
-
note: (text, o) =>
|
|
10726
|
+
note: (text, o) => run.note(text, o)
|
|
10758
10727
|
});
|
|
10759
|
-
if (found2)
|
|
10760
|
-
else
|
|
10728
|
+
if (found2) run.done(leftoverSummary(found2));
|
|
10729
|
+
else run.fail(leftoverSummary(found2));
|
|
10761
10730
|
} catch (err) {
|
|
10762
|
-
|
|
10731
|
+
run.fail(err.message);
|
|
10763
10732
|
} finally {
|
|
10764
10733
|
leftoversBusy = false;
|
|
10765
10734
|
}
|
|
@@ -10806,7 +10775,7 @@ async function startWebServer(opts = {}) {
|
|
|
10806
10775
|
scopeApi = mountScopeRoutes(app, { broadcast });
|
|
10807
10776
|
mountTerminalRoutes(app, {
|
|
10808
10777
|
elsewhere: defaultElsewhere,
|
|
10809
|
-
ensure: (id) => ensurePty(id),
|
|
10778
|
+
ensure: (id, grid, attachOnly) => ensurePty(id, { grid, attachOnly }),
|
|
10810
10779
|
ticket: terminalTicketUrl,
|
|
10811
10780
|
log: (line) => debugLog("INFO", line)
|
|
10812
10781
|
});
|
|
@@ -11066,10 +11035,10 @@ async function settleAgentHooks(io) {
|
|
|
11066
11035
|
|
|
11067
11036
|
// src/core/platform/autostart.ts
|
|
11068
11037
|
import fs21 from "fs";
|
|
11069
|
-
import
|
|
11038
|
+
import path23 from "path";
|
|
11070
11039
|
function startupScriptPath() {
|
|
11071
11040
|
if (process.platform !== "win32" || !process.env.APPDATA) return null;
|
|
11072
|
-
return
|
|
11041
|
+
return path23.join(process.env.APPDATA, "Microsoft", "Windows", "Start Menu", "Programs", "Startup", "work-web.vbs");
|
|
11073
11042
|
}
|
|
11074
11043
|
function vbsQuote(s) {
|
|
11075
11044
|
return '"' + s.replace(/"/g, '""') + '"';
|
|
@@ -11087,7 +11056,7 @@ function setAutostart(enabled, workBin) {
|
|
|
11087
11056
|
const file = startupScriptPath();
|
|
11088
11057
|
if (!file) throw new Error("Autostart is only supported on Windows so far.");
|
|
11089
11058
|
if (enabled) {
|
|
11090
|
-
fs21.mkdirSync(
|
|
11059
|
+
fs21.mkdirSync(path23.dirname(file), { recursive: true });
|
|
11091
11060
|
fs21.writeFileSync(file, buildStartupScript(process.execPath, workBin), "utf-8");
|
|
11092
11061
|
} else {
|
|
11093
11062
|
try {
|
|
@@ -11108,14 +11077,14 @@ async function demoHostSubmit(url, review) {
|
|
|
11108
11077
|
};
|
|
11109
11078
|
return { ok: true, url: `${url}#pullrequestreview-1` };
|
|
11110
11079
|
}
|
|
11111
|
-
var hunk = (
|
|
11080
|
+
var hunk = (path25, lines, status = "modified") => {
|
|
11112
11081
|
const added = lines.filter((l) => l.startsWith("+")).length;
|
|
11113
11082
|
const deleted = lines.filter((l) => l.startsWith("-")).length;
|
|
11114
11083
|
const context = lines.length - added - deleted;
|
|
11115
11084
|
return [
|
|
11116
|
-
`diff --git a/${
|
|
11117
|
-
...status === "added" ? ["new file mode 100644", "index 0000000..1111111", "--- /dev/null"] : ["index 1111111..2222222 100644", `--- a/${
|
|
11118
|
-
`+++ b/${
|
|
11085
|
+
`diff --git a/${path25} b/${path25}`,
|
|
11086
|
+
...status === "added" ? ["new file mode 100644", "index 0000000..1111111", "--- /dev/null"] : ["index 1111111..2222222 100644", `--- a/${path25}`],
|
|
11087
|
+
`+++ b/${path25}`,
|
|
11119
11088
|
`@@ -${status === "added" ? 0 : 1},${status === "added" ? 0 : context + deleted} +1,${context + added} @@`,
|
|
11120
11089
|
...lines
|
|
11121
11090
|
].join("\n");
|
|
@@ -11434,12 +11403,12 @@ function mountDemoReviews(app, broadcast, sessions = noSessions) {
|
|
|
11434
11403
|
});
|
|
11435
11404
|
const key = (repo, n) => `${repo}#${n}`;
|
|
11436
11405
|
const store = {
|
|
11437
|
-
read: (rp,
|
|
11438
|
-
update: (rp,
|
|
11439
|
-
const was = reviews.get(key(rp, String(
|
|
11406
|
+
read: (rp, num3) => reviews.get(key(rp, String(num3))) ?? null,
|
|
11407
|
+
update: (rp, num3, change) => {
|
|
11408
|
+
const was = reviews.get(key(rp, String(num3)));
|
|
11440
11409
|
if (!was) return null;
|
|
11441
11410
|
const next = change(was);
|
|
11442
|
-
reviews.set(key(rp, String(
|
|
11411
|
+
reviews.set(key(rp, String(num3)), next);
|
|
11443
11412
|
return next;
|
|
11444
11413
|
},
|
|
11445
11414
|
pid: 0,
|
|
@@ -11503,7 +11472,7 @@ function mountDemoReviews(app, broadcast, sessions = noSessions) {
|
|
|
11503
11472
|
{
|
|
11504
11473
|
...store,
|
|
11505
11474
|
repoPath: (alias) => alias === "api" ? "/demo/api" : null,
|
|
11506
|
-
submit: async (_at,
|
|
11475
|
+
submit: async (_at, num3, review) => demoHostSubmit(reviews.get(key(repo, String(num3)))?.url ?? "", review)
|
|
11507
11476
|
},
|
|
11508
11477
|
repo,
|
|
11509
11478
|
n,
|
|
@@ -11617,7 +11586,7 @@ function createDemoRepos(liveTargets) {
|
|
|
11617
11586
|
/** GET /api/projects: what New worktree offers, as the real one reads config. */
|
|
11618
11587
|
projects() {
|
|
11619
11588
|
return {
|
|
11620
|
-
singles: Object.entries(repos).map(([name,
|
|
11589
|
+
singles: Object.entries(repos).map(([name, path25]) => ({ name, kind: "single", path: path25 })),
|
|
11621
11590
|
groups: Object.entries(groups).map(([name, members]) => ({ name, kind: "group", members }))
|
|
11622
11591
|
};
|
|
11623
11592
|
},
|
|
@@ -11659,12 +11628,12 @@ function createDemoRepos(liveTargets) {
|
|
|
11659
11628
|
}));
|
|
11660
11629
|
return { roots: [root], repos: rows, groups: groupRows };
|
|
11661
11630
|
},
|
|
11662
|
-
enroll(alias,
|
|
11663
|
-
if (!found2.some((f) => f.path ===
|
|
11664
|
-
const problem = enrollProblem(alias,
|
|
11631
|
+
enroll(alias, path25) {
|
|
11632
|
+
if (!found2.some((f) => f.path === path25)) throw new DemoRepoError(`${path25} is not the top folder of a git repository`);
|
|
11633
|
+
const problem = enrollProblem(alias, path25, config());
|
|
11665
11634
|
if (problem) throw new DemoRepoError(problem);
|
|
11666
|
-
repos[alias] =
|
|
11667
|
-
ignored.delete(
|
|
11635
|
+
repos[alias] = path25;
|
|
11636
|
+
ignored.delete(path25);
|
|
11668
11637
|
},
|
|
11669
11638
|
remove(alias, force) {
|
|
11670
11639
|
if (!(alias in repos)) throw new DemoRepoError(`no repo \u201C${alias}\u201D`);
|
|
@@ -11673,9 +11642,9 @@ function createDemoRepos(liveTargets) {
|
|
|
11673
11642
|
delete repos[alias];
|
|
11674
11643
|
for (const g2 of Object.keys(groups)) groups[g2] = groups[g2].filter((m) => m !== alias);
|
|
11675
11644
|
},
|
|
11676
|
-
ignore(
|
|
11677
|
-
if (on) ignored.add(
|
|
11678
|
-
else ignored.delete(
|
|
11645
|
+
ignore(path25, on) {
|
|
11646
|
+
if (on) ignored.add(path25);
|
|
11647
|
+
else ignored.delete(path25);
|
|
11679
11648
|
},
|
|
11680
11649
|
saveGroup(name, members, creating) {
|
|
11681
11650
|
const problem = groupProblem(name, members, config(), { creating });
|
|
@@ -12076,8 +12045,8 @@ var DemoScenario = class {
|
|
|
12076
12045
|
this.pending = this.pending.filter((p) => !ready.includes(p));
|
|
12077
12046
|
for (const p of ready) p.run();
|
|
12078
12047
|
}
|
|
12079
|
-
after(ms,
|
|
12080
|
-
this.pending.push({ at: this.now() + ms * this.speed, run
|
|
12048
|
+
after(ms, run) {
|
|
12049
|
+
this.pending.push({ at: this.now() + ms * this.speed, run });
|
|
12081
12050
|
}
|
|
12082
12051
|
// -- seed -----------------------------------------------------------------
|
|
12083
12052
|
iso(minutesAgo) {
|
|
@@ -12974,15 +12943,15 @@ ${reply}\r
|
|
|
12974
12943
|
if (refusal || !s) return { ok: false, status: refusal?.status ?? 404, error: refusal?.error ?? "unknown session" };
|
|
12975
12944
|
s.repos.push({ name: alias, uncommitted: "", sinceBranch: "", published: false, pr: null });
|
|
12976
12945
|
const from = base || "main";
|
|
12977
|
-
const
|
|
12946
|
+
const path25 = this.wire(s).paths[s.repos.length - 1];
|
|
12978
12947
|
s.comments.post({
|
|
12979
12948
|
side: "general",
|
|
12980
12949
|
status: "published",
|
|
12981
|
-
body: addedRepoNote({ alias, path:
|
|
12950
|
+
body: addedRepoNote({ alias, path: path25, branch: s.branch, from, imported: true })
|
|
12982
12951
|
});
|
|
12983
12952
|
this.emit("comments-changed", { sessionId: id });
|
|
12984
12953
|
this.changed();
|
|
12985
|
-
return { ok: true, wire: { ok: true, path:
|
|
12954
|
+
return { ok: true, wire: { ok: true, path: path25, branch: s.branch, created: true, from, imported: true, warnings: [] } };
|
|
12986
12955
|
}
|
|
12987
12956
|
// -- CI (the PR watch, simulated) ------------------------------------------
|
|
12988
12957
|
/** The Today digest, through the same builder as work web: the demo's
|
|
@@ -13560,20 +13529,20 @@ function demoCodeFiles(repos, group) {
|
|
|
13560
13529
|
})
|
|
13561
13530
|
};
|
|
13562
13531
|
}
|
|
13563
|
-
function demoCodeFile(repos, group, repo,
|
|
13532
|
+
function demoCodeFile(repos, group, repo, path25) {
|
|
13564
13533
|
if (repo === "") {
|
|
13565
|
-
if (!group ||
|
|
13534
|
+
if (!group || path25 !== "CLAUDE.md") return null;
|
|
13566
13535
|
const text2 = `# Group instructions
|
|
13567
13536
|
|
|
13568
13537
|
Repos: ${repos.map((r2) => r2.name).join(", ")}.
|
|
13569
13538
|
`;
|
|
13570
|
-
return { repo, path:
|
|
13539
|
+
return { repo, path: path25, size: text2.length, text: text2 };
|
|
13571
13540
|
}
|
|
13572
13541
|
const r = repos.find((x) => x.name === repo);
|
|
13573
13542
|
if (!r) return null;
|
|
13574
|
-
const changed = r.changed.find((f) => f.path ===
|
|
13575
|
-
const text = changed ? newSide(changed) : COMMON[
|
|
13576
|
-
return text === void 0 ? null : { repo, path:
|
|
13543
|
+
const changed = r.changed.find((f) => f.path === path25 && f.status !== "deleted");
|
|
13544
|
+
const text = changed ? newSide(changed) : COMMON[path25]?.replace(/\{repo\}/g, repo);
|
|
13545
|
+
return text === void 0 ? null : { repo, path: path25, size: text.length, text };
|
|
13577
13546
|
}
|
|
13578
13547
|
function demoCodeSearch(repos, group, query) {
|
|
13579
13548
|
const q = query.trim();
|
|
@@ -13582,12 +13551,12 @@ function demoCodeSearch(repos, group, query) {
|
|
|
13582
13551
|
const text = [];
|
|
13583
13552
|
const fold = (x) => ignoresCase(q) ? x.toLowerCase() : x;
|
|
13584
13553
|
for (const r of demoCodeFiles(repos, group).repos) {
|
|
13585
|
-
for (const
|
|
13586
|
-
const lines = (demoCodeFile(repos, group, r.name,
|
|
13554
|
+
for (const path25 of r.files) {
|
|
13555
|
+
const lines = (demoCodeFile(repos, group, r.name, path25)?.text ?? "").split("\n");
|
|
13587
13556
|
lines.forEach((line, i) => {
|
|
13588
|
-
const d = declarationOf(
|
|
13589
|
-
if (d) symbols.push({ ...d, repo: r.name, path:
|
|
13590
|
-
if (fold(line).includes(fold(q))) text.push({ repo: r.name, path:
|
|
13557
|
+
const d = declarationOf(path25, line);
|
|
13558
|
+
if (d) symbols.push({ ...d, repo: r.name, path: path25, line: i + 1, text: line.trim() });
|
|
13559
|
+
if (fold(line).includes(fold(q))) text.push({ repo: r.name, path: path25, line: i + 1, text: line });
|
|
13591
13560
|
});
|
|
13592
13561
|
}
|
|
13593
13562
|
}
|
|
@@ -13615,8 +13584,8 @@ function createDemoActivity(scenario, emit) {
|
|
|
13615
13584
|
const sweep = () => {
|
|
13616
13585
|
prCheck.next(Date.now() + SWEEP_EVERY_MS);
|
|
13617
13586
|
const sessions = scenario.list().filter((s) => !s.archivedAt);
|
|
13618
|
-
const
|
|
13619
|
-
|
|
13587
|
+
const run = log.start("pr-watch", "Checking pull requests");
|
|
13588
|
+
run.progress(0, sessions.length);
|
|
13620
13589
|
let prs = 0;
|
|
13621
13590
|
let threads = 0;
|
|
13622
13591
|
let failing = 0;
|
|
@@ -13628,24 +13597,24 @@ function createDemoActivity(scenario, emit) {
|
|
|
13628
13597
|
threads += r.openThreads ?? 0;
|
|
13629
13598
|
if (r.pr.checks === "fail") {
|
|
13630
13599
|
failing++;
|
|
13631
|
-
|
|
13600
|
+
run.note(
|
|
13632
13601
|
`${s.target} ${s.branch}: checks fail on #${r.pr.number} (${(r.pr.failing ?? []).map((f) => f.name).join(", ")}): already told its Claude`,
|
|
13633
13602
|
{ sessionId: s.id }
|
|
13634
13603
|
);
|
|
13635
13604
|
}
|
|
13636
13605
|
if (r.openThreads)
|
|
13637
|
-
|
|
13606
|
+
run.note(`${s.target} ${s.branch}: ${r.openThreads} unresolved review threads on #${r.pr.number}`, { sessionId: s.id });
|
|
13638
13607
|
}
|
|
13639
|
-
|
|
13608
|
+
run.progress(i + 1, sessions.length);
|
|
13640
13609
|
if (i === sessions.length - 1) {
|
|
13641
13610
|
const parts = [`${sessions.length} sessions`, `${prs} open PRs`];
|
|
13642
13611
|
if (threads) parts.push(`${threads} unresolved review threads`);
|
|
13643
13612
|
if (failing) parts.push(`${failing} failing`);
|
|
13644
|
-
|
|
13613
|
+
run.done(parts.join(" \xB7 "));
|
|
13645
13614
|
}
|
|
13646
13615
|
});
|
|
13647
13616
|
});
|
|
13648
|
-
if (sessions.length === 0)
|
|
13617
|
+
if (sessions.length === 0) run.done("0 sessions");
|
|
13649
13618
|
};
|
|
13650
13619
|
later(3e3, sweep);
|
|
13651
13620
|
prCheck.next(Date.now() + 3e3);
|
|
@@ -13870,13 +13839,13 @@ function createDemoSettings(repoPathOf) {
|
|
|
13870
13839
|
};
|
|
13871
13840
|
return {
|
|
13872
13841
|
read,
|
|
13873
|
-
async write(
|
|
13874
|
-
const f = settingAt(
|
|
13875
|
-
if (!f) throw new SettingsError(`no setting ${
|
|
13842
|
+
async write(path25, value) {
|
|
13843
|
+
const f = settingAt(path25);
|
|
13844
|
+
if (!f) throw new SettingsError(`no setting ${path25}`, 404);
|
|
13876
13845
|
const r = checkSetting(f, value);
|
|
13877
13846
|
if (!r.ok) throw new SettingsError(`${f.label}: ${r.error}`);
|
|
13878
|
-
if (r.value === null) delete values[
|
|
13879
|
-
else values[
|
|
13847
|
+
if (r.value === null) delete values[path25];
|
|
13848
|
+
else values[path25] = r.value;
|
|
13880
13849
|
return read();
|
|
13881
13850
|
},
|
|
13882
13851
|
readRepo,
|
|
@@ -14550,10 +14519,16 @@ async function startDemoServer(opts) {
|
|
|
14550
14519
|
const next = p.section && !known2.has(p.section) ? applyPlacePatch(p, { section: null }) : p;
|
|
14551
14520
|
if (next) places[id] = next;
|
|
14552
14521
|
}
|
|
14553
|
-
rail = { sections, places };
|
|
14522
|
+
rail = { ...rail, sections, places };
|
|
14554
14523
|
railChanged();
|
|
14555
14524
|
return c.json(railView());
|
|
14556
14525
|
});
|
|
14526
|
+
app.put("/api/rail/view", async (c) => {
|
|
14527
|
+
const view = asRailView((await json2(c)).view);
|
|
14528
|
+
if (!view) return c.json({ error: "expected {view: mine|state|project}" }, 400);
|
|
14529
|
+
rail = { ...rail, view };
|
|
14530
|
+
return c.json(railView());
|
|
14531
|
+
});
|
|
14557
14532
|
app.put("/api/sessions/:id/rail", async (c) => {
|
|
14558
14533
|
const id = c.req.param("id");
|
|
14559
14534
|
if (!scenario.list().some((x) => x.id === id)) return notFound(c);
|
|
@@ -14582,6 +14557,7 @@ async function startDemoServer(opts) {
|
|
|
14582
14557
|
});
|
|
14583
14558
|
app.post("/api/sessions/:id/agent/start", (c) => scenario.comments(c.req.param("id")) ? c.json({ how: "running" }) : notFound(c));
|
|
14584
14559
|
app.post("/api/sessions/:id/agent/stop", (c) => scenario.comments(c.req.param("id")) ? c.json({ how: "stopped" }) : notFound(c));
|
|
14560
|
+
app.post("/api/sessions/:id/background/stop", (c) => scenario.comments(c.req.param("id")) ? c.json({ stopped: [] }) : notFound(c));
|
|
14585
14561
|
app.get(
|
|
14586
14562
|
"/api/sessions/:id/last-reply",
|
|
14587
14563
|
(c) => scenario.comments(c.req.param("id")) ? c.json({ text: scenario.lastReply(c.req.param("id")) }) : notFound(c)
|
|
@@ -15049,7 +15025,7 @@ async function startDemoServer(opts) {
|
|
|
15049
15025
|
tick.unref?.();
|
|
15050
15026
|
const wss = new WebSocketServer2({ noServer: true });
|
|
15051
15027
|
handle.httpServer.on("upgrade", (req, socket, head) => {
|
|
15052
|
-
const m = (req.url ?? "").match(/^\/ws\/sessions\/([
|
|
15028
|
+
const m = (req.url ?? "").match(/^\/ws\/sessions\/([^/?]+)\/terminal(?:\?.*)?$/);
|
|
15053
15029
|
const reason = refuseReason({ method: "GET", upgrade: true, host: req.headers.host, origin: req.headers.origin }, handle.port);
|
|
15054
15030
|
if (!m || reason) {
|
|
15055
15031
|
socket.destroy();
|
|
@@ -15106,8 +15082,8 @@ async function startDemoServer(opts) {
|
|
|
15106
15082
|
|
|
15107
15083
|
// src/core/platform/web-life.ts
|
|
15108
15084
|
import fs22 from "fs";
|
|
15109
|
-
import
|
|
15110
|
-
var lifePath = () =>
|
|
15085
|
+
import path24 from "path";
|
|
15086
|
+
var lifePath = () => path24.join(getConfigDir(), "web-life.json");
|
|
15111
15087
|
function isLife(v) {
|
|
15112
15088
|
const l = v;
|
|
15113
15089
|
return !!l && typeof l === "object" && typeof l.pid === "number" && typeof l.version === "string" && typeof l.startedAt === "string" && typeof l.lastSeen === "string" && (l.ended === void 0 || typeof l.ended?.at === "string" && typeof l.ended?.how === "string");
|
|
@@ -15480,4 +15456,4 @@ export {
|
|
|
15480
15456
|
stopExisting,
|
|
15481
15457
|
webCommand
|
|
15482
15458
|
};
|
|
15483
|
-
//# sourceMappingURL=web-
|
|
15459
|
+
//# sourceMappingURL=web-JAAXINIU.js.map
|