@testmuai/kane-cli 0.10.3 → 0.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ChatSurface-WKYH5MYP.js +2 -0
- package/dist/ChromeProfilePicker-ROQIRMWR.js +2 -0
- package/dist/{CliFeedbackPrompt-JWCTMIGI.js → CliFeedbackPrompt-55OKAT4W.js} +1 -1
- package/dist/{CliUploadProgress-XFRRFRL4.js → CliUploadProgress-NK2U3CKQ.js} +1 -1
- package/dist/{ConfigView-6JF4DOJN.js → ConfigView-7A5JTKLF.js} +1 -1
- package/dist/EvidenceViewOffer-U7J5ZRVK.js +2 -0
- package/dist/FolderPicker-R4QDIFTW.js +2 -0
- package/dist/InfoBox-SRQ4TSUT.js +2 -0
- package/dist/LinksBox-7BWLLQVR.js +2 -0
- package/dist/ProfilesView-TQTJR4WQ.js +2 -0
- package/dist/ProjectPicker-A5SXNDUL.js +2 -0
- package/dist/SaveSessionPrompt-IECYZMXW.js +2 -0
- package/dist/SingleShotApp-MN5IE6EU.js +2 -0
- package/dist/SummaryBox-WFOS6GON.js +2 -0
- package/dist/TestMdRunView-URNSXIVC.js +2 -0
- package/dist/TestrunEvidenceTable-SZPZMW3J.js +2 -0
- package/dist/{WhoamiView-H7JNLLCY.js → WhoamiView-G6QP4SID.js} +1 -1
- package/dist/{app-client-U2YYF65L.js → app-client-2RR5ATI6.js} +1 -1
- package/dist/app-download-UGLDWWTX.js +2 -0
- package/dist/{assurance-job-F4L3T4VJ.js → assurance-job-V5QB36WJ.js} +1 -1
- package/dist/{binary-K3XMILST.js → binary-32FXH6PQ.js} +1 -1
- package/dist/bind-3PB77PWJ.js +2 -0
- package/dist/bootstrap-A2O4UZUJ.js +2 -0
- package/dist/{bridge-2UHJOVLX.js → bridge-SPGIYAAG.js} +1 -1
- package/dist/{catalog-YCU6OHNV.js → catalog-P5IOIVYP.js} +1 -1
- package/dist/{catalog-client-MVEEHTG2.js → catalog-client-LR2KPSU7.js} +1 -1
- package/dist/{changelog-5UB3AQT6.js → changelog-GKIKDJ32.js} +1 -1
- package/dist/chat-committer-7E3TRZ6P.js +2 -0
- package/dist/chat-controller-5ZBG23L6.js +2 -0
- package/dist/child-MNLSG77W.js +2 -0
- package/dist/{chunk-5YYCCM6K.js → chunk-2AHQ3D3D.js} +1 -1
- package/dist/{chunk-UWPG5MWM.js → chunk-2EKLTUY2.js} +1 -1
- package/dist/{chunk-KL7XFNSD.js → chunk-2G7UYQOW.js} +1 -1
- package/dist/{chunk-GXQYFOBD.js → chunk-2MBNAW2G.js} +1 -1
- package/dist/{chunk-Y2HQMJGS.js → chunk-2NP3THOE.js} +1 -1
- package/dist/chunk-37KFCYHG.js +18 -0
- package/dist/{chunk-ZHAMVLQZ.js → chunk-3A4KK22B.js} +1 -1
- package/dist/{chunk-L3BUPFAQ.js → chunk-3CFAE36M.js} +1 -1
- package/dist/{chunk-TU2KPOW2.js → chunk-3DFBFYTD.js} +2 -2
- package/dist/{chunk-QE4AWNOV.js → chunk-3RJRCAUX.js} +6 -6
- package/dist/chunk-3UY4WPMQ.js +8 -0
- package/dist/{chunk-3NWUXRSI.js → chunk-4DM5EWEV.js} +1 -1
- package/dist/{chunk-ZMWTRXFH.js → chunk-4DRFMDAW.js} +1 -1
- package/dist/{chunk-PI7OXS62.js → chunk-5EAJO372.js} +1 -1
- package/dist/{chunk-4KL3TSTT.js → chunk-5K7PCSTP.js} +4 -4
- package/dist/{chunk-HV2CDY4K.js → chunk-5LKDOE3P.js} +1 -1
- package/dist/{chunk-AT7AT3AR.js → chunk-5OFHMBZC.js} +5 -5
- package/dist/{chunk-CQDCNP7V.js → chunk-5ORBAYTU.js} +1 -1
- package/dist/{chunk-2TK4MDF2.js → chunk-63BFLTJI.js} +1 -1
- package/dist/{chunk-BBJAKSA7.js → chunk-642GD7E6.js} +2 -2
- package/dist/{chunk-KKLCXRW6.js → chunk-642LB5R2.js} +1 -1
- package/dist/{chunk-Q4SMITTV.js → chunk-66C5A2F5.js} +1 -1
- package/dist/{chunk-X6FCXBXU.js → chunk-6FVGPKVX.js} +1 -1
- package/dist/{chunk-32HED7X2.js → chunk-6KUUSONE.js} +1 -1
- package/dist/{chunk-6FFX4S7N.js → chunk-6OL5EVRC.js} +1 -1
- package/dist/{chunk-SXBPUUQ5.js → chunk-6PZ3SVWE.js} +1 -1
- package/dist/{chunk-SJQTTEXQ.js → chunk-6VG2FG67.js} +1 -1
- package/dist/chunk-6WN4WSXR.js +2 -0
- package/dist/{chunk-CB2BWDHG.js → chunk-76MKY7FG.js} +4 -4
- package/dist/{chunk-LRNUGKYH.js → chunk-77BZTEHJ.js} +1 -1
- package/dist/chunk-7TSM2FCL.js +5 -0
- package/dist/{chunk-KQ4XKTIZ.js → chunk-A5C7HIAH.js} +1 -1
- package/dist/{chunk-ENRFXGID.js → chunk-ABAUIIPD.js} +1 -1
- package/dist/{chunk-JTNEF5ZP.js → chunk-AL6IAMYV.js} +1 -1
- package/dist/{chunk-4CJQ7XZP.js → chunk-AXOSLGQ4.js} +1 -1
- package/dist/{chunk-CNHKZE4F.js → chunk-BDZWRJAL.js} +1 -1
- package/dist/{chunk-VCVEZEVS.js → chunk-BFRWZPIK.js} +1 -1
- package/dist/{chunk-IZ66FKPC.js → chunk-BIGOLVK6.js} +1 -1
- package/dist/{chunk-Q4ALB7SH.js → chunk-BLHFNL5K.js} +1 -1
- package/dist/chunk-BRWCWZE3.js +2 -0
- package/dist/{chunk-X7S7IGCV.js → chunk-BXJNL22L.js} +1 -1
- package/dist/chunk-BZEW7CSM.js +3 -0
- package/dist/{chunk-Z24SD2EJ.js → chunk-C3DMMAFP.js} +1 -1
- package/dist/{chunk-DQXQJJOP.js → chunk-C466XER3.js} +2 -2
- package/dist/{chunk-BLVDV3QQ.js → chunk-C4UME2PA.js} +1 -1
- package/dist/chunk-CBEMXSWF.js +2 -0
- package/dist/{chunk-6QCCTZO3.js → chunk-CBPACEYQ.js} +1 -1
- package/dist/{chunk-MD3RABID.js → chunk-CJGQFKLJ.js} +1 -1
- package/dist/{chunk-YVVFXBT5.js → chunk-CQBLJTDU.js} +1 -1
- package/dist/{chunk-X2MDL6S4.js → chunk-CVVUBCB7.js} +1 -1
- package/dist/{chunk-35BG2EMW.js → chunk-E3C4OWSD.js} +1 -1
- package/dist/{chunk-ERRIDBE7.js → chunk-EIQSXD7B.js} +1 -1
- package/dist/{chunk-YPGZ5E4I.js → chunk-EP4WGGMY.js} +1 -1
- package/dist/{chunk-GAKBHNC4.js → chunk-EUGFABAS.js} +1 -1
- package/dist/{chunk-HBLHKQR7.js → chunk-F4GWIX66.js} +1 -1
- package/dist/{chunk-SALZ6WSF.js → chunk-F4XCCOWC.js} +1 -1
- package/dist/{chunk-NHGPMYM3.js → chunk-FHULYIG3.js} +1 -1
- package/dist/{chunk-7RELCXRW.js → chunk-FKA5SWWF.js} +1 -1
- package/dist/{chunk-OCVDMZWB.js → chunk-FLGOQ6Q6.js} +1 -1
- package/dist/{chunk-YILRYMMG.js → chunk-FNBHP75S.js} +1 -1
- package/dist/{chunk-JBKHX5ES.js → chunk-FOURJ24E.js} +1 -1
- package/dist/{chunk-DC5F2ADJ.js → chunk-FOUUD3LI.js} +1 -1
- package/dist/{chunk-IEHJG6J4.js → chunk-FP6JCXOS.js} +1 -1
- package/dist/{chunk-ZDCXWEQG.js → chunk-GRQKMOKE.js} +1 -1
- package/dist/{chunk-XKOVEMVZ.js → chunk-H23ZMHHC.js} +1 -1
- package/dist/{chunk-E4GIGM5V.js → chunk-H6IPGZTP.js} +1 -1
- package/dist/{chunk-MINDIQET.js → chunk-HBGYEA3O.js} +1 -1
- package/dist/{chunk-KBGMQYMD.js → chunk-HHF7AM3D.js} +1 -1
- package/dist/{chunk-PCQK62MP.js → chunk-HTJDMLZS.js} +1 -1
- package/dist/{chunk-ZPU3WAC4.js → chunk-HY5BBSYX.js} +1 -1
- package/dist/{chunk-TM6VLC6V.js → chunk-IPIARGHE.js} +1 -1
- package/dist/{chunk-M2E5CPPV.js → chunk-IPXITNFD.js} +1 -1
- package/dist/{chunk-NI3TIAD7.js → chunk-IT6M7OMG.js} +1 -1
- package/dist/{chunk-Y3RJHWNK.js → chunk-ITG5WMQG.js} +1 -1
- package/dist/{chunk-WEJR2V7R.js → chunk-J3XOEMKO.js} +1 -1
- package/dist/{chunk-OHGL4GEJ.js → chunk-J3YID4A5.js} +1 -1
- package/dist/{chunk-OCMPWCKQ.js → chunk-J44FV6CH.js} +1 -1
- package/dist/{chunk-3MD2XLE7.js → chunk-J5D4IGAM.js} +9 -8
- package/dist/{chunk-6QH75BPJ.js → chunk-J5QFO7LW.js} +1 -1
- package/dist/{chunk-GJXO6FF7.js → chunk-JBUKEIYL.js} +1 -1
- package/dist/{chunk-EJGCIGQY.js → chunk-JGQ3VB44.js} +1 -1
- package/dist/{chunk-GEZVC4S3.js → chunk-JM6AKCN4.js} +1 -1
- package/dist/{chunk-3KY7HHQU.js → chunk-JSSM2TWY.js} +1 -1
- package/dist/{chunk-3ZC7GSMM.js → chunk-JVXEAO62.js} +1 -1
- package/dist/{chunk-TM45NPWL.js → chunk-JYH7CTF7.js} +1 -1
- package/dist/{chunk-YNDELIXL.js → chunk-JZ7GFPKZ.js} +1 -1
- package/dist/{chunk-CTHUX7O4.js → chunk-KUSHV5SR.js} +1 -1
- package/dist/{chunk-LTPOMMAB.js → chunk-LB5NIDW6.js} +1 -1
- package/dist/{chunk-SIHX5FW5.js → chunk-LJKTIKZY.js} +1 -1
- package/dist/{chunk-LPJKNX6D.js → chunk-LMOW4NM5.js} +1 -1
- package/dist/{chunk-WIVKLNIO.js → chunk-LPJX5L3F.js} +1 -1
- package/dist/{chunk-HRIDAK6Y.js → chunk-LWP7E5FU.js} +1 -1
- package/dist/{chunk-YWWVF5OU.js → chunk-LXYXCANZ.js} +1 -1
- package/dist/{chunk-35WUYKGO.js → chunk-MAQVRBUQ.js} +1 -1
- package/dist/{chunk-NPAUSUNM.js → chunk-MBNSCXVK.js} +1 -1
- package/dist/{chunk-ZMIKNNO6.js → chunk-MIQ6J5YG.js} +1 -1
- package/dist/chunk-MTMHB5LF.js +2 -0
- package/dist/{chunk-RNHSULQM.js → chunk-MUL2QFG2.js} +1 -1
- package/dist/{chunk-MEBEVHGP.js → chunk-N4XUGIAK.js} +1 -1
- package/dist/{chunk-GQAWZEA4.js → chunk-NAUIJF72.js} +1 -1
- package/dist/{chunk-PB6RXDWQ.js → chunk-NFDVDEOH.js} +2 -2
- package/dist/{chunk-LHJSIHLC.js → chunk-NGBXXBHP.js} +1 -1
- package/dist/{chunk-YCVEI7BT.js → chunk-NIBNVPAE.js} +1 -1
- package/dist/chunk-NKJRAQ6L.js +6 -0
- package/dist/{chunk-OZNYQONA.js → chunk-NNVHWFLI.js} +3 -3
- package/dist/{chunk-7SU53QGU.js → chunk-NZ7UCAN6.js} +1 -1
- package/dist/{chunk-7V34ZMMS.js → chunk-OKCVG7AG.js} +1 -1
- package/dist/{chunk-LZGAFKYH.js → chunk-OMCJD4LH.js} +1 -1
- package/dist/{chunk-VO2NNXKR.js → chunk-OPR5XIPT.js} +1 -1
- package/dist/{chunk-EZMRWXRT.js → chunk-OVB5GVRB.js} +1 -1
- package/dist/{chunk-LV7224DG.js → chunk-PCL2FYPE.js} +1 -1
- package/dist/{chunk-AVLYSNEG.js → chunk-PE3CEG6E.js} +1 -1
- package/dist/{chunk-MEMXFTLD.js → chunk-PEHVBCXM.js} +1 -1
- package/dist/{chunk-6HRNG4CK.js → chunk-PKXWYYVK.js} +1 -1
- package/dist/{chunk-YQZ736IQ.js → chunk-PSBR2LVL.js} +1 -1
- package/dist/{chunk-R6TFRAMZ.js → chunk-PUNFWBRW.js} +1 -1
- package/dist/{chunk-7Y55CO42.js → chunk-PZOQ2IQK.js} +1 -1
- package/dist/{chunk-SMGRXKXX.js → chunk-Q4QCSO6Y.js} +1 -1
- package/dist/{chunk-TUSG7DIL.js → chunk-QJ5XHVS5.js} +1 -1
- package/dist/{chunk-TAY7J5VS.js → chunk-QLGQDNA3.js} +1 -1
- package/dist/{chunk-QEM5ZRDN.js → chunk-QRUAI2ST.js} +1 -1
- package/dist/{chunk-C4KAPGBS.js → chunk-QWEQ742S.js} +3 -3
- package/dist/{chunk-Z47ZEFH7.js → chunk-R6S4EJ5R.js} +1 -1
- package/dist/{chunk-WE7HRAGO.js → chunk-RHQLDNZL.js} +1 -1
- package/dist/{chunk-3RO2YGKH.js → chunk-RM5ZVDVR.js} +1 -1
- package/dist/{chunk-N7IWR45S.js → chunk-RU3SWHRE.js} +1 -1
- package/dist/{chunk-OBNVGD5H.js → chunk-S5UITUBB.js} +1 -1
- package/dist/chunk-SACFQNUH.js +47 -0
- package/dist/{chunk-X45RZIAJ.js → chunk-SDIHDYWT.js} +1 -1
- package/dist/{chunk-AHT2ORJT.js → chunk-SFHDRKUX.js} +1 -1
- package/dist/{chunk-OTMHCHH6.js → chunk-SLISNOG6.js} +1 -1
- package/dist/{chunk-T77LTLAD.js → chunk-SULRMI2J.js} +1 -1
- package/dist/{chunk-OOGKX4Y6.js → chunk-TC2PHBPH.js} +1 -1
- package/dist/{chunk-HVOXMCKE.js → chunk-TCK7WR3M.js} +1 -1
- package/dist/{chunk-FOLUB336.js → chunk-TFSWG7AS.js} +1 -1
- package/dist/{chunk-PRBWZXFA.js → chunk-TOOJTCON.js} +6 -6
- package/dist/chunk-TPCW5OU5.js +3 -0
- package/dist/chunk-U5V3L5QH.js +2 -0
- package/dist/{chunk-LXK4B2FE.js → chunk-UJYC2XDD.js} +1 -1
- package/dist/chunk-UV7FPIBL.js +2 -0
- package/dist/{chunk-23DKB2MT.js → chunk-UVL6XQHU.js} +1 -1
- package/dist/{chunk-M7A66MSK.js → chunk-UWEBI76C.js} +1 -1
- package/dist/{chunk-PTLOOVV4.js → chunk-UWQ4KXLB.js} +1 -1
- package/dist/{chunk-ZCBOHWN3.js → chunk-V24LUINK.js} +1 -1
- package/dist/{chunk-ND6OP3O2.js → chunk-V3IWCGZT.js} +1 -1
- package/dist/{chunk-YDB72F4K.js → chunk-V4SL74TK.js} +1 -1
- package/dist/chunk-VEE2O524.js +34 -0
- package/dist/{chunk-VKVYT6KZ.js → chunk-VJRXJJML.js} +2 -2
- package/dist/{chunk-NRAPCFI2.js → chunk-VKIUHHNT.js} +2 -2
- package/dist/{chunk-QHH42RH5.js → chunk-W3PQMIXE.js} +1 -1
- package/dist/{chunk-LLQWEGXD.js → chunk-W5EDS4DF.js} +1 -1
- package/dist/{chunk-LUA25RYS.js → chunk-WAC5WISH.js} +1 -1
- package/dist/{chunk-W54BX6HC.js → chunk-WCIRLITM.js} +1 -1
- package/dist/chunk-WMXBRC4B.js +21 -0
- package/dist/{chunk-RQKMSNEU.js → chunk-WTMCDYR3.js} +1 -1
- package/dist/{chunk-DXIQVBMI.js → chunk-WZ3FE5MT.js} +1 -1
- package/dist/{chunk-GLM5UGTF.js → chunk-X66NIHT4.js} +1 -1
- package/dist/{chunk-B7ZX5HEN.js → chunk-XDAFRUAJ.js} +1 -1
- package/dist/{chunk-JNPFEBUR.js → chunk-XDAHKZ4J.js} +1 -1
- package/dist/chunk-XJV5SF3X.js +26 -0
- package/dist/{chunk-ZCL7XIVS.js → chunk-XKJZG4GR.js} +1 -1
- package/dist/{chunk-EBJW6POT.js → chunk-XRJH4UF3.js} +1 -1
- package/dist/chunk-XTQUCCJH.js +2 -0
- package/dist/chunk-Y3RDLUH5.js +7 -0
- package/dist/{chunk-SVIIUKJ2.js → chunk-Y7GSOKXS.js} +1 -1
- package/dist/{chunk-UJ37XGSP.js → chunk-YF22VTR5.js} +3 -3
- package/dist/chunk-YIBLZIXF.js +13 -0
- package/dist/{chunk-2JFRN62I.js → chunk-YLI7DQMJ.js} +2 -2
- package/dist/chunk-YQXOD7SV.js +102 -0
- package/dist/{chunk-4UX5N7YI.js → chunk-YTWBNACA.js} +1 -1
- package/dist/{chunk-KCXLRR3Q.js → chunk-YUFXE6WU.js} +1 -1
- package/dist/{chunk-SSOUYKVG.js → chunk-ZIRSTOEV.js} +1 -1
- package/dist/command-span-HZSKIZH7.js +2 -0
- package/dist/commands-TRAUFCRZ.js +2 -0
- package/dist/{committer-UO3B3S5Y.js → committer-L2HXEODA.js} +1 -1
- package/dist/{config-7WTZPMAH.js → config-O3BWQUP4.js} +1 -1
- package/dist/cover-cmd-SAWVP7TL.js +2 -0
- package/dist/{credentials-5WIFF5DG.js → credentials-NNNODDXF.js} +1 -1
- package/dist/{deps-bundle-BLLJ2BQ4.js → deps-bundle-CXKBCA7W.js} +1 -1
- package/dist/{deps-resolve-WQ6J6RLI.js → deps-resolve-K7XNTRZX.js} +1 -1
- package/dist/design-chat-S4KYE6PP.js +2 -0
- package/dist/{design-committer-7YIPFKMO.js → design-committer-ZKNW5LUS.js} +1 -1
- package/dist/design-headless-DDAFAJNR.js +2 -0
- package/dist/design-remote-UITWJ72Q.js +3 -0
- package/dist/device-env-SBTHFSVK.js +2 -0
- package/dist/dispatch-BGH5PVZ4.js +2 -0
- package/dist/doctor-SRMLENYN.js +2 -0
- package/dist/{docx-convert-DO5AQYD3.js → docx-convert-PA5S2S7P.js} +1 -1
- package/dist/{dossier-5XKNAK6Q.js → dossier-B6KBSRJY.js} +1 -1
- package/dist/evidence-FOWW3MOS.js +2 -0
- package/dist/evolve-cmd-MDK2H4JY.js +2 -0
- package/dist/evolve-remote-4G7YFC5H.js +2 -0
- package/dist/exit-manager-UZ7DGXS4.js +2 -0
- package/dist/{explain-cmd-KNDORU2D.js → explain-cmd-A5YMPXAJ.js} +1 -1
- package/dist/explain-cmd-Q4NLNJFB.js +12 -0
- package/dist/explore-MWUMVGRM.js +2 -0
- package/dist/explore-context-tty-QLMZGYBX.js +2 -0
- package/dist/explore-entry-QMCVGRP4.js +6 -0
- package/dist/{explore-live-XIWWUV52.js → explore-live-QIET6WO4.js} +1 -1
- package/dist/{explore-run-tty-M56I23IF.js → explore-run-tty-6UTBRCEF.js} +2 -2
- package/dist/{extract-bind-LZ22VFKB.js → extract-bind-UTERWZMW.js} +3 -3
- package/dist/extract-chat-4WBNRVPG.js +2 -0
- package/dist/{extract-cmd-46E2XDWZ.js → extract-cmd-SYZX6CML.js} +2 -2
- package/dist/extract-headless-QBF77JWP.js +2 -0
- package/dist/{feeder-NGWIPZ26.js → feeder-VAY4NYBX.js} +1 -1
- package/dist/folder-flags-IJ556UET.js +2 -0
- package/dist/gaps-cmd-E55OGZ7P.js +3 -0
- package/dist/gate-5UIJVMHL.js +2 -0
- package/dist/gate-VJ7W5QIH.js +2 -0
- package/dist/{generate-headless-HXAVEAEZ.js → generate-headless-VYD2QIUO.js} +3 -3
- package/dist/hold-passthrough-ZHOC2Q26.js +2 -0
- package/dist/identity-66TGWITQ.js +2 -0
- package/dist/{impact-cmd-TJTUFAFO.js → impact-cmd-3P6SKFJC.js} +2 -2
- package/dist/index.js +185 -184
- package/dist/ingest-6UQGSQYU.js +2 -0
- package/dist/ingest-cmd-HMTLO5MB.js +8 -0
- package/dist/ingest-remote-NIW5VAGW.js +2 -0
- package/dist/install-KJDAGU2R.js +2 -0
- package/dist/{interactive-bind-SOD7VTAY.js → interactive-bind-K3ZQFHLH.js} +4 -4
- package/dist/{interactive-remote-7ZSTI66T.js → interactive-remote-SGM76D6M.js} +2 -2
- package/dist/lane-EHU4JRRU.js +2 -0
- package/dist/lattice-auth-DCAVEQKY.js +2 -0
- package/dist/lifecycle-cmd-Y5DH2PL5.js +2 -0
- package/dist/list-cmd-RYHICCUV.js +3 -0
- package/dist/list-commands-QFTIQE6Q.js +2 -0
- package/dist/{list-remote-EFCET42K.js → list-remote-PWAQBF57.js} +1 -1
- package/dist/{locks-cmd-AZKCSGHI.js → locks-cmd-76IU4JB7.js} +1 -1
- package/dist/{logical-ids-74PLU3VR.js → logical-ids-YMNV2MDB.js} +1 -1
- package/dist/login-flow-W7RAVXSD.js +2 -0
- package/dist/maintenance-cmd-JNP2KCSI.js +2 -0
- package/dist/mobile-prompts-SP2RULD7.js +2 -0
- package/dist/onboarding-YPIKXNYA.js +5 -0
- package/dist/open-provider-LXCPVNUU.js +2 -0
- package/dist/{pdf-convert-YB6PJFMI.js → pdf-convert-N2C3KB4Q.js} +1 -1
- package/dist/persist-recorded-session-BWGA7WXR.js +3 -0
- package/dist/phase-seed-G5JSYKSL.js +2 -0
- package/dist/pipeline-YE4IRKQX.js +2 -0
- package/dist/{policy-commands-4PUGESCW.js → policy-commands-MSJIPHDB.js} +1 -1
- package/dist/prepare-target-G7LU4LYX.js +2 -0
- package/dist/pull-cmd-G3PVSSFP.js +2 -0
- package/dist/pull-route-5JQUUSU7.js +2 -0
- package/dist/readmodel-FARAAPUU.js +2 -0
- package/dist/real-device-run-425XK527.js +2 -0
- package/dist/reconcile-cmd-QJBYZVUB.js +5 -0
- package/dist/reconcile-deps-TILDRCHG.js +2 -0
- package/dist/{reconcile-remote-3W6ZTO3G.js → reconcile-remote-JMV26DLX.js} +2 -2
- package/dist/recording-banner-VZ67EWWQ.js +2 -0
- package/dist/registry-3YMKU5GC.js +2 -0
- package/dist/remote-entry-6LQRYR5F.js +2 -0
- package/dist/remote-mode-35BQUMEL.js +4 -0
- package/dist/remote-words-QXVFVHOB.js +2 -0
- package/dist/{require-project-folder-3DTI2CVB.js → require-project-folder-O2XCXDRE.js} +1 -1
- package/dist/resolve-run-intent-QCRZPYXM.js +2 -0
- package/dist/{resolver-CDF7QKVD.js → resolver-LWXOB7PH.js} +1 -1
- package/dist/revert-F6MKJ73M.js +2 -0
- package/dist/review-cmd-PYU7YCAC.js +5 -0
- package/dist/run-EABFRFOF.js +2 -0
- package/dist/run-LX3ARF53.js +2 -0
- package/dist/run-remote-PS45MTHW.js +2 -0
- package/dist/run-startup-gate-YBQB2JLF.js +2 -0
- package/dist/run-test-md-XYOCVA6F.js +20 -0
- package/dist/session-worker.js +2 -2
- package/dist/{sessions-cmd-TLUITRG5.js → sessions-cmd-WUWZYZJW.js} +2 -2
- package/dist/{sessions-remote-INO7AWKB.js → sessions-remote-4J7ITZB4.js} +1 -1
- package/dist/{skill-installer-7JH5QCJF.js → skill-installer-54ZAFNOB.js} +1 -1
- package/dist/store-2F26FIUS.js +2 -0
- package/dist/store-choice-ZE7AZMRC.js +2 -0
- package/dist/store-guard-X5FIEZWZ.js +2 -0
- package/dist/{store-site-K5NHLI7D.js → store-site-AFXB6SBW.js} +1 -1
- package/dist/{stream-warnings-GM7YEOVG.js → stream-warnings-I5LUWVFU.js} +1 -1
- package/dist/support-id-RISKXA53.js +2 -0
- package/dist/sync-cmd-TAVE44DU.js +2 -0
- package/dist/sync-setup-M65RX34Y.js +2 -0
- package/dist/tcg-generate-OXZF7TNQ.js +2 -0
- package/dist/{test-definition-53XNBEDE.js → test-definition-GXEKFRRB.js} +1 -1
- package/dist/testmd-actions-4OHRME2Z.js +2 -0
- package/dist/{testmd-sync-LYHEXWCT.js → testmd-sync-HM24JCS7.js} +1 -1
- package/dist/token-refresh-3SEDPIXO.js +2 -0
- package/dist/{use-case-ref-44BPIP4N.js → use-case-ref-E3PJDHQB.js} +1 -1
- package/dist/{validate-basic-66XDPA3S.js → validate-basic-HWDR665U.js} +1 -1
- package/dist/verdicts-KB6YTIY6.js +2 -0
- package/dist/{version-check-SHNVYTMU.js → version-check-DRE5KT7F.js} +1 -1
- package/dist/{view-cmd-QOB3O6YW.js → view-cmd-3UKV3YEX.js} +1 -1
- package/dist/walk-session-W6OLG5NT.js +2 -0
- package/dist/with-telemetry-BF4BGK5S.js +2 -0
- package/package.json +11 -11
- package/dist/ChatSurface-Z26BOE5U.js +0 -2
- package/dist/ChromeProfilePicker-ODRIAXL3.js +0 -2
- package/dist/EvidenceViewOffer-6344EX74.js +0 -2
- package/dist/FolderPicker-4PCYHE75.js +0 -2
- package/dist/InfoBox-NJ2DL7YC.js +0 -2
- package/dist/LinksBox-HNDNFVUT.js +0 -2
- package/dist/ProfilesView-DEJKJOHY.js +0 -2
- package/dist/ProjectPicker-DTWMWOH7.js +0 -2
- package/dist/SaveSessionPrompt-3GCLB3ZT.js +0 -2
- package/dist/SingleShotApp-HMOXO5DW.js +0 -2
- package/dist/SummaryBox-7PPDMSSM.js +0 -2
- package/dist/TestMdRunView-QLKRUU4V.js +0 -2
- package/dist/TestrunEvidenceTable-T2JUB4TE.js +0 -2
- package/dist/app-download-GKRF2EIM.js +0 -2
- package/dist/bind-SSHAZAB3.js +0 -2
- package/dist/bootstrap-XGKU4WXB.js +0 -2
- package/dist/chat-committer-ZKEKJA2R.js +0 -2
- package/dist/chat-controller-FXRJXUG3.js +0 -2
- package/dist/child-JHYENXE7.js +0 -2
- package/dist/chunk-2RBMQTYS.js +0 -26
- package/dist/chunk-5F5IVART.js +0 -8
- package/dist/chunk-6SD4XTYC.js +0 -6
- package/dist/chunk-7YV2FCN4.js +0 -3
- package/dist/chunk-A2DODRHG.js +0 -2
- package/dist/chunk-BJO6J5X2.js +0 -3
- package/dist/chunk-DIOK3SER.js +0 -34
- package/dist/chunk-DREQ3RAA.js +0 -2
- package/dist/chunk-HC6VLPUB.js +0 -5
- package/dist/chunk-J4FIESTB.js +0 -2
- package/dist/chunk-NZJSGINB.js +0 -47
- package/dist/chunk-SXRHKXSE.js +0 -2
- package/dist/chunk-UJLULWSR.js +0 -21
- package/dist/chunk-ULIIYKZB.js +0 -7
- package/dist/chunk-UXGMKRS4.js +0 -102
- package/dist/chunk-VO66KP2W.js +0 -2
- package/dist/chunk-X52YIWGG.js +0 -13
- package/dist/chunk-ZIHQ5JGB.js +0 -18
- package/dist/commands-JBFLLT7A.js +0 -2
- package/dist/cover-cmd-DU6ZYJFL.js +0 -2
- package/dist/design-chat-ZICGVYIH.js +0 -2
- package/dist/design-headless-HYWZIIDS.js +0 -2
- package/dist/design-remote-HPX4VZ63.js +0 -3
- package/dist/device-env-4P4GUVBW.js +0 -2
- package/dist/dispatch-BV6XMCN3.js +0 -2
- package/dist/doctor-Z2YQ2DBX.js +0 -2
- package/dist/evidence-BJIID6VT.js +0 -2
- package/dist/evolve-cmd-GZCUSCEK.js +0 -2
- package/dist/evolve-remote-LILOAHYH.js +0 -2
- package/dist/exit-manager-EGWAZHCR.js +0 -2
- package/dist/explain-cmd-LXIVHGN7.js +0 -12
- package/dist/explore-SA2P3SGX.js +0 -2
- package/dist/explore-context-tty-PERKIWXD.js +0 -2
- package/dist/explore-entry-E6EY3VV3.js +0 -6
- package/dist/extract-chat-Z64LEAJ5.js +0 -2
- package/dist/extract-headless-XLS56LMN.js +0 -2
- package/dist/folder-flags-ZIDJVDKX.js +0 -2
- package/dist/gaps-cmd-XYOBJVTO.js +0 -3
- package/dist/gate-AK44VDHC.js +0 -2
- package/dist/gate-NB5CJMTN.js +0 -2
- package/dist/hold-passthrough-JGHWMYDM.js +0 -2
- package/dist/identity-HL5CJJXR.js +0 -2
- package/dist/ingest-ZHHHBUXR.js +0 -2
- package/dist/ingest-cmd-OJSKTSQK.js +0 -8
- package/dist/ingest-remote-2WM6PYUW.js +0 -2
- package/dist/install-JBWBF3WX.js +0 -2
- package/dist/lane-CNGO7LH5.js +0 -2
- package/dist/lattice-auth-UQPFQSG7.js +0 -2
- package/dist/lifecycle-cmd-DGIO3VAO.js +0 -2
- package/dist/list-cmd-HQIN3HX4.js +0 -3
- package/dist/list-commands-OFRRBU3D.js +0 -2
- package/dist/login-flow-SYKXXDLH.js +0 -2
- package/dist/maintenance-cmd-X5247RSJ.js +0 -2
- package/dist/mobile-prompts-I66ENBDW.js +0 -2
- package/dist/onboarding-6HIP3KW6.js +0 -5
- package/dist/open-provider-XDJKT3W3.js +0 -2
- package/dist/persist-recorded-session-RSSMTVF3.js +0 -3
- package/dist/phase-seed-ZZSJME7M.js +0 -2
- package/dist/pipeline-NTJDH5TC.js +0 -2
- package/dist/prepare-target-AI3GGZF6.js +0 -2
- package/dist/pull-cmd-NRVB5ZN7.js +0 -2
- package/dist/pull-route-FWCZW76M.js +0 -2
- package/dist/readmodel-TRV4E3MW.js +0 -2
- package/dist/real-device-run-NQ7RNH7C.js +0 -2
- package/dist/reconcile-cmd-7B7THAFJ.js +0 -5
- package/dist/reconcile-deps-UDQBWSLE.js +0 -2
- package/dist/recording-banner-WVDTWTSE.js +0 -2
- package/dist/registry-PFOSXOIH.js +0 -2
- package/dist/remote-entry-BZU4NFNS.js +0 -2
- package/dist/remote-mode-NXUKDUXG.js +0 -4
- package/dist/remote-words-JRDDNOZ6.js +0 -2
- package/dist/resolve-run-intent-QCL7QXIB.js +0 -2
- package/dist/revert-QKHPCRT6.js +0 -2
- package/dist/review-cmd-XBK3TGRE.js +0 -5
- package/dist/run-CSYGVV3D.js +0 -2
- package/dist/run-YUHHD54J.js +0 -2
- package/dist/run-remote-SFR3F2T5.js +0 -2
- package/dist/run-startup-gate-QSFJRYUY.js +0 -2
- package/dist/run-test-md-ZSREINDQ.js +0 -20
- package/dist/store-X4UK4AP7.js +0 -2
- package/dist/store-choice-27HDIFTU.js +0 -2
- package/dist/store-guard-ZXKB5DQH.js +0 -2
- package/dist/sync-cmd-2PCO7LZA.js +0 -2
- package/dist/sync-setup-5WQO73Y5.js +0 -2
- package/dist/tcg-generate-DGJD5KSM.js +0 -2
- package/dist/testmd-actions-XE2JPQHB.js +0 -2
- package/dist/token-refresh-E4FTJVHY.js +0 -2
- package/dist/verdicts-PVB7TV5S.js +0 -2
- package/dist/walk-session-WIEROYOT.js +0 -2
- package/dist/with-telemetry-T2PWI5CY.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as Tr}from"./chunk-6QH75BPJ.js";import{a as dn,c as mn,e as Et,f as Je,g as $r,h as Rr,i as gn,j as Cr}from"./chunk-XKOVEMVZ.js";import{a as St,b as un}from"./chunk-JTNEF5ZP.js";import{a as ln,b as wr}from"./chunk-EJGCIGQY.js";import{a as xr,b as kr,c as vr}from"./chunk-YWWVF5OU.js";import{a as pr,b as ue}from"./chunk-YILRYMMG.js";import{a as dr}from"./chunk-5Y2G4NC7.js";import{c as Rt}from"./chunk-SMXABALN.js";import{b as fr}from"./chunk-WN5VKKJ3.js";import{b as fn}from"./chunk-HD6NR44L.js";import{a as Ct,b as an,c as Ye,d as yr,e as cn}from"./chunk-BWXLZS5O.js";import{e as ze,f as S,g as br}from"./chunk-LRNUGKYH.js";import{b as gr,c as Ge,d as hr}from"./chunk-22PIMG52.js";import{na as mr,oa as on}from"./chunk-PI7OXS62.js";import{a as ur}from"./chunk-ND6OP3O2.js";import{a as Y}from"./chunk-HCBYKLMW.js";import{a as w,b as r,k as Me}from"./chunk-33DWJV67.js";import{a as cr}from"./chunk-6YGTRKDT.js";import{z as o}from"./chunk-J4FIESTB.js";import{e as U}from"./chunk-UR6MHSHU.js";var bn=U(cr(),1);var g=U(cr(),1);var m=U(Y(),1),Wi=60,Vi=100;function hn(e,s){let c=e.options.length,f=c,p=e.multi_select?f++:null,a=e.allow_free_text?f++:null,u=s?f++:null;return{optionCount:c,doneIdx:p,freeIdx:a,batchIdx:u,maxSel:f-1}}var Ki="\xA0",Ui={high:{text:`\u203C${Ki}high`,color:o.red},med:{text:"med",color:"yellow"},low:{text:"low",color:o.dim}};function Hi(e){let s=(e.header??e.text.split(/\s+/).slice(0,3).join(" ")).trim();return s.length>16?`${s.slice(0,15)}\u2026`:s}function Qi(e,s,c){let f=x=>e[x].length+6,p=f(s),a=s,u=s;for(;;){let x=u+1<e.length?f(u+1):1/0,y=a-1>=0?f(a-1):1/0;if(x===1/0&&y===1/0)break;if(x<=y){if(p+x>c)break;p+=x,u+=1}else{if(p+y>c)break;p+=y,a-=1}}return{lo:a,hi:u}}function Sr({batch:e,qView:s,sel:c=0,focused:f=!1,freeText:p=null,optionText:a=null,attach:u=null,multiSelFor:x,childPrefix:y,gapAbove:T=!0}){let{stdout:P}=Me(),V=P?.columns??80,re=V<Wi,C=Math.min(V-1,Vi),b=Math.max(0,Math.min(e.questions.length-1,s??(e.cursor<0?0:e.cursor))),I=e.questions[b],pe=e.resolution[b],q=e.resolution.filter(B=>!B).length,fe=e.questions.length-q,we=St(e),W=hn(I,we!==""),xe=x?x(b):[],ie=Ui[I.risk],Z=B=>f&&c===B?(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"}):" ",A=`? ${y??""}the agent needs ${q===1?"one answer":`${q} answers`}`,Pe=e.questions.length>1?` \xB7 ${b+1} of ${e.questions.length} \xB7 ${fe} answered`:"",H=(0,m.jsxs)(w,{flexDirection:"column",children:[(0,m.jsx)(w,{paddingLeft:2,children:(0,m.jsxs)(r,{bold:!0,children:[I.text,ie?(0,m.jsx)(r,{color:ie.color,bold:!1,children:` ${ie.text}`}):null]})}),(0,m.jsx)(w,{paddingLeft:2,children:(0,m.jsx)(r,{color:o.dim,children:I.rationale})}),(0,m.jsx)(r,{children:" "}),I.options.map((B,$)=>{let Q=f&&c===$;return a&&a.optionIndex===$?(0,m.jsx)(w,{flexDirection:"column",children:(0,m.jsxs)(w,{children:[(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"})," ",(0,m.jsx)(r,{color:o.assuranceAccent,children:`${$+1}. ${un(B.label)}`}),(0,m.jsx)(r,{color:o.dim,children:" \u270E "})]}),(0,m.jsx)(Rt,{value:a.value,onChange:a.onChange,onSubmit:a.onSubmit,onCancel:a.onCancel,placeholder:B.detail||"type your answer"})]})},`o-${$}`):(0,m.jsxs)(w,{flexDirection:"column",children:[(0,m.jsxs)(r,{children:[Z($)," ",I.multi_select?(0,m.jsx)(r,{color:xe.includes($)?o.green:o.dim,children:xe.includes($)?"[x] ":"[ ] "}):null,(0,m.jsx)(r,{color:Q?o.assuranceAccent:void 0,children:`${$+1}. ${un(B.label)}`}),$===I.recommended_index?(0,m.jsx)(r,{color:o.dim,children:" (recommended)"}):null,pe?.selected_index===$?(0,m.jsx)(r,{color:o.dim,children:" (current)"}):null]}),B.detail?(0,m.jsx)(w,{paddingLeft:5,children:(0,m.jsx)(r,{color:o.dim,children:B.detail})}):null]},`o-${$}`)}),I.multi_select&&W.doneIdx!=null?(0,m.jsxs)(r,{children:[Z(W.doneIdx)," ",(0,m.jsx)(r,{color:o.green,children:"\u2714"}),(0,m.jsx)(r,{color:f&&c===W.doneIdx?o.assuranceAccent:void 0,children:" done \u2014 confirm selection"})]}):null,I.allow_free_text?(0,m.jsx)(r,{children:" "}):null,I.allow_free_text?p?(0,m.jsxs)(w,{children:[(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"})," ",(0,m.jsx)(r,{color:o.dim,children:"\u270E "})]}),(0,m.jsx)(Rt,{value:p.value,onChange:p.onChange,onSubmit:p.onSubmit,onCancel:p.onCancel,placeholder:"Tell me what to do"})]}):(0,m.jsxs)(r,{children:[W.freeIdx!=null?Z(W.freeIdx):" "," ",(0,m.jsx)(r,{color:f&&W.freeIdx!=null&&c===W.freeIdx?o.assuranceAccent:o.dim,children:"\u270E Tell me what to do"})]}):null,u?(0,m.jsxs)(w,{flexDirection:"column",marginTop:1,children:[(0,m.jsxs)(w,{children:[(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"})," ",(0,m.jsx)(r,{color:o.assuranceAccent,children:"@ attach a file or URL"}),(0,m.jsx)(r,{color:o.dim,children:" \u270E "})]}),(0,m.jsx)(Rt,{value:u.value,onChange:u.onChange,onSubmit:u.onSubmit,onCancel:u.onCancel,placeholder:"path or URL"})]}),(0,m.jsx)(w,{paddingLeft:2,children:(0,m.jsx)(r,{color:o.dim,children:"the questions are set aside \u2014 the agent reads the source and re-asks what's still open"})})]}):null]}),F=we!==""?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(r,{children:" "}),(0,m.jsxs)(r,{children:[f&&W.batchIdx!=null&&c===W.batchIdx?(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"}):" "," ",(0,m.jsx)(r,{color:o.assuranceAccent,children:"\xBB"}),(0,m.jsx)(r,{bold:!0,color:f&&W.batchIdx!=null&&c===W.batchIdx?o.assuranceAccent:void 0,children:" Go with recommendations"}),q>=5?(0,m.jsx)(r,{color:o.dim,children:` \u2014 resolves all ${q} open`}):null,(0,m.jsx)(r,{color:o.dim,children:" (tab)"})]})]}):null;if(re)return(0,m.jsxs)(w,{marginTop:T?1:0,marginBottom:1,flexDirection:"column",children:[(0,m.jsx)(r,{color:o.assuranceAccent,bold:!0,children:A}),e.questions.length>1?(0,m.jsx)(r,{color:o.dim,children:Pe.replace(/^ · /,"")}):null,(0,m.jsx)(r,{children:" "}),H,F]});let h=e.questions.map(B=>Hi(B)),me=e.questions.length>1?Qi(h,b,C-8):null;return(0,m.jsxs)(w,{marginTop:T?1:0,marginBottom:1,flexDirection:"column",children:[(0,m.jsxs)(r,{color:o.assuranceAccent,children:[(0,m.jsx)(r,{bold:!0,children:A}),Pe?(0,m.jsx)(r,{color:o.dim,children:Pe}):null]}),me?(0,m.jsx)(w,{marginTop:1,children:(0,m.jsxs)(r,{children:[me.lo>0?(0,m.jsx)(r,{color:o.dim,children:"\u25C0 "}):" ",e.questions.slice(me.lo,me.hi+1).map((B,$)=>{let Q=me.lo+$,et=$>0?" ":"";return Q===b?(0,m.jsxs)(r,{children:[et,(0,m.jsx)(r,{backgroundColor:o.assuranceAccent,color:"#0d1117",bold:!0,children:` ${h[Q]} `})]},B.id):(0,m.jsxs)(r,{children:[et,e.resolution[Q]?(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.green,children:"\u2713 "}),(0,m.jsx)(r,{color:o.dim,children:h[Q]})]}):(0,m.jsx)(r,{color:o.dim,children:`\u25CB ${h[Q]}`})]},B.id)}),me.hi<e.questions.length-1?(0,m.jsx)(r,{color:o.dim,children:" \u25B6"}):null]})}):null,(0,m.jsx)(r,{children:" "}),H,F]})}var Er={ac:["acceptance criterion","acceptance criteria"],gap:["open question","open questions"],scenario:["scenario","scenarios"],test:["test","tests"],"use-case":["use-case","use-cases"]},pn=e=>Er[e]?.[1]??`${e}s`,At={label:(e,s)=>s===1?Er[e]?.[0]??e:pn(e),skip:new Set(["exercise"])},xn={ac:null,test:null,gap:null,scenario:"kind"},Xi=(e,s,c)=>`${e} ${e===1?s:c}`,Gi=e=>e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`;function Ar(e){let s=e.covers?on(e.covers):"1 scenario",c=e.verifies.slice(0,2).map(on),f=e.verifiesTotal-c.length,p=c.length===0?Xi(e.verifiesTotal,"acceptance criterion","acceptance criteria"):Gi([...c,...f>0?[`${f} more`]:[]]);return`covers ${s} \xB7 verifies ${p}`}function Dr(e,s){let c=typeof s=="string"&&s!==""?s.split(", "):[],f=p=>typeof p=="string"&&mr.test(p);return{covers:f(e)?e:null,verifies:c.filter(f),verifiesTotal:c.length}}var Dt={"acceptance criteria":{name:"acceptance criteria",next:"scenarios",done:"acceptance criteria say what the use-case must always do"},scenarios:{name:"scenarios",next:"scenario checks",done:"scenarios are the paths a user takes that test the criteria"},"acceptance criteria + exercises":{name:"scenario checks",next:"tests",done:"scenario checks say which criteria each scenario checks"},"tests + gaps":{name:"tests"},tests:{name:"tests"}};function Ze(e){let s=Dt[e]?.name;if(s)return s;let c={exercises:"scenario checks",gaps:"open questions"};return[...new Set(e.split(" + ").map(f=>c[f]??f))].join(" + ")}var Ir={scenarios:"next, scenarios: the paths a user takes that test them","scenario checks":"next, scenario checks: which criteria each scenario checks",tests:"next, tests: runnable tests, and open questions for what can't run"},Br="phases: acceptance criteria \u2192 scenarios \u2192 scenario checks \u2192 tests";var k=U(Y(),1),zi=e=>e.startsWith("designing: ")?`designing: ${Ze(e.slice(11))}`:e;function Yi(e,s){let c=e.form==="assumed"?" (assumed)":e.form==="deferred"?"":" (you)",f=e.note?` \u2014 ${e.note}`:"",p=s?`"${e.stub}"`:`q${e.qNum} ${e.stub}`;return e.form==="deferred"?`\u21B3 deferred ${p}${f}`:e.form==="changed"?`\u21B3 changed ${p}: ${e.prev??"?"} \u2192 ${e.choice??"?"}${c}${f}`:`\u21B3 ${e.form} ${p}: ${e.choice??"?"}${c}${f}`}var Ji=()=>(process.stdout?.columns??100)-12,Zi=new Set(["banner","header","user","agent","worked","childOpen","lines"]);function Lr({block:e,annotations:s,remote:c=!1,afterHeader:f=!1}){let p=e.era??0,{stdout:a}=Me(),u=c||p>0?(a?.columns??100)-p*2:null,x=ns(e,s??null,c,u,(a?.columns??100)-p*2),y=p>0?(0,k.jsx)(w,{marginLeft:p*2,children:x}):x;return f&&!Zi.has(e.kind)?(0,k.jsx)(w,{marginTop:1,children:y}):y}var es=new RegExp("[\\u1100-\\u115F\\u2E80-\\u303E\\u3041-\\uA4CF\\uAC00-\\uD7A3\\uF900-\\uFAFF\\uFE10-\\uFE19\\uFE30-\\uFE6F\\uFF00-\\uFF60\\uFFE0-\\uFFE6\\u{20000}-\\u{3FFFD}\u2714\u26A0]|\\p{Emoji_Presentation}","u"),It=e=>[...e].reduce((s,c)=>s+(es.test(c)?2:1),0);function ts(e,s,c){let f=Math.max(12,c-It(e)),p=[],a="";for(let u of s){let x=a?`${a} \xB7 ${u}`:u;It(x)>f&&a?(p.push(a),a=u):a=x}return p.push(a),p.map((u,x)=>(x===0?e:" ".repeat(e.length))+u)}function _e(e,s,c){let f=Math.max(12,c-It(e)),p=[],a="";for(let u of s.split(" ")){let x=a?`${a} ${u}`:u;It(x)>f&&a?(p.push(a),a=u):a=x}return p.push(a),p.map((u,x)=>(x===0?e:" ".repeat(e.length))+u)}function ns(e,s,c,f=null,p=100){switch(e.kind){case"banner":return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsx)(r,{bold:!0,color:o.assuranceAccent,children:` ${c?zi(e.text):e.text}`})});case"header":return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsxs)(r,{color:o.assuranceAccent,children:[`\u25CF ${e.text}`,e.tail?(0,k.jsx)(r,{color:o.dim,children:` \u2014 ${e.tail}`}):null]})});case"user":return(0,k.jsxs)(w,{marginTop:1,children:[(0,k.jsx)(r,{color:o.orange,children:"\u276F "}),(0,k.jsx)(r,{children:e.text})]});case"note":return(0,k.jsx)(r,{color:o.dim,children:` ${e.text}`});case"lines":return(0,k.jsx)(w,{flexDirection:"column",marginTop:1,children:e.lines.map((a,u)=>(0,k.jsx)(r,{...a.dim?{color:o.dim}:{},children:a.text},u))});case"agent":return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsx)(kr,{text:e.text,accent:o.assuranceAccent,indent:f===null?0:(e.era??0)*2})});case"worked":return(0,k.jsx)(w,{marginTop:1,flexDirection:"column",children:ts(" \u2699 ",hr(e.durS,e.toolCalls,e.tools),p).map((a,u)=>(0,k.jsx)(r,{color:o.dim,children:a},u))});case"usage":return(0,k.jsx)(r,{color:o.dim,children:` \xB7 ${e.credits.toFixed(1)} credits \u2014 total ${e.total.toFixed(1)}`});case"turn":{let a=s,u=(a?a.fresh:e.items.map((C,b)=>({item:C,num:b+1,updated:!1}))).filter(C=>!(c&&At.skip?.has(C.item.kind??""))),x={usecase:"risk","use-case":"risk",ac:"check",scenario:"kind",test:"check",gap:"risk",stylenote:"kind"},y=C=>C.kind??"use-case",T=new Map;for(let C of u){let b=C.item,I=y(C.item),pe=c&&I==="test"?{title:b.title,summary:Ar(b.links??Dr(b.extra?.automates,b.extra?.verifies)),badge:""}:c&&I==="gap"?{title:b.question??"",summary:b.rationale??"",badge:""}:null,q=b.risk==="high"||b.risk==="med"||b.risk==="low"?b.risk:void 0,fe=b.logical_id??(c?b.matched_id:void 0),we={id:fe??"",staged:!fe,...c&&b.held&&!fe?{held:!0}:{},title:pe?.title??b.title,badge:pe?.badge??b.badge??b.risk??"",summary:pe?.summary??b.why??b.summary??b.description??"",...q?{risk:q}:{},...C.updated?{marker:"\u21B3 changed"}:{}},W=T.get(I)??[];W.push(we),T.set(I,W)}let P=u.some(C=>!!C.item.kind),V=(a?.unchanged??[]).reduce((C,b)=>C+b.count,0),re=a?.headerStats?` \u2014 ${a.headerStats}${V>0?` (${V} unchanged)`:""}`:"";return(0,k.jsxs)(w,{flexDirection:"column",marginLeft:2,children:[(0,k.jsxs)(r,{bold:!0,children:[P?"design":e.heading,re?(0,k.jsx)(r,{bold:!1,color:o.dim,children:re}):null]}),[...T.entries()].map(([C,b])=>(0,k.jsxs)(w,{flexDirection:"column",children:[T.size>1?(0,k.jsx)(r,{color:o.dim,children:`${c?pn(C):Ct(C)} \xB7 ${b.length}`}):null,(0,k.jsx)(Tr,{rows:b,width:Ji(),badgeHeader:c&&C in xn?xn[C]:x[C]??"info"})]},C)),a&&a.unchanged.length>0&&(0,k.jsx)(r,{color:o.dim,children:` \u22EE unchanged: ${a.unchanged.map(C=>`${C.count} ${C.label}`).join(" \xB7 ")}`})]})}case"answer":return(0,k.jsx)(r,{color:o.dim,children:Yi(e.receipt,c)});case"continued":return(0,k.jsx)(r,{color:o.dim,children:"\u21B3 continued"});case"childOpen":{if(c)return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsx)(r,{color:o.assuranceAccent,children:`\u25CF ${e.update?S.updateOpen(e.subject,e.changed===!0):S.childOpen(e.verb,e.subject)}`})});let{ing:a}=fn(e.verb);return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsxs)(r,{color:o.assuranceAccent,children:[`\u25CF ${a} ${e.subject}`,e.sid?(0,k.jsx)(r,{color:o.dim,children:` \u2014 ${e.sid}`}):null,e.note?(0,k.jsx)(r,{color:o.dim,children:` ${e.note}`}):null]})})}case"childClose":{if(e.held)return(0,k.jsx)(w,{});if(c&&e.update){let x=[Ge(e.durS),...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]];if(!e.ok)return(0,k.jsx)(r,{color:o.red,children:`\u25CF ${S.updateFailed(e.subject)}`});if(e.untouched)return(0,k.jsx)(r,{children:`\u25CF ${S.updateUntouched(e.subject)} \u2014 ${x.join(" \xB7 ")}`});if(e.unfinished)return(0,k.jsx)(r,{children:`\u25CF ${S.updateUnfinished(e.subject)} \u2014 ${x.join(" \xB7 ")}`});let y=e.testsWritten?S.updateTests(e.testsWritten):null,T=[x[0],...y?[y]:[],...x.slice(1)];return(0,k.jsx)(r,{color:o.green,children:`\u25CF ${S.updateClosed(e.subject,T)}`})}if(c){if(!e.ok)return(0,k.jsx)(r,{color:o.red,children:`\u25CF ${S.childFailed(e.verb,e.subject)}`});if(e.unfinished)return(0,k.jsx)(r,{children:`\u25CF ${[S.childUnfinished(e.verb),[Ge(e.durS),...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]].join(" \xB7 ")].join(" \u2014 ")}`});let x=[Ge(e.durS),...e.tests?[S.childTests(e.verb,e.tests)]:[],...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]];return(0,k.jsx)(r,{color:o.green,children:`\u25CF ${S.childClosed(e.verb,e.subject,x)}`})}let{ed:a}=fn(e.verb);if(!e.ok)return(0,k.jsxs)(r,{color:o.red,children:[`\u25CF ${e.verb} failed \u2014 ${e.exitCode!=null?`exited ${e.exitCode}`:"error"}`,e.fixCmd?(0,k.jsx)(r,{color:o.dim,children:` \xB7 ${e.fixCmd}`}):null]});let u=[Ge(e.durS),...e.results?[e.results]:[],...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]].join(" \xB7 ");return(0,k.jsx)(r,{color:o.green,children:`\u25CF ${a} ${e.subject} \u2014 ${u}`})}case"childBack":return(0,k.jsx)(r,{color:o.dim,children:`back with ${e.parentVerb} \u2014 ${e.context}`});case"commit":if(c&&e.person&&!e.ok&&e.refused?.length){let a=S.approveRefused(e.refused);return(0,k.jsxs)(w,{flexDirection:"column",children:[_e(" \u2717 ",a.line,f??100).map((u,x)=>(0,k.jsx)(r,{color:o.red,children:u},`p-${x}`)),a.notes.flatMap((u,x)=>_e(" ",u,f??100).map((y,T)=>(0,k.jsx)(r,{color:o.dim,children:y},`n-${x}-${T}`)))]})}return(0,k.jsxs)(w,{flexDirection:"column",children:[c&&e.held?_e(" \u2016 ",e.line,f??100).map((a,u)=>(0,k.jsx)(r,{children:a},`h-${u}`)):f!==null?_e(` ${e.ok?"\u2714":"\u2717"} `,e.line,f).map((a,u)=>(0,k.jsx)(r,{color:e.ok?o.green:o.red,children:a},`c-${u}`)):(0,k.jsx)(r,{color:e.ok?o.green:o.red,children:` ${e.ok?"\u2714":"\u2717"} ${e.line}`}),c&&e.refused?.length?S.chatRefused(e.refused).flatMap((a,u)=>_e(" ",a,f??100).map((x,y)=>(0,k.jsx)(r,{color:o.dim,children:x},`r-${u}-${y}`))):(e.warnings??[]).flatMap((a,u)=>!c&&f!==null&&(e.era??0)>0?_e(" \u26A0 ",a,f).map((x,y)=>(0,k.jsx)(r,{color:o.dim,children:x},`w-${u}-${y}`)):[(0,k.jsx)(r,{color:o.dim,children:` \u26A0 ${a}`},`w-${u}`)])]});case"error":return(0,k.jsxs)(ur,{variant:"error",paddingX:1,children:[(0,k.jsx)(r,{color:o.red,children:e.title}),e.detail.map((a,u)=>(0,k.jsx)(r,{color:o.dim,children:a},`d-${u}`))]})}}var Oe=U(Y(),1);function Mr({item:e}){return(0,Oe.jsxs)(w,{flexDirection:"column",marginLeft:2,children:[(e.cite??[]).map((s,c)=>(0,Oe.jsx)(r,{dimColor:!0,children:`cite ${s.anchor??"conv"} \u2014 "${s.quote??""}"`},`cite-${c}`)),(e.depends_on_hint??[]).length>0&&(0,Oe.jsx)(r,{dimColor:!0,children:`depends on: ${(e.depends_on_hint??[]).join(", ")}`}),Object.entries(e.extra??{}).map(([s,c])=>(0,Oe.jsx)(r,{dimColor:!0,children:`${s}: ${c}`},`extra-${s}`))]})}var E=U(Y(),1),kn=(e,s)=>Math.max(0,Math.min(s,e));function Lt(e,s,c){switch(s.type){case"move":return e.level==="detail"?{...e,scroll:Math.max(0,(e.scroll??0)+s.delta)}:{...e,cursor:kn(e.cursor+s.delta,Math.max(0,c-1))};case"enter":return e.level==="list"?{...e,level:"detail",scroll:0}:e;case"back":return e.level==="detail"?{...e,level:"list",scroll:0}:null}}var Or={"use-case":"use-cases",ac:"acs",scenario:"scenarios",test:"tests",gap:"gaps"};function Pr(e,s){if(e.level==="detail")return{level:"detail",cursor:kn(e.num-1,Math.max(0,s.entries.length-1))};if(e.section){let c=s.entries.findIndex(f=>Or[f.kind]===e.section);if(c>=0)return{level:"list",cursor:c}}return{level:"list",cursor:0}}function rs(e){let s=[];for(let c of e.entries){let f=s.find(p=>p.kind===c.kind);f?f.entries.push(c):s.push({kind:c.kind,entries:[c]})}return s}var _r=3;function is({items:e,cursor:s,verb:c,more:f}){let p=`view \xB7 ${c} so far \xB7 ${e.counts.map(u=>`${u.count} ${u.count===1?u.label.replace(/s$/,""):u.label}`).join(" \xB7 ")}`,a=e.entries[s];return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsx)(r,{bold:!0,color:o.assuranceAccent,children:p}),rs(e).map(({kind:u,entries:x})=>{let y=a?.kind===u,T=y?x.findIndex(C=>C.num===a.num):-1,P=y?kn(T-1,Math.max(0,x.length-_r)):0,V=x.slice(P,P+(y?_r:1)),re=x.length-V.length;return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsx)(r,{color:o.dim,children:`${Or[u]??Ct(u)} \xB7 ${x.length}`}),V.map(C=>{let b=y&&C.num===a.num,I=C.item.badge;return(0,E.jsxs)(r,{children:[(0,E.jsx)(r,{color:o.assuranceAccent,children:b?"\u203A ":" "}),(0,E.jsx)(r,{children:`${C.num} \xB7 ${C.item.title}`}),I?(0,E.jsx)(r,{color:o.dim,children:` \xB7 ${I}`}):null]},`${C.kind}:${C.num}`)}),re>0&&(0,E.jsx)(r,{color:o.dim,children:` \u22EE ${re} more`})]},u)}),f?(0,E.jsxs)(r,{children:[(0,E.jsx)(r,{color:o.assuranceAccent,children:s===e.entries.length?"\u203A ":" "}),(0,E.jsx)(r,{color:o.dim,children:`\u22EF show all \u2014 ${f.hidden} more from earlier turns`})]}):null]})}var Bt=14;function ss({items:e,cursor:s,explain:c,grandTotal:f,dossier:p,scroll:a=0}){let u=e.entries[s];if(!u)return(0,E.jsx)(r,{color:o.dim,children:"nothing to show"});if(p){let y=Math.max(0,Math.min(a,Math.max(0,p.lines.length-Bt))),T=p.lines.slice(y,y+Bt);return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsxs)(r,{bold:!0,children:[`view \xB7 ${p.id}`,p.id.toLowerCase()!==p.rawId?(0,E.jsx)(r,{bold:!1,color:o.dim,children:` \xB7 ${p.rawId}`}):null]}),(0,E.jsx)(r,{bold:!0,children:p.title}),y>0?(0,E.jsx)(r,{color:o.muted,children:`\u22EE ${y} above`}):null,T.map((P,V)=>(0,E.jsx)(r,{color:P.dim?o.dim:void 0,children:P.text},`dl-${V}`)),p.lines.length>y+Bt?(0,E.jsx)(r,{color:o.muted,children:`\u22EE ${p.lines.length-y-Bt} more`}):null]})}let x=u.item;return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsx)(r,{bold:!0,children:`view \xB7 ${u.kind} ${u.num} of ${f??e.entries.length}`}),(0,E.jsx)(r,{children:u.item.title}),x.badge?(0,E.jsx)(r,{color:o.dim,children:`kind: ${x.badge}`}):null,x.why?(0,E.jsx)(r,{color:o.dim,children:x.why}):null,(0,E.jsx)(Mr,{item:u.item}),c?.map((y,T)=>(0,E.jsx)(r,{color:o.dim,children:y},`ex-${T}`)),(0,E.jsx)(r,{color:o.dim,children:"view-only \u2014 approvals happen in chat"})]})}function jr({items:e,state:s,verb:c,more:f,explain:p,grandTotal:a,dossier:u=null}){return s.level==="list"?(0,E.jsx)(is,{items:e,cursor:s.cursor,verb:c,more:f}):(0,E.jsx)(ss,{items:e,cursor:s.cursor,explain:p,grandTotal:a,dossier:u,scroll:s.scroll??0})}var J=U(Y(),1),vn=14;function os(e){let s=[],c=null;for(let f of e)f.field!==c&&(c=f.field,s.push({kind:"field",field:c})),s.push({kind:"line",field:c,line:f});return s}function Fr({title:e,lines:s,offset:c=0,remote:f=!1}){let p=os(s),a=Math.max(0,Math.min(c,Math.max(0,p.length-vn))),u=p.slice(a,a+vn),x=a,y=Math.max(0,p.length-a-vn),T=f?`the change to ${e} \xB7 old \u2192 new`:`view \xB7 diff \xB7 ${e} \xB7 current \u2192 proposed`;return(0,J.jsxs)(w,{flexDirection:"column",children:[(0,J.jsx)(r,{bold:!0,color:o.assuranceAccent,children:T}),x>0?(0,J.jsx)(w,{paddingLeft:2,children:(0,J.jsx)(r,{color:o.dim,children:`\u22EE ${x} above`})}):null,u.map((P,V)=>P.kind==="field"?(0,J.jsx)(w,{paddingLeft:2,children:(0,J.jsx)(r,{color:o.dim,children:P.field==="criteria"?f?"acceptance criteria":"criteria":P.field})},`r-${a+V}`):(0,J.jsx)(w,{paddingLeft:4,children:(0,J.jsx)(r,{color:P.line.op==="-"?"red":"green",children:`${P.line.op==="-"?"\u2212":"+"} ${P.line.text}`})},`r-${a+V}`)),y>0?(0,J.jsx)(w,{paddingLeft:2,children:(0,J.jsx)(r,{color:o.dim,children:`\u22EE ${y} more`})}):null]})}var ls={"use-cases":"use-cases",usecases:"use-cases","use-case":"use-cases",acs:"acs",ac:"acs",scenarios:"scenarios",scenario:"scenarios",tests:"tests",test:"tests",gaps:"gaps",gap:"gaps"};function qr(e){let s=(e??"").trim().toLowerCase();if(!s)return{level:"list"};if(/^\d+$/.test(s)){let f=parseInt(s,10);return f>=1?{level:"detail",num:f}:{error:"items are numbered from 1 \u2014 /view 1"}}let c=ls[s];return c?{level:"list",section:c}:{error:"try /view, /view <number>, or /view acs|scenarios|tests"}}var D=U(Y(),1),as=6,Nr=12;function cs(e,s,c){let f=Math.max(20,s),p=[];for(let u of e.split(`
|
|
2
|
+
import{b as Tr}from"./chunk-J5QFO7LW.js";import{a as dn,c as mn,e as Et,f as Je,g as $r,h as Rr,i as gn,j as Cr}from"./chunk-H23ZMHHC.js";import{a as St,b as un}from"./chunk-AL6IAMYV.js";import{a as ln,b as wr}from"./chunk-JGQ3VB44.js";import{a as xr,b as kr,c as vr}from"./chunk-LXYXCANZ.js";import{a as pr,b as ue}from"./chunk-FNBHP75S.js";import{a as dr}from"./chunk-5Y2G4NC7.js";import{c as Rt}from"./chunk-SMXABALN.js";import{a as ur}from"./chunk-V3IWCGZT.js";import{b as fr}from"./chunk-WN5VKKJ3.js";import{a as Y}from"./chunk-HCBYKLMW.js";import{b as fn}from"./chunk-HD6NR44L.js";import{a as Ct,b as an,c as Ye,d as yr,e as cn}from"./chunk-BWXLZS5O.js";import{e as ze,f as S,g as br}from"./chunk-77BZTEHJ.js";import{b as gr,c as Ge,d as hr}from"./chunk-22PIMG52.js";import{na as mr,oa as on}from"./chunk-5EAJO372.js";import{A as o}from"./chunk-BRWCWZE3.js";import{a as w,b as r,k as Me}from"./chunk-33DWJV67.js";import{a as cr}from"./chunk-6YGTRKDT.js";import{e as U}from"./chunk-UR6MHSHU.js";var bn=U(cr(),1);var g=U(cr(),1);var m=U(Y(),1),Wi=60,Vi=100;function hn(e,s){let c=e.options.length,f=c,p=e.multi_select?f++:null,a=e.allow_free_text?f++:null,u=s?f++:null;return{optionCount:c,doneIdx:p,freeIdx:a,batchIdx:u,maxSel:f-1}}var Ki="\xA0",Ui={high:{text:`\u203C${Ki}high`,color:o.red},med:{text:"med",color:"yellow"},low:{text:"low",color:o.dim}};function Hi(e){let s=(e.header??e.text.split(/\s+/).slice(0,3).join(" ")).trim();return s.length>16?`${s.slice(0,15)}\u2026`:s}function Qi(e,s,c){let f=x=>e[x].length+6,p=f(s),a=s,u=s;for(;;){let x=u+1<e.length?f(u+1):1/0,y=a-1>=0?f(a-1):1/0;if(x===1/0&&y===1/0)break;if(x<=y){if(p+x>c)break;p+=x,u+=1}else{if(p+y>c)break;p+=y,a-=1}}return{lo:a,hi:u}}function Sr({batch:e,qView:s,sel:c=0,focused:f=!1,freeText:p=null,optionText:a=null,attach:u=null,multiSelFor:x,childPrefix:y,gapAbove:T=!0}){let{stdout:P}=Me(),V=P?.columns??80,re=V<Wi,C=Math.min(V-1,Vi),b=Math.max(0,Math.min(e.questions.length-1,s??(e.cursor<0?0:e.cursor))),I=e.questions[b],pe=e.resolution[b],q=e.resolution.filter(B=>!B).length,fe=e.questions.length-q,we=St(e),W=hn(I,we!==""),xe=x?x(b):[],ie=Ui[I.risk],Z=B=>f&&c===B?(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"}):" ",A=`? ${y??""}the agent needs ${q===1?"one answer":`${q} answers`}`,Pe=e.questions.length>1?` \xB7 ${b+1} of ${e.questions.length} \xB7 ${fe} answered`:"",H=(0,m.jsxs)(w,{flexDirection:"column",children:[(0,m.jsx)(w,{paddingLeft:2,children:(0,m.jsxs)(r,{bold:!0,children:[I.text,ie?(0,m.jsx)(r,{color:ie.color,bold:!1,children:` ${ie.text}`}):null]})}),(0,m.jsx)(w,{paddingLeft:2,children:(0,m.jsx)(r,{color:o.dim,children:I.rationale})}),(0,m.jsx)(r,{children:" "}),I.options.map((B,$)=>{let Q=f&&c===$;return a&&a.optionIndex===$?(0,m.jsx)(w,{flexDirection:"column",children:(0,m.jsxs)(w,{children:[(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"})," ",(0,m.jsx)(r,{color:o.assuranceAccent,children:`${$+1}. ${un(B.label)}`}),(0,m.jsx)(r,{color:o.dim,children:" \u270E "})]}),(0,m.jsx)(Rt,{value:a.value,onChange:a.onChange,onSubmit:a.onSubmit,onCancel:a.onCancel,placeholder:B.detail||"type your answer"})]})},`o-${$}`):(0,m.jsxs)(w,{flexDirection:"column",children:[(0,m.jsxs)(r,{children:[Z($)," ",I.multi_select?(0,m.jsx)(r,{color:xe.includes($)?o.green:o.dim,children:xe.includes($)?"[x] ":"[ ] "}):null,(0,m.jsx)(r,{color:Q?o.assuranceAccent:void 0,children:`${$+1}. ${un(B.label)}`}),$===I.recommended_index?(0,m.jsx)(r,{color:o.dim,children:" (recommended)"}):null,pe?.selected_index===$?(0,m.jsx)(r,{color:o.dim,children:" (current)"}):null]}),B.detail?(0,m.jsx)(w,{paddingLeft:5,children:(0,m.jsx)(r,{color:o.dim,children:B.detail})}):null]},`o-${$}`)}),I.multi_select&&W.doneIdx!=null?(0,m.jsxs)(r,{children:[Z(W.doneIdx)," ",(0,m.jsx)(r,{color:o.green,children:"\u2714"}),(0,m.jsx)(r,{color:f&&c===W.doneIdx?o.assuranceAccent:void 0,children:" done \u2014 confirm selection"})]}):null,I.allow_free_text?(0,m.jsx)(r,{children:" "}):null,I.allow_free_text?p?(0,m.jsxs)(w,{children:[(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"})," ",(0,m.jsx)(r,{color:o.dim,children:"\u270E "})]}),(0,m.jsx)(Rt,{value:p.value,onChange:p.onChange,onSubmit:p.onSubmit,onCancel:p.onCancel,placeholder:"Tell me what to do"})]}):(0,m.jsxs)(r,{children:[W.freeIdx!=null?Z(W.freeIdx):" "," ",(0,m.jsx)(r,{color:f&&W.freeIdx!=null&&c===W.freeIdx?o.assuranceAccent:o.dim,children:"\u270E Tell me what to do"})]}):null,u?(0,m.jsxs)(w,{flexDirection:"column",marginTop:1,children:[(0,m.jsxs)(w,{children:[(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"})," ",(0,m.jsx)(r,{color:o.assuranceAccent,children:"@ attach a file or URL"}),(0,m.jsx)(r,{color:o.dim,children:" \u270E "})]}),(0,m.jsx)(Rt,{value:u.value,onChange:u.onChange,onSubmit:u.onSubmit,onCancel:u.onCancel,placeholder:"path or URL"})]}),(0,m.jsx)(w,{paddingLeft:2,children:(0,m.jsx)(r,{color:o.dim,children:"the questions are set aside \u2014 the agent reads the source and re-asks what's still open"})})]}):null]}),F=we!==""?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(r,{children:" "}),(0,m.jsxs)(r,{children:[f&&W.batchIdx!=null&&c===W.batchIdx?(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"}):" "," ",(0,m.jsx)(r,{color:o.assuranceAccent,children:"\xBB"}),(0,m.jsx)(r,{bold:!0,color:f&&W.batchIdx!=null&&c===W.batchIdx?o.assuranceAccent:void 0,children:" Go with recommendations"}),q>=5?(0,m.jsx)(r,{color:o.dim,children:` \u2014 resolves all ${q} open`}):null,(0,m.jsx)(r,{color:o.dim,children:" (tab)"})]})]}):null;if(re)return(0,m.jsxs)(w,{marginTop:T?1:0,marginBottom:1,flexDirection:"column",children:[(0,m.jsx)(r,{color:o.assuranceAccent,bold:!0,children:A}),e.questions.length>1?(0,m.jsx)(r,{color:o.dim,children:Pe.replace(/^ · /,"")}):null,(0,m.jsx)(r,{children:" "}),H,F]});let h=e.questions.map(B=>Hi(B)),me=e.questions.length>1?Qi(h,b,C-8):null;return(0,m.jsxs)(w,{marginTop:T?1:0,marginBottom:1,flexDirection:"column",children:[(0,m.jsxs)(r,{color:o.assuranceAccent,children:[(0,m.jsx)(r,{bold:!0,children:A}),Pe?(0,m.jsx)(r,{color:o.dim,children:Pe}):null]}),me?(0,m.jsx)(w,{marginTop:1,children:(0,m.jsxs)(r,{children:[me.lo>0?(0,m.jsx)(r,{color:o.dim,children:"\u25C0 "}):" ",e.questions.slice(me.lo,me.hi+1).map((B,$)=>{let Q=me.lo+$,et=$>0?" ":"";return Q===b?(0,m.jsxs)(r,{children:[et,(0,m.jsx)(r,{backgroundColor:o.assuranceAccent,color:"#0d1117",bold:!0,children:` ${h[Q]} `})]},B.id):(0,m.jsxs)(r,{children:[et,e.resolution[Q]?(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.green,children:"\u2713 "}),(0,m.jsx)(r,{color:o.dim,children:h[Q]})]}):(0,m.jsx)(r,{color:o.dim,children:`\u25CB ${h[Q]}`})]},B.id)}),me.hi<e.questions.length-1?(0,m.jsx)(r,{color:o.dim,children:" \u25B6"}):null]})}):null,(0,m.jsx)(r,{children:" "}),H,F]})}var Er={ac:["acceptance criterion","acceptance criteria"],gap:["open question","open questions"],scenario:["scenario","scenarios"],test:["test","tests"],"use-case":["use-case","use-cases"]},pn=e=>Er[e]?.[1]??`${e}s`,At={label:(e,s)=>s===1?Er[e]?.[0]??e:pn(e),skip:new Set(["exercise"])},xn={ac:null,test:null,gap:null,scenario:"kind"},Xi=(e,s,c)=>`${e} ${e===1?s:c}`,Gi=e=>e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`;function Ar(e){let s=e.covers?on(e.covers):"1 scenario",c=e.verifies.slice(0,2).map(on),f=e.verifiesTotal-c.length,p=c.length===0?Xi(e.verifiesTotal,"acceptance criterion","acceptance criteria"):Gi([...c,...f>0?[`${f} more`]:[]]);return`covers ${s} \xB7 verifies ${p}`}function Dr(e,s){let c=typeof s=="string"&&s!==""?s.split(", "):[],f=p=>typeof p=="string"&&mr.test(p);return{covers:f(e)?e:null,verifies:c.filter(f),verifiesTotal:c.length}}var Dt={"acceptance criteria":{name:"acceptance criteria",next:"scenarios",done:"acceptance criteria say what the use-case must always do"},scenarios:{name:"scenarios",next:"scenario checks",done:"scenarios are the paths a user takes that test the criteria"},"acceptance criteria + exercises":{name:"scenario checks",next:"tests",done:"scenario checks say which criteria each scenario checks"},"tests + gaps":{name:"tests"},tests:{name:"tests"}};function Ze(e){let s=Dt[e]?.name;if(s)return s;let c={exercises:"scenario checks",gaps:"open questions"};return[...new Set(e.split(" + ").map(f=>c[f]??f))].join(" + ")}var Ir={scenarios:"next, scenarios: the paths a user takes that test them","scenario checks":"next, scenario checks: which criteria each scenario checks",tests:"next, tests: runnable tests, and open questions for what can't run"},Br="phases: acceptance criteria \u2192 scenarios \u2192 scenario checks \u2192 tests";var k=U(Y(),1),zi=e=>e.startsWith("designing: ")?`designing: ${Ze(e.slice(11))}`:e;function Yi(e,s){let c=e.form==="assumed"?" (assumed)":e.form==="deferred"?"":" (you)",f=e.note?` \u2014 ${e.note}`:"",p=s?`"${e.stub}"`:`q${e.qNum} ${e.stub}`;return e.form==="deferred"?`\u21B3 deferred ${p}${f}`:e.form==="changed"?`\u21B3 changed ${p}: ${e.prev??"?"} \u2192 ${e.choice??"?"}${c}${f}`:`\u21B3 ${e.form} ${p}: ${e.choice??"?"}${c}${f}`}var Ji=()=>(process.stdout?.columns??100)-12,Zi=new Set(["banner","header","user","agent","worked","childOpen","lines"]);function Lr({block:e,annotations:s,remote:c=!1,afterHeader:f=!1}){let p=e.era??0,{stdout:a}=Me(),u=c||p>0?(a?.columns??100)-p*2:null,x=ns(e,s??null,c,u,(a?.columns??100)-p*2),y=p>0?(0,k.jsx)(w,{marginLeft:p*2,children:x}):x;return f&&!Zi.has(e.kind)?(0,k.jsx)(w,{marginTop:1,children:y}):y}var es=new RegExp("[\\u1100-\\u115F\\u2E80-\\u303E\\u3041-\\uA4CF\\uAC00-\\uD7A3\\uF900-\\uFAFF\\uFE10-\\uFE19\\uFE30-\\uFE6F\\uFF00-\\uFF60\\uFFE0-\\uFFE6\\u{20000}-\\u{3FFFD}\u2714\u26A0]|\\p{Emoji_Presentation}","u"),It=e=>[...e].reduce((s,c)=>s+(es.test(c)?2:1),0);function ts(e,s,c){let f=Math.max(12,c-It(e)),p=[],a="";for(let u of s){let x=a?`${a} \xB7 ${u}`:u;It(x)>f&&a?(p.push(a),a=u):a=x}return p.push(a),p.map((u,x)=>(x===0?e:" ".repeat(e.length))+u)}function _e(e,s,c){let f=Math.max(12,c-It(e)),p=[],a="";for(let u of s.split(" ")){let x=a?`${a} ${u}`:u;It(x)>f&&a?(p.push(a),a=u):a=x}return p.push(a),p.map((u,x)=>(x===0?e:" ".repeat(e.length))+u)}function ns(e,s,c,f=null,p=100){switch(e.kind){case"banner":return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsx)(r,{bold:!0,color:o.assuranceAccent,children:` ${c?zi(e.text):e.text}`})});case"header":return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsxs)(r,{color:o.assuranceAccent,children:[`\u25CF ${e.text}`,e.tail?(0,k.jsx)(r,{color:o.dim,children:` \u2014 ${e.tail}`}):null]})});case"user":return(0,k.jsxs)(w,{marginTop:1,children:[(0,k.jsx)(r,{color:o.orange,children:"\u276F "}),(0,k.jsx)(r,{children:e.text})]});case"note":return(0,k.jsx)(r,{color:o.dim,children:` ${e.text}`});case"lines":return(0,k.jsx)(w,{flexDirection:"column",marginTop:1,children:e.lines.map((a,u)=>(0,k.jsx)(r,{...a.dim?{color:o.dim}:{},children:a.text},u))});case"agent":return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsx)(kr,{text:e.text,accent:o.assuranceAccent,indent:f===null?0:(e.era??0)*2})});case"worked":return(0,k.jsx)(w,{marginTop:1,flexDirection:"column",children:ts(" \u2699 ",hr(e.durS,e.toolCalls,e.tools),p).map((a,u)=>(0,k.jsx)(r,{color:o.dim,children:a},u))});case"usage":return(0,k.jsx)(r,{color:o.dim,children:` \xB7 ${e.credits.toFixed(1)} credits \u2014 total ${e.total.toFixed(1)}`});case"turn":{let a=s,u=(a?a.fresh:e.items.map((C,b)=>({item:C,num:b+1,updated:!1}))).filter(C=>!(c&&At.skip?.has(C.item.kind??""))),x={usecase:"risk","use-case":"risk",ac:"check",scenario:"kind",test:"check",gap:"risk",stylenote:"kind"},y=C=>C.kind??"use-case",T=new Map;for(let C of u){let b=C.item,I=y(C.item),pe=c&&I==="test"?{title:b.title,summary:Ar(b.links??Dr(b.extra?.automates,b.extra?.verifies)),badge:""}:c&&I==="gap"?{title:b.question??"",summary:b.rationale??"",badge:""}:null,q=b.risk==="high"||b.risk==="med"||b.risk==="low"?b.risk:void 0,fe=b.logical_id??(c?b.matched_id:void 0),we={id:fe??"",staged:!fe,...c&&b.held&&!fe?{held:!0}:{},title:pe?.title??b.title,badge:pe?.badge??b.badge??b.risk??"",summary:pe?.summary??b.why??b.summary??b.description??"",...q?{risk:q}:{},...C.updated?{marker:"\u21B3 changed"}:{}},W=T.get(I)??[];W.push(we),T.set(I,W)}let P=u.some(C=>!!C.item.kind),V=(a?.unchanged??[]).reduce((C,b)=>C+b.count,0),re=a?.headerStats?` \u2014 ${a.headerStats}${V>0?` (${V} unchanged)`:""}`:"";return(0,k.jsxs)(w,{flexDirection:"column",marginLeft:2,children:[(0,k.jsxs)(r,{bold:!0,children:[P?"design":e.heading,re?(0,k.jsx)(r,{bold:!1,color:o.dim,children:re}):null]}),[...T.entries()].map(([C,b])=>(0,k.jsxs)(w,{flexDirection:"column",children:[T.size>1?(0,k.jsx)(r,{color:o.dim,children:`${c?pn(C):Ct(C)} \xB7 ${b.length}`}):null,(0,k.jsx)(Tr,{rows:b,width:Ji(),badgeHeader:c&&C in xn?xn[C]:x[C]??"info"})]},C)),a&&a.unchanged.length>0&&(0,k.jsx)(r,{color:o.dim,children:` \u22EE unchanged: ${a.unchanged.map(C=>`${C.count} ${C.label}`).join(" \xB7 ")}`})]})}case"answer":return(0,k.jsx)(r,{color:o.dim,children:Yi(e.receipt,c)});case"continued":return(0,k.jsx)(r,{color:o.dim,children:"\u21B3 continued"});case"childOpen":{if(c)return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsx)(r,{color:o.assuranceAccent,children:`\u25CF ${e.update?S.updateOpen(e.subject,e.changed===!0):S.childOpen(e.verb,e.subject)}`})});let{ing:a}=fn(e.verb);return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsxs)(r,{color:o.assuranceAccent,children:[`\u25CF ${a} ${e.subject}`,e.sid?(0,k.jsx)(r,{color:o.dim,children:` \u2014 ${e.sid}`}):null,e.note?(0,k.jsx)(r,{color:o.dim,children:` ${e.note}`}):null]})})}case"childClose":{if(e.held)return(0,k.jsx)(w,{});if(c&&e.update){let x=[Ge(e.durS),...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]];if(!e.ok)return(0,k.jsx)(r,{color:o.red,children:`\u25CF ${S.updateFailed(e.subject)}`});if(e.untouched)return(0,k.jsx)(r,{children:`\u25CF ${S.updateUntouched(e.subject)} \u2014 ${x.join(" \xB7 ")}`});if(e.unfinished)return(0,k.jsx)(r,{children:`\u25CF ${S.updateUnfinished(e.subject)} \u2014 ${x.join(" \xB7 ")}`});let y=e.testsWritten?S.updateTests(e.testsWritten):null,T=[x[0],...y?[y]:[],...x.slice(1)];return(0,k.jsx)(r,{color:o.green,children:`\u25CF ${S.updateClosed(e.subject,T)}`})}if(c){if(!e.ok)return(0,k.jsx)(r,{color:o.red,children:`\u25CF ${S.childFailed(e.verb,e.subject)}`});if(e.unfinished)return(0,k.jsx)(r,{children:`\u25CF ${[S.childUnfinished(e.verb),[Ge(e.durS),...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]].join(" \xB7 ")].join(" \u2014 ")}`});let x=[Ge(e.durS),...e.tests?[S.childTests(e.verb,e.tests)]:[],...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]];return(0,k.jsx)(r,{color:o.green,children:`\u25CF ${S.childClosed(e.verb,e.subject,x)}`})}let{ed:a}=fn(e.verb);if(!e.ok)return(0,k.jsxs)(r,{color:o.red,children:[`\u25CF ${e.verb} failed \u2014 ${e.exitCode!=null?`exited ${e.exitCode}`:"error"}`,e.fixCmd?(0,k.jsx)(r,{color:o.dim,children:` \xB7 ${e.fixCmd}`}):null]});let u=[Ge(e.durS),...e.results?[e.results]:[],...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]].join(" \xB7 ");return(0,k.jsx)(r,{color:o.green,children:`\u25CF ${a} ${e.subject} \u2014 ${u}`})}case"childBack":return(0,k.jsx)(r,{color:o.dim,children:`back with ${e.parentVerb} \u2014 ${e.context}`});case"commit":if(c&&e.person&&!e.ok&&e.refused?.length){let a=S.approveRefused(e.refused);return(0,k.jsxs)(w,{flexDirection:"column",children:[_e(" \u2717 ",a.line,f??100).map((u,x)=>(0,k.jsx)(r,{color:o.red,children:u},`p-${x}`)),a.notes.flatMap((u,x)=>_e(" ",u,f??100).map((y,T)=>(0,k.jsx)(r,{color:o.dim,children:y},`n-${x}-${T}`)))]})}return(0,k.jsxs)(w,{flexDirection:"column",children:[c&&e.held?_e(" \u2016 ",e.line,f??100).map((a,u)=>(0,k.jsx)(r,{children:a},`h-${u}`)):f!==null?_e(` ${e.ok?"\u2714":"\u2717"} `,e.line,f).map((a,u)=>(0,k.jsx)(r,{color:e.ok?o.green:o.red,children:a},`c-${u}`)):(0,k.jsx)(r,{color:e.ok?o.green:o.red,children:` ${e.ok?"\u2714":"\u2717"} ${e.line}`}),c&&e.refused?.length?S.chatRefused(e.refused).flatMap((a,u)=>_e(" ",a,f??100).map((x,y)=>(0,k.jsx)(r,{color:o.dim,children:x},`r-${u}-${y}`))):(e.warnings??[]).flatMap((a,u)=>!c&&f!==null&&(e.era??0)>0?_e(" \u26A0 ",a,f).map((x,y)=>(0,k.jsx)(r,{color:o.dim,children:x},`w-${u}-${y}`)):[(0,k.jsx)(r,{color:o.dim,children:` \u26A0 ${a}`},`w-${u}`)])]});case"error":return(0,k.jsxs)(ur,{variant:"error",paddingX:1,children:[(0,k.jsx)(r,{color:o.red,children:e.title}),e.detail.map((a,u)=>(0,k.jsx)(r,{color:o.dim,children:a},`d-${u}`))]})}}var Oe=U(Y(),1);function Mr({item:e}){return(0,Oe.jsxs)(w,{flexDirection:"column",marginLeft:2,children:[(e.cite??[]).map((s,c)=>(0,Oe.jsx)(r,{dimColor:!0,children:`cite ${s.anchor??"conv"} \u2014 "${s.quote??""}"`},`cite-${c}`)),(e.depends_on_hint??[]).length>0&&(0,Oe.jsx)(r,{dimColor:!0,children:`depends on: ${(e.depends_on_hint??[]).join(", ")}`}),Object.entries(e.extra??{}).map(([s,c])=>(0,Oe.jsx)(r,{dimColor:!0,children:`${s}: ${c}`},`extra-${s}`))]})}var E=U(Y(),1),kn=(e,s)=>Math.max(0,Math.min(s,e));function Lt(e,s,c){switch(s.type){case"move":return e.level==="detail"?{...e,scroll:Math.max(0,(e.scroll??0)+s.delta)}:{...e,cursor:kn(e.cursor+s.delta,Math.max(0,c-1))};case"enter":return e.level==="list"?{...e,level:"detail",scroll:0}:e;case"back":return e.level==="detail"?{...e,level:"list",scroll:0}:null}}var Or={"use-case":"use-cases",ac:"acs",scenario:"scenarios",test:"tests",gap:"gaps"};function Pr(e,s){if(e.level==="detail")return{level:"detail",cursor:kn(e.num-1,Math.max(0,s.entries.length-1))};if(e.section){let c=s.entries.findIndex(f=>Or[f.kind]===e.section);if(c>=0)return{level:"list",cursor:c}}return{level:"list",cursor:0}}function rs(e){let s=[];for(let c of e.entries){let f=s.find(p=>p.kind===c.kind);f?f.entries.push(c):s.push({kind:c.kind,entries:[c]})}return s}var _r=3;function is({items:e,cursor:s,verb:c,more:f}){let p=`view \xB7 ${c} so far \xB7 ${e.counts.map(u=>`${u.count} ${u.count===1?u.label.replace(/s$/,""):u.label}`).join(" \xB7 ")}`,a=e.entries[s];return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsx)(r,{bold:!0,color:o.assuranceAccent,children:p}),rs(e).map(({kind:u,entries:x})=>{let y=a?.kind===u,T=y?x.findIndex(C=>C.num===a.num):-1,P=y?kn(T-1,Math.max(0,x.length-_r)):0,V=x.slice(P,P+(y?_r:1)),re=x.length-V.length;return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsx)(r,{color:o.dim,children:`${Or[u]??Ct(u)} \xB7 ${x.length}`}),V.map(C=>{let b=y&&C.num===a.num,I=C.item.badge;return(0,E.jsxs)(r,{children:[(0,E.jsx)(r,{color:o.assuranceAccent,children:b?"\u203A ":" "}),(0,E.jsx)(r,{children:`${C.num} \xB7 ${C.item.title}`}),I?(0,E.jsx)(r,{color:o.dim,children:` \xB7 ${I}`}):null]},`${C.kind}:${C.num}`)}),re>0&&(0,E.jsx)(r,{color:o.dim,children:` \u22EE ${re} more`})]},u)}),f?(0,E.jsxs)(r,{children:[(0,E.jsx)(r,{color:o.assuranceAccent,children:s===e.entries.length?"\u203A ":" "}),(0,E.jsx)(r,{color:o.dim,children:`\u22EF show all \u2014 ${f.hidden} more from earlier turns`})]}):null]})}var Bt=14;function ss({items:e,cursor:s,explain:c,grandTotal:f,dossier:p,scroll:a=0}){let u=e.entries[s];if(!u)return(0,E.jsx)(r,{color:o.dim,children:"nothing to show"});if(p){let y=Math.max(0,Math.min(a,Math.max(0,p.lines.length-Bt))),T=p.lines.slice(y,y+Bt);return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsxs)(r,{bold:!0,children:[`view \xB7 ${p.id}`,p.id.toLowerCase()!==p.rawId?(0,E.jsx)(r,{bold:!1,color:o.dim,children:` \xB7 ${p.rawId}`}):null]}),(0,E.jsx)(r,{bold:!0,children:p.title}),y>0?(0,E.jsx)(r,{color:o.muted,children:`\u22EE ${y} above`}):null,T.map((P,V)=>(0,E.jsx)(r,{color:P.dim?o.dim:void 0,children:P.text},`dl-${V}`)),p.lines.length>y+Bt?(0,E.jsx)(r,{color:o.muted,children:`\u22EE ${p.lines.length-y-Bt} more`}):null]})}let x=u.item;return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsx)(r,{bold:!0,children:`view \xB7 ${u.kind} ${u.num} of ${f??e.entries.length}`}),(0,E.jsx)(r,{children:u.item.title}),x.badge?(0,E.jsx)(r,{color:o.dim,children:`kind: ${x.badge}`}):null,x.why?(0,E.jsx)(r,{color:o.dim,children:x.why}):null,(0,E.jsx)(Mr,{item:u.item}),c?.map((y,T)=>(0,E.jsx)(r,{color:o.dim,children:y},`ex-${T}`)),(0,E.jsx)(r,{color:o.dim,children:"view-only \u2014 approvals happen in chat"})]})}function jr({items:e,state:s,verb:c,more:f,explain:p,grandTotal:a,dossier:u=null}){return s.level==="list"?(0,E.jsx)(is,{items:e,cursor:s.cursor,verb:c,more:f}):(0,E.jsx)(ss,{items:e,cursor:s.cursor,explain:p,grandTotal:a,dossier:u,scroll:s.scroll??0})}var J=U(Y(),1),vn=14;function os(e){let s=[],c=null;for(let f of e)f.field!==c&&(c=f.field,s.push({kind:"field",field:c})),s.push({kind:"line",field:c,line:f});return s}function Fr({title:e,lines:s,offset:c=0,remote:f=!1}){let p=os(s),a=Math.max(0,Math.min(c,Math.max(0,p.length-vn))),u=p.slice(a,a+vn),x=a,y=Math.max(0,p.length-a-vn),T=f?`the change to ${e} \xB7 old \u2192 new`:`view \xB7 diff \xB7 ${e} \xB7 current \u2192 proposed`;return(0,J.jsxs)(w,{flexDirection:"column",children:[(0,J.jsx)(r,{bold:!0,color:o.assuranceAccent,children:T}),x>0?(0,J.jsx)(w,{paddingLeft:2,children:(0,J.jsx)(r,{color:o.dim,children:`\u22EE ${x} above`})}):null,u.map((P,V)=>P.kind==="field"?(0,J.jsx)(w,{paddingLeft:2,children:(0,J.jsx)(r,{color:o.dim,children:P.field==="criteria"?f?"acceptance criteria":"criteria":P.field})},`r-${a+V}`):(0,J.jsx)(w,{paddingLeft:4,children:(0,J.jsx)(r,{color:P.line.op==="-"?"red":"green",children:`${P.line.op==="-"?"\u2212":"+"} ${P.line.text}`})},`r-${a+V}`)),y>0?(0,J.jsx)(w,{paddingLeft:2,children:(0,J.jsx)(r,{color:o.dim,children:`\u22EE ${y} more`})}):null]})}var ls={"use-cases":"use-cases",usecases:"use-cases","use-case":"use-cases",acs:"acs",ac:"acs",scenarios:"scenarios",scenario:"scenarios",tests:"tests",test:"tests",gaps:"gaps",gap:"gaps"};function qr(e){let s=(e??"").trim().toLowerCase();if(!s)return{level:"list"};if(/^\d+$/.test(s)){let f=parseInt(s,10);return f>=1?{level:"detail",num:f}:{error:"items are numbered from 1 \u2014 /view 1"}}let c=ls[s];return c?{level:"list",section:c}:{error:"try /view, /view <number>, or /view acs|scenarios|tests"}}var D=U(Y(),1),as=6,Nr=12;function cs(e,s,c){let f=Math.max(20,s),p=[];for(let u of e.split(`
|
|
3
3
|
`)){if(u.length<=f){p.push(u);continue}let x="";for(let y of u.split(" "))x&&x.length+1+y.length>f?(p.push(x),x=y):x=x?`${x} ${y}`:y;p.push(x)}let a=Math.max(0,p.length-c);return{body:p.slice(-c).join(`
|
|
4
4
|
`),hidden:a}}function wn(e){return e.resumed?[{role:"agent",turnIndex:0,items:e.resumed.items},...e.turns]:e.turns}function Wr(e){let s={key:"redesign",label:"re-design from scratch",detail:"replaces the current design"},c={key:"keep",label:"keep the existing design",detail:"back to the list"};return e.designed==="stale"?[{...s,detail:"the use-case changed since it was designed"},c]:[c,s]}function Vr(e){return e.length===0?null:{approved:e.filter(s=>s.verdict==="approve").length,rejected:e.filter(s=>s.verdict==="reject").length,deferred:e.filter(s=>s.verdict==="defer").length}}function ds(e,s){return s?`the changes in ${e} could not be read: ${s.message}`:"no reviewable changes came back \u2014 the source may be unchanged"}function fo({controller:e,verb:s="extract",onCtrlC:c,chain:f=null,inspect:p=null,reconcile:a=null,autoReview:u=!1,onReviewExit:x,meta:y=null,remote:T=null}){let[,P]=(0,g.useState)(0),[V,re]=(0,g.useState)(!1),[C,b]=(0,g.useState)(null),[I,pe]=(0,g.useState)(null),q=(0,g.useRef)(null),[fe,we]=(0,g.useState)(null),W=(0,g.useRef)(null),xe=t=>{W.current=t,we(t)},ie=t=>{q.current=t,pe(t),t===null&&xe(null)},Z=(0,g.useRef)([]),[A,Pe]=(0,g.useState)(null),H=(0,g.useRef)(null),F=t=>{H.current=t,Pe(t)},[h,me]=(0,g.useState)(null),B=(0,g.useRef)(null),$=t=>{B.current=t,me(t)},[Q,et]=(0,g.useState)(null),yn=(0,g.useRef)(null),be=t=>{yn.current=t,et(t)},Mt=(0,g.useRef)({approved:0,rejected:0,deferred:0}),[Kr,Ur]=(0,g.useState)(null),je=(0,g.useRef)({added:0,updated:0}),Fe=(0,g.useRef)(!1),se=(0,g.useRef)(null),[ye,_t]=(0,g.useState)(null),Tn=(0,g.useRef)(new Set),$n=fr(),{stdout:Hr}=Me(),Qr=Hr?.columns??80,Rn=(0,g.useRef)(0),N=T!==null,R=T?.review??null,tt=N&&e.state.ledger.at(-1)?.kind==="agent",Ot=(0,g.useRef)(0);(0,g.useEffect)(()=>{let t=i=>R!==null&&i?.kind==="header"&&(i.era??0)>0,n=()=>{let i=e.state.ledger;for(let d=Rn.current;d<i.length;d++){let v=i[d];if(t(v))continue;let _=v.kind==="turn"?yr(e.state.turns,v.turnIndex,N?At:void 0):void 0;N&&_&&_.fresh.length===0&&_.unchanged.length===0||$n.append((0,D.jsx)(Lr,{block:v,annotations:_,remote:N,afterHeader:i[d-1]?.kind==="header"&&!t(i[d-1])||i[d-1]?.kind==="lines"},`lg-${d}`))}Rn.current=i.length};n();let l=e.subscribe(()=>{n();let i=e.state;q.current&&(i.pending||i.status==="pausing")&&(ie(null),i.pending&&b("questions arrived \u2014 back to chat")),P(d=>d+1)});return P(i=>i+1),l},[e,$n]);let{thinking:ge,status:ee,pending:M,confirm:qe,ledger:oe,activeTurn:Cn,stream:Xr,notice:nt}=e.state,Sn=(Xr?.text??"").trimEnd(),En=Sn.length>0,Gr=V&&(ge.liveThinking.length>0||ge.thinkingLog.length>0),zr=cs(ge.liveThinking||ge.thinkingLog.map(t=>t.text).join(`
|
|
5
5
|
`),Qr-6,Nr),An=En?Sn.split(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{l as
|
|
2
|
+
import{l as _,m as A}from"./chunk-BRWCWZE3.js";import{k as E}from"./chunk-WMXBRC4B.js";import{a as x}from"./chunk-RZ4F3BHX.js";import{spawn as S,spawnSync as T}from"child_process";import{existsSync as y,mkdirSync as I,readFileSync as M,writeFileSync as v}from"fs";import{createConnection as G}from"net";import{homedir as m,platform as h}from"os";import{join as i}from"path";var H=new Set(["1","true","yes"]),f=class extends Error{constructor(o){super(o),this.name="ChromeNotFoundError"}};function ie(e){return e instanceof f?e.message:`Chrome failed: ${e instanceof Error?e.message:String(e)}`}var w={darwin:["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",i(m(),"Applications/Google Chrome.app/Contents/MacOS/Google Chrome"),"/Applications/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing",i(m(),"Applications/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing"),"/Applications/Chromium.app/Contents/MacOS/Chromium"],linux:["/usr/bin/google-chrome","/usr/bin/google-chrome-stable","/usr/bin/google-chrome-for-testing","/usr/local/bin/google-chrome-for-testing",i(m(),"chrome-for-testing/chrome-linux64/chrome"),"/usr/bin/chromium","/usr/bin/chromium-browser","/snap/bin/chromium"],win32:["C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe","C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",i(m(),"AppData\\Local\\Google\\Chrome\\Application\\chrome.exe"),"C:\\chrome-for-testing\\chrome-win64\\chrome.exe",i(m(),"AppData\\Local\\chrome-for-testing\\chrome-win64\\chrome.exe"),i(m(),"AppData\\Local\\kane-chrome\\chrome.exe")]};function L(){let e=process.env.KANE_CLI_CHROME_PATH?.trim();return e||void 0}function N(){let e=L();if(e)return e;let o=h(),r=w[o]??w.linux;for(let t of r)if(y(t))return t;return o==="win32"?"chrome.exe":"google-chrome"}function $(){let e=L();if(e)return y(e);let o=h();if((w[o]??w.linux).some(s=>y(s)))return!0;let t=o==="win32"?"chrome.exe":"google-chrome",n=o==="win32"?"where":"which";try{return T(n,[t],{stdio:"ignore"}).status===0}catch{return!1}}function F(){let e=h();return e==="darwin"?["Google Chrome is required but was not found at any standard path.","","Install via Homebrew (recommended):"," brew install --cask google-chrome","","Or download:"," https://www.google.com/chrome/","","Then re-run your command. Set KANE_CLI_CHROME_PATH=/path/to/chrome","to point at a non-standard install."].join(`
|
|
3
3
|
`):e==="linux"?["Google Chrome is required but was not found at /usr/bin/google-chrome.","(amd64 / x86_64 only \u2014 Google does not ship Chrome for Linux ARM.)","","Debian / Ubuntu (any version):"," wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"," sudo apt install -y ./google-chrome-stable_current_amd64.deb","","Fedora / RHEL / AlmaLinux / Rocky:"," sudo dnf install -y https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm","","Then re-run your command. Set KANE_CLI_CHROME_PATH=/path/to/chrome","to point at a non-standard install."].join(`
|
|
4
4
|
`):e==="win32"?["Google Chrome is required but was not found in Program Files or AppData.","","Install via winget (Windows 10 1809+):"," winget install --id Google.Chrome -e --silent","","Or download:"," https://www.google.com/chrome/","","Then re-run your command. Set KANE_CLI_CHROME_PATH=C:\\path\\to\\chrome.exe","to point at a non-standard install."].join(`
|
|
5
5
|
`):["Google Chrome is required.","Install from https://www.google.com/chrome/","(Note: no official Chrome builds for BSD or Alpine/musl Linux.)"].join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as h,d as P}from"./chunk-SMXABALN.js";import{a as $}from"./chunk-HCBYKLMW.js";import{a as i,b as t,k as O}from"./chunk-33DWJV67.js";import{
|
|
2
|
+
import{c as h,d as P}from"./chunk-SMXABALN.js";import{a as $}from"./chunk-HCBYKLMW.js";import{A as l}from"./chunk-BRWCWZE3.js";import{a as i,b as t,k as O}from"./chunk-33DWJV67.js";import{e as y}from"./chunk-UR6MHSHU.js";var o=y($(),1);function L(a){let c=a.findIndex(m=>m.free);return c>=0?c:null}var v=60,A=100;function N({headline:a,ask:c=!1,rows:m,sel:u,focused:x,freeText:n=null,freeTextNote:d,sublines:B=[],gapAbove:p=!0,accent:s=l.assuranceAccent}){let{stdout:C}=O(),b=C?.columns??80,S=b<v,F=Math.min(b-1,A),f=e=>x&&u===e?(0,o.jsx)(t,{color:s,children:"\u276F"}):" ",T=c?`? ${a}`:a,g=Math.max(4,F-3),R=B.map((e,r)=>(0,o.jsx)(t,{color:l.dim,children:` ${e.length>g?`${e.slice(0,g-1)}\u2026`:e}`},`sub-${r}`)),k=0,w=m.map((e,r)=>e.free?n?(0,o.jsxs)(i,{flexDirection:"column",children:[(0,o.jsxs)(i,{children:[(0,o.jsxs)(t,{children:[(0,o.jsx)(t,{color:s,children:"\u276F"})," ",(0,o.jsx)(t,{color:l.dim,children:"\u270E "})]}),n.keysFromPanel?(0,o.jsx)(P,{value:n.value,placeholder:e.label}):(0,o.jsx)(h,{value:n.value,onChange:n.onChange,onSubmit:n.onSubmit,onCancel:n.onCancel,placeholder:e.label})]}),d?(0,o.jsx)(t,{color:l.muted,children:` ${d}`}):null]},e.key):(0,o.jsxs)(t,{children:[f(r)," ",(0,o.jsx)(t,{color:l.dim,children:`\u270E ${e.label}`})]},e.key):(k+=1,(0,o.jsxs)(t,{bold:x&&u===r,children:[f(r),` ${k}. ${e.label}`,e.detail?(0,o.jsx)(t,{color:l.dim,bold:!1,children:` \u2014 ${e.detail}`}):null]},e.key)));return S?(0,o.jsxs)(i,{marginTop:p?1:0,marginBottom:1,flexDirection:"column",children:[(0,o.jsx)(t,{bold:!0,color:s,children:T}),R,w]}):(0,o.jsxs)(i,{marginTop:p?1:0,marginBottom:1,flexDirection:"column",children:[(0,o.jsx)(t,{bold:!0,color:s,children:T}),R,(0,o.jsx)(t,{children:" "}),w]})}export{L as a,N as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as R,b as C,f as T,h as N,i as _,j as $,k,l as x,m as j,p as A,q as W}from"./chunk-
|
|
2
|
+
import{a as R,b as C,f as T,h as N,i as _,j as $,k,l as x,m as j,p as A,q as W}from"./chunk-RHQLDNZL.js";import{a as p,e as E}from"./chunk-4C7WVQOD.js";var H=500;async function U(t,e){let l=e.now??(()=>new Date),u=e.sleep??(o=>new Promise(m=>setTimeout(m,o))),i=(await t.eventsAfter(0)).map(({seq:o,kind:m,at:S,body:y})=>({seq:o,kind:m,at:S,payload:y})),n=i.length,c=!1,s=null,h=[],d=()=>{for(let o of[...h]){if(s)o.reject(s);else if(n>=o.through)o.resolve();else continue;h.splice(h.indexOf(o),1)}},w=o=>{s=o,d(),e.onStopped(o)};async function r(){if(c||s)return;c=!0;let o=e.retryDeadlineMs??12e4,m=E(o,u,()=>l().getTime());for(;!s&&n<i.length;){let S=i.slice(n,n+H);try{await t.appendEvents(e.generation,S.map(({seq:y,kind:f,at:a,payload:g})=>({seq:y,kind:f,at:a,body:g}))),n+=S.length,m.reset(),e.imports?.answered(),d()}catch(y){let f=y instanceof p?y:new p(0,"UNREACHABLE",String(y));if(k(f)&&e.imports){if(await e.imports.wait())continue;w(x());break}if(!f.retryable){w(f);break}if(!await m.again()){w(new p(f.status,f.code,`the session's events were not stored within ${o/1e3} s: ${f.message}`,null,null,{},f.requestId));break}}}c=!1}return{append(o,m){let S={seq:i.length+1,kind:o,at:l().toISOString(),payload:m};return i.push(S),r(),S},since(o){return i.slice(Math.max(0,o))},lastSeq(){return i.length},halt(o){s||(s=o,d())},flush(){if(s)return Promise.reject(s);let o=i.length;return n>=o?Promise.resolve():new Promise((m,S)=>h.push({through:o,resolve:m,reject:S}))}}}function B(t,e){let l=e.now??(()=>new Date),u=e.sleep??(i=>new Promise(n=>setTimeout(n,i)));return{async save(i,n){if(i!==e.sessionId)throw new Error(`this host holds the token of session ${e.sessionId}; it cannot save session ${i}`);let{status:c,lastActivityAt:s}=n;await t.save({generation:e.generation,...s===void 0?{}:{lastActivityAt:s},...c===void 0?{}:{status:q(c)}})},async end(i,n){if(i!==e.sessionId)throw new Error(`this host holds the token of session ${e.sessionId}; it cannot end session ${i}`);let c=n.state==="complete"||n.state==="failed"?n.state:null;if(c===null)throw new Error(`session ${i}: ${n.state} is not an ending`);let s=e.endDeadlineMs??12e4,h=E(s,u,()=>l().getTime());for(;;)try{await t.save({generation:e.generation,status:q(n),ended:c,lastActivityAt:l().toISOString()});return}catch(d){let w=d instanceof p&&d.retryable&&!await h.again();if(!(d instanceof p)||!d.retryable||w){let r=w?new p(d.status,d.code,`the ending was not stored within ${s/1e3} s: ${d.message}`,null,null,{},d.requestId):d;throw r instanceof p&&e.onStopped?.(r),r}}}}}function q(t){let e=t.checkIn?{checkIn:"phase",...t.phase?{phase:t.phase}:{}}:{};return{state:t.state,panel:t.panel,error:t.error,...e}}var O=class extends Error{constructor(l,u){super(u);this.side=l;this.name="EngineFormsMismatch"}},Y=3e4,G=["main/history","save-state","session-side","ended"];async function Se(t){let e=t.testing??{},l={url:t.url,basicAuth:t.basicAuth,...e.fetch?{fetch:e.fetch}:{},...e.requestDeadlineMs?{requestDeadlineMs:e.requestDeadlineMs}:{}},u=T(l),i=async a=>{let g=E(e.retryDeadlineMs??12e4);for(;;)try{return await a()}catch(v){if(!(v instanceof p)||!v.retryable)throw v;let L=D=>t.onProgress({kind:"retry",attempt:g.attempt,nextInS:Math.ceil(D/1e3),giveUpAt:new Date(g.endsAt()??Date.now()).toISOString(),cause:A(v)});if(!await g.again(L))throw v}};t.onProgress({kind:"connect",step:"service"});let n=t.start.kind==="new"?await i(()=>u.createSession(t.start.body)):await i(()=>u.getSession(t.start.sessionId));if(n.ended!==null)throw new p(409,"SESSION_ENDED",`session ${n.sessionId} has ended (${n.ended}); start a new one`,null,null,{ended:n.ended});let c=$({...l,sessionId:n.sessionId,onBody:K(t.onProgress)});t.onProgress({kind:"connect",step:"session",sid:n.sessionId,...t.projectName!==void 0?{project:t.projectName}:{}});let s=await i(()=>c.claim()),h=G.filter(a=>!s.features?.includes(a));if(h.length>0)throw new O("service_older",`Lattice at ${t.url} does not serve ${h.join(", ")}; it is older than this kane-cli`);let d=s.engine;if(!d||1>d.forms||1<d.oldestRead){let a=d&&1<d.oldestRead?"cli_older":"service_older";throw new O(a,`Lattice at ${t.url} serves engine forms ${d?.oldestRead??"none"} to ${d?.forms??"none"}, and this kane-cli writes ${1}`)}let w=!1,r=null,o=a=>{if(w)return;w=!0,clearInterval(f);let g=a.code===_&&r!==null;t.onStopped(g?new p(a.status,V,`the lease lapsed while Lattice could not be reached: ${a.message}`,null,null,{},a.requestId):a)},m=e.leaseRenewMs??Y,S=e.retryDeadlineMs??12e4,y=0,f=setInterval(()=>{c.renewLease(s.generation).then(()=>{r=null,y=0},a=>{if(!(a instanceof p))return;if(J.has(a.code))return o(a);if(!a.retryable)return;let g=Date.now();r??=g;let v=r+S;if(g>=v)return o(new p(a.status,a.code,`Lattice did not take the lease for ${S/1e3} s: ${a.message}`,null,null,{},a.requestId));y+=1,t.onProgress({kind:"retry",attempt:y,nextInS:Math.ceil(m/1e3),giveUpAt:new Date(v).toISOString(),cause:A(a)})})},m);f.unref();try{let a=j(),g=e.retryDeadlineMs!==void 0?{retryDeadlineMs:e.retryDeadlineMs}:{},v=await U(c,{generation:s.generation,onStopped:o,imports:a,...g}),L=B(c,{sessionId:n.sessionId,generation:s.generation,onStopped:o}),D=W(c,{generation:s.generation,historyForms:d.forms,children:s.children,onStopped:o,log:v,imports:a,onRetry:P=>t.onProgress({kind:"retry",attempt:P.attempt,nextInS:Math.ceil(P.nextInMs/1e3),giveUpAt:new Date(P.giveUpAt).toISOString(),cause:P.cause}),...g}),M=await u.getSession(n.sessionId);return t.start.kind==="new"&&ee(u,M,t.onProgress,t.log??(()=>{})),{record:M,claim:s,client:c,person:u,storeCalls:D,log:v,state:L,release:()=>clearInterval(f)}}catch(a){throw clearInterval(f),a}}var V="CONNECTION_LOST",J=new Set([_,N,"SESSION_ENDED","PROJECT_NOT_MARKED"]);function K(t){let e=new Map;return(l,u,i)=>{let n=/\/main\/history/.test(l)?"history":/\/embeddings\?/.test(l)?"search":/\/scope\/drafts/.test(l)?"session":null;if(n===null)return;let c=i===null?0:Math.min(10,Math.floor(u*10/Math.max(i,1)));e.has(l)&&e.get(l)>=c||(e.set(l,c),t({kind:"load",part:n,done:u,total:i,unit:"bytes"}))}}var F=3e3,Q=4;async function z(t,e,l,u){if(!l.sourceId&&!l.useCase)return[];let i=await t.listSessions(e,l),n=i.find(c=>c.sessionId===u)?.userId??null;return Z(t,e,i.filter(c=>c.sessionId!==u),n)}function X(t,e){return t.mine!==void 0?t.mine?"you":"someone_else":e===null?null:t.userId===e?"you":"someone_else"}async function Z(t,e,l,u,i=Q){let n=l.filter(r=>R(r)!=="saved"&&R(r)!=="discarded"),c=async r=>{let o=(await t.counts(e,r.sessionId)).proposes,m=r.verb==="design"?C(o):o.useCases??0;return{sid:r.sessionId,owner:X(r,u),verb:r.verb,subject:r.useCase??r.sourceId,state:R(r),added:m,lastActivityAt:r.lastActivityAt??r.createdAt}},s=new Array(n.length),h=0,d=async()=>{for(let r=h++;r<n.length;r=h++)s[r]=await c(n[r])};await Promise.all(Array.from({length:Math.min(i,n.length)},d));let w=r=>Date.parse(r.lastActivityAt??"")||0;return s.sort((r,o)=>+(o.owner==="you")-+(r.owner==="you")||w(o)-w(r))}function ee(t,e,l,u){let i=!1,n=setTimeout(()=>i=!0,F);n.unref();let c={...e.sourceId?{sourceId:e.sourceId}:{},...e.useCase?{useCase:e.useCase}:{}};z(t,e.projectId,c,e.sessionId).then(s=>{clearTimeout(n),i?u(`the other open sessions on this subject answered after ${F/1e3} s, too late to show (${s.length} open)`):s.length>0&&l({kind:"overlap",sessions:s})},s=>{clearTimeout(n),u(`the other open sessions on this subject couldn't be read: ${s instanceof p?`${s.code}: ${s.message}`:s instanceof Error?s.message:String(s)}`)})}export{O as a,Se as b,X as c,Z as d};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{f as y,h as z,j as U}from"./chunk-
|
|
2
|
+
import{f as y,h as z,j as U}from"./chunk-V4SL74TK.js";import{b as N,c as O,e as S,f as D,j as T}from"./chunk-77ZZQJLX.js";import{a as Y}from"./chunk-JIRNI5TB.js";import{a as M}from"./chunk-UTM7D4PI.js";import{a as R}from"./chunk-FCD3NYOM.js";import{a as F}from"./chunk-XDAFRUAJ.js";import{a as A}from"./chunk-BRWCWZE3.js";import{e as $}from"./chunk-UR6MHSHU.js";var C=$(Y(),1);import{existsSync as k,readFileSync as I,readdirSync as J,statSync as K}from"fs";import{dirname as H,isAbsolute as V,join as h,relative as P,resolve as Z,sep as _}from"path";import{createHash as q}from"crypto";var b="testmd-bundle.json",u=class extends Error{constructor(t){super(t),this.name="BundleUsageError"}},B=e=>e.split(_).join("/");function v(e){if(!k(e))return[];let t=[];for(let s of J(e).sort()){let r=h(e,s);K(r).isDirectory()?t.push(...v(r)):t.push(r)}return t}function G(e){let t=e.map(r=>H(r).split(_)),s=t[0];for(let r of t.slice(1)){let i=0;for(;i<s.length&&i<r.length&&s[i]===r[i];)i++;s=s.slice(0,i)}return s.join(_)||_}function Q(e){for(let t of e){let s=F(t,I(t,"utf8"));for(let r of s.steps)if(r.body.kind==="import_ref"&&V(r.body.path))throw new u(`bundle sync: absolute @import is not portable after unzip: ${t} step ${r.index} (@import ${r.body.path})`)}}function j(e,t={}){let s=Z(e),r=S(s),i=y(s);if(!i?.commit_id||!i?.test_id)throw new u(`bundle sync: ${s} is not authored \u2014 run \`kane-cli testmd run\` first (output-<stem>/.internal/meta.json needs commit_id + test_id)`);let l;try{l=U(s)}catch(n){throw n instanceof z?new u(`bundle sync: ${n.message}`):n}let a=[s];for(let n of l.steps)for(let c of n.trace.slice(1))a.includes(c.file)||a.push(c.file);Q(a);let o=[],d=[];for(let n of l.unitFiles){if(n.file===s)continue;let c=N(n.file);o.includes(c)||o.push(c),n.kind==="module"&&d.push(S(n.file))}let m=[...a],p=n=>{k(n)&&m.push(n)};p(O(s)),m.push(r),p(D(s)),m.push(...v(T(s)));for(let n of o)p(h(n,"Result.md")),m.push(...v(h(n,".internal","steps")));for(let n of d)p(n);let f=G(m);if(k(h(f,b)))throw new u(`bundle sync: a real file named ${b} exists at the zip root (${f}) \u2014 it would collide with the generated manifest`);let x=m.map(n=>{let c=n===r&&t.identityOverride?Buffer.from(JSON.stringify({...JSON.parse(I(n,"utf8")),commit_id:t.identityOverride.commit_id},null,2)+`
|
|
3
3
|
`):void 0,E=c??I(n);return{abs:n,rel:B(P(f,n)),sha256:q("sha256").update(E).digest("hex"),bytes:E.length,...c?{contents:c}:{}}}).sort((n,c)=>n.rel<c.rel?-1:1),w=B(P(f,s)),L={schema_version:2,entry:w,commit_id:t.identityOverride?.commit_id??i.commit_id,test_id:i.test_id,testcase_id:i.testcase_id??null,project_id:i.project_id??null,folder_id:i.folder_id??null,org_id:i.org_id??null,created_at:new Date().toISOString(),producer:{name:"kane-cli",version:A},files:x.map(n=>({path:n.rel,sha256:n.sha256,bytes:n.bytes})),units:l.unitFiles.filter(n=>n.file!==s).map(n=>({path:B(P(f,n.file)),kind:n.kind}))};return{zipRoot:f,entry:w,files:x,manifest:L}}var g=e=>e instanceof Error?e.message:String(e);function W(e){return new Promise((t,s)=>{let r=(0,C.default)("zip",{zlib:{level:6}}),i=[];r.on("data",l=>i.push(l)),r.on("error",s),r.on("end",()=>t(Buffer.concat(i))),r.append(JSON.stringify(e.manifest,null,2)+`
|
|
4
4
|
`,{name:b});for(let l of e.files)l.contents?r.append(l.contents,{name:l.rel}):r.file(l.abs,{name:l.rel});r.finalize()})}async function X(e){let{plan:t,controller:s,testId:r,sessionId:i,commitId:l}=e,a;try{a=await W(t)}catch(d){return{ok:!1,stage:"zip",error:g(d)}}let o;try{let d={key:"testmd",content_type:"application/zip",filename:`${l}-testmd.zip`},p=(await s.getPresignedUrls(r,i,[d])).urls?.testmd?.upload_url;if(!p)return{ok:!1,stage:"presign",error:"presign response missing testmd upload_url"};o=p}catch(d){return{ok:!1,stage:"presign",error:g(d)}}try{await M(o,a,"application/zip")}catch(d){return{ok:!1,stage:"upload",error:g(d)}}return{ok:!0,bytes:a.length}}async function ee(e){let t;try{t=j(e.sourcePath,{identityOverride:e.identityOverride})}catch(s){return s instanceof u?{ok:!1,stage:"collect",error:s.message}:{ok:!1,stage:"collect",error:g(s)}}return X({...e,plan:t})}function ge(e){return e.shouldUploadPipeline&&e.uploadSucceeded&&!!e.metaCommitId&&!!e.metaTestId}function te(e){return e.persisted?e.uploadSucceeded?e.local?"local":e.hasBasicAuth?!e.metaCommitId||!e.metaTestId?"not_authored":null:"no_auth":"upload_failed":"not_persisted"}async function ye(e){let t=e.recordedTestPath??null,s=t?y(t):null,r=te({persisted:!!t,uploadSucceeded:e.uploadSucceeded,local:e.local,hasBasicAuth:!!e.basicAuth,metaCommitId:s?.commit_id,metaTestId:s?.test_id});if(r)return e.log("info","BUNDLE_SYNC_SKIPPED","testmd bundle sync skipped",{reason:r,...t?{path:t}:{}}),{skipped:r};let i=s.commit_id,l=s.test_id,a=o=>{try{e.onAgentEvent?.(o)}catch{}};try{let o=await(e.syncFn??ee)({sourcePath:t,testId:l,sessionId:e.sessionId,commitId:i,controller:new R(e.controllerBaseUrl,{username:e.basicAuth.username,accessKey:e.basicAuth.access_key})});return o.ok?(e.log("info","BUNDLE_SYNC_OK","testmd bundle pushed",{commit_id:i,path:t,bytes:o.bytes}),a({type:"test_md_bundle_sync",status:"ok",commit_id:i,path:t,bytes:o.bytes})):(e.log("warn","BUNDLE_SYNC_FAILED","testmd bundle sync failed",{commit_id:i,path:t,stage:o.stage,error:o.error}),a({type:"test_md_bundle_sync",status:"failed",commit_id:i,path:t,stage:o.stage})),o}catch(o){let d=g(o);return e.log("warn","BUNDLE_SYNC_FAILED","testmd bundle sync threw",{commit_id:i,path:t,error:d}),a({type:"test_md_bundle_sync",status:"failed",commit_id:i,path:t,stage:"upload"}),{ok:!1,stage:"upload",error:d}}}export{j as a,W as b,X as c,ee as d,ge as e,te as f,ye as g};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as w,b as C}from"./chunk-
|
|
2
|
+
import{a as w,b as C}from"./chunk-QLGQDNA3.js";import{e as y}from"./chunk-IT6M7OMG.js";import{a as j,b as I,e as x}from"./chunk-RM5ZVDVR.js";import{i as k}from"./chunk-XMPTFXPW.js";import{Ha as i,f as h}from"./chunk-RHQLDNZL.js";import{a as l}from"./chunk-4C7WVQOD.js";import{o as g}from"./chunk-OKCVG7AG.js";import{c as m}from"./chunk-V24LUINK.js";import{readFileSync as A}from"fs";import{basename as T,dirname as p,join as N}from"path";var S=5e3,O=w("assurance-case");function _(e,t={}){let s=p(e);if(T(s)!=="tests"||T(p(s))!==".testmuai")return null;let n=p(p(s)),a;try{a=g(A(e,"utf8"))}catch{return null}if(!a?.id)return null;let r=(c,u,d)=>({root:n,latticeUrl:c,projectId:u,projectName:d,test:a.id,base:a.base??null});if(t.grid){let c=x(N(n,j));return c===null?null:r("",c.projectId,c.projectName)}let o=I(n,t.address??m());return o.kind==="remote"?r(o.latticeUrl,o.projectId,o.projectName):null}function K(e,t={}){let s={};for(let n of e){let a=_(n,t);a?.base&&(s[n]={test:a.test,definitionId:a.base})}return s}async function V(e){let t=_(e.testFile,{address:e.address,grid:e.gridCase!==void 0});if(t===null)return{kind:"unlinked"};let s=t.base===null?null:{test:t.test,definitionId:t.base},n=e.metaCaseId===null;if(e.gridCase)return R(t,s,e.metaCaseId,{caseId:e.gridCase.caseId,internalId:e.gridCase.tc,canAttach:!0});if(s===null)return{kind:"stop",stop:{why:"not_in_project",useCase:null},projectName:t.projectName};let a;try{let r=e.auth??await y(),o=e.lookup??((c,u,d)=>h({url:t.latticeUrl,basicAuth:r}).testCase(c,u,d));a=await L(o(t.projectId,t.test,s.definitionId),e.budgetMs??S)}catch(r){return r instanceof l&&r.code==="NO_CONTEXT"?{kind:"stop",stop:{why:"no_work"},projectName:t.projectName}:(O(`the test case of ${t.test} wasn't checked: ${r instanceof f?r.message:C(r)}`),n?{kind:"stop",stop:{why:"lookup",refusal:v(r,t.projectName)},projectName:t.projectName}:{kind:"run",projectId:t.projectId,tc:null,stamp:s})}return"refused"in a?{kind:"stop",stop:E(a.refused),projectName:t.projectName}:R(t,s,e.metaCaseId,a.linked)}function R(e,t,s,n){return s===n.caseId?{kind:"run",projectId:e.projectId,tc:n.internalId,stamp:t}:n.canAttach?{kind:"attach",projectId:e.projectId,caseId:n.caseId,tc:n.internalId,stamp:t,rehome:s!==null}:{kind:"stop",stop:{why:"outdated"},projectName:e.projectName}}function X(e,t){switch(e.why){case"missing":return{refusal:i.testCaseMissing(e.session),exit:2};case"gone":return{refusal:i.testCaseGone(e.session),exit:2};case"archived":return{refusal:i.testCaseArchived(),exit:2};case"not_in_project":return{refusal:i.testNotInProject(t,e.useCase),exit:2};case"no_work":return{refusal:i.testProjectHasNoWork(t),exit:2};case"outdated":return{refusal:i.testManagerOutdated(),exit:1};case"lookup":return{refusal:e.refusal,exit:2}}}function b(e){switch(e.why){case"missing":return e.session?{reason:"it isn't in Test Manager yet; save the session that designed it:",cmd:`kane-cli context sessions save ${e.session}`}:{reason:"it isn't in Test Manager yet; find its session, then save it:",cmd:"kane-cli context sessions"};case"gone":return e.session?{reason:"its test case was deleted or moved; saving its session makes a new one:",cmd:`kane-cli context sessions save ${e.session}`}:{reason:"its test case was deleted or moved; find its session, then save it:",cmd:"kane-cli context sessions"};case"archived":return{reason:"its test case is archived in Test Manager; restore it there"};case"not_in_project":return{reason:"the session that designed it can't be saved anymore; design it again:",cmd:`kane-cli design tests --use-case ${e.useCase??"<use-case>"}`}}}function q(e){if(e.some(r=>r.stop.why==="outdated"))return{pair:i.dispatchTestManagerOutdated()};let t=e.find(r=>r.stop.why==="lookup")?.stop;if(t?.why==="lookup")return{pair:t.refusal};let s=e.find(r=>r.stop.why==="no_work");if(s)return{pair:i.dispatchProjectHasNoWork(s.projectName)};let n=[{text:i.dispatchStopped(e.length)}],a=new Set;for(let{relPath:r,stop:o}of e){if(o.why==="outdated"||o.why==="lookup"||o.why==="no_work")continue;let{reason:c,cmd:u}=b(o),d=u!==void 0&&a.has(u);n.push({text:` ${r}`,dim:!0},{text:` ${d?`${c.replace(/:$/,"")}, as above`:c}`,dim:!0}),u&&!d&&(a.add(u),n.push({text:` ${u}`}))}return n.push({text:i.dispatchNext(e.length)}),{lines:n}}function z(e){return{refusal:e.reason==="outdated"?i.testManagerMadeItsOwn():i.testCaseAttachFailed(),exit:1}}function E(e){switch(e.code){case"NO_CASE":return{why:"missing",session:e.session};case"CASE_BROKEN":return{why:"gone",session:e.session};case"CASE_ARCHIVED":return{why:"archived",internalId:e.internalId};case"TEST_FILE_STALE":return{why:"not_in_project",useCase:e.useCase}}}function v(e,t){return e instanceof k?{code:e.code,message:e.message,...e.remedy?{remedy:e.remedy}:{}}:e instanceof l&&e.status===401?i.credentialsRejected():e instanceof l&&e.code==="NOT_FOUND"?i.noAccess(t):e instanceof l&&e.code==="PROJECT_NOT_MARKED"?i.assuranceOff(t):i.noConnection()}var f=class extends Error{};async function L(e,t){let s,n=new Promise((a,r)=>{s=setTimeout(()=>r(new f(`Lattice took over ${t} ms`)),t)});try{return await Promise.race([e,n])}finally{clearTimeout(s)}}export{S as a,_ as b,K as c,V as d,X as e,q as f,z as g,f as h,L as i};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{i as U}from"./chunk-
|
|
2
|
+
import{i as U}from"./chunk-3CFAE36M.js";import{g as S}from"./chunk-C3DMMAFP.js";import{a as E}from"./chunk-DBMW3VUN.js";var h=1,v=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;var L=["cites-deep"],C=["observe","events","refresh","check","tools","migrate"],d={remote:"fetch",explain:"explain",context:"context",coverage:"coverage"},x=class extends Error{remedy;constructor(a,p){super(a),this.name="SourcePluginRefusal",this.remedy=p}};var T=class extends Error{refusal;constructor(a){super(`${a.code}: ${a.message}${a.remedy?` \u2014 ${a.remedy}`:""}`),this.name="SourcePluginError",this.refusal=a}};function A(l){let a=l.manifest?.capabilities;return Array.isArray(a)?a:[]}var i=(l,a,p={})=>{throw new T({code:l,message:a,...p})},R="test-",O=new Set(["http","https","file"]),b=new Set(U.map(l=>l.name)),G=Object.values(d),$=/^([a-z][a-z0-9-]{1,31}):([\s\S]+)$/,_={plugins:[],byId:()=>{},route:()=>null},D=l=>/(\.[^./\\]+)$/.exec(l)?.[1]?.toLowerCase()??"";function Y(l,a={}){let p=new Set(S.flatMap(o=>o.extensions)),c=new Map,P=new Map,I=new Map;for(let o of l){let r=o?.manifest,e=typeof r?.id=="string"?r.id:"",t={plugin:e||"(no id)"};r?.contract!==h&&i("PLUGIN_CONTRACT_UNSUPPORTED",`plugin ${t.plugin} is written against contract ${String(r?.contract)}; this build has contract ${h}`,t),E.test(e)||i("PLUGIN_ID_INVALID",`${JSON.stringify(r.id)} is not a plugin id: lower-case letters, digits and hyphens, starting with a letter, 2 to 32 characters`,t),e.startsWith(R)&&a.allowTestPlugins!==!0&&i("PLUGIN_ID_RESERVED",`plugin ${e} is a test plugin: an id starting with ${R} is loaded by the conformance suite only`,t),O.has(e)&&i("PLUGIN_ID_TAKEN",`${e} cannot be a plugin id: it already means something at the start of an input`,t),b.has(e)&&i("PLUGIN_ID_TAKEN",`${e} cannot be a plugin id: it is the name of a built-in remote source kind`,t),(c.has(e)||I.has(e))&&i("PLUGIN_ID_TAKEN",`two loaded plugins use the name ${e}`,t),(typeof r.version!="string"||r.version==="")&&i("PLUGIN_ID_INVALID",`plugin ${e} names no version`,t),(typeof r.rules!="string"||r.rules==="")&&i("PLUGIN_RULES_MISSING",`plugin ${e} names no fingerprint-rules version`,t),r.capabilities!==void 0&&!Array.isArray(r.capabilities)&&i("PLUGIN_CAPABILITY_UNKNOWN",`plugin ${e}: capabilities must be a list of capability names`,t);let u=A(o);for(let n of u){if(L.includes(n))continue;if(!(n in d)){let N=C.includes(n);i("PLUGIN_CAPABILITY_UNKNOWN",`plugin ${e} lists the capability ${JSON.stringify(n)}, which ${N?"is reserved and not defined yet":"this contract does not define"}`,t)}let s=d[n];typeof o[s]!="function"&&i("PLUGIN_CAPABILITY_WITHOUT_HOOK",`plugin ${e} lists the capability ${n} and has no ${s} hook`,t)}u.includes("cites-deep")&&!(u.includes("context")&&typeof o.context=="function")&&i("PLUGIN_CITES_DEEP_WITHOUT_CONTEXT",`plugin ${e} lists the capability cites-deep without the capability context and its hook: the instruction to cite each criterion, scenario and test could never reach the design agent`,{...t,remedy:"list the context capability, with its hook, and say in its design note what each item should cite"});for(let n of G){let s=Object.entries(d).find(([,N])=>N===n)[0];o[n]!==void 0&&!u.includes(s)&&i("PLUGIN_HOOK_WITHOUT_CAPABILITY",`plugin ${e} has the hook ${n} and does not list the capability ${s}`,t)}for(let n of["claim","render","index"])typeof o[n]!="function"&&i("PLUGIN_CAPABILITY_WITHOUT_HOOK",`plugin ${e} has no ${n} hook, which every plugin needs`,t);let g=r.claims?.extensions??[];Array.isArray(g)||i("PLUGIN_EXTENSION_TAKEN",`plugin ${e} claims its extensions as ${JSON.stringify(g)}, which is not a list`,t);for(let n of g){(typeof n!="string"||!/^\.[a-z0-9][a-z0-9._-]*$/.test(n))&&i("PLUGIN_EXTENSION_TAKEN",`plugin ${e} claims ${JSON.stringify(n)}, which is not a file extension: lower-case, starting with a dot`,t);let s=n;s.lastIndexOf(".")!==0&&i("PLUGIN_EXTENSION_TAKEN",`plugin ${e} claims ${s}, which holds a second dot: an input's extension is what follows its last dot, so no input would ever be routed to it`,t),p.has(s)&&i("PLUGIN_EXTENSION_TAKEN",`plugin ${e} claims ${s}, which a built-in source kind already reads`,t),P.has(s)&&i("PLUGIN_EXTENSION_TAKEN",`plugin ${e} claims ${s}, which plugin ${P.get(s).manifest.id} already claims`,t),P.set(s,o)}let y=r.claims?.schemes??[];Array.isArray(y)||i("PLUGIN_SCHEME_TAKEN",`plugin ${e} claims its schemes as ${JSON.stringify(y)}, which is not a list`,t);for(let n of y){(typeof n!="string"||!E.test(n)||O.has(n))&&i("PLUGIN_SCHEME_TAKEN",`plugin ${e} claims the scheme ${JSON.stringify(n)}, which is not one a plugin may have`,t);let s=n;b.has(s)&&i("PLUGIN_SCHEME_TAKEN",`plugin ${e} claims the scheme ${s}, which is the name of a built-in remote source kind`,t),(I.has(s)||c.has(s)&&s!==e)&&i("PLUGIN_SCHEME_TAKEN",`plugin ${e} claims the scheme ${s}, which another loaded plugin already uses`,t),I.set(s,o)}c.set(e,o)}for(let[o,r]of I)A(r).includes("remote")||i("PLUGIN_SCHEME_WITHOUT_REMOTE",`plugin ${r.manifest.id} claims the scheme ${o} but has no remote capability, so it can never read a ${o}:// input`,{plugin:r.manifest.id});return c.size===0?_:{plugins:[...c.values()],byId:o=>c.get(o),route(o,r){let e=$.exec(o);if(e&&!r(o)){let u=I.get(e[1]);if(u)return{plugin:u,ref:o,named:!1};let g=c.get(e[1]);if(g)return{plugin:g,ref:e[2],named:!0}}let t=P.get(D(o));return t&&!/^https?:\/\//i.test(o)?{plugin:t,ref:o,named:!1}:null}}}var f=_,m,J=()=>f,j=()=>m;function q(l,a){if(f!==_)throw new Error("a source-plugin registry is already installed: a host installs its registry once");return f=l,m=a,()=>{f===l&&(f=_,m=void 0)}}export{v as a,x as b,T as c,A as d,i as e,_ as f,Y as g,J as h,j as i,q as j};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as O,c as P}from"./chunk-SMXABALN.js";import{b as I,c as L}from"./chunk-BWXLZS5O.js";import{a as M,b as $}from"./chunk-LRNUGKYH.js";import{oa as j}from"./chunk-PI7OXS62.js";import{a as D}from"./chunk-HCBYKLMW.js";import{a as m,b as s,k as _}from"./chunk-33DWJV67.js";import{a as q}from"./chunk-6YGTRKDT.js";import{z as f}from"./chunk-J4FIESTB.js";import{e as C}from"./chunk-UR6MHSHU.js";var F={"acceptance criteria":1,scenarios:2,"acceptance criteria + exercises":3,"tests + gaps":4,tests:4};function J(e,i,n={}){let r=[],u=L(e.turns).entries.length;if(i==="design"){let c;for(let g=e.ledger.length-1;g>=0;g--){let p=e.ledger[g];if(p.kind==="banner"&&p.text.startsWith("designing: ")){c=p.text.slice(11);break}}let o=n.remote&&!c?e.ledger.find(g=>g.kind==="header")?.phase:void 0,v=c?F[c]:o;v&&r.push(`phase ${v}/4`),u>0&&!n.remote&&r.push(`${u} item${u===1?"":"s"} this session`)}else u>0&&!n.remote&&r.push(`${u} saved as draft${u===1?"":"s"}`);let l=n.remote?n.added??I(e.turns):0,a=n.remote?n.updated??0:0;(l>0||a>0)&&r.push([l>0?`${l} added`:"",a>0?`${a} updated`:"","not saved yet"].filter(Boolean).join(" \xB7 "));let h=e.pending?e.pending.resolution.filter(c=>!c).length:0;return h>0&&r.push(`${h} question${h===1?"":"s"} pending`),e.credits&&r.push(`${e.credits.total.toFixed(1)} credits`),{items:r}}function Z(e,i){let n=[],r=e.applied+e.committed+e.retired;n.push(`${r} applied`),n.push(`${i} to decide`);let u=[];return e.skipped>0&&u.push(`${e.skipped} skipped`),e.deferred>0&&u.push(`${e.deferred} deferred`),e.failed>0&&u.push(`${e.failed} failed`),{items:[...n,...u]}}var x=C(q(),1);function ne({onToggleThinking:e,onCtrlC:i,explorer:n,panel:r}){let l=(0,x.useRef)(null),a=(0,x.useRef)(""),h=()=>{l.current&&clearTimeout(l.current),l.current=null,a.current=""};return(0,x.useEffect)(()=>h,[]),O((c,o)=>{if(o.ctrl&&c==="t"){e();return}if(o.ctrl&&c==="c"){i();return}if(!o.ctrl&&c.includes("")){i();return}if(!o.ctrl&&c.includes("")){e();return}if(n&&n.isOpen()){let v=()=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{h(),n.onBack()},150)};if(l.current){if(o.upArrow||o.downArrow||o.return){h(),o.return?n.onEnter():n.onMove(o.upArrow?-1:1);return}if(a.current+=c,a.current==="["){v();return}let g=a.current;h();let p=/^\[([ABCD])/.exec(g);if(p){(p[1]==="A"||p[1]==="B")&&n.onMove(p[1]==="A"?-1:1);return}n.onBack();return}if(o.upArrow){n.onMove(-1);return}if(o.downArrow){n.onMove(1);return}if(o.return){n.onEnter();return}if(o.escape){a.current="",v();return}return}if(r&&r.isFocused()){let v=()=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{h(),r.onBack()},150)};if(l.current){if(o.upArrow||o.downArrow||o.return||o.leftArrow||o.rightArrow){h(),o.return?r.onSelect():o.leftArrow?r.onLeft?.():o.rightArrow?r.onRight?.():r.onMove(o.upArrow?-1:1);return}if(a.current+=c,a.current==="["){v();return}let g=a.current;h();let p=/^\[([ABCD])/.exec(g);if(p){p[1]==="A"||p[1]==="B"?r.onMove(p[1]==="A"?-1:1):p[1]==="C"?r.onRight?.():r.onLeft?.();return}r.onBack();return}if(o.upArrow){r.onMove(-1);return}if(o.downArrow){r.onMove(1);return}if(o.leftArrow){r.onLeft?.();return}if(o.rightArrow){r.onRight?.();return}if(o.return){r.onSelect();return}if(o.escape){a.current="",v();return}if(/^[1-9]$/.test(c)){r.onDigit(Number(c));return}if(o.tab){r.onTab?.();return}if(c===" "&&r.isMulti()){r.onSpace();return}if(c&&!o.ctrl&&!o.meta){r.onType(c);return}return}}),null}var t=C(D(),1);function N(e,i=!1){return i?Y(e):e.kind==="REVIEW"?[{v:"approve",label:"approve",detail:"mark it reviewed and trusted"},{v:"archive",label:"archive",detail:"reject it \u2014 asks for a reason; impact shown above"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="PAIR"?[{v:"merge",label:"merge",detail:"duplicate \u2014 fold into the older item (it stays unreviewed)"},{v:"keep_both",label:"keep both",detail:"genuinely distinct \u2014 promote both"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="ARCHIVE"?[{v:"archive",label:"retire",detail:"hidden from now on; history is kept and it can be reverted"},{v:"skip",label:"skip",detail:"keep it \u2014 decided, never re-offered"},{v:"defer",label:"defer",detail:"not now \u2014 the plan re-offers it"}]:e.heldPayload?[{v:"approve",label:"approve update",detail:"commit the held payload \u2014 impact preview above"},{v:"skip",label:"keep current",detail:"drop the held payload (the owner's disk state stays untouched)"},{v:"defer",label:"defer",detail:"not now \u2014 stays held"}]:[{v:"approve",label:"approve",detail:e.kind==="ADD"?"commit + design it":"commit the updated version (old\u2192new redirect)"},{v:"skip",label:e.origin==="content-change"?"reject":"skip",detail:e.origin==="content-change"?"drop the staged proposal \u2014 nothing committed":"leave it as is"},{v:"defer",label:"defer",detail:"not now \u2014 the plan keeps it staged"}]}var Q=e=>e===0?null:e===1?"its test was designed for the old version":`its ${e} tests were designed for the old version`;function Y(e){return e.heldPayload?[{v:"approve",label:"approve the change",detail:"the use-case takes the new version"},{v:"skip",label:"keep it as it is",detail:"the change is dropped"},{v:"defer",label:"decide later",detail:"it keeps waiting"}]:e.kind==="ARCHIVE"?[...e.archiveRefused?[]:[{v:"archive",label:"archive",detail:"it's hidden from the project from now on"}],{v:"skip",label:"keep it",detail:"it stays as it is; this may be suggested again"},{v:"defer",label:"defer",detail:"decide later; it's kept as an open question"}]:e.kind==="ADD"?[{v:"approve",label:"approve",detail:"add it to this session"},{v:"skip",label:"reject",detail:"leave it out; it may be suggested again"},{v:"defer",label:"defer",detail:"leave it out for now, as an open question"}]:[{v:"approve",label:"approve",detail:"the use-case takes the new version"},{v:"skip",label:"reject",detail:"it stays as it is; the change may be suggested again"},{v:"defer",label:"defer",detail:"it stays as it is for now, as an open question"}]}function K(e,i=!1){let n=N(e,i);return e.viewDiff&&n.push({v:"view_diff",label:"view diff",detail:i?"the whole change, old \u2192 new":"full old \u2192 new"}),n}function R(e,i=!1){return e.kind==="ARCHIVE"?null:K(e,i).length}var G={ADD:{color:f.green??"green"},MODIFY:{color:"yellow"},ARCHIVE:{color:f.red},REVIEW:{color:"cyan"},PAIR:{color:"magenta"}},U=60,X=(e,i)=>`${e.heldPayload?"changed earlier":e.kind==="ADD"?"new":e.kind==="ARCHIVE"?`no longer in ${$(i)}`:"changed"}:`;function de({card:e,position:i,sel:n=0,focused:r=!1,freeText:u=null,editorIntent:l="steer",remote:a,gapAbove:h=!0}){let{stdout:c}=_(),o=c?.columns??80,v=o<U,g=K(e,!!a),p=R(e,!!a),H=G[e.kind],S=d=>r&&n===d?(0,t.jsx)(s,{color:f.assuranceAccent,children:"\u276F"}):" ",b=e.impact,k=a?e.kind==="MODIFY"?Q(e.tests??0):null:b&&"stale_refs"in b&&b.stale_refs.length>0?`${e.kind==="ARCHIVE"?"retiring leaves":"approving marks"} ${b.stale_refs.length} item(s) stale`+((b.direct_refs?.length??0)>0?` \u2014 ${b.direct_refs.length} directly touched: ${b.direct_refs.join(", ")}`:""):b&&"design_children"in b?`${e.kind==="REVIEW"?"archiving drops":"merging folds"} ${b.design_children} design child(ren)`:null,T=e.provenance&&e.provenance!==e.why?e.provenance:a?null:e.origin??null,B=a?[{label:"change",text:e.why},...T?[{label:"from",text:T,dimmer:!0}]:[],...k?[{label:"tests",text:k}]:[]]:[{label:"why",text:e.why},...T?[{label:"from",text:T,dimmer:!0}]:[],...e.tier?[{label:"match",text:e.tier,dimmer:!0}]:[],...k?[{label:"impact",text:k}]:[]],E=Math.max(...B.map(d=>d.label.length)),A=a?`? review the changes from ${$(a.source)}`:"? reconcile",y=a?`${i.n} of ${i.of}`:`item ${i.n} of ${i.of}`,W=(0,t.jsxs)(m,{flexDirection:"column",children:[(0,t.jsx)(m,{paddingLeft:2,children:(0,t.jsxs)(s,{bold:!0,children:[(0,t.jsx)(s,{color:H.color,children:a?X(e,a.source):`[${e.kind}]`}),` ${a?M(e):j(e.title)}`]})}),B.map((d,w)=>a?(0,t.jsxs)(m,{paddingLeft:2,children:[(0,t.jsx)(m,{flexShrink:0,width:E+2,children:(0,t.jsx)(s,{color:f.dim,children:d.label})}),(0,t.jsx)(m,{flexGrow:1,children:(0,t.jsx)(s,{color:d.dimmer?f.dim:void 0,children:d.text})})]},`f-${w}`):(0,t.jsx)(m,{paddingLeft:2,children:(0,t.jsxs)(s,{children:[(0,t.jsx)(s,{color:f.dim,children:`${d.label.padEnd(E)} `}),(0,t.jsx)(s,{color:d.dimmer?f.dim:void 0,children:d.text})]})},`f-${w}`)),e.diffSummary?(0,t.jsx)(m,{paddingLeft:2,children:(0,t.jsx)(s,{color:f.dim,children:e.diffSummary})}):(e.diff??[]).map((d,w)=>(0,t.jsx)(m,{paddingLeft:4,children:(0,t.jsx)(s,{color:d.op==="-"?"red":"green",children:`${d.op==="-"?"\u2212":"+"} ${d.field==="criteria"?a?"acceptance criterion":"criterion":d.field}: ${d.text}`})},`d-${w}`)),(a?[]:e.citeLines??[]).map((d,w)=>(0,t.jsx)(m,{paddingLeft:2,children:(0,t.jsx)(s,{color:f.dim,children:d})},`c-${w}`)),(0,t.jsx)(s,{children:" "}),g.map((d,w)=>(0,t.jsxs)(s,{children:[S(w),` ${w+1}. ${d.label}`,(0,t.jsx)(s,{color:f.dim,children:` \u2014 ${d.detail}`})]},`o-${w}`)),p!==null||u&&l==="because"?u?(0,t.jsxs)(m,{flexDirection:"column",children:[(0,t.jsxs)(m,{children:[(0,t.jsxs)(s,{children:[(0,t.jsx)(s,{color:f.assuranceAccent,children:"\u276F"})," ",(0,t.jsx)(s,{color:f.dim,children:"\u270E "})]}),(0,t.jsx)(P,{value:u.value,onChange:u.onChange,onSubmit:u.onSubmit,onCancel:u.onCancel,placeholder:l==="because"?"why archive it?":l==="adjust"?"tell me what to change":"say what to adjust"})]}),(0,t.jsx)(s,{color:f.muted,children:l==="because"?" submits as: archive \xB7 your reason goes on the record":l==="adjust"?" the agent looks at this change again, with your words":e.kind==="PAIR"?" submits as: defer \xB7 your note parks with the card (it re-offers)":" submits as: approve \xB7 your words steer the re-design"})]}):p!==null?(0,t.jsxs)(s,{children:[S(p)," ",(0,t.jsx)(s,{color:f.dim,children:l==="adjust"?"\u270E adjust \u2014 tell me what to change":e.kind==="PAIR"?"\u270E defer with a note \u2014 say what you noticed":"\u270E approve with changes \u2014 say what to adjust"})]}):null:null]});if(v)return(0,t.jsxs)(m,{marginTop:h?1:0,marginBottom:1,flexDirection:"column",children:[(0,t.jsx)(s,{bold:!0,color:f.assuranceAccent,children:A}),(0,t.jsx)(s,{color:f.dim,children:y}),W]});let V=Math.max(2,Math.min(o-1,100)-A.length-y.length);return(0,t.jsxs)(m,{marginTop:h?1:0,marginBottom:1,flexDirection:"column",children:[(0,t.jsxs)(s,{children:[(0,t.jsx)(s,{bold:!0,color:f.assuranceAccent,children:A})," ".repeat(V),(0,t.jsx)(s,{color:f.dim,children:y})]}),(0,t.jsx)(s,{children:" "}),W]})}function fe(e,i){let n=["\u2191\u2193 select","\u23CE confirm"];return e.multi_select&&n.push("space toggle"),i.batchCount>1&&n.push("\u2190 \u2192 questions"),(e.allow_free_text||e.options.some(r=>r.input===!0))&&n.push("\u270E type your own"),i.canAttach&&n.push("@ attach a file or URL"),i.escBack&&n.push("esc back"),{keys:n}}function pe(e,i){let n=["\u2191\u2193 select","\u23CE confirm"];return e.some(r=>r.free)&&n.push("\u270E type your own"),i.escBack&&n.push("esc back"),{keys:n}}function he(e){let i=["\u2191\u2193 select","\u23CE confirm","1-9 verdict"];return R(e)!==null&&i.push("type = adjust"),i.push("esc \xB7 nothing to undo"),{keys:i}}export{J as a,Z as b,ne as c,N as d,K as e,R as f,de as g,fe as h,pe as i,he as j};
|
|
2
|
+
import{b as O,c as P}from"./chunk-SMXABALN.js";import{a as D}from"./chunk-HCBYKLMW.js";import{b as I,c as L}from"./chunk-BWXLZS5O.js";import{a as M,b as $}from"./chunk-77BZTEHJ.js";import{oa as j}from"./chunk-5EAJO372.js";import{A as f}from"./chunk-BRWCWZE3.js";import{a as m,b as s,k as _}from"./chunk-33DWJV67.js";import{a as q}from"./chunk-6YGTRKDT.js";import{e as C}from"./chunk-UR6MHSHU.js";var F={"acceptance criteria":1,scenarios:2,"acceptance criteria + exercises":3,"tests + gaps":4,tests:4};function J(e,i,n={}){let r=[],u=L(e.turns).entries.length;if(i==="design"){let c;for(let g=e.ledger.length-1;g>=0;g--){let p=e.ledger[g];if(p.kind==="banner"&&p.text.startsWith("designing: ")){c=p.text.slice(11);break}}let o=n.remote&&!c?e.ledger.find(g=>g.kind==="header")?.phase:void 0,v=c?F[c]:o;v&&r.push(`phase ${v}/4`),u>0&&!n.remote&&r.push(`${u} item${u===1?"":"s"} this session`)}else u>0&&!n.remote&&r.push(`${u} saved as draft${u===1?"":"s"}`);let l=n.remote?n.added??I(e.turns):0,a=n.remote?n.updated??0:0;(l>0||a>0)&&r.push([l>0?`${l} added`:"",a>0?`${a} updated`:"","not saved yet"].filter(Boolean).join(" \xB7 "));let h=e.pending?e.pending.resolution.filter(c=>!c).length:0;return h>0&&r.push(`${h} question${h===1?"":"s"} pending`),e.credits&&r.push(`${e.credits.total.toFixed(1)} credits`),{items:r}}function Z(e,i){let n=[],r=e.applied+e.committed+e.retired;n.push(`${r} applied`),n.push(`${i} to decide`);let u=[];return e.skipped>0&&u.push(`${e.skipped} skipped`),e.deferred>0&&u.push(`${e.deferred} deferred`),e.failed>0&&u.push(`${e.failed} failed`),{items:[...n,...u]}}var x=C(q(),1);function ne({onToggleThinking:e,onCtrlC:i,explorer:n,panel:r}){let l=(0,x.useRef)(null),a=(0,x.useRef)(""),h=()=>{l.current&&clearTimeout(l.current),l.current=null,a.current=""};return(0,x.useEffect)(()=>h,[]),O((c,o)=>{if(o.ctrl&&c==="t"){e();return}if(o.ctrl&&c==="c"){i();return}if(!o.ctrl&&c.includes("")){i();return}if(!o.ctrl&&c.includes("")){e();return}if(n&&n.isOpen()){let v=()=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{h(),n.onBack()},150)};if(l.current){if(o.upArrow||o.downArrow||o.return){h(),o.return?n.onEnter():n.onMove(o.upArrow?-1:1);return}if(a.current+=c,a.current==="["){v();return}let g=a.current;h();let p=/^\[([ABCD])/.exec(g);if(p){(p[1]==="A"||p[1]==="B")&&n.onMove(p[1]==="A"?-1:1);return}n.onBack();return}if(o.upArrow){n.onMove(-1);return}if(o.downArrow){n.onMove(1);return}if(o.return){n.onEnter();return}if(o.escape){a.current="",v();return}return}if(r&&r.isFocused()){let v=()=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{h(),r.onBack()},150)};if(l.current){if(o.upArrow||o.downArrow||o.return||o.leftArrow||o.rightArrow){h(),o.return?r.onSelect():o.leftArrow?r.onLeft?.():o.rightArrow?r.onRight?.():r.onMove(o.upArrow?-1:1);return}if(a.current+=c,a.current==="["){v();return}let g=a.current;h();let p=/^\[([ABCD])/.exec(g);if(p){p[1]==="A"||p[1]==="B"?r.onMove(p[1]==="A"?-1:1):p[1]==="C"?r.onRight?.():r.onLeft?.();return}r.onBack();return}if(o.upArrow){r.onMove(-1);return}if(o.downArrow){r.onMove(1);return}if(o.leftArrow){r.onLeft?.();return}if(o.rightArrow){r.onRight?.();return}if(o.return){r.onSelect();return}if(o.escape){a.current="",v();return}if(/^[1-9]$/.test(c)){r.onDigit(Number(c));return}if(o.tab){r.onTab?.();return}if(c===" "&&r.isMulti()){r.onSpace();return}if(c&&!o.ctrl&&!o.meta){r.onType(c);return}return}}),null}var t=C(D(),1);function N(e,i=!1){return i?Y(e):e.kind==="REVIEW"?[{v:"approve",label:"approve",detail:"mark it reviewed and trusted"},{v:"archive",label:"archive",detail:"reject it \u2014 asks for a reason; impact shown above"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="PAIR"?[{v:"merge",label:"merge",detail:"duplicate \u2014 fold into the older item (it stays unreviewed)"},{v:"keep_both",label:"keep both",detail:"genuinely distinct \u2014 promote both"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="ARCHIVE"?[{v:"archive",label:"retire",detail:"hidden from now on; history is kept and it can be reverted"},{v:"skip",label:"skip",detail:"keep it \u2014 decided, never re-offered"},{v:"defer",label:"defer",detail:"not now \u2014 the plan re-offers it"}]:e.heldPayload?[{v:"approve",label:"approve update",detail:"commit the held payload \u2014 impact preview above"},{v:"skip",label:"keep current",detail:"drop the held payload (the owner's disk state stays untouched)"},{v:"defer",label:"defer",detail:"not now \u2014 stays held"}]:[{v:"approve",label:"approve",detail:e.kind==="ADD"?"commit + design it":"commit the updated version (old\u2192new redirect)"},{v:"skip",label:e.origin==="content-change"?"reject":"skip",detail:e.origin==="content-change"?"drop the staged proposal \u2014 nothing committed":"leave it as is"},{v:"defer",label:"defer",detail:"not now \u2014 the plan keeps it staged"}]}var Q=e=>e===0?null:e===1?"its test was designed for the old version":`its ${e} tests were designed for the old version`;function Y(e){return e.heldPayload?[{v:"approve",label:"approve the change",detail:"the use-case takes the new version"},{v:"skip",label:"keep it as it is",detail:"the change is dropped"},{v:"defer",label:"decide later",detail:"it keeps waiting"}]:e.kind==="ARCHIVE"?[...e.archiveRefused?[]:[{v:"archive",label:"archive",detail:"it's hidden from the project from now on"}],{v:"skip",label:"keep it",detail:"it stays as it is; this may be suggested again"},{v:"defer",label:"defer",detail:"decide later; it's kept as an open question"}]:e.kind==="ADD"?[{v:"approve",label:"approve",detail:"add it to this session"},{v:"skip",label:"reject",detail:"leave it out; it may be suggested again"},{v:"defer",label:"defer",detail:"leave it out for now, as an open question"}]:[{v:"approve",label:"approve",detail:"the use-case takes the new version"},{v:"skip",label:"reject",detail:"it stays as it is; the change may be suggested again"},{v:"defer",label:"defer",detail:"it stays as it is for now, as an open question"}]}function K(e,i=!1){let n=N(e,i);return e.viewDiff&&n.push({v:"view_diff",label:"view diff",detail:i?"the whole change, old \u2192 new":"full old \u2192 new"}),n}function R(e,i=!1){return e.kind==="ARCHIVE"?null:K(e,i).length}var G={ADD:{color:f.green??"green"},MODIFY:{color:"yellow"},ARCHIVE:{color:f.red},REVIEW:{color:"cyan"},PAIR:{color:"magenta"}},U=60,X=(e,i)=>`${e.heldPayload?"changed earlier":e.kind==="ADD"?"new":e.kind==="ARCHIVE"?`no longer in ${$(i)}`:"changed"}:`;function de({card:e,position:i,sel:n=0,focused:r=!1,freeText:u=null,editorIntent:l="steer",remote:a,gapAbove:h=!0}){let{stdout:c}=_(),o=c?.columns??80,v=o<U,g=K(e,!!a),p=R(e,!!a),H=G[e.kind],S=d=>r&&n===d?(0,t.jsx)(s,{color:f.assuranceAccent,children:"\u276F"}):" ",b=e.impact,k=a?e.kind==="MODIFY"?Q(e.tests??0):null:b&&"stale_refs"in b&&b.stale_refs.length>0?`${e.kind==="ARCHIVE"?"retiring leaves":"approving marks"} ${b.stale_refs.length} item(s) stale`+((b.direct_refs?.length??0)>0?` \u2014 ${b.direct_refs.length} directly touched: ${b.direct_refs.join(", ")}`:""):b&&"design_children"in b?`${e.kind==="REVIEW"?"archiving drops":"merging folds"} ${b.design_children} design child(ren)`:null,T=e.provenance&&e.provenance!==e.why?e.provenance:a?null:e.origin??null,B=a?[{label:"change",text:e.why},...T?[{label:"from",text:T,dimmer:!0}]:[],...k?[{label:"tests",text:k}]:[]]:[{label:"why",text:e.why},...T?[{label:"from",text:T,dimmer:!0}]:[],...e.tier?[{label:"match",text:e.tier,dimmer:!0}]:[],...k?[{label:"impact",text:k}]:[]],E=Math.max(...B.map(d=>d.label.length)),A=a?`? review the changes from ${$(a.source)}`:"? reconcile",y=a?`${i.n} of ${i.of}`:`item ${i.n} of ${i.of}`,W=(0,t.jsxs)(m,{flexDirection:"column",children:[(0,t.jsx)(m,{paddingLeft:2,children:(0,t.jsxs)(s,{bold:!0,children:[(0,t.jsx)(s,{color:H.color,children:a?X(e,a.source):`[${e.kind}]`}),` ${a?M(e):j(e.title)}`]})}),B.map((d,w)=>a?(0,t.jsxs)(m,{paddingLeft:2,children:[(0,t.jsx)(m,{flexShrink:0,width:E+2,children:(0,t.jsx)(s,{color:f.dim,children:d.label})}),(0,t.jsx)(m,{flexGrow:1,children:(0,t.jsx)(s,{color:d.dimmer?f.dim:void 0,children:d.text})})]},`f-${w}`):(0,t.jsx)(m,{paddingLeft:2,children:(0,t.jsxs)(s,{children:[(0,t.jsx)(s,{color:f.dim,children:`${d.label.padEnd(E)} `}),(0,t.jsx)(s,{color:d.dimmer?f.dim:void 0,children:d.text})]})},`f-${w}`)),e.diffSummary?(0,t.jsx)(m,{paddingLeft:2,children:(0,t.jsx)(s,{color:f.dim,children:e.diffSummary})}):(e.diff??[]).map((d,w)=>(0,t.jsx)(m,{paddingLeft:4,children:(0,t.jsx)(s,{color:d.op==="-"?"red":"green",children:`${d.op==="-"?"\u2212":"+"} ${d.field==="criteria"?a?"acceptance criterion":"criterion":d.field}: ${d.text}`})},`d-${w}`)),(a?[]:e.citeLines??[]).map((d,w)=>(0,t.jsx)(m,{paddingLeft:2,children:(0,t.jsx)(s,{color:f.dim,children:d})},`c-${w}`)),(0,t.jsx)(s,{children:" "}),g.map((d,w)=>(0,t.jsxs)(s,{children:[S(w),` ${w+1}. ${d.label}`,(0,t.jsx)(s,{color:f.dim,children:` \u2014 ${d.detail}`})]},`o-${w}`)),p!==null||u&&l==="because"?u?(0,t.jsxs)(m,{flexDirection:"column",children:[(0,t.jsxs)(m,{children:[(0,t.jsxs)(s,{children:[(0,t.jsx)(s,{color:f.assuranceAccent,children:"\u276F"})," ",(0,t.jsx)(s,{color:f.dim,children:"\u270E "})]}),(0,t.jsx)(P,{value:u.value,onChange:u.onChange,onSubmit:u.onSubmit,onCancel:u.onCancel,placeholder:l==="because"?"why archive it?":l==="adjust"?"tell me what to change":"say what to adjust"})]}),(0,t.jsx)(s,{color:f.muted,children:l==="because"?" submits as: archive \xB7 your reason goes on the record":l==="adjust"?" the agent looks at this change again, with your words":e.kind==="PAIR"?" submits as: defer \xB7 your note parks with the card (it re-offers)":" submits as: approve \xB7 your words steer the re-design"})]}):p!==null?(0,t.jsxs)(s,{children:[S(p)," ",(0,t.jsx)(s,{color:f.dim,children:l==="adjust"?"\u270E adjust \u2014 tell me what to change":e.kind==="PAIR"?"\u270E defer with a note \u2014 say what you noticed":"\u270E approve with changes \u2014 say what to adjust"})]}):null:null]});if(v)return(0,t.jsxs)(m,{marginTop:h?1:0,marginBottom:1,flexDirection:"column",children:[(0,t.jsx)(s,{bold:!0,color:f.assuranceAccent,children:A}),(0,t.jsx)(s,{color:f.dim,children:y}),W]});let V=Math.max(2,Math.min(o-1,100)-A.length-y.length);return(0,t.jsxs)(m,{marginTop:h?1:0,marginBottom:1,flexDirection:"column",children:[(0,t.jsxs)(s,{children:[(0,t.jsx)(s,{bold:!0,color:f.assuranceAccent,children:A})," ".repeat(V),(0,t.jsx)(s,{color:f.dim,children:y})]}),(0,t.jsx)(s,{children:" "}),W]})}function fe(e,i){let n=["\u2191\u2193 select","\u23CE confirm"];return e.multi_select&&n.push("space toggle"),i.batchCount>1&&n.push("\u2190 \u2192 questions"),(e.allow_free_text||e.options.some(r=>r.input===!0))&&n.push("\u270E type your own"),i.canAttach&&n.push("@ attach a file or URL"),i.escBack&&n.push("esc back"),{keys:n}}function pe(e,i){let n=["\u2191\u2193 select","\u23CE confirm"];return e.some(r=>r.free)&&n.push("\u270E type your own"),i.escBack&&n.push("esc back"),{keys:n}}function he(e){let i=["\u2191\u2193 select","\u23CE confirm","1-9 verdict"];return R(e)!==null&&i.push("type = adjust"),i.push("esc \xB7 nothing to undo"),{keys:i}}export{J as a,Z as b,ne as c,N as d,K as e,R as f,de as g,fe as h,pe as i,he as j};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as Re}from"./chunk-LD5B3QFW.js";import{a as K,f as Se}from"./chunk-ZHAMVLQZ.js";import{c as Ie}from"./chunk-ZCIWQHCO.js";import{D as ue,H as ge,I as fe,J as he,L as me,M as ve,N as Ee,W as ye,a as M,b as T,ca as U,f as ae,g as pe,pa as $e,r as le,zb as te}from"./chunk-PI7OXS62.js";import{g as y,h as G,i as Z,j as ee}from"./chunk-KU3YHPWZ.js";var be=["definitionId"],B=g=>be.find(m=>g[m]!==void 0)??null;function P(g,m,n,R,f){let $={...n};for(let[w,C]of Object.entries(R))C!==void 0&&!be.includes(w)&&($[w]=C);if(m==="test"&&typeof R.test_md_blob=="string"){if(f===void 0)throw new Error("a test's steps were edited without the rule for its definition id: pass definitionOf (design/test-definition.ts)");$.definitionId=f(g,R.test_md_blob)}return $}var Ne=new Set([y.EXERCISES,y.VERIFIES,y.SCOPED_TO]),ke=new Set(["approve","edit","reject"]);function ze(g){let{store:m,graph:n,ops:R,by:f}=g,$=g.mintable??Re(),w=m.head(),C=m.serialize(w);if(!m.sameToken(m.parse(n.latestHash),w))return{record:null,errors:[{code:"STALE_BASIS",detail:`graph opened at ${String(n.latestHash)} but chain head is ${String(C)} \u2014 re-open and retry`}]};let W=[],D=[],ne=new Set;for(let e of R){if(n.appliedEvents.has(e.eventId)||ne.has(e.eventId)){W.push(e.eventId);continue}ne.add(e.eventId),D.push(e)}if(D.length===0)return{record:null,errors:null,applied:[],skipped:W,minted:[],staleDelta:[]};let d=[],q=[],I=[],Oe=pe(ae(m,n)),N=[],S=[],H=[],F=[...g.judgements??[]],Y=[],J=new Map,ie=new Set,se=[],j=new Set,Te=new Set($),de=new Set;for(let e of D){if(!ke.has(e.kind))continue;let i=e.target,o=n.resolve(i),t=o?n.tipOf(o.cid):i;de.has(t)&&d.push({code:"MULTIPLE_TERMINAL_OPS",detail:`${i} has more than one terminal op in this turn \u2014 normalize latest-wins first`}),de.add(t)}let b={targets:{},enhance:{},redirectTo:{},retract:{},conv:{}},k=(e,i)=>{let{target:o,expectedCid:t}=i,r=n.resolve(o);if(!r)return d.push({code:"UNKNOWN_NODE",detail:`${e}: ${o} names nothing in the graph`}),null;let s=n.tipOf(r.cid);if(s!==t||n.superseded.has(t)){let c=te(n,s).includes(t);return d.push({code:"EXPECTED_CID_MOVED",detail:c?`${e}: ${o} moved or was archived since it was displayed`:`${e}: ${o}: the cid given names no version of it, so the edit didn't match it as it is now`,data:{tip:s,target:o,moved:c}}),null}return b.targets[i.eventId]=t,t},z=e=>new Set(te(n,n.tipOf(e))),_=[],O=new Set,oe=e=>({code:"RETRACT_FORBIDDEN",detail:`retract ${e}: provenance edges cannot be retracted \u2014 DERIVES is historical evidence; reject or edit the node instead`});for(let e of D){if(e.kind!=="retract"){_.push(e);continue}let i=k("retract",e);if(!i)continue;let o=new Map;for(let s of z(i))for(let c of[...n.edgesFrom(s),...n.edgesInto(s)])o.set(c.ecid,c);let t,r={};if(e.edgeEcid!==void 0){if(n.superseded.has(e.edgeEcid)){d.push({code:"UNKNOWN_EDGE",detail:`retract ${e.target}: ${e.edgeEcid} is already retracted`});continue}if(t=o.get(e.edgeEcid),!t){d.push({code:"UNKNOWN_EDGE",detail:`retract ${e.target}: ${e.edgeEcid} is not a live edge touching ${e.target} (checked the full version chain)`});continue}}else if(e.edgeRef!==void 0){let s=e.edgeRef;if(s.type===y.DERIVES){d.push(oe(e.target));continue}let c=(a,u)=>{let x=U(n,u);if(x)return x;let A=n.resolve(u)!==null;return d.push(A?{code:"TOMBSTONED_REF",detail:`retract ${e.target}: ${s.type} ${a} '${u}' is tombstoned (retired with no live successor) \u2014 pick a live node`}:{code:"UNKNOWN_REF",detail:`retract ${e.target}: ${s.type} ${a} got (unknown) for '${u}' \u2014 not a committed node (a node added in this same turn has no id yet: commit the add first)`}),null},v=c("dst",s.dst);if(!v)continue;r.dst=v.cid;let h=z(v.cid),l=null;if(s.src!==void 0){let a=c("src",s.src);if(!a)continue;r.src=a.cid,l=z(a.cid)}let E=[...o.values()].filter(a=>a.type===s.type&&h.has(a.dst)&&(l===null||l.has(a.src)));if(E.length===0){d.push({code:"UNKNOWN_EDGE",detail:`retract ${e.target}: no live ${s.type} edge onto ${s.dst}${s.src!==void 0?` from ${s.src}`:""} touches ${e.target} (checked the full version chain)`});continue}if(E.length>1){let a=E.map(u=>`${u.type} ${n.displayNameOf(u.src)??u.src} \u2192 ${n.displayNameOf(u.dst)??u.dst} (${u.ecid})`).join("; ");d.push({code:"AMBIGUOUS_RETRACT",detail:`retract ${e.target}: ${E.length} live ${s.type} edges match \u2014 ${a} \u2014 add src to disambiguate`});continue}t=E[0]}else{d.push({code:"INVALID_RETRACT",detail:`retract ${e.target}: neither edge_ecid nor edge {type, dst, src?} was given`});continue}if(t.type===y.DERIVES){d.push(oe(e.target));continue}if(O.has(t.ecid)){d.push({code:"EDGE_RETRACTED",detail:`retract ${e.target}: ${t.ecid} was retracted earlier in this turn`});continue}O.add(t.ecid),b.retract[e.eventId]={ecid:t.ecid,...r},_.push({kind:"retract",target:e.target,expectedCid:e.expectedCid,edgeEcid:t.ecid,reason:e.reason,eventId:e.eventId})}let L=new Map;for(let e of _){if(e.kind!=="edit")continue;let i=n.resolve(e.target);if(!i||n.tipOf(i.cid)!==e.expectedCid||n.superseded.has(e.expectedCid))continue;let o=n.getNode(e.expectedCid);if(!o||B(e.edit)!==null)continue;let t=P(n,o.label,o.content,e.edit,g.definitionOf);if(typeof t.title=="string"&&!t.title.trim()||G(o.label,t).length>0)continue;let r=M(o.label,t);r!==e.expectedCid&&L.set(e.expectedCid,r)}for(let e of _)if(e.kind==="approve"){let i=k("approve",e);i&&N.push({id:i,kind:"review-item",resolution:"approved",edit:null,reason:null,by:f})}else if(e.kind==="reject"){let i=k("reject",e);if(!i)continue;if(N.push({id:i,kind:"review-item",resolution:"rejected",edit:null,reason:e.reason,by:f}),e.redirectTo!==void 0){let o=Ee(n,e.redirectTo);if(!o){d.push({code:"UNKNOWN_NODE",detail:`reject.redirectTo: ${e.redirectTo} is not a live node`});continue}if(o===i){d.push({code:"SELF_SUPERSEDE",detail:`reject.redirectTo: the live version of ${e.redirectTo} is the node being rejected`});continue}b.redirectTo[e.eventId]=o,S.push({kind:"node",old:i,new:o,reason:e.reason,by:f});for(let t of n.edgesInto(i)){if(Z(t.type)?.pin?.comparesTo!=="dst_tip"||n.superseded.has(t.ecid)||n.superseded.has(t.src))continue;let r=`${e.reason} \u2014 ${e.target} merged into ${e.redirectTo}`,s=n.edgesFrom(t.src).some(c=>c.type===t.type&&c.dst===o&&!n.superseded.has(c.ecid));!s&&!Ne.has(t.type)||(S.push({kind:"edge",ecid:t.ecid,reason:r,by:f}),s||I.push({ecid:T(t.type,t.src,o,t.props),type:t.type,src:t.src,dst:o,props:t.props}))}}}else if(e.kind==="edit"){let i=k("edit",e);if(!i)continue;let o=n.getNode(i);if(!o){d.push({code:"UNKNOWN_NODE",detail:`edit: ${e.target} node file unreadable`});continue}let t=B(e.edit);if(t!==null){d.push({code:"DERIVED_FIELD",detail:`edit ${e.target}: ${t} is derived from the test's steps, never set by an edit; edit test_md_blob instead`});continue}let r=P(n,o.label,o.content,e.edit,g.definitionOf);if(typeof r.title=="string"&&!r.title.trim()){d.push({code:"EMPTY_TITLE",detail:`edit: ${e.target} edited title is empty`});continue}let s=G(o.label,r);if(s.length>0){for(let h of s)d.push({code:h.code,detail:`edit ${e.target}: ${h.detail}`});continue}let c=M(o.label,r);if(c===i){N.push({id:i,kind:"review-item",resolution:"approved",edit:null,reason:null,by:f});continue}if(fe(n,i,c)){d.push({code:"SUPERSEDE_CYCLE",detail:`edit ${e.target}: edit reproduces an already-superseded version (supersession cycle guard) \u2014 re-edit forward or redesign`});continue}let v=he({graph:n,oldTip:i,newCid:c,newLabel:o.label,by:f,reason:`re-blessed onto ${c} (edited in chat)`,skipEcids:O,dstRedirect:L});if(v.errors.length>0){for(let h of v.errors)d.push({code:"REBLESS_REFUSED",detail:`edit ${e.target}: ${h}`});continue}q.push({cid:c,label:o.label,content:r}),I.push(...v.edges),S.push({kind:"node",old:i,new:c,reason:e.reason??"edited in chat",by:f}),S.push(...v.supersessions),N.push({id:c,kind:"review-item",resolution:"edited",edit:{...e.edit},reason:null,by:f})}else if(e.kind==="enhance"){if(!k("enhance",e))continue;for(let o of e.edges){let t=o,r=U(n,t.src),s=U(n,t.dst);if(!r||!s){let[p,Q]=r?["dst",t.dst]:["src",t.src],De=n.resolve(Q)!==null;d.push(De?{code:"TOMBSTONED_REF",detail:`enhance ${e.target}: ${t.type} ${p} '${Q}' is tombstoned (retired with no live successor) \u2014 pick a live node`}:{code:"UNKNOWN_REF",detail:`enhance ${e.target}: ${t.type} ${p} got (unknown) for '${Q}' \u2014 not a committed node (a node added in this same turn has no id yet: commit the add first)`});continue}if((b.enhance[e.eventId]??=[]).push({src:r.cid,dst:s.cid}),t.type===y.DERIVES){let p=Oe.one(L.get(s.cid)??s.cid,t.props,I);if("fault"in p){d.push({code:p.fault.code,detail:`enhance ${e.target}: ${p.fault.detail}`});continue}p.props!==t.props&&(t={...t,props:p.props})}let c=n.nodeLabel.get(r.cid)??"(unknown)",v=n.nodeLabel.get(s.cid)??"(unknown)";for(let p of ee(t.type,c,v,t.props))d.push({code:p.code,detail:`enhance ${e.target}: ${p.detail}`});let h=T(t.type,r.cid,s.cid,t.props),l=L.get(r.cid)??r.cid,E=L.get(s.cid)??s.cid,a=T(t.type,l,E,t.props);if(n.superseded.has(h)||O.has(h)||n.superseded.has(a)){let p=n.superseded.has(h)||O.has(h)?h:a;d.push({code:"EDGE_RETRACTED",detail:`enhance ${e.target}: this ${t.type} edge was retracted (${p}) \u2014 re-adding a retracted edge is refused (revival unsupported)`});continue}if(n.edgesFrom(r.cid).some(p=>p.ecid===h)||I.some(p=>p.ecid===a))continue;let u=ye(n,t.type,r.cid,s.cid,se);u&&d.push(u);let x=ge(n,{type:t.type,src:r.cid,dst:s.cid},{pending:[],retracted:O},`enhance ${e.target}`);x&&d.push(x);let A=Z(t.type)?.cardinality;if(A==="one-live-per-src"||A==="one-live-per-src-and-dst"){let p=`${t.type}|${r.cid}`;j.has(p)&&d.push({code:"CARDINALITY_VIOLATION",detail:`${t.type} from ${r.cid}: two one-live edges in one turn`}),j.add(p)}if(A==="one-live-per-src-and-dst"){let p=`${t.type}|dst|${s.cid}`;j.has(p)&&d.push({code:"CARDINALITY_VIOLATION",detail:`${t.type} onto ${s.cid}: two one-live edges in one turn (strict 1:1)`}),j.add(p)}I.push({ecid:a,type:t.type,src:l,dst:E,props:t.props}),se.push({src:r.cid,dst:s.cid,type:t.type})}}else if(e.kind==="retract")S.push({kind:"edge",ecid:e.edgeEcid,reason:e.reason,by:f});else if(e.kind==="add"){if(!Te.has(e.label)){d.push({code:"GATED_LABEL",detail:`add: ${e.label} is not mintable in v1 (gate: ${$.join("|")})`,data:{gate:[...$]}});continue}let i=n.heads.get(e.convSourceId),o=n.convChains.get(e.convSourceId);if(typeof i!="string"||!o){d.push({code:"CONV_SOURCE_MISSING",detail:`add: ${e.convSourceId} is not a live conversation source`});continue}b.conv[e.eventId]=i;let t=n.getNode(i)?.content?.blob,r=typeof t=="string"?m.getBlob(t)?.toString("utf8")??"":"",s=Se(r,e.cite.turn);if(s===null){d.push({code:"BAD_ANCHOR",detail:`add: ${K(e.cite.turn)} does not resolve in ${e.convSourceId}`});continue}if(!ue(e.cite.quote,s)){d.push({code:"QUOTE_MISMATCH",detail:`add: quote is not verbatim within ${K(e.cite.turn)}`});continue}let c=B(e.content);if(c!==null){d.push({code:"DERIVED_FIELD",detail:`add: ${c} is derived from the test's steps, never set by an add; send test_md_blob only`});continue}let v={...P(n,e.label,{},e.content,g.definitionOf),derived:!0},h=G(e.label,v);if(h.length>0){for(let u of h)d.push({code:u.code,detail:`add: ${u.detail}`});continue}let l=M(e.label,v),E={source_id:e.convSourceId,source_cid:i,anchor:K(e.cite.turn),quote:e.cite.quote};for(let u of ee(y.DERIVES,"source",e.label,E))d.push({code:u.code,detail:`add: ${u.detail}`});if(n.hasNode(l)){if(n.superseded.has(l)){d.push({code:"NODE_TOMBSTONED",detail:`add: ${n.nameOf.get(l)??l} already exists and was retired \u2014 restore it deliberately or add it under new content`});continue}I.push({ecid:T("DERIVES",i,l,E),type:y.DERIVES,src:i,dst:l,props:E}),e.rationale&&F.push({about:l,rationale:e.rationale,by:f}),J.set(e.eventId,l);continue}q.push({cid:l,label:e.label,content:v}),I.push({ecid:T("DERIVES",i,l,E),type:y.DERIVES,src:i,dst:l,props:E}),e.rationale&&F.push({about:l,rationale:e.rationale,by:f});let a=$e(e.label,u=>ie.has(u),n.names.keys());a!==null&&(ie.add(a),H.push({cid:l,slug:a,by:f})),Y.push({cid:l,...a!==null?{slug:a}:{}}),J.set(e.eventId,l)}if(d.length)return{record:null,errors:d};let re=new Date().toISOString();for(let e of g.learn===!1?[]:_){if(e.kind==="add"){let i=J.get(e.eventId);i&&m.signals().append({ts:re,command:"extract-chat",id:i,verdict:"add",polarity:"preference",tag:e.label,by:f,event_id:e.eventId,target:i});continue}for(let i of Ie(e,{ts:re,command:"extract-chat",by:f}))m.signals().append(i)}let ce=D.map(e=>e.eventId).sort(),we=me(m,{ts:new Date().toISOString(),proposal_id:null,nodes:q,edges:I,review:N,supersessions:S,...H.length>0?{names:H}:{},...F.length>0?{judgements:F}:{},event_ids:ce,...g.sid?{sid:g.sid}:{},source_head_moves:{}},{graph:n,scope:g.scope,expectPrev:C,intent:{v:1,verb:"chat",args:le({ops:R,judgements:g.judgements??null,by:f,mintable:[...$],sid:g.sid??null,...g.learn===!1?{learn:!1}:{}}),pins:b},provenance:g.provenance}),X=ve(m),V=new Set;for(let e of S)if(e.kind==="node"){V.add(e.old);for(let i of X.edgesInto(e.old))V.add(i.src)}for(let e of Y)V.add(e.cid);let Ce=[...V].map(e=>({cid:e,state:X.stale(X.tipOf(e))})).filter(e=>e.state!=="fresh");return{record:we.record,errors:null,applied:ce,skipped:W,minted:Y,staleDelta:Ce}}export{be as a,P as b,ze as c};
|
|
2
|
+
import{a as Re}from"./chunk-LD5B3QFW.js";import{a as K,f as Se}from"./chunk-3A4KK22B.js";import{c as Ie}from"./chunk-ZCIWQHCO.js";import{D as ue,H as ge,I as fe,J as he,L as me,M as ve,N as Ee,W as ye,a as M,b as T,ca as U,f as ae,g as pe,pa as $e,r as le,zb as te}from"./chunk-5EAJO372.js";import{g as y,h as G,i as Z,j as ee}from"./chunk-KU3YHPWZ.js";var be=["definitionId"],B=g=>be.find(m=>g[m]!==void 0)??null;function P(g,m,n,R,f){let $={...n};for(let[w,C]of Object.entries(R))C!==void 0&&!be.includes(w)&&($[w]=C);if(m==="test"&&typeof R.test_md_blob=="string"){if(f===void 0)throw new Error("a test's steps were edited without the rule for its definition id: pass definitionOf (design/test-definition.ts)");$.definitionId=f(g,R.test_md_blob)}return $}var Ne=new Set([y.EXERCISES,y.VERIFIES,y.SCOPED_TO]),ke=new Set(["approve","edit","reject"]);function ze(g){let{store:m,graph:n,ops:R,by:f}=g,$=g.mintable??Re(),w=m.head(),C=m.serialize(w);if(!m.sameToken(m.parse(n.latestHash),w))return{record:null,errors:[{code:"STALE_BASIS",detail:`graph opened at ${String(n.latestHash)} but chain head is ${String(C)} \u2014 re-open and retry`}]};let W=[],D=[],ne=new Set;for(let e of R){if(n.appliedEvents.has(e.eventId)||ne.has(e.eventId)){W.push(e.eventId);continue}ne.add(e.eventId),D.push(e)}if(D.length===0)return{record:null,errors:null,applied:[],skipped:W,minted:[],staleDelta:[]};let d=[],q=[],I=[],Oe=pe(ae(m,n)),N=[],S=[],H=[],F=[...g.judgements??[]],Y=[],J=new Map,ie=new Set,se=[],j=new Set,Te=new Set($),de=new Set;for(let e of D){if(!ke.has(e.kind))continue;let i=e.target,o=n.resolve(i),t=o?n.tipOf(o.cid):i;de.has(t)&&d.push({code:"MULTIPLE_TERMINAL_OPS",detail:`${i} has more than one terminal op in this turn \u2014 normalize latest-wins first`}),de.add(t)}let b={targets:{},enhance:{},redirectTo:{},retract:{},conv:{}},k=(e,i)=>{let{target:o,expectedCid:t}=i,r=n.resolve(o);if(!r)return d.push({code:"UNKNOWN_NODE",detail:`${e}: ${o} names nothing in the graph`}),null;let s=n.tipOf(r.cid);if(s!==t||n.superseded.has(t)){let c=te(n,s).includes(t);return d.push({code:"EXPECTED_CID_MOVED",detail:c?`${e}: ${o} moved or was archived since it was displayed`:`${e}: ${o}: the cid given names no version of it, so the edit didn't match it as it is now`,data:{tip:s,target:o,moved:c}}),null}return b.targets[i.eventId]=t,t},z=e=>new Set(te(n,n.tipOf(e))),_=[],O=new Set,oe=e=>({code:"RETRACT_FORBIDDEN",detail:`retract ${e}: provenance edges cannot be retracted \u2014 DERIVES is historical evidence; reject or edit the node instead`});for(let e of D){if(e.kind!=="retract"){_.push(e);continue}let i=k("retract",e);if(!i)continue;let o=new Map;for(let s of z(i))for(let c of[...n.edgesFrom(s),...n.edgesInto(s)])o.set(c.ecid,c);let t,r={};if(e.edgeEcid!==void 0){if(n.superseded.has(e.edgeEcid)){d.push({code:"UNKNOWN_EDGE",detail:`retract ${e.target}: ${e.edgeEcid} is already retracted`});continue}if(t=o.get(e.edgeEcid),!t){d.push({code:"UNKNOWN_EDGE",detail:`retract ${e.target}: ${e.edgeEcid} is not a live edge touching ${e.target} (checked the full version chain)`});continue}}else if(e.edgeRef!==void 0){let s=e.edgeRef;if(s.type===y.DERIVES){d.push(oe(e.target));continue}let c=(a,u)=>{let x=U(n,u);if(x)return x;let A=n.resolve(u)!==null;return d.push(A?{code:"TOMBSTONED_REF",detail:`retract ${e.target}: ${s.type} ${a} '${u}' is tombstoned (retired with no live successor) \u2014 pick a live node`}:{code:"UNKNOWN_REF",detail:`retract ${e.target}: ${s.type} ${a} got (unknown) for '${u}' \u2014 not a committed node (a node added in this same turn has no id yet: commit the add first)`}),null},v=c("dst",s.dst);if(!v)continue;r.dst=v.cid;let h=z(v.cid),l=null;if(s.src!==void 0){let a=c("src",s.src);if(!a)continue;r.src=a.cid,l=z(a.cid)}let E=[...o.values()].filter(a=>a.type===s.type&&h.has(a.dst)&&(l===null||l.has(a.src)));if(E.length===0){d.push({code:"UNKNOWN_EDGE",detail:`retract ${e.target}: no live ${s.type} edge onto ${s.dst}${s.src!==void 0?` from ${s.src}`:""} touches ${e.target} (checked the full version chain)`});continue}if(E.length>1){let a=E.map(u=>`${u.type} ${n.displayNameOf(u.src)??u.src} \u2192 ${n.displayNameOf(u.dst)??u.dst} (${u.ecid})`).join("; ");d.push({code:"AMBIGUOUS_RETRACT",detail:`retract ${e.target}: ${E.length} live ${s.type} edges match \u2014 ${a} \u2014 add src to disambiguate`});continue}t=E[0]}else{d.push({code:"INVALID_RETRACT",detail:`retract ${e.target}: neither edge_ecid nor edge {type, dst, src?} was given`});continue}if(t.type===y.DERIVES){d.push(oe(e.target));continue}if(O.has(t.ecid)){d.push({code:"EDGE_RETRACTED",detail:`retract ${e.target}: ${t.ecid} was retracted earlier in this turn`});continue}O.add(t.ecid),b.retract[e.eventId]={ecid:t.ecid,...r},_.push({kind:"retract",target:e.target,expectedCid:e.expectedCid,edgeEcid:t.ecid,reason:e.reason,eventId:e.eventId})}let L=new Map;for(let e of _){if(e.kind!=="edit")continue;let i=n.resolve(e.target);if(!i||n.tipOf(i.cid)!==e.expectedCid||n.superseded.has(e.expectedCid))continue;let o=n.getNode(e.expectedCid);if(!o||B(e.edit)!==null)continue;let t=P(n,o.label,o.content,e.edit,g.definitionOf);if(typeof t.title=="string"&&!t.title.trim()||G(o.label,t).length>0)continue;let r=M(o.label,t);r!==e.expectedCid&&L.set(e.expectedCid,r)}for(let e of _)if(e.kind==="approve"){let i=k("approve",e);i&&N.push({id:i,kind:"review-item",resolution:"approved",edit:null,reason:null,by:f})}else if(e.kind==="reject"){let i=k("reject",e);if(!i)continue;if(N.push({id:i,kind:"review-item",resolution:"rejected",edit:null,reason:e.reason,by:f}),e.redirectTo!==void 0){let o=Ee(n,e.redirectTo);if(!o){d.push({code:"UNKNOWN_NODE",detail:`reject.redirectTo: ${e.redirectTo} is not a live node`});continue}if(o===i){d.push({code:"SELF_SUPERSEDE",detail:`reject.redirectTo: the live version of ${e.redirectTo} is the node being rejected`});continue}b.redirectTo[e.eventId]=o,S.push({kind:"node",old:i,new:o,reason:e.reason,by:f});for(let t of n.edgesInto(i)){if(Z(t.type)?.pin?.comparesTo!=="dst_tip"||n.superseded.has(t.ecid)||n.superseded.has(t.src))continue;let r=`${e.reason} \u2014 ${e.target} merged into ${e.redirectTo}`,s=n.edgesFrom(t.src).some(c=>c.type===t.type&&c.dst===o&&!n.superseded.has(c.ecid));!s&&!Ne.has(t.type)||(S.push({kind:"edge",ecid:t.ecid,reason:r,by:f}),s||I.push({ecid:T(t.type,t.src,o,t.props),type:t.type,src:t.src,dst:o,props:t.props}))}}}else if(e.kind==="edit"){let i=k("edit",e);if(!i)continue;let o=n.getNode(i);if(!o){d.push({code:"UNKNOWN_NODE",detail:`edit: ${e.target} node file unreadable`});continue}let t=B(e.edit);if(t!==null){d.push({code:"DERIVED_FIELD",detail:`edit ${e.target}: ${t} is derived from the test's steps, never set by an edit; edit test_md_blob instead`});continue}let r=P(n,o.label,o.content,e.edit,g.definitionOf);if(typeof r.title=="string"&&!r.title.trim()){d.push({code:"EMPTY_TITLE",detail:`edit: ${e.target} edited title is empty`});continue}let s=G(o.label,r);if(s.length>0){for(let h of s)d.push({code:h.code,detail:`edit ${e.target}: ${h.detail}`});continue}let c=M(o.label,r);if(c===i){N.push({id:i,kind:"review-item",resolution:"approved",edit:null,reason:null,by:f});continue}if(fe(n,i,c)){d.push({code:"SUPERSEDE_CYCLE",detail:`edit ${e.target}: edit reproduces an already-superseded version (supersession cycle guard) \u2014 re-edit forward or redesign`});continue}let v=he({graph:n,oldTip:i,newCid:c,newLabel:o.label,by:f,reason:`re-blessed onto ${c} (edited in chat)`,skipEcids:O,dstRedirect:L});if(v.errors.length>0){for(let h of v.errors)d.push({code:"REBLESS_REFUSED",detail:`edit ${e.target}: ${h}`});continue}q.push({cid:c,label:o.label,content:r}),I.push(...v.edges),S.push({kind:"node",old:i,new:c,reason:e.reason??"edited in chat",by:f}),S.push(...v.supersessions),N.push({id:c,kind:"review-item",resolution:"edited",edit:{...e.edit},reason:null,by:f})}else if(e.kind==="enhance"){if(!k("enhance",e))continue;for(let o of e.edges){let t=o,r=U(n,t.src),s=U(n,t.dst);if(!r||!s){let[p,Q]=r?["dst",t.dst]:["src",t.src],De=n.resolve(Q)!==null;d.push(De?{code:"TOMBSTONED_REF",detail:`enhance ${e.target}: ${t.type} ${p} '${Q}' is tombstoned (retired with no live successor) \u2014 pick a live node`}:{code:"UNKNOWN_REF",detail:`enhance ${e.target}: ${t.type} ${p} got (unknown) for '${Q}' \u2014 not a committed node (a node added in this same turn has no id yet: commit the add first)`});continue}if((b.enhance[e.eventId]??=[]).push({src:r.cid,dst:s.cid}),t.type===y.DERIVES){let p=Oe.one(L.get(s.cid)??s.cid,t.props,I);if("fault"in p){d.push({code:p.fault.code,detail:`enhance ${e.target}: ${p.fault.detail}`});continue}p.props!==t.props&&(t={...t,props:p.props})}let c=n.nodeLabel.get(r.cid)??"(unknown)",v=n.nodeLabel.get(s.cid)??"(unknown)";for(let p of ee(t.type,c,v,t.props))d.push({code:p.code,detail:`enhance ${e.target}: ${p.detail}`});let h=T(t.type,r.cid,s.cid,t.props),l=L.get(r.cid)??r.cid,E=L.get(s.cid)??s.cid,a=T(t.type,l,E,t.props);if(n.superseded.has(h)||O.has(h)||n.superseded.has(a)){let p=n.superseded.has(h)||O.has(h)?h:a;d.push({code:"EDGE_RETRACTED",detail:`enhance ${e.target}: this ${t.type} edge was retracted (${p}) \u2014 re-adding a retracted edge is refused (revival unsupported)`});continue}if(n.edgesFrom(r.cid).some(p=>p.ecid===h)||I.some(p=>p.ecid===a))continue;let u=ye(n,t.type,r.cid,s.cid,se);u&&d.push(u);let x=ge(n,{type:t.type,src:r.cid,dst:s.cid},{pending:[],retracted:O},`enhance ${e.target}`);x&&d.push(x);let A=Z(t.type)?.cardinality;if(A==="one-live-per-src"||A==="one-live-per-src-and-dst"){let p=`${t.type}|${r.cid}`;j.has(p)&&d.push({code:"CARDINALITY_VIOLATION",detail:`${t.type} from ${r.cid}: two one-live edges in one turn`}),j.add(p)}if(A==="one-live-per-src-and-dst"){let p=`${t.type}|dst|${s.cid}`;j.has(p)&&d.push({code:"CARDINALITY_VIOLATION",detail:`${t.type} onto ${s.cid}: two one-live edges in one turn (strict 1:1)`}),j.add(p)}I.push({ecid:a,type:t.type,src:l,dst:E,props:t.props}),se.push({src:r.cid,dst:s.cid,type:t.type})}}else if(e.kind==="retract")S.push({kind:"edge",ecid:e.edgeEcid,reason:e.reason,by:f});else if(e.kind==="add"){if(!Te.has(e.label)){d.push({code:"GATED_LABEL",detail:`add: ${e.label} is not mintable in v1 (gate: ${$.join("|")})`,data:{gate:[...$]}});continue}let i=n.heads.get(e.convSourceId),o=n.convChains.get(e.convSourceId);if(typeof i!="string"||!o){d.push({code:"CONV_SOURCE_MISSING",detail:`add: ${e.convSourceId} is not a live conversation source`});continue}b.conv[e.eventId]=i;let t=n.getNode(i)?.content?.blob,r=typeof t=="string"?m.getBlob(t)?.toString("utf8")??"":"",s=Se(r,e.cite.turn);if(s===null){d.push({code:"BAD_ANCHOR",detail:`add: ${K(e.cite.turn)} does not resolve in ${e.convSourceId}`});continue}if(!ue(e.cite.quote,s)){d.push({code:"QUOTE_MISMATCH",detail:`add: quote is not verbatim within ${K(e.cite.turn)}`});continue}let c=B(e.content);if(c!==null){d.push({code:"DERIVED_FIELD",detail:`add: ${c} is derived from the test's steps, never set by an add; send test_md_blob only`});continue}let v={...P(n,e.label,{},e.content,g.definitionOf),derived:!0},h=G(e.label,v);if(h.length>0){for(let u of h)d.push({code:u.code,detail:`add: ${u.detail}`});continue}let l=M(e.label,v),E={source_id:e.convSourceId,source_cid:i,anchor:K(e.cite.turn),quote:e.cite.quote};for(let u of ee(y.DERIVES,"source",e.label,E))d.push({code:u.code,detail:`add: ${u.detail}`});if(n.hasNode(l)){if(n.superseded.has(l)){d.push({code:"NODE_TOMBSTONED",detail:`add: ${n.nameOf.get(l)??l} already exists and was retired \u2014 restore it deliberately or add it under new content`});continue}I.push({ecid:T("DERIVES",i,l,E),type:y.DERIVES,src:i,dst:l,props:E}),e.rationale&&F.push({about:l,rationale:e.rationale,by:f}),J.set(e.eventId,l);continue}q.push({cid:l,label:e.label,content:v}),I.push({ecid:T("DERIVES",i,l,E),type:y.DERIVES,src:i,dst:l,props:E}),e.rationale&&F.push({about:l,rationale:e.rationale,by:f});let a=$e(e.label,u=>ie.has(u),n.names.keys());a!==null&&(ie.add(a),H.push({cid:l,slug:a,by:f})),Y.push({cid:l,...a!==null?{slug:a}:{}}),J.set(e.eventId,l)}if(d.length)return{record:null,errors:d};let re=new Date().toISOString();for(let e of g.learn===!1?[]:_){if(e.kind==="add"){let i=J.get(e.eventId);i&&m.signals().append({ts:re,command:"extract-chat",id:i,verdict:"add",polarity:"preference",tag:e.label,by:f,event_id:e.eventId,target:i});continue}for(let i of Ie(e,{ts:re,command:"extract-chat",by:f}))m.signals().append(i)}let ce=D.map(e=>e.eventId).sort(),we=me(m,{ts:new Date().toISOString(),proposal_id:null,nodes:q,edges:I,review:N,supersessions:S,...H.length>0?{names:H}:{},...F.length>0?{judgements:F}:{},event_ids:ce,...g.sid?{sid:g.sid}:{},source_head_moves:{}},{graph:n,scope:g.scope,expectPrev:C,intent:{v:1,verb:"chat",args:le({ops:R,judgements:g.judgements??null,by:f,mintable:[...$],sid:g.sid??null,...g.learn===!1?{learn:!1}:{}}),pins:b},provenance:g.provenance}),X=ve(m),V=new Set;for(let e of S)if(e.kind==="node"){V.add(e.old);for(let i of X.edgesInto(e.old))V.add(i.src)}for(let e of Y)V.add(e.cid);let Ce=[...V].map(e=>({cid:e,state:X.stale(X.tipOf(e))})).filter(e=>e.state!=="fresh");return{record:we.record,errors:null,applied:ce,skipped:W,minted:Y,staleDelta:Ce}}export{be as a,P as b,ze as c};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as bt}from"./chunk-LX2I4JEH.js";import{a as St}from"./chunk-GEZVC4S3.js";import{a as gt,b as mt,d as ht,e as _t}from"./chunk-3KY7HHQU.js";import{F as ct,H as dt,L as at,M as ft,P as le,W as ut,a as st,b as Ie,ba as pt,f as nt,g as it,oa as X,pa as lt,r as ot,v as rt}from"./chunk-PI7OXS62.js";import{d as pe,e as W,f as _,g,h as Ze,i as et,j as tt}from"./chunk-KU3YHPWZ.js";var Pt=/\s@verifies\s+(ac-[\w.:\/-]+(?:\s*,\s*ac-[\w.:\/-]+)*)\s*$/,Lt=new Set([g.EXERCISES,g.VERIFIES,g.SCOPED_TO]),Y=n=>({record:null,errors:n,minted:{},logicalIds:{},superseded:[],warnings:[],finalizedTests:{}});function J(n){return n.toLowerCase().trim().replace(/\s+/g," ")}function yt(n,E,t,l,f){return y=>{if(!f||!W.has(String(y.kind))||!(y.kind==="unmeasurable"||l==="tests")||y.ref&&(t.scenarios??[]).some(T=>T.temp_ref===y.ref))return!0;let O=y.ref?n.resolve(y.ref):null;return!!(O&&n.nodeLabel.get(O.cid)===_.SCENARIO&&!n.superseded.has(n.tipOf(O.cid))&&n.edgesFrom(n.tipOf(O.cid)).some(T=>T.type===g.BELONGS_TO&&n.tipOf(T.dst)===E))}}function Ot(n){let E=new Set;return n.sections.scenarios?.length&&E.add(_.SCENARIO),n.sections.tests?.length&&E.add(_.TEST),n.gen8&&(n.sections.tests?.length||n.phase==="tests"&&n.gapsToMint.some(t=>W.has(String(t.kind))))&&(E.add(_.TEST),E.add(_.GAP)),E}function Et(n,E,t){let l=new Set,f=[];for(let y of E)n.superseded.has(y)||(t.has(n.nodeLabel.get(y)??"")?l.add(y):f.push(y));return{retired:l,remaining:f}}function ss(n,E){let t=n.tokenAt(E.seq),l=t===null?null:n.intentOf(t);if(l===null)return null;let f=l.args,y=l.pins.forceScope;if(l.verb!=="design"||f.forceScope==null||!Array.isArray(y)||!f.sections||!f.ucRef)return;let O=E.seq>1?n.tokenAt(E.seq-1):null;if(O===null)return null;let T=ft(n,{token:O}),F=le(T,f.ucRef);if(!F.ok)return null;let R=pe(f.templateVersion)>=8,C=(f.sections.gaps??[]).filter(yt(T,F.cid,f.sections,f.phase,R));return Et(T,y,Ot({sections:f.sections,phase:f.phase,gen8:R,gapsToMint:C})).remaining}function Ft(n,E,t={}){let l=le(n,E);if(!l.ok)return[];let f=new Set,y=new Set;for(let{cid:O}of n.byLabel(_.SCENARIO))if(!n.superseded.has(O)&&n.edgesFrom(O).some(T=>T.type===g.BELONGS_TO&&n.tipOf(T.dst)===l.cid)){f.add(O),y.add(O),y.add(n.tipOf(O));for(let T of n.edgesInto(O))T.type!==g.AUTOMATES||n.superseded.has(T.src)||f.add(T.src)}if(t.blockerGaps){let O=new Set([l.cid,n.tipOf(l.cid)]);for(let{cid:T,content:F}of n.byLabel(_.GAP)){if(n.superseded.has(T)||n.trust.get(T)==="archived"||!W.has(String(F.kind??"")))continue;let R=typeof F.uc=="string"?F.uc:"";if(!O.has(R)&&!O.has(n.tipOf(R)))continue;let C=F.ref,k=typeof C=="string"&&C?n.resolve(C):null;k&&(y.has(k.cid)||y.has(n.tipOf(k.cid)))&&f.add(T)}}return[...f]}function ns(n){let{store:E,graph:t,sections:l,by:f}=n,y=n.engine??"design@1",O=E.head(),T=E.serialize(O);if(!E.sameToken(E.parse(t.latestHash),O))return Y([{code:"STALE_BASIS",detail:`graph opened at ${String(t.latestHash)} but chain head is ${String(T)} \u2014 re-open and retry`}]);let F=le(t,n.ucRef);if(!F.ok)return Y([{code:"UNKNOWN_UC",detail:`${n.ucRef} is not a live use-case`}]);let R=F.cid,C={ucRef:R,automates:{},verifies:{},reuses:{},scope:{},depends_on:{},exercises:[],scoped_to_repoints:[],judgements:[],body_tags:{},forceScope:[]},k=[],Ae=/^design@(\d+)$/.exec(n.templateVersion??""),Q=pe(n.templateVersion)>=8,Ne=yt(t,R,l,n.phase,Q),te=(l.gaps??[]).filter(Ne),Tt=Ae!==null&&Number.parseInt(Ae[1],10)>=3,De=new Map,$t=(e,i)=>{let s=De.get(e.source_cid);if(s===void 0){let p=rt(E,t,e.source_cid);s=p?St(p.toString("utf8")):null,De.set(e.source_cid,s)}if(s===null)return k.push({code:"CITE_UNVERIFIED",detail:`${i}: source ${e.source_id} (${e.source_cid.slice(0,19)}) has no citable text to verify against`}),!1;let u=ct(t.mediaOf(e.source_cid),e,s);if(u.length>0){for(let p of u)k.push({code:"CITE_UNVERIFIED",detail:`${i}: ${p.code}: ${p.detail}`});return!1}return!0},xe=pe(n.templateVersion)>=9,kt=(e,i)=>{let s=e.source_cid?t.mediaOf(e.source_cid):void 0;if(!e.source_cid||!t.hasNode(e.source_cid)&&s==null)return{code:"CITE_SOURCE_UNKNOWN",detail:`${i}: there is no source ${e.source_id} in this store to cite \u2014 cite a source the use case reads, by its id`};if(s?.plugin?.cites_deep===!0)return null;let u=s?.format==="plugin"?`version ${e.source_cid.slice(0,19)} of ${e.source_id} was stored before its plugin allowed citations below the use case (or by a plugin that does not allow them) \u2014 re-ingest it, or cite it at the use case`:`${e.source_id} is not a source-plugin source that allows citations below the use case \u2014 cite it at the use case instead, or leave this item's cites out`;return{code:"CITE_DEPTH_UNSUPPORTED",detail:`${i}: ${u}`}},ge=(e,i,s,u,p)=>{for(let m of i??[]){if(u){let a=kt(m,`${s}.cite`);if(a){k.push(a);continue}}if(Tt&&!$t(m,`${s}.cite`))continue;let x={source_id:m.source_id,source_cid:m.source_cid,anchor:m.anchor,...m.quote?{quote:m.quote}:{}},G=Ct.one(e,x,p);if("fault"in G){k.push(G.fault);continue}B(g.DERIVES,m.source_cid,e,G.props,`${s}.cite`)}},vt=()=>xe?bt(t,R):[],P=[],M=[],N=[],me=[],re=[],w={},q={},he={},L=[],Z=[],H=[],Pe=new Set,_e=[],ce=new Set,Le=n.forceScope??(n.force?Ft(t,n.ucRef,{blockerGaps:Q}):[]);C.forceScope=[...Le];let{retired:U,remaining:Fe}=Et(t,Le,Ot({sections:l,phase:n.phase,gen8:Q,gapsToMint:te})),V=new Set,be=e=>!t.superseded.has(e)&&(!U.has(e)||V.has(e)),j=(e,i,s)=>{if(w[e])return w[e];let u=t.resolve(e),p=u?be(u.cid)?u.cid:t.tipOf(u.cid):null;return!u||!p||!be(p)?(k.push({code:"UNKNOWN_REF",detail:`${i}: '${e}' is neither in this payload nor a live committed node`}),null):s&&t.nodeLabel.get(p)!==s?(k.push({code:"ILLEGAL_EDGE",detail:`${i}: '${e}' is a ${t.nodeLabel.get(p)}, expected ${s}`}),null):p},Rt=(e,i,s,u)=>{if(t.nameOf.has(i)){q[u]=t.nameOf.get(i);return}let p=lt(e,m=>Pe.has(m),t.names.keys());p!==null&&(Pe.add(p),me.push({cid:i,slug:p,by:f}),q[u]=p)},de=(e,i,s,u)=>{for(let m of Ze(e,s))k.push({code:m.code,detail:`${i}: ${m.detail}`});let p=st(e,s);if(t.hasNode(p)&&!t.superseded.has(p))return U.has(p)&&V.add(p),w[i]=p,p;if(t.hasNode(p)&&t.superseded.has(p)){let m=X(t.nameOf.get(p)??p),x=t.tipOf(p),G=x!==p&&!t.superseded.has(x);return k.push(G?{code:"NODE_SUPERSEDED",detail:`${i}: '${u}' is ${m} as it was before it was replaced by ${X(t.nameOf.get(x)??x)} \u2014 refer to ${X(t.nameOf.get(x)??x)} to keep it, or send it changed`}:{code:"NODE_TOMBSTONED",detail:`${i}: '${u}' is ${m}, which was retired \u2014 a retired item can't come back as it was; send it changed (it is then a new item), or leave it out`}),null}return P.push({cid:p,label:e,content:s}),w[i]=p,Rt(e,p,u,i),p},Ct=it(nt(E,t)),B=(e,i,s,u,p)=>{let m=Ie(e,i,s,u);if(t.edgesFrom(i).some(d=>d.ecid===m&&!t.superseded.has(d.ecid))){e===g.AUTOMATES&&ce.add(s);return}if(t.superseded.has(m)){k.push({code:"EDGE_RETRACTED",detail:`${p}: this ${e} edge was retracted (${m}) \u2014 retraction is terminal for commits. Add a NEW relationship (different endpoint or props), redesign, or revert the retracting record`});return}if(Lt.has(e)&&t.hasNode(i)&&!t.superseded.has(i)&&t.hasNode(s)&&!t.superseded.has(s)){let d=t.displayNameOf(s);for(let c of t.edgesFrom(i))c.type!==e||c.dst===s||t.superseded.has(c.ecid)||!t.superseded.has(c.dst)||t.tipOf(c.dst)!==s||d===null||t.displayNameOf(c.dst)!==d||N.some(v=>v.kind==="edge"&&v.ecid===c.ecid)||N.push({kind:"edge",ecid:c.ecid,reason:`re-pinned onto ${s} (the same link to its live version) by ${f.id}`,by:f})}let x=t.nodeLabel.get(i)??P.find(d=>d.cid===i)?.label??"(unknown)",G=t.nodeLabel.get(s)??P.find(d=>d.cid===s)?.label??"(unknown)";for(let d of tt(e,x,G,u))k.push({code:d.code,detail:`${p}: ${d.detail}`});let a=ut(t,e,i,s,_e);if(a){k.push({code:a.code,detail:`${p}: ${a.detail}`});return}if(e===g.BELONGS_TO||e===g.SCOPED_TO){let d=dt(t,{type:e,src:i,dst:s},{pending:_e,retracted:new Set(N.flatMap(c=>c.kind==="edge"?[c.ecid]:[])),freed:new Set([...U].filter(c=>!V.has(c)))},p);if(d){k.push(d);return}}if(e===g.AUTOMATES){if(ce.has(s)){k.push({code:"CARDINALITY_VIOLATION",detail:`${p}: two automates onto ${s} in one record (strict 1:1)`});return}if(ce.add(s),!U.has(s)||V.has(s)){let d=h=>U.has(h)&&!V.has(h);if(t.edgesFrom(i).some(h=>h.type===g.AUTOMATES&&h.dst!==s&&!t.superseded.has(h.dst)&&!d(h.dst))&&t.hasNode(i)){k.push({code:"CARDINALITY_VIOLATION",detail:`${p}: automates from ${i} already has a live edge \u2014 supersede it first`});return}if(t.edgesInto(s).some(h=>h.type===g.AUTOMATES&&h.src!==i&&!t.superseded.has(h.src)&&!d(h.src))){k.push({code:"CARDINALITY_VIOLATION",detail:`${p}: automates onto ${s} already has a live edge \u2014 strict 1:1, supersede it first`});return}}}M.push({ecid:Ie(e,i,s,u),type:e,src:i,dst:s,props:u}),_e.push({src:i,dst:s,type:e})},Se=new Set;for(let e of te)e.kind==="budget-evicted"&&e.ref&&Se.add(e.ref);let K=[];for(let[e,i]of(l.gaps??[]).entries()){if(Ne(i))continue;let s=i.temp_ref??i.ref??"gap";K.push(e),L.push(`${s} not committed: a ${i.kind} gap stands in for a scenario's test \u2014 ref must be that scenario's committed id (sc-N) or its temp_ref in this payload; got ${i.ref?`'${i.ref}'`:"no ref"}`)}let Me=()=>{for(let e of te){let i=e.temp_ref??e.ref??"gap",s=e.question;if(!s||typeof s!="object"||!s.header||!Array.isArray(s.options)||s.options.length===0||!Number.isInteger(s.recommended_index)){k.push({code:"GAP_QUESTION_INCOMPLETE",detail:`${i}: design gaps carry a full ranked question object (header/options/recommended_index)`});continue}let u=e.ref?Q?w[e.ref]??e.ref:e.ref:void 0,p={kind:e.kind,question:s,derived:!0,uc:R,...e.risk?{risk:e.risk}:{},...e.risk_rationale?{risk_rationale:e.risk_rationale}:{},...e.text?{text:e.text}:{},...u?{ref:u}:{}};de(_.GAP,i,p,String(s.header))}};Q||Me();let ae=n.lineage===2,D={reuseOf:{seen:0,honored:0,linked:0,unresolved:0},byPair:0,byCriteria:0,byTitle:0},fe=[],ye={},Oe=new Map;if(ae)for(let e of l.scenarios??[]){if(typeof e.reuse_of!="string"||!e.reuse_of)continue;D.reuseOf.seen+=1;let i=t.resolve(e.reuse_of),s=i?t.superseded.has(i.cid)?t.tipOf(i.cid):i.cid:null;if(!(s!==null&&!t.superseded.has(s)&&t.nodeLabel.get(s)===_.SCENARIO&&t.edgesFrom(s).some(p=>p.type===g.BELONGS_TO&&t.tipOf(p.dst)===R))){D.reuseOf.unresolved+=1,fe.push(`${e.temp_ref}: reuse_of '${e.reuse_of}' names no scenario of this use case \u2014 saved as a new scenario`);continue}Oe.set(e.temp_ref,s),ye[e.temp_ref]=s}let Ge=new Map;for(let{cid:e,content:i}of t.byLabel(_.SCENARIO))be(e)&&t.edgesFrom(e).some(s=>s.type===g.BELONGS_TO&&t.tipOf(s.dst)===R)&&Ge.set(J(String(i.title??"")),e);for(let e of l.scenarios??[]){let i=Oe.get(e.temp_ref);if(i!==void 0&&!U.has(i))if(t.edgesInto(i).some(m=>m.type===g.AUTOMATES&&!t.superseded.has(m.ecid)&&!t.superseded.has(m.src))&&(l.tests??[]).some(m=>m.automates===e.temp_ref))fe.push(`${e.temp_ref}: reuse_of '${e.reuse_of}' names a scenario that already has its test \u2014 saved as a new scenario`);else{w[e.temp_ref]=i;let m=t.displayNameOf(i);m&&(q[e.temp_ref]=m),D.reuseOf.linked+=1;continue}let s=Ge.get(J(e.title));if(s){k.push({code:"DUPLICATE_SCENARIO",detail:`${e.temp_ref}: '${e.title}' duplicates live scenario ${t.nameOf.get(s)??s} \u2014 exercise/link it instead (reuse before minting)`});continue}let u={title:e.title,intent:e.intent,case_type:e.case_type,derived:!0,...e.technique_notes?{technique_notes:e.technique_notes}:{},...e.description?{description:e.description}:{},...e.parameters?{parameters:e.parameters}:{},...e.tags?{tags:e.tags}:{}};de(_.SCENARIO,e.temp_ref,u,e.title)}for(let e of l.scenarios??[]){let i=w[e.temp_ref];if(i){B(g.BELONGS_TO,i,R,{},e.temp_ref);for(let s of e.depends_on??[]){let u=j(s,`${e.temp_ref}.depends_on`,_.SCENARIO);u&&((C.depends_on[e.temp_ref]??=[]).push(u),B(g.DEPENDS_ON,i,u,{},`${e.temp_ref}.depends_on`))}ge(i,e.cites,e.temp_ref,!0,M)}}for(let e of l.acs??[]){let i={text:e.text,kind:e.kind,risk:e.risk,derived:!0,...e.expected_answer?{expected_answer:e.expected_answer}:{},...e.measurable!==void 0?{measurable:e.measurable}:{}},s=de(_.AC,e.temp_ref,i,e.text);if(!s)continue;let u=e.scope?.type==="scenario"&&e.scope.ref?j(e.scope.ref,`${e.temp_ref}.scope`,_.SCENARIO):R;u&&u!==R&&(C.scope[e.temp_ref]=u),u&&!t.edgesFrom(s).some(p=>p.type===g.SCOPED_TO&&!t.superseded.has(p.ecid))&&B(g.SCOPED_TO,s,u,{},`${e.temp_ref}.scope`),ge(s,e.cites,e.temp_ref,xe,M)}for(let e of l.exercises??[]){let i=j(e.scenario,"exercises.scenario",_.SCENARIO),s=j(e.ac,"exercises.ac",_.AC);!i||!s||(C.exercises.push({scenario:i,ac:s}),B(g.EXERCISES,i,s,{},`exercises ${e.scenario}\u2192${e.ac}`))}let Be=0;for(let e of l.scoped_to_repoints??[]){let i=j(e.ac,"scoped_to_repoints.ac",_.AC),s=j(e.to,"scoped_to_repoints.to");if(!i||!s)continue;C.scoped_to_repoints.push({ac:i,to:s});let u=t.edgesFrom(i).find(p=>p.type===g.SCOPED_TO&&!t.superseded.has(p.ecid));if(u&&u.dst===s){Be+=1,L.push(`scoped_to_repoints ${e.ac}: already scoped to ${e.to} \u2014 no-op`);continue}u&&N.push({kind:"edge",ecid:u.ecid,reason:`re-scoped to ${e.to} by ${f.id}`,by:f}),B(g.SCOPED_TO,i,s,{},`scoped_to_repoints ${e.ac}`)}let Ue=new Map;if(n.finalizeTestBody)for(let[e,i]of t.nameOf)Ue.set(t.tipOf(e),i);let je=e=>t.nameOf.get(e)??Ue.get(t.tipOf(e))??null,Ee=e=>{if(w[e])return w[e];let i=t.resolve(e);return i?t.names.has(e)&&!t.superseded.has(i.cid)?i.cid:t.tipOf(i.cid):null},wt=e=>{let i=Ee(e);if(!i&&n.strict)throw new Error(`UNMAPPED_REF: '${e}' resolves to nothing on this graph`);return i?w[e]?q[e]??je(i):t.names.has(e)?e:je(i):null};Q&&Me();for(let e of l.tests??[]){for(let a of e.reuses??[])Se.has(a)&&k.push({code:"REUSES_EVICTED",detail:`${e.temp_ref}: reuses '${a}' which was budget-evicted \u2014 drop the edge; the dependent gap names the missing @import`});{let a=c=>c==="emulator"||c==="simulator"?c:"web",d=c=>{let v=(l.tests??[]).find(z=>z.temp_ref===c);if(v)return a(v.target);let h=t.resolve(c),b=h?t.getNode(t.tipOf(h.cid)??h.cid)?.content:void 0;if(typeof b?.target=="string")return a(String(b.target));let I=/^\s*\[mobile:\s*(emulator|simulator)\]/m.exec(String(b?.test_md_blob??""));return I?I[1]:"web"};for(let c of e.reuses??[]){let v=a(e.target),h=d(c);v!==h&&k.push({code:"REUSES_CROSS_SURFACE",detail:`${e.temp_ref}: reuses '${c}' which runs on ${h} while this test runs on ${v} \u2014 a test imports only same-surface units`})}}let i=e.test_md_blob,s=e.definitionId,u=e.objectives_blob;if(n.finalizeTestBody){let a;try{a=n.finalizeTestBody({temp_ref:e.temp_ref,test_md_blob:e.test_md_blob,verifies:e.verifies,reuses:e.reuses??[]},wt)}catch(d){return Y([{code:"FINALIZE_BODY",detail:`${e.temp_ref}: ${d instanceof Error?d.message:String(d)}`}])}a&&(i=a.test_md_blob,s=a.definitionId,u=a.objectives_blob??u,he[e.temp_ref]=s)}let p={title:e.title,check:e.check,definitionId:s,derived:!0,...e.config?{config:e.config}:{},...i?{test_md_blob:i}:{},...u?{objectives_blob:u}:{},...e.surface_required!==void 0?{surface_required:e.surface_required}:{},...e.target?{target:e.target}:{},...e.app&&e.target?{app:e.app}:{}},m=de(_.TEST,e.temp_ref,p,e.title);if(!m)continue;ge(m,e.cites,e.temp_ref,!0,M);let x=j(e.automates,`${e.temp_ref}.automates`,_.SCENARIO);x&&(C.automates[e.temp_ref]=x,B(g.AUTOMATES,m,x,{},`${e.temp_ref}.automates`)),C.verifies[e.temp_ref]=[];for(let a of e.verifies){let d=j(a,`${e.temp_ref}.verifies`,_.AC);d&&(C.verifies[e.temp_ref].push(d),B(g.VERIFIES,m,d,{},`${e.temp_ref}.verifies`))}C.reuses[e.temp_ref]=[];for(let a of e.reuses??[]){if(Se.has(a))continue;let d=j(a,`${e.temp_ref}.reuses`,_.TEST);d&&(C.reuses[e.temp_ref].push(d),B(g.REUSES,m,d,{},`${e.temp_ref}.reuses`))}for(let a of e.verifies){let d=Ee(a)??void 0;d&&(t.trust.get(d)??"derived")==="derived"&&!P.some(c=>c.cid===d)?(L.push(`${e.temp_ref}: verifies ${a} which is still DERIVED (unapproved) \u2014 committed anyway; approve it in chat or via review`),Z.push({test:e.temp_ref,criterion:d})):d&&w[a]===d&&(l.acs??[]).some(c=>c.temp_ref===a)&&(L.push(`${e.temp_ref}: verifies ${a} minted in this same record (unapproved) \u2014 committed anyway; approve it in chat`),Z.push({test:e.temp_ref,criterion:d}))}if(!String(e.test_md_blob??"").split(`
|
|
2
|
+
import{a as bt}from"./chunk-LX2I4JEH.js";import{a as St}from"./chunk-JM6AKCN4.js";import{a as gt,b as mt,d as ht,e as _t}from"./chunk-JSSM2TWY.js";import{F as ct,H as dt,L as at,M as ft,P as le,W as ut,a as st,b as Ie,ba as pt,f as nt,g as it,oa as X,pa as lt,r as ot,v as rt}from"./chunk-5EAJO372.js";import{d as pe,e as W,f as _,g,h as Ze,i as et,j as tt}from"./chunk-KU3YHPWZ.js";var Pt=/\s@verifies\s+(ac-[\w.:\/-]+(?:\s*,\s*ac-[\w.:\/-]+)*)\s*$/,Lt=new Set([g.EXERCISES,g.VERIFIES,g.SCOPED_TO]),Y=n=>({record:null,errors:n,minted:{},logicalIds:{},superseded:[],warnings:[],finalizedTests:{}});function J(n){return n.toLowerCase().trim().replace(/\s+/g," ")}function yt(n,E,t,l,f){return y=>{if(!f||!W.has(String(y.kind))||!(y.kind==="unmeasurable"||l==="tests")||y.ref&&(t.scenarios??[]).some(T=>T.temp_ref===y.ref))return!0;let O=y.ref?n.resolve(y.ref):null;return!!(O&&n.nodeLabel.get(O.cid)===_.SCENARIO&&!n.superseded.has(n.tipOf(O.cid))&&n.edgesFrom(n.tipOf(O.cid)).some(T=>T.type===g.BELONGS_TO&&n.tipOf(T.dst)===E))}}function Ot(n){let E=new Set;return n.sections.scenarios?.length&&E.add(_.SCENARIO),n.sections.tests?.length&&E.add(_.TEST),n.gen8&&(n.sections.tests?.length||n.phase==="tests"&&n.gapsToMint.some(t=>W.has(String(t.kind))))&&(E.add(_.TEST),E.add(_.GAP)),E}function Et(n,E,t){let l=new Set,f=[];for(let y of E)n.superseded.has(y)||(t.has(n.nodeLabel.get(y)??"")?l.add(y):f.push(y));return{retired:l,remaining:f}}function ss(n,E){let t=n.tokenAt(E.seq),l=t===null?null:n.intentOf(t);if(l===null)return null;let f=l.args,y=l.pins.forceScope;if(l.verb!=="design"||f.forceScope==null||!Array.isArray(y)||!f.sections||!f.ucRef)return;let O=E.seq>1?n.tokenAt(E.seq-1):null;if(O===null)return null;let T=ft(n,{token:O}),F=le(T,f.ucRef);if(!F.ok)return null;let R=pe(f.templateVersion)>=8,C=(f.sections.gaps??[]).filter(yt(T,F.cid,f.sections,f.phase,R));return Et(T,y,Ot({sections:f.sections,phase:f.phase,gen8:R,gapsToMint:C})).remaining}function Ft(n,E,t={}){let l=le(n,E);if(!l.ok)return[];let f=new Set,y=new Set;for(let{cid:O}of n.byLabel(_.SCENARIO))if(!n.superseded.has(O)&&n.edgesFrom(O).some(T=>T.type===g.BELONGS_TO&&n.tipOf(T.dst)===l.cid)){f.add(O),y.add(O),y.add(n.tipOf(O));for(let T of n.edgesInto(O))T.type!==g.AUTOMATES||n.superseded.has(T.src)||f.add(T.src)}if(t.blockerGaps){let O=new Set([l.cid,n.tipOf(l.cid)]);for(let{cid:T,content:F}of n.byLabel(_.GAP)){if(n.superseded.has(T)||n.trust.get(T)==="archived"||!W.has(String(F.kind??"")))continue;let R=typeof F.uc=="string"?F.uc:"";if(!O.has(R)&&!O.has(n.tipOf(R)))continue;let C=F.ref,k=typeof C=="string"&&C?n.resolve(C):null;k&&(y.has(k.cid)||y.has(n.tipOf(k.cid)))&&f.add(T)}}return[...f]}function ns(n){let{store:E,graph:t,sections:l,by:f}=n,y=n.engine??"design@1",O=E.head(),T=E.serialize(O);if(!E.sameToken(E.parse(t.latestHash),O))return Y([{code:"STALE_BASIS",detail:`graph opened at ${String(t.latestHash)} but chain head is ${String(T)} \u2014 re-open and retry`}]);let F=le(t,n.ucRef);if(!F.ok)return Y([{code:"UNKNOWN_UC",detail:`${n.ucRef} is not a live use-case`}]);let R=F.cid,C={ucRef:R,automates:{},verifies:{},reuses:{},scope:{},depends_on:{},exercises:[],scoped_to_repoints:[],judgements:[],body_tags:{},forceScope:[]},k=[],Ae=/^design@(\d+)$/.exec(n.templateVersion??""),Q=pe(n.templateVersion)>=8,Ne=yt(t,R,l,n.phase,Q),te=(l.gaps??[]).filter(Ne),Tt=Ae!==null&&Number.parseInt(Ae[1],10)>=3,De=new Map,$t=(e,i)=>{let s=De.get(e.source_cid);if(s===void 0){let p=rt(E,t,e.source_cid);s=p?St(p.toString("utf8")):null,De.set(e.source_cid,s)}if(s===null)return k.push({code:"CITE_UNVERIFIED",detail:`${i}: source ${e.source_id} (${e.source_cid.slice(0,19)}) has no citable text to verify against`}),!1;let u=ct(t.mediaOf(e.source_cid),e,s);if(u.length>0){for(let p of u)k.push({code:"CITE_UNVERIFIED",detail:`${i}: ${p.code}: ${p.detail}`});return!1}return!0},xe=pe(n.templateVersion)>=9,kt=(e,i)=>{let s=e.source_cid?t.mediaOf(e.source_cid):void 0;if(!e.source_cid||!t.hasNode(e.source_cid)&&s==null)return{code:"CITE_SOURCE_UNKNOWN",detail:`${i}: there is no source ${e.source_id} in this store to cite \u2014 cite a source the use case reads, by its id`};if(s?.plugin?.cites_deep===!0)return null;let u=s?.format==="plugin"?`version ${e.source_cid.slice(0,19)} of ${e.source_id} was stored before its plugin allowed citations below the use case (or by a plugin that does not allow them) \u2014 re-ingest it, or cite it at the use case`:`${e.source_id} is not a source-plugin source that allows citations below the use case \u2014 cite it at the use case instead, or leave this item's cites out`;return{code:"CITE_DEPTH_UNSUPPORTED",detail:`${i}: ${u}`}},ge=(e,i,s,u,p)=>{for(let m of i??[]){if(u){let a=kt(m,`${s}.cite`);if(a){k.push(a);continue}}if(Tt&&!$t(m,`${s}.cite`))continue;let x={source_id:m.source_id,source_cid:m.source_cid,anchor:m.anchor,...m.quote?{quote:m.quote}:{}},G=Ct.one(e,x,p);if("fault"in G){k.push(G.fault);continue}B(g.DERIVES,m.source_cid,e,G.props,`${s}.cite`)}},vt=()=>xe?bt(t,R):[],P=[],M=[],N=[],me=[],re=[],w={},q={},he={},L=[],Z=[],H=[],Pe=new Set,_e=[],ce=new Set,Le=n.forceScope??(n.force?Ft(t,n.ucRef,{blockerGaps:Q}):[]);C.forceScope=[...Le];let{retired:U,remaining:Fe}=Et(t,Le,Ot({sections:l,phase:n.phase,gen8:Q,gapsToMint:te})),V=new Set,be=e=>!t.superseded.has(e)&&(!U.has(e)||V.has(e)),j=(e,i,s)=>{if(w[e])return w[e];let u=t.resolve(e),p=u?be(u.cid)?u.cid:t.tipOf(u.cid):null;return!u||!p||!be(p)?(k.push({code:"UNKNOWN_REF",detail:`${i}: '${e}' is neither in this payload nor a live committed node`}),null):s&&t.nodeLabel.get(p)!==s?(k.push({code:"ILLEGAL_EDGE",detail:`${i}: '${e}' is a ${t.nodeLabel.get(p)}, expected ${s}`}),null):p},Rt=(e,i,s,u)=>{if(t.nameOf.has(i)){q[u]=t.nameOf.get(i);return}let p=lt(e,m=>Pe.has(m),t.names.keys());p!==null&&(Pe.add(p),me.push({cid:i,slug:p,by:f}),q[u]=p)},de=(e,i,s,u)=>{for(let m of Ze(e,s))k.push({code:m.code,detail:`${i}: ${m.detail}`});let p=st(e,s);if(t.hasNode(p)&&!t.superseded.has(p))return U.has(p)&&V.add(p),w[i]=p,p;if(t.hasNode(p)&&t.superseded.has(p)){let m=X(t.nameOf.get(p)??p),x=t.tipOf(p),G=x!==p&&!t.superseded.has(x);return k.push(G?{code:"NODE_SUPERSEDED",detail:`${i}: '${u}' is ${m} as it was before it was replaced by ${X(t.nameOf.get(x)??x)} \u2014 refer to ${X(t.nameOf.get(x)??x)} to keep it, or send it changed`}:{code:"NODE_TOMBSTONED",detail:`${i}: '${u}' is ${m}, which was retired \u2014 a retired item can't come back as it was; send it changed (it is then a new item), or leave it out`}),null}return P.push({cid:p,label:e,content:s}),w[i]=p,Rt(e,p,u,i),p},Ct=it(nt(E,t)),B=(e,i,s,u,p)=>{let m=Ie(e,i,s,u);if(t.edgesFrom(i).some(d=>d.ecid===m&&!t.superseded.has(d.ecid))){e===g.AUTOMATES&&ce.add(s);return}if(t.superseded.has(m)){k.push({code:"EDGE_RETRACTED",detail:`${p}: this ${e} edge was retracted (${m}) \u2014 retraction is terminal for commits. Add a NEW relationship (different endpoint or props), redesign, or revert the retracting record`});return}if(Lt.has(e)&&t.hasNode(i)&&!t.superseded.has(i)&&t.hasNode(s)&&!t.superseded.has(s)){let d=t.displayNameOf(s);for(let c of t.edgesFrom(i))c.type!==e||c.dst===s||t.superseded.has(c.ecid)||!t.superseded.has(c.dst)||t.tipOf(c.dst)!==s||d===null||t.displayNameOf(c.dst)!==d||N.some(v=>v.kind==="edge"&&v.ecid===c.ecid)||N.push({kind:"edge",ecid:c.ecid,reason:`re-pinned onto ${s} (the same link to its live version) by ${f.id}`,by:f})}let x=t.nodeLabel.get(i)??P.find(d=>d.cid===i)?.label??"(unknown)",G=t.nodeLabel.get(s)??P.find(d=>d.cid===s)?.label??"(unknown)";for(let d of tt(e,x,G,u))k.push({code:d.code,detail:`${p}: ${d.detail}`});let a=ut(t,e,i,s,_e);if(a){k.push({code:a.code,detail:`${p}: ${a.detail}`});return}if(e===g.BELONGS_TO||e===g.SCOPED_TO){let d=dt(t,{type:e,src:i,dst:s},{pending:_e,retracted:new Set(N.flatMap(c=>c.kind==="edge"?[c.ecid]:[])),freed:new Set([...U].filter(c=>!V.has(c)))},p);if(d){k.push(d);return}}if(e===g.AUTOMATES){if(ce.has(s)){k.push({code:"CARDINALITY_VIOLATION",detail:`${p}: two automates onto ${s} in one record (strict 1:1)`});return}if(ce.add(s),!U.has(s)||V.has(s)){let d=h=>U.has(h)&&!V.has(h);if(t.edgesFrom(i).some(h=>h.type===g.AUTOMATES&&h.dst!==s&&!t.superseded.has(h.dst)&&!d(h.dst))&&t.hasNode(i)){k.push({code:"CARDINALITY_VIOLATION",detail:`${p}: automates from ${i} already has a live edge \u2014 supersede it first`});return}if(t.edgesInto(s).some(h=>h.type===g.AUTOMATES&&h.src!==i&&!t.superseded.has(h.src)&&!d(h.src))){k.push({code:"CARDINALITY_VIOLATION",detail:`${p}: automates onto ${s} already has a live edge \u2014 strict 1:1, supersede it first`});return}}}M.push({ecid:Ie(e,i,s,u),type:e,src:i,dst:s,props:u}),_e.push({src:i,dst:s,type:e})},Se=new Set;for(let e of te)e.kind==="budget-evicted"&&e.ref&&Se.add(e.ref);let K=[];for(let[e,i]of(l.gaps??[]).entries()){if(Ne(i))continue;let s=i.temp_ref??i.ref??"gap";K.push(e),L.push(`${s} not committed: a ${i.kind} gap stands in for a scenario's test \u2014 ref must be that scenario's committed id (sc-N) or its temp_ref in this payload; got ${i.ref?`'${i.ref}'`:"no ref"}`)}let Me=()=>{for(let e of te){let i=e.temp_ref??e.ref??"gap",s=e.question;if(!s||typeof s!="object"||!s.header||!Array.isArray(s.options)||s.options.length===0||!Number.isInteger(s.recommended_index)){k.push({code:"GAP_QUESTION_INCOMPLETE",detail:`${i}: design gaps carry a full ranked question object (header/options/recommended_index)`});continue}let u=e.ref?Q?w[e.ref]??e.ref:e.ref:void 0,p={kind:e.kind,question:s,derived:!0,uc:R,...e.risk?{risk:e.risk}:{},...e.risk_rationale?{risk_rationale:e.risk_rationale}:{},...e.text?{text:e.text}:{},...u?{ref:u}:{}};de(_.GAP,i,p,String(s.header))}};Q||Me();let ae=n.lineage===2,D={reuseOf:{seen:0,honored:0,linked:0,unresolved:0},byPair:0,byCriteria:0,byTitle:0},fe=[],ye={},Oe=new Map;if(ae)for(let e of l.scenarios??[]){if(typeof e.reuse_of!="string"||!e.reuse_of)continue;D.reuseOf.seen+=1;let i=t.resolve(e.reuse_of),s=i?t.superseded.has(i.cid)?t.tipOf(i.cid):i.cid:null;if(!(s!==null&&!t.superseded.has(s)&&t.nodeLabel.get(s)===_.SCENARIO&&t.edgesFrom(s).some(p=>p.type===g.BELONGS_TO&&t.tipOf(p.dst)===R))){D.reuseOf.unresolved+=1,fe.push(`${e.temp_ref}: reuse_of '${e.reuse_of}' names no scenario of this use case \u2014 saved as a new scenario`);continue}Oe.set(e.temp_ref,s),ye[e.temp_ref]=s}let Ge=new Map;for(let{cid:e,content:i}of t.byLabel(_.SCENARIO))be(e)&&t.edgesFrom(e).some(s=>s.type===g.BELONGS_TO&&t.tipOf(s.dst)===R)&&Ge.set(J(String(i.title??"")),e);for(let e of l.scenarios??[]){let i=Oe.get(e.temp_ref);if(i!==void 0&&!U.has(i))if(t.edgesInto(i).some(m=>m.type===g.AUTOMATES&&!t.superseded.has(m.ecid)&&!t.superseded.has(m.src))&&(l.tests??[]).some(m=>m.automates===e.temp_ref))fe.push(`${e.temp_ref}: reuse_of '${e.reuse_of}' names a scenario that already has its test \u2014 saved as a new scenario`);else{w[e.temp_ref]=i;let m=t.displayNameOf(i);m&&(q[e.temp_ref]=m),D.reuseOf.linked+=1;continue}let s=Ge.get(J(e.title));if(s){k.push({code:"DUPLICATE_SCENARIO",detail:`${e.temp_ref}: '${e.title}' duplicates live scenario ${t.nameOf.get(s)??s} \u2014 exercise/link it instead (reuse before minting)`});continue}let u={title:e.title,intent:e.intent,case_type:e.case_type,derived:!0,...e.technique_notes?{technique_notes:e.technique_notes}:{},...e.description?{description:e.description}:{},...e.parameters?{parameters:e.parameters}:{},...e.tags?{tags:e.tags}:{}};de(_.SCENARIO,e.temp_ref,u,e.title)}for(let e of l.scenarios??[]){let i=w[e.temp_ref];if(i){B(g.BELONGS_TO,i,R,{},e.temp_ref);for(let s of e.depends_on??[]){let u=j(s,`${e.temp_ref}.depends_on`,_.SCENARIO);u&&((C.depends_on[e.temp_ref]??=[]).push(u),B(g.DEPENDS_ON,i,u,{},`${e.temp_ref}.depends_on`))}ge(i,e.cites,e.temp_ref,!0,M)}}for(let e of l.acs??[]){let i={text:e.text,kind:e.kind,risk:e.risk,derived:!0,...e.expected_answer?{expected_answer:e.expected_answer}:{},...e.measurable!==void 0?{measurable:e.measurable}:{}},s=de(_.AC,e.temp_ref,i,e.text);if(!s)continue;let u=e.scope?.type==="scenario"&&e.scope.ref?j(e.scope.ref,`${e.temp_ref}.scope`,_.SCENARIO):R;u&&u!==R&&(C.scope[e.temp_ref]=u),u&&!t.edgesFrom(s).some(p=>p.type===g.SCOPED_TO&&!t.superseded.has(p.ecid))&&B(g.SCOPED_TO,s,u,{},`${e.temp_ref}.scope`),ge(s,e.cites,e.temp_ref,xe,M)}for(let e of l.exercises??[]){let i=j(e.scenario,"exercises.scenario",_.SCENARIO),s=j(e.ac,"exercises.ac",_.AC);!i||!s||(C.exercises.push({scenario:i,ac:s}),B(g.EXERCISES,i,s,{},`exercises ${e.scenario}\u2192${e.ac}`))}let Be=0;for(let e of l.scoped_to_repoints??[]){let i=j(e.ac,"scoped_to_repoints.ac",_.AC),s=j(e.to,"scoped_to_repoints.to");if(!i||!s)continue;C.scoped_to_repoints.push({ac:i,to:s});let u=t.edgesFrom(i).find(p=>p.type===g.SCOPED_TO&&!t.superseded.has(p.ecid));if(u&&u.dst===s){Be+=1,L.push(`scoped_to_repoints ${e.ac}: already scoped to ${e.to} \u2014 no-op`);continue}u&&N.push({kind:"edge",ecid:u.ecid,reason:`re-scoped to ${e.to} by ${f.id}`,by:f}),B(g.SCOPED_TO,i,s,{},`scoped_to_repoints ${e.ac}`)}let Ue=new Map;if(n.finalizeTestBody)for(let[e,i]of t.nameOf)Ue.set(t.tipOf(e),i);let je=e=>t.nameOf.get(e)??Ue.get(t.tipOf(e))??null,Ee=e=>{if(w[e])return w[e];let i=t.resolve(e);return i?t.names.has(e)&&!t.superseded.has(i.cid)?i.cid:t.tipOf(i.cid):null},wt=e=>{let i=Ee(e);if(!i&&n.strict)throw new Error(`UNMAPPED_REF: '${e}' resolves to nothing on this graph`);return i?w[e]?q[e]??je(i):t.names.has(e)?e:je(i):null};Q&&Me();for(let e of l.tests??[]){for(let a of e.reuses??[])Se.has(a)&&k.push({code:"REUSES_EVICTED",detail:`${e.temp_ref}: reuses '${a}' which was budget-evicted \u2014 drop the edge; the dependent gap names the missing @import`});{let a=c=>c==="emulator"||c==="simulator"?c:"web",d=c=>{let v=(l.tests??[]).find(z=>z.temp_ref===c);if(v)return a(v.target);let h=t.resolve(c),b=h?t.getNode(t.tipOf(h.cid)??h.cid)?.content:void 0;if(typeof b?.target=="string")return a(String(b.target));let I=/^\s*\[mobile:\s*(emulator|simulator)\]/m.exec(String(b?.test_md_blob??""));return I?I[1]:"web"};for(let c of e.reuses??[]){let v=a(e.target),h=d(c);v!==h&&k.push({code:"REUSES_CROSS_SURFACE",detail:`${e.temp_ref}: reuses '${c}' which runs on ${h} while this test runs on ${v} \u2014 a test imports only same-surface units`})}}let i=e.test_md_blob,s=e.definitionId,u=e.objectives_blob;if(n.finalizeTestBody){let a;try{a=n.finalizeTestBody({temp_ref:e.temp_ref,test_md_blob:e.test_md_blob,verifies:e.verifies,reuses:e.reuses??[]},wt)}catch(d){return Y([{code:"FINALIZE_BODY",detail:`${e.temp_ref}: ${d instanceof Error?d.message:String(d)}`}])}a&&(i=a.test_md_blob,s=a.definitionId,u=a.objectives_blob??u,he[e.temp_ref]=s)}let p={title:e.title,check:e.check,definitionId:s,derived:!0,...e.config?{config:e.config}:{},...i?{test_md_blob:i}:{},...u?{objectives_blob:u}:{},...e.surface_required!==void 0?{surface_required:e.surface_required}:{},...e.target?{target:e.target}:{},...e.app&&e.target?{app:e.app}:{}},m=de(_.TEST,e.temp_ref,p,e.title);if(!m)continue;ge(m,e.cites,e.temp_ref,!0,M);let x=j(e.automates,`${e.temp_ref}.automates`,_.SCENARIO);x&&(C.automates[e.temp_ref]=x,B(g.AUTOMATES,m,x,{},`${e.temp_ref}.automates`)),C.verifies[e.temp_ref]=[];for(let a of e.verifies){let d=j(a,`${e.temp_ref}.verifies`,_.AC);d&&(C.verifies[e.temp_ref].push(d),B(g.VERIFIES,m,d,{},`${e.temp_ref}.verifies`))}C.reuses[e.temp_ref]=[];for(let a of e.reuses??[]){if(Se.has(a))continue;let d=j(a,`${e.temp_ref}.reuses`,_.TEST);d&&(C.reuses[e.temp_ref].push(d),B(g.REUSES,m,d,{},`${e.temp_ref}.reuses`))}for(let a of e.verifies){let d=Ee(a)??void 0;d&&(t.trust.get(d)??"derived")==="derived"&&!P.some(c=>c.cid===d)?(L.push(`${e.temp_ref}: verifies ${a} which is still DERIVED (unapproved) \u2014 committed anyway; approve it in chat or via review`),Z.push({test:e.temp_ref,criterion:d})):d&&w[a]===d&&(l.acs??[]).some(c=>c.temp_ref===a)&&(L.push(`${e.temp_ref}: verifies ${a} minted in this same record (unapproved) \u2014 committed anyway; approve it in chat`),Z.push({test:e.temp_ref,criterion:d}))}if(!String(e.test_md_blob??"").split(`
|
|
3
3
|
`).some(a=>/^##\s/.test(a)&&!/—\s?assert/.test(a)&&Pt.test(a))&&e.verifies.length>1){let a=e.check?.verified_against;L.push(`${e.temp_ref}: verifies ${e.verifies.length} ACs but machine-asserts only 1 (check.verified_against=${a!=null?String(a):"?"}) \u2014 the rest ride prose only`)}}let se=[];for(let e of l.tests??[]){let i={};for(let s of Gt(e.test_md_blob,e.objectives_blob)){let u=Ee(s);u?i[s]=u:se.push(`${e.temp_ref}: body tag '${s}' resolves to nothing`)}C.body_tags[e.temp_ref]=i,se.push(...Mt(e.temp_ref,i,[...C.verifies[e.temp_ref]??[],...C.reuses[e.temp_ref]??[]]))}if(se.length>0){if(n.strict)return Y(se.map(e=>({code:"BODY_EDGE_MISMATCH",detail:e})));L.push(...se.map(e=>`integrity: ${e}`))}let ee=[];{let e=(a,d)=>`${a??""}\0${J(String(d??""))}`,i=(a,d)=>n.reason?`${n.reason} \u2014 evolve by ${f.id}${d?` (${d})`:""}`:a,s=a=>t.edgesFrom(a).some(d=>d.type!==g.SCOPED_TO?!1:d.dst===R||t.tipOf(d.dst)===R?!0:t.nodeLabel.get(d.dst)===_.SCENARIO&&t.edgesFrom(d.dst).some(c=>c.type===g.BELONGS_TO&&t.tipOf(c.dst)===R)),u=new Map;for(let{cid:a,content:d}of t.byLabel(_.AC)){if(t.superseded.has(a)||!s(a))continue;let c=J(String(d.text??""));u.set(c,[...u.get(c)??[],a])}let p=new Map;for(let a of P){if(a.label!==_.AC)continue;let d=J(String(a.content.text??""));p.set(d,[...p.get(d)??[],a.cid])}let m=[];for(let[a,d]of u){let c=p.get(a)??[];d.length!==1||c.length!==1||m.push([d[0],c[0]])}if(ae){let a=new Map(m),d=[...U].filter(o=>!V.has(o)),c=new Map,v=new Set,h=(o,r,S)=>{c.set(o,{cid:r,tag:S}),v.add(r)},b=(o,r)=>{let S=new Map;for(let A of o){let oe=r(A);oe&&S.set(oe,[...S.get(oe)??[],A])}return S},I=(o,r,S)=>{let A=0;for(let[oe,Je]of o){let Qe=r.get(oe)??[];Je.length===1&&Qe.length===1&&(h(Je[0],Qe[0],S),A+=1)}return A},z=new Map,$e=new Set;for(let[o,r]of Oe){let S=w[o];!U.has(r)||V.has(r)||!S||!P.some(A=>A.cid===S)||($e.add(S),z.set(r,[...z.get(r)??[],S]))}let $=new Set,It=o=>J(String(P.find(r=>r.cid===o)?.content.title??""));for(let[o,r]of z){if(r.length===1){h(o,r[0],"reuse_of successor"),D.reuseOf.honored+=1;continue}$.add(o);let S=r.filter(A=>It(A)===J(String(t.getNode(o)?.content.title??"")));S.length===1&&(h(o,S[0],"title-matched successor"),D.byTitle+=1)}let ke=o=>d.filter(r=>t.nodeLabel.get(r)===o&&!c.has(r)&&!$.has(r)),ve=o=>P.filter(r=>r.label===o&&!v.has(r.cid)&&!$e.has(r.cid)).map(r=>r.cid),ze=o=>[...new Set(o.map(r=>a.get(t.tipOf(r))??t.tipOf(r)))].sort().join(`
|
|
4
4
|
`),At=o=>t.edgesFrom(o).filter(r=>r.type===g.EXERCISES&&!t.superseded.has(r.ecid)).map(r=>r.dst),Nt=o=>M.filter(r=>r.type===g.EXERCISES&&r.src===o).map(r=>r.dst);D.byCriteria+=I(b(ke(_.SCENARIO),o=>ze(At(o))),b(ve(_.SCENARIO),o=>ze(Nt(o))),"same-criteria successor");let He=(o,r)=>e(t.nodeLabel.get(o)??P.find(S=>S.cid===o)?.label,(r??t.getNode(o)?.content)?.title),Re=new Map(P.map(o=>[o.cid,o.content])),Ke=o=>I(b(ke(o),r=>He(r)),b(ve(o),r=>He(r,Re.get(r))),"title-matched successor");D.byTitle+=Ke(_.SCENARIO);let Dt=o=>{let r=t.edgesFrom(o).find(A=>A.type===g.AUTOMATES&&!t.superseded.has(A.ecid));if(!r)return"";let S=t.tipOf(r.dst);return c.get(r.dst)?.cid??c.get(S)?.cid??S};D.byPair+=I(b(ke(_.TEST),Dt),b(ve(_.TEST),o=>M.find(r=>r.type===g.AUTOMATES&&r.src===o)?.dst??""),"paired test successor"),D.byTitle+=Ke(_.TEST);let Ce=new Set(d),ue=o=>{let r=c.get(o)?.cid??c.get(t.tipOf(o))?.cid??t.tipOf(o);return t.superseded.has(r)&&!Re.has(r)||Ce.has(r)&&!c.has(r)?null:r},we=new Set;for(let o of M)o.type===g.AUTOMATES&&Re.has(o.src)&&we.add(ue(o.dst)??o.dst);for(let{cid:o}of t.byLabel(_.TEST))if(!(t.superseded.has(o)||Ce.has(o)))for(let r of t.edgesFrom(o))r.type===g.AUTOMATES&&!t.superseded.has(r.ecid)&&we.add(ue(r.dst)??r.dst);let xt=!l.tests?.length&&te.some(o=>W.has(String(o.kind))),We=new Set,Xe=o=>{if(typeof o!="string"||!o)return;let r=w[o]??t.resolve(o)?.cid,S=r?ue(r):null;S!==null&&We.add(S)};for(let o of te)W.has(String(o.kind))&&Xe(o.ref);for(let{cid:o,content:r}of t.byLabel(_.GAP))t.superseded.has(o)||Ce.has(o)||t.trust.get(o)==="archived"||W.has(String(r.kind??""))&&Xe(r.ref);let ie=new Map,Ye=new Set;for(let o of xt?[]:d){if(t.nodeLabel.get(o)!==_.TEST||c.has(o))continue;let r=t.edgesFrom(o).find(A=>A.type===g.AUTOMATES&&!t.superseded.has(A.ecid)),S=r?ue(r.dst):null;!r||S===null||we.has(S)||Ye.has(S)||We.has(S)||(ie.set(o,{edge:r,scenario:S}),Ye.add(S))}for(let o of d){if(ie.has(o))continue;let r=c.get(o);r?(N.push({kind:"node",old:o,new:r.cid,reason:i(`--force redesign of ${n.ucRef} by ${f.id} (${r.tag})`,r.tag),by:f}),ee.push({old:o,next:r.cid})):N.push({kind:"node",old:o,new:null,reason:i(`--force redesign of ${n.ucRef} by ${f.id}`),by:f}),H.push(o)}for(let[o,{edge:r,scenario:S}]of ie)r.dst===S||ee.some(A=>A.old===r.dst)||(N.push({kind:"edge",ecid:r.ecid,reason:`re-blessed onto ${S} (its test kept by the redesign of ${n.ucRef}) by ${f.id}`,by:f}),B(g.AUTOMATES,o,S,r.props,`keep ${t.nameOf.get(o)??o}`));ie.size>0&&(D.keptTests=ie.size)}else{let a=new Map;for(let c of P){if(c.label!==_.SCENARIO&&c.label!==_.TEST)continue;let v=e(c.label,c.content.title);a.set(v,[...a.get(v)??[],c.cid])}let d=new Map;for(let c of U){if(V.has(c))continue;let v=e(t.nodeLabel.get(c),t.getNode(c)?.content.title);d.set(v,[...d.get(v)??[],c])}for(let[c,v]of d){let h=a.get(c)??[],b=v.length===1&&h.length===1;for(let I of v)b?(N.push({kind:"node",old:I,new:h[0],reason:i(`--force redesign of ${n.ucRef} by ${f.id} (title-matched successor)`,"title-matched successor"),by:f}),ee.push({old:I,next:h[0]})):N.push({kind:"node",old:I,new:null,reason:i(`--force redesign of ${n.ucRef} by ${f.id}`),by:f}),H.push(I)}}for(let[a,d]of m)N.push({kind:"node",old:a,new:d,reason:i(`AC re-emitted with changed content by ${f.id} (text-matched successor)`,"AC text-matched successor"),by:f}),ee.push({old:a,next:d}),H.push(a);if(n.force||n.forceScope){let a=new Set(H),d=new Map(ee.map(b=>[b.old,b.next])),c=new Set(P.map(b=>b.cid)),v=b=>{if(c.has(b))return!0;let I=d.get(b)??t.tipOf(b);return c.has(I)||!t.superseded.has(I)&&!a.has(I)},h=new Set(N.flatMap(b=>b.kind==="edge"?[b.ecid]:[]));for(let{cid:b}of t.byLabel(_.AC)){if(t.superseded.has(b)||a.has(b)||!s(b))continue;let I=t.edgesFrom(b).filter($=>$.type===g.SCOPED_TO&&!t.superseded.has($.ecid)&&!h.has($.ecid)).map($=>$.dst);if(I.length===0||I.some(v))continue;let z=I.map($=>t.nameOf.get($)??t.nameOf.get(t.tipOf($))??$).join(", ");if([...t.edgesInto(b).filter($=>($.type===g.EXERCISES||$.type===g.VERIFIES)&&!t.superseded.has($.ecid)&&!h.has($.ecid)).map($=>$.src),...M.filter($=>($.type===g.EXERCISES||$.type===g.VERIFIES)&&$.dst===b).map($=>$.src)].some($=>v($))){L.push(`ORPHANED_CRITERION: ${X(t.nameOf.get(b)??b)} is scoped to ${z}, which is retired, and a live scenario or test still rests on it \u2014 kept; re-scope it (scoped_to_repoints) to the scenario or use case it belongs to`);continue}N.push({kind:"node",old:b,new:null,reason:i(`orphaned: its scenario ${z} was retired; retired with it by the redesign of ${n.ucRef} (${f.id})`,"orphaned criterion"),by:f}),H.push(b)}}let x=new Set(H),G=new Set;for(let a of N)a.kind==="edge"&&G.add(a.ecid);for(let{old:a,next:d}of ee)for(let c of t.edgesInto(a))et(c.type)?.pin?.comparesTo!=="dst_tip"||t.superseded.has(c.src)||x.has(c.src)||G.has(c.ecid)||(N.push({kind:"edge",ecid:c.ecid,reason:`re-blessed onto ${d} (redirect successor of ${a}) by ${f.id}`,by:f}),G.add(c.ecid),M.some(h=>h.type===c.type&&h.src===c.src&&h.dst===d)||t.edgesFrom(c.src).some(h=>h.type===c.type&&h.dst===d))||c.type===g.AUTOMATES&&ce.has(d)||B(c.type,c.src,d,c.props,`rebless ${c.type} from ${t.nameOf.get(c.src)??c.src}`)}let ne=vt();if(ne.length>0){let e=s=>[...M.filter(u=>u.dst===s),...t.edgesInto(s).filter(u=>!t.superseded.has(u.ecid))].some(u=>u.type===g.DERIVES&&ne.includes(String(u.props.source_id))),i=[...(l.scenarios??[]).map(s=>({label:"scenario",temp_ref:s.temp_ref,title:s.title})),...(l.tests??[]).map(s=>({label:"test",temp_ref:s.temp_ref,title:s.title}))];for(let s of i){let u=w[s.temp_ref];!u||e(u)||L.push(`CITE_MISSING: ${s.label} ${X(q[s.temp_ref]??t.nameOf.get(u)??s.temp_ref)} "${s.title}" cites nothing of ${ne.join(", ")}, whose plugin asks each scenario and test to cite what it rests on \u2014 committed anyway; cite its screens and flows so a change to them marks exactly this ${s.label} stale`)}}if(ne.length>0)for(let e of n.droppedCriterionCites??[]){let i=w[e.temp_ref],s=X(q[e.temp_ref]??(i?t.nameOf.get(i):void 0)??e.temp_ref);L.push(`CITE_DROPPED: criterion ${s} \u2014 a cite was dropped: ${e.why}; the criterion is committed without it. A criterion cites only into ${ne.join(", ")}, whose plugin asks each item to cite what it rests on`)}if(k.length>0)return Y(k);let qe=ae&&(D.reuseOf.seen>0||D.byPair+D.byCriteria+D.byTitle+(D.keptTests??0)>0)?{lineage:D}:{},Ve=fe.length?{modelWarnings:fe}:{};if(P.length===0&&M.length===0&&N.length===0&&re.length===0)return Object.keys(w).length>0||Be>0?(L.push("everything in this phase is already current \u2014 nothing re-committed"),{record:null,errors:null,minted:w,logicalIds:q,superseded:[],warnings:L,finalizedTests:he,unchanged:!0,...K.length?{droppedBlockers:K}:{},...Z.length?{awaitingApproval:Z}:{},...qe,...Ve,...n.force||n.forceScope?{forceScopeRemaining:Fe}:{}}):{...Y([{code:"EMPTY_DESIGN",detail:"finalize_design produced nothing to commit"}]),warnings:L,...K.length?{droppedBlockers:K}:{}};if(n.generationTicket){let e=ht(t,n.generationTicket);if(e!==null)return Y([e])}let Te=n.eventIds&&n.eventIds.length>0?n.eventIds:n.sid?pt(t,n.sid,"design",1):null;return{record:at(E,{ts:new Date().toISOString(),proposal_id:null,nodes:P,edges:M,review:[],supersessions:N,source_head_moves:{},...me.length>0?{names:me}:{},...(()=>{for(let e of l.judgements??[]){let i=e.target?w[e.target]??t.resolve(e.target)?.tip??R:R;C.judgements.push(i),re.push({about:i,rationale:`[${e.kind}] ${e.rationale}`,by:f})}return re.length>0?{judgements:re}:{}})(),design_of:{uc_cid:R,engine:y},...n.generationTicket?{design_generation:_t(n.generationTicket,R,f)}:{},...Te?{event_ids:Te}:{},...n.sid?{sid:n.sid}:{},...n.phase?{design_phase:{uc_root:gt(t,t.resolve(n.ucRef)?.cid??R),generation:n.generationTicket?.next_gen??mt(t,n.ucRef)?.gen??1,phase:n.phase,completeness:n.phaseCompleteness??"complete",...n.payloadDigest?{payload_digest:n.payloadDigest}:{}}}:{}},{graph:t,scope:{ucTargets:[{ref:R}],...n.generationTicket?{generationTicket:{uc_root:n.generationTicket.uc_root,next_gen:n.generationTicket.next_gen}}:{}},expectPrev:t.latestHash,intent:{v:1,verb:"design",args:ot({ucRef:n.ucRef,sections:l,by:f,engine:y,force:n.force??!1,forceScope:n.forceScope??null,reason:n.reason??null,generationTicket:n.generationTicket??null,templateVersion:n.templateVersion??null,phase:n.phase??null,phaseCompleteness:n.phaseCompleteness??null,eventIds:Te,sid:n.sid??null,...ae?{lineage:2}:{}}),pins:Object.keys(ye).length?{...C,reuse_of:ye}:C},provenance:n.provenance}).record,errors:null,minted:w,logicalIds:q,superseded:H,warnings:L,finalizedTests:he,...K.length?{droppedBlockers:K}:{},...Z.length?{awaitingApproval:Z}:{},...n.force||n.forceScope?{forceScopeRemaining:Fe}:{},...qe,...Ve}}function Mt(n,E,t){let l=new Set(Object.values(E));if(l.size===0)return[];let f=new Set(t),y=[];for(let[O,T]of Object.entries(E))f.has(T)||y.push(`${n}: body tag '${O}' has no verifies or reuses edge`);for(let O of f)l.has(O)||y.push(`${n}: edge to ${O} has no body tag`);return y}function Gt(n,E){let t=[];for(let f of(n??"").split(`
|
|
5
5
|
`)){let y=/^##\s.*?\s@verifies\s+(.+?)\s*$/.exec(f);y&&t.push(...y[1].split(",").map(T=>T.trim()).filter(Boolean));let O=/^@import\s+(\S+)\s*$/.exec(f.trim())??/^## Import: (\S+)\s*$/.exec(f);O&&t.push(O[1])}let l=null;for(let f of(E??"").split(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{g as o,h as a}from"./chunk-
|
|
2
|
+
import{g as o,h as a}from"./chunk-UWQ4KXLB.js";import{mkdirSync as p,writeFileSync as f,chmodSync as d,existsSync as m}from"fs";var y={darwin:"https://downloads.lambdatest.com/hyperexecute/darwin/hyperexecute",linux:"https://downloads.lambdatest.com/hyperexecute/linux/hyperexecute",win32:"https://downloads.lambdatest.com/hyperexecute/windows/hyperexecute.exe"};function h(s){let t=y[s];if(!t)throw new Error(`unsupported platform for hyperexecute: ${s}`);return t}async function g(s,t={}){let i=t.platform??process.platform,u=t.existsImpl??m,c=t.fetchImpl??(r=>fetch(r)),e=a(s);if(u(e))return{status:"present",path:e};try{let r=h(i),n=await c(r);if(!n.ok)return{status:"failed",path:e,error:`download failed: HTTP ${n.status}`};let l=Buffer.from(await n.arrayBuffer());return p(o(s),{recursive:!0}),f(e,l),d(e,493),{status:"downloaded",path:e}}catch(r){return{status:"failed",path:e,error:r instanceof Error?r.message:String(r)}}}export{h as a,g as b};
|