@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
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as j}from"./chunk-L5LI2JF4.js";import{c as C}from"./chunk-EYOCNMUM.js";import{dirname as U,basename as q,join as y}from"path";function Z(e){let t=q(e);return t.endsWith("_test.md")?t.slice(0,-8):t.endsWith(".md")?t.slice(0,-3):t}function v(e){return y(U(e),`output-${Z(e)}`)}function Te(e){return y(v(e),"Result.md")}function T(e){return y(v(e),".internal")}function O(e){return y(T(e),"meta.json")}function Ae(e,t,n){return y(v(e),`${t}-${n}-code`)}function Ie(e){return y(v(e),"generated-code")}function Le(e){return v(e)+".staging"}function Q(e){return y(T(e),"steps")}function Pe(e,t,n){return y(Q(e),`${t}-${n}`)}import{existsSync as p,renameSync as S,rmSync as _}from"fs";function Ke(e){let t=`${e}.staging`,n=`${e}.bak`;if(!p(t))throw new Error(`atomicReplaceDir: staging missing: ${t}`);if(process.platform==="win32"){p(e)&&_(e,{recursive:!0,force:!0}),S(t,e);return}p(e)&&(p(n)&&_(n,{recursive:!0,force:!0}),S(e,n)),S(t,e),p(n)&&_(n,{recursive:!0,force:!0})}function Ge(e){let t=`${e}.staging`,n=`${e}.bak`;if(process.platform==="win32"){p(t)&&(p(e)?_(t,{recursive:!0,force:!0}):S(t,e));return}if(p(n)&&!p(e)){S(n,e),p(t)&&_(t,{recursive:!0,force:!0});return}p(n)&&p(e)&&_(n,{recursive:!0,force:!0}),p(t)&&p(e)&&_(t,{recursive:!0,force:!0})}import{readFileSync as Se,existsSync as xe}from"fs";import{basename as N,dirname as Re,isAbsolute as $e,resolve as J}from"path";import{dirname as X,isAbsolute as ee,resolve as te}from"path";var d=class extends Error{constructor(n,o,r){super(`[${o}${r!=null?`:${r}`:""}] ${n}`);this.file=o;this.line=r;this.name="TestMdParseError"}},ne=new Set(["username","access_key","oauth","profile","project_id","folder_id"]),A=new Set(["mode","max_steps","timeout","global_context","local_context","variables","session_context","code_export","code_language","url","target","chrome_profile","cdp_endpoint","ws_endpoint","headless","app","no_reset","on_lock_conflict","tags","assurance"]),I=new Set(["optional"]),re=new Set(["optional","variables"]),oe=new Set(["target","chrome_profile","cdp_endpoint","ws_endpoint","headless"]),ie=new Set(["app","no_reset"]),se=new Set(["mode","on_lock_conflict","tags","assurance"]);function L(e,t){let n=t.split(`
|
|
3
|
+
`),{global:o,bodyStartLine:r}=ae(e,n),{title:a,steps:s}=be(e,n,r);return{path:e,title:a,global:o,steps:s}}function ae(e,t){if(t[0]?.trim()!=="---")return{global:{},bodyStartLine:0};let n=-1;for(let c=1;c<t.length;c++)if(t[c].trim()==="---"){n=c;break}if(n===-1)throw new d("frontmatter is missing closing '---'",e,1);let o=t.slice(1,n).join(`
|
|
4
|
+
`),r;try{r=j(o)??{}}catch(c){throw new d(`invalid YAML in frontmatter: ${c.message}`,e,1)}if(V(e,r,"frontmatter",1),r.on_lock_conflict!==void 0){let c=r.on_lock_conflict;if(c!=="readonly"&&c!=="fail"&&c!=="wait")throw new d(`on_lock_conflict must be 'readonly' | 'fail' | 'wait', got: ${JSON.stringify(c)}`,e,1)}if(F(e,r,1),r.assurance!==void 0){let c=r.assurance;if(c===null||typeof c!="object"||Array.isArray(c))throw new d("assurance must be a mapping with sub-keys {id, base}",e,1);let f=c;for(let g of Object.keys(f))if(g!=="id"&&g!=="base")throw new d(`unknown assurance sub-key '${g}' \u2014 the engine block allows only {id, base}`,e,1);if(typeof f.id!="string"||f.id.length===0)throw new d("assurance.id must be a non-empty string (logical id)",e,1);if(f.base!==void 0&&!(typeof f.base=="string"&&/^sha256:[0-9a-f]+$/.test(f.base)))throw new d("assurance.base must be a 'sha256:<hex>' string",e,1)}if(r.tags!==void 0){let c=r.tags,f=Array.isArray(c)?c.map(g=>String(g)).join(","):String(c);r.tags=ce(f,e,1)}if(r.target!==void 0&&(r.target=le(r.target,e,1)),r.app!==void 0&&(r.app=ge(r.app,e,1)),r.no_reset!==void 0&&typeof r.no_reset!="boolean")throw new d(`no_reset must be boolean: got ${typeof r.no_reset}`,e,1);let a=r.target,s=a==="emulator"||a==="simulator";if(s&&r.app===void 0)throw new d(`target: ${String(a)} needs an app \u2014 add \`app: <path-to-build | APPid>\``,e,1);if(!s&&r.app!==void 0)throw new d("app requires a mobile target \u2014 add `target: emulator` or `target: simulator`",e,1);if(!s&&r.no_reset!==void 0)throw new d("no_reset requires a mobile target \u2014 add `target: emulator` or `target: simulator`",e,1);return{global:r,bodyStartLine:n+1}}function ce(e,t,n){let r=e.trim().replace(/^\[/,"").replace(/\]$/,"").split(",").map(a=>a.trim().toLowerCase());if(r.length===0||r.some(a=>a.length===0))throw new d("tags must be a non-empty list of non-empty strings",t,n);return[...new Set(r)]}var de=new Set(["chrome","cdp","ws","emulator","simulator"]),fe="target must be one of 'chrome' | 'cdp' | 'ws' (web) or 'emulator' | 'simulator' (mobile, with a root `app:` key)";function le(e,t,n){if(typeof e=="string"&&de.has(e))return e;throw e!==null&&typeof e=="object"&&!Array.isArray(e)?new d(`the mapping form of target is no longer accepted \u2014 write flat keys:
|
|
5
|
+
target: emulator | simulator
|
|
6
|
+
app: <path-to-build | APPid>`,t,n):new d(`${fe} \u2014 got: ${JSON.stringify(e)}`,t,n)}function ge(e,t,n){if(typeof e!="string"||e.trim().length===0)throw new d("app must be a build (e.g. ./builds/app-debug.apk) or an app id from your cloud uploads",t,n);let o=e.trim();if(!/\.(apk|zip)$/i.test(o)&&!/^APP\d{6,}$/.test(o))throw new d(`app '${o}' is not a build \u2014 expected a path ending in .apk or .zip, or an app id from your cloud uploads.`,t,n);return pe(o,t)}function pe(e,t){return/^APP[0-9A-Za-z_-]+$/.test(e)||ee(e)?e:te(X(t),e)}function We(e){let t=e.target;if(!(t!=="emulator"&&t!=="simulator"))return{platform:C(t)??"",app:e.app??"",...e.no_reset!==void 0?{no_reset:e.no_reset}:{}}}function P(e){let t=e.target;return t==="chrome"||t==="cdp"||t==="ws"?t:void 0}var ue=/\s@verifies\s+(ac-[\w.:\/-]+(?:\s*,\s*ac-[\w.:\/-]+)*)\s*$/;function me(e,t,n){let o=ue.exec(t);if(o)return{label:t.slice(0,o.index).trim(),verifies:o[1].split(",").map(a=>a.trim())};let r=t.lastIndexOf("@verifies");if(r>0&&/\s/.test(t[r-1])){let a=t.slice(r+9).split(/[\s,]+/).filter(s=>s.length>0);if(a.length===0||a.every(s=>s.startsWith("ac-")))throw new d("malformed @verifies directive \u2014 expected '@verifies ac-<id>[, ac-<id>\u2026]' at the end of the heading",e,n)}return{label:t,verifies:[]}}function be(e,t,n){let o,r=n;for(;r<t.length&&t[r].trim()==="";)r++;let a=r<t.length?/^#\s+(.+?)\s*$/.exec(t[r]):null;a&&(o=a[1],r++);let s=[];for(let f=r;f<t.length;f++)/^##\s/.test(t[f])&&s.push(f);let c=[];for(let f=0;f<s.length;f++){let g=s[f],u=s[f+1]??t.length,h=t[g].replace(/^##\s+/,"").trim(),{label:i,verifies:l}=me(e,h,g+1),m=t.slice(g+1,u),{config:b,body:w,optional:R}=he(e,g+1,m);c.push({index:f+1,heading:i,verifies:l,config:b,body:w,headingLine:g+1,optional:R})}return{title:o,steps:c}}function he(e,t,n){let o=0;for(;o<n.length&&n[o].trim()==="";)o++;let r,a=t;if(o<n.length&&/^```yaml\s*$/.test(n[o])){let l=o;a=t+l,o++;let m=-1;for(;o<n.length;){if(/^```\s*$/.test(n[o])){m=o;break}o++}if(m===-1)throw new d("step-config fenced ```yaml block is not closed",e,a);let b=n.slice(l+1,m).join(`
|
|
7
|
+
`);try{r=j(b)??{}}catch(w){throw new d(`invalid YAML in step config: ${w.message}`,e,a)}o=m+1}let s=we(n.slice(o)),c=s.filter(l=>l.trim()!=="");if(c.length>0&&/^@session\s+/.test(c[0].trim()))throw new d("@session is no longer supported (iteration 3); use @import instead",e,t);let f=/^@import\s+(\S.*)$/,u=s.filter(l=>f.test(l.trim())).length>0;if(u&&c.length!==1)throw new d("step body must be exactly one of prose / @import",e,t);let h=!1,i;if(r){if(V(e,r,u?"step config (ref)":"step config (objective)",a),F(e,r,a),typeof r.optional=="boolean")h=r.optional;else if(r.optional!==void 0)throw new d(`step config 'optional' must be boolean: got ${typeof r.optional}`,e,a);let l={...r};delete l.optional,u&&delete l.variables,!u&&Object.keys(l).length>0&&(i=l)}if(u){let m=f.exec(c[0].trim())[1].trim(),b=r?.variables;return{body:{kind:"import_ref",path:m,...b&&Object.keys(b).length>0?{bindings:b}:{}},optional:h}}return{body:{kind:"objective",text:s.join(`
|
|
8
|
+
`).trim()},config:i,optional:h}}function we(e){let t=0,n=e.length;for(;t<n&&e[t].trim()==="";)t++;for(;n>t&&e[n-1].trim()==="";)n--;return e.slice(t,n)}function F(e,t,n){let o=t.variables;if(o==null)return;if(typeof o!="object"||Array.isArray(o))throw new d("variables must be an object map",e,n);let r={};for(let[a,s]of Object.entries(o))if(typeof s=="string")r[a]={value:s};else if(s&&typeof s=="object"&&!Array.isArray(s)&&typeof s.value=="string")r[a]=s;else throw new d(`variable '${a}' must be a string or { value: ... } object`,e,n);t.variables=r}function V(e,t,n,o){for(let r of Object.keys(t)){if(ne.has(r))throw new d(`auth/identity keys are CLI-only: ${r}`,e,o);if(n==="frontmatter"){if(I.has(r))throw new d(`step-only key in frontmatter: ${r}`,e,o);if(!A.has(r))throw new d(`unknown config key: ${r}`,e,o)}else if(n==="step config (objective)"){if(!A.has(r)&&!I.has(r))throw new d(`unknown config key: ${r}`,e,o);if(oe.has(r))throw new d(`chrome config is global-only: ${r}`,e,o);if(ie.has(r))throw new d(`'${r}' is global-only: the whole run drives one app`,e,o);if(se.has(r))throw new d(`'${r}' is run-level and cannot be set per-step`,e,o)}else if(!re.has(r))throw new d(`step config on @import may only contain 'optional' / 'variables': got ${r}`,e,o)}}import{createHash as K}from"crypto";function x(e){if(e==null)return null;if(Array.isArray(e))return e.map(x);if(typeof e=="object"){let t={};for(let n of Object.keys(e).sort()){let o=e[n];o!==void 0&&(t[n]=x(o))}return t}return e}function ye(e){if(e.body.kind!=="objective")throw new Error("stepMd5: only objective steps have an md5; @import rows do not");let t={...e.config??{},optional:e.optional??!1},n=JSON.stringify(x(t));return K("md5").update(e.body.text).update(`
|
|
9
|
+
`).update(n).digest("hex")}function G(e){let t={};for(let[o,r]of Object.entries(e.bindings??{}))t[o]={value:r.value,...r.secret===!0?{secret:!0}:{},...r.syntax?{syntax:r.syntax}:{}};let n=JSON.stringify(x({bindings:t,optional:e.optional}));return K("md5").update(e.path).update(`
|
|
10
|
+
`).update(n).digest("hex")}function ze(e){return ye({index:e.trace[e.trace.length-1].stepIndex,heading:e.trace[e.trace.length-1].heading,verifies:[],body:{kind:"objective",text:e.objective},config:e.parsedConfig,headingLine:1,optional:e.optional})}import{writeFileSync as _e,mkdirSync as ke,readFileSync as ve}from"fs";import{dirname as Y}from"path";function D(e){try{return JSON.parse(ve(O(e),"utf8"))}catch{return null}}function Xe(e){let t=O(e.sourcePath);try{ke(Y(t),{recursive:!0})}catch(o){return process.stderr.write(`
|
|
11
|
+
\u26A0 Failed to create output directory.
|
|
12
|
+
${o.message}
|
|
13
|
+
Path: ${Y(t)}
|
|
14
|
+
|
|
15
|
+
`),t}let n={commit_id:e.commitId};e.testId!==void 0&&(n.test_id=e.testId),e.testcaseId!==void 0&&(n.testcase_id=e.testcaseId),e.projectId!==void 0&&(n.project_id=e.projectId),e.folderId!==void 0&&(n.folder_id=e.folderId),e.orgId!==void 0&&(n.org_id=e.orgId),e.sessionName!==void 0&&(n.session_name=e.sessionName),e.plan!==void 0&&(n.plan=e.plan);try{_e(t,JSON.stringify(n,null,2)+`
|
|
16
|
+
`,"utf8")}catch(o){process.stderr.write(`
|
|
17
|
+
\u26A0 Failed to write meta.json.
|
|
18
|
+
${o.message}
|
|
19
|
+
Path: ${t}
|
|
20
|
+
|
|
21
|
+
`)}return t}var W=["target","chrome_profile","cdp_endpoint","ws_endpoint","headless"],je=["app","no_reset"],Oe=["mode","on_lock_conflict","tags","target","chrome_profile","cdp_endpoint","ws_endpoint","headless","app","no_reset"],k=class extends Error{constructor(t){super(t),this.name="TestMdResolveError"}};function E(e){return N(e).endsWith("_test.md")?"test":"helper"}function st(e){let t=J(e),n=B(t),o=Ee(n.global),r=[],a=[],s=[{file:t,kind:E(t)}],c=[];return H(n,a,r,[],t,{},s,c,{}),r.forEach((g,u)=>g.flatIndex=u+1),{rootPath:t,rootTitle:n.title,rootGlobal:n.global,rootSteps:n.steps,chrome:o,steps:r,unitFiles:s,warnings:c}}function at(e){let t=[];for(let n of e.unitFiles){if(n.kind!=="test")continue;let o=D(n.file);o&&t.push({file:n.file,...o.project_id?{project_id:String(o.project_id)}:{},...o.org_id?{org_id:String(o.org_id)}:{}})}return t}function B(e){if(!xe(e))throw new k(`@import path not found: ${e}`);let t=Se(e,"utf8");return L(e,t)}function H(e,t,n,o,r,a,s,c,f){if(t.includes(e.path)){let i=[...t,e.path].map(l=>N(l)).join(" \u2192 ");throw new k(`cyclic reference: ${i}`)}t.push(e.path);let g=o.length===0,u=e.global.variables??{};for(let i of Object.keys(a))if(Object.hasOwn(u,i))throw new k(`callsite binding '${i}' collides with a declared variable in ${e.path} (frontmatter variables are pinned; parameters are its undeclared names)`);let h=e.global;if(!g){let i={...e.global};for(let l of Oe)i[l]!==void 0&&(c.push(`${e.path}: '${l}' is root-governed on imported units \u2014 ignored`),delete i[l]);i.url!==void 0&&(f.pending=String(i.url),delete i.url),h=i}for(let i of e.steps){let l=i.body.kind!=="objective";if(i.optional&&l&&!g)throw new k(`intermediate-ref 'optional' is not supported in v1: ${e.path}:${i.headingLine}`);if(i.body.kind==="objective"){let $={file:e.path,stepIndex:i.index,heading:i.heading,optional:i.optional??!1},z=Me(h,i.config,a),M={flatIndex:0,objective:i.body.text,sourceFile:e.path,trace:[...o,$],config:z,parsedConfig:i.config,optional:i.optional??!1,verifies:i.verifies,owningFile:e.path,unitKind:E(e.path)};f.pending&&(M.unitEntryUrl=f.pending,f.pending=void 0),n.push(M);continue}let m={file:e.path,stepIndex:i.index,heading:i.heading,optional:i.optional??!1,rowMd5:G({path:i.body.path,bindings:i.body.bindings,optional:i.optional??!1})},b=Re(e.path),w=$e(i.body.path)?i.body.path:J(b,i.body.path),R=B(w);s.some($=>$.file===w)||s.push({file:w,kind:E(w)}),H(R,t,n,[...o,m],r,i.body.bindings??{},s,c,f)}g||(f.pending=void 0),t.pop()}function Ee(e){let t={};for(let n of W){if(n==="target"){let o=P(e);o!==void 0&&(t.target=o);continue}e[n]!==void 0&&(t[n]=e[n])}return t}function Me(e,t,n){let o={};for(let[s,c]of Object.entries(e))W.includes(s)||je.includes(s)||(o[s]=c);let r={...o,...t??{}},a={...n,...e.variables??{},...t?.variables??{}};return Object.keys(a).length>0?r.variables=a:delete r.variables,r}export{Z as a,v as b,Te as c,T as d,O as e,Ae as f,Ie as g,Le as h,Q as i,Pe as j,Ke as k,Ge as l,L as m,We as n,G as o,ze as p,D as q,Xe as r,k as s,st as t,at as u};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as R}from"./chunk-TDPWFYTJ.js";import{a as x}from"./chunk-T5Y6MOLM.js";import{d as S}from"./chunk-FNH55WSR.js";import{d as y}from"./chunk-TYLYFERW.js";import{a as p}from"./chunk-G7VQCS4J.js";import{e as g,j as E}from"./chunk-27U4PLPX.js";import{spawn as M,execSync as h}from"child_process";import{appendFileSync as b,existsSync as m,mkdirSync as C}from"fs";import{homedir as L}from"os";import{join as V,resolve as s,dirname as v,delimiter as T}from"path";import{fileURLToPath as U}from"url";import{createInterface as I}from"readline";async function*A(e){let n=I({input:e,crlfDelay:1/0});for await(let r of n){let o=r.trim();if(o)try{let i=JSON.parse(o);i&&typeof i.type=="string"&&(yield i)}catch{}}}function O(e){return e==="action"?{set:{V16_AGENT_ENABLE_ALL_BLOCKERS:"true",V16_BIFURCATION_PHASES:"1"},unset:["V16_NETWORK_WS","V16_NETWORK_SSE"]}:{set:{V16_BIFURCATION_PHASES:"1"},unset:["V16_AGENT_ENABLE_ALL_BLOCKERS","V16_NETWORK_WS","V16_NETWORK_SSE"]}}function w(e){return e?{set:{},unset:["V16_AGENT_SKIP_CP_FINAL"]}:{set:{V16_AGENT_SKIP_CP_FINAL:"true"},unset:[]}}function N(e){return e==="dom"?{set:{V16_AGENT_ENABLE_TEXTUAL_VISUAL:"true"},unset:[]}:{set:{},unset:["V16_AGENT_ENABLE_TEXTUAL_VISUAL"]}}var c=v(U(import.meta.url));function k(){for(let e of["python3","python"])try{return h(`${e} --version`,{stdio:"ignore"}),e}catch{}return null}function D(){let n=process.platform==="win32"?"v16-runner.exe":"v16-runner",r={"darwin-arm64":["@testmuai/kane-cli-darwin-arm64","@lambdatestincprivate/kane-cli-darwin-arm64"],"darwin-x64":["@testmuai/kane-cli-darwin-x64","@lambdatestincprivate/kane-cli-darwin-x64"],"linux-x64":["@testmuai/kane-cli-linux-x64","@lambdatestincprivate/kane-cli-linux-x64"],"linux-arm64":["@testmuai/kane-cli-linux-arm64","@lambdatestincprivate/kane-cli-linux-arm64"],"win32-x64":["@testmuai/kane-cli-win-x64","@lambdatestincprivate/kane-cli-win-x64"]},o=`${process.platform}-${process.arch}`,i=r[o];if(i)for(let t of i){let a=[s(c,"..","node_modules",t,"bin",n),s(c,"..","..","node_modules",t,"bin",n),s(c,"..","..","..","node_modules",t,"bin",n),s(c,"..","..","..","..","node_modules",t,"bin",n)];for(let u of a)if(m(u))return{cmd:u,args:[]}}let d=[s(c,"bin",n),s(c,"..","bin",n),s(c,"..","..","..","..","v16-runner","dist",n),s(c,"..","..","..","v16-runner","dist",n),s(c,"..","..","v16-runner","dist",n),s(process.cwd(),"v16-runner","dist",n),s(process.cwd(),"..","v16-runner","dist",n)];for(let t of d)if(m(t))return{cmd:t,args:[]};let l=[s(c,"..","..","v16-runner"),s(c,"..","..","..","..","v16-runner"),s(c,"..","..","..","v16-runner"),s(process.cwd(),"v16-runner"),s(process.cwd(),"..","v16-runner")];for(let t of l)if(m(s(t,"main.py"))){for(let u of[s(t,".venv","bin","python"),s(t,"..",".venv","bin","python"),s(t,"..","browser-agent",".venv","bin","python")])if(m(u))return{cmd:u,args:["main.py"],cwd:t};let a=k();if(a)return{cmd:a,args:["main.py"],cwd:t}}return null}function P(e){return e?V(L(),".testmuai","kaneai","sessions",e,"runner-stderr.log"):null}function K(e){let n=M(e.runner.cmd,e.runner.args,{stdio:["pipe","pipe","pipe"],env:e.env,cwd:e.runner.cwd});n.stdin.on("error",()=>{});let r=P(e.sessionId);if(r)try{C(v(r),{recursive:!0})}catch{}let o=1e5,i="";n.stderr.on("data",u=>{if(i+=u.toString(),i.length>o&&(i=i.slice(-o)),r)try{b(r,u)}catch{}}),n.on("error",u=>{e.log?.("error","RUNNER_SPAWN_ERROR","Runner spawn error",{error:u.message})});let d=null,l=null,t=new Promise(u=>{n.on("close",(f,_)=>{d=f,l=_?String(_):null,e.log?.("info","RUNNER_EXIT","Runner exited",{code:f,signal:l??"none"}),u({code:f,signal:l})})}),a=A(n.stdout);return{child:n,events:a,getStderr:()=>i,getExitCode:()=>d,getExitSignal:()=>l,exited:t}}async function B(e,n){if(!n?.platform||!n.target_kind)return;let r=await S(n.platform)?.toolEnv(n.target_kind)??{dirs:[]};if(r.dirs.length>0&&(e.PATH=[...r.dirs,e.PATH??""].filter(Boolean).join(T)),r.appiumHome&&(e.APPIUM_HOME=r.appiumHome),r.wdaRoot&&(e.TESTMU_IOS_WDA_DERIVED_DATA=r.wdaRoot),n.platform==="android"){let o=y();o&&(e.PATH=[o.platformToolsDir,e.PATH??""].filter(Boolean).join(T),e.ANDROID_HOME=o.root,e.ANDROID_SDK_ROOT=o.root)}}function H(e){let n={...process.env};e.environment&&(n.TESTMUAI_ENV=e.environment),n.TESTMUAI_SOURCE="kane-cli",process.platform==="win32"&&(n.PYTHONIOENCODING="utf-8",n.PYTHONUTF8="1");let r=p(e.environment);n.V16_SERVER_API_HOST=r.v16ServerHost,n.ATMS_URL=r.tmsBaseUrl.replace(/\/api\/?$/,""),e.username&&e.accessKey&&(n.LT_USERNAME=e.username,n.LT_ACCESS_KEY=e.accessKey),e.sessionId&&(n.TESTMUAI_SESSION_ID=e.sessionId);let o=O(e.mode??"testing");Object.assign(n,o.set);for(let a of o.unset)delete n[a];let i=new x().load(),d=N(e.assertionMode??(i.assertion_mode==="visual"?"visual":"dom"));Object.assign(n,d.set);for(let a of d.unset)delete n[a];let l=e.finalValidation??i.final_validation,t=w(l);Object.assign(n,t.set);for(let a of t.unset)delete n[a];return n}function G(e,n){let r=p(n?.environment),o=R();o!==void 0&&e.ap_mode===void 0&&(e.ap_mode=o),e.telemetry_proxy_url===void 0&&process.env.KANE_TELEMETRY!=="0"&&(e.telemetry_proxy_url=E),e.media_upload===void 0&&e.org_id&&e.username&&e.access_key&&(e.media_upload={url:r.shareApiBaseUrl.replace(/\/$/,"")+"/mfs/v1.0/media/upload",artefacts_host:r.mediaArtefactsHost,org_id:e.org_id,media_dir:g})}async function oe(e,n){let r=D();if(!r)throw new Error("v16-runner not found. Build the binary with `cd v16-runner && python build.py` or ensure Python is available.");process.env.KANE_SPAWN_DEBUG&&process.stderr.write(`[spawn-debug] ${JSON.stringify(r)}
|
|
3
|
+
`);let o=H({environment:n?.environment,mode:n?.mode,assertionMode:n?.assertionMode,finalValidation:n?.finalValidation,username:e.username,accessKey:e.access_key,sessionId:e.session_id});e.device?.platform&&await B(o,e.device),G(e,{environment:n?.environment});let i=K({env:o,runner:r,log:n?.log,sessionId:e.session_id}),d=i.child;d.stdin.write(JSON.stringify(e)+`
|
|
4
|
+
`);let l=P(e.session_id);if(l)try{C(v(l),{recursive:!0}),b(l,`--- runner spawn ${new Date().toISOString()} run_index=${e.run_index} ---
|
|
5
|
+
`)}catch{}return{child:d,events:i.events,sendUserResponse(t){let a=JSON.stringify({type:"user_response",answer:t});try{d.stdin.write(a+`
|
|
6
|
+
`)}catch{}},sendCancel(t){let a=JSON.stringify({type:"cancel",reason:t});try{d.stdin.write(a+`
|
|
7
|
+
`)}catch{}},cancel(){d.kill("SIGTERM")},get stderr(){return i.getStderr()},get exitCode(){return i.getExitCode()},get exitSignal(){return i.getExitSignal()},exited:i.exited}}export{D as a,K as b,B as c,H as d,G as e,oe as f};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
2
|
function l(r){let{isAgent:c,log:m}=r,a=r.stdout??process.stderr,s=r.stdin??process.stdin,p=t=>{c&&process.stdout.write(JSON.stringify(t)+`
|
|
3
|
-
`)};return{async runSteps(t){let{default:e}=await import("./react-QWOAB3TB.js"),{render:o}=await import("./build-JIKYOZUH.js"),{TestMdRunView:i}=await import("./TestMdRunView-
|
|
3
|
+
`)};return{async runSteps(t){let{default:e}=await import("./react-QWOAB3TB.js"),{render:o}=await import("./build-JIKYOZUH.js"),{TestMdRunView:i}=await import("./TestMdRunView-7UVSDAF4.js"),{ScrollbackProvider:n}=await import("./scrollback-JLPJR25X.js"),{waitUntilExit:d}=o(e.createElement(n,null,e.createElement(i,t)),{stdout:a,stdin:s,exitOnCtrlC:!1});await d()},async runUpload(t,e){let{renderUploadProgress:o}=await import("./CliUploadProgress-6HL7WTEX.js");return await o(t,e)},async onSummary(t){try{let{default:e}=await import("./react-QWOAB3TB.js"),{render:o}=await import("./build-JIKYOZUH.js"),{AutoExitSummaryBox:i}=await import("./SummaryBox-UAYSVFB7.js"),{waitUntilExit:n}=o(e.createElement(i,{data:t}),{stdout:a,stdin:s});await n()}catch(e){m("warn","TEST_MD_SUMMARY_RENDER_FAILED","Summary box render failed",{error:String(e)})}},async onLinks(t){try{let{default:e}=await import("./react-QWOAB3TB.js"),{render:o}=await import("./build-JIKYOZUH.js"),{LinksBox:i}=await import("./LinksBox-LREUUJDV.js"),{waitUntilExit:n}=o(e.createElement(i,t),{stdout:a,stdin:s});await n()}catch(e){m("warn","TEST_MD_LINKS_RENDER_FAILED","LinksBox render failed",{error:String(e)})}},onLockState(t){p({type:"test_md_lock_state",...t})},onRetryAttempt(t){p({type:"test_md_retry_attempt",...t})},onAgentEvent(t){p(t)}}}export{l as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as l}from"./chunk-RZ4F3BHX.js";import{openAsBlob as g}from"fs";import{basename as f}from"path";var h={emulator:"application/vnd.android.package-archive",simulator:"application/zip"},m=30*6e4,p=3e4;function y(n){let e=n??{},t=Array.isArray(e.apps)?e.apps:[],s=[];for(let r of t){let a=r??{},o=typeof a.app_id=="string"?a.app_id:void 0;o&&s.push({appId:o,name:typeof a.name=="string"&&a.name.trim()!==""?a.name:o,...typeof a.package=="string"?{packageName:a.package}:{},...typeof a.updated_at=="string"?{updatedAt:a.updated_at}:{}})}return{apps:s,total:typeof e.total=="number"?e.total:s.length}}function w(){return{fileBody:n=>g(n),request:l}}function A(n){if(!n||typeof n!="object")return null;let e=n,t=typeof e.app_id=="string"?e.app_id:void 0;return t?{appId:t,...typeof e.app_url=="string"?{appUrl:e.app_url}:{},...typeof e.url=="string"?{url:e.url}:{},cached:e.cached===!0,...typeof e.name=="string"?{name:e.name}:{}}:null}function b(n){if(!n||typeof n!="object")return null;let e=n,t=typeof e.app_id=="string"?e.app_id:void 0,s=typeof e.url=="string"?e.url:void 0;if(!t||!s)return null;let r=typeof e.name=="string"&&e.name.trim()!==""?e.name:`${t}.bin`;return{appId:t,name:r,url:s,...typeof e.package=="string"?{packageName:e.package}:{},...typeof e.type=="string"?{type:e.type}:{}}}function k(n){let e=n?.cause,t=e instanceof Error?e.message:typeof e=="string"?e:void 0,s=n instanceof Error?n.message:String(n);return t&&t!==s?`${s} (${t})`:s}var i=class extends Error{constructor(t,s){super(t);this.status=s;this.name="AppUploadError"}};async function u(n){let e=await n.text(),t;try{let s=JSON.parse(e);t=s.error??s.message??e}catch{t=e}return n.status===503&&t.includes("app service not configured")?"the controller has the app routes but its app service is not configured (LMAO_BASE_URL is unset) \u2014 ask whoever runs this environment to set it.":t}var d=class{constructor(e,t,s={}){this.baseUrl=e;this.auth=t;this.deps={...w(),...s}}deps;headers(){return{Authorization:typeof this.auth=="string"?`Bearer ${this.auth}`:`Basic ${Buffer.from(`${this.auth.username}:${this.auth.accessKey}`).toString("base64")}`}}async upload(e,t,s={}){let r=f(e),a=await this.uploadTarget(r,t);s.onProgress?.(`uploading ${r}\u2026`);let o=await this.deps.request(a.uploadUrl,{method:"PUT",headers:{"Content-Type":h[t]},body:await this.deps.fileBody(e),signal:s.signal??AbortSignal.timeout(m)});if(!o.ok)throw new i(`Uploading ${r} failed: ${o.status} ${await o.text()}`,o.status);let c=a.uploadUrl.split("?")[0];return this.register(r,t,c)}async uploadTarget(e,t){let s=`name=${encodeURIComponent(e)}&device_class=${encodeURIComponent(t)}`,r=await this.deps.request(`${this.baseUrl}/mobile-app/upload-url?${s}`,{method:"GET",headers:this.headers(),signal:AbortSignal.timeout(p)});if(!r.ok)throw new i(`Could not start the upload of ${e}: ${await u(r)}`,r.status);let a=await r.json();if(!a.upload_url)throw new i(`Could not start the upload of ${e}: no upload url.`);return{key:a.key??"",uploadUrl:a.upload_url}}async register(e,t,s){let r=await this.deps.request(`${this.baseUrl}/mobile-app/register`,{method:"POST",headers:{...this.headers(),"Content-Type":"application/json"},body:JSON.stringify({name:e,device_class:t,url:s}),signal:AbortSignal.timeout(p)});if(!r.ok)throw new i(`Could not register ${e}: ${await u(r)}`,r.status);let a=A(await r.json());if(!a)throw new i(`Registering ${e} returned no app id.`);return a}async list(e){let t=new URLSearchParams({device_class:e.type});e.limit!==void 0&&t.set("limit",String(e.limit)),e.offset!==void 0&&t.set("offset",String(e.offset)),e.search&&t.set("search",e.search);let s=`${this.baseUrl}/mobile-app/list?${t.toString()}`,r;try{r=await this.deps.request(s,{method:"GET",headers:this.headers(),signal:AbortSignal.timeout(p)})}catch(a){throw new i(k(a))}if(!r.ok)throw r.status===404?new i("Browsing uploads needs a newer v16 controller than this environment is running.",404):new i(`Could not list your uploads: ${await u(r)}`,r.status);return y(await r.json())}async details(e){let t=await this.deps.request(`${this.baseUrl}/mobile-app/${encodeURIComponent(e)}`,{method:"GET",headers:this.headers(),signal:AbortSignal.timeout(p)});if(!t.ok)throw new i(`${e}: ${await u(t)}`,t.status);let s=b(await t.json());if(!s)throw new i(`${e} returned no download url.`);return s}async liveness(e){try{return await this.details(e),"alive"}catch(t){let s=t instanceof i?t.status:void 0;return s!==void 0&&s>=400&&s<500?"gone":"unknown"}}};export{h as a,y as b,A as c,b as d,k as e,i as f,d as g};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as m}from"./chunk-L5LI2JF4.js";import{a as _}from"./chunk-TDPWFYTJ.js";import{c as h}from"./chunk-
|
|
2
|
+
import{b as m}from"./chunk-L5LI2JF4.js";import{a as _}from"./chunk-TDPWFYTJ.js";import{c as h}from"./chunk-27U4PLPX.js";import{randomUUID as F}from"crypto";import{mkdirSync as A,writeFileSync as v,appendFileSync as O,existsSync as b}from"fs";import{join as u}from"path";import{writeFileSync as x,mkdirSync as I,existsSync as j}from"fs";import{join as p,relative as L}from"path";function f(n){let t=Object.keys(n.frontmatter).length>0?m(n.frontmatter).trimEnd():"",s=["---"];return t&&s.push(t),s.push("---",""),s.push(`# ${n.heading}`,""),n.steps.forEach((i,r)=>{s.push(`## Step ${r+1}`,i,"")}),s.join(`
|
|
3
3
|
`)}function T(n,e){let t={},s={},i=e;for(let[r,l]of Object.entries(n)){if(r.startsWith("global.")||r.startsWith("secrets.user.")||r.startsWith("environment.")){let o=r.startsWith("secrets.user.");t[r]={value:l.value,secret:o,syntax:`{{${r}}}`,type:o?"secret":r.startsWith("environment.")?"environment":"global"},s[r]=r;continue}if(l.secret){let o=`secrets.user.${r}`;t[o]={value:l.value,secret:!0,syntax:`{{secrets.user.${r}}}`,type:"secret"},s[r]=o,i=i.replaceAll(`{{${r}}}`,`{{secrets.user.${r}}}`)}else{let o=`global.${r}`;t[o]={value:l.value,secret:!1,syntax:`{{global.${r}}}`,type:"global"},s[r]=o,i=i.replaceAll(`{{${r}}}`,`{{global.${r}}}`)}}return{variables:t,objective:i,keyMap:s}}var w=/\{\{\s*(?:global|secrets\.user|environment)\.([^{}]+?)\s*\}\}/g;function c(n){return typeof n!="string"||!n.includes("{{")?n:n.replace(w,"{{$1}}")}function d(n){if(typeof n=="string")return c(n);if(Array.isArray(n))return n.map(e=>d(e));if(n&&typeof n=="object"){let e={};for(let[t,s]of Object.entries(n))e[t]=d(s);return e}return n}var N=new Set(["username","access_key","oauth","profile","project_id","folder_id"]),$=new Set(["model","env"]),g=class{constructor(e){this.opts=e}objectives=[];flushed=!1;lastWrittenPath=null;lastCollisionSuffixed=!1;appendObjective(e){this.objectives.push(e)}flush(){if(this.flushed||(this.flushed=!0,this.objectives.length===0))return;let e=this.opts.getName();if(!e)return;let t=p(this.opts.cwd,".testmuai","tests");try{I(t,{recursive:!0})}catch(a){process.stderr.write(`
|
|
4
4
|
\u26A0 Failed to create ${L(this.opts.cwd,t)}/
|
|
5
5
|
${a.message}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{c as v}from"./chunk-UD7KKHPW.js";var E=.8,y="usecase-dedup";function w(n,r){let i=Math.min(n.length,r.length),u=0,s=0,c=0;for(let e=0;e<i;e++)u+=n[e]*r[e],s+=n[e]*n[e],c+=r[e]*r[e];return s===0||c===0?0:u/(Math.sqrt(s)*Math.sqrt(c))}function C(n,r,i){return i*n+(1-i)*r}var D=.7;function A(n){return new Set(n.toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").split(" ").filter(Boolean))}function R(n,...r){let i=A(n);if(i.size===0)return 0;let u=n.trim().toLowerCase(),s=0;for(let c of r){let e=A(c);if(e.size===0)continue;let p=0;for(let b of i)e.has(b)&&p++;let m=i.size+e.size-p,d=m===0?0:p/m;u&&c.toLowerCase().includes(u)&&(d=Math.max(d,.9)),s=Math.max(s,d)}return s}var S=n=>String(n.title??"");function _(n){return n.byLabel("usecase").filter(r=>!n.superseded.has(r.cid)).map(r=>({cid:r.cid,text:S(r.content)}))}function L(n,r){let i=r.threshold??E,u=new Map,s=null;return{async batchSimilar(c,e){let p=c.latestHash;if(e.length===0)return{hits:[],degraded:!1,probeBasis:p};let m=_(c),d=[];try{s=(await r.resolveAlias(y)).alias;let f=new Map,g=[];for(let t of m){let a=r.readVector?.(s,t.cid)??null;a!==null?f.set(t.cid,a):g.push(t)}let o=[...e.map(t=>t.probeText),...g.map(t=>t.text)],{vectors:P}=await r.embed(y,o);e.forEach((t,a)=>u.set(t.tempRef,Float32Array.from(P[a]))),g.forEach((t,a)=>{let l=Float32Array.from(P[e.length+a]);f.set(t.cid,l),r.writeVector?.(s,t.cid,l)});for(let t of e){let a=u.get(t.tempRef);for(let l of m){let x=f.get(l.cid);if(x===void 0)continue;let h=C(w(a,x),R(t.probeText,l.text),D);h>=i&&d.push({tempRef:t.tempRef,candidateCid:l.cid,score:h,scorer:"embedding"})}}return{hits:d,degraded:!1,probeBasis:p}}catch(b){v(JSON.stringify({event:"dedup_probe_degraded",contextDir:n,candidates:e.length,reason:String(b?.message??b).slice(0,160),ts:new Date().toISOString()}),"DEDUP_PROBE_DEGRADED");for(let f of e)for(let g of m){let o=R(f.probeText,g.text);o>=i&&d.push({tempRef:f.tempRef,candidateCid:g.cid,score:o,scorer:"lexical_fallback"})}return{hits:d,degraded:!0,probeBasis:p}}},recheckLocal(c,e,p,m){let d=[],b=[],f=new Set;for(let g of m)for(let o of g.nodes){if(o.label!=="usecase"||f.has(o.cid)||(f.add(o.cid),c.superseded.has(o.cid)||!c.hasNode(o.cid)))continue;let P=S(o.content),t=s!==null?r.readVector?.(s,o.cid)??null:null,a=t!==null;for(let l of e){let x=u.get(l.tempRef),h;t!==null&&x!==void 0?h=C(w(x,t),R(l.probeText,P),D):(h=R(l.probeText,P),a=a&&!1),h>=i&&d.push({tempRef:l.tempRef,candidateCid:o.cid,score:h,scorer:t!==null&&x!==void 0?"embedding":"lexical_fallback"})}a||b.push(o.cid)}return{hits:d,uncachedNewNodes:b}}}}export{L as a};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{existsSync as f,fsyncSync as X,mkdirSync as z,readFileSync as S,readdirSync as N,renameSync as E,rmSync as m,writeFileSync as H,openSync as K,closeSync as j}from"fs";import{randomBytes as Q}from"crypto";import{join as y}from"path";var u=class extends Error{constructor(t,r){super(`${t}: ${r}`);this.code=t}},q=1440*60*1e3,F=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,v=n=>y(n,"sessions"),O=(n,e)=>y(v(n),e),l=(n,e)=>y(O(n,e),"state.json"),h=(n,e)=>y(O(n,e),".lock"),w=n=>(n?.now??(()=>new Date))();function M(n){if(!Number.isInteger(n)||n<=0)return!1;try{return process.kill(n,0),!0}catch(e){return e.code==="EPERM"}}function b(n,e){let t=`${n}.tmp-${process.pid}`,r=K(t,"w");try{H(r,e,{mode:384}),X(r)}finally{j(r)}E(t,n)}function k(n,e,t,r=0){if(r>20)throw new u("SESSION_LOCKED",`${e}: lock contention did not settle`);let o=h(n,e),s=Q(8).toString("hex"),c=JSON.stringify({pid:process.pid,ts:t.toISOString(),nonce:s})+`
|
|
3
|
+
`;try{let i=K(o,"wx",384);return H(i,c),j(i),s}catch(i){if(i.code!=="EEXIST")throw i;let p=!1,a;try{let d=JSON.parse(S(o,"utf8")),_=t.getTime()-new Date(d.ts).getTime();p=!M(d.pid)||_>=q,a=d.nonce}catch{p=!0}if(!p)throw new u("SESSION_LOCKED",`${e} is held by another live process`);let g=`${o}.break-${s}`;try{E(o,g);let d;try{d=JSON.parse(S(g,"utf8"))}catch{d=null}if(d===null||d.nonce===a)m(g,{force:!0});else try{E(g,o)}catch{m(g,{force:!0})}}catch(d){if(d.code!=="ENOENT")throw d}return k(n,e,t,r+1)}}function G(n,e,t,r,o){let s=()=>{try{if(JSON.parse(S(h(n,e),"utf8")).nonce!==r)throw new u("SESSION_LOCK_LOST",`${e} lock was taken over`)}catch(i){throw i instanceof u?i:new u("SESSION_LOCK_LOST",`${e} lock file unreadable/gone`)}},c=()=>b(l(n,e),JSON.stringify(t)+`
|
|
4
|
+
`);return{get state(){return t},isApplied:i=>t.applied_events.includes(i),markApplied(i){s(),t={...t,applied_events:[...new Set([...t.applied_events,...i])].sort()},c()},reconcileSave(i){s(),t={...t,applied_events:[...new Set([...t.applied_events,...i.appliedEvents])].sort(),held_receipts:i.heldReceipts,pending:i.pending},c()},save(i){s();let{agent_state:p,pending:a,assumed:g,read_basis:d,corpus_cursor:_,expires_at:I,force:x,conv_source:R,held_receipts:T,force_scope:D,user_session_id:J,checkpoint:L,target_pins:$,ingest_registry:A,ingest_schedule:P,reconcile:C}=i;t={...t,...p!==void 0?{agent_state:p}:{},...a!==void 0?{pending:a}:{},...g!==void 0?{assumed:g}:{},...d!==void 0?{read_basis:d}:{},..._!==void 0?{corpus_cursor:_}:{},...I!==void 0?{expires_at:I}:{},...x!==void 0?{force:x}:{},...R!==void 0?{conv_source:R}:{},...T!==void 0?{held_receipts:T}:{},...D!==void 0?{force_scope:D}:{},...J!==void 0?{user_session_id:J}:{},...L!==void 0?{checkpoint:L}:{},...$!==void 0?{target_pins:$}:{},...A!==void 0?{ingest_registry:A}:{},...P!==void 0?{ingest_schedule:P}:{},...C!==void 0?{reconcile:C}:{}},c()},complete(){s(),m(O(n,e),{recursive:!0,force:!0})},release(){try{s(),m(h(n,e),{force:!0})}catch(i){if(i instanceof u||i.code==="ENOENT")return;throw i}}}}function W(n,e,t){if(!F.test(e.sid))throw new u("SESSION_MISSING",`bad sid ${JSON.stringify(e.sid)}`);let r=w(t);if(f(l(n,e.sid)))throw new u("SESSION_LOCKED",`${e.sid} already exists \u2014 resume it`);z(O(n,e.sid),{recursive:!0,mode:448});let o=k(n,e.sid,r),s={schema:1,applied_events:[],...e};return b(l(n,e.sid),JSON.stringify(s)+`
|
|
5
|
+
`),G(n,e.sid,s,o,t)}function Y(n,e,t){if(!F.test(e)||!f(l(n,e)))throw new u("SESSION_MISSING",`no session ${e}`);let r=w(t),o=k(n,e,r),s=JSON.parse(S(l(n,e),"utf8"));if(new Date(s.expires_at).getTime()<=r.getTime())throw m(h(n,e),{force:!0}),new u("SESSION_EXPIRED",`${e} expired at ${s.expires_at}`);let c={...s,expires_at:new Date(r.getTime()+q).toISOString()};return b(l(n,e),JSON.stringify(c)+`
|
|
6
|
+
`),G(n,e,c,o,t)}function Z(n,e){try{let t=y(n,"proposals",e,"verdicts.json");return JSON.parse(S(t,"utf8")).resolved===!0}catch{return!1}}function ee(n,e){let t=l(n,e);return f(t)?JSON.parse(S(t,"utf8")):null}function ne(n){let e=v(n);if(!f(e))return[];let t=[];for(let r of N(e)){let o=l(n,r);if(f(o))try{let s=JSON.parse(S(o,"utf8"));t.push({sid:s.sid,mode:s.mode,created_at:s.created_at,expires_at:s.expires_at,pendingCount:s.pending.questions.length+s.pending.proposals.length,verb:s.verb,use_case:s.use_case})}catch{t.push({sid:r,mode:"?",created_at:"",expires_at:"",pendingCount:0,corrupt:!0})}}return t.sort((r,o)=>r.created_at<o.created_at?-1:1)}function te(n,e,t){let r=v(n);if(!f(r))return{holders:[],corrupt:0};let o=w(t),s=[],c=0;for(let i of N(r)){let p=l(n,i);if(f(p))try{let a=JSON.parse(S(p,"utf8"));if(new Date(a.expires_at).getTime()<=o.getTime())continue;let g=a.pending.proposals.some(_=>(_.content?._held?.source_id??null)===e),d=a.reconcile!=null&&e in a.read_basis&&!Z(n,a.reconcile.proposal_id);(g||d)&&s.push(a.sid)}catch{c+=1}}return{holders:s,corrupt:c}}function se(n,e){let t=w(e),r=[],o=[],s=v(n);if(!f(s))return{removed:r,skipped:o};for(let c of N(s)){if(e?.sid&&c!==e.sid)continue;let i=!1,p=!1;try{let a=JSON.parse(S(l(n,c),"utf8"));i=new Date(a.expires_at).getTime()<=t.getTime()}catch{p=!0}if(e?.sid||e?.all||i||p&&e?.all){try{let a=JSON.parse(S(h(n,c),"utf8"));if(M(a.pid)&&a.pid!==process.pid){o.push({sid:c,reason:`in use by live pid ${a.pid}`});continue}}catch{}m(O(n,c),{recursive:!0,force:!0}),r.push(c)}}return{removed:r,skipped:o}}export{u as a,W as b,Y as c,Z as d,ee as e,ne as f,te as g,se as h};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as t}from"./chunk-427OQS2N.js";import{a,b as s,c as n}from"./chunk-
|
|
2
|
+
import{a as t}from"./chunk-427OQS2N.js";import{a,b as s,c as n}from"./chunk-WXHQYYD5.js";function y(o="extract"){let i=new Set(t(o)),c=Object.fromEntries(Object.keys(s).map(r=>{let e=s[r];return[r,{hashed:[...e.hashed],unhashed:[...e.unhashed??[]],required:[...e.required],enums:Object.fromEntries(Object.entries(e.enums).map(([p,g])=>[p,[...g]])),mintable:i.has(r)}]})),d=Object.fromEntries(Object.keys(n).map(r=>{let e=n[r];return[r,{src:[...e.src],dst:[...e.dst],salient:[...e.salient],props:[...e.props],cardinality:e.cardinality,acyclic:e.acyclic,direction:"dependent->dependency"}]}));return{schema_version:a,nodes:c,edges:d,mint_gate:t(o),blob_fingerprint:{algo:"sha256",domain:"assurance.blob\0",prefix:"sha256:"}}}export{y as a};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{e as M,f as R,h as j,i as y}from"./chunk-ZPDM6FO7.js";import{
|
|
2
|
+
import{e as M,f as R,h as j,i as y}from"./chunk-ZPDM6FO7.js";import{v as k}from"./chunk-TH47OOBV.js";import{existsSync as A,mkdirSync as W,readdirSync as B,readFileSync as N,renameSync as E,writeFileSync as G}from"fs";import{join as p}from"path";var P=/^@import\s+(\S+)\s*$/;function O(e,n){let s=e.resolve(n),l=s?String(e.getNode(s.tip)?.content.title??""):"";return l&&k(l,()=>!1)||n}function D(e){return p(e,".testmuai","tests")}function L(e){let n=new Map;if(!A(e))return n;for(let s of B(e)){if(!s.endsWith("_test.md"))continue;let l=p(e,s);try{let r=y(N(l,"utf8"))?.id;r&&n.set(r,[...n.get(r)??[],l])}catch{}}return n}function q(e,n){let s=`${e}.tmp-mint`;G(s,n),E(s,e)}function U(e){let{graph:n,cids:s,cwd:l}=e,r=D(l),w=[],d=[],m=L(r),$=new Set,b=(t,f)=>{let c=m.get(t);if(c&&c.length>1)return d.push({id:t,reason:`two files claim assurance.id ${t}: ${c.join(" \xB7 ")} \u2014 resolve the duplicate first`}),null;if($.has(t))return I(t);if(f.includes(t))return I(t)??`${O(n,t)}_test.md`;let S=n.resolve(t),v=S?n.getNode(S.tip):void 0,x=v?.content.test_md_blob,F=v?.content.definitionId;if(!x||!F)return d.push({id:t,reason:`${t} has no test definition in the graph`}),null;let h=x.split(`
|
|
3
3
|
`).map(o=>{let i=P.exec(o.trim());if(!i)return o;let u=i[1];if(!n.resolve(u))return o;let _=b(u,[...f,t]);if(!_)throw new g(`dependency ${u} could not be minted/located`);return`@import ./${_}`}).join(`
|
|
4
4
|
`),T=`---
|
|
5
5
|
assurance:
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as f}from"./chunk-TFPPEOAK.js";import{y as r}from"./chunk-27U4PLPX.js";import{a as g}from"./chunk-HCBYKLMW.js";import{a as i,b as n,i as p}from"./chunk-C44QQJR4.js";import{a as x}from"./chunk-6YGTRKDT.js";import{e as d}from"./chunk-UR6MHSHU.js";var b=d(x(),1);var e=d(g(),1),v=[{value:"desktop",label:"Desktop",hint:"Chrome on this machine"},{value:"emulator",label:"Emulator",hint:"a virtual Android device"},{value:"simulator",label:"Simulator",hint:"a virtual iOS device"}];function T(a){return a==="all"?v:v.filter(l=>l.value!=="desktop")}function B({mode:a="all",onSelect:l,onCancel:c}){let u=T(a),[h,m]=(0,b.useState)(0);return p((s,o)=>{if(o.escape&&c){c();return}o.upArrow&&m(t=>Math.max(0,t-1)),o.downArrow&&m(t=>Math.min(u.length-1,t+1)),o.return&&l(u[h].value)}),(0,e.jsxs)(i,{flexDirection:"column",borderStyle:"round",borderColor:r.orange,paddingX:2,paddingY:1,children:[(0,e.jsx)(n,{color:r.orange,bold:!0,children:a==="all"?"Where should tests run?":"Which kind of device?"}),(0,e.jsx)(i,{marginTop:1,flexDirection:"column",children:u.map((s,o)=>{let t=o===h;return(0,e.jsxs)(i,{children:[(0,e.jsxs)(n,{color:t?r.orange:void 0,children:[t?"\u276F ":" ",s.label]}),(0,e.jsxs)(n,{color:r.dim,children:[" ",s.hint]})]},s.value)})}),(0,e.jsx)(i,{marginTop:1,children:(0,e.jsx)(n,{color:r.dim,children:"You can change this any time with /desktop or /mobile."})}),(0,e.jsx)(f,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"select"}],suppressEscBack:!c,escBackLabel:"skip"})]})}export{B as a};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as w,b as O}from"./chunk-R5T4RLF5.js";import{e as L}from"./chunk-IDX3TOPY.js";import{a as N,b as k}from"./chunk-BKM2LWU2.js";import{a as I}from"./chunk-KBM3XHAM.js";import{a as R,b as y,c as T,d as m,e as A,f as b,g as r}from"./chunk-56PAQAX5.js";import{b as x}from"./chunk-5EOX4MEY.js";import{a as E}from"./chunk-RZ4F3BHX.js";import{a as g,j as v}from"./chunk-27U4PLPX.js";import{platform as X,arch as Y}from"os";import P from"fs";import M from"fs";import D from"path";var V=1e3,d=0,j=new Set([130,3]),a=class t{ids;logger;opts;ended=!1;createdAt=Date.now();errorState;constructor(e,n={emitted:!1}){this.ids=e.envelope,this.logger=e.logger,this.opts=e,this.errorState=n}get enabled(){return this.logger!==null}event(e,n={}){if(!this.logger)return;e==="ASR_ERROR"&&(this.errorState.emitted=!0);let i=m(this.ids,e,n);this.logger.log(R[e],e,e,C(i))}error(e,n={}){this.logger&&(this.logger.escalate(d),this.event("ASR_ERROR",{...n,error_code:e}))}child(e,n){return new t({...this.opts,envelope:{...this.ids,operation_id:n,parent_operation_id:this.ids.operation_id,verb:"design"}},this.errorState)}async lateBindContext(e){if(!(!this.logger||this.ids.context_instance_id))try{let{ensureStoreIds:n}=await import("./store-id-EOSGEKVK.js"),{ids:i,cloned:s}=n(e);this.ids.context_lineage_id=i.context_lineage_id,this.ids.context_instance_id=i.context_instance_id,s&&this.event("ASR_CONTEXT_CLONED")}catch{}}agentSession(e){this.ids.agent_session_id=e}spawnEnv(){if(!this.opts.telemetryEnabled)return{};let e={TESTMUAI_USER_SESSION_ID:this.ids.session_id,TESTMUAI_OPERATION_ID:this.ids.operation_id,TESTMUAI_CLIENT_VERSION:this.opts.clientVersion,TESTMUAI_TELEMETRY_PROXY_URL:this.opts.proxyUrl};return this.ids.context_instance_id&&(e.TESTMUAI_CONTEXT_INSTANCE_ID=this.ids.context_instance_id),e}traceTee(){return e=>{if(!this.logger)return;let n=typeof e.kind=="string"?e.kind.slice(0,64):"trace",i={...C(m(this.ids,"ASR_CMD_START",{})),trace_kind:n};typeof e.code=="string"&&(i.trace_code=e.code.slice(0,64)),delete i.event,this.logger.logStep(d,`trace_${n}`,n,i)}}wireTrace(e,n,i){if(!this.logger)return;i&&this.agentSession(i);let s=n&&typeof n=="object"?n:{};switch(e){case"spawn":this.event("ASR_AGENT_SPAWN",{tier:s.tier});break;case"session_paused":this.event("ASR_SESSION_PAUSED",s);break;case"commit":this.event("ASR_COMMIT",s);break;default:this.traceTee()({kind:e,code:typeof s.code=="string"?s.code:void 0})}}banner(){return`session: ${this.ids.session_id}`}supportFooter(){return`if this keeps failing, share this id with support: ${this.ids.session_id}`}async end(e){if(!this.ended){if(this.ended=!0,e.duration_ms===void 0&&(e={...e,duration_ms:Date.now()-this.createdAt}),this.logger)if(e.exit_code===0?this.logger.discardSteps(d):this.logger.escalate(d),e.exit_code>0&&!j.has(e.exit_code)&&!this.errorState.emitted&&this.event("ASR_ERROR",{error_code:e.exit_code===2?"usage_exit_unattributed":`exit_${e.exit_code}_unattributed`,exit_code:e.exit_code}),this.event("ASR_CMD_END",e),this.opts.longSession)await this.logger.shutdown();else{let n=await this.logger.flushOnce(V);(n==="failed"||n==="timeout")&&A(this.logger.drainBuffer())}this.logger&&this.writeManifestLine(e.exit_code),r(null)}}writeManifestLine(e){try{let n=x(this.ids.context_instance_id??null);M.mkdirSync(D.dirname(n),{recursive:!0});let i={ts:new Date().toISOString(),session_id:this.ids.session_id,operation_id:this.ids.operation_id,agent_session_id:this.ids.agent_session_id,verb:this.ids.verb,mode:this.ids.mode,exit_code:e};M.appendFileSync(n,JSON.stringify(i)+`
|
|
3
|
+
`,{flag:"a",mode:384})}catch{}}};function C(t){let e={event:t.event,session_id:t.session_id,operation_id:t.operation_id,verb:t.verb,mode:t.mode,component:t.component,seq:t.seq,context_lineage_id:t.context_lineage_id,context_instance_id:t.context_instance_id};t.parent_operation_id&&(e.parent_operation_id=t.parent_operation_id),t.agent_session_id&&(e.agent_session_id=t.agent_session_id);for(let[n,i]of Object.entries(t.context))e[n]=i;return e}var u=process.env.KANE_TELEMETRY_URL||v;function B(){return process.env.TESTMUAI_BASE_URL?"custom":process.env.TESTMUAI_ENV==="stage"?"stage":"prod"}function _e(t){let e=process.env.KANE_TELEMETRY!=="0"&&(!process.env.VITEST||process.env.KANE_TELEMETRY==="1"),n=t.env??B(),i=null;if(t.resumeSid&&t.contextRoot)try{let o=L(t.contextRoot,t.resumeSid);o?.user_session_id&&(i=o.user_session_id)}catch{}if(!i&&t.applyPlanPath)try{let o=JSON.parse(P.readFileSync(t.applyPlanPath,"utf8"));o.telemetry?.user_session_id&&(i=o.telemetry.user_session_id)}catch{}let s=i!==null;i||(i=y());let l=null,c=null,f=!1;if(t.contextRoot&&P.existsSync(t.contextRoot))if(t.write&&e){let o=k(t.contextRoot);l=o.ids.context_lineage_id,c=o.ids.context_instance_id,f=o.cloned}else{let o=N(t.contextRoot);l=o?.context_lineage_id??null,c=o?.context_instance_id??null}let h={session_id:i,operation_id:T(),context_lineage_id:l,context_instance_id:c,verb:t.verb,mode:t.mode,component:"kane-cli"},_=null;if(e){let o=I(n),S={org_id:o.org_id??"",user_id:o.user_id??"",machine_id:o.machine_id,email:null,email_domain:"",user_type:o.user_type??"unknown",env:o.env,plan:o.plan??"unknown"},U=t.mode==="interactive"||t.mode==="cli"?"cli":"agent";_=new w({proxyUrl:u,sessionId:i,identity:S,device:{cli_version:g,platform:X(),arch:Y(),host_agent:O(),invocation_mode:U},getToken:async()=>null}),t.longSession&&_.start()}let p=new a({envelope:h,logger:_,longSession:!!t.longSession,proxyUrl:u,clientVersion:`kane-cli/${g}`,telemetryEnabled:e});return e&&(r(h),p.event("ASR_CMD_START",{resumed:s,applied_plan:!!t.applyPlanPath}),f&&p.event("ASR_CONTEXT_CLONED"),b(async o=>{try{return(await E(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)})).ok}catch{return!1}}).catch(()=>{})),p}export{B as a,_e as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{y as m}from"./chunk-
|
|
2
|
+
import{y as m}from"./chunk-27U4PLPX.js";import{a as x}from"./chunk-HCBYKLMW.js";import{a as u,b as a,j as g}from"./chunk-C44QQJR4.js";import{a as b}from"./chunk-6YGTRKDT.js";import{e as f}from"./chunk-UR6MHSHU.js";var T=f(b(),1);function k(i,n){if(!n)return i;let l=i.trim()||n;return`\x1B]8;;${n}\x07${l}\x1B]8;;\x07`}var r=f(x(),1);function $({shareableLink:i,testCaseLink:n,codeExportDir:l,recordedTestPath:s,outputDir:o,autoExit:p=!0}){let{exit:c}=g();(0,T.useEffect)(()=>{if(!p)return;let t=setTimeout(()=>c(),100);return()=>clearTimeout(t)},[c,p]);let e=[];return s&&e.push({label:"Test",url:s,linkUrl:`file://${s}`}),o&&e.push({label:"Output",url:o,linkUrl:`file://${o}`}),i&&e.push({label:"ShareLink",url:i}),n&&e.push({label:"TestCase",url:n}),l&&!o&&e.push({label:"CodeExport",url:l,linkUrl:`file://${l}`}),e.length===0?(0,r.jsx)(r.Fragment,{}):(0,r.jsx)(u,{flexDirection:"column",marginTop:1,marginLeft:1,children:e.map(t=>(0,r.jsxs)(u,{flexDirection:"column",marginBottom:1,children:[(0,r.jsxs)(a,{color:m.orange,children:[t.label,":"]}),(0,r.jsx)(a,{color:m.dim,children:k(t.url,t.linkUrl??t.url)})]},t.label))})}export{$ as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{d as f}from"./chunk-
|
|
2
|
+
import{d as f}from"./chunk-WXHQYYD5.js";function k(s,n){let t=null;for(let[i,e]of s.designOf)i!==n&&s.tipOf(i)!==n||(t==null||e.seq>t.seq)&&(t={...e,designed_at_cid:i});return t}function $(s,n){let t=new Map;for(let[d,o]of s.superseded)o!=null&&t.set(o,d);let i=[n],e=n;for(;t.has(e);)e=t.get(e),i.unshift(e);return i}function w(s,n,t){let i=s.resolve(n);if(!i){let r=[...s.names.keys()].filter(m=>m.startsWith("uc-")).sort().slice(0,6);return{ok:!1,code:2,message:`unknown use-case '${n}' \u2014 no live node by that logical id or cid${r.length?` (known: ${r.join(", ")})`:""}`}}let e=i.tip;if(s.superseded.has(e)&&s.superseded.get(e)===null)return{ok:!1,code:2,message:`use-case '${n}' was removed (tombstoned) \u2014 nothing to design`};let d=s.nodeLabel.get(e);if(d!==f.USECASE)return{ok:!1,code:2,message:`'${n}' is a ${d??"missing node"}, not a use-case \u2014 design runs per use-case`};let o=s.nameOf.get(e)??s.nameOf.get(i.cid)??e.slice(0,19);if(s.trust.get(e)==="archived"){let r=s.archivedReason.get(e);return{ok:!1,code:2,message:`use-case '${o}' is archived${r?` (${r})`:""} \u2014 design runs only over live use-cases`}}let c=k(s,e);if(c==null||t)return{ok:!0};let l=$(s,e),a=l.length;if(c.designed_at_cid===e)return{ok:!1,code:2,message:`'${o}' is already designed @ v${a} \u2014 current; use --force to redesign`,wall:{kind:"already-designed",display:o,currentV:a}};let u=l.indexOf(c.designed_at_cid),g=u>=0?`v${u+1}`:"an earlier version";return{ok:!1,code:2,message:`'${o}' was designed @ ${g} \u2014 the use-case is now @ v${a} (STALE); use --force to redesign`,wall:{kind:"designed-stale",display:o,currentV:a,designedV:g}}}export{k as a,w as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as p}from"./chunk-2YEHV2CX.js";import{d as o}from"./chunk-5EOX4MEY.js";import s from"fs";import a from"path";var g=new Set(["org_id","user_id","plan","user_type"]);function m(e){let t={machine_id:p(),env:e};try{let i=JSON.parse(s.readFileSync(o(e),"utf8"));for(let[n,r]of Object.entries(i))g.has(n)&&typeof r=="string"&&r.length>0&&r.length<=128&&(t[n]=r)}catch{}return t}async function y(e,t){if(!t)return;let i={};if(t.org_id!==void 0&&t.org_id!==null&&(i.org_id=String(t.org_id)),t.user_id!==void 0&&t.user_id!==null&&(i.user_id=String(t.user_id)),typeof t.plan=="string"&&t.plan&&(i.plan=t.plan),typeof t.user_type=="string"&&t.user_type&&(i.user_type=t.user_type),Object.keys(i).length===0)return;let n=o(e);await s.promises.mkdir(a.dirname(n),{recursive:!0});let r=`${n}.tmp-${process.pid}`;await s.promises.writeFile(r,JSON.stringify(i),{mode:384}),await s.promises.rename(r,n)}export{m as a,y as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as re,d as ie,e as se}from"./chunk-VGFTNLQQ.js";import{a as ne}from"./chunk-L2TV4G56.js";import{b as G,d as te}from"./chunk-
|
|
2
|
+
import{c as re,d as ie,e as se}from"./chunk-VGFTNLQQ.js";import{a as ne}from"./chunk-L2TV4G56.js";import{b as G,d as te}from"./chunk-6KPPGMO2.js";import{d as ee}from"./chunk-NVGBE2DR.js";var ce=new Set(["approve","edit","reject"]);function le(s,t){return`chatop:${t}:${s.target??"new"}:${s.op}:${s.seq}`}function de(s,t,b,k){let c=le(s,t),h=s.payload;switch(s.op){case"approve":return{kind:"approve",target:s.target,expectedCid:s.expected_cid,eventId:c};case"edit":{let{reason:o,...y}=h;return{kind:"edit",target:s.target,expectedCid:s.expected_cid,edit:y,reason:o,eventId:c}}case"enhance":return{kind:"enhance",target:s.target,expectedCid:s.expected_cid,edges:h.edges??[],eventId:c};case"reject":return{kind:"reject",target:s.target,expectedCid:s.expected_cid,reason:h.reason??"",redirectTo:h.redirect_to,eventId:c};case"add":{let o=h.proposal_item??{},y=String(o.label??"");if(!b.mint_gate.includes(y))throw new Error(`GATED_LABEL: cannot mint "${y}" (gate: ${b.mint_gate.join(", ")})`);let l=o.cite??{},p=o.conv_source_id??k;if(!p||typeof l.turn!="number"||!l.quote)throw new Error("INVALID_ADD: a chat add requires a conversation cite {turn, quote} and conv_source_id");let _=o.content,w=_&&typeof _=="object"&&!Array.isArray(_)&&Object.keys(_).length>0?_:null,v=new Set(["label","cite","conv_source_id","content","rationale","edges"]),C=w??Object.fromEntries(Object.entries(o).filter(([R])=>!v.has(R)));return{kind:"add",label:y,content:C,cite:{turn:l.turn,quote:l.quote},convSourceId:p,rationale:o.rationale,eventId:c}}}}function oe(s,t,b={}){let k=b.turn??0,c=[],h=[];for(let l of s)(l.op==="add"||l.op==="enhance")&&h.push(l);let o=new Map;for(let l of s){if(!ce.has(l.op)||!l.target)continue;let p=o.get(l.target)??[];p.push(l),o.set(l.target,p)}for(let[l,p]of o){let _=Math.max(...p.map(v=>v.seq)),w=p.filter(v=>v.seq===_);if(w.length>1){c.push({target:l,seq:_,kinds:w.map(v=>v.op)});continue}h.push(w[0])}return{chatOps:h.sort((l,p)=>l.seq-p.seq).map(l=>de(l,k,t,b.convSourceId)),ambiguous:c}}function ge(s){let t=[];return s.questions.forEach((b,k)=>{if(s.resolution[k])return;let c=b.recommended_index!=null?b.options[b.recommended_index]?.label:void 0;c!=null&&t.push(b.risk==="high"?`${c} \u203C`:c)}),t.length>3?`${t.slice(0,3).join(" \xB7 ")} \xB7 +${t.length-3} more`:t.join(" \xB7 ")}function ae(s){let t=s.text.replace(/\?+\s*$/,"");return t.length<=36?t:`${t.slice(0,33)}\u2026`}function pe(s){return s.use_cases??[]}var me={acs:"acceptance criteria",scenarios:"scenarios",exercises:"exercises",tests:"tests",gaps:"gaps"};function fe(s){let t=[],b=[],k=(o,y)=>{y.length!==0&&(b.push(o),t.push(...y))},c=o=>typeof o=="string"&&/^[a-z]{1,4}\d{1,4}$/i.test(o)?o:null,h=o=>{let y=c(o.automates)??"1 scenario",l=o.verifies??[],p=l.map(c).filter(v=>v!==null).slice(0,2),_=l.length-p.length,w=p.length?`${p.join(" ")}${_>0?` +${_}`:""}`:`${l.length} ACs`;return`covers ${y} \xB7 verifies ${w}`};return k("acs",(s.acs??[]).map(o=>({temp_ref:o.temp_ref,title:o.text,kind:"ac",badge:String(o.kind),extra:{...o.expected_answer?{expects:`${String(o.expected_answer.operator??"")} \xB7 ${String(o.expected_answer.operand??"")}`}:{},"scoped to":o.scoped_to??"(use-case)"}}))),k("scenarios",(s.scenarios??[]).map(o=>({temp_ref:o.temp_ref,title:o.title,kind:"scenario",badge:o.case_type,why:o.intent,depends_on_hint:o.depends_on??[],extra:{technique:o.technique_notes}}))),k("exercises",(s.exercises??[]).map(o=>({temp_ref:c(o.scenario)??"wiring",title:`${c(o.scenario)??"scenario"} exercises ${c(o.ac)??"1 AC"}`,kind:"exercise",badge:"wires",why:o.rationale}))),k("tests",(s.tests??[]).map(o=>({temp_ref:o.temp_ref,title:o.title,kind:"test",why:h(o),depends_on_hint:o.reuses??[],extra:{automates:String(o.automates??"?"),verifies:(o.verifies??[]).join(", "),check:o.check?`${String(o.check.kind)} vs ${String(o.check.verified_against)}`:"?"}}))),k("gaps",(s.gaps??[]).map(o=>({temp_ref:o.temp_ref??o.ref??"?",title:String(o.question?.header??o.kind),kind:"gap",badge:o.kind,why:o.risk_rationale}))),{items:t,heading:b.join(" + ")||"design"}}function ve(s={}){let t={turns:[],thinking:re(),pending:null,confirm:null,status:"idle",ledger:[],activeTurn:null,stream:null,checkpoint:!1},b=e=>{let n=[],r=e.minted.map(a=>a.slug).filter(Boolean);r.length&&n.push(`added ${r.join(", ")}`);let i=e.applied.length-e.minted.length;return i>0&&n.push(`${i} change${i===1?"":"s"} applied`),e.staleDelta.length&&n.push(`stales ${e.staleDelta.length}`),n.join(" \xB7 ")||"no changes"},k=[];s.onRender&&k.push(s.onRender);let c=0,h=0,o=null,y=null,l=null,p=[],_=0,w=e=>{if(!(!l||!s.contextDir||!e.trim()))try{let n=s.refreshGraph?.()??s.graph;if(!n)return;te({contextDir:s.contextDir,graph:n,sourceId:l,text:e,by:s.by??{kind:"human",id:"owner"}})}catch{}},v=e=>{if(!l||!s.contextDir)return;let n=s.refreshGraph?.()??s.graph,r=n?.heads.get(l),i=n?.convChains.get(l);if(!n||typeof r!="string"||!i)return;let a=n.getNode(r)?.content?.blob,u=typeof a=="string"?ee(s.contextDir,a)?.toString("utf8")??"":"";if(u)for(let f of e){if(f.kind!=="add"||f.convSourceId!==l)continue;let Q=G(u,f.cite.turn);if(!(Q!==null&&Q.includes(f.cite.quote)))for(let $=i.turns;$>=1;$--){let W=G(u,$);if(W!==null&&W.includes(f.cite.quote)){f.cite={...f.cite,turn:$};break}}}},C=null,R=new Map,U=e=>JSON.stringify([e.id,e.text,e.options.map(n=>n.label)]),T=null,z=new Map,B=new Map,H=null,m=()=>{I&&(clearTimeout(I),I=null);for(let e of k)e()},I=null,K=()=>{I||(I=setTimeout(()=>{I=null;for(let e of k)e()},80))},d=e=>{t.ledger.push(e)},O=null,P=!1,N=(e=!1)=>{O?d({kind:"agent",text:O}):e&&P&&d({kind:"note",text:'chat to refine ("looks good" approves; /done finishes)'}),O=null,P=!1},ue=()=>{O=null,P=!1},q=null,F=e=>{if(q){if(e)for(let n of q.items){let r=e.get(n.temp_ref);r&&(n.logical_id=r)}d({kind:"turn",...q}),q=null}},j=()=>{F(),t.activeTurn&&(t.activeTurn=null)},J=(e,n)=>n.choice||(n.selected_index!=null?e.options[n.selected_index]?.label??"?":"?"),L=()=>{let e=t.pending;if(!e)return;if(!e.resolution.every(Boolean)){e.cursor=e.resolution.findIndex(i=>i===null);return}let n=e.questions.map((i,a)=>{let u=e.resolution[a];return u.form==="deferred"?{id:i.id,selected_index:null,free_text:null}:{id:i.id,selected_index:u.selected_index,free_text:u.free_text}});t.pending=null,t.status=t.status==="pausing"?"pausing":"streaming",t.status==="streaming"&&(t.busySince=Date.now());let r=C;C=null,r?.(n)},A=(e,n)=>{let r=t.pending,i=r.questions[e],a=r.resolution[e];r.resolution[e]=n;let u=ae(i);a?d({kind:"answer",receipt:{form:"changed",qNum:e+1,stub:u,choice:J(i,n),prev:a.choice}}):n.form==="deferred"?d({kind:"answer",receipt:{form:"deferred",qNum:e+1,stub:u}}):d({kind:"answer",receipt:{form:n.form,qNum:e+1,stub:u,choice:J(i,n)}})},V=()=>{let e=t.pending;e&&(e.questions.forEach((n,r)=>{e.resolution[r]||A(r,{form:"deferred",selected_index:null,free_text:null,choice:""})}),L())},E=new Map,Y=e=>{E.clear();let n={high:0,med:1,low:2};return e=e.map((r,i)=>({q:r,i})).sort((r,i)=>(n[r.q.risk]??3)-(n[i.q.risk]??3)||r.i-i.i).map(({q:r})=>r),{questions:e,cursor:0,resolution:e.map(()=>null)}};return{state:t,explainLines(e){if(!s.explain||!s.graph||s.contextDir===void 0)return null;let n=s.explain(s.contextDir,s.graph,e);return n.target?[`${n.target.label} ${n.target.slug??n.target.cid.slice(0,19)}:`,...n.entries.map(r=>` [${r.kind}] ${r.rationale??r.detail}`)]:null},explainRef(e){if(!s.explain||!s.graph||s.contextDir===void 0){d({kind:"note",text:"explain isn't available here"}),m();return}let n=s.explain(s.contextDir,s.graph,e),r=n.target?[`${n.target.label} ${n.target.slug??n.target.cid.slice(0,19)}:`,...n.entries.map(i=>` [${i.kind}] ${i.rationale??i.detail}`)].join(`
|
|
3
3
|
`):`unknown ref: ${e}`;d({kind:"note",text:r}),m()},subscribe(e){return k.push(e),()=>{let n=k.indexOf(e);n>=0&&k.splice(n,1)}},submit(e){if(t.confirm&&(t.confirm=null),!t.pending){if(!o){t.turns.push({role:"user",text:e}),d({kind:"user",text:e}),t.notice="the agent isn't running \u2014 nothing sent",m();return}for(t.notice=void 0,t.checkpoint=!1,N(),t.turns.push({role:"user",text:e}),d({kind:"user",text:e}),w(e),t.status="streaming",t.busySince=Date.now(),t.error=void 0,h+=1;p.length>0;)h+=1,o({type:"user_message",message_id:`u${h}-receipt`,text:p.shift()});o({type:"user_message",message_id:`u${h}`,text:e}),m()}},attachSender(e){let n=o;return o=e,()=>{o=n}},attachOnCommitted(e){y=e},attachConversationSource(e){l=e},attachSession(e){s.session=e},holdReceipt(e){p.push(e),t.checkpoint=!0,m()},drainHeldReceipts(){return p.splice(0,p.length)},peekHeldReceipts(){return[...p]},submitAnswer(e,n){let r=t.pending,i=r?.questions[e],a=i?.options[n]?.label;!r||!i||a==null||(A(e,{form:"answered",selected_index:n,free_text:null,choice:a}),L(),m())},submitFreeText(e,n){let r=t.pending,i=r?.questions[e],a=n.trim();!r||!i||!a||(A(e,{form:"answered",selected_index:null,free_text:a,choice:a}),L(),m())},deferBatch(e){let n=t.pending;if(!n||!C)return;n.questions.forEach((i,a)=>{let u=n.resolution[a];u&&u.form==="answered"&&R.set(U(i),u)}),t.pending=null,t.status=t.status==="pausing"?"pausing":"streaming",t.status==="streaming"&&(t.busySince=Date.now()),d({kind:"note",text:`questions set aside \u2014 source ${e.source_id} landed; the agent reads it next`});let r=C;C=null,r({deferred:!0,ingested:e}),m()},submitAnswerWithText(e,n,r){let i=t.pending,a=i?.questions[e],u=a?.options[n]?.label;if(!i||!a||u==null)return;let f=r.trim();A(e,{form:"answered",selected_index:n,free_text:f||null,choice:f?`${u} \u2014 ${f}`:u}),L(),m()},toggleOption(e,n){let r=t.pending?.questions[e];if(!r||r.options[n]==null)return;let i=E.get(e)??new Set;i.has(n)?i.delete(n):i.add(n),E.set(e,i),m()},multiSelection(e){return[...E.get(e)??[]].sort((n,r)=>n-r)},confirmMulti(e){let n=t.pending,r=n?.questions[e];if(!n||!r)return;let i=[...E.get(e)??[]].sort((u,f)=>u-f).map(u=>r.options[u]?.label).filter(u=>u!=null);if(i.length===0)return;E.delete(e);let a=i.join(", ");A(e,{form:"answered",selected_index:null,free_text:a,choice:a}),L(),m()},goWithRecommendations(){let e=t.pending;if(!e)return{picks:""};let n=ge(e),r=null;return e.questions.forEach((i,a)=>{if(e.resolution[a])return;let u=i.recommended_index,f=u!=null?i.options[u]?.label:void 0;if(f==null){r===null&&(r=a);return}A(a,{form:"assumed",selected_index:u,free_text:null,choice:f})}),r!==null?(e.cursor=r,m(),{blocked:r}):(L(),m(),{picks:n})},reopenQuestion(){let e=t.pending;if(!e)return;let n=e.cursor<0?e.questions.length:e.cursor;for(let r=n-1;r>=0;r--)if(e.resolution[r]){e.cursor=r,m();return}},continueParked(){if(o){for(t.checkpoint=!1,d({kind:"continued"});p.length>0;)h+=1,o({type:"user_message",message_id:`u${h}-receipt`,text:p.shift()});h+=1,o({type:"user_message",message_id:`u${h}`,text:"continue"}),t.status="streaming",t.busySince=Date.now(),m()}},note(e){d({kind:"note",text:e}),m()},aliasOf(e){return B.get(e)},registerAliases(e){for(let n of e)B.set(n.ref,n.cid);F(new Map(e.filter(n=>n.id).map(n=>[n.ref,n.id]))),m()},setWorking(e){if(e!=null){if(t.status!=="idle"&&t.status!=="working")return;t.status==="idle"&&(t.busySince=Date.now()),t.status="working",t.workingLabel=e}else{if(t.status!=="working")return;t.status="idle",t.workingLabel=void 0,t.busySince=void 0}m()},ledger(e){e.kind==="commit"&&F(),(e.kind==="pause"||e.kind==="error"||e.kind==="summary")&&(j(),N()),(e.kind==="summary"||e.kind==="pause")&&(t.stream=null),d(e),e.kind==="commit"&&(e.ok?N(!0):ue()),m()},senderAlive(){return o!=null},completeSession(){V(),o?.({type:"session_complete"}),t.status="idle",t.busySince=void 0,m()},requestPause(){V(),t.status="pausing",t.busySince=void 0;let e=o;Promise.resolve().then(()=>e?.({type:"pause"})),m()},ask(e){t.pending=Y(e),z=new Map(e.map((r,i)=>[r.id,i+1])),t.status="awaiting-input",t.busySince=void 0;let n=new Promise(r=>{C=r});if(R.size>0){let r=0;e.forEach((i,a)=>{let u=U(i),f=R.get(u);f&&(R.delete(u),A(a,{...f}),r+=1)}),r>0&&d({kind:"note",text:`your earlier answer${r>1?"s are":" is"} pre-filled \u2014 press enter to send, or pick a different answer`})}return m(),n},attachIngest(e){let n=T;return T=e,()=>{T===e&&(T=n)}},canIngest(){return T!==null},async ingestAttach(e){let n=T,r=e.trim();if(!n||!r)return;let i;try{i=await n(r)}catch(a){i={ok:!1,error:a instanceof Error?a.message:String(a)}}i.ok||(d({kind:"note",text:i.error??"the source could not be ingested"}),m())},noteCoercion(e,n){d({kind:"answer",receipt:{form:"assumed",qNum:z.get(e.id)??0,stub:ae(e),choice:n,note:"your typed answer couldn't be used here"}}),m()},onAgentEvent(e){switch(e.type){case"reasoning_delta":case"reasoning_done":case"tool_activity":case"decision_activity":{let n=t.thinking;if(t.thinking=se(n,e),t.thinking!==n){if(e.type==="reasoning_done"&&e.present)d({kind:"thinking",tookMs:e.took_ms});else if(e.type==="tool_activity"&&e.status!=="started")d({kind:"tool",name:e.name,status:e.status==="done"?"ok":e.status,detail:e.detail});else if(e.type==="decision_activity"){let r=`\xB7 ${ie(e)}`,i=t.ledger.length-1;for(;i>=0&&t.ledger[i].kind==="tool";)i--;let a=t.ledger[i];a&&a.kind==="note"&&a.text===r||d({kind:"note",text:r})}}if(e.type==="reasoning_delta"){K();return}break}case"usage":t.credits={turn:e.credits,total:e.total_credits};break;case"text_delta":{let n=H;if(n&&(e.turn_id<n.turn_id||e.turn_id===n.turn_id&&e.attempt<n.attempt))return;(!n||n.turn_id!==e.turn_id||n.attempt!==e.attempt)&&(H={turn_id:e.turn_id,attempt:e.attempt},t.stream={text:""}),t.stream={text:(t.stream?.text??"")+e.text},K();return}case"progress":break;case"proposal":{c+=1,j(),t.stream=null,t.busySince&&(d({kind:"note",text:`\u2713 done in ${Math.max(1,Math.round((Date.now()-t.busySince)/1e3))}s`}),t.busySince=void 0);let n=pe(e.proposal),r=s.dedupFlags?.(e.proposal);if(r)for(let i of n){let a=r.get(i.temp_ref);a&&(i.matches_existing=a)}t.turns.push({role:"agent",turnIndex:c,items:n,text:e.narrative}),O=e.narrative??null,P=!0,t.activeTurn={turnIndex:c,heading:"use-cases",items:n},q={turnIndex:c,heading:"use-cases",items:n},(t.status==="streaming"||t.status==="working")&&(t.status="idle"),t.workingLabel=void 0;break}case"design":{c+=1,j(),t.stream=null,t.busySince&&(d({kind:"note",text:`\u2713 done in ${Math.max(1,Math.round((Date.now()-t.busySince)/1e3))}s`}),t.busySince=void 0);let{items:n,heading:r}=fe(e.design),i=e.design.phase==="wiring"?"acceptance criteria + exercises":r.split(" + ").map(a=>me[a]??a).join(" + ");d({kind:"banner",text:`designing: ${i}`}),t.turns.push({role:"agent",turnIndex:c,items:n,itemsHeading:r,text:e.narrative}),O=e.narrative??null,P=!0,t.activeTurn={turnIndex:c,heading:r,items:n},q={turnIndex:c,heading:r,items:n},(t.status==="streaming"||t.status==="working")&&(t.status="idle"),t.workingLabel=void 0;break}case"ask_user":t.pending=Y(e.questions),t.status="awaiting-input",t.busySince=void 0;break;case"chat_ops":{c+=1,j(),t.stream=null,t.status==="streaming"&&(t.status="idle",t.busySince=void 0);let n=e.chat_ops??e,r=Array.isArray(n.ops)?n.ops:[],i=n.text??e.text??"",a=s.refreshGraph?.()??s.graph,u=g=>B.get(g)??g,f=r.map(g=>{if(!g.target)return g;let x=u(g.target),S=g.expected_cid;if(S==null&&a){let Z=a.resolve(x);Z&&(S=a.tipOf(Z.cid))}let D=g.payload?.redirect_to,M=D&&u(D);return x===g.target&&S===g.expected_cid&&M===D?g:{...g,target:x,expected_cid:S,...M!==D?{payload:{...g.payload,redirect_to:M}}:{}}}),Q;try{if(!Array.isArray(n.ops))throw new Error("the agent sent an unreadable change set (no ops array) \u2014 say it again in different words");Q=oe(f,s.descriptor??{mint_gate:[]},{turn:c,...l?{convSourceId:l}:{}})}catch(g){t.error=g instanceof Error?g.message:String(g),t.turns.push({role:"agent",turnIndex:c,text:i,narration:t.error}),i&&d({kind:"agent",text:i}),d({kind:"error",title:t.error,detail:[]});break}let{chatOps:$,ambiguous:W}=Q;if(W.length>0){let g=W[0];t.confirm={kind:"ambiguity-confirm",prompt:`did you mean edit or ${g.kinds.filter(x=>x!=="edit").join("/")} on ${g.target}?`},t.turns.push({role:"agent",turnIndex:c,text:i}),i&&d({kind:"agent",text:i});break}if(v($),s.commitChatTurn&&$.length>0){let g=s.commitChatTurn({contextDir:s.contextDir??"",graph:s.refreshGraph?.()??s.graph,ops:$,by:s.by??{kind:"human",id:"owner"},...s.descriptor?.mint_gate?{mintable:s.descriptor.mint_gate}:{},...s.session?.state?.sid?{sid:s.session.state.sid}:{}});if(g.errors)t.error=g.errors.map(x=>x.detail).join("; "),t.turns.push({role:"agent",turnIndex:c,text:i}),d({kind:"commit",ok:!1,line:"commit failed \u2014 nothing landed",warnings:g.errors.map(x=>`${x.code}: ${x.detail}`)}),p.push(["COMMIT FAILED (chat turn) \u2014 nothing landed; do not assume any of your last ops applied.",...g.errors.map(x=>`- ${x.code}: ${x.detail}`),...g.errors.some(x=>x.code==="UNKNOWN_FIELD")?["If you were changing citations or matched-existing content, that is proposal territory (approve/re-propose) \u2014 a chat edit can only replace a node's own schema fields."]:[]].join(`
|
|
4
4
|
`)),i&&d({kind:"agent",text:i});else{g.applied.length>0&&s.session?.markApplied(g.applied);let x=b(g);t.turns.push({role:"agent",turnIndex:c,text:i,narration:x}),d({kind:"commit",ok:!0,line:x});let S=s.refreshGraph?.();if(S&&y&&y(S),S)try{_+=1;let X=s.descriptor?.mint_gate?.includes("usecase")?"extract":"design",D=ne({verb:X,commitN:_,phase:"chat",committed:g.minted.map(M=>({cid:M.cid,...M.slug?{logical_id:M.slug}:{}}))},S);p.push(D.text)}catch{}i&&d({kind:"agent",text:i})}}else t.turns.push({role:"agent",turnIndex:c,text:i}),i&&d({kind:"agent",text:i});w(i);break}case"done":case"session_complete":j(),N(),t.status="idle",t.busySince=void 0,o=null;break;case"error":j(),N(),t.stream=null,t.status="idle",t.busySince=void 0,t.error=e.message,o=null,d({kind:"error",title:e.message,detail:[]});break;case"session_paused":break;default:break}m()}}}export{ge as a,ae as b,ve as c};
|