@moberg_hr/work-tree 2.10.0 → 2.11.1
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-QSNXX5YV.js → account-QZH4MA42.js} +21 -21
- package/dist/{add-repo-YZ32MLZG.js → add-repo-CAQSJPLG.js} +17 -17
- package/dist/{answer-Y4T5X446.js → answer-3QIKCVON.js} +12 -12
- package/dist/{attach-XPYWYHDP.js → attach-GR3AD4D7.js} +19 -19
- package/dist/bin.js +5 -5
- package/dist/{block-JVAGG5QA.js → block-JFZ5RDO3.js} +15 -16
- package/dist/{block-JVAGG5QA.js.map → block-JFZ5RDO3.js.map} +1 -1
- package/dist/{broadcast-FATIANHX.js → broadcast-WW6DBVZ3.js} +10 -10
- package/dist/{catchup-OTI2KZG5.js → catchup-RMYAFVK3.js} +15 -15
- package/dist/{chunk-VV3NFLLP.js → chunk-26YZYL77.js} +3 -3
- package/dist/{chunk-UP2JTDBI.js → chunk-32VFZGPR.js} +3 -3
- package/dist/{chunk-ZRATYLBB.js → chunk-33XSEAHO.js} +2 -2
- package/dist/{chunk-E67DOUVU.js → chunk-3OAW37JA.js} +107 -18
- package/dist/chunk-3OAW37JA.js.map +1 -0
- package/dist/{chunk-27LWL6QE.js → chunk-3SBQIJQS.js} +468 -14
- package/dist/chunk-3SBQIJQS.js.map +1 -0
- package/dist/{chunk-MM7344RC.js → chunk-4CNBSPNL.js} +2 -2
- package/dist/{chunk-RHDZPV6C.js → chunk-4EL7FVQQ.js} +2 -2
- package/dist/{chunk-FMLE2WSN.js → chunk-4IRPL6XA.js} +2 -2
- package/dist/{chunk-BNKVENDF.js → chunk-4NUWTGAP.js} +5 -5
- package/dist/{chunk-46XSWHCQ.js → chunk-5E44Z6IL.js} +5 -4
- package/dist/chunk-5E44Z6IL.js.map +1 -0
- package/dist/{chunk-KL4YYV37.js → chunk-5FBRQW2F.js} +4 -4
- package/dist/{chunk-TKWUSJNQ.js → chunk-5LW5OJHH.js} +7 -9
- package/dist/{chunk-TKWUSJNQ.js.map → chunk-5LW5OJHH.js.map} +1 -1
- package/dist/{chunk-JNCKZ3OF.js → chunk-63FTAMDO.js} +4 -4
- package/dist/{chunk-WKOJ7NXD.js → chunk-6RMB3I3V.js} +4 -4
- package/dist/{chunk-6J6U7JXN.js → chunk-6YZBMC35.js} +3 -3
- package/dist/{chunk-3BSFVKMK.js → chunk-7DUGVGUZ.js} +2 -2
- package/dist/{chunk-IOHK45WE.js → chunk-7OFVXQSM.js} +2 -2
- package/dist/{chunk-34E2LA3M.js → chunk-A6N4FF4K.js} +5 -5
- package/dist/{chunk-IFQOOCT7.js → chunk-AOWYAOAX.js} +46 -24
- package/dist/chunk-AOWYAOAX.js.map +1 -0
- package/dist/{chunk-V4U5RGEG.js → chunk-BDPRYJL3.js} +3 -3
- package/dist/chunk-BDPRYJL3.js.map +1 -0
- package/dist/{chunk-4TTYEMOY.js → chunk-BM36OYVS.js} +14 -7
- package/dist/chunk-BM36OYVS.js.map +1 -0
- package/dist/{chunk-66VPQOVZ.js → chunk-C7CDET5W.js} +13 -10
- package/dist/chunk-C7CDET5W.js.map +1 -0
- package/dist/{chunk-RCGFHJM7.js → chunk-CBCOVIXZ.js} +2 -2
- package/dist/{chunk-ZXHMC7UO.js → chunk-D2J3AD6L.js} +3 -5
- package/dist/chunk-D2J3AD6L.js.map +1 -0
- package/dist/{chunk-ICXUTMGH.js → chunk-DGVCN7HB.js} +2 -2
- package/dist/{chunk-B5WDN63X.js → chunk-DMGNJ73M.js} +2 -2
- package/dist/{chunk-LZZCJAJQ.js → chunk-DTUKXBAR.js} +7 -7
- package/dist/{chunk-FKM67CZZ.js → chunk-FEL7UMIO.js} +7 -9
- package/dist/{chunk-FKM67CZZ.js.map → chunk-FEL7UMIO.js.map} +1 -1
- package/dist/chunk-FGPXMAYU.js +25 -0
- package/dist/chunk-FGPXMAYU.js.map +1 -0
- package/dist/{chunk-2K5TDJ7M.js → chunk-FI2HURCM.js} +5 -5
- package/dist/{chunk-2HHIDWHH.js → chunk-FJQT7OWV.js} +7 -7
- package/dist/{chunk-LKESANVD.js → chunk-FNA27U2B.js} +2 -2
- package/dist/{chunk-6YMLYU5G.js → chunk-FZJ472VJ.js} +7 -7
- package/dist/{chunk-ADIN3DTD.js → chunk-GG4VKPAX.js} +2 -2
- package/dist/{chunk-V7GCYL6A.js → chunk-GOK6JBB2.js} +6 -6
- package/dist/{chunk-IKX3B26P.js → chunk-GZYXCMJH.js} +4 -4
- package/dist/{chunk-VFH4SU3M.js → chunk-HRBAXQXF.js} +9 -9
- package/dist/{chunk-2VRZVUM7.js → chunk-ISE5VJP2.js} +6 -6
- package/dist/{chunk-OCMNBOPX.js → chunk-JVHHSKBJ.js} +2 -2
- package/dist/{chunk-3S6L437Q.js → chunk-K3H4EQHV.js} +4 -4
- package/dist/{chunk-KDO7D46L.js → chunk-KJRUC2QY.js} +3 -3
- package/dist/{chunk-Z6ZMWFNV.js → chunk-LA3X5A3U.js} +6 -8
- package/dist/{chunk-Z6ZMWFNV.js.map → chunk-LA3X5A3U.js.map} +1 -1
- package/dist/{chunk-PSUJZUYX.js → chunk-LM2T5OR3.js} +3 -2
- package/dist/{chunk-UBOKRHNV.js → chunk-MKJH2D4V.js} +2 -2
- package/dist/{chunk-NWOCQVSL.js → chunk-MR7XFKTK.js} +7 -7
- package/dist/{chunk-Z7I6DQAR.js → chunk-N4W34U3I.js} +42 -9
- package/dist/chunk-N4W34U3I.js.map +1 -0
- package/dist/{chunk-PCNNW63Z.js → chunk-NFWSJFYY.js} +2 -2
- package/dist/{chunk-TIG7NHVO.js → chunk-NKIZLEO2.js} +21 -9
- package/dist/chunk-NKIZLEO2.js.map +1 -0
- package/dist/{chunk-353ZINJ2.js → chunk-NXN7B3BE.js} +3 -3
- package/dist/{chunk-3XG23PLG.js → chunk-O36SFV5G.js} +13 -3
- package/dist/{chunk-3XG23PLG.js.map → chunk-O36SFV5G.js.map} +1 -1
- package/dist/{chunk-2MAZV5KS.js → chunk-O5ZJY5BT.js} +16 -3
- package/dist/chunk-O5ZJY5BT.js.map +1 -0
- package/dist/{chunk-WY7QZ2P7.js → chunk-O6UWELSS.js} +2 -2
- package/dist/{chunk-WVV54JP3.js → chunk-OAP7XYNK.js} +53 -53
- package/dist/{chunk-AHI2WVWP.js → chunk-OYLUYJTY.js} +8 -8
- package/dist/{chunk-PHGVVFTF.js → chunk-PJGAPVK4.js} +108 -133
- package/dist/chunk-PJGAPVK4.js.map +1 -0
- package/dist/{chunk-RJUMLWXP.js → chunk-PTYM27VH.js} +114 -18
- package/dist/chunk-PTYM27VH.js.map +1 -0
- package/dist/{chunk-Y7T73SAP.js → chunk-RUYTU2WJ.js} +7 -3
- package/dist/chunk-RUYTU2WJ.js.map +1 -0
- package/dist/{chunk-5R5JEQW7.js → chunk-SFMIDVB7.js} +17 -12
- package/dist/chunk-SFMIDVB7.js.map +1 -0
- package/dist/{chunk-GZGJQKQT.js → chunk-SKRVI3Z4.js} +2 -2
- package/dist/{chunk-E7WPTSHQ.js → chunk-UJ2GAHAZ.js} +11 -11
- package/dist/{chunk-4O4VQQEA.js → chunk-VJ5XMYXE.js} +3 -3
- package/dist/{chunk-IDQVTWLX.js → chunk-VRTOALU3.js} +5 -5
- package/dist/chunk-WAIFKHD6.js +9 -0
- package/dist/{chunk-LJKF73JB.js → chunk-WDL6ANZ3.js} +3 -3
- package/dist/{chunk-F3PEUOTP.js → chunk-WGKU5PPI.js} +2 -2
- package/dist/{chunk-JVBIWU7S.js → chunk-X5RHYVXY.js} +3 -3
- package/dist/{chunk-RQFHA5BM.js → chunk-YKQLHFY4.js} +43 -8
- package/dist/chunk-YKQLHFY4.js.map +1 -0
- package/dist/{chunk-FSQJOZS4.js → chunk-ZI7XN4VD.js} +9 -9
- package/dist/{cleanup-M5TY4FQS.js → cleanup-OMYTNUP4.js} +35 -35
- package/dist/{cli-446A536X.js → cli-G7EUXIPW.js} +5 -5
- package/dist/{command-hook-installer-7Q7UD7AU.js → command-hook-installer-GMQ4IVDE.js} +3 -3
- package/dist/{config-JLORGUXN.js → config-YO5QGP3B.js} +11 -11
- package/dist/{diff-4O5HXNZ7.js → diff-LIG47TN7.js} +12 -12
- package/dist/{digest-IAAZXJCC.js → digest-FMSWN4A6.js} +11 -11
- package/dist/{fork-ULJYPEKY.js → fork-A7U7AM4M.js} +32 -32
- package/dist/{history-JFZF22M7.js → history-NMHRGJ76.js} +9 -9
- package/dist/{hook-UYOIQVJ7.js → hook-NDETZUEC.js} +17 -17
- package/dist/{hydrate-DROI4RJ7.js → hydrate-ZTKYATH3.js} +10 -10
- package/dist/{init-FF75CQM7.js → init-MMJF5ZVJ.js} +16 -16
- package/dist/{install-skills-XSAHNBYD.js → install-skills-KS6N4U6L.js} +8 -8
- package/dist/install-skills-bin.js +7 -7
- package/dist/{list-5FEHBP6N.js → list-Z77M43EU.js} +9 -9
- package/dist/{move-422L6PPI.js → move-YQIYXSFQ.js} +20 -20
- package/dist/{note-AAXPD5VA.js → note-C5SVIML6.js} +13 -13
- package/dist/{overlaps-WPNUYOFF.js → overlaps-ARNCAXUT.js} +16 -16
- package/dist/{pin-QXPF23BB.js → pin-D4J3XXDU.js} +13 -13
- package/dist/{pr-QLGXPKPQ.js → pr-VMDNT4T7.js} +24 -24
- package/dist/{prune-GRHKRRVT.js → prune-XKMNAY7O.js} +33 -33
- package/dist/{pty-host-XDDXA4SL.js → pty-host-FVXJRFSL.js} +59 -21
- package/dist/pty-host-FVXJRFSL.js.map +1 -0
- package/dist/{read-YWKD2DGP.js → read-PWWKV66E.js} +12 -12
- package/dist/{recent-SI5BDVVH.js → recent-C4ZH75KK.js} +17 -17
- package/dist/{remove-RXXCHY44.js → remove-QFZ4YGVH.js} +32 -32
- package/dist/{restart-CPNDEXU6.js → restart-NZ2QYWA4.js} +12 -12
- package/dist/{resume-BLP4TTJK.js → resume-PRMBJOOG.js} +17 -17
- package/dist/{review-now-ADWZPELT.js → review-now-HHQIBVUS.js} +5 -5
- package/dist/{run-JFCDJ3EV.js → run-LUXAB6F5.js} +9 -9
- package/dist/{screen-LBOPAUXV.js → screen-PJJEEXVP.js} +12 -12
- package/dist/{search-AMEGRH24.js → search-4HW2HAPD.js} +9 -9
- package/dist/{section-73Z34PVE.js → section-PWWC2XPV.js} +13 -13
- package/dist/{send-IZBSEET5.js → send-JZMFXJ2B.js} +13 -13
- package/dist/{sessions-WVQ2U2W4.js → sessions-KQOSJ3OP.js} +28 -28
- package/dist/{snooze-7IBHY5MY.js → snooze-ZMYLNEVQ.js} +12 -12
- package/dist/{start-AU62TW6M.js → start-L2S4FTDD.js} +12 -12
- package/dist/{state-IZV7DAPL.js → state-BR43ONIH.js} +15 -6
- package/dist/state-BR43ONIH.js.map +1 -0
- package/dist/{status-Z7OMNYZX.js → status-N4WDRKZP.js} +14 -14
- package/dist/{statusline-VJFY7ZAB.js → statusline-WKKYCH7O.js} +5 -5
- package/dist/{statusline-hook-JA7MNE5H.js → statusline-hook-K7KPN2H6.js} +3 -3
- package/dist/{stop-PWNXSFBD.js → stop-IMXPEISI.js} +12 -12
- package/dist/{sync-2BTZVDDG.js → sync-5Q5FLL2B.js} +33 -33
- package/dist/{time-CTCIAXIY.js → time-ZK7RLSJI.js} +14 -14
- package/dist/{time-actions-UYBOXET6.js → time-actions-YOXF5WC7.js} +5 -5
- package/dist/{timesheet-BUFQ34FC.js → timesheet-73FNOA42.js} +16 -16
- package/dist/{todo-2R7VID57.js → todo-TALKJYK6.js} +5 -5
- package/dist/{tree-LQDPAXQA.js → tree-S2TMFTUZ.js} +32 -33
- package/dist/{tree-LQDPAXQA.js.map → tree-S2TMFTUZ.js.map} +1 -1
- package/dist/{update-2IYJHY7H.js → update-WZJ7B3QA.js} +19 -19
- package/dist/{usage-IR5GNF4R.js → usage-LQVXS6YO.js} +11 -11
- package/dist/{version-ONEI52TI.js → version-TVT6GSRF.js} +5 -5
- package/dist/{wait-6DH34L53.js → wait-AQGROBL7.js} +13 -13
- package/dist/wd-bin.js +4 -4
- package/dist/web/assets/PtyView-Bx7qpA8Y.js +96 -0
- package/dist/web/assets/PtyView-Bx7qpA8Y.js.map +1 -0
- package/dist/web/assets/index-CpqiTeqj.css +1 -0
- package/dist/web/assets/index-CxSvivCX.js +126 -0
- package/dist/web/assets/index-CxSvivCX.js.map +1 -0
- package/dist/web/index.html +2 -2
- package/dist/{web-RIHGV7YY.js → web-AKDU7HMP.js} +3735 -2713
- package/dist/web-AKDU7HMP.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/dist/chunk-27LWL6QE.js.map +0 -1
- package/dist/chunk-2MAZV5KS.js.map +0 -1
- package/dist/chunk-46XSWHCQ.js.map +0 -1
- package/dist/chunk-4TTYEMOY.js.map +0 -1
- package/dist/chunk-5R5JEQW7.js.map +0 -1
- package/dist/chunk-66VPQOVZ.js.map +0 -1
- package/dist/chunk-7S2NQRWL.js +0 -9
- package/dist/chunk-AQP6SCCJ.js +0 -66
- package/dist/chunk-AQP6SCCJ.js.map +0 -1
- package/dist/chunk-E67DOUVU.js.map +0 -1
- package/dist/chunk-IFQOOCT7.js.map +0 -1
- package/dist/chunk-L22AWXWA.js +0 -29
- package/dist/chunk-L22AWXWA.js.map +0 -1
- package/dist/chunk-PHGVVFTF.js.map +0 -1
- package/dist/chunk-RJUMLWXP.js.map +0 -1
- package/dist/chunk-RQFHA5BM.js.map +0 -1
- package/dist/chunk-TIG7NHVO.js.map +0 -1
- package/dist/chunk-V4U5RGEG.js.map +0 -1
- package/dist/chunk-Y7T73SAP.js.map +0 -1
- package/dist/chunk-Z7I6DQAR.js.map +0 -1
- package/dist/chunk-ZXHMC7UO.js.map +0 -1
- package/dist/pty-host-XDDXA4SL.js.map +0 -1
- package/dist/state-IZV7DAPL.js.map +0 -1
- package/dist/web/assets/PtyView-kBcAOwHr.js +0 -96
- package/dist/web/assets/PtyView-kBcAOwHr.js.map +0 -1
- package/dist/web/assets/index-BgfR3N99.js +0 -124
- package/dist/web/assets/index-BgfR3N99.js.map +0 -1
- package/dist/web/assets/index-CKpHjII8.css +0 -1
- package/dist/web-RIHGV7YY.js.map +0 -1
- /package/dist/{account-QSNXX5YV.js.map → account-QZH4MA42.js.map} +0 -0
- /package/dist/{add-repo-YZ32MLZG.js.map → add-repo-CAQSJPLG.js.map} +0 -0
- /package/dist/{answer-Y4T5X446.js.map → answer-3QIKCVON.js.map} +0 -0
- /package/dist/{attach-XPYWYHDP.js.map → attach-GR3AD4D7.js.map} +0 -0
- /package/dist/{broadcast-FATIANHX.js.map → broadcast-WW6DBVZ3.js.map} +0 -0
- /package/dist/{catchup-OTI2KZG5.js.map → catchup-RMYAFVK3.js.map} +0 -0
- /package/dist/{chunk-VV3NFLLP.js.map → chunk-26YZYL77.js.map} +0 -0
- /package/dist/{chunk-UP2JTDBI.js.map → chunk-32VFZGPR.js.map} +0 -0
- /package/dist/{chunk-ZRATYLBB.js.map → chunk-33XSEAHO.js.map} +0 -0
- /package/dist/{chunk-MM7344RC.js.map → chunk-4CNBSPNL.js.map} +0 -0
- /package/dist/{chunk-RHDZPV6C.js.map → chunk-4EL7FVQQ.js.map} +0 -0
- /package/dist/{chunk-FMLE2WSN.js.map → chunk-4IRPL6XA.js.map} +0 -0
- /package/dist/{chunk-BNKVENDF.js.map → chunk-4NUWTGAP.js.map} +0 -0
- /package/dist/{chunk-KL4YYV37.js.map → chunk-5FBRQW2F.js.map} +0 -0
- /package/dist/{chunk-JNCKZ3OF.js.map → chunk-63FTAMDO.js.map} +0 -0
- /package/dist/{chunk-WKOJ7NXD.js.map → chunk-6RMB3I3V.js.map} +0 -0
- /package/dist/{chunk-6J6U7JXN.js.map → chunk-6YZBMC35.js.map} +0 -0
- /package/dist/{chunk-3BSFVKMK.js.map → chunk-7DUGVGUZ.js.map} +0 -0
- /package/dist/{chunk-IOHK45WE.js.map → chunk-7OFVXQSM.js.map} +0 -0
- /package/dist/{chunk-34E2LA3M.js.map → chunk-A6N4FF4K.js.map} +0 -0
- /package/dist/{chunk-RCGFHJM7.js.map → chunk-CBCOVIXZ.js.map} +0 -0
- /package/dist/{chunk-ICXUTMGH.js.map → chunk-DGVCN7HB.js.map} +0 -0
- /package/dist/{chunk-B5WDN63X.js.map → chunk-DMGNJ73M.js.map} +0 -0
- /package/dist/{chunk-LZZCJAJQ.js.map → chunk-DTUKXBAR.js.map} +0 -0
- /package/dist/{chunk-2K5TDJ7M.js.map → chunk-FI2HURCM.js.map} +0 -0
- /package/dist/{chunk-2HHIDWHH.js.map → chunk-FJQT7OWV.js.map} +0 -0
- /package/dist/{chunk-LKESANVD.js.map → chunk-FNA27U2B.js.map} +0 -0
- /package/dist/{chunk-6YMLYU5G.js.map → chunk-FZJ472VJ.js.map} +0 -0
- /package/dist/{chunk-ADIN3DTD.js.map → chunk-GG4VKPAX.js.map} +0 -0
- /package/dist/{chunk-V7GCYL6A.js.map → chunk-GOK6JBB2.js.map} +0 -0
- /package/dist/{chunk-IKX3B26P.js.map → chunk-GZYXCMJH.js.map} +0 -0
- /package/dist/{chunk-VFH4SU3M.js.map → chunk-HRBAXQXF.js.map} +0 -0
- /package/dist/{chunk-2VRZVUM7.js.map → chunk-ISE5VJP2.js.map} +0 -0
- /package/dist/{chunk-OCMNBOPX.js.map → chunk-JVHHSKBJ.js.map} +0 -0
- /package/dist/{chunk-3S6L437Q.js.map → chunk-K3H4EQHV.js.map} +0 -0
- /package/dist/{chunk-KDO7D46L.js.map → chunk-KJRUC2QY.js.map} +0 -0
- /package/dist/{chunk-PSUJZUYX.js.map → chunk-LM2T5OR3.js.map} +0 -0
- /package/dist/{chunk-UBOKRHNV.js.map → chunk-MKJH2D4V.js.map} +0 -0
- /package/dist/{chunk-NWOCQVSL.js.map → chunk-MR7XFKTK.js.map} +0 -0
- /package/dist/{chunk-PCNNW63Z.js.map → chunk-NFWSJFYY.js.map} +0 -0
- /package/dist/{chunk-353ZINJ2.js.map → chunk-NXN7B3BE.js.map} +0 -0
- /package/dist/{chunk-WY7QZ2P7.js.map → chunk-O6UWELSS.js.map} +0 -0
- /package/dist/{chunk-WVV54JP3.js.map → chunk-OAP7XYNK.js.map} +0 -0
- /package/dist/{chunk-AHI2WVWP.js.map → chunk-OYLUYJTY.js.map} +0 -0
- /package/dist/{chunk-GZGJQKQT.js.map → chunk-SKRVI3Z4.js.map} +0 -0
- /package/dist/{chunk-E7WPTSHQ.js.map → chunk-UJ2GAHAZ.js.map} +0 -0
- /package/dist/{chunk-4O4VQQEA.js.map → chunk-VJ5XMYXE.js.map} +0 -0
- /package/dist/{chunk-IDQVTWLX.js.map → chunk-VRTOALU3.js.map} +0 -0
- /package/dist/{chunk-7S2NQRWL.js.map → chunk-WAIFKHD6.js.map} +0 -0
- /package/dist/{chunk-LJKF73JB.js.map → chunk-WDL6ANZ3.js.map} +0 -0
- /package/dist/{chunk-F3PEUOTP.js.map → chunk-WGKU5PPI.js.map} +0 -0
- /package/dist/{chunk-JVBIWU7S.js.map → chunk-X5RHYVXY.js.map} +0 -0
- /package/dist/{chunk-FSQJOZS4.js.map → chunk-ZI7XN4VD.js.map} +0 -0
- /package/dist/{cleanup-M5TY4FQS.js.map → cleanup-OMYTNUP4.js.map} +0 -0
- /package/dist/{cli-446A536X.js.map → cli-G7EUXIPW.js.map} +0 -0
- /package/dist/{command-hook-installer-7Q7UD7AU.js.map → command-hook-installer-GMQ4IVDE.js.map} +0 -0
- /package/dist/{config-JLORGUXN.js.map → config-YO5QGP3B.js.map} +0 -0
- /package/dist/{diff-4O5HXNZ7.js.map → diff-LIG47TN7.js.map} +0 -0
- /package/dist/{digest-IAAZXJCC.js.map → digest-FMSWN4A6.js.map} +0 -0
- /package/dist/{fork-ULJYPEKY.js.map → fork-A7U7AM4M.js.map} +0 -0
- /package/dist/{history-JFZF22M7.js.map → history-NMHRGJ76.js.map} +0 -0
- /package/dist/{hook-UYOIQVJ7.js.map → hook-NDETZUEC.js.map} +0 -0
- /package/dist/{hydrate-DROI4RJ7.js.map → hydrate-ZTKYATH3.js.map} +0 -0
- /package/dist/{init-FF75CQM7.js.map → init-MMJF5ZVJ.js.map} +0 -0
- /package/dist/{install-skills-XSAHNBYD.js.map → install-skills-KS6N4U6L.js.map} +0 -0
- /package/dist/{list-5FEHBP6N.js.map → list-Z77M43EU.js.map} +0 -0
- /package/dist/{move-422L6PPI.js.map → move-YQIYXSFQ.js.map} +0 -0
- /package/dist/{note-AAXPD5VA.js.map → note-C5SVIML6.js.map} +0 -0
- /package/dist/{overlaps-WPNUYOFF.js.map → overlaps-ARNCAXUT.js.map} +0 -0
- /package/dist/{pin-QXPF23BB.js.map → pin-D4J3XXDU.js.map} +0 -0
- /package/dist/{pr-QLGXPKPQ.js.map → pr-VMDNT4T7.js.map} +0 -0
- /package/dist/{prune-GRHKRRVT.js.map → prune-XKMNAY7O.js.map} +0 -0
- /package/dist/{read-YWKD2DGP.js.map → read-PWWKV66E.js.map} +0 -0
- /package/dist/{recent-SI5BDVVH.js.map → recent-C4ZH75KK.js.map} +0 -0
- /package/dist/{remove-RXXCHY44.js.map → remove-QFZ4YGVH.js.map} +0 -0
- /package/dist/{restart-CPNDEXU6.js.map → restart-NZ2QYWA4.js.map} +0 -0
- /package/dist/{resume-BLP4TTJK.js.map → resume-PRMBJOOG.js.map} +0 -0
- /package/dist/{review-now-ADWZPELT.js.map → review-now-HHQIBVUS.js.map} +0 -0
- /package/dist/{run-JFCDJ3EV.js.map → run-LUXAB6F5.js.map} +0 -0
- /package/dist/{screen-LBOPAUXV.js.map → screen-PJJEEXVP.js.map} +0 -0
- /package/dist/{search-AMEGRH24.js.map → search-4HW2HAPD.js.map} +0 -0
- /package/dist/{section-73Z34PVE.js.map → section-PWWC2XPV.js.map} +0 -0
- /package/dist/{send-IZBSEET5.js.map → send-JZMFXJ2B.js.map} +0 -0
- /package/dist/{sessions-WVQ2U2W4.js.map → sessions-KQOSJ3OP.js.map} +0 -0
- /package/dist/{snooze-7IBHY5MY.js.map → snooze-ZMYLNEVQ.js.map} +0 -0
- /package/dist/{start-AU62TW6M.js.map → start-L2S4FTDD.js.map} +0 -0
- /package/dist/{status-Z7OMNYZX.js.map → status-N4WDRKZP.js.map} +0 -0
- /package/dist/{statusline-VJFY7ZAB.js.map → statusline-WKKYCH7O.js.map} +0 -0
- /package/dist/{statusline-hook-JA7MNE5H.js.map → statusline-hook-K7KPN2H6.js.map} +0 -0
- /package/dist/{stop-PWNXSFBD.js.map → stop-IMXPEISI.js.map} +0 -0
- /package/dist/{sync-2BTZVDDG.js.map → sync-5Q5FLL2B.js.map} +0 -0
- /package/dist/{time-CTCIAXIY.js.map → time-ZK7RLSJI.js.map} +0 -0
- /package/dist/{time-actions-UYBOXET6.js.map → time-actions-YOXF5WC7.js.map} +0 -0
- /package/dist/{timesheet-BUFQ34FC.js.map → timesheet-73FNOA42.js.map} +0 -0
- /package/dist/{todo-2R7VID57.js.map → todo-TALKJYK6.js.map} +0 -0
- /package/dist/{update-2IYJHY7H.js.map → update-WZJ7B3QA.js.map} +0 -0
- /package/dist/{usage-IR5GNF4R.js.map → usage-LQVXS6YO.js.map} +0 -0
- /package/dist/{version-ONEI52TI.js.map → version-TVT6GSRF.js.map} +0 -0
- /package/dist/{wait-6DH34L53.js.map → wait-AQGROBL7.js.map} +0 -0
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
noteBranchFacts,
|
|
7
7
|
readSessionBranches,
|
|
8
8
|
repoNameOf
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-3OAW37JA.js";
|
|
10
10
|
import {
|
|
11
11
|
defaultRunner
|
|
12
12
|
} from "./chunk-KSVYR4G2.js";
|
|
@@ -15,10 +15,10 @@ import {
|
|
|
15
15
|
checkedOutBranch,
|
|
16
16
|
logSwallowed,
|
|
17
17
|
stageOfPr
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-3SBQIJQS.js";
|
|
19
19
|
import {
|
|
20
20
|
sessionIdFor
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-RUYTU2WJ.js";
|
|
22
22
|
|
|
23
23
|
// src/core/stacks/branch-facts.ts
|
|
24
24
|
async function repoBase(repo, run = defaultRunner) {
|
|
@@ -38,7 +38,16 @@ async function branchFacts(repo, name, run = defaultRunner, base) {
|
|
|
38
38
|
const main = base === void 0 ? await repoBase(repo, run) : base;
|
|
39
39
|
const commits = main ? count(await git("rev-list", "--count", `${main}..${local}`)) : null;
|
|
40
40
|
const unpushed = pushed ? count(await git("rev-list", "--count", `${remote}..${local}`)) : commits;
|
|
41
|
-
|
|
41
|
+
const isBase = !!main && main === `origin/${name}`;
|
|
42
|
+
return {
|
|
43
|
+
exists,
|
|
44
|
+
sha: tip.stdout.trim() || null,
|
|
45
|
+
pushed,
|
|
46
|
+
commits,
|
|
47
|
+
unpushed,
|
|
48
|
+
merged: !isBase && pushed && commits === 0,
|
|
49
|
+
...isBase ? { base: true } : {}
|
|
50
|
+
};
|
|
42
51
|
}
|
|
43
52
|
var factsKey = (repo, name) => `${repo}\0${name}`;
|
|
44
53
|
var BranchFactsCache = class {
|
|
@@ -126,8 +135,11 @@ function branchesWire(rec, current, facts, ci, now) {
|
|
|
126
135
|
const rows = [];
|
|
127
136
|
for (const b of rec.branches) {
|
|
128
137
|
const pr = prOfBranch(ci, b.repo, b.name);
|
|
129
|
-
if (branchHidden(b, now, pr?.state === "MERGED")) continue;
|
|
130
138
|
const f = facts.get(factsKey(b.repo, b.name));
|
|
139
|
+
const merged = f ? pr?.state === "MERGED" || !(f.exists && (f.base || (f.commits ?? 0) > 0)) && (f.merged || !!b.merged) : !!b.merged || pr?.state === "MERGED";
|
|
140
|
+
const { merged: _kept, ...rest } = b;
|
|
141
|
+
const seen = { ...rest, ...merged ? { merged: true } : {} };
|
|
142
|
+
if (branchHidden(seen, now, false, current(b.repo) === b.name)) continue;
|
|
131
143
|
rows.push({
|
|
132
144
|
repo: b.repo,
|
|
133
145
|
name: b.name,
|
|
@@ -140,8 +152,8 @@ function branchesWire(rec, current, facts, ci, now) {
|
|
|
140
152
|
pushed: f.pushed,
|
|
141
153
|
commits: f.commits,
|
|
142
154
|
unpushed: f.unpushed,
|
|
143
|
-
merged
|
|
144
|
-
} :
|
|
155
|
+
merged
|
|
156
|
+
} : merged ? { merged: true } : {},
|
|
145
157
|
...pr ? { pr: { number: pr.number, url: pr.url, state: pr.state, kind: stageOfPr(pr) } } : {}
|
|
146
158
|
});
|
|
147
159
|
}
|
|
@@ -198,7 +210,7 @@ function createSessionBranches(opts = {}) {
|
|
|
198
210
|
function branchJobs(s, rec, now) {
|
|
199
211
|
if (!rec?.branches.length) return null;
|
|
200
212
|
const currentOf = new Map(s.paths.map((p) => [repoNameOf(s, p), checkedOutBranch(p)]));
|
|
201
|
-
const visible = rec.branches.filter((b) => !branchHidden(b, now));
|
|
213
|
+
const visible = rec.branches.filter((b) => !branchHidden(b, now, false, currentOf.get(b.repo) === b.name));
|
|
202
214
|
const repos = new Set(visible.map((b) => b.repo));
|
|
203
215
|
if (![...repos].some((r) => visible.filter((b) => b.repo === r).length > 1)) return null;
|
|
204
216
|
const pathOf = new Map(s.paths.map((p) => [repoNameOf(s, p), p]));
|
|
@@ -228,4 +240,4 @@ export {
|
|
|
228
240
|
createSessionBranches,
|
|
229
241
|
sessionBranchesNow
|
|
230
242
|
};
|
|
231
|
-
//# sourceMappingURL=chunk-
|
|
243
|
+
//# sourceMappingURL=chunk-NKIZLEO2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/stacks/branch-facts.ts"],"sourcesContent":["import { defaultRunner, type CommandRunner } from '../platform/command-runner.js';\nimport { bestEffort, logSwallowed } from '../platform/best-effort.js';\nimport type { SessionBranchWire, SessionCi, ShipPr } from '../api-types.js';\nimport { stageOfPr } from '../pr/pr-stage.js';\nimport {\n backfillSessionBranches,\n branchHidden,\n MAX_WATCHED_BRANCHES,\n noteBranchFacts,\n readSessionBranches,\n repoNameOf,\n type SessionBranches,\n} from '../sessions/session-branches.js';\nimport { checkedOutBranch } from '../git/git-head.js';\nimport { sessionIdFor } from '../sessions/session-id.js';\nimport type { WorktreeSession } from '../sessions/session-types.js';\n\n/**\n * What a session's other branches hold (session-branches.ts records them):\n * still there, pushed, how many commits its base lacks, how many origin\n * lacks, merged. Git through a CommandRunner (argv only), a few runs per\n * branch — so read in the background (BranchFactsCache, beside behind-main's)\n * and by the PR watch's preflight, never on a request's path.\n */\n\nexport interface BranchFacts {\n exists: boolean;\n /** Its tip, when it exists. */\n sha: string | null;\n /** `origin/<name>` exists. */\n pushed: boolean;\n /** Commits on it that its base (origin/HEAD) doesn't have; null: unknown. */\n commits: number | null;\n /** Commits on it that origin doesn't have (all of `commits` when never pushed); null: unknown. */\n unpushed: number | null;\n /** Its commits are all in its base, and it was pushed (a branch merged the usual way). Never the base itself. */\n merged: boolean;\n /** It is the repo's main line itself (`main` when origin/HEAD is origin/main): never \"merged\" into itself. */\n base?: true;\n}\n\n/** The repo's main line (`origin/main`), as origin/HEAD names it; null when it doesn't. */\nexport async function repoBase(repo: string, run: CommandRunner = defaultRunner): Promise<string | null> {\n const head = await run('git', ['-C', repo, 'rev-parse', '--abbrev-ref', 'origin/HEAD'], repo);\n const base = head.code === 0 ? head.stdout.trim() : '';\n return base && base !== 'origin/HEAD' ? base : null;\n}\n\nconst count = (out: { code: number; stdout: string }) =>\n out.code === 0 && /^\\d+$/.test(out.stdout.trim()) ? Number(out.stdout.trim()) : null;\n\n/** One branch of one repo. `base`: the repo's main line (repoBase), passed so a repo's branches ask it once. */\nexport async function branchFacts(\n repo: string,\n name: string,\n run: CommandRunner = defaultRunner,\n base?: string | null,\n): Promise<BranchFacts> {\n const git = (...args: string[]) => run('git', ['-C', repo, ...args], repo);\n const local = `refs/heads/${name}`;\n const remote = `refs/remotes/origin/${name}`;\n const tip = await git('rev-parse', '--verify', '--quiet', local);\n const exists = tip.code === 0;\n const pushed = (await git('rev-parse', '--verify', '--quiet', remote)).code === 0;\n if (!exists) return { exists, sha: null, pushed, commits: null, unpushed: null, merged: false };\n const main = base === undefined ? await repoBase(repo, run) : base;\n const commits = main ? count(await git('rev-list', '--count', `${main}..${local}`)) : null;\n const unpushed = pushed ? count(await git('rev-list', '--count', `${remote}..${local}`)) : commits;\n // The main line itself is level with origin/main whenever it's pushed: that isn't a merge (it read \"merged\").\n const isBase = !!main && main === `origin/${name}`;\n return {\n exists,\n sha: tip.stdout.trim() || null,\n pushed,\n commits,\n unpushed,\n merged: !isBase && pushed && commits === 0,\n ...(isBase ? { base: true as const } : {}),\n };\n}\n\n/** A repo's other branches to look at: by name, in its checkout. */\nexport interface BranchJob {\n repo: string;\n path: string;\n name: string;\n}\n\nexport const factsKey = (repo: string, name: string) => `${repo}\\u0000${name}`;\n\n/**\n * Per session, refreshed in the background a couple of sessions at a time;\n * reads never wait (BehindCache's way). `onFacts`: what a look found, to keep\n * (a branch seen deleted, or merged: session-branches.ts `noteBranchFacts`).\n */\nexport class BranchFactsCache {\n private readonly entries = new Map<string, { value: Map<string, BranchFacts>; at: number; inFlight: boolean; key: string }>();\n private running = 0;\n private readonly queue: Array<{ id: string; jobs: BranchJob[] }> = [];\n\n constructor(\n private readonly opts: {\n ttlMs?: number;\n concurrency?: number;\n run?: CommandRunner;\n onChange?: () => void;\n onFacts?: (id: string, facts: Array<BranchJob & BranchFacts>) => void;\n now?: () => number;\n } = {},\n ) {}\n\n /** What the last look found (an empty map before the first); schedules one when stale or the branches changed. */\n get(id: string, jobs: BranchJob[]): Map<string, BranchFacts> {\n const now = (this.opts.now ?? Date.now)();\n const key = jobs.map((j) => factsKey(j.repo, j.name)).join('|');\n const e = this.entries.get(id);\n const moved = !!e && e.key !== key;\n if (!e || moved || (!e.inFlight && now - e.at > (this.opts.ttlMs ?? 5 * 60_000))) this.schedule(id, jobs, key);\n return this.entries.get(id)?.value ?? new Map();\n }\n\n /** Look again soon (a turn ended, a push). */\n invalidate(id: string): void {\n const e = this.entries.get(id);\n if (e) e.at = 0;\n }\n\n async idle(): Promise<void> {\n while (this.running > 0 || this.queue.length > 0) await new Promise((r) => setTimeout(r, 5));\n }\n\n private schedule(id: string, jobs: BranchJob[], key: string): void {\n const e = this.entries.get(id) ?? { value: new Map<string, BranchFacts>(), at: 0, inFlight: false, key };\n if (e.inFlight && e.key === key) return;\n e.inFlight = true;\n e.key = key;\n this.entries.set(id, e);\n this.queue.push({ id, jobs });\n this.pump();\n }\n\n private pump(): void {\n while (this.running < (this.opts.concurrency ?? 2) && this.queue.length > 0) {\n const job = this.queue.shift()!;\n this.running++;\n void lookAt(job.jobs, this.opts.run)\n .catch((err) => {\n logSwallowed(`branch facts for ${job.id}`, err);\n return null;\n })\n .then((found) => {\n const e = this.entries.get(job.id)!;\n e.inFlight = false;\n e.at = (this.opts.now ?? Date.now)();\n if (!found) return;\n const value = new Map(found.map((f) => [factsKey(f.repo, f.name), strip(f)]));\n const changed = JSON.stringify([...e.value]) !== JSON.stringify([...value]);\n e.value = value;\n this.opts.onFacts?.(job.id, found);\n if (changed) this.opts.onChange?.();\n })\n .finally(() => {\n this.running--;\n this.pump();\n });\n }\n }\n}\n\nconst strip = (f: BranchJob & BranchFacts): BranchFacts => ({\n exists: f.exists,\n sha: f.sha,\n pushed: f.pushed,\n commits: f.commits,\n unpushed: f.unpushed,\n merged: f.merged,\n});\n\nasync function lookAt(jobs: BranchJob[], run?: CommandRunner): Promise<Array<BranchJob & BranchFacts>> {\n const bases = new Map<string, string | null>();\n const out: Array<BranchJob & BranchFacts> = [];\n for (const j of jobs) {\n if (!bases.has(j.path)) bases.set(j.path, await repoBase(j.path, run));\n out.push({ ...j, ...(await branchFacts(j.path, j.name, run, bases.get(j.path))) });\n }\n return out;\n}\n\n/** The PR of a repo's branch, from the PR watch's last check: the checked-out one's, or another's. */\nexport function prOfBranch(ci: SessionCi | null | undefined, repo: string, name: string): ShipPr | null {\n const r = ci?.repos.find((x) => x.name === repo);\n if (!r) return null;\n if (r.branch === name && r.pr) return r.pr;\n return r.otherPrs?.find((o) => o.branch === name)?.pr ?? null;\n}\n\n/**\n * The branches a session's row shows: every recorded one not hidden (merged\n * and deleted a while ago), each with its facts and PR, the checked-out ones\n * first, the rest newest first. Null unless some repo has been on more than\n * one: a session that stayed on its branch shows nothing new. Pure.\n */\nexport function branchesWire(\n rec: SessionBranches | null | undefined,\n current: (repo: string) => string | null,\n facts: Map<string, BranchFacts>,\n ci: SessionCi | null | undefined,\n now: number,\n): SessionBranchWire[] | null {\n if (!rec?.branches.length) return null;\n const rows: SessionBranchWire[] = [];\n for (const b of rec.branches) {\n const pr = prOfBranch(ci, b.repo, b.name);\n const f = facts.get(factsKey(b.repo, b.name));\n // Merged as kept once seen — unless the branch, there now, has work of its own again (commits its base\n // lacks) or is the main line itself: a repo's own main read \"6 commits · 6 not pushed · merged\". Its PR\n // merged still says so (a squash merge leaves its commits unmerged).\n const merged = f\n ? pr?.state === 'MERGED' || (!(f.exists && (f.base || (f.commits ?? 0) > 0)) && (f.merged || !!b.merged))\n : !!b.merged || pr?.state === 'MERGED';\n // Hidden by its merged as shown (a branch with work of its own again isn't done), deleted as the record says.\n const { merged: _kept, ...rest } = b;\n const seen = { ...rest, ...(merged ? { merged: true as const } : {}) };\n if (branchHidden(seen, now, false, current(b.repo) === b.name)) continue;\n rows.push({\n repo: b.repo,\n name: b.name,\n current: current(b.repo) === b.name,\n firstSeen: b.firstSeen,\n lastSeen: b.lastSeen,\n ...(b.from ? { from: b.from } : {}),\n ...(f\n ? {\n exists: f.exists,\n pushed: f.pushed,\n commits: f.commits,\n unpushed: f.unpushed,\n merged,\n }\n : merged\n ? { merged: true }\n : {}),\n ...(pr ? { pr: { number: pr.number, url: pr.url, state: pr.state, kind: stageOfPr(pr) } } : {}),\n });\n }\n const repos = new Set(rows.map((r) => r.repo));\n if (![...repos].some((repo) => rows.filter((r) => r.repo === repo).length > 1)) return null;\n return rows.sort(\n (a, b) => Number(b.current) - Number(a.current) || Date.parse(b.lastSeen) - Date.parse(a.lastSeen) || a.repo.localeCompare(b.repo),\n );\n}\n\n/**\n * The sessions list's branches (work web): each row's recorded branches with\n * their facts — read in the background (BranchFactsCache), what it finds kept\n * (deleted, merged, pushed once) — and, once per session recorded before the\n * list began, its reflog read into the record (backfillSessionBranches), one\n * session at a time, off the request's path. `wire` never runs git.\n */\nexport function createSessionBranches(\n opts: {\n onChange?: () => void;\n run?: CommandRunner;\n now?: () => number;\n /** Tests: the reflog read and the fact keeping (default: session-branches.ts). */\n backfill?: (s: WorktreeSession) => SessionBranches | void;\n keepFacts?: (id: string, facts: Array<BranchJob & BranchFacts>) => void;\n } = {},\n) {\n const now = opts.now ?? Date.now;\n const facts = new BranchFactsCache({\n ...(opts.run ? { run: opts.run } : {}),\n now,\n onChange: opts.onChange,\n onFacts: (id, found) =>\n bestEffort(`keep the branch facts of ${id}`, () => (opts.keepFacts ?? ((sid, f) => noteBranchFacts(sid, f)))(id, found)),\n });\n const backfill = opts.backfill ?? ((s: WorktreeSession) => backfillSessionBranches(s));\n const asked = new Set<string>();\n const waiting: WorktreeSession[] = [];\n let busy = false;\n const pump = () => {\n if (busy) return;\n const s = waiting.shift();\n if (!s) return;\n busy = true;\n setImmediate(() => {\n const rec = bestEffort(`read the branches of ${s.target}:${s.branch} from its reflog`, () => backfill(s));\n busy = false;\n // Only a session that turns out to have worked on more than one branch looks any different.\n if (rec && branchJobs(s, rec, now())) opts.onChange?.();\n pump();\n });\n };\n return {\n /** The row's branches (branchesWire), from what was recorded and last looked at. */\n wire(s: WorktreeSession, rec: SessionBranches | null | undefined, ci: SessionCi | null | undefined): SessionBranchWire[] | null {\n if (s.archivedAt) return null;\n const id = sessionIdFor(s);\n if (!rec?.backfilled && !asked.has(id)) {\n asked.add(id);\n waiting.push(s);\n pump();\n }\n const plan = branchJobs(s, rec, now());\n return plan ? branchesWire(rec, plan.current, facts.get(id, plan.jobs), ci, now()) : null;\n },\n invalidate: (id: string) => facts.invalidate(id),\n async idle(): Promise<void> {\n await facts.idle();\n while (busy || waiting.length) await new Promise((r) => setTimeout(r, 5));\n },\n };\n}\n\n/**\n * What to look at for a session's row: each repo's visible recorded branches (the checked-out one first, then\n * the most recent, at most MAX_WATCHED_BRANCHES others), and what each repo has checked out (HEAD files). Null\n * when no repo has been on more than one branch. No git.\n */\nexport function branchJobs(\n s: Pick<WorktreeSession, 'target' | 'isGroup' | 'paths'>,\n rec: SessionBranches | null | undefined,\n now: number,\n): { jobs: BranchJob[]; current: (repo: string) => string | null } | null {\n if (!rec?.branches.length) return null;\n const currentOf = new Map(s.paths.map((p) => [repoNameOf(s, p), checkedOutBranch(p)]));\n const visible = rec.branches.filter((b) => !branchHidden(b, now, false, currentOf.get(b.repo) === b.name));\n const repos = new Set(visible.map((b) => b.repo));\n if (![...repos].some((r) => visible.filter((b) => b.repo === r).length > 1)) return null;\n const pathOf = new Map(s.paths.map((p) => [repoNameOf(s, p), p]));\n const jobs: BranchJob[] = [];\n for (const repo of repos) {\n const p = pathOf.get(repo);\n if (!p) continue;\n const isCurrent = (name: string) => Number(name === currentOf.get(repo));\n const mine = visible\n .filter((b) => b.repo === repo)\n .sort((a, b) => isCurrent(b.name) - isCurrent(a.name) || Date.parse(b.lastSeen) - Date.parse(a.lastSeen))\n .slice(0, MAX_WATCHED_BRANCHES + 1);\n for (const b of mine) jobs.push({ repo, path: p, name: b.name });\n }\n return { jobs, current: (repo) => currentOf.get(repo) ?? null };\n}\n\n/**\n * The same now, for the CLI (`work sessions --json`, `work status`): the record (read from the reflog first\n * when it never was), each branch looked at with git, the PR from the PR watch's last check. Null when it stayed\n * on one branch.\n */\nexport async function sessionBranchesNow(\n s: WorktreeSession,\n ci: SessionCi | null | undefined,\n run: CommandRunner = defaultRunner,\n now = Date.now(),\n): Promise<SessionBranchWire[] | null> {\n if (s.archivedAt) return null;\n let rec = readSessionBranches(sessionIdFor(s));\n if (!rec?.backfilled) rec = bestEffort(`read the branches of ${s.target}:${s.branch}`, () => backfillSessionBranches(s), rec) ?? rec;\n const plan = branchJobs(s, rec, now);\n if (!plan) return null;\n const found = await lookAt(plan.jobs, run);\n return branchesWire(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AACpC,eAAW,KAAK,KAAM,MAAK,KAAK,EAAE,MAAM,MAAM,GAAG,MAAM,EAAE,KAAK,CAAC;AAAA,EACjE;AACA,SAAO,EAAE,MAAM,SAAS,CAAC,SAAS,UAAU,IAAI,IAAI,KAAK,KAAK;AAChE;AAOA,eAAsB,mBACpB,GACA,IACA,MAAqB,eACrB,MAAM,KAAK,IAAI,GACsB;AACrC,MAAI,EAAE,WAAY,QAAO;AACzB,MAAI,MAAM,oBAAoB,aAAa,CAAC,CAAC;AAC7C,MAAI,CAAC,KAAK,WAAY,OAAM,WAAW,wBAAwB,EAAE,MAAM,IAAI,EAAE,MAAM,IAAI,MAAM,wBAAwB,CAAC,GAAG,GAAG,KAAK;AACjI,QAAM,OAAO,WAAW,GAAG,KAAK,GAAG;AACnC,MAAI,CAAC,KAAM,QAAO;AAClB,QAAM,QAAQ,MAAM,OAAO,KAAK,MAAM,GAAG;AACzC,SAAO,aAAa,KAAK,KAAK,SAAS,IAAI,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG;AACjH;","names":[]}
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
workSteps,
|
|
5
5
|
workedBetween,
|
|
6
6
|
workedByDay
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3SBQIJQS.js";
|
|
8
8
|
import {
|
|
9
9
|
dayKey
|
|
10
10
|
} from "./chunk-NEJVK5CF.js";
|
|
11
11
|
import {
|
|
12
12
|
agentOf
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-N4W34U3I.js";
|
|
14
14
|
|
|
15
15
|
// src/core/conversations/work-time-source.ts
|
|
16
16
|
import fs from "fs";
|
|
@@ -153,4 +153,4 @@ export {
|
|
|
153
153
|
sessionTokens,
|
|
154
154
|
sessionWorkTime
|
|
155
155
|
};
|
|
156
|
-
//# sourceMappingURL=chunk-
|
|
156
|
+
//# sourceMappingURL=chunk-NXN7B3BE.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
PROTOCOL_VERSION,
|
|
4
4
|
readHostInfo
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-BDPRYJL3.js";
|
|
6
6
|
import {
|
|
7
7
|
isPidAlive,
|
|
8
8
|
spawnDetachedWork
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
ensureFile,
|
|
12
12
|
withFileLock
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-D2J3AD6L.js";
|
|
14
14
|
import {
|
|
15
15
|
getConfigDir
|
|
16
16
|
} from "./chunk-6THUVP6T.js";
|
|
@@ -259,6 +259,16 @@ var PtyHostClient = class {
|
|
|
259
259
|
attachUrl(id) {
|
|
260
260
|
return `ws://127.0.0.1:${this.info.port}/ptys/${encodeURIComponent(id)}/attach?token=${this.info.token}`;
|
|
261
261
|
}
|
|
262
|
+
/**
|
|
263
|
+
* The address a dashboard page attaches this terminal at, with a one-time ticket for its origin
|
|
264
|
+
* (terminal-tickets.ts) — never the token. Null from a host without tickets, or one that refused.
|
|
265
|
+
*/
|
|
266
|
+
async ticketUrl(id, origin) {
|
|
267
|
+
if (!(await this.features())?.includes("tickets")) return null;
|
|
268
|
+
const got = await this.call("POST", "/tickets", { id, origin }).catch(() => null);
|
|
269
|
+
const ticket = typeof got?.ticket === "string" ? got.ticket : null;
|
|
270
|
+
return ticket ? `ws://127.0.0.1:${this.info.port}/ptys/${encodeURIComponent(id)}/attach?ticket=${ticket}` : null;
|
|
271
|
+
}
|
|
262
272
|
};
|
|
263
273
|
|
|
264
274
|
export {
|
|
@@ -270,4 +280,4 @@ export {
|
|
|
270
280
|
ensureHost,
|
|
271
281
|
PtyHostClient
|
|
272
282
|
};
|
|
273
|
-
//# sourceMappingURL=chunk-
|
|
283
|
+
//# sourceMappingURL=chunk-O36SFV5G.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/pty/pty-host-client.ts"],"sourcesContent":["import path from 'node:path';\nimport { spawnDetachedWork } from '../platform/process.js';\nimport { getConfigDir } from '../platform/config.js';\nimport { isPidAlive } from '../platform/process.js';\nimport { ensureFile, withFileLock } from '../platform/fs-safe.js';\nimport type { EnvDelta } from '../platform/env-delta.js';\nimport { PROTOCOL_VERSION, readHostInfo, type HostInfo, type PtyInfo, type SpawnSpec } from './pty-host-protocol.js';\n\nexport class PtyHostVersionError extends Error {\n constructor(readonly hostVersion: number) {\n super(\n `A PTY host from an older build (protocol v${hostVersion}, need v${PROTOCOL_VERSION}) ` +\n 'is running. Restart it with `work pty-host --restart` — sessions come back via --continue.',\n );\n }\n}\n\n/**\n * Ask whoever listens on the discovery file's port whether it's our host:\n * it must answer /health with our token. Returns what it reports (its\n * protocol version and pid), or null if nothing answers / the token is\n * wrong — i.e. the discovery file is stale.\n */\nexport async function probeHost(info: HostInfo, timeoutMs = 800): Promise<{ version: number; pid: number } | null> {\n const r = await probeHostDetailed(info, timeoutMs);\n return r.kind === 'host' ? { version: r.version, pid: r.pid } : null;\n}\n\nexport type ProbeResult =\n | { kind: 'host'; version: number; pid: number }\n /** Nothing listens on the port (connection refused): definitely gone. */\n | { kind: 'refused' }\n /** Something answered, but not as our host (wrong token, bad body). */\n | { kind: 'not-ours' }\n /** No answer in time, or the connection dropped (reset, hang-up) — could be a BUSY or hung host\n * (e.g. restoring many sessions, a ConPTY start that blocks). Never treat this as proof the host is gone. */\n | { kind: 'timeout' };\n\nexport async function probeHostDetailed(info: HostInfo, timeoutMs = 800): Promise<ProbeResult> {\n try {\n const res = await fetch(`http://127.0.0.1:${info.port}/health`, {\n headers: { 'x-work-token': info.token },\n signal: AbortSignal.timeout(timeoutMs),\n });\n if (!res.ok) return { kind: 'not-ours' };\n const body = (await res.json()) as { version?: number; pid?: number };\n if (typeof body.version !== 'number' || typeof body.pid !== 'number') return { kind: 'not-ours' };\n return { kind: 'host', version: body.version, pid: body.pid };\n } catch (err) {\n const e = err as { name?: string; cause?: { code?: string } };\n // Only a refused connection proves nothing listens. Anything else — a reset, a dropped socket — is no answer,\n // not proof it's gone: a hung host keeps its port, and once requests pile up unanswered Windows resets new\n // connections. Read as \"refused\", that started a second host beside the hung one (two Claudes per conversation).\n if (e.cause?.code === 'ECONNREFUSED') return { kind: 'refused' };\n return { kind: 'timeout' };\n }\n}\n\n/** A host is there but didn't answer in time (event loop busy: a ConPTY\n * spawn, restoring many sessions). It is RUNNING — never start another. */\nexport class PtyHostBusyError extends Error {\n constructor() {\n super('The PTY host is running but not answering (busy?). Try again in a moment.');\n this.name = 'PtyHostBusyError';\n }\n}\n\n/**\n * The running host, or null when there is none. Throws PtyHostVersionError\n * on a mismatch, and PtyHostBusyError when a host holds the port but\n * doesn't answer even a patient second probe — treating that as \"no host\"\n * would start a second one, which restores every session again (two\n * Claudes per conversation).\n */\nexport async function findHost(timeoutsMs: number[] = [800, 5000]): Promise<HostInfo | null> {\n const info = readHostInfo();\n if (!info) return null;\n let probe: ProbeResult = { kind: 'timeout' };\n for (const t of timeoutsMs) {\n probe = await probeHostDetailed(info, t);\n if (probe.kind !== 'timeout') break;\n }\n if (probe.kind === 'timeout') {\n // No answer: a host whose process is alive is busy — but a dead one\n // (crashed, killed) left a stale file, and whatever now holds that port\n // is not our host. Calling THAT busy would make the host unstartable.\n if (!isPidAlive(info.pid)) return null;\n throw new PtyHostBusyError();\n }\n if (probe.kind !== 'host' || probe.pid !== info.pid) return null;\n if (probe.version !== PROTOCOL_VERSION) throw new PtyHostVersionError(probe.version);\n return info;\n}\n\n/**\n * findHost that waits out a busy host: retries until it answers or\n * `timeoutMs` passes, then throws PtyHostBusyError. For callers that must\n * reach the host (stopping a session before its worktree is deleted).\n */\nexport async function findHostPatient(timeoutMs = 20_000): Promise<HostInfo | null> {\n const deadline = Date.now() + timeoutMs;\n for (;;) {\n try {\n return await findHost();\n } catch (err) {\n if (!(err instanceof PtyHostBusyError) || Date.now() >= deadline) throw err;\n await new Promise((r) => setTimeout(r, 250));\n }\n }\n}\n\n/** findHost for \"should I start one?\": a busy host counts as running. */\nasync function findHostOrBusy(): Promise<HostInfo | 'busy' | null> {\n try {\n return await findHost();\n } catch (err) {\n if (err instanceof PtyHostBusyError) return 'busy';\n throw err;\n }\n}\n\n/** Serializes host spawning across `work` processes (see ensureHost). */\nexport function hostSpawnLockPath(): string {\n return path.join(getConfigDir(), 'pty-host.spawn.lock');\n}\n\nlet inFlight: Promise<HostInfo> | null = null;\n\n/**\n * Return the running host, spawning a detached one if none is. `workBin` is\n * the path to the `work` binary (dist/bin.js) — passed in rather than\n * derived because core can't reach the commands layer's resolver (§2.1).\n *\n * Exactly one host may start: two hosts would each restore every saved\n * session — two Claudes on one conversation. So spawning is single-flight\n * within this process (concurrent callers share one attempt) and serialized\n * across processes by a file lock held from \"is one running?\" until the new\n * host answers; a caller that waited on the lock re-checks and finds it.\n */\n// A cold host start loads the whole `work` bundle; on a busy machine (right\n// after login with autostart, or a loaded test run) that can pass 8 s.\nexport function ensureHost(workBin: string, timeoutMs = 20_000): Promise<HostInfo> {\n if (!inFlight) {\n inFlight = ensureHostLocked(workBin, timeoutMs).finally(() => {\n inFlight = null;\n });\n }\n return inFlight;\n}\n\nasync function ensureHostLocked(workBin: string, timeoutMs: number): Promise<HostInfo> {\n const existing = await findHostOrBusy();\n if (existing === 'busy') return waitForHost(timeoutMs); // it's there; wait for it to answer\n if (existing) return existing;\n const lock = hostSpawnLockPath();\n ensureFile(lock, '');\n try {\n return await withFileLock(lock, async () => {\n // Another process may have started it while we waited for the lock.\n const started = await findHostOrBusy();\n if (started === 'busy') return waitForHost(timeoutMs);\n if (started) return started;\n spawnHost(workBin);\n return waitForHost(timeoutMs);\n });\n } catch (err) {\n // Couldn't get the lock in time (another process is mid-spawn and slow):\n // don't spawn a second one — wait for theirs.\n if ((err as { code?: string }).code === 'ELOCKED') return waitForHost(timeoutMs);\n throw err;\n }\n}\n\nfunction spawnHost(workBin: string): void {\n spawnDetachedWork(workBin, ['pty-host'], path.join(getConfigDir(), 'pty-host.log'));\n}\n\nasync function waitForHost(timeoutMs: number): Promise<HostInfo> {\n const deadline = Date.now() + timeoutMs;\n while (Date.now() < deadline) {\n const found = await findHost().catch(() => null);\n if (found) return found;\n await new Promise((r) => setTimeout(r, 100));\n }\n throw new Error('PTY host did not start (see ~/.work/pty-host.log)');\n}\n\nexport class PtyHostClient {\n constructor(readonly info: HostInfo) {}\n\n /** What the host said it supports (`/health`'s `features`), asked once per host (a client is one host). */\n private featureList: readonly string[] | null = null;\n /** The work release it runs (`/health`'s `work`); '' for a host from before it said. */\n private hostWork: string | null = null;\n\n /**\n * The host's features (HOST_FEATURES): [] for a host from before they were answered. Null when it couldn't be asked\n * (not answering in time): unknown, asked again next time.\n */\n async features(): Promise<readonly string[] | null> {\n if (this.featureList) return this.featureList;\n try {\n const res = await fetch(`http://127.0.0.1:${this.info.port}/health`, {\n headers: { 'x-work-token': this.info.token },\n signal: AbortSignal.timeout(5000),\n });\n if (!res.ok) return null;\n const body = (await res.json()) as { features?: unknown; work?: unknown };\n const list = Array.isArray(body.features) ? body.features.filter((f): f is string => typeof f === 'string') : [];\n this.featureList = list;\n this.hostWork = typeof body.work === 'string' ? body.work : '';\n return list;\n } catch {\n return null;\n }\n }\n\n /** The work release the host runs: '' for one from before it said (older than 2.9.3), null when it couldn't be asked. */\n async workVersion(): Promise<string | null> {\n if (this.hostWork === null) await this.features();\n return this.hostWork;\n }\n\n private async call<T>(method: string, p: string, body?: unknown): Promise<T> {\n const res = await fetch(`http://127.0.0.1:${this.info.port}${p}`, {\n method,\n headers: {\n 'x-work-token': this.info.token,\n ...(body !== undefined ? { 'Content-Type': 'application/json' } : {}),\n },\n body: body !== undefined ? JSON.stringify(body) : undefined,\n signal: AbortSignal.timeout(5000),\n });\n const json = (await res.json().catch(() => ({}))) as T & { error?: string };\n if (!res.ok) throw new Error(json.error ?? `PTY host ${method} ${p}: ${res.status}`);\n return json;\n }\n\n list(): Promise<PtyInfo[]> {\n return this.call('GET', '/ptys');\n }\n\n get(id: string): Promise<PtyInfo | null> {\n return this.call<PtyInfo>('GET', `/ptys/${encodeURIComponent(id)}`).catch(() => null);\n }\n\n spawn(id: string, spec: SpawnSpec): Promise<PtyInfo> {\n return this.call('POST', `/ptys/${encodeURIComponent(id)}`, spec);\n }\n\n /** The session's visible screen as text; null when it has none — or the\n * host predates this call (404 either way: nothing to answer by key). */\n async screen(id: string): Promise<string | null> {\n try {\n const r = await this.call<{ text?: unknown }>('GET', `/ptys/${encodeURIComponent(id)}/screen`);\n return typeof r.text === 'string' ? r.text : null;\n } catch {\n return null;\n }\n }\n\n async write(id: string, data: string): Promise<boolean> {\n try {\n await this.call('POST', `/ptys/${encodeURIComponent(id)}/write`, { data });\n return true;\n } catch {\n return false;\n }\n }\n\n /**\n * Its agent restarted in place, the attached terminals kept (registry.restart).\n * `unsupported`: a host from before the call (404) — stop and start it instead. With `agentEnv` (a session moved to\n * another account) a host that restarted it without taking the environment (one from before it) is `unsupported` too:\n * what runs now is on the old account, and the caller starts it again.\n */\n async restart(id: string, opts: { agentEnv?: EnvDelta } = {}): Promise<'restarted' | 'not-running' | 'unsupported'> {\n const res = await fetch(`http://127.0.0.1:${this.info.port}/ptys/${encodeURIComponent(id)}/restart`, {\n method: 'POST',\n headers: { 'x-work-token': this.info.token, ...(opts.agentEnv ? { 'content-type': 'application/json' } : {}) },\n ...(opts.agentEnv ? { body: JSON.stringify({ agentEnv: opts.agentEnv }) } : {}),\n // Waits for the old process to exit (up to 3 s) before the new one starts.\n signal: AbortSignal.timeout(15_000),\n });\n if (res.ok) {\n if (!opts.agentEnv) return 'restarted';\n const json = (await res.json().catch(() => null)) as { agentEnvApplied?: unknown } | null;\n return json?.agentEnvApplied === true ? 'restarted' : 'unsupported';\n }\n if (res.status === 409) return 'not-running';\n if (res.status === 404) return 'unsupported';\n const json = (await res.json().catch(() => ({}))) as { error?: string };\n throw new Error(json.error ?? `PTY host restart ${id}: ${res.status}`);\n }\n\n /**\n * Stop its agent and keep the session (entry, terminals) until `resume`. `unsupported`: a host from before the call (404):\n * nothing was stopped — the caller stops it the old way.\n */\n async halt(id: string): Promise<'halted' | 'not-running' | 'unsupported'> {\n const res = await fetch(`http://127.0.0.1:${this.info.port}/ptys/${encodeURIComponent(id)}/halt`, {\n method: 'POST',\n headers: { 'x-work-token': this.info.token },\n signal: AbortSignal.timeout(15_000),\n });\n if (res.ok) return 'halted';\n if (res.status === 409) return 'not-running';\n if (res.status === 404) return 'unsupported';\n const json = (await res.json().catch(() => ({}))) as { error?: string };\n throw new Error(json.error ?? `PTY host halt ${id}: ${res.status}`);\n }\n\n /** Start a halted agent again in place (`--continue`), on `agentEnv` when given. `not-halted`: it isn't halted (resumed already, or gone). */\n async resume(id: string, opts: { agentEnv?: EnvDelta } = {}): Promise<'resumed' | 'not-halted'> {\n const res = await fetch(`http://127.0.0.1:${this.info.port}/ptys/${encodeURIComponent(id)}/resume`, {\n method: 'POST',\n headers: { 'x-work-token': this.info.token, 'content-type': 'application/json' },\n body: JSON.stringify(opts.agentEnv ? { agentEnv: opts.agentEnv } : {}),\n signal: AbortSignal.timeout(15_000),\n });\n if (res.ok) return 'resumed';\n if (res.status === 409) return 'not-halted';\n const json = (await res.json().catch(() => ({}))) as { error?: string };\n throw new Error(json.error ?? `PTY host resume ${id}: ${res.status}`);\n }\n\n async kill(id: string): Promise<void> {\n await this.call('DELETE', `/ptys/${encodeURIComponent(id)}`);\n }\n\n attachUrl(id: string): string {\n return `ws://127.0.0.1:${this.info.port}/ptys/${encodeURIComponent(id)}/attach?token=${this.info.token}`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAO,UAAU;AAQV,IAAM,sBAAN,cAAkC,MAAM;AAAA,EAC7C,YAAqB,aAAqB;AACxC;AAAA,MACE,6CAA6C,WAAW,WAAW,gBAAgB;AAAA,IAErF;AAJmB;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AAW,IAAK,QAAO;AAC/B,QAAI,IAAI,WAAW,IAAK,QAAO;AAC/B,UAAM,OAAQ,MAAM,IAAI,KAAK,EAAE,MAAM,OAAO,CAAC,EAAE;AAC/C,UAAM,IAAI,MAAM,KAAK,SAAS,iBAAiB,EAAE,KAAK,IAAI,MAAM,EAAE;AAAA,EACpE;AAAA;AAAA,EAGA,MAAM,OAAO,IAAY,OAAgC,CAAC,GAAsC;AAC9F,UAAM,MAAM,MAAM,MAAM,oBAAoB,KAAK,KAAK,IAAI,SAAS,mBAAmB,EAAE,CAAC,WAAW;AAAA,MAClG,QAAQ;AAAA,MACR,SAAS,EAAE,gBAAgB,KAAK,KAAK,OAAO,gBAAgB,mBAAmB;AAAA,MAC/E,MAAM,KAAK,UAAU,KAAK,WAAW,EAAE,UAAU,KAAK,SAAS,IAAI,CAAC,CAAC;AAAA,MACrE,QAAQ,YAAY,QAAQ,IAAM;AAAA,IACpC,CAAC;AACD,QAAI,IAAI,GAAI,QAAO;AACnB,QAAI,IAAI,WAAW,IAAK,QAAO;AAC/B,UAAM,OAAQ,MAAM,IAAI,KAAK,EAAE,MAAM,OAAO,CAAC,EAAE;AAC/C,UAAM,IAAI,MAAM,KAAK,SAAS,mBAAmB,EAAE,KAAK,IAAI,MAAM,EAAE;AAAA,EACtE;AAAA,EAEA,MAAM,KAAK,IAA2B;AACpC,UAAM,KAAK,KAAK,UAAU,SAAS,mBAAmB,EAAE,CAAC,EAAE;AAAA,EAC7D;AAAA,EAEA,UAAU,IAAoB;AAC5B,WAAO,kBAAkB,KAAK,KAAK,IAAI,SAAS,mBAAmB,EAAE,CAAC,iBAAiB,KAAK,KAAK,KAAK;AAAA,EACxG;AACF;","names":["json"]}
|
|
1
|
+
{"version":3,"sources":["../src/core/pty/pty-host-client.ts"],"sourcesContent":["import path from 'node:path';\nimport { spawnDetachedWork } from '../platform/process.js';\nimport { getConfigDir } from '../platform/config.js';\nimport { isPidAlive } from '../platform/process.js';\nimport { ensureFile, withFileLock } from '../platform/fs-safe.js';\nimport type { EnvDelta } from '../platform/env-delta.js';\nimport { PROTOCOL_VERSION, readHostInfo, type HostInfo, type PtyInfo, type SpawnSpec } from './pty-host-protocol.js';\n\nexport class PtyHostVersionError extends Error {\n constructor(readonly hostVersion: number) {\n super(\n `A PTY host from an older build (protocol v${hostVersion}, need v${PROTOCOL_VERSION}) ` +\n 'is running. Restart it with `work pty-host --restart` — sessions come back via --continue.',\n );\n }\n}\n\n/**\n * Ask whoever listens on the discovery file's port whether it's our host:\n * it must answer /health with our token. Returns what it reports (its\n * protocol version and pid), or null if nothing answers / the token is\n * wrong — i.e. the discovery file is stale.\n */\nexport async function probeHost(info: HostInfo, timeoutMs = 800): Promise<{ version: number; pid: number } | null> {\n const r = await probeHostDetailed(info, timeoutMs);\n return r.kind === 'host' ? { version: r.version, pid: r.pid } : null;\n}\n\nexport type ProbeResult =\n | { kind: 'host'; version: number; pid: number }\n /** Nothing listens on the port (connection refused): definitely gone. */\n | { kind: 'refused' }\n /** Something answered, but not as our host (wrong token, bad body). */\n | { kind: 'not-ours' }\n /** No answer in time, or the connection dropped (reset, hang-up) — could be a BUSY or hung host\n * (e.g. restoring many sessions, a ConPTY start that blocks). Never treat this as proof the host is gone. */\n | { kind: 'timeout' };\n\nexport async function probeHostDetailed(info: HostInfo, timeoutMs = 800): Promise<ProbeResult> {\n try {\n const res = await fetch(`http://127.0.0.1:${info.port}/health`, {\n headers: { 'x-work-token': info.token },\n signal: AbortSignal.timeout(timeoutMs),\n });\n if (!res.ok) return { kind: 'not-ours' };\n const body = (await res.json()) as { version?: number; pid?: number };\n if (typeof body.version !== 'number' || typeof body.pid !== 'number') return { kind: 'not-ours' };\n return { kind: 'host', version: body.version, pid: body.pid };\n } catch (err) {\n const e = err as { name?: string; cause?: { code?: string } };\n // Only a refused connection proves nothing listens. Anything else — a reset, a dropped socket — is no answer,\n // not proof it's gone: a hung host keeps its port, and once requests pile up unanswered Windows resets new\n // connections. Read as \"refused\", that started a second host beside the hung one (two Claudes per conversation).\n if (e.cause?.code === 'ECONNREFUSED') return { kind: 'refused' };\n return { kind: 'timeout' };\n }\n}\n\n/** A host is there but didn't answer in time (event loop busy: a ConPTY\n * spawn, restoring many sessions). It is RUNNING — never start another. */\nexport class PtyHostBusyError extends Error {\n constructor() {\n super('The PTY host is running but not answering (busy?). Try again in a moment.');\n this.name = 'PtyHostBusyError';\n }\n}\n\n/**\n * The running host, or null when there is none. Throws PtyHostVersionError\n * on a mismatch, and PtyHostBusyError when a host holds the port but\n * doesn't answer even a patient second probe — treating that as \"no host\"\n * would start a second one, which restores every session again (two\n * Claudes per conversation).\n */\nexport async function findHost(timeoutsMs: number[] = [800, 5000]): Promise<HostInfo | null> {\n const info = readHostInfo();\n if (!info) return null;\n let probe: ProbeResult = { kind: 'timeout' };\n for (const t of timeoutsMs) {\n probe = await probeHostDetailed(info, t);\n if (probe.kind !== 'timeout') break;\n }\n if (probe.kind === 'timeout') {\n // No answer: a host whose process is alive is busy — but a dead one\n // (crashed, killed) left a stale file, and whatever now holds that port\n // is not our host. Calling THAT busy would make the host unstartable.\n if (!isPidAlive(info.pid)) return null;\n throw new PtyHostBusyError();\n }\n if (probe.kind !== 'host' || probe.pid !== info.pid) return null;\n if (probe.version !== PROTOCOL_VERSION) throw new PtyHostVersionError(probe.version);\n return info;\n}\n\n/**\n * findHost that waits out a busy host: retries until it answers or\n * `timeoutMs` passes, then throws PtyHostBusyError. For callers that must\n * reach the host (stopping a session before its worktree is deleted).\n */\nexport async function findHostPatient(timeoutMs = 20_000): Promise<HostInfo | null> {\n const deadline = Date.now() + timeoutMs;\n for (;;) {\n try {\n return await findHost();\n } catch (err) {\n if (!(err instanceof PtyHostBusyError) || Date.now() >= deadline) throw err;\n await new Promise((r) => setTimeout(r, 250));\n }\n }\n}\n\n/** findHost for \"should I start one?\": a busy host counts as running. */\nasync function findHostOrBusy(): Promise<HostInfo | 'busy' | null> {\n try {\n return await findHost();\n } catch (err) {\n if (err instanceof PtyHostBusyError) return 'busy';\n throw err;\n }\n}\n\n/** Serializes host spawning across `work` processes (see ensureHost). */\nexport function hostSpawnLockPath(): string {\n return path.join(getConfigDir(), 'pty-host.spawn.lock');\n}\n\nlet inFlight: Promise<HostInfo> | null = null;\n\n/**\n * Return the running host, spawning a detached one if none is. `workBin` is\n * the path to the `work` binary (dist/bin.js) — passed in rather than\n * derived because core can't reach the commands layer's resolver (§2.1).\n *\n * Exactly one host may start: two hosts would each restore every saved\n * session — two Claudes on one conversation. So spawning is single-flight\n * within this process (concurrent callers share one attempt) and serialized\n * across processes by a file lock held from \"is one running?\" until the new\n * host answers; a caller that waited on the lock re-checks and finds it.\n */\n// A cold host start loads the whole `work` bundle; on a busy machine (right\n// after login with autostart, or a loaded test run) that can pass 8 s.\nexport function ensureHost(workBin: string, timeoutMs = 20_000): Promise<HostInfo> {\n if (!inFlight) {\n inFlight = ensureHostLocked(workBin, timeoutMs).finally(() => {\n inFlight = null;\n });\n }\n return inFlight;\n}\n\nasync function ensureHostLocked(workBin: string, timeoutMs: number): Promise<HostInfo> {\n const existing = await findHostOrBusy();\n if (existing === 'busy') return waitForHost(timeoutMs); // it's there; wait for it to answer\n if (existing) return existing;\n const lock = hostSpawnLockPath();\n ensureFile(lock, '');\n try {\n return await withFileLock(lock, async () => {\n // Another process may have started it while we waited for the lock.\n const started = await findHostOrBusy();\n if (started === 'busy') return waitForHost(timeoutMs);\n if (started) return started;\n spawnHost(workBin);\n return waitForHost(timeoutMs);\n });\n } catch (err) {\n // Couldn't get the lock in time (another process is mid-spawn and slow):\n // don't spawn a second one — wait for theirs.\n if ((err as { code?: string }).code === 'ELOCKED') return waitForHost(timeoutMs);\n throw err;\n }\n}\n\nfunction spawnHost(workBin: string): void {\n spawnDetachedWork(workBin, ['pty-host'], path.join(getConfigDir(), 'pty-host.log'));\n}\n\nasync function waitForHost(timeoutMs: number): Promise<HostInfo> {\n const deadline = Date.now() + timeoutMs;\n while (Date.now() < deadline) {\n const found = await findHost().catch(() => null);\n if (found) return found;\n await new Promise((r) => setTimeout(r, 100));\n }\n throw new Error('PTY host did not start (see ~/.work/pty-host.log)');\n}\n\nexport class PtyHostClient {\n constructor(readonly info: HostInfo) {}\n\n /** What the host said it supports (`/health`'s `features`), asked once per host (a client is one host). */\n private featureList: readonly string[] | null = null;\n /** The work release it runs (`/health`'s `work`); '' for a host from before it said. */\n private hostWork: string | null = null;\n\n /**\n * The host's features (HOST_FEATURES): [] for a host from before they were answered. Null when it couldn't be asked\n * (not answering in time): unknown, asked again next time.\n */\n async features(): Promise<readonly string[] | null> {\n if (this.featureList) return this.featureList;\n try {\n const res = await fetch(`http://127.0.0.1:${this.info.port}/health`, {\n headers: { 'x-work-token': this.info.token },\n signal: AbortSignal.timeout(5000),\n });\n if (!res.ok) return null;\n const body = (await res.json()) as { features?: unknown; work?: unknown };\n const list = Array.isArray(body.features) ? body.features.filter((f): f is string => typeof f === 'string') : [];\n this.featureList = list;\n this.hostWork = typeof body.work === 'string' ? body.work : '';\n return list;\n } catch {\n return null;\n }\n }\n\n /** The work release the host runs: '' for one from before it said (older than 2.9.3), null when it couldn't be asked. */\n async workVersion(): Promise<string | null> {\n if (this.hostWork === null) await this.features();\n return this.hostWork;\n }\n\n private async call<T>(method: string, p: string, body?: unknown): Promise<T> {\n const res = await fetch(`http://127.0.0.1:${this.info.port}${p}`, {\n method,\n headers: {\n 'x-work-token': this.info.token,\n ...(body !== undefined ? { 'Content-Type': 'application/json' } : {}),\n },\n body: body !== undefined ? JSON.stringify(body) : undefined,\n signal: AbortSignal.timeout(5000),\n });\n const json = (await res.json().catch(() => ({}))) as T & { error?: string };\n if (!res.ok) throw new Error(json.error ?? `PTY host ${method} ${p}: ${res.status}`);\n return json;\n }\n\n list(): Promise<PtyInfo[]> {\n return this.call('GET', '/ptys');\n }\n\n get(id: string): Promise<PtyInfo | null> {\n return this.call<PtyInfo>('GET', `/ptys/${encodeURIComponent(id)}`).catch(() => null);\n }\n\n spawn(id: string, spec: SpawnSpec): Promise<PtyInfo> {\n return this.call('POST', `/ptys/${encodeURIComponent(id)}`, spec);\n }\n\n /** The session's visible screen as text; null when it has none — or the\n * host predates this call (404 either way: nothing to answer by key). */\n async screen(id: string): Promise<string | null> {\n try {\n const r = await this.call<{ text?: unknown }>('GET', `/ptys/${encodeURIComponent(id)}/screen`);\n return typeof r.text === 'string' ? r.text : null;\n } catch {\n return null;\n }\n }\n\n async write(id: string, data: string): Promise<boolean> {\n try {\n await this.call('POST', `/ptys/${encodeURIComponent(id)}/write`, { data });\n return true;\n } catch {\n return false;\n }\n }\n\n /**\n * Its agent restarted in place, the attached terminals kept (registry.restart).\n * `unsupported`: a host from before the call (404) — stop and start it instead. With `agentEnv` (a session moved to\n * another account) a host that restarted it without taking the environment (one from before it) is `unsupported` too:\n * what runs now is on the old account, and the caller starts it again.\n */\n async restart(id: string, opts: { agentEnv?: EnvDelta } = {}): Promise<'restarted' | 'not-running' | 'unsupported'> {\n const res = await fetch(`http://127.0.0.1:${this.info.port}/ptys/${encodeURIComponent(id)}/restart`, {\n method: 'POST',\n headers: { 'x-work-token': this.info.token, ...(opts.agentEnv ? { 'content-type': 'application/json' } : {}) },\n ...(opts.agentEnv ? { body: JSON.stringify({ agentEnv: opts.agentEnv }) } : {}),\n // Waits for the old process to exit (up to 3 s) before the new one starts.\n signal: AbortSignal.timeout(15_000),\n });\n if (res.ok) {\n if (!opts.agentEnv) return 'restarted';\n const json = (await res.json().catch(() => null)) as { agentEnvApplied?: unknown } | null;\n return json?.agentEnvApplied === true ? 'restarted' : 'unsupported';\n }\n if (res.status === 409) return 'not-running';\n if (res.status === 404) return 'unsupported';\n const json = (await res.json().catch(() => ({}))) as { error?: string };\n throw new Error(json.error ?? `PTY host restart ${id}: ${res.status}`);\n }\n\n /**\n * Stop its agent and keep the session (entry, terminals) until `resume`. `unsupported`: a host from before the call (404):\n * nothing was stopped — the caller stops it the old way.\n */\n async halt(id: string): Promise<'halted' | 'not-running' | 'unsupported'> {\n const res = await fetch(`http://127.0.0.1:${this.info.port}/ptys/${encodeURIComponent(id)}/halt`, {\n method: 'POST',\n headers: { 'x-work-token': this.info.token },\n signal: AbortSignal.timeout(15_000),\n });\n if (res.ok) return 'halted';\n if (res.status === 409) return 'not-running';\n if (res.status === 404) return 'unsupported';\n const json = (await res.json().catch(() => ({}))) as { error?: string };\n throw new Error(json.error ?? `PTY host halt ${id}: ${res.status}`);\n }\n\n /** Start a halted agent again in place (`--continue`), on `agentEnv` when given. `not-halted`: it isn't halted (resumed already, or gone). */\n async resume(id: string, opts: { agentEnv?: EnvDelta } = {}): Promise<'resumed' | 'not-halted'> {\n const res = await fetch(`http://127.0.0.1:${this.info.port}/ptys/${encodeURIComponent(id)}/resume`, {\n method: 'POST',\n headers: { 'x-work-token': this.info.token, 'content-type': 'application/json' },\n body: JSON.stringify(opts.agentEnv ? { agentEnv: opts.agentEnv } : {}),\n signal: AbortSignal.timeout(15_000),\n });\n if (res.ok) return 'resumed';\n if (res.status === 409) return 'not-halted';\n const json = (await res.json().catch(() => ({}))) as { error?: string };\n throw new Error(json.error ?? `PTY host resume ${id}: ${res.status}`);\n }\n\n async kill(id: string): Promise<void> {\n await this.call('DELETE', `/ptys/${encodeURIComponent(id)}`);\n }\n\n attachUrl(id: string): string {\n return `ws://127.0.0.1:${this.info.port}/ptys/${encodeURIComponent(id)}/attach?token=${this.info.token}`;\n }\n\n /**\n * The address a dashboard page attaches this terminal at, with a one-time ticket for its origin\n * (terminal-tickets.ts) — never the token. Null from a host without tickets, or one that refused.\n */\n async ticketUrl(id: string, origin: string): Promise<string | null> {\n if (!(await this.features())?.includes('tickets')) return null;\n const got = await this.call<{ ticket?: unknown }>('POST', '/tickets', { id, origin }).catch(() => null);\n const ticket = typeof got?.ticket === 'string' ? got.ticket : null;\n return ticket ? `ws://127.0.0.1:${this.info.port}/ptys/${encodeURIComponent(id)}/attach?ticket=${ticket}` : null;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAO,UAAU;AAQ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QAAI,EAAE,MAAM,KAAK,SAAS,IAAI,SAAS,SAAS,EAAG,QAAO;AAC1D,UAAM,MAAM,MAAM,KAAK,KAA2B,QAAQ,YAAY,EAAE,IAAI,OAAO,CAAC,EAAE,MAAM,MAAM,IAAI;AACtG,UAAM,SAAS,OAAO,KAAK,WAAW,WAAW,IAAI,SAAS;AAC9D,WAAO,SAAS,kBAAkB,KAAK,KAAK,IAAI,SAAS,mBAAmB,EAAE,CAAC,kBAAkB,MAAM,KAAK;AAAA,EAC9G;AACF;","names":["json"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
atomicWriteFile
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-D2J3AD6L.js";
|
|
5
5
|
import {
|
|
6
6
|
getConfigDir
|
|
7
7
|
} from "./chunk-6THUVP6T.js";
|
|
@@ -324,6 +324,8 @@ function loadConfig() {
|
|
|
324
324
|
Object.entries(parsed.gitHosts).filter((e) => typeof e[1] === "string")
|
|
325
325
|
) : void 0,
|
|
326
326
|
hostEnv: Array.isArray(parsed.hostEnv) ? parsed.hostEnv.filter((n) => typeof n === "string" && /^[A-Za-z_][A-Za-z0-9_]*$/.test(n)) : void 0,
|
|
327
|
+
// The Settings page writes it (reported: it saved and nothing read it).
|
|
328
|
+
jiraWatch: parsed.jiraWatch && typeof parsed.jiraWatch === "object" && typeof parsed.jiraWatch.maxPerDay === "number" ? Number.isInteger(parsed.jiraWatch.maxPerDay) && parsed.jiraWatch.maxPerDay >= 0 && parsed.jiraWatch.maxPerDay <= 100 ? { maxPerDay: parsed.jiraWatch.maxPerDay } : void 0 : void 0,
|
|
327
329
|
jiraWorklog: parsed.jiraWorklog && typeof parsed.jiraWorklog === "object" && typeof parsed.jiraWorklog.site === "string" && typeof parsed.jiraWorklog.email === "string" ? {
|
|
328
330
|
site: parsed.jiraWorklog.site,
|
|
329
331
|
email: parsed.jiraWorklog.email,
|
|
@@ -340,13 +342,24 @@ function loadConfig() {
|
|
|
340
342
|
(b) => typeof b === "string" && b.trim().length > 0
|
|
341
343
|
)
|
|
342
344
|
} : {},
|
|
343
|
-
wakeClaude: parsed.prWatch.wakeClaude !== false
|
|
345
|
+
wakeClaude: parsed.prWatch.wakeClaude !== false,
|
|
346
|
+
...cleanRequiredChecks(parsed.prWatch.requiredChecks) ? { requiredChecks: cleanRequiredChecks(parsed.prWatch.requiredChecks) } : {}
|
|
344
347
|
} : void 0
|
|
345
348
|
};
|
|
346
349
|
} catch {
|
|
347
350
|
return null;
|
|
348
351
|
}
|
|
349
352
|
}
|
|
353
|
+
function cleanRequiredChecks(raw) {
|
|
354
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return null;
|
|
355
|
+
const out = {};
|
|
356
|
+
for (const [repo, names] of Object.entries(raw)) {
|
|
357
|
+
if (!repo.trim() || !Array.isArray(names)) continue;
|
|
358
|
+
const list = names.filter((n) => typeof n === "string" && n.trim().length > 0).map((n) => n.trim());
|
|
359
|
+
if (list.length) out[repo] = list;
|
|
360
|
+
}
|
|
361
|
+
return Object.keys(out).length ? out : null;
|
|
362
|
+
}
|
|
350
363
|
function saveConfig(config) {
|
|
351
364
|
atomicWriteFile(getConfigPath(), JSON.stringify(config, null, 2));
|
|
352
365
|
}
|
|
@@ -374,4 +387,4 @@ export {
|
|
|
374
387
|
saveConfig,
|
|
375
388
|
ensureConfig
|
|
376
389
|
};
|
|
377
|
-
//# sourceMappingURL=chunk-
|
|
390
|
+
//# sourceMappingURL=chunk-O5ZJY5BT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/platform/config.ts","../src/core/sessions/saved-prompts.ts","../src/core/time/allocate.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { atomicWriteFile } from './fs-safe.js';\nimport { validatePrompts } from '../sessions/saved-prompts.js';\nimport { isIssueKey } from '../time/allocate.js';\nimport { getConfigDir } from './config-dir.js';\nimport type { SavedPrompt } from '../api-types.js';\n\n/**\n * An opt-in shell command that runs when a session changes status. The command\n * runs with the session's directory as its cwd (passed as the spawn `cwd`\n * option, never interpolated into the command string).\n */\nexport interface StatusHook {\n on: 'idle' | 'needs_input';\n command: string;\n}\n\nexport interface WorkConfig {\n worktreesRoot: string;\n repos: Record<string, string>;\n groups: Record<string, string[]>;\n copyFiles: string[];\n /** Folders the Repos page scans for git repos (repo-scan.ts); default: the one the worktrees root sits in. */\n scanRoots?: string[];\n /** Repos you chose not to enrol (paths), so the Repos page stops offering them. */\n ignoredRepos?: string[];\n /** The Jira watch (jira-watch.ts; turned on and off in the Jira tab): at most this many automatic starts a day (default 5). */\n jiraWatch?: { maxPerDay?: number };\n /** The Time tab's rules (core/time/allocate.ts, defaults in DEFAULT_TIME_SETTINGS), and the Jira\n * projects whose keys count in commit subjects (default: the projects of your sessions' keys). */\n time?: Partial<import('../time/allocate.js').TimeSettings> & {\n projects?: string[];\n /** How many days back the Time tab gathers (default 14, at most 92; Claude's own transcripts go back about 30). */\n catchUpDays?: number;\n /** Tickets a workstream maps to when nothing names them (the timesheet tool's TICKET_HINTS), by key. */\n hints?: Record<string, import('../time/hints.js').TicketHint>;\n /** Posting to Tempo: the env variable with the token (default TEMPO_API_TOKEN) and your Jira account id (else JIRA_ACCOUNT_ID). */\n tempo?: { tokenEnv?: string; accountId?: string };\n /** Outlook and Teams through Microsoft Graph: the app registration to sign in with (else GRAPH_CLIENT_ID / GRAPH_TENANT_ID). */\n graph?: { clientId?: string; tenantId?: string };\n /** The Jira field holding story points (`customfield_…`, each site its own): read for tasks, they weigh the day's split. */\n storyPointsField?: string;\n };\n /** Stacked sessions (stack-sync.ts): bring a parent's new commits into the sessions stacked on it (default true). */\n stacks?: { autoUpdate?: boolean };\n /** Usage meters: `statusLine: false` leaves Claude's status line alone (work otherwise wraps it to read the rate limits). */\n usage?: { statusLine?: boolean };\n /** Claude Code accounts besides the default `~/.claude`: name → its config folder (`CLAUDE_CONFIG_DIR`), as written; agents/claude/accounts.ts checks them. */\n claudeAccounts?: Record<string, string>;\n /** The account new sessions and work's own Claude runs use: `default` or a key of `claudeAccounts`. */\n claudeAccount?: string;\n /** The agent that writes work's own summaries — checkpoint names, catch-up, archive summaries, the Jira watch's choice (default `claude`; one without one-shot runs writes none). */\n internalAgent?: string;\n /** The agent the Ctrl+K assistant runs (an adapter's id; Claude Code by default). */\n assistantAgent?: string;\n /**\n * PR reviews prepared in the background (#64, core/review/): per project (a repo alias or a group) `all` open PRs\n * (the default), only those `asked` of you, or `off`; the day's cap and the size above which a review waits for a\n * click; and kind-of-change rules before the defaults (change-kinds.ts).\n */\n reviews?: { projects?: Record<string, 'all' | 'asked' | 'off'>; maxPerDay?: number; maxLines?: number; rules?: unknown[] };\n /**\n * The git host of an origin whose URL no adapter claims (core/hosts/index.ts): its hostname (lower case) → a host\n * id. Only a host that can work with such a server needs it (one registered at run time); GitHub Enterprise needs\n * no entry — an unclaimed origin is asked as GitHub already, and gh finds its server from the repo's folder. The\n * registry reads it from the raw config.\n */\n gitHosts?: Record<string, string>;\n /** Environment variable names to keep for a session restored after a reboot (the launching shell's values; secret-looking names are never kept). */\n hostEnv?: string[];\n /** Writing session time to Jira as worklogs (jira-worklog.ts): the site, your email, and the API token (from the env var `tokenEnv`, default JIRA_API_TOKEN, or `token`). */\n jiraWorklog?: { site: string; email: string; tokenEnv?: string; token?: string };\n /**\n * AI tool command to launch in worktrees. May include extra args, e.g.\n * \"claude\" (default), \"gemini\", \"codex\", or \"my-tool --some-flag\".\n */\n aiCommand?: string;\n /**\n * Launch `work tree`'s AI session inside the PTY host and attach this\n * terminal to it (like `work attach`), so it survives closing the tab and\n * the dashboard shows the same screen. Default on; `false` launches\n * directly in the terminal. Per call: `--host` / `--no-host`.\n */\n launchViaHost?: boolean;\n /**\n * Experimental, off by default: NEW sessions are made as a folder with one\n * subfolder per repo — a single repo too (`<root>/<branch>-<id6>/<repo>/`, session-folder.ts) —\n * and the agent runs in the folder, whose instructions file imports each\n * repo's own. Existing sessions keep the layout they were made with.\n */\n sessionFolders?: boolean;\n /**\n * Per-tool flag overrides. Defaults come from the preset matching the\n * binary in `aiCommand` (see AI_TOOL_PRESETS in core/ai-launcher.ts).\n * Set any value to an empty string to disable that flag for the configured tool.\n */\n aiCommandFlags?: {\n /** Flag for resuming the most recent session. */\n resume?: string;\n /** Flag for passing an initial prompt as a file path. */\n promptFile?: string;\n /** Flag for passing an inline prompt; empty string = positional arg. */\n prompt?: string;\n };\n /** Editor command for opening worktrees. Default: \"code\" */\n editor?: string;\n /**\n * Range of dev-server ports to allocate to worktrees (inclusive).\n * Each worktree gets a stable port exposed as $PORT to the launched process.\n * Default when unset: { start: 3000, end: 3099 }.\n */\n portRange?: { start: number; end: number };\n /**\n * Dev-server command per repo alias, run from the dashboard with this\n * worktree's $PORT (e.g. `{ \"web\": \"npm run dev -- --port $PORT\" }`).\n */\n devCommands?: Record<string, string>;\n /**\n * Stop a session's Claude in the PTY host after this many minutes idle with\n * no window attached; opening the session resumes its conversation. Frees\n * memory (each Claude holds a few hundred MB). Default 10, at least 5; 0 = never.\n * Only a truly idle one: never working, waiting on you, or with background work still running (idle-sleep.ts).\n */\n sleepIdleAfterMinutes?: number;\n /**\n * Windows: start terminals on the ConPTY node-pty ships (`conpty.dll` + `OpenConsole.exe`, the one Windows Terminal\n * uses) instead of the one built into Windows, whose console start can hang — and with it the PTY host. Read at\n * each terminal start; nothing restarts. Default off (node-pty calls it experimental).\n */\n useBundledConpty?: boolean;\n /**\n * Archived conversations (archive-retention.ts): gzip them once this many\n * days old (default 30; 0 = never; lossless), and delete them after this\n * many (default 0 = never; the summary and prompts stay).\n */\n archive?: { compressAfterDays?: number; dropTranscriptsAfterDays?: number };\n /**\n * Background PR watch in `work web` (both default on): archive a session\n * once all its PRs merged, and tell its Claude when CI fails or reviewers\n * leave feedback.\n */\n prWatch?: {\n autoArchive?: boolean;\n fixCi?: boolean;\n /** A PR of the session's that turns conflicting: its Claude is asked to merge the base in and\n * resolve it (DECISION NEEDED when it isn't clear-cut). Default on. */\n fixConflicts?: boolean;\n reviewComments?: boolean;\n /** Review bots whose comments go to Claude like a colleague's (logins,\n * e.g. \"copilot-pull-request-reviewer\"). Default: Copilot and\n * github-actions (pr-review.ts DEFAULT_TRUSTED_BOTS); [] = none. */\n trustedBots?: string[];\n /** Start a session's Claude (resuming its conversation) when feedback\n * arrives and it isn't running, so it works on it at once. Default on. */\n wakeClaude?: boolean;\n /**\n * The checks that count, per repo (its alias, or the host's `owner/name`), for a repo whose host requires none\n * (GitHub's branch protection or rulesets list no required checks): a failed check not named here doesn't make\n * the PR's checks fail — shown grey as \"not required\", never asked of Claude. The host's own list, when it has\n * one, wins; a repo with neither counts every check.\n */\n requiredChecks?: Record<string, string[]>;\n };\n /**\n * Opt-in desktop notifications. When true, the dashboard fires an OS\n * notification when a session goes idle or needs input. Default: off.\n */\n notifications?: boolean;\n /**\n * Opt-in shell commands run when a session changes status (idle /\n * needs_input). Each command runs with the session dir as its cwd.\n * Generalizes `notifications`; both paths work independently. Default: none.\n */\n statusHooks?: StatusHook[];\n /**\n * One-click instructions in a session's \"Prompts ▾\" menu, replacing the\n * built-in ones: `[{ \"label\": \"Add tests\", \"prompt\": \"…\", \"repos\": [\"api\"] }]`\n * (`repos` optional: only for those repo aliases / group names).\n */\n prompts?: SavedPrompt[];\n}\n\n/** Lowest port we allow to be configured (avoid privileged ports < 1024). */\nconst MIN_PORT = 1024;\n/** Highest valid TCP port. */\nconst MAX_PORT = 65535;\n\n/**\n * Validate a configured port range. Returns the normalized range when it is a\n * pair of integers with `MIN_PORT <= start <= end <= MAX_PORT`, otherwise\n * undefined (callers then fall back to the default range). Rejects non-integers,\n * privileged/out-of-bounds ports, and reversed ranges.\n */\nexport function validatePortRange(value: unknown): { start: number; end: number } | undefined {\n if (!value || typeof value !== 'object') return undefined;\n const { start, end } = value as { start?: unknown; end?: unknown };\n if (typeof start !== 'number' || typeof end !== 'number') return undefined;\n if (!Number.isInteger(start) || !Number.isInteger(end)) return undefined;\n if (start < MIN_PORT || end > MAX_PORT) return undefined;\n if (start > end) return undefined;\n return { start, end };\n}\n\nexport { getConfigDir };\n\n/** An agent named in config (`internalAgent`, `assistantAgent`): an adapter's id, a plain word — never a path or a command line. */\nexport function isAgentId(v: unknown): v is string {\n return typeof v === 'string' && /^[\\w.-]+$/.test(v);\n}\n\nexport function getConfigPath(): string {\n return path.join(getConfigDir(), 'config.json');\n}\n\nfunction validateDevCommands(raw: unknown): Record<string, string> | undefined {\n if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return undefined;\n const out: Record<string, string> = {};\n for (const [alias, cmd] of Object.entries(raw)) if (typeof cmd === 'string' && cmd.trim()) out[alias] = cmd;\n return out;\n}\n\n/** The Time tab's section as written: only well-formed values (a bad one is left to its default). */\nexport function validateTime(raw: unknown): WorkConfig['time'] {\n if (!raw || typeof raw !== 'object') return undefined;\n const t = raw as Record<string, unknown>;\n const num = (k: string, min: number) => (typeof t[k] === 'number' && (t[k] as number) >= min ? { [k]: t[k] as number } : {});\n const key = (k: string) => (typeof t[k] === 'string' && isIssueKey(t[k] as string) ? { [k]: t[k] as string } : {});\n const strs = (o: unknown, keys: string[]) => {\n if (!o || typeof o !== 'object') return undefined;\n const out: Record<string, string> = {};\n for (const k of keys) {\n const v = (o as Record<string, unknown>)[k];\n if (typeof v === 'string' && v.trim()) out[k] = v.trim();\n }\n return Object.keys(out).length ? out : undefined;\n };\n const days = stringList(t.holidays)?.filter((d) => /^\\d{4}-\\d{2}-\\d{2}$/.test(d));\n const vacation = stringList(t.vacation)?.filter((d) => /^\\d{4}-\\d{2}-\\d{2}$/.test(d));\n const hints = validateHints(t.hints);\n const catchUp = typeof t.catchUpDays === 'number' && t.catchUpDays >= 1 ? { catchUpDays: Math.min(92, Math.floor(t.catchUpDays)) } : {};\n const projects = stringList(t.projects)?.filter((p) => /^[A-Z][A-Z0-9]{1,9}$/.test(p));\n const desk = stringList(t.deskProjects)?.filter((p) => /^[A-Z][A-Z0-9]{1,9}$/.test(p));\n const tempo = strs(t.tempo, ['tokenEnv', 'accountId']);\n const graph = strs(t.graph, ['clientId', 'tenantId']);\n return {\n ...num('dayHours', 0.25),\n ...num('multiplier', 0),\n ...num('capHours', 0),\n ...num('stepHours', 0.01),\n ...num('minHours', 0),\n ...key('gapTicket'),\n ...key('timeOffTicket'),\n ...(days ? { holidays: days } : {}),\n ...(vacation ? { vacation } : {}),\n ...(typeof t.effort === 'boolean' ? { effort: t.effort } : {}),\n ...(desk ? { deskProjects: desk } : {}),\n ...(t.taskMinHours === null || (typeof t.taskMinHours === 'number' && t.taskMinHours >= 0)\n ? { taskMinHours: t.taskMinHours as number | null }\n : {}),\n ...num('pointsWeight', 0),\n ...(typeof t.storyPointsField === 'string' && /^customfield_\\d+$/.test(t.storyPointsField)\n ? { storyPointsField: t.storyPointsField }\n : {}),\n ...catchUp,\n ...(hints ? { hints } : {}),\n ...(projects ? { projects } : {}),\n ...(tempo ? { tempo } : {}),\n ...(graph ? { graph } : {}),\n };\n}\n\n/** `time.hints`: each a real issue key with what matches it (text found in a session, commit, meeting or chat). */\nfunction validateHints(raw: unknown): Record<string, import('../time/hints.js').TicketHint> | undefined {\n if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return undefined;\n const out: Record<string, import('../time/hints.js').TicketHint> = {};\n for (const [k, v] of Object.entries(raw as Record<string, unknown>)) {\n const h = v as Record<string, unknown> | null;\n const matches = stringList(h?.matches)\n ?.map((m) => m.trim())\n .filter((m) => m.length >= 3);\n if (!isIssueKey(k) || !matches?.length) continue;\n out[k] = {\n matches,\n ...(typeof h?.summary === 'string' && h.summary.trim() ? { summary: h.summary.trim() } : {}),\n ...(h?.placeholder === true ? { placeholder: true } : {}),\n };\n }\n return Object.keys(out).length ? out : undefined;\n}\n\n/** A list of non-empty strings, or undefined (not a list). */\nfunction stringList(raw: unknown): string[] | undefined {\n return Array.isArray(raw) ? raw.filter((x): x is string => typeof x === 'string' && x.trim().length > 0) : undefined;\n}\n\n/** `default` is the account at `~/.claude` (a session that records no account runs on it); it can't be a configured name. */\nexport const DEFAULT_ACCOUNT = 'default';\n\n/**\n * `claudeAccounts` as written: the entries whose folder is a string. What makes one an account (a name, a folder that\n * can be one) is Claude's to say (agents/claude/accounts.ts), which checks them where they are read.\n */\nfunction stringRecord(raw: unknown): Record<string, string> | undefined {\n if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return undefined;\n const out = Object.fromEntries(\n Object.entries(raw as Record<string, unknown>).filter((e): e is [string, string] => typeof e[1] === 'string'),\n );\n return Object.keys(out).length ? out : undefined;\n}\n\nexport function loadConfig(): WorkConfig | null {\n const configPath = getConfigPath();\n if (!fs.existsSync(configPath)) {\n return null;\n }\n\n try {\n const raw = fs.readFileSync(configPath, 'utf-8');\n const parsed = JSON.parse(raw);\n return {\n worktreesRoot: parsed.worktreesRoot ?? '',\n repos: parsed.repos ?? {},\n groups: parsed.groups ?? {},\n copyFiles: parsed.copyFiles ?? [],\n scanRoots: stringList(parsed.scanRoots),\n ignoredRepos: stringList(parsed.ignoredRepos),\n aiCommand: parsed.aiCommand,\n aiCommandFlags: parsed.aiCommandFlags,\n editor: parsed.editor,\n portRange: validatePortRange(parsed.portRange),\n notifications: parsed.notifications === true,\n statusHooks: Array.isArray(parsed.statusHooks) ? parsed.statusHooks : [],\n launchViaHost: typeof parsed.launchViaHost === 'boolean' ? parsed.launchViaHost : undefined,\n sessionFolders: typeof parsed.sessionFolders === 'boolean' ? parsed.sessionFolders : undefined,\n devCommands: validateDevCommands(parsed.devCommands),\n sleepIdleAfterMinutes:\n typeof parsed.sleepIdleAfterMinutes === 'number' && parsed.sleepIdleAfterMinutes >= 0 ? parsed.sleepIdleAfterMinutes : undefined,\n useBundledConpty: typeof parsed.useBundledConpty === 'boolean' ? parsed.useBundledConpty : undefined,\n prompts: validatePrompts(parsed.prompts),\n time: validateTime(parsed.time),\n archive:\n parsed.archive && typeof parsed.archive === 'object'\n ? {\n ...(typeof parsed.archive.compressAfterDays === 'number' && parsed.archive.compressAfterDays >= 0\n ? { compressAfterDays: parsed.archive.compressAfterDays }\n : {}),\n ...(typeof parsed.archive.dropTranscriptsAfterDays === 'number' && parsed.archive.dropTranscriptsAfterDays >= 0\n ? { dropTranscriptsAfterDays: parsed.archive.dropTranscriptsAfterDays }\n : {}),\n }\n : undefined,\n stacks: parsed.stacks && typeof parsed.stacks === 'object' ? { autoUpdate: parsed.stacks.autoUpdate !== false } : undefined,\n usage: parsed.usage && typeof parsed.usage === 'object' ? { statusLine: parsed.usage.statusLine !== false } : undefined,\n claudeAccounts: stringRecord(parsed.claudeAccounts),\n claudeAccount: typeof parsed.claudeAccount === 'string' ? parsed.claudeAccount : undefined,\n internalAgent: isAgentId(parsed.internalAgent) ? parsed.internalAgent : undefined,\n assistantAgent: isAgentId(parsed.assistantAgent) ? parsed.assistantAgent : undefined,\n reviews:\n parsed.reviews && typeof parsed.reviews === 'object' && !Array.isArray(parsed.reviews)\n ? {\n ...(parsed.reviews.projects && typeof parsed.reviews.projects === 'object' && !Array.isArray(parsed.reviews.projects)\n ? {\n projects: Object.fromEntries(\n Object.entries(parsed.reviews.projects as Record<string, unknown>).filter(\n (e): e is [string, 'all' | 'asked' | 'off'] => e[1] === 'all' || e[1] === 'asked' || e[1] === 'off',\n ),\n ),\n }\n : {}),\n ...(typeof parsed.reviews.maxPerDay === 'number' && parsed.reviews.maxPerDay >= 0\n ? { maxPerDay: parsed.reviews.maxPerDay }\n : {}),\n ...(typeof parsed.reviews.maxLines === 'number' && parsed.reviews.maxLines > 0 ? { maxLines: parsed.reviews.maxLines } : {}),\n ...(Array.isArray(parsed.reviews.rules) ? { rules: parsed.reviews.rules as unknown[] } : {}),\n }\n : undefined,\n gitHosts:\n parsed.gitHosts && typeof parsed.gitHosts === 'object' && !Array.isArray(parsed.gitHosts)\n ? Object.fromEntries(\n Object.entries(parsed.gitHosts as Record<string, unknown>).filter((e): e is [string, string] => typeof e[1] === 'string'),\n )\n : undefined,\n hostEnv: Array.isArray(parsed.hostEnv)\n ? parsed.hostEnv.filter((n: unknown): n is string => typeof n === 'string' && /^[A-Za-z_][A-Za-z0-9_]*$/.test(n))\n : undefined,\n // The Settings page writes it (reported: it saved and nothing read it).\n jiraWatch:\n parsed.jiraWatch && typeof parsed.jiraWatch === 'object' && typeof parsed.jiraWatch.maxPerDay === 'number'\n ? Number.isInteger(parsed.jiraWatch.maxPerDay) && parsed.jiraWatch.maxPerDay >= 0 && parsed.jiraWatch.maxPerDay <= 100\n ? { maxPerDay: parsed.jiraWatch.maxPerDay }\n : undefined\n : undefined,\n jiraWorklog:\n parsed.jiraWorklog &&\n typeof parsed.jiraWorklog === 'object' &&\n typeof parsed.jiraWorklog.site === 'string' &&\n typeof parsed.jiraWorklog.email === 'string'\n ? {\n site: parsed.jiraWorklog.site,\n email: parsed.jiraWorklog.email,\n ...(typeof parsed.jiraWorklog.tokenEnv === 'string' ? { tokenEnv: parsed.jiraWorklog.tokenEnv } : {}),\n ...(typeof parsed.jiraWorklog.token === 'string' ? { token: parsed.jiraWorklog.token } : {}),\n }\n : undefined,\n prWatch:\n parsed.prWatch && typeof parsed.prWatch === 'object'\n ? {\n autoArchive: parsed.prWatch.autoArchive !== false,\n fixCi: parsed.prWatch.fixCi !== false,\n fixConflicts: parsed.prWatch.fixConflicts !== false,\n reviewComments: parsed.prWatch.reviewComments !== false,\n ...(Array.isArray(parsed.prWatch.trustedBots)\n ? {\n trustedBots: parsed.prWatch.trustedBots.filter(\n (b: unknown): b is string => typeof b === 'string' && b.trim().length > 0,\n ),\n }\n : {}),\n wakeClaude: parsed.prWatch.wakeClaude !== false,\n ...(cleanRequiredChecks(parsed.prWatch.requiredChecks)\n ? { requiredChecks: cleanRequiredChecks(parsed.prWatch.requiredChecks)! }\n : {}),\n }\n : undefined,\n };\n } catch {\n return null;\n }\n}\n\n/** `prWatch.requiredChecks` as written: repo → check names (strings only, none empty); null when there's none. */\nexport function cleanRequiredChecks(raw: unknown): Record<string, string[]> | null {\n if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return null;\n const out: Record<string, string[]> = {};\n for (const [repo, names] of Object.entries(raw as Record<string, unknown>)) {\n if (!repo.trim() || !Array.isArray(names)) continue;\n const list = names.filter((n): n is string => typeof n === 'string' && n.trim().length > 0).map((n) => n.trim());\n if (list.length) out[repo] = list;\n }\n return Object.keys(out).length ? out : null;\n}\n\nexport function saveConfig(config: WorkConfig): void {\n // Atomic (write temp + rename): a crash or a concurrent reader can never\n // see a half-written config (§5.3 — history/tasks already did this).\n atomicWriteFile(getConfigPath(), JSON.stringify(config, null, 2));\n}\n\nexport function ensureConfig(): WorkConfig {\n const config = loadConfig();\n if (!config) {\n throw new Error('Configuration not found. Run \"work init\" to set up.');\n }\n return config;\n}\n","import type { SavedPrompt } from '../api-types.js';\n\nexport type { SavedPrompt } from '../api-types.js';\n\n/**\n * One-click instructions for a session (\"Prompts ▾\" in its header). Sent\n * like a review comment, so they reach Claude the same safe way: pushed to\n * a terminal the dashboard owns, or on the session's next turn — never\n * typed over a permission prompt. Pure (the demo uses it too).\n *\n * `prompts` in config.json replaces these defaults; `repos` limits one to\n * those repo aliases / group names.\n */\nexport const DEFAULT_PROMPTS: SavedPrompt[] = [\n {\n label: 'Review your changes',\n prompt:\n 'Review the changes on this branch as a strict reviewer would: bugs, missing edge cases, missing tests, leftovers (debug output, TODOs, dead code). Fix what you find, then tell me briefly what you changed.',\n },\n {\n label: 'Add tests',\n prompt:\n 'Add tests for what changed on this branch, following the existing test patterns in this repo. Run them and fix anything that fails.',\n },\n {\n label: 'Run checks and fix',\n prompt:\n \"Run this repo's type check, lint and tests (whatever it has). Fix what fails, and tell me if something is failing for a reason outside this change.\",\n },\n {\n label: 'Commit',\n prompt: \"Commit the current changes with a clear message in this repo's commit style. Don't push.\",\n },\n {\n label: 'Open a pull request',\n prompt:\n 'Push this branch and open a pull request for it with the CLI of the git host its origin is on. Write the title and description yourself from what we did in this conversation: what changed and why, how it was tested, anything a reviewer should look at first. Put the Jira key in the title if the branch or our conversation has one. Open it ready for review, not as a draft, and give me its link.',\n },\n {\n label: 'Rebase on the default branch',\n prompt:\n \"Fetch, then rebase this branch on origin's default branch. Resolve conflicts keeping both sides' intent, run the tests, and tell me about any conflict you weren't sure of.\",\n },\n];\n\nconst MAX_PROMPT = 20_000;\n\n/** The configured list, validated; undefined (use the defaults) when absent. */\nexport function validatePrompts(raw: unknown): SavedPrompt[] | undefined {\n if (!Array.isArray(raw)) return undefined;\n const out: SavedPrompt[] = [];\n for (const p of raw) {\n if (!p || typeof p !== 'object') continue;\n const { label, prompt, repos } = p as Record<string, unknown>;\n if (typeof label !== 'string' || !label.trim() || typeof prompt !== 'string' || !prompt.trim()) continue;\n const item: SavedPrompt = { label: label.trim(), prompt: prompt.trim().slice(0, MAX_PROMPT) };\n if (Array.isArray(repos)) {\n const names = repos.filter((r): r is string => typeof r === 'string' && r.length > 0);\n if (names.length) item.repos = names;\n }\n out.push(item);\n }\n return out;\n}\n\n/** The prompts that apply to a session: unscoped ones, and those naming\n * its target (a repo alias or group name) or one of its repos. */\nexport function promptsForSession(prompts: SavedPrompt[], target: string, repoNames: string[] = []): SavedPrompt[] {\n const names = new Set([target, ...repoNames]);\n return prompts.filter((p) => !p.repos || p.repos.some((r) => names.has(r)));\n}\n","/**\n * A day's suggested hours, from what was worked on (pure; the SPA and the\n * demo use it too). The timesheet tool's rules, as settings: a day of\n * `dayHours`, measured Claude time scaled by `multiplier` (an hour of Claude\n * at work stands for more of yours: reading, testing, talking), all of it\n * capped at `capHours`, in `stepHours` steps with at least `minHours` a\n * ticket, and what's left to the `gapTicket` (meetings, reviews, the rest).\n * A ticket touched with no measured time (a commit, an issue moved) gets the\n * minimum. Unlike the tool, it never goes over the day — too many tickets\n * trim the biggest first, then drop the smallest — and nothing is taken out\n * of one entry alone.\n */\n\nexport interface TimeSettings {\n /** A workday's hours. */\n dayHours: number;\n /** Measured Claude minutes × this = your hours on it. */\n multiplier: number;\n /** At most this much of a day to tickets (the gap ticket keeps the rest). */\n capHours: number;\n stepHours: number;\n /** A ticket that gets time gets at least this. */\n minHours: number;\n /** Gets what's left of the day (null: left unallocated). */\n gapTicket: string | null;\n /** A day off is booked to it (null: a day off books nothing). */\n timeOffTicket: string | null;\n /** Days that aren't workdays besides weekends (`YYYY-MM-DD`). */\n holidays: string[];\n /** Your days off (`YYYY-MM-DD`): booked whole to the time-off ticket, whatever else happened (the timesheet tool's VACATION_DAYS). */\n vacation: string[];\n /**\n * Hours as measured (the timesheet tool's `build --effort`): Claude minutes 1:1 in steps, no multiplier and no\n * minimum beyond a step, a ticket only touched gets no row; the gap ticket takes the rest of the day.\n */\n effort: boolean;\n /** Projects whose tickets are service desk (keep `minHours`); any other project's ticket is a task. */\n deskProjects: string[];\n /** A task's row on a day is at least this (null: tasks get `minHours` like any ticket). */\n taskMinHours: number | null;\n /** A task's measured hours × (1 + this × (story points − 1)) before the day is shared out (0: points don't count). */\n pointsWeight: number;\n}\n\nexport const DEFAULT_TIME_SETTINGS: TimeSettings = {\n dayHours: 7.5,\n multiplier: 5,\n capHours: 7,\n stepHours: 0.25,\n minHours: 0.5,\n gapTicket: null,\n timeOffTicket: null,\n holidays: [],\n vacation: [],\n effort: false,\n deskProjects: [],\n taskMinHours: null,\n pointsWeight: 0.25,\n};\n\n/** A ticket that isn't service desk, the gap ticket or time off: a task (its own minimum, its story points count). */\nexport function isTask(key: string, s: Pick<TimeSettings, 'deskProjects' | 'gapTicket' | 'timeOffTicket'>): boolean {\n return key !== s.gapTicket && key !== s.timeOffTicket && !s.deskProjects.includes(key.split('-')[0]);\n}\n\n/** What a ticket got that day: measured Claude minutes (× multiplier), your own minutes on it (a meeting: 1:1), or only touched (0). */\nexport interface TicketActivity {\n key: string;\n minutes: number;\n direct?: number;\n}\n\nexport interface TimeEntry {\n key: string;\n hours: number;\n}\n\nexport interface DaySuggestion {\n entries: TimeEntry[];\n /** Hours of the day no ticket got (no gap ticket set). */\n unallocated: number;\n /** How each row got its hours, in words, by key: \"51 min of Claude × 5 = 4.25 h\". */\n why: Record<string, string>;\n}\n\n/** \"4.25 h\". */\nconst h2 = (h: number) => `${Math.round(h * 100) / 100} h`;\n\n/**\n * A day's suggestion. `dayOff`: all of it to the time-off ticket.\n * `reserveMinutes`: meetings no ticket got — kept for the gap ticket, so\n * the tickets' share shrinks to leave them room.\n */\nexport function suggestDay(\n activity: readonly TicketActivity[],\n s: TimeSettings,\n opts: { dayOff?: boolean; reserveMinutes?: number; points?: Record<string, number> } = {},\n): DaySuggestion {\n // Whole steps, so sums are exact.\n const units = (h: number) => Math.round(h / s.stepHours);\n const day = units(s.dayHours);\n const hours = (u: number) => Math.round(u * s.stepHours * 100) / 100;\n if (opts.dayOff)\n return s.timeOffTicket\n ? { entries: [{ key: s.timeOffTicket, hours: s.dayHours }], unallocated: 0, why: { [s.timeOffTicket]: 'a day off: the whole day' } }\n : { entries: [], unallocated: s.dayHours, why: {} };\n\n // One row per ticket; the gap ticket's own time goes into what it gets at the end.\n const minutes = new Map<string, { claude: number; direct: number }>();\n for (const a of activity) {\n if (!a.key || a.key === s.gapTicket) continue;\n const m = minutes.get(a.key) ?? { claude: 0, direct: 0 };\n m.claude += Math.max(0, a.minutes);\n m.direct += Math.max(0, a.direct ?? 0);\n minutes.set(a.key, m);\n }\n const min = s.effort ? 1 : Math.max(1, units(s.minHours));\n // A task's own minimum (as measured, none beyond a step).\n const task = (key: string) => !s.effort && s.taskMinHours !== null && isTask(key, s);\n const minFor = (key: string) => (task(key) ? Math.max(min, units(s.taskMinHours!)) : min);\n // Story points weigh a task's share: × (1 + weight × (points − 1)); unknown points, a desk ticket: × 1.\n const factorFor = (key: string) => {\n const p = opts.points?.[key];\n return !s.effort && p !== undefined && p > 0 && isTask(key, s) ? Math.max(0, 1 + s.pointsWeight * (p - 1)) : 1;\n };\n const multiplier = s.effort ? 1 : s.multiplier;\n // Room for tickets: the cap, and the day less what the gap ticket keeps (its minimum, or the meetings it has).\n const reserve = s.gapTicket ? Math.max(min, units((opts.reserveMinutes ?? 0) / 60)) : 0;\n const room = Math.max(0, Math.min(units(s.capHours), day - reserve));\n const raw = [...minutes].map(([key, m]) => {\n const h = ((m.claude / 60) * multiplier + m.direct / 60) * factorFor(key);\n // Only touched (a commit, an issue moved): the minimum — or, measuring effort, nothing.\n return { key, raw: h > 0 ? h : s.effort ? 0 : s.minHours };\n });\n const total = raw.reduce((n, r) => n + r.raw, 0);\n const scale = total > room * s.stepHours && total > 0 ? (room * s.stepHours) / total : 1;\n let rows = raw\n .map((r) => {\n const scaled = r.raw * scale;\n const u = units(scaled);\n // Under its minimum: the minimum when it's at least a step's worth, else nothing.\n const least = minFor(r.key);\n return { key: r.key, raw: scaled, u: u >= least ? u : scaled >= s.stepHours ? least : 0, first: 0 };\n })\n .filter((r) => r.u > 0);\n for (const r of rows) r.first = r.u;\n // Rounding up to minimums can overshoot the room: trim the biggest a step at a time, then drop the smallest.\n let used = rows.reduce((n, r) => n + r.u, 0);\n const dropped: string[] = [];\n while (used > room && rows.length) {\n const big = rows.filter((r) => r.u > minFor(r.key)).sort((a, b) => b.u - a.u || a.key.localeCompare(b.key))[0];\n if (big) big.u--;\n else {\n rows = rows.sort((a, b) => a.raw - b.raw);\n dropped.push(rows[0].key);\n rows = rows.slice(1);\n }\n used = rows.reduce((n, r) => n + r.u, 0);\n }\n const entries = rows.sort((a, b) => b.u - a.u || a.key.localeCompare(b.key)).map((r) => ({ key: r.key, hours: hours(r.u) }));\n\n // The words: what it measured, how that became hours, and every step after (cut to fit, a minimum, trimmed).\n const why: Record<string, string> = {};\n const roomWhy =\n room === units(s.capHours) && units(s.capHours) <= day - reserve\n ? `the ${h2(s.capHours)} cap for tickets`\n : `the ${h2(s.dayHours)} day less ${h2(hours(reserve))} kept for ${s.gapTicket}${(opts.reserveMinutes ?? 0) > 0 ? ' (meetings no ticket got)' : ''}`;\n for (const r of rows) {\n const m = minutes.get(r.key)!;\n const parts: string[] = [];\n if (m.claude > 0)\n parts.push(s.effort ? `${Math.round(m.claude)} min of Claude, as measured` : `${Math.round(m.claude)} min of Claude × ${multiplier}`);\n if (m.direct > 0) parts.push(`${Math.round(m.direct)} min of meetings`);\n const measured = (m.claude / 60) * multiplier + m.direct / 60;\n const factor = factorFor(r.key);\n const steps: string[] = [\n measured > 0\n ? `${parts.join(' + ')} = ${h2(measured)}`\n : `only touched (a commit, an issue moved, a chat): the ${h2(s.minHours)} minimum`,\n ];\n if (measured > 0 && factor !== 1)\n steps.push(`× ${Math.round(factor * 100) / 100} for ${opts.points![r.key]} story points = ${h2(measured * factor)}`);\n if (scale < 1) steps.push(`all tickets came to ${h2(total)}, over ${roomWhy}: each cut to ${Math.round(scale * 100)}%`);\n const least = minFor(r.key);\n if (r.first === least && units(r.raw) < least && (measured > 0 || least > min))\n steps.push(least > min ? `raised to the ${h2(hours(least))} minimum for a task` : `raised to the ${h2(s.minHours)} minimum`);\n if (r.u < r.first) steps.push(`trimmed ${h2(hours(r.first - r.u))} so the day adds up`);\n why[r.key] = `${steps.join('; ')} → ${h2(hours(r.u))}`;\n }\n\n const left = day - used;\n if (s.gapTicket && left > 0) {\n why[s.gapTicket] =\n (dropped.length ? `no room left for ${dropped.join(', ')} (each under its minimum); ` : '') +\n `the rest of the ${h2(s.dayHours)} day${(opts.reserveMinutes ?? 0) > 0 ? `, ${Math.round(opts.reserveMinutes ?? 0)} min of it meetings no ticket got` : ''} → ${h2(hours(left))}`;\n return { entries: [...entries, { key: s.gapTicket, hours: hours(left) }], unallocated: 0, why };\n }\n return { entries, unallocated: hours(Math.max(0, left)), why };\n}\n\n/** Sum of a day's entries, in hours (to two decimals). */\nexport function totalHours(entries: readonly TimeEntry[]): number {\n return Math.round(entries.reduce((n, e) => n + e.hours, 0) * 100) / 100;\n}\n\n/** Monday to Friday, and not a holiday. */\nexport function isWorkday(day: string, s: Pick<TimeSettings, 'holidays'>): boolean {\n const d = new Date(`${day}T12:00:00`);\n const wd = d.getDay();\n return wd !== 0 && wd !== 6 && !s.holidays.includes(day);\n}\n\n/** A Jira issue key, as found in a branch, a commit subject or a title. */\nexport const ISSUE_KEY = /\\b([A-Z][A-Z0-9]{1,9}-\\d+)\\b/g;\n\n/** Whether a string is one issue key, whole (a row's key, a configured ticket). */\nexport function isIssueKey(s: string): boolean {\n return new RegExp(`^${ISSUE_KEY.source}$`).test(s);\n}\n\n/** The issue keys in a text, only of the given projects when any are given (`UTF-8` isn't an issue). */\nexport function issueKeys(text: string, projects?: ReadonlySet<string>): string[] {\n const out: string[] = [];\n for (const m of text.matchAll(ISSUE_KEY)) {\n const key = m[1];\n if (projects && projects.size && !projects.has(key.split('-')[0])) continue;\n if (!out.includes(key)) out.push(key);\n }\n return out;\n}\n"],"mappings":";;;;;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;;;ACYV,IAAM,kBAAiC;AAAA,EAC5C;AAAA,IACE,OAAO;AAAA,IACP,QACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,QACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,QACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,QAAQ;AAAA,EACV;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,QACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,QACE;AAAA,EACJ;AACF;AAEA,IAAM,aAAa;AAGZ,SAAS,gBAAgB,KAAyC;AACvE,MAAI,CAAC,MAAM,QAAQ,GAAG,EAAG,QAAO;AAChC,QAAM,MAAqB,CAAC;AAC5B,aAAW,KAAK,KAAK;AACnB,QAAI,CAAC,KAAK,OAAO,MAAM,SAAU;AACjC,UAAM,EAAE,OAAO,QAAQ,MAAM,IAAI;AACjC,QAAI,OAAO,UAAU,YAAY,CAAC,MAAM,KAAK,KAAK,OAAO,WAAW,YAAY,CAAC,OAAO,KAAK,EAAG;AAChG,UAAM,OAAoB,EAAE,OAAO,MAAM,K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
8
|
function findSession(sessionId) {
|
|
@@ -68,4 +68,4 @@ export {
|
|
|
68
68
|
disposeSessionWatcher,
|
|
69
69
|
disposeAllWatchers
|
|
70
70
|
};
|
|
71
|
-
//# sourceMappingURL=chunk-
|
|
71
|
+
//# sourceMappingURL=chunk-O6UWELSS.js.map
|