@testmuai/kane-cli 0.7.1 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ChatSurface-U37VZDCW.js +8 -0
- package/dist/{ChromeProfilePicker-4CDSPBWL.js → ChromeProfilePicker-AUU7JF6F.js} +1 -1
- package/dist/{CliFeedbackPrompt-TLRVBA4E.js → CliFeedbackPrompt-4W74Y3UF.js} +1 -1
- package/dist/{CliUploadProgress-WGGFLUSF.js → CliUploadProgress-6HL7WTEX.js} +1 -1
- package/dist/ConfigView-6BSCZP5Y.js +2 -0
- package/dist/EvidenceViewOffer-62XHEEGW.js +2 -0
- package/dist/FolderPicker-S7U2EN2M.js +2 -0
- package/dist/{HelpView-FBCX32U7.js → HelpView-TU7ED43J.js} +1 -1
- package/dist/{InfoBox-KK2ICVS4.js → InfoBox-JLTMKVDE.js} +1 -1
- package/dist/{LinksBox-KKRANMR3.js → LinksBox-LREUUJDV.js} +1 -1
- package/dist/{ProfilesView-DGPXSAQN.js → ProfilesView-W3GX2N2E.js} +1 -1
- package/dist/{ProjectPicker-ESQSL4TT.js → ProjectPicker-SYQUJK2J.js} +1 -1
- package/dist/{SaveSessionPrompt-AQGP5W6E.js → SaveSessionPrompt-MR5NJMRP.js} +1 -1
- package/dist/SingleShotApp-XOKVOM7C.js +2 -0
- package/dist/{SummaryBox-BFZJW2KK.js → SummaryBox-UAYSVFB7.js} +1 -1
- package/dist/TestMdRunView-7UVSDAF4.js +2 -0
- package/dist/{WhoamiView-JABY3I5Q.js → WhoamiView-2YU76ASQ.js} +1 -1
- package/dist/adbkit-apkreader-ORZBGCJQ.js +184 -0
- package/dist/app-client-OEXESV4U.js +2 -0
- package/dist/app-download-AEEFQ63M.js +2 -0
- package/dist/{auth-76LVI6B5.js → auth-HET3TBRI.js} +1 -1
- package/dist/bind-STKXOUYI.js +12 -0
- package/dist/bootstrap-44YKVWWE.js +2 -0
- package/dist/bridge-5Z3BIB77.js +2 -0
- package/dist/{changelog-PSWPPOAF.js → changelog-7OWRHFHZ.js} +1 -1
- package/dist/chat-committer-ZWWCLJFD.js +2 -0
- package/dist/chat-controller-T2FAI55V.js +2 -0
- package/dist/{chunk-C4G7RVJ6.js → chunk-27U4PLPX.js} +1 -1
- package/dist/{chunk-V36ATG7A.js → chunk-2BGUUWNF.js} +2 -2
- package/dist/chunk-2KDGIZED.js +4 -0
- package/dist/chunk-2UIHS2FH.js +2 -0
- package/dist/chunk-2YEHV2CX.js +2 -0
- package/dist/{chunk-NRTHYROA.js → chunk-3LJWYRAA.js} +1 -1
- package/dist/chunk-3PECJD6S.js +11 -0
- package/dist/chunk-3POR47RC.js +8 -0
- package/dist/{chunk-KVQOBPAZ.js → chunk-3Q6WAK6P.js} +1 -1
- package/dist/chunk-4JOD47QI.js +2 -0
- package/dist/chunk-56PAQAX5.js +19 -0
- package/dist/{chunk-FCMLIK7P.js → chunk-5DBK6QNS.js} +1 -1
- package/dist/chunk-5DT7PIGB.js +5 -0
- package/dist/chunk-65ZTD5SJ.js +7 -0
- package/dist/chunk-6IA6QMPH.js +2 -0
- package/dist/{chunk-5KFS3GAZ.js → chunk-6KPPGMO2.js} +1 -1
- package/dist/{chunk-F6ZOJXYU.js → chunk-6O3DDOP2.js} +1 -1
- package/dist/chunk-6XX4LEVJ.js +2 -0
- package/dist/{chunk-KT6G7AF2.js → chunk-766WGMBU.js} +1 -1
- package/dist/chunk-7BZSCUPP.js +10 -0
- package/dist/{chunk-UBFKZEX3.js → chunk-7JWKHKFU.js} +2 -2
- package/dist/{chunk-PMHJRT3A.js → chunk-7KORP5FF.js} +1 -1
- package/dist/chunk-7Q6M6P4X.js +26 -0
- package/dist/{chunk-AM5S4KG4.js → chunk-AFPHLUQ5.js} +1 -1
- package/dist/chunk-AW2XUHH4.js +2 -0
- package/dist/chunk-BKHXPBWN.js +2 -0
- package/dist/chunk-BRHNRCEZ.js +3 -0
- package/dist/chunk-BRIEBB2U.js +2 -0
- package/dist/{chunk-NJPTOKW5.js → chunk-C7HSWZP6.js} +1 -1
- package/dist/{chunk-JEUA4UWK.js → chunk-CLGC7VEO.js} +1 -1
- package/dist/chunk-CTW2VQKS.js +6 -0
- package/dist/{chunk-L4JIMNKW.js → chunk-CUM23TLF.js} +1 -1
- package/dist/chunk-DBIBROYW.js +5 -0
- package/dist/{chunk-L7VREJTG.js → chunk-DCY6R5DP.js} +1 -1
- package/dist/{chunk-X3ICV5M5.js → chunk-DO5HAO3H.js} +1 -1
- package/dist/chunk-DPUV6OSP.js +2 -0
- package/dist/{chunk-M7WQM4UA.js → chunk-DUAXZYAD.js} +1 -1
- package/dist/{chunk-HPMS5KO6.js → chunk-DZGCXKKI.js} +3 -3
- package/dist/chunk-EDSZJZFG.js +4 -0
- package/dist/{chunk-OIYGGEUL.js → chunk-ELM6MXGJ.js} +1 -1
- package/dist/{chunk-R2RGSO4B.js → chunk-EWCAFKLX.js} +1 -1
- package/dist/chunk-EYOCNMUM.js +2 -0
- package/dist/{chunk-73C4PRYU.js → chunk-FEJXWJ3L.js} +1 -1
- package/dist/{chunk-BAL64WSI.js → chunk-FMRSMN34.js} +1 -1
- package/dist/chunk-FNH55WSR.js +19 -0
- package/dist/chunk-FQLIW3LM.js +2 -0
- package/dist/{chunk-JRMDGLLT.js → chunk-G7VQCS4J.js} +1 -1
- package/dist/chunk-GCBKDX2J.js +2 -0
- package/dist/{chunk-AAONIIQV.js → chunk-GFKCTYCA.js} +1 -1
- package/dist/chunk-GKYPNSQP.js +26 -0
- package/dist/chunk-GPG3FIN3.js +21 -0
- package/dist/chunk-GZPK6FRP.js +7 -0
- package/dist/{chunk-NOCIMJSN.js → chunk-HCKH44I2.js} +1 -1
- package/dist/chunk-HEAIJCGZ.js +2 -0
- package/dist/{chunk-3FN5VJMV.js → chunk-HMYMSRA4.js} +1 -1
- package/dist/chunk-I7TIGB7K.js +2 -0
- package/dist/chunk-IDX3TOPY.js +6 -0
- package/dist/{chunk-CVOGP253.js → chunk-IMR64OCZ.js} +1 -1
- package/dist/{chunk-IBNC444G.js → chunk-IOD3HQVW.js} +1 -1
- package/dist/chunk-IOFZSQAA.js +2 -0
- package/dist/chunk-IP2O264K.js +3 -0
- package/dist/{chunk-CSQ46PJ7.js → chunk-JJHG3BWO.js} +1 -1
- package/dist/{chunk-5JTUL6XL.js → chunk-JZ26R6UL.js} +1 -1
- package/dist/chunk-KBM3XHAM.js +2 -0
- package/dist/{chunk-SY3HLQMV.js → chunk-KCCSWEGA.js} +1 -1
- package/dist/chunk-KFSUPQAG.js +66 -0
- package/dist/chunk-KRKGZ2ZW.js +47 -0
- package/dist/chunk-KU6IXFGZ.js +9 -0
- package/dist/chunk-L7MXYCD7.js +2 -0
- package/dist/chunk-MA34UWKX.js +4 -0
- package/dist/chunk-MBF3FP5P.js +5 -0
- package/dist/chunk-MSGW4JDG.js +2 -0
- package/dist/chunk-MXHHMIO2.js +349 -0
- package/dist/chunk-N2P4MI32.js +2 -0
- package/dist/{chunk-CDQX6HGJ.js → chunk-NX7TM662.js} +1 -1
- package/dist/chunk-OMQCD3KR.js +2 -0
- package/dist/{chunk-QROUKGKU.js → chunk-OS4VSIHT.js} +1 -1
- package/dist/chunk-OTTGS2TE.js +2 -0
- package/dist/chunk-QGKPLOUI.js +2 -0
- package/dist/{chunk-JKTFTF24.js → chunk-QRZRSAZH.js} +1 -1
- package/dist/{chunk-WJ5HDEVH.js → chunk-QSDH5P7C.js} +1 -1
- package/dist/{chunk-322JEJEH.js → chunk-QW6EZC53.js} +1 -1
- package/dist/{chunk-2XMJ6YAE.js → chunk-R5T4RLF5.js} +1 -1
- package/dist/chunk-R7QAS6LZ.js +4 -0
- package/dist/{chunk-LR5XO2KD.js → chunk-RC52N7PC.js} +1 -1
- package/dist/{chunk-33QXD75Y.js → chunk-RFR4ZKIC.js} +3 -3
- package/dist/{chunk-3LWTUMDG.js → chunk-RLRNLIRS.js} +1 -1
- package/dist/{chunk-XDHZMCTA.js → chunk-SDPRO2LE.js} +2 -2
- package/dist/chunk-T5Y6MOLM.js +4 -0
- package/dist/{chunk-4OPQJ7PE.js → chunk-TFPPEOAK.js} +1 -1
- package/dist/chunk-TH47OOBV.js +4 -0
- package/dist/{chunk-XVDJ423L.js → chunk-TKGUT425.js} +1 -1
- package/dist/{chunk-OHRS3H7Z.js → chunk-TRJUD3XJ.js} +1 -1
- package/dist/chunk-TYLYFERW.js +10 -0
- package/dist/chunk-TZXXJWHA.js +2 -0
- package/dist/chunk-UD7KKHPW.js +5 -0
- package/dist/{chunk-APAIWBIH.js → chunk-UDIQOJEL.js} +1 -1
- package/dist/chunk-UV462FZR.js +2 -0
- package/dist/{chunk-323MLBYA.js → chunk-UXDL4XDL.js} +1 -1
- package/dist/chunk-V2R3LCA3.js +12 -0
- package/dist/chunk-VAYBKR76.js +4 -0
- package/dist/{chunk-AH7ZZIZY.js → chunk-VRVFPMCR.js} +1 -1
- package/dist/chunk-W2JFDDIB.js +2 -0
- package/dist/chunk-W4B5LOEX.js +4 -0
- package/dist/{chunk-36OC3TFE.js → chunk-W5TTF7GB.js} +2 -2
- package/dist/chunk-WXHQYYD5.js +2 -0
- package/dist/{chunk-6HEGD6H2.js → chunk-XO5ZH3ZR.js} +1 -1
- package/dist/chunk-XWKUZJCP.js +2 -0
- package/dist/{chunk-2KBD6JZX.js → chunk-YFYCCTSL.js} +1 -1
- package/dist/{chunk-ZM5PVRJK.js → chunk-YJELGSKJ.js} +1 -1
- package/dist/chunk-YRFMPIU2.js +4 -0
- package/dist/{chunk-2XGDWUJ5.js → chunk-ZGBSGZZM.js} +1 -1
- package/dist/{chunk-NBKQT7LJ.js → chunk-ZIUAOEUC.js} +1 -1
- package/dist/chunk-ZMNJBUAO.js +2 -0
- package/dist/chunk-ZVHCQMJ6.js +13 -0
- package/dist/committer-SWEWEYNX.js +2 -0
- package/dist/{config-R3GF2FZA.js → config-RS47F5SC.js} +1 -1
- package/dist/{controller-client-RD2YEMAH.js → controller-client-OB4WD2C4.js} +1 -1
- package/dist/{cover-cmd-TXICWHUU.js → cover-cmd-HDZZWJXG.js} +1 -1
- package/dist/{credentials-XN4ROCQ3.js → credentials-OH6AVI6N.js} +1 -1
- package/dist/deps-resolve-XC5S53DG.js +2 -0
- package/dist/descriptor-OEUZZCOK.js +2 -0
- package/dist/design-committer-VYT6NU3T.js +2 -0
- package/dist/dispatch-SE5GY3Z2.js +2 -0
- package/dist/doctor-FSECFZUU.js +2 -0
- package/dist/docx-convert-JMUMT5C4.js +2 -0
- package/dist/{dossier-QZV74XOS.js → dossier-KTLTGT2X.js} +1 -1
- package/dist/evidence-OYPHZUKI.js +2 -0
- package/dist/evolve-cmd-BCPNXAMV.js +2 -0
- package/dist/exec-P2IKJRRR.js +2 -0
- package/dist/exit-manager-3FVBTNYR.js +2 -0
- package/dist/explain-UAAQWHYR.js +2 -0
- package/dist/{explain-cmd-X7JZLSZZ.js → explain-cmd-3GEKR7O5.js} +1 -1
- package/dist/{explain-cmd-RZW6QJYM.js → explain-cmd-EX24XKD6.js} +1 -1
- package/dist/extract-bind-LLEASZAK.js +10 -0
- package/dist/extract-cmd-UZMEZMGP.js +5 -0
- package/dist/feeder-C3TOJPKK.js +2 -0
- package/dist/{gaps-cmd-BWCRLLBK.js → gaps-cmd-IVXFPFAQ.js} +1 -1
- package/dist/{gate-YHBPWEM5.js → gate-54BRAE7N.js} +1 -1
- package/dist/{generate-headless-BSTDLZZY.js → generate-headless-D3SVQ2AI.js} +3 -3
- package/dist/{headless-io-BL3TEAX5.js → headless-io-66RG5NN5.js} +1 -1
- package/dist/host-7GZPBA74.js +2 -0
- package/dist/identity-ADZ4PAJF.js +2 -0
- package/dist/index.js +85 -69
- package/dist/ingest-EX72IEQT.js +2 -0
- package/dist/ingest-cmd-EAE7N5RC.js +2 -0
- package/dist/{interactive-bind-43HGDF5K.js → interactive-bind-ORMN2REX.js} +7 -6
- package/dist/{lifecycle-cmd-D6TVTYRK.js → lifecycle-cmd-O2324GN6.js} +1 -1
- package/dist/{list-cmd-XCAV2FKA.js → list-cmd-N4KMA34H.js} +1 -1
- package/dist/list-commands-MRXL5HGS.js +2 -0
- package/dist/locks-cmd-CSVSWY2Y.js +2 -0
- package/dist/logical-ids-TEBCQJGO.js +2 -0
- package/dist/login-flow-QJQM3RHT.js +2 -0
- package/dist/maintenance-cmd-6XSVO6FO.js +2 -0
- package/dist/mobile-prompts-TOX35ER6.js +2 -0
- package/dist/pdf-convert-OZIRUADA.js +2 -0
- package/dist/persist-recorded-session-TLDQ5HKP.js +3 -0
- package/dist/phase-seed-VFHIH6FL.js +2 -0
- package/dist/pipeline-UOM4LNAI.js +2 -0
- package/dist/prepare-target-QYWIJIVQ.js +2 -0
- package/dist/readmodel-XOYGGQ3S.js +2 -0
- package/dist/reconcile-cmd-3H34KVVD.js +2 -0
- package/dist/reconcile-deps-XIH75ZLY.js +4 -0
- package/dist/reconcile-engine-UKWPG2LV.js +2 -0
- package/dist/{recording-banner-TALO7PUR.js → recording-banner-4M7XHVGI.js} +1 -1
- package/dist/records-IOZTZUZV.js +2 -0
- package/dist/registry-PYOTKZYZ.js +2 -0
- package/dist/{require-project-folder-R347LFDQ.js → require-project-folder-4UPQNEBJ.js} +1 -1
- package/dist/resolve-run-intent-X72V3KJA.js +7 -0
- package/dist/{resolver-IDCGRPFJ.js → resolver-UBOZLFFE.js} +1 -1
- package/dist/revert-NQ7GEVSE.js +2 -0
- package/dist/review-cmd-DQRKQUMG.js +4 -0
- package/dist/run-2COODVX2.js +2 -0
- package/dist/run-URPGHOQM.js +2 -0
- package/dist/run-channel-RGH4WIQX.js +2 -0
- package/dist/{run-test-md-DFNIGYB7.js → run-test-md-76ZPKXO6.js} +3 -3
- package/dist/session-target-UWROGOCY.js +2 -0
- package/dist/sessions-GIEXOCE4.js +2 -0
- package/dist/{sessions-cmd-AQWLL5ZN.js → sessions-cmd-ZZIZN2VB.js} +4 -4
- package/dist/{skill-installer-ANXTCXQV.js → skill-installer-CIS6GAYF.js} +1 -1
- package/dist/spawner-J67QR4QP.js +2 -0
- package/dist/structured-answers-5EY2AZN7.js +5 -0
- package/dist/tcg-generate-BDTRKY2A.js +2 -0
- package/dist/testmd-actions-77ELR5UU.js +2 -0
- package/dist/token-refresh-4BPAPXKK.js +2 -0
- package/dist/types-6E2HTDKJ.js +2 -0
- package/dist/{validate-basic-O2DP2XJL.js → validate-basic-2GVSQ2R5.js} +1 -1
- package/dist/verdicts-TRSTJLCL.js +2 -0
- package/dist/{version-check-RNR3JCQ5.js → version-check-O6PYTI4T.js} +1 -1
- package/dist/{view-cmd-YSEGA5PI.js → view-cmd-KPJTP4DI.js} +1 -1
- package/dist/walk-session-CHJXHZMO.js +2 -0
- package/dist/with-telemetry-CQCWLVOC.js +2 -0
- package/package.json +12 -6
- package/dist/ChatSurface-D66CACLX.js +0 -8
- package/dist/ConfigView-DBANTBXC.js +0 -2
- package/dist/EvidenceViewOffer-DNCQ3A6R.js +0 -2
- package/dist/FolderPicker-W7RCIFEL.js +0 -2
- package/dist/SingleShotApp-SMCAIKCE.js +0 -2
- package/dist/TestMdRunView-FMKZJ3A3.js +0 -2
- package/dist/bind-AACBTSAA.js +0 -12
- package/dist/bootstrap-CNOZ5VRB.js +0 -2
- package/dist/bridge-T4HL4TG7.js +0 -2
- package/dist/chat-committer-4BQBOKI4.js +0 -2
- package/dist/chat-controller-NNTMKEPG.js +0 -2
- package/dist/chunk-2SREGETM.js +0 -4
- package/dist/chunk-3STZLM5J.js +0 -4
- package/dist/chunk-5YPBPZUR.js +0 -2
- package/dist/chunk-6UJDOAYR.js +0 -26
- package/dist/chunk-BQHKBOSF.js +0 -11
- package/dist/chunk-DQ54MH7F.js +0 -13
- package/dist/chunk-DXV6MBTD.js +0 -8
- package/dist/chunk-EV3EHXEI.js +0 -4
- package/dist/chunk-F7WKDMX7.js +0 -47
- package/dist/chunk-FPFOW6BS.js +0 -2
- package/dist/chunk-GVIPTX6T.js +0 -6
- package/dist/chunk-GW5DWAXY.js +0 -2
- package/dist/chunk-HJERKSBK.js +0 -349
- package/dist/chunk-IQDWBTRJ.js +0 -3
- package/dist/chunk-IXVOXJP6.js +0 -6
- package/dist/chunk-KNDSQ4PS.js +0 -2
- package/dist/chunk-KRXSXQBU.js +0 -12
- package/dist/chunk-LQZ2BU7Q.js +0 -2
- package/dist/chunk-NAC7SFBE.js +0 -5
- package/dist/chunk-NAE7MBR2.js +0 -23
- package/dist/chunk-NRC2G4Y5.js +0 -5
- package/dist/chunk-O56PUUNL.js +0 -9
- package/dist/chunk-QM4S2APK.js +0 -2
- package/dist/chunk-RKWJG3WW.js +0 -19
- package/dist/chunk-RNSSM2BK.js +0 -11
- package/dist/chunk-SE6WNCYU.js +0 -4
- package/dist/chunk-SRDHPKJT.js +0 -2
- package/dist/chunk-SWESH2J7.js +0 -10
- package/dist/chunk-T63R6QT4.js +0 -4
- package/dist/chunk-UI7KULSI.js +0 -7
- package/dist/chunk-UPPEOQJQ.js +0 -3
- package/dist/chunk-URQUQWGW.js +0 -62
- package/dist/chunk-UX2B7L6K.js +0 -2
- package/dist/chunk-VOHQA2SP.js +0 -2
- package/dist/chunk-W5DOU2DV.js +0 -2
- package/dist/chunk-W6VD2XFO.js +0 -19
- package/dist/chunk-WAOCHXJ5.js +0 -2
- package/dist/chunk-WWNSD6FA.js +0 -6
- package/dist/chunk-ZLCZDAEX.js +0 -6
- package/dist/committer-2EJPVVCQ.js +0 -2
- package/dist/descriptor-KXDJ4XYD.js +0 -2
- package/dist/design-committer-BQUWD6AC.js +0 -2
- package/dist/docx-convert-ZBVQO2LG.js +0 -2
- package/dist/evidence-V23FPVXQ.js +0 -2
- package/dist/evolve-cmd-PZCPXDMR.js +0 -2
- package/dist/exit-manager-HNFATGSM.js +0 -2
- package/dist/explain-UE4IACQH.js +0 -2
- package/dist/extract-bind-BFY7IRL4.js +0 -10
- package/dist/extract-cmd-U3MGK2LP.js +0 -6
- package/dist/feeder-XGTFV7TZ.js +0 -2
- package/dist/ingest-AL6CABJT.js +0 -2
- package/dist/ingest-cmd-O6OWWZT4.js +0 -2
- package/dist/list-commands-747UTUSS.js +0 -2
- package/dist/locks-cmd-QAULI5LV.js +0 -2
- package/dist/logical-ids-4G4FAHNJ.js +0 -2
- package/dist/login-flow-CV76ENHV.js +0 -2
- package/dist/maintenance-cmd-ZRB4NTGG.js +0 -2
- package/dist/pdf-convert-S7VYE6AV.js +0 -2
- package/dist/persist-recorded-session-MDPWWUA7.js +0 -3
- package/dist/phase-seed-52LRE3LH.js +0 -2
- package/dist/pipeline-LM5JAK7F.js +0 -2
- package/dist/readmodel-X7L7W2BA.js +0 -2
- package/dist/reconcile-cmd-DGCSDML6.js +0 -2
- package/dist/records-5SVUXJBW.js +0 -2
- package/dist/revert-DXXYXJGN.js +0 -2
- package/dist/review-cmd-2QF5HTI7.js +0 -4
- package/dist/run-52UIBPXD.js +0 -2
- package/dist/run-VRVH4VO3.js +0 -2
- package/dist/sessions-BLXZVK5U.js +0 -2
- package/dist/spawner-AH5FTUYU.js +0 -2
- package/dist/structured-answers-QHFGZPSS.js +0 -5
- package/dist/tcg-generate-WKCBBKI5.js +0 -2
- package/dist/testmd-actions-RPYG6TJG.js +0 -2
- package/dist/token-refresh-NIDUOTRM.js +0 -2
- package/dist/verdicts-TJH3O5UW.js +0 -2
- package/dist/walk-session-HXW4OSA2.js +0 -2
- package/dist/with-telemetry-PNP6CAVM.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as T}from"./chunk-
|
|
2
|
+
import{b as T}from"./chunk-OS4VSIHT.js";import"./chunk-5DT7PIGB.js";import"./chunk-CH273NAE.js";import{A as V}from"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import{d as I}from"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import{d as f,e as x}from"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-UR6MHSHU.js";import{writeFileSync as ce,mkdirSync as pe}from"fs";import{tmpdir as ue}from"os";import{dirname as fe,join as ge}from"path";var F={DERIVES:"derivation",automates:"linkage",exercises:"mesh",verifies:"mesh",depends_on:"crosslink",reuses:"crosslink",belongs_to:"containment",scoped_to:"containment",annotates:"annotation"},re=(t,r)=>t===f.SOURCE?String(r.source_id??""):t===f.AC?String(r.text??""):t===f.STYLENOTE?String(r.statement??r.text??""):t===f.GAP?String(r.text??r.question??""):String(r.title??"");function H(t){let r=[];for(let[o,p]of t.nodeLabel){let g=t.getNode(o)?.content??{};r.push({cid:o,label:p,slug:p===f.SOURCE?String(g.source_id??""):t.displayNameOf?.(o)??t.nameOf.get(o)??o.slice(0,19),trust:t.trust.get(o)??"derived",fresh:t.stale(o),title:re(p,g),content:g,superseded:t.superseded.has(o)})}let e=new Map;for(let[o]of t.nodeLabel)for(let p of t.edgesFrom(o)){let g=`${p.type}|${p.src}|${p.dst}`,v=typeof p.props?.anchor=="string"?p.props.anchor:void 0,w=e.get(g);w?(w.count++,v&&w.anchors.push(v)):e.set(g,{key:g,type:p.type,family:F[p.type]??"mesh",src:p.src,dst:p.dst,count:1,anchors:v?[v]:[],container:F[p.type]==="containment"})}let s=[...e.values()],i={},l={trusted:0,derived:0,archived:0},d={fresh:0,stale:0,orphaned:0,superseded:0},a=0;for(let o of r)o.superseded||(a++,i[o.label]=(i[o.label]??0)+1,o.label!==f.SOURCE&&l[o.trust]++,d[o.fresh]++);return{nodes:r,edges:s,summary:{nodes:a,edges:s.reduce((o,p)=>o+p.count,0),byLabel:i,trust:l,fresh:d,usecases:i[f.USECASE]??0,designed:0}}}var P=/^([a-z]+)-(\d+)$/,E=(t,r)=>{let e=P.exec(t),s=P.exec(r);return e&&s&&e[1]===s[1]?Number(e[2])-Number(s[2]):t<r?-1:t>r?1:0};function se(t,r,e){let s=new Set,i=d=>{let a=e.nodeLabel.get(d);if(a===f.USECASE)s.add(d);else if(a===f.SCENARIO)for(let o of e.edgesFrom(d))o.type===x.BELONGS_TO&&s.add(o.dst)},l=e.edgesFrom(t);if(r===f.SCENARIO)for(let d of l)d.type===x.BELONGS_TO&&s.add(d.dst);if(r===f.AC)for(let d of l)d.type===x.SCOPED_TO&&i(d.dst);if(r===f.TEST)for(let d of l)d.type===x.AUTOMATES&&i(d.dst);return s}function G(t,r){let e=new Map,s=t.nodes.filter(a=>a.label===f.USECASE).map(a=>a.cid),i=s.map(a=>({ucCid:a,slug:r.nameOf.get(a)??a.slice(0,19),designed:r.designOf.has(a),nodeCids:[a]})).sort((a,o)=>E(a.slug,o.slug)),l={ucCid:"__shared__",slug:"cross-cutting",designed:!1,nodeCids:[]},d=new Map(i.map(a=>[a.ucCid,a]));for(let a of s)e.set(a,a);for(let a of t.nodes){if(a.label===f.SOURCE||a.label===f.USECASE)continue;let o=se(a.cid,a.label,r);if(o.size===1){let p=[...o][0];e.set(a.cid,p),d.get(p).nodeCids.push(a.cid)}else e.set(a.cid,"__shared__"),l.nodeCids.push(a.cid)}return{laneOf:e,lanes:[...i,l]}}var N={source:0,usecase:1,scenario:2,ac:3,test:4,stylenote:5,gap:5},ie=6,z=260,R=64,B=28;function U(t,r,e){let{lanes:s}=r,i=new Map(t.nodes.map(n=>[n.cid,n])),l=new Map,d=[],a=[],o=n=>{let m=n.map(h=>l.get(h)).filter(h=>h!==void 0);return m.length?m.reduce((h,S)=>h+S,0)/m.length:Number.MAX_SAFE_INTEGER},p=s.filter(n=>n.ucCid!=="__shared__"||n.nodeCids.length>0),g=t.nodes.filter(n=>n.label===f.SOURCE).sort((n,m)=>E(n.slug,m.slug)),v=0;for(let n of p){let m=n.nodeCids.map(c=>i.get(c)).filter(Boolean),h=c=>m.filter(u=>u.label===c),S=h(f.USECASE).sort((c,u)=>E(c.slug,u.slug));S.forEach((c,u)=>l.set(c.cid,u));let D=h(f.SCENARIO).sort((c,u)=>E(c.slug,u.slug));D.forEach((c,u)=>l.set(c.cid,u));let M=h(f.AC).sort((c,u)=>{let _=o(e.edgesInto(c.cid).filter(b=>b.type===x.EXERCISES).map(b=>b.src)),O=o(e.edgesInto(u.cid).filter(b=>b.type===x.EXERCISES).map(b=>b.src));return _-O||E(c.slug,u.slug)});M.forEach((c,u)=>l.set(c.cid,u));let j=h(f.TEST).sort((c,u)=>{let _=o(e.edgesFrom(c.cid).filter(b=>b.type===x.VERIFIES).map(b=>b.dst)),O=o(e.edgesFrom(u.cid).filter(b=>b.type===x.VERIFIES).map(b=>b.dst));return _-O||E(c.slug,u.slug)});j.forEach((c,u)=>l.set(c.cid,u));let q=m.filter(c=>N[c.label]===void 0||N[c.label]>=5).sort((c,u)=>E(c.slug,u.slug));q.forEach((c,u)=>l.set(c.cid,u));let A=Math.max(1,S.length,D.length,M.length,j.length,q.length)*R+B;for(let c of m){let u=N[c.label]??4,_=l.get(c.cid)??0;d.push({...c,lane:n.ucCid,col:u,x:u*z,y:v+B/2+_*R})}a.push({...n,y0:v,y1:v+A}),v+=A}let w=Math.max(v,R);g.forEach((n,m)=>d.push({...n,lane:"__spine__",col:0,x:0,y:w/(g.length+1)*(m+1)}));let L=ie*z;return{nodes:d,lanes:a,width:L,height:w}}function ae(t){return t.design_of?"design":t.review.length>0?"review":t.nodes.some(r=>r.label==="source")?"ingest":t.nodes.length>0?"extract":"other"}function $(t){let r=new Map,e=new Map,s=[];for(let i of t){for(let n of i.nodes)r.has(n.cid)||r.set(n.cid,i.seq);let l=new Map(e);for(let n of i.nodes)n.content?.derived===!0&&!e.has(n.cid)&&e.set(n.cid,"derived");for(let n of i.review)n.resolution==="approved"||n.resolution==="edited"?e.set(n.id,"trusted"):n.resolution==="rejected"?e.set(n.id,"archived"):n.resolution==="reset"&&e.set(n.id,"derived");let d=n=>{let m=0;for(let[h,S]of e)S===n&&l.get(h)!==n&&m++;return m},a=0;for(let[n,m]of e){let h=l.get(n);m==="derived"&&(h==="trusted"||h==="archived")&&a++}let o={trusted:d("trusted"),archived:d("archived"),reset:a},p=ae(i),g=i.nodes.map(n=>n.cid),v=i.edges.map(n=>`${n.type}|${n.src}|${n.dst}`),w=i.review.map(n=>n.id),L=p==="review"?"review \xB7 +"+o.trusted+" trusted"+(o.archived?", +"+o.archived+" archived":""):p+" \xB7 +"+g.length+" nodes";s.push({seq:i.seq,ts:i.ts,kind:p,label:L,mintedNodeCids:g,mintedEdgeKeys:v,reviewedNodeCids:w,trustDelta:o})}return{commits:s,bornSeq:r}}function Y(t,r,e){let s=[];for(let i of t){i.nodes.some(l=>l.cid===r)&&s.push({seq:i.seq,ts:i.ts,kind:"minted",detail:"minted here"});for(let l of i.review)l.id===r&&s.push({seq:i.seq,ts:i.ts,kind:"review",detail:l.resolution+(l.reason?": "+l.reason:"")})}return e.length&&s.push({seq:0,ts:"",kind:"derived_from",detail:"source lines "+e.join(", ")}),s}var oe={"&":"&","<":"<",">":">",'"':""","'":"'"};function k(t){return String(t).replace(/[&<>"']/g,r=>oe[r])}var W=t=>"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"),de=new RegExp("[\u2028\u2029]","g");function X(t){return t.replace(/[<>&]/g,W).replace(de,W)}var K=t=>t.replace("sha256:","").slice(0,12);function J(t){if(!t||typeof t!="object")return"";let r=String(t.operator??""),e=t.operand!=null?String(t.operand):"",s=t.unit!=null?" "+String(t.unit):"",i=t.baseline!=null?String(t.baseline):"",l=t.within&&typeof t.within=="object"?t.within:null,d;switch(r){case"exists":d="exists: "+e;break;case"forall":d="for all "+e;break;case"contains":d="contains "+e;break;case"gte":d=">= "+e+s;break;case"lte":d="<= "+e+s;break;case"equals":d="= "+e+s+(i?" (was "+i+")":"");break;case"changed-by":d="changed by "+e+s;break;default:d=(r+" "+e+s).trim()}if(l){let a=l.threshold!=null?String(l.threshold):"",o=l.unit!=null?String(l.unit):"";(a||o)&&(d+=" within "+a+o)}return d.trim()}var C=t=>t==null||t===""?"":`<span class="chip">${k(t)}</span>`,y=(t,r)=>r==null||r===""?"":`<div class="kv"><span class="k">${k(t)}</span><span class="v">${k(r)}</span></div>`,le=t=>Array.isArray(t)&&t.length?`<ul class="crit">${t.map(r=>`<li>${k(r)}</li>`).join("")}</ul>`:"";function Q(t,r){let e=r??{};switch(t){case"usecase":return[y("description",e.description),y("value",e.value),[C(e.risk?"risk: "+e.risk:""),...Array.isArray(e.actors)?e.actors.map(s=>C(s)):[]].join(""),le(e.criteria)].join("");case"scenario":return[y("intent",e.intent),[C(e.case_type)].join(""),e.parameters&&typeof e.parameters=="object"?Object.entries(e.parameters).map(([s,i])=>y(s,i)).join(""):"",y("techniques",e.technique_notes)].join("");case"ac":return[y("",e.text),[C(e.kind),C(e.risk?"risk: "+e.risk:"")].join(""),(()=>{let s=J(e.expected_answer);return s?`<div class="pred">${k(s)}</div>`:""})()].join("");case"test":{let s=J(e.check),i=e.test_md_blob!=null?`<pre class="md">${k(String(e.test_md_blob))}</pre>`:"";return[s?`<div class="pred">${k(s)}</div>`:"",y("definitionId",e.definitionId),i].join("")}case"source":return[y("source_id",e.source_id),y("blob",e.blob)].join("");case"stylenote":return[e.statement?`<div class="pred">${k(e.statement)}</div>`:"",[C(e.learned_from_kind?"learned from: "+e.learned_from_kind:"")].join(""),y("",e.text),Array.isArray(e.tags)?e.tags.map(s=>C(s)).join(""):""].join("");case"gap":return[y("",e.text??e.question),[C(e.kind),C(e.risk?"risk: "+e.risk:"")].join(""),y("why",e.risk_rationale),y("ref",e.ref)].join("");default:return""}}function Z(t,r,e,s){let i=H(t),l=G(i,t),d=U(i,l,t),{commits:a}=$(r);i.summary.designed=l.lanes.filter(n=>n.designed&&n.ucCid!=="__shared__").length;let o={},p={};for(let n of i.nodes){o[n.cid]=Q(n.label,n.content);let m=t.edgesInto(n.cid).filter(h=>h.type===x.DERIVES&&typeof h.props?.anchor=="string").map(h=>h.props.anchor);p[n.cid]=Y(r,n.cid,m)}let g=d.nodes.map(n=>({cid:n.cid,slug:n.slug,label:n.label,trust:n.trust,fresh:n.fresh,title:n.title,superseded:n.superseded,lane:n.lane,col:n.col,x:n.x,y:n.y})),v=d.lanes.map(n=>({ucCid:n.ucCid,slug:n.slug,designed:n.designed,y0:n.y0,y1:n.y1})),L=i.nodes.some(n=>n.label===f.SOURCE)?{}:void 0;return{meta:{fromSeq:r[0]?.seq??0,tipHash:e[e.length-1]??null,storePath:s,schema:"assurance/context@1",asOf:r[r.length-1]?.ts??null},summary:i.summary,lanes:v,nodes:g,edges:i.edges,commits:a,lineage:p,contentHtml:o,width:d.width,height:d.height,source:L}}var ee="__PAYLOAD__",te=`<!doctype html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="utf-8">
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{c as ce}from"./chunk-VRVFPMCR.js";import{k as se}from"./chunk-3POR47RC.js";import"./chunk-AFPHLUQ5.js";import{a as q,c as Q,d as ae}from"./chunk-RLRNLIRS.js";import"./chunk-OS4VSIHT.js";import"./chunk-TRJUD3XJ.js";import{b as G,c as ne,d as ie,e as L,g as N,h as oe}from"./chunk-W2JFDDIB.js";import{a as K}from"./chunk-CLGC7VEO.js";import"./chunk-JFAFKHDX.js";import"./chunk-GFKCTYCA.js";import"./chunk-JZ26R6UL.js";import"./chunk-DNNZ353O.js";import"./chunk-5DT7PIGB.js";import"./chunk-XWKUZJCP.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import{A as O}from"./chunk-TH47OOBV.js";import{b as re}from"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import{i as te}from"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import{a as ee}from"./chunk-YCCUBQY4.js";import{y as g}from"./chunk-27U4PLPX.js";import{a as j}from"./chunk-HCBYKLMW.js";import{a as P,b as w,k as B}from"./chunk-C44QQJR4.js";import{a as be}from"./chunk-6YGTRKDT.js";import{e as H}from"./chunk-UR6MHSHU.js";var D=H(be(),1);function le(r,p,b){let{ref:C,reason:u,by:y}=b;if(!u||u.trim().length===0)return{record:null,errors:[{code:"REASON_REQUIRED",detail:"archiving a node needs a reason \u2014 it becomes the tombstone's provenance"}]};let k=p.resolve(C);if(!k)return{record:null,errors:[{code:"UNKNOWN_REF",detail:`no node '${C}' in the graph`}]};let t=p.tipOf(k.cid);if(p.superseded.has(t))return{record:null,errors:[{code:"ALREADY_ARCHIVED",detail:`${C} is already superseded at its tip (${t.slice(0,19)}\u2026)`}]};let i=te(r,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[{kind:"node",old:t,new:null,reason:u,by:y}],source_head_moves:{}},{expectPrev:p.latestHash});return re(r),{record:i.record,errors:null}}function de(r){let p=r.by??{kind:"human",id:process.env.USER??"operator"},b=r.mode==="interactive"?"override":r.mode,C={out:()=>{},err:()=>{},isTTY:!1,confirm:async()=>!0},u={applied:0,committed:0,retired:0,skipped:0,deferred:0,failed:0},y=new Map;for(let t of r.planRows)if(t.held_ref&&r.held){let i=r.held.rows.find(a=>a.temp_ref===t.held_ref);if(!i)continue;let v={kind:i.kind,ref:i.temp_ref,title:i.title,why:i.why,origin:"content-change",...t.impact?{impact:t.impact}:{}};y.set(v.ref,{card:v,source:"held",heldRef:i.temp_ref})}else if(t.kind==="MODIFY"){let i={kind:"MODIFY",ref:t.ref,title:t.ref,why:`${t.reason}: ${t.provenance}`,origin:t.origin??"structural-stale",...t.impact?{impact:t.impact}:{}};y.set(i.ref,{card:i,source:"row",row:t})}else if(t.kind==="ADD"){let i={kind:"ADD",ref:t.ref,title:t.ref,why:t.reason,origin:t.origin??"content-change"};y.set(i.ref,{card:i,source:"row",row:t})}for(let t of r.archive){if(t.kind!=="ARCHIVE")continue;let i={kind:"ARCHIVE",ref:t.ref,title:t.ref,why:t.why,provenance:t.why,...t.impact?{impact:t.impact}:{}};y.set(i.ref,{card:i,source:"archive",row:t})}for(let t of r.reviewFeeder?.()??[]){if(y.has(t.ref))continue;let i={kind:t.kind==="MODIFY_HELD"?"MODIFY":t.kind,ref:t.ref,title:t.title,why:t.why,...t.impact?{impact:t.impact}:{},...t.pair?{pair:t.pair}:{},...t.held?{held:!0}:{},...t.kind==="MODIFY_HELD"?{heldPayload:!0}:{}};y.set(i.ref,{card:i,source:"review",reviewCard:t})}let k=t=>(u.failed++,{outcome:"failed",detail:t});return{cards:()=>[...y.values()].map(t=>t.card),async submit(t,i){let v=y.get(t);if(!v)return k(`no card ${t}`);if(v.source==="review"){if(v.reviewCard.kind==="PAIR"&&i.v==="approve")return k(`${t} is a PAIR card \u2014 approve is not in its grammar (merge / keep both / defer); words ride a defer note`);let{submitReview:s}=await import("./verdicts-TRSTJLCL.js"),x=i.v==="approve"?{v:"approve"}:i.v==="archive"?{v:"archive",because:i.because??""}:i.v==="skip"&&v.reviewCard.kind==="MODIFY_HELD"?{v:"keep_current"}:i.v==="defer"||i.v==="skip"?{v:"defer"}:i.v==="merge"?{v:"merge"}:{v:"keep_both"},h=await s({contextDir:r.contextDir,signals:o=>r.signals({ref:o.ref,verdict:o.verdict,...o.reason?{reason:o.reason}:{}})},v.reviewCard,x,p);return h.outcome==="failed"?(u.failed++,h):h.outcome==="deferred"?(u.deferred++,i.v==="defer"&&i.note?(r.signals({ref:t,verdict:"deferred-with-note",reason:i.note}),{...h,detail:`steering noted: "${i.note}" \u2014 decide ${v.reviewCard.kind==="PAIR"?"merge / keep both":"the verdict"} when it re-offers`}):h):h.outcome==="retired"?(u.retired++,h):h.outcome==="committed"?(u.committed++,h):(u.applied++,h)}if(i.v==="merge"||i.v==="keep_both")return k(`${t} is a ${v.card.kind} card \u2014 ${i.v} applies to review cards only`);if(i.v==="skip")return u.skipped++,r.signals({ref:t,verdict:"gap-dismissed"}),{outcome:"skipped"};if(i.v==="defer")return u.deferred++,i.note?(r.signals({ref:t,verdict:"deferred-with-note",reason:i.note}),{outcome:"deferred",detail:`steering noted: "${i.note}"`}):{outcome:"deferred"};if(i.v==="archive"){if(v.source!=="archive")return k(`${t} is not an ARCHIVE card`);let s=O(r.contextDir),x=s.resolve(v.row.ref);if(x&&s.superseded.has(s.tipOf(x.cid)))return u.skipped++,{outcome:"skipped",detail:"already retired \u2014 nothing to do"};let h=le(r.contextDir,O(r.contextDir),{ref:v.row.ref,reason:`reconcile retire: ${v.row.why}`,by:p});return h.errors?k(h.errors.map(o=>`${o.code}: ${o.detail}`).join("; ")):(u.retired++,r.signals({ref:t,verdict:"gap-resolved-archive",reason:v.row.why}),{outcome:"retired"})}if(v.source==="archive")return k(`${t} takes archive/skip/defer, not approve`);if(v.source==="held"){let s=se(r.contextDir,r.held,v.heldRef,p,i.edits);if(!s.ok)return k(s.message);if(s.kind==="ADD"){let x=await r.runDesign(s.ref,{yes:!0,mode:b,...i.steering?{because:i.steering}:{}});return x!==0?(u.failed++,{outcome:"failed",landed:!0,detail:`committed ${s.ref}, but its design run exited ${x} \u2014 finish with kane-cli design tests --use-case ${s.ref}`}):(u.applied++,r.signals({ref:t,verdict:"gap-resolved-create",...i.steering?{reason:i.steering}:{}}),{outcome:"applied",detail:s.ref})}if(i.steering){let x=O(r.contextDir),h=q(x,s.ref);if(!h.ok)return u.committed++,{outcome:"committed",detail:`committed ${s.ref}, but steering could not resolve it (${h.message}) \u2014 steer via kane-cli maintain evolve ${s.ref}`};let o=await Q(r.contextDir,h.target,{yes:!0,mode:b,because:i.steering},C,r.runDesign,"batch");if(o.outcome==="no-design"){let d=await r.runDesign(h.target.seamRef,{yes:!0,mode:b,because:i.steering});return d!==0?(u.failed++,{outcome:"failed",landed:!0,detail:`committed ${s.ref}, but its steered design run exited ${d} \u2014 finish with kane-cli design tests --use-case ${h.target.seamRef}`}):(u.applied++,r.signals({ref:t,verdict:"gap-resolved-create",reason:i.steering}),{outcome:"applied",detail:s.ref})}return o.outcome==="failed"||o.outcome==="paused"?(u.failed++,{outcome:"failed",landed:!0,detail:`committed ${s.ref}, but the steering evolve ${o.outcome} (exit ${o.code}) \u2014 finish with kane-cli maintain evolve ${s.ref}`}):o.outcome==="declined"?(u.committed++,{outcome:"committed",detail:`committed ${s.ref} \u2014 the steering evolve was declined; re-run kane-cli maintain evolve ${s.ref}`}):(u.applied++,r.signals({ref:t,verdict:"gap-resolved-evolve",reason:i.steering}),{outcome:"applied",detail:s.ref})}return u.committed++,r.signals({ref:t,verdict:"gap-resolved-evolve"}),{outcome:"committed",detail:s.ref}}let a=O(r.contextDir),f=q(a,v.row.ref);if(!f.ok)return k(f.message);if(v.card.kind==="ADD"){let s=await r.runDesign(f.target.seamRef,{yes:!0,mode:b});return s!==0?k(`design run exited ${s}`):(u.applied++,r.signals({ref:t,verdict:"gap-resolved-create"}),{outcome:"applied"})}let R=await Q(r.contextDir,f.target,{yes:!0,mode:b,...i.steering?{because:i.steering}:{}},C,r.runDesign,"batch");return R.outcome==="evolved"?(u.applied++,r.signals({ref:t,verdict:"gap-resolved-evolve",...i.steering?{reason:i.steering}:{}}),{outcome:"applied"}):R.outcome==="failed"||R.outcome==="paused"?k(`evolve ${R.outcome} (exit ${R.code})`):(u.skipped++,{outcome:"skipped",detail:R.outcome})},summary:()=>({...u})}}var _=H(j(),1);function U({mark:r,markColor:p,color:b,indent:C=2,reserve:u=0,children:y}){let{stdout:k}=B(),t=(k?.columns??80)-u,i=C+r.length+1;return(0,_.jsxs)(P,{children:[(0,_.jsx)(P,{width:i,flexShrink:0,children:(0,_.jsx)(w,{color:p,children:`${" ".repeat(C)}${r}`})}),(0,_.jsx)(P,{width:Math.max(20,t-i),children:(0,_.jsx)(w,{color:b,children:y})})]})}var l=H(j(),1);function ue(r){return r.landed?"committed":r.outcome}var ye={applied:{mark:"\u2714",color:"green"},committed:{mark:"\u2714",color:"green"},retired:{mark:"\u2714",color:"green"},skipped:{mark:"\xB7",color:"dim"},deferred:{mark:"\u2013",color:"dim"},failed:{mark:"\u2717",color:"red"}},Y=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function xe(r){return r.v==="archive"?"Retiring\u2026":r.v==="approve"&&r.steering?"Approving with your changes \u2014 committing, then re-designing\u2026":"Applying \u2014 committing\u2026"}function Re({controller:r,cards:p,note:b,markOutcome:C,routeChat:u,listEvolveTargets:y,barSubject:k,onFinish:t,onCtrlC:i,pauseRef:v}){let[a,f]=(0,D.useState)(p.length>0?{at:"card",idx:0,sel:0,editor:null}:{at:"done-panel",sel:0}),R=(0,D.useRef)(0),s=(0,D.useRef)(a);s.current=a;let x=(0,D.useRef)([]),[h,o]=(0,D.useState)(0),d=a.at==="busy"||a.at==="evolving";(0,D.useEffect)(()=>{if(!d)return;let e=setInterval(()=>o(n=>n+1),120);return()=>clearInterval(e)},[d]);let A=(0,D.useRef)(!1),$=()=>{b((0,l.jsx)(w,{color:g.dim,children:"walk paused \u2014 every verdict so far is committed; re-run the same command to continue"})),t(3)},I=()=>{if(A.current)return;A.current=!0;let e=s.current;if(e.at==="busy"||e.at==="evolving"){b((0,l.jsx)(w,{color:g.dim,children:"finishing the current item, then pausing\u2026"}));return}if(e.at==="done-panel"||e.at==="picker"||e.at==="why"||e.at==="view"){t(R.current);return}$()};v&&(v.current=I);let E=a.at==="card"||a.at==="busy"?p[a.idx]:null,T=()=>[{key:"finish",label:"finish"},...y?[{key:"evolve",label:"evolve another use-case\u2026"}]:[],...x.current.length>0?[{key:"view",label:"view what changed"}]:[]],W=()=>{let e=y?.()??[];if(e.length===0){b((0,l.jsx)(w,{color:g.dim,children:"nothing is stale \u2014 no evolve targets right now"})),f({at:"done-panel",sel:0});return}f({at:"picker",items:e,sel:0})},M=e=>{let n=e+1;if(n<p.length)f({at:"card",idx:n,sel:0,editor:null});else{let c=r.summary();b((0,l.jsx)(w,{color:g.dim,children:`reconcile walk: ${c.applied} applied, ${c.committed} committed, ${c.retired} retired, ${c.skipped} skipped, ${c.deferred} deferred`+(c.failed>0?`, ${c.failed} failed`:"")})),f({at:"done-panel",sel:0})}},F=(0,D.useRef)(!1),S=(e,n)=>{if(F.current)return;F.current=!0;let c=p[e];f({at:"busy",idx:e,label:xe(n),startedAt:Date.now()}),r.submit(c.ref,n).catch(m=>({outcome:"failed",detail:m instanceof Error?m.message:String(m)})).then(m=>{let V=ye[m.outcome]??{mark:"\xB7",color:"dim"},we=m.outcome!=="failed"&&m.outcome!=="skipped"&&m.outcome!=="deferred"&&c.impact&&"stale_refs"in c.impact&&c.impact.stale_refs.length>0?` \xB7 ${c.impact.stale_refs.length} item(s) now stale`:"",Z=`${m.outcome} [${c.kind}] ${K(c.title)}${m.detail?` \u2014 ${K(m.detail)}`:""}${we}`;if(x.current.push({mark:V.mark,color:V.color,line:Z}),b((0,l.jsx)(U,{mark:V.mark,markColor:V.color==="green"?g.green:V.color==="red"?g.red:g.dim,color:V.color==="dim"?g.dim:void 0,children:Z})),m.outcome==="failed"&&(R.current=R.current===0?1:R.current),C(c.ref,ue(m)),F.current=!1,A.current){$();return}M(e)})},me=(e,n)=>{f({at:"evolving",title:e.title,startedAt:Date.now()}),u(`${e.key} ${n}`).catch(c=>`\u2717 evolve failed: ${c instanceof Error?c.message:String(c)}`).then(c=>{let m=c.startsWith("\u2713");if(x.current.push({mark:m?"\u2714":"\u2717",color:m?"green":"red",line:c.replace(/^[✓✗]\s*/,"")}),b((0,l.jsx)(U,{mark:m?"\u2714":"\u2717",markColor:m?g.green:g.red,children:c.replace(/^[✓✗]\s*/,"")})),A.current){t(R.current);return}f({at:"done-panel",sel:0})})},fe=(0,D.useMemo)(()=>({isFocused:()=>{let e=s.current;return e.at==="card"&&e.editor===null||e.at==="done-panel"||e.at==="picker"||e.at==="view"},onMove:e=>{f(n=>{if(n.at==="card"){let c=p[n.idx],m=N(c)??L(c).length-1;return{...n,sel:Math.max(0,Math.min(m,n.sel+e))}}return n.at==="done-panel"?{...n,sel:Math.max(0,Math.min(T().length-1,n.sel+e))}:n.at==="picker"?{...n,sel:Math.max(0,Math.min(n.items.length-1,n.sel+e))}:n})},onSelect:()=>{let e=s.current;if(e.at==="card"){let n=p[e.idx],c=N(n);if(c!==null&&e.sel===c){f({...e,editor:"",editorIntent:"steer"});return}let m=L(n)[e.sel];if(m?.v==="archive"&&n.kind==="REVIEW"){f({...e,editor:"",editorIntent:"because"});return}m&&S(e.idx,{v:m.v});return}if(e.at==="done-panel"){let n=T()[e.sel];n?.key==="finish"?t(R.current):n?.key==="evolve"?W():n?.key==="view"&&f({at:"view"});return}if(e.at==="picker"){let n=e.items[e.sel];n&&f({at:"why",item:n,text:""});return}},onDigit:e=>{let n=s.current;if(n.at==="card"){let c=p[n.idx],m=L(c)[e-1];if(m?.v==="archive"&&c.kind==="REVIEW"){f({...n,editor:"",editorIntent:"because"});return}m&&S(n.idx,{v:m.v});return}n.at==="done-panel"&&e-1<T().length&&f({...n,sel:e-1}),n.at==="picker"&&e-1<n.items.length&&f({...n,sel:e-1})},onType:e=>{f(n=>n.at!=="card"||N(p[n.idx])===null?n:{...n,editor:(n.editor??"")+e,editorIntent:n.editorIntent??"steer"})},isMulti:()=>!1,onSpace:()=>{},onBack:()=>{let e=s.current;(e.at==="picker"||e.at==="view")&&f({at:"done-panel",sel:0})}}),[p]);(0,D.useEffect)(()=>{a.at==="done"&&t(R.current)},[a.at]);let pe=a.at==="card"||a.at==="done-panel"||a.at==="picker"||a.at==="why"||a.at==="view",ge=a.at==="card"||a.at==="busy"?`${k?`${k} \xB7 `:""}item ${a.idx+1} of ${p.length}`:k,X=e=>Math.floor((Date.now()-e)/1e3),{stdout:ve}=B(),z=Math.min((ve?.columns??80)-1,100),J=`view \xB7 this run's changes \xB7 ${x.current.length}`,he=Math.max(2,z-(3+J.length+1)),ke=Math.max(2,z-12);return(0,l.jsxs)(P,{flexDirection:"column",children:[(0,l.jsx)(ie,{onToggleThinking:()=>{},onCtrlC:()=>{i(),I()},panel:fe}),a.at==="card"&&E?(0,l.jsx)(oe,{card:E,position:{n:a.idx+1,of:p.length},sel:a.sel,focused:a.editor===null,editorIntent:a.editorIntent??"steer",freeText:a.editor!==null?{value:a.editor,onChange:e=>f(n=>n.at==="card"?{...n,editor:e}:n),onSubmit:e=>{let n=s.current;if(n.at!=="card")return;let c=e.trim();if(!c){f({...n,editor:null,editorIntent:void 0});return}let m=p[n.idx];n.editorIntent==="because"?S(n.idx,{v:"archive",because:c}):m.kind==="PAIR"?S(n.idx,{v:"defer",note:c}):S(n.idx,{v:"approve",steering:c})},onCancel:()=>f(e=>e.at==="card"?{...e,editor:null,editorIntent:void 0}:e)}:null}):null,a.at==="busy"?(0,l.jsxs)(w,{color:g.assuranceAccent,children:[`${Y[h%Y.length]} ${a.label} `,(0,l.jsx)(w,{color:g.dim,children:`(${X(a.startedAt)}s)`})]}):null,a.at==="evolving"?(0,l.jsxs)(w,{color:g.assuranceAccent,children:[`${Y[h%Y.length]} Evolving ${a.title}\u2026 `,(0,l.jsx)(w,{color:g.dim,children:`(${X(a.startedAt)}s)`})]}):null,a.at==="done-panel"?(0,l.jsx)(G,{headline:(()=>{let e=r.summary();return`reconcile done \u2014 ${e.applied+e.committed} applied \xB7 ${e.retired} retired \xB7 ${e.skipped} skipped \xB7 ${e.deferred} deferred${e.failed>0?` \xB7 ${e.failed} failed`:""}`})(),rows:T(),sel:a.sel,focused:!0,legend:"\u2191\u2193 \xB7 \u23CE select"}):null,a.at==="picker"?(0,l.jsx)(G,{ask:!0,headline:"evolve which use-case?",rows:a.items.map(e=>({key:e.key,label:e.title,detail:e.badge})),sel:a.sel,focused:!0,legend:"\u2191\u2193 \xB7 \u23CE select \xB7 esc back"}):null,a.at==="why"?(0,l.jsxs)(P,{flexDirection:"column",borderStyle:"round",borderColor:g.assuranceAccent,paddingX:1,children:[(0,l.jsxs)(P,{children:[(0,l.jsxs)(w,{children:[(0,l.jsx)(w,{color:g.assuranceAccent,children:"\u25B8"})," ",(0,l.jsx)(w,{color:g.dim,children:"\u270E "})]}),(0,l.jsx)(ee,{value:a.text,onChange:e=>f(n=>n.at==="why"?{...n,text:e}:n),onSubmit:e=>{let n=s.current;n.at==="why"&&(e.trim()?me(n.item,e.trim()):f({at:"picker",items:[n.item],sel:0}))},onCancel:()=>{s.current.at==="why"&&W()},placeholder:`what should change about ${a.item.title}?`})]}),(0,l.jsx)(w,{color:g.muted,children:" \u23CE submit \xB7 esc back"})]}):null,a.at==="view"?(0,l.jsxs)(P,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,l.jsxs)(w,{color:g.assuranceAccent,children:["\u2500\u2500 ",(0,l.jsx)(w,{bold:!0,children:J}),` ${"\u2500".repeat(he)}`]}),(0,l.jsx)(w,{children:" "}),x.current.map((e,n)=>(0,l.jsx)(U,{mark:e.mark,markColor:e.color==="green"?g.green:e.color==="red"?g.red:g.dim,color:e.color==="dim"?g.dim:void 0,indent:0,reserve:0,children:e.line},`vc-${n}`)),(0,l.jsx)(w,{children:" "}),(0,l.jsxs)(w,{color:g.assuranceAccent,children:["\u2500\u2500 ",(0,l.jsx)(w,{color:g.muted,children:"esc back"}),` ${"\u2500".repeat(ke)}`]})]}):null,(0,l.jsx)(ne,{verb:"maintain",subject:ge,state:pe?"idle":void 0,hints:"ctrl+c exit"})]})}async function qe(r){let p={current:null},b=o=>{p.current?.append(o)},C=null,u=async(o,d)=>{let[{runDesign:A},{resolveAgentAuthEnv:$},{runAgent:I},{preflightTurn:E}]=await Promise.all([import("./run-2COODVX2.js"),import("./spawner-J67QR4QP.js"),import("./bridge-5Z3BIB77.js"),import("./turn-preflight-JGYT7LXP.js")]);C??=await $();let T=C;return A({useCase:o,force:!0,mode:d.mode??"override",...d.because?{because:d.because}:{},...d.changeDelta!==void 0?{changeDelta:d.changeDelta}:{},...d.priorDesign!==void 0?{priorDesign:d.priorDesign}:{}},{contextDir:r.dir,agent:I,preflightTurn:()=>E(T),ask:async()=>[],out:()=>{},progress:()=>{},isTTY:!1,auth:T})},y=r.runDesign??u,k=de({contextDir:r.dir,held:r.held,archive:r.archive,planRows:r.rows,runDesign:y,mode:"interactive",signals:r.signals,reviewFeeder:()=>{try{return ce({contextDir:r.dir},O(r.dir))}catch{return[]}}}),t=new Set(r.rows.filter(o=>o.applied!==void 0).map(o=>o.held_ref??o.ref)),i=k.cards().filter(o=>!t.has(o.ref)&&!(o.kind==="ARCHIVE"&&r.archiveState?.[o.ref]!==void 0)),v=o=>r.rows.findIndex(d=>(d.held_ref??d.ref)===o),a=(o,d)=>{try{if(i.find(I=>I.ref===o)?.kind==="ARCHIVE"){d==="retired"?r.markA?.(o,"retired"):d==="skipped"&&r.markA?.(o,"skipped");return}let $=v(o);if($<0)return;d==="applied"||d==="committed"?r.mark?.($,"approved"):d==="skipped"&&r.mark?.($,"skipped")}catch{}},f=async o=>{let[{openGraph:d},{resolveParentUc:A,evolveOneUc:$}]=await Promise.all([import("./readmodel-XOYGGQ3S.js"),import("./evolve-cmd-BCPNXAMV.js")]),[I,...E]=o.split(/\s+/),T=d(r.dir),W=A(T,I);if(!W.ok)return`couldn't resolve '${I}' \u2014 start with a use-case id (uc-\u2026): ${W.message}`;if(E.length===0)return`say what to change: \`${I} <your words>\` \u2014 the words become the redesign's change delta`;let M=E.join(" "),F={out:()=>{},err:()=>{},isTTY:!1,confirm:async()=>!0},S=await $(r.dir,W.target,{yes:!0,mode:"override",because:M},F,y,"batch");return S.outcome==="evolved"?(r.signals({ref:W.target.display,verdict:"gap-resolved-evolve",reason:M}),`\u2713 redesigned ${W.target.display} \u2014 "${M}"`):`\u2717 evolve ${S.outcome} for ${W.target.display} (exit ${S.code})`},R=r.listEvolveTargets??(()=>{let o=O(r.dir);return ae(o).targets.map(d=>({key:d.display,title:d.display,badge:"stale"}))});if(r.script){let o=0;for(let d of i){let A=await r.script(d),$=await k.submit(d.ref,A);$.outcome==="failed"&&o===0&&(o=1),a(d.ref,ue($))}return o}let[{render:s},{ScrollbackProvider:x},{ScrollbackTap:h}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./scrollback-JLPJR25X.js"),import("./ScrollbackTap-Q3IOKNMS.js")]);return new Promise(o=>{let d=!1,A=M=>{d||(d=!0,(async()=>{process.removeListener("SIGINT",T),await p.current?.flush();try{W.unmount()}catch{}o(M)})())},$=0,I={current:null},E=()=>{if($+=1,$>=2){process.removeListener("SIGINT",T);try{W.unmount()}catch{}o(130)}},T=()=>{E(),I.current?.()};process.on("SIGINT",T);let W=s((0,l.jsxs)(x,{children:[(0,l.jsx)(h,{into:p}),(0,l.jsx)(Re,{controller:k,cards:i,note:b,markOutcome:a,routeChat:f,listEvolveTargets:R,barSubject:r.barSubject,onFinish:A,onCtrlC:E,pauseRef:I})]}),{exitOnCtrlC:!1})})}export{Re as WalkSessionSurface,ue as outcomeToMark,qe as runWalkSession};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a}from"./chunk-EDSZJZFG.js";import"./chunk-IP2O264K.js";import"./chunk-R5T4RLF5.js";import"./chunk-IDX3TOPY.js";import"./chunk-BKM2LWU2.js";import"./chunk-KBM3XHAM.js";import"./chunk-2YEHV2CX.js";import"./chunk-56PAQAX5.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-27U4PLPX.js";import"./chunk-UR6MHSHU.js";export{a as withTelemetry};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testmuai/kane-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "KaneAI Terminal UI — browser automation testing agent",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"README.md"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
+
"@devicefarmer/adbkit-apkreader": "^3.2.4",
|
|
20
21
|
"@testmuai/evidence-cli": "^0.1.7",
|
|
21
22
|
"archiver": "^7.0.1",
|
|
22
23
|
"chalk": "^5.3.0",
|
|
@@ -34,11 +35,16 @@
|
|
|
34
35
|
"ws": "^8.20.0"
|
|
35
36
|
},
|
|
36
37
|
"optionalDependencies": {
|
|
37
|
-
"@testmuai/kane-cli-darwin-arm64": "0.
|
|
38
|
-
"@testmuai/kane-cli-darwin-x64": "0.
|
|
39
|
-
"@testmuai/kane-cli-linux-
|
|
40
|
-
"@testmuai/kane-cli-linux-
|
|
41
|
-
"@testmuai/kane-cli-win-x64": "0.
|
|
38
|
+
"@testmuai/kane-cli-assurance-darwin-arm64": "0.8.1",
|
|
39
|
+
"@testmuai/kane-cli-assurance-darwin-x64": "0.8.1",
|
|
40
|
+
"@testmuai/kane-cli-assurance-linux-arm64": "0.8.1",
|
|
41
|
+
"@testmuai/kane-cli-assurance-linux-x64": "0.8.1",
|
|
42
|
+
"@testmuai/kane-cli-assurance-win-x64": "0.8.1",
|
|
43
|
+
"@testmuai/kane-cli-darwin-arm64": "0.8.1",
|
|
44
|
+
"@testmuai/kane-cli-darwin-x64": "0.8.1",
|
|
45
|
+
"@testmuai/kane-cli-linux-x64": "0.8.1",
|
|
46
|
+
"@testmuai/kane-cli-linux-arm64": "0.8.1",
|
|
47
|
+
"@testmuai/kane-cli-win-x64": "0.8.1",
|
|
42
48
|
"@testmuai/kane-cli-node-darwin-arm64": "24.18.0",
|
|
43
49
|
"@testmuai/kane-cli-node-darwin-x64": "24.18.0",
|
|
44
50
|
"@testmuai/kane-cli-node-linux-x64": "24.18.0",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as Wt,b as he,c as Ut,d as st}from"./chunk-W5DOU2DV.js";import{a as Nt}from"./chunk-JEUA4UWK.js";import{a as Fe}from"./chunk-SY3HLQMV.js";import{a as Pt,b as Ft}from"./chunk-VGFTNLQQ.js";import"./chunk-L2TV4G56.js";import"./chunk-5KFS3GAZ.js";import{a as _t,b as Ot,c as qt}from"./chunk-NRTHYROA.js";import"./chunk-NVGBE2DR.js";import{a as Et}from"./chunk-5Y2G4NC7.js";import"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import{a as Pe}from"./chunk-YCCUBQY4.js";import{a as Lt}from"./chunk-73C4PRYU.js";import{b as Mt}from"./chunk-DFS4RMVP.js";import{y as r}from"./chunk-C4G7RVJ6.js";import{a as Q}from"./chunk-HCBYKLMW.js";import{a as T,b as n,k as qe}from"./chunk-C44QQJR4.js";import{a as Pn}from"./chunk-6YGTRKDT.js";import{e as V}from"./chunk-UR6MHSHU.js";var p=V(Pn(),1);var l=V(Q(),1),Fn=60,Wn=100;function it(e,s){let o=e.options.length,c=o,d=e.multi_select?c++:null,m=e.allow_free_text?c++:null,u=s?c++:null;return{optionCount:o,doneIdx:d,freeIdx:m,batchIdx:u,maxSel:c-1}}var Nn="\xA0",Un={high:{text:`\u203C${Nn}high`,color:r.red},med:{text:"med",color:"yellow"},low:{text:"low",color:r.dim}};function jn(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 Vn(e,s,o){let c=g=>e[g].length+6,d=c(s),m=s,u=s;for(;;){let g=u+1<e.length?c(u+1):1/0,h=m-1>=0?c(m-1):1/0;if(g===1/0&&h===1/0)break;if(g<=h){if(d+g>o)break;d+=g,u+=1}else{if(d+h>o)break;d+=h,m-=1}}return{lo:m,hi:u}}function jt({batch:e,qView:s,sel:o=0,focused:c=!1,freeText:d=null,optionText:m=null,attach:u=null,canAttach:g=!1,multiSelFor:h}){let{stdout:I}=qe(),b=I?.columns??80,w=b<Fn,D=Math.min(b-1,Wn),C=Math.max(0,Math.min(e.questions.length-1,s??(e.cursor<0?0:e.cursor))),x=e.questions[C],R=e.resolution[C],L=e.resolution.filter(F=>!F).length,S=e.questions.length-L,B=Fe(e),f=it(x,B!==""),U=h?h(C):[],O=Un[x.risk],q=F=>c&&o===F?(0,l.jsx)(n,{color:r.assuranceAccent,children:"\u276F"}):" ",le=`? the agent needs ${L===1?"one answer":`${L} answers`}`,ae=e.questions.length>1?` \xB7 ${C+1} of ${e.questions.length} \xB7 ${S} answered`:"",Ae=(0,l.jsxs)(T,{flexDirection:"column",children:[(0,l.jsx)(T,{paddingLeft:2,children:(0,l.jsxs)(n,{bold:!0,children:[x.text,O?(0,l.jsx)(n,{color:O.color,bold:!1,children:` ${O.text}`}):null]})}),(0,l.jsx)(T,{paddingLeft:2,children:(0,l.jsx)(n,{color:r.dim,children:x.rationale})}),(0,l.jsx)(n,{children:" "}),x.options.map((F,P)=>{let X=c&&o===P;return m&&m.optionIndex===P?(0,l.jsx)(T,{flexDirection:"column",children:(0,l.jsxs)(T,{children:[(0,l.jsxs)(n,{children:[(0,l.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,l.jsx)(n,{color:r.assuranceAccent,children:`${P+1}. ${F.label}`}),(0,l.jsx)(n,{color:r.dim,children:" \u270E "})]}),(0,l.jsx)(Pe,{value:m.value,onChange:m.onChange,onSubmit:m.onSubmit,onCancel:m.onCancel,placeholder:F.detail||"type your answer"})]})},`o-${P}`):(0,l.jsxs)(T,{flexDirection:"column",children:[(0,l.jsxs)(n,{children:[q(P)," ",x.multi_select?(0,l.jsx)(n,{color:U.includes(P)?r.green:r.dim,children:U.includes(P)?"[x] ":"[ ] "}):null,(0,l.jsx)(n,{color:X?r.assuranceAccent:void 0,children:`${P+1}. ${F.label}`}),P===x.recommended_index?(0,l.jsx)(n,{color:r.dim,children:" (recommended)"}):null,R?.selected_index===P?(0,l.jsx)(n,{color:r.dim,children:" (current)"}):null]}),F.detail?(0,l.jsx)(T,{paddingLeft:5,children:(0,l.jsx)(n,{color:r.dim,children:F.detail})}):null]},`o-${P}`)}),x.multi_select&&f.doneIdx!=null?(0,l.jsxs)(n,{children:[q(f.doneIdx)," ",(0,l.jsx)(n,{color:r.green,children:"\u2714"}),(0,l.jsx)(n,{color:c&&o===f.doneIdx?r.assuranceAccent:void 0,children:" done \u2014 confirm selection"})]}):null,x.allow_free_text?(0,l.jsx)(n,{children:" "}):null,x.allow_free_text?d?(0,l.jsxs)(T,{children:[(0,l.jsxs)(n,{children:[(0,l.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,l.jsx)(n,{color:r.dim,children:"\u270E "})]}),(0,l.jsx)(Pe,{value:d.value,onChange:d.onChange,onSubmit:d.onSubmit,onCancel:d.onCancel,placeholder:"Tell me what to do"})]}):(0,l.jsxs)(n,{children:[f.freeIdx!=null?q(f.freeIdx):" "," ",(0,l.jsx)(n,{color:c&&f.freeIdx!=null&&o===f.freeIdx?r.assuranceAccent:r.dim,children:"\u270E Tell me what to do"})]}):null,u?(0,l.jsxs)(T,{flexDirection:"column",marginTop:1,children:[(0,l.jsxs)(T,{children:[(0,l.jsxs)(n,{children:[(0,l.jsx)(n,{color:r.assuranceAccent,children:"\u276F"})," ",(0,l.jsx)(n,{color:r.assuranceAccent,children:"@ attach a file or URL"}),(0,l.jsx)(n,{color:r.dim,children:" \u270E "})]}),(0,l.jsx)(Pe,{value:u.value,onChange:u.onChange,onSubmit:u.onSubmit,onCancel:u.onCancel,placeholder:"path or URL"})]}),(0,l.jsx)(T,{paddingLeft:2,children:(0,l.jsx)(n,{color:r.dim,children:"the questions are set aside \u2014 the agent reads the source and re-asks what's still open"})})]}):null]}),be=B!==""?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(n,{children:" "}),(0,l.jsxs)(n,{children:[c&&f.batchIdx!=null&&o===f.batchIdx?(0,l.jsx)(n,{color:r.assuranceAccent,children:"\u276F"}):" "," ",(0,l.jsx)(n,{color:r.assuranceAccent,children:"\xBB"}),(0,l.jsx)(n,{bold:!0,color:c&&f.batchIdx!=null&&o===f.batchIdx?r.assuranceAccent:void 0,children:" Go with recommendations"}),L>=5?(0,l.jsx)(n,{color:r.dim,children:` \u2014 resolves all ${L} open`}):null,(0,l.jsx)(n,{color:r.dim,children:" (tab)"})]})]}):null;if(w)return(0,l.jsxs)(T,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,l.jsx)(n,{color:r.assuranceAccent,bold:!0,children:le}),e.questions.length>1?(0,l.jsx)(n,{color:r.dim,children:ae.replace(/^ · /,"")}):null,(0,l.jsx)(n,{children:" "}),Ae,be,(0,l.jsx)(T,{paddingLeft:2,children:(0,l.jsx)(n,{color:r.muted,children:"\u2191\u2193 \u23CE \xB7 \u2190 \u2192 questions \xB7 esc back"})})]});let ke=`\u2500\u2500 ${le}${ae} `,re=Math.max(2,D-ke.length),Z=g?"\u2191\u2193 select \xB7 \u23CE confirm \xB7 \u2190 \u2192 questions \xB7 type = your words \xB7 @ attach a file or URL \xB7 esc back":"\u2191\u2193 select \xB7 \u23CE confirm \xB7 \u2190 \u2192 questions \xB7 type = your words \xB7 esc back",M=`\u2500\u2500 ${Z} `,ce=Math.max(2,D-M.length),j=e.questions.map(F=>jn(F)),ee=e.questions.length>1?Vn(j,C,D-8):null;return(0,l.jsxs)(T,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,l.jsxs)(n,{color:r.assuranceAccent,children:["\u2500\u2500 ",(0,l.jsx)(n,{bold:!0,children:le}),ae?(0,l.jsx)(n,{color:r.dim,children:ae}):null,` ${"\u2500".repeat(re)}`]}),ee?(0,l.jsx)(T,{marginTop:1,children:(0,l.jsxs)(n,{children:[ee.lo>0?(0,l.jsx)(n,{color:r.dim,children:"\u25C0 "}):" ",e.questions.slice(ee.lo,ee.hi+1).map((F,P)=>{let X=ee.lo+P,ye=P>0?" ":"";return X===C?(0,l.jsxs)(n,{children:[ye,(0,l.jsx)(n,{backgroundColor:r.assuranceAccent,color:"#0d1117",bold:!0,children:` ${j[X]} `})]},F.id):(0,l.jsxs)(n,{children:[ye,e.resolution[X]?(0,l.jsxs)(n,{children:[(0,l.jsx)(n,{color:r.green,children:"\u2713 "}),(0,l.jsx)(n,{color:r.dim,children:j[X]})]}):(0,l.jsx)(n,{color:r.dim,children:`\u25CB ${j[X]}`})]},F.id)}),ee.hi<e.questions.length-1?(0,l.jsx)(n,{color:r.dim,children:" \u25B6"}):null]})}):null,(0,l.jsx)(n,{children:" "}),Ae,be,(0,l.jsx)(n,{children:" "}),(0,l.jsxs)(n,{color:r.assuranceAccent,children:["\u2500\u2500 ",(0,l.jsx)(n,{color:r.muted,children:Z}),` ${"\u2500".repeat(ce)}`]})]})}var E=V(Q(),1),Vt={high:0,med:1,low:2},Kn={high:r.red,med:"yellow",low:r.dim};function Qn(e){return e.map((s,o)=>({r:s,i:o})).sort((s,o)=>(Vt[s.r.risk??"zz"]??3)-(Vt[o.r.risk??"zz"]??3)||s.i-o.i).map(({r:s})=>s)}var se=(e,s)=>e.length<=s?e:s<=1?"\u2026":`${e.slice(0,s-1)}\u2026`,We=(e,s)=>e+" ".repeat(Math.max(0,s-e.length));function Kt({rows:e,width:s=120,badgeHeader:o="risk"}){if(e.length===0)return null;let c=Qn(e),d=S=>S.staged||!S.id?"(staged)":Nt(S.id),m=Math.max(2,...c.map(S=>d(S).length)),u=Math.max(o.length,...c.map(S=>(S.badge??"").length)),g=s>=96&&c.some(S=>S.summary),I=s-(g?13:10)-m-u,b=Math.max(...c.map(S=>Math.max(S.title.length,(S.marker??"").length)),5),w=Math.max(5,g?Math.min(b,Math.max(16,Math.floor(I*.5))):Math.min(b,I)),D=g?Math.max(7,I-w):0,C=(S,B,f,U)=>S+U.map(O=>`\u2500${"\u2500".repeat(O.length)}\u2500`).join(B)+f,x=(S,B,f,U)=>[We(se(S,m),m),We(se(B,w),w),We(se(f,u),u),...g?[We(se(U,D),D)]:[]],R=x("id","title",o,"summary"),L=[];L.push((0,E.jsx)(n,{color:r.dim,children:C("\u250C","\u252C","\u2510",R)},"t")),L.push((0,E.jsxs)(n,{children:[R.map((S,B)=>(0,E.jsxs)(n,{children:[(0,E.jsx)(n,{color:r.dim,children:B===0?"\u2502 ":" \u2502 "}),(0,E.jsx)(n,{bold:!0,children:S})]},B)),(0,E.jsx)(n,{color:r.dim,children:" \u2502"})]},"h")),L.push((0,E.jsx)(n,{color:r.dim,children:C("\u251C","\u253C","\u2524",R)},"m"));for(let[S,B]of c.entries()){let f=x(d(B),se(B.title,w),se(B.badge??"",u),se(B.summary??"",D)),U=B.badgeColor??Kn[B.badge??""]??r.dim;if(L.push((0,E.jsxs)(n,{children:[(0,E.jsx)(n,{color:r.dim,children:"\u2502 "}),(0,E.jsx)(n,{color:r.assuranceAccent,children:f[0]}),(0,E.jsx)(n,{color:r.dim,children:" \u2502 "}),f[1],(0,E.jsx)(n,{color:r.dim,children:" \u2502 "}),(0,E.jsx)(n,{color:U,children:f[2]}),g?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(n,{color:r.dim,children:" \u2502 "}),f[3]]}):null,(0,E.jsx)(n,{color:r.dim,children:" \u2502"})]},`r-${S}`)),B.marker){let O=x("",se(B.marker,w),"","");L.push((0,E.jsx)(n,{color:r.dim,children:`\u2502 ${O.join(" \u2502 ")} \u2502`},`mk-${S}`))}}return L.push((0,E.jsx)(n,{color:r.dim,children:C("\u2514","\u2534","\u2518",R)},"b")),(0,E.jsx)(E.Fragment,{children:L})}var Hn={"use-case":"use-cases",ac:"ACs",scenario:"scenarios",test:"tests",gap:"gaps"},ne=e=>Hn[e]??`${e}s`,Qt=e=>e==="ac"?"AC":e==="use-case"?"use-case":e,ot=e=>e.kind??"use-case",Ht=e=>`${ot(e)}:${e.temp_ref}`;function Xt(e){let s=e,o=s.badge??e.risk??null,c=s.why??e.summary??e.description??null;return JSON.stringify([e.title,o,c,s.extra??null,e.depends_on_hint??null])}function zt(e){return e.filter(s=>s.role==="agent"&&typeof s.turnIndex=="number"&&Array.isArray(s.items)&&s.items.length>0)}function oe(e){let s=new Map,o=1;for(let m of zt(e)){let u=new Set;for(let g of m.items){let h=Ht(g);if(u.has(h))continue;u.add(h);let I=s.get(h);s.set(h,{num:I?.num??o++,ref:g.temp_ref,kind:ot(g),item:g,turnIndex:m.turnIndex,fingerprint:Xt(g)})}}let c=[...s.values()].sort((m,u)=>m.num-u.num),d=[];for(let m of c){let u=d.find(g=>g.kind===m.kind);u?u.count++:d.push({kind:m.kind,label:ne(m.kind),count:1})}return{entries:c,byRef:s,counts:d}}function Gt(e,s){let c=zt(e).find(x=>x.turnIndex===s);if(!c)return null;let d=e.filter(x=>x.role!=="agent"||typeof x.turnIndex!="number"||x.turnIndex<=s),m=oe(d),u=oe(e.filter(x=>x.role!=="agent"||typeof x.turnIndex!="number"||x.turnIndex<s)),g=[],h=new Map,I=new Map,b=new Map,w=new Set;for(let x of c.items){let R=Ht(x);if(w.has(R))continue;w.add(R);let L=u.byRef.get(R),S=x.changed===!0,B=m.byRef.get(R).num,f=ot(x);if(L&&!S&&L.fingerprint===Xt(x)){h.set(f,(h.get(f)??0)+1);continue}let U=!!L||S,O=U?b:I;O.set(f,(O.get(f)??0)+1),g.push({item:x,num:B,updated:U})}let D=[...h.entries()].map(([x,R])=>({label:ne(x),count:R})),C=[...[...I.entries()].map(([x,R])=>`${R} new ${R===1?Qt(x):ne(x)}`),...[...b.entries()].map(([x,R])=>`${R} updated ${R===1?Qt(x):ne(x)}`)].join(" \xB7 ");return{fresh:g,unchanged:D,headerStats:C}}function lt(e,s){let o=e.entries.filter(m=>m.turnIndex===s);if(o.length===0)return e;let c=new Map(o.map(m=>[m.ref,m])),d=[];for(let m of o){let u=d.find(g=>g.kind===m.kind);u?u.count+=1:d.push({kind:m.kind,label:ne(m.kind),count:1})}return{entries:o,byRef:c,counts:d}}var y=V(Q(),1);function Xn(e){let s=e.form==="assumed"?" (assumed)":e.form==="deferred"?"":" (you)",o=e.note?` \u2014 ${e.note}`:"";return e.form==="deferred"?`\u21B3 deferred q${e.qNum} ${e.stub}${o}`:e.form==="changed"?`\u21B3 changed q${e.qNum} ${e.stub}: ${e.prev??"?"} \u2192 ${e.choice??"?"}${s}${o}`:`\u21B3 ${e.form} q${e.qNum} ${e.stub}: ${e.choice??"?"}${s}${o}`}var zn=Math.min(process.stdout?.columns??100,120)-2;function Jt({block:e,annotations:s}){switch(e.kind){case"banner":return(0,y.jsx)(T,{marginTop:1,children:(0,y.jsx)(n,{color:r.dim,children:` \u2500\u2500 ${e.text} \u2500\u2500`})});case"user":return(0,y.jsxs)(T,{marginTop:1,children:[(0,y.jsx)(n,{color:r.orange,children:"\u276F "}),(0,y.jsx)(n,{children:e.text})]});case"note":return(0,y.jsx)(n,{color:r.dim,children:` ${e.text}`});case"agent":return(0,y.jsx)(T,{marginTop:1,children:(0,y.jsx)(Ot,{text:e.text,accent:r.assuranceAccent})});case"thinking":return(0,y.jsx)(T,{marginTop:1,children:(0,y.jsx)(n,{color:r.dim,children:` thought for ${(e.tookMs/1e3).toFixed(1)}s`})});case"tool":return(0,y.jsx)(n,{color:r.dim,children:` ${Pt({name:e.name,status:e.status==="ok"?"done":e.status,detail:e.detail})}`});case"usage":return(0,y.jsx)(n,{color:r.dim,children:` \xB7 ${e.credits.toFixed(1)} credits \u2014 total ${e.total.toFixed(1)}`});case"turn":{let o=s??null,c=o?o.fresh:e.items.map((b,w)=>({item:b,num:w+1,updated:!1})),d={usecase:"risk","use-case":"risk",ac:"check",scenario:"kind",test:"check",gap:"severity",stylenote:"kind"},m=b=>b.kind??"use-case",u=new Map;for(let b of c){let w=b.item,D=m(b.item),C=w.risk==="high"||w.risk==="med"||w.risk==="low"?w.risk:void 0,x={id:w.logical_id??"",staged:!w.logical_id,title:w.title,badge:w.badge??w.risk??"",summary:w.why??w.summary??w.description??"",...C?{risk:C}:{},...b.updated?{marker:"\u21B3 changed"}:{}},R=u.get(D)??[];R.push(x),u.set(D,R)}let g=c.some(b=>!!b.item.kind),h=(o?.unchanged??[]).reduce((b,w)=>b+w.count,0),I=o?.headerStats?` \u2014 ${o.headerStats}${h>0?` (${h} unchanged)`:""}`:"";return(0,y.jsxs)(T,{flexDirection:"column",marginLeft:2,children:[(0,y.jsxs)(n,{bold:!0,children:[g?"design":e.heading,I?(0,y.jsx)(n,{bold:!1,color:r.dim,children:I}):null]}),[...u.entries()].map(([b,w])=>(0,y.jsxs)(T,{flexDirection:"column",children:[u.size>1?(0,y.jsx)(n,{color:r.dim,children:`${ne(b)} \xB7 ${w.length}`}):null,(0,y.jsx)(Kt,{rows:w,width:zn,badgeHeader:d[b]??"info"})]},b)),o&&o.unchanged.length>0&&(0,y.jsx)(n,{color:r.dim,children:` \u22EE unchanged: ${o.unchanged.map(b=>`${b.count} ${b.label}`).join(" \xB7 ")}`})]})}case"answer":return(0,y.jsx)(n,{color:r.dim,children:Xn(e.receipt)});case"continued":return(0,y.jsx)(n,{color:r.dim,children:"\u21B3 continued"});case"commit":return(0,y.jsxs)(T,{flexDirection:"column",children:[(0,y.jsx)(n,{color:e.ok?r.green:r.red,children:` ${e.ok?"\u2714":"\u2717"} ${e.line}`}),(e.warnings??[]).map((o,c)=>(0,y.jsx)(n,{color:r.dim,children:` \u26A0 ${o}`},`w-${c}`))]});case"error":return(0,y.jsxs)(Lt,{variant:"error",paddingX:1,children:[(0,y.jsx)(n,{color:r.red,children:e.title}),e.detail.map((o,c)=>(0,y.jsx)(n,{color:r.dim,children:o},`d-${c}`))]});case"interrupted":return(0,y.jsxs)(T,{flexDirection:"column",children:[(0,y.jsx)(n,{color:r.red,children:"interrupted \u2014 session not saved"}),e.detail?(0,y.jsx)(n,{color:r.dim,children:e.detail}):null]});case"pause":return(0,y.jsxs)(T,{flexDirection:"column",children:[(0,y.jsx)(n,{children:`paused: session ${e.sid} saved`}),e.expires_at?(0,y.jsx)(n,{color:r.dim,children:`expires: ${e.expires_at}`}):null,(0,y.jsx)(n,{children:`resume: ${e.resume}`}),e.messageForm?(0,y.jsx)(n,{children:`or say something on the way in: ${e.messageForm}`}):null]});case"summary":return(0,y.jsxs)(T,{flexDirection:"column",children:[(0,y.jsx)(n,{bold:!0,children:"session summary"}),e.lines.map((o,c)=>(0,y.jsx)(n,{children:` ${o}`},`s-${c}`))]})}}var xe=V(Q(),1);function Yt({item:e}){return(0,xe.jsxs)(T,{flexDirection:"column",marginLeft:2,children:[(e.cite??[]).map((s,o)=>(0,xe.jsx)(n,{dimColor:!0,children:`cite ${s.anchor??"conv"} \u2014 "${s.quote??""}"`},`cite-${o}`)),(e.depends_on_hint??[]).length>0&&(0,xe.jsx)(n,{dimColor:!0,children:`depends on: ${(e.depends_on_hint??[]).join(", ")}`}),Object.entries(e.extra??{}).map(([s,o])=>(0,xe.jsx)(n,{dimColor:!0,children:`${s}: ${o}`},`extra-${s}`))]})}var v=V(Q(),1),at=(e,s)=>Math.max(0,Math.min(s,e));function Ue(e,s,o){switch(s.type){case"move":return e.level==="detail"?{...e,scroll:Math.max(0,(e.scroll??0)+s.delta)}:{...e,cursor:at(e.cursor+s.delta,Math.max(0,o-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 en={"use-case":"use-cases",ac:"acs",scenario:"scenarios",test:"tests",gap:"gaps"};function tn(e,s){if(e.level==="detail")return{level:"detail",cursor:at(e.num-1,Math.max(0,s.entries.length-1))};if(e.section){let o=s.entries.findIndex(c=>en[c.kind]===e.section);if(o>=0)return{level:"list",cursor:o}}return{level:"list",cursor:0}}function Gn(e){let s=[];for(let o of e.entries){let c=s.find(d=>d.kind===o.kind);c?c.entries.push(o):s.push({kind:o.kind,entries:[o]})}return s}var Zt=3;function Jn({items:e,cursor:s,verb:o,more:c}){let d=`view \xB7 ${o} so far \xB7 ${e.counts.map(u=>`${u.count} ${u.count===1?u.label.replace(/s$/,""):u.label}`).join(" \xB7 ")}`,m=e.entries[s];return(0,v.jsxs)(T,{flexDirection:"column",borderStyle:"round",borderColor:r.dim,paddingX:1,children:[(0,v.jsx)(n,{bold:!0,children:d}),Gn(e).map(({kind:u,entries:g})=>{let h=m?.kind===u,I=h?g.findIndex(C=>C.ref===m.ref):-1,b=h?at(I-1,Math.max(0,g.length-Zt)):0,w=g.slice(b,b+(h?Zt:1)),D=g.length-w.length;return(0,v.jsxs)(T,{flexDirection:"column",children:[(0,v.jsx)(n,{color:r.dim,children:`${en[u]??ne(u)} \xB7 ${g.length}`}),w.map(C=>{let x=h&&C.ref===m.ref,R=C.item.badge;return(0,v.jsxs)(n,{children:[(0,v.jsx)(n,{color:r.assuranceAccent,children:x?"\u203A ":" "}),(0,v.jsx)(n,{children:`${C.num} \xB7 ${C.item.title}`}),R?(0,v.jsx)(n,{color:r.dim,children:` \xB7 ${R}`}):null]},`${C.kind}:${C.ref}`)}),D>0&&(0,v.jsx)(n,{color:r.dim,children:` \u22EE ${D} more`})]},u)}),c?(0,v.jsxs)(n,{children:[(0,v.jsx)(n,{color:r.assuranceAccent,children:s===e.entries.length?"\u203A ":" "}),(0,v.jsx)(n,{color:r.dim,children:`\u22EF show all \u2014 ${c.hidden} more from earlier turns`})]}):null,(0,v.jsx)(n,{color:r.dim,children:"\u2191\u2193 move \xB7 \u21B5 detail \xB7 esc back"})]})}var Ne=14;function Yn({items:e,cursor:s,explain:o,grandTotal:c,dossier:d,scroll:m=0}){let u=e.entries[s];if(!u)return(0,v.jsx)(n,{color:r.dim,children:"nothing to show"});if(d){let h=Math.max(0,Math.min(m,Math.max(0,d.lines.length-Ne))),I=d.lines.slice(h,h+Ne);return(0,v.jsxs)(T,{flexDirection:"column",borderStyle:"round",borderColor:r.dim,paddingX:1,children:[(0,v.jsxs)(n,{bold:!0,children:[`view \xB7 ${d.id}`,d.id.toLowerCase()!==d.rawId?(0,v.jsx)(n,{bold:!1,color:r.dim,children:` \xB7 ${d.rawId}`}):null]}),(0,v.jsx)(n,{bold:!0,children:d.title}),h>0?(0,v.jsx)(n,{color:r.muted,children:`\u22EE ${h} above`}):null,I.map((b,w)=>(0,v.jsx)(n,{color:b.dim?r.dim:void 0,children:b.text},`dl-${w}`)),d.lines.length>h+Ne?(0,v.jsx)(n,{color:r.muted,children:`\u22EE ${d.lines.length-h-Ne} more`}):null,(0,v.jsx)(n,{color:r.dim,children:"\u2191\u2193 scroll \xB7 esc back"})]})}let g=u.item;return(0,v.jsxs)(T,{flexDirection:"column",borderStyle:"round",borderColor:r.dim,paddingX:1,children:[(0,v.jsx)(n,{bold:!0,children:`view \xB7 ${u.kind} ${u.num} of ${c??e.entries.length}`}),(0,v.jsx)(n,{children:u.item.title}),g.badge?(0,v.jsx)(n,{color:r.dim,children:`kind: ${g.badge}`}):null,g.why?(0,v.jsx)(n,{color:r.dim,children:g.why}):null,(0,v.jsx)(Yt,{item:u.item}),o?.map((h,I)=>(0,v.jsx)(n,{color:r.dim,children:h},`ex-${I}`)),(0,v.jsx)(n,{color:r.dim,children:"view-only \u2014 approvals happen in chat"}),(0,v.jsx)(n,{color:r.dim,children:"\u2191\u2193 prev/next \xB7 esc back to list"})]})}function nn({items:e,state:s,verb:o,more:c,explain:d,grandTotal:m,dossier:u=null}){return s.level==="list"?(0,v.jsx)(Jn,{items:e,cursor:s.cursor,verb:o,more:c}):(0,v.jsx)(Yn,{items:e,cursor:s.cursor,explain:d,grandTotal:m,dossier:u,scroll:s.scroll??0})}var Zn={"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 rn(e){let s=(e??"").trim().toLowerCase();if(!s)return{level:"list"};if(/^\d+$/.test(s)){let c=parseInt(s,10);return c>=1?{level:"detail",num:c}:{error:"items are numbered from 1 \u2014 /view 1"}}let o=Zn[s];return o?{level:"list",section:o}:{error:"try /view, /view <number>, or /view acs|scenarios|tests"}}var A=V(Q(),1),er=6,sn=12;function tr(e,s,o){let c=Math.max(20,s),d=[];for(let u of e.split(`
|
|
3
|
-
`)){if(u.length<=c){d.push(u);continue}let g="";for(let h of u.split(" "))g&&g.length+1+h.length>c?(d.push(g),g=h):g=g?`${g} ${h}`:h;d.push(g)}let m=Math.max(0,d.length-o);return{body:d.slice(-o).join(`
|
|
4
|
-
`),hidden:m}}var je=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function on(e){let s={key:"redesign",label:"re-design from scratch",detail:"replaces the current design"},o={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"},o]:[o,s]}function Kr({controller:e,verb:s="extract",onCtrlC:o,chain:c=null,inspect:d=null}){let[,m]=(0,p.useState)(0),[u,g]=(0,p.useState)(!1),[h,I]=(0,p.useState)(null),[b,w]=(0,p.useState)(null),D=(0,p.useRef)(null),[C,x]=(0,p.useState)(null),R=(0,p.useRef)(null),L=t=>{R.current=t,x(t)},S=t=>{D.current=t,w(t),t===null&&L(null)},B=(0,p.useRef)([]),[f,U]=(0,p.useState)(null),O=(0,p.useRef)(null),q=t=>{O.current=t,U(t)},le=Mt(),{stdout:ae}=qe(),Ae=ae?.columns??80,be=(0,p.useRef)(0),ke=(0,p.useRef)(0);(0,p.useEffect)(()=>{let t=()=>{let i=e.state.ledger;for(let k=be.current;k<i.length;k++){let $=i[k],_=$.kind==="turn"?Gt(e.state.turns,$.turnIndex):void 0;le.append((0,A.jsx)(Jt,{block:$,annotations:_},`lg-${k}`))}be.current=i.length};t();let a=e.subscribe(()=>{t();let i=e.state;D.current&&(i.pending||i.status==="pausing")&&(S(null),i.pending&&I("questions arrived \u2014 back to chat")),m(k=>k+1)});return m(i=>i+1),a},[e,le]);let{thinking:re,status:Z,pending:M,confirm:ce,ledger:j,activeTurn:ee,stream:F,notice:P}=e.state,X=(F?.text??"").trimEnd(),ye=X.length>0,ln=u&&(re.liveThinking.length>0||re.thinkingLog.length>0),an=tr(re.liveThinking||re.thinkingLog.map(t=>t.text).join(`
|
|
5
|
-
`),Ae-6,sn),ct=ye?X.split(`
|
|
6
|
-
`).slice(-er):[];ee&&(ke.current=ee.turnIndex);let cn=M?M.resolution.filter(t=>!t).length:0,ut;for(let t=j.length-1;t>=0;t--){if(B.current.some(i=>i.end!=null&&t>=i.start&&t<i.end))continue;let a=j[t];if(a.kind==="banner"&&!a.text.startsWith("kane")){ut=a.text;break}}let Te=re.activity[re.activity.length-1],Ve=Te?Te.status==="decision"?Te.label:Ft({name:Te.name,status:Te.status}):void 0,dt=Z==="streaming"||Z==="working",[mt,un]=(0,p.useState)(0);Et(()=>un(t=>t+1),dt||f?.kind==="running"?120:null);let dn=e.state.busySince?Math.floor((Date.now()-e.state.busySince)/1e3):0,mn=ye?"Writing\u2026":Ve?`${Ve.charAt(0).toUpperCase()}${Ve.slice(1)}\u2026`:e.state.workingLabel??(s==="design"?"Designing\u2026":"Thinking\u2026"),gn=e.state.turns.some(t=>t.role==="agent"),[fn,pn]=(0,p.useState)(0),[hn,xn]=(0,p.useState)(!1),[gt,bn]=(0,p.useState)(null),ue=(0,p.useRef)(0),ft=(0,p.useRef)(!1),pt=(0,p.useRef)(null),we=t=>{ue.current=t,pn(t)},ht=t=>{ft.current=t,xn(t)},de=t=>{pt.current=t,bn(t)},[Be,kn]=(0,p.useState)(null),Ke=(0,p.useRef)(null),me=t=>{Ke.current=t,kn(t)},[xt,yn]=(0,p.useState)(null),bt=(0,p.useRef)(null),$e=t=>{bt.current=t,yn(t)},[Qe,Tn]=(0,p.useState)(0),K=(0,p.useRef)(0),ve=t=>{K.current=t,Tn(t)},kt=M?M.questions[0]?.id??"b":null;(0,p.useEffect)(()=>{M&&ve(M.cursor<0?0:M.cursor)},[kt,M?.cursor]);let De=()=>{let t=H.current;if(!t)return;let a=t.questions.length;for(let i=1;i<=a;i++){let k=(K.current+i)%a;if(!t.resolution[k]){ve(k);return}}},yt=M?M.questions[Math.max(0,Math.min(M.questions.length-1,Qe))]:void 0,z=(0,p.useRef)(yt);z.current=yt;let H=(0,p.useRef)(M);H.current=M;let wn=M?`${kt}:${Qe}`:null;(0,p.useEffect)(()=>{if(de(null),me(null),$e(null),z.current){ht(!0);let t=H.current?.resolution[K.current]?.selected_index;we(t??z.current.recommended_index??0)}else ht(!1)},[wn]);let Ee=t=>{let a=H.current;return it(t,a?Fe(a)!=="":!1)},$n={isFocused:()=>ft.current&&z.current!=null&&pt.current==null&&Ke.current==null&&bt.current==null||O.current!=null&&O.current.kind!=="running"||G.current&&Bt.current==null,onMove:t=>{let a=z.current;if(a){we(Math.max(0,Math.min(Ee(a).maxSel,ue.current+t)));return}let i=O.current;if(i?.kind==="picker"){q({...i,sel:Math.max(0,Math.min(i.items.length-1,i.sel+t))});return}if(i?.kind==="ask"||i?.kind==="confirm"||i?.kind==="failed"){let k=(i.kind==="ask"?Me.current.length:i.kind==="failed"?_e.current.length:2)-1;q({...i,sel:Math.max(0,Math.min(k,i.sel+t))});return}i&&!G.current||G.current&&fe(Math.max(0,Math.min(Re.current.length-1,nt.current+t)))},onSelect:()=>{let t=z.current,a=H.current;if(!t||!a){let $=O.current;if($?.kind==="picker"){let W=$.items[$.sel];W&&(W.designed?q({kind:"confirm",item:W,sel:0}):Ye(W,!1));return}if($?.kind==="confirm"){on($.item)[$.sel]?.key==="redesign"?Ye($.item,!0):Je();return}if($?.kind==="ask"){let W=Me.current[$.sel]?.key;W==="another"?Je():W==="view"?rt(""):q(null);return}if($?.kind==="failed"){let W=_e.current[$.sel]?.key;W==="retry"?Ye($.item,$.force):W==="view"?rt(""):q(null);return}if($&&!G.current||!G.current)return;switch(Re.current[nt.current]?.key){case"finish":e.completeSession();return;case"continue":e.continueParked();return;case"design-chain":Je();return;case"view":rt("",ke.current);return;case"free":pe("");return}return}let i=Ee(t),k=ue.current;if(i.batchIdx!=null&&k===i.batchIdx){e.goWithRecommendations();return}if(i.freeIdx!=null&&k===i.freeIdx){de("");return}if(i.doneIdx!=null&&k===i.doneIdx){e.confirmMulti(K.current),De();return}if(t.multi_select){e.toggleOption(K.current,k);return}if(t.options[k]?.input===!0){me({opt:k,value:""});return}e.submitAnswer(K.current,k),De()},onLeft:()=>{H.current&&ve(Math.max(0,K.current-1))},onRight:()=>{let t=H.current;t&&ve(Math.min(t.questions.length-1,K.current+1))},onDigit:t=>{let a=z.current;if(a){t-1<a.options.length&&we(t-1);return}let i=O.current;if(i?.kind==="picker"){t-1<i.items.length&&q({...i,sel:t-1});return}if(i?.kind==="ask"){t-1<Me.current.length&&q({...i,sel:t-1});return}if(i?.kind==="failed"){t-1<_e.current.length&&q({...i,sel:t-1});return}if(i?.kind==="confirm"){t-1<2&&q({...i,sel:t-1});return}if(!(i&&!G.current)&&G.current){let k=Re.current,$=0;for(let _=0;_<k.length;_++)if(!k[_].free&&($+=1,$===t)){fe(_);return}}},isMulti:()=>{let t=z.current;return!!t?.multi_select&&ue.current<(t?.options.length??0)},onSpace:()=>{H.current&&e.toggleOption(K.current,ue.current)},onTab:()=>{let t=z.current;if(!t)return;let a=Ee(t);a.batchIdx!=null&&we(a.batchIdx)},onType:t=>{let a=z.current;if(a){if(t==="@"&&e.canIngest()){$e("");return}let i=ue.current;if(a.options[i]?.input===!0){me({opt:i,value:t});return}if(!a.allow_free_text)return;let k=Ee(a);we(k.freeIdx??0),de(t);return}if(!(O.current&&!G.current)&&G.current){let i=Wt(Re.current);if(i==null)return;fe(i),pe(t)}},onBack:()=>{let t=O.current;if(t&&t.kind!=="running"){q(null);return}let a=H.current;if(a){for(let i=K.current-1;i>=0;i--)if(a.resolution[i]){ve(i);return}}}},vn=gt!=null?{value:gt,onChange:t=>de(t),onSubmit:t=>{de(null),t.trim()&&H.current&&(e.submitFreeText(K.current,t),De())},onCancel:()=>de(null)}:null,Sn=xt!=null?{value:xt,onChange:t=>$e(t),onSubmit:t=>{$e(null),t.trim()&&e.ingestAttach(t)},onCancel:()=>$e(null)}:null,In=Be!=null?{optionIndex:Be.opt,value:Be.value,onChange:t=>me({opt:Be.opt,value:t}),onSubmit:t=>{let a=Ke.current?.opt;me(null),a!=null&&H.current&&(e.submitAnswerWithText(K.current,a,t),De())},onCancel:()=>me(null)}:null,Tt=o??(()=>e.requestPause()),ie=e.state.checkpoint,Se=f?.kind==="running"&&Z==="idle",Ie=Z==="idle"&&gn&&!M&&!b&&(!f||Se),G=(0,p.useRef)(!1);G.current=Ie;let J=oe(e.state.turns).entries.length,Ce,Y;for(let t=j.length-1;t>=0;t--){if(B.current.some(i=>i.end!=null&&t>=i.start&&t<i.end))continue;let a=j[t];if(!Ce&&a.kind==="commit"&&a.ok&&(Ce=a.line),!Y&&a.kind==="banner"&&a.text.startsWith("designing: ")&&(Y=a.text.slice(11)),Ce&&Y)break}let He;for(let t=j.length-1;t>=0;t--){let a=j[t];if(a.kind==="user")break;if(a.kind==="commit"&&a.ok&&/\bapplied\b/.test(a.line)){He=a.line;break}}let te=Y?{"acceptance criteria":"scenarios",scenarios:"acceptance criteria + exercises","acceptance criteria + exercises":"tests + gaps"}[Y]:void 0,wt={"acceptance criteria":"the promises every path of this use-case must keep",scenarios:"the concrete user journeys that exercise those promises","acceptance criteria + exercises":"the wiring pass \u2014 per-journey checks, tied to the promises each journey exercises","tests + gaps":"runnable browser tests \u2014 anything unautomatable is recorded as a gap"},$t=Y?wt[Y]:void 0,vt=te?wt[te]:void 0,Cn="phases: acceptance criteria \u2192 scenarios \u2192 wiring \u2192 tests \xB7 stop anytime with finish",Rn=(()=>{for(let t=j.length-1;t>=0;t--){let a=j[t];if(a.kind==="agent")return a.text}return null})(),ge=/\?\s*$/.test((Rn??"").trimEnd()),St=s==="design"&&!ie&&(ge||te!==void 0),It=Y==="tests + gaps",Le=f?.kind==="running"?f.title:"the design",Ct=!!e.state.error&&!e.senderAlive(),An=ce?"the agent needs a clarification before it can apply that":Se&&!ie?ge?`${Le} \u2014 the agent asked a question`:He?`${Le} \u2014 ${He}`:It?`${Le} \u2014 design complete`:`${Le} \u2014 the agent is waiting on you`:ie?Y?`${Y} done${te?` \u2014 next: ${te}`:""}`:Ce??"phase done":Ct?"the agent stopped \u2014 the session is view-only":St?ge?"the agent asked a question \u2014 answer or continue":`design incomplete \u2014 ${te} not started`:Ce??"waiting on you",Xe=ce?[{key:"free",label:"clarify \u2014 type which one you meant",free:!0}]:Se&&!ie?It&&!ge?[{key:"finish",label:"finish this design"},...J>0?[{key:"view",label:"view what's saved"}]:[],{key:"free",label:"reply \u2014 tell the agent what to change",free:!0}]:[{key:"continue",label:ge?"continue \u2014 go with your suggestion":"continue designing"},...J>0?[{key:"view",label:"view what's saved"}]:[],{key:"finish",label:"finish this design"},{key:"free",label:"reply \u2014 tell the agent what to change",free:!0}]:ie?[{key:"continue",label:te?`continue to ${te}`:"continue"},...J>0?[{key:"view",label:"view what's saved"}]:[],{key:"finish",label:"finish here"},{key:"free",label:"adjust \u2014 tell me what to change",free:!0}]:Ct?[...J>0?[{key:"view",label:"view what's saved"}]:[],{key:"free",label:"tell me what to change",free:!0}]:St?[{key:"continue",label:ge?"continue \u2014 go with your suggestion":`continue \u2014 ${te} next`},...J>0?[{key:"view",label:"view the design"}]:[],{key:"finish",label:"finish anyway"},{key:"free",label:"reply \u2014 answer and continue",free:!0}]:[{key:"finish",label:s==="design"?"finish":"looks good \u2014 finish the session"},...c?[{key:"design-chain",label:"design tests for a use-case\u2026"}]:[],...J>0?[{key:"view",label:s==="design"?"view the design":`view the ${J} draft${J===1?"":"s"}`}]:[],{key:"free",label:s==="design"?"keep adjusting \u2014 tell me what to change":"tell me what to change",free:!0}],ze=[{key:"another",label:"design another use-case\u2026"},...J>0?[{key:"view",label:"view what was designed"}]:[],{key:"back",label:"done \u2014 back"}],Me=(0,p.useRef)(ze);Me.current=ze;let Ge=[{key:"retry",label:"try again"},...J>0?[{key:"view",label:"view what's saved"}]:[],{key:"back",label:"back"}],_e=(0,p.useRef)(Ge);_e.current=Ge;let Je=()=>{let t=c?.listUcs()??[];if(t.length===0){I("no use-cases to design yet");return}q({kind:"picker",items:t,sel:0})},Ye=(t,a)=>{let i={start:e.state.ledger.length,end:null};B.current.push(i);let k=()=>{i.end=e.state.ledger.length};q({kind:"running",title:t.title,item:t,force:a,startedAt:Date.now()}),c.runDesignChild(t.key,a).then($=>{k(),$===0?(e.ledger({kind:"commit",ok:!0,line:`designed ${t.title}`}),q({kind:"ask",title:t.title,sel:0})):(e.ledger({kind:"commit",ok:!1,line:`design for ${t.title} failed \u2014 child exited ${$}`}),q({kind:"failed",item:t,force:a,detail:`child exited ${$}`,sel:0}))}).catch($=>{k();let _=$ instanceof Error?$.message:String($);e.ledger({kind:"commit",ok:!1,line:`design for ${t.title} failed \u2014 ${_}`}),q({kind:"failed",item:t,force:a,detail:_,sel:0})})},Re=(0,p.useRef)(Xe);Re.current=Xe;let Ze=Ie&&ie&&$t!==void 0,et=B.current.find(t=>t.end==null)?.start??"top",Rt=(0,p.useRef)(new Set),[Bn,At]=(0,p.useState)(!1);(0,p.useEffect)(()=>{Ze?Rt.current.has(et)||(Rt.current.add(et),At(!0)):At(!1)},[Ze,et]);let Dn=Ze?[...Bn?[Cn]:[],`${$t}${vt?` \xB7 next: ${vt}`:""}`]:[],[En,Ln]=(0,p.useState)(0),[tt,Mn]=(0,p.useState)(null),nt=(0,p.useRef)(0),Bt=(0,p.useRef)(null),fe=t=>{nt.current=t,Ln(t)},pe=t=>{Bt.current=t,Mn(t)},_n=`${Ie}:${ie}:${ke.current}`;(0,p.useEffect)(()=>{fe(0),pe(null)},[_n]);let On=tt!=null?{value:tt,onChange:t=>pe(t),onSubmit:t=>{pe(null),fe(0);let a=t.trim();a&&(I(null),e.submit(a))},onCancel:()=>{pe(null),fe(0)}}:null,rt=(t,a)=>{if(/^(uc|sc|ac|t|gap|sty)-\d+$/i.test(t.trim())){let _=t.trim().toLowerCase(),Oe=oe(e.state.turns).entries.findIndex(N=>(N.item.logical_id??"").toLowerCase()===_);if(Oe<0){I(`${t.trim().toUpperCase()} isn't in this session's items \u2014 view lists what this session minted`);return}S({level:"detail",cursor:Oe,scroll:0}),L(null);return}let i=rn(t);if("error"in i){I(i.error);return}let k=oe(e.state.turns);if(k.entries.length===0){I("nothing proposed yet \u2014 the first turn is still coming");return}if(i.level==="detail"&&i.num>k.entries.length){I(`no item ${i.num} \u2014 the set has ${k.entries.length} item${k.entries.length===1?"":"s"}`);return}let $=a!=null?lt(k,a):k;S(tn(i,$)),L(a!=null&&$.entries.length<k.entries.length?a:null)},Dt=(0,A.jsx)(Ut,{verb:s,subject:ut,pendingCount:cn,creditsTotal:e.state.credits?.total,state:Se?"waiting on you":M||Ie||b||f&&f.kind!=="running"?"idle":void 0});if(b){let t=oe(e.state.turns),a=C!=null?lt(t,C):t,i=t.entries.length-a.entries.length,k=b.level==="list"&&i>0,$=a.entries.length+(k?1:0),_=a.entries[b.cursor],W=b.level==="detail"&&_?e.explainLines(_.item.slug??_.item.temp_ref):null,Oe=b.level==="detail"&&_&&d?d(_.item.logical_id??e.aliasOf(_.item.temp_ref)??_.item.temp_ref):null;return(0,A.jsxs)(T,{flexDirection:"column",children:[(0,A.jsx)(st,{onToggleThinking:()=>g(N=>!N),onCtrlC:Tt,explorer:{isOpen:()=>D.current!==null,onMove:N=>S(D.current&&Ue(D.current,{type:"move",delta:N},$)),onEnter:()=>{let N=D.current;if(N){if(N.level==="list"&&k&&N.cursor===a.entries.length){L(null);return}S(Ue(N,{type:"enter"},$))}},onBack:()=>{S(D.current&&Ue(D.current,{type:"back"},$)),setTimeout(()=>m(N=>N+1),0)}}}),(0,A.jsx)(nn,{items:a,state:b,verb:s,more:k?{hidden:i}:null,explain:W,grandTotal:t.entries.length,dossier:Oe}),(P??h)&&(P??h).split(`
|
|
7
|
-
`).map((N,qn)=>(0,A.jsx)(n,{color:r.orange,children:N},`nt-${qn}`)),Dt]})}return(0,A.jsxs)(T,{flexDirection:"column",children:[(0,A.jsx)(st,{onToggleThinking:()=>g(t=>!t),onCtrlC:Tt,panel:$n}),ln&&(0,A.jsx)(qt,{thinking:an.body,expanded:!0,thinkingDone:Z!=="streaming",maxLines:sn+1}),ct.length>0&&(0,A.jsx)(T,{flexDirection:"column",children:ct.map((t,a)=>(0,A.jsx)(n,{children:_t(t).map((i,k)=>(0,A.jsx)(n,{bold:i.bold,italic:i.italic,color:i.code?r.dim:void 0,children:i.text},k))},`st-${a}`))}),M&&(0,A.jsx)(jt,{batch:M,qView:Qe,sel:fn,focused:hn,freeText:vn,optionText:In,attach:Sn,canAttach:e.canIngest(),multiSelFor:t=>e.multiSelection(t)}),ce&&(0,A.jsx)(n,{color:"yellow",children:ce.prompt}),(P??h)&&(P??h).split(`
|
|
8
|
-
`).map((t,a)=>(0,A.jsx)(n,{color:r.orange,children:t},`nt-${a}`)),dt&&!M&&(0,A.jsxs)(n,{color:r.assuranceAccent,children:[`${je[mt%je.length]} ${mn} `,(0,A.jsx)(n,{color:r.dim,children:`(${dn}s)`})]}),Ie&&(0,A.jsx)(he,{headline:An,rows:Xe,sel:En,focused:tt==null,legend:"\u2191\u2193 \xB7 \u23CE select \xB7 type = your own words",freeText:On,sublines:Dn}),f?.kind==="picker"&&(0,A.jsx)(he,{ask:!0,headline:"design tests for which use-case?",rows:f.items.map(t=>({key:t.key,label:t.title,detail:t.badge})),sel:f.sel,focused:!0,legend:"\u2191\u2193 \xB7 \u23CE select \xB7 esc back"}),f?.kind==="confirm"&&(0,A.jsx)(he,{ask:!0,headline:`${f.item.title} is already designed${f.item.designed==="stale"?" \u2014 and the use-case has changed since":""}`,rows:on(f.item).map(t=>({key:t.key,label:t.label,detail:t.detail})),sel:f.sel,focused:!0,legend:"\u2191\u2193 \xB7 \u23CE select \xB7 esc back"}),f?.kind==="running"&&!Se&&(0,A.jsxs)(n,{color:r.assuranceAccent,children:[`${je[mt%je.length]} Designing ${f.title}\u2026 `,(0,A.jsx)(n,{color:r.dim,children:`(${Math.floor((Date.now()-f.startedAt)/1e3)}s)`})]}),f?.kind==="ask"&&(0,A.jsx)(he,{headline:`designed ${f.title}`,rows:ze,sel:f.sel,focused:!0,legend:"\u2191\u2193 \xB7 \u23CE select \xB7 esc back"}),f?.kind==="failed"&&(0,A.jsx)(he,{headline:`design failed \u2014 ${f.item.title} (${f.detail})`,rows:Ge,sel:f.sel,focused:!0,legend:"\u2191\u2193 \xB7 \u23CE select \xB7 esc back"}),Z==="pausing"&&(0,A.jsx)(n,{color:r.dim,children:"pausing \u2014 saving session\u2026 (ctrl+c again = force quit)"}),Dt]})}export{Kr as ChatSurface,tr as tailVisualRows};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as p,b as l,c as n}from"./chunk-73C4PRYU.js";import{y as o}from"./chunk-C4G7RVJ6.js";import{a as g}from"./chunk-HCBYKLMW.js";import{a,j as c}from"./chunk-C44QQJR4.js";import{a as R}from"./chunk-6YGTRKDT.js";import{e as t}from"./chunk-UR6MHSHU.js";var b=t(R(),1);var e=t(g(),1);function A({model:d,authLabel:v,profile:x,env:w,defaultUrl:u,projectId:r,projectName:s,folderId:i,folderName:f,windowSize:B,chromeProfile:C}){let h=r?s?`${s} (${r})`:r:"(none)",D=i?f?`${f} (${i})`:i:"(none)",{exit:m}=c();return(0,b.useEffect)(()=>{let P=setTimeout(()=>m(),50);return()=>clearTimeout(P)},[m]),(0,e.jsx)(a,{flexDirection:"column",children:(0,e.jsx)(p,{title:"Configuration",children:(0,e.jsxs)(a,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(n,{label:"Auth"}),(0,e.jsx)(l,{label:" method",value:v}),(0,e.jsx)(l,{label:" profile",value:x}),(0,e.jsx)(l,{label:" env",value:w}),(0,e.jsx)(n,{label:"Defaults"}),(0,e.jsx)(l,{label:" url",value:u??"(none)",valueColor:u?o.orange:o.dim}),(0,e.jsx)(l,{label:" model",value:d}),(0,e.jsx)(l,{label:" window",value:B}),(0,e.jsx)(l,{label:" project",value:h}),(0,e.jsx)(l,{label:" folder",value:D}),(0,e.jsx)(n,{label:"Paths"}),(0,e.jsx)(l,{label:" chrome",value:C,valueColor:o.dim})]})})})}export{A as ConfigView};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-2KBD6JZX.js";import"./chunk-DQ54MH7F.js";import"./chunk-FCMLIK7P.js";import"./chunk-CJJXT5DO.js";import"./chunk-QM4S2APK.js";import"./chunk-ZPDM6FO7.js";import"./chunk-EHN5HTUD.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-L5LI2JF4.js";import"./chunk-RFHMDQXZ.js";import"./chunk-GW5DWAXY.js";import"./chunk-T63R6QT4.js";import"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-W6VD2XFO.js";import"./chunk-5EOX4MEY.js";import"./chunk-JRMDGLLT.js";import"./chunk-C4G7RVJ6.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as EvidenceViewOffer};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b}from"./chunk-323MLBYA.js";import"./chunk-YCCUBQY4.js";import"./chunk-KNDSQ4PS.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-JRMDGLLT.js";import"./chunk-4OPQJ7PE.js";import"./chunk-C4G7RVJ6.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as FolderPicker,a as formatFolderLine};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-SRDHPKJT.js";import"./chunk-RNSSM2BK.js";import"./chunk-3FN5VJMV.js";import"./chunk-L5LI2JF4.js";import"./chunk-TDPWFYTJ.js";import"./chunk-DXV6MBTD.js";import"./chunk-KT6G7AF2.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-JKTFTF24.js";import"./chunk-323MLBYA.js";import"./chunk-YCCUBQY4.js";import"./chunk-KNDSQ4PS.js";import"./chunk-W6VD2XFO.js";import"./chunk-5EOX4MEY.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-JRMDGLLT.js";import"./chunk-VE3SUJMA.js";import"./chunk-F6ZOJXYU.js";import"./chunk-4OPQJ7PE.js";import"./chunk-C4G7RVJ6.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as SingleShotApp};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{g as a}from"./chunk-NBKQT7LJ.js";import"./chunk-IXVOXJP6.js";import"./chunk-UI7KULSI.js";import"./chunk-TDPWFYTJ.js";import"./chunk-DXV6MBTD.js";import"./chunk-R2RGSO4B.js";import"./chunk-5Y2G4NC7.js";import"./chunk-W6VD2XFO.js";import"./chunk-5EOX4MEY.js";import"./chunk-JRMDGLLT.js";import"./chunk-APAIWBIH.js";import"./chunk-73C4PRYU.js";import"./chunk-DFS4RMVP.js";import"./chunk-C4G7RVJ6.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as TestMdRunView};
|
package/dist/bind-AACBTSAA.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as b}from"./chunk-HJERKSBK.js";import"./chunk-IBNC444G.js";import"./chunk-KHU7C6EE.js";import"./chunk-KVQOBPAZ.js";import"./chunk-AM5S4KG4.js";import"./chunk-5JTUL6XL.js";import"./chunk-O56PUUNL.js";import"./chunk-NRC2G4Y5.js";import"./chunk-BQHKBOSF.js";import"./chunk-2XGDWUJ5.js";import"./chunk-BB2W35TW.js";import"./chunk-VGFTNLQQ.js";import"./chunk-L2TV4G56.js";import"./chunk-JFAFKHDX.js";import"./chunk-5KFS3GAZ.js";import"./chunk-EV3EHXEI.js";import"./chunk-F7WKDMX7.js";import"./chunk-VOHQA2SP.js";import"./chunk-XDHZMCTA.js";import"./chunk-AAONIIQV.js";import"./chunk-YKTYVJBN.js";import"./chunk-CVOGP253.js";import"./chunk-427OQS2N.js";import"./chunk-ZLCZDAEX.js";import"./chunk-SE6WNCYU.js";import"./chunk-DNNZ353O.js";import"./chunk-Q2F5QB2W.js";import"./chunk-GVIPTX6T.js";import"./chunk-ZPDM6FO7.js";import"./chunk-NVGBE2DR.js";import{a as g}from"./chunk-CH273NAE.js";import"./chunk-L5LI2JF4.js";import"./chunk-GW5DWAXY.js";import"./chunk-T63R6QT4.js";import"./chunk-3STZLM5J.js";import"./chunk-L4JIMNKW.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-5EOX4MEY.js";import"./chunk-C4G7RVJ6.js";import"./chunk-UR6MHSHU.js";import{existsSync as N}from"fs";var O=new Set(["interactive","agent","ci","override"]);function Y(e){return e.mode!=null&&!O.has(e.mode)?{error:`design: --mode must be interactive | agent | ci | override, got '${e.mode}'`}:e.strength!=null&&e.strength!=="pairwise"&&e.strength!=="3-wise"?{error:`design: --strength must be pairwise | 3-wise, got '${e.strength}'`}:e.max!=null&&(!Number.isInteger(e.max)||e.max<1)?{error:"design: --max must be a positive integer"}:!e.useCase&&!e.resume?{error:"design: --use-case is required (or --resume <sid> \u2014 the session remembers its use-case)"}:{useCase:e.useCase,max:e.max,strength:e.strength,mode:e.mode,force:e.force,resume:e.resume,plan:e.plan,message:e.message,phase:e.phase,allowUnreviewed:e.allowUnreviewed,because:e.because,changeDelta:e.changeDelta,priorDesign:e.priorDesign}}async function B(e){let l=async(t,n)=>{if(process.stderr.write(t+`
|
|
3
|
-
`),e.mode!=="agent")return 2;let{makeHeadlessIO:s,agentRefusal:d}=await import("./headless-io-BL3TEAX5.js");return d(s("ndjson","design"),t,n)},h=Y(e);if("error"in h)return l(h.error);let i=h;{let{validateResumeMessage:t}=await import("./headless-io-BL3TEAX5.js"),n=t(i,"design");if(n)return l(n)}{let{gateStructuredFlags:t}=await import("./structured-answers-QHFGZPSS.js"),n=t(e,"design");if(n)return l(n,"STRUCTURED_FLAGS_USAGE")}if(!N(g(process.cwd())))return l("error: no context store here (run `kane-cli context ingest` + `kane-cli context extract` first)","NO_STORE");let v=!!i.resume;if(i.useCase&&i.resume&&!e.allowUnreviewed)try{let{peekSession:t}=await import("./sessions-BLXZVK5U.js"),n=t(g(process.cwd()),i.resume);v=!!(n&&n.use_case===i.useCase)}catch{v=!1}if(i.useCase&&!v&&!e.allowUnreviewed)try{let[{openGraph:t},{designEntryCheck:n}]=await Promise.all([import("./readmodel-X7L7W2BA.js"),import("./trust-gate-EX7R2P4Y.js")]),s=n(t(g(process.cwd())),i.useCase);if(!s.ok&&(s.code==="UC_UNREVIEWED"||s.code==="UC_ARCHIVED"))if((i.mode??"interactive")==="interactive"&&process.stdin.isTTY&&process.stdout.isTTY){let{createInterface:m}=await import("readline/promises"),c=m({input:process.stdin,output:process.stderr}),p=(await c.question(`design: ${s.detail}
|
|
4
|
-
Design against it anyway? (y/N) `)).trim().toLowerCase();if(c.close(),p!=="y"&&p!=="yes")return process.stderr.write(`aborted \u2014 approve it first: ${s.reviewCmd}
|
|
5
|
-
`),2}else if(e.mode==="agent"){let{makeHeadlessIO:m}=await import("./headless-io-BL3TEAX5.js"),c=m("ndjson","design");return c.event({type:"error",code:s.code,message:`design: ${s.detail}`,next:[s.reviewCmd]}),c.event({type:"done",status:"refused",exit_code:2,next:[s.reviewCmd,`kane-cli design tests --use-case ${i.useCase} --mode agent --allow-unreviewed`]}),2}else return process.stderr.write(`design: ${s.detail} (${s.reviewCmd})
|
|
6
|
-
`),2}catch(t){process.env.KANE_DEBUG&&process.stderr.write(`trust gate skipped: ${String(t)}
|
|
7
|
-
`)}let r=null,y=null;try{if(!i.mode&&!process.stdin.isTTY)return process.stderr.write(`design: no TTY \u2014 pass an explicit --mode agent|ci|override to run headless
|
|
8
|
-
`),2;let t=i.mode??"interactive";if(t==="interactive"){if(!process.stdin.isTTY||!process.stdout.isTTY)return process.stderr.write(`design: --mode interactive needs a TTY on stdin and stdout (use --mode agent|ci|override headless)
|
|
9
|
-
`),2;let{bindDesignInteractive:o}=await import("./interactive-bind-43HGDF5K.js");return await o(i)}let{resolveAgentAuthEnv:n}=await import("./spawner-AH5FTUYU.js"),{runAgent:s}=await import("./bridge-T4HL4TG7.js"),{preflightTurn:d}=await import("./turn-preflight-JGYT7LXP.js"),{makeInterruptGuard:m}=await import("./interrupt-guard-UREUWNRL.js"),{baseUrlAdvisory:c}=await import("./turn-preflight-JGYT7LXP.js"),{makeHeadlessIO:p,resolveEncoding:k,guardedChannels:S}=await import("./headless-io-BL3TEAX5.js"),{withStructuredNext:_,prepareStructuredResume:A}=await import("./structured-answers-QHFGZPSS.js");r=_(p(k(t),"design"));let{telemetryBootstrap:R,telemetryEnvName:U}=await import("./bootstrap-CNOZ5VRB.js"),u=R({verb:"design",mode:t,contextRoot:g(process.cwd()),env:U(),resumeSid:i.resume,write:!0,longSession:!0});y=o=>u.end(o);let x={...await n(),...u.spawnEnv()},a=A({opts:e,contextDir:g(process.cwd()),verb:"design"});if(a.kind==="refuse")return r.out(a.error),t==="agent"&&r.event({type:"error",message:a.error,code:a.code}),await u.end({exit_code:2}),t==="agent"?r.done(2,"refused"):2;let T;if(a.kind==="apply"){for(let o of a.notes)r.out(o);if(a.matchedQids.length>0){r.out(`applying ${a.matchedQids.length} structured answer(s) from --answer to the paused session's pending questions`);for(let o of a.matchedQids)r.event({type:"panel_resolved",id:o,by:"user",via:"flag"})}a.statement&&(T=[i.message,a.statement].filter(Boolean).join(`
|
|
10
|
-
|
|
11
|
-
`))}let E=c();E&&r.out(E);let f=m(s,o=>r.out(o)),C=S(r,()=>f.interrupted(),/^error: (design agent failed|the design agent ended)/);try{let o=t==="interactive"&&process.stdin.isTTY&&process.stdout.isTTY?async $=>{let{createInterface:I}=await import("readline/promises"),D=I({input:process.stdin,output:process.stdout});try{return/^y(es)?$/i.test((await D.question(`${$} [y/N] `)).trim())}finally{D.close()}}:void 0,w=await b({...i,mode:t,...T!==void 0?{message:T}:{},...o?{confirmRetarget:o}:{}},{contextDir:g(process.cwd()),agent:f.agent,preflightTurn:()=>d(x),ask:async()=>[],out:C.out,emit:C.emit,progress:r.progress,isTTY:!1,auth:x,telemetry:u});return f.interrupted()&&w!==3?(r.out("interrupted \u2014 no session saved"),await u.end({exit_code:130}),r.done(130)):(w===1&&r.out(u.supportFooter()),await u.end({exit_code:w}),r.done(w))}finally{f.dispose()}}catch(t){y&&await y({exit_code:1}).catch(()=>{});let n=t instanceof Error?t.message:String(t);r?.event({type:"error",message:`error: design failed: ${n}`});let s=r?d=>r.out(d):d=>process.stderr.write(d+`
|
|
12
|
-
`);return s(`error: design failed: ${n}`),(process.env.ASSURANCE_LOG_LEVEL??"").toLowerCase()==="debug"&&t instanceof Error&&t.stack&&s(t.stack),s('hint: the full trace is in the file named on the "trace:" line at the start of this run'),r?r.done(1):1}}export{B as designTestsCommand};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b}from"./chunk-IQDWBTRJ.js";import"./chunk-GVIPTX6T.js";import"./chunk-BKM2LWU2.js";import"./chunk-2XMJ6YAE.js";import"./chunk-W6VD2XFO.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-C4G7RVJ6.js";import"./chunk-UR6MHSHU.js";export{b as telemetryBootstrap,a as telemetryEnvName};
|
package/dist/bridge-T4HL4TG7.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as V,c as te}from"./chunk-JFAFKHDX.js";import{a as k,b as ee}from"./chunk-5KFS3GAZ.js";import{a as ne}from"./chunk-427OQS2N.js";import{d as Z}from"./chunk-NVGBE2DR.js";import{a as X}from"./chunk-GW5DWAXY.js";import"./chunk-T63R6QT4.js";import{e as Y,f as z,w as Q}from"./chunk-3STZLM5J.js";import{a as j,b as F}from"./chunk-L4JIMNKW.js";import{f as J,i as W}from"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import{e as L,f as A,g as P,h as x}from"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";var de=new Set(["approve","edit","reject"]);function ye(m){let{contextDir:f,graph:s,ops:oe,by:l}=m,N=m.mintable??ne(),T=J(f);if(s.latestHash!==T)return{record:null,errors:[{code:"STALE_BASIS",detail:`graph opened at ${String(s.latestHash)} but chain head is ${String(T)} \u2014 re-open and retry`}]};let C=[],h=[],M=new Set;for(let e of oe){if(s.appliedEvents.has(e.eventId)||M.has(e.eventId)){C.push(e.eventId);continue}M.add(e.eventId),h.push(e)}if(h.length===0)return{record:null,errors:null,applied:[],skipped:C,minted:[],staleDelta:[]};let o=[],$=[],I=[],v=[],b=[],O=[],_=[...m.judgements??[]],D=[],q=new Map,B=new Set,G=[],E=new Set,se=new Set(N),H=new Set;for(let e of h){if(!de.has(e.kind))continue;let n=e.target,t=s.resolve(n)?.cid??n;H.has(t)&&o.push({code:"MULTIPLE_TERMINAL_OPS",detail:`${n} has more than one terminal op in this turn \u2014 normalize latest-wins first`}),H.add(t)}let S=(e,n,t)=>{let r=s.resolve(n);if(!r)return o.push({code:"UNKNOWN_NODE",detail:`${e}: ${n} names nothing in the graph`}),null;let p=s.tipOf(r.cid);return p!==t||s.superseded.has(t)?(o.push({code:"EXPECTED_CID_MOVED",detail:`${e}: ${n} moved or was archived since it was displayed`,data:{tip:p}}),null):t};for(let e of h)if(e.kind==="approve"){let n=S("approve",e.target,e.expectedCid);n&&v.push({id:n,kind:"review-item",resolution:"approved",edit:null,reason:null,by:l})}else if(e.kind==="reject"){let n=S("reject",e.target,e.expectedCid);if(!n)continue;if(v.push({id:n,kind:"review-item",resolution:"rejected",edit:null,reason:e.reason,by:l}),e.redirectTo!==void 0){let t=s.resolve(e.redirectTo);if(!t||t.superseded){o.push({code:"UNKNOWN_NODE",detail:`reject.redirectTo: ${e.redirectTo} is not a live node`});continue}b.push({kind:"node",old:n,new:t.cid,reason:e.reason,by:l})}}else if(e.kind==="edit"){let n=S("edit",e.target,e.expectedCid);if(!n)continue;let t=s.getNode(n);if(!t){o.push({code:"UNKNOWN_NODE",detail:`edit: ${e.target} node file unreadable`});continue}let r={...t.content};for(let[c,u]of Object.entries(e.edit))u!==void 0&&(r[c]=u);if(typeof r.title=="string"&&!r.title.trim()){o.push({code:"EMPTY_TITLE",detail:`edit: ${e.target} edited title is empty`});continue}let p=A(t.label,r);if(p.length>0){for(let c of p)o.push({code:c.code,detail:`edit ${e.target}: ${c.detail}`});continue}let d=j(t.label,r);if(d===n){v.push({id:n,kind:"review-item",resolution:"approved",edit:null,reason:null,by:l});continue}$.push({cid:d,label:t.label,content:r}),b.push({kind:"node",old:n,new:d,reason:e.reason??"edited in chat",by:l}),v.push({id:d,kind:"review-item",resolution:"edited",edit:{...e.edit},reason:null,by:l})}else if(e.kind==="enhance"){if(!S("enhance",e.target,e.expectedCid))continue;for(let t of e.edges){let r=s.nodeLabel.get(t.src)??"(unknown)",p=s.nodeLabel.get(t.dst)??"(unknown)";for(let i of x(t.type,r,p,t.props))o.push({code:i.code,detail:`enhance ${e.target}: ${i.detail}`});let d=F(t.type,t.src,t.dst,t.props);if(s.edgesFrom(t.src).some(i=>i.ecid===d)||I.some(i=>i.ecid===d))continue;let c=Y(s,t.type,t.src,t.dst,G);c&&o.push(c);let u=z(s,t.type,t.src,t.dst);u&&o.push(u);let a=P(t.type)?.cardinality;if(a==="one-live-per-src"||a==="one-live-per-src-and-dst"){let i=`${t.type}|${t.src}`;E.has(i)&&o.push({code:"CARDINALITY_VIOLATION",detail:`${t.type} from ${t.src}: two one-live edges in one turn`}),E.add(i)}if(a==="one-live-per-src-and-dst"){let i=`${t.type}|dst|${t.dst}`;E.has(i)&&o.push({code:"CARDINALITY_VIOLATION",detail:`${t.type} onto ${t.dst}: two one-live edges in one turn (strict 1:1)`}),E.add(i)}I.push({ecid:d,type:t.type,src:t.src,dst:t.dst,props:t.props}),G.push({src:t.src,dst:t.dst,type:t.type})}}else if(e.kind==="add"){if(!se.has(e.label)){o.push({code:"GATED_LABEL",detail:`add: ${e.label} is not mintable in v1 (gate: ${N.join("|")})`,data:{gate:[...N]}});continue}let n=s.heads.get(e.convSourceId),t=s.convChains.get(e.convSourceId);if(typeof n!="string"||!t){o.push({code:"CONV_SOURCE_MISSING",detail:`add: ${e.convSourceId} is not a live conversation source`});continue}let r=s.getNode(n)?.content?.blob,p=typeof r=="string"?Z(f,r)?.toString("utf8")??"":"",d=ee(p,e.cite.turn);if(d===null){o.push({code:"BAD_ANCHOR",detail:`add: ${k(e.cite.turn)} does not resolve in ${e.convSourceId}`});continue}if(!d.includes(e.cite.quote)){o.push({code:"QUOTE_MISMATCH",detail:`add: quote is not verbatim within ${k(e.cite.turn)}`});continue}let c={...e.content,derived:!0},u=A(e.label,c);if(u.length>0){for(let g of u)o.push({code:g.code,detail:`add: ${g.detail}`});continue}let a=j(e.label,c),i={source_id:e.convSourceId,source_cid:n,anchor:k(e.cite.turn),quote:e.cite.quote};for(let g of x(L.DERIVES,"source",e.label,i))o.push({code:g.code,detail:`add: ${g.detail}`});$.push({cid:a,label:e.label,content:c}),I.push({ecid:F("DERIVES",n,a,i),type:L.DERIVES,src:n,dst:a,props:i}),e.rationale&&_.push({about:a,rationale:e.rationale,by:l});let y=Q(e.label,g=>B.has(g),s.names.keys());y!==null&&(B.add(y),O.push({cid:a,slug:y,by:l})),D.push({cid:a,...y!==null?{slug:y}:{}}),q.set(e.eventId,a)}if(o.length)return{record:null,errors:o};let U=new Date().toISOString();for(let e of h){if(e.kind==="add"){let n=q.get(e.eventId);n&&V(f,{ts:U,command:"extract-chat",id:n,verdict:"add",polarity:"preference",tag:e.label,by:l,event_id:e.eventId,target:n});continue}for(let n of te(e,{ts:U,command:"extract-chat",by:l}))V(f,n)}let K=h.map(e=>e.eventId).sort(),ie=W(f,{ts:new Date().toISOString(),proposal_id:null,nodes:$,edges:I,review:v,supersessions:b,...O.length>0?{names:O}:{},..._.length>0?{judgements:_}:{},event_ids:K,...m.sid?{sid:m.sid}:{},source_head_moves:{}},{expectPrev:T}),R=X(f),w=new Set;for(let e of b)if(e.kind==="node"){w.add(e.old);for(let n of R.edgesInto(e.old))w.add(n.src)}for(let e of D)w.add(e.cid);let re=[...w].map(e=>({cid:e,state:R.stale(R.tipOf(e))})).filter(e=>e.state!=="fresh");return{record:ie.record,errors:null,applied:K,skipped:C,minted:D,staleDelta:re}}export{ye as commitChatTurn};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c}from"./chunk-SY3HLQMV.js";import"./chunk-VGFTNLQQ.js";import"./chunk-L2TV4G56.js";import"./chunk-5KFS3GAZ.js";import"./chunk-NVGBE2DR.js";import"./chunk-L4JIMNKW.js";import"./chunk-M7WQM4UA.js";import"./chunk-WWNSD6FA.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";export{c as makeChatController,b as questionStub,a as recommendationPicks};
|
package/dist/chunk-2SREGETM.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as o,b as i}from"./chunk-IQDWBTRJ.js";import{resolve as c}from"path";async function w(n,s,r={}){let e=i({verb:n,mode:"cli",contextRoot:c(process.cwd(),".context"),env:o(),write:r.write});try{let t=await s();return r.write&&t===0&&await e.lateBindContext(c(process.cwd(),".context")),t===1&&process.stderr.write(e.supportFooter()+`
|
|
3
|
-
`),await e.end({exit_code:t}),t}catch(t){throw e.error("cli_crash"),process.stderr.write(e.supportFooter()+`
|
|
4
|
-
`),await e.end({exit_code:1}),t}}export{w as a};
|
package/dist/chunk-3STZLM5J.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as Q,b as A,d as Z}from"./chunk-L4JIMNKW.js";import{f as Ee,i as K}from"./chunk-M7WQM4UA.js";import{d as F,e as y,f as Y,g as le,h as pe}from"./chunk-5YPBPZUR.js";function Re(s,n){let r=s.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");if(r.length>60){let d=r.lastIndexOf("-",60);r=(d>0?r.slice(0,d):r.slice(0,60)).replace(/-+$/g,"")}if(!X.test(r))return null;let e=r;for(let d=2;n(e);d++)e=`${r}-${d}`;return X.test(e)?e:null}var xe={source:"src",usecase:"uc",scenario:"sc",ac:"ac",test:"t",gap:"gap",stylenote:"sty"};function Le(s,n,r){let e=xe[s];return Re(e?`${e} ${n}`:n,r)}var Ce={usecase:"uc",scenario:"sc",ac:"ac",test:"t",gap:"gap",stylenote:"sty"},Ge=/^(uc|sc|ac|t|gap|sty)-\d+$/i;function Se(s,n,r){let e=Ce[s];if(!e)return null;let d=new RegExp(`^${e}-(\\d+)$`),f=0;for(let l of r){let m=d.exec(l);if(!m)continue;let i=Number(m[1]);Number.isSafeInteger(i)&&i>f&&(f=i)}let a=f+1;for(;n(`${e}-${a}`);)a+=1;return`${e}-${a}`}var ye=/^L([1-9]\d*)-L([1-9]\d*)$/,Oe=/^img#(p[1-9]\d*-[1-9]\d*|i[1-9]\d*)$/;function ee(s){if(s==="img#whole")return{kind:"img-whole"};let n=Oe.exec(s);if(n)return{kind:"img-part",ref:n[1]};let r=ye.exec(s);return r?{kind:"lines",a:parseInt(r[1],10),b:parseInt(r[2],10)}:null}function be(s,n){let r=/^L(\d+)-L(\d+)$/.exec(n);if(!r)return null;let e=parseInt(r[1],10),d=parseInt(r[2],10),f=s.split(`
|
|
3
|
-
`);return e<1||d<e||d>f.length?null:f.slice(e-1,d).map(a=>a.replace(/^\d+\| /,"")).join(`
|
|
4
|
-
`)}function $e(s,n,r){let e=ee(n.anchor);if(s.format==="image")return e?.kind==="img-whole"?[]:[{code:"CITE_ANCHOR_INVALID",detail:`image cites are anchor-only (img#whole), got ${n.anchor}`}];if(e?.kind==="img-part")return new Set((s.images??[]).map(a=>a.ref)).has(e.ref)?[]:[{code:"CITE_ANCHOR_INVALID",detail:`anchor ${n.anchor} names no embedded image of this source version`}];if(!n.anchor||n.quote===void 0||n.quote==="")return[{code:"MISSING_CITE",detail:"text-kind cites need anchor+quote"}];let d=r!==null?be(r,n.anchor):null;return d===null?[{code:"BAD_ANCHOR",detail:`anchor ${n.anchor} does not resolve in the source`}]:d.includes(n.quote)?[]:[{code:"QUOTE_MISMATCH",detail:`quote is not verbatim within ${n.anchor}`}]}var X=/^[a-z0-9][a-z0-9-]{1,63}$/;function Ie(s,n,r,e){if(!n)return{error:{code:"SUPERSEDE_TARGET_MISSING",detail:"supersede verdict needs a target (slug or cid)"}};let d=s.resolve(n);return d?d.superseded||e.has(d.cid)?{error:{code:"ALREADY_SUPERSEDED",detail:`${n} is already superseded (tip: ${d.tip})`}}:d.cid===r?{error:{code:"SELF_SUPERSEDE",detail:"a node cannot supersede itself"}}:{targetCid:d.cid}:{error:{code:"UNKNOWN_SUPERSEDE_TARGET",detail:`${n} names nothing in the graph`}}}function ke(s,n,r,e,d=[]){if(!le(n)?.acyclic)return null;if(r===e)return{code:"EDGE_CYCLE",detail:`${n} ${r} \u2192 itself`};let a=i=>[...s.edgesFrom(i).filter(g=>g.type===n).map(g=>g.dst),...d.filter(g=>g.type===n&&g.src===i).map(g=>g.dst)],l=new Set,m=[e];for(;m.length>0;){let i=m.pop();if(i===r)return{code:"EDGE_CYCLE",detail:`${n} ${r} \u2192 ${e} closes a cycle`};l.has(i)||(l.add(i),m.push(...a(i)))}return null}function ze(s,n,r,e){let f=le(n)?.cardinality;if(f!=="one-live-per-src"&&f!=="one-live-per-src-and-dst")return null;let a=s.edgesFrom(r).filter(l=>l.type===n&&!s.superseded.has(l.dst));if(a.length>0)return{code:"CARDINALITY_VIOLATION",detail:`${n} from ${r} already has a live edge (${a[0].ecid}) \u2014 supersede it first`};if(f==="one-live-per-src-and-dst"&&e!==void 0){let l=s.edgesInto(e).filter(m=>m.type===n&&!s.superseded.has(m.src));if(l.length>0)return{code:"CARDINALITY_VIOLATION",detail:`${n} onto ${e} already has a live edge (${l[0].ecid}) \u2014 strict 1:1, supersede it first`}}return null}var fe=new Set(["high","med","low"]),te=s=>s.cites&&s.cites.length>0?s.cites:[s.cite];function re(s){let n=0;for(let r of s)typeof r=="object"&&r!==null&&"op"in r&&n++;return n===0?"flat":n===s.length?"ops":"mixed"}var De=/^c[1-9][0-9]*$/;function ve(s,n,r,e){let d=new Map,f=[],a=[];for(let[m,i]of n.entries()){let g=`${s}.updated.criteria[${m}]`;if(i.op==="keep"||i.op==="remove"){if(!De.test(i.ref??"")){e.push({code:"CRITERIA_REF_UNKNOWN",detail:`${g}: ref ${JSON.stringify(i.ref)} is not a c<N> criterion index`});continue}if(d.has(i.ref)){e.push({code:"CRITERIA_REF_DUPLICATE",detail:`${g}: ${i.ref} is already named by another op \u2014 every prior criterion appears in exactly one keep or remove`});continue}d.set(i.ref,i);let h=Number.parseInt(i.ref.slice(1),10);if(h>r.length){e.push({code:"CRITERIA_REF_UNKNOWN",detail:`${g}: ${i.ref} \u2014 the live target has ${r.length} criteria`});continue}if(r[h-1]!==i.text){e.push({code:"CRITERIA_REF_MISMATCH",detail:`${g}: ${i.ref} echo mismatch \u2014 the live target's criterion ${h} reads ${JSON.stringify(r[h-1])}, the op echoed ${JSON.stringify(i.text)} \u2014 re-read the node and re-emit`});continue}i.op==="remove"&&(f.push(i.text),(!i.reason||!i.reason.trim())&&e.push({code:"EMPTY_REASON",detail:`${g}: a remove op carries its reason`}))}else!i.text||!i.text.trim()?e.push({code:"EMPTY_CRITERION",detail:`${g}: set text is empty`}):a.push(i.text)}let l=[];for(let m=1;m<=r.length;m++)d.has(`c${m}`)||l.push(`c${m}`);l.length>0&&e.push({code:"CRITERIA_PARTITION_INCOMPLETE",detail:`${s}: prior criteria ${l.join(", ")} named by no keep/remove op \u2014 every prior criterion must be kept or removed (with a reason)`});for(let m of f)a.includes(m)&&e.push({code:"CRITERIA_OP_CONFLICT",detail:`${s}: ${JSON.stringify(m)} is removed AND re-set in the same update \u2014 drop one of the two ops`})}function Ze(s,n,r){let e=[],d=s.sources??[s.source],f=new Map(d.map(i=>[i.source_id,i.source_cid])),a=new Map;if(typeof n=="string")a.set(s.source.source_id,{media:r.mediaOf(s.source.source_cid),numberedText:n});else for(let[i,g]of n)a.set(i,g);for(let i of d)r.hasNode(i.source_cid)||e.push({code:"MISSING_SOURCE_NODE",detail:`source ${i.source_id} (${i.source_cid}) is not a committed node \u2014 ingest it first`});let l=(i,g)=>{let h=g.source_id??s.source.source_id;if(!f.has(h)){e.push({code:"CITE_SOURCE_UNKNOWN",detail:`${i}: cite source ${JSON.stringify(h)} is not in read_basis`});return}let o=a.get(h);if(!o){e.push({code:"MISSING_SOURCE_NODE",detail:`${i}: no citable text available for source ${h}`});return}for(let N of $e(o.media,g,o.numberedText))e.push({code:N.code,detail:`${i}: ${N.detail}`})},m=new Set;for(let i of s.use_cases){if(m.has(i.temp_ref)&&e.push({code:"DUP_TEMP_REF",detail:`duplicate temp_ref ${i.temp_ref}`}),m.add(i.temp_ref),(!i.title||!i.title.trim())&&e.push({code:"EMPTY_TITLE",detail:`${i.temp_ref}: title is empty`}),fe.has(i.risk)||e.push({code:"BAD_RISK",detail:`${i.temp_ref}: risk ${JSON.stringify(i.risk)} not in high|med|low`}),!i.cite||!i.cite.anchor)e.push({code:"MISSING_CITE",detail:`${i.temp_ref}: every derived use-case must carry a cite`});else for(let h of te(i))l(i.temp_ref,h);i.matches_existing&&!r.hasNode(i.matches_existing.cid)&&e.push({code:"UNKNOWN_MATCH",detail:`${i.temp_ref}: matches_existing ${i.matches_existing.cid} is not in the graph`});for(let[h,o]of(i.criteria??[]).entries())(!o.text||!o.text.trim())&&e.push({code:"EMPTY_CRITERION",detail:`${i.temp_ref}.criteria[${h}]: text is empty`}),!o.cite||!o.cite.anchor?e.push({code:"MISSING_CITE",detail:`${i.temp_ref}.criteria[${h}]: every criterion carries its own cite`}):l(`${i.temp_ref}.criteria[${h}]`,o.cite);let g=i.updated?.criteria??[];if(g.length>0){let h=re(g);if(h==="mixed")e.push({code:"CRITERIA_SHAPE_MIXED",detail:`${i.temp_ref}.updated.criteria mixes op-shaped (keep/set/remove) and {text, cite} entries \u2014 emit ONE shape for the whole array`});else if(h==="ops"){let o=g,N=i.matches_existing?Ue(r,i.matches_existing.cid):null;if(!N)e.push({code:"CRITERIA_REF_UNKNOWN",detail:`${i.temp_ref}: op-union criteria address a prior version \u2014 they need a resolvable matches_existing target`});else{let v=r.getNode(N.cid)?.content.criteria??[];ve(i.temp_ref,o,v,e)}for(let[v,R]of o.entries())R.op==="set"&&(!R.cite||!R.cite.anchor?e.push({code:"MISSING_CITE",detail:`${i.temp_ref}.updated.criteria[${v}]: a set op carries the proposing source's cite`}):l(`${i.temp_ref}.updated.criteria[${v}]`,R.cite))}else for(let[o,N]of g.entries())(!N.text||!N.text.trim())&&e.push({code:"EMPTY_CRITERION",detail:`${i.temp_ref}.updated.criteria[${o}]: text is empty`}),!N.cite||!N.cite.anchor?e.push({code:"MISSING_CITE",detail:`${i.temp_ref}.updated.criteria[${o}]: every updated criterion carries its own cite`}):l(`${i.temp_ref}.updated.criteria[${o}]`,N.cite)}}return e}function we(s,n,r){return`${s}:${n}:${r}`}function Te(s,n,r,e){let d=`${n}:${r}:`,f=0;for(let a of s.appliedEvents){if(!a.startsWith(d))continue;let l=a.slice(d.length);if(!/^\d+$/.test(l))continue;let m=Number.parseInt(l,10);m>f&&(f=m)}return Array.from({length:e},(a,l)=>we(n,r,f+1+l))}function Ae(s,n){let r=new Map;for(let[a,l]of s.superseded)typeof l=="string"&&l!==a&&r.set(l,[...r.get(l)??[],a]);let e=[],d=[n],f=new Set;for(;d.length>0;){let a=d.pop();f.has(a)||(f.add(a),e.push(a),d.push(...r.get(a)??[]))}return e}function Ue(s,n){let r=s.resolve(n);if(r===null)return null;let e=r.cid;if(s.superseded.has(e)){let d=s.tipOf(e);return s.superseded.has(d)?null:{cid:d,redirected:!0}}return{cid:e,redirected:!1}}function et(s){let{contextDir:n,graph:r,proposal:e,proposalId:d,verdicts:f,by:a,allowStaleBasis:l,extractorVersion:m,autoName:i}=s,g=Ee(n);if(!l&&e.read_basis!==g)return{record:null,errors:[{code:"STALE_BASIS",detail:`proposal read_basis ${String(e.read_basis)} != latest ${String(g)}`}]};for(let t of e.sources??[e.source])if(!r.hasNode(t.source_cid))return{record:null,errors:[{code:"MISSING_SOURCE_NODE",detail:`source ${t.source_id} (${t.source_cid}) is not a committed node \u2014 ingest it first`}]};let h=new Map((e.sources??[e.source]).map(t=>[t.source_id,t.source_cid])),o=[],N=[],v=new Map,R=[],W=r.mediaOf(e.source.source_cid),j=new Set,V=[],k=[],ie=[],G=[],se=[],oe=[],ne=new Set,me=new Set,z=(t,u,O)=>{let U=Ie(r,u.supersedeTarget,O,ne);if("error"in U){o.push({code:U.error.code,detail:`${t}: ${U.error.detail}`});return}ne.add(U.targetCid),se.push({kind:"node",old:U.targetCid,new:O,reason:u.reason??`superseded via review by ${a.id}`,by:a})};for(let t of e.use_cases){let u=f.get(t.temp_ref)??{resolution:"skipped"};j.has(t.temp_ref)&&o.push({code:"DUP_TEMP_REF",detail:`duplicate temp_ref ${t.temp_ref}`}),j.add(t.temp_ref),(!t.title||!t.title.trim())&&o.push({code:"EMPTY_TITLE",detail:`${t.temp_ref}: title is empty`}),fe.has(t.risk)||o.push({code:"BAD_RISK",detail:`${t.temp_ref}: risk ${JSON.stringify(t.risk)} not in high|med|low`});let O=ee(t.cite?.anchor??""),U=t.cite?.source_id!==void 0&&h.has(t.cite.source_id)?r.mediaOf(h.get(t.cite.source_id)):W;if(U.format==="image"){if(O?.kind!=="img-whole"){o.push({code:t.cite?.anchor?"CITE_ANCHOR_INVALID":"MISSING_CITE",detail:`${t.temp_ref}: image cites are anchor-only (img#whole)`});continue}}else if(O?.kind==="img-part"){if(!(U.images??[]).some(p=>p.ref===O.ref)){o.push({code:"CITE_ANCHOR_INVALID",detail:`${t.temp_ref}: anchor ${t.cite?.anchor} names no embedded image of this source version`});continue}}else if(!t.cite||!t.cite.anchor||!t.cite.quote){o.push({code:"MISSING_CITE",detail:`${t.temp_ref}: every derived use-case must cite anchor+quote`});continue}u.resolution==="edited"&&u.edit&&(u.edit.title!==void 0&&!u.edit.title.trim()&&o.push({code:"EMPTY_TITLE",detail:`${t.temp_ref}: edited title is empty`}),u.edit.risk!==void 0&&!fe.has(u.edit.risk)&&o.push({code:"BAD_RISK",detail:`${t.temp_ref}: edited risk ${JSON.stringify(u.edit.risk)} invalid`}));let ae=Z({title:u.edit?.title??t.title,description:t.description,summary:u.edit?.summary??t.summary,actors:t.actors,value:t.value,risk:u.edit?.risk??t.risk,...t.criteria&&t.criteria.length>0?{criteria:t.criteria.map(c=>c.text)}:{}}),S=Q("usecase",ae),ue=t.cite.source_id??e.source.source_id,he=h.get(ue);if(t.cite.source_id!==void 0&&he===void 0){o.push({code:"CITE_SOURCE_UNKNOWN",detail:`${t.temp_ref}: cite source ${JSON.stringify(ue)} is not in read_basis`});continue}let q={source_id:ue,source_cid:he??e.source.source_cid,anchor:t.cite.anchor,...t.cite.quote?{quote:t.cite.quote}:{}};if(t.matches_existing&&!r.hasNode(t.matches_existing.cid)){o.push({code:"UNKNOWN_MATCH",detail:`${t.temp_ref}: matches_existing ${t.matches_existing.cid} is not in the graph`});continue}let $=t.matches_existing?.cid??(r.hasNode(S)?S:null);if($&&r.superseded.has($)){let c=r.tipOf($);$=r.superseded.has(c)?null:c}if($&&t.matches_existing&&(r.trust.get($)??null)==="derived"){let c=t.updated?.criteria??[];if(t.changed&&c.length>0&&re(c)==="ops"&&(u.resolution==="approved"||u.resolution==="edited")){o.push({code:"UC_UNREVIEWED",detail:`${t.temp_ref}: merge target ${$.slice(0,19)} is unreviewed (derived) \u2014 bless it first (kane-cli context review) and re-propose the merge`});continue}let p=(s.probeHits??[]).find(_=>_.tempRef===t.temp_ref&&_.candidateCid===$);R.push({tempRef:t.temp_ref,candidate_cid:$,score:p?.score??1,scorer:p?.scorer??"lexical_fallback"}),$=null}if($){if(t.changed&&(u.resolution==="approved"||u.resolution==="edited")){let c=t.updated;if(!c||Object.keys(c).length===0){o.push({code:"CHANGED_NEEDS_PAYLOAD",detail:`${t.temp_ref}: changed:true needs an updated{...} payload naming the moved fields`});continue}let p=r.getNode($)?.content??{},_=c.criteria??[],x=_.length>0?re(_):"flat";if(x==="mixed"){o.push({code:"CRITERIA_SHAPE_MIXED",detail:`${t.temp_ref}.updated.criteria mixes op-shaped (keep/set/remove) and {text, cite} entries \u2014 emit ONE shape for the whole array`});continue}if(x==="ops"){let C=_,b=p.criteria??[],D=o.length;ve(t.temp_ref,C,b,o);for(let[H,B]of C.entries())B.op==="set"&&(!B.cite||!B.cite.anchor)&&o.push({code:"MISSING_CITE",detail:`${t.temp_ref}.updated.criteria[${H}]: a set op carries the proposing source's cite`});if(o.length>D)continue;let I=C.filter(H=>H.op!=="remove").map(H=>H.text),T=Z({title:u.edit?.title??c.title??String(p.title??t.title),...c.description??p.description?{description:c.description??p.description}:{},...u.edit?.summary??c.summary??p.summary?{summary:u.edit?.summary??c.summary??p.summary}:{},...c.actors??p.actors?{actors:c.actors??p.actors}:{},...c.value??p.value?{value:c.value??p.value}:{},risk:u.edit?.risk??c.risk??String(p.risk??t.risk),...I.length>0?{criteria:I}:{}}),P=Q("usecase",T);if(P!==$){for(let E of Y("usecase",T))o.push({code:E.code,detail:`${t.temp_ref}: ${E.detail}`});V.push({cid:P,label:F.USECASE,content:T});for(let E of te(t)){let M=E.source_id??e.source.source_id,w=h.get(M);if(!w){o.push({code:"CITE_SOURCE_UNKNOWN",detail:`${t.temp_ref}: cite source ${JSON.stringify(M)} is not in read_basis`});continue}let L={source_id:M,source_cid:w,anchor:E.anchor,...E.quote?{quote:E.quote}:{}};k.push({ecid:A("DERIVES",w,P,L),type:y.DERIVES,src:w,dst:P,props:L})}let B=Ae(r,$).flatMap(E=>r.edgesInto(E)).filter(E=>E.type===y.DERIVES&&typeof E.props.claim=="string");for(let E of C){if(E.op!=="keep")continue;let M=new Set;for(let w of B){let L=w.props;if(L.claim!==E.text)continue;let ge=`${L.source_id}|${L.source_cid}|${L.anchor}`;if(M.has(ge))continue;M.add(ge);let _e={...w.props};k.push({ecid:A("DERIVES",w.src,P,_e),type:y.DERIVES,src:w.src,dst:P,props:_e})}}for(let E of C){if(E.op!=="set")continue;let M=E.cite.source_id??e.source.source_id,w=h.get(M);if(!w){o.push({code:"CITE_SOURCE_UNKNOWN",detail:`${t.temp_ref}: set cite source ${JSON.stringify(M)} is not in read_basis`});continue}let L={source_id:M,source_cid:w,anchor:E.cite.anchor,...E.cite.quote?{quote:E.cite.quote}:{},claim:E.text};k.push({ecid:A("DERIVES",w,P,L),type:y.DERIVES,src:w,dst:P,props:L})}for(let E of C)E.op==="remove"&&N.push({about:$,ref:E.ref,text:E.text,reason:E.reason});z(t.temp_ref,{resolution:"supersede",supersedeTarget:$,reason:u.reason??`criteria merge: ${e.source.source_id} (${C.filter(E=>E.op==="keep").length} kept, ${C.filter(E=>E.op==="set").length} set, ${C.filter(E=>E.op==="remove").length} removed)`},P),G.push({id:P,kind:"review-item",resolution:u.resolution,edit:u.resolution==="edited"?{...u.edit}:null,reason:null,by:a});continue}}else{let C=_.map(I=>typeof I=="string"?{text:I,cite:void 0}:I),b=Z({title:u.edit?.title??c.title??String(p.title??t.title),...c.description??p.description?{description:c.description??p.description}:{},...u.edit?.summary??c.summary??p.summary?{summary:u.edit?.summary??c.summary??p.summary}:{},...c.actors??p.actors?{actors:c.actors??p.actors}:{},...c.value??p.value?{value:c.value??p.value}:{},risk:u.edit?.risk??c.risk??String(p.risk??t.risk),...c.criteria?C.length>0?{criteria:C.map(I=>I.text)}:{}:p.criteria?{criteria:p.criteria}:{}}),D=Q("usecase",b);if(D!==$){for(let I of Y("usecase",b))o.push({code:I.code,detail:`${t.temp_ref}: ${I.detail}`});V.push({cid:D,label:F.USECASE,content:b}),k.push({ecid:A("DERIVES",q.source_cid,D,q),type:y.DERIVES,src:q.source_cid,dst:D,props:q});for(let I of C){if(!I.cite)continue;let T={source_id:e.source.source_id,source_cid:e.source.source_cid,anchor:I.cite.anchor,...I.cite.quote?{quote:I.cite.quote}:{},claim:I.text};k.push({ecid:A("DERIVES",T.source_cid,D,T),type:y.DERIVES,src:T.source_cid,dst:D,props:T})}z(t.temp_ref,{resolution:"supersede",supersedeTarget:$,reason:u.reason??`matches-but-changed: ${e.source.source_id} moved (${Object.keys(c).join(", ")})`},D),G.push({id:D,kind:"review-item",resolution:u.resolution,edit:u.resolution==="edited"?{...u.edit}:null,reason:null,by:a});continue}for(let I of C){if(!I.cite)continue;let T={source_id:e.source.source_id,source_cid:e.source.source_cid,anchor:I.cite.anchor,...I.cite.quote?{quote:I.cite.quote}:{},claim:I.text};k.push({ecid:A("DERIVES",T.source_cid,$,T),type:y.DERIVES,src:T.source_cid,dst:$,props:T})}}}if(t.changed&&u.resolution==="skipped"){let c=t.updated?.criteria??[];c.length>0&&re(c)==="ops"&&G.push({id:$,kind:"pending_update",resolution:"pending",edit:{temp_ref:t.temp_ref,source_id:e.source.source_id,updated:t.updated},reason:t.change_note??null,by:a})}if(u.resolution!=="rejected"){for(let c of te(t)){let p=c.source_id??e.source.source_id,_=h.get(p);if(!_){o.push({code:"CITE_SOURCE_UNKNOWN",detail:`${t.temp_ref}: cite source ${JSON.stringify(p)} is not in read_basis`});continue}let x={source_id:p,source_cid:_,anchor:c.anchor,...c.quote?{quote:c.quote}:{}};k.push({ecid:A("DERIVES",_,$,x),type:y.DERIVES,src:_,dst:$,props:x})}(u.resolution==="approved"||u.resolution==="edited"||u.resolution==="supersede")&&G.push({id:$,kind:"review-item",resolution:"approved",edit:null,reason:null,by:a}),u.resolution==="supersede"&&z(t.temp_ref,u,$)}continue}for(let c of Y("usecase",ae))o.push({code:c.code,detail:`${t.temp_ref}: ${c.detail}`});for(let c of pe(y.DERIVES,"source","usecase",q))o.push({code:c.code,detail:`${t.temp_ref}: ${c.detail}`});V.push({cid:S,label:F.USECASE,content:ae}),v.set(t.temp_ref,S),k.push({ecid:A("DERIVES",q.source_cid,S,q),type:y.DERIVES,src:q.source_cid,dst:S,props:q});for(let c of te(t).slice(1)){let p=c.source_id??e.source.source_id,_=h.get(p);if(!_){o.push({code:"CITE_SOURCE_UNKNOWN",detail:`${t.temp_ref}: cite source ${JSON.stringify(p)} is not in read_basis`});continue}let x={source_id:p,source_cid:_,anchor:c.anchor,...c.quote?{quote:c.quote}:{}};for(let C of pe(y.DERIVES,"source","usecase",x))o.push({code:C.code,detail:`${t.temp_ref}: ${C.detail}`});k.push({ecid:A("DERIVES",_,S,x),type:y.DERIVES,src:_,dst:S,props:x})}for(let c of t.criteria??[]){let p=c.cite.source_id??e.source.source_id,_=h.get(p);if(!_){o.push({code:"CITE_SOURCE_UNKNOWN",detail:`${t.temp_ref}: criterion cite source ${JSON.stringify(p)} is not in read_basis`});continue}let x={source_id:p,source_cid:_,anchor:c.cite.anchor,...c.cite.quote?{quote:c.cite.quote}:{},claim:c.text};k.push({ecid:A("DERIVES",x.source_cid,S,x),type:y.DERIVES,src:x.source_cid,dst:S,props:x})}for(let c of t.depends_on_hint??[]){let p=b=>b.toLowerCase().trim().replace(/\s+/g," "),_=null,x=r.resolve(c);if(x&&!x.superseded&&r.nodeLabel.get(x.cid)===F.USECASE&&(_=x.cid),!_){for(let{cid:b,content:D}of r.byLabel(F.USECASE))if(!r.superseded.has(b)&&p(String(D.title??""))===p(c)){_=b;break}}if(!_){let b=V.find(D=>D.label===F.USECASE&&p(String(D.content.title??""))===p(c));b&&(_=b.cid)}!_||_===S||ke(r,y.DEPENDS_ON,S,_,ie)||ie.some(b=>b.src===S&&b.dst===_)||(k.push({ecid:A(y.DEPENDS_ON,S,_,{reason:"extract hint"}),type:y.DEPENDS_ON,src:S,dst:_,props:{reason:"extract hint"}}),ie.push({src:S,dst:_,type:y.DEPENDS_ON}))}if((u.resolution==="approved"||u.resolution==="edited"||u.resolution==="supersede")&&r.superseded.get(S)===null&&!ne.has(S)&&se.push({kind:"node",old:S,new:S,reason:`re-minted after tombstone via review by ${a.id}`,by:a}),i){let c=Se("usecase",p=>me.has(p),r.names.keys());c!==null&&!r.nameOf.has(S)&&(me.add(c),oe.push({cid:S,slug:c,by:a}))}u.resolution==="approved"?G.push({id:S,kind:"review-item",resolution:"approved",edit:null,reason:null,by:a}):u.resolution==="edited"?G.push({id:S,kind:"review-item",resolution:"edited",edit:{...u.edit},reason:null,by:a}):u.resolution==="rejected"?G.push({id:S,kind:"review-item",resolution:"rejected",edit:null,reason:u.reason??null,by:a}):u.resolution==="supersede"&&(G.push({id:S,kind:"review-item",resolution:"approved",edit:null,reason:u.reason??null,by:a}),z(t.temp_ref,u,S))}if(o.length)return{record:null,errors:o};let ce=new Date().toISOString(),Ne=(e.sources?.length??0)>1||(e.extraction_claims?.length??0)>0,de;if(Ne){let t=[];if(e.extraction_claims==null)t.push({source_id:e.source.source_id,source_cid:e.source.source_cid,completeness:"complete",...m?{extractor_version:m}:{},at:ce});else{let u=new Map(e.extraction_claims.map(O=>[O.source_id,O.completeness]));for(let O of e.sources??[e.source]){let U=u.get(O.source_id)??null;U!==null&&t.push({source_id:O.source_id,source_cid:O.source_cid,completeness:U,...m?{extractor_version:m}:{},at:ce})}}de=t}else de=e.source.source_cid;let J=[];for(let t of s.probeHits??[])J.push({...v.has(t.tempRef)?{new_cid:v.get(t.tempRef)}:{},candidate_cid:t.candidateCid,score:t.score,scorer:t.scorer,probe_basis:null});for(let t of R){let u=v.get(t.tempRef);J.some(O=>O.new_cid===u&&O.candidate_cid===t.candidate_cid)||J.push({...u!==void 0?{new_cid:u}:{},candidate_cid:t.candidate_cid,score:t.score,scorer:t.scorer,probe_basis:null})}return{record:K(n,{ts:ce,proposal_id:d,...d!=null?{extraction_of:de}:{},...d!=null&&m?{extractor_version:m}:{},...N.length>0?{criteria_removed:N}:{},...J.length>0?{dedup_hits:J}:{},nodes:V,edges:k,review:G,supersessions:se,...oe.length>0?{names:oe}:{},...s.judgements&&s.judgements.length>0?{judgements:s.judgements}:{},...s.eventIds&&s.eventIds.length>0?{event_ids:s.eventIds}:s.sid?{event_ids:Te(r,s.sid,"extract",1)}:{},...s.sid?{sid:s.sid}:{},source_head_moves:{}},{expectPrev:g}).record,errors:null}}function tt(s){let{contextDir:n,graph:r,verdicts:e,by:d}=s,f=[],a=[],l=[],m=[],i=new Set;for(let[h,o]of e){if(o.resolution==="skipped")continue;let N=r.resolve(h);if(!N){f.push({code:"UNKNOWN_NODE",detail:`${h} names nothing in the graph`});continue}if(N.superseded){f.push({code:"SUPERSEDED_TARGET",detail:`${h} is superseded \u2014 review the tip (${N.tip})`});continue}let v=N.cid;if(o.resolution==="approved")l.push({id:v,kind:"review-item",resolution:"approved",edit:null,reason:null,by:d});else if(o.resolution==="rejected")s.holdArchives?l.push({id:v,kind:"pending_archive",resolution:"pending",edit:null,reason:o.reason??null,by:d}):l.push({id:v,kind:"review-item",resolution:"rejected",edit:null,reason:o.reason??null,by:d});else if(o.resolution==="edited"){let R=r.getNode(v);if(!R){f.push({code:"UNKNOWN_NODE",detail:`${h}: node file unreadable`});continue}let W={...R.content,...o.edit?.title!==void 0?{title:o.edit.title}:{},...o.edit?.summary!==void 0?{summary:o.edit.summary}:{},...o.edit?.risk!==void 0?{risk:o.edit.risk}:{}},j=Y(R.label,W);if(j.length>0){for(let k of j)f.push({code:k.code,detail:`${h}: ${k.detail}`});continue}let V=Q(R.label,W);if(V===v){l.push({id:v,kind:"review-item",resolution:"approved",edit:null,reason:null,by:d});continue}a.push({cid:V,label:R.label,content:W}),i.add(v),m.push({kind:"node",old:v,new:V,reason:o.reason??"edited in review",by:d}),l.push({id:V,kind:"review-item",resolution:"edited",edit:{...o.edit},reason:null,by:d})}else if(o.resolution==="supersede"){let R=Ie(r,o.supersedeTarget,v,i);if("error"in R){f.push({code:R.error.code,detail:`${h}: ${R.error.detail}`});continue}i.add(R.targetCid),s.holdArchives?l.push({id:R.targetCid,kind:"pending_archive",resolution:"pending",edit:null,reason:`supersede by ${v}${o.reason?` \u2014 ${o.reason}`:""}`,by:d}):(m.push({kind:"node",old:R.targetCid,new:v,reason:o.reason??`superseded via review by ${d.id}`,by:d}),l.push({id:v,kind:"review-item",resolution:"approved",edit:null,reason:o.reason??null,by:d}))}}return f.length?{record:null,errors:f}:l.length===0&&m.length===0?{record:null,errors:[{code:"NO_VERDICTS",detail:"every item was skipped \u2014 nothing to commit"}]}:{record:K(n,{ts:new Date().toISOString(),proposal_id:null,nodes:a,edges:[],review:l,supersessions:m,source_head_moves:{}},{expectPrev:r.latestHash}).record,errors:null}}function rt(s){let{contextDir:n,graph:r,survivor:e,merged:d,reason:f,by:a}=s,l=r.resolve(e),m=r.resolve(d);return l?m?l.superseded||m.superseded?{record:null,errors:[{code:"ALREADY_SUPERSEDED",detail:"a side of the pair is already superseded \u2014 the pair is drained"}]}:l.cid===m.cid?{record:null,errors:[{code:"SELF_SUPERSEDE",detail:"a pair cannot merge a node into itself"}]}:{record:K(n,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[{kind:"node",old:m.cid,new:l.cid,reason:f??`pair merge: duplicate of ${e}`,by:a}],source_head_moves:{}},{expectPrev:r.latestHash}).record,errors:null}:{record:null,errors:[{code:"UNKNOWN_NODE",detail:`${d} names nothing in the graph`}]}:{record:null,errors:[{code:"UNKNOWN_NODE",detail:`${e} names nothing in the graph`}]}}function it(s){let{contextDir:n,graph:r,assignments:e,by:d}=s,f=[],a=[],l=new Set;for(let{ref:i,slug:g}of e){if(!X.test(g)){f.push({code:"BAD_SLUG",detail:`${JSON.stringify(g)} \u2014 slugs are kebab-case ${String(X)}`});continue}let h=r.resolve(i);if(!h){f.push({code:"UNKNOWN_REF",detail:`${i} names nothing in the graph`});continue}if(h.superseded){f.push({code:"SUPERSEDED_TARGET",detail:`${i} is superseded \u2014 name the tip instead (${h.tip})`});continue}let o=r.names.get(g);if(o!==void 0&&!r.superseded.has(o)&&o!==h.cid||l.has(g)){f.push({code:"SLUG_TAKEN",detail:`${g} already names ${o??"another node in this record"}`});continue}l.add(g),a.push({cid:h.cid,slug:g,by:d})}return f.length?{record:null,errors:f}:a.length===0?{record:null,errors:[{code:"NO_ASSIGNMENTS",detail:"nothing to name"}]}:{record:K(n,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[],names:a,source_head_moves:{}},{expectPrev:r.latestHash}).record,errors:null}}function st(s){let{contextDir:n,graph:r,sourceId:e,reason:d,by:f}=s,a=r.heads.get(e);return a===void 0?{record:null,errors:[{code:"UNKNOWN_SOURCE",detail:`no source ${e} in the graph`}]}:a===null?{record:null,errors:[{code:"ALREADY_RETIRED",detail:`source ${e} is already retired`}]}:{record:K(n,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[{kind:"node",old:a,new:null,reason:d??`retired source ${e}`,by:f}],source_head_moves:{[e]:null},names:[]},{expectPrev:r.latestHash}).record,errors:null}}export{ee as a,be as b,$e as c,X as d,ke as e,ze as f,te as g,re as h,ve as i,Ze as j,we as k,Te as l,Ue as m,et as n,tt as o,rt as p,it as q,st as r,Re as s,xe as t,Le as u,Ge as v,Se as w};
|
package/dist/chunk-5YPBPZUR.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
var l="assurance/context@1";var u={source:{hashed:["blob","source_id"],required:["blob","source_id"],enums:{}},usecase:{hashed:["actors","criteria","derived","description","risk","summary","title","value"],required:["derived","risk","title"],enums:{risk:["high","med","low"]}},scenario:{hashed:["case_type","derived","description","intent","parameters","tags","technique_notes","title"],required:["case_type","derived","intent","title"],enums:{case_type:["happy","negative","boundary","edge","security","a11y","perf","i18n"]}},ac:{hashed:["derived","expected_answer","kind","measurable","risk","text"],required:["derived","risk","text"],enums:{risk:["high","med","low"],kind:["presence","forbidden-presence","count","delta","state-transition","absolute","bound","propagation","latency","graded"]}},test:{hashed:["check","config","definitionId","derived","objectives_blob","surface_required","test_md_blob","title"],required:["definitionId","derived","title"],enums:{}},gap:{hashed:["derived","kind","question","ref","risk","risk_rationale","text","uc"],required:["derived","kind"],enums:{kind:["ambiguous","incomplete","contradictory","unmeasurable","missing-expected-result","budget-evicted","invariant-unexercised"],risk:["high","med","low"]}},stylenote:{hashed:["derived","learned_from_kind","statement","tags","text"],unhashed:["learned_from"],required:["derived","learned_from_kind","statement"],enums:{learned_from_kind:["edit","directed-edit","mistake","usage"]}}},f={DERIVES:{src:["source"],dst:["usecase","ac","scenario","test"],salient:["anchor","source_cid","source_id"],optionalSalient:["claim"],props:["anchor","claim","quote","source_cid","source_id"],pin:{comparesTo:"source_head"},cardinality:"many",acyclic:!1},belongs_to:{src:["scenario"],dst:["usecase"],salient:[],props:[],pin:{comparesTo:"dst_tip"},cardinality:"one-live-per-src",acyclic:!1},scoped_to:{src:["ac"],dst:["scenario","usecase"],salient:[],props:[],pin:{comparesTo:"dst_tip"},cardinality:"one-live-per-src",acyclic:!1},exercises:{src:["scenario"],dst:["ac"],salient:[],props:[],pin:{comparesTo:"dst_tip"},cardinality:"many",acyclic:!1},verifies:{src:["test"],dst:["ac"],salient:[],props:[],pin:{comparesTo:"dst_tip"},cardinality:"many",acyclic:!1},automates:{src:["test"],dst:["scenario"],salient:[],props:[],pin:{comparesTo:"dst_tip"},cardinality:"one-live-per-src-and-dst",acyclic:!1},depends_on:{src:["usecase","scenario"],dst:["usecase","scenario"],salient:[],props:["reason"],pin:{comparesTo:"dst_tip"},cardinality:"many",acyclic:!0},reuses:{src:["test"],dst:["test"],salient:[],props:[],pin:{comparesTo:"dst_tip"},cardinality:"many",acyclic:!0},annotates:{src:["gap","stylenote"],dst:["source","usecase","scenario","ac","test"],salient:[],props:["reason"],pin:{comparesTo:"dst_tip"},cardinality:"many",acyclic:!1}},E=["presence","forbidden-presence","count","delta","state-transition","absolute","bound","propagation","latency","graded"];var g={presence:{operators:["exists","forall"],baseline:"null",requires:[]},"forbidden-presence":{operators:["exists","forall"],baseline:"null",requires:[]},count:{operators:["equals","gte","lte"],baseline:"null",requires:[],operand_forms:["literal","derived"]},delta:{operators:["changed-by"],baseline:"required",requires:[]},"state-transition":{operators:["changed-by","equals"],baseline:"required",requires:[]},absolute:{operators:["equals","contains","gte","lte"],baseline:"null",requires:[]},bound:{operators:["gte","lte"],baseline:"null",requires:[]},propagation:{operators:["exists","equals"],baseline:"null",requires:[]},latency:{operators:["lte"],baseline:"null",requires:["within"]},graded:{operators:["gte"],baseline:"null",requires:["metric","threshold"]}},y=Object.freeze({SOURCE:"source",USECASE:"usecase",SCENARIO:"scenario",AC:"ac",TEST:"test",GAP:"gap",STYLENOTE:"stylenote"}),h=Object.freeze({DERIVES:"DERIVES",BELONGS_TO:"belongs_to",SCOPED_TO:"scoped_to",EXERCISES:"exercises",VERIFIES:"verifies",AUTOMATES:"automates",DEPENDS_ON:"depends_on",REUSES:"reuses",ANNOTATES:"annotates"});function c(n,s,i){let r=[],e=g[n];if(!e)return r.push({code:"BAD_CHECK",detail:`${i}.kind ${JSON.stringify(n)} not in ${E.join("|")}`}),r;let o=s.operator;o!==void 0&&!e.operators.includes(o)&&r.push({code:"BAD_CHECK",detail:`${i}: operator ${JSON.stringify(o)} illegal for kind "${String(n)}" (legal: ${e.operators.join("|")})`});for(let a of e.requires)(s[a]===void 0||s[a]===null||s[a]==="")&&r.push({code:"BAD_CHECK",detail:`${i}: kind "${String(n)}" requires "${a}"`});e.baseline==="null"&&s.baseline!==void 0&&s.baseline!==null&&r.push({code:"BAD_CHECK",detail:`${i}: kind "${String(n)}" must carry baseline null (only delta/state-transition have one)`});let t=s.operand;if(t!==null&&typeof t=="object"&&!Array.isArray(t)){let a=Object.keys(t),d=t.derived;(!(e.operand_forms?.includes("derived")??!1)||a.length!==1||a[0]!=="derived"||typeof d!="string"||!d.trim())&&r.push({code:"BAD_CHECK",detail:`${i}: object operand is only the count derivation form {derived: "<how the runtime value is computed>"}`})}return r}function m(n,s){let i=u[n];if(!i)return[{code:"UNKNOWN_LABEL",detail:`unknown node label ${JSON.stringify(n)}`}];let r=[];for(let e of Object.keys(s))s[e]!==void 0&&!i.hashed.includes(e)&&!(i.unhashed??[]).includes(e)&&r.push({code:"UNKNOWN_FIELD",detail:`${n}.${e} is not in the ${l} schema`});for(let e of i.required)(s[e]===void 0||s[e]===null)&&r.push({code:"MISSING_FIELD",detail:`${n}.${e} is required`});for(let[e,o]of Object.entries(i.enums)){let t=s[e];t!==void 0&&!o.includes(t)&&r.push({code:"BAD_ENUM",detail:`${n}.${e} ${JSON.stringify(t)} not in ${o.join("|")}`})}if(n==="test"&&s.check&&typeof s.check=="object"){let e=s.check;r.push(...c(e.kind,e,"test.check"))}if(n==="ac"&&s.expected_answer&&typeof s.expected_answer=="object"){let e=s.expected_answer;r.push(...c(s.kind??e.kind,e,"ac.expected_answer"))}return r}function p(n){return f[n]}function S(n,s,i,r){let e=p(n);if(!e)return[{code:"UNKNOWN_EDGE_TYPE",detail:`unknown edge type ${JSON.stringify(n)}`}];let o=[];e.src.includes(s)||o.push({code:"ILLEGAL_EDGE",detail:`${n} src must be ${e.src.join("|")}, got ${s}`}),e.dst.includes(i)||o.push({code:"ILLEGAL_EDGE",detail:`${n} dst must be ${e.dst.join("|")}, got ${i}`}),n==="depends_on"&&s!==i&&o.push({code:"ILLEGAL_EDGE",detail:`depends_on links same-label nodes only, got ${s}\u2192${i}`});for(let t of e.salient)(r[t]===void 0||r[t]===null)&&o.push({code:"MISSING_SALIENT",detail:`${n}.props.${t} is salient (inside the ecid) and required`});for(let t of Object.keys(r))r[t]!==void 0&&(e.props.includes(t)||o.push({code:"UNKNOWN_EDGE_PROP",detail:`${n}.props.${t} is not in the ${l} schema`}));return o}function k(n,s){let i=u[n];if(!i)return s;let r={};for(let e of i.hashed)s[e]!==void 0&&(r[e]=s[e]);return r}function N(n,s){let i=p(n);if(!i)return s;let r={};for(let e of i.salient)s[e]!==void 0&&(r[e]=s[e]);for(let e of i.optionalSalient??[])s[e]!==void 0&&(r[e]=s[e]);return r}export{l as a,u as b,f as c,y as d,h as e,m as f,p as g,S as h,k as i,N as j};
|
package/dist/chunk-6UJDOAYR.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as B,b as V,c as se}from"./chunk-33QXD75Y.js";import{a as j,b as N}from"./chunk-ZM5PVRJK.js";import{a as C,b as Y,e as M,f as te,m as re}from"./chunk-RKWJG3WW.js";import{a as ne,b as oe}from"./chunk-2YQ6TW77.js";import{a as L}from"./chunk-DXV6MBTD.js";import{a as ee}from"./chunk-WAOCHXJ5.js";import{a as Z}from"./chunk-KNDSQ4PS.js";import{a as A}from"./chunk-RZ4F3BHX.js";import{a as H}from"./chunk-JRMDGLLT.js";import{a as O}from"./chunk-F6ZOJXYU.js";import{y as h}from"./chunk-C4G7RVJ6.js";import{a as F}from"./chunk-HCBYKLMW.js";import{a as k,b as g,i as Q}from"./chunk-C44QQJR4.js";import{a as X}from"./chunk-6YGTRKDT.js";import{e as v}from"./chunk-UR6MHSHU.js";var D=v(X(),1);import{existsSync as P,readFileSync as Je,rmSync as pe,unlinkSync as Ke}from"fs";import{resolve as G}from"path";import{promises as ie,realpathSync as ke}from"fs";import{homedir as be}from"os";import{join as q,parse as Te,relative as ae,resolve as ce}from"path";var le=new Set(["node_modules",".git","dist","build",".next",".venv","venv","target","__pycache__"]),R=class extends Error{constructor(s){super(`refusing to scan '${s}'. Run from your project root, or pass --root <dir>.`);this.cwd=s;this.name="HomeRefusedError"}};function ue(e){try{return ke(ce(e))}catch{return ce(e)}}function Ee(e){let r=ue(e),s=ue(be()),n=Te(r).root;if(process.platform==="win32"){let o=t=>t.toLowerCase();return o(r)===o(s)||o(r)===o(n)}return r===s||r===n}async function U(e){if(Ee(e.root))throw new R(e.root);let r=e.maxEntries??5e4,s=e.maxResults??5e3,n=new Set(e.ignore??[]),o=[],t=0,i=0,c=!1,f,l=[e.root];for(;l.length>0&&!c;){let a=l.shift(),m;try{m=await ie.readdir(a,{withFileTypes:!0})}catch{continue}i++;for(let b of m){if(t++,t>r){c=!0,f="max_entries";break}let w=b.name,E=q(a,w);if(b.isDirectory()){if(le.has(w)||w.startsWith(".")||w.startsWith("output-")||n.has(w))continue;l.push(E)}else if(b.isFile()&&w.endsWith("_test.md")&&(o.push({path:E,relPath:ae(e.root,E),source:"cwd"}),o.length>=s)){c=!0,f="max_results";break}}e.onProgress?.(i,o.length)}if(!c){let m=[{dir:q(e.root,".testmuai","tests"),depth:0}];for(;m.length>0&&!c;){let{dir:b,depth:w}=m.shift(),E;try{E=await ie.readdir(b,{withFileTypes:!0})}catch{continue}i++;for(let u of E){if(t++,t>r){c=!0,f="max_entries";break}let x=u.name,y=q(b,x);if(u.isDirectory()){if(w>=20||x.startsWith(".")||x.startsWith("output-")||le.has(x))continue;m.push({dir:y,depth:w+1})}else if(u.isFile()&&x.endsWith("_test.md")&&(o.push({path:y,relPath:ae(e.root,y),source:"tests-dir"}),o.length>=s)){c=!0,f="max_results";break}}}}return{results:o,aborted:c,abortReason:f,dirsScanned:i}}import{readFileSync as Se}from"fs";function W(e){try{return re(e,Se(e,"utf8")).global.tags??[]}catch{return[]}}import{mkdirSync as ve,writeFileSync as Re}from"fs";import{join as Pe}from"path";function de(e,r){return`Basic ${Buffer.from(`${e}:${r}`).toString("base64")}`}async function Me(e){let r=ne({tmsBaseUrl:e.tmsBaseUrl,testcaseId:e.testcaseId,codeExport:{enabled:!0,language:e.language,skipValidation:e.skipValidation}}),s=await A(r.url,{method:"POST",headers:{"content-type":"application/json",authorization:de(e.auth.username,e.auth.access_key)},body:JSON.stringify(r.body)});if(!s.ok)throw new Error(`code-export trigger failed: ${s.status} ${await s.text()}`);e.log("info","CODE_EXPORT_TRIGGERED","Code export triggered",{testcase_id:e.testcaseId})}async function De(e){let r=oe({tmsBaseUrl:e.tmsBaseUrl,testcaseId:e.testcaseId}),s=e.pollIntervalMs??5e3,n=e.timeoutMs??3e5,o=Date.now()+n;for(;Date.now()<o;){let t=await A(r,{headers:{authorization:de(e.auth.username,e.auth.access_key),accept:"application/json"}});if(!t.ok){await new Promise(l=>setTimeout(l,s));continue}let c=(await t.json()).data?.find(l=>l.code_name==="kane-cli-trigger");if(!c){await new Promise(l=>setTimeout(l,s));continue}let f=(c.status??"").toLowerCase();if(f==="in progress"||f==="in_progress"||f==="pending"){await new Promise(l=>setTimeout(l,s));continue}if(!c.url||c.url.length===0)throw new Error(`code-export status=${c.status} but no files returned`);ve(e.outDir,{recursive:!0});for(let l of c.url){let a=Pe(e.outDir,l.file_name),m=await A(l.file_url);if(!m.ok){e.log("warn","CODE_EXPORT_FILE_FAILED","Failed to download file",{file_name:l.file_name,status:m.status});continue}let b=await m.text();Re(a,b,"utf-8")}return e.log("info","CODE_EXPORT_DOWNLOADED","Code export saved",{out_dir:e.outDir,file_count:c.url.length}),e.outDir}throw new Error("code-export polling timed out")}async function fe(e){return await Me(e),await De(e)}var T=v(X(),1);import{existsSync as $e,readFileSync as Ce}from"fs";var p=v(F(),1);function Ie(e){B(e);let r=M(e);if(!$e(r))return null;try{return JSON.parse(Ce(r,"utf8"))}catch{return{}}}function Fe(e){return e===null?"never_run":e.testcase_id?"synced":"local_only"}function Oe(e){return e==="synced"?"\u2601":e==="local_only"?"\u25A3":"\u25CB"}function Ae(e){return e==="tests-dir"?"\u2726":" "}function Le(e,r){return r==="all"?!0:r==="synced"?e.status==="synced":r==="local"?e.status==="local_only":r==="never_run"?e.status==="never_run":r==="cli"?e.source==="tests-dir":r==="hand"?e.source==="cwd":!0}var z=["all","synced","local","never_run","cli","hand"];function Be(e){let r=z.indexOf(e);return z[(r+1)%z.length]}function me({root:e,currentOrgId:r,onSelect:s,onCancel:n}){let[o,t]=(0,T.useState)([]),[i,c]=(0,T.useState)(null),[f,l]=(0,T.useState)(!0),[a,m]=(0,T.useState)("all");(0,T.useEffect)(()=>{(async()=>{try{let u=await U({root:e}),x=[];for(let y of u.results){let K=Ie(y.path);K?.org_id!==void 0&&K.org_id!==r||x.push({path:y.path,relPath:y.relPath,name:C(y.path),status:Fe(K),source:y.source,tags:W(y.path)})}t(x),l(!1)}catch(u){u instanceof R,c(u.message),l(!1)}})()},[e,r]);let b=(0,T.useMemo)(()=>o.filter(u=>Le(u,a)).map(u=>({id:u.path,label:`${Oe(u.status)} ${Ae(u.source)} ${u.relPath}${u.tags.length>0?` [${u.tags.join(", ")}]`:""}`})),[o,a]),w=(0,T.useMemo)(()=>Ne(a,o),[a,o]);if(i)return(0,p.jsxs)(k,{flexDirection:"column",borderStyle:"round",borderColor:h.red,paddingX:2,paddingY:1,children:[(0,p.jsx)(g,{color:h.red,bold:!0,children:"testmd"}),(0,p.jsx)(k,{marginTop:1,children:(0,p.jsx)(g,{color:h.red,children:i})})]});let E=a==="all"?"all":je(a);return(0,p.jsx)(Z,{title:`testmd \xB7 filter: ${E}`,items:b,loading:f,itemNoun:"tests",onSelect:u=>{let x=o.find(y=>y.path===u.id);x&&s(x)},onCancel:n,onTab:()=>m(u=>Be(u)),extraHint:"cycle filter",footer:w})}function je(e){return e==="synced"?"synced (\u2601)":e==="local"?"local (\u25A3)":e==="never_run"?"never run (\u25CB)":e==="cli"?"cli-generated (\u2726)":e==="hand"?"hand-written":"all"}function Ne(e,r){let s={synced:r.filter(o=>o.status==="synced").length,local:r.filter(o=>o.status==="local_only").length,never:r.filter(o=>o.status==="never_run").length,cli:r.filter(o=>o.source==="tests-dir").length,hand:r.filter(o=>o.source==="cwd").length},n=o=>o?h.orange:h.dim;return(0,p.jsxs)(k,{flexDirection:"column",children:[(0,p.jsx)(g,{color:h.dim,children:"legend:"}),(0,p.jsxs)(k,{children:[(0,p.jsx)(g,{color:n(e==="synced"),children:` \u2601 synced (${s.synced}) `}),(0,p.jsx)(g,{color:n(e==="local"),children:`\u25A3 local (${s.local}) `}),(0,p.jsx)(g,{color:n(e==="never_run"),children:`\u25CB never run (${s.never})`})]}),(0,p.jsxs)(k,{children:[(0,p.jsx)(g,{color:n(e==="cli"),children:` \u2726 cli-generated (${s.cli}) `}),(0,p.jsx)(g,{color:n(e==="hand"),children:` hand-written (${s.hand})`})]})]})}var I=v(X(),1);import{existsSync as Ue,readFileSync as We}from"fs";var d=v(F(),1);function ge({path:e,relPath:r,onAction:s,onBack:n,onView:o}){let[t,i]=(0,I.useState)(null),[c,f]=(0,I.useState)(!1);(0,I.useEffect)(()=>{let a=M(e);if(Ue(a))try{i(JSON.parse(We(a,"utf8")))}catch{i(null)}},[e]),Q((a,m)=>{if(m.escape){if(c){f(!1);return}n();return}if(c){a==="y"||a==="Y"?(f(!1),s("delete")):(a==="n"||a==="N")&&f(!1);return}a==="r"&&s("run"),a==="e"&&t?.testcase_id&&s("export"),a==="d"&&f(!0),a==="v"&&o&&o()});let l=({k:a,v:m})=>m?(0,d.jsxs)(g,{children:[(0,d.jsx)(g,{color:h.dim,children:a.padEnd(14)}),m]}):null;return(0,d.jsxs)(k,{flexDirection:"column",borderStyle:"round",borderColor:h.orange,paddingX:2,paddingY:1,children:[(0,d.jsx)(g,{color:h.orange,bold:!0,children:r}),(0,d.jsx)(k,{marginTop:1,flexDirection:"column",children:t?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(l,{k:"test_id",v:t.test_id}),(0,d.jsx)(l,{k:"testcase_id",v:t.testcase_id}),(0,d.jsx)(l,{k:"project_id",v:t.project_id}),(0,d.jsx)(l,{k:"folder_id",v:t.folder_id}),(0,d.jsx)(l,{k:"org_id",v:t.org_id}),(0,d.jsx)(l,{k:"session_name",v:t.session_name}),(0,d.jsx)(l,{k:"commit_id",v:t.commit_id})]}):(0,d.jsx)(g,{color:h.dim,children:"(never run \u2014 no meta.json)"})}),c?(0,d.jsx)(k,{marginTop:1,children:(0,d.jsxs)(g,{color:h.red,bold:!0,children:["Delete ",r," and its output dir? [y/n]"]})}):(0,d.jsx)(k,{marginTop:1,children:(0,d.jsxs)(g,{color:h.dim,children:["[r] run [e] export",t?.testcase_id?"":" (need testcase_id)"," [d] delete",o?" [v] view":""," [Esc] back"]})})]})}function $(e){B(e);let r=M(e);if(!P(r))return null;try{return JSON.parse(Je(r,"utf8"))}catch{return null}}function he(e,r){return!e||e.org_id===void 0?!0:e.org_id===r}function J(e,r){return he(e,r)?null:(process.stderr.write(`error: this test belongs to org ${e.org_id}; you are logged in as org ${r}.
|
|
3
|
-
Switch profiles with \`kane-cli profiles switch\` to act on it.
|
|
4
|
-
`),2)}async function Ut(e={}){let r=!!process.stdin.isTTY&&!e.json,s=new O,n=new L;await V({isInteractive:r,creds:s,config:n});let o=s.getDefaultEnv()??"prod";try{let t=await N({creds:s,env:o,log:()=>{}});return t.resolvedCreds?.org_id===void 0?(process.stderr.write("error: TMS did not return an org_id. Run `kane-cli login` again.\n"),{ok:!1,code:2}):{ok:!0,orgId:String(t.resolvedCreds.org_id)}}catch(t){if(t instanceof j)return process.stderr.write("error: not authenticated. Run `kane-cli login` first.\n"),{ok:!1,code:2};throw t}}async function Wt(e,r){if(process.stdin.isTTY&&!e.json)return await Ye(r,e.root);let s=e.root??process.cwd(),n;try{n=await U({root:s,ignore:e.ignore})}catch(o){if(o instanceof R)return process.stderr.write(`error: ${o.message}
|
|
5
|
-
`),2;throw o}for(let o of n.results){let t=$(o.path);if(!he(t,r))continue;let i={path:o.relPath.startsWith(".")?o.relPath:`./${o.relPath}`,name:C(o.path),has_meta:t!==null,source:o.source,synced:!!t?.testcase_id,tags:W(o.path)};t&&(t.test_id&&(i.test_id=t.test_id),t.testcase_id&&(i.testcase_id=t.testcase_id),t.org_id&&(i.org_id=t.org_id),t.project_id&&(i.project_id=t.project_id),t.folder_id&&(i.folder_id=t.folder_id)),process.stdout.write(JSON.stringify(i)+`
|
|
6
|
-
`)}return n.aborted&&process.stderr.write(`warn: walk aborted (${n.abortReason}). Pass --root or --ignore to narrow.
|
|
7
|
-
`),0}var _e=-1001,ye=-1002,we=-1003,_={action:null,path:null};function Xe(e,r){return _.action=e,_.path=r,e==="run"?_e:e==="export"?ye:we}function He({root:e,currentOrgId:r,onComplete:s}){let[n,o]=D.default.useState({kind:"list"});return D.default.useEffect(()=>{n.kind==="exiting"&&s(n.code)},[n,s]),n.kind==="list"?D.default.createElement(me,{root:e,currentOrgId:r,onSelect:t=>o({kind:"inspect",path:t.path,relPath:t.relPath}),onCancel:()=>o({kind:"exiting",code:0})}):n.kind==="inspect"?D.default.createElement(ge,{path:n.path,relPath:n.relPath,onAction:async t=>{o({kind:"exiting",code:Xe(t,n.path)})},onBack:()=>o({kind:"list"})}):null}async function Ye(e,r){let s=r??process.cwd(),{render:n}=await import("./build-JIKYOZUH.js"),o=await new Promise(t=>{let{unmount:i,waitUntilExit:c}=n(D.default.createElement(He,{root:s,currentOrgId:e,onComplete:f=>{i(),t(f)}}),{stdout:process.stderr,exitOnCtrlC:!0});c().then(()=>t(0)).catch(()=>t(0))});if(o===_e&&_.path){let{runTestMdFile:t}=await import("./run-test-md-DFNIGYB7.js"),i=await t(_.path,{});return _.action=null,_.path=null,i}if(o===ye&&_.path){let t=await qe(_.path,{},e);return _.action=null,_.path=null,t}if(o===we&&_.path){let t=await Ve(_.path,!0,e);return _.action=null,_.path=null,t}return o}async function Jt(e,r){let s=G(e);if(!P(s))return process.stderr.write(`error: file not found: ${s}
|
|
8
|
-
`),2;let n=$(s),o=J(n,r);if(o!==null)return o;let t={path:s,name:C(s),has_meta:n!==null};return n&&(n.commit_id&&(t.commit_id=n.commit_id),n.test_id&&(t.test_id=n.test_id),n.testcase_id&&(t.testcase_id=n.testcase_id),n.project_id&&(t.project_id=n.project_id),n.folder_id&&(t.folder_id=n.folder_id),n.org_id&&(t.org_id=n.org_id),n.session_name&&(t.session_name=n.session_name)),process.stdout.write(JSON.stringify(t)+`
|
|
9
|
-
`),0}async function Ve(e,r,s){let n=G(e);if(!P(n))return process.stderr.write(`error: file not found: ${n}
|
|
10
|
-
`),2;let o=$(n),t=J(o,s);if(t!==null)return t;if(!r)return process.stderr.write(`error: refusing to delete without --yes.
|
|
11
|
-
This will remove '${n}' and '${Y(n)}/'.
|
|
12
|
-
`),2;let i=Y(n);if(P(i))try{pe(i,{recursive:!0,force:!0})}catch(c){return process.stderr.write(`error: failed to remove ${i}: ${c.message}
|
|
13
|
-
`),2}try{Ke(n)}catch(c){return process.stderr.write(`error: failed to remove ${n}: ${c.message}
|
|
14
|
-
`),2}return process.stderr.write(`removed ${n} and ${i}/
|
|
15
|
-
`),0}var S=class extends Error{kind;constructor(r,s){super(s),this.name="ExportError",this.kind=r}};async function Kt(e,r){let{codeDir:s}=await xe(e,r);return{codeDir:s}}async function xe(e,r){let s=$(e);if(!s?.testcase_id)throw new S("not-synced","this test has not been synced to TMS \u2014 run `kane-cli testmd run` first.");let n=new L().load(),o=r.language??n.code_export?.language;if(!o)throw new S("no-language","--language not provided and no default in tui-config.");let t=r.output??te(e,"playwright",o),i=P(t);if(i&&!r.force){let a=!1;try{let{readdirSync:m}=await import("fs");a=m(t).length>0}catch{}if(a)return{kind:"reused",codeDir:t}}i&&r.force&&pe(t,{recursive:!0,force:!0});let c=new O,f=r.env??c.getDefaultEnv()??"prod",l;try{l=await N({creds:c,env:f,log:()=>{}})}catch(a){throw a instanceof j?new S("auth-fail","not authenticated. Run `kane-cli login` first."):a}if(!l.basicAuth)throw new S("auth-incomplete","TMS basic auth could not be resolved. Run `kane-cli login` again.");try{let a=H(f);await fe({tmsBaseUrl:a.tmsBaseUrl,testcaseId:s.testcase_id,auth:l.basicAuth,language:o,framework:"playwright",skipValidation:n.code_export?.skip_validation??!0,outDir:t,log:()=>{}})}catch(a){throw new S("export-fail",`code export failed: ${a.message}`)}return{kind:"exported",codeDir:t}}async function qe(e,r,s){let n=G(e);if(!P(n))return process.stderr.write(`error: file not found: ${n}
|
|
16
|
-
`),2;let o=$(n),t=J(o,s);if(t!==null)return t;try{let i=await xe(n,r);return i.kind==="reused"?process.stderr.write(`reusing existing export at ${i.codeDir}
|
|
17
|
-
`):process.stderr.write(`exported to ${i.codeDir}
|
|
18
|
-
`),0}catch(i){if(i instanceof S)return i.kind==="not-synced"?(process.stderr.write("error: this test has not been synced to TMS \u2014 run `kane-cli testmd run` first.\n"),2):i.kind==="no-language"?(process.stderr.write(`error: --language not provided and no default in tui-config.
|
|
19
|
-
`),2):i.kind==="auth-fail"?(process.stderr.write("error: not authenticated. Run `kane-cli login` first.\n"),2):i.kind==="auth-incomplete"?(process.stderr.write("error: TMS basic auth could not be resolved. Run `kane-cli login` again.\n"),2):(process.stderr.write(`error: ${i.message}
|
|
20
|
-
`),2);throw i}}async function Xt(e={}){let r=!!process.stdin.isTTY,s=new O,n=new L;await V({isInteractive:r,creds:s,config:n});let o=e.env??s.getDefaultEnv()??"prod";try{let t=await N({creds:s,env:o,usernameFlag:e.username,accessKeyFlag:e.accessKey,log:()=>{}});return t.resolvedCreds?.org_id===void 0||!t.basicAuth?(process.stderr.write("error: could not resolve TMS credentials. Run `kane-cli login` again.\n"),{ok:!1,code:2}):{ok:!0,orgId:String(t.resolvedCreds.org_id),basicAuth:t.basicAuth,controllerBaseUrl:H(o).controllerBaseUrl}}catch(t){if(t instanceof j)return process.stderr.write("error: not authenticated. Run `kane-cli login` first.\n"),{ok:!1,code:2};throw t}}async function Ht(e,r,s=se){if(!P(e))return process.stderr.write(`error: file not found: ${e}
|
|
21
|
-
`),2;if(!e.endsWith("_test.md"))return process.stderr.write(`error: not a *_test.md file: ${e}
|
|
22
|
-
`),2;let n=$(e),o=J(n,r.orgId);if(o!==null)return o;if(!n?.commit_id||!n?.test_id)return process.stderr.write(`error: ${e} is not authored \u2014 run \`kane-cli testmd run ${e}\` first.
|
|
23
|
-
`),2;let t=await s({sourcePath:e,testId:n.test_id,sessionId:n.commit_id,commitId:n.commit_id,controller:new ee(r.controllerBaseUrl,{username:r.basicAuth.username,accessKey:r.basicAuth.access_key})}),i={type:"test_md_bundle_sync",status:t.ok?"ok":"failed",commit_id:n.commit_id,...t.ok?{bytes:t.bytes}:{stage:t.stage}};return process.stdout.write(JSON.stringify(i)+`
|
|
24
|
-
`),t.ok?(process.stderr.write(`synced: ${n.commit_id}-testmd.zip (${t.bytes} bytes)
|
|
25
|
-
`),0):(process.stderr.write(`error: bundle sync failed at ${t.stage}: ${t.error}
|
|
26
|
-
`),t.stage==="collect"?2:1)}export{U as a,W as b,me as c,ge as d,$ as e,he as f,J as g,Ut as h,Wt as i,Ye as j,Jt as k,Ve as l,S as m,Kt as n,qe as o,Xt as p,Ht as q};
|