@moberg_hr/work-tree 2.11.2 → 2.11.4
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-TEV24OIT.js → account-JOKEFQ46.js} +19 -18
- package/dist/{account-TEV24OIT.js.map → account-JOKEFQ46.js.map} +1 -1
- package/dist/{add-repo-RTWDVZLS.js → add-repo-JKVHNRWU.js} +20 -19
- package/dist/{add-repo-RTWDVZLS.js.map → add-repo-JKVHNRWU.js.map} +1 -1
- package/dist/{answer-Z73ZUV4U.js → answer-PDCLL5Z2.js} +11 -10
- package/dist/{answer-Z73ZUV4U.js.map → answer-PDCLL5Z2.js.map} +1 -1
- package/dist/{attach-46EMF36G.js → attach-BIFQP5OY.js} +15 -14
- package/dist/{attach-46EMF36G.js.map → attach-BIFQP5OY.js.map} +1 -1
- package/dist/bin.js +3 -3
- package/dist/{block-YZUWOE32.js → block-EI3OQVDM.js} +16 -15
- package/dist/{block-YZUWOE32.js.map → block-EI3OQVDM.js.map} +1 -1
- package/dist/{broadcast-WKG6KOY4.js → broadcast-ZSA3L5FY.js} +7 -6
- package/dist/{broadcast-WKG6KOY4.js.map → broadcast-ZSA3L5FY.js.map} +1 -1
- package/dist/{catchup-QSE2VRQI.js → catchup-SNMGWNRX.js} +14 -13
- package/dist/{catchup-QSE2VRQI.js.map → catchup-SNMGWNRX.js.map} +1 -1
- package/dist/{chunk-KSVYR4G2.js → chunk-253Q6TOC.js} +3 -3
- package/dist/{chunk-323URLMS.js → chunk-2R6EHVZG.js} +3 -3
- package/dist/{chunk-2FEJ66UR.js → chunk-2VYWTBC6.js} +3 -3
- package/dist/{chunk-ZNH72CNE.js → chunk-2YKV6MNQ.js} +3 -3
- package/dist/{chunk-52WAQNW2.js → chunk-3LDQPUJ6.js} +6 -6
- package/dist/{chunk-BVTV67Y2.js → chunk-3PXA5RJ2.js} +32 -5
- package/dist/chunk-3PXA5RJ2.js.map +1 -0
- package/dist/{chunk-TQEG7UWB.js → chunk-3QEDOZMA.js} +3 -3
- package/dist/{chunk-EL3XL2OC.js → chunk-3QKH7JNR.js} +2 -64
- package/dist/chunk-3QKH7JNR.js.map +1 -0
- package/dist/{chunk-MSJWQC7H.js → chunk-3UI35AFZ.js} +2 -2
- package/dist/{chunk-VPTHUGPB.js → chunk-3XU7Y2MV.js} +2 -2
- package/dist/{chunk-JNBMANFM.js → chunk-5DUKO7WC.js} +3 -3
- package/dist/{chunk-I6MILNM5.js → chunk-5ZU6H62F.js} +2 -2
- package/dist/{chunk-RGLIW45S.js → chunk-6C7CR2W2.js} +2 -2
- package/dist/{chunk-ZGUMZJLW.js → chunk-6MMXVHPL.js} +7 -7
- package/dist/{chunk-XU7TWI23.js → chunk-73MGZAGV.js} +2 -2
- package/dist/{chunk-PPZP7CA7.js → chunk-7HQM5NYN.js} +3 -3
- package/dist/{chunk-4DKXJGZU.js → chunk-7OZZUQDW.js} +4 -4
- package/dist/{chunk-O36SFV5G.js → chunk-AU7XGTJZ.js} +2 -2
- package/dist/chunk-AWY2HWAQ.js +9 -0
- package/dist/{chunk-OXKUVNQL.js → chunk-BENY64FW.js} +3 -3
- package/dist/{chunk-MQCDFSVF.js → chunk-BLOV7ECI.js} +2 -2
- package/dist/{chunk-QZU6TQM7.js → chunk-BTR2E5WD.js} +13 -13
- package/dist/{chunk-CGXZSYY3.js → chunk-CJ2QTQHG.js} +3 -2
- package/dist/chunk-CJ2QTQHG.js.map +1 -0
- package/dist/{chunk-3XKGKOVC.js → chunk-CL3SSNBC.js} +3 -3
- package/dist/{chunk-3XKGKOVC.js.map → chunk-CL3SSNBC.js.map} +1 -1
- package/dist/{chunk-DCCC7LEP.js → chunk-CSTPOCV2.js} +5 -3
- package/dist/{chunk-DCCC7LEP.js.map → chunk-CSTPOCV2.js.map} +1 -1
- package/dist/{chunk-O4V7K5HL.js → chunk-DMA3XCMF.js} +6 -6
- package/dist/{chunk-H3VAWTA4.js → chunk-E6WVQXF4.js} +3 -3
- package/dist/{chunk-U4CIMKG2.js → chunk-F7IOGLKV.js} +6 -6
- package/dist/{chunk-UQJUIOGU.js → chunk-FFL7ETBY.js} +5 -5
- package/dist/{chunk-WW2FT2L3.js → chunk-GAE3NB3G.js} +8 -8
- package/dist/{chunk-WZSKGVOQ.js → chunk-GV3KXHF3.js} +3 -3
- package/dist/{chunk-HPCGWSTO.js → chunk-HECIDNBU.js} +8 -8
- package/dist/{chunk-EUY7ZOAM.js → chunk-HJ2RKMBI.js} +2 -2
- package/dist/{chunk-DAKJTB6N.js → chunk-HRUKMBF3.js} +2 -2
- package/dist/{chunk-26YZYL77.js → chunk-IYWNDEXA.js} +5 -5
- package/dist/{chunk-MAMO57YN.js → chunk-K7Y7YTN3.js} +2 -2
- package/dist/{chunk-N4W34U3I.js → chunk-KCDHOW22.js} +42 -18
- package/dist/chunk-KCDHOW22.js.map +1 -0
- package/dist/{chunk-AHYCZUPI.js → chunk-KKVWDMSM.js} +2 -2
- package/dist/{chunk-I2ZBOLXK.js → chunk-KP2CI5QU.js} +4 -4
- package/dist/{chunk-FCGFXV6C.js → chunk-LPHYUNMD.js} +5 -5
- package/dist/{chunk-UNKJVL2C.js → chunk-M7FX37Z2.js} +5 -5
- package/dist/{chunk-7QNVFVG6.js → chunk-MBSCZQ2C.js} +2 -2
- package/dist/chunk-MBSCZQ2C.js.map +1 -0
- package/dist/{chunk-GZYXCMJH.js → chunk-MGNJPBZU.js} +5 -5
- package/dist/{chunk-I4YAFPYP.js → chunk-N75AJ3ZR.js} +3 -3
- package/dist/{chunk-S3QXYWKF.js → chunk-PHHBZDO2.js} +55 -53
- package/dist/chunk-PHHBZDO2.js.map +1 -0
- package/dist/{chunk-4K4S53KX.js → chunk-PMEOGFGV.js} +2 -2
- package/dist/{chunk-562VO6OV.js → chunk-QRYZAY7R.js} +6 -6
- package/dist/{chunk-B5GJNQFD.js → chunk-RH4BGTER.js} +3 -3
- package/dist/{chunk-4CNBSPNL.js → chunk-RIEBQWQC.js} +2 -2
- package/dist/{chunk-ODCAGWB7.js → chunk-RUUEZSQY.js} +6 -6
- package/dist/{chunk-7HNGU6VR.js → chunk-RXZKYHSW.js} +4 -4
- package/dist/{chunk-VHYTF5Z3.js → chunk-SC2FQ6BR.js} +5 -5
- package/dist/{chunk-NUMRRBHL.js → chunk-SMXRY653.js} +6 -6
- package/dist/{chunk-3JJLUNPD.js → chunk-SQ4ZGEZY.js} +6 -3
- package/dist/chunk-SQ4ZGEZY.js.map +1 -0
- package/dist/{chunk-PMR5TOBL.js → chunk-TW44C7CG.js} +5 -5
- package/dist/{chunk-SO3GLVKM.js → chunk-U3RRXU6W.js} +7 -7
- package/dist/{chunk-QHXMVK75.js → chunk-VADGWMXL.js} +5 -5
- package/dist/chunk-VQACXAFX.js +69 -0
- package/dist/chunk-VQACXAFX.js.map +1 -0
- package/dist/{chunk-6OG7ERB5.js → chunk-WQN7HJK6.js} +15 -9
- package/dist/chunk-WQN7HJK6.js.map +1 -0
- package/dist/{chunk-CD6I23QB.js → chunk-WV5U4S5N.js} +7 -7
- package/dist/{chunk-63ZLPXRL.js → chunk-WYQD44Y4.js} +2 -2
- package/dist/{chunk-FJTMZB4E.js → chunk-XZKQHQBB.js} +4 -4
- package/dist/{chunk-GYWLYPXX.js → chunk-ZJBVZ4OJ.js} +4 -4
- package/dist/{chunk-EXNL7TI7.js → chunk-ZX2VBM2F.js} +4 -4
- package/dist/{cleanup-4SBO55WC.js → cleanup-5CPX253G.js} +36 -35
- package/dist/{cleanup-4SBO55WC.js.map → cleanup-5CPX253G.js.map} +1 -1
- package/dist/cli-D2RPZWWM.js +20 -0
- package/dist/{completion-IAH7WRKJ.js → completion-QCB7PKKT.js} +4 -3
- package/dist/{completion-IAH7WRKJ.js.map → completion-QCB7PKKT.js.map} +1 -1
- package/dist/{config-TPMJCP5K.js → config-EQFAXBMQ.js} +13 -12
- package/dist/{config-TPMJCP5K.js.map → config-EQFAXBMQ.js.map} +1 -1
- package/dist/{diff-BW6BSFQS.js → diff-MLCUMIYC.js} +13 -12
- package/dist/{diff-BW6BSFQS.js.map → diff-MLCUMIYC.js.map} +1 -1
- package/dist/{digest-I53EQ6FM.js → digest-KSAGLQND.js} +10 -9
- package/dist/{digest-I53EQ6FM.js.map → digest-KSAGLQND.js.map} +1 -1
- package/dist/{fork-GORLJ5D7.js → fork-RCTVMUYI.js} +32 -31
- package/dist/{fork-GORLJ5D7.js.map → fork-RCTVMUYI.js.map} +1 -1
- package/dist/{history-QQ72P3PD.js → history-N4ZURR4F.js} +9 -6
- package/dist/{hook-PSCHP6OD.js → hook-DRZVYLJB.js} +13 -12
- package/dist/{hook-PSCHP6OD.js.map → hook-DRZVYLJB.js.map} +1 -1
- package/dist/{hydrate-JWUZUKQR.js → hydrate-NVJZZAFT.js} +8 -7
- package/dist/{hydrate-JWUZUKQR.js.map → hydrate-NVJZZAFT.js.map} +1 -1
- package/dist/{init-C6CCVCZ3.js → init-RF6YC4BQ.js} +18 -17
- package/dist/{init-C6CCVCZ3.js.map → init-RF6YC4BQ.js.map} +1 -1
- package/dist/{install-skills-KS6N4U6L.js → install-skills-DV7JBW56.js} +7 -6
- package/dist/install-skills-bin.js +6 -5
- package/dist/install-skills-bin.js.map +1 -1
- package/dist/keep-7Q3B6QT5.js +53 -0
- package/dist/keep-7Q3B6QT5.js.map +1 -0
- package/dist/{list-LLB6KAFP.js → list-PIJ4ROHR.js} +9 -8
- package/dist/{list-LLB6KAFP.js.map → list-PIJ4ROHR.js.map} +1 -1
- package/dist/{move-IU6BI3JN.js → move-XAZG3MJT.js} +22 -21
- package/dist/{move-IU6BI3JN.js.map → move-XAZG3MJT.js.map} +1 -1
- package/dist/{note-7USST5R5.js → note-JJXIQ4QK.js} +10 -9
- package/dist/{note-7USST5R5.js.map → note-JJXIQ4QK.js.map} +1 -1
- package/dist/{overlaps-YCKUSS6F.js → overlaps-3YN4UQWC.js} +17 -16
- package/dist/{overlaps-YCKUSS6F.js.map → overlaps-3YN4UQWC.js.map} +1 -1
- package/dist/{pin-OVQLMH5R.js → pin-OOCB6DFR.js} +10 -9
- package/dist/{pin-OVQLMH5R.js.map → pin-OOCB6DFR.js.map} +1 -1
- package/dist/{pr-CEH64GGM.js → pr-LCG4W65A.js} +24 -23
- package/dist/{pr-CEH64GGM.js.map → pr-LCG4W65A.js.map} +1 -1
- package/dist/{prune-D2GPBZZ4.js → prune-2NGAUOPI.js} +34 -33
- package/dist/{prune-D2GPBZZ4.js.map → prune-2NGAUOPI.js.map} +1 -1
- package/dist/{pty-host-TNIVMCBV.js → pty-host-XRXRI6UL.js} +13 -12
- package/dist/{pty-host-TNIVMCBV.js.map → pty-host-XRXRI6UL.js.map} +1 -1
- package/dist/{read-Q47ZI64J.js → read-FJDDCX4D.js} +10 -9
- package/dist/{read-Q47ZI64J.js.map → read-FJDDCX4D.js.map} +1 -1
- package/dist/{recent-YRCOQC4A.js → recent-AAXLCQUF.js} +14 -13
- package/dist/{recent-YRCOQC4A.js.map → recent-AAXLCQUF.js.map} +1 -1
- package/dist/{remove-EEQHU53O.js → remove-VO5V45IJ.js} +33 -32
- package/dist/{remove-EEQHU53O.js.map → remove-VO5V45IJ.js.map} +1 -1
- package/dist/{restart-RVRLKW2Q.js → restart-AP763LE2.js} +11 -10
- package/dist/{restart-RVRLKW2Q.js.map → restart-AP763LE2.js.map} +1 -1
- package/dist/{resume-2ZAGQMV7.js → resume-SPO5XNDT.js} +14 -13
- package/dist/{resume-2ZAGQMV7.js.map → resume-SPO5XNDT.js.map} +1 -1
- package/dist/review-5IGFQF2T.js +120 -0
- package/dist/review-5IGFQF2T.js.map +1 -0
- package/dist/{run-MEL42R3A.js → run-JZWZHJOE.js} +7 -6
- package/dist/{run-MEL42R3A.js.map → run-JZWZHJOE.js.map} +1 -1
- package/dist/{screen-JNHBNT3Z.js → screen-JRMMYVHB.js} +11 -10
- package/dist/{screen-JNHBNT3Z.js.map → screen-JRMMYVHB.js.map} +1 -1
- package/dist/{search-55ZJKEHN.js → search-XOWMVFP2.js} +7 -6
- package/dist/{search-55ZJKEHN.js.map → search-XOWMVFP2.js.map} +1 -1
- package/dist/{section-KTIOZ67K.js → section-7WO7IHG6.js} +10 -9
- package/dist/{section-KTIOZ67K.js.map → section-7WO7IHG6.js.map} +1 -1
- package/dist/{send-NTTZ5K6N.js → send-OCSMOCUE.js} +16 -15
- package/dist/{send-NTTZ5K6N.js.map → send-OCSMOCUE.js.map} +1 -1
- package/dist/{sessions-7PSFS7KI.js → sessions-UAZALGGH.js} +28 -27
- package/dist/{sessions-7PSFS7KI.js.map → sessions-UAZALGGH.js.map} +1 -1
- package/dist/{snooze-IVWKZMOD.js → snooze-UDJ5UDCS.js} +10 -9
- package/dist/{snooze-IVWKZMOD.js.map → snooze-UDJ5UDCS.js.map} +1 -1
- package/dist/{start-3TQXW22D.js → start-OEG3T2SW.js} +11 -10
- package/dist/{start-3TQXW22D.js.map → start-OEG3T2SW.js.map} +1 -1
- package/dist/{status-LNDJJARR.js → status-R4T2EHG5.js} +14 -13
- package/dist/{status-LNDJJARR.js.map → status-R4T2EHG5.js.map} +1 -1
- package/dist/{statusline-WKKYCH7O.js → statusline-3H3HAPCZ.js} +5 -4
- package/dist/{statusline-WKKYCH7O.js.map → statusline-3H3HAPCZ.js.map} +1 -1
- package/dist/{statusline-hook-K7KPN2H6.js → statusline-hook-FILOARNM.js} +5 -4
- package/dist/{statusline-hook-K7KPN2H6.js.map → statusline-hook-FILOARNM.js.map} +1 -1
- package/dist/{stop-DZJDYVUY.js → stop-D3LRCCJS.js} +11 -10
- package/dist/{stop-DZJDYVUY.js.map → stop-D3LRCCJS.js.map} +1 -1
- package/dist/{sync-TZYDXWA6.js → sync-FWC2EWLW.js} +34 -33
- package/dist/{sync-TZYDXWA6.js.map → sync-FWC2EWLW.js.map} +1 -1
- package/dist/{time-NZG6C7OX.js → time-AMAMIDWD.js} +11 -10
- package/dist/{time-NZG6C7OX.js.map → time-AMAMIDWD.js.map} +1 -1
- package/dist/{timesheet-6U35X2KH.js → timesheet-QFBA2Z2A.js} +18 -17
- package/dist/{timesheet-6U35X2KH.js.map → timesheet-QFBA2Z2A.js.map} +1 -1
- package/dist/{tree-P27UZCXD.js → tree-PJM2R2VA.js} +35 -34
- package/dist/{tree-P27UZCXD.js.map → tree-PJM2R2VA.js.map} +1 -1
- package/dist/{update-5UQBKLML.js → update-RVZMM54Z.js} +20 -19
- package/dist/{update-5UQBKLML.js.map → update-RVZMM54Z.js.map} +1 -1
- package/dist/{usage-OZNRH45Z.js → usage-W4UXQUPD.js} +9 -8
- package/dist/{usage-OZNRH45Z.js.map → usage-W4UXQUPD.js.map} +1 -1
- package/dist/{version-TVT6GSRF.js → version-WPF664CL.js} +8 -6
- package/dist/{version-TVT6GSRF.js.map → version-WPF664CL.js.map} +1 -1
- package/dist/{wait-MAEZJP4D.js → wait-C3S7Q6FA.js} +11 -10
- package/dist/{wait-MAEZJP4D.js.map → wait-C3S7Q6FA.js.map} +1 -1
- package/dist/wd-bin.js +8 -7
- package/dist/wd-bin.js.map +1 -1
- package/dist/web/assets/{PtyView-CKn5mESo.js → PtyView-Bq8MHIjd.js} +2 -2
- package/dist/web/assets/{PtyView-CKn5mESo.js.map → PtyView-Bq8MHIjd.js.map} +1 -1
- package/dist/web/assets/index-DkVQmwkZ.js +126 -0
- package/dist/web/assets/{index-DYhzy-XC.js.map → index-DkVQmwkZ.js.map} +1 -1
- package/dist/web/assets/index-vHIk7hQs.css +1 -0
- package/dist/web/index.html +2 -2
- package/dist/{web-7T6QQSJV.js → web-MPSYOYQ2.js} +113 -83
- package/dist/web-MPSYOYQ2.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/dist/chunk-3JJLUNPD.js.map +0 -1
- package/dist/chunk-6OG7ERB5.js.map +0 -1
- package/dist/chunk-7QNVFVG6.js.map +0 -1
- package/dist/chunk-BVTV67Y2.js.map +0 -1
- package/dist/chunk-CGXZSYY3.js.map +0 -1
- package/dist/chunk-EL3XL2OC.js.map +0 -1
- package/dist/chunk-FL44GFZZ.js +0 -9
- package/dist/chunk-N4W34U3I.js.map +0 -1
- package/dist/chunk-S3QXYWKF.js.map +0 -1
- package/dist/cli-73SMUICE.js +0 -19
- package/dist/web/assets/index-CpqiTeqj.css +0 -1
- package/dist/web/assets/index-DYhzy-XC.js +0 -126
- package/dist/web-7T6QQSJV.js.map +0 -1
- /package/dist/{chunk-KSVYR4G2.js.map → chunk-253Q6TOC.js.map} +0 -0
- /package/dist/{chunk-323URLMS.js.map → chunk-2R6EHVZG.js.map} +0 -0
- /package/dist/{chunk-2FEJ66UR.js.map → chunk-2VYWTBC6.js.map} +0 -0
- /package/dist/{chunk-ZNH72CNE.js.map → chunk-2YKV6MNQ.js.map} +0 -0
- /package/dist/{chunk-52WAQNW2.js.map → chunk-3LDQPUJ6.js.map} +0 -0
- /package/dist/{chunk-TQEG7UWB.js.map → chunk-3QEDOZMA.js.map} +0 -0
- /package/dist/{chunk-MSJWQC7H.js.map → chunk-3UI35AFZ.js.map} +0 -0
- /package/dist/{chunk-VPTHUGPB.js.map → chunk-3XU7Y2MV.js.map} +0 -0
- /package/dist/{chunk-JNBMANFM.js.map → chunk-5DUKO7WC.js.map} +0 -0
- /package/dist/{chunk-I6MILNM5.js.map → chunk-5ZU6H62F.js.map} +0 -0
- /package/dist/{chunk-RGLIW45S.js.map → chunk-6C7CR2W2.js.map} +0 -0
- /package/dist/{chunk-ZGUMZJLW.js.map → chunk-6MMXVHPL.js.map} +0 -0
- /package/dist/{chunk-XU7TWI23.js.map → chunk-73MGZAGV.js.map} +0 -0
- /package/dist/{chunk-PPZP7CA7.js.map → chunk-7HQM5NYN.js.map} +0 -0
- /package/dist/{chunk-4DKXJGZU.js.map → chunk-7OZZUQDW.js.map} +0 -0
- /package/dist/{chunk-O36SFV5G.js.map → chunk-AU7XGTJZ.js.map} +0 -0
- /package/dist/{chunk-FL44GFZZ.js.map → chunk-AWY2HWAQ.js.map} +0 -0
- /package/dist/{chunk-OXKUVNQL.js.map → chunk-BENY64FW.js.map} +0 -0
- /package/dist/{chunk-MQCDFSVF.js.map → chunk-BLOV7ECI.js.map} +0 -0
- /package/dist/{chunk-QZU6TQM7.js.map → chunk-BTR2E5WD.js.map} +0 -0
- /package/dist/{chunk-O4V7K5HL.js.map → chunk-DMA3XCMF.js.map} +0 -0
- /package/dist/{chunk-H3VAWTA4.js.map → chunk-E6WVQXF4.js.map} +0 -0
- /package/dist/{chunk-U4CIMKG2.js.map → chunk-F7IOGLKV.js.map} +0 -0
- /package/dist/{chunk-UQJUIOGU.js.map → chunk-FFL7ETBY.js.map} +0 -0
- /package/dist/{chunk-WW2FT2L3.js.map → chunk-GAE3NB3G.js.map} +0 -0
- /package/dist/{chunk-WZSKGVOQ.js.map → chunk-GV3KXHF3.js.map} +0 -0
- /package/dist/{chunk-HPCGWSTO.js.map → chunk-HECIDNBU.js.map} +0 -0
- /package/dist/{chunk-EUY7ZOAM.js.map → chunk-HJ2RKMBI.js.map} +0 -0
- /package/dist/{chunk-DAKJTB6N.js.map → chunk-HRUKMBF3.js.map} +0 -0
- /package/dist/{chunk-26YZYL77.js.map → chunk-IYWNDEXA.js.map} +0 -0
- /package/dist/{chunk-MAMO57YN.js.map → chunk-K7Y7YTN3.js.map} +0 -0
- /package/dist/{chunk-AHYCZUPI.js.map → chunk-KKVWDMSM.js.map} +0 -0
- /package/dist/{chunk-I2ZBOLXK.js.map → chunk-KP2CI5QU.js.map} +0 -0
- /package/dist/{chunk-FCGFXV6C.js.map → chunk-LPHYUNMD.js.map} +0 -0
- /package/dist/{chunk-UNKJVL2C.js.map → chunk-M7FX37Z2.js.map} +0 -0
- /package/dist/{chunk-GZYXCMJH.js.map → chunk-MGNJPBZU.js.map} +0 -0
- /package/dist/{chunk-I4YAFPYP.js.map → chunk-N75AJ3ZR.js.map} +0 -0
- /package/dist/{chunk-4K4S53KX.js.map → chunk-PMEOGFGV.js.map} +0 -0
- /package/dist/{chunk-562VO6OV.js.map → chunk-QRYZAY7R.js.map} +0 -0
- /package/dist/{chunk-B5GJNQFD.js.map → chunk-RH4BGTER.js.map} +0 -0
- /package/dist/{chunk-4CNBSPNL.js.map → chunk-RIEBQWQC.js.map} +0 -0
- /package/dist/{chunk-ODCAGWB7.js.map → chunk-RUUEZSQY.js.map} +0 -0
- /package/dist/{chunk-7HNGU6VR.js.map → chunk-RXZKYHSW.js.map} +0 -0
- /package/dist/{chunk-VHYTF5Z3.js.map → chunk-SC2FQ6BR.js.map} +0 -0
- /package/dist/{chunk-NUMRRBHL.js.map → chunk-SMXRY653.js.map} +0 -0
- /package/dist/{chunk-PMR5TOBL.js.map → chunk-TW44C7CG.js.map} +0 -0
- /package/dist/{chunk-SO3GLVKM.js.map → chunk-U3RRXU6W.js.map} +0 -0
- /package/dist/{chunk-QHXMVK75.js.map → chunk-VADGWMXL.js.map} +0 -0
- /package/dist/{chunk-CD6I23QB.js.map → chunk-WV5U4S5N.js.map} +0 -0
- /package/dist/{chunk-63ZLPXRL.js.map → chunk-WYQD44Y4.js.map} +0 -0
- /package/dist/{chunk-FJTMZB4E.js.map → chunk-XZKQHQBB.js.map} +0 -0
- /package/dist/{chunk-GYWLYPXX.js.map → chunk-ZJBVZ4OJ.js.map} +0 -0
- /package/dist/{chunk-EXNL7TI7.js.map → chunk-ZX2VBM2F.js.map} +0 -0
- /package/dist/{cli-73SMUICE.js.map → cli-D2RPZWWM.js.map} +0 -0
- /package/dist/{history-QQ72P3PD.js.map → history-N4ZURR4F.js.map} +0 -0
- /package/dist/{install-skills-KS6N4U6L.js.map → install-skills-DV7JBW56.js.map} +0 -0
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moberg_hr/work-tree",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.4",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@moberg_hr/work-tree",
|
|
9
|
-
"version": "2.11.
|
|
9
|
+
"version": "2.11.4",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/agents/assistant.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { getConfigDir } from '../platform/config.js';\nimport { atomicWriteFile } from '../platform/fs-safe.js';\nimport type { AssistantView, SessionWire } from '../api-types.js';\nimport { DISPLAY_LABEL, displayStatus } from '../sessions/session-view.js';\nimport type { AgentAdapter, AllowRule, WorkHook } from './types.js';\nimport { branchesText } from '../sessions/branch-view.js';\n\n/**\n * The dashboard assistant (Ctrl+K): a persistent agent session in the PTY\n * host, like any worktree's, with its own folder under ~/.work/assistant. It\n * runs config `assistantAgent` (Claude Code by default; `assistantAgent()`).\n *\n * That folder is written by work: the agent's instructions file (CLAUDE.md\n * for Claude) saying what it is for and how to get the data (the\n * `work … --json` commands), and through its adapter's `workspace` its own\n * settings: the read-only commands pre-allowed, and a hook at the start of\n * each turn that adds what the user is looking at in the dashboard to the\n * prompt (`work hook assistant-context`), so \"clean these up\" or \"why is this\n * one blocked?\" need no explaining. An agent without a workspace gets the\n * instructions only (it asks before every command, and sees no view).\n *\n * It runs in the agent's normal permission mode, as every session does: anything\n * not pre-allowed — `work cleanup --apply`, `work remove`, git — asks first,\n * in the panel (and the Inbox).\n */\n\nexport const ASSISTANT_ID = 'assistant';\n\n/** What the dashboard reported, kept this long for the hook. */\nexport const CONTEXT_TTL_MS = 30 * 60_000;\n\nexport function assistantDir(): string {\n return path.join(getConfigDir(), 'assistant');\n}\nconst contextFile = () => path.join(assistantDir(), 'context.json');\n\n/**\n * Read-only commands it may run without asking (each agent's adapter writes\n * them in its own terms). Exact forms for cleanup: a `work cleanup --json`\n * prefix rule would also allow `--apply`.\n */\nexport const ASSISTANT_ALLOW: AllowRule[] = [\n { command: 'work sessions', prefix: true },\n { command: 'work digest', prefix: true },\n { command: 'work overlaps', prefix: true },\n { command: 'work search', prefix: true },\n { command: 'work cleanup --json' },\n { command: 'work cleanup --json --no-fetch' },\n { command: 'work cleanup --no-fetch --json' },\n { command: 'work list', prefix: true },\n { command: 'work recent', prefix: true },\n // The Time tab's day, read only (set / reset / off / gather / post ask first).\n { command: 'work timesheet show', prefix: true },\n { command: 'work timesheet month', prefix: true },\n];\n\n/** Its hook: what the dashboard shows, added at the start of each turn. */\nexport const ASSISTANT_HOOKS: WorkHook[] = [\n { owner: 'assistant', edge: 'turn-start', command: 'work hook assistant-context', timeoutSec: 5 },\n];\n\nexport const ASSISTANT_INSTRUCTIONS = `# You are the work dashboard's assistant\n\nThe user opens you with Ctrl+K in \\`work web\\`, the dashboard over all their git worktrees and the coding agent session in each. Help them make sense of it and act on it: what needs them, what each session did, what can be cleaned up, which sessions will conflict.\n\n## Getting the data\n\nUse the \\`work\\` CLI with \\`--json\\` (see the work-sessions skill) and parse it; don't guess from the filesystem:\n\n- \\`work sessions --json\\` — every session: status (\\`view.label\\`), age, last active, context usage, archive state. \\`--changes\\` adds +N −M and same-file overlaps; \\`--all\\` adds older and archived ones.\n- \\`work digest --json --since today|yesterday|week\\` — what each session did (prompts, turns, PRs).\n- \\`work overlaps --json\\` — live sessions changing the same files.\n- \\`work cleanup --json\\` — which worktrees can go, and why.\n- \\`work timesheet show [day] --json\\` — the Time tab's day: hours per ticket, and why (sessions' Claude minutes, commits, Jira, meetings, chats). On the Time tab, the day on screen is described to you with each message.\n- \\`work timesheet month [YYYY-MM] --json\\` — a month: every day's rows with how each got its hours, the month's tickets, and what posting it would do. On the Month view, the month on screen is described to you with each message.\n- \\`work search <words> --json\\` — sessions whose conversation (live or archived, also older than the agent keeps) mentions it, with the matching lines: \"what did we do about X?\".\n\nEach prompt comes with what the user is looking at in the dashboard (the tab, the selected session). When they say \"this\", \"these\" or \"here\", that is what they mean.\n\n## Changing things\n\nAsk before you change anything, and say exactly what will happen:\n- Removing, archiving or forgetting worktrees: \\`work cleanup --apply <id>… --action delete|archive|forget --json\\`. Each is checked again right before it runs; report what was refused and why. Never \\`--force\\` unless the user asked for exactly that.\n- A day's hours: \\`work timesheet set <day> KEY=HOURS …\\` (all its rows; quarter hours, the day's total as the user wants it), \\`reset <day>\\`, \\`off <day>\\`; several days: one command per day. Explain the change first. To look at a day again (its sessions, commits, Jira, meetings): \\`work timesheet gather <day>\\`, or \\`gather <YYYY-MM>\\` for a month's days not gathered yet. Posting to Tempo (\\`work timesheet post <day>\\`) only when the user asks for it.\n- Anything else (\\`work remove\\`, git, files in a worktree): only when asked, and show the command first.\n\nDon't post on a git host (comments, reviews, replies), and don't send prompts to other sessions, unless the user asks. Keep answers short: the user is in the middle of something.\n`;\n\n/** What work wrote in the folder last time (relative paths), so files an earlier agent's setup left can go. */\nconst writtenFile = () => path.join(assistantDir(), '.work-written.json');\n/** What a work from before the list wrote: Claude's. */\nconst BEFORE_THE_LIST = ['CLAUDE.md', path.join('.claude', 'settings.json')];\n\nfunction readWritten(): string[] {\n try {\n const v = JSON.parse(fs.readFileSync(writtenFile(), 'utf-8')) as unknown;\n return Array.isArray(v) ? v.filter((x): x is string => typeof x === 'string') : [];\n } catch (err) {\n return (err as NodeJS.ErrnoException).code === 'ENOENT' ? BEFORE_THE_LIST : [];\n }\n}\n\n/**\n * Write (or refresh) the assistant's folder for the agent it runs; returns\n * it. Idempotent. Files work wrote there for another agent before (its\n * instructions, its settings with their allow rules and hooks) are removed:\n * after a switch they would be instructions and permissions nothing manages.\n * Only files work wrote and listed, inside the folder — never the user's own.\n */\nexport function prepareAssistantDir(agent: Pick<AgentAdapter, 'instructionsFile' | 'workspace'>): string {\n const dir = assistantDir();\n fs.mkdirSync(dir, { recursive: true });\n const before = readWritten();\n atomicWriteFile(path.join(dir, agent.instructionsFile), ASSISTANT_INSTRUCTIONS);\n const written = [agent.instructionsFile, ...(agent.workspace?.write(dir, { allow: ASSISTANT_ALLOW, hooks: ASSISTANT_HOOKS }) ?? [])].map(\n (f) => path.normalize(f),\n );\n const root = path.resolve(dir);\n for (const old of before.map((f) => path.normalize(f))) {\n const file = path.resolve(root, old);\n if (written.includes(old) || path.isAbsolute(old) || !file.startsWith(root + path.sep)) continue; // listed by us, inside the folder: nothing else\n fs.rmSync(file, { force: true });\n }\n atomicWriteFile(writtenFile(), JSON.stringify(written));\n return dir;\n}\n\ninterface StoredContext {\n at: string;\n text: string;\n /** The Time tab's day on screen: described afresh at each prompt (rows change by Save, Post, a rebuild). */\n day?: string;\n /** The Time tab's Month view on screen (`YYYY-MM`), described afresh the same way. */\n month?: string;\n /** The Reviews tab's PR on screen: its review described afresh at each prompt (a re-prepare, a submit change it). */\n review?: { repo: string; number: number };\n}\n\n/**\n * The dashboard view in words, for the hook: which tab, and the selected\n * session's state. Pure.\n */\nexport function describeView(view: AssistantView, session: SessionWire | null, now = Date.now()): string {\n const lines = [`The user is looking at the dashboard's ${view.tab} tab${view.sub ? ` (${view.sub})` : ''}.`];\n if (session) {\n const status = DISPLAY_LABEL[displayStatus(session, now)];\n lines.push(\n `Selected session: ${session.target} · ${session.branch} (id ${session.id}) — ${status}.`,\n ...(session.attention?.summary ? [` Its last line: ${session.attention.summary}`] : []),\n ...(session.diffStat?.files\n ? [` Uncommitted: +${session.diffStat.added} −${session.diffStat.deleted} in ${session.diffStat.files} files.`]\n : []),\n ...(session.overlaps?.length\n ? [` Changes the same files as: ${session.overlaps.map((o) => `${o.target} · ${o.branch}`).join(', ')}.`]\n : []),\n ...(session.context ? [` Its conversation is ${Math.round((session.context.used / session.context.window) * 100)}% full.`] : []),\n ...(session.branches?.length ? [` It has worked on more than one branch: ${branchesText(session.branches, session.isGroup)}.`] : []),\n ...(session.archivedAt ? [' It is archived.'] : []),\n ` Worktree: ${session.paths.join(', ')}`,\n );\n }\n if (view.note) lines.push(view.note);\n return lines.join('\\n');\n}\n\nexport function writeAssistantContext(\n text: string,\n now = Date.now(),\n day?: string,\n month?: string,\n review?: { repo: string; number: number },\n): void {\n fs.mkdirSync(assistantDir(), { recursive: true });\n const stored: StoredContext = {\n at: new Date(now).toISOString(),\n text,\n ...(day ? { day } : {}),\n ...(month ? { month } : {}),\n ...(review ? { review } : {}),\n };\n atomicWriteFile(contextFile(), JSON.stringify(stored));\n}\n\n/** The day on screen, if the Time tab is: for the hook to describe as it is now. */\nexport function assistantContextDay(now = Date.now()): string | null {\n const s = readStored(now);\n return s && typeof s.day === 'string' && /^\\d{4}-\\d{2}-\\d{2}$/.test(s.day) ? s.day : null;\n}\n\n/** The month on screen, if the Time tab's Month view is: for the hook to describe as it is now. */\nexport function assistantContextMonth(now = Date.now()): string | null {\n const s = readStored(now);\n return s && typeof s.month === 'string' && /^\\d{4}-(0[1-9]|1[0-2])$/.test(s.month) ? s.month : null;\n}\n\n/** The PR on screen, if the Reviews tab is: for the hook to describe its review as it is now. */\nexport function assistantContextReview(now = Date.now()): { repo: string; number: number } | null {\n const r = readStored(now)?.review as { repo?: unknown; number?: unknown } | undefined;\n return r && typeof r.repo === 'string' && r.repo && typeof r.number === 'number' && Number.isInteger(r.number) && r.number > 0\n ? { repo: r.repo, number: r.number }\n : null;\n}\n\nfunction readStored(now: number): Partial<StoredContext> | null {\n try {\n const s = JSON.parse(fs.readFileSync(contextFile(), 'utf-8')) as Partial<StoredContext> | null;\n if (!s || typeof s.text !== 'string' || typeof s.at !== 'string') return null;\n return now - Date.parse(s.at) > CONTEXT_TTL_MS ? null : s;\n } catch {\n return null;\n }\n}\n\n/**\n * What the hook adds to a prompt; null when the dashboard said nothing\n * lately. `dayNow` describes the Time tab's day as it is at this prompt\n * (the hook reads it from state.db), not as it was when the tab was opened.\n */\nexport function readAssistantContext(now = Date.now(), dayNow?: string | null): string | null {\n const s = readStored(now);\n if (!s) return null;\n return `[work dashboard] ${s.text}${dayNow ? `\\n${dayNow}` : ''}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AA2B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K,IAAI,GAAkB;AACnE,QAAM,IAAI,WAAW,GAAG;AACxB,SAAO,KAAK,OAAO,EAAE,QAAQ,YAAY,sBAAsB,KAAK,EAAE,GAAG,IAAI,EAAE,MAAM;AACvF;AAGO,SAAS,sBAAsB,MAAM,KAAK,IAAI,GAAkB;AACrE,QAAM,IAAI,WAAW,GAAG;AACxB,SAAO,KAAK,OAAO,EAAE,UAAU,YAAY,0BAA0B,KAAK,EAAE,KAAK,IAAI,EAAE,QAAQ;AACjG;AAGO,SAAS,uBAAuB,MAAM,KAAK,IAAI,GAA4C;AAChG,QAAM,IAAI,WAAW,GAAG,GAAG;AAC3B,SAAO,KAAK,OAAO,EAAE,SAAS,YAAY,EAAE,QAAQ,OAAO,EAAE,WAAW,YAAY,OAAO,UAAU,EAAE,MAAM,KAAK,EAAE,SAAS,IACzH,EAAE,MAAM,EAAE,MAAM,QAAQ,EAAE,OAAO,IACjC;AACN;AAEA,SAAS,WAAW,KAA4C;AAC9D,MAAI;AACF,UAAM,IAAI,KAAK,MAAM,GAAG,aAAa,YAAY,GAAG,OAAO,CAAC;AAC5D,QAAI,CAAC,KAAK,OAAO,EAAE,SAAS,YAAY,OAAO,EAAE,OAAO,SAAU,QAAO;AACzE,WAAO,MAAM,KAAK,MAAM,EAAE,EAAE,IAAI,iBAAiB,OAAO;AAAA,EAC1D,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAOO,SAAS,qBAAqB,MAAM,KAAK,IAAI,GAAG,QAAuC;AAC5F,QAAM,IAAI,WAAW,GAAG;AACxB,MAAI,CAAC,EAAG,QAAO;AACf,SAAO,oBAAoB,EAAE,IAAI,GAAG,SAAS;AAAA,EAAK,MAAM,KAAK,EAAE;AACjE;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/sessions/session-wire.ts","../src/core/comments/linked-stores.ts","../src/core/sessions/session-meta.ts","../src/core/conversations/context-usage.ts","../src/core/conversations/session-title.ts"],"sourcesContent":["import fs from 'node:fs';\nimport { agentOf, agentWire } from '../agents/index.js';\nimport { readStatus } from '../status/session-status.js';\nimport { snoozeActive, type Snooze } from '../rail/snooze.js';\nimport { idleFrom, withLiveClaude } from '../status/session-status.js';\nimport path from 'node:path';\nimport { readSessionMeta } from './session-meta.js';\nimport { checkedOutBranch } from '../git/git-head.js';\nimport { sessionIdFor } from './web-state.js';\nimport { readContextUsage } from '../conversations/context-usage.js';\nimport { bestEffort } from '../platform/best-effort.js';\nimport type { WorktreeSession } from './history.js';\nimport type {\n DiffStat,\n SessionArchiveInfo,\n SessionAttention,\n SessionClaudes,\n SessionWire,\n BlockerWire,\n PrStageWire,\n SessionBranchWire,\n ElsewherePr,\n} from '../api-types.js';\nimport { archiveDirFor, archivedByOf, keptList, readArchive } from '../archive/session-archive.js';\nimport { isArchiving, isRestoring } from '../archive/archiving.js';\nimport { sessionTitle } from '../conversations/session-title.js';\nimport { prStageOf, stageRepos, STAGE_WANTS_YOU, type StagePr } from '../pr/pr-stage.js';\nimport { stageInputOf } from '../pr/branch-work.js';\nimport { isLeftover } from '../worktree/leftover.js';\nimport { recordedRepos, sessionRepos } from './session-repos.js';\nimport { DEFAULT_ACCOUNT, getConfigPath, loadConfig, type WorkConfig } from '../platform/config.js';\n\n/**\n * One session as every client sees it — the dashboard's /api/sessions rows\n * and `work sessions --json` alike: identity, status, activity, comments,\n * context, archive state. Built in one place so the two can't drift.\n */\nexport interface SessionWireOptions {\n /** The account a switch waiting for its turn will move it to (account-switch.ts), or null. */\n accountPendingFor?: (id: string) => string | null;\n /** The session's `+N −M`, when the caller has one (the web cache). */\n diffStatFor?: (id: string, s: WorktreeSession, hasStatus: boolean) => DiffStat | null;\n /** Whether its Claude runs in the PTY host (the CLI asks the host; the\n * web server's pool knows it already). */\n ptyLive?: (id: string) => boolean;\n /** Its running Claudes, wherever they were started (live-claudes.ts). */\n claudesFor?: (id: string) => SessionClaudes | null;\n /** It shares its folder with another session that owns it\n * (shared-folders.ts): the folder's activity isn't this one's. */\n shadowed?: (id: string) => boolean;\n /** Unresolved review threads on its open PRs (the PR watch's last check). */\n reviewThreadsFor?: (id: string) => number;\n /** Reply drafts its Claude wrote for you to post (pr-replies.ts). */\n replyDraftsFor?: (id: string) => number;\n /** Where its PR stands (pr-stage.ts over the PR watch's last check), and whether you've seen it there. */\n prStageFor?: (id: string) => PrStageWire | null;\n /** You have notes on it (session-notes.ts). */\n hasNote?: (id: string) => boolean;\n /** What it waits on that isn't done yet (session-blocks.ts). */\n blockedByFor?: (id: string) => BlockerWire[];\n /** The running Claudes were read against a real process list, so \"none\" means none. */\n liveKnown?: boolean;\n /** A Claude of ours runs for it (PTY host), whether or not Claude Code's file shows it yet. */\n hostedLive?: (id: string) => boolean;\n /** A status read from its terminal output, for a tool with no hooks (output-status.ts). */\n outputStatusFor?: (id: string) => SessionAttention | null;\n /** Its snooze, if any (snooze-store.ts); shown only while it holds. */\n snoozeFor?: (id: string) => Snooze | null;\n /** How far behind main — or the session it is stacked on — it is (behind-main.ts's cache). */\n /** `lastActivity`: its agent's last write (ms; 0 none), so a session entered long ago but worked in today counts as in use. */\n behindFor?: (\n id: string,\n s: WorktreeSession,\n lastActivity: number,\n ) => { base: string; commits: number; conflicts: boolean; stacked?: true } | null;\n /** Every branch it worked on, with what's known of each (branch-facts.ts `createSessionBranches`); null when\n * it stayed on one. */\n branchesFor?: (id: string, s: WorktreeSession) => SessionBranchWire[] | null;\n /** Where it sits in a stack (stack-sessions.ts). */\n stackFor?: (id: string) => {\n parent: { id: string; branch: string; title?: string } | null;\n children: number;\n merged?: { id: string; branch: string } | null;\n };\n}\n\nexport function sessionWire(s: WorktreeSession, opts: SessionWireOptions = {}): SessionWire {\n const id = sessionIdFor(s);\n const meta = readSessionMeta(id, s);\n const shadowed = opts.shadowed?.(id) ?? false;\n const claudes = shadowed ? null : (opts.claudesFor?.(id) ?? null);\n const reviewThreads = s.archivedAt ? 0 : (opts.reviewThreadsFor?.(id) ?? 0);\n const replyDrafts = s.archivedAt ? 0 : (opts.replyDraftsFor?.(id) ?? 0);\n const prStage = s.archivedAt ? null : (opts.prStageFor?.(id) ?? null);\n const wire: SessionWire = {\n id,\n target: s.target,\n branch: s.branch,\n isGroup: s.isGroup,\n paths: s.paths,\n repos: wireRepos(s),\n folder: s.isGroup,\n baseBranch: s.baseBranch,\n jiraKey: s.jiraKey,\n createdAt: s.createdAt,\n lastAccessedAt: s.lastAccessedAt,\n draftCount: meta.draftCount,\n commentCount: meta.commentCount,\n claudeCount: meta.claudeCount,\n ptyStatus: opts.ptyLive ? (opts.ptyLive(id) ? 'running' : 'idle') : meta.ptyStatus,\n lastActivity: shadowed ? null : meta.lastActivity,\n // A running Claude is open even when it writes nothing (idle at its prompt).\n activityState: shadowed\n ? 'stale'\n : claudes\n ? claudes.busy\n ? 'active'\n : meta.activityState === 'active'\n ? 'active'\n : 'open'\n : meta.activityState,\n ...(claudes ? { agents: claudes, claudes } : {}),\n agent: agentWire(agentOf(s)),\n // Only a session on an account other than the default says which.\n ...(s.account && s.account !== DEFAULT_ACCOUNT ? { account: s.account } : {}),\n ...(!s.archivedAt && opts.accountPendingFor?.(id) ? { accountPending: opts.accountPendingFor(id)! } : {}),\n ...(s.archivedAt ? archiveInfo(id) : {}),\n title: bestEffort(\n `title of ${s.target}:${s.branch}`,\n () => sessionTitle(s, s.archivedAt ? readArchive(id)?.summary.prompts[0]?.text : null),\n null,\n ),\n ...(s.title ? { titleIsYours: true } : {}),\n pendingForClaudeCount: meta.pendingForClaudeCount,\n // Claude Code's own state file over what the hooks recorded, when newer.\n attention:\n meta.attention && !shadowed && opts.claudesFor\n ? withLiveClaude(meta.attention, claudes, {\n known: opts.liveKnown === true,\n hosted: opts.hostedLive?.(id) ?? true,\n background: () => agentOf(s).conversation?.backgroundWorkSince?.(s, idleFrom(meta.attention!)) ?? null,\n })\n : (meta.attention ?? (shadowed || s.archivedAt ? null : (opts.outputStatusFor?.(id) ?? null))),\n diffStat: opts.diffStatFor ? opts.diffStatFor(id, s, meta.attention !== null) : null,\n archivedAt: s.archivedAt ?? null,\n port: s.port ?? null,\n context: s.archivedAt ? null : bestEffort(`context usage for ${s.target}:${s.branch}`, () => readContextUsage(s), null),\n ...(reviewThreads > 0 ? { openReviewThreads: reviewThreads } : {}),\n ...(replyDrafts > 0 ? { replyDrafts } : {}),\n ...(prStage ? { prStage } : {}),\n ...otherBranches(s),\n };\n // Snoozed: only while it holds (a time not yet reached, or the status it\n // was snoozed in). \"Its status\" is what the hooks recorded — the same the\n // snooze was taken against — not the shown one, which a live Claude's state\n // file can override (that would end a snooze the moment it was set).\n const snooze = s.archivedAt ? null : (opts.snoozeFor?.(id) ?? null);\n if (snooze && snoozeActive(snooze, { attention: readStatus(id), openReviewThreads: wire.openReviewThreads, prStage: wire.prStage }))\n wire.snoozed = { until: snooze.until };\n const behind = s.archivedAt ? null : (opts.behindFor?.(id, s, wire.lastActivity ?? 0) ?? null);\n if (behind && behind.commits > 0) wire.behind = behind;\n const stack = s.archivedAt ? null : (opts.stackFor?.(id) ?? null);\n if (stack?.parent) wire.stackedOn = stack.parent;\n if (stack?.children) wire.stackedChildren = stack.children;\n if (stack?.merged) wire.stackParentMerged = stack.merged;\n const branches = s.archivedAt ? null : (opts.branchesFor?.(id, s) ?? null);\n if (branches?.length) wire.branches = branches;\n if (opts.hasNote?.(id)) wire.hasNote = true;\n if (isArchiving(id)) wire.archiving = true;\n if (!s.archivedAt && isAsleep(readStatus(id)?.stoppedAt, wire.ptyStatus === 'running', wire.lastActivity ?? 0)) wire.asleep = true;\n const blockers = s.archivedAt ? [] : (opts.blockedByFor?.(id) ?? []);\n if (blockers.length) wire.blockedBy = blockers;\n return wire;\n}\n\n/**\n * Asleep: work stopped its Claude (idle sleep, `work stop`: `stoppedAt`), it\n * isn't running now, and its conversation wasn't written since — one started\n * again (opened, sent a note, started in a terminal) is awake. Pure.\n */\nexport function isAsleep(stoppedAt: string | undefined, ptyRunning: boolean, lastActivityMs: number): boolean {\n const stopped = stoppedAt ? Date.parse(stoppedAt) : NaN;\n return Number.isFinite(stopped) && !ptyRunning && lastActivityMs <= stopped;\n}\n\n/** The row, marked Restoring while a Restore of it runs (a copy: archived rows are cached). */\nexport function withRestoring(w: SessionWire): SessionWire {\n return isRestoring(w.id) ? { ...w, restoring: true } : w;\n}\n\n/**\n * Its repos' aliases, one per path (`sessionRepos`). A recorded list needs no\n * config; a group's row from before reads the group's members from the\n * config, read once per change of the file (this runs per row of every list).\n */\nexport function wireRepos(\n s: Pick<WorktreeSession, 'target' | 'isGroup' | 'paths' | 'repos'>,\n config: () => Pick<WorkConfig, 'repos' | 'groups'> | null = repoConfig,\n): string[] {\n const recorded = recordedRepos(s);\n if (recorded) return recorded.map((r) => r.alias);\n return sessionRepos(s, s.isGroup ? config() : null).map((r) => r.alias);\n}\n\nlet configCache: { key: string; value: Pick<WorkConfig, 'repos' | 'groups'> | null } | null = null;\n\nfunction repoConfig(): Pick<WorkConfig, 'repos' | 'groups'> | null {\n const file = getConfigPath();\n let key: string;\n try {\n const st = fs.statSync(file);\n key = `${file}|${st.size}|${st.mtimeMs}`;\n } catch {\n return null;\n }\n if (configCache?.key === key) return configCache.value;\n const cfg = bestEffort('config for session repos', () => loadConfig(), null);\n configCache = { key, value: cfg ? { repos: cfg.repos, groups: cfg.groups } : null };\n return configCache.value;\n}\n\n/**\n * Repos of the session checked out on another branch than the session's\n * (read from HEAD files, no git). Ship and the PR watch follow the real\n * branch already; this is so the dashboard says so.\n */\nexport function otherBranches(s: Pick<WorktreeSession, 'branch' | 'paths' | 'target' | 'isGroup' | 'archivedAt'>): {\n onOtherBranch?: Array<{ repo: string; branch: string | null; noGit?: true }>;\n} {\n if (s.archivedAt || !s.branch) return {};\n const out: Array<{ repo: string; branch: string | null; noGit?: true }> = [];\n for (const p of s.paths) {\n if (!fs.existsSync(p)) continue;\n // A folder with no git left in it (a removal that stopped halfway) is on no branch at all.\n if (isLeftover(p)) {\n out.push({ repo: s.isGroup ? path.basename(p) : s.target, branch: null, noGit: true });\n continue;\n }\n const branch = checkedOutBranch(p);\n if (branch !== s.branch) out.push({ repo: s.isGroup ? path.basename(p) : s.target, branch });\n }\n return out.length ? { onOtherBranch: out } : {};\n}\n\n/** A session's unresolved review threads, from the PR watch's per-repo counts (open PRs only). */\nexport function reviewThreadsOf(ci: { repos: Array<{ pr: { state: string } | null; openThreads?: number }> } | null | undefined): number {\n return (ci?.repos ?? []).reduce((n, r) => n + (r.pr?.state === 'OPEN' ? (r.openThreads ?? 0) : 0), 0);\n}\n\n/** The `pr_watch_seen` key that says you saw a session at a PR stage. */\nexport const stageSeenKey = (stageKey: string) => `stage:${stageKey}`;\n\n/**\n * A session's PR stage from the PR watch's last check, with `seen` read only\n * for a stage that would bring it back to the Inbox (one lookup, not one per row).\n */\nexport function prStageWire(\n ci:\n | {\n repos: Array<{ name: string; pr: StagePr | null; branch?: string; otherPrs?: Array<{ branch: string; pr: StagePr }> }>;\n elsewhere?: ElsewherePr[];\n }\n | null\n | undefined,\n seen: (key: string) => boolean,\n): PrStageWire | null {\n // Every open PR across the branches it worked on (stageRepos), and its listed PRs in repos it doesn't have.\n const stage = prStageOf(stageRepos(stageInputOf(ci)));\n if (!stage) return null;\n return STAGE_WANTS_YOU.has(stage.kind) && seen(stageSeenKey(stage.key)) ? { ...stage, seen: true } : stage;\n}\n\n/** Saved uncommitted files a Restore hasn't put back yet. */\nfunction savedFiles(saved: Record<string, { files: number; restoredAt?: string; restoreError?: string }> | undefined): {\n savedUncommitted?: number;\n} {\n const n = Object.values(saved ?? {})\n .filter((u) => !u.restoredAt && !u.restoreError)\n .reduce((sum, u) => sum + u.files, 0);\n return n ? { savedUncommitted: n } : {};\n}\n\nfunction archiveInfo(id: string): { archive?: SessionArchiveInfo } {\n const rec = readArchive(id);\n if (!rec) return {};\n const by = archivedByOf(rec);\n const kept = keptList(rec.kept);\n return {\n archive: {\n ...(by ? { by } : {}),\n worktreeRemoved: rec.worktreeRemoved,\n keptBecause: rec.keptBecause,\n promptCount: rec.summary.promptCount,\n prompts: rec.summary.prompts.map((p) => p.text),\n lastSummary: rec.summary.lastSummary,\n ...(rec.summary.written ? { written: rec.summary.written } : {}),\n ...(rec.buildFolders ? { buildFolders: rec.buildFolders } : {}),\n ...savedFiles(rec.uncommitted),\n ...(kept ? { kept } : {}),\n },\n };\n}\n\n/** Newest sign of life (ms): the hook update, Claude's last write, the\n * `work tree` entry — the same rule as the dashboard's \"Last active\". */\nexport function lastActiveMs(w: Pick<SessionWire, 'lastAccessedAt' | 'lastActivity' | 'attention'>): number {\n return Math.max(Date.parse(w.lastAccessedAt) || 0, w.lastActivity ?? 0, w.attention ? Date.parse(w.attention.updatedAt) || 0 : 0);\n}\n\n/**\n * Archived sessions' rows, kept between builds of the list: an archived\n * session doesn't change — its Claude is stopped, its worktree mostly gone —\n * and building its row reads its archive (2/3 of /api/sessions' time with\n * fifty of them). A row is built again when its archive file was written\n * (the summary lands after archiving, a Restore records what came back), it\n * was renamed or entered, or your note on it came or went.\n */\nexport function createArchivedRows(\n archiveFile: (id: string) => string = (id) => path.join(archiveDirFor(id), 'archive.json'),\n): (s: WorktreeSession, extra: { hasNote: boolean }, build: () => SessionWire) => SessionWire {\n const rows = new Map<string, { key: string; row: SessionWire }>();\n return (s, extra, build) => {\n if (!s.archivedAt) return build();\n const id = sessionIdFor(s);\n let mtime = 0;\n try {\n mtime = fs.statSync(archiveFile(id)).mtimeMs;\n } catch {\n /* none yet */\n }\n const key = `${s.archivedAt}|${mtime}|${s.title ?? ''}|${s.lastAccessedAt}|${extra.hasNote}`;\n const hit = rows.get(id);\n if (hit?.key === key) return hit.row;\n const row = build();\n rows.set(id, { key, row });\n return row;\n };\n}\n","import type { WorktreeSession } from '../sessions/history.js';\nimport { sessionIdFor } from '../sessions/session-id.js';\nimport { readStoresComments } from './comment-file-store.js';\nimport { scopeStoreIdsForPaths } from './pending-delivery.js';\nimport type { Comment } from './comment-types.js';\n\n/**\n * One worktree's comments live in two kinds of store: the session's own (the\n * dashboard's Diff tab posts there) and a `wd` scope's (`scope-<hash>`: the\n * browser diff page, `/diff/<hash>`, posts there). Claude was handed both\n * (`readPendingForWorktree`), but each view showed only its own, so a comment\n * made on one wasn't there on the other. Each view now lists its own store\n * first and the linked ones after: the session's view its scope stores, a\n * scope's view the session(s) whose worktree it covers.\n *\n * The stores stay separate — a new `wd -c` run clears its scope's comments\n * (`ensureScope`), which must never clear the session's.\n */\n\n/** A session as these lookups need it: its id (its store's) and its worktree paths. */\nexport interface LinkedSession {\n id: string;\n paths: string[];\n}\n\nexport const linkedSession = (s: WorktreeSession): LinkedSession => ({ id: sessionIdFor(s), paths: s.paths });\n\n/** The session's store, then every scope store over its paths. */\nexport function sessionLinkedStoreIds(session: LinkedSession): string[] {\n return [session.id, ...scopeStoreIdsForPaths(session.paths)];\n}\n\n/** The scope's store, then each session whose paths that scope covers (the whole worktree, or one repo of a group). */\nexport function scopeLinkedStoreIds(hash: string, sessions: LinkedSession[]): string[] {\n const own = `scope-${hash}`;\n return [own, ...new Set(sessions.filter((s) => scopeStoreIdsForPaths(s.paths).includes(own)).map((s) => s.id))];\n}\n\nexport type Read = (storeId: string) => Comment[];\n\n/** These stores read in one query (they're mostly empty: a scope store has rows only once its page was commented on). */\nexport function readerFor(storeIds: string[]): Read {\n const rows = readStoresComments(storeIds);\n return (id) => rows.get(id) ?? [];\n}\n\n/**\n * Every comment the view shows: the first store's whole, the linked ones'\n * without their drafts (a draft is that view's unsent review; this view's\n * Submit wouldn't send it). Oldest first, each comment once.\n */\nexport function linkedComments(storeIds: string[], read: Read = readerFor(storeIds)): Comment[] {\n const seen = new Set<string>();\n const out: Comment[] = [];\n storeIds.forEach((id, i) => {\n for (const c of read(id)) {\n if (seen.has(c.id) || (i > 0 && c.status === 'draft')) continue;\n seen.add(c.id);\n out.push(c);\n }\n });\n return out.sort((a, b) => a.createdAt.localeCompare(b.createdAt));\n}\n\n/** Which of these stores holds the comment (a delete, a resolve or a reply acts there), or null. */\nexport function storeHolding(storeIds: string[], commentId: string, read: Read = readerFor(storeIds)): string | null {\n return storeIds.find((id) => read(id).some((c) => c.id === commentId)) ?? null;\n}\n\n/** Who to tell a store changed: the sessions and scopes whose views list it. */\nexport function viewersOf(storeId: string, sessions: LinkedSession[]): { sessionIds: string[]; scopeHashes: string[] } {\n if (storeId.startsWith('scope-')) {\n return {\n sessionIds: [...new Set(sessions.filter((s) => scopeStoreIdsForPaths(s.paths).includes(storeId)).map((s) => s.id))],\n scopeHashes: [storeId.slice('scope-'.length)],\n };\n }\n const session = sessions.find((s) => s.id === storeId);\n return {\n sessionIds: [storeId],\n scopeHashes: session ? scopeStoreIdsForPaths(session.paths).map((id) => id.slice('scope-'.length)) : [],\n };\n}\n\n/** How a front-end tells a view its comments changed: a session's Diff tab by id, a scope page on its own stream. */\nexport interface Tell {\n session: (sessionId: string, data: Record<string, unknown>) => void;\n scope: (scopeHash: string, data: Record<string, unknown>) => void;\n}\n\n/** A store changed: every view listing it is told (both comment routes use this, so they can't drift apart). */\nexport function announceChange(storeId: string, sessions: LinkedSession[], tell: Tell, data: Record<string, unknown>): void {\n const { sessionIds, scopeHashes } = viewersOf(storeId, sessions);\n for (const sessionId of sessionIds) tell.session(sessionId, { ...data, sessionId });\n for (const scopeHash of scopeHashes) tell.scope(scopeHash, { ...data, scopeHash });\n}\n","import { peekPty } from '../pty/pty-pool.js';\nimport { sessionStatusView } from '../status/turn-activity.js';\nimport type { ActivityState } from '../api-types.js';\nimport { readSessionActivity } from './session-activity.js';\nimport { linkedComments, sessionLinkedStoreIds } from '../comments/linked-stores.js';\nimport { readPendingForWorktree } from '../comments/pending-delivery.js';\nimport type { WorktreeSession } from './history.js';\nimport { readStatus, type EffectiveStatus } from '../status/session-status.js';\n\nexport type { PtyStatus } from '../api-types.js';\nimport type { PtyStatus } from '../api-types.js';\n\nexport interface SessionMeta {\n draftCount: number;\n /** Open comment threads (top-level, not resolved): the Diff tab's badge. */\n commentCount: number;\n /** Comments authored by claude — used by the client to compute unread. */\n claudeCount: number;\n /** Set when *our* PTY pool has a live Claude for this session. Doesn't\n * catch external terminals — `activityState` does. */\n ptyStatus: PtyStatus;\n /** ms since epoch of Claude's last write across this worktree, or null. */\n lastActivity: number | null;\n /** Derived from `lastActivity`: 'active' (≤30 s), 'open' (≤5 min), 'stale'. */\n activityState: ActivityState;\n /** Published user comments not yet surfaced to Claude via the\n * UserPromptSubmit hook. Drops to zero after Claude takes its next turn. */\n pendingForClaudeCount: number;\n /** Hook-driven agent status for the attention inbox; null until the\n * session's Claude has fired a hook under a full `work web`. */\n attention: EffectiveStatus | null;\n}\n\n/**\n * Cheap per-session metadata. Goes through the file-store cache so badge\n * counts reflect in-flight writes that haven't yet hit disk — reading the\n * raw JSON behind the cache's back produced stale counts under load.\n *\n * `session` is required because we need the worktree paths to look up\n * Claude's transcript directory (the sessionId hash alone isn't enough).\n */\nexport function readSessionMeta(sessionId: string, session: WorktreeSession): SessionMeta {\n // As the Diff tab lists them: with those made on the browser diff page (linked-stores.ts).\n const comments = linkedComments(sessionLinkedStoreIds({ id: sessionId, paths: session.paths }));\n let drafts = 0;\n let claude = 0;\n let open = 0;\n for (const c of comments) {\n if (c.status === 'draft') drafts++;\n if (c.author === 'claude') claude++;\n // The Diff tab's badge: threads still open. One Claude worked through is resolved (resolveAddressed).\n if (!c.parentId && !c.resolved) open++;\n }\n const activity = readSessionActivity(session);\n // What the hooks will hand over: the session's and its scopes' (readPendingForWorktree), as the badges count.\n const pending = readPendingForWorktree(session, sessionId).length;\n const status = readStatus(sessionId);\n return {\n draftCount: drafts,\n commentCount: open,\n claudeCount: claude,\n ptyStatus: peekPty(sessionId) ? 'running' : 'idle',\n lastActivity: activity.lastActivity,\n activityState: activity.state,\n pendingForClaudeCount: pending,\n attention: status ? sessionStatusView(status, session, activity.lastActivity ?? 0) : null,\n };\n}\n","import { readJsonlTail } from './jsonl.js';\nimport { agentOf } from '../agents/index.js';\nimport type { ConversationEntry } from '../agents/types.js';\nimport type { ContextUsage } from '../api-types.js';\nimport type { WorktreeSession } from '../sessions/session-types.js';\n\nexport type { ContextUsage } from '../api-types.js';\n\n/**\n * How full a session's conversation is. Every assistant message in the\n * transcript carries the token usage of the request that produced it, so\n * the newest one says how big the context is now: its prompt (input +\n * cache reads + cache writes) plus its reply, which the next turn carries.\n * Near the window Claude Code compacts the conversation, and answers get\n * worse before that — the dashboard shows when to start fresh.\n */\n\n/** From conversation entries (oldest first): the newest main-thread usage, in the agent's window (`window`). */\nexport function contextUsageFrom(\n entries: readonly ConversationEntry[],\n window: (model: string | undefined, used: number) => number,\n): ContextUsage | null {\n for (let i = entries.length - 1; i >= 0; i--) {\n const e = entries[i];\n // Subagent (Task) turns run in their own context.\n if (e.role !== 'agent' || e.sidechain || !e.usage) continue;\n const used = e.usage.prompt + e.usage.reply;\n if (used === 0) continue;\n return { used, window: window(e.model, used), ...(e.model ? { model: e.model } : {}) };\n }\n return null;\n}\n\n// Claude Code's transcript files, for the callers that still read Claude's own records (turn activity): agents/claude-files.ts.\nexport type { ConversationFile as TranscriptFile } from '../agents/types.js';\n\n/** Only the tail is read — a usage line is always near the end. */\nconst USAGE_TAIL_BYTES = 64 * 1024;\nconst cache = new Map<string, { key: string; usage: ContextUsage | null }>();\n\n/** The session's context usage now, through its agent; re-reads a conversation only after it changed. Null when work can't read its agent's conversations. */\nexport function readContextUsage(session: WorktreeSession): ContextUsage | null {\n const conv = agentOf(session).conversation;\n if (!conv) return null;\n let t: { file: string; size: number; mtimeMs: number } | null = null;\n for (const f of conv.files(session)) if (!t || f.mtimeMs > t.mtimeMs) t = f;\n if (!t) return null;\n const key = `${t.file}:${t.size}:${t.mtimeMs}`;\n const id = session.paths.join('|');\n const hit = cache.get(id);\n if (hit?.key === key) return hit.usage;\n const usage = contextUsageFrom(conv.entries(readJsonlTail(t.file, USAGE_TAIL_BYTES)), conv.contextWindow);\n cache.set(id, { key, usage });\n return usage;\n}\n","import fs from 'node:fs';\nimport { promptsSince } from './digest.js';\nimport { agentOf } from '../agents/index.js';\nimport type { ConversationEntry } from '../agents/types.js';\nimport type { WorktreeSession } from '../sessions/session-types.js';\n\n/**\n * A human name for a session, beside its branch: the name you gave it, or\n * else what you first asked its Claude (\"Rotate the terminal encryption\n * keys\"), or else its Jira key. Worked out when read — the first prompt is\n * read from the start of its oldest transcript, cached per file — so a GET\n * writes nothing; only a rename is stored.\n */\n\nconst TITLE_CHARS = 80;\nconst HEAD_BYTES = 256 * 1024;\nconst cache = new Map<string, { size: number; title: string | null }>();\n\n/** The first prompt in a conversation file (read from its start), its lines read by `toEntries` (the agent's). */\nexport function firstPromptOf(file: string, toEntries: (lines: readonly unknown[]) => ConversationEntry[]): string | null {\n let size: number;\n try {\n size = fs.statSync(file).size;\n } catch {\n return null;\n }\n const hit = cache.get(file);\n // The start of a file doesn't change as it grows, unless it was replaced\n // (smaller). \"No prompt in it\" holds as long as the file is the same, or\n // its whole head was read already: re-reading 256 KB of every such\n // transcript on every session-list build cost the most of all.\n if (hit && size >= hit.size && (hit.title !== null || size === hit.size || hit.size >= HEAD_BYTES)) return hit.title;\n let text: string;\n try {\n const fd = fs.openSync(file, 'r');\n try {\n const buf = Buffer.alloc(Math.min(size, HEAD_BYTES));\n fs.readSync(fd, buf, 0, buf.length, 0);\n text = buf.toString('utf8');\n } finally {\n fs.closeSync(fd);\n }\n } catch {\n return null;\n }\n const lines: unknown[] = [];\n for (const line of text.split('\\n')) {\n try {\n lines.push(JSON.parse(line));\n } catch {\n /* the last, cut-off line */\n }\n }\n const first = promptsSince([toEntries(lines)], 0)[0]?.text ?? null;\n const readable = first ? titleText(first) : null;\n const title = readable ? clip(readable) : null;\n cache.set(file, { size, title });\n return title;\n}\n\nconst clip = (s: string) => (s.length > TITLE_CHARS ? s.slice(0, TITLE_CHARS - 1).trimEnd() + '…' : s);\n\n/**\n * A prompt as a name: what you wrote, without markup. A pasted block\n * (`<pasted_content …>…</pasted_content>`, a log or code you pasted) is left\n * out when you also wrote something; a prompt that is only a paste keeps its\n * text. Other tags are dropped, their text kept. Null when nothing is left.\n */\nexport function titleText(prompt: string): string | null {\n const flat = (s: string) =>\n s\n .replace(/<\\/?[A-Za-z][\\w-]*(?:\\s[^>]*)?>/g, ' ')\n .replace(/\\s+/g, ' ')\n .trim();\n const outside = flat(prompt.replace(/<pasted_content\\b[^>]*>[\\s\\S]*?<\\/pasted_content>/g, ' '));\n const text = outside || flat(prompt);\n return text ? text : null;\n}\n\n/** The session's name: yours, else its first prompt, else its Jira key. */\nexport function sessionTitle(s: WorktreeSession, fallbackPrompt?: string | null): string | null {\n if (s.title?.trim()) return s.title.trim();\n const conv = agentOf(s).conversation;\n const oldestFirst = (conv?.files(s) ?? []).sort((a, b) => a.mtimeMs - b.mtimeMs);\n for (const t of oldestFirst) {\n const p = firstPromptOf(t.file, conv!.entries);\n if (p) return p;\n }\n const fallback = fallbackPrompt ? titleText(fallbackPrompt) : null;\n if (fallback) return clip(fallback);\n return s.jiraKey ?? null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,SAAQ;AAKf,OAAO,UAAU;;;ACoBV,IAAM,gBAAgB,CAAC,OAAuC,EAAE,IAAI,aAAa,CAAC,GAAG,OAAO,EAAE,MAAM;AAGpG,SAAS,sBAAsB,SAAkC;AACtE,SAAO,CAAC,QAAQ,IAAI,GAAG,sBAAsB,QAAQ,KAAK,CAAC;AAC7D;AAGO,SAAS,oBAAoB,MAAc,UAAqC;AACrF,QAAM,MAAM,SAAS,IAAI;AACzB,SAAO,CAAC,KAAK,GAAG,IAAI,IAAI,SAAS,OAAO,CAAC,MAAM,sBAAsB,EAAE,KAAK,EAAE,SAAS,GAAG,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAChH;AAKO,SAAS,UAAU,UAA0B;AAClD,QAAM,OAAO,mBAAmB,QAAQ;AACxC,SAAO,CAAC,OAAO,KAAK,IAAI,EAAE,KAAK,CAAC;A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S,IAAI,QAAQ,QAAQ,IAAI,CAAC;AAAA,MAC9D,GAAI,IAAI,eAAe,EAAE,cAAc,IAAI,aAAa,IAAI,CAAC;AAAA,MAC7D,GAAG,WAAW,IAAI,WAAW;AAAA,MAC7B,GAAI,OAAO,EAAE,KAAK,IAAI,CAAC;AAAA,IACzB;AAAA,EACF;AACF;AAIO,SAAS,aAAa,GAA+E;AAC1G,SAAO,KAAK,IAAI,KAAK,MAAM,EAAE,cAAc,KAAK,GAAG,EAAE,gBAAgB,GAAG,EAAE,YAAY,KAAK,MAAM,EAAE,UAAU,SAAS,KAAK,IAAI,CAAC;AAClI;AAUO,SAAS,mBACd,cAAsC,CAAC,OAAO,KAAK,KAAK,cAAc,EAAE,GAAG,cAAc,GACG;AAC5F,QAAM,OAAO,oBAAI,IAA+C;AAChE,SAAO,CAAC,GAAG,OAAO,UAAU;AAC1B,QAAI,CAAC,EAAE,WAAY,QAAO,MAAM;AAChC,UAAM,KAAK,aAAa,CAAC;AACzB,QAAI,QAAQ;AACZ,QAAI;AACF,cAAQA,IAAG,SAAS,YAAY,EAAE,CAAC,EAAE;AAAA,IACvC,QAAQ;AAAA,IAER;AACA,UAAM,MAAM,GAAG,EAAE,UAAU,IAAI,KAAK,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,cAAc,IAAI,MAAM,OAAO;AAC1F,UAAM,MAAM,KAAK,IAAI,EAAE;AACvB,QAAI,KAAK,QAAQ,IAAK,QAAO,IAAI;AACjC,UAAM,MAAM,MAAM;AAClB,SAAK,IAAI,IAAI,EAAE,KAAK,IAAI,CAAC;AACzB,WAAO;AAAA,EACT;AACF;","names":["fs","cache","fs"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/pty/agent-restart.ts"],"sourcesContent":["import fs from 'node:fs';\nimport { isAccountLoginId } from './account-login-id.js';\nimport { findOnPath } from '../platform/find-on-path.js';\nimport type { PtyInfo } from './pty-host-protocol.js';\nimport { LATER_TEXT, restartCountsText } from './restart-view.js';\n\n/**\n * Restarting the agents in the PTY host — after their tool updated (Claude Code\n * replaced its binary; a running Claude keeps the old one until it starts again),\n * or when asked. A restart is its agent stopped and started again in place,\n * resuming its conversation; never in the middle of a turn: a session working or\n * waiting on you restarts when its turn ends.\n */\n\n/** Before this, an mtime isn't when the file was installed: npm unpacks every file dated 1985-10-26. */\nconst PACKED_MTIME_BEFORE = Date.parse('1990-01-01T00:00:00Z');\n\n/**\n * When the file a tool's command runs was installed, following links\n * (`~/.local/bin/claude` → `versions/2.1.296`): the later of its modification time\n * and its creation — an updater that copies the new file keeping its build date\n * still creates it now. A file npm unpacked with its fixed old date, on a system\n * that doesn't record creation, falls back to its change time (the unpacking).\n * Not the change time otherwise: a chmod or a relink moves it, and every running\n * agent would read as outdated. Null when it isn't on PATH.\n */\nexport function installedAt(cmd: string, find: (cmd: string) => string | null = findOnPath): number | null {\n const file = find(cmd);\n if (!file) return null;\n try {\n return installTime(fs.statSync(fs.realpathSync(file)));\n } catch {\n return null;\n }\n}\n\n/** installedAt's rule on a file's times. Pure. */\nexport function installTime(st: { mtimeMs: number; ctimeMs: number; birthtimeMs: number }): number {\n const real = (ms: number) => (ms >= PACKED_MTIME_BEFORE ? ms : null);\n const known = [real(st.mtimeMs), real(st.birthtimeMs)].filter((x): x is number => x !== null);\n return known.length ? Math.max(...known) : st.ctimeMs;\n}\n\n/**\n * `installedAt` per tool, read again only after `ttlMs`: a lookup walks PATH with a\n * stat per folder and extension, synchronously, and the dashboard asks every few\n * minutes per window.\n */\nexport function installedAtCache(ttlMs = 60_000, look: (cmd: string) => number | null = installedAt, now: () => number = Date.now) {\n const cache = new Map<string, { at: number | null; read: number }>();\n return (cmd: string): number | null => {\n const hit = cache.get(cmd);\n if (hit && now() - hit.read < ttlMs) return hit.at;\n const at = look(cmd);\n cache.set(cmd, { at, read: now() });\n return at;\n };\n}\n\n/**\n * The live PTYs whose process started before its tool's file was installed: they\n * run the version from before. A PTY whose tool isn't known (a host from before\n * `tool`) or isn't on PATH is left out: nothing says it's outdated. Pure.\n */\nexport function outdatedPtys(ptys: readonly PtyInfo[], toolInstalledAt: (tool: string) => number | null): PtyInfo[] {\n return ptys.filter((p) => {\n // An account's login terminal is the Accounts page's, for a moment: never restarted (it would resume an old login).\n if (p.exited || !p.tool || isAccountLoginId(p.id)) return false;\n const at = toolInstalledAt(p.tool);\n const started = Date.parse(p.startedAt);\n return at !== null && Number.isFinite(started) && started < at;\n });\n}\n\n/** How recently a terminal printed for its agent to count as at work: a working one redraws its spinner, an idle one prints nothing. */\nexport const PRINTING_MS = 10_000;\n\n/**\n * At work, for a restart: what the agent itself says (Claude Code's own state for its process: mid-turn, or\n * waiting on you; at a permission dialog it prints nothing, so only this tells), or its status (the hooks' as\n * the dashboard reads it, corrected by the transcript and decayed) is working or waiting on you, or its\n * terminal printed in the last few seconds, which catches a turn both missed. An agent that says nothing and\n * has no status (a tool with no hooks or process state) has only the last: one silent at a prompt of its own\n * can't be told from idle. Pure.\n */\nexport function busyForRestart(\n state: 'working' | 'needs_input' | 'idle' | null,\n lastOutputMs: number | null,\n now = Date.now(),\n live: 'busy' | 'idle' | 'waiting' | null = null,\n): boolean {\n if (live === 'busy' || live === 'waiting') return true;\n if (state === 'working' || state === 'needs_input') return true;\n return lastOutputMs !== null && now - lastOutputMs < PRINTING_MS;\n}\n\n/** Which of `ids` restart now and which after their turn (working, or waiting on you). Pure. */\nexport function restartPlan(ids: readonly string[], busy: (id: string) => boolean): { now: string[]; later: string[] } {\n const now: string[] = [];\n const later: string[] = [];\n for (const id of new Set(ids)) (busy(id) ? later : now).push(id);\n return { now, later };\n}\n\n/** Restarts run this many at a time. */\nexport const RESTART_AT_ONCE = 3;\n\nexport interface RestarterDeps {\n /** Restart its agent in place (the host keeps attached terminals); a string: how it went instead (an older host). */\n restart: (id: string) => Promise<string | void>;\n /** Working, or waiting on you: not now. `turnEnded`: its turn just ended (the Stop), so the final message it\n * printed a moment ago isn't work going on. */\n busy: (id: string, opts?: { turnEnded?: boolean }) => boolean;\n /** Its agent runs in the host (a queued one stopped meanwhile needs nothing). */\n running: (id: string) => boolean;\n /** What one request (or one turn's end) decided, at once: one Activity run, not one per session. */\n report?: (notes: RestartNote[]) => void;\n /** When the waiting ones are looked at next (the Activity panel's schedule); null when nothing waits. */\n scheduled?: (nextAt: number | null) => void;\n changed?: () => void;\n /** A look again a little later (default setTimeout, unref'd): a turn-end the status hasn't caught up with yet. */\n later?: (fn: () => void, ms: number) => void;\n /**\n * Something else that restarts its agent anyway is waiting or under way (a switch of account, account-switch.ts): what\n * it is, in a few words; null: nothing. A restart asked for then is folded into it (answered as waiting, never a\n * second restart), and a queued one is dropped when its turn comes.\n */\n foldedInto?: (id: string) => string | null;\n}\n\nexport interface RestartNote {\n id: string;\n text: string;\n level: 'action' | 'info' | 'warn';\n}\n\ntype OneRestart = { ok: true; how: string } | { ok: false; error: string };\n\nexport interface RestartOutcome {\n now: string[];\n later: string[];\n failed: Array<{ id: string; error: string }>;\n}\n\n/** One request's decisions in a line, for its Activity run (restart-view.ts's wording). Pure. */\nexport function restartNotesSummary(notes: readonly RestartNote[]): string {\n const n = (level: RestartNote['level']) => notes.filter((x) => x.level === level).length;\n return restartCountsText({ restarted: n('action'), later: n('info'), failed: n('warn') });\n}\n\n/** While anything waits, how often it is looked at again: a turn whose end no hook reported, or a terminal that was\n * only redrawing (the printing check) — never left for the 5-minute sweep, which `--dev` and lean don't run. */\nexport const QUEUE_RECHECK_MS = 15_000;\n/** After a turn ends, how long before its agent is restarted: the Stop's own hooks (`work hook turn-end`: the\n * checkpoint, the status) run as its children, and stopping it at once would kill them mid-way. */\nexport const TURN_END_GRACE_MS = 10_000;\n\n/**\n * Restarts now what can go now, and the rest when their turn ends (`turnEnded`,\n * from the status hook — and once more a little later, should the status still\n * say working then) or on a later `retry` (a turn whose end no hook reported).\n * One restart per session at a time: asked again meanwhile, it shares that one's\n * outcome.\n */\nexport function createRestarter(deps: RestarterDeps) {\n const queued = new Set<string>();\n const inFlight = new Map<string, Promise<OneRestart>>();\n const later = deps.later ?? ((fn: () => void, ms: number) => void setTimeout(fn, ms).unref?.());\n\n /** Restart one: how it went (a different way, on an older host), or why not. */\n const one = (id: string): Promise<OneRestart> => {\n const running = inFlight.get(id);\n if (running) return running;\n queued.delete(id);\n const p = deps.restart(id).then(\n (how): OneRestart => ({ ok: true, how: how || 'restarted its agent (its conversation goes on)' }),\n (err: Error): OneRestart => ({ ok: false, error: err.message }),\n );\n inFlight.set(id, p);\n void p.finally(() => inFlight.delete(id));\n return p;\n };\n\n /** Restart these, RESTART_AT_ONCE at a time; each waits for its old process to exit. */\n const run = async (ids: string[], notes: RestartNote[]) => {\n const failed: RestartOutcome['failed'] = [];\n const ok = new Set<string>();\n const queue = [...ids];\n const worker = async () => {\n for (let id = queue.shift(); id !== undefined; id = queue.shift()) {\n const r = await one(id);\n if (r.ok) {\n ok.add(id);\n notes.push({ id, text: r.how, level: 'action' });\n } else {\n failed.push({ id, error: r.error });\n notes.push({ id, text: `couldn't restart its agent: ${r.error}`, level: 'warn' });\n }\n }\n };\n await Promise.all(Array.from({ length: Math.min(RESTART_AT_ONCE, queue.length) }, worker));\n return { done: ids.filter((id) => ok.has(id)), failed };\n };\n\n const finish = (notes: RestartNote[]) => {\n if (!notes.length) return;\n deps.report?.(notes);\n deps.changed?.();\n };\n\n /** Restart these (the caller found them running in the host: its list is fresh, `running` is a cache). */\n const request = async (ids: readonly string[]): Promise<RestartOutcome> => {\n const notes: RestartNote[] = [];\n const folded: string[] = [];\n for (const id of ids) {\n const into = deps.foldedInto?.(id);\n if (!into) continue;\n folded.push(id);\n notes.push({ id, text: `restarts with ${into} (no second restart)`, level: 'info' });\n }\n const plan = restartPlan(\n ids.filter((id) => !folded.includes(id)),\n (id) => deps.busy(id),\n );\n for (const id of plan.later) {\n queued.add(id);\n notes.push({ id, text: `${LATER_TEXT} (it is working or waiting on you)`, level: 'info' });\n }\n const { done, failed } = await run(plan.now, notes);\n finish(notes);\n tick();\n return { now: done, later: [...folded, ...plan.later], failed };\n };\n\n // While anything waits, it is looked at again every QUEUE_RECHECK_MS.\n let ticking = false;\n const tick = () => {\n if (ticking) return;\n if (queued.size === 0) {\n deps.scheduled?.(null);\n return;\n }\n ticking = true;\n deps.scheduled?.(Date.now() + QUEUE_RECHECK_MS);\n later(() => {\n ticking = false;\n void retry()\n .catch(() => {})\n .finally(tick);\n }, QUEUE_RECHECK_MS);\n };\n\n /** Restart the queued ones (or `only`) that can go now; a queued one stopped meanwhile is dropped. */\n const retry = async (only?: string, opts?: { turnEnded?: boolean }): Promise<void> => {\n const notes: RestartNote[] = [];\n const ready: string[] = [];\n for (const id of [...queued]) {\n if (only !== undefined && id !== only) continue;\n if (!deps.running(id)) {\n queued.delete(id);\n notes.push({ id, text: 'no longer waits to restart: it was stopped meanwhile (it starts on the new version)', level: 'info' });\n continue;\n }\n const into = deps.foldedInto?.(id);\n if (into) {\n queued.delete(id);\n notes.push({ id, text: `no longer waits to restart: ${into} restarts it`, level: 'info' });\n continue;\n }\n if (!deps.busy(id, opts)) ready.push(id);\n }\n await run(ready, notes);\n finish(notes);\n };\n\n return {\n request,\n retry: () => retry(),\n /** A session's turn ended: restart it if it was waiting for that — and if it still reads as busy, look again shortly. */\n turnEnded: (id: string): void => {\n if (!queued.has(id)) return;\n later(() => void retry(id, { turnEnded: true }).catch(() => {}), TURN_END_GRACE_MS);\n },\n queued: (): string[] => [...queued],\n /** Take one off the queue (it no longer waits for its turn); false when it wasn't waiting (not queued, or running now). */\n cancel: (id: string): boolean => {\n if (!queued.delete(id)) return false;\n if (queued.size === 0) deps.scheduled?.(null);\n deps.changed?.();\n return true;\n },\n /** Being restarted now (the host lists them as exited meanwhile: still this session's). */\n restarting: (): string[] => [...inFlight.keys()],\n };\n}\n\nexport type Restarter = ReturnType<typeof createRestarter>;\n"],"mappings":";;;;;;;;;;;;;AAAA,OAAO,QAAQ;AAef,IAAM,sBAAsB,KAAK,MAAM,sBAAsB;AAWtD,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