@joshuafolkken/kit 1.3000.0 → 1.3041.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/workflow-commands/backlogrun-steps.md +1 -1
- package/.claude/skills/workflow-commands/kickoff.md +6 -0
- package/dist/.inputs-verified.json +1 -1
- package/dist/commands/adopt.js +12 -12
- package/dist/commands/auto-ok-judge-cli.js +18 -14
- package/dist/commands/auto-ok-main.js +42 -40
- package/dist/commands/backlog-budget-main.js +3 -3
- package/dist/commands/backlog-drive-cli.js +276 -188
- package/dist/commands/backlog-next-main.js +77 -75
- package/dist/commands/backlog-offer-main.js +80 -78
- package/dist/commands/backlog-plan-cli.js +96 -97
- package/dist/commands/backlog-triage-cli.js +94 -92
- package/dist/commands/backlogrun-cli.js +212 -206
- package/dist/commands/behavior-cli.js +12 -13
- package/dist/commands/bump-version-main.js +2 -2
- package/dist/commands/bytes-command.js +61 -22
- package/dist/commands/check-related.js +61 -60
- package/dist/commands/{chunk-X7PN54LZ.js → chunk-22DVQCP6.js} +16 -6
- package/dist/commands/{chunk-7GHOFHUS.js → chunk-24ZDAWML.js} +3 -3
- package/dist/commands/{chunk-HBNB3TLG.js → chunk-2BB5ZR2F.js} +13 -7
- package/dist/commands/{chunk-F22G3VDB.js → chunk-2BC33QPY.js} +1 -1
- package/dist/commands/{chunk-72EW7AVI.js → chunk-2BJJUTZA.js} +2 -2
- package/dist/commands/{chunk-XDQOWUVT.js → chunk-2CXT6MBR.js} +4 -4
- package/dist/commands/{chunk-TVJE67O2.js → chunk-2EZTYLO4.js} +6 -6
- package/dist/commands/{chunk-JLYW7CP6.js → chunk-2PHOLX62.js} +1 -1
- package/dist/commands/{chunk-6EU5ZCDP.js → chunk-2QM72JCJ.js} +23 -87
- package/dist/commands/{chunk-EFHSCUFN.js → chunk-2VFPUPSG.js} +2 -2
- package/dist/commands/{chunk-ATRMETHT.js → chunk-2XAH3MHV.js} +1 -1
- package/dist/commands/{chunk-T2E724HN.js → chunk-34JJYCIY.js} +2 -2
- package/dist/commands/{chunk-REMKUFAC.js → chunk-34KZDKQJ.js} +1 -1
- package/dist/commands/{chunk-GK2KY4MO.js → chunk-352KLSFX.js} +3 -3
- package/dist/commands/{chunk-7S6VRZOH.js → chunk-3AEDZZNL.js} +5 -5
- package/dist/commands/{chunk-KVJDDECB.js → chunk-3B2HEFNO.js} +2 -2
- package/dist/commands/{chunk-HZBTXKT2.js → chunk-3Z425MM3.js} +2 -2
- package/dist/commands/{chunk-J3G2R64I.js → chunk-3ZOX4G4U.js} +3 -3
- package/dist/commands/{chunk-LRS2OS5J.js → chunk-452HWOJ7.js} +2 -2
- package/dist/commands/{chunk-HRT4KWP4.js → chunk-475EFIJV.js} +1 -1
- package/dist/commands/{chunk-4HBVHYNL.js → chunk-47UZB54M.js} +3 -3
- package/dist/commands/{chunk-H4LYG37R.js → chunk-4DN4XVPL.js} +6 -6
- package/dist/commands/{chunk-TMLNI3YW.js → chunk-4HERA2GY.js} +1 -1
- package/dist/commands/{chunk-W6V4DWC5.js → chunk-4JI35CVO.js} +1 -1
- package/dist/commands/{chunk-YT342DRV.js → chunk-4L4LNWZ7.js} +2 -2
- package/dist/commands/{chunk-ZZAH3YQP.js → chunk-4N32QKJZ.js} +6 -6
- package/dist/commands/{chunk-GDUK5YPO.js → chunk-4NRSFLG7.js} +12 -12
- package/dist/commands/{chunk-O5QZ2S6X.js → chunk-4OKRPAUT.js} +4 -4
- package/dist/commands/{chunk-QDFDB4CF.js → chunk-4Q64PG46.js} +13 -13
- package/dist/commands/{chunk-HO52D6JY.js → chunk-4UDTQVDD.js} +14 -14
- package/dist/commands/{chunk-HPVLI26Z.js → chunk-4WR2LEZL.js} +6 -6
- package/dist/commands/{chunk-DP7WIGQ4.js → chunk-4ZJOC6OK.js} +4 -4
- package/dist/commands/{chunk-WTRDWEUQ.js → chunk-4ZQM4I7R.js} +12 -12
- package/dist/commands/{chunk-OTZJXU2R.js → chunk-54X37JEJ.js} +8 -8
- package/dist/commands/{chunk-A5V7EWIX.js → chunk-56KW5EOK.js} +2 -2
- package/dist/commands/chunk-5CG3XU3O.js +74 -0
- package/dist/commands/{chunk-FC33R5UN.js → chunk-5ESZLHDZ.js} +13 -15
- package/dist/commands/{chunk-OVA7STGP.js → chunk-5FBRMARM.js} +9 -9
- package/dist/commands/{chunk-SK2LJBFS.js → chunk-5PCK53WP.js} +3 -3
- package/dist/commands/{chunk-6NV2F7QH.js → chunk-5RG4S66L.js} +1 -1
- package/dist/commands/{chunk-JOARHU3M.js → chunk-5UJGACVN.js} +1 -1
- package/dist/commands/{chunk-NKOET4FB.js → chunk-5Y7B7FDL.js} +2 -2
- package/dist/commands/{chunk-XMBRXCIE.js → chunk-5Z6E5ZUV.js} +4 -4
- package/dist/commands/{chunk-RZ4OKKPM.js → chunk-5ZNUH4LV.js} +2 -2
- package/dist/commands/{chunk-7CHCZBNF.js → chunk-6CFHLMKM.js} +4 -4
- package/dist/commands/{chunk-TXXYC7EV.js → chunk-6DDK5XWK.js} +1 -1
- package/dist/commands/{chunk-2TQXCH2K.js → chunk-6GQX752S.js} +3 -3
- package/dist/commands/{chunk-RY6ZDHKB.js → chunk-6MAZ55GF.js} +107 -84
- package/dist/commands/{chunk-SNFLV7VV.js → chunk-6RUWU2SB.js} +2 -2
- package/dist/commands/{chunk-D4SZK7H2.js → chunk-6TIVDEKG.js} +2 -2
- package/dist/commands/{chunk-RIQ75QWR.js → chunk-6UCWAFQY.js} +55 -43
- package/dist/commands/{chunk-4D5KWMFL.js → chunk-6YURRFRU.js} +19 -19
- package/dist/commands/{chunk-7MOZEEFJ.js → chunk-6YVURZAJ.js} +1 -1
- package/dist/commands/{chunk-73JOEKIC.js → chunk-6Z4YZG7P.js} +5 -5
- package/dist/commands/{chunk-NJ53AWJU.js → chunk-77BIN247.js} +9 -9
- package/dist/commands/{chunk-MZHOPRI6.js → chunk-7ABHNNY3.js} +7 -7
- package/dist/commands/{chunk-6WTVAL4D.js → chunk-7C7FOKJK.js} +1 -1
- package/dist/commands/{chunk-KVSSLDA3.js → chunk-7HAGC6SW.js} +5 -5
- package/dist/commands/{chunk-IG22Y5MA.js → chunk-7KKUFLH5.js} +1 -1
- package/dist/commands/{chunk-ZQ3CKRMP.js → chunk-7MJYLUF4.js} +2 -2
- package/dist/commands/{chunk-6UGFS3EU.js → chunk-7NHZCI5Y.js} +11 -11
- package/dist/commands/{chunk-FB3D7CX5.js → chunk-7OQ56DVW.js} +5 -7
- package/dist/commands/{chunk-EK327QOS.js → chunk-7VWPGTZO.js} +10 -10
- package/dist/commands/{chunk-WSOF74K4.js → chunk-7YZXS3AK.js} +3 -3
- package/dist/commands/{chunk-N6TYL3B2.js → chunk-AAUDI7WJ.js} +2 -2
- package/dist/commands/{chunk-3GF52L5F.js → chunk-AC26ZUG5.js} +12 -24
- package/dist/commands/{chunk-EK2Y6B4X.js → chunk-ACZ52JPI.js} +7 -7
- package/dist/commands/{chunk-VD72V5VX.js → chunk-AJ65WNJB.js} +4 -4
- package/dist/commands/{chunk-MYWRGF5A.js → chunk-AK7SEO4Y.js} +2 -2
- package/dist/commands/{chunk-IBEKFLWG.js → chunk-ALDAS2WG.js} +9 -9
- package/dist/commands/{chunk-W32DIQEP.js → chunk-ARFBIJFS.js} +1 -1
- package/dist/commands/{chunk-F3WBEEYC.js → chunk-AVVMDVGO.js} +5 -5
- package/dist/commands/chunk-AXXEMVRJ.js +23 -0
- package/dist/commands/{chunk-GIGKMIPQ.js → chunk-B3M5WSGN.js} +1 -1
- package/dist/commands/{chunk-4Z5723GA.js → chunk-B7ZNIEDV.js} +5 -4
- package/dist/commands/{chunk-B3XFOHDX.js → chunk-BCUDQWYK.js} +10 -4
- package/dist/commands/{chunk-PR3JCPP7.js → chunk-BMKWSWWE.js} +1 -1
- package/dist/commands/{chunk-RZJAUVMI.js → chunk-BMM4RHCG.js} +2 -2
- package/dist/commands/{chunk-LAKVPOJQ.js → chunk-BMTYUJNT.js} +2 -2
- package/dist/commands/{chunk-DAJCUSPG.js → chunk-BRHPRDDV.js} +3 -3
- package/dist/commands/{chunk-UZAU6UI6.js → chunk-BRUBX64M.js} +2 -2
- package/dist/commands/{chunk-BFLFPKQQ.js → chunk-BTZJDHQT.js} +4 -4
- package/dist/commands/{chunk-AI5K4QJO.js → chunk-BYFC6MD2.js} +1 -1
- package/dist/commands/{chunk-JGTLNFFE.js → chunk-BYGJ3BCJ.js} +10 -10
- package/dist/commands/{chunk-5HWZFL4D.js → chunk-C54QXJD6.js} +51 -18
- package/dist/commands/{chunk-LMS6N6GE.js → chunk-CBAKBWSZ.js} +7 -7
- package/dist/commands/{chunk-7EAMUVIO.js → chunk-CFHRNTE5.js} +1 -1
- package/dist/commands/{chunk-UIWAMLQH.js → chunk-CGYDIYHD.js} +2 -2
- package/dist/commands/{chunk-4QYW2IL7.js → chunk-CHKYPF5O.js} +1 -1
- package/dist/commands/{chunk-5HCPSV45.js → chunk-CJBW6BWG.js} +8 -8
- package/dist/commands/chunk-CKUKK7JG.js +252 -0
- package/dist/commands/{chunk-4PES3BAA.js → chunk-CMHGDCGN.js} +3 -3
- package/dist/commands/{chunk-F6OWP2AY.js → chunk-CNGTHSUS.js} +22 -22
- package/dist/commands/{chunk-B2EA2HCY.js → chunk-COGKULQH.js} +4 -4
- package/dist/commands/{chunk-S7XWXG4M.js → chunk-CP2J4RV2.js} +175 -81
- package/dist/commands/{chunk-YGDNUTTI.js → chunk-CQUZ6TNQ.js} +2 -2
- package/dist/commands/chunk-CQZI7RIK.js +72 -0
- package/dist/commands/chunk-CVJHQOI3.js +153 -0
- package/dist/commands/{chunk-2MJ4OCDL.js → chunk-CWCKCZS6.js} +1 -1
- package/dist/commands/chunk-D5OHVIPM.js +17 -0
- package/dist/commands/{chunk-TPKFVVJQ.js → chunk-D6D6WQR6.js} +2 -2
- package/dist/commands/{chunk-5PAEXYIY.js → chunk-D7JRJI44.js} +69 -6
- package/dist/commands/{chunk-LOSOLCCW.js → chunk-D7OAU32Z.js} +1 -1
- package/dist/commands/{chunk-VZHC2I3T.js → chunk-DAAX7XDS.js} +8 -8
- package/dist/commands/{chunk-OHVAEJSM.js → chunk-DEZF7QZZ.js} +5 -5
- package/dist/commands/{chunk-CA6F5OXK.js → chunk-DYZOOWVW.js} +124 -21
- package/dist/commands/{chunk-TKGBF75Y.js → chunk-EDKOSZ3K.js} +5 -5
- package/dist/commands/{chunk-YPNTORQD.js → chunk-EFDVE5P5.js} +1 -1
- package/dist/commands/{chunk-EH3LVYOX.js → chunk-EGIHAEMT.js} +1 -1
- package/dist/commands/{chunk-7P4X4TQL.js → chunk-EKLU6QR7.js} +4 -4
- package/dist/commands/{chunk-ILQZFUDC.js → chunk-ELY76WAR.js} +2 -2
- package/dist/commands/{chunk-2VLHFILE.js → chunk-EM3HAZF6.js} +2 -2
- package/dist/commands/{chunk-F2HFWLQR.js → chunk-EMTZAGT5.js} +20 -1
- package/dist/commands/{chunk-GA4VIFHD.js → chunk-ERG4QRNG.js} +2 -2
- package/dist/commands/{chunk-ICEMFE2V.js → chunk-EUGNQCYK.js} +1 -1
- package/dist/commands/{chunk-3HU3LPIF.js → chunk-EXDFKKMH.js} +2 -2
- package/dist/commands/{chunk-ISPBJVXM.js → chunk-EXWB34R2.js} +7 -7
- package/dist/commands/{chunk-FNOSSXLG.js → chunk-EYMPBHDN.js} +2 -2
- package/dist/commands/{chunk-7V5UVKFG.js → chunk-EZ7IPKIH.js} +2 -2
- package/dist/commands/{chunk-KQWSENCT.js → chunk-F6IQHZYY.js} +3 -3
- package/dist/commands/{chunk-7ZECP3J6.js → chunk-FDS65XOJ.js} +5 -5
- package/dist/commands/{chunk-KXRFGPZD.js → chunk-FGG7V473.js} +21 -5
- package/dist/commands/{chunk-PZ6VWHOO.js → chunk-FHFWNNUC.js} +1 -1
- package/dist/commands/{chunk-XBRD2BDL.js → chunk-FJX7AENO.js} +2 -2
- package/dist/commands/{chunk-M42SLJCD.js → chunk-FKZ5E4JD.js} +4 -4
- package/dist/commands/{chunk-F2J6DGDM.js → chunk-FMZWRDKH.js} +8 -8
- package/dist/commands/{chunk-DSBK66US.js → chunk-FOKCRIAN.js} +10 -10
- package/dist/commands/{chunk-OI7KM4K3.js → chunk-FQGWO2ZH.js} +2 -2
- package/dist/commands/{chunk-2IESYBZH.js → chunk-FURNDIT3.js} +3 -3
- package/dist/commands/chunk-FVDQNMP6.js +93 -0
- package/dist/commands/{chunk-PZU6FZO6.js → chunk-FWU3H4TX.js} +1 -1
- package/dist/commands/{chunk-RYZ3RQRH.js → chunk-G3HBYHFA.js} +1 -1
- package/dist/commands/{chunk-HCA5QG2U.js → chunk-G4E4M2P4.js} +2 -2
- package/dist/commands/{chunk-VJLZ3IQQ.js → chunk-G5KSL2Q2.js} +1 -1
- package/dist/commands/{chunk-Y5ZW3KN5.js → chunk-G6XC7V6Y.js} +2 -2
- package/dist/commands/{chunk-73EBNBUW.js → chunk-GCPP5XIG.js} +1 -1
- package/dist/commands/{chunk-Q3463XNL.js → chunk-GITT5A5A.js} +3 -3
- package/dist/commands/{chunk-T2IO4LEB.js → chunk-GLC47H7I.js} +10 -10
- package/dist/commands/{chunk-GA6E4VGO.js → chunk-GUR54ELE.js} +1 -1
- package/dist/commands/{chunk-7IT23HIR.js → chunk-GY4DMCKS.js} +2 -2
- package/dist/commands/{chunk-PZ4ITSLG.js → chunk-H6JQRHDC.js} +3 -3
- package/dist/commands/{chunk-ZHZSZNE2.js → chunk-HATKF6VX.js} +2 -2
- package/dist/commands/{chunk-ELWNRE6E.js → chunk-HH3CVIFU.js} +5 -5
- package/dist/commands/{chunk-7GMTJDO2.js → chunk-HHMMGDMP.js} +6 -6
- package/dist/commands/{chunk-VD5674LW.js → chunk-HI5WPM6C.js} +2 -2
- package/dist/commands/{chunk-JUUBDYFZ.js → chunk-HQSWPRUF.js} +4 -4
- package/dist/commands/{chunk-ZAJD6T6E.js → chunk-HVCQYZVD.js} +2 -2
- package/dist/commands/chunk-HWEZRNPL.js +66 -0
- package/dist/commands/{chunk-J6GIVMXI.js → chunk-HX3FFIO5.js} +18 -3
- package/dist/commands/{chunk-GU5ML3Y3.js → chunk-HXDTA5VU.js} +13 -68
- package/dist/commands/{chunk-BNXE3NVB.js → chunk-I2KCGKJI.js} +1 -1
- package/dist/commands/{chunk-LC7SBONO.js → chunk-IAD4WLLI.js} +1 -1
- package/dist/commands/{chunk-WWC5L3AO.js → chunk-IB5TT73I.js} +2 -2
- package/dist/commands/{chunk-HOSZITJM.js → chunk-IBAYXCMU.js} +2 -2
- package/dist/commands/{chunk-UTBVTCQN.js → chunk-IF3EIFK4.js} +267 -153
- package/dist/commands/chunk-IGDJNXX2.js +49 -0
- package/dist/commands/{chunk-OJ4LGBVD.js → chunk-ILIITIMQ.js} +3 -3
- package/dist/commands/{chunk-CUR2WNYB.js → chunk-IRGDMSTI.js} +3 -3
- package/dist/commands/{chunk-PZTWQYRI.js → chunk-IYJEBWW5.js} +3 -3
- package/dist/commands/{chunk-A3D2XHOJ.js → chunk-J22PSIXR.js} +40 -9
- package/dist/commands/{chunk-O27H6NN6.js → chunk-J66YBAAM.js} +3 -5
- package/dist/commands/{chunk-P6RGQXHI.js → chunk-J6WKZRV2.js} +2 -2
- package/dist/commands/{chunk-NFEBQED3.js → chunk-J7IO3AYH.js} +2 -2
- package/dist/commands/{chunk-T57W3UWK.js → chunk-JAKC2BHX.js} +1 -1
- package/dist/commands/{chunk-3EO2XN3A.js → chunk-JCAQ7B6J.js} +4 -4
- package/dist/commands/{chunk-QQZOQ7AM.js → chunk-JFLFGLE4.js} +1 -1
- package/dist/commands/{chunk-ZDSDPKCD.js → chunk-JIGBNCDR.js} +1 -1
- package/dist/commands/{chunk-Q5N2J2UF.js → chunk-JJHWTFWQ.js} +5 -7
- package/dist/commands/{chunk-EI6JG5DF.js → chunk-JKOGWGQM.js} +1 -1
- package/dist/commands/{chunk-RK4HE5NW.js → chunk-JM6EVOFN.js} +4 -4
- package/dist/commands/{chunk-EBNIX2TC.js → chunk-JV24VP2O.js} +1 -1
- package/dist/commands/{chunk-BCK5LW4F.js → chunk-JVKXJ763.js} +3 -3
- package/dist/commands/{chunk-D5TAR6TV.js → chunk-JZHY7D6D.js} +1 -1
- package/dist/commands/{chunk-CRNPPKP2.js → chunk-JZK33TA5.js} +1 -1
- package/dist/commands/{chunk-UOAG2XQT.js → chunk-K275REYP.js} +3 -3
- package/dist/commands/{chunk-HESMKHEB.js → chunk-K4G3HOKS.js} +2 -2
- package/dist/commands/{chunk-L6XN3EXI.js → chunk-K64EIHD2.js} +1 -1
- package/dist/commands/{chunk-RINVPTA2.js → chunk-KCFOP5RI.js} +28 -28
- package/dist/commands/{chunk-O26Y2FOJ.js → chunk-KGE4AS2Y.js} +1 -1
- package/dist/commands/{chunk-EWA72KO7.js → chunk-KK2SL42W.js} +2 -2
- package/dist/commands/{chunk-MMXZKLDU.js → chunk-KK7TEL5G.js} +10 -4
- package/dist/commands/{chunk-UEURNXE5.js → chunk-KKIMVXAP.js} +2 -2
- package/dist/commands/{chunk-MAGJFH5T.js → chunk-KODXWMBX.js} +6 -6
- package/dist/commands/{chunk-D4HNS43Q.js → chunk-KPSKWTOS.js} +17 -17
- package/dist/commands/{chunk-VFJYOAOQ.js → chunk-KTV2HNWB.js} +2 -2
- package/dist/commands/{chunk-OWR2TCOY.js → chunk-KWYQR5MK.js} +5 -5
- package/dist/commands/{chunk-FNQW6NY7.js → chunk-KXK2A2HB.js} +6 -2
- package/dist/commands/{chunk-O5FVBIRI.js → chunk-KZ5BBBMO.js} +5 -5
- package/dist/commands/{chunk-JUJFIATR.js → chunk-KZ7HD37E.js} +6 -6
- package/dist/commands/{chunk-2YCKPX3A.js → chunk-KZZWPUJW.js} +1 -1
- package/dist/commands/{chunk-MYNM3YMR.js → chunk-L7DAL54N.js} +3 -3
- package/dist/commands/{chunk-NOXLKIPR.js → chunk-LAR76BFA.js} +1 -1
- package/dist/commands/{chunk-ZA3W73PF.js → chunk-LB557AHJ.js} +3 -3
- package/dist/commands/{chunk-LYEKT3IN.js → chunk-LEB2VP7F.js} +1 -1
- package/dist/commands/{chunk-WQJ7O3C3.js → chunk-LJXKVLYI.js} +1 -1
- package/dist/commands/{chunk-CHX4QTP4.js → chunk-LJZERYLG.js} +1 -1
- package/dist/commands/{chunk-PF22VUWB.js → chunk-LOOFYHUM.js} +76 -26
- package/dist/commands/{chunk-HIPO6HUG.js → chunk-LPSULLNK.js} +1 -1
- package/dist/commands/{chunk-G47ZNQVG.js → chunk-LR22UK5W.js} +1 -1
- package/dist/commands/{chunk-SV4FHQE7.js → chunk-LT7QSHR4.js} +14 -14
- package/dist/commands/{chunk-HIB5G2X6.js → chunk-LUXWDMKI.js} +7 -7
- package/dist/commands/{chunk-XH6BGVVP.js → chunk-LX7TIEMI.js} +9 -36
- package/dist/commands/{chunk-OGNTJ5JB.js → chunk-LYO6TX5L.js} +1 -1
- package/dist/commands/{chunk-JLREFWJ4.js → chunk-LZ5QXE5N.js} +6 -6
- package/dist/commands/{chunk-5WIZR5SC.js → chunk-M4UV3BEV.js} +11 -11
- package/dist/commands/{chunk-LNBUIOK6.js → chunk-M6JDU5EK.js} +4 -4
- package/dist/commands/{chunk-VZSJCFRT.js → chunk-MFBNNTBM.js} +4 -4
- package/dist/commands/{chunk-KHWTJ4F7.js → chunk-MI2OS6TL.js} +3 -3
- package/dist/commands/{chunk-VZCQZFPH.js → chunk-MLW4S35K.js} +19 -8
- package/dist/commands/{chunk-RIUPRMLW.js → chunk-MN425CU6.js} +1 -1
- package/dist/commands/{chunk-7W3D3WRW.js → chunk-MOIOSCZM.js} +2 -2
- package/dist/commands/{chunk-3BNNMJOT.js → chunk-MRORPFSO.js} +20 -320
- package/dist/commands/{chunk-LA5WTOAM.js → chunk-MUGTOJUL.js} +12 -12
- package/dist/commands/{chunk-L6LU2633.js → chunk-MVHPRYHE.js} +1 -1
- package/dist/commands/{chunk-EKCKCX5S.js → chunk-MWO6FOSZ.js} +123 -21
- package/dist/commands/{chunk-AVUGMOHZ.js → chunk-N7QTMTST.js} +2 -2
- package/dist/commands/{chunk-LMSS4ARB.js → chunk-NDBX7LSS.js} +1 -1
- package/dist/commands/{chunk-BEE7OAQ5.js → chunk-NDWZTWXV.js} +21 -2
- package/dist/commands/{chunk-6TESOL3L.js → chunk-NEGJ77RV.js} +7 -7
- package/dist/commands/{chunk-LCEJXF7A.js → chunk-NEGRE5VW.js} +4 -4
- package/dist/commands/{chunk-IXX4SXIP.js → chunk-NFPD2P3V.js} +1 -1
- package/dist/commands/chunk-NHIW7JE6.js +335 -0
- package/dist/commands/{chunk-CJSFC5YI.js → chunk-NILSN7A4.js} +7 -7
- package/dist/commands/{chunk-W4J6YTFE.js → chunk-NOLFSPOB.js} +2 -2
- package/dist/commands/chunk-NT67QTZO.js +65 -0
- package/dist/commands/{chunk-NJT5L6IC.js → chunk-NU7W6QGT.js} +33 -4
- package/dist/commands/chunk-NUR4FQHM.js +21 -0
- package/dist/commands/{chunk-OKKQI4ZG.js → chunk-OAAVY2JK.js} +1 -1
- package/dist/commands/chunk-OF4BY4N7.js +32 -0
- package/dist/commands/{chunk-W47I2KDY.js → chunk-OGS2DK7I.js} +3 -3
- package/dist/commands/{chunk-MS6Q3Z7V.js → chunk-OIPV3PWW.js} +6 -6
- package/dist/commands/{chunk-T33QDAWD.js → chunk-OIX2363L.js} +1 -1
- package/dist/commands/{chunk-GPMSYXYO.js → chunk-OJ65BZBV.js} +283 -15
- package/dist/commands/{chunk-34LAULSC.js → chunk-OKZWEVR4.js} +3 -3
- package/dist/commands/{chunk-2CXAVVST.js → chunk-OL6IF4JC.js} +1 -1
- package/dist/commands/{chunk-6JVNRY5A.js → chunk-OMPRILFH.js} +1 -1
- package/dist/commands/{chunk-VGHSZLYQ.js → chunk-OOWGH2RG.js} +1 -1
- package/dist/commands/{chunk-ERGZPWKP.js → chunk-OP2RFVLS.js} +1 -1
- package/dist/commands/{chunk-UU6GCJGM.js → chunk-ORKVN2LO.js} +2 -2
- package/dist/commands/{chunk-RHII5XI6.js → chunk-OSBWXZJ4.js} +24 -24
- package/dist/commands/{chunk-D3SHCUBC.js → chunk-OVWPZDWP.js} +2 -2
- package/dist/commands/{chunk-Z4HYBFZD.js → chunk-OWYK2BEJ.js} +108 -46
- package/dist/commands/{chunk-P4O67FP5.js → chunk-OX3VQLV2.js} +6 -6
- package/dist/commands/{chunk-L6TU7FC2.js → chunk-OZJP77UM.js} +4 -4
- package/dist/commands/{chunk-SNO7CY2B.js → chunk-P3H3DKTE.js} +2 -2
- package/dist/commands/{chunk-2OIX4JLA.js → chunk-P5SOYWH2.js} +3 -3
- package/dist/commands/{chunk-M4PEC7YW.js → chunk-PHLOTUB7.js} +54 -37
- package/dist/commands/{chunk-73KBUQKI.js → chunk-PTNQCCIB.js} +2 -2
- package/dist/commands/{chunk-4P2LCVGO.js → chunk-PTZEFQUX.js} +8 -8
- package/dist/commands/{chunk-DJVMC3U2.js → chunk-Q426ZSZ4.js} +1 -1
- package/dist/commands/{chunk-US6X7JXC.js → chunk-Q7EEIOAD.js} +4 -4
- package/dist/commands/{chunk-LE7TFPMU.js → chunk-QABRNGQV.js} +2 -2
- package/dist/commands/{chunk-NGKB632X.js → chunk-QDFVVRQP.js} +3 -3
- package/dist/commands/{chunk-36M2UV6C.js → chunk-QGATHT4S.js} +38 -4
- package/dist/commands/{chunk-DIB2Z2OS.js → chunk-QJRVDE7T.js} +1 -1
- package/dist/commands/{chunk-KUJQWO6M.js → chunk-QKTTKAXM.js} +2 -2
- package/dist/commands/{chunk-DXZW4V7J.js → chunk-QMDKDQKW.js} +3 -3
- package/dist/commands/{chunk-VW5SGE7A.js → chunk-QOSC5RKD.js} +1 -1
- package/dist/commands/{chunk-ENLWXAHD.js → chunk-QV5FKMOU.js} +1 -1
- package/dist/commands/{chunk-32SNWQJP.js → chunk-R2THGPI3.js} +2 -2
- package/dist/commands/{chunk-RVHBWSIG.js → chunk-R54Z2Z3X.js} +2 -2
- package/dist/commands/{chunk-CJAA5GAF.js → chunk-RG53UFNW.js} +15 -15
- package/dist/commands/{chunk-HJKZDDDI.js → chunk-RHKCWJQX.js} +1 -1
- package/dist/commands/{chunk-RPDWFUQO.js → chunk-RKIAX4DZ.js} +36 -84
- package/dist/commands/{chunk-LE2T3FGJ.js → chunk-RLBFEHHC.js} +2 -4
- package/dist/commands/{chunk-5GBZ43UA.js → chunk-RMDLFLPE.js} +1 -1
- package/dist/commands/{chunk-U2UH4VM4.js → chunk-RN2YDNLF.js} +2 -2
- package/dist/commands/{chunk-GQHUFNXN.js → chunk-RRAIRS2T.js} +1 -1
- package/dist/commands/{chunk-DRCTDVI2.js → chunk-RUQY5TS3.js} +3 -3
- package/dist/commands/{chunk-WGULS5DA.js → chunk-RW64VHEB.js} +1 -0
- package/dist/commands/{chunk-4G7NKNAZ.js → chunk-RXYMJPJB.js} +3 -3
- package/dist/commands/{chunk-B33BTNB4.js → chunk-S4M6UWR2.js} +21 -5
- package/dist/commands/{chunk-4Q4FXBUQ.js → chunk-SASX3W2M.js} +2 -2
- package/dist/commands/{chunk-TIXJY22D.js → chunk-SJ2ZN575.js} +5 -5
- package/dist/commands/{chunk-NSZTSCBW.js → chunk-SP7DKYGU.js} +13 -13
- package/dist/commands/{chunk-T3FD3Q73.js → chunk-SRG6PKVS.js} +1 -1
- package/dist/commands/{chunk-QA22PBCJ.js → chunk-SSL6A3Y4.js} +3 -3
- package/dist/commands/{chunk-4BEIYKI2.js → chunk-SV4FZR24.js} +2 -0
- package/dist/commands/{chunk-HZSQI6TD.js → chunk-SVTS7ACS.js} +2 -2
- package/dist/commands/{chunk-F7XLEK55.js → chunk-SVV4U5AR.js} +1 -1
- package/dist/commands/{chunk-RRQFITJE.js → chunk-SXJM4DZ5.js} +1 -1
- package/dist/commands/{chunk-OIDMJASD.js → chunk-SYB3M632.js} +1 -1
- package/dist/commands/{chunk-UJOZ2MGX.js → chunk-SYOXIKB7.js} +6 -6
- package/dist/commands/{chunk-5SB37YDW.js → chunk-SZG5HDNP.js} +3 -3
- package/dist/commands/{chunk-R2CF6VZE.js → chunk-T4F33UKZ.js} +4 -4
- package/dist/commands/{chunk-ESQEEL4O.js → chunk-TAEGXID2.js} +2 -2
- package/dist/commands/chunk-TEPYEUYG.js +585 -0
- package/dist/commands/{chunk-LUMCYDGE.js → chunk-TFLHYC2F.js} +2 -2
- package/dist/commands/{chunk-V5OIPYA6.js → chunk-TJKM56WJ.js} +4 -4
- package/dist/commands/{chunk-CYQ3ZF7R.js → chunk-TLAB552K.js} +86 -13
- package/dist/commands/{chunk-ST32OGPY.js → chunk-TP6L4W3W.js} +5 -5
- package/dist/commands/{chunk-C26LKDBE.js → chunk-TR7WWYD5.js} +1 -1
- package/dist/commands/{chunk-PWYXY46Y.js → chunk-TYNH2R66.js} +15 -15
- package/dist/commands/{chunk-AZUE65NT.js → chunk-U5P6G3UV.js} +2 -2
- package/dist/commands/{chunk-REPANBLS.js → chunk-U7Y6RKLK.js} +1 -1
- package/dist/commands/{chunk-55I7OYHI.js → chunk-UIMMWH7U.js} +1 -1
- package/dist/commands/{chunk-72J2G2E7.js → chunk-UKBBWMLE.js} +20 -20
- package/dist/commands/{chunk-VTLL6CKO.js → chunk-UNMSZGSG.js} +14 -14
- package/dist/commands/chunk-UOVUUVDK.js +18 -0
- package/dist/commands/{chunk-JNWHX25C.js → chunk-URDT2O2K.js} +1 -1
- package/dist/commands/{chunk-FGZQSSGH.js → chunk-UREXZJDB.js} +1 -1
- package/dist/commands/{chunk-O4WBADCX.js → chunk-UTHUX7VU.js} +3 -3
- package/dist/commands/{chunk-PDDKRHHS.js → chunk-V5OUZFWK.js} +3 -3
- package/dist/commands/{chunk-N4O5I55P.js → chunk-VCPGFBMN.js} +8 -8
- package/dist/commands/{chunk-WN7NK3NY.js → chunk-VGPIQNDB.js} +1 -1
- package/dist/commands/{chunk-HOGFJHBT.js → chunk-VJS2MCLA.js} +1 -1
- package/dist/commands/{chunk-4YI4SLRJ.js → chunk-VK6D5CWA.js} +8 -8
- package/dist/commands/{chunk-4LWRCPS5.js → chunk-VOF3N4WO.js} +3 -3
- package/dist/commands/{chunk-AM44D7NF.js → chunk-VQRT32JB.js} +1 -1
- package/dist/commands/{chunk-AS3GWVAN.js → chunk-VQVPAVQ3.js} +1 -1
- package/dist/commands/{chunk-6VTJO5L2.js → chunk-VV4TQYGD.js} +3 -3
- package/dist/commands/{chunk-WIE7VUBE.js → chunk-W7DRUOF7.js} +5 -5
- package/dist/commands/{chunk-HH2KDLTP.js → chunk-WAEN2RTT.js} +2 -2
- package/dist/commands/{chunk-NKKH3PBE.js → chunk-WB4T3VY2.js} +18 -1
- package/dist/commands/{chunk-DNJC7X73.js → chunk-WCEUMOKK.js} +2 -2
- package/dist/commands/{chunk-BK6Q4VCA.js → chunk-WTH6NTXU.js} +4 -4
- package/dist/commands/{chunk-WG6GYBRJ.js → chunk-WWVYEHQT.js} +2 -1
- package/dist/commands/{chunk-P4CWLRT2.js → chunk-X3TNPALI.js} +1 -1
- package/dist/commands/{chunk-LZNYHWRO.js → chunk-XC6GG5JR.js} +3 -3
- package/dist/commands/{chunk-RI7EQYKL.js → chunk-XFWI6WHH.js} +2 -2
- package/dist/commands/{chunk-BY3POLIQ.js → chunk-XHGWMD3L.js} +7 -7
- package/dist/commands/{chunk-BPSJSHYD.js → chunk-XI2ABCRX.js} +2 -2
- package/dist/commands/{chunk-TS4ZK46L.js → chunk-XKSUBUIH.js} +5 -5
- package/dist/commands/{chunk-K7GL3BGI.js → chunk-XPBF5DG3.js} +4 -4
- package/dist/commands/{chunk-6SKMZGER.js → chunk-XUMYPESL.js} +20 -8
- package/dist/commands/{chunk-QS5USD4T.js → chunk-XXC32PVL.js} +5 -4
- package/dist/commands/{chunk-ORSI7Y55.js → chunk-XXN2EZBY.js} +1 -1
- package/dist/commands/{chunk-IZVM2TTH.js → chunk-XZQWEVR3.js} +2 -2
- package/dist/commands/{chunk-E3CXOVPQ.js → chunk-Y27PTXXI.js} +1 -1
- package/dist/commands/{chunk-337QQM4C.js → chunk-Y4EBUI6M.js} +106 -5
- package/dist/commands/{chunk-WRX3MINT.js → chunk-YAU3LYNF.js} +1 -1
- package/dist/commands/{chunk-JB7R3A4A.js → chunk-YDURQICF.js} +4 -4
- package/dist/commands/{chunk-RX5JSPPH.js → chunk-YGFOGA7C.js} +11 -11
- package/dist/commands/{chunk-S6SXMBF2.js → chunk-YHJ2AJMA.js} +2 -2
- package/dist/commands/{chunk-MVPUQLN5.js → chunk-YM77CF4D.js} +4 -4
- package/dist/commands/{chunk-ZYIMQHCB.js → chunk-YNPRJCEO.js} +6 -6
- package/dist/commands/{chunk-3UKJFWKS.js → chunk-YTBQAD5W.js} +3 -3
- package/dist/commands/{chunk-WW3TX742.js → chunk-Z3WGHIVB.js} +3 -3
- package/dist/commands/{chunk-KIVOZY2J.js → chunk-ZBZ5DDCH.js} +66 -64
- package/dist/commands/{chunk-TAPDXK34.js → chunk-ZLRUHSOP.js} +1 -1
- package/dist/commands/{chunk-XYAK53TK.js → chunk-ZNR75OXP.js} +2 -1
- package/dist/commands/{chunk-CADFBQJJ.js → chunk-ZSOR4ISJ.js} +4 -4
- package/dist/commands/{chunk-6NRTLH6I.js → chunk-ZYFHYQA7.js} +1 -1
- package/dist/commands/{chunk-Q7TV3OV6.js → chunk-ZZFFSQF4.js} +4 -4
- package/dist/commands/{chunk-PDAY76AN.js → chunk-ZZULXNC2.js} +1 -1
- package/dist/commands/{chunk-5Y7QQYTU.js → chunk-ZZXO6TFH.js} +1 -1
- package/dist/commands/code-symbol-cli.js +4 -4
- package/dist/commands/codex-hook-adapter.js +99 -100
- package/dist/commands/command-derive.js +10 -10
- package/dist/commands/cost-audit-main.js +94 -92
- package/dist/commands/cspell-cached.js +24 -23
- package/dist/commands/defect-origin-main.js +19 -18
- package/dist/commands/defect-report-main.js +15 -14
- package/dist/commands/disposition-cli.js +67 -64
- package/dist/commands/doctor.js +3 -3
- package/dist/commands/document-read-cli.js +89 -9
- package/dist/commands/document-section-main.js +89 -9
- package/dist/commands/edit-files-cli.js +1 -1
- package/dist/commands/effect-audit-cli.js +20 -19
- package/dist/commands/epic-audit-main.js +55 -53
- package/dist/commands/epic-bundle-main.js +87 -85
- package/dist/commands/epic-check.js +16 -15
- package/dist/commands/epic-main.js +93 -91
- package/dist/commands/epic-next-main.js +51 -49
- package/dist/commands/format-edited-cli.js +30 -32
- package/dist/commands/format.js +11 -10
- package/dist/commands/fresh-machine-cli.js +6 -6
- package/dist/commands/git-followup-workflow.js +137 -122
- package/dist/commands/git-workflow.js +28 -27
- package/dist/commands/github-release-cli.js +26 -3
- package/dist/commands/hook-ledger-cli.js +74 -126
- package/dist/commands/init-main.js +20 -19
- package/dist/commands/inputs.json +1907 -1876
- package/dist/commands/issue-ack-cli.js +5 -5
- package/dist/commands/issue-already-done-cli.js +63 -58
- package/dist/commands/issue-body-cli.js +44 -42
- package/dist/commands/issue-cite-main.js +11 -10
- package/dist/commands/issue-comment-main.js +15 -11
- package/dist/commands/issue-consolidate-cli.js +31 -30
- package/dist/commands/issue-file-main.js +114 -110
- package/dist/commands/issue-fold-existing-cli.js +88 -86
- package/dist/commands/issue-fold-main.js +26 -25
- package/dist/commands/issue-lint-main.js +38 -37
- package/dist/commands/issue-measured-cli.js +66 -61
- package/dist/commands/issue-plan-cli.js +103 -101
- package/dist/commands/issue-premise-unmet-cli.js +66 -61
- package/dist/commands/issue-priority-cli.js +13 -12
- package/dist/commands/issue-read-main.js +18 -17
- package/dist/commands/issue-release-class-cli.js +12 -11
- package/dist/commands/issue-release-main.js +13 -12
- package/dist/commands/issue-scout-main.js +89 -87
- package/dist/commands/issue-spill-main.js +114 -110
- package/dist/commands/issue-state-main.js +16 -15
- package/dist/commands/issue-tick-cli.js +14 -13
- package/dist/commands/josh-completion.js +10 -10
- package/dist/commands/lane-adopt-cli.js +19 -19
- package/dist/commands/lane-breakdown-cli.js +154 -126
- package/dist/commands/lane-cli.js +131 -125
- package/dist/commands/lane-launch-main.js +17 -17
- package/dist/commands/lane-limit-cli.js +81 -79
- package/dist/commands/lane-measure-cli.js +246 -130
- package/dist/commands/lane-pause-cli.js +15 -15
- package/dist/commands/lane-plan-cli.js +108 -101
- package/dist/commands/lane-resolve-cli.js +20 -19
- package/dist/commands/lane-restart-cli.js +124 -118
- package/dist/commands/lane-why-cli.js +85 -82
- package/dist/commands/lane-withdraw-cli.js +49 -48
- package/dist/commands/latest-corepack.js +3 -3
- package/dist/commands/latest-if-required-cli.js +9 -9
- package/dist/commands/latest-scope-main.js +5 -5
- package/dist/commands/latest-update.js +3 -3
- package/dist/commands/lines-command.js +3 -3
- package/dist/commands/lint-parallel-main.js +32 -31
- package/dist/commands/lint-related.js +79 -60
- package/dist/commands/lint-rule.js +32 -31
- package/dist/commands/lockfile-policy.js +11 -11
- package/dist/commands/main-merge-main.js +5 -5
- package/dist/commands/main-sync-main.js +5 -5
- package/dist/commands/managed-config-scope-cli.js +3 -3
- package/dist/commands/measure-rerun-cli.js +10 -10
- package/dist/commands/metrics-command.js +91 -58
- package/dist/commands/observation-record-cli.js +3 -3
- package/dist/commands/observations-flush-cli.js +27 -25
- package/dist/commands/oracle-list-cli.js +2 -2
- package/dist/commands/overrides-check.js +4 -4
- package/dist/commands/package-scout-cli.js +67 -26
- package/dist/commands/plan-consumers-main.js +4 -4
- package/dist/commands/plan-scaffold-cli.js +132 -91
- package/dist/commands/pr-classification-main.js +3 -3
- package/dist/commands/pre-commit-lint.js +11 -12
- package/dist/commands/pre-commit-type-check.js +25 -24
- package/dist/commands/pre-push-unit.js +33 -33
- package/dist/commands/pretool-guard-cli.js +90 -91
- package/dist/commands/project-profile-cli.js +5 -4
- package/dist/commands/propagate.js +15 -15
- package/dist/commands/prose-stale-cli.js +20 -19
- package/dist/commands/publishable-range-check.js +4 -4
- package/dist/commands/read-files-cli.js +2 -2
- package/dist/commands/read-set-cli.js +61 -24
- package/dist/commands/refactor-scan-cli.js +6 -6
- package/dist/commands/release-cli.js +64 -36
- package/dist/commands/release-scope-main.js +19 -18
- package/dist/commands/rename-cli.js +27 -29
- package/dist/commands/reserved-run.js +3 -3
- package/dist/commands/retrospective-cli.js +104 -102
- package/dist/commands/review-attest-cli.js +6 -6
- package/dist/commands/review-brief-main.js +127 -109
- package/dist/commands/review-findings-cli.js +2 -2
- package/dist/commands/review-pair-cli.js +110 -84
- package/dist/commands/review-record-main.js +108 -83
- package/dist/commands/review-round2-cli.js +46 -45
- package/dist/commands/review-stops-cli.js +16 -16
- package/dist/commands/review-submit-cli.js +127 -109
- package/dist/commands/rule-list.js +58 -60
- package/dist/commands/rule-value-cli.js +226 -74
- package/dist/commands/run-add-cli.js +28 -27
- package/dist/commands/run-board-main.js +136 -132
- package/dist/commands/run-carry-cli.js +127 -124
- package/dist/commands/run-chain-cli.js +116 -93
- package/dist/commands/run-cut-cli.js +124 -119
- package/dist/commands/run-ending-cli.js +19 -22
- package/dist/commands/run-entry-cli.js +183 -180
- package/dist/commands/run-event-cli.js +5 -5
- package/dist/commands/run-handoff-cli.js +52 -28
- package/dist/commands/run-handoff-lanes-cli.js +15 -15
- package/dist/commands/run-hold-main.js +64 -62
- package/dist/commands/run-liveness-cli.js +11 -11
- package/dist/commands/run-merge-main.js +119 -116
- package/dist/commands/run-next-cli.js +87 -86
- package/dist/commands/run-park-cli.js +111 -92
- package/dist/commands/run-pause-cli.js +147 -133
- package/dist/commands/run-pickup-cli.js +13 -13
- package/dist/commands/run-prep-main.js +83 -82
- package/dist/commands/run-prime-cli.js +107 -87
- package/dist/commands/run-progress-main.js +123 -107
- package/dist/commands/run-report-cli.js +25 -24
- package/dist/commands/run-review-cli.js +168 -149
- package/dist/commands/run-ship-cli.js +208 -203
- package/dist/commands/run-ship-evidence-cli.js +38 -37
- package/dist/commands/run-ship-wait-main.js +40 -37
- package/dist/commands/run-split-cli.js +127 -125
- package/dist/commands/run-stale-main.js +36 -35
- package/dist/commands/run-status-cli.js +16 -15
- package/dist/commands/run-step-cli.js +173 -164
- package/dist/commands/run-tail-cli.js +1 -1
- package/dist/commands/run-tidy-main.js +30 -29
- package/dist/commands/run-wake-main.js +137 -119
- package/dist/commands/run-watcher-guard-cli.js +30 -29
- package/dist/commands/secretlint-scan.js +2 -2
- package/dist/commands/selfcheck-cli.js +27 -26
- package/dist/commands/session-language-main.js +48 -28
- package/dist/commands/sonar-hotspots-cli.js +3 -3
- package/dist/commands/split-assess-cli.js +24 -23
- package/dist/commands/split-child-recover-cli.js +13 -12
- package/dist/commands/start.js +37 -35
- package/dist/commands/stash-pop-main.js +3 -3
- package/dist/commands/stash-push-main.js +3 -3
- package/dist/commands/stop-guard.js +144 -143
- package/dist/commands/sync-main.js +11 -10
- package/dist/commands/telegram-test-main.js +5 -5
- package/dist/commands/test-declared.js +9 -8
- package/dist/commands/test-e2e-guard.js +23 -22
- package/dist/commands/test-pinned-main.js +26 -25
- package/dist/commands/test-reach-cli.js +15 -14
- package/dist/commands/test-red-main.js +5 -5
- package/dist/commands/{test-related-ZT2AO62I.js → test-related-ZCNC46MS.js} +31 -31
- package/dist/commands/test-related-main.js +51 -50
- package/dist/commands/test-unit-guard-main.js +9 -8
- package/dist/commands/time-cli.js +24 -27
- package/dist/commands/time-density-cli.js +8 -9
- package/dist/commands/tree-status-cli.js +4 -4
- package/dist/commands/type-check-command.js +8 -7
- package/dist/commands/ui-shot-cli.js +4 -4
- package/dist/commands/uninstall.js +20 -19
- package/dist/commands/unused-members-cli.js +9 -8
- package/dist/commands/upstream-interrupt-main.js +115 -111
- package/dist/commands/verification-gate.js +46 -46
- package/dist/commands/version-check.js +5 -5
- package/dist/hooks/{chunk-LWD43Z3C.js → chunk-5CUXGQT6.js} +1667 -107
- package/dist/hooks/{chunk-4YXV2REH.js → chunk-5R5YFQR5.js} +8 -8
- package/dist/hooks/{chunk-LKQBEKBI.js → chunk-6RLY27FT.js} +8 -8
- package/dist/hooks/{chunk-CICKRHTB.js → chunk-AO4TOV4V.js} +119 -2679
- package/dist/hooks/{chunk-NUPVO7RI.js → chunk-G5WSPYJ6.js} +4296 -1687
- package/dist/hooks/{chunk-UU4PTPEZ.js → chunk-HHIVWGHX.js} +250 -125
- package/dist/hooks/{chunk-P7BPAU26.js → chunk-IURJANNZ.js} +2 -2
- package/dist/hooks/{chunk-6RR6JZSB.js → chunk-OV22V63P.js} +357 -1744
- package/dist/hooks/{chunk-RQXECHAS.js → chunk-SXABK6UV.js} +57 -45
- package/dist/hooks/codex-hook-adapter.js +11 -11
- package/dist/hooks/daemon.js +1053 -690
- package/dist/hooks/format-edited.js +5 -5
- package/dist/hooks/inputs.json +551 -536
- package/dist/hooks/pretool-guard.js +7 -7
- package/dist/hooks/session-lang.js +292 -15
- package/dist/hooks/stop-guard.js +225 -48
- package/dist/inputs.json +65 -65
- package/dist/josh.js +73 -19
- package/dist/self-sync-guard/index.js +18 -1
- package/dist/version/index.js +18 -1
- package/package.json +3 -3
- package/pnpm-workspace.yaml +5 -13
- package/prompts/collaboration-workflow/issue-template.en.md +56 -52
- package/scripts/agent/agent-argv.ts +20 -6
- package/scripts/agent/agent-phase-profile.ts +89 -0
- package/scripts/agent/agent-role-profile.ts +3 -71
- package/scripts/agent/agent-ship-cap.ts +44 -0
- package/scripts/agent/agent-worker-profile.ts +154 -0
- package/scripts/agent/claude-agent-argv.ts +1 -1
- package/scripts/agent/lane-instructions.ts +29 -3
- package/scripts/auto-ok/auto-ok-judge-cli.ts +3 -0
- package/scripts/auto-ok/auto-ok-judge-write.ts +2 -1
- package/scripts/auto-ok/auto-ok-judge.ts +4 -2
- package/scripts/backlog/backlog-drive-escalate.ts +115 -0
- package/scripts/backlog/backlog-drive-stalled-retry.ts +48 -10
- package/scripts/document/document-scan.ts +35 -1
- package/scripts/gh/git-pr-checks-failed.ts +24 -0
- package/scripts/hooks/implementation-shell-deny-expansion.ts +20 -0
- package/scripts/hooks/implementation-shell-deny-git.ts +128 -0
- package/scripts/hooks/implementation-shell-deny.ts +14 -138
- package/scripts/hooks/implementation-shell.ts +28 -5
- package/scripts/hooks/step-zero-notice.ts +9 -6
- package/scripts/hooks/stop-actions.ts +4 -2
- package/scripts/init/init-logic-workspace.ts +1 -1
- package/scripts/issue/issue-auto-ok.ts +43 -4
- package/scripts/issue/issue-body-keys.ts +4 -0
- package/scripts/issue/issue-comment-cli.ts +15 -2
- package/scripts/issue/issue-evidence-exit.ts +6 -2
- package/scripts/issue/issue-file-cli.ts +5 -1
- package/scripts/issue/issue-file-pass.ts +14 -7
- package/scripts/issue/issue-file-worker.ts +95 -0
- package/scripts/issue/issue-file.ts +1 -1
- package/scripts/issue/issue-outcome.ts +107 -0
- package/scripts/issue/issue-read.ts +12 -7
- package/scripts/issue/issue-watch-diff.ts +2 -1
- package/scripts/josh/josh-commands-ai.ts +2 -2
- package/scripts/josh/josh-commands-development.ts +21 -5
- package/scripts/josh/josh-commands-issue-write.ts +3 -2
- package/scripts/josh/josh-commands-lint.ts +1 -1
- package/scripts/josh/josh-commands-project.ts +7 -2
- package/scripts/josh/josh-commands-run.ts +10 -2
- package/scripts/josh/josh-commands-workflow.ts +5 -0
- package/scripts/lane/lane-breakdown-cli.ts +14 -4
- package/scripts/lane/lane-breakdown-text.ts +7 -0
- package/scripts/lane/lane-breakdown.ts +21 -1
- package/scripts/lane/lane-dispatch-prepare.ts +83 -0
- package/scripts/lane/lane-dispatch.ts +3 -53
- package/scripts/lane/lane-elapsed-time.ts +118 -0
- package/scripts/lane/lane-ledger-schema-ship.ts +4 -1
- package/scripts/lane/lane-net-time.ts +35 -7
- package/scripts/lane/lane-overrun.ts +1 -1
- package/scripts/lane/lane-plan-cli.ts +7 -3
- package/scripts/lane/lane-plan-estimate.ts +57 -0
- package/scripts/lane/lane-plan-size.ts +11 -20
- package/scripts/lane/lane-plan.ts +1 -0
- package/scripts/lane/lane-relaunch.ts +9 -4
- package/scripts/lane/lane-stage-budget.ts +6 -1
- package/scripts/lane/lane-stage-events.ts +103 -0
- package/scripts/lane/lane-stats-tables.ts +3 -0
- package/scripts/lane/lane-stop-check-stats.ts +117 -0
- package/scripts/lane/lane-stop-stats.ts +30 -6
- package/scripts/lane/lane-why-causes.ts +3 -11
- package/scripts/lane/openai-lane-supervisor-owner.ts +12 -0
- package/scripts/lane/openai-lane-supervisor.ts +36 -1
- package/scripts/lib/home-tilde.ts +24 -0
- package/scripts/lib/package-manifest.ts +27 -1
- package/scripts/observations/observation-ledger-archive.ts +180 -0
- package/scripts/observations/observation-ledger-home.ts +1 -0
- package/scripts/observations/observation-ledger.ts +5 -0
- package/scripts/observations/observations-flush-transaction.ts +358 -0
- package/scripts/observations/observations-flush.ts +72 -172
- package/scripts/plan/plan-scaffold-cli.ts +17 -6
- package/scripts/plan/plan-scaffold.ts +11 -0
- package/scripts/release/github-release-notes.ts +24 -0
- package/scripts/release/github-release-runs.ts +32 -6
- package/scripts/release/github-release.ts +10 -2
- package/scripts/release/release-progress.ts +22 -10
- package/scripts/release/release-publish-run.ts +39 -6
- package/scripts/repo/repository-labels.ts +23 -11
- package/scripts/review/review-comment-round.ts +10 -5
- package/scripts/rules/broad-investigation-shell.ts +2 -2
- package/scripts/rules/codex-prompt.ts +63 -0
- package/scripts/rules/direct-issue-comment.ts +62 -2
- package/scripts/rules/direct-issue-read.ts +55 -2
- package/scripts/rules/guard-remedy.ts +10 -4
- package/scripts/rules/issue-citation.ts +20 -9
- package/scripts/rules/last-prompt.ts +8 -4
- package/scripts/rules/rule-value-cli.ts +85 -4
- package/scripts/rules/rule-value-trend.ts +108 -0
- package/scripts/rules/shell-redirects.ts +19 -7
- package/scripts/rules/shell-segments.ts +145 -20
- package/scripts/rules/shell-tokens.ts +66 -0
- package/scripts/rules/standalone-gh-call.ts +63 -0
- package/scripts/rules/unasked-filing.ts +12 -4
- package/scripts/run/board/run-board-closed.ts +10 -1
- package/scripts/run/board/run-board-decision-read.ts +52 -12
- package/scripts/run/board/run-board-decision.ts +5 -0
- package/scripts/run/board/run-board-ending-reason.ts +21 -7
- package/scripts/run/board/run-board-github.ts +8 -1
- package/scripts/run/board/run-board-layout.ts +5 -3
- package/scripts/run/board/run-board-link.ts +2 -0
- package/scripts/run/board/run-board-operation.ts +6 -2
- package/scripts/run/board/run-board-pause-fixture.json +12 -0
- package/scripts/run/board/run-board-pause.ts +87 -0
- package/scripts/run/board/run-board-plan-shared.ts +2 -0
- package/scripts/run/board/run-board-render-condition.ts +10 -1
- package/scripts/run/board/run-board-render-title.ts +7 -0
- package/scripts/run/board/run-board-settle.ts +16 -2
- package/scripts/run/board/run-board-snapshot.ts +4 -0
- package/scripts/run/board/run-board-status.ts +11 -1
- package/scripts/run/cut/run-cut-cli.ts +2 -1
- package/scripts/run/park/run-park-cli.ts +13 -1
- package/scripts/run/park/run-park-escalate.ts +102 -0
- package/scripts/run/park/run-stalled.ts +29 -7
- package/scripts/run/review/run-review-early-push.ts +6 -6
- package/scripts/run/ship/run-ship-stop-cause.ts +12 -1
- package/scripts/split/split-assess.ts +14 -5
- package/scripts/test/test-related-touched.ts +21 -3
- package/scripts/test/test-related.ts +1 -1
- package/dist/commands/chunk-6WEVLIZE.js +0 -29
- package/dist/commands/chunk-E2ZCUKHT.js +0 -274
- package/dist/commands/chunk-NMLCPYBN.js +0 -134
- package/dist/commands/chunk-QEIO2ZNQ.js +0 -324
- package/dist/commands/chunk-QWX7EBC6.js +0 -112
- package/dist/commands/chunk-RQRLW4XK.js +0 -20
- package/dist/commands/chunk-UCQJDYE3.js +0 -21
- package/dist/commands/chunk-W4YH2DF3.js +0 -58
- package/dist/commands/{chunk-LRA3PXHS.js → chunk-ENKFCOVY.js} +3 -3
- package/dist/commands/{chunk-RUWV4INF.js → chunk-HQGNXR6I.js} +3 -3
|
@@ -4,38 +4,21 @@ import {
|
|
|
4
4
|
OPTIONAL_ENV_FILE_FLAGS,
|
|
5
5
|
PACKAGE_JSON,
|
|
6
6
|
ancestor_directories,
|
|
7
|
-
|
|
8
|
-
cost_blocks,
|
|
9
|
-
figure_format,
|
|
10
|
-
issue_cite,
|
|
11
|
-
josh_environment_file,
|
|
12
|
-
lane_reap,
|
|
7
|
+
josh_verdict,
|
|
13
8
|
lane_state_record,
|
|
14
9
|
ports,
|
|
15
|
-
pr_raw_schema,
|
|
16
10
|
process_owner_schema,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
session_language,
|
|
20
|
-
time_josh_names,
|
|
21
|
-
time_shell,
|
|
22
|
-
transcript_record,
|
|
23
|
-
transcript_tail
|
|
24
|
-
} from "./chunk-NUPVO7RI.js";
|
|
11
|
+
session_language
|
|
12
|
+
} from "./chunk-G5WSPYJ6.js";
|
|
25
13
|
import {
|
|
26
14
|
git_directory
|
|
27
15
|
} from "./chunk-LRD2ERRI.js";
|
|
28
16
|
import {
|
|
29
|
-
cost_transcript,
|
|
30
|
-
file_reader,
|
|
31
17
|
issue_number_shape,
|
|
32
|
-
lane_ledger_write,
|
|
33
18
|
lane_paths,
|
|
34
|
-
process_identity
|
|
35
|
-
time_instant
|
|
19
|
+
process_identity
|
|
36
20
|
} from "./chunk-FOW4B7OQ.js";
|
|
37
21
|
import {
|
|
38
|
-
MS_PER_SECOND,
|
|
39
22
|
PLATFORM_TEMP_ROOT,
|
|
40
23
|
durable_state_root,
|
|
41
24
|
external_exports,
|
|
@@ -44,2561 +27,10 @@ import {
|
|
|
44
27
|
stamp_file
|
|
45
28
|
} from "./chunk-CY3ADSDR.js";
|
|
46
29
|
|
|
47
|
-
// scripts/hooks/hook-context.ts
|
|
48
|
-
function from_process() {
|
|
49
|
-
return { cwd: process.cwd(), env: process.env, ancestry: lane_reap.own_ancestry };
|
|
50
|
-
}
|
|
51
|
-
var hook_context = { from_process };
|
|
52
|
-
|
|
53
|
-
// scripts/time-runtime/time-hook-transcript.ts
|
|
54
|
-
import path from "node:path";
|
|
55
|
-
var { TRANSCRIPT_EXTENSION } = cost_transcript;
|
|
56
|
-
var AGENT_PREFIX = "agent-";
|
|
57
|
-
var AGENT_ID_PATTERN = /^[\w-]+$/u;
|
|
58
|
-
function is_agent_id(value2) {
|
|
59
|
-
return typeof value2 === "string" && AGENT_ID_PATTERN.test(value2);
|
|
60
|
-
}
|
|
61
|
-
function fork_path(transcript_path, agent_id) {
|
|
62
|
-
const directory = path.dirname(transcript_path);
|
|
63
|
-
const session_id = path.basename(transcript_path, TRANSCRIPT_EXTENSION);
|
|
64
|
-
const file_name = `${AGENT_PREFIX}${agent_id}${TRANSCRIPT_EXTENSION}`;
|
|
65
|
-
return path.join(cost_transcript.unit_directory(directory, session_id), file_name);
|
|
66
|
-
}
|
|
67
|
-
function transcript_of(transcript_path, agent_id) {
|
|
68
|
-
if (!is_agent_id(agent_id) || !transcript_path.endsWith(TRANSCRIPT_EXTENSION)) {
|
|
69
|
-
return transcript_path;
|
|
70
|
-
}
|
|
71
|
-
return fork_path(transcript_path, agent_id);
|
|
72
|
-
}
|
|
73
|
-
var time_hook_transcript = {
|
|
74
|
-
fork_path,
|
|
75
|
-
transcript_of
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
// scripts/josh/hook-payload-capture.ts
|
|
79
|
-
import { mkdirSync, readdirSync, writeFileSync } from "node:fs";
|
|
80
|
-
import path2 from "node:path";
|
|
81
|
-
var CAPTURE_DIR_KEY = "JOSH_HOOK_CAPTURE_DIR";
|
|
82
|
-
var NO_TOOL = "none";
|
|
83
|
-
var FILE_EXTENSION = ".json";
|
|
84
|
-
var UNSAFE_NAME_CHARACTERS = /[^\w.-]/gu;
|
|
85
|
-
var MAX_ATTEMPTS = 32;
|
|
86
|
-
var tool_schema = external_exports.looseObject({ tool_name: external_exports.string().min(1) });
|
|
87
|
-
function safe_name(name) {
|
|
88
|
-
return name.replaceAll(UNSAFE_NAME_CHARACTERS, "-");
|
|
89
|
-
}
|
|
90
|
-
function tool_label(raw_payload) {
|
|
91
|
-
return safe_name(json_value.parse_with(raw_payload, tool_schema)?.tool_name ?? NO_TOOL);
|
|
92
|
-
}
|
|
93
|
-
function write_new(file, raw_payload) {
|
|
94
|
-
try {
|
|
95
|
-
writeFileSync(file, raw_payload, { flag: "wx" });
|
|
96
|
-
return true;
|
|
97
|
-
} catch {
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
function write_capture(directory, hook, raw_payload) {
|
|
102
|
-
const prefix2 = `${safe_name(hook)}-${tool_label(raw_payload)}-`;
|
|
103
|
-
const first = readdirSync(directory).filter((name) => name.startsWith(prefix2)).length + 1;
|
|
104
|
-
for (let index = first; index < first + MAX_ATTEMPTS; index += 1) {
|
|
105
|
-
const file = path2.join(directory, `${prefix2}${String(index)}${FILE_EXTENSION}`);
|
|
106
|
-
if (write_new(file, raw_payload)) return file;
|
|
107
|
-
}
|
|
108
|
-
return void 0;
|
|
109
|
-
}
|
|
110
|
-
function capture(hook, raw_payload, environment = process.env) {
|
|
111
|
-
const directory = environment[CAPTURE_DIR_KEY];
|
|
112
|
-
if (directory === void 0 || directory === "") return void 0;
|
|
113
|
-
try {
|
|
114
|
-
mkdirSync(directory, { recursive: true });
|
|
115
|
-
return write_capture(directory, hook, raw_payload);
|
|
116
|
-
} catch {
|
|
117
|
-
return void 0;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
var hook_payload_capture = { CAPTURE_DIR_KEY, capture };
|
|
121
|
-
|
|
122
|
-
// scripts/josh/hook-decision.ts
|
|
123
|
-
import { text } from "node:stream/consumers";
|
|
124
|
-
|
|
125
|
-
// scripts/josh/hook-envelope.ts
|
|
126
|
-
var HOOK_EVENT_NAME = "PreToolUse";
|
|
127
|
-
var DENY_DECISION = "deny";
|
|
128
|
-
var ALLOW_DECISION = "allow";
|
|
129
|
-
function deny_envelope(reason) {
|
|
130
|
-
return JSON.stringify({
|
|
131
|
-
hookSpecificOutput: {
|
|
132
|
-
hookEventName: HOOK_EVENT_NAME,
|
|
133
|
-
permissionDecision: DENY_DECISION,
|
|
134
|
-
permissionDecisionReason: reason
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
function rewrite_envelope(updated_input, context) {
|
|
139
|
-
return JSON.stringify({
|
|
140
|
-
systemMessage: context,
|
|
141
|
-
hookSpecificOutput: {
|
|
142
|
-
hookEventName: HOOK_EVENT_NAME,
|
|
143
|
-
permissionDecision: ALLOW_DECISION,
|
|
144
|
-
updatedInput: updated_input,
|
|
145
|
-
additionalContext: context
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
function flow_rewrite_envelope(updated_input, context) {
|
|
150
|
-
return JSON.stringify({
|
|
151
|
-
systemMessage: context,
|
|
152
|
-
hookSpecificOutput: {
|
|
153
|
-
hookEventName: HOOK_EVENT_NAME,
|
|
154
|
-
updatedInput: updated_input,
|
|
155
|
-
additionalContext: context
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
function notice_envelope(notice) {
|
|
160
|
-
return JSON.stringify({
|
|
161
|
-
systemMessage: notice,
|
|
162
|
-
hookSpecificOutput: { hookEventName: HOOK_EVENT_NAME, additionalContext: notice }
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
var hook_envelope = { deny_envelope, flow_rewrite_envelope, notice_envelope, rewrite_envelope };
|
|
166
|
-
|
|
167
|
-
// scripts/josh/hook-tool-payload.ts
|
|
168
|
-
var schema = external_exports.object({
|
|
169
|
-
tool_name: external_exports.string().min(1),
|
|
170
|
-
tool_input: external_exports.unknown()
|
|
171
|
-
});
|
|
172
|
-
function parse(raw_payload) {
|
|
173
|
-
return json_value.parse_with(raw_payload, schema);
|
|
174
|
-
}
|
|
175
|
-
var hook_tool_payload = { parse, schema };
|
|
176
|
-
|
|
177
|
-
// scripts/josh/hook-decision.ts
|
|
178
|
-
var payload_schema = hook_tool_payload.schema.extend({
|
|
179
|
-
transcript_path: external_exports.string().min(1),
|
|
180
|
-
// **`nullish`, not `optional`.** A payload spelling the absent agent as `null` has to read as "no
|
|
181
|
-
// fork"; rejected, it would fail `safeParse` for the whole payload and take the guard off every
|
|
182
|
-
// call of the main line, in silence — the failure every other path here is written to avoid.
|
|
183
|
-
agent_id: external_exports.string().nullish(),
|
|
184
|
-
// The session's model where the harness hands it over (a Codex payload); Claude Code names it on
|
|
185
|
-
// the transcript's assistant entries instead (`scripts/rules/main-model.ts`).
|
|
186
|
-
model: external_exports.string().nullish()
|
|
187
|
-
});
|
|
188
|
-
var refusal_schema = external_exports.object({ refused_at_ms: external_exports.number() });
|
|
189
|
-
var NEVER_MS = 0;
|
|
190
|
-
var DISABLED_VALUES = ["off", "0", "false", "no"];
|
|
191
|
-
function is_switch_enabled(key2, environment = process.env) {
|
|
192
|
-
return !DISABLED_VALUES.includes((environment[key2] ?? "").trim().toLowerCase());
|
|
193
|
-
}
|
|
194
|
-
var ENABLED_VALUES = ["on", "1", "true", "yes"];
|
|
195
|
-
function is_switch_opt_in(key2) {
|
|
196
|
-
return ENABLED_VALUES.includes((process.env[key2] ?? "").trim().toLowerCase());
|
|
197
|
-
}
|
|
198
|
-
function parse_hook_payload(raw_payload) {
|
|
199
|
-
return json_value.parse_with(raw_payload, payload_schema);
|
|
200
|
-
}
|
|
201
|
-
var { deny_envelope: deny_envelope2, flow_rewrite_envelope: flow_rewrite_envelope2, notice_envelope: notice_envelope2, rewrite_envelope: rewrite_envelope2 } = hook_envelope;
|
|
202
|
-
function stamp_fault(switch_key) {
|
|
203
|
-
return `\u26A0 ${switch_key}: the run is past the limit but the refusal stamp could not be written, so this call was allowed rather than refused. Without the stamp a refusal could repeat and wedge the run. Batch the calls that do not need each other anyway, and check the temp directory is writable.`;
|
|
204
|
-
}
|
|
205
|
-
function error_text(error) {
|
|
206
|
-
if (error instanceof Error) return error.message;
|
|
207
|
-
return typeof error === "string" ? error : "a value that is not an error";
|
|
208
|
-
}
|
|
209
|
-
function fault_notice(switch_key, error) {
|
|
210
|
-
if (file_reader.is_absent(error)) return void 0;
|
|
211
|
-
const detail = error_text(error);
|
|
212
|
-
return `\u26A0 ${switch_key}: the guard could not read the run's history, so this call was allowed without being checked \u2014 silence here is not evidence that the run is batching. Cause: ${detail}`;
|
|
213
|
-
}
|
|
214
|
-
function last_refusal_ms(target) {
|
|
215
|
-
const raw = stamp_file.read_stamp_text(target);
|
|
216
|
-
if (raw === void 0) return NEVER_MS;
|
|
217
|
-
return json_value.parse_with(raw, refusal_schema)?.refused_at_ms ?? NEVER_MS;
|
|
218
|
-
}
|
|
219
|
-
function record_refusal(target, now_ms) {
|
|
220
|
-
try {
|
|
221
|
-
stamp_file.write_stamp(target, { refused_at_ms: now_ms });
|
|
222
|
-
return true;
|
|
223
|
-
} catch {
|
|
224
|
-
return false;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
function create_refusal_stamp(prefix2) {
|
|
228
|
-
function path6(transcript_path) {
|
|
229
|
-
return stamp_file.stamp_path(prefix2, transcript_path);
|
|
230
|
-
}
|
|
231
|
-
return { path: path6, last_ms: last_refusal_ms, record: record_refusal };
|
|
232
|
-
}
|
|
233
|
-
var { load_environment_file } = josh_environment_file;
|
|
234
|
-
var NO_OUTCOME = { reason: void 0, notice: void 0, fault: void 0 };
|
|
235
|
-
function fire_once(stamp, run, should_fire, switch_key) {
|
|
236
|
-
const target = stamp.path(run.transcript);
|
|
237
|
-
if (!should_fire(stamp.last_ms(target))) return { fired: false, fault: void 0 };
|
|
238
|
-
if (!stamp.record(target, run.now_ms)) return { fired: false, fault: stamp_fault(switch_key) };
|
|
239
|
-
return { fired: true, fault: void 0 };
|
|
240
|
-
}
|
|
241
|
-
function block_outcome(context) {
|
|
242
|
-
const { spec, stamp, tail, call, run } = context;
|
|
243
|
-
const result = fire_once(
|
|
244
|
-
stamp,
|
|
245
|
-
run,
|
|
246
|
-
(last_fired_ms) => spec.should_block(tail, call, last_fired_ms, run),
|
|
247
|
-
spec.switch_key
|
|
248
|
-
);
|
|
249
|
-
if (result.fired) return { reason: spec.reason, notice: void 0, fault: void 0 };
|
|
250
|
-
return { reason: void 0, notice: void 0, fault: result.fault };
|
|
251
|
-
}
|
|
252
|
-
function notify_outcome(context) {
|
|
253
|
-
const { spec, notify_stamp, tail, call, run } = context;
|
|
254
|
-
if (notify_stamp === void 0 || spec.notify === void 0) return NO_OUTCOME;
|
|
255
|
-
const { notify } = spec;
|
|
256
|
-
const result = fire_once(
|
|
257
|
-
notify_stamp,
|
|
258
|
-
run,
|
|
259
|
-
(last_fired_ms) => notify.should_notify(tail, call, last_fired_ms, run),
|
|
260
|
-
spec.switch_key
|
|
261
|
-
);
|
|
262
|
-
if (result.fired) return { reason: void 0, notice: notify.text(call, tail), fault: void 0 };
|
|
263
|
-
return { reason: void 0, notice: void 0, fault: result.fault };
|
|
264
|
-
}
|
|
265
|
-
function is_clear(outcome) {
|
|
266
|
-
return outcome.reason === void 0 && outcome.notice === void 0 && outcome.fault === void 0;
|
|
267
|
-
}
|
|
268
|
-
function guard_reason_for_payload(parts, payload, now_ms, hook) {
|
|
269
|
-
const call = { name: payload.tool_name, input: payload.tool_input };
|
|
270
|
-
if (!parts.spec.is_candidate(call, hook)) return NO_OUTCOME;
|
|
271
|
-
const transcript = time_hook_transcript.transcript_of(payload.transcript_path, payload.agent_id);
|
|
272
|
-
const tail = transcript_tail.read_tail(transcript);
|
|
273
|
-
const is_unit = typeof payload.agent_id === "string" && payload.agent_id.length > 0;
|
|
274
|
-
const run = { transcript, now_ms, model: payload.model ?? void 0, is_unit, context: hook };
|
|
275
|
-
const context = { ...parts, tail, call, run };
|
|
276
|
-
const blocked = block_outcome(context);
|
|
277
|
-
if (!is_clear(blocked)) return blocked;
|
|
278
|
-
return notify_outcome(context);
|
|
279
|
-
}
|
|
280
|
-
function guard_outcome(parts, raw_payload, now_ms, hook) {
|
|
281
|
-
const payload = parse_hook_payload(raw_payload);
|
|
282
|
-
if (payload === void 0 || !is_switch_enabled(parts.spec.switch_key, hook.env)) {
|
|
283
|
-
return NO_OUTCOME;
|
|
284
|
-
}
|
|
285
|
-
return guard_reason_for_payload(parts, payload, now_ms, hook);
|
|
286
|
-
}
|
|
287
|
-
function create_transcript_guard(spec) {
|
|
288
|
-
const stamp = create_refusal_stamp(spec.prefix);
|
|
289
|
-
const notify_stamp = spec.notify ? create_refusal_stamp(spec.notify.prefix) : void 0;
|
|
290
|
-
const parts = { spec, stamp, notify_stamp };
|
|
291
|
-
function is_enabled(environment = process.env) {
|
|
292
|
-
return is_switch_enabled(spec.switch_key, environment);
|
|
293
|
-
}
|
|
294
|
-
function outcome(raw_payload, now_ms = Date.now(), hook = hook_context.from_process()) {
|
|
295
|
-
try {
|
|
296
|
-
return guard_outcome(parts, raw_payload, now_ms, hook);
|
|
297
|
-
} catch (error) {
|
|
298
|
-
return { reason: void 0, notice: void 0, fault: fault_notice(spec.switch_key, error) };
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
function refusal(...call) {
|
|
302
|
-
return outcome(...call).reason;
|
|
303
|
-
}
|
|
304
|
-
return { is_enabled, outcome, refusal, refusal_path: stamp.path };
|
|
305
|
-
}
|
|
306
|
-
function emit_outcome(outcome) {
|
|
307
|
-
const { reason, notice, fault } = outcome;
|
|
308
|
-
if (reason !== void 0) process.stdout.write(`${deny_envelope2(reason)}
|
|
309
|
-
`);
|
|
310
|
-
else if (notice !== void 0) process.stdout.write(`${notice_envelope2(notice)}
|
|
311
|
-
`);
|
|
312
|
-
else if (fault !== void 0) process.stdout.write(`${notice_envelope2(fault)}
|
|
313
|
-
`);
|
|
314
|
-
}
|
|
315
|
-
function report_no_payload(command) {
|
|
316
|
-
process.stderr.write(
|
|
317
|
-
`${command} reads a Claude Code hook payload on stdin; it is not run by hand.
|
|
318
|
-
`
|
|
319
|
-
);
|
|
320
|
-
}
|
|
321
|
-
async function respond_from_stdin(command, respond) {
|
|
322
|
-
if (process.stdin.isTTY) {
|
|
323
|
-
report_no_payload(command);
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
const raw_payload = await text(process.stdin);
|
|
327
|
-
load_environment_file();
|
|
328
|
-
hook_payload_capture.capture(command, raw_payload);
|
|
329
|
-
await respond(raw_payload);
|
|
330
|
-
}
|
|
331
|
-
var hook_decision = {
|
|
332
|
-
DISABLED_VALUES,
|
|
333
|
-
ENABLED_VALUES,
|
|
334
|
-
NEVER_MS,
|
|
335
|
-
create_refusal_stamp,
|
|
336
|
-
create_transcript_guard,
|
|
337
|
-
deny_envelope: deny_envelope2,
|
|
338
|
-
emit_outcome,
|
|
339
|
-
flow_rewrite_envelope: flow_rewrite_envelope2,
|
|
340
|
-
is_switch_enabled,
|
|
341
|
-
is_switch_opt_in,
|
|
342
|
-
load_environment_file,
|
|
343
|
-
notice_envelope: notice_envelope2,
|
|
344
|
-
parse_hook_payload,
|
|
345
|
-
respond_from_stdin,
|
|
346
|
-
rewrite_envelope: rewrite_envelope2,
|
|
347
|
-
stamp_fault
|
|
348
|
-
};
|
|
349
|
-
|
|
350
|
-
// scripts/lib/status-icons.ts
|
|
351
|
-
var FAIL_ICON = "\u2717";
|
|
352
|
-
var PASS_ICON = "\u2714";
|
|
353
|
-
var WARN_ICON = "\u26A0";
|
|
354
|
-
var status_icons = { FAIL_ICON, PASS_ICON, WARN_ICON };
|
|
355
|
-
|
|
356
|
-
// scripts/josh/josh-verdict.ts
|
|
357
|
-
var { FAIL_ICON: FAIL_ICON2, PASS_ICON: PASS_ICON2, WARN_ICON: WARN_ICON2 } = status_icons;
|
|
358
|
-
var GATE_SUBJECT = "verification gate";
|
|
359
|
-
var GATE_PASSED_PREFIX = `${PASS_ICON2} ${GATE_SUBJECT} passed`;
|
|
360
|
-
var GATE_FAILED_PREFIX = `${FAIL_ICON2} ${GATE_SUBJECT} failed`;
|
|
361
|
-
var GATE_UNVERIFIED_PREFIX = `${WARN_ICON2} ${GATE_SUBJECT} not verified`;
|
|
362
|
-
var PASSED_VERDICT = "passed";
|
|
363
|
-
var FAILED_VERDICT = "failed";
|
|
364
|
-
var UNVERIFIED_VERDICT = "unverified";
|
|
365
|
-
function format_counts(counts) {
|
|
366
|
-
if (counts.skipped === 0) return `${String(counts.ran)} checks`;
|
|
367
|
-
return `${String(counts.ran)} ran, ${String(counts.skipped)} skipped`;
|
|
368
|
-
}
|
|
369
|
-
function format_gate_passed(counts, total) {
|
|
370
|
-
return `${GATE_PASSED_PREFIX} (${format_counts(counts)}) in ${total}.`;
|
|
371
|
-
}
|
|
372
|
-
function format_gate_unverified(skipped, total) {
|
|
373
|
-
return `${GATE_UNVERIFIED_PREFIX} (0 ran, ${String(skipped)} skipped) in ${total}.`;
|
|
374
|
-
}
|
|
375
|
-
function format_gate_failed(failed_labels, total) {
|
|
376
|
-
return `${GATE_FAILED_PREFIX}: ${failed_labels} (${total})`;
|
|
377
|
-
}
|
|
378
|
-
var GATE_OPENING_PREFIX = "plan: ";
|
|
379
|
-
var GATE_OPENING_MARK = " checks at once";
|
|
380
|
-
function is_gate_opening(line2) {
|
|
381
|
-
const trimmed = line2.trimStart();
|
|
382
|
-
return trimmed.startsWith(GATE_OPENING_PREFIX) && trimmed.includes(GATE_OPENING_MARK);
|
|
383
|
-
}
|
|
384
|
-
function read_verdict(line2) {
|
|
385
|
-
const trimmed = line2.trimStart();
|
|
386
|
-
if (trimmed.startsWith(GATE_FAILED_PREFIX)) return FAILED_VERDICT;
|
|
387
|
-
if (trimmed.startsWith(GATE_PASSED_PREFIX)) return PASSED_VERDICT;
|
|
388
|
-
if (trimmed.startsWith(GATE_UNVERIFIED_PREFIX)) return UNVERIFIED_VERDICT;
|
|
389
|
-
return void 0;
|
|
390
|
-
}
|
|
391
|
-
var josh_verdict = {
|
|
392
|
-
PASSED_VERDICT,
|
|
393
|
-
FAILED_VERDICT,
|
|
394
|
-
UNVERIFIED_VERDICT,
|
|
395
|
-
format_gate_passed,
|
|
396
|
-
format_gate_failed,
|
|
397
|
-
format_gate_unverified,
|
|
398
|
-
GATE_OPENING_MARK,
|
|
399
|
-
GATE_OPENING_PREFIX,
|
|
400
|
-
is_gate_opening,
|
|
401
|
-
read_verdict
|
|
402
|
-
};
|
|
403
|
-
|
|
404
|
-
// scripts/time-runtime/time-reported-failure.ts
|
|
405
|
-
var TEXT_BLOCK_SCHEMA = external_exports.object({ text: external_exports.string().nullish() });
|
|
406
|
-
var CONTENT_SCHEMA = external_exports.union([external_exports.string(), external_exports.array(external_exports.unknown())]);
|
|
407
|
-
var LINE_SEPARATOR = "\n";
|
|
408
|
-
function block_text(block) {
|
|
409
|
-
const parsed = TEXT_BLOCK_SCHEMA.safeParse(block);
|
|
410
|
-
return parsed.success ? parsed.data.text ?? "" : "";
|
|
411
|
-
}
|
|
412
|
-
function result_text(content) {
|
|
413
|
-
const parsed = CONTENT_SCHEMA.safeParse(content);
|
|
414
|
-
if (!parsed.success) return "";
|
|
415
|
-
if (typeof parsed.data === "string") return parsed.data;
|
|
416
|
-
return parsed.data.map((block) => block_text(block)).join(LINE_SEPARATOR);
|
|
417
|
-
}
|
|
418
|
-
function is_failure_line(line2) {
|
|
419
|
-
return line2.trimStart().startsWith(status_icons.FAIL_ICON);
|
|
420
|
-
}
|
|
421
|
-
function is_failed_verdict(line2) {
|
|
422
|
-
return josh_verdict.read_verdict(line2) === josh_verdict.FAILED_VERDICT;
|
|
423
|
-
}
|
|
424
|
-
var GREEN_VERDICTS = /* @__PURE__ */ new Set([
|
|
425
|
-
josh_verdict.PASSED_VERDICT,
|
|
426
|
-
josh_verdict.UNVERIFIED_VERDICT
|
|
427
|
-
]);
|
|
428
|
-
function is_green_verdict(line2) {
|
|
429
|
-
return GREEN_VERDICTS.has(josh_verdict.read_verdict(line2));
|
|
430
|
-
}
|
|
431
|
-
function new_scan() {
|
|
432
|
-
return {
|
|
433
|
-
did_find: false,
|
|
434
|
-
has_failure_before_region: false,
|
|
435
|
-
has_failure_in_region: false,
|
|
436
|
-
is_region_open: false
|
|
437
|
-
};
|
|
438
|
-
}
|
|
439
|
-
function close_region(scan) {
|
|
440
|
-
scan.did_find ||= scan.is_region_open && scan.has_failure_before_region;
|
|
441
|
-
scan.has_failure_before_region = false;
|
|
442
|
-
scan.has_failure_in_region = false;
|
|
443
|
-
scan.is_region_open = false;
|
|
444
|
-
}
|
|
445
|
-
function note_failure(scan) {
|
|
446
|
-
if (scan.is_region_open) {
|
|
447
|
-
scan.has_failure_in_region = true;
|
|
448
|
-
return;
|
|
449
|
-
}
|
|
450
|
-
scan.has_failure_before_region = true;
|
|
451
|
-
}
|
|
452
|
-
function scan_line(scan, line2) {
|
|
453
|
-
if (is_green_verdict(line2)) {
|
|
454
|
-
close_region(scan);
|
|
455
|
-
return;
|
|
456
|
-
}
|
|
457
|
-
if (is_failure_line(line2)) {
|
|
458
|
-
note_failure(scan);
|
|
459
|
-
return;
|
|
460
|
-
}
|
|
461
|
-
if (josh_verdict.is_gate_opening(line2)) scan.is_region_open = true;
|
|
462
|
-
}
|
|
463
|
-
function scan_body(lines) {
|
|
464
|
-
const scan = new_scan();
|
|
465
|
-
for (const line2 of lines) scan_line(scan, line2);
|
|
466
|
-
return scan;
|
|
467
|
-
}
|
|
468
|
-
function did_scan_find(scan) {
|
|
469
|
-
return scan.did_find || scan.has_failure_before_region || scan.has_failure_in_region;
|
|
470
|
-
}
|
|
471
|
-
function has_failure_line(content) {
|
|
472
|
-
const lines = result_text(content).split(LINE_SEPARATOR);
|
|
473
|
-
if (lines.some((line2) => is_failed_verdict(line2))) return true;
|
|
474
|
-
return did_scan_find(scan_body(lines));
|
|
475
|
-
}
|
|
476
|
-
function is_reported_failure(josh_command, did_print_failure) {
|
|
477
|
-
return josh_command !== "" && did_print_failure;
|
|
478
|
-
}
|
|
479
|
-
var time_reported_failure = { result_text, has_failure_line, is_reported_failure };
|
|
480
|
-
|
|
481
|
-
// scripts/time-runtime/time-phase-names.ts
|
|
482
|
-
var GATE_PHASE = "gate";
|
|
483
|
-
var PR_PHASE = "pr";
|
|
484
|
-
var MERGE_PHASE = "merge";
|
|
485
|
-
var GATE_COMMAND2 = "josh gate";
|
|
486
|
-
var COMMAND_PHASES = /* @__PURE__ */ new Map([
|
|
487
|
-
[GATE_COMMAND2, GATE_PHASE],
|
|
488
|
-
["josh git", PR_PHASE],
|
|
489
|
-
["josh pr", PR_PHASE],
|
|
490
|
-
["josh followup", MERGE_PHASE]
|
|
491
|
-
]);
|
|
492
|
-
|
|
493
|
-
// scripts/time-runtime/time-background.ts
|
|
494
|
-
var NO_BACKGROUND = "";
|
|
495
|
-
var NO_FINISH = 0;
|
|
496
|
-
var LAUNCH_PATTERN = /(?:running in background with ID:|moved to the background \(ID:)\s*([\w-]+)/iu;
|
|
497
|
-
var AGENT_LAUNCH_PATTERN = /^(?:Async agent launched[\s\S]*?\bagentId:\s*|\{"success":[^\n]*?"resumedAgentId":")([\w-]+)/u;
|
|
498
|
-
var FINISH_PATTERN = /^<task-notification>[\s\S]*?<task-id>([\w-]+)<\/task-id>/u;
|
|
499
|
-
var STOP_PATTERN = /^\{"message":"Successfully stopped task:\s*([\w-]+)/u;
|
|
500
|
-
var OUTPUT_PATTERN = /tasks\/([\w-]+)\.output/u;
|
|
501
|
-
var BASH_ID_KEY = "bash_id";
|
|
502
|
-
function read_id(command) {
|
|
503
|
-
return OUTPUT_PATTERN.exec(time_shell.unquoted(command))?.[1] ?? NO_BACKGROUND;
|
|
504
|
-
}
|
|
505
|
-
function read_id_of(input) {
|
|
506
|
-
if (!json_value.is_record(input)) return NO_BACKGROUND;
|
|
507
|
-
const id = input[BASH_ID_KEY];
|
|
508
|
-
return typeof id === "string" ? id : read_id(time_shell.bash_command(input));
|
|
509
|
-
}
|
|
510
|
-
function launch_id(text2) {
|
|
511
|
-
return LAUNCH_PATTERN.exec(text2)?.[1] ?? NO_BACKGROUND;
|
|
512
|
-
}
|
|
513
|
-
function agent_launch_id(text2) {
|
|
514
|
-
return AGENT_LAUNCH_PATTERN.exec(text2)?.[1] ?? NO_BACKGROUND;
|
|
515
|
-
}
|
|
516
|
-
function finished_id(text2) {
|
|
517
|
-
return FINISH_PATTERN.exec(text2)?.[1] ?? NO_BACKGROUND;
|
|
518
|
-
}
|
|
519
|
-
function stopped_id(text2) {
|
|
520
|
-
return STOP_PATTERN.exec(text2)?.[1] ?? NO_BACKGROUND;
|
|
521
|
-
}
|
|
522
|
-
function finished_at(lines) {
|
|
523
|
-
const notices = lines.filter((one) => one.finished_background !== NO_BACKGROUND).toSorted((left, right) => right.timestamp_ms - left.timestamp_ms);
|
|
524
|
-
return new Map(notices.map((one) => [one.finished_background, one.timestamp_ms]));
|
|
525
|
-
}
|
|
526
|
-
function started_ms(span) {
|
|
527
|
-
return span.ended_ms - span.duration_ms;
|
|
528
|
-
}
|
|
529
|
-
function read_end_ms(spans, run) {
|
|
530
|
-
if (run.background_ended_ms === NO_FINISH) return void 0;
|
|
531
|
-
const found = spans.find(
|
|
532
|
-
(span) => span.reads_background === run.background_id && span.ended_ms >= run.background_ended_ms
|
|
533
|
-
);
|
|
534
|
-
return found?.ended_ms;
|
|
535
|
-
}
|
|
536
|
-
function to_run(spans, launch) {
|
|
537
|
-
const read = read_end_ms(spans, launch);
|
|
538
|
-
return {
|
|
539
|
-
id: launch.background_id,
|
|
540
|
-
josh_command: launch.josh_command,
|
|
541
|
-
started_ms: started_ms(launch),
|
|
542
|
-
ended_ms: read ?? launch.ended_ms,
|
|
543
|
-
is_read: read !== void 0
|
|
544
|
-
};
|
|
545
|
-
}
|
|
546
|
-
function is_launch(span) {
|
|
547
|
-
return span.background_id !== NO_BACKGROUND;
|
|
548
|
-
}
|
|
549
|
-
function runs(spans) {
|
|
550
|
-
return spans.filter((span) => is_launch(span)).map((launch) => to_run(spans, launch));
|
|
551
|
-
}
|
|
552
|
-
function is_within(span, run) {
|
|
553
|
-
const start = started_ms(span);
|
|
554
|
-
return start >= run.started_ms && start < run.ended_ms;
|
|
555
|
-
}
|
|
556
|
-
function latest_first(all2) {
|
|
557
|
-
return all2.filter((run) => run.is_read).toSorted((left, right) => right.started_ms - left.started_ms);
|
|
558
|
-
}
|
|
559
|
-
function own_run(span, all2) {
|
|
560
|
-
return is_launch(span) ? all2.find((run) => run.id === span.background_id) : void 0;
|
|
561
|
-
}
|
|
562
|
-
function placed(span, all2, ordered) {
|
|
563
|
-
const own = own_run(span, all2);
|
|
564
|
-
const run = own ?? ordered.find((one) => is_within(span, one));
|
|
565
|
-
if (run === void 0) return span;
|
|
566
|
-
const beside = { ...span, background_command: run.josh_command };
|
|
567
|
-
return own === void 0 ? beside : { ...beside, own_duration_ms: own.ended_ms - own.started_ms };
|
|
568
|
-
}
|
|
569
|
-
function positioned(spans) {
|
|
570
|
-
const all2 = runs(spans);
|
|
571
|
-
if (all2.length === 0) return [...spans];
|
|
572
|
-
const ordered = latest_first(all2);
|
|
573
|
-
return spans.map((span) => placed(span, all2, ordered));
|
|
574
|
-
}
|
|
575
|
-
function unread_phases(spans) {
|
|
576
|
-
const names = runs(spans).filter((run) => !run.is_read).map((run) => COMMAND_PHASES.get(run.josh_command));
|
|
577
|
-
return new Set(names.filter((phase) => phase !== void 0));
|
|
578
|
-
}
|
|
579
|
-
var time_background = {
|
|
580
|
-
NO_BACKGROUND,
|
|
581
|
-
NO_FINISH,
|
|
582
|
-
launch_id,
|
|
583
|
-
agent_launch_id,
|
|
584
|
-
finished_id,
|
|
585
|
-
stopped_id,
|
|
586
|
-
finished_at,
|
|
587
|
-
read_id,
|
|
588
|
-
read_id_of,
|
|
589
|
-
runs,
|
|
590
|
-
positioned,
|
|
591
|
-
unread_phases
|
|
592
|
-
};
|
|
593
|
-
|
|
594
|
-
// scripts/gh/git-pr-checks-parse.ts
|
|
595
|
-
var CHECK_STATUS_PASS = "pass";
|
|
596
|
-
var CHECK_STATUS_PENDING = "pending";
|
|
597
|
-
var CHECK_STATUS_FAIL = "fail";
|
|
598
|
-
var CHECK_STATUS_MISSING = "missing";
|
|
599
|
-
var PASSING_CONCLUSIONS = /* @__PURE__ */ new Set(["success", "skipped", "neutral"]);
|
|
600
|
-
var KEY_TYPE_NAME = "__typename";
|
|
601
|
-
var KEY_STATE = "state";
|
|
602
|
-
var KEY_STATUS = "status";
|
|
603
|
-
var KEY_CONCLUSION = "conclusion";
|
|
604
|
-
var KEY_NAME = "name";
|
|
605
|
-
var KEY_CONTEXT = "context";
|
|
606
|
-
var KEY_DESCRIPTION = "description";
|
|
607
|
-
function read_string(value2) {
|
|
608
|
-
if (typeof value2 !== "string") return void 0;
|
|
609
|
-
const trimmed = value2.trim();
|
|
610
|
-
if (trimmed.length === 0) return void 0;
|
|
611
|
-
return trimmed;
|
|
612
|
-
}
|
|
613
|
-
var PENDING_STATUS_STATES = /* @__PURE__ */ new Set(["pending", "expected"]);
|
|
614
|
-
function parse_status_context(item) {
|
|
615
|
-
const state = read_string(item[KEY_STATE])?.toLowerCase();
|
|
616
|
-
if (state === "success") return CHECK_STATUS_PASS;
|
|
617
|
-
if (state !== void 0 && PENDING_STATUS_STATES.has(state)) return CHECK_STATUS_PENDING;
|
|
618
|
-
return CHECK_STATUS_FAIL;
|
|
619
|
-
}
|
|
620
|
-
function is_passing_conclusion(item) {
|
|
621
|
-
const conclusion = read_string(item[KEY_CONCLUSION])?.toLowerCase();
|
|
622
|
-
return conclusion !== void 0 && PASSING_CONCLUSIONS.has(conclusion);
|
|
623
|
-
}
|
|
624
|
-
function parse_check_run(item) {
|
|
625
|
-
const status = read_string(item[KEY_STATUS])?.toLowerCase();
|
|
626
|
-
if (status !== "completed") return CHECK_STATUS_PENDING;
|
|
627
|
-
return is_passing_conclusion(item) ? CHECK_STATUS_PASS : CHECK_STATUS_FAIL;
|
|
628
|
-
}
|
|
629
|
-
function parse_rollup_status(item) {
|
|
630
|
-
const type_name = read_string(item[KEY_TYPE_NAME]);
|
|
631
|
-
if (type_name === "StatusContext") return parse_status_context(item);
|
|
632
|
-
return parse_check_run(item);
|
|
633
|
-
}
|
|
634
|
-
function read_rollup_array(parsed) {
|
|
635
|
-
const result = pr_raw_schema.safeParse(parsed);
|
|
636
|
-
if (!result.success) return [];
|
|
637
|
-
return result.data.statusCheckRollup ?? [];
|
|
638
|
-
}
|
|
639
|
-
function parse_rollup_item(item) {
|
|
640
|
-
const name = read_string(item[KEY_NAME]) ?? read_string(item[KEY_CONTEXT]);
|
|
641
|
-
if (name === void 0) return void 0;
|
|
642
|
-
const check = { name, status: parse_rollup_status(item) };
|
|
643
|
-
const description = read_string(item[KEY_DESCRIPTION]);
|
|
644
|
-
return description === void 0 ? check : { ...check, description };
|
|
645
|
-
}
|
|
646
|
-
function parse_rollup_checks(raw_json) {
|
|
647
|
-
const parsed = json_value.parse_or_undefined(raw_json);
|
|
648
|
-
const rollup = read_rollup_array(parsed);
|
|
649
|
-
const checks = [];
|
|
650
|
-
for (const item of rollup) {
|
|
651
|
-
const parsed_item = parse_rollup_item(item);
|
|
652
|
-
if (parsed_item !== void 0) checks.push(parsed_item);
|
|
653
|
-
}
|
|
654
|
-
return checks;
|
|
655
|
-
}
|
|
656
|
-
function with_head_sha(snapshot, head_sha) {
|
|
657
|
-
return head_sha === void 0 ? snapshot : { ...snapshot, head_sha };
|
|
658
|
-
}
|
|
659
|
-
function with_required_contexts(snapshot, required_contexts) {
|
|
660
|
-
if (required_contexts === void 0 || required_contexts.length === 0) return snapshot;
|
|
661
|
-
return { ...snapshot, required_contexts };
|
|
662
|
-
}
|
|
663
|
-
function read_pr_raw_data(raw_json) {
|
|
664
|
-
const result = pr_raw_schema.safeParse(json_value.parse_or_undefined(raw_json));
|
|
665
|
-
return result.success ? result.data : {};
|
|
666
|
-
}
|
|
667
|
-
function parse_pr_state_snapshot(raw_json) {
|
|
668
|
-
const data = read_pr_raw_data(raw_json);
|
|
669
|
-
const snapshot = {
|
|
670
|
-
rollup: parse_rollup_checks(raw_json),
|
|
671
|
-
merge_state_status: read_string(data.mergeStateStatus),
|
|
672
|
-
review_decision: read_string(data.reviewDecision),
|
|
673
|
-
...data.merged === true && { is_merged: true }
|
|
674
|
-
};
|
|
675
|
-
return with_required_contexts(
|
|
676
|
-
with_head_sha(snapshot, read_string(data.headRefOid)),
|
|
677
|
-
data.requiredContexts
|
|
678
|
-
);
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
// scripts/gh/git-pr-checks-missing.ts
|
|
682
|
-
var MISSING_GRACE_MS = 12e4;
|
|
683
|
-
var CHECK_SUITE_SEPARATOR = " / ";
|
|
684
|
-
var MERGE_STATE_CLEAN = "CLEAN";
|
|
685
|
-
function is_required_match(check_name, required_name) {
|
|
686
|
-
if (check_name === required_name) return true;
|
|
687
|
-
return check_name.startsWith(`${required_name}${CHECK_SUITE_SEPARATOR}`);
|
|
688
|
-
}
|
|
689
|
-
function is_settled(rollup) {
|
|
690
|
-
return rollup.length > 0 && rollup.every((check) => check.status !== CHECK_STATUS_PENDING);
|
|
691
|
-
}
|
|
692
|
-
var first_absent_at = /* @__PURE__ */ new Map();
|
|
693
|
-
function absence_key(snapshot, context) {
|
|
694
|
-
return `${snapshot.head_sha ?? ""} ${context}`;
|
|
695
|
-
}
|
|
696
|
-
function has_outlasted_grace(key2, now) {
|
|
697
|
-
const first = first_absent_at.get(key2);
|
|
698
|
-
if (first !== void 0) return now - first >= MISSING_GRACE_MS;
|
|
699
|
-
first_absent_at.set(key2, now);
|
|
700
|
-
return false;
|
|
701
|
-
}
|
|
702
|
-
function absent_from(rollup, required) {
|
|
703
|
-
return required.filter(
|
|
704
|
-
(context) => rollup.every((check) => !is_required_match(check.name, context))
|
|
705
|
-
);
|
|
706
|
-
}
|
|
707
|
-
function collect_absent_contexts(snapshot) {
|
|
708
|
-
if (snapshot.merge_state_status === MERGE_STATE_CLEAN || !is_settled(snapshot.rollup)) return [];
|
|
709
|
-
return absent_from(snapshot.rollup, snapshot.required_contexts ?? []);
|
|
710
|
-
}
|
|
711
|
-
function forget_present_contexts(snapshot, absent) {
|
|
712
|
-
const present = (snapshot.required_contexts ?? []).filter((context) => !absent.includes(context));
|
|
713
|
-
for (const context of present) first_absent_at.delete(absence_key(snapshot, context));
|
|
714
|
-
}
|
|
715
|
-
function collect_missing_contexts(snapshot) {
|
|
716
|
-
const absent = collect_absent_contexts(snapshot);
|
|
717
|
-
forget_present_contexts(snapshot, absent);
|
|
718
|
-
const now = Date.now();
|
|
719
|
-
return absent.filter((context) => has_outlasted_grace(absence_key(snapshot, context), now));
|
|
720
|
-
}
|
|
721
|
-
function describe_missing_context(context) {
|
|
722
|
-
return `required context ${context} has no check-run`;
|
|
723
|
-
}
|
|
724
|
-
var MissingContextError = class extends Error {
|
|
725
|
-
name = "MissingContextError";
|
|
726
|
-
missing;
|
|
727
|
-
constructor(message, options) {
|
|
728
|
-
super(message, options);
|
|
729
|
-
this.missing = options.missing;
|
|
730
|
-
}
|
|
731
|
-
};
|
|
732
|
-
function missing_context_error(message, snapshot) {
|
|
733
|
-
const contexts = collect_missing_contexts(snapshot);
|
|
734
|
-
if (contexts.length === 0 || snapshot.head_sha === void 0) return void 0;
|
|
735
|
-
return new MissingContextError(message, { missing: { contexts, head_sha: snapshot.head_sha } });
|
|
736
|
-
}
|
|
737
|
-
var BLOCKED_LEAD = "BLOCKED: ";
|
|
738
|
-
var MERGE_STATE_LEAD = "mergeStateStatus: ";
|
|
739
|
-
function absent_required(snapshot, required_checks) {
|
|
740
|
-
const required = [.../* @__PURE__ */ new Set([...required_checks, ...snapshot.required_contexts ?? []])];
|
|
741
|
-
return absent_from(snapshot.rollup, required);
|
|
742
|
-
}
|
|
743
|
-
function blocked_cause(snapshot, required_checks) {
|
|
744
|
-
const absent = absent_required(snapshot, required_checks);
|
|
745
|
-
if (absent.length > 0) return `${BLOCKED_LEAD}${absent.join(", ")} missing`;
|
|
746
|
-
if (snapshot.merge_state_status === void 0) return void 0;
|
|
747
|
-
return `${MERGE_STATE_LEAD}${snapshot.merge_state_status}`;
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
// scripts/gh/git-pr-checks-eval.ts
|
|
751
|
-
var DEFAULT_REQUIRED_CHECKS = ["SonarQube"];
|
|
752
|
-
var CODERABBIT_CHECK_NAME = "CodeRabbit";
|
|
753
|
-
var REQUIRED_CHECKS_ENV_VAR = "JOSH_REQUIRED_CHECKS";
|
|
754
|
-
function parse_required_checks() {
|
|
755
|
-
const raw = process.env[REQUIRED_CHECKS_ENV_VAR];
|
|
756
|
-
if (!raw) return DEFAULT_REQUIRED_CHECKS;
|
|
757
|
-
return raw.split(",").map((check) => check.trim()).filter((check) => check.length > 0);
|
|
758
|
-
}
|
|
759
|
-
var REQUIRED_CHECKS = parse_required_checks();
|
|
760
|
-
var MERGE_STATE_CLEAN2 = "CLEAN";
|
|
761
|
-
var MERGE_STATE_UNSTABLE = "UNSTABLE";
|
|
762
|
-
var MERGE_STATE_DIRTY = "DIRTY";
|
|
763
|
-
var REVIEW_CHANGES_REQUESTED = "CHANGES_REQUESTED";
|
|
764
|
-
var FAILURE_MESSAGE_PREFIX = "PR checks failed";
|
|
765
|
-
var FAILURE_REASON_REVIEW = "review requested changes";
|
|
766
|
-
var FAILURE_REASON_CHECKS = "failed checks";
|
|
767
|
-
var FAILURE_REASON_CONFLICT = "merge conflict";
|
|
768
|
-
function find_required_check(checks, required_name) {
|
|
769
|
-
return checks.find((check) => is_required_match(check.name, required_name));
|
|
770
|
-
}
|
|
771
|
-
function read_required_statuses(checks) {
|
|
772
|
-
return REQUIRED_CHECKS.map(
|
|
773
|
-
(name) => find_required_check(checks, name)?.status ?? CHECK_STATUS_MISSING
|
|
774
|
-
);
|
|
775
|
-
}
|
|
776
|
-
function is_review_blocked(review_decision) {
|
|
777
|
-
return review_decision === REVIEW_CHANGES_REQUESTED;
|
|
778
|
-
}
|
|
779
|
-
function is_merge_conflict(merge_state_status) {
|
|
780
|
-
return merge_state_status === MERGE_STATE_DIRTY;
|
|
781
|
-
}
|
|
782
|
-
function evaluate_failure_state(input) {
|
|
783
|
-
if (is_merge_conflict(input.merge_state_status) || is_review_blocked(input.review_decision) || input.failed_checks.length > 0) {
|
|
784
|
-
return "failure";
|
|
785
|
-
}
|
|
786
|
-
return void 0;
|
|
787
|
-
}
|
|
788
|
-
function is_merge_state_clean(merge_state_status) {
|
|
789
|
-
return merge_state_status === MERGE_STATE_CLEAN2;
|
|
790
|
-
}
|
|
791
|
-
function is_every_required_passing(statuses) {
|
|
792
|
-
return statuses.every((status) => status === CHECK_STATUS_PASS);
|
|
793
|
-
}
|
|
794
|
-
function is_coderabbit_check(check_name) {
|
|
795
|
-
return is_required_match(check_name, CODERABBIT_CHECK_NAME);
|
|
796
|
-
}
|
|
797
|
-
var CODERABBIT_RATE_LIMIT_DESCRIPTION = /rate limit/iu;
|
|
798
|
-
function is_coderabbit_rate_limited(check) {
|
|
799
|
-
return is_coderabbit_check(check.name) && CODERABBIT_RATE_LIMIT_DESCRIPTION.test(check.description ?? "");
|
|
800
|
-
}
|
|
801
|
-
function matches_any(check_name, required_names) {
|
|
802
|
-
return required_names.some((required) => is_required_match(check_name, required));
|
|
803
|
-
}
|
|
804
|
-
function is_optional_pending(check, required_contexts) {
|
|
805
|
-
if (required_contexts.length === 0 || check.status !== CHECK_STATUS_PENDING) return false;
|
|
806
|
-
return !matches_any(check.name, required_contexts);
|
|
807
|
-
}
|
|
808
|
-
function is_every_context_passing(checks, contexts) {
|
|
809
|
-
return contexts.every(
|
|
810
|
-
(context) => find_required_check(checks, context)?.status === CHECK_STATUS_PASS
|
|
811
|
-
);
|
|
812
|
-
}
|
|
813
|
-
function is_unstable_only_from_optional(snapshot) {
|
|
814
|
-
if (snapshot.merge_state_status !== MERGE_STATE_UNSTABLE) return false;
|
|
815
|
-
const required_contexts = snapshot.required_contexts ?? [];
|
|
816
|
-
const non_passing = snapshot.rollup.filter((check) => check.status !== CHECK_STATUS_PASS);
|
|
817
|
-
if (non_passing.length === 0) return false;
|
|
818
|
-
const is_tolerated = non_passing.every(
|
|
819
|
-
(check) => is_coderabbit_check(check.name) || is_optional_pending(check, required_contexts)
|
|
820
|
-
);
|
|
821
|
-
return is_tolerated && is_every_context_passing(snapshot.rollup, required_contexts);
|
|
822
|
-
}
|
|
823
|
-
function is_required_check(check_name) {
|
|
824
|
-
return REQUIRED_CHECKS.some((required) => is_required_match(check_name, required));
|
|
825
|
-
}
|
|
826
|
-
function is_blocking_failure(check) {
|
|
827
|
-
if (check.status !== CHECK_STATUS_FAIL) return false;
|
|
828
|
-
return !is_coderabbit_check(check.name) || is_required_check(check.name);
|
|
829
|
-
}
|
|
830
|
-
function collect_blocking_failures(snapshot) {
|
|
831
|
-
return snapshot.rollup.filter((check) => is_blocking_failure(check)).map((check) => check.name);
|
|
832
|
-
}
|
|
833
|
-
function is_mergeable_state(snapshot) {
|
|
834
|
-
if (is_merge_state_clean(snapshot.merge_state_status)) return true;
|
|
835
|
-
return is_unstable_only_from_optional(snapshot);
|
|
836
|
-
}
|
|
837
|
-
function collect_failure_reasons(snapshot) {
|
|
838
|
-
const reasons = [];
|
|
839
|
-
if (is_merge_conflict(snapshot.merge_state_status)) reasons.push(FAILURE_REASON_CONFLICT);
|
|
840
|
-
if (is_review_blocked(snapshot.review_decision)) reasons.push(FAILURE_REASON_REVIEW);
|
|
841
|
-
const failed = collect_blocking_failures(snapshot);
|
|
842
|
-
if (failed.length > 0) reasons.push(`${FAILURE_REASON_CHECKS}: ${failed.join(", ")}`);
|
|
843
|
-
reasons.push(
|
|
844
|
-
...collect_missing_contexts(snapshot).map((context) => describe_missing_context(context))
|
|
845
|
-
);
|
|
846
|
-
return reasons;
|
|
847
|
-
}
|
|
848
|
-
function describe_pr_failure(snapshot) {
|
|
849
|
-
const reasons = collect_failure_reasons(snapshot);
|
|
850
|
-
if (reasons.length === 0) return `${FAILURE_MESSAGE_PREFIX}.`;
|
|
851
|
-
return `${FAILURE_MESSAGE_PREFIX} (${reasons.join("; ")}).`;
|
|
852
|
-
}
|
|
853
|
-
function evaluate_pr_state(snapshot) {
|
|
854
|
-
const statuses = read_required_statuses(snapshot.rollup);
|
|
855
|
-
const failure = evaluate_failure_state({
|
|
856
|
-
review_decision: snapshot.review_decision,
|
|
857
|
-
failed_checks: [...collect_blocking_failures(snapshot), ...collect_missing_contexts(snapshot)],
|
|
858
|
-
merge_state_status: snapshot.merge_state_status
|
|
859
|
-
});
|
|
860
|
-
if (failure !== void 0) return failure;
|
|
861
|
-
if (is_mergeable_state(snapshot) && is_every_required_passing(statuses)) return "success";
|
|
862
|
-
return "pending";
|
|
863
|
-
}
|
|
864
|
-
function is_review_decision_decisive(snapshot) {
|
|
865
|
-
return evaluate_pr_state(snapshot) !== "pending";
|
|
866
|
-
}
|
|
867
|
-
var PrConflictError = class extends Error {
|
|
868
|
-
name = "PrConflictError";
|
|
869
|
-
};
|
|
870
|
-
|
|
871
|
-
// scripts/time-runtime/time-format.ts
|
|
872
|
-
var SECOND_DECIMALS = 1;
|
|
873
|
-
var LABEL_WIDTH = 24;
|
|
874
|
-
var MINUTES_WIDTH = 9;
|
|
875
|
-
var NOT_MEASURED = "not measured";
|
|
876
|
-
var NO_CALLS = "no tool call to divide";
|
|
877
|
-
var MAX_ROWS = 15;
|
|
878
|
-
function overflow_line(row_count) {
|
|
879
|
-
if (row_count <= MAX_ROWS) return [];
|
|
880
|
-
return [
|
|
881
|
-
` \u2026 and ${String(row_count - MAX_ROWS)} more (--json carries every row this report holds)`
|
|
882
|
-
];
|
|
883
|
-
}
|
|
884
|
-
function format_seconds(duration_ms) {
|
|
885
|
-
return `${(duration_ms / MS_PER_SECOND).toFixed(SECOND_DECIMALS)} s`;
|
|
886
|
-
}
|
|
887
|
-
function format_columns(label, minutes, suffix) {
|
|
888
|
-
return ` ${label.padEnd(LABEL_WIDTH)}${minutes.padStart(MINUTES_WIDTH)} ${suffix}`;
|
|
889
|
-
}
|
|
890
|
-
function format_row(label, duration_ms, suffix) {
|
|
891
|
-
return format_columns(label, figure_format.format_minutes(duration_ms), suffix);
|
|
892
|
-
}
|
|
893
|
-
function unmeasured_row(label) {
|
|
894
|
-
return format_columns(label, "", NOT_MEASURED);
|
|
895
|
-
}
|
|
896
|
-
var time_format = {
|
|
897
|
-
MAX_ROWS,
|
|
898
|
-
NO_CALLS,
|
|
899
|
-
overflow_line,
|
|
900
|
-
format_seconds,
|
|
901
|
-
format_columns,
|
|
902
|
-
format_row,
|
|
903
|
-
// `format_clock` stays private: `format_window` is its only caller, and a namespace that offers
|
|
904
|
-
// both invites a second renderer to join the two with its own arrow.
|
|
905
|
-
unmeasured_row
|
|
906
|
-
};
|
|
907
|
-
|
|
908
|
-
// scripts/followup/followup-ci-path.ts
|
|
909
|
-
function new_path() {
|
|
910
|
-
return { pending: /* @__PURE__ */ new Set(), settled: /* @__PURE__ */ new Set(), check_ms: {} };
|
|
911
|
-
}
|
|
912
|
-
function settle(path6, name, elapsed_ms) {
|
|
913
|
-
if (path6.pending.delete(name)) path6.check_ms[name] = elapsed_ms;
|
|
914
|
-
path6.settled.add(name);
|
|
915
|
-
}
|
|
916
|
-
function hold(path6, name) {
|
|
917
|
-
if (path6.settled.has(name)) path6.has_rerun = true;
|
|
918
|
-
path6.pending.add(name);
|
|
919
|
-
}
|
|
920
|
-
function observe(path6, snapshot, now_ms) {
|
|
921
|
-
path6.start_ms ??= now_ms;
|
|
922
|
-
const elapsed_ms = now_ms - path6.start_ms;
|
|
923
|
-
const checks = snapshot.rollup.filter((check) => !is_coderabbit_check(check.name));
|
|
924
|
-
const pending = new Set(
|
|
925
|
-
checks.filter((check) => check.status === CHECK_STATUS_PENDING).map((check) => check.name)
|
|
926
|
-
);
|
|
927
|
-
for (const name of pending) hold(path6, name);
|
|
928
|
-
for (const check of checks) if (!pending.has(check.name)) settle(path6, check.name, elapsed_ms);
|
|
929
|
-
}
|
|
930
|
-
function observer_of(path6) {
|
|
931
|
-
const is_first_wait = path6.start_ms === void 0;
|
|
932
|
-
return async function time_checks(snapshot) {
|
|
933
|
-
if (is_first_wait) observe(path6, snapshot, performance.now());
|
|
934
|
-
};
|
|
935
|
-
}
|
|
936
|
-
function record_of(path6) {
|
|
937
|
-
const [last] = Object.entries(path6.check_ms).toSorted((left, right) => right[1] - left[1]);
|
|
938
|
-
if (last === void 0) return {};
|
|
939
|
-
return {
|
|
940
|
-
last_check: last[0],
|
|
941
|
-
check_ms: { ...path6.check_ms },
|
|
942
|
-
...path6.has_rerun && { has_rerun: path6.has_rerun }
|
|
943
|
-
};
|
|
944
|
-
}
|
|
945
|
-
var followup_ci_path = { new_path, observe, observer_of, record_of };
|
|
946
|
-
|
|
947
|
-
// scripts/run/event/run-event-checks.ts
|
|
948
|
-
var CODERABBIT_STATES = ["running", "done", "rate-limited", "failed", "none"];
|
|
949
|
-
var CHECKS_PATTERN = /^#\d+ PR (?<pr>\d+) pass (?<pass>\d+) pending (?<pending>\d+) fail (?<fail>\d+) coderabbit (?<coderabbit>\S+)$/u;
|
|
950
|
-
function text_of(issue, checks) {
|
|
951
|
-
const { pr, pass, pending, fail, coderabbit } = checks;
|
|
952
|
-
return `${issue_cite.plain_for("program", issue)} PR ${String(pr)} pass ${String(pass)} pending ${String(pending)} fail ${String(fail)} coderabbit ${coderabbit}`;
|
|
953
|
-
}
|
|
954
|
-
var STATE_NAMES = new Set(CODERABBIT_STATES);
|
|
955
|
-
function is_coderabbit_state(value2 = "") {
|
|
956
|
-
return STATE_NAMES.has(value2);
|
|
957
|
-
}
|
|
958
|
-
function checks_of(text2) {
|
|
959
|
-
const groups = CHECKS_PATTERN.exec(text2)?.groups;
|
|
960
|
-
const coderabbit = groups?.["coderabbit"];
|
|
961
|
-
if (groups === void 0 || !is_coderabbit_state(coderabbit)) return void 0;
|
|
962
|
-
return {
|
|
963
|
-
pr: Number(groups["pr"]),
|
|
964
|
-
pass: Number(groups["pass"]),
|
|
965
|
-
pending: Number(groups["pending"]),
|
|
966
|
-
fail: Number(groups["fail"]),
|
|
967
|
-
coderabbit
|
|
968
|
-
};
|
|
969
|
-
}
|
|
970
|
-
var run_event_checks = { checks_of, text_of };
|
|
971
|
-
|
|
972
|
-
// scripts/followup/followup-checks-event.ts
|
|
973
|
-
var PR_NUMBER_PATTERN = /\/pull\/(?<number>\d+)/u;
|
|
974
|
-
var { PR_CHECKS } = run_event_stream.EVENT_KIND;
|
|
975
|
-
function count_of(checks, status) {
|
|
976
|
-
return checks.filter((check) => check.status === status).length;
|
|
977
|
-
}
|
|
978
|
-
function coderabbit_state_of(check) {
|
|
979
|
-
if (check === void 0) return "none";
|
|
980
|
-
if (check.status === CHECK_STATUS_PENDING) return "running";
|
|
981
|
-
if (check.status !== CHECK_STATUS_PASS) return "failed";
|
|
982
|
-
return is_coderabbit_rate_limited(check) ? "rate-limited" : "done";
|
|
983
|
-
}
|
|
984
|
-
function coderabbit_of(snapshot) {
|
|
985
|
-
return coderabbit_state_of(snapshot.rollup.find((check) => is_coderabbit_check(check.name)));
|
|
986
|
-
}
|
|
987
|
-
function summary_of(snapshot, pr) {
|
|
988
|
-
const ci = snapshot.rollup.filter((check) => !is_coderabbit_check(check.name));
|
|
989
|
-
return {
|
|
990
|
-
pr,
|
|
991
|
-
pass: count_of(ci, CHECK_STATUS_PASS),
|
|
992
|
-
pending: count_of(ci, CHECK_STATUS_PENDING),
|
|
993
|
-
fail: count_of(ci, CHECK_STATUS_FAIL),
|
|
994
|
-
coderabbit: coderabbit_of(snapshot)
|
|
995
|
-
};
|
|
996
|
-
}
|
|
997
|
-
function pr_number_of(pr_url = "") {
|
|
998
|
-
const number = PR_NUMBER_PATTERN.exec(pr_url)?.groups?.["number"];
|
|
999
|
-
return number === void 0 ? void 0 : Number(number);
|
|
1000
|
-
}
|
|
1001
|
-
async function skip_snapshot() {
|
|
1002
|
-
}
|
|
1003
|
-
function observer_of2(issue, pr_url) {
|
|
1004
|
-
const pr = pr_number_of(pr_url);
|
|
1005
|
-
if (issue === void 0 || pr === void 0) return skip_snapshot;
|
|
1006
|
-
let last_text = "";
|
|
1007
|
-
return async function report_snapshot(snapshot) {
|
|
1008
|
-
const text2 = run_event_checks.text_of(issue, summary_of(snapshot, pr));
|
|
1009
|
-
if (text2 === last_text) return;
|
|
1010
|
-
last_text = text2;
|
|
1011
|
-
await run_event_stream_emit.emit(PR_CHECKS, text2);
|
|
1012
|
-
};
|
|
1013
|
-
}
|
|
1014
|
-
var followup_checks_event = { coderabbit_of, observer_of: observer_of2, summary_of };
|
|
1015
|
-
|
|
1016
|
-
// scripts/followup/followup-coderabbit-wait.ts
|
|
1017
|
-
var NO_TIME = 0;
|
|
1018
|
-
var RATE_LIMITED = "rate-limited";
|
|
1019
|
-
var WAITING_STATES = /* @__PURE__ */ new Set(["running", RATE_LIMITED]);
|
|
1020
|
-
function new_wait() {
|
|
1021
|
-
return { wait_ms: NO_TIME, rate_limited_ms: NO_TIME };
|
|
1022
|
-
}
|
|
1023
|
-
function charge(wait, last, now_ms) {
|
|
1024
|
-
const elapsed_ms = now_ms - last.at_ms;
|
|
1025
|
-
if (WAITING_STATES.has(last.state)) wait.wait_ms += elapsed_ms;
|
|
1026
|
-
if (last.state === RATE_LIMITED) wait.rate_limited_ms += elapsed_ms;
|
|
1027
|
-
}
|
|
1028
|
-
function observe2(wait, snapshot, now_ms) {
|
|
1029
|
-
if (wait.last !== void 0) charge(wait, wait.last, now_ms);
|
|
1030
|
-
wait.last = { state: followup_checks_event.coderabbit_of(snapshot), at_ms: now_ms };
|
|
1031
|
-
}
|
|
1032
|
-
function observer_of3(wait) {
|
|
1033
|
-
delete wait.last;
|
|
1034
|
-
return async function time_snapshot(snapshot) {
|
|
1035
|
-
observe2(wait, snapshot, performance.now());
|
|
1036
|
-
};
|
|
1037
|
-
}
|
|
1038
|
-
function all(...observers) {
|
|
1039
|
-
return async function observe_all(snapshot) {
|
|
1040
|
-
await Promise.all(
|
|
1041
|
-
observers.map(async (observer) => {
|
|
1042
|
-
await observer(snapshot);
|
|
1043
|
-
})
|
|
1044
|
-
);
|
|
1045
|
-
};
|
|
1046
|
-
}
|
|
1047
|
-
async function record_part(stage, elapsed_ms) {
|
|
1048
|
-
if (elapsed_ms > NO_TIME) await lane_ledger_write.record_stage({ stage, elapsed_ms });
|
|
1049
|
-
}
|
|
1050
|
-
async function record(wait) {
|
|
1051
|
-
await record_part(lane_ledger_write.CODERABBIT_WAIT_STAGE, wait.wait_ms);
|
|
1052
|
-
await record_part(lane_ledger_write.CODERABBIT_RATE_LIMIT_STAGE, wait.rate_limited_ms);
|
|
1053
|
-
}
|
|
1054
|
-
var followup_coderabbit_wait = { all, new_wait, observe: observe2, observer_of: observer_of3, record };
|
|
1055
|
-
|
|
1056
|
-
// scripts/followup/git-followup-stages.ts
|
|
1057
|
-
var STAGE_LINE_PREFIX = "followup stage: ";
|
|
1058
|
-
var STAGE_TOTAL_PREFIX = "followup stages total: ";
|
|
1059
|
-
var STAGE_NAME_WIDTH = 26;
|
|
1060
|
-
var VALUE_COLUMN = STAGE_LINE_PREFIX.length + STAGE_NAME_WIDTH;
|
|
1061
|
-
var NO_DURATION = 0;
|
|
1062
|
-
var STAGE = {
|
|
1063
|
-
closes_and_context: "closes-and-context",
|
|
1064
|
-
checks_wait: "checks-wait",
|
|
1065
|
-
// Only on a run that retriggered a rate-limited CodeRabbit: the window and the review after it
|
|
1066
|
-
// (joshuafolkken/kit#5289), kept out of `checks-wait` so the `ci-wait` row is the checks alone.
|
|
1067
|
-
coderabbit_retrigger: "coderabbit-retrigger",
|
|
1068
|
-
coderabbit_comments: "coderabbit-comments",
|
|
1069
|
-
ai_review_comments: "ai-review-comments",
|
|
1070
|
-
// The interval of a run that merged nothing, where the send has nothing to go beside.
|
|
1071
|
-
telegram: "telegram",
|
|
1072
|
-
telegram_and_merge: "telegram-and-merge",
|
|
1073
|
-
completion_and_epic_close: "completion-and-epic-close",
|
|
1074
|
-
// The completion tail `git-followup-finish.ts` prints after this block (#5131): the next-issue list
|
|
1075
|
-
// and the unreleased-merge count. Printed as its own row there, since the block is already out.
|
|
1076
|
-
completion: "completion",
|
|
1077
|
-
// The lap that was still running when a stage threw. `followup` exits non-zero on an AI-review
|
|
1078
|
-
// blocker and on a red check, and those are the runs whose wait is longest — reporting nothing for
|
|
1079
|
-
// them would leave the measurement blind to exactly the invocations worth measuring.
|
|
1080
|
-
interrupted: "interrupted",
|
|
1081
|
-
// The interrupted lap when the wait failed on a merge conflict, so the
|
|
1082
|
-
// stage block names the cause a resumed session would otherwise look up with `gh pr view`.
|
|
1083
|
-
conflict: "conflict"
|
|
1084
|
-
};
|
|
1085
|
-
function stopped_lap(error) {
|
|
1086
|
-
return error instanceof PrConflictError ? STAGE.conflict : STAGE.interrupted;
|
|
1087
|
-
}
|
|
1088
|
-
function new_log() {
|
|
1089
|
-
return {
|
|
1090
|
-
stages: [],
|
|
1091
|
-
last_ms: performance.now(),
|
|
1092
|
-
coderabbit: followup_coderabbit_wait.new_wait(),
|
|
1093
|
-
ci_path: followup_ci_path.new_path(),
|
|
1094
|
-
reran: []
|
|
1095
|
-
};
|
|
1096
|
-
}
|
|
1097
|
-
function hold_issue(log, issue_number) {
|
|
1098
|
-
const issue = Number(issue_number);
|
|
1099
|
-
if (Number.isSafeInteger(issue) && issue > 0) log.issue = issue;
|
|
1100
|
-
}
|
|
1101
|
-
function lap(log, name) {
|
|
1102
|
-
const now_ms = performance.now();
|
|
1103
|
-
log.stages.push({ name, duration_ms: now_ms - log.last_ms });
|
|
1104
|
-
log.last_ms = now_ms;
|
|
1105
|
-
}
|
|
1106
|
-
function total_ms(stages) {
|
|
1107
|
-
return stages.reduce((sum, stage) => sum + stage.duration_ms, NO_DURATION);
|
|
1108
|
-
}
|
|
1109
|
-
function format_stage(stage) {
|
|
1110
|
-
const name = stage.name.padEnd(STAGE_NAME_WIDTH);
|
|
1111
|
-
return `${STAGE_LINE_PREFIX}${name}${time_format.format_seconds(stage.duration_ms)}`;
|
|
1112
|
-
}
|
|
1113
|
-
function format_stages(log) {
|
|
1114
|
-
if (log.stages.length === 0) return [];
|
|
1115
|
-
const rows = log.stages.map((stage) => format_stage(stage));
|
|
1116
|
-
const total = time_format.format_seconds(total_ms(log.stages));
|
|
1117
|
-
return ["", ...rows, `${STAGE_TOTAL_PREFIX.padEnd(VALUE_COLUMN)}${total}`];
|
|
1118
|
-
}
|
|
1119
|
-
function print_stages(log) {
|
|
1120
|
-
for (const line2 of format_stages(log)) console.info(line2);
|
|
1121
|
-
}
|
|
1122
|
-
async function record_ci_wait(log) {
|
|
1123
|
-
const wait = log.stages.find((stage) => stage.name === STAGE.checks_wait);
|
|
1124
|
-
if (wait === void 0) return;
|
|
1125
|
-
await lane_ledger_write.record_stage({
|
|
1126
|
-
stage: lane_ledger_write.CI_WAIT_STAGE,
|
|
1127
|
-
elapsed_ms: wait.duration_ms,
|
|
1128
|
-
...log.issue !== void 0 && { issue: log.issue },
|
|
1129
|
-
...followup_ci_path.record_of(log.ci_path)
|
|
1130
|
-
});
|
|
1131
|
-
}
|
|
1132
|
-
async function record_waits(log) {
|
|
1133
|
-
await record_ci_wait(log);
|
|
1134
|
-
await followup_coderabbit_wait.record(log.coderabbit);
|
|
1135
|
-
}
|
|
1136
|
-
var git_followup_stages = {
|
|
1137
|
-
STAGE,
|
|
1138
|
-
STAGE_LINE_PREFIX,
|
|
1139
|
-
STAGE_TOTAL_PREFIX,
|
|
1140
|
-
new_log,
|
|
1141
|
-
hold_issue,
|
|
1142
|
-
lap,
|
|
1143
|
-
total_ms,
|
|
1144
|
-
format_stage,
|
|
1145
|
-
format_stages,
|
|
1146
|
-
print_stages,
|
|
1147
|
-
record_waits,
|
|
1148
|
-
stopped_lap
|
|
1149
|
-
};
|
|
1150
|
-
|
|
1151
|
-
// scripts/time-runtime/time-followup-stage.ts
|
|
1152
|
-
var LINE_SEPARATOR2 = "\n";
|
|
1153
|
-
var SECONDS_SUFFIX = " s";
|
|
1154
|
-
var DIGIT_OR_POINT = /[\d.]/u;
|
|
1155
|
-
var NO_STAGES = [];
|
|
1156
|
-
function stage_body(line2) {
|
|
1157
|
-
const trimmed = line2.trimStart();
|
|
1158
|
-
if (!trimmed.startsWith(git_followup_stages.STAGE_LINE_PREFIX)) return void 0;
|
|
1159
|
-
return trimmed.slice(git_followup_stages.STAGE_LINE_PREFIX.length);
|
|
1160
|
-
}
|
|
1161
|
-
function digits_start(head) {
|
|
1162
|
-
let index = head.length;
|
|
1163
|
-
while (index > 0 && DIGIT_OR_POINT.test(head.charAt(index - 1))) index -= 1;
|
|
1164
|
-
return index;
|
|
1165
|
-
}
|
|
1166
|
-
function is_duration(digits) {
|
|
1167
|
-
return digits !== "" && Number.isFinite(Number(digits));
|
|
1168
|
-
}
|
|
1169
|
-
function to_stage(body) {
|
|
1170
|
-
const text2 = body.trimEnd();
|
|
1171
|
-
if (!text2.endsWith(SECONDS_SUFFIX)) return void 0;
|
|
1172
|
-
const head = text2.slice(0, -SECONDS_SUFFIX.length);
|
|
1173
|
-
const start = digits_start(head);
|
|
1174
|
-
const name = head.slice(0, start).trim();
|
|
1175
|
-
const digits = head.slice(start);
|
|
1176
|
-
if (name === "" || !is_duration(digits)) return void 0;
|
|
1177
|
-
return { name, duration_ms: Number(digits) * MS_PER_SECOND };
|
|
1178
|
-
}
|
|
1179
|
-
function read_stages(text2) {
|
|
1180
|
-
if (!text2.includes(git_followup_stages.STAGE_LINE_PREFIX)) return NO_STAGES;
|
|
1181
|
-
return text2.split(LINE_SEPARATOR2).map((line2) => stage_body(line2)).filter((body) => body !== void 0).map((body) => to_stage(body)).filter((stage) => stage !== void 0);
|
|
1182
|
-
}
|
|
1183
|
-
var time_followup_stage = { NO_STAGES, read_stages };
|
|
1184
|
-
|
|
1185
|
-
// scripts/time-runtime/time-transcript-block.ts
|
|
1186
|
-
var ERROR_TEXT_LIMIT = 256;
|
|
1187
|
-
var REFUSAL_MARKER = "\u26D4";
|
|
1188
|
-
var HOOK_ERROR_LABEL = /^PreToolUse:\S+ hook error: /u;
|
|
1189
|
-
var TOKEN_LINE = /^[a-z][a-z-]*$/u;
|
|
1190
|
-
var TOKEN_LINE_LIMIT = 8;
|
|
1191
|
-
function block_names(raw) {
|
|
1192
|
-
return {
|
|
1193
|
-
type: raw.type ?? "",
|
|
1194
|
-
name: raw.name ?? "",
|
|
1195
|
-
id: raw.id ?? "",
|
|
1196
|
-
result_id: raw.tool_use_id ?? ""
|
|
1197
|
-
};
|
|
1198
|
-
}
|
|
1199
|
-
function refusal_body(text2) {
|
|
1200
|
-
return text2.trimStart().replace(HOOK_ERROR_LABEL, "");
|
|
1201
|
-
}
|
|
1202
|
-
function guard_from_refusal(text2) {
|
|
1203
|
-
const trimmed = refusal_body(text2);
|
|
1204
|
-
if (!trimmed.startsWith(REFUSAL_MARKER)) return "";
|
|
1205
|
-
const headline = trimmed.slice(REFUSAL_MARKER.length).split("\n", 1)[0]?.trimStart() ?? "";
|
|
1206
|
-
const colon = headline.indexOf(":");
|
|
1207
|
-
return (colon === -1 ? headline : headline.slice(0, colon)).trim();
|
|
1208
|
-
}
|
|
1209
|
-
function token_lines_of(text2) {
|
|
1210
|
-
return text2.split("\n").map((line2) => line2.trim()).filter((line2) => TOKEN_LINE.test(line2)).slice(0, TOKEN_LINE_LIMIT);
|
|
1211
|
-
}
|
|
1212
|
-
function to_block(raw) {
|
|
1213
|
-
const text2 = time_reported_failure.result_text(raw.content);
|
|
1214
|
-
const is_error = raw.is_error ?? void 0;
|
|
1215
|
-
return {
|
|
1216
|
-
...block_names(raw),
|
|
1217
|
-
input: raw.input,
|
|
1218
|
-
is_error,
|
|
1219
|
-
has_failure_line: time_reported_failure.has_failure_line(text2),
|
|
1220
|
-
followup_stages: time_followup_stage.read_stages(text2),
|
|
1221
|
-
error_text: is_error === true ? text2.slice(0, ERROR_TEXT_LIMIT) : "",
|
|
1222
|
-
refusal_guard: is_error === true ? guard_from_refusal(text2) : "",
|
|
1223
|
-
token_lines: is_error === true ? [] : token_lines_of(text2),
|
|
1224
|
-
background_id: time_background.launch_id(text2),
|
|
1225
|
-
agent_id: time_background.agent_launch_id(text2),
|
|
1226
|
-
result_chars: text2.length
|
|
1227
|
-
};
|
|
1228
|
-
}
|
|
1229
|
-
function to_blocks(content) {
|
|
1230
|
-
return typeof content === "string" || content === null || content === void 0 ? [] : content.map((block) => to_block(block));
|
|
1231
|
-
}
|
|
1232
|
-
var time_transcript_block = {
|
|
1233
|
-
ERROR_TEXT_LIMIT,
|
|
1234
|
-
TOKEN_LINE_LIMIT,
|
|
1235
|
-
guard_from_refusal,
|
|
1236
|
-
refusal_body,
|
|
1237
|
-
to_blocks
|
|
1238
|
-
};
|
|
1239
|
-
|
|
1240
|
-
// scripts/time-runtime/time-transcript-line.ts
|
|
1241
|
-
var UNKNOWN_BRANCH = "";
|
|
1242
|
-
var PROMPT_KEY = "prompt";
|
|
1243
|
-
var NO_MESSAGE_ID = "";
|
|
1244
|
-
var STOP_FEEDBACK_LABEL = /^Stop hook feedback:\s*/u;
|
|
1245
|
-
function stop_feedback_of(data) {
|
|
1246
|
-
const content = data.message?.content;
|
|
1247
|
-
if (typeof content !== "string" || !STOP_FEEDBACK_LABEL.test(content)) return "";
|
|
1248
|
-
return content.replace(STOP_FEEDBACK_LABEL, "").trim();
|
|
1249
|
-
}
|
|
1250
|
-
function message_fields(message) {
|
|
1251
|
-
return {
|
|
1252
|
-
message_id: message?.id ?? NO_MESSAGE_ID,
|
|
1253
|
-
blocks: time_transcript_block.to_blocks(message?.content)
|
|
1254
|
-
};
|
|
1255
|
-
}
|
|
1256
|
-
function notice_text(data) {
|
|
1257
|
-
const attachment = json_value.is_record(data.attachment) ? data.attachment[PROMPT_KEY] : void 0;
|
|
1258
|
-
const carried = [data.message?.content, data.content, attachment];
|
|
1259
|
-
return carried.find((one) => typeof one === "string") ?? "";
|
|
1260
|
-
}
|
|
1261
|
-
function stopped_background(content) {
|
|
1262
|
-
if (!Array.isArray(content)) return time_background.NO_BACKGROUND;
|
|
1263
|
-
const ids = content.map(
|
|
1264
|
-
(block) => typeof block.content === "string" ? time_background.stopped_id(block.content) : ""
|
|
1265
|
-
);
|
|
1266
|
-
return ids.find((id) => id !== time_background.NO_BACKGROUND) ?? time_background.NO_BACKGROUND;
|
|
1267
|
-
}
|
|
1268
|
-
function finished_background(data) {
|
|
1269
|
-
const notice = time_background.finished_id(notice_text(data));
|
|
1270
|
-
return notice === time_background.NO_BACKGROUND ? stopped_background(data.message?.content) : notice;
|
|
1271
|
-
}
|
|
1272
|
-
function request_fields(data) {
|
|
1273
|
-
return { request_id: data.requestId ?? "", effort: data.effort ?? "" };
|
|
1274
|
-
}
|
|
1275
|
-
function to_line(data) {
|
|
1276
|
-
const timestamp_ms = time_instant.parse_instant(data.timestamp);
|
|
1277
|
-
if (timestamp_ms === void 0) return void 0;
|
|
1278
|
-
const stop_feedback = stop_feedback_of(data);
|
|
1279
|
-
return {
|
|
1280
|
-
type: data.type ?? "",
|
|
1281
|
-
timestamp_ms,
|
|
1282
|
-
branch: data.gitBranch ?? UNKNOWN_BRANCH,
|
|
1283
|
-
finished_background: finished_background(data),
|
|
1284
|
-
stop_feedback,
|
|
1285
|
-
stop_guard: time_transcript_block.guard_from_refusal(stop_feedback),
|
|
1286
|
-
...request_fields(data),
|
|
1287
|
-
...message_fields(data.message)
|
|
1288
|
-
};
|
|
1289
|
-
}
|
|
1290
|
-
function parse_line(line2) {
|
|
1291
|
-
const record2 = transcript_record.parse(line2);
|
|
1292
|
-
return record2 === void 0 ? void 0 : to_line(record2);
|
|
1293
|
-
}
|
|
1294
|
-
function parse_text(text2) {
|
|
1295
|
-
return text2.split("\n").flatMap((line2) => parse_line(line2) ?? []);
|
|
1296
|
-
}
|
|
1297
|
-
var time_transcript_line = {
|
|
1298
|
-
ERROR_TEXT_LIMIT: time_transcript_block.ERROR_TEXT_LIMIT,
|
|
1299
|
-
NO_MESSAGE_ID,
|
|
1300
|
-
TOKEN_LINE_LIMIT: time_transcript_block.TOKEN_LINE_LIMIT,
|
|
1301
|
-
guard_from_refusal: time_transcript_block.guard_from_refusal,
|
|
1302
|
-
parse_line,
|
|
1303
|
-
parse_text,
|
|
1304
|
-
refusal_body: time_transcript_block.refusal_body
|
|
1305
|
-
};
|
|
1306
|
-
|
|
1307
|
-
// scripts/time-runtime/time-bundle-call.ts
|
|
1308
|
-
var { BASH_TOOL } = cost_blocks;
|
|
1309
|
-
var BUNDLEABLE_TOOLS = /* @__PURE__ */ new Set(["Edit", "Glob", "Grep", "Read", "WebFetch", "WebSearch", "Write"]);
|
|
1310
|
-
var LAUNCH_TOOLS = /* @__PURE__ */ new Set(["Agent", "Task"]);
|
|
1311
|
-
var PRIOR_REFERENCE_MARKERS = [
|
|
1312
|
-
"previous finding",
|
|
1313
|
-
"prior finding",
|
|
1314
|
-
"earlier finding",
|
|
1315
|
-
"previous result",
|
|
1316
|
-
"prior result",
|
|
1317
|
-
"earlier result",
|
|
1318
|
-
"based on the previous",
|
|
1319
|
-
"based on the earlier",
|
|
1320
|
-
"from the previous agent",
|
|
1321
|
-
"from the prior agent",
|
|
1322
|
-
"the finding above",
|
|
1323
|
-
"as found earlier",
|
|
1324
|
-
"as found above",
|
|
1325
|
-
"building on the previous"
|
|
1326
|
-
];
|
|
1327
|
-
var READ_COMMANDS = /* @__PURE__ */ new Set([
|
|
1328
|
-
"awk",
|
|
1329
|
-
"basename",
|
|
1330
|
-
"cat",
|
|
1331
|
-
"comm",
|
|
1332
|
-
"cut",
|
|
1333
|
-
"diff",
|
|
1334
|
-
"dirname",
|
|
1335
|
-
"du",
|
|
1336
|
-
"echo",
|
|
1337
|
-
"file",
|
|
1338
|
-
"find",
|
|
1339
|
-
"gh",
|
|
1340
|
-
"grep",
|
|
1341
|
-
"head",
|
|
1342
|
-
"jq",
|
|
1343
|
-
"ls",
|
|
1344
|
-
"nl",
|
|
1345
|
-
"printf",
|
|
1346
|
-
"pwd",
|
|
1347
|
-
"realpath",
|
|
1348
|
-
"rg",
|
|
1349
|
-
// **`sed -i` is deliberately not excluded.** An in-place edit is what `Edit` does, and `Edit` is on
|
|
1350
|
-
// the allow-list above — a turn may issue several of them, so rejecting the shell spelling of the
|
|
1351
|
-
// same thing would exclude a call the tool form counts. Two in-place edits of the *same* file are
|
|
1352
|
-
// caught by the target test instead, which is where that ordering actually lives.
|
|
1353
|
-
"sed",
|
|
1354
|
-
"sort",
|
|
1355
|
-
"stat",
|
|
1356
|
-
"tail",
|
|
1357
|
-
"tree",
|
|
1358
|
-
"uniq",
|
|
1359
|
-
"wc",
|
|
1360
|
-
"which"
|
|
1361
|
-
]);
|
|
1362
|
-
var MUTATION_WORDS = /* @__PURE__ */ new Set([
|
|
1363
|
-
"--field",
|
|
1364
|
-
"--method",
|
|
1365
|
-
"--raw-field",
|
|
1366
|
-
"-F",
|
|
1367
|
-
"-X",
|
|
1368
|
-
"-delete",
|
|
1369
|
-
"-exec",
|
|
1370
|
-
"-f",
|
|
1371
|
-
"add",
|
|
1372
|
-
"chmod",
|
|
1373
|
-
"chown",
|
|
1374
|
-
"close",
|
|
1375
|
-
"comment",
|
|
1376
|
-
"cp",
|
|
1377
|
-
"create",
|
|
1378
|
-
"dd",
|
|
1379
|
-
"delete",
|
|
1380
|
-
"edit",
|
|
1381
|
-
"git",
|
|
1382
|
-
"install",
|
|
1383
|
-
"kill",
|
|
1384
|
-
"ln",
|
|
1385
|
-
"merge",
|
|
1386
|
-
"mkdir",
|
|
1387
|
-
"mv",
|
|
1388
|
-
"node",
|
|
1389
|
-
"npm",
|
|
1390
|
-
"npx",
|
|
1391
|
-
"pkill",
|
|
1392
|
-
"pnpm",
|
|
1393
|
-
"remove",
|
|
1394
|
-
"rm",
|
|
1395
|
-
"scp",
|
|
1396
|
-
"secret",
|
|
1397
|
-
"set",
|
|
1398
|
-
"ssh",
|
|
1399
|
-
"sudo",
|
|
1400
|
-
"tee",
|
|
1401
|
-
"touch",
|
|
1402
|
-
"truncate",
|
|
1403
|
-
"tsx",
|
|
1404
|
-
"upload",
|
|
1405
|
-
"wget"
|
|
1406
|
-
]);
|
|
1407
|
-
var READ_JOSH_SUBCOMMANDS = /* @__PURE__ */ new Set([
|
|
1408
|
-
"backlog:budget",
|
|
1409
|
-
"backlog:next",
|
|
1410
|
-
"cost",
|
|
1411
|
-
"delegate",
|
|
1412
|
-
"epic:audit",
|
|
1413
|
-
"epic:bundle",
|
|
1414
|
-
"epic:check",
|
|
1415
|
-
"epic:next",
|
|
1416
|
-
"issue:read",
|
|
1417
|
-
"issue:scout",
|
|
1418
|
-
"issue:state",
|
|
1419
|
-
"lane:list",
|
|
1420
|
-
"latest:scope",
|
|
1421
|
-
"release:scope",
|
|
1422
|
-
"review:brief",
|
|
1423
|
-
"review:round2",
|
|
1424
|
-
"run:liveness"
|
|
1425
|
-
]);
|
|
1426
|
-
var JOSH_WORD = "josh";
|
|
1427
|
-
var JOSH_SCRIPT_SUFFIX = "josh.ts";
|
|
1428
|
-
var COMMAND_CHAIN = /[|;&`>]|\$\(/u;
|
|
1429
|
-
var WHITESPACE_PATTERN = /\s+/u;
|
|
1430
|
-
var TARGET_FIELDS = ["file_path", "notebook_path", "path", "url"];
|
|
1431
|
-
var TARGET_ARRAY_FIELD = "file_paths";
|
|
1432
|
-
var MAX_TARGETS = 8;
|
|
1433
|
-
var WORD_PATTERN = /[\s'"=(),;:|&]+/u;
|
|
1434
|
-
var EXTENSION_PATTERN = /^[A-Za-z]+$/u;
|
|
1435
|
-
var MAX_EXTENSION = 5;
|
|
1436
|
-
var AFTER_DOT = 1;
|
|
1437
|
-
var FIRST_INDEX = 0;
|
|
1438
|
-
var CURRENT_DIRECTORY = "./";
|
|
1439
|
-
var LAST_CHARACTER = -1;
|
|
1440
|
-
var FLAG_PREFIX = "-";
|
|
1441
|
-
var PATH_SEPARATOR = "/";
|
|
1442
|
-
var MIN_TARGET_LENGTH = 3;
|
|
1443
|
-
var WRITING_TOOLS = /* @__PURE__ */ new Set(["Edit", "Write", "NotebookEdit"]);
|
|
1444
|
-
var WRITING_WORDS = /* @__PURE__ */ new Set(["dd", "sed", "tee"]);
|
|
1445
|
-
var REDIRECTION = ">";
|
|
1446
|
-
var IN_PLACE_COMMAND = "sed";
|
|
1447
|
-
var IN_PLACE_FLAG_PATTERN = /^--in-place\b|^-[A-Za-z]*i/u;
|
|
1448
|
-
function not_bundleable() {
|
|
1449
|
-
return {
|
|
1450
|
-
is_bundleable: false,
|
|
1451
|
-
targets: [],
|
|
1452
|
-
is_writing: false,
|
|
1453
|
-
may_write: false,
|
|
1454
|
-
has_prior_reference: false
|
|
1455
|
-
};
|
|
1456
|
-
}
|
|
1457
|
-
function is_launch_tool(name) {
|
|
1458
|
-
return LAUNCH_TOOLS.has(name);
|
|
1459
|
-
}
|
|
1460
|
-
function words_of(command) {
|
|
1461
|
-
return command.split(WORD_PATTERN).filter((word) => word !== "");
|
|
1462
|
-
}
|
|
1463
|
-
function has_mutation(command) {
|
|
1464
|
-
return words_of(command).some((word) => MUTATION_WORDS.has(word));
|
|
1465
|
-
}
|
|
1466
|
-
function josh_subcommand(command) {
|
|
1467
|
-
const tokens = command.split(WHITESPACE_PATTERN).filter((token) => token !== "");
|
|
1468
|
-
const josh_index = tokens.findIndex(
|
|
1469
|
-
(token) => token === JOSH_WORD || token.endsWith(JOSH_SCRIPT_SUFFIX)
|
|
1470
|
-
);
|
|
1471
|
-
return josh_index < FIRST_INDEX ? void 0 : tokens[josh_index + 1];
|
|
1472
|
-
}
|
|
1473
|
-
function is_read_josh(command) {
|
|
1474
|
-
if (COMMAND_CHAIN.test(command)) return false;
|
|
1475
|
-
const subcommand = josh_subcommand(command);
|
|
1476
|
-
if (subcommand === void 0) return false;
|
|
1477
|
-
return READ_JOSH_SUBCOMMANDS.has(canonical_command(subcommand));
|
|
1478
|
-
}
|
|
1479
|
-
function may_write_command(command) {
|
|
1480
|
-
if (command.includes(REDIRECTION)) return true;
|
|
1481
|
-
return words_of(command).some((word) => WRITING_WORDS.has(word));
|
|
1482
|
-
}
|
|
1483
|
-
function write_segment(command) {
|
|
1484
|
-
return time_shell.command_segment(time_shell.unquoted(command));
|
|
1485
|
-
}
|
|
1486
|
-
function is_in_place_sed(segment) {
|
|
1487
|
-
if (time_shell.leading_word(segment) !== IN_PLACE_COMMAND) return false;
|
|
1488
|
-
return words_of(segment).some((word) => IN_PLACE_FLAG_PATTERN.test(word));
|
|
1489
|
-
}
|
|
1490
|
-
function normalize(word) {
|
|
1491
|
-
const head = word.startsWith(CURRENT_DIRECTORY) ? word.slice(CURRENT_DIRECTORY.length) : word;
|
|
1492
|
-
return head.endsWith(PATH_SEPARATOR) ? head.slice(0, LAST_CHARACTER) : head;
|
|
1493
|
-
}
|
|
1494
|
-
function has_extension(word) {
|
|
1495
|
-
const dot = word.lastIndexOf(".");
|
|
1496
|
-
if (dot <= FIRST_INDEX) return false;
|
|
1497
|
-
const suffix = word.slice(dot + AFTER_DOT);
|
|
1498
|
-
return suffix.length <= MAX_EXTENSION && EXTENSION_PATTERN.test(suffix);
|
|
1499
|
-
}
|
|
1500
|
-
function is_target(word) {
|
|
1501
|
-
if (word.startsWith(FLAG_PREFIX) || word.length < MIN_TARGET_LENGTH) return false;
|
|
1502
|
-
return word.includes(PATH_SEPARATOR) || has_extension(word);
|
|
1503
|
-
}
|
|
1504
|
-
function targets_in(text2) {
|
|
1505
|
-
return words_of(text2).map((word) => normalize(word)).filter((word) => is_target(word)).slice(0, MAX_TARGETS);
|
|
1506
|
-
}
|
|
1507
|
-
function field_text(input, field) {
|
|
1508
|
-
if (!json_value.is_record(input)) return "";
|
|
1509
|
-
const value2 = input[field];
|
|
1510
|
-
return typeof value2 === "string" ? value2 : "";
|
|
1511
|
-
}
|
|
1512
|
-
function field_targets(input) {
|
|
1513
|
-
if (!json_value.is_record(input)) return [];
|
|
1514
|
-
const value2 = input[TARGET_ARRAY_FIELD];
|
|
1515
|
-
return Array.isArray(value2) ? value2.filter((entry) => typeof entry === "string") : [];
|
|
1516
|
-
}
|
|
1517
|
-
function tool_targets(input) {
|
|
1518
|
-
const scalar_targets = TARGET_FIELDS.map((field) => field_text(input, field));
|
|
1519
|
-
const targets = [...scalar_targets, ...field_targets(input)].map((target) => normalize(target));
|
|
1520
|
-
return [...new Set(targets)].filter((target) => target !== "");
|
|
1521
|
-
}
|
|
1522
|
-
function prompt_references_prior(input) {
|
|
1523
|
-
const prompt = field_text(input, "prompt").toLowerCase();
|
|
1524
|
-
return PRIOR_REFERENCE_MARKERS.some((marker) => prompt.includes(marker));
|
|
1525
|
-
}
|
|
1526
|
-
function tool_facts(name, input) {
|
|
1527
|
-
const writes = { is_writing: WRITING_TOOLS.has(name), may_write: WRITING_TOOLS.has(name) };
|
|
1528
|
-
const has_prior_reference = LAUNCH_TOOLS.has(name) && prompt_references_prior(input);
|
|
1529
|
-
if (!BUNDLEABLE_TOOLS.has(name)) return { ...not_bundleable(), ...writes, has_prior_reference };
|
|
1530
|
-
return { is_bundleable: true, targets: tool_targets(input), ...writes, has_prior_reference };
|
|
1531
|
-
}
|
|
1532
|
-
function bash_facts(command) {
|
|
1533
|
-
const writes = {
|
|
1534
|
-
is_writing: is_in_place_sed(write_segment(command)),
|
|
1535
|
-
may_write: may_write_command(command)
|
|
1536
|
-
};
|
|
1537
|
-
if (is_read_josh(command)) {
|
|
1538
|
-
return {
|
|
1539
|
-
is_bundleable: true,
|
|
1540
|
-
targets: targets_in(time_shell.unquoted(command)),
|
|
1541
|
-
...writes,
|
|
1542
|
-
has_prior_reference: false
|
|
1543
|
-
};
|
|
1544
|
-
}
|
|
1545
|
-
if (!READ_COMMANDS.has(time_shell.leading_word(command)) || has_mutation(command)) {
|
|
1546
|
-
return { ...not_bundleable(), ...writes };
|
|
1547
|
-
}
|
|
1548
|
-
return {
|
|
1549
|
-
is_bundleable: true,
|
|
1550
|
-
targets: targets_in(time_shell.unquoted(command)),
|
|
1551
|
-
...writes,
|
|
1552
|
-
has_prior_reference: false
|
|
1553
|
-
};
|
|
1554
|
-
}
|
|
1555
|
-
function call_facts(name, input) {
|
|
1556
|
-
if (name !== BASH_TOOL) return tool_facts(name, input);
|
|
1557
|
-
return bash_facts(time_shell.bash_command(input));
|
|
1558
|
-
}
|
|
1559
|
-
var time_bundle_call = {
|
|
1560
|
-
MAX_TARGETS,
|
|
1561
|
-
not_bundleable,
|
|
1562
|
-
bash_facts,
|
|
1563
|
-
call_facts,
|
|
1564
|
-
tool_facts,
|
|
1565
|
-
// Exported for `time-agent-bundles.ts`, which asks the launch question of a
|
|
1566
|
-
// span's `label` — the tool name for a non-Bash call — so the set lives in one place.
|
|
1567
|
-
is_launch_tool,
|
|
1568
|
-
// Exported for `time-writes.ts`, which asks what a call *wrote* rather
|
|
1569
|
-
// than what it named. The extraction is the same one either way — a second copy of it would let a
|
|
1570
|
-
// path be recognized as a target when read and missed when written.
|
|
1571
|
-
targets_in,
|
|
1572
|
-
tool_targets,
|
|
1573
|
-
// Exported for the batching guard's own word scan, so the two scanners
|
|
1574
|
-
// cannot come to disagree about where one word of a shell line ends and the next begins.
|
|
1575
|
-
// Exported for the read-fold notice, which offers `read:files <path>` only
|
|
1576
|
-
// over file-shaped targets — a bare directory like `scripts/` is a target here but not something
|
|
1577
|
-
// `read:files` can read, so the notice reuses this test rather than keep a second copy that could
|
|
1578
|
-
// drift from what counts as a file path.
|
|
1579
|
-
has_extension,
|
|
1580
|
-
// Exported for `time-writes.ts`, which needs the same two answers to say
|
|
1581
|
-
// *which* files an in-place `sed` wrote. Two copies of this test disagreed in both directions at
|
|
1582
|
-
// once — one called a piped `grep -i` a write, the other missed a bundled `sed -ni`.
|
|
1583
|
-
write_segment,
|
|
1584
|
-
is_in_place_sed,
|
|
1585
|
-
// Exported for the drift test in `time-bundle-call.test.ts`, which pins that
|
|
1586
|
-
// every name here is a real `josh` command and none of them writes.
|
|
1587
|
-
READ_JOSH_SUBCOMMANDS
|
|
1588
|
-
};
|
|
1589
|
-
|
|
1590
|
-
// scripts/cost-runtime/cost-attribute.ts
|
|
1591
|
-
var ISSUE_BRANCH_PATTERN = /^(\d+)-/u;
|
|
1592
|
-
var UNATTRIBUTED_KEY = -1;
|
|
1593
|
-
function issue_from_branch(branch) {
|
|
1594
|
-
const matched = ISSUE_BRANCH_PATTERN.exec(branch);
|
|
1595
|
-
return matched?.[1] === void 0 ? UNATTRIBUTED_KEY : Number(matched[1]);
|
|
1596
|
-
}
|
|
1597
|
-
function declared_issue(record2) {
|
|
1598
|
-
const declared = record2.issue ?? UNATTRIBUTED_KEY;
|
|
1599
|
-
return declared === UNATTRIBUTED_KEY ? issue_from_branch(record2.branch) : declared;
|
|
1600
|
-
}
|
|
1601
|
-
function fill(declared, is_reverse) {
|
|
1602
|
-
const filled = Array.from({ length: declared.length }, () => UNATTRIBUTED_KEY);
|
|
1603
|
-
const order = declared.map((_value, index) => is_reverse ? declared.length - 1 - index : index);
|
|
1604
|
-
let carried = UNATTRIBUTED_KEY;
|
|
1605
|
-
for (const index of order) {
|
|
1606
|
-
const own = declared[index] ?? UNATTRIBUTED_KEY;
|
|
1607
|
-
carried = own === UNATTRIBUTED_KEY ? carried : own;
|
|
1608
|
-
filled[index] = carried;
|
|
1609
|
-
}
|
|
1610
|
-
return filled;
|
|
1611
|
-
}
|
|
1612
|
-
function is_attributed(value2) {
|
|
1613
|
-
return value2 !== void 0 && value2 !== UNATTRIBUTED_KEY;
|
|
1614
|
-
}
|
|
1615
|
-
function pick(own, carried, next, previous) {
|
|
1616
|
-
if (is_attributed(own)) return own;
|
|
1617
|
-
if (is_attributed(carried)) return carried;
|
|
1618
|
-
if (is_attributed(next)) return next;
|
|
1619
|
-
return previous ?? UNATTRIBUTED_KEY;
|
|
1620
|
-
}
|
|
1621
|
-
function announcements(records) {
|
|
1622
|
-
return fill(
|
|
1623
|
-
records.map((record2) => record2.issue ?? UNATTRIBUTED_KEY),
|
|
1624
|
-
false
|
|
1625
|
-
);
|
|
1626
|
-
}
|
|
1627
|
-
function attribute(records) {
|
|
1628
|
-
const declared = records.map((record2) => declared_issue(record2));
|
|
1629
|
-
const carried = announcements(records);
|
|
1630
|
-
const next = fill(declared, true);
|
|
1631
|
-
const previous = fill(declared, false);
|
|
1632
|
-
return declared.map(
|
|
1633
|
-
(own, index) => pick(own, carried[index] ?? UNATTRIBUTED_KEY, next[index], previous[index])
|
|
1634
|
-
);
|
|
1635
|
-
}
|
|
1636
|
-
function group_by_issue(records) {
|
|
1637
|
-
const issues = attribute(records);
|
|
1638
|
-
const grouped = /* @__PURE__ */ new Map();
|
|
1639
|
-
for (const [index, record2] of records.entries()) {
|
|
1640
|
-
const bucket = grouped.get(issues[index] ?? UNATTRIBUTED_KEY) ?? [];
|
|
1641
|
-
bucket.push(record2);
|
|
1642
|
-
grouped.set(issues[index] ?? UNATTRIBUTED_KEY, bucket);
|
|
1643
|
-
}
|
|
1644
|
-
return [...grouped].toSorted(([left], [right]) => left - right).map(([issue, bucket]) => ({ issue, records: bucket }));
|
|
1645
|
-
}
|
|
1646
|
-
function records_for_issue(records, issue_number) {
|
|
1647
|
-
const issues = attribute(records);
|
|
1648
|
-
return records.filter((_record, index) => issues[index] === issue_number);
|
|
1649
|
-
}
|
|
1650
|
-
var cost_attribute = {
|
|
1651
|
-
UNATTRIBUTED_KEY,
|
|
1652
|
-
issue_from_branch,
|
|
1653
|
-
declared_issue,
|
|
1654
|
-
attribute,
|
|
1655
|
-
group_by_issue,
|
|
1656
|
-
records_for_issue
|
|
1657
|
-
};
|
|
1658
|
-
|
|
1659
|
-
// scripts/time-runtime/time-markers.ts
|
|
1660
|
-
var NO_MARKER = "none";
|
|
1661
|
-
var PLAN_MARKER = "plan";
|
|
1662
|
-
var EDIT_MARKER = "edit";
|
|
1663
|
-
var REVIEW_MARKER = "review";
|
|
1664
|
-
var WORKFLOW_MARKER = "workflow";
|
|
1665
|
-
var EDIT_TOOLS = /* @__PURE__ */ new Set(["Edit", "Write", "MultiEdit", "NotebookEdit"]);
|
|
1666
|
-
var SKILL_TOOL = "Skill";
|
|
1667
|
-
var SKILL_KEY = "skill";
|
|
1668
|
-
var REVIEW_SKILL = "code-review";
|
|
1669
|
-
var WORKFLOW_SKILL = "workflow-commands";
|
|
1670
|
-
var AGENT_TOOL = "Agent";
|
|
1671
|
-
var PROMPT_KEY2 = "prompt";
|
|
1672
|
-
var REVIEW_INVOCATION = "/code-review";
|
|
1673
|
-
var REVIEW_ATTEST = "review:attest";
|
|
1674
|
-
var SKILL_MARKERS = /* @__PURE__ */ new Map([
|
|
1675
|
-
[REVIEW_SKILL, REVIEW_MARKER],
|
|
1676
|
-
[WORKFLOW_SKILL, WORKFLOW_MARKER]
|
|
1677
|
-
]);
|
|
1678
|
-
var ISSUE_API_PATTERN = /repos\/\S+\/issues\/\d+/u;
|
|
1679
|
-
var BODY_FIELD_PATTERN = /\bbody=/u;
|
|
1680
|
-
var ISSUE_COMMENT_PATTERN = /\bgh\s+issue\s+comment\b/u;
|
|
1681
|
-
var BODY_FLAG_PATTERN = /--body(?:-file)?\b/u;
|
|
1682
|
-
var ISSUE_PLAN_PATTERN = /(?:^|[;&|]\s*)pnpm\s+josh\s+issue:plan\b/u;
|
|
1683
|
-
var ISSUE_LABELS_PATTERN = /repos\/\S+\/issues\/(\d+)\/labels\b(?!\/)/u;
|
|
1684
|
-
var IN_PROGRESS_FIELD = "labels[]=in-progress";
|
|
1685
|
-
var RUN_ENTRY_PATTERN = /\bjosh\s+run:entry\s+(\d+)\b/u;
|
|
1686
|
-
var NO_ISSUE = cost_attribute.UNATTRIBUTED_KEY;
|
|
1687
|
-
function string_field(input, key2) {
|
|
1688
|
-
if (!json_value.is_record(input)) return "";
|
|
1689
|
-
const value2 = input[key2];
|
|
1690
|
-
return typeof value2 === "string" ? value2 : "";
|
|
1691
|
-
}
|
|
1692
|
-
function skill_name(input) {
|
|
1693
|
-
return string_field(input, SKILL_KEY);
|
|
1694
|
-
}
|
|
1695
|
-
function agent_marker(input) {
|
|
1696
|
-
const prompt = string_field(input, PROMPT_KEY2);
|
|
1697
|
-
const is_review = prompt.includes(REVIEW_INVOCATION) && prompt.includes(REVIEW_ATTEST);
|
|
1698
|
-
return is_review ? REVIEW_MARKER : NO_MARKER;
|
|
1699
|
-
}
|
|
1700
|
-
function tool_marker(name, input) {
|
|
1701
|
-
if (EDIT_TOOLS.has(name)) return EDIT_MARKER;
|
|
1702
|
-
if (name === AGENT_TOOL) return agent_marker(input);
|
|
1703
|
-
if (name !== SKILL_TOOL) return NO_MARKER;
|
|
1704
|
-
return SKILL_MARKERS.get(skill_name(input)) ?? NO_MARKER;
|
|
1705
|
-
}
|
|
1706
|
-
function is_api_body_write(command) {
|
|
1707
|
-
return ISSUE_API_PATTERN.test(command) && BODY_FIELD_PATTERN.test(command);
|
|
1708
|
-
}
|
|
1709
|
-
function is_issue_comment(command) {
|
|
1710
|
-
return ISSUE_COMMENT_PATTERN.test(command) && BODY_FLAG_PATTERN.test(command);
|
|
1711
|
-
}
|
|
1712
|
-
function is_plan_write(command) {
|
|
1713
|
-
return is_api_body_write(command) || is_issue_comment(command) || ISSUE_PLAN_PATTERN.test(command);
|
|
1714
|
-
}
|
|
1715
|
-
function is_in_progress_label(command) {
|
|
1716
|
-
return ISSUE_LABELS_PATTERN.test(command) && command.includes(IN_PROGRESS_FIELD);
|
|
1717
|
-
}
|
|
1718
|
-
function is_run_start(command) {
|
|
1719
|
-
return is_in_progress_label(command) || RUN_ENTRY_PATTERN.test(command);
|
|
1720
|
-
}
|
|
1721
|
-
var COMMAND_SEPARATOR = /&&|\|\||;/u;
|
|
1722
|
-
function declared_issue2(part) {
|
|
1723
|
-
const pattern = is_in_progress_label(part) ? ISSUE_LABELS_PATTERN : RUN_ENTRY_PATTERN;
|
|
1724
|
-
const matched = pattern.exec(part);
|
|
1725
|
-
return matched?.[1] === void 0 ? NO_ISSUE : Number(matched[1]);
|
|
1726
|
-
}
|
|
1727
|
-
function bash_issue(command) {
|
|
1728
|
-
for (const part of command.split(COMMAND_SEPARATOR)) {
|
|
1729
|
-
if (is_run_start(part)) return declared_issue2(part);
|
|
1730
|
-
}
|
|
1731
|
-
return NO_ISSUE;
|
|
1732
|
-
}
|
|
1733
|
-
function bash_marker(command) {
|
|
1734
|
-
if (is_run_start(command)) return WORKFLOW_MARKER;
|
|
1735
|
-
return is_plan_write(command) ? PLAN_MARKER : NO_MARKER;
|
|
1736
|
-
}
|
|
1737
|
-
var time_markers = {
|
|
1738
|
-
NO_MARKER,
|
|
1739
|
-
PLAN_MARKER,
|
|
1740
|
-
EDIT_MARKER,
|
|
1741
|
-
REVIEW_MARKER,
|
|
1742
|
-
WORKFLOW_MARKER,
|
|
1743
|
-
NO_ISSUE,
|
|
1744
|
-
tool_marker,
|
|
1745
|
-
bash_marker,
|
|
1746
|
-
bash_issue
|
|
1747
|
-
};
|
|
1748
|
-
|
|
1749
|
-
// scripts/time-runtime/time-single-check.ts
|
|
1750
|
-
var CHECK_COMMANDS = /* @__PURE__ */ new Set([
|
|
1751
|
-
"josh check",
|
|
1752
|
-
"josh cspell",
|
|
1753
|
-
"josh cspell:dot",
|
|
1754
|
-
"josh lint",
|
|
1755
|
-
"josh lint:related",
|
|
1756
|
-
"josh test:related",
|
|
1757
|
-
"josh test:unit"
|
|
1758
|
-
]);
|
|
1759
|
-
var NO_CHECK = "";
|
|
1760
|
-
var KEY_SEPARATOR = " ";
|
|
1761
|
-
function argument_key(command) {
|
|
1762
|
-
return [...new Set(time_shell.josh_arguments(command))].toSorted(
|
|
1763
|
-
(left, right) => left.localeCompare(right)
|
|
1764
|
-
);
|
|
1765
|
-
}
|
|
1766
|
-
function check_key(josh_command, command) {
|
|
1767
|
-
if (!CHECK_COMMANDS.has(josh_command)) return NO_CHECK;
|
|
1768
|
-
return [josh_command, ...argument_key(command)].join(KEY_SEPARATOR);
|
|
1769
|
-
}
|
|
1770
|
-
var time_single_check = { NO_CHECK, check_key };
|
|
1771
|
-
|
|
1772
|
-
// scripts/time-runtime/time-writes.ts
|
|
1773
|
-
function bash_writes(command) {
|
|
1774
|
-
const segment = time_bundle_call.write_segment(command);
|
|
1775
|
-
return time_bundle_call.is_in_place_sed(segment) ? time_bundle_call.targets_in(segment) : [];
|
|
1776
|
-
}
|
|
1777
|
-
function tool_writes(name, input) {
|
|
1778
|
-
if (time_markers.tool_marker(name, input) !== time_markers.EDIT_MARKER) return [];
|
|
1779
|
-
return time_bundle_call.tool_targets(input);
|
|
1780
|
-
}
|
|
1781
|
-
var time_writes = {
|
|
1782
|
-
bash_writes,
|
|
1783
|
-
tool_writes
|
|
1784
|
-
};
|
|
1785
|
-
|
|
1786
|
-
// scripts/time-runtime/time-tool-call.ts
|
|
1787
|
-
var { NO_MESSAGE_ID: NO_MESSAGE_ID2 } = time_transcript_line;
|
|
1788
|
-
var UNKNOWN_TOOL = "unknown";
|
|
1789
|
-
var NO_CALL = {
|
|
1790
|
-
label: "",
|
|
1791
|
-
josh_command: "",
|
|
1792
|
-
josh_commands: [],
|
|
1793
|
-
josh_signatures: [],
|
|
1794
|
-
check_key: time_single_check.NO_CHECK,
|
|
1795
|
-
marker: time_markers.NO_MARKER,
|
|
1796
|
-
message_id: NO_MESSAGE_ID2,
|
|
1797
|
-
writes: [],
|
|
1798
|
-
issue: time_markers.NO_ISSUE,
|
|
1799
|
-
reads_background: time_background.NO_BACKGROUND,
|
|
1800
|
-
...time_bundle_call.not_bundleable()
|
|
1801
|
-
};
|
|
1802
|
-
var UNKNOWN_CALL = {
|
|
1803
|
-
label: UNKNOWN_TOOL,
|
|
1804
|
-
josh_command: "",
|
|
1805
|
-
josh_commands: [],
|
|
1806
|
-
josh_signatures: [],
|
|
1807
|
-
check_key: time_single_check.NO_CHECK,
|
|
1808
|
-
marker: time_markers.NO_MARKER,
|
|
1809
|
-
message_id: NO_MESSAGE_ID2,
|
|
1810
|
-
writes: [],
|
|
1811
|
-
issue: time_markers.NO_ISSUE,
|
|
1812
|
-
reads_background: time_background.NO_BACKGROUND,
|
|
1813
|
-
...time_bundle_call.not_bundleable()
|
|
1814
|
-
};
|
|
1815
|
-
function non_bash_call(name, input, message_id) {
|
|
1816
|
-
return {
|
|
1817
|
-
label: name,
|
|
1818
|
-
josh_command: "",
|
|
1819
|
-
josh_commands: [],
|
|
1820
|
-
josh_signatures: [],
|
|
1821
|
-
check_key: time_single_check.NO_CHECK,
|
|
1822
|
-
marker: time_markers.tool_marker(name, input),
|
|
1823
|
-
message_id,
|
|
1824
|
-
writes: time_writes.tool_writes(name, input),
|
|
1825
|
-
issue: time_markers.NO_ISSUE,
|
|
1826
|
-
// A non-Bash tool joins a backgrounded command too — `BashOutput` carries the shell id in a
|
|
1827
|
-
// field of its own, `Monitor` names the same `…/tasks/<id>.output` path in a command — so the
|
|
1828
|
-
// same reader is asked here rather than the field being left empty for every tool but `Bash`.
|
|
1829
|
-
reads_background: time_background.read_id_of(input),
|
|
1830
|
-
...time_bundle_call.tool_facts(name, input)
|
|
1831
|
-
};
|
|
1832
|
-
}
|
|
1833
|
-
function bash_call(input, message_id) {
|
|
1834
|
-
const command = time_shell.bash_command(input);
|
|
1835
|
-
const josh_command = time_josh_names.josh_command_of(command);
|
|
1836
|
-
return {
|
|
1837
|
-
label: time_shell.bash_label(command),
|
|
1838
|
-
josh_command,
|
|
1839
|
-
josh_commands: time_josh_names.josh_commands_of(command),
|
|
1840
|
-
josh_signatures: time_josh_names.josh_signatures_of(command),
|
|
1841
|
-
check_key: time_single_check.check_key(josh_command, command),
|
|
1842
|
-
marker: time_markers.bash_marker(command),
|
|
1843
|
-
message_id,
|
|
1844
|
-
writes: time_writes.bash_writes(command),
|
|
1845
|
-
issue: time_markers.bash_issue(command),
|
|
1846
|
-
reads_background: time_background.read_id_of(input),
|
|
1847
|
-
...time_bundle_call.bash_facts(command)
|
|
1848
|
-
};
|
|
1849
|
-
}
|
|
1850
|
-
function to_tool_call(name, input, message_id) {
|
|
1851
|
-
if (name !== cost_blocks.BASH_TOOL) return non_bash_call(name, input, message_id);
|
|
1852
|
-
return bash_call(input, message_id);
|
|
1853
|
-
}
|
|
1854
|
-
var time_tool_call = {
|
|
1855
|
-
UNKNOWN_TOOL,
|
|
1856
|
-
NO_CALL,
|
|
1857
|
-
UNKNOWN_CALL,
|
|
1858
|
-
to_tool_call
|
|
1859
|
-
};
|
|
1860
|
-
|
|
1861
|
-
// scripts/time-runtime/time-spans.ts
|
|
1862
|
-
var { NO_MESSAGE_ID: NO_MESSAGE_ID3, parse_line: parse_line2 } = time_transcript_line;
|
|
1863
|
-
var { NO_CALL: NO_CALL2, UNKNOWN_CALL: UNKNOWN_CALL2, UNKNOWN_TOOL: UNKNOWN_TOOL2, to_tool_call: to_tool_call2 } = time_tool_call;
|
|
1864
|
-
var ASSISTANT_TYPE = "assistant";
|
|
1865
|
-
var USER_TYPE = "user";
|
|
1866
|
-
var MODEL_CATEGORY = "model";
|
|
1867
|
-
var TOOL_CATEGORY = "tool";
|
|
1868
|
-
var HUMAN_CATEGORY = "human";
|
|
1869
|
-
var OK_OUTCOME = "ok";
|
|
1870
|
-
var FAILED_OUTCOME = "failed";
|
|
1871
|
-
var UNKNOWN_OUTCOME = "unknown";
|
|
1872
|
-
var NO_RESULT = {
|
|
1873
|
-
call_id: "",
|
|
1874
|
-
outcome: UNKNOWN_OUTCOME,
|
|
1875
|
-
refusal_guard: "",
|
|
1876
|
-
background_id: time_background.NO_BACKGROUND,
|
|
1877
|
-
followup_stages: time_followup_stage.NO_STAGES
|
|
1878
|
-
};
|
|
1879
|
-
function tool_use_blocks(lines) {
|
|
1880
|
-
return lines.flatMap(
|
|
1881
|
-
(line2) => line2.blocks.filter((block) => block.type === cost_blocks.TOOL_USE_TYPE && block.id !== "").map((block) => ({ block, message_id: line2.message_id }))
|
|
1882
|
-
);
|
|
1883
|
-
}
|
|
1884
|
-
function collect_calls(lines) {
|
|
1885
|
-
return new Map(
|
|
1886
|
-
tool_use_blocks(lines).map(({ block, message_id }) => [
|
|
1887
|
-
block.id,
|
|
1888
|
-
to_tool_call2(block.name, block.input, message_id)
|
|
1889
|
-
])
|
|
1890
|
-
);
|
|
1891
|
-
}
|
|
1892
|
-
function result_block(line2) {
|
|
1893
|
-
return line2.blocks.find((block) => block.type === cost_blocks.TOOL_RESULT_TYPE);
|
|
1894
|
-
}
|
|
1895
|
-
function event_of(line2, category, call, result = NO_RESULT) {
|
|
1896
|
-
return { timestamp_ms: line2.timestamp_ms, branch: line2.branch, category, ...result, ...call };
|
|
1897
|
-
}
|
|
1898
|
-
function outcome_of(result, call) {
|
|
1899
|
-
if (time_reported_failure.is_reported_failure(call.josh_command, result.has_failure_line)) {
|
|
1900
|
-
return FAILED_OUTCOME;
|
|
1901
|
-
}
|
|
1902
|
-
if (result.is_error === void 0) return UNKNOWN_OUTCOME;
|
|
1903
|
-
return result.is_error ? FAILED_OUTCOME : OK_OUTCOME;
|
|
1904
|
-
}
|
|
1905
|
-
function facts_of(result, call) {
|
|
1906
|
-
return {
|
|
1907
|
-
call_id: result.result_id,
|
|
1908
|
-
outcome: outcome_of(result, call),
|
|
1909
|
-
refusal_guard: result.refusal_guard,
|
|
1910
|
-
background_id: result.background_id,
|
|
1911
|
-
followup_stages: result.followup_stages
|
|
1912
|
-
};
|
|
1913
|
-
}
|
|
1914
|
-
function user_event(line2, calls) {
|
|
1915
|
-
const result = result_block(line2);
|
|
1916
|
-
if (result === void 0) return event_of(line2, HUMAN_CATEGORY, NO_CALL2);
|
|
1917
|
-
const call = calls.get(result.result_id) ?? UNKNOWN_CALL2;
|
|
1918
|
-
return event_of(line2, TOOL_CATEGORY, call, facts_of(result, call));
|
|
1919
|
-
}
|
|
1920
|
-
function to_event(line2, calls) {
|
|
1921
|
-
if (line2.type === ASSISTANT_TYPE) {
|
|
1922
|
-
return event_of(line2, MODEL_CATEGORY, { ...NO_CALL2, message_id: line2.message_id });
|
|
1923
|
-
}
|
|
1924
|
-
return line2.type === USER_TYPE ? user_event(line2, calls) : void 0;
|
|
1925
|
-
}
|
|
1926
|
-
function to_events(lines, calls) {
|
|
1927
|
-
return lines.map((line2) => to_event(line2, calls)).filter((event) => event !== void 0).toSorted((left, right) => left.timestamp_ms - right.timestamp_ms);
|
|
1928
|
-
}
|
|
1929
|
-
function equal_durations(duration_ms) {
|
|
1930
|
-
return { duration_ms, own_duration_ms: duration_ms };
|
|
1931
|
-
}
|
|
1932
|
-
function no_background() {
|
|
1933
|
-
const none = time_background.NO_BACKGROUND;
|
|
1934
|
-
return {
|
|
1935
|
-
background_id: none,
|
|
1936
|
-
reads_background: none,
|
|
1937
|
-
background_command: none,
|
|
1938
|
-
background_ended_ms: time_background.NO_FINISH
|
|
1939
|
-
};
|
|
1940
|
-
}
|
|
1941
|
-
function background_fields(event, finished) {
|
|
1942
|
-
return {
|
|
1943
|
-
background_id: event.background_id,
|
|
1944
|
-
reads_background: event.reads_background,
|
|
1945
|
-
background_command: time_background.NO_BACKGROUND,
|
|
1946
|
-
background_ended_ms: finished.get(event.background_id) ?? time_background.NO_FINISH
|
|
1947
|
-
};
|
|
1948
|
-
}
|
|
1949
|
-
function result_facts_of(event) {
|
|
1950
|
-
return {
|
|
1951
|
-
call_id: event.call_id,
|
|
1952
|
-
outcome: event.outcome,
|
|
1953
|
-
refusal_guard: event.refusal_guard,
|
|
1954
|
-
followup_stages: event.followup_stages
|
|
1955
|
-
};
|
|
1956
|
-
}
|
|
1957
|
-
function to_spans(events, finished) {
|
|
1958
|
-
return events.slice(1).map((event, index) => ({
|
|
1959
|
-
category: event.category,
|
|
1960
|
-
label: event.label,
|
|
1961
|
-
josh_command: event.josh_command,
|
|
1962
|
-
josh_commands: event.josh_commands,
|
|
1963
|
-
josh_signatures: event.josh_signatures,
|
|
1964
|
-
check_key: event.check_key,
|
|
1965
|
-
marker: event.marker,
|
|
1966
|
-
is_bundleable: event.is_bundleable,
|
|
1967
|
-
targets: event.targets,
|
|
1968
|
-
is_writing: event.is_writing,
|
|
1969
|
-
may_write: event.may_write,
|
|
1970
|
-
has_prior_reference: event.has_prior_reference,
|
|
1971
|
-
writes: event.writes,
|
|
1972
|
-
message_id: event.message_id,
|
|
1973
|
-
issue: event.issue,
|
|
1974
|
-
branch: event.branch,
|
|
1975
|
-
...result_facts_of(event),
|
|
1976
|
-
is_continuation: false,
|
|
1977
|
-
...background_fields(event, finished),
|
|
1978
|
-
ended_ms: event.timestamp_ms,
|
|
1979
|
-
...equal_durations(event.timestamp_ms - (events[index]?.timestamp_ms ?? event.timestamp_ms))
|
|
1980
|
-
}));
|
|
1981
|
-
}
|
|
1982
|
-
function parse_timeline(text2) {
|
|
1983
|
-
const lines = text2.split("\n").map((line2) => parse_line2(line2)).filter((line2) => line2 !== void 0);
|
|
1984
|
-
const events = to_events(lines, collect_calls(lines));
|
|
1985
|
-
return {
|
|
1986
|
-
started_ms: events[0]?.timestamp_ms ?? 0,
|
|
1987
|
-
ended_ms: events.at(-1)?.timestamp_ms ?? 0,
|
|
1988
|
-
// **The positioning happens here rather than in a caller**: a launch and
|
|
1989
|
-
// the call that reads its output are in one transcript, and by the time spans have been merged
|
|
1990
|
-
// across sessions and trimmed they are fragments rather than calls.
|
|
1991
|
-
spans: time_background.positioned(to_spans(events, time_background.finished_at(lines)))
|
|
1992
|
-
};
|
|
1993
|
-
}
|
|
1994
|
-
function has_transcript_data(span_count) {
|
|
1995
|
-
return span_count > 0;
|
|
1996
|
-
}
|
|
1997
|
-
var time_spans = {
|
|
1998
|
-
ASSISTANT_TYPE,
|
|
1999
|
-
MODEL_CATEGORY,
|
|
2000
|
-
TOOL_CATEGORY,
|
|
2001
|
-
HUMAN_CATEGORY,
|
|
2002
|
-
OK_OUTCOME,
|
|
2003
|
-
FAILED_OUTCOME,
|
|
2004
|
-
UNKNOWN_OUTCOME,
|
|
2005
|
-
NO_MESSAGE_ID: NO_MESSAGE_ID3,
|
|
2006
|
-
UNKNOWN_TOOL: UNKNOWN_TOOL2,
|
|
2007
|
-
has_transcript_data,
|
|
2008
|
-
equal_durations,
|
|
2009
|
-
no_background,
|
|
2010
|
-
// Re-exported so the suites that measure how a command is read keep asking one namespace, and so
|
|
2011
|
-
// `time-shell.ts` moving out of this file changed no call site.
|
|
2012
|
-
bash_label: time_shell.bash_label,
|
|
2013
|
-
josh_command_of: time_josh_names.josh_command_of,
|
|
2014
|
-
josh_commands_of: time_josh_names.josh_commands_of,
|
|
2015
|
-
to_tool_call: to_tool_call2,
|
|
2016
|
-
parse_line: parse_line2,
|
|
2017
|
-
parse_timeline
|
|
2018
|
-
};
|
|
2019
|
-
|
|
2020
|
-
// scripts/time-runtime/time-round-trips.ts
|
|
2021
|
-
var CALLS_PER_ROUND_TRIP_FLOOR = 1.5;
|
|
2022
|
-
var DENSITY_DECIMALS = 2;
|
|
2023
|
-
var NONE = 0;
|
|
2024
|
-
function is_tool(span) {
|
|
2025
|
-
return span.category === time_spans.TOOL_CATEGORY;
|
|
2026
|
-
}
|
|
2027
|
-
function is_model(span) {
|
|
2028
|
-
return span.category === time_spans.MODEL_CATEGORY;
|
|
2029
|
-
}
|
|
2030
|
-
function started_ms2(span) {
|
|
2031
|
-
return span.ended_ms - span.duration_ms;
|
|
2032
|
-
}
|
|
2033
|
-
function in_time_order(spans) {
|
|
2034
|
-
return spans.toSorted((left, right) => started_ms2(left) - started_ms2(right));
|
|
2035
|
-
}
|
|
2036
|
-
function is_tool_at(spans, index) {
|
|
2037
|
-
const span = spans[index];
|
|
2038
|
-
return span !== void 0 && is_tool(span);
|
|
2039
|
-
}
|
|
2040
|
-
function is_call(span) {
|
|
2041
|
-
return is_tool(span) && !span.is_continuation;
|
|
2042
|
-
}
|
|
2043
|
-
function count_calls(spans) {
|
|
2044
|
-
return spans.filter((span) => is_call(span)).length;
|
|
2045
|
-
}
|
|
2046
|
-
function previous_break(spans, index) {
|
|
2047
|
-
for (let back = index - 1; back >= 0; back -= 1) {
|
|
2048
|
-
const span = spans[back];
|
|
2049
|
-
if (span === void 0 || !is_model(span)) return span;
|
|
2050
|
-
}
|
|
2051
|
-
return void 0;
|
|
2052
|
-
}
|
|
2053
|
-
function continues_turn(spans, index, message_id) {
|
|
2054
|
-
if (message_id === time_spans.NO_MESSAGE_ID) return false;
|
|
2055
|
-
const earlier = previous_break(spans, index);
|
|
2056
|
-
return earlier !== void 0 && !earlier.is_continuation && earlier.message_id === message_id;
|
|
2057
|
-
}
|
|
2058
|
-
function opens_round_trip(spans, index) {
|
|
2059
|
-
const span = spans[index];
|
|
2060
|
-
if (span === void 0 || !is_tool(span) || span.is_continuation || is_tool_at(spans, index - 1)) {
|
|
2061
|
-
return false;
|
|
2062
|
-
}
|
|
2063
|
-
return !continues_turn(spans, index, span.message_id);
|
|
2064
|
-
}
|
|
2065
|
-
function open_trip(walk) {
|
|
2066
|
-
walk.open = [];
|
|
2067
|
-
walk.trips.push(walk.open);
|
|
2068
|
-
}
|
|
2069
|
-
function place_call(walk, span) {
|
|
2070
|
-
if (is_call(span)) walk.open?.push(span);
|
|
2071
|
-
}
|
|
2072
|
-
function step_trip(walk, span, is_opener) {
|
|
2073
|
-
if (is_opener) open_trip(walk);
|
|
2074
|
-
if (is_tool(span)) place_call(walk, span);
|
|
2075
|
-
else if (!is_model(span)) walk.open = void 0;
|
|
2076
|
-
}
|
|
2077
|
-
function group_round_trips(spans) {
|
|
2078
|
-
const ordered = in_time_order(spans);
|
|
2079
|
-
const walk = { trips: [], open: void 0 };
|
|
2080
|
-
for (const [index, span] of ordered.entries()) {
|
|
2081
|
-
step_trip(walk, span, opens_round_trip(ordered, index));
|
|
2082
|
-
}
|
|
2083
|
-
return walk.trips;
|
|
2084
|
-
}
|
|
2085
|
-
function count_round_trips(spans) {
|
|
2086
|
-
return group_round_trips(spans).length;
|
|
2087
|
-
}
|
|
2088
|
-
function turn_key(span, index) {
|
|
2089
|
-
return span.message_id === time_spans.NO_MESSAGE_ID ? `#${String(index)}` : span.message_id;
|
|
2090
|
-
}
|
|
2091
|
-
function count_turns(spans) {
|
|
2092
|
-
const keys = spans.filter((span) => is_model(span)).map((span, index) => turn_key(span, index));
|
|
2093
|
-
return new Set(keys).size;
|
|
2094
|
-
}
|
|
2095
|
-
function per_round_trip(total, round_trip_count) {
|
|
2096
|
-
if (round_trip_count === NONE) return NONE;
|
|
2097
|
-
return total / round_trip_count;
|
|
2098
|
-
}
|
|
2099
|
-
function format_density(density) {
|
|
2100
|
-
return density.toFixed(DENSITY_DECIMALS);
|
|
2101
|
-
}
|
|
2102
|
-
function is_below_floor(density) {
|
|
2103
|
-
return density > NONE && density < CALLS_PER_ROUND_TRIP_FLOOR;
|
|
2104
|
-
}
|
|
2105
|
-
var time_round_trips = {
|
|
2106
|
-
CALLS_PER_ROUND_TRIP_FLOOR,
|
|
2107
|
-
count_calls,
|
|
2108
|
-
count_round_trips,
|
|
2109
|
-
// Exported so a turn is defined in the one module that already defines a round trip rather than
|
|
2110
|
-
// as a span filter in the report next door.
|
|
2111
|
-
count_turns,
|
|
2112
|
-
format_density,
|
|
2113
|
-
// Exported so the per-tool counts are read off the very groups this module counts rather than off
|
|
2114
|
-
// a second grouping beside them.
|
|
2115
|
-
group_round_trips,
|
|
2116
|
-
// Exported so the failure aggregation orders a run's spans through
|
|
2117
|
-
// the one function that already knows why they need it — a second `toSorted` beside it would be
|
|
2118
|
-
// the clone `CLAUDE.md` prohibits, and the seam it guards (a delegated unit's spans appended
|
|
2119
|
-
// after the parent's) is not one a second copy would keep remembering.
|
|
2120
|
-
in_time_order,
|
|
2121
|
-
is_below_floor,
|
|
2122
|
-
// Exported so callers price a round trip with the same divisor and guard rather than a private
|
|
2123
|
-
// copy — the clone `CLAUDE.md` prohibits.
|
|
2124
|
-
per_round_trip
|
|
2125
|
-
};
|
|
2126
|
-
|
|
2127
|
-
// scripts/time-runtime/time-agent-bundles.ts
|
|
2128
|
-
var NONE2 = 0;
|
|
2129
|
-
var ONE = 1;
|
|
2130
|
-
var MIN_GROUP = 2;
|
|
2131
|
-
function is_launch2(span) {
|
|
2132
|
-
return span.category === time_spans.TOOL_CATEGORY && !span.is_continuation && time_bundle_call.is_launch_tool(span.label);
|
|
2133
|
-
}
|
|
2134
|
-
function new_walk() {
|
|
2135
|
-
return { closed: [], open: NONE2, wrote_since: false, turn_id: time_spans.NO_MESSAGE_ID };
|
|
2136
|
-
}
|
|
2137
|
-
function close_group(walk) {
|
|
2138
|
-
if (walk.open >= MIN_GROUP) walk.closed.push(walk.open);
|
|
2139
|
-
walk.open = NONE2;
|
|
2140
|
-
}
|
|
2141
|
-
function is_same_turn(walk, span) {
|
|
2142
|
-
return span.message_id !== time_spans.NO_MESSAGE_ID && span.message_id === walk.turn_id;
|
|
2143
|
-
}
|
|
2144
|
-
function open_turn(walk, span) {
|
|
2145
|
-
if (walk.wrote_since || span.has_prior_reference) close_group(walk);
|
|
2146
|
-
walk.open += ONE;
|
|
2147
|
-
walk.turn_id = span.message_id;
|
|
2148
|
-
walk.wrote_since = false;
|
|
2149
|
-
}
|
|
2150
|
-
function step(walk, span) {
|
|
2151
|
-
if (span.is_writing) {
|
|
2152
|
-
walk.wrote_since = true;
|
|
2153
|
-
return;
|
|
2154
|
-
}
|
|
2155
|
-
if (!is_launch2(span) || is_same_turn(walk, span)) return;
|
|
2156
|
-
open_turn(walk, span);
|
|
2157
|
-
}
|
|
2158
|
-
function agent_bundles(spans) {
|
|
2159
|
-
const walk = new_walk();
|
|
2160
|
-
for (const span of time_round_trips.in_time_order(spans)) step(walk, span);
|
|
2161
|
-
close_group(walk);
|
|
2162
|
-
return walk.closed;
|
|
2163
|
-
}
|
|
2164
|
-
var time_agent_bundles = { agent_bundles };
|
|
2165
|
-
|
|
2166
|
-
// scripts/time-runtime/time-bundles.ts
|
|
2167
|
-
var { unmeasured_row: unmeasured_row2 } = time_format;
|
|
2168
|
-
var HEADING = "Bundling:";
|
|
2169
|
-
var SEQUENCE_LABEL = "bundleable sequences";
|
|
2170
|
-
var RECOVERABLE_LABEL = "recoverable round trips";
|
|
2171
|
-
var SAVING_LABEL = "recoverable wait";
|
|
2172
|
-
var BY_TOOL_LABEL = "recoverable by tool";
|
|
2173
|
-
var AGENT_ROW_LABEL = "Agent";
|
|
2174
|
-
var ROW_INDENT = " ";
|
|
2175
|
-
var MIN_SEQUENCE = 2;
|
|
2176
|
-
var ONE_CALL = 1;
|
|
2177
|
-
var NONE3 = 0;
|
|
2178
|
-
var PATH_SEPARATOR2 = "/";
|
|
2179
|
-
var FIRST_CALL = 1;
|
|
2180
|
-
var NO_LABEL = "";
|
|
2181
|
-
var NO_BUNDLES = {
|
|
2182
|
-
sequence_count: 0,
|
|
2183
|
-
longest_sequence: 0,
|
|
2184
|
-
recoverable_round_trips: 0,
|
|
2185
|
-
by_tool: [],
|
|
2186
|
-
unattributed_round_trips: 0,
|
|
2187
|
-
single_call: { independent_round_trips: 0, dependent_round_trips: 0, by_tool: [] },
|
|
2188
|
-
is_measured: false
|
|
2189
|
-
};
|
|
2190
|
-
function contains_segments(whole, part) {
|
|
2191
|
-
if (whole.startsWith(`${part}${PATH_SEPARATOR2}`)) return true;
|
|
2192
|
-
return whole.endsWith(`${PATH_SEPARATOR2}${part}`) || whole.includes(`${PATH_SEPARATOR2}${part}${PATH_SEPARATOR2}`);
|
|
2193
|
-
}
|
|
2194
|
-
function is_related(left, right) {
|
|
2195
|
-
if (left === right) return true;
|
|
2196
|
-
return contains_segments(left, right) || contains_segments(right, left);
|
|
2197
|
-
}
|
|
2198
|
-
function shares_target(left, right) {
|
|
2199
|
-
return left.some((one) => right.some((other) => is_related(one, other)));
|
|
2200
|
-
}
|
|
2201
|
-
function is_dependent(earlier, later) {
|
|
2202
|
-
if (earlier.is_writing && later.is_writing) return false;
|
|
2203
|
-
return shares_target(earlier.targets, later.targets);
|
|
2204
|
-
}
|
|
2205
|
-
function conflicts(span, sequence) {
|
|
2206
|
-
return sequence.some((earlier) => is_dependent(earlier, span));
|
|
2207
|
-
}
|
|
2208
|
-
function is_call2(span) {
|
|
2209
|
-
return span.category === time_spans.TOOL_CATEGORY && !span.is_continuation;
|
|
2210
|
-
}
|
|
2211
|
-
function is_turn_boundary(span) {
|
|
2212
|
-
return span.category === time_spans.MODEL_CATEGORY;
|
|
2213
|
-
}
|
|
2214
|
-
function new_walk2() {
|
|
2215
|
-
return { pending: [], sequence: [], closed: [], dependent: NONE3 };
|
|
2216
|
-
}
|
|
2217
|
-
function flush(walk) {
|
|
2218
|
-
if (walk.sequence.length >= MIN_SEQUENCE) walk.closed.push(walk.sequence);
|
|
2219
|
-
walk.sequence = [];
|
|
2220
|
-
}
|
|
2221
|
-
function extend(walk, span) {
|
|
2222
|
-
if (conflicts(span, walk.sequence)) {
|
|
2223
|
-
walk.dependent += ONE_CALL;
|
|
2224
|
-
flush(walk);
|
|
2225
|
-
}
|
|
2226
|
-
walk.sequence.push(span);
|
|
2227
|
-
}
|
|
2228
|
-
function close_trip(walk) {
|
|
2229
|
-
const [only] = walk.pending;
|
|
2230
|
-
if (walk.pending.length === ONE_CALL && only?.is_bundleable === true) extend(walk, only);
|
|
2231
|
-
else if (walk.pending.length > NONE3) flush(walk);
|
|
2232
|
-
walk.pending = [];
|
|
2233
|
-
}
|
|
2234
|
-
function is_same_turn2(span, pending) {
|
|
2235
|
-
const [first] = pending;
|
|
2236
|
-
if (first === void 0 || span.is_continuation || span.message_id === time_spans.NO_MESSAGE_ID) {
|
|
2237
|
-
return false;
|
|
2238
|
-
}
|
|
2239
|
-
return span.message_id === first.message_id;
|
|
2240
|
-
}
|
|
2241
|
-
function step2(walk, span) {
|
|
2242
|
-
if (is_call2(span)) {
|
|
2243
|
-
walk.pending.push(span);
|
|
2244
|
-
return;
|
|
2245
|
-
}
|
|
2246
|
-
if (is_same_turn2(span, walk.pending)) return;
|
|
2247
|
-
close_trip(walk);
|
|
2248
|
-
if (!is_turn_boundary(span)) flush(walk);
|
|
2249
|
-
}
|
|
2250
|
-
function longest_of(sizes) {
|
|
2251
|
-
return sizes.length === NONE3 ? NONE3 : Math.max(...sizes);
|
|
2252
|
-
}
|
|
2253
|
-
function recoverable_of(sizes) {
|
|
2254
|
-
return sizes.reduce((sum, size) => sum + size - ONE_CALL, NONE3);
|
|
2255
|
-
}
|
|
2256
|
-
function sizes_of(closed) {
|
|
2257
|
-
return closed.map((sequence) => sequence.length);
|
|
2258
|
-
}
|
|
2259
|
-
function tally_for(tallies, label) {
|
|
2260
|
-
const found = tallies.get(label);
|
|
2261
|
-
if (found !== void 0) return found;
|
|
2262
|
-
const created = { sequence_count: NONE3, recoverable_round_trips: NONE3 };
|
|
2263
|
-
tallies.set(label, created);
|
|
2264
|
-
return created;
|
|
2265
|
-
}
|
|
2266
|
-
function count_trip(tallies, counted, label) {
|
|
2267
|
-
const tally = tally_for(tallies, label);
|
|
2268
|
-
tally.recoverable_round_trips += ONE_CALL;
|
|
2269
|
-
if (!counted.has(label)) tally.sequence_count += ONE_CALL;
|
|
2270
|
-
counted.add(label);
|
|
2271
|
-
}
|
|
2272
|
-
function tally_sequence(tallies, sequence) {
|
|
2273
|
-
const counted = /* @__PURE__ */ new Set();
|
|
2274
|
-
for (const span of sequence.slice(FIRST_CALL)) {
|
|
2275
|
-
if (span.label !== NO_LABEL) count_trip(tallies, counted, span.label);
|
|
2276
|
-
}
|
|
2277
|
-
}
|
|
2278
|
-
function by_weight(left, right) {
|
|
2279
|
-
if (left.recoverable_round_trips !== right.recoverable_round_trips) {
|
|
2280
|
-
return right.recoverable_round_trips - left.recoverable_round_trips;
|
|
2281
|
-
}
|
|
2282
|
-
return left.label.localeCompare(right.label);
|
|
2283
|
-
}
|
|
2284
|
-
function tool_rows(closed) {
|
|
2285
|
-
const tallies = /* @__PURE__ */ new Map();
|
|
2286
|
-
for (const sequence of closed) tally_sequence(tallies, sequence);
|
|
2287
|
-
return [...tallies].map(([label, tally]) => ({ label, ...tally })).toSorted(by_weight);
|
|
2288
|
-
}
|
|
2289
|
-
function attributed_of(rows) {
|
|
2290
|
-
return rows.reduce((sum, row) => sum + row.recoverable_round_trips, NONE3);
|
|
2291
|
-
}
|
|
2292
|
-
function with_agent_row(rows, agent_sizes) {
|
|
2293
|
-
const recoverable_round_trips = recoverable_of(agent_sizes);
|
|
2294
|
-
if (recoverable_round_trips === NONE3) return [...rows];
|
|
2295
|
-
const row = {
|
|
2296
|
-
label: AGENT_ROW_LABEL,
|
|
2297
|
-
sequence_count: agent_sizes.length,
|
|
2298
|
-
recoverable_round_trips
|
|
2299
|
-
};
|
|
2300
|
-
return [...rows, row].toSorted(by_weight);
|
|
2301
|
-
}
|
|
2302
|
-
function single_call_split(walk, sizes) {
|
|
2303
|
-
return {
|
|
2304
|
-
independent_round_trips: recoverable_of(sizes),
|
|
2305
|
-
dependent_round_trips: walk.dependent,
|
|
2306
|
-
by_tool: tool_rows(walk.closed)
|
|
2307
|
-
};
|
|
2308
|
-
}
|
|
2309
|
-
function build_bundles(spans) {
|
|
2310
|
-
const walk = new_walk2();
|
|
2311
|
-
for (const span of time_round_trips.in_time_order(spans)) step2(walk, span);
|
|
2312
|
-
close_trip(walk);
|
|
2313
|
-
flush(walk);
|
|
2314
|
-
const sizes = sizes_of(walk.closed);
|
|
2315
|
-
const agent_sizes = time_agent_bundles.agent_bundles(spans);
|
|
2316
|
-
const single_call = single_call_split(walk, sizes);
|
|
2317
|
-
const by_tool = with_agent_row(single_call.by_tool, agent_sizes);
|
|
2318
|
-
const recoverable_round_trips = single_call.independent_round_trips + recoverable_of(agent_sizes);
|
|
2319
|
-
return {
|
|
2320
|
-
sequence_count: sizes.length + agent_sizes.length,
|
|
2321
|
-
longest_sequence: Math.max(longest_of(sizes), longest_of(agent_sizes)),
|
|
2322
|
-
recoverable_round_trips,
|
|
2323
|
-
by_tool,
|
|
2324
|
-
unattributed_round_trips: recoverable_round_trips - attributed_of(by_tool),
|
|
2325
|
-
single_call,
|
|
2326
|
-
is_measured: time_spans.has_transcript_data(spans.length)
|
|
2327
|
-
};
|
|
2328
|
-
}
|
|
2329
|
-
function open_sequence(spans) {
|
|
2330
|
-
const walk = new_walk2();
|
|
2331
|
-
for (const span of time_round_trips.in_time_order(spans)) step2(walk, span);
|
|
2332
|
-
return walk.sequence;
|
|
2333
|
-
}
|
|
2334
|
-
function sequence_suffix(totals) {
|
|
2335
|
-
return `longest ${String(totals.longest_sequence)} turn(s)`;
|
|
2336
|
-
}
|
|
2337
|
-
function recoverable_suffix(totals, round_trip_count) {
|
|
2338
|
-
const share = figure_format.format_share(totals.recoverable_round_trips, round_trip_count);
|
|
2339
|
-
return `${share} of ${String(round_trip_count)} round trip(s)`;
|
|
2340
|
-
}
|
|
2341
|
-
function saving_line(totals, model_ms_per_round_trip) {
|
|
2342
|
-
const saved_ms = totals.recoverable_round_trips * model_ms_per_round_trip;
|
|
2343
|
-
const rate = `at ${time_format.format_seconds(model_ms_per_round_trip)} model time per round trip`;
|
|
2344
|
-
return time_format.format_row(SAVING_LABEL, saved_ms, rate);
|
|
2345
|
-
}
|
|
2346
|
-
function by_tool_suffix(totals) {
|
|
2347
|
-
const attributed = totals.recoverable_round_trips - totals.unattributed_round_trips;
|
|
2348
|
-
return `${String(attributed)} of ${String(totals.recoverable_round_trips)} attributed`;
|
|
2349
|
-
}
|
|
2350
|
-
function tool_row(row) {
|
|
2351
|
-
return time_format.format_columns(
|
|
2352
|
-
`${ROW_INDENT}${row.label}`,
|
|
2353
|
-
String(row.recoverable_round_trips),
|
|
2354
|
-
`in ${String(row.sequence_count)} sequence(s)`
|
|
2355
|
-
);
|
|
2356
|
-
}
|
|
2357
|
-
function by_tool_lines(totals) {
|
|
2358
|
-
const heading2 = time_format.format_columns(
|
|
2359
|
-
BY_TOOL_LABEL,
|
|
2360
|
-
String(totals.by_tool.length),
|
|
2361
|
-
by_tool_suffix(totals)
|
|
2362
|
-
);
|
|
2363
|
-
const rows = totals.by_tool.slice(NONE3, time_format.MAX_ROWS).map((row) => tool_row(row));
|
|
2364
|
-
return [heading2, ...rows, ...time_format.overflow_line(totals.by_tool.length)];
|
|
2365
|
-
}
|
|
2366
|
-
function measured_lines(totals, price) {
|
|
2367
|
-
return [
|
|
2368
|
-
time_format.format_columns(
|
|
2369
|
-
SEQUENCE_LABEL,
|
|
2370
|
-
String(totals.sequence_count),
|
|
2371
|
-
sequence_suffix(totals)
|
|
2372
|
-
),
|
|
2373
|
-
time_format.format_columns(
|
|
2374
|
-
RECOVERABLE_LABEL,
|
|
2375
|
-
String(totals.recoverable_round_trips),
|
|
2376
|
-
recoverable_suffix(totals, price.round_trip_count)
|
|
2377
|
-
),
|
|
2378
|
-
saving_line(totals, price.model_ms_per_round_trip),
|
|
2379
|
-
...by_tool_lines(totals)
|
|
2380
|
-
];
|
|
2381
|
-
}
|
|
2382
|
-
var LABELS = [SEQUENCE_LABEL, RECOVERABLE_LABEL, SAVING_LABEL, BY_TOOL_LABEL];
|
|
2383
|
-
function no_divisor_lines() {
|
|
2384
|
-
return LABELS.map((label) => time_format.format_columns(label, "", time_format.NO_CALLS));
|
|
2385
|
-
}
|
|
2386
|
-
function bundle_lines(totals, price) {
|
|
2387
|
-
const heading2 = ["", HEADING];
|
|
2388
|
-
if (!totals.is_measured) return [...heading2, ...LABELS.map((label) => unmeasured_row2(label))];
|
|
2389
|
-
if (price.round_trip_count === NONE3) return [...heading2, ...no_divisor_lines()];
|
|
2390
|
-
return [...heading2, ...measured_lines(totals, price)];
|
|
2391
|
-
}
|
|
2392
|
-
var time_bundles = {
|
|
2393
|
-
HEADING,
|
|
2394
|
-
BY_TOOL_LABEL,
|
|
2395
|
-
NO_BUNDLES,
|
|
2396
|
-
build_bundles,
|
|
2397
|
-
bundle_lines,
|
|
2398
|
-
by_weight,
|
|
2399
|
-
is_dependent,
|
|
2400
|
-
open_sequence,
|
|
2401
|
-
shares_target
|
|
2402
|
-
};
|
|
2403
|
-
|
|
2404
|
-
// scripts/time-runtime/time-command-key.ts
|
|
2405
|
-
var UNNAMED_KEY = "";
|
|
2406
|
-
function command_key(span) {
|
|
2407
|
-
if (span.label === time_spans.UNKNOWN_TOOL) return UNNAMED_KEY;
|
|
2408
|
-
return span.josh_command === "" ? span.label : span.josh_command;
|
|
2409
|
-
}
|
|
2410
|
-
var time_command_key = { UNNAMED_KEY, command_key };
|
|
2411
|
-
|
|
2412
|
-
// scripts/time-runtime/time-call-identity.ts
|
|
2413
|
-
var IDENTITY_SEPARATOR = "\0";
|
|
2414
|
-
function identity_of(call) {
|
|
2415
|
-
return [
|
|
2416
|
-
time_command_key.command_key(call),
|
|
2417
|
-
call.check_key,
|
|
2418
|
-
[...call.targets].toSorted((left, right) => left.localeCompare(right)).join(",")
|
|
2419
|
-
].join(IDENTITY_SEPARATOR);
|
|
2420
|
-
}
|
|
2421
|
-
var time_call_identity = { identity_of };
|
|
2422
|
-
|
|
2423
|
-
// scripts/time-runtime/time-search-call.ts
|
|
2424
|
-
var SEARCH_COMMANDS = ["fd", "find", "grep", "rg"];
|
|
2425
|
-
var SEARCH_LABELS = new Set(
|
|
2426
|
-
SEARCH_COMMANDS.map((command) => time_shell.bash_label(command))
|
|
2427
|
-
);
|
|
2428
|
-
var CHAIN_COMMANDS = [...SEARCH_COMMANDS, "sed"];
|
|
2429
|
-
var CHAIN_LABELS = new Set(
|
|
2430
|
-
CHAIN_COMMANDS.map((command) => time_shell.bash_label(command))
|
|
2431
|
-
);
|
|
2432
|
-
function is_read_only_search(call) {
|
|
2433
|
-
return SEARCH_LABELS.has(call.label) && call.is_bundleable && !call.may_write;
|
|
2434
|
-
}
|
|
2435
|
-
function is_search_chain_call(call) {
|
|
2436
|
-
return CHAIN_LABELS.has(call.label) && call.is_bundleable && !call.is_writing;
|
|
2437
|
-
}
|
|
2438
|
-
var time_search_call = {
|
|
2439
|
-
is_read_only_search,
|
|
2440
|
-
is_search_chain_call
|
|
2441
|
-
};
|
|
2442
|
-
|
|
2443
|
-
// scripts/time-runtime/time-batch-guard.ts
|
|
2444
|
-
var CONSECUTIVE_LIMIT = 3;
|
|
2445
|
-
var REFIRE_EVERY = CONSECUTIVE_LIMIT;
|
|
2446
|
-
var ONE_TURN = 1;
|
|
2447
|
-
var NONE4 = 0;
|
|
2448
|
-
var NOTICE_REFIRE_EVERY = ONE_TURN;
|
|
2449
|
-
var NAMED_CANDIDATE_COUNT = 3;
|
|
2450
|
-
var SEQUENCE_BEFORE_LIMIT = CONSECUTIVE_LIMIT - ONE_TURN;
|
|
2451
|
-
var RULE_POINTER = "`prompts/collaboration-workflow/turn-batching.md`";
|
|
2452
|
-
var STREAK = `${String(CONSECUTIVE_LIMIT)} single-call turns in a row`;
|
|
2453
|
-
var REASON = `\u26D4 batching: ${STREAK}. Reissue this with the calls that do not need its result \u2014 the test is whether a call's input needs another call's result, not what kind of call it is (edits are covered exactly as reads); it never authorizes weakening a verification gate or a review. Nothing to pair? Reissue it unchanged. ${RULE_POINTER}`;
|
|
2454
|
-
var NOTICE = `\u{1F4A1} batching: ${STREAK}; the Write proceeds. Issue the writes that do not need its result in one turn, never by weakening a gate or a review. ${RULE_POINTER}`;
|
|
2455
|
-
var LANE_NOTICE = `\u{1F4A1} batching: ${STREAK}; the call proceeds. Pair independent calls. ${RULE_POINTER}`;
|
|
2456
|
-
var WHOLE_FILE_WRITE_TOOL = "Write";
|
|
2457
|
-
var EDIT_TOOL = "Edit";
|
|
2458
|
-
function is_guarded_call(call) {
|
|
2459
|
-
if (call.name === WHOLE_FILE_WRITE_TOOL) return false;
|
|
2460
|
-
return time_bundle_call.call_facts(call.name, call.input).is_bundleable;
|
|
2461
|
-
}
|
|
2462
|
-
function is_notice_call(call) {
|
|
2463
|
-
return call.name === WHOLE_FILE_WRITE_TOOL;
|
|
2464
|
-
}
|
|
2465
|
-
function is_read_only_call(call) {
|
|
2466
|
-
const facts = time_bundle_call.call_facts(call.name, call.input);
|
|
2467
|
-
return facts.is_bundleable && !facts.may_write;
|
|
2468
|
-
}
|
|
2469
|
-
function depends_on_sequence(sequence, facts) {
|
|
2470
|
-
return sequence.some((span) => time_bundles.shares_target(span.targets, facts.targets));
|
|
2471
|
-
}
|
|
2472
|
-
function sequence_started_ms(sequence) {
|
|
2473
|
-
return sequence[0]?.ended_ms ?? NONE4;
|
|
2474
|
-
}
|
|
2475
|
-
function turns_since(sequence, last_fired_ms) {
|
|
2476
|
-
return sequence.filter((span) => span.ended_ms > last_fired_ms).length;
|
|
2477
|
-
}
|
|
2478
|
-
function is_sequence_at_limit(sequence, facts, last_fired_ms, refire_every) {
|
|
2479
|
-
if (sequence.length < SEQUENCE_BEFORE_LIMIT || depends_on_sequence(sequence, facts)) return false;
|
|
2480
|
-
if (last_fired_ms < sequence_started_ms(sequence)) return true;
|
|
2481
|
-
return turns_since(sequence, last_fired_ms) >= refire_every;
|
|
2482
|
-
}
|
|
2483
|
-
function is_at_limit(spans, call, last_fired_ms, refire_every) {
|
|
2484
|
-
return is_sequence_at_limit(
|
|
2485
|
-
time_bundles.open_sequence(spans),
|
|
2486
|
-
time_bundle_call.call_facts(call.name, call.input),
|
|
2487
|
-
last_fired_ms,
|
|
2488
|
-
refire_every
|
|
2489
|
-
);
|
|
2490
|
-
}
|
|
2491
|
-
var GUARD_LABEL = time_transcript_line.guard_from_refusal(REASON);
|
|
2492
|
-
function is_reissued_refusal(spans, call) {
|
|
2493
|
-
const identity = time_call_identity.identity_of(
|
|
2494
|
-
time_spans.to_tool_call(call.name, call.input, time_spans.NO_MESSAGE_ID)
|
|
2495
|
-
);
|
|
2496
|
-
return spans.some(
|
|
2497
|
-
(span) => span.refusal_guard === GUARD_LABEL && time_call_identity.identity_of(span) === identity
|
|
2498
|
-
);
|
|
2499
|
-
}
|
|
2500
|
-
function refusable_spans(text2, call) {
|
|
2501
|
-
if (!is_guarded_call(call)) return [];
|
|
2502
|
-
const { spans } = time_spans.parse_timeline(text2);
|
|
2503
|
-
return is_reissued_refusal(spans, call) ? [] : spans;
|
|
2504
|
-
}
|
|
2505
|
-
function should_block(text2, call, refused_at_ms, refire_every = REFIRE_EVERY) {
|
|
2506
|
-
return is_at_limit(refusable_spans(text2, call), call, refused_at_ms, refire_every);
|
|
2507
|
-
}
|
|
2508
|
-
function as_tool_call(call) {
|
|
2509
|
-
return time_spans.to_tool_call(call.name, call.input, time_spans.NO_MESSAGE_ID);
|
|
2510
|
-
}
|
|
2511
|
-
function is_search_chain_call2(call) {
|
|
2512
|
-
return is_guarded_call(call) && time_search_call.is_search_chain_call(as_tool_call(call));
|
|
2513
|
-
}
|
|
2514
|
-
function is_search_chain(spans, call) {
|
|
2515
|
-
const recent = time_bundles.open_sequence(spans).slice(-SEQUENCE_BEFORE_LIMIT);
|
|
2516
|
-
return [...recent, as_tool_call(call)].every(
|
|
2517
|
-
(turn) => time_search_call.is_search_chain_call(turn)
|
|
2518
|
-
);
|
|
2519
|
-
}
|
|
2520
|
-
function should_block_search_chain(text2, call, refused_at_ms) {
|
|
2521
|
-
const spans = refusable_spans(text2, call);
|
|
2522
|
-
return is_search_chain(spans, call) && is_at_limit(spans, call, refused_at_ms, REFIRE_EVERY);
|
|
2523
|
-
}
|
|
2524
|
-
function should_notify(text2, call, notified_at_ms) {
|
|
2525
|
-
if (!is_notice_call(call)) return false;
|
|
2526
|
-
const { spans } = time_spans.parse_timeline(text2);
|
|
2527
|
-
return is_at_limit(spans, call, notified_at_ms, NOTICE_REFIRE_EVERY);
|
|
2528
|
-
}
|
|
2529
|
-
function describe_span(span) {
|
|
2530
|
-
const target = span.targets[0] ?? "";
|
|
2531
|
-
if (target === "" || span.label.includes(target)) return span.label;
|
|
2532
|
-
return `${span.label} ${target}`;
|
|
2533
|
-
}
|
|
2534
|
-
var FOLD_MINIMUM = 2;
|
|
2535
|
-
function read_targets(sequence) {
|
|
2536
|
-
const paths = sequence.filter((span) => span.is_bundleable && !span.is_writing).map((span) => span.targets[0] ?? "").filter((path6) => path6 !== "" && time_bundle_call.has_extension(path6));
|
|
2537
|
-
return [...new Set(paths)];
|
|
2538
|
-
}
|
|
2539
|
-
function read_fold_directive(sequence) {
|
|
2540
|
-
const paths = read_targets(sequence);
|
|
2541
|
-
if (paths.length < FOLD_MINIMUM) return "";
|
|
2542
|
-
return ` Fold them into one call: \`pnpm josh read:files ${paths.join(" ")}\`.`;
|
|
2543
|
-
}
|
|
2544
|
-
function write_targets(sequence) {
|
|
2545
|
-
const paths = sequence.filter((span) => span.label === EDIT_TOOL).map((span) => span.targets[0] ?? "").filter((path6) => path6 !== "" && time_bundle_call.has_extension(path6));
|
|
2546
|
-
return [...new Set(paths)];
|
|
2547
|
-
}
|
|
2548
|
-
function write_fold_directive(sequence) {
|
|
2549
|
-
const paths = write_targets(sequence);
|
|
2550
|
-
if (paths.length < FOLD_MINIMUM) return "";
|
|
2551
|
-
return ` Fold them into one \`pnpm josh edit:files\` call with a plan over: ${paths.join(" ")}.`;
|
|
2552
|
-
}
|
|
2553
|
-
function name_candidates(calls) {
|
|
2554
|
-
if (calls.length === NONE4) return "";
|
|
2555
|
-
const named = calls.map((call) => describe_span(call)).join(", ");
|
|
2556
|
-
const folds = `${read_fold_directive(calls)}${write_fold_directive(calls)}`;
|
|
2557
|
-
return ` Just issued one per turn, so at least these could have shared a turn: ${named}.${folds}`;
|
|
2558
|
-
}
|
|
2559
|
-
function recent_candidates(tail) {
|
|
2560
|
-
return name_candidates(
|
|
2561
|
-
time_bundles.open_sequence(time_spans.parse_timeline(tail).spans).slice(-NAMED_CANDIDATE_COUNT)
|
|
2562
|
-
);
|
|
2563
|
-
}
|
|
2564
|
-
function pairing_candidates(tail, call) {
|
|
2565
|
-
const sequence = time_bundles.open_sequence(time_spans.parse_timeline(tail).spans);
|
|
2566
|
-
if (call === void 0 || sequence.length === NONE4) {
|
|
2567
|
-
return name_candidates(sequence.slice(-NAMED_CANDIDATE_COUNT));
|
|
2568
|
-
}
|
|
2569
|
-
const facts = time_bundle_call.call_facts(call.name, call.input);
|
|
2570
|
-
if (!facts.is_bundleable || depends_on_sequence(sequence, facts)) return "";
|
|
2571
|
-
const current = time_spans.to_tool_call(call.name, call.input, time_spans.NO_MESSAGE_ID);
|
|
2572
|
-
return name_candidates([...sequence.slice(ONE_TURN - NAMED_CANDIDATE_COUNT), current]);
|
|
2573
|
-
}
|
|
2574
|
-
var STAMP_PREFIX = "josh-batch-guard-";
|
|
2575
|
-
var NOTICE_STAMP_PREFIX = "josh-batch-guard-notice-";
|
|
2576
|
-
var time_batch_guard = {
|
|
2577
|
-
CONSECUTIVE_LIMIT,
|
|
2578
|
-
GUARD_LABEL,
|
|
2579
|
-
LANE_NOTICE,
|
|
2580
|
-
NOTICE,
|
|
2581
|
-
NOTICE_REFIRE_EVERY,
|
|
2582
|
-
NOTICE_STAMP_PREFIX,
|
|
2583
|
-
REASON,
|
|
2584
|
-
REFIRE_EVERY,
|
|
2585
|
-
SEQUENCE_BEFORE_LIMIT,
|
|
2586
|
-
STAMP_PREFIX,
|
|
2587
|
-
is_guarded_call,
|
|
2588
|
-
is_notice_call,
|
|
2589
|
-
is_read_only_call,
|
|
2590
|
-
is_search_chain_call: is_search_chain_call2,
|
|
2591
|
-
pairing_candidates,
|
|
2592
|
-
recent_candidates,
|
|
2593
|
-
should_block,
|
|
2594
|
-
should_block_search_chain,
|
|
2595
|
-
should_notify
|
|
2596
|
-
};
|
|
2597
|
-
|
|
2598
30
|
// scripts/build/local-bin.ts
|
|
2599
31
|
import { existsSync, readFileSync } from "node:fs";
|
|
2600
32
|
import { createRequire } from "node:module";
|
|
2601
|
-
import
|
|
33
|
+
import path from "node:path";
|
|
2602
34
|
|
|
2603
35
|
// scripts/lib/pnpm-reach.ts
|
|
2604
36
|
var PNPM = "pnpm";
|
|
@@ -2652,23 +84,23 @@ var WINDOWS_PLATFORM = "win32";
|
|
|
2652
84
|
var WINDOWS_SHIM_SUFFIX = ".cmd";
|
|
2653
85
|
function resolve_local_bin(project_root, bin_name) {
|
|
2654
86
|
const shim = process.platform === WINDOWS_PLATFORM ? `${bin_name}${WINDOWS_SHIM_SUFFIX}` : bin_name;
|
|
2655
|
-
return
|
|
87
|
+
return path.join(project_root, NODE_MODULES, BIN_DIR, shim);
|
|
2656
88
|
}
|
|
2657
89
|
function find_local_bin_upwards(start_directory, bin_name) {
|
|
2658
90
|
return ancestor_directories.list(start_directory).map((directory) => resolve_local_bin(directory, bin_name)).find((candidate) => existsSync(candidate));
|
|
2659
91
|
}
|
|
2660
92
|
function read_bin_entry(manifest_path, package_name, bin_name) {
|
|
2661
93
|
const { bin } = package_bin_schema.parse(JSON.parse(readFileSync(manifest_path, "utf8")));
|
|
2662
|
-
if (typeof bin === "string") return bin_name ===
|
|
94
|
+
if (typeof bin === "string") return bin_name === path.basename(package_name) ? bin : void 0;
|
|
2663
95
|
return bin?.[bin_name];
|
|
2664
96
|
}
|
|
2665
97
|
function resolve_package_bin(base_directory, package_name, bin_name) {
|
|
2666
98
|
try {
|
|
2667
|
-
const resolve_from = createRequire(
|
|
99
|
+
const resolve_from = createRequire(path.join(base_directory, PACKAGE_JSON));
|
|
2668
100
|
const manifest_path = resolve_from.resolve(`${package_name}/${PACKAGE_JSON}`);
|
|
2669
101
|
const bin_entry = read_bin_entry(manifest_path, package_name, bin_name);
|
|
2670
102
|
if (bin_entry === void 0) return void 0;
|
|
2671
|
-
const cli_entry =
|
|
103
|
+
const cli_entry = path.join(path.dirname(manifest_path), bin_entry);
|
|
2672
104
|
return existsSync(cli_entry) ? cli_entry : void 0;
|
|
2673
105
|
} catch {
|
|
2674
106
|
return void 0;
|
|
@@ -2710,41 +142,41 @@ var BASIC_REQUIRED_SUFFIXES = [
|
|
|
2710
142
|
".yml",
|
|
2711
143
|
".toml"
|
|
2712
144
|
];
|
|
2713
|
-
function
|
|
2714
|
-
return paths.map((
|
|
145
|
+
function normalize(paths) {
|
|
146
|
+
return paths.map((path4) => path4.trim()).filter((path4) => path4 !== "");
|
|
2715
147
|
}
|
|
2716
|
-
function is_test_file(
|
|
2717
|
-
return TEST_SUFFIXES.some((suffix) =>
|
|
148
|
+
function is_test_file(path4) {
|
|
149
|
+
return TEST_SUFFIXES.some((suffix) => path4.endsWith(suffix));
|
|
2718
150
|
}
|
|
2719
|
-
function is_basic_manual(
|
|
2720
|
-
const lower =
|
|
151
|
+
function is_basic_manual(path4, is_basic) {
|
|
152
|
+
const lower = path4.toLowerCase();
|
|
2721
153
|
return is_basic && BASIC_REQUIRED_SUFFIXES.every((suffix) => !lower.endsWith(suffix));
|
|
2722
154
|
}
|
|
2723
|
-
function is_basic_visual(
|
|
2724
|
-
const lower =
|
|
155
|
+
function is_basic_visual(path4) {
|
|
156
|
+
const lower = path4.toLowerCase();
|
|
2725
157
|
return BASIC_VISUAL_SUFFIXES.some((suffix) => lower.endsWith(suffix));
|
|
2726
158
|
}
|
|
2727
|
-
function is_exempt(
|
|
2728
|
-
if (EXEMPT_PATHS.includes(
|
|
2729
|
-
return EXEMPT_SUFFIXES.some((suffix) =>
|
|
159
|
+
function is_exempt(path4, is_basic = false) {
|
|
160
|
+
if (EXEMPT_PATHS.includes(path4) || is_basic_manual(path4, is_basic)) return true;
|
|
161
|
+
return EXEMPT_SUFFIXES.some((suffix) => path4.endsWith(suffix)) || EXEMPT_PREFIXES.some((prefix2) => path4.startsWith(prefix2));
|
|
2730
162
|
}
|
|
2731
|
-
function is_runtime(
|
|
2732
|
-
return !is_test_file(
|
|
163
|
+
function is_runtime(path4, is_basic = false) {
|
|
164
|
+
return !is_test_file(path4) && !is_exempt(path4, is_basic);
|
|
2733
165
|
}
|
|
2734
166
|
function verdict_for(paths, is_basic = false) {
|
|
2735
|
-
const changed =
|
|
2736
|
-
if (changed.some((
|
|
2737
|
-
if (changed.some((
|
|
167
|
+
const changed = normalize(paths);
|
|
168
|
+
if (changed.some((path4) => is_test_file(path4))) return "satisfied";
|
|
169
|
+
if (changed.some((path4) => is_runtime(path4, is_basic))) return "required";
|
|
2738
170
|
return "exempt";
|
|
2739
171
|
}
|
|
2740
172
|
function runtime_files(paths, is_basic = false) {
|
|
2741
|
-
return
|
|
173
|
+
return normalize(paths).filter((path4) => is_runtime(path4, is_basic));
|
|
2742
174
|
}
|
|
2743
175
|
function exempt_files(paths, is_basic = false) {
|
|
2744
|
-
return
|
|
176
|
+
return normalize(paths).filter((path4) => is_exempt(path4, is_basic));
|
|
2745
177
|
}
|
|
2746
178
|
function manual_check_files(paths, is_basic) {
|
|
2747
|
-
return
|
|
179
|
+
return normalize(paths).filter((path4) => is_exempt(path4, is_basic) && !is_exempt(path4));
|
|
2748
180
|
}
|
|
2749
181
|
var test_declared_logic = {
|
|
2750
182
|
EXEMPT_PATHS,
|
|
@@ -2837,7 +269,10 @@ var KEYS = {
|
|
|
2837
269
|
measure_absent: { ja: "\u8A08\u6E2C\u5BA3\u8A00\u306A\u3057", en: "No measure declaration" },
|
|
2838
270
|
sample_gate: { ja: "\u5B9F\u65BD\u53EF\u80FD\u6761\u4EF6", en: "Sample gate" },
|
|
2839
271
|
not_before: { ja: "\u5B9F\u65BD\u53EF\u80FD\u65E5", en: "Not before" },
|
|
2840
|
-
source: { ja: "\u51FA\u3069\u3053\u308D", en: "Source" }
|
|
272
|
+
source: { ja: "\u51FA\u3069\u3053\u308D", en: "Source" },
|
|
273
|
+
constraint_source: { ja: "\u51FA\u6240", en: "Constraint source" },
|
|
274
|
+
constraint_reference: { ja: "\u53C2\u7167", en: "Constraint reference" },
|
|
275
|
+
constraint_instruction: { ja: "\u6307\u793A", en: "Constraint instruction" }
|
|
2841
276
|
};
|
|
2842
277
|
var VALUES = {
|
|
2843
278
|
bug: { ja: "\u4E0D\u5177\u5408", en: "defect" },
|
|
@@ -2865,7 +300,8 @@ var HEADINGS = {
|
|
|
2865
300
|
trigger: { ja: "\u767A\u706B\u70B9", en: "Trigger" },
|
|
2866
301
|
baseline: { ja: "\u30D9\u30FC\u30B9\u30E9\u30A4\u30F3", en: "Baseline" },
|
|
2867
302
|
reproduction: { ja: "\u518D\u73FE", en: "Reproduction" },
|
|
2868
|
-
expected_effect: { ja: "\u671F\u5F85\u52B9\u679C", en: "Expected effect" }
|
|
303
|
+
expected_effect: { ja: "\u671F\u5F85\u52B9\u679C", en: "Expected effect" },
|
|
304
|
+
auto_execution_constraint: { ja: "\u81EA\u52D5\u5B9F\u884C\u306E\u5236\u7D04", en: "Automatic execution constraint" }
|
|
2869
305
|
};
|
|
2870
306
|
var SIZE_VALUES = {
|
|
2871
307
|
ja: "\u7D04 <files> \u30D5\u30A1\u30A4\u30EB / <lines> \u884C\uFF08\u30C6\u30B9\u30C8\u9664\u304F\uFF09",
|
|
@@ -2884,14 +320,14 @@ var VALUE_TEXTS = Object.values(VALUES).flatMap((row) => COLUMNS.map((at) => ({
|
|
|
2884
320
|
function column() {
|
|
2885
321
|
return session_language.is_japanese(session_language.resolve_session_lang().lang) ? "ja" : "en";
|
|
2886
322
|
}
|
|
2887
|
-
function
|
|
323
|
+
function text_of(row) {
|
|
2888
324
|
return row[column()];
|
|
2889
325
|
}
|
|
2890
326
|
function key(name) {
|
|
2891
|
-
return
|
|
327
|
+
return text_of(KEYS[name]);
|
|
2892
328
|
}
|
|
2893
329
|
function value(name) {
|
|
2894
|
-
return
|
|
330
|
+
return text_of(VALUES[name]);
|
|
2895
331
|
}
|
|
2896
332
|
function prefix(name) {
|
|
2897
333
|
return `- ${key(name)}:`;
|
|
@@ -2906,16 +342,16 @@ function line_variants(name, value_name) {
|
|
|
2906
342
|
return COLUMNS.map((at) => `- ${KEYS[name][at]}: ${VALUES[value_name][at]}`);
|
|
2907
343
|
}
|
|
2908
344
|
function heading(name) {
|
|
2909
|
-
return `## ${
|
|
345
|
+
return `## ${text_of(HEADINGS[name])}`;
|
|
2910
346
|
}
|
|
2911
347
|
function size_value(files, lines) {
|
|
2912
|
-
return
|
|
348
|
+
return text_of(SIZE_VALUES).replace("<files>", () => files).replace("<lines>", () => lines);
|
|
2913
349
|
}
|
|
2914
|
-
function size_counts(
|
|
2915
|
-
return SIZE_PATTERNS.map((pattern) => pattern.exec(
|
|
350
|
+
function size_counts(text) {
|
|
351
|
+
return SIZE_PATTERNS.map((pattern) => pattern.exec(text)?.groups).find(Boolean);
|
|
2916
352
|
}
|
|
2917
|
-
function row_named(rows,
|
|
2918
|
-
return Object.values(rows).find((row) => COLUMNS.some((at) => row[at] ===
|
|
353
|
+
function row_named(rows, text) {
|
|
354
|
+
return Object.values(rows).find((row) => COLUMNS.some((at) => row[at] === text));
|
|
2919
355
|
}
|
|
2920
356
|
function indent_of(raw) {
|
|
2921
357
|
return raw.slice(0, raw.length - raw.trimStart().length);
|
|
@@ -2923,21 +359,21 @@ function indent_of(raw) {
|
|
|
2923
359
|
function canonical_value(rest) {
|
|
2924
360
|
const trimmed = rest.trimStart();
|
|
2925
361
|
const found = VALUE_TEXTS.find(
|
|
2926
|
-
({ text
|
|
362
|
+
({ text }) => trimmed.startsWith(text) && VALUE_END.test(trimmed.slice(text.length))
|
|
2927
363
|
);
|
|
2928
364
|
if (found === void 0) return rest;
|
|
2929
|
-
return `${indent_of(rest)}${
|
|
365
|
+
return `${indent_of(rest)}${text_of(found.row)}${trimmed.slice(found.text.length)}`;
|
|
2930
366
|
}
|
|
2931
367
|
function canonical_declaration(raw) {
|
|
2932
|
-
const
|
|
2933
|
-
const end =
|
|
2934
|
-
const row = end !== -1 &&
|
|
2935
|
-
return row === void 0 ? void 0 : `${indent_of(raw)}${BULLET}${
|
|
368
|
+
const text = raw.trimStart();
|
|
369
|
+
const end = text.indexOf(KEY_END);
|
|
370
|
+
const row = end !== -1 && text.startsWith(BULLET) ? row_named(KEYS, text.slice(BULLET.length, end)) : void 0;
|
|
371
|
+
return row === void 0 ? void 0 : `${indent_of(raw)}${BULLET}${text_of(row)}${KEY_END}${canonical_value(text.slice(end + 1))}`;
|
|
2936
372
|
}
|
|
2937
373
|
function canonical_heading(raw) {
|
|
2938
|
-
const
|
|
2939
|
-
const row =
|
|
2940
|
-
return row === void 0 ? void 0 : `${indent_of(raw)}${HEADING_PREFIX}${
|
|
374
|
+
const text = raw.trim();
|
|
375
|
+
const row = text.startsWith(HEADING_PREFIX) ? row_named(HEADINGS, text.slice(HEADING_PREFIX.length)) : void 0;
|
|
376
|
+
return row === void 0 ? void 0 : `${indent_of(raw)}${HEADING_PREFIX}${text_of(row)}`;
|
|
2941
377
|
}
|
|
2942
378
|
function canonical_line(raw) {
|
|
2943
379
|
return canonical_heading(raw) ?? canonical_declaration(raw) ?? raw;
|
|
@@ -3675,7 +1111,7 @@ var ISSUE_WRITE_COMMANDS = {
|
|
|
3675
1111
|
},
|
|
3676
1112
|
{
|
|
3677
1113
|
names: ["--label <name>"],
|
|
3678
|
-
description: "an extra label (
|
|
1114
|
+
description: "an extra label (e.g. `epic`). Repeatable. With `josh.worker`, `worker:<name>` names a printed profile."
|
|
3679
1115
|
},
|
|
3680
1116
|
{
|
|
3681
1117
|
names: ["--defect / --verification / --every-run <yes|no|unknown>"],
|
|
@@ -3699,7 +1135,7 @@ var ISSUE_WRITE_COMMANDS = {
|
|
|
3699
1135
|
},
|
|
3700
1136
|
{
|
|
3701
1137
|
names: ["--no-auto-ok"],
|
|
3702
|
-
description: "needs
|
|
1138
|
+
description: "needs human judgement or a verified user prohibition; no `auto-ok`."
|
|
3703
1139
|
},
|
|
3704
1140
|
{
|
|
3705
1141
|
names: ["--release"],
|
|
@@ -4612,17 +2048,25 @@ var RUN_COMMANDS = {
|
|
|
4612
2048
|
},
|
|
4613
2049
|
"run:park": {
|
|
4614
2050
|
script: "scripts/run/park/run-park-cli.ts",
|
|
4615
|
-
description: "Park a lane child for a decision, or clear the park",
|
|
2051
|
+
description: "Park a lane child for a decision or an escalation, or clear the park",
|
|
4616
2052
|
category: "AI tools",
|
|
4617
2053
|
tsx_arguments: OPTIONAL_ENV_FILE_FLAGS,
|
|
4618
|
-
reference: [
|
|
2054
|
+
reference: [
|
|
2055
|
+
"<issue> --body-file <path> | <issue> --clear | <issue> --escalate <reason>",
|
|
2056
|
+
"automation",
|
|
2057
|
+
["files", "network"]
|
|
2058
|
+
],
|
|
4619
2059
|
usage: {
|
|
4620
2060
|
examples: [
|
|
4621
2061
|
{
|
|
4622
2062
|
arguments: "1839 --body-file .josh/tmp/park-1839.md",
|
|
4623
2063
|
note: "options, tiers and a recommendation; then needs-decision, the record, run:release"
|
|
4624
2064
|
},
|
|
4625
|
-
{ arguments: "1839 --clear", note: "remove needs-decision and the record" }
|
|
2065
|
+
{ arguments: "1839 --clear", note: "remove needs-decision and the record" },
|
|
2066
|
+
{
|
|
2067
|
+
arguments: '1839 --escalate "needs a stronger model"',
|
|
2068
|
+
note: "josh.worker.escalate only: run:stalled with the reason, resumed one profile up"
|
|
2069
|
+
}
|
|
4626
2070
|
]
|
|
4627
2071
|
}
|
|
4628
2072
|
},
|
|
@@ -5408,7 +2852,7 @@ var AI_COMMANDS = {
|
|
|
5408
2852
|
description: "Record a lane child's planned files; yield its lane, naming file and holder, when an earlier-planned running lane declares or plans one; `--size-approval` bounds lines/files",
|
|
5409
2853
|
category: "AI tools",
|
|
5410
2854
|
reference: [
|
|
5411
|
-
"<issue> <path>... [--probe] [--single] [--size-approval <json-file>] [--imports <path>...]",
|
|
2855
|
+
"<issue> <path>... [--probe] [--single] [--estimate <json-file>] [--size-approval <json-file>] [--imports <path>...]",
|
|
5412
2856
|
"automation",
|
|
5413
2857
|
["files", "network"]
|
|
5414
2858
|
],
|
|
@@ -5471,7 +2915,7 @@ var AI_COMMANDS = {
|
|
|
5471
2915
|
},
|
|
5472
2916
|
"lane:stats": {
|
|
5473
2917
|
...MEASURE_ARGUMENTS,
|
|
5474
|
-
description: "Print period lane throughput, stage, stop, check and machine-load statistics; --sinks shows stage totals, --over lane chains, --why cause groups above a net-minute threshold, and --pairs scoped pair runs",
|
|
2918
|
+
description: "Print period lane throughput, stage, stop (by failed CI check, longest first), check and machine-load statistics; --sinks shows stage totals, --over lane chains, --why cause groups above a net-minute threshold, and --pairs scoped pair runs",
|
|
5475
2919
|
category: "AI tools",
|
|
5476
2920
|
reference: [
|
|
5477
2921
|
"(--period <days> | --since <instant>) [--limit <lane-limit> | --sinks [<minutes>] | --over <minutes> | --why <minutes> | --pairs]",
|
|
@@ -5638,23 +3082,23 @@ import { availableParallelism as availableParallelism2 } from "node:os";
|
|
|
5638
3082
|
import { availableParallelism } from "node:os";
|
|
5639
3083
|
|
|
5640
3084
|
// scripts/test/unit-lane-count.ts
|
|
5641
|
-
import { readdirSync
|
|
5642
|
-
import
|
|
3085
|
+
import { readdirSync } from "node:fs";
|
|
3086
|
+
import path2 from "node:path";
|
|
5643
3087
|
function is_idle_lane(lanes_root, issue, environment) {
|
|
5644
|
-
const common = git_directory.resolve_git_directory(
|
|
3088
|
+
const common = git_directory.resolve_git_directory(path2.join(lanes_root, issue));
|
|
5645
3089
|
if (common === void 0) return false;
|
|
5646
3090
|
const override = environment[platform_temporary.TEMP_ROOT_KEY];
|
|
5647
3091
|
const state_root = durable_state_root.state_root(override, () => common);
|
|
5648
3092
|
return lane_state_record.is_idle(state_root, common, issue);
|
|
5649
3093
|
}
|
|
5650
3094
|
function own_lane(checkout, environment) {
|
|
5651
|
-
return lane_paths.lane_issue_of(lane_paths.checkout_of(
|
|
3095
|
+
return lane_paths.lane_issue_of(lane_paths.checkout_of(path2.resolve(checkout)), environment);
|
|
5652
3096
|
}
|
|
5653
3097
|
function live_lane_count(checkout = process.cwd(), environment = process.env) {
|
|
5654
3098
|
try {
|
|
5655
3099
|
const lanes_root = lane_paths.lanes_root_of(checkout, environment);
|
|
5656
3100
|
const own = own_lane(checkout, environment);
|
|
5657
|
-
const issues =
|
|
3101
|
+
const issues = readdirSync(lanes_root).filter(
|
|
5658
3102
|
(name) => issue_number_shape.ISSUE_NUMBER_PATTERN.test(name)
|
|
5659
3103
|
);
|
|
5660
3104
|
return issues.filter((issue) => issue === own || !is_idle_lane(lanes_root, issue, environment)).length;
|
|
@@ -5665,8 +3109,8 @@ function live_lane_count(checkout = process.cwd(), environment = process.env) {
|
|
|
5665
3109
|
var unit_lane_count = { live_lane_count };
|
|
5666
3110
|
|
|
5667
3111
|
// scripts/test/unit-run-marker.ts
|
|
5668
|
-
import { readdirSync as
|
|
5669
|
-
import
|
|
3112
|
+
import { readdirSync as readdirSync2 } from "node:fs";
|
|
3113
|
+
import path3 from "node:path";
|
|
5670
3114
|
var RUN_PREFIX = "josh-unit-running-";
|
|
5671
3115
|
var MIN_WORKERS = 1;
|
|
5672
3116
|
var SOLO_RUNS = 1;
|
|
@@ -5684,7 +3128,7 @@ function read_marker(source) {
|
|
|
5684
3128
|
}
|
|
5685
3129
|
function marker_files(directory = PLATFORM_TEMP_ROOT) {
|
|
5686
3130
|
try {
|
|
5687
|
-
return
|
|
3131
|
+
return readdirSync2(directory).filter((name) => name.startsWith(RUN_PREFIX));
|
|
5688
3132
|
} catch {
|
|
5689
3133
|
return [];
|
|
5690
3134
|
}
|
|
@@ -5703,19 +3147,19 @@ function is_marker_live(source) {
|
|
|
5703
3147
|
return false;
|
|
5704
3148
|
}
|
|
5705
3149
|
function live_run_count(directory = PLATFORM_TEMP_ROOT) {
|
|
5706
|
-
return marker_files(directory).filter((name) => is_marker_live(
|
|
3150
|
+
return marker_files(directory).filter((name) => is_marker_live(path3.join(directory, name))).length;
|
|
5707
3151
|
}
|
|
5708
3152
|
var NESTED_KEY = "JOSH_UNIT_RUN_MARKED";
|
|
5709
3153
|
var NESTED_VALUE = "1";
|
|
5710
3154
|
function is_nested_run() {
|
|
5711
3155
|
return process.env[NESTED_KEY] === NESTED_VALUE;
|
|
5712
3156
|
}
|
|
5713
|
-
function resolve_unit_workers(available_cores,
|
|
5714
|
-
if (
|
|
5715
|
-
return Math.max(MIN_WORKERS, Math.floor(available_cores /
|
|
3157
|
+
function resolve_unit_workers(available_cores, runs) {
|
|
3158
|
+
if (runs <= SOLO_RUNS) return void 0;
|
|
3159
|
+
return Math.max(MIN_WORKERS, Math.floor(available_cores / runs));
|
|
5716
3160
|
}
|
|
5717
|
-
function sharing_runs(
|
|
5718
|
-
return Math.max(
|
|
3161
|
+
function sharing_runs(runs, lanes) {
|
|
3162
|
+
return Math.max(runs, lanes);
|
|
5719
3163
|
}
|
|
5720
3164
|
function mark_run_started(target) {
|
|
5721
3165
|
try {
|
|
@@ -5765,13 +3209,13 @@ function cap_to_claim(share, claim) {
|
|
|
5765
3209
|
const bound = Math.max(MIN_WORKERS2, (claim.granted ?? claim.weight) - MAIN_PROCESS_CORES);
|
|
5766
3210
|
return Math.min(share ?? bound, bound);
|
|
5767
3211
|
}
|
|
5768
|
-
function
|
|
3212
|
+
function own_run() {
|
|
5769
3213
|
return is_nested_run2() ? 0 : SOLO_RUNS2;
|
|
5770
3214
|
}
|
|
5771
3215
|
function current_share(available_cores = availableParallelism(), live_runs = live_run_count2(), free = UNREAD_CAPACITY, live_lanes = SOLO_RUNS2) {
|
|
5772
3216
|
const share = resolve_unit_workers2(
|
|
5773
3217
|
available_cores,
|
|
5774
|
-
sharing_runs2(live_runs +
|
|
3218
|
+
sharing_runs2(live_runs + own_run(), live_lanes)
|
|
5775
3219
|
);
|
|
5776
3220
|
return cap_to_capacity(share, free, available_cores);
|
|
5777
3221
|
}
|
|
@@ -5919,8 +3363,8 @@ function lightest_first(items, reserved_cores_of) {
|
|
|
5919
3363
|
return items.toSorted((left, right) => reserved_cores_of(left) - reserved_cores_of(right));
|
|
5920
3364
|
}
|
|
5921
3365
|
function shared_cores(available_cores, concurrent_runs) {
|
|
5922
|
-
const
|
|
5923
|
-
return Math.max(MIN_SHARED_CORES, Math.floor(available_cores /
|
|
3366
|
+
const runs = Number.isFinite(concurrent_runs) ? Math.max(unit_worker_share.SOLO_RUNS, concurrent_runs) : unit_worker_share.SOLO_RUNS;
|
|
3367
|
+
return Math.max(MIN_SHARED_CORES, Math.floor(available_cores / runs));
|
|
5924
3368
|
}
|
|
5925
3369
|
function resolve_concurrency(available_cores, concurrent_runs = unit_worker_share.SOLO_RUNS, checks = LANE_GATE_CHECKS2) {
|
|
5926
3370
|
const share = shared_cores(available_cores, concurrent_runs);
|
|
@@ -6207,6 +3651,7 @@ var TEST_CHECK_COMMANDS = {
|
|
|
6207
3651
|
|
|
6208
3652
|
// scripts/josh/josh-commands-development.ts
|
|
6209
3653
|
var NARROWED = { arguments: "scripts/thing.ts", note: "narrow by the given files instead" };
|
|
3654
|
+
var FORWARDED_TO_VITEST = "flags are forwarded to vitest";
|
|
6210
3655
|
var UNSEEDED = {};
|
|
6211
3656
|
var FILE_ARGUMENTS = "[files...]";
|
|
6212
3657
|
var REQUIRED_FILE_ARGUMENTS = "<files...>";
|
|
@@ -6248,13 +3693,14 @@ var DEV_COMMANDS = {
|
|
|
6248
3693
|
script: "scripts/lint/lint-parallel-main.ts",
|
|
6249
3694
|
description: "Check code with prettier and eslint (skips a tool a basic project lacks)",
|
|
6250
3695
|
category: "Development",
|
|
6251
|
-
reference: ["[--changed]", "developer", ["processes"]],
|
|
3696
|
+
reference: ["[--changed] [--shard=<n>]", "developer", ["processes"]],
|
|
6252
3697
|
core_weight: core_weights.CORE_WEIGHTS.lint,
|
|
6253
3698
|
memory_mb: core_weights.MEMORY_MB.lint,
|
|
6254
3699
|
usage: {
|
|
6255
3700
|
examples: [
|
|
6256
3701
|
{ arguments: "" },
|
|
6257
|
-
{ arguments: "--changed", note: "the branch's changed files \u2014 the gate's form" }
|
|
3702
|
+
{ arguments: "--changed", note: "the branch's changed files \u2014 the gate's form" },
|
|
3703
|
+
{ arguments: "--shard=1", note: "one of two fixed halves of the tree (1 or 2) \u2014 a CI leg" }
|
|
6258
3704
|
]
|
|
6259
3705
|
}
|
|
6260
3706
|
},
|
|
@@ -6322,7 +3768,11 @@ var DEV_COMMANDS = {
|
|
|
6322
3768
|
script: "scripts/rules/rule-value-cli.ts",
|
|
6323
3769
|
description: "Print each delivered rule's unaided compliance \u2014 runs reached, kept rate, refusals",
|
|
6324
3770
|
category: "AI tools",
|
|
6325
|
-
reference: [
|
|
3771
|
+
reference: [
|
|
3772
|
+
"[--fresh | --refresh | --period <days> | --weekly <rule-id>... | --prose]",
|
|
3773
|
+
"developer",
|
|
3774
|
+
["files"]
|
|
3775
|
+
],
|
|
6326
3776
|
usage: {
|
|
6327
3777
|
examples: [
|
|
6328
3778
|
{ arguments: "", note: "a reading cached under 15 minutes ago, else measure" },
|
|
@@ -6331,6 +3781,14 @@ var DEV_COMMANDS = {
|
|
|
6331
3781
|
arguments: "--refresh",
|
|
6332
3782
|
note: "write the reading to the loop-head cache instead of stdout"
|
|
6333
3783
|
},
|
|
3784
|
+
{
|
|
3785
|
+
arguments: "--period 7",
|
|
3786
|
+
note: "measure only the transcripts written in the last 7 days, cache untouched"
|
|
3787
|
+
},
|
|
3788
|
+
{
|
|
3789
|
+
arguments: "--weekly <rule-id>...",
|
|
3790
|
+
note: "reached / refused / rephrased of the named rules, one line per week"
|
|
3791
|
+
},
|
|
6334
3792
|
{ arguments: "--prose", note: "class each prose rule: enforced, measured or prose only" }
|
|
6335
3793
|
]
|
|
6336
3794
|
}
|
|
@@ -6415,7 +3873,9 @@ var DEV_COMMANDS = {
|
|
|
6415
3873
|
category: "Development",
|
|
6416
3874
|
reference: [FILTER_ARGUMENTS, "developer", ["processes"]],
|
|
6417
3875
|
...gate_plan.DIRECT_UNIT_CLAIM,
|
|
6418
|
-
usage: {
|
|
3876
|
+
usage: {
|
|
3877
|
+
examples: [{ arguments: "" }, { arguments: "--shard=1/3", note: FORWARDED_TO_VITEST }]
|
|
3878
|
+
}
|
|
6419
3879
|
},
|
|
6420
3880
|
"test:related": {
|
|
6421
3881
|
script: "scripts/test/test-related-main.ts",
|
|
@@ -6426,8 +3886,8 @@ var DEV_COMMANDS = {
|
|
|
6426
3886
|
examples: [
|
|
6427
3887
|
{ arguments: "" },
|
|
6428
3888
|
NARROWED,
|
|
6429
|
-
{ arguments: "--touched", note: "
|
|
6430
|
-
{ arguments: "--silent", note:
|
|
3889
|
+
{ arguments: "--touched", note: "diff tests, same-named tests and direct test importers" },
|
|
3890
|
+
{ arguments: "--silent", note: FORWARDED_TO_VITEST }
|
|
6431
3891
|
]
|
|
6432
3892
|
}
|
|
6433
3893
|
},
|
|
@@ -6635,7 +4095,7 @@ var LINT_COMMANDS = {
|
|
|
6635
4095
|
script: "scripts/plan/plan-scaffold-cli.ts",
|
|
6636
4096
|
description: "Print a work summary's inputs in one call: the run:prep skeleton, planned files near the line limit, the test:declared verdict, the owed cases and the plan:consumers draft",
|
|
6637
4097
|
category: "AI tools",
|
|
6638
|
-
reference: ["<issue> [<path>...]", "automation", ["network"]],
|
|
4098
|
+
reference: ["<issue> [<path>...] [--estimate <json-file>]", "automation", ["network"]],
|
|
6639
4099
|
usage: {
|
|
6640
4100
|
examples: [
|
|
6641
4101
|
{ arguments: "123", note: "planned files from the issue body" },
|
|
@@ -7005,8 +4465,13 @@ var PROJECT_COMMANDS = {
|
|
|
7005
4465
|
script: "scripts/sync/sync-main.ts",
|
|
7006
4466
|
description: "Sync config files",
|
|
7007
4467
|
category: "Project",
|
|
7008
|
-
reference: ["", "developer", ["files"]],
|
|
7009
|
-
usage: {
|
|
4468
|
+
reference: ["[--force]", "developer", ["files"]],
|
|
4469
|
+
usage: {
|
|
4470
|
+
examples: [
|
|
4471
|
+
{ arguments: "", note: "overwrite managed files" },
|
|
4472
|
+
{ arguments: "--force", note: "also replace a file you added to, dropping your additions" }
|
|
4473
|
+
]
|
|
4474
|
+
}
|
|
7010
4475
|
},
|
|
7011
4476
|
uninstall: {
|
|
7012
4477
|
script: "scripts/uninstall/uninstall.ts",
|
|
@@ -7261,6 +4726,10 @@ var WORKFLOW_COMMANDS = {
|
|
|
7261
4726
|
{
|
|
7262
4727
|
names: [SKIP_COMMIT, SKIP_PUSH],
|
|
7263
4728
|
description: "recover/open a PR without a new commit or push."
|
|
4729
|
+
},
|
|
4730
|
+
{
|
|
4731
|
+
names: ["--body-file <path>"],
|
|
4732
|
+
description: "extra PR body text after `closes #N`, from a file (`-` = stdin); use it when the text holds a backtick or `$`."
|
|
7264
4733
|
}
|
|
7265
4734
|
]
|
|
7266
4735
|
}
|
|
@@ -7538,35 +5007,6 @@ var COMMAND_MAP = {
|
|
|
7538
5007
|
};
|
|
7539
5008
|
|
|
7540
5009
|
export {
|
|
7541
|
-
hook_context,
|
|
7542
|
-
time_hook_transcript,
|
|
7543
|
-
hook_payload_capture,
|
|
7544
|
-
hook_tool_payload,
|
|
7545
|
-
hook_decision,
|
|
7546
|
-
time_bundle_call,
|
|
7547
|
-
CHECK_STATUS_PENDING,
|
|
7548
|
-
CHECK_STATUS_FAIL,
|
|
7549
|
-
read_string,
|
|
7550
|
-
parse_pr_state_snapshot,
|
|
7551
|
-
missing_context_error,
|
|
7552
|
-
blocked_cause,
|
|
7553
|
-
REQUIRED_CHECKS,
|
|
7554
|
-
is_merge_conflict,
|
|
7555
|
-
is_coderabbit_check,
|
|
7556
|
-
is_required_check,
|
|
7557
|
-
collect_blocking_failures,
|
|
7558
|
-
describe_pr_failure,
|
|
7559
|
-
evaluate_pr_state,
|
|
7560
|
-
is_review_decision_decisive,
|
|
7561
|
-
PrConflictError,
|
|
7562
|
-
time_reported_failure,
|
|
7563
|
-
cost_attribute,
|
|
7564
|
-
time_markers,
|
|
7565
|
-
time_transcript_line,
|
|
7566
|
-
time_spans,
|
|
7567
|
-
time_round_trips,
|
|
7568
|
-
time_search_call,
|
|
7569
|
-
time_batch_guard,
|
|
7570
5010
|
test_declared_logic,
|
|
7571
5011
|
pnpm_reach,
|
|
7572
5012
|
package_version_schema,
|