@testmuai/kane-cli 0.9.0 → 0.10.0-rc.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-VPD5G67Q.js +2 -0
- package/dist/ChromeProfilePicker-CRKQEFYD.js +2 -0
- package/dist/CliFeedbackPrompt-M7BMWLKK.js +2 -0
- package/dist/CliUploadProgress-OP7DXMC2.js +2 -0
- package/dist/ConfigView-XI74BCCH.js +2 -0
- package/dist/EvidenceViewOffer-HAAK6DS5.js +2 -0
- package/dist/FolderPicker-W5S6RFCP.js +2 -0
- package/dist/InfoBox-OWUEHV2D.js +2 -0
- package/dist/LinksBox-PNSESNCU.js +2 -0
- package/dist/ProfilesView-PYDZZHKO.js +2 -0
- package/dist/ProjectPicker-BGFCUGT5.js +2 -0
- package/dist/SaveSessionPrompt-SUJE54GS.js +2 -0
- package/dist/ScrollbackTap-4SPXGFMU.js +2 -0
- package/dist/SingleShotApp-4TDXZEUA.js +2 -0
- package/dist/SummaryBox-FALOODAQ.js +2 -0
- package/dist/TestMdRunView-4GPRWHEU.js +2 -0
- package/dist/TestrunEvidenceTable-OBVQJ6IO.js +2 -0
- package/dist/WhoamiView-6WXGRANY.js +2 -0
- package/dist/{agent-parse-2MLJOJTH.js → agent-parse-CAS45UKA.js} +1 -1
- package/dist/app-client-U2YYF65L.js +2 -0
- package/dist/app-download-RXVZB6MM.js +2 -0
- package/dist/assurance-job-C3TXZGLL.js +7 -0
- package/dist/auth-7Z54TMQQ.js +2 -0
- package/dist/{binary-LVHXED3O.js → binary-DJCDMGPX.js} +1 -1
- package/dist/bind-XVO4CQYV.js +2 -0
- package/dist/bootstrap-TY5RANJ7.js +2 -0
- package/dist/bridge-T6QMYKED.js +2 -0
- package/dist/build-5ZN47FAT.js +2 -0
- package/dist/catalog-RRQF4TCA.js +2 -0
- package/dist/{changelog-N5AZHXOS.js → changelog-GBEVIUFJ.js} +1 -1
- package/dist/chat-committer-ZCSRJEUB.js +2 -0
- package/dist/chat-controller-XINCDH6Z.js +2 -0
- package/dist/child-G2GCW73X.js +2 -0
- package/dist/chunk-22PIMG52.js +2 -0
- package/dist/chunk-252FWF2G.js +19 -0
- package/dist/{chunk-UWXDURAB.js → chunk-2IZRPMZN.js} +1 -1
- package/dist/{chunk-X2A6CC6B.js → chunk-2NFS4KE4.js} +1 -1
- package/dist/{chunk-ZXY4P76I.js → chunk-2OOFURWD.js} +1 -1
- package/dist/chunk-2OSFI33O.js +97 -0
- package/dist/{chunk-CSNJPD2J.js → chunk-2S3W2JT3.js} +3 -3
- package/dist/chunk-2SWSVJUP.js +12 -0
- package/dist/chunk-2TVPA3LL.js +2 -0
- package/dist/{chunk-FMUV6UCX.js → chunk-2XW33VOK.js} +1 -1
- package/dist/chunk-33DWJV67.js +235 -0
- package/dist/chunk-34R7BNZ2.js +2 -0
- package/dist/chunk-35ECWCCK.js +2 -0
- package/dist/chunk-3BSYOCSW.js +3 -0
- package/dist/chunk-3G2LSTK5.js +2 -0
- package/dist/chunk-3GXN6VF6.js +2 -0
- package/dist/chunk-3JLEDSG5.js +4 -0
- package/dist/chunk-3QICDXY5.js +5 -0
- package/dist/chunk-3UVSAAES.js +10 -0
- package/dist/chunk-42PALMW2.js +4 -0
- package/dist/chunk-432ZOE42.js +21 -0
- package/dist/chunk-44B6THYK.js +2 -0
- package/dist/chunk-47WQBG5I.js +6 -0
- package/dist/{chunk-DOOI2JBD.js → chunk-4D5PC6QE.js} +1 -1
- package/dist/chunk-4I7YN6YY.js +3 -0
- package/dist/chunk-4IEQNX7F.js +2 -0
- package/dist/{chunk-KXEE6VCA.js → chunk-4LPX2OLV.js} +1 -1
- package/dist/chunk-4LTHDJ3D.js +2 -0
- package/dist/chunk-4QTH7VYE.js +2 -0
- package/dist/chunk-54XA5MZH.js +2 -0
- package/dist/chunk-57MDWTON.js +2 -0
- package/dist/{chunk-CNUCP6DK.js → chunk-5BUIIFLC.js} +1 -1
- package/dist/{chunk-AKE2CTV6.js → chunk-5D7ENQTQ.js} +1 -1
- package/dist/chunk-63EKRZKI.js +2 -0
- package/dist/{chunk-EHN5HTUD.js → chunk-65VANXOF.js} +51 -51
- package/dist/chunk-672CQECV.js +47 -0
- package/dist/chunk-6LIC2R22.js +3 -0
- package/dist/chunk-6NFOH4AC.js +4 -0
- package/dist/chunk-6NWT2TEJ.js +2 -0
- package/dist/chunk-6PIIUAZF.js +3 -0
- package/dist/{chunk-4CYBXJIA.js → chunk-6U7ID777.js} +1 -1
- package/dist/chunk-6UVIY56J.js +2 -0
- package/dist/chunk-72KYMWQ5.js +2 -0
- package/dist/chunk-72RC7JSA.js +21 -0
- package/dist/chunk-74W4AOT2.js +2 -0
- package/dist/chunk-77ZZQJLX.js +2 -0
- package/dist/chunk-7DFBOVUB.js +2 -0
- package/dist/chunk-7EXDYXXD.js +2 -0
- package/dist/chunk-7HO4NX5W.js +1 -0
- package/dist/chunk-7KX2BHKG.js +2 -0
- package/dist/chunk-7LKCWO2R.js +11 -0
- package/dist/{chunk-ULGZPRKU.js → chunk-7NCJMWFX.js} +1 -1
- package/dist/{chunk-EBLXHOE3.js → chunk-7RPKHKA3.js} +1 -1
- package/dist/chunk-7RWP4Y3H.js +2 -0
- package/dist/chunk-7V4BQSSV.js +2 -0
- package/dist/chunk-7XBNMOH4.js +6 -0
- package/dist/chunk-A6TJOZ24.js +2 -0
- package/dist/chunk-AA674WLL.js +2 -0
- package/dist/chunk-AIXJYMSP.js +9 -0
- package/dist/chunk-AJQZ3ST5.js +8 -0
- package/dist/chunk-AQ2OG2EF.js +2 -0
- package/dist/chunk-AUJSC7PU.js +4 -0
- package/dist/chunk-AVI5H4UM.js +13 -0
- package/dist/chunk-AZLNLHUA.js +4 -0
- package/dist/chunk-B2HXPGIZ.js +26 -0
- package/dist/{chunk-HGFWIBVF.js → chunk-B7ZX5HEN.js} +5 -5
- package/dist/{chunk-WRSIKZ2V.js → chunk-BJJUKB5K.js} +1 -1
- package/dist/{chunk-66MOZKD2.js → chunk-BSRSXYDZ.js} +1 -1
- package/dist/{chunk-4BZOG6PE.js → chunk-BVO4C5F2.js} +1 -1
- package/dist/chunk-BWXLZS5O.js +2 -0
- package/dist/chunk-BY65QAAN.js +4 -0
- package/dist/chunk-BZVNI44O.js +6 -0
- package/dist/chunk-C5Z7MQE6.js +2 -0
- package/dist/chunk-C6HI6Y3S.js +2 -0
- package/dist/chunk-CB4ARIHR.js +2 -0
- package/dist/{chunk-C25M2J5Q.js → chunk-CPBBYNL7.js} +1 -1
- package/dist/{chunk-75MMTNPB.js → chunk-D4FFXCX6.js} +2 -2
- package/dist/chunk-D756UWY2.js +6 -0
- package/dist/chunk-DBMW3VUN.js +4 -0
- package/dist/chunk-DD5TULWQ.js +34 -0
- package/dist/{chunk-Q5RDCSYM.js → chunk-DDJNYQBH.js} +1 -1
- package/dist/{chunk-6HU5M2DS.js → chunk-DHQ4SQWA.js} +1 -1
- package/dist/chunk-DNGOT65K.js +3 -0
- package/dist/chunk-DPGOAFKF.js +2 -0
- package/dist/chunk-DREQ3RAA.js +2 -0
- package/dist/chunk-DTUPEKEO.js +2 -0
- package/dist/chunk-E6KSRQXL.js +8 -0
- package/dist/chunk-EF47KRUK.js +2 -0
- package/dist/chunk-ENL4XTQ2.js +2 -0
- package/dist/chunk-EXFDIVNI.js +9 -0
- package/dist/chunk-EZN7CF45.js +4 -0
- package/dist/chunk-F3U6T4YD.js +22 -0
- package/dist/{chunk-DHJSM5DT.js → chunk-FCD3NYOM.js} +1 -1
- package/dist/chunk-FFL55I2M.js +2 -0
- package/dist/chunk-FIP5L6LV.js +9 -0
- package/dist/chunk-FOJHSG5M.js +6 -0
- package/dist/chunk-FSYOTRMC.js +2 -0
- package/dist/chunk-GFLB2SHW.js +2 -0
- package/dist/chunk-GMTHZUZ3.js +2 -0
- package/dist/chunk-GRURFGBP.js +2 -0
- package/dist/chunk-GZFLJORM.js +2 -0
- package/dist/{chunk-EOA6YPES.js → chunk-H3HHSTEK.js} +4 -4
- package/dist/chunk-HAW5WEKT.js +13 -0
- package/dist/chunk-HFJSP4KD.js +2 -0
- package/dist/chunk-HHW6MRU3.js +6 -0
- package/dist/chunk-HIUAUZNL.js +2 -0
- package/dist/chunk-HJLMH7ZM.js +2 -0
- package/dist/{chunk-5GUD3CIH.js → chunk-HQ2E2XCU.js} +1 -1
- package/dist/{chunk-K3IQEL7R.js → chunk-I2KOGINW.js} +1 -1
- package/dist/chunk-I2MC6VVX.js +2 -0
- package/dist/chunk-I5NSJBOZ.js +2 -0
- package/dist/chunk-I6OQISK4.js +2 -0
- package/dist/chunk-IBBD36FQ.js +2 -0
- package/dist/{chunk-GCISXCDU.js → chunk-IINZZ4BZ.js} +1 -1
- package/dist/{chunk-M3UAZTDK.js → chunk-IMDMRJQ6.js} +2 -2
- package/dist/chunk-IXW7FOGX.js +2 -0
- package/dist/chunk-IZ65ZPWY.js +3 -0
- package/dist/chunk-JD52IXON.js +9 -0
- package/dist/chunk-JGRXMTME.js +15 -0
- package/dist/{chunk-NBXYL2JT.js → chunk-JIRNI5TB.js} +7 -7
- package/dist/chunk-JNSWKGTB.js +2 -0
- package/dist/chunk-JPYW6U4D.js +2 -0
- package/dist/chunk-JQSLUGD4.js +3 -0
- package/dist/{chunk-GFBAK7WQ.js → chunk-K45BKGB5.js} +7 -7
- package/dist/chunk-KF4DKXSS.js +2 -0
- package/dist/chunk-KGNE5CIM.js +2 -0
- package/dist/chunk-KM3YCIDV.js +3 -0
- package/dist/chunk-KU3YHPWZ.js +2 -0
- package/dist/chunk-L4UVUFL6.js +3 -0
- package/dist/chunk-LCSJ7GOG.js +2 -0
- package/dist/chunk-LKQFG4RW.js +5 -0
- package/dist/chunk-LNNWCBPQ.js +2 -0
- package/dist/chunk-LRS5MGBY.js +3 -0
- package/dist/chunk-LRXBJTD4.js +4 -0
- package/dist/chunk-LSDJOVWW.js +6 -0
- package/dist/chunk-LWJRSUE2.js +2 -0
- package/dist/chunk-LX2I4JEH.js +2 -0
- package/dist/{chunk-RWSOZPJQ.js → chunk-M6MBMRFR.js} +1 -1
- package/dist/chunk-MGNRNLBE.js +2 -0
- package/dist/chunk-MII3JOO3.js +4 -0
- package/dist/chunk-MNBGG4H3.js +16 -0
- package/dist/chunk-MYVKUJGS.js +2 -0
- package/dist/chunk-MYZHOBS4.js +2 -0
- package/dist/chunk-MZOIHUVX.js +27 -0
- package/dist/{chunk-7GAHJZLH.js → chunk-N3TCNZSX.js} +1 -1
- package/dist/chunk-NC7D7GOM.js +21 -0
- package/dist/{chunk-HAYV4D2I.js → chunk-NDEI7R4K.js} +1 -1
- package/dist/{chunk-BL3SJDCG.js → chunk-NFRA64NU.js} +1 -1
- package/dist/chunk-NLZZLANH.js +4 -0
- package/dist/{chunk-DWMESHFI.js → chunk-NQTYWHPB.js} +1 -1
- package/dist/chunk-NWBLYMH7.js +3 -0
- package/dist/chunk-NWD54VV5.js +2 -0
- package/dist/chunk-NXRF7FFS.js +2 -0
- package/dist/chunk-O3HHTKZ5.js +6 -0
- package/dist/{chunk-F7NSSQYZ.js → chunk-OAKYUBD3.js} +1 -1
- package/dist/{chunk-7WXMV3O3.js → chunk-OEWYXCTA.js} +1 -1
- package/dist/{chunk-4FHK4LKQ.js → chunk-OF7WPCTQ.js} +1 -1
- package/dist/chunk-OFSDB7B4.js +3 -0
- package/dist/chunk-OJ33Q6DU.js +2 -0
- package/dist/chunk-OQ5G773E.js +2 -0
- package/dist/chunk-OVNRRI4E.js +2 -0
- package/dist/{chunk-C6S2RPZA.js → chunk-OZNBTSW5.js} +1 -1
- package/dist/chunk-P2ZQDQDB.js +2 -0
- package/dist/chunk-P7MSVLAH.js +6 -0
- package/dist/chunk-PUVMC4PX.js +26 -0
- package/dist/{chunk-SEEEGDVK.js → chunk-PZA3BSOE.js} +1 -1
- package/dist/chunk-Q3C6NDGI.js +2 -0
- package/dist/chunk-QCKA665H.js +2 -0
- package/dist/chunk-QDFY5GGO.js +5 -0
- package/dist/{chunk-YBAVDT3G.js → chunk-QHRUBG7J.js} +1 -1
- package/dist/chunk-QI5RZ7LL.js +2 -0
- package/dist/chunk-QNLVC5ZB.js +2 -0
- package/dist/{chunk-WDMUPK6I.js → chunk-QQ4TKLWP.js} +1 -1
- package/dist/chunk-QS5ZJFGF.js +4 -0
- package/dist/chunk-QTZBVDPR.js +12 -0
- package/dist/chunk-QXQ7KVEN.js +2 -0
- package/dist/chunk-R4JUKTDO.js +2 -0
- package/dist/chunk-R7KXAISS.js +12 -0
- package/dist/chunk-RDP7GWSY.js +2 -0
- package/dist/chunk-REKHAN53.js +5 -0
- package/dist/{chunk-KWEOLPBJ.js → chunk-RFEON5GN.js} +1 -1
- package/dist/{chunk-SOCHN2PY.js → chunk-RFIIM33J.js} +1 -1
- package/dist/chunk-RG372DON.js +6 -0
- package/dist/chunk-RPRXRKKR.js +2 -0
- package/dist/chunk-RTVWQK7I.js +2 -0
- package/dist/{chunk-2PKME4VT.js → chunk-RW3Z2HMB.js} +4 -4
- package/dist/chunk-RX47NRSM.js +2 -0
- package/dist/chunk-RX6776AI.js +5 -0
- package/dist/chunk-S53AQU7R.js +6 -0
- package/dist/{chunk-XT7XA4DN.js → chunk-SA6IKFFD.js} +1 -1
- package/dist/{chunk-Q5CINJYL.js → chunk-SLKYD44Y.js} +1 -1
- package/dist/chunk-SMTBOSEJ.js +2 -0
- package/dist/chunk-SMXABALN.js +2 -0
- package/dist/chunk-SONMD3W5.js +5 -0
- package/dist/chunk-SWMTXMKB.js +2 -0
- package/dist/{chunk-TM7VRLWS.js → chunk-SXRHKXSE.js} +1 -1
- package/dist/chunk-T3HEJASG.js +5 -0
- package/dist/chunk-T4AVLJCW.js +6 -0
- package/dist/{chunk-6VY62QC2.js → chunk-T6K2MEWP.js} +1 -1
- package/dist/{chunk-PCKIANML.js → chunk-T7H4LBFK.js} +1 -1
- package/dist/chunk-TNORODUF.js +2 -0
- package/dist/chunk-TW63WWEN.js +2 -0
- package/dist/chunk-UALJTPSA.js +18 -0
- package/dist/chunk-UAWWLLTI.js +2 -0
- package/dist/chunk-UEE3RZN4.js +14 -0
- package/dist/chunk-UTM7D4PI.js +2 -0
- package/dist/chunk-UUJIGOEO.js +2 -0
- package/dist/chunk-UYDHOHSZ.js +2 -0
- package/dist/chunk-V5JGXOV7.js +2 -0
- package/dist/chunk-V7S6S5W3.js +2 -0
- package/dist/{chunk-OHOJSADN.js → chunk-VG44B5JD.js} +1 -1
- package/dist/chunk-VJGWVBZR.js +1 -0
- package/dist/chunk-VLDCHFXF.js +2 -0
- package/dist/chunk-VO66KP2W.js +2 -0
- package/dist/{chunk-J3BGYSMD.js → chunk-VQLH63X7.js} +8 -8
- package/dist/chunk-VRIZDOO5.js +2 -0
- package/dist/chunk-VYHT2IET.js +1397 -0
- package/dist/chunk-VZJ6LUXX.js +2 -0
- package/dist/chunk-W3OVSDBN.js +29 -0
- package/dist/chunk-W7FLXW6Q.js +5 -0
- package/dist/{chunk-UA2QDAWT.js → chunk-WEM3MOAL.js} +1 -1
- package/dist/chunk-WI7K6VKQ.js +2 -0
- package/dist/chunk-WMGKUERB.js +6 -0
- package/dist/{chunk-DFS4RMVP.js → chunk-WN5VKKJ3.js} +1 -1
- package/dist/chunk-WOSANGV6.js +5 -0
- package/dist/chunk-WYSZ6TPW.js +15 -0
- package/dist/chunk-XB6BJPDL.js +2 -0
- package/dist/{chunk-YWYORBY3.js → chunk-XBEYWXPV.js} +1 -1
- package/dist/chunk-XIPKSXRQ.js +16 -0
- package/dist/chunk-XJ7HCXKW.js +2 -0
- package/dist/chunk-XMPTFXPW.js +5 -0
- package/dist/chunk-XZYA7DNH.js +2 -0
- package/dist/chunk-Y4T4SLDO.js +2 -0
- package/dist/{chunk-OIUV3ISA.js → chunk-Y6Y6RAY4.js} +1 -1
- package/dist/chunk-YDPTSDIJ.js +2 -0
- package/dist/chunk-YDSGXB25.js +2 -0
- package/dist/chunk-YIKF4ERQ.js +375 -0
- package/dist/chunk-Z55KBMYV.js +2 -0
- package/dist/chunk-ZCRZFAOT.js +2 -0
- package/dist/chunk-ZFM77AQU.js +2 -0
- package/dist/{chunk-Q6F23V7L.js → chunk-ZFMRQ57Y.js} +1 -1
- package/dist/chunk-ZHWU6L2G.js +5 -0
- package/dist/chunk-ZTHYAHDN.js +17 -0
- package/dist/chunk-ZZP5SHUV.js +3 -0
- package/dist/committer-JGY66PFM.js +2 -0
- package/dist/config-5ZOALGKE.js +2 -0
- package/dist/controller-client-PB3AZAGG.js +2 -0
- package/dist/cover-cmd-UA2SVIZZ.js +2 -0
- package/dist/{credentials-QD32Y7K7.js → credentials-MRG452Y6.js} +1 -1
- package/dist/{deps-bundle-OI7JJ22L.js → deps-bundle-FWINW4XM.js} +1 -1
- package/dist/{deps-resolve-ZOALDS6H.js → deps-resolve-IET4KIBO.js} +1 -1
- package/dist/descriptor-7T32VRMB.js +2 -0
- package/dist/design-chat-MM5PJD2N.js +2 -0
- package/dist/design-committer-TRYP3LOZ.js +2 -0
- package/dist/design-headless-FZONCKHW.js +2 -0
- package/dist/design-remote-SPVRIY2H.js +3 -0
- package/dist/device-env-LXJ65AVF.js +2 -0
- package/dist/dispatch-DVQ3H7EJ.js +2 -0
- package/dist/doctor-VAX2BWQF.js +2 -0
- package/dist/docx-convert-6IZO5P5K.js +2 -0
- package/dist/{dossier-7HVC6BNK.js → dossier-NROC2MCY.js} +1 -1
- package/dist/evidence-LVVK7ROT.js +2 -0
- package/dist/evidence-presentation-YYTIDCBS.js +2 -0
- package/dist/evolve-cmd-AGRKG7T3.js +2 -0
- package/dist/evolve-remote-BGHULJTL.js +2 -0
- package/dist/{exit-manager-ZLDO54S4.js → exit-manager-EDHCETUN.js} +1 -1
- package/dist/explain-DGJ5T6V5.js +2 -0
- package/dist/explain-cmd-VYAANFFZ.js +4 -0
- package/dist/explain-cmd-WOBGS6KX.js +12 -0
- package/dist/explore-LOKNOVNP.js +2 -0
- package/dist/explore-context-tty-JTZVZFOE.js +2 -0
- package/dist/explore-entry-5OGNLFAU.js +6 -0
- package/dist/explore-live-2XZHUYFS.js +5 -0
- package/dist/explore-run-tty-LGTIK2NA.js +5 -0
- package/dist/extract-bind-NM2BBK4I.js +14 -0
- package/dist/extract-chat-HLQMJJIC.js +2 -0
- package/dist/extract-cmd-T2TSAC3N.js +6 -0
- package/dist/extract-headless-OQTQ3FJK.js +2 -0
- package/dist/feeder-NY45UFJK.js +2 -0
- package/dist/folder-flags-WXUR6OPJ.js +2 -0
- package/dist/gaps-cmd-PTSKPTF7.js +3 -0
- package/dist/gate-P57VP4E5.js +2 -0
- package/dist/gate-WISOUTHQ.js +2 -0
- package/dist/{generate-headless-6WMJYNI6.js → generate-headless-JYZP6VXZ.js} +3 -3
- package/dist/headless-io-FFM5T6KL.js +2 -0
- package/dist/hold-passthrough-IOWPVB4W.js +2 -0
- package/dist/identity-HL5CJJXR.js +2 -0
- package/dist/index.js +178 -160
- package/dist/ingest-PDGS5ZTL.js +2 -0
- package/dist/ingest-cmd-LHCBMO4Z.js +8 -0
- package/dist/ingest-remote-D5TO5JQP.js +2 -0
- package/dist/ink-screen-RZ7QDIUI.js +2 -0
- package/dist/install-Z6K2D2VY.js +2 -0
- package/dist/interactive-bind-5EJQUGKI.js +26 -0
- package/dist/interactive-remote-D77ULJGL.js +65 -0
- package/dist/interrupt-guard-QETBPINI.js +2 -0
- package/dist/lane-AQYRIW24.js +2 -0
- package/dist/lattice-auth-74XGF77Y.js +2 -0
- package/dist/lifecycle-cmd-7SM6UCMH.js +2 -0
- package/dist/list-cmd-Z6FZXMFU.js +3 -0
- package/dist/list-commands-CZYZ7GIG.js +2 -0
- package/dist/list-remote-WOPOC6KK.js +15 -0
- package/dist/locks-cmd-JJ2QNTNY.js +2 -0
- package/dist/logical-ids-RXAQJZ3T.js +2 -0
- package/dist/login-flow-2FZEOVHM.js +2 -0
- package/dist/maintenance-cmd-VRTGZVRE.js +2 -0
- package/dist/mobile-prompts-KNAHU64X.js +2 -0
- package/dist/{next-KZXH4UA4.js → next-O6SUSX3R.js} +1 -1
- package/dist/{objective-variable-gate-CG2KK5UX.js → objective-variable-gate-3Z7DNVVC.js} +1 -1
- package/dist/onboarding-LGT6PMDZ.js +5 -0
- package/dist/open-provider-OZAG6WZS.js +2 -0
- package/dist/{paths-JCYX6UWL.js → paths-UMIX3RJF.js} +1 -1
- package/dist/pdf-convert-447ACUB3.js +2 -0
- package/dist/persist-recorded-session-BX7II5P7.js +3 -0
- package/dist/phase-seed-LCJ4WSYV.js +2 -0
- package/dist/pipeline-IXVTVRS5.js +2 -0
- package/dist/prepare-target-ULMKVKMC.js +2 -0
- package/dist/pull-cmd-6AL2WYHB.js +2 -0
- package/dist/pull-route-TTVARJMV.js +2 -0
- package/dist/readmodel-INMP6MNW.js +2 -0
- package/dist/real-device-run-2LFS5WE2.js +2 -0
- package/dist/reconcile-cmd-R6H37SQR.js +5 -0
- package/dist/reconcile-deps-TWJ3FTSU.js +2 -0
- package/dist/reconcile-remote-GWDV5CUT.js +13 -0
- package/dist/recording-banner-ACC67Q2U.js +2 -0
- package/dist/registry-6IJYQXQC.js +2 -0
- package/dist/remote-entry-YL7O2NJQ.js +2 -0
- package/dist/remote-mode-7G6PLJCW.js +4 -0
- package/dist/remote-words-45USLRVN.js +2 -0
- package/dist/require-project-folder-A3UDRELU.js +2 -0
- package/dist/resolve-run-intent-ZGPSUBXV.js +2 -0
- package/dist/resolver-IPM6R7U4.js +2 -0
- package/dist/revert-FHOBLZWF.js +2 -0
- package/dist/review-cmd-NNT5C5RZ.js +5 -0
- package/dist/run-5RQUCNYP.js +2 -0
- package/dist/run-PC5YO4AS.js +2 -0
- package/dist/run-channel-63SVP5OI.js +2 -0
- package/dist/run-remote-3AYYVPKX.js +2 -0
- package/dist/run-startup-gate-NKRMKYBB.js +2 -0
- package/dist/run-test-md-HE6DUWQR.js +17 -0
- package/dist/scrollback-GGNBDFQV.js +2 -0
- package/dist/session-target-DD53UXO7.js +2 -0
- package/dist/session-worker.js +12 -0
- package/dist/sessions-CFV7FOIT.js +2 -0
- package/dist/sessions-cmd-GYMETJHG.js +26 -0
- package/dist/sessions-remote-GI7GOBMH.js +3 -0
- package/dist/shell-arg-FN3MT5U7.js +2 -0
- package/dist/{skill-installer-32YYMM4N.js → skill-installer-3QAVQGDH.js} +1 -1
- package/dist/spawner-C7NLLM4F.js +2 -0
- package/dist/store-X6XPFSKF.js +2 -0
- package/dist/store-choice-RT73HAI7.js +2 -0
- package/dist/store-guard-SNWKLHQV.js +2 -0
- package/dist/store-id-YZ5WKJ25.js +2 -0
- package/dist/store-site-KA2DNBGY.js +2 -0
- package/dist/stream-warnings-GEQKKJU7.js +2 -0
- package/dist/structured-answers-EQ2AP3F7.js +2 -0
- package/dist/sync-cmd-NBPPDG3B.js +2 -0
- package/dist/sync-setup-5NUCH6N3.js +2 -0
- package/dist/{sync-setup-ui-RC727VK6.js → sync-setup-ui-XITPGSO4.js} +2 -2
- package/dist/tcg-generate-Z23CUISY.js +2 -0
- package/dist/test-definition-VRI4YIYL.js +2 -0
- package/dist/testmd-actions-GH5BW5V5.js +2 -0
- package/dist/testmd-sync-ACKCIOL3.js +2 -0
- package/dist/tms-client-NXAB6VJD.js +2 -0
- package/dist/token-refresh-4UCYAG6A.js +2 -0
- package/dist/trust-gate-AT2XBWN4.js +2 -0
- package/dist/turn-preflight-LHYLRL7G.js +2 -0
- package/dist/ui-SNV3FD2G.js +4 -0
- package/dist/use-case-ref-NE4X4MZN.js +2 -0
- package/dist/validate-basic-RE2WLIGQ.js +2 -0
- package/dist/{variable-receipt-YWNS24TH.js → variable-receipt-BXSZO36E.js} +1 -1
- package/dist/verdicts-XK3GAUX3.js +2 -0
- package/dist/version-check-4FJVZP3K.js +2 -0
- package/dist/{view-cmd-3WHG6MVB.js → view-cmd-N47BQZPD.js} +4 -3
- package/dist/walk-session-DA7QWXSW.js +2 -0
- package/dist/with-telemetry-7V4LY2BG.js +2 -0
- package/package.json +11 -11
- package/dist/ChatSurface-FJPK3XEJ.js +0 -8
- package/dist/ChromeProfilePicker-7DUDJTE2.js +0 -2
- package/dist/CliFeedbackPrompt-ZZPYC6OS.js +0 -2
- package/dist/CliUploadProgress-WQYKIBAR.js +0 -2
- package/dist/ConfigView-KXNOODDW.js +0 -2
- package/dist/EvidenceViewOffer-BTBVPBZX.js +0 -2
- package/dist/FolderPicker-H4YEX5LV.js +0 -2
- package/dist/InfoBox-DTM7X24Z.js +0 -2
- package/dist/LinksBox-KFG3FVOT.js +0 -2
- package/dist/ProfilesView-KBZHT4KL.js +0 -2
- package/dist/ProjectPicker-OARWULNN.js +0 -2
- package/dist/SaveSessionPrompt-37SMU5MC.js +0 -2
- package/dist/ScrollbackTap-QHJOFYMC.js +0 -2
- package/dist/SingleShotApp-UYCAW65Y.js +0 -2
- package/dist/SummaryBox-6RB5DSAH.js +0 -2
- package/dist/TestMdRunView-ZMOII3PL.js +0 -2
- package/dist/TestrunEvidenceTable-3UP2EYIV.js +0 -2
- package/dist/WhoamiView-MC62GERR.js +0 -2
- package/dist/app-client-PQFJAB63.js +0 -2
- package/dist/app-download-P6YXWSVQ.js +0 -2
- package/dist/auth-LXW4OFKF.js +0 -2
- package/dist/bind-ZYESQSCJ.js +0 -15
- package/dist/bootstrap-DI4UGMH3.js +0 -2
- package/dist/bridge-7J3JE3JS.js +0 -2
- package/dist/build-JIKYOZUH.js +0 -2
- package/dist/catalog-LLME3744.js +0 -2
- package/dist/chat-committer-6D7AQI6Z.js +0 -2
- package/dist/chat-controller-UJQ6Z4RE.js +0 -2
- package/dist/chunk-243ZJHT6.js +0 -4
- package/dist/chunk-2KVECC36.js +0 -2
- package/dist/chunk-2YEHV2CX.js +0 -2
- package/dist/chunk-3MCPTVJX.js +0 -2
- package/dist/chunk-3UI5VTQS.js +0 -4
- package/dist/chunk-3VAU3PNU.js +0 -2
- package/dist/chunk-3YIZG7WZ.js +0 -3
- package/dist/chunk-4Y2WH77W.js +0 -2
- package/dist/chunk-5EOX4MEY.js +0 -2
- package/dist/chunk-5HMN74RZ.js +0 -9
- package/dist/chunk-5LJRZI7S.js +0 -6
- package/dist/chunk-5RCS2LIQ.js +0 -26
- package/dist/chunk-5TQFOPJV.js +0 -2
- package/dist/chunk-5ZFOKYFB.js +0 -5
- package/dist/chunk-63DYVWNX.js +0 -2
- package/dist/chunk-6MD7SR7D.js +0 -9
- package/dist/chunk-7N6OCHPC.js +0 -7
- package/dist/chunk-A2SQD2AY.js +0 -4
- package/dist/chunk-AACQE24F.js +0 -2
- package/dist/chunk-AHFIRHSP.js +0 -18
- package/dist/chunk-AJT34ESA.js +0 -38
- package/dist/chunk-AUMJ4RVA.js +0 -21
- package/dist/chunk-AXTPNZPX.js +0 -2
- package/dist/chunk-BB2W35TW.js +0 -2
- package/dist/chunk-BKM2LWU2.js +0 -3
- package/dist/chunk-BUPRL2TE.js +0 -2
- package/dist/chunk-C44QQJR4.js +0 -239
- package/dist/chunk-CW3RHKLA.js +0 -5
- package/dist/chunk-D6E6KRVX.js +0 -2
- package/dist/chunk-DTRKTBCE.js +0 -17
- package/dist/chunk-DTRSYWZE.js +0 -2
- package/dist/chunk-EVFFDODK.js +0 -5
- package/dist/chunk-F2OBORCG.js +0 -2
- package/dist/chunk-FQNQVC5O.js +0 -5
- package/dist/chunk-FY7TCYPK.js +0 -6
- package/dist/chunk-GTVQYT3D.js +0 -35
- package/dist/chunk-HG5LLZBU.js +0 -2
- package/dist/chunk-I7TIGB7K.js +0 -2
- package/dist/chunk-IICT4VOU.js +0 -2
- package/dist/chunk-ILDHE4P4.js +0 -6
- package/dist/chunk-IPXKUYUK.js +0 -2
- package/dist/chunk-JQY5HRZ4.js +0 -15
- package/dist/chunk-JX6BFEDO.js +0 -4
- package/dist/chunk-K2UJYY2U.js +0 -2
- package/dist/chunk-KBM3XHAM.js +0 -2
- package/dist/chunk-KDNNMU7Q.js +0 -4
- package/dist/chunk-KJQNAOOE.js +0 -6
- package/dist/chunk-LH4IPANP.js +0 -2
- package/dist/chunk-LLG7NEGX.js +0 -6
- package/dist/chunk-LSDWPG6C.js +0 -2
- package/dist/chunk-MSGW4JDG.js +0 -2
- package/dist/chunk-NJ4BXZBX.js +0 -2
- package/dist/chunk-NLCCBXXV.js +0 -2
- package/dist/chunk-NMSZ7G6P.js +0 -2
- package/dist/chunk-OC6H6BYI.js +0 -6
- package/dist/chunk-OJAXOOZ5.js +0 -8
- package/dist/chunk-OMNLAGQC.js +0 -29
- package/dist/chunk-OOCCUUR2.js +0 -2
- package/dist/chunk-OXC6O5O7.js +0 -2
- package/dist/chunk-OZQDD2EX.js +0 -94
- package/dist/chunk-PEDINHVU.js +0 -2
- package/dist/chunk-PNUAP3RY.js +0 -8
- package/dist/chunk-Q2F5QB2W.js +0 -2
- package/dist/chunk-Q4YYAN6E.js +0 -2
- package/dist/chunk-Q6AHSGOE.js +0 -5
- package/dist/chunk-QAB3Y5FQ.js +0 -4
- package/dist/chunk-RDHWNSDP.js +0 -7
- package/dist/chunk-RKXHVP2Z.js +0 -2
- package/dist/chunk-RRY5IXOB.js +0 -2
- package/dist/chunk-RSSOJ3L2.js +0 -21
- package/dist/chunk-RTSBKCZY.js +0 -16
- package/dist/chunk-SID4X77D.js +0 -370
- package/dist/chunk-SRTKRHYI.js +0 -12
- package/dist/chunk-T2ONUKTL.js +0 -5
- package/dist/chunk-U6OTFMIT.js +0 -4
- package/dist/chunk-UD7KKHPW.js +0 -5
- package/dist/chunk-USOYXCZ4.js +0 -2
- package/dist/chunk-USY7VAO6.js +0 -2
- package/dist/chunk-V4B5QA3U.js +0 -4
- package/dist/chunk-VBS33P2C.js +0 -2
- package/dist/chunk-VHW7BMZQ.js +0 -2
- package/dist/chunk-VIO7CCFW.js +0 -5
- package/dist/chunk-VORWZLS3.js +0 -9
- package/dist/chunk-VVOKM2VO.js +0 -2
- package/dist/chunk-W5TTF7GB.js +0 -6
- package/dist/chunk-WESMQEPO.js +0 -2
- package/dist/chunk-WMI4P76K.js +0 -27
- package/dist/chunk-WNOC6MQC.js +0 -2
- package/dist/chunk-WVHMPIDQ.js +0 -2
- package/dist/chunk-XBX643ZD.js +0 -2
- package/dist/chunk-XKHWWKJZ.js +0 -3
- package/dist/chunk-XLSOQLVT.js +0 -2
- package/dist/chunk-Y3ZYN6AK.js +0 -4
- package/dist/chunk-YCCUBQY4.js +0 -2
- package/dist/chunk-YKTYVJBN.js +0 -3
- package/dist/chunk-YLQHY4A7.js +0 -2
- package/dist/chunk-Z7IGTVJW.js +0 -2
- package/dist/chunk-ZC2CKWLB.js +0 -2
- package/dist/chunk-ZER3FZSZ.js +0 -22
- package/dist/chunk-ZJYT72BA.js +0 -9
- package/dist/chunk-ZKSN2SJ7.js +0 -2
- package/dist/chunk-ZLWURCJ7.js +0 -2
- package/dist/committer-2QPBANRD.js +0 -2
- package/dist/config-YGTHSGQN.js +0 -2
- package/dist/controller-client-ZF5IXRUV.js +0 -2
- package/dist/cover-cmd-6RO366CC.js +0 -3
- package/dist/descriptor-3JJUOHBM.js +0 -2
- package/dist/design-committer-D44GSUXY.js +0 -2
- package/dist/device-env-DXDJJMTL.js +0 -2
- package/dist/dispatch-7EWWQRQ5.js +0 -2
- package/dist/doctor-TPYPEEUL.js +0 -2
- package/dist/docx-convert-SQRTF7XS.js +0 -2
- package/dist/evidence-NPFTBGDF.js +0 -2
- package/dist/evidence-presentation-XF23B7F2.js +0 -2
- package/dist/evolve-cmd-VGVXV6XW.js +0 -2
- package/dist/explain-NEFBUX5G.js +0 -2
- package/dist/explain-cmd-GOP5TE63.js +0 -9
- package/dist/explain-cmd-M7IX2YNB.js +0 -3
- package/dist/extract-bind-CKIRLXAJ.js +0 -14
- package/dist/extract-cmd-3EWLSPGS.js +0 -5
- package/dist/feeder-66TUPB2R.js +0 -2
- package/dist/gaps-cmd-WVC5GXQC.js +0 -3
- package/dist/gate-OYRDJMF6.js +0 -2
- package/dist/headless-io-75HUMWZB.js +0 -2
- package/dist/identity-ADZ4PAJF.js +0 -2
- package/dist/ingest-OSNNM3DH.js +0 -2
- package/dist/ingest-cmd-AECK5T4H.js +0 -2
- package/dist/install-ZV3KJZV4.js +0 -2
- package/dist/interactive-bind-IYS6KDOH.js +0 -26
- package/dist/interrupt-guard-UREUWNRL.js +0 -2
- package/dist/lifecycle-cmd-XCSBELFQ.js +0 -2
- package/dist/list-cmd-S4DSN2ET.js +0 -3
- package/dist/list-commands-GLNGHPDU.js +0 -2
- package/dist/locks-cmd-67OHQZNV.js +0 -2
- package/dist/logical-ids-GLVM2SVR.js +0 -2
- package/dist/login-flow-ASUUU7SO.js +0 -2
- package/dist/maintenance-cmd-K5KXRIFL.js +0 -2
- package/dist/mobile-prompts-ZUZTA3RV.js +0 -2
- package/dist/open-provider-YIBB77FE.js +0 -2
- package/dist/pdf-convert-RLXSXFWN.js +0 -2
- package/dist/persist-recorded-session-EWV56TSZ.js +0 -3
- package/dist/phase-seed-MKHEWUN6.js +0 -2
- package/dist/pipeline-LAWACB2O.js +0 -2
- package/dist/prepare-target-WGPCZKLE.js +0 -2
- package/dist/readmodel-FVLRQWZ7.js +0 -2
- package/dist/real-device-run-MDLFKFVQ.js +0 -2
- package/dist/reconcile-cmd-XFM2ZXUJ.js +0 -2
- package/dist/reconcile-deps-V5VLDPYT.js +0 -4
- package/dist/reconcile-engine-VZBTMPUK.js +0 -2
- package/dist/recording-banner-CJHRPHHF.js +0 -2
- package/dist/records-LMCVKPE5.js +0 -2
- package/dist/registry-3JXQFZEG.js +0 -2
- package/dist/require-project-folder-SE5GVCYJ.js +0 -2
- package/dist/resolve-run-intent-DD4MB6UD.js +0 -2
- package/dist/resolver-TLO4SRWV.js +0 -2
- package/dist/revert-NOUECRW4.js +0 -2
- package/dist/review-cmd-7EOYQMPE.js +0 -5
- package/dist/run-EHUNJPW6.js +0 -2
- package/dist/run-OTMPUQSH.js +0 -2
- package/dist/run-channel-RGH4WIQX.js +0 -2
- package/dist/run-test-md-KBDEHGXJ.js +0 -17
- package/dist/scrollback-JLPJR25X.js +0 -2
- package/dist/session-items-2ATN7VXG.js +0 -2
- package/dist/session-target-UMNASXI7.js +0 -2
- package/dist/sessions-NH7WQWMX.js +0 -2
- package/dist/sessions-cmd-M3SECFKQ.js +0 -25
- package/dist/spawner-DPT2RLAO.js +0 -2
- package/dist/store-guard-U32JE6JJ.js +0 -2
- package/dist/store-id-EOSGEKVK.js +0 -2
- package/dist/structured-answers-ZI2B6JJE.js +0 -2
- package/dist/sync-cmd-3EP7LZGL.js +0 -2
- package/dist/sync-setup-SWTBVQEV.js +0 -2
- package/dist/tcg-generate-KXU7E2GF.js +0 -2
- package/dist/testmd-actions-PEWCPQ5R.js +0 -2
- package/dist/testmd-sync-ZWFQWZ2X.js +0 -2
- package/dist/tms-client-KU6HCA23.js +0 -2
- package/dist/token-refresh-QD3OCGJJ.js +0 -2
- package/dist/trust-gate-EX7R2P4Y.js +0 -2
- package/dist/turn-preflight-JGYT7LXP.js +0 -2
- package/dist/ui-JEJGTURD.js +0 -4
- package/dist/validate-basic-AAIXSAWH.js +0 -2
- package/dist/verdicts-LAB5BGCC.js +0 -2
- package/dist/version-check-EHOLX3YH.js +0 -2
- package/dist/walk-session-XP4KYFKO.js +0 -2
- package/dist/with-telemetry-FJMJQDCM.js +0 -2
- /package/dist/{chunk-BKHXPBWN.js → chunk-2RUSXQ3O.js} +0 -0
- /package/dist/{chunk-6J5T5FEY.js → chunk-3AGP2BVN.js} +0 -0
- /package/dist/{chunk-CH273NAE.js → chunk-73Y6T2UK.js} +0 -0
- /package/dist/{chunk-ZMNJBUAO.js → chunk-73ZFOJOK.js} +0 -0
- /package/dist/{chunk-NOL7MNZH.js → chunk-A7RJQJNT.js} +0 -0
- /package/dist/{chunk-N2P4MI32.js → chunk-FWGUISUG.js} +0 -0
- /package/dist/{chunk-UJZZDPDY.js → chunk-HD6NR44L.js} +0 -0
- /package/dist/{chunk-LDPLJFCV.js → chunk-I6S6DZ2E.js} +0 -0
- /package/dist/{chunk-427OQS2N.js → chunk-LD5B3QFW.js} +0 -0
- /package/dist/{chunk-2UIHS2FH.js → chunk-PGESS7BW.js} +0 -0
- /package/dist/{chunk-BZAGVBCX.js → chunk-ZCIWQHCO.js} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as A,b as T,c as $,d as x,e as c,h as F}from"./chunk-UUJIGOEO.js";import{f as k,l as v,q as E}from"./chunk-AZLNLHUA.js";import{M as S,j as N,m as U,n as O}from"./chunk-UEE3RZN4.js";import{d as m}from"./chunk-DBMW3VUN.js";import{existsSync as R,readFileSync as H,statSync as M}from"fs";var B=t=>{try{return R(t)&&M(t).isFile()}catch{return!1}},C=t=>N(t)&&A.test(t);async function y(t,n,o,l){let e=t.manifest.id,s,a=new Promise((r,d)=>{s=setTimeout(()=>d(new $({code:"PLUGIN_HOOK_TIMEOUT",message:`plugin ${e} did not answer ${n} within ${Math.round(o/1e3)} seconds`,plugin:e,hook:n})),o)});try{return await Promise.race([Promise.resolve().then(l),a])}catch(r){throw r instanceof $?r:r instanceof T?new $({code:"PLUGIN_REFUSED",message:r.message,plugin:e,hook:n,...r.remedy?{remedy:r.remedy}:{}}):new $({code:"PLUGIN_HOOK_FAILED",message:`plugin ${e} failed in ${n}: ${r instanceof Error?r.message:String(r)}`,plugin:e,hook:n})}finally{clearTimeout(s)}}async function ee(t){let{plugin:n,ref:o,named:l}=t,e=n.manifest.id,s=t.hookMs??m.hookMs,a=t.isFile??B(o),r=!a&&x(n).includes("remote")&&typeof n.fetch=="function",d=l?`${e}:${o}`:o,I=r?O(d):null;I!==null&&c("PLUGIN_REF_INVALID",`${d.length>80?`${d.slice(0,80)}\u2026`:d} cannot be recorded as a reference: ${I}`,{plugin:e,remedy:`give the source as <scheme>:<rest>, one word of at most ${U} characters`});let h=await y(n,"claim",s,()=>n.claim({ref:o,named:l,isFile:a}));h==null&&c("PLUGIN_NOT_CLAIMED",`plugin ${e} does not read ${o}`,{plugin:e,hook:"claim",remedy:l?`drop the ${e}: prefix, or name the plugin that reads it`:"ingest it as a file of a built-in kind"}),(typeof h!="object"||typeof h.sourceId!="string")&&c("PLUGIN_HOOK_FAILED",`plugin ${e} answered claim with something that is not a claim`,{plugin:e,hook:"claim"});let p=t.asId??h.sourceId,b=h.recorded;if(r&&b!==void 0){(typeof b!="string"||b==="")&&c("PLUGIN_HOOK_FAILED",`plugin ${e} answered claim with a recorded reference that is not one`,{plugin:e,hook:"claim"});let i=l?`${e}:${b}`:b,u=O(i);u!==null&&c("PLUGIN_HOOK_FAILED",`plugin ${e} would record ${i.length>80?`${i.slice(0,80)}\u2026`:i}, which cannot be recorded as a reference: ${u}`,{plugin:e,hook:"claim"});let f=(t.registry??F()).route(i,()=>!1);(f===null||f.plugin.manifest.id!==e)&&c("PLUGIN_HOOK_FAILED",`plugin ${e} would record ${i.length>80?`${i.slice(0,80)}\u2026`:i}, which ${f===null?"no plugin reads":`plugin ${f.plugin.manifest.id} reads`}: a recorded reference must route back to the plugin that read it`,{plugin:e,hook:"claim"});let w=await y(n,"claim",s,()=>n.claim({ref:f.ref,named:f.named,isFile:!1}));(w==null||typeof w!="object"||w.sourceId!==h.sourceId)&&c("PLUGIN_HOOK_FAILED",`plugin ${e} would record ${b} for ${h.sourceId}, but claiming it again ${w?`gives ${String(w.sourceId)}`:"is refused"}: a recorded reference must name the same source`,{plugin:e,hook:"claim"}),d=i}C(p)||c("PLUGIN_SOURCE_ID_INVALID",`${JSON.stringify(p)} is not an id a source may have: it starts with a letter or digit and holds letters, digits and . _ -, at most 128 characters`,{plugin:e,hook:"claim",remedy:t.asId===void 0?"give the source an id with --as <id>":"give another id with --as <id>"});let g,L;if(!a&&t.supplied!==void 0){r||c("PLUGIN_REMOTE_UNAVAILABLE",`${o} is not a file on this machine, and plugin ${e} has no connection to fetch it through`,{plugin:e,remedy:"save the source to a file and ingest the file"}),g=Buffer.from(t.supplied.bytes),g.byteLength>m.contentBytes&&c("PLUGIN_CONTENT_TOO_LARGE",`${o} is ${g.byteLength} bytes; a plugin's source may be at most ${m.contentBytes}`,{plugin:e,hook:"fetch"});let i=t.supplied.cursor??null;L={ref:d,...i!==null?{cursor:i}:{}}}else if(a)g=t.supplied!==void 0?Buffer.from(t.supplied.bytes):H(o),g.byteLength>m.contentBytes&&c("PLUGIN_CONTENT_TOO_LARGE",`${o} is ${g.byteLength} bytes; a plugin's source may be at most ${m.contentBytes}`,{plugin:e});else{let i=r?t.connect?.(e):void 0;i===void 0&&c("PLUGIN_REMOTE_UNAVAILABLE",`${o} is not a file on this machine, and plugin ${e} has no connection to fetch it through`,{plugin:e,remedy:"save the source to a file and ingest the file"});let u=t.cursor!==void 0?t.cursor:j(t.store,p,e,d),f=await D(n,i,{ref:o,sourceId:p,cursor:u},s);if(f.kind==="unchanged")return K(t.store,p,e);g=f.bytes,L={ref:d,...f.cursor!==null?{cursor:f.cursor}:{}},t.onFetched?.({bytes:new Uint8Array(g),cursor:f.cursor})}let _={sourceId:p,bytes:new Uint8Array(g)},G=async()=>{let u=(await y(n,"render",s,()=>n.render(_)))?.text;(typeof u!="string"||u===""||u.includes("\0"))&&c("PLUGIN_TEXT_INVALID",`plugin ${e} rendered ${p} to something that is not text: ${typeof u!="string"?"no text":u===""?"empty text":"text holding a NUL"}`,{plugin:e,hook:"render"});let f=await y(n,"index",s,()=>n.index(_,{text:u}));return{projection:u,inventory:[],blobs:new Map,delivered:[],converter:{name:e,version:n.manifest.version,policy:`rules-${n.manifest.rules}`},units:f}},P=x(n);return E({store:t.store,bytes:g,media:k,sourceId:p,label:o,plugin:{id:e,rules:n.manifest.rules,...L!==void 0?{fetch:L}:{},...P.includes("cites-deep")?{citesDeep:!0}:{}},converters:{plugin:G},...P.includes("explain")&&typeof n.explain=="function"?{explain:(i,u)=>y(n,"explain",Math.min(u,s),()=>n.explain(i))}:{},...t.explainMs!==void 0?{explainMs:t.explainMs}:{},...P.includes("context")&&typeof n.context=="function"?{context:(i,u)=>y(n,"context",Math.min(u,s),()=>n.context({..._,text:i.text,units:i.units}))}:{},...P.includes("coverage")&&typeof n.coverage=="function"?{coverage:(i,u)=>y(n,"coverage",Math.min(u,s),()=>n.coverage({sourceId:_.sourceId,units:i.units}))}:{},...t.confirmSameSource?{confirmSameSource:t.confirmSameSource}:{},...t.eventIds?{eventIds:t.eventIds}:{},...t.provenance?{provenance:t.provenance}:{}})}async function D(t,n,o,l){let e=t.manifest.id,s;try{s=await y(t,"fetch",l,()=>t.fetch({...o,connection:n}))}catch(h){throw n.breach?n.breach:h}finally{n.close()}if(n.breach)throw n.breach;let a=s?.kind;if(a==="unchanged")return{kind:"unchanged"};let r=s;(a!=="content"||!(r.bytes instanceof Uint8Array))&&c("PLUGIN_HOOK_FAILED",`plugin ${e} answered fetch with something that is not an answer: neither the content, with its bytes, nor "unchanged"`,{plugin:e,hook:"fetch"});let d=Buffer.from(r.bytes);d.byteLength>m.contentBytes&&c("PLUGIN_CONTENT_TOO_LARGE",`plugin ${e} fetched ${d.byteLength} bytes for ${o.ref}; a plugin's source may be at most ${m.contentBytes}`,{plugin:e,hook:"fetch"}),r.cursor!==void 0&&typeof r.cursor!="string"&&c("PLUGIN_HOOK_FAILED",`plugin ${e} answered fetch with a cursor that is not a string`,{plugin:e,hook:"fetch"});let I=r.cursor===void 0?null:r.cursor;return I!==null&&Buffer.byteLength(I,"utf8")>m.cursorBytes&&c("PLUGIN_CURSOR_TOO_LARGE",`plugin ${e} answered fetch with a cursor of ${Buffer.byteLength(I,"utf8")} bytes; a cursor may be at most ${m.cursorBytes}`,{plugin:e,hook:"fetch",remedy:"the plugin must be fixed: every later fetch of this source starts from the same cursor and is refused the same way"}),{kind:"content",bytes:d,cursor:I}}function K(t,n,o){let l=S(t),e=l.heads.get(n);typeof e!="string"&&c("PLUGIN_HOOK_FAILED",`plugin ${o} answered fetch with "unchanged" for ${n}, which this store holds no current version of`,{plugin:o,hook:"fetch"});let s=l.mediaOf(e),a=v(n,s.format==="plugin"?s.plugin?.id??"":null,o,!1);if(a!==void 0)throw new Error(a);let r=l.getNode(e)?.content.blob;return{status:"unchanged",source_id:n,cid:e,blob:typeof r=="string"?r:""}}function j(t,n,o,l){let e=S(t),s=e.heads.get(n);if(typeof s!="string")return null;let a=e.mediaOf(s).plugin;return a?.id!==o||a.fetch?.ref!==l?null:a.fetch.cursor??null}export{B as a,C as b,y as c,ee as d};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{i as d}from"./chunk-XMPTFXPW.js";import{b as a}from"./chunk-C6HI6Y3S.js";import{Ha as o}from"./chunk-W3OVSDBN.js";async function p(e,l,s){let n=l.project,i=l.local===!0;if(n===void 0&&!i)return{kind:"none"};if(n!==void 0&&i)return r(o.folderFlagsBoth());if(l.resume!==void 0)return r(o.folderFlagWithResume(n!==void 0?"--project":"--local"));if(e.kind==="refuse")return r(e.refusal);if(e.kind==="local")return i?{kind:"none"}:r(o.folderWorksLocally());if(e.kind==="remote")return i?r(o.folderLinkedNotLocal(e.projectName)):n===e.projectId?{kind:"none"}:r(o.folderLinkedElsewhere(e.projectName));if(i)return{kind:"local"};let c;try{c=await s.getProject(n)}catch(t){if(t instanceof d)return r({code:t.code,message:t.message,...t.remedy?{remedy:t.remedy}:{}});if(t instanceof a)return r(o.noConnection());throw t}return c===null?r(o.projectIdUnknown(n,l.agent===!0)):{kind:"link",projectId:c.id,projectName:c.name}}var r=e=>({kind:"refuse",refusal:e}),g=e=>({...e.project!==void 0?{project:e.project}:{},...e.local===!0?{local:!0}:{}});export{p as a,g as b};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{e as i}from"./chunk-NWBLYMH7.js";import{a as s,b as c,c as n}from"./chunk-ZCRZFAOT.js";import{appendFileSync as m,mkdirSync as u,readFileSync as g,writeFileSync as f}from"fs";import o from"path";var l=!1,p,x=({verb:r,contextInstanceId:e,sessionId:t})=>l&&e===null?n(p??r,t):c(e,r,t);function P(r){l=!0,p=r}function h(r,e){return{path:r,line:(t,d={})=>{if(r!==null)try{u(o.dirname(r),{recursive:!0}),m(r,JSON.stringify({ts:new Date().toISOString(),level:"info",user_session_id:e,source:"kane-cli",kind:t,data:d})+`
|
|
3
|
+
`)}catch{}}}}function k(r,e){return h(i()?n(r,e):null,e)}var a=r=>o.join(s(),"shared","logs","sessions",`${r}.trace`);function R(r,e){try{u(o.dirname(a(r)),{recursive:!0}),f(a(r),e)}catch{}}function O(r){if(!i())return null;try{return g(a(r),"utf8").trim()||null}catch{return null}}export{x as a,P as b,h as c,k as d,R as e,O as f};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{g as A,h as _}from"./chunk-
|
|
3
|
-
Provide one: ${e}`}function
|
|
4
|
-
`):[`session target is "${i}" but no app is set.`,` Set one: kane-cli config set-app ${
|
|
5
|
-
`)}function
|
|
6
|
-
`)}function
|
|
7
|
-
`)}var J="kane-cli config set-target emulator|simulator",
|
|
8
|
-
`);export{E as a,
|
|
2
|
+
import{g as A,h as _}from"./chunk-7RPKHKA3.js";import{b as N}from"./chunk-SA6IKFFD.js";import{d as b,i as h}from"./chunk-Z7S3IWUX.js";import{a as F,c as x,e as k}from"./chunk-2XW33VOK.js";import{a as $,b as T,c as D,d as I,f as v,h as g,i as V,l as m,q as P,t as y,u as w}from"./chunk-A7RJQJNT.js";function E(e,n){return e.kind==="app_id"?!0:n==="emulator"?e.kind==="apk":e.kind==="zip"}function S(e){let n=e.deviceName,i=e.osVersion;return n!==void 0&&n.trim()===""||i!==void 0&&i.trim()===""?{ok:!1,message:"--device-name and --os-version cannot be empty."}:{ok:!0,...n!==void 0?{name:n.trim()}:{},...i!==void 0?{osVersion:i.trim()}:{}}}function C(e){return`--device-name needs an OS version \u2014 a bare name matches every runtime that ships it.
|
|
3
|
+
Provide one: ${e}`}function R(e,n,i){let t=_(e);return t?E(t,n)?null:n==="emulator"?`${i} cannot run on an emulator (needs an .apk, or an APP\u2026 id).`:`${i} cannot run on a simulator (needs a .zip of the .app bundle, or an APP\u2026 id).`:`${e}: ${A}`}function M(e){return D(e)?e:null}function O(e){return`--target must be one of ${$.join(", ")} (got "${e}")`}function L(e){let n=[];for(let[i,t]of[["--device-name",e.deviceName],["--os-version",e.osVersion],["--app",e.app]])t!==void 0&&n.push(`ignored ${i} ${t}: session target is desktop \u2014 set --target ${T.join("|")} to run on a device`);return n}function W(e){let{flags:n,saved:i}=e,t=[],a;if(n.target!==void 0){let r=M(n.target);if(!r)return{kind:"invalid",message:O(n.target)};a=r}else{let r=F(i?.tui_target,i?.default_target?.kind);if(r.kind==="choose-mobile")return{kind:"choose-mobile-kind"};a=r.kind==="unset"?"desktop":r.kind}if(a==="desktop")return t.push(...L(n)),{kind:"web",warnings:t};if(v(a))return B(a,n,i,t);if(!e.host.supported)return{kind:"invalid",message:e.host.reason??"this machine cannot run mobile targets."};let s=[],o,d,c=S(n);if(!c.ok)return{kind:"invalid",message:c.message};let p=i?.default_target&&i.default_target.kind===a?b(i.default_target):void 0;if(c.name!==void 0||c.osVersion!==void 0){let r=c.name??p?.name,l=c.osVersion??p?.osVersion;if(l===void 0)return{kind:"invalid",message:C("--os-version <version>, or save one (kane-cli config set-os-version)")};d={...r!==void 0?{name:r}:{},osVersion:l},o={value:r?`${r} (${l})`:`any device on ${l}`,source:"flag"}}else if(i?.default_target&&i.default_target.kind===a&&(b(i.default_target)!==void 0||i.default_target.id!==void 0))o={value:h(i.default_target)??"(saved device)",source:"saved"};else{if(i?.default_target&&i.default_target.kind!==a&&(b(i.default_target)!==void 0||i.default_target.id!==void 0))return{kind:"invalid",message:`Your saved device '${h(i.default_target)}' is ${i.default_target.kind==="simulator"?"a simulator":"an emulator"}, but this run targets ${a==="simulator"?"a simulator":"an emulator"}. Pass --device-name and --os-version, or update your config (set-target, set-device-name, set-os-version).`};s.push("device")}let u;if(n.app!==void 0){let r=R(n.app,a,`--app ${n.app}`);if(r)return{kind:"invalid",message:r};u={value:n.app,source:"flag"}}else{let r=i?.default_app,l=r?_(r):null;l&&E(l,a)&&i?.default_target?.kind===a?u={value:r,source:"saved"}:s.push("app")}return{kind:"mobile",target:a,...d?{deviceSelector:d}:{},...o?{device:o}:{},...u?{app:u}:{},missing:s,warnings:t}}function K(e,n,i){let t=e.trim();return N(t)||y(n,t)?null:`${i} cannot run on ${m(n)} \u2014 use ${w(n)} file, or an ${V(g(n))} app ID from \`kane-cli apps list --target ${n}\`.`}function j(e,n,i){let t=S(e);if(!t.ok)return{ok:!1,message:t.message};let a=(u,r)=>{if(u!==void 0)return{value:u,source:"flag"};let l=r?.trim();return l?{value:l,source:n.source}:void 0},s=a(t.name,n.device_name),o=a(t.osVersion,n.os_version),d=a(e.app,n.app),c=d?.source==="flag"?`--app ${d.value}`:d?.source==="file"?`the file's app: ${d?.value}`:`your saved app ${d?.value}`,p=d?K(d.value,i,c):null;return{ok:!0,...s?{deviceName:s}:{},...o?{osVersion:o}:{},...d?{app:d}:{},...p?{appProblem:p}:{}}}function Z(e,n,i){return v(e)?K(n,e,i):R(n,e,i)}function G(e,n,i){let t=j(e,n.target===i?{source:"file",device_name:n.device_name,os_version:n.os_version,app:n.app}:{source:"file"},i);if(!t.ok)return t;if(!t.app)return{ok:!1,message:`no app for this real-device test \u2014 add \`app: <path-to-build | AppId>\` to the file, or pass --app. See your uploads: kane-cli apps list --target ${i}`};if(t.appProblem)return{ok:!1,message:t.appProblem};let{deviceName:a,osVersion:s,app:o}=t;return{ok:!0,selection:{...a?{deviceName:a}:{},...s?{osVersion:s}:{},app:o}}}function B(e,n,i,t){let a=x(i,e),s=j(n,{source:"saved",device_name:a.deviceName,os_version:a.osVersion,app:a.app},e);if(!s.ok)return{kind:"invalid",message:s.message};if(s.appProblem&&s.app?.source==="flag")return{kind:"invalid",message:s.appProblem};let o=s.appProblem?void 0:s.app;return{kind:"real-device",target:e,platform:g(e),...s.deviceName?{deviceName:s.deviceName}:{},...s.osVersion?{osVersion:s.osVersion}:{},...o?{app:o}:{},missing:o?[]:["app"],warnings:s.appProblem?[...t,s.appProblem]:t}}function z(e){let n=[];for(let[i,t]of[["--device-name",e.deviceName],["--os-version",e.osVersion],["--app",e.app]])t!==void 0&&n.push(`ignored ${i} ${t}: a real-device run takes its device and app from the run's device config`);return n}function H(e){return`this run was given a device config (KANE_CLI_DEVICE_CONFIG), so it runs on a real device, but the test file ${e?`has \`target: ${e}\``:"has no `target:` (a web test)"} \u2014 only a \`target: android\` or \`target: ios\` test runs on a real device.`}function ee(e){let{flags:n,file:i}=e,t=[],a=I(i.target)?i.target:void 0,s;if(n.target!==void 0){let r=M(n.target);if(!r)return{kind:"invalid",message:O(n.target)};s=r;let l=a;l&&l!==s&&t.push(`--target ${s} overrides the file's \`target: ${l}\` \u2014 steps recorded on ${m(l)} may not replay here`)}else s=a??"desktop";if(v(s)){if(e.deviceConfig)return t.push(...z(n)),{kind:"real-device",platform:g(s),warnings:t};let r=G(n,i,s);return r.ok?{kind:"real-device",platform:g(s),selection:r.selection,warnings:t}:{kind:"invalid",message:r.message}}if(s!=="desktop"&&e.grid)return{kind:"invalid",message:`KANE_CLI_GRID is set, which works only for real-device tests (\`target: android\` / \`target: ios\`), and this test targets ${m(s)}. Unset KANE_CLI_GRID and try again.`};if(e.deviceConfig)return{kind:"invalid",message:H(i.target)};if(s==="desktop")return t.push(...L(n)),{kind:"web",warnings:t};let o=S(n);if(!o.ok)return{kind:"invalid",message:o.message};let d=o.name??(i.device_name?.trim()||void 0),c=o.osVersion??(i.os_version?.trim()||void 0);if(d!==void 0&&c===void 0)return{kind:"invalid",message:C("--os-version <version>, or os_version: in the test file")};let p=c!==void 0?{...d!==void 0?{name:d}:{},osVersion:c}:void 0;if(s==="simulator"&&p&&p.name===void 0&&t.push(`the file names no device_name \u2014 any simulator on ${c} may be used. Add device_name: to the file (or pass --device-name) to pin the device.`),n.app!==void 0){let r=R(n.app,s,`--app ${n.app}`);if(r)return{kind:"invalid",message:r}}else if(i.app){let r=R(i.app,s,`the file's app: ${i.app}`);if(r)return{kind:"invalid",message:r}}let u=n.app??(i.app||void 0);return{kind:"mobile",target:s,platform:g(s)??"",...u?{app:u}:{},...p?{deviceSelector:p}:{},...i.no_reset!==void 0?{noReset:i.no_reset}:{},warnings:t}}function ne(e){return e.target==="desktop"?"Running on: Desktop \xB7 Chrome":`Running on: ${k(e.target)} \xB7 ${e.deviceLabel} \xB7 ${e.appLabel}`}function f(e){return`</path/to/app${P(e)[0]} | AppId>`}function ie(e){return{type:"error",code:"APP_NOT_SET",message:`no app is set for this ${k(e).toLowerCase()} run`,remedy:`name the app under test with --app ${f(e)}, or for every run with kane-cli config set-app ${f(e)}`,next:[{cmd:`kane-cli apps list --target ${e} --agent`,why:"lists the builds you've uploaded, to name one with --app"}]}}function te(e,n){let i=k(e).toLowerCase();return n==="device"?[`session target is "${i}" but no device is set.`,` See devices: kane-cli devices list --target ${e}`,' Set one: kane-cli config set-device-name "<name>" && kane-cli config set-os-version "<version>"',' Or per-run: --device-name "<name>" --os-version "<version>"'].join(`
|
|
4
|
+
`):[`session target is "${i}" but no app is set.`,` Set one: kane-cli config set-app ${f(e)}`,` Or per-run: --app ${f(e)}`].join(`
|
|
5
|
+
`)}function se(e){return[`saved device "${e}" was not found on this machine.`," See devices: kane-cli devices list",' Set one: kane-cli config set-device-name "<name>" && kane-cli config set-os-version "<version>"'].join(`
|
|
6
|
+
`)}function re(e,n){return[`saved app ${e} no longer exists on disk.`," The build may have been moved or cleaned. Set a new one:",` kane-cli config set-app ${f(n)}`].join(`
|
|
7
|
+
`)}var J="kane-cli config set-target emulator|simulator",ae=['session target is "mobile" from an older version \u2014 say which kind:',` ${J}`].join(`
|
|
8
|
+
`);export{E as a,S as b,C as c,W as d,Z as e,ee as f,ne as g,ie as h,te as i,se as j,re as k,J as l,ae as m};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{b as f}from"./chunk-AUJSC7PU.js";import{c as d}from"./chunk-I2MC6VVX.js";import{g}from"./chunk-4I7YN6YY.js";import{existsSync as a}from"fs";import{resolve as i}from"path";function E(){let n=g().packageRoot;return n===null?[]:[n]}function A(n){return{"darwin-arm64":"kane-cli-darwin-arm64","darwin-x64":"kane-cli-darwin-x64","linux-x64":"kane-cli-linux-x64","linux-arm64":"kane-cli-linux-arm64","win32-x64":"kane-cli-win-x64"}[n]??null}function S(n){return{"darwin-arm64":"kane-cli-assurance-darwin-arm64","darwin-x64":"kane-cli-assurance-darwin-x64","linux-x64":"kane-cli-assurance-linux-x64","linux-arm64":"kane-cli-assurance-linux-arm64","win32-x64":"kane-cli-assurance-win-x64"}[n]??null}function v(n=E()){let e=A(`${process.platform}-${process.arch}`),c=S(`${process.platform}-${process.arch}`),t=process.platform==="win32"?"assurance-agent.exe":"assurance-agent";for(let r of n){for(let s of c?["@testmuai","@lambdatestincprivate"]:[]){let o=i(r,"node_modules",s,c,"bin",t);if(a(o))return{cmd:o,args:[],tier:"platform"}}for(let s of e?["@testmuai","@lambdatestincprivate"]:[]){let o=i(r,"node_modules",s,e,"bin",t);if(a(o))return{cmd:o,args:[],tier:"platform"}}let m=i(r,"dist","bin",t);if(a(m))return{cmd:m,args:[],tier:"embedded"};let u=i(r,"../assurance-agent/dist",t);if(a(u))return{cmd:u,args:[],tier:"sibling"};let l=i(r,"../assurance-agent/main.py");if(a(l)){let s=i(r,"../assurance-agent/.venv/bin/python");return{cmd:a(s)?s:"python3",args:[l],tier:"dev-python"}}}return null}var _=12e4+d;function P(n,e={}){return{...process.env,...e,...f(),TESTMUAI_SOURCE:"kane-cli",TESTMUAI_SESSION_ID:n,ASSURANCE_LOG_LEVEL:process.env.ASSURANCE_LOG_LEVEL??"info",PYTHONIOENCODING:"utf-8",PYTHONUTF8:"1",ASSURANCE_CHECKPOINT_SAVE_DEADLINE_S:String(_/1e3)}}async function C(n,e=process.env){if(e.TESTMUAI_API_KEY||e.TESTMUAI_BASIC_AUTH)return{};try{let t={TESTMUAI_ENV:e.TESTMUAI_ENV==="stage"?"stage":"prod"},r=await n.controller();return r.basic?(t.TESTMUAI_BASIC_AUTH=Buffer.from(`${r.basic.username}:${r.basic.accessKey}`,"utf8").toString("base64"),t):r.token?(t.TESTMUAI_API_KEY=r.token,t):{}}catch{return{}}}export{A as a,S as b,v as c,_ as d,P as e,C as f};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as f}from"./chunk-4QTH7VYE.js";import{a as w}from"./chunk-RZ4F3BHX.js";var g=class extends Error{constructor(n,e,r,s=null){super(r);this.status=n;this.code=e;this.body=s;this.name="ExplorationApiError"}},b=new Set([400,409,422]),R=new Set([408,425,429]),h=new Set(["RUN_NOT_ACTIVE","RUN_ENDED","NOT_FOUND"]),y=class{base;authHeader;timeoutMs;constructor(t){this.base=t.baseUrl.replace(/\/+$/,"")+"/exploration",this.authHeader=f(t.auth.username,t.auth.access_key),this.timeoutMs=t.timeoutMs??3e4}async createExploration(t){let n=await this.call("",t),e=typeof n.id=="string"?n.id:typeof n.exploration_id=="string"?n.exploration_id:null;if(!e)throw new g(0,"BAD_RESPONSE","create exploration: response carries no id");return{id:e,body:n}}async startRun(t,n){let e=await this.call(`/${a(t)}/runs`,n);return k(t,e)}async endRun(t,n,e){return this.call(`/${a(t)}/runs/${a(n)}/end`,e)}async listExplorations(t={}){let n=await this.getJson("",{state:t.state??"running",project:t.project,limit:t.limit,cursor:t.cursor});return{explorations:Array.isArray(n.explorations)?n.explorations:[],next_cursor:u(n.next_cursor)??null}}async listSessions(t,n={}){let e=await this.getJson(`/${a(t)}/sessions`,{limit:n.limit,cursor:n.cursor});return{sessions:Array.isArray(e.sessions)?e.sessions:[],next_cursor:u(e.next_cursor)??null}}async getSession(t,n){return await this.getJson(`/${a(t)}/sessions/${a(n)}`)}async remoteRun(t){return await this.call("/remote/run",t)}async runRequest(t,n){return this.getJson(`/${a(t)}/runs/${a(n)}/request`)}async stopExploration(t,n=!0){let e=`/${a(t)}/stop`,r=await this.post(e,{wait:n}),{json:s,text:i}=await m(r);if(!r.ok){let l=typeof s?.code=="string"?s.code:`HTTP_${r.status}`;throw new g(r.status,l,`POST /exploration${e} failed: ${_(s,i,r.status)}`,s)}return{status:r.status,body:s??{}}}async deleteExploration(t){let n=await this.send("DELETE",`/${a(t)}`),{json:e,text:r}=await m(n);if(!n.ok){let s=typeof e?.code=="string"?e.code:`HTTP_${n.status}`;throw new g(n.status,s,`DELETE /exploration/${t} failed: ${_(e,r,n.status)}`,e)}return{exploration_id:u(e?.exploration_id)??t,deleted_at:u(e?.deleted_at)??""}}async getContext(t){return this.getJson(`/${a(t)}/context`)}async setContext(t,n){return await this.jsonRequest("PUT",`/${a(t)}/context`,{enabled:n})}async syncContext(t){return await this.jsonRequest("POST",`/${a(t)}/context/sync`,{})}async queryMap(t){return this.getJson(`/${a(t)}/query/map`)}async viewSummary(t){try{return await this.getJson(`/${a(t)}/view/summary`)}catch{return null}}async wireVersion(){try{return u((await this.getJson("/wire")).wire_version)}catch(t){if(t instanceof g&&t.status===404)return;throw t}}async getJson(t,n={}){let e=new URLSearchParams;for(let[c,d]of Object.entries(n))d!==void 0&&d!==""&&e.set(c,String(d));let r=e.toString(),s=r?`${t}?${r}`:t,i=await this.send("GET",s),{json:l,text:p}=await m(i);if(!i.ok){let c=typeof l?.code=="string"?l.code:`HTTP_${i.status}`;throw new g(i.status,c,`GET /exploration${t} failed: ${_(l,p,i.status)}`,l)}return l??{}}async send(t,n){let e=new AbortController,r=setTimeout(()=>e.abort(),this.timeoutMs);try{return await w(`${this.base}${n}`,{method:t,headers:{Authorization:this.authHeader,Accept:"application/json"},signal:e.signal})}catch(s){throw s instanceof Error&&s.name==="AbortError"?new Error(`${t} /exploration${n} timed out after ${this.timeoutMs}ms`):s}finally{clearTimeout(r)}}async commitDelta(t,n,e){let r=e.seq,s;try{s=await this.post(`/${a(t)}/runs/${a(n)}/deltas`,e)}catch(d){return{kind:"transient",seq:r,reason:d instanceof Error?d.message:String(d)}}let{json:i,text:l}=await m(s);if(s.ok)return{kind:"committed",seq:r,body:i};let p=typeof i?.code=="string"?i.code:`HTTP_${s.status}`,c=_(i,l,s.status);return s.status>=500||R.has(s.status)?{kind:"transient",seq:r,reason:c}:b.has(s.status)&&!h.has(p)?{kind:"refused",seq:r,status:s.status,code:p,reason:c}:{kind:"fatal",seq:r,status:s.status,code:p,reason:c}}async call(t,n){let e=await this.post(t,n),{json:r,text:s}=await m(e);if(!e.ok){let i=typeof r?.code=="string"?r.code:`HTTP_${e.status}`;throw new g(e.status,i,`POST /exploration${t} failed: ${_(r,s,e.status)}`,r)}return r??{}}async jsonRequest(t,n,e){let r=await this.post(n,e,t),{json:s,text:i}=await m(r);if(!r.ok){let l=typeof s?.code=="string"?s.code:`HTTP_${r.status}`;throw new g(r.status,l,`${t} /exploration${n} failed: ${_(s,i,r.status)}`,s)}return s??{}}async post(t,n,e="POST"){let r=new AbortController,s=setTimeout(()=>r.abort(),this.timeoutMs);try{return await w(`${this.base}${t}`,{method:e,headers:{Authorization:this.authHeader,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(n),signal:r.signal})}catch(i){throw i instanceof Error&&i.name==="AbortError"?new Error(`${e} /exploration${t} timed out after ${this.timeoutMs}ms`):i}finally{clearTimeout(s)}}};function k(o,t){let n=t.run&&typeof t.run=="object"?t.run:{},e=u(t.run_id)??u(n.run_id)??u(n.id);if(!e)throw new g(0,"BAD_RESPONSE","start run: response carries no run_id");let r=t.projection&&typeof t.projection=="object"?t.projection:{},s={...r,exploration_id:u(r.exploration_id)??o},i=x(s.last_seq)??x(n.high_water_mark)??x(t.high_water_mark)??0;s.last_seq=i;let l=x(t.next_seq)??i+1,p=x(t.version),c=u(t.wire_version),d=u(t.live_token);return{run_id:e,projection:s,next_seq:l,...p!==void 0?{version:p}:{},...c?{wire_version:c}:{},...d?{live_token:d}:{}}}function a(o){return encodeURIComponent(o)}function u(o){return typeof o=="string"&&o?o:void 0}function x(o){return typeof o=="number"&&Number.isFinite(o)?o:void 0}async function m(o){let t="";try{t=await o.text()}catch{}try{let n=t?JSON.parse(t):null;return{json:n&&typeof n=="object"?n:null,text:t}}catch{return{json:null,text:t}}}function _(o,t,n){if(!o)return`${n} ${t.slice(0,500)}`.trim();let e=[],r=u(o.error)??u(o.message);return e.push(r?`${u(o.code)??n}: ${r}`:`${u(o.code)??n}`),(o.expected!==void 0||o.received!==void 0)&&e.push(`expected seq ${String(o.expected)}, received ${String(o.received)}`),Array.isArray(o.problems)&&o.problems.length&&e.push(`problems: ${o.problems.map(String).join("; ")}`),e.join(" \u2014 ")}export{g as a,y as b};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{appendFileSync as r,mkdirSync as t}from"fs";import{homedir as c}from"os";import{dirname as s,join as a}from"path";function u(i,e){let n=/^(DOCX_[A-Z_]+):/.exec(e)?.[1];n&&o(`${n} ${i}`)}function d(i,e){o(`review ${i} ${e}`)}function o(i){try{let e=process.env.KANE_CONTEXT_REFUSAL_LOG??a(c(),".testmuai","kaneai","context-refusals.log");t(s(e),{recursive:!0}),r(e,`${new Date().toISOString()} ${i}
|
|
3
|
+
`)}catch{}}export{u as a,d as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
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:["app","check","config","definitionId","derived","objectives_blob","surface_required","target","test_md_blob","title"],required:["definitionId","derived","title"],enums:{}},gap:{hashed:["basis","derived","kind","question","ref","risk","risk_rationale","text","uc"],unhashed:["proposal_id","temp_ref"],required:["derived","kind"],enums:{kind:["ambiguous","incomplete","contradictory","unmeasurable","missing-expected-result","budget-evicted","invariant-unexercised","reconcile_deferred"],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","reconfirms"],props:["anchor","claim","quote","reconfirms","source_cid","source_id","units"],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}},g=["presence","forbidden-presence","count","delta","state-transition","absolute","bound","propagation","latency","graded"];var E={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"]}};function y(s){let n=/^design@(\d+)$/.exec(s??"");return n?Number(n[1]):0}var h=new Set(["unmeasurable","budget-evicted"]),m=Object.freeze({SOURCE:"source",USECASE:"usecase",SCENARIO:"scenario",AC:"ac",TEST:"test",GAP:"gap",STYLENOTE:"stylenote"}),S=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(s,n,t){let r=[],e=E[s];if(!e)return r.push({code:"BAD_CHECK",detail:`${t}.kind ${JSON.stringify(s)} not in ${g.join("|")}`}),r;let o=n.operator;o!==void 0&&!e.operators.includes(o)&&r.push({code:"BAD_CHECK",detail:`${t}: operator ${JSON.stringify(o)} illegal for kind "${String(s)}" (legal: ${e.operators.join("|")})`});for(let a of e.requires)(n[a]===void 0||n[a]===null||n[a]==="")&&r.push({code:"BAD_CHECK",detail:`${t}: kind "${String(s)}" requires "${a}"`});e.baseline==="null"&&n.baseline!==void 0&&n.baseline!==null&&r.push({code:"BAD_CHECK",detail:`${t}: kind "${String(s)}" must carry baseline null (only delta/state-transition have one)`});let i=n.operand;if(i!==null&&typeof i=="object"&&!Array.isArray(i)){let a=Object.keys(i),d=i.derived;(!(e.operand_forms?.includes("derived")??!1)||a.length!==1||a[0]!=="derived"||typeof d!="string"||!d.trim())&&r.push({code:"BAD_CHECK",detail:`${t}: object operand is only the count derivation form {derived: "<how the runtime value is computed>"}`})}return r}function k(s,n){let t=u[s];if(!t)return[{code:"UNKNOWN_LABEL",detail:`unknown node label ${JSON.stringify(s)}`}];let r=[];for(let e of Object.keys(n))n[e]!==void 0&&!t.hashed.includes(e)&&!(t.unhashed??[]).includes(e)&&r.push({code:"UNKNOWN_FIELD",detail:`${s}.${e} is not in the ${l} schema`});for(let e of t.required)(n[e]===void 0||n[e]===null)&&r.push({code:"MISSING_FIELD",detail:`${s}.${e} is required`});for(let[e,o]of Object.entries(t.enums)){let i=n[e];i!==void 0&&!o.includes(i)&&r.push({code:"BAD_ENUM",detail:`${s}.${e} ${JSON.stringify(i)} not in ${o.join("|")}`})}if(s==="test"&&n.check&&typeof n.check=="object"){let e=n.check;r.push(...c(e.kind,e,"test.check"))}if(s==="ac"&&n.expected_answer&&typeof n.expected_answer=="object"){let e=n.expected_answer;r.push(...c(n.kind??e.kind,e,"ac.expected_answer"))}return r}function p(s){return f[s]}function N(s,n,t,r){let e=p(s);if(!e)return[{code:"UNKNOWN_EDGE_TYPE",detail:`unknown edge type ${JSON.stringify(s)}`}];let o=[];e.src.includes(n)||o.push({code:"ILLEGAL_EDGE",detail:`${s} src must be ${e.src.join("|")}, got ${n}`}),e.dst.includes(t)||o.push({code:"ILLEGAL_EDGE",detail:`${s} dst must be ${e.dst.join("|")}, got ${t}`}),s==="depends_on"&&n!==t&&o.push({code:"ILLEGAL_EDGE",detail:`depends_on links same-label nodes only, got ${n}\u2192${t}`});for(let i of e.salient)(r[i]===void 0||r[i]===null)&&o.push({code:"MISSING_SALIENT",detail:`${s}.props.${i} is salient (inside the ecid) and required`});for(let i of Object.keys(r))r[i]!==void 0&&(e.props.includes(i)||o.push({code:"UNKNOWN_EDGE_PROP",detail:`${s}.props.${i} is not in the ${l} schema`}));return o}function b(s,n){let t=u[s];if(!t)return n;let r={};for(let e of t.hashed)n[e]!==void 0&&(r[e]=n[e]);return r}function O(s,n){let t=p(s);if(!t)return n;let r={};for(let e of t.salient)n[e]!==void 0&&(r[e]=n[e]);for(let e of t.optionalSalient??[])n[e]!==void 0&&!(Array.isArray(n[e])&&n[e].length===0)&&(r[e]=n[e]);return r}export{l as a,u as b,f as c,y as d,h as e,m as f,S as g,k as h,p as i,N as j,b as k,O as l};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as p}from"./chunk-73Y6T2UK.js";import{Ha as l}from"./chunk-W3OVSDBN.js";import{c as u}from"./chunk-MGNRNLBE.js";import{existsSync as d,mkdirSync as m,readFileSync as j,rmSync as g,writeFileSync as y,statSync as I}from"fs";import{dirname as f,join as n}from"path";var o=n(".testmuai","assurance.json");function N(e,r=u()){let t={kind:"local",dir:p(e)},s=r.trim().replace(/\/+$/,"");if(!s)return t;let a=d(n(e,o));if(d(t.dir))return a?{kind:"refuse",code:"BOTH_STORES",refusal:l.bothStores(i(n(e,o))?.projectName??null)}:t;if(!a)return{kind:"pick",latticeUrl:s};let c=i(n(e,o));return c===null?{kind:"refuse",code:"PROJECT_FILE_UNREADABLE",refusal:l.linkUnreadable()}:{kind:"remote",latticeUrl:s,projectId:c.projectId,projectName:c.projectName}}function P(e){return i(n(e,o))?.lastUserId??null}function R(e,r){let t=i(n(e,o));t!==null&&t.lastUserId!==r&&S(e,{...t,lastUserId:r})}function i(e){try{let r=JSON.parse(j(e,"utf8"));return typeof r!="object"||r===null||Array.isArray(r)||typeof r.projectId!="string"||r.projectId===""||typeof r.projectName!="string"?null:{projectId:r.projectId,projectName:r.projectName,writtenBy:typeof r.writtenBy=="string"?r.writtenBy:"",...typeof r.lastUserId=="string"?{lastUserId:r.lastUserId}:{}}}catch{return null}}function O(e){try{return!I(n(e,f(o))).isDirectory()}catch{return!1}}function S(e,r){let t=n(e,o);m(f(t),{recursive:!0}),y(t,JSON.stringify(r,null,2)+`
|
|
3
|
+
`)}function A(e){g(n(e,o),{force:!0})}export{o as a,N as b,P as c,R as d,i as e,O as f,S as g,A as h};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{c as l}from"./chunk-HAW5WEKT.js";import{M as f,sb as m}from"./chunk-UEE3RZN4.js";import{f as a,g as u}from"./chunk-KU3YHPWZ.js";function O(e){let i=f(e),s=new Set;for(let{cid:t}of i.byLabel(a.USECASE)){if(i.superseded.has(t)||i.trust.get(t)==="archived")continue;let o=i.displayNameOf(t);o&&s.add(o)}return s}function g(e,i){let s=f(e),t=[];for(let{cid:o,content:r}of s.byLabel(a.USECASE)){if(s.superseded.has(o)||s.trust.get(o)==="archived")continue;let d=s.displayNameOf(o);if(!d||i.has(d))continue;let n=new Set;for(let c of s.derivesInto(o)){let p=s.getNode(c.src)?.content.source_id;typeof p=="string"&&n.add(p)}t.push({id:d,title:String(r.title??""),source_ids:[...n].sort()})}return t.sort((o,r)=>o.id.localeCompare(r.id,void 0,{numeric:!0}))}function U(e,i,s){let t=f(e),r=g(e,s).filter(n=>n.source_ids.includes(i)).map(n=>({id:n.id,state:"new",units_moved:[]})),d=new Set(r.map(n=>n.id));for(let n of l(e,i)){let c=t.displayNameOf(n);!c||d.has(c)||r.push({id:c,state:"stale",units_moved:m(t,n,i)?.changed??[]})}return r.sort((n,c)=>n.id.localeCompare(c.id,void 0,{numeric:!0}))}function b(e){let i=t=>!e.superseded.has(t)&&e.trust.get(t)!=="archived",s=new Set;for(let{cid:t}of e.byLabel(a.TEST))if(i(t))for(let o of e.edgesFrom(t)){if(o.type!==u.AUTOMATES||e.superseded.has(o.ecid))continue;let r=e.tipOf(o.dst);if(i(r))for(let d of e.edgesFrom(r))d.type!==u.BELONGS_TO||e.superseded.has(d.ecid)||s.add(e.tipOf(d.dst))}return s}export{O as a,g as b,U as c,b as d};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{b as ae}from"./chunk-I6S6DZ2E.js";import{a as X,c as oe}from"./chunk-W7FLXW6Q.js";import{a as ie,b as W,c as B,d as F,e as V,f as M,g as J,h as S}from"./chunk-R4JUKTDO.js";import{a as re}from"./chunk-HD6NR44L.js";import{M as L,R as ne,S as se,xb as P}from"./chunk-UEE3RZN4.js";import{f as k,g as q}from"./chunk-KU3YHPWZ.js";import{d as Q,m as $}from"./chunk-4I7YN6YY.js";function I(e,t){(e.err??e.out)(`error: ${t}`)}function Y(e,t){let n=e.nameOf.get(t);if(n)return n;for(let[i,r]of e.names)if(e.tipOf(r)===t)return i;return t}function fe(e,t){return{ucTip:t,display:Y(e,t),seamRef:e.nameOf.get(t)??t}}function ye(e,t){let n=e.resolve(t);if(!n)return{ok:!1,message:`unknown ref '${t}' \u2014 no test/scenario/ac/use-case by that id or cid`};let i=n.tip,r=e.nodeLabel.get(i);if(!r||!W.has(r))return{ok:!1,message:`'${t}' is a ${r??"missing node"} \u2014 evolve takes a test, scenario, acceptance criterion, or use-case`};let o=F(e,i,r);return!o||e.nodeLabel.get(o)!==k.USECASE?{ok:!1,message:`cannot resolve '${t}' to a parent use-case \u2014 its ${r} chain is broken`}:e.superseded.has(o)?{ok:!1,message:`use-case ${Y(e,o)} was removed \u2014 nothing to evolve`}:e.trust.get(o)==="archived"?{ok:!1,message:`use-case ${Y(e,o)} was archived \u2014 nothing to evolve`}:{ok:!0,target:fe(e,o)}}function We(e,t){return j(e,t)}function j(e,t){let n=[];for(let{cid:r}of e.byLabel(k.SCENARIO)){if(!B(e,r)||!e.edgesFrom(r).some(s=>s.type===q.BELONGS_TO&&e.tipOf(s.dst)===t))continue;let o=e.edgesInto(r).filter(s=>s.type===q.AUTOMATES&&B(e,s.src));if(o.length===0)n.push({scenario:r,test:null});else for(let s of o)n.push({scenario:r,test:s.src})}let i=new Map;for(let{cid:r}of e.byLabel(k.AC)){if(!B(e,r)||F(e,r,k.AC)!==t)continue;let o=e.edgesInto(r).filter(s=>s.type===q.VERIFIES&&B(e,s.src)).map(s=>s.src).sort();i.set(r,o)}return{pairs:n,verifies:i}}function be(e,t){let n=s=>`${s.scenario}\0${s.test??""}`,i=new Set(e.pairs.map(n)),r=new Set(t.pairs.map(n)),o=[];for(let[s,a]of e.verifies){let l=t.verifies.get(s);l&&(a.length===l.length&&a.every((d,_)=>d===l[_])||o.push({ac:s,before:a,after:l}))}return{superseded:e.pairs.filter(s=>!r.has(n(s))),minted:t.pairs.filter(s=>!i.has(n(s))),retained:t.pairs.filter(s=>i.has(n(s))),moves:o}}function we(e,t,n,i,r){let o=a=>t.nameOf.get(a)??a,s=a=>` - ${o(a.scenario)} \xB7 ${a.test?o(a.test):"(no test)"}`;e.out(`evolved: use-case ${n} \u2014 design record ${i.before} \u2192 ${i.after}`),e.out(` superseded ${r.superseded.length} pair(s)`);for(let a of r.superseded)e.out(s(a));e.out(` minted ${r.minted.length} pair(s)`);for(let a of r.minted)e.out(s(a));e.out(` retained ${r.retained.length} pair(s)`);for(let a of r.retained)e.out(s(a));if(r.moves.length===0)e.out(" verifies none moved");else{e.out(" verifies moved:");for(let a of r.moves){let l=d=>d.length>0?d.map(o).join(" + "):"(none)";e.out(` - ${o(a.ac)}: ${l(a.before)} \u2192 ${l(a.after)}`)}}}async function ge(e,t,n,i,r,o,s,a){let l=L(e),d=S(l,t.ucTip);if(!d)return o==="batch"?(i.out($().text("note.no_design_skipped",{use_case:t.display})),a?.({type:"evolve_skipped",use_case:t.display,reason:"no-design"}),{code:0,outcome:"no-design"}):(I(i,$().text("note.no_design",{use_case:t.display})),{code:2,outcome:"no-design"});let _=j(l,t.ucTip),v=[`evolve ${t.display}`,` re-designs use-case ${t.display}`,` affects ${_.pairs.length} pair(s)`,...n.because?[` because ${n.because}`]:[]];if(n.yes)for(let p of v)i.out(p);else{for(let c of v)i.out(c);let p=n.confirm?await n.confirm():await i.confirm(`proceed with the re-design of ${t.display}?`)?"proceed":"decline";if(p==="defer")return i.out(`deferred: the re-design of ${t.display} waits for an answer \u2014 nothing evolved`),{code:3,outcome:"deferred"};if(p==="decline")return i.out(o==="batch"?`skipped ${t.display}`:"declined \u2014 nothing evolved"),{code:0,outcome:"declined"}}let E=t.named?Ce(t.named):void 0,x=oe(e,l,t.ucTip,n.because,E),R=t.named?Re(l,t.named,t.display,n.because,t.ucTip):void 0,D=!1,O,h=p=>{p.type==="nothing_to_change"&&(D=!0,typeof p.note=="string"&&(O=p.note)),a?.(p)},y=await re(s,{verb:"evolve",subject:t.display},()=>r(t.seamRef,{yes:!!n.yes,...n.mode?{mode:n.mode}:{},...n.because?{because:n.because}:{},...x!==void 0?{changeDelta:x.change_delta,priorDesign:x.prior_design}:{},onChildEvent:h,...R?{statement:R}:{},...n.repin?{repinsKept:!0}:{}}),p=>({ok:p===0,exitCode:p}));if(y===3)return i.out($().text("note.design_paused",{use_case:t.display})),{code:y,outcome:"paused"};if(y!==0)return I(i,`design run for ${t.display} ended with exit code ${y} \u2014 no diff to report`),{code:y,outcome:"failed"};let u=L(e),b=u.tipOf(t.ucTip),w=S(u,b)?.seq,T={before:d.seq,after:w??"?"},A=be(_,j(u,b)),C=n.sourceChanged?{source_changed:n.sourceChanged}:{};if(D&&w===d.seq){let p=n.repin?_e(e,b,n.repin.by,i,t.display):void 0;return i.out(`unchanged: use-case ${t.display} \u2014 the design agent found nothing to change`),a?.({...ue(u,t.display,T,A),nothing_to_change:!0,...O?{note:O}:{},...p?{repinned:p}:{},...C}),ce(i,t.display,n.sourceChanged),{code:0,outcome:"unchanged"}}return we(i,u,t.display,T,A),a?.({...ue(u,t.display,T,A),...C}),ce(i,t.display,n.sourceChanged),{code:0,outcome:"evolved"}}function _e(e,t,n,i,r){let o=ie({store:e,graph:L(e),ucTip:t,by:n});if(o.errors){i.err?.(`the tests of ${r} couldn't be marked up to date: ${o.errors.map(a=>a.detail).join("; ")}`);return}let s=L(e);if(!(o.moved===0||V(s,t)))return{tests:H(s,t).total}}function ce(e,t,n){n&&e.out($().text("note.source_changed_after",{use_case:t,review:z(n)}))}var z=e=>e.next&&e.next.length>0?e.next.map(t=>t.cmd).join(" and "):null;function Ee(e,t){return n=>{let r=L(e).heads.get(n),o=r?[...e.recordsSince(null)].reverse().find(l=>l.source_head_moves?.[n]===r):void 0,s=o?e.tokenAt(o.seq):null,a=s?e.intentOf(s)?.args?.label:void 0;return{cmd:$().command("next.review_source",{source_id:n,from:typeof a=="string"?a:null,agent_mode:t})}}}function $e(e){let t=new Map,n=0;for(let{cid:r,state:o}of e.staleList()){if(o==="superseded")continue;let s=e.nodeLabel.get(r);if(!s||!W.has(s)||!B(e,r)||!P(e,r))continue;let a=F(e,r,s);!a||e.nodeLabel.get(a)!==k.USECASE||!B(e,a)||(n++,t.has(a)||t.set(a,fe(e,a)))}return{targets:[...t.values()].sort((r,o)=>r.display<o.display?-1:r.display>o.display?1:0),staleCount:n}}function xe(e,t,n){let i=e.map(s=>t(s,n)),r=i.flatMap(s=>s.cmd?[{cmd:s.cmd,why:"review its source's change"}]:[]),o=i.flatMap(s=>s.remedy?[s.remedy]:[]).join(`
|
|
3
|
+
`);return{...r.length>0?{next:r}:{},...o?{remedy:o}:{}}}var pe={[k.TEST]:"test",[k.SCENARIO]:"scenario",[k.AC]:"ac",[k.USECASE]:"usecase"},ve={test:"test",scenario:"scenario",ac:"acceptance criterion",usecase:"use-case"},de=120;function Oe(e,t){let n=e.resolve(t);if(!n)return null;let i=pe[e.nodeLabel.get(n.tip)??""];if(!i)return null;let r=e.getNode(n.tip)?.content??{},o=i==="ac"?r.text:r.title,s=typeof o=="string"?o.replace(/[\u0000-\u001f\u007f]+/g," ").trim():"",a=Array.from(s),l=a.length===0?void 0:a.length>de?`${a.slice(0,de-1).join("")}\u2026`:s,d=e.superseded.has(n.tip)?"removed":e.trust.get(n.tip)==="archived"?"archived":void 0;return{ref:e.nameOf.get(n.tip)??e.displayNameOf(n.tip)??t,label:i,...l?{title:l}:{},cid:n.tip,...d?{dead:d}:{}}}function Ce(e){if(!e.dead)return{ref:e.ref,label:e.label,...e.title?{title:e.title}:{}}}function ke(e,t,n){let i=[];for(let{cid:r,state:o}of e.staleList()){if(o==="superseded"||r===n)continue;let s=e.nodeLabel.get(r),a=pe[s??""];if(!s||!a||!B(e,r)||!P(e,r)||F(e,r,s)!==t)continue;let l=X(e,r);if(!l)continue;let d=e.nameOf.get(r)??e.displayNameOf(r)??r;i.push({display:d,text:`${ve[a]} ${d} \u2014 ${l}`})}return i.sort((r,o)=>r.display<o.display?-1:r.display>o.display?1:0),i[0]?.text??null}var Se=`Judge the scope yourself: change what this genuinely affects and leave the rest as designed.
|
|
4
|
+
If it is ambiguous what should change, ask before changing anything.`;function Re(e,t,n,i,r){let o=t.label==="usecase"?"":` in use-case ${n}`,s=[t.title?`"${t.title}"`:"",t.dead?`${t.dead} earlier`:""].filter(Boolean).join(", "),a=`[kane] evolve started on ${ve[t.label]} ${t.ref}${s?` (${s})`:""}${o}.`,l=i?.trim(),d=l||t.dead?void 0:X(e,t.cid),_=l?void 0:d??(r?ke(e,r,t.cid):null),v=l?`Because: ${l}`:_?`Stale: ${_}`:null;return[a,v,Se].filter(E=>E!==null).join(`
|
|
5
|
+
`)}function ue(e,t,n,i){let r=s=>e.nameOf.get(s)??s,o=s=>({scenario:r(s.scenario),test:s.test?r(s.test):null});return{type:"evolve_diff",use_case:t,generation:n,superseded:i.superseded.map(o),minted:i.minted.map(o),retained:i.retained.map(o),moves:i.moves.map(s=>({ac:r(s.ac),before:s.before.map(r),after:s.after.map(r)}))}}function H(e,t){let n=j(e,t).pairs.flatMap(r=>r.test!==null?[{test:r.test,scenario:r.scenario}]:[]);return{touched:n.filter(({test:r,scenario:o})=>P(e,r)||P(e,o)||e.edgesFrom(r).some(s=>s.type===q.VERIFIES&&P(e,s.dst))).length,total:n.length}}async function Ve(e,t,n){let{io:i,asks:r,runDesign:o,emit:s}=n,a=t.because,l=n.onChild??(s?De(s):void 0);i.out(`evolving ${t.ref??"stale use-cases"}: reading the graph\u2026`);let d=L(e),_=t.ref!==void 0?se(d,t.ref):null;if(_!==null)return I(i,_),2;let v=t.ref!==void 0?ne(d,t.ref):void 0,E="given"in r.blast?r.blast:null,x=n.words?.review??Ee(e,t.mode==="agent"),R=(c,f)=>xe(c,x,f),D=c=>{let{sources:f}=M(d,c.ucTip);return f.length>0?R(f,c.ucTip):void 0},O=(c,f)=>n.words?n.words.question(c,H(d,c.ucTip),a,v===void 0):le(c,f,a),h,y,u=[],b=()=>{for(let{target:c,review:f}of u)i.out($().text("note.source_changed_skipped",{use_case:c.display,review:z(f)})),s?.({type:"evolve_skipped",use_case:c.display,reason:"source_changed",...f})};if(v){let c=ye(d,v);if(!c.ok)return I(i,c.message),2;let f=M(d,c.target.ucTip);if(!a&&S(d,c.target.ucTip)&&J(f)){let m=R(f.sources,c.target.ucTip);return I(i,$().text("note.source_changed",{use_case:c.target.display,review:z(m)})),s?.({type:"evolve_skipped",use_case:c.target.display,reason:"source_changed",...m}),2}if(!a&&S(d,c.target.ucTip)&&!V(d,c.target.ucTip)){let m=r.because?await r.because(c.target.display):void 0;if(m!==null&&typeof m=="object")return i.out(`deferred: the reason to re-design ${c.target.display} waits for an answer \u2014 nothing evolved`),s?.({type:"evolve_paused",pending_because:c.target.display}),3;let N=m?.trim();if(!N)return I(i,$().text("note.nothing_changed",{ref:v})),2;a=N}let g=Oe(d,v);h=[{...c.target,ref:v,...g?{named:g}:{}}]}else{let{targets:c,staleCount:f}=$e(d);if(c.length===0){let g=E?Z(E,[]):null;return g?te(i,g):(s?.({type:"evolve_batch",stale_nodes:f,use_cases:0}),i.out("nothing stale \u2014 nothing to evolve"),0)}if(i.out(`from-stale: ${f} stale node(s) \u2192 ${c.length} use-case(s)`),u=c.flatMap(g=>{let m=M(d,g.ucTip);return S(d,g.ucTip)&&J(m)?[{target:g,review:R(m.sources,g.ucTip)}]:[]}),h=c.filter(g=>!u.some(m=>m.target.ucTip===g.ucTip)),y={stale_nodes:f,use_cases:h.length},h.length===0){let g=E?Z(E,[]):null;return g?te(i,g):(b(),s?.({type:"evolve_batch",...y}),0)}}let w={...a?{because:a}:{},...t.mode?{mode:t.mode}:{},...t.yes?{yes:!0}:{},repin:{by:n.by??{kind:"human",id:"operator"}}},T=c=>{a&&e.signals().append({ts:new Date().toISOString(),command:"evolve",id:c,verdict:"gap-resolved-evolve",polarity:"preference",by:n.by??{kind:"human",id:"operator"},target:c,reason:a})};if(E)return Te({store:e,graph:d,ref:v,targets:h,batch:y,opts:w,answered:E,io:i,runDesign:o,onChild:l,emit:s,signal:T,sayLeftOut:b,reviewFor:D,question:(c,f)=>n.words?n.words.question(c,H(d,c.ucTip),w.because,v===void 0):le(c,f,w.because),...n.words?{why:n.words.answerWhy}:{}});let A=r.blast.ask,C=c=>S(d,c.ucTip)?j(d,c.ucTip).pairs.length:0;y&&(b(),s?.({type:"evolve_batch",...y}));let p=[];for(let[c,f]of h.entries()){let g=C(f);S(d,f.ucTip)&&s?.(me(f,g,a));let m=()=>A(O(f,g),f.display),N=D(f),U=await ge(e,f,{...w,confirm:m,...N?{sourceChanged:N}:{}},i,o,v?"single":"batch",l,s);if(U.outcome==="evolved"&&T(v??f.display),U.outcome==="declined"&&s?.({type:"evolve_skipped",use_case:f.display,reason:"declined"}),U.outcome==="deferred"){let he=h.slice(c).filter(K=>S(d,K.ucTip));return s?.({type:"evolve_paused",pending_questions:he.map(K=>O(K,C(K))),deferred:f.display}),ee([...p,3])}if(v)return U.code;p.push(U.code)}return ee(p)}function Z(e,t){if(e.unreadable!==void 0)return e.unreadable;for(let[n,i]of e.given){if(!t.includes(n))return`${n} is not a question this run asks \u2014 addressable: ${t.length>0?t.join(", "):"(none)"}`;if(typeof i=="object")return`'${i.invalid}' is not a choice for ${n} \u2014 use 1 or proceed, 2 or decline`}return null}async function Te(e){let{store:t,graph:n,ref:i,targets:r,batch:o,opts:s,answered:a,io:l,runDesign:d,onChild:_,emit:v,signal:E}=e,x=[],R=[];for(let u of r){if(!S(n,u.ucTip)){if(i)return I(l,$().text("note.no_design",{use_case:u.display})),2;R.push(u);continue}x.push({target:u,pairs:j(n,u.ucTip).pairs.length})}let D=Z(a,x.map(u=>G(u.target)));if(D)return te(l,D);let O=a.given;o&&(e.sayLeftOut(),v?.({type:"evolve_batch",...o}));for(let u of R)l.out($().text("note.no_design_skipped",{use_case:u.display})),v?.({type:"evolve_skipped",use_case:u.display,reason:"no-design"});for(let u of x)v?.(me(u.target,u.pairs,s.because));let h=x.filter(u=>!O.has(G(u.target)));if(h.length>0){let u=$(),b=[...O.entries()].map(([g,m])=>({id:g,choice:m})),w={...i!==void 0?{ref:i}:{},...s.because?{because:s.because}:{}},T=u.command("next.answer_evolve",{...w,answers:b}),A=g=>({...w,answers:[...b,...h.map(m=>({id:G(m.target),choice:g}))]}),C=h.length===1?`use-case ${h[0].target.display}`:`${h.length} use-cases`,p=[...O.values()].filter(g=>g==="proceed").length,c=p>0?`; the ${p} use-case(s) already answered proceed still re-design`:"",f=[Q(u,"next.answer_evolve",A("proceed"),{why:e.why?e.why("proceed",C):`re-design ${C} now \u2014 supersedes what the change touches, spends design credits${c}`,...e.why?{}:{title:p>0?"Proceed with the remaining re-design":"Proceed with the re-design"}}),Q(u,"next.answer_evolve",A("decline"),{why:e.why?e.why("decline",C):`leave ${C} as designed${c}`,...e.why?{}:{title:p>0?"Decline the remaining question(s)":"Decline"}})].filter(g=>!("cmd"in g)||ae(g.cmd));return v?.({type:"evolve_paused",pending_questions:h.map(g=>e.question(g.target,g.pairs)),...T!==null?{resume:T}:{},next:f}),3}let y=[];for(let{target:u}of x){if(O.get(G(u))==="decline"){l.out(i?"declined \u2014 nothing evolved":`skipped ${u.display}`),v?.({type:"evolve_skipped",use_case:u.display,reason:"declined"});continue}let b=e.reviewFor(u),w=await ge(t,u,{...s,yes:!0,...b?{sourceChanged:b}:{}},l,d,i?"single":"batch",_,v);w.outcome==="evolved"&&E(i??u.display),y.push(w.code)}return ee(y)}function ee(e){let t=e.find(n=>n!==0&&n!==3);return t!==void 0?t:e.includes(3)?3:0}function te(e,t){return e.err?e.err(`error: ${t}`,"ANSWER_USAGE"):e.out(`error: ${t}`),2}function G(e){return`evolve:${e.display}`}function me(e,t,n){return{type:"evolve_target",...e.ref!==void 0?{ref:e.ref}:{},use_case:e.display,pairs:t,...n?{because:n}:{}}}function le(e,t,n){return{id:G(e),header:"Re-design?",text:`Re-design use-case ${e.display}? ${t} scenario/test pair(s) are affected${n?` \u2014 because: ${n}`:""}.`,risk:"med",rationale:"evolve re-designs the whole parent use-case: what the change touches is superseded, the rest is re-emitted verbatim; the run spends design credits",options:[{label:"proceed",detail:`re-design use-case ${e.display} now (${t} pair(s) affected)`},{label:"decline",detail:"leave the current design as it is"}],recommended_index:0,allow_free_text:!1}}function De(e){return t=>{t.kind==="start"?e({type:"child_start",child:"design",subject:t.subject}):t.kind==="end"&&e({type:"child_end",ok:t.ok,dur_s:t.durS,...t.exitCode!==void 0?{exit_code:t.exitCode}:{}})}}export{ye as a,We as b,ge as c,$e as d,xe as e,Oe as f,Se as g,Re as h,Ve as i,G as j};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as m}from"./chunk-3QICDXY5.js";import{a as p}from"./chunk-RPRXRKKR.js";import{f as e}from"./chunk-4I7YN6YY.js";import{a as t,b as i,x as n}from"./chunk-I6OQISK4.js";import{dirname as d}from"path";import{fileURLToPath as l}from"url";import{existsSync as a}from"fs";import{join as c,resolve as f}from"path";function g(r){for(let o of[f(r,".."),f(r,"../..")])if(a(c(o,"package.json")))return o;return null}function u(r=m,o,s=p){e({version:t,baseDir:i,authEnvironments:n,packageRoot:g(d(l(import.meta.url))),wording:r,...o?{warn:o}:{},userSessionId:s})}u();export{g as a,u as b};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as At,b as Ct,d as Ot,f as Tt,t as Mt,u as jt}from"./chunk-SONMD3W5.js";import{b as It}from"./chunk-QCKA665H.js";import{b as _t,d as Rt}from"./chunk-XJ7HCXKW.js";import{k as yt}from"./chunk-QTZBVDPR.js";import{a as ht,b as U}from"./chunk-NLZZLANH.js";import{c as gt}from"./chunk-NWD54VV5.js";import{c as vt,h as wt}from"./chunk-L4UVUFL6.js";import{a as Wt}from"./chunk-HIUAUZNL.js";import{g as Pt,h as Re,j as Et}from"./chunk-252FWF2G.js";import{c as Dt,d as $t,e as Ut}from"./chunk-JQSLUGD4.js";import{d as xt}from"./chunk-FFL55I2M.js";import{g as Nt}from"./chunk-42PALMW2.js";import{f as bt}from"./chunk-KF4DKXSS.js";import{k as St}from"./chunk-ZTHYAHDN.js";import{c as kt}from"./chunk-DPGOAFKF.js";import{B as ct,D as ut,Da as mt,Ha as P,W as _e,ba as pt,f as re,fa as ft,h as rt,i as st,n as k,o as dt,pa as ie,r as Se,t as z,u as se,v as oe,w as lt}from"./chunk-W3OVSDBN.js";import{a as ot,b as it,d as at}from"./chunk-GFLB2SHW.js";import{a as ne}from"./chunk-I2MC6VVX.js";import{a as ke}from"./chunk-RPRXRKKR.js";import{d as et}from"./chunk-NWBLYMH7.js";import{oa as nt}from"./chunk-UEE3RZN4.js";import{b as tt}from"./chunk-6NFOH4AC.js";import{c as Ze}from"./chunk-ZCRZFAOT.js";import{a as Ye}from"./chunk-I6OQISK4.js";import{appendFileSync as tn,mkdirSync as nn,mkdtempSync as rn,rmSync as sn}from"fs";import{tmpdir as on}from"os";import{dirname as an,join as dn}from"path";import{MessageChannel as ln,Worker as cn}from"worker_threads";var Ft=["submit","submitAnswer","submitFreeText","submitAnswerWithText","toggleOption","confirmMulti","goWithRecommendations","ingestAttach","continueParked","completeSession","requestPause","finalizeForExit","note","ledger"],xn=[...Ft,"state","subscribe","multiSelection","canIngest","senderAlive","aliasOf","explainLines","ask","approveAdded"];function Lt(e,s){let n=s.state,o=s.view,i=new Set,l=[];e.on("message",m=>{if(m.type==="approved")return void l.shift()?.(m.go);if(m.type==="mirror"){n=m.state,o=m.view;for(let g of[...i])g()}});let f=(m,g)=>e.postMessage({type:"controller",member:m,args:g});return{...Object.fromEntries(Ft.map(m=>[m,(...g)=>{f(m,g)}])),get state(){return n},subscribe(m){return i.add(m),()=>i.delete(m)},goWithRecommendations(){return f("goWithRecommendations",[]),{picks:""}},async ingestAttach(m){f("ingestAttach",[m])},approveAdded(){return new Promise(m=>{l.push(m),f("approveAdded",[])})},multiSelection:m=>o.multi[m]??[],canIngest:()=>o.canIngest,senderAlive:()=>o.senderAlive,aliasOf:m=>o.aliases[m],explainLines:()=>null,ask:async()=>{throw new Error("a remote session's questions are asked on its session thread")}}}var Xt=e=>e.added===0?"":e.verb==="design"?`${e.added} added`:`${e.added} ${e.added===1?"use-case":"use-cases"} added`;function On(e,s,n){let o=e.length,i=s.title?`"${s.title}"`:nt(s.id);return[{text:` ${o} other ${o===1?"session is":"sessions are"} open on ${i} \u2014 you can still go ahead`},...Ie(e,n,4)]}function Ie(e,s,n){let o=" ".repeat(n),i=[];for(let l of e){let f=l.owner===null?"":(l.owner==="you"?"yours":"someone else").padEnd(15),j=[Mt[l.state]??l.state,jt(l.lastActivityAt,s),Xt(l)].filter(Boolean);i.push({text:`${o}${f}${j.join(" \xB7 ")}`,dim:!0}),l.owner!=="someone_else"&&(l.state==="ready_to_save"?i.push({text:`${o} save: kane-cli context sessions save ${l.sid}`,dim:!0}):l.state==="paused"&&i.push({text:`${o} resume: ${ie(l.verb==="design"||l.verb==="evolve"?"design":"extract",l.sid,!1)}`,dim:!0}))}return i}var ae=2e3,qt=2*ae,Yt=16;async function $n(e){let s=await xe(e);return s===null?null:s.length===0?P.nothingNewRead.map(n=>({text:n})):[{text:P.nothingNewInSession},...Ie(s,e.now,2)]}function Bt(e){if(e.length===0)return{type:"nothing_new",reason:"every_source_read",next:[{cmd:"kane-cli context ingest <files> --mode agent",why:"add more sources"}]};let s=e.filter(n=>n.owner!=="someone_else").flatMap(n=>n.state==="paused"?[{cmd:`kane-cli context extract --resume ${n.sid} --mode agent`,why:"resume your session"}]:n.state==="ready_to_save"?[{cmd:`kane-cli context sessions save ${n.sid} --yes --mode agent`,why:"save your session"}]:[]);return{type:"nothing_new",reason:"sources_in_a_session",open_sessions:e.map(({sid:n,owner:o,state:i,added:l})=>({sid:n,owner:o,state:i,added:l})),...s.length>0?{next:s}:{}}}async function xe(e){let s,n=new Promise(o=>{s=setTimeout(()=>{e.log?.(`the sources weren't read within ${e.budgetMs??qt} ms; the extract goes on`),o(null)},e.budgetMs??qt)});try{return await Promise.race([Zt(e),n])}catch(o){return e.log?.(`the sources weren't read: ${U(o)}; the extract goes on`),null}finally{clearTimeout(s)}}async function Zt(e){let[s,n]=await Promise.all([e.person.sources(e.projectId),e.person.listSessions(e.projectId)]),o=s.filter(l=>l.head!==null&&!l.sourceId.startsWith(Nt));if(o.length===0||o.some(l=>l.completeness?.sourceCid!==l.head))return null;let i=n.filter(l=>l.verb==="extract");return Rt(e.person,e.projectId,i,e.me,Math.min(Yt,Math.max(1,i.length)))}var Pe=class extends Error{constructor(){super("stopped while the file went up")}},de=class extends Error{constructor(n,o,i){super(n.message);this.refusal=n;this.exit=o;this.detail=i}};async function Sr(){let e=await bt(gt);return{auth:e,preflight:await kt(e)}}var un=500,le=5e3,Ht=6e4,pn=250;function fn(e){let s=e.now-e.pressedAt;if(s>=Ht)return"force";let n=e.saving>0?0:e.now-Math.max(e.quietSince,e.pressedAt);return n>=le?"force":{wait:Math.min(le-n,Ht-s)}}var mn=new Set([k.appendDraft,k.vectorsWrite,k.putBlob,k.chainWrite,k.chainWriteIfAbsent,k.chainRemove,k.filesWrite,k.statePut,k.acknowledge,k.registerChild,k.sideSave]);function gn(){return import.meta.url.endsWith(".ts")?new URL("./session-worker.boot.mjs",import.meta.url):new URL("./session-worker.js",import.meta.url)}function hn(e,s){if(e!=="ingested"||s===null||typeof s!="object")return{kind:e};let n=s,o={kind:e};for(let i of["source_id","status","behind","unread","cursor"])n[i]!==void 0&&(o[i]=n[i]);return o}function vn(e,s){let n=Ze(`remote-${e}`,s);return o=>{try{nn(an(n),{recursive:!0}),tn(n,`${new Date().toISOString()} ${o}
|
|
3
|
+
`)}catch{}}}var w=U;async function wn(e,s,n,o){let i,l;try{[i,l]=await Promise.all([pt(e.person,s,n),e.person.getSession(n)])}catch(f){return o(`the session that added nothing was not discarded: ${w(f)}`),!0}if(ft(i,(l.scope?.position??l.basePosition)>l.basePosition))return!0;try{await e.person.discard(n,e.claim.generation)}catch(f){o(`the session that added nothing was not discarded: ${w(f)}`)}return!1}function yn(e,s){return e===0&&s>0?1:e}async function _r(e){let s={trace:Dt(null,"")},n=1;Se({projectId:e.choice.projectId});try{return n=await bn(e,s),n}finally{s.trace.line("run_end",{code:n}),await lt()}}async function bn(e,s){let n=e.testing??{},o=null,i=new Set,l=r=>{if(r.type!=="session_paused"||e.verb!=="extract"||i.size<2)return r;let{resume:a,held_review:y,next:Y,...$}=r,Z=Ot(e.ingest?.map(ee=>ee.path??ee.file),A?.record??null),G=A?.record.sessionId??String(r.sid);return{...$,sid:G,...Tt(G,Z)}},f=r=>{let a=e.io?At(r,Date.now(),{sourceId:A?.record.sourceId??null,mode:e.mode}):null;a&&e.io.event(l(a)),e.onProgress(o!==null&&r.kind==="load"?{kind:"reading",file:o}:r)},j=e.start.kind==="resume"?e.start.sessionId:null,N=null,m=null,g=null,Ee=!1,ce=null,Ae=[],W=!1,ue=!1,pe=null,fe=!1,A=null,u=n.diagnostics??(()=>{}),C=(r,a={})=>{e.io?e.io.event({type:"error",code:r.code,message:r.message,...ct(r),...r.heldBy?{held_by:ut(r.heldBy)}:{},...r.notAdded?{not_added:r.notAdded}:{},...a}):e.onRefusal?e.onRefusal(r):yt(r)},Gt=r=>{if(!g){if(g=r,e.onEnding?.(),u(`the session's writer was stopped: ${U(r)}`),z(se(r),oe(r)),m?.close(P.stepRefused),r.code==="PROJECT_NOT_MARKED")Ee=!0;else if(r.code==="SESSION_ENDED"||r.code==="SCOPE_NOT_OPEN")pe=r;else{let a=r.code===rt?"resumed_elsewhere":r.code===st?"computer_slept":"connection_lost";W&&a==="connection_lost"?ue=!0:f({kind:"paused",reason:a,sid:A?.record.sessionId??j??""})}setTimeout(()=>{N?.terminate()},le).unref()}},E=!1,S=!1,me=0,ge=new Set,D=0,Ce=!1,J=!1,Oe=()=>{},Kt=new Promise(r=>Oe=r),Te=()=>{E=!0,N?.postMessage({type:"stop"})},Me=()=>{},je=new Promise(r=>Me=r),he=()=>{s.trace.line("run_forced",{}),S=!0,Me(),J&&Oe();let r=N;r?.postMessage({type:"kill"}),setTimeout(()=>{r?.terminate()},pn).unref()},ve=0,Ne=r=>{let a=()=>{if(S||Ce)return;let y=fn({now:Date.now(),pressedAt:r,saving:me+ge.size,quietSince:D});if(y==="force")return he();setTimeout(a,Math.max(50,y.wait)).unref()};setTimeout(a,le).unref()},We=()=>{if(ve+=1,s.trace.line("stop_asked",{by:"ctrl_c",press:ve}),J||ve>1)return he();Te(),Ne(Date.now())};e.onControls?.({pause:()=>{s.trace.line("stop_asked",{by:"pause"}),E=!0,Ne(Date.now())},force:he});let _=!1,De=null,$e=0;if(e.mode==="agent"&&e.io&&e.verb==="extract"&&e.start.kind==="new"&&!e.start.body.sourceId&&!e.run.force&&!e.ingest){let r=await xe({person:re({url:e.choice.latticeUrl,basicAuth:e.basicAuth,requestDeadlineMs:ae,...n.fetch?{fetch:n.fetch}:{}}),projectId:e.choice.projectId,me:vt(process.cwd()),now:Date.now(),log:n.diagnostics??ht("nothing-new")});if(r!==null)return e.io.event(Bt(r)),0}let F=e.io?await tt({event:r=>e.io.event(r)},e.check):await e.check();if(!F.preflight.ok){let{cause:r,final:a}=F.preflight;return u(`the controller's check refused the run: ${F.preflight.message}`),C(P.preflight(r??(a?"rejected":"unreachable")),{final:a}),2}if(S)return 130;let Vt=e.signals?process.listeners("SIGINT"):[],Q=!1,Ue=()=>{!e.signals||Q||(Q=!0,process.removeAllListeners("SIGINT"),process.on("SIGINT",We))},L=()=>{if(Q){Q=!1,process.removeListener("SIGINT",We);for(let r of Vt)process.on("SIGINT",r)}},q=null,X=[];if(e.ingest){Ue();try{for(let a of e.ingest){if(!a.fetch)continue;if(await Promise.race([a.fetch(f).then(()=>!0),je.then(()=>null)])===null||S||E)return L(),130}let r=[];for(let a of e.ingest){if(a.deferred){r.push(null);continue}let y=await Promise.race([a.upload(f,()=>E||S),je.then(()=>null)]);if(y===null||S)return L(),130;r.push(y)}q=r}catch(r){if(L(),r instanceof Pe)return 130;if(!(r instanceof de))throw r;return u(`the upload was refused: ${r.detail??r.message}`),C(r.refusal),r.exit}}try{A=await _t({url:e.choice.latticeUrl,basicAuth:e.basicAuth,start:e.start,...e.choice.projectName?{projectName:e.choice.projectName}:{},onProgress:f,onStopped:Gt,log:r=>u(r),testing:{...n.fetch?{fetch:n.fetch}:{},...n.leaseRenewMs!==void 0?{leaseRenewMs:n.leaseRenewMs}:{},...n.retryDeadlineMs!==void 0?{retryDeadlineMs:n.retryDeadlineMs}:{}}})}catch(r){L(),e.choice.onboarded&&r instanceof ne&&(r.code==="MARK_REFUSED"||r.code==="PROJECT_NOT_MARKED")&&wt(process.cwd());let a=await Rn(r,{latticeUrl:e.choice.latticeUrl,projectId:e.choice.projectId,basicAuth:e.basicAuth,sessionId:j,useCase:e.run.useCase,log:$=>u($),...n.fetch?{fetch:n.fetch}:{}}),{exit:y,...Y}=It(r,e.choice,j,e.verb==="reconcile"?void 0:{verb:e.verb,...(e.verb==="design"||e.verb==="evolve")&&e.run.useCase?{useCase:e.run.useCase}:{},...a!==void 0?{title:a}:{},...e.mode==="agent"?{agent:!0}:{}});return u(`the session could not be opened: ${w(r)}`),r instanceof ne&&z(se(r),oe(r)),C(Y),y}let c=A,p=c.record.sessionId;Se({latticeSessionId:p,projectId:e.choice.projectId});let Fe=e.start.kind==="resume"&&c.record.verb==="reconcile"&&c.record.sourceId!==null,B=Fe?_n({...c.record,sourceId:c.record.sourceId}):null;Fe&&e.io?.retag?.("reconcile");let H=e.start.kind==="resume"&&c.record.verb==="evolve";H&&e.io?.retag?.("evolve");let Le=H?Sn(c.log.since(0)):void 0;if(H)for(let[r,a]of _e(c.log.since(0)))e.onRepinned?.(r,a);n.diagnostics||(u=vn(e.verb,p)),s.trace=$t(e.traceVerb??e.verb,ke()),s.trace.path&&Ut(p,s.trace.path),s.trace.line("run_open",{sid:p,verb:e.verb,start:e.start.kind,mode:e.mode??"interactive",cli_version:Ye,env:et(),project_id:e.choice.projectId});{let r=u;u=a=>{r(a),s.trace.line("diag",{line:a})}}let qe=rn(dn(on(),"kane-remote-session-")),we=[],Be=!1;Ue();let He=async()=>{if(!(!e.ingest||q===null))for(let[r,a]of e.ingest.entries())X[r]||(X[r]=!0,await a.cancel(p).catch(y=>u(`the upload's cancel was not posted: ${w(y)}`)))},ye=()=>(e.start.kind==="new"?c.person.discard(p,c.claim.generation):c.person.setStatus(p,"paused")).then(()=>{},r=>u(`the unstarted session was not put away: ${w(r)}`)),Ge=async()=>(await c.person.setStatus(p,"paused").catch(r=>u(`the pause was not recorded: ${w(r)}`)),f({kind:"not_ended",sid:p,project:e.choice.projectName}),1),Ke=async()=>{let r=await c.person.getSession(p).then(y=>y.scope?.state,()=>null);return f({kind:"ended",reason:r==="finalized"?"saved_elsewhere":r==="discarded"?"discarded_elsewhere":"ended_elsewhere",sid:p}),0},zt=async()=>{let r=await c.client.sessionState().catch(a=>(u(`the session's state couldn't be read: ${w(a)}`),null));return r===null||typeof r.completed_at!="string"?null:r.ended?.ended==="failed"?"failed":"complete"};try{if(S)return await He(),await ye(),130;try{e.onOpened?.(c.record,d=>u(d))}catch(d){u(`the folder's project link could not be updated: ${w(d)}`)}let r=e.start.kind==="resume"?await zt():null;if(r!==null){J=!0,W=!0;try{await c.state.end(p,{state:r,panel:null,error:null,checkIn:!1,phase:null,child:null,pausing:!1})}catch(d){return u(`the ending was not recorded: ${w(d)}`),pe?await Ke():g&&!ue?3:await Ge()}return r==="failed"?(C(P.sessionFailed(p)),2):(f({kind:"finished_before",sid:p}),0)}let a=0,y=async(d,b)=>{let T=mn.has(d),v=String(b?.childId??"");d===k.chainWrite&&/^(delta|full)-\d+\.json$/.test(String(b?.name))&&ge.add(v),T&&(me+=1,D=Date.now());let R=d===k.appendDraft,K;R&&(a+=1,e.onWrites?.(a),K=setTimeout(()=>f({kind:"write",pending:a}),300));try{return await c.storeCalls(d,b)}catch(I){throw u(`${d} was refused: ${w(I)}`),I instanceof ot?I:(z(se(I),oe(I)),I instanceof dt&&!g&&(fe=!0,e.onEnding?.()),it(new Error(P.stepRefused),I))}finally{d===k.acknowledge&&ge.delete(v),T&&(me-=1,D=Date.now()),R&&(clearTimeout(K),a-=1,e.onWrites?.(a),a===0&&f({kind:"write",pending:0}))}},{port1:Y,port2:$}=new ln,Z=new SharedArrayBuffer(4);m=at({port:Y,signal:Z},y);let G=H||e.verb==="evolve"?await kn(re({url:e.choice.latticeUrl,basicAuth:e.basicAuth,requestDeadlineMs:ae,...n.fetch?{fetch:n.fetch}:{}}),e.choice.projectId,u):void 0,ee={verb:B?"reconcile":H?"evolve":e.verb,traceVerb:e.traceVerb??e.verb,mode:e.mode,sessionId:p,fresh:e.start.kind==="new",generation:c.claim.generation,projectDir:process.cwd(),projectName:e.choice.projectName,projectId:e.choice.projectId,sideDir:qe,bridge:{port:$,signal:Z},lastEventSeq:c.log.lastSeq(),run:e.start.kind==="resume"?{...e.run,resume:p,...Le!==void 0?{kept:Le,...c.record.useCase?{useCase:c.record.useCase}:{}}:{}}:e.run,...e.start.kind==="resume"&&e.verb==="extract"?{landed:[...new Set((c.record.uploads??[]).filter(d=>d.outcome!=="refused").map(d=>d.sourceId))]}:{},auth:F.auth,preflight:F.preflight,supportId:ke(),...n.agent||n.remoteDeps||n.sourcePlugins||n.refuseCard?{testing:{...n.agent?{agent:n.agent}:{},...n.remoteDeps?{remoteDeps:n.remoteDeps}:{},...n.sourcePlugins?{sourcePlugins:n.sourcePlugins}:{},...n.refuseCard?{refuseCard:n.refuseCard}:{}}}:{},...e.ingest&&q?{ingest:e.ingest.map((d,b)=>({bytes:new Uint8Array(d.bytes),file:d.file,sourceId:d.sourceId,fingerprint:q[b]?.fingerprint??"",then:d.then,...d.remote?{remote:d.remote}:{},...d.plugin?{plugin:d.plugin}:{}}))}:{},...B?{review:B}:{},...G?{origins:G}:{}},Ve=()=>e.io?.event({type:"error",message:P.runStopped(e.verb)}),O=await new Promise(d=>{let b=!1,T=t=>{b||(b=!0,d(t))},v;try{v=new cn(n.workerUrl??gn(),{workerData:ee,transferList:[$]})}catch(t){return u(`the session thread could not start: ${w(t)}`),Ve(),T(1)}N=v,E&&v.postMessage({type:"stop"});let R=e.ingest?.[0],K=R?.remote?Pt({...R.remote,address:R.remote.origin.url},Re(R.remote.provider,R.remote.origin.url,R.sourceId)):void 0,I=B??(e.verb==="reconcile"&&R?{sourceId:R.sourceId,file:R.path??R.file,...K?{page:K}:{}}:null);if(e.onReview&&I){let t=Wt(v),x={source:I.sourceId,file:I.file,...I.page?{page:I.page}:{}};e.onReview(t,x);let h=!1;v.on("message",V=>{if(h||V.type!=="reviewMirror"||!V.review.named)return;h=!0;let M=xt(x,V.review.named);M&&e.onReview(t,M)})}e.ingest&&(o=e.ingest[0].file,f({kind:"reading",file:o})),n.terminateOnHold?.then(()=>v.terminate());let Qe=!0,Xe=!1;v.on("message",t=>{if(t.type==="mirror"&&E&&t.state.nestedAgent===!0&&(D=Date.now()),t.type==="mirror"&&!Xe)Xe=!0,e.onController?.(Lt(v,{state:t.state,view:t.view}));else if(t.type==="event"){if(E&&t.event.child_id!==void 0&&(D=Date.now()),(fe||g)&&t.event.type==="error")return u(`after the run paused: ${String(t.event.message??"")}`);if(e.start.kind==="resume"&&t.event.type==="error"&&mt.has(String(t.event.code??"")))return ce=String(t.event.code),u(`the resume was refused: ${String(t.event.message??"")}`);if(t.event.type==="held"&&e.onHeld?.(Number(t.event.count)||0),t.event.type==="session_complete"&&e.mode==="agent"||(t.event.type==="source_start"&&i.add(String(t.event.source_id)),t.event.type==="child_start"?we.push({child:t.event.child,at:Date.now()}):t.event.type==="child_end"?we.pop():t.event.type==="session_paused"&&t.event.child_id===void 0&&(Be=!0),t.event.type==="run_start"&&t.event.child_id!==void 0))return;e.io?.event(l(t.event.type==="run_start"?{type:"run_start",session:p}:t.event.type==="session_paused"&&t.event.held!==void 0?{...t.event,reason:"held_back"}:t.event.type==="held"&&t.event.reason==="embed_degraded"?{...t.event,reason:"duplicate_check_reduced"}:t.event.type==="held"&&t.event.reason==="reconcile"?{...t.event,reason:"review"}:t.event)),(Qe&&n.stopAfterFirstEvent||!E&&t.event.type===n.stopAtEvent)&&Te(),Qe=!1}else if(t.type==="summary")e.onSummary?.(t.facts);else if(t.type==="notUpdated")e.onNotUpdated?.(t.useCases,t.titles,t.stillStale);else if(t.type==="unstarted")_=!0;else if(t.type==="needed")Ae=t.needed.noStartPage.map(({test:x})=>({test:x})),e.onNeeded?.({needed:t.needed,tests:t.tests});else if(t.type==="preMount")(e.onPreMount?e.onPreMount(t.question):Promise.resolve({go:!1,code:2})).then(x=>{!x.go&&t.question.kind!=="evolve-entry"&&t.question.kind!=="lines"&&(_=!0),v.postMessage({type:"preMountAnswer",answer:x})});else if(t.type==="ingestFetched"){let x=e.ingest[t.index];x.bytes=Buffer.from(t.bytes),x.upload(f,()=>E||S).then(h=>{q[t.index]=h,v.postMessage({type:"ingestUploaded",index:t.index,ok:!0,fingerprint:h.fingerprint})},h=>{h instanceof de?(u(`the upload was refused: ${h.detail??h.message}`),C(h.refusal),De=h.exit):u(`the fetched item's upload failed: ${w(h)}`),X[t.index]=!0,_=!0,v.postMessage({type:"ingestUploaded",index:t.index,ok:!1})})}else if(t.type==="ingestOutcome"){let{type:x,index:h,...V}=t;X[h]=!0,e.ingest[h].result(V,p,u).then(M=>{M?e.ingest[h+1]&&(o=e.ingest[h+1].file,f({kind:"reading",file:o})):(_=!0,o=null),v.postMessage({type:"ingestGo",index:h,go:M})},M=>{u(`the upload's result was not posted: ${w(M)}`),_=!0,v.postMessage({type:"ingestGo",index:h,go:!1})})}else if(t.type==="ingested")o=null,e.verb==="reconcile"&&t.status==="unchanged"&&!t.behind&&!t.unread&&(_=!0),e.ingest?.[t.index]?.onAdded?.(t.status,p,{...t.duplicateOf?{duplicateOf:t.duplicateOf}:{},...t.attachments?{attachments:t.attachments}:{},...t.behind?{behind:t.behind}:{},...t.unread?{unread:!0}:{}});else if(t.type==="ingestUnwritten")o=null,_=!0,e.ingest?.[t.index]?.onUnwritten?.(p);else if(t.type==="sessionEvent"){E&&t.payload.child_id!==void 0&&(D=Date.now()),c.log.append(t.kind,t.payload),s.trace.line("session_event",hn(t.kind,t.payload));for(let[x,h]of _e([t]))e.onRepinned?.(x,h)}else t.type==="itemsFailed"?$e+=t.count:t.type==="out"?e.io?.out(t.line):t.type==="log"?u(t.line):t.type==="done"&&T(De??t.code)}),v.on("error",t=>{u(`the session thread failed: ${t instanceof Error&&t.stack?t.stack:w(t)}`),z("thread_crash"),Ve(),T(1)}),v.on("exit",()=>{s.trace.line("thread_exit",{stopped:g!==null,forced:S}),T(g?3:S?130:1)})});J=!0;let ze=e.ingest?.[0]?.then==="pause";W=O===0&&!_&&!ze;let te=O!==0||_,Jt=fe&&!g&&!S&&O!==0&&!_,be=!1,Qt=async()=>{await He(),_?(await c.log.flush().catch(()=>{}),await ye()):O!==0&&!g&&await c.person.setStatus(p,"paused").catch(d=>u(`the pause was not recorded: ${w(d)}`)),await c.log.flush(),!g&&O===0&&!_&&(ze?await c.person.setStatus(p,"paused"):await c.state.end(p,{state:"complete",panel:null,error:null,checkIn:!1,phase:null,child:null,pausing:!1}),te=!0),be=!0};await Promise.race([Qt().catch(d=>u(`the run's ending was not recorded: ${w(d)}`)),Kt]);let Je=!0;if(e.mode==="agent"&&be&&W&&te&&!g&&!S&&(Je=await wn(c,e.choice.projectId,p,u)),S&&!be&&!g){let d=_?ye():c.person.setStatus(p,"paused").catch(b=>u(`the pause was not recorded: ${w(b)}`));await Promise.race([d,new Promise(b=>setTimeout(b,un).unref())])}if(Ee)return C(P.assuranceOff(e.choice.projectName)),2;if(ce!==null)return C(P.resumeUnreadable(ce,p,e.verb==="design"?"design":"extract",c.record.useCase)),2;if(pe)return await Ke();if(S){if(e.mode!=="agent"||g||_)return 130;if(Be)return 3;for(let b of we.splice(0).reverse())e.io?.event({type:"child_end",child:b.child,ok:!1,dur_s:Math.max(1,Math.round((Date.now()-b.at)/1e3)),exit_code:3});let d=ie(e.verb==="design"&&!B?"design":"extract",p,!0);return e.io?.event(l({type:"session_paused",sid:p,...c.record.sourceId?{source_id:c.record.sourceId}:{},mode:"agent",resume:d,expires_at:null,pending_questions:[],next:[{cmd:d,why:"resume"}]})),3}return ue||W&&!te&&!g?await Ge():g?3:Jt?(f({kind:"paused",reason:"not_accepted",sid:p}),3):te?(e.mode==="agent"&&W&&O===0&&e.io?.event(Ct(p,Je,{sourceId:A?.record.sourceId??null,noStartPage:Ae})),yn(O,$e)):(f({kind:"paused",reason:"connection_lost",sid:p}),3)}finally{Ce=!0,L(),c.release(),m?.close("the session ended"),await N?.terminate(),sn(qe,{recursive:!0,force:!0})}}async function kn(e,s,n){try{return Object.fromEntries((await e.sources(s)).map(o=>[o.sourceId,o.origin?.url??null]))}catch(o){return n(`the project's sources were not read: ${w(o)}`),{}}}function Sn(e){let s=e.filter(i=>i.kind==="evolve_answers").at(-1)?.payload,n=s?.request;if(!n||!Array.isArray(s?.answers))return"unread";let o=s.answers.flatMap(i=>typeof i.id=="string"&&(i.choice==="proceed"||i.choice==="decline")?[{id:i.id,choice:i.choice}]:[]);return{request:{...typeof n.ref=="string"?{ref:n.ref}:{},fromStale:n.fromStale===!0,...typeof n.because=="string"?{because:n.because}:{}},answers:o}}function _n(e){let s=[...e.uploads??[]].reverse().find(n=>n.sourceId===e.sourceId&&n.outcome!=="refused"&&(n.filename||n.originUrl));if(s&&!s.filename&&s.originUrl){let n=s.originUrl,o=St(n)?.name??"web";return{sourceId:e.sourceId,file:n,page:Et(o,n,void 0,Re(o,n,e.sourceId))}}return{sourceId:e.sourceId,file:s?.filename??"<file>"}}async function Rn(e,s){if(!(e instanceof ne)||e.code!=="SESSION_CLASH")return;let n=e.extra.heldBy;if(n?.verb!=="design"&&n?.verb!=="evolve")return;let o=re({url:s.latticeUrl,basicAuth:s.basicAuth,...s.fetch?{fetch:s.fetch}:{}});try{if(s.sessionId!==null)return(await o.getSession(s.sessionId)).useCaseTitle??null;if(!s.useCase)return null;let i=(await o.mainNode(s.projectId,s.useCase)).content.title;return typeof i=="string"&&i!==""?i:null}catch(i){return s.log(`the use case's title couldn't be read for the lock's words, so they name its id: ${U(i)}`),null}}export{On as a,ae as b,$n as c,Pe as d,de as e,Sr as f,fn as g,mn as h,hn as i,yn as j,_r as k};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{b as c}from"./chunk-5D7ENQTQ.js";import{a as w}from"./chunk-2XW33VOK.js";import{d as h,h as g}from"./chunk-A7RJQJNT.js";import{c as b,j as v}from"./chunk-I6OQISK4.js";import{readFileSync as C,writeFileSync as k,mkdirSync as x,existsSync as T}from"fs";import{dirname as S}from"path";var f={window_size:{width:1920,height:1080},chrome_profile_path:"",default_url:v,model:"v16-alpha",project_id:null,project_name:null,folder_id:null,folder_name:null,mode:"testing",assertion_mode:"dom",network_ws:!1,network_sse:!1,bug_detection:"off",assertion_failure_mode:"stop",final_validation:!1,code_export:{enabled:!0,language:"python",skip_validation:!0},generate:{scenario_limit:2,per_scenario_limit:3,memory_enabled:!1},last_seen_version:"",hints_enabled:!0},I=f;function E(r){let{mobile:e,...o}=r,t={...o};delete t.target,delete t.device,delete t.device_name,delete t.os_version,delete t.app;let n=e??{};n.tui_target&&(t.target=n.tui_target);let s=n.default_target?.name?.trim(),l=n.default_target?.os_version?.trim();if(s||l)s&&(t.device_name=s),l&&(t.os_version=l);else{let i=n.default_target?.id?.trim();i&&(t.device=i)}n.default_app&&(t.app=n.default_app);let a={};n.no_reset!==void 0&&(a.no_reset=n.no_reset),n.appium_url!==void 0&&(a.appium_url=n.appium_url);for(let i of c)n[i]!==void 0&&(a[i]=n[i]);return Object.keys(a).length>0&&(t.mobile=a),t}function R(r){let e=r.mobile??{},o=typeof r.target=="string"?r.target:void 0,t=typeof r.device=="string"&&r.device.trim()!==""?r.device.trim():void 0,n=d=>typeof d=="string"&&d.trim()!==""?d.trim():void 0,s=n(r.device_name),l=n(r.os_version),a=typeof r.app=="string"&&r.app!==""?r.app:void 0,i={},_=o??e.tui_target;_&&(i.tui_target=_);let p=w(_,void 0).kind,u=h(p)?p:null;u&&(s||l)?i.default_target={platform:g(u),kind:u,...s?{name:s}:{},...l?{os_version:l}:{}}:u&&t?i.default_target={platform:g(u),kind:u,id:t}:(e.default_target?.id?.trim()||e.default_target?.name?.trim())&&(i.default_target=e.default_target);let m=a??e.default_app;m&&(i.default_app=m),e.no_reset!==void 0&&(i.no_reset=e.no_reset),e.appium_url!==void 0&&(i.appium_url=e.appium_url);for(let d of c)e[d]!==void 0&&(i[d]=e[d]);return Object.keys(i).length>0?i:void 0}var y=class{constructor(e=b){this.path=e}exists(){return T(this.path)}load(){try{let e=C(this.path,"utf-8"),o=JSON.parse(e),t=R(o),{target:n,device:s,app:l,...a}=o;return{...f,...a,...t?{mobile:t}:{},code_export:{...f.code_export,...o.code_export??{}},generate:{...f.generate,...o.generate??{}}}}catch{return{...f,code_export:{...f.code_export},generate:{...f.generate}}}}write(e){try{x(S(this.path),{recursive:!0}),k(this.path,JSON.stringify(E(e),null,2)+`
|
|
3
|
+
`)}catch(o){let t=o instanceof Error?o.message:String(o);process.stderr.write(`[config] Failed to save config: ${t}
|
|
4
|
+
`)}}set(e,o){let t=this.load();t[e]=o,this.write(t)}save(e){this.write({...this.load(),...e})}getMobile(){return this.load().mobile??{}}setMobile(e){let o={...this.getMobile()};for(let t of Object.keys(e)){let n=e[t];n===void 0?delete o[t]:o[t]=n}this.set("mobile",Object.keys(o).length>0?o:void 0)}writeRaw(e){this.write(e)}};export{I as a,y as b};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{c as y,e as k}from"./chunk-KF4DKXSS.js";import{spawn as A}from"child_process";var S=new Set(["progress","ask_user","graph_query","ingest_request","proposal","design","error","done","reasoning_delta","reasoning_done","tool_activity","decision_activity","text_delta","usage","receipt","chat_ops","session_paused","session_complete","state_checkpoint","turn_retry"]),M=5e3,E=new Set(["done","session_paused","error"]);function R(u,t={}){let a=t.spawnCmd!==void 0?t.spawnCmd:y();if(!a)throw new Error("assurance agent not found \u2014 your platform package may be missing; reinstall kane-cli (npm i -g @testmuai/kane-cli)");let h=u.source.images?.length??0;a.tier==="dev-python"&&h>0&&t.onWarn?.("warn: development agent in use \u2014 if image citations are missing, update the agent package");let n=A(a.cmd,a.args,{stdio:["pipe","pipe","pipe"],env:k(u.session_id,t.auth)});if(n.stdin.on("error",e=>{e.code!=="EPIPE"&&t.onWarn?.(`agent stdin: ${e.message}`)}),n.stdin.write(JSON.stringify(u)+`
|
|
3
|
+
`),n.stdout.setEncoding("utf8"),n.stderr.setEncoding("utf8"),t.onStderr){let e="";n.stderr.on("data",r=>{e+=r;let i;for(;(i=e.indexOf(`
|
|
4
|
+
`))>=0;){let o=e.slice(0,i);e=e.slice(i+1),o.trim()&&t.onStderr(o)}})}let g=!1,d=new Promise(e=>{n.on("exit",(r,i)=>{g=!0,e({code:r,signal:i})})}),p=null,f=()=>(p??=(async()=>{if(g||n.pid===void 0)return;n.kill("SIGTERM");let e=setTimeout(()=>{g||n.kill("SIGKILL")},t.killGraceMs??M);e.unref?.(),await d,clearTimeout(e)})(),p),l,v=()=>{l===void 0&&(l=setTimeout(()=>{f()},t.killGraceMs??M),l.unref?.())};d.then(()=>clearTimeout(l));async function*w(){let e="",r=!1;for await(let i of n.stdout){e+=i;let o;for(;(o=e.indexOf(`
|
|
5
|
+
`))>=0;){let c=e.slice(0,o).trim();if(e=e.slice(o+1),!c)continue;let m;try{m=JSON.parse(c)}catch{t.onWarn?.(`agent: skipping malformed line: ${c.slice(0,120)}`);continue}let s=m;if(!s||typeof s!="object"||!S.has(s.type)){t.onWarn?.(`agent: skipping unknown event type "${s&&typeof s=="object"?String(s.type??"?"):"?"}"`);continue}if(E.has(s.type)&&v(),yield s,s.type==="done"){r=!0;break}}if(r)break}await d.catch(()=>{})}return{events:w(),send:e=>{n.stdin&&!n.stdin.destroyed&&n.stdin.write(JSON.stringify(e)+`
|
|
6
|
+
`)},kill:f,exited:d,...n.pid!==void 0?{pid:n.pid}:{}}}export{M as a,R as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{b as Q,c as Z,d as ee,e as fe,f as de}from"./chunk-NDEI7R4K.js";import{a as ge}from"./chunk-2NFS4KE4.js";import{d as le}from"./chunk-UALJTPSA.js";import{a as ue}from"./chunk-BVO4C5F2.js";import{b as ae}from"./chunk-LRXBJTD4.js";import{a as R,b as E,d as ce}from"./chunk-VE3SUJMA.js";import{c as N}from"./chunk-UAWWLLTI.js";import{d as ne}from"./chunk-Y6Y6RAY4.js";import{b as re,c as ie}from"./chunk-ENL4XTQ2.js";import{b as se}from"./chunk-IBBD36FQ.js";import{d as M}from"./chunk-C6HI6Y3S.js";import{b as oe}from"./chunk-TZXXJWHA.js";import{i as te}from"./chunk-Z7S3IWUX.js";import{r as w}from"./chunk-NC7D7GOM.js";import{a as B}from"./chunk-MGNRNLBE.js";import{a as T,c as W,e as I}from"./chunk-2XW33VOK.js";import{f as z,g as H}from"./chunk-A7RJQJNT.js";import{a as Y}from"./chunk-XBEYWXPV.js";import{a as J}from"./chunk-HCBYKLMW.js";import{a as c,b as u,i as O,j as q}from"./chunk-33DWJV67.js";import{a as ye}from"./chunk-6YGTRKDT.js";import{e as F}from"./chunk-UR6MHSHU.js";var s=F(ye(),1);var r=F(J(),1);function Ae(f){return f.mode==="login"?f.authOnly?"done":"ensure-project":f.complete?"done":f.hasProject?"ensure-folder":"ensure-project"}function Je({resultRef:f,mode:p="singleshot",loginCompleteRef:d,authOnly:A=!1}){let{exit:h}=q(),k=(0,s.useRef)(new Y),P=(0,s.useRef)(new ae),g=(0,s.useRef)(new le),o=k.current,a=P.current,U=g.current,pe=Q(),[x,m]=(0,s.useState)(p==="login"?"login":"gate"),[X,me]=(0,s.useState)(null),[we,$]=(0,s.useState)(null),[Ee,L]=(0,s.useState)(null),[G,ve]=(0,s.useState)(null),[K,S]=(0,s.useState)([]),b=(0,s.useCallback)((e,t,i,n)=>U.log(e,t,i,n),[U]),ke=(0,s.useCallback)((e,t)=>{e?R(o,a,e,t):a.save({project_id:null,project_name:null,folder_id:null,folder_name:null})},[o,a]),C=(0,s.useCallback)(()=>{if(p==="login")d&&(d.current=!0),h();else{let e=a.load().mobile,t=T(e?.tui_target,e?.default_target?.kind),i=t.kind==="unset"||t.kind==="choose-mobile"&&oe();m(i?"target":"input")}},[p,h,d,a]),_=(0,s.useCallback)((e,t)=>{let i=R(o,a,e,t),n=Ae({mode:p,authOnly:A,hasProject:!!i.projectId,complete:ce(i)});n==="done"?C():m(n)},[o,a,C,p,A]);O((e,t)=>{t.ctrl&&e==="c"&&w(0,"Ctrl+C exit")});let V=(0,s.useRef)(!1);s.default.useEffect(()=>{V.current||(V.current=!0,p!=="login"&&de(o,b).then(e=>{me(e),e.status==="authenticated"?_(e.result.profile,e.result.env):e.status==="needs_pick"?m("pick"):($(e.profile??null),L(e.env??null),m("login"))}).catch(e=>{ve(`Auth check failed: ${e instanceof Error?e.message:String(e)}`)}))},[o,b]);let he=(0,s.useCallback)(e=>{f.current={objective:e},h()},[f,h]),Pe=(0,s.useCallback)(async(e,t)=>{o.setActiveProfile(e),o.setDefaultEnv(t),(await fe(o,e,t,b)).status==="authenticated"?_(e,t):($(e),L(t),m("login"))},[o,b,_]),j=(0,s.useCallback)(()=>{let e=o.getActiveProfile(),t=o.getDefaultEnv();if(!e)return null;let i=B(t),n=o.loadBasicAuth(e,t);return new ue(i.controllerBaseUrl,async()=>o.loadCredentials(e,t)?.access_token??null,n,b)},[o,b]),xe=(0,s.useCallback)(async()=>{let e=j();if(!e)return null;let t=e.cached??await e.resolve();if(!t)return null;let i=B(o.getDefaultEnv()),n=new M(i.tmsBaseUrl,t.username,t.access_key);try{let v=(await n.listProjects()).find(D=>D.name==="KaneAI Generated");if(v)return{id:v.project_id,name:v.name};let y=await n.createProject("KaneAI Generated");return{id:y.id,name:y.name}}catch{return null}},[j,o]),be=(0,s.useCallback)(async e=>{let t=j();if(!t)return null;let i=t.cached??await t.resolve();if(!i)return null;let n=B(o.getDefaultEnv()),l=new M(n.tmsBaseUrl,i.username,i.access_key);try{let y=(await l.listFolders(e)).find(je=>je.name==="Untitled");if(y)return{id:y.id,name:y.name};let D=await l.createFolder(e,"Untitled");return{id:D.id,name:D.name}}catch{return null}},[j,o]);if(x==="gate")return(0,r.jsx)(c,{paddingX:1,children:(0,r.jsx)(u,{color:"yellow",children:"Checking authentication..."})});if(G)return(0,r.jsxs)(c,{flexDirection:"column",paddingX:1,children:[(0,r.jsx)(u,{color:"red",children:G}),(0,r.jsx)(u,{color:"gray",children:"Press Ctrl+C to exit."})]});if(x==="pick"&&X?.status==="needs_pick")return(0,r.jsx)(Ce,{profiles:X.profiles,onSelect:Pe});if(x==="login")return(0,r.jsx)(ee,{devMode:process.env.KANE_DEV_MODE==="1",profiles:o.listProfiles(),onBasicLogin:async(e,t,i,n)=>{let{validateBasicAuth:l}=await import("./validate-basic-RE2WLIGQ.js");await l(t,i,n),o.saveBasicAuth(e,t,{username:i,access_key:n}),o.setActiveProfile(e),o.setDefaultEnv(t)},onOAuthLogin:async(e,t)=>{let{LoginFlow:i}=await import("./login-flow-2FZEOVHM.js");o.setDefaultEnv(t),o.setActiveProfile(e),await new i(e,t,o).login()},onComplete:(e,t)=>{$(e),L(t),o.setActiveProfile(e),o.setDefaultEnv(t),_(e,t)},onCancel:()=>{w(0,"Login cancelled")}});if(x==="ensure-project"){let e=o.getActiveProfile()??"default",t=o.getDefaultEnv(),i=()=>{if(p==="login"){m("ensure-folder");return}R(o,a,e,t).folderId?C():m("ensure-folder")};return(0,r.jsxs)(c,{flexDirection:"column",children:[(0,r.jsx)(c,{paddingX:1,marginBottom:1,children:(0,r.jsx)(u,{color:"yellow",children:"Project & folder are required to save tests \xB7 Esc to use defaults \xB7 Ctrl+C to exit"})}),(0,r.jsx)(ie,{resolver:j(),currentProjectId:a.load().project_id,env:t,...re,onSelect:(n,l)=>{E(o,a,e,t,{projectId:n,projectName:l}),S(v=>[...v,`\u2713 Project: ${l} (${n})`]),i()},onCancel:async()=>{let n=await xe();n&&(E(o,a,e,t,{projectId:n.id,projectName:n.name}),S(l=>[...l,`\u2713 Default project: ${n.name} (${n.id})`]),i())}})]})}if(x==="ensure-folder"){let e=o.getActiveProfile()??"default",t=o.getDefaultEnv(),i=o.loadProfileConfig(e,t);return(0,r.jsxs)(c,{flexDirection:"column",children:[(0,r.jsx)(c,{paddingX:1,marginBottom:1,children:(0,r.jsx)(u,{color:"yellow",children:"Project & folder are required to save tests \xB7 Esc to use defaults \xB7 Ctrl+C to exit"})}),(0,r.jsx)(se,{resolver:j(),projectId:i?.project_id??"",currentFolderId:a.load().folder_id,env:t,onSelect:(n,l)=>{E(o,a,e,t,{folderId:n,folderName:l}),S(v=>[...v,`\u2713 Folder: ${l} (${n})`]),C()},onCancel:async()=>{if(!i?.project_id)return;let n=await be(i.project_id);n&&(E(o,a,e,t,{folderId:n.id,folderName:n.name}),S(l=>[...l,`\u2713 Default folder: ${n.name} (${n.id})`]),C())}})]})}if(x==="target"){let e=T(a.load().mobile?.tui_target,a.load().mobile?.default_target?.kind).kind==="choose-mobile";return(0,r.jsx)(c,{paddingX:1,children:(0,r.jsx)(ge,{mode:e?"legacy-mobile":"all",onSelect:t=>{a.setMobile({tui_target:t}),m("input")},onCancel:()=>m("input")})})}if(x==="input"){let e=a.load().mobile,t=T(e?.tui_target,e?.default_target?.kind),i=(()=>{if(H(t.kind)){let n=te(e?.default_target)??"(no device)",l=N(e?.default_app)??"(no app)";return`Config: ${I(t.kind)} \xB7 ${n} \xB7 ${l}`}if(z(t.kind)){let n=W(e,t.kind),l=N(n.app)??"(no app)";return`Config: ${I(t.kind)} \xB7 ${ne(n)} \xB7 ${l}`}return"Config: Desktop \xB7 Chrome"})();return(0,r.jsxs)(c,{flexDirection:"column",children:[K.length>0&&(0,r.jsx)(c,{flexDirection:"column",paddingX:1,marginBottom:1,children:K.map((n,l)=>(0,r.jsx)(u,{color:"green",children:n},l))}),(0,r.jsx)(c,{paddingX:1,children:(0,r.jsx)(u,{color:"gray",children:i})}),(0,r.jsx)(Z,{onSubmit:he,onEscape:()=>w(0,"User pressed Escape"),history:pe,placeholder:"Type an objective..."})]})}return(0,r.jsx)(r.Fragment,{})}function Ce({profiles:f,onSelect:p}){let[d,A]=(0,s.useState)(0),[h,k]=(0,s.useState)(!1);return O((P,g)=>{if(!h){if(g.escape){w(0,"Profile picker cancelled");return}if(g.upArrow&&d>0&&A(o=>o-1),g.downArrow&&d<f.length-1&&A(o=>o+1),g.return){k(!0);let o=f[d];p(o.profile,o.env).catch(()=>k(!1))}}}),(0,r.jsxs)(c,{flexDirection:"column",paddingX:1,children:[(0,r.jsx)(u,{color:"#ff9500",bold:!0,children:"Select a profile:"}),(0,r.jsx)(c,{marginTop:1,flexDirection:"column",children:f.map((P,g)=>(0,r.jsxs)(u,{children:[g===d?"\u276F ":" ",(0,r.jsx)(u,{color:g===d?"#ff9500":"white",bold:g===d,children:P.profile}),(0,r.jsxs)(u,{color:"gray",children:[" [",P.env,"]"]})]},`${P.profile}-${P.env}`))}),h&&(0,r.jsx)(c,{marginTop:1,children:(0,r.jsx)(u,{color:"yellow",children:"Validating credentials..."})})]})}export{Ae as a,Je as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{f as u,g as d}from"./chunk-KU3YHPWZ.js";function f(e,c){let n=new Set;for(let i of e.edgesInto(c)){if(i.type!==d.DERIVES||e.superseded.has(i.ecid))continue;let r=String(i.props.source_id),o=e.heads.get(r);typeof o=="string"&&e.mediaOf(o)?.plugin?.cites_deep===!0&&n.add(r)}return[...n].sort()}function g(e,c){let n=f(e,c);if(n.length===0)return{sources:n,missing:[]};let i=s=>!e.superseded.has(s),r=s=>e.edgesInto(s).some(t=>t.type===d.DERIVES&&!e.superseded.has(t.ecid)&&n.includes(String(t.props.source_id))),o=[];for(let s of e.edgesInto(c))if(!(s.type!==d.BELONGS_TO||e.superseded.has(s.ecid)||!i(s.src)||e.nodeLabel.get(s.src)!==u.SCENARIO)){r(s.src)||o.push(s.src);for(let t of e.edgesInto(s.src))t.type!==d.AUTOMATES||e.superseded.has(t.ecid)||!i(t.src)||r(t.src)||o.push(t.src)}return{sources:n,missing:o}}export{f as a,g as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{g as o,h as a}from"./chunk-
|
|
2
|
+
import{g as o,h as a}from"./chunk-N3TCNZSX.js";import{mkdirSync as p,writeFileSync as f,chmodSync as d,existsSync as m}from"fs";var y={darwin:"https://downloads.lambdatest.com/hyperexecute/darwin/hyperexecute",linux:"https://downloads.lambdatest.com/hyperexecute/linux/hyperexecute",win32:"https://downloads.lambdatest.com/hyperexecute/windows/hyperexecute.exe"};function h(s){let t=y[s];if(!t)throw new Error(`unsupported platform for hyperexecute: ${s}`);return t}async function g(s,t={}){let i=t.platform??process.platform,u=t.existsImpl??m,c=t.fetchImpl??(r=>fetch(r)),e=a(s);if(u(e))return{status:"present",path:e};try{let r=h(i),n=await c(r);if(!n.ok)return{status:"failed",path:e,error:`download failed: HTTP ${n.status}`};let l=Buffer.from(await n.arrayBuffer());return p(o(s),{recursive:!0}),f(e,l),d(e,493),{status:"downloaded",path:e}}catch(r){return{status:"failed",path:e,error:r instanceof Error?r.message:String(r)}}}export{h as a,g as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as n}from"./chunk-XBEYWXPV.js";import{x as s}from"./chunk-I6OQISK4.js";function E(t="prod",r=process.env){let e=s[t];return t!=="stage"?e:{authBaseUrl:r.KANE_STAGE_AUTH_URL??e.authBaseUrl,consentUrl:r.KANE_STAGE_CONSENT_URL??e.consentUrl,controllerBaseUrl:r.TESTMUAI_BASE_URL??e.controllerBaseUrl,tmsBaseUrl:r.KANE_STAGE_TMS_URL??e.tmsBaseUrl,testGeneratorBaseUrl:r.KANE_STAGE_TCG_URL??e.testGeneratorBaseUrl,secretsBaseUrl:r.KANE_STAGE_SECRETS_URL??e.secretsBaseUrl,testManagerUiUrl:r.KANE_STAGE_TEST_MANAGER_UI_URL??e.testManagerUiUrl,shareApiBaseUrl:r.KANE_STAGE_SHARE_API_URL??e.shareApiBaseUrl,v16ServerHost:r.KANE_STAGE_V16_SERVER_HOST??e.v16ServerHost,evidenceViewerUrl:r.KANE_STAGE_EVIDENCE_VIEWER_URL??e.evidenceViewerUrl,mediaArtefactsHost:r.KANE_STAGE_MEDIA_ARTEFACTS_HOST??e.mediaArtefactsHost,mobileAppBaseUrl:r.KANE_STAGE_MOBILE_APP_URL??e.mobileAppBaseUrl,mobileHubUrl:r.KANE_STAGE_MOBILE_HUB_URL??e.mobileHubUrl,lrmaaBaseUrl:r.KANE_STAGE_LRMAA_URL??e.lrmaaBaseUrl,latticeBaseUrl:r.KANE_LATTICE_URL??e.latticeBaseUrl,deviceStreamUrl:r.KANE_STAGE_DEVICE_STREAM_URL??e.deviceStreamUrl}}function U(){let t=process.env.TESTMUAI_ENV;return t!==void 0&&t!==""?t==="stage"?"stage":"prod":new n().getDefaultEnv()==="stage"?"stage":"prod"}function a(){let t=process.env.KANE_LATTICE_URL;return t!==void 0&&t.trim()===""?"":E(U()).latticeBaseUrl.trim()}export{E as a,U as b,a as c};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{f as y,h as z,j as U}from"./chunk-JGRXMTME.js";import{b as N,c as O,e as S,f as D,j as T}from"./chunk-77ZZQJLX.js";import{a as Y}from"./chunk-JIRNI5TB.js";import{a as M}from"./chunk-UTM7D4PI.js";import{a as R}from"./chunk-FCD3NYOM.js";import{a as F}from"./chunk-B7ZX5HEN.js";import{a as A}from"./chunk-I6OQISK4.js";import{e as $}from"./chunk-UR6MHSHU.js";var C=$(Y(),1);import{existsSync as k,readFileSync as I,readdirSync as J,statSync as K}from"fs";import{dirname as H,isAbsolute as V,join as h,relative as P,resolve as Z,sep as _}from"path";import{createHash as q}from"crypto";var b="testmd-bundle.json",u=class extends Error{constructor(t){super(t),this.name="BundleUsageError"}},B=e=>e.split(_).join("/");function v(e){if(!k(e))return[];let t=[];for(let s of J(e).sort()){let r=h(e,s);K(r).isDirectory()?t.push(...v(r)):t.push(r)}return t}function G(e){let t=e.map(r=>H(r).split(_)),s=t[0];for(let r of t.slice(1)){let i=0;for(;i<s.length&&i<r.length&&s[i]===r[i];)i++;s=s.slice(0,i)}return s.join(_)||_}function Q(e){for(let t of e){let s=F(t,I(t,"utf8"));for(let r of s.steps)if(r.body.kind==="import_ref"&&V(r.body.path))throw new u(`bundle sync: absolute @import is not portable after unzip: ${t} step ${r.index} (@import ${r.body.path})`)}}function j(e,t={}){let s=Z(e),r=S(s),i=y(s);if(!i?.commit_id||!i?.test_id)throw new u(`bundle sync: ${s} is not authored \u2014 run \`kane-cli testmd run\` first (output-<stem>/.internal/meta.json needs commit_id + test_id)`);let l;try{l=U(s)}catch(n){throw n instanceof z?new u(`bundle sync: ${n.message}`):n}let a=[s];for(let n of l.steps)for(let c of n.trace.slice(1))a.includes(c.file)||a.push(c.file);Q(a);let o=[],d=[];for(let n of l.unitFiles){if(n.file===s)continue;let c=N(n.file);o.includes(c)||o.push(c),n.kind==="module"&&d.push(S(n.file))}let m=[...a],p=n=>{k(n)&&m.push(n)};p(O(s)),m.push(r),p(D(s)),m.push(...v(T(s)));for(let n of o)p(h(n,"Result.md")),m.push(...v(h(n,".internal","steps")));for(let n of d)p(n);let f=G(m);if(k(h(f,b)))throw new u(`bundle sync: a real file named ${b} exists at the zip root (${f}) \u2014 it would collide with the generated manifest`);let x=m.map(n=>{let c=n===r&&t.identityOverride?Buffer.from(JSON.stringify({...JSON.parse(I(n,"utf8")),commit_id:t.identityOverride.commit_id},null,2)+`
|
|
3
|
+
`):void 0,E=c??I(n);return{abs:n,rel:B(P(f,n)),sha256:q("sha256").update(E).digest("hex"),bytes:E.length,...c?{contents:c}:{}}}).sort((n,c)=>n.rel<c.rel?-1:1),w=B(P(f,s)),L={schema_version:2,entry:w,commit_id:t.identityOverride?.commit_id??i.commit_id,test_id:i.test_id,testcase_id:i.testcase_id??null,project_id:i.project_id??null,folder_id:i.folder_id??null,org_id:i.org_id??null,created_at:new Date().toISOString(),producer:{name:"kane-cli",version:A},files:x.map(n=>({path:n.rel,sha256:n.sha256,bytes:n.bytes})),units:l.unitFiles.filter(n=>n.file!==s).map(n=>({path:B(P(f,n.file)),kind:n.kind}))};return{zipRoot:f,entry:w,files:x,manifest:L}}var g=e=>e instanceof Error?e.message:String(e);function W(e){return new Promise((t,s)=>{let r=(0,C.default)("zip",{zlib:{level:6}}),i=[];r.on("data",l=>i.push(l)),r.on("error",s),r.on("end",()=>t(Buffer.concat(i))),r.append(JSON.stringify(e.manifest,null,2)+`
|
|
4
|
+
`,{name:b});for(let l of e.files)l.contents?r.append(l.contents,{name:l.rel}):r.file(l.abs,{name:l.rel});r.finalize()})}async function X(e){let{plan:t,controller:s,testId:r,sessionId:i,commitId:l}=e,a;try{a=await W(t)}catch(d){return{ok:!1,stage:"zip",error:g(d)}}let o;try{let d={key:"testmd",content_type:"application/zip",filename:`${l}-testmd.zip`},p=(await s.getPresignedUrls(r,i,[d])).urls?.testmd?.upload_url;if(!p)return{ok:!1,stage:"presign",error:"presign response missing testmd upload_url"};o=p}catch(d){return{ok:!1,stage:"presign",error:g(d)}}try{await M(o,a,"application/zip")}catch(d){return{ok:!1,stage:"upload",error:g(d)}}return{ok:!0,bytes:a.length}}async function ee(e){let t;try{t=j(e.sourcePath,{identityOverride:e.identityOverride})}catch(s){return s instanceof u?{ok:!1,stage:"collect",error:s.message}:{ok:!1,stage:"collect",error:g(s)}}return X({...e,plan:t})}function ge(e){return e.shouldUploadPipeline&&e.uploadSucceeded&&!!e.metaCommitId&&!!e.metaTestId}function te(e){return e.persisted?e.uploadSucceeded?e.local?"local":e.hasBasicAuth?!e.metaCommitId||!e.metaTestId?"not_authored":null:"no_auth":"upload_failed":"not_persisted"}async function ye(e){let t=e.recordedTestPath??null,s=t?y(t):null,r=te({persisted:!!t,uploadSucceeded:e.uploadSucceeded,local:e.local,hasBasicAuth:!!e.basicAuth,metaCommitId:s?.commit_id,metaTestId:s?.test_id});if(r)return e.log("info","BUNDLE_SYNC_SKIPPED","testmd bundle sync skipped",{reason:r,...t?{path:t}:{}}),{skipped:r};let i=s.commit_id,l=s.test_id,a=o=>{try{e.onAgentEvent?.(o)}catch{}};try{let o=await(e.syncFn??ee)({sourcePath:t,testId:l,sessionId:e.sessionId,commitId:i,controller:new R(e.controllerBaseUrl,{username:e.basicAuth.username,accessKey:e.basicAuth.access_key})});return o.ok?(e.log("info","BUNDLE_SYNC_OK","testmd bundle pushed",{commit_id:i,path:t,bytes:o.bytes}),a({type:"test_md_bundle_sync",status:"ok",commit_id:i,path:t,bytes:o.bytes})):(e.log("warn","BUNDLE_SYNC_FAILED","testmd bundle sync failed",{commit_id:i,path:t,stage:o.stage,error:o.error}),a({type:"test_md_bundle_sync",status:"failed",commit_id:i,path:t,stage:o.stage})),o}catch(o){let d=g(o);return e.log("warn","BUNDLE_SYNC_FAILED","testmd bundle sync threw",{commit_id:i,path:t,error:d}),a({type:"test_md_bundle_sync",status:"failed",commit_id:i,path:t,stage:"upload"}),{ok:!1,stage:"upload",error:d}}}export{j as a,W as b,X as c,ee as d,ge as e,te as f,ye as g};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{O as W,ka as D}from"./chunk-UEE3RZN4.js";import{h as B,k as j,m as L,o as E,q as P}from"./chunk-PUVMC4PX.js";import{existsSync as I,mkdirSync as H,readdirSync as J,readFileSync as A,renameSync as Q,writeFileSync as X}from"fs";import{join as _}from"path";var Y=new Set(["duplicate","unwritable"]),Z=/^sha256:[0-9a-f]{64}$/,tt=/^@import\s+(\S+)\s*$/;function et(e,n,o,u){if(u===null||!("superseded"in e)||!("nodeLabel"in e))return!1;let r=e.resolve(n)?.tip;if(!r)return!1;for(let R of W(e,r)){let d=e.getNode(R)?.content;if(d?.definitionId===o&&typeof d.test_md_blob=="string")return P(e,d.test_md_blob)===u}return!1}function T(e,n){let o=e.resolve(n),u=o?String(e.getNode(o.tip)?.content.title??""):"";return u&&D(u,()=>!1)||n}function nt(e){return _(e,".testmuai","tests")}function rt(e){let n=new Map;if(!I(e))return n;for(let o of J(e)){if(!o.endsWith("_test.md"))continue;let u=_(e,o);try{let r=E(A(u,"utf8"))?.id;r&&n.set(r,[...n.get(r)??[],u])}catch{}}return n}function it(e,n,o){let u=`assurance:
|
|
3
|
+
id: ${n}
|
|
4
|
+
base: ${o}
|
|
5
|
+
`,r=e.endsWith(`
|
|
6
|
+
`)?e:e+`
|
|
7
|
+
`;return r.startsWith(`---
|
|
8
|
+
`)?`---
|
|
9
|
+
${u}${r.slice(4)}`:r.startsWith(`---\r
|
|
10
|
+
`)?`---\r
|
|
11
|
+
${u.replace(/\n/g,`\r
|
|
12
|
+
`)}${r.slice(5)}`:`---
|
|
13
|
+
${u}---
|
|
14
|
+
${r}`}function C(e,n){let o=`${e}.tmp-mint`;X(o,n),Q(o,e)}function dt(e){let{graph:n,cids:o,cwd:u}=e,r=nt(u),R=[],d=[],N=[],U=[],V=e.overwriteEdited===!0&&e.refuseUnwritable===!0,O=t=>{let f=n.resolve(t),l=f?n.getNode(f.tip)?.content.title:void 0;return typeof l=="string"&&l!==""?l:null},w=new Map,S=new Map,p=(t,f,l,g,y,m)=>{e.refuseUnwritable&&w.has(t)||(w.set(t,g??f),d.push({id:t,reason:l,kind:f,title:O(t),...g?{via:g}:{},...y?{imports:y}:{},...m?{file:m}:{}}))},b=rt(r),x=new Set,F=(t,f)=>{if(e.refuseUnwritable&&S.has(t))return S.get(t);if(e.refuseUnwritable&&w.has(t))return null;let l=b.get(t);if(l&&l.length>1)return p(t,"duplicate",`two files claim assurance.id ${t}: ${l.join(" \xB7 ")} \u2014 resolve the duplicate first`),null;if(x.has(t))return G(t);if(f.includes(t))return G(t)??`${T(n,t)}_test.md`;let g=n.resolve(t),y=g?n.getNode(g.tip):void 0,m=y?.content.test_md_blob,K=y?.content.definitionId;if(!m||!K)return p(t,"unresolved",`${t} has no test definition in the graph`),null;if(Z.test(m.trim()))return p(t,"unreadable","its text is held where this kane-cli can't read it"),null;let v=[],q=m.split(`
|
|
15
|
+
`).map(s=>{let a=tt.exec(s.trim());if(!a)return s;let c=a[1];if(!n.resolve(c))return s;let h=F(c,[...f,t]);if(!h&&!e.refuseUnwritable)throw new $(`dependency ${c} could not be minted/located`,w.get(c));return h?`@import ./${h}`:(v.push(c),s)});if(v.length>0){let s=v.map(a=>w.get(a));throw new $(`dependency ${v.join(", ")} could not be minted/located`,s.find(a=>a!==void 0&&!Y.has(a))??s[0],v.map(O))}let z=q.join(`
|
|
16
|
+
`),k=it(z,t,K),i=l?.[0];if(i){let s=A(i,"utf8"),a=E(s)?.base,c;try{c=B(j(s,L(r,n)))}catch(M){if(!e.refuseUnwritable)throw M;c=null}let h=!a||c!==a&&!et(n,t,a,c);if(h&&V){try{C(i,k)}catch(M){return p(t,"unwritable",M instanceof Error?M.message:String(M)),null}return x.add(t),b.set(t,[i]),U.push({id:t,path:i}),i.split("/").pop()}if(h)return p(t,"edited",`${i} was edited since the engine last wrote it \u2014 keeping yours (reconcile via a run or maintain)`,void 0,void 0,i),e.refuseUnwritable?(S.set(t,i.split("/").pop()),S.get(t)):null}else{let s=T(n,t),a=_(r,`${s}_test.md`);for(let c=2;I(a);c++)a=_(r,`${s}-${c}_test.md`);i=a}if(e.skipSame&&I(i)&&A(i,"utf8")===k)return x.add(t),b.set(t,[i]),N.push({id:t,path:i}),i.split("/").pop();try{H(r,{recursive:!0}),C(i,k)}catch(s){if(!e.refuseUnwritable)throw s;return p(t,"unwritable",s instanceof Error?s.message:String(s)),null}return x.add(t),b.set(t,[i]),R.push({id:t,path:i}),i.split("/").pop()},G=t=>b.get(t)?.[0]?.split("/").pop()??null;for(let t of o){let f=n.nameOf.get(t);if(!f){d.push({id:t,reason:"minted test has no logical id",kind:"unresolved",title:null});continue}try{F(f,[])}catch(l){if(l instanceof $)p(f,"import",l.message,l.via,l.imports);else throw l}}return{wrote:R,refused:d,...e.skipSame?{unchanged:N}:{},...e.overwriteEdited?{overwrote:U}:{}}}var $=class extends Error{constructor(o,u,r){super(o);this.via=u;this.imports=r}};export{T as a,nt as b,rt as c,dt as d};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{g as l}from"./chunk-4I7YN6YY.js";import{existsSync as u,readdirSync as d,readFileSync as f}from"fs";import{join as o}from"path";var m="--variables",g=["global","smart","environment","secrets","totp"],p=/^[a-z][a-z0-9_]*$/;function x(r){return typeof r=="string"?r.trim().length>0:typeof r=="number"&&Number.isFinite(r)}function a(r,e,n){let t=JSON.parse(r);if(!(!t||typeof t!="object")){for(let[i,s]of Object.entries(t))if(s&&typeof s=="object"&&"value"in s){let b={has_value:x(s.value),source:e};n.set(y(i),b)}}}function c(r,e){if(!u(r))return;let n;try{n=d(r).filter(t=>t.endsWith(".json")).sort()}catch{return}for(let t of n){let i=o(r,t);try{a(f(i,"utf-8"),i,e)}catch{}}}function w(r){return{globalDir:o(l().baseDir,"variables"),localDir:o(r,".testmuai","variables")}}function I(r){let e=new Map;if(c(r.globalDir,e),c(r.localDir,e),r.file&&u(r.file))try{a(f(r.file,"utf-8"),r.file,e)}catch{}if(r.inline)try{a(r.inline,m,e)}catch{}return e}function N(r){let e=r.trim();if(!e)return null;let n=e.split(/[.[]/).map(t=>t.trim()).filter(Boolean);return n.length===0||g.includes(n[0])?null:n[0]}function y(r){let e=/^(?:global|secrets\.user|environment)\.(.+)$/.exec(r);return e?e[1]:r}function V(r){if(!r||!r.trim())return"variable name is empty";let e=r.split(".")[0];return g.includes(e)?`'${r}' starts with a runtime namespace (global/secrets/smart/environment/totp) \u2014 declare the bare name`:p.test(r)?null:`'${r}' is not lower_snake_case (letters, digits, underscores; starts with a letter)`}export{m as a,w as b,I as c,N as d,y as e,V as f};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as B}from"./chunk-RG372DON.js";import{a as N}from"./chunk-AA674WLL.js";import{a as ie,b as ae,c as ce}from"./chunk-W3USRQX6.js";import{a as H}from"./chunk-WI7K6VKQ.js";import{d as le}from"./chunk-MII3JOO3.js";import{a as $,b as X,e as M,g as se}from"./chunk-77ZZQJLX.js";import{b as oe}from"./chunk-L4UVUFL6.js";import{b as L}from"./chunk-LRXBJTD4.js";import{a as te}from"./chunk-HFJSP4KD.js";import{a as ee}from"./chunk-FCD3NYOM.js";import{a as j}from"./chunk-XZYA7DNH.js";import{a as re,b as ne}from"./chunk-B7ZX5HEN.js";import{a as K}from"./chunk-MGNRNLBE.js";import{a as A}from"./chunk-RZ4F3BHX.js";import{a as O}from"./chunk-XBEYWXPV.js";import{a as F}from"./chunk-HCBYKLMW.js";import{a as b,b as p,i as Z}from"./chunk-33DWJV67.js";import{a as q}from"./chunk-6YGTRKDT.js";import{y}from"./chunk-I6OQISK4.js";import{e as S}from"./chunk-UR6MHSHU.js";var D=S(q(),1);import{existsSync as P,readFileSync as Ye,rmSync as we,unlinkSync as ze}from"fs";import{resolve as Q}from"path";import{promises as ue,realpathSync as Re}from"fs";import{homedir as Pe}from"os";import{join as V,parse as Me,relative as de,resolve as fe}from"path";var me=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 ge(e){try{return Re(fe(e))}catch{return fe(e)}}function De(e){let r=ge(e),s=ge(Pe()),n=Me(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(De(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,a=!1,u,c=[e.root];for(;c.length>0&&!a;){let l=c.shift(),g;try{g=await ue.readdir(l,{withFileTypes:!0})}catch{continue}i++;for(let _ of g){if(t++,t>r){a=!0,u="max_entries";break}let m=_.name,T=V(l,m);if(_.isDirectory()){if(me.has(m)||m.startsWith(".")||m.startsWith("output-")||n.has(m))continue;c.push(T)}else if(_.isFile()&&m.endsWith("_test.md")&&(o.push({path:T,relPath:de(e.root,T),source:"cwd"}),o.length>=s)){a=!0,u="max_results";break}}e.onProgress?.(i,o.length)}if(!a){let g=[{dir:V(e.root,".testmuai","tests"),depth:0}];for(;g.length>0&&!a;){let{dir:_,depth:m}=g.shift(),T;try{T=await ue.readdir(_,{withFileTypes:!0})}catch{continue}i++;for(let d of T){if(t++,t>r){a=!0,u="max_entries";break}let k=d.name,w=V(_,k);if(d.isDirectory()){if(m>=20||k.startsWith(".")||k.startsWith("output-")||me.has(k))continue;g.push({dir:w,depth:m+1})}else if(d.isFile()&&k.endsWith("_test.md")&&(o.push({path:w,relPath:de(e.root,w),source:"tests-dir"}),o.length>=s)){a=!0,u="max_results";break}}}}return{results:o,aborted:a,abortReason:u,dirsScanned:i}}import{readFileSync as Ce}from"fs";function Y(e){let r;try{r=Ce(e,"utf8")}catch{return{tags:[]}}try{let{global:s}=re(e,r),n=ne(s);return{tags:s.tags??[],...n?{mobileTarget:n}:{}}}catch{let s=$e(r);return{tags:[],...s?{mobileTarget:s}:{}}}}var pe={platform:"",app:""};function $e(e){let r=/^---\r?\n([\s\S]*?)\r?\n---/.exec(e);if(!r)return;let s=r[1].split(/\r?\n/);for(let o of s){let t=/^target:\s*['"]?(emulator|simulator|android|ios)['"]?\s*$/.exec(o);if(t)return t[1]==="android"||t[1]==="ios"?{platform:t[1],app:"",realDevice:!0}:pe}let n=s.findIndex(o=>/^target:\s*$/.test(o));if(!(n<0))return s.slice(n+1).some(o=>/^\s+\S/.test(o))?pe:void 0}function W(e){return Y(e).tags}import{mkdirSync as Ie,writeFileSync as Fe}from"fs";import{join as Oe}from"path";function he(e,r){return`Basic ${Buffer.from(`${e}:${r}`).toString("base64")}`}async function Ae(e){let r=ae({tmsBaseUrl:e.tmsBaseUrl,testcaseId:e.testcaseId,codeExport:{enabled:!0,language:e.language,skipValidation:e.skipValidation},mobile:e.framework==="appium"}),s=await A(r.url,{method:"POST",headers:{"content-type":"application/json",authorization:he(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 Le(e){let r=ce({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:he(e.auth.username,e.auth.access_key),accept:"application/json"}});if(!t.ok){await new Promise(c=>setTimeout(c,s));continue}let a=(await t.json()).data?.find(c=>c.code_name==="kane-cli-trigger");if(!a){await new Promise(c=>setTimeout(c,s));continue}let u=(a.status??"").toLowerCase();if(u==="in progress"||u==="in_progress"||u==="pending"){await new Promise(c=>setTimeout(c,s));continue}if(!a.url||a.url.length===0)throw new Error(`code-export status=${a.status} but no files returned`);Ie(e.outDir,{recursive:!0});for(let c of a.url){let l=Oe(e.outDir,c.file_name),g=await A(c.file_url);if(!g.ok){e.log("warn","CODE_EXPORT_FILE_FAILED","Failed to download file",{file_name:c.file_name,status:g.status});continue}let _=await g.text();Fe(l,_,"utf-8")}return e.log("info","CODE_EXPORT_DOWNLOADED","Code export saved",{out_dir:e.outDir,file_count:a.url.length}),e.outDir}throw new Error("code-export polling timed out")}async function _e(e){return await Ae(e),await Le(e)}var E=S(q(),1);import{existsSync as je,readFileSync as Be}from"fs";var h=S(F(),1);function Ne(e){B(e);let r=M(e);if(!je(r))return null;try{return JSON.parse(Be(r,"utf8"))}catch{return{}}}function Ue(e){return e===null?"never_run":e.testcase_id?"synced":"local_only"}function We(e){return e==="synced"?"\u2601":e==="local_only"?"\u25A3":"\u25CB"}function Je(e){return e==="tests-dir"?"\u2726":" "}function Ge(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 qe(e){let r=z.indexOf(e);return z[(r+1)%z.length]}function ye({root:e,currentOrgId:r,onSelect:s,onCancel:n}){let[o,t]=(0,E.useState)([]),[i,a]=(0,E.useState)(null),[u,c]=(0,E.useState)(!0),[l,g]=(0,E.useState)("all");(0,E.useEffect)(()=>{(async()=>{try{let d=await U({root:e}),k=[];for(let w of d.results){let G=Ne(w.path);G?.org_id!==void 0&&G.org_id!==r||k.push({path:w.path,relPath:w.relPath,name:$(w.path),status:Ue(G),source:w.source,tags:W(w.path)})}t(k),c(!1)}catch(d){d instanceof R,a(d.message),c(!1)}})()},[e,r]);let _=(0,E.useMemo)(()=>o.filter(d=>Ge(d,l)).map(d=>({id:d.path,label:`${We(d.status)} ${Je(d.source)} ${d.relPath}${d.tags.length>0?` [${d.tags.join(", ")}]`:""}`})),[o,l]),m=(0,E.useMemo)(()=>Xe(l,o),[l,o]);if(i)return(0,h.jsxs)(b,{flexDirection:"column",borderStyle:"round",borderColor:y.red,paddingX:2,paddingY:1,children:[(0,h.jsx)(p,{color:y.red,bold:!0,children:"testmd"}),(0,h.jsx)(b,{marginTop:1,children:(0,h.jsx)(p,{color:y.red,children:i})})]});let T=l==="all"?"all":Ke(l);return(0,h.jsx)(te,{title:`testmd \xB7 filter: ${T}`,items:_,loading:u,itemNoun:"tests",onSelect:d=>{let k=o.find(w=>w.path===d.id);k&&s(k)},onCancel:n,onTab:()=>g(d=>qe(d)),extraHint:"cycle filter",footer:m})}function Ke(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 Xe(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?y.orange:y.dim;return(0,h.jsxs)(b,{flexDirection:"column",children:[(0,h.jsx)(p,{color:y.dim,children:"legend:"}),(0,h.jsxs)(b,{children:[(0,h.jsx)(p,{color:n(e==="synced"),children:` \u2601 synced (${s.synced}) `}),(0,h.jsx)(p,{color:n(e==="local"),children:`\u25A3 local (${s.local}) `}),(0,h.jsx)(p,{color:n(e==="never_run"),children:`\u25CB never run (${s.never})`})]}),(0,h.jsxs)(b,{children:[(0,h.jsx)(p,{color:n(e==="cli"),children:` \u2726 cli-generated (${s.cli}) `}),(0,h.jsx)(p,{color:n(e==="hand"),children:` hand-written (${s.hand})`})]})]})}var I=S(q(),1);import{existsSync as He,readFileSync as Ve}from"fs";var f=S(F(),1);function xe({path:e,relPath:r,onAction:s,onBack:n,onView:o}){let[t,i]=(0,I.useState)(null),[a,u]=(0,I.useState)(!1);(0,I.useEffect)(()=>{let l=M(e);if(He(l))try{i(JSON.parse(Ve(l,"utf8")))}catch{i(null)}},[e]),Z((l,g)=>{if(g.escape){if(a){u(!1);return}n();return}if(a){l==="y"||l==="Y"?(u(!1),s("delete")):(l==="n"||l==="N")&&u(!1);return}l==="r"&&s("run"),l==="e"&&t?.testcase_id&&s("export"),l==="d"&&u(!0),l==="v"&&o&&o()});let c=({k:l,v:g})=>g?(0,f.jsxs)(p,{children:[(0,f.jsx)(p,{color:y.dim,children:l.padEnd(14)}),g]}):null;return(0,f.jsxs)(b,{flexDirection:"column",borderStyle:"round",borderColor:y.orange,paddingX:2,paddingY:1,children:[(0,f.jsx)(p,{color:y.orange,bold:!0,children:r}),(0,f.jsx)(b,{marginTop:1,flexDirection:"column",children:t?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(c,{k:"test_id",v:t.test_id}),(0,f.jsx)(c,{k:"testcase_id",v:t.testcase_id}),(0,f.jsx)(c,{k:"project_id",v:t.project_id}),(0,f.jsx)(c,{k:"folder_id",v:t.folder_id}),(0,f.jsx)(c,{k:"org_id",v:t.org_id}),(0,f.jsx)(c,{k:"session_name",v:t.session_name}),(0,f.jsx)(c,{k:"commit_id",v:t.commit_id})]}):(0,f.jsx)(p,{color:y.dim,children:"(never run \u2014 no meta.json)"})}),a?(0,f.jsx)(b,{marginTop:1,children:(0,f.jsxs)(p,{color:y.red,bold:!0,children:["Delete ",r," and its output dir? [y/n]"]})}):(0,f.jsx)(b,{marginTop:1,children:(0,f.jsxs)(p,{color:y.dim,children:["[r] run [e] export",t?.testcase_id?"":" (need testcase_id)"," [d] delete",o?" [v] view":""," [Esc] back"]})})]})}function C(e){B(e);let r=M(e);if(!P(r))return null;try{return JSON.parse(Ye(r,"utf8"))}catch{return null}}function ke(e,r){return!e||e.org_id===void 0?!0:e.org_id===r}function J(e,r){return ke(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)}function be(){return oe(process.cwd()).kind==="remote"?{authOnly:!0}:{}}async function zt(e={}){let r=!!process.stdin.isTTY&&!e.json,s=new O,n=new L;await H({isInteractive:r,creds:s,config:n,...be()});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 Qt(e,r){if(process.stdin.isTTY&&!e.json)return await et(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=C(o.path);if(!ke(t,r))continue;let i={path:o.relPath.startsWith(".")?o.relPath:`./${o.relPath}`,name:$(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 Te=-1001,Ee=-1002,ve=-1003,x={action:null,path:null};function Qe(e,r){return x.action=e,x.path=r,e==="run"?Te:e==="export"?Ee:ve}function Ze({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(ye,{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(xe,{path:n.path,relPath:n.relPath,onAction:async t=>{o({kind:"exiting",code:Qe(t,n.path)})},onBack:()=>o({kind:"list"})}):null}async function et(e,r){let s=r??process.cwd(),{render:n}=await import("./build-5ZN47FAT.js"),o=await new Promise(t=>{let{unmount:i,waitUntilExit:a}=n(D.default.createElement(Ze,{root:s,currentOrgId:e,onComplete:u=>{i(),t(u)}}),{stdout:process.stderr,exitOnCtrlC:!0});a().then(()=>t(0)).catch(()=>t(0))});if(o===Te&&x.path){let{runTestMdFile:t}=await import("./run-test-md-HE6DUWQR.js"),i=await t(x.path,{});return x.action=null,x.path=null,i}if(o===Ee&&x.path){let t=await rt(x.path,{},e);return x.action=null,x.path=null,t}if(o===ve&&x.path){let t=await tt(x.path,!0,e);return x.action=null,x.path=null,t}return o}async function Zt(e,r){let s=Q(e);if(!P(s))return process.stderr.write(`error: file not found: ${s}
|
|
8
|
+
`),2;let n=C(s),o=J(n,r);if(o!==null)return o;let t={path:s,name:$(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 tt(e,r,s){let n=Q(e);if(!P(n))return process.stderr.write(`error: file not found: ${n}
|
|
10
|
+
`),2;let o=C(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 '${X(n)}/'.
|
|
12
|
+
`),2;let i=X(n);if(P(i))try{we(i,{recursive:!0,force:!0})}catch(a){return process.stderr.write(`error: failed to remove ${i}: ${a.message}
|
|
13
|
+
`),2}try{ze(n)}catch(a){return process.stderr.write(`error: failed to remove ${n}: ${a.message}
|
|
14
|
+
`),2}return process.stderr.write(`removed ${n} and ${i}/
|
|
15
|
+
`),0}var v=class extends Error{kind;constructor(r,s){super(s),this.name="ExportError",this.kind=r}};async function er(e,r){let{codeDir:s}=await Se(e,r);return{codeDir:s}}async function Se(e,r){let s=C(e);if(!s?.testcase_id)throw new v("not-synced","this test has not been synced to TMS \u2014 run `kane-cli testmd run` first.");let n=new L().load(),o=Y(e).mobileTarget!==void 0;if(o&&r.language?.toLowerCase()==="javascript")throw new v("js-on-mobile","--language javascript is not supported on a mobile target \u2014 mobile code export is Appium + Python only. Drop the flag, or pass --language python.");let t=r.language??n.code_export?.language;if(!o&&!t)throw new v("no-language","--language not provided and no default in tui-config.");let{framework:i,language:a}=ie(t??"python",o),u=r.output??se(e,i,a),c=P(u);if(c&&!r.force){let m=!1;try{let{readdirSync:T}=await import("fs");m=T(u).length>0}catch{}if(m)return{kind:"reused",codeDir:u}}c&&r.force&&we(u,{recursive:!0,force:!0});let l=new O,g=r.env??l.getDefaultEnv()??"prod",_;try{_=await N({creds:l,env:g,log:()=>{}})}catch(m){throw m instanceof j?new v("auth-fail","not authenticated. Run `kane-cli login` first."):m}if(!_.basicAuth)throw new v("auth-incomplete","TMS basic auth could not be resolved. Run `kane-cli login` again.");try{let m=K(g);await _e({tmsBaseUrl:m.tmsBaseUrl,testcaseId:s.testcase_id,auth:_.basicAuth,language:a,framework:i,skipValidation:n.code_export?.skip_validation??!0,outDir:u,log:()=>{}})}catch(m){throw new v("export-fail",`code export failed: ${m.message}`)}return{kind:"exported",codeDir:u}}async function rt(e,r,s){let n=Q(e);if(!P(n))return process.stderr.write(`error: file not found: ${n}
|
|
16
|
+
`),2;let o=C(n),t=J(o,s);if(t!==null)return t;try{let i=await Se(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 v)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==="js-on-mobile"?(process.stderr.write(`error: ${i.message}
|
|
20
|
+
`),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}
|
|
21
|
+
`),2);throw i}}async function tr(e={}){let r=!!process.stdin.isTTY,s=new O,n=new L;await H({isInteractive:r,creds:s,config:n,...be()});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:K(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 rr(e,r,s=le){if(!P(e))return process.stderr.write(`error: file not found: ${e}
|
|
22
|
+
`),2;if(!e.endsWith("_test.md"))return process.stderr.write(`error: not a *_test.md file: ${e}
|
|
23
|
+
`),2;let n=C(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.
|
|
24
|
+
`),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)+`
|
|
25
|
+
`),t.ok?(process.stderr.write(`synced: ${n.commit_id}-testmd.zip (${t.bytes} bytes)
|
|
26
|
+
`),0):(process.stderr.write(`error: bundle sync failed at ${t.stage}: ${t.error}
|
|
27
|
+
`),t.stage==="collect"?2:1)}export{U as a,Y as b,ye as c,xe as d,C as e,ke as f,J as g,zt as h,Qt as i,et as j,Zt as k,tt as l,v as m,er as n,rt as o,tr as p,rr as q};
|
|
@@ -1,2 +1,2 @@
|
|
|
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-I6OQISK4.js";import{join as i}from"path";function e(n=t){return i(n,"plugins")}function g(n,r=t){return i(e(r),n)}function c(n,r,o=t){return i(g(n,o),r)}function f(n,r=t){return i(g(n,r),"current")}function x(n,r=t){return i(g(n,r),"config.json")}function l(n,r=t){return i(g(n,r),".jobs")}function s(n=t){return i(n,"bin")}function h(n=t){return i(s(n),"hyperexecute")}export{e as a,g as b,c,f as d,x as e,l as f,s as g,h};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{e as R}from"./chunk-ZCRZFAOT.js";import{a as O}from"./chunk-RZ4F3BHX.js";var C={ASR_CMD_START:"info",ASR_CMD_END:"info",ASR_AGENT_SPAWN:"info",ASR_WORK_ITEM_START:"info",ASR_WORK_ITEM_END:"info",ASR_PROPOSAL:"info",ASR_VALIDATE_FAILED:"warn",ASR_COMMIT:"info",ASR_SESSION_PAUSED:"info",ASR_SESSION_RESUMED:"info",ASR_SESSION_COMPLETE:"info",ASR_AGENT_EXIT:"warn",ASR_RECONCILE_PLAN:"info",ASR_RECONCILE_ROW_END:"info",ASR_HIGH_RISK_CI:"warn",ASR_INGEST:"info",ASR_EMBED_DEGRADED:"warn",ASR_CONTEXT_CLONED:"warn",ASR_ERROR:"error",ASR_CRASH:"error",ASR_FSCK_REPORT:"warn"},L={ASR_CMD_START:["source_count","resumed","applied_plan"],ASR_CMD_END:["exit_code","duration_ms","credits_total","work_items_total","work_items_failed"],ASR_AGENT_SPAWN:["tier","duration_ms"],ASR_WORK_ITEM_START:["work_item_index","work_item_count","source_kind"],ASR_WORK_ITEM_END:["work_item_index","work_item_count","outcome","duration_ms","error_domain","error_code"],ASR_PROPOSAL:["item_count","turn_index"],ASR_VALIDATE_FAILED:["error_code","count","turn_index"],ASR_COMMIT:["trusted","derived","archived","items","items_dropped","record_seq","phase","duration_ms"],ASR_SESSION_PAUSED:["pending_questions","pending_proposals"],ASR_SESSION_RESUMED:["resume_count","expired_session_id"],ASR_SESSION_COMPLETE:["duration_ms","credits_total"],ASR_AGENT_EXIT:["exit_code","signal"],ASR_RECONCILE_PLAN:["row_count","add_count","modify_count","archive_count"],ASR_RECONCILE_ROW_END:["row_index","kind","outcome","duration_ms"],ASR_HIGH_RISK_CI:["count"],ASR_INGEST:["work_item_index","work_item_count","format","bytes","media_facts"],ASR_EMBED_DEGRADED:["held"],ASR_CONTEXT_CLONED:[],ASR_ERROR:["error_domain","error_code","exit_code","turn_index","request_id"],ASR_CRASH:["error_domain","error_code","error_name"],ASR_FSCK_REPORT:["issue_count","records","pending","codes","issues","issues_truncated"]},U=[[/^lattice_/,"lattice"],[/^refused_/,"refused"],[/^(auth_expired|401|preflight_auth|AUTH)/i,"auth"],[/^(credit_denied|402|CREDIT)/i,"credit"],[/^(stream_drop|read_timeout|connect_failed|dns|E(CONN|AI_AGAIN|TIMEDOUT)|network)/i,"network"],[/^(frame_parse|post_terminal_data|eof_without_terminal|turn_id_mismatch|binding_mismatch|schema_invalid|frame_too_large|protocol)/i,"protocol"],[/^(provider_error|http_5\d\d|turn_exhausted|adapter_integrity)/i,"provider"],[/^(STALE_BASIS|R\d+|validation|criteria)/i,"validation"],[/^(CHAIN_ERROR|DERIVED_(MISSING|DRIFT)|NODE_FILE_(MISSING|MISMATCH|CORRUPT)|CARDINALITY_VIOLATION|SUPERSEDE_(UNKNOWN_(OLD|NEW|ECID)|CYCLE)|DOUBLE_SUPERSEDE|NAME_UNKNOWN_TARGET|EDGE_CYCLE|UNKNOWN_(LABEL|FIELD|EDGE_TYPE|EDGE_PROP)|BAD_(CHECK|ENUM)|MISSING_(FIELD|SALIENT)|ILLEGAL_EDGE)$/,"graph"],[/^(BLOB_MISSING|SOURCE_UNKNOWN|SESSION_(LOCKED|EXPIRED|MISSING|LOCK_LOST)|NO_STORE|fsck|store)/i,"store"],[/^(usage|EX2|SOURCE_WITH_RESUME|HIGH_RISK_CI|bad_flag|no_tty)/i,"usage"],[/^exit_\d+_unattributed$/,"unattributed"],[/^agent_(crash|exit)/i,"agent_crash"]];function v(e){let t=(e||"unknown").slice(0,64);for(let[n,r]of U)if(n.test(t))return{error_domain:r,error_code:t};return{error_domain:"cli_crash",error_code:t}}import{randomBytes as w}from"crypto";var b=/^(uc|sc|ac|t|gap|sty)-\d+$/,K="0123456789abcdefghijklmnopqrstuvwxyz";function W(e){let t="",n=w(e);for(let r=0;r<e;r++)t+=K[n[r]%36];return t}function se(e=new Date){let t=(r,o)=>String(r).padStart(o,"0");return`as-${`${e.getUTCFullYear()}${t(e.getUTCMonth()+1,2)}${t(e.getUTCDate(),2)}T${t(e.getUTCHours(),2)}${t(e.getUTCMinutes(),2)}`}-${W(8)}`}var M=-1,S=0;function ce(e=new Date){let t=e.getTime(),n=w(10);t===M?S=S+1&4095:(M=t,S=(n[0]<<8|n[1])&4095);let r=Buffer.alloc(16);r.writeUIntBE(t,0,6),r[6]=112|S>>8,r[7]=S&255,r[8]=128|n[2]&63,n.copy(r,9,3,10);let o=r.toString("hex");return`${o.slice(0,8)}-${o.slice(8,12)}-${o.slice(12,16)}-${o.slice(16,20)}-${o.slice(20)}`}var B=64,P=128,$=/^[A-Za-z0-9._:@\/-]+$/,j={codes:512},H={ASR_FSCK_REPORT:["issues"]},X=20480,V=0;function q(e,t){if(typeof t=="number"&&Number.isFinite(t)||typeof t=="boolean")return t;if(typeof t!="string")return;let n=e.endsWith("_id")||e==="signal"?P:j[e]??B;if(!(t.length===0||t.length>n)&&$.test(t))return t}var k=e=>e!==void 0&&e.length>0&&e.length<=P&&$.test(e);function F(e,t,n={}){let r=L[t],o={};for(let s of r){let i=n[s];if(i==null)continue;if(H[t]?.includes(s)){if(typeof i!="string"||i.length===0)continue;let _=i.replace(/[\u0000-\u001F\u007F]/g,"");if(Buffer.byteLength(_,"utf8")>X)continue;o[s]=_;continue}if(s==="items"){let _=Array.isArray(i)?i.filter(E=>typeof E=="string"):[],u=_.filter(E=>b.test(E));u.length>0&&(o.items=u.slice(0,50).join(","));let p=_.length-u.length;p>0&&(o.items_dropped=p);continue}let a=q(s,i);a!==void 0&&(o[s]=a)}if(typeof n.error_code=="string"&&r.includes("error_code")){let{error_domain:s,error_code:i}=v(n.error_code);o.error_code=i,r.includes("error_domain")&&(o.error_domain=s)}return{level:C[t],event:t,message:t,session_id:e.session_id,operation_id:e.operation_id,...e.parent_operation_id?{parent_operation_id:e.parent_operation_id}:{},...e.agent_session_id?{agent_session_id:e.agent_session_id}:{},context_lineage_id:e.context_lineage_id??null,context_instance_id:e.context_instance_id??null,...k(e.lattice_session_id)?{lattice_session_id:e.lattice_session_id}:{},...k(e.project_id)?{project_id:e.project_id}:{},verb:e.verb,mode:e.mode,component:"kane-cli",seq:V++,event_time:new Date().toISOString(),context:o}}import c from"fs";import A from"path";var z=500,Y=7,J=512*1024,Z=15*6e4;function y(e){if(e.length!==0)try{let t=R();c.mkdirSync(A.dirname(t),{recursive:!0});let n=e.map(o=>JSON.stringify(o)).join(`
|
|
3
|
+
`)+`
|
|
4
|
+
`;c.appendFileSync(t,n,{flag:"a",mode:384});let r=0;try{r=c.statSync(t).size}catch{r=0}r>J&&re()}catch{}}function Q(e){try{let t=A.dirname(e),n=A.basename(e);for(let r of c.readdirSync(t)){if(!r.startsWith(`${n}.claim-`)&&!r.startsWith(`${n}.prune-`))continue;let o=A.join(t,r),s=Number(r.slice(r.lastIndexOf("-")+1));if(s===process.pid)continue;let i=!1;if(Number.isFinite(s)&&s>0)try{process.kill(s,0),i=!0}catch{i=!1}let a=!i;if(i)try{a=Date.now()-c.statSync(o).mtimeMs>Z}catch{a=!1}if(a)try{let _=c.readFileSync(o,"utf8");_.trim()&&c.appendFileSync(e,_.endsWith(`
|
|
5
|
+
`)?_:_+`
|
|
6
|
+
`,{flag:"a",mode:384}),c.unlinkSync(o)}catch{}}}catch{}}function Se(e){ee(e).catch(()=>{})}function ee(e){return te(async t=>{try{return(await O(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).ok}catch{return!1}})}var G=Promise.resolve();function te(e){let t=G.then(()=>ne(e));return G=t.catch(()=>{}),t}async function ne(e){let t=R();Q(t);let n=`${t}.claim-${process.pid}`,r;try{c.renameSync(t,n),r=c.readFileSync(n,"utf8")}catch{return}let o=[];for(let s of r.split(`
|
|
7
|
+
`))if(s.trim())try{o.push(JSON.parse(s))}catch{}try{(o.length===0?!0:await e(o))?c.unlinkSync(n):(c.appendFileSync(t,r,{flag:"a",mode:384}),c.unlinkSync(n))}catch{try{c.appendFileSync(t,r,{flag:"a",mode:384}),c.unlinkSync(n)}catch{}}}function re(e=z,t=Y){try{let n=R(),r=`${n}.prune-${process.pid}`;c.renameSync(n,r);let s=c.readFileSync(r,"utf8").split(`
|
|
8
|
+
`).filter(u=>u.trim()),i=Date.now()-t*24*3600*1e3,_=s.filter(u=>{try{let p=JSON.parse(u),E=Date.parse(p.event_time??p.timestamp??"");return Number.isNaN(E)||E>=i}catch{return!1}}).slice(-e);_.length>0&&c.appendFileSync(n,_.join(`
|
|
9
|
+
`)+`
|
|
10
|
+
`,{flag:"a",mode:384}),c.unlinkSync(r)}catch{}}var f=null;function Ae(e){f=e}function ye(){return f}var N=()=>!!process.env.KANE_DEV_MODE,d=[],h=!1,D=null,m=null,T=null,l=null,g=[];function Ie(e){if(l=e,e&&g.length>0){let t=g;g=[];for(let n of t)try{e.log(n.level,n.event,n.message,n.context)}catch{}}}function he(e,t,n,r){if(l){try{l.log(e,t,n,r)}catch{}return}g.push({level:e,event:t,message:n,context:r})}function Te(){return l}function Ne(){return h}function De(e,t){d=d.filter(n=>n.name!==e),d.push({name:e,fn:t})}function xe(e){d=d.filter(t=>t.name!==e)}function Oe(e,t){let n=d.find(o=>o.name===e);if(!n)return;d=d.filter(o=>o.name!==e);let r=!0;try{n.fn()}catch(o){r=!1,process.stderr.write(`[exit-manager] cleanup(${e}) failed: ${o instanceof Error?o.message:String(o)}
|
|
11
|
+
`)}t&&r&&N()&&process.stderr.write(`[exit-manager] cleanup(${e}): ${t}
|
|
12
|
+
`)}async function Ce(e=1e3){let t=l;if(!(!t?.stopAndFlushOnce||!t.drainBuffer))try{let n=await t.stopAndFlushOnce(e);if(n!=="sent"&&n!=="empty"){let r=t.drainBuffer();r.length>0&&y(r)}}catch{}}function I(e,t,n=!1,r){if(h){process.exit(D??e);return}if(h=!0,D=e,n&&l)try{l.log("error","CRASH",t);let i=l.drainBuffer?.()??[];i.length>0&&y(i),l.shutdownSync()}catch{}if(n&&f&&e!==130&&e!==143)try{let i=/Uncaught exception:\s*([A-Za-z0-9_$]+)/.exec(t)?.[1]??"crash";y([F(f,"ASR_CRASH",{error_code:"cli_crash",error_name:i})])}catch{}let o=[...d].reverse(),s=[];for(let i of o)try{i.fn(),s.push(i.name)}catch(a){process.stderr.write(`[exit-manager] cleanup(${i.name}) failed: ${a instanceof Error?a.message:String(a)}
|
|
13
|
+
`)}if(d=[],N()&&(process.stderr.write(`[exit-manager] shutdown(${e}): ${t}
|
|
14
|
+
`),s.length>0&&process.stderr.write(`[exit-manager] cleaned up: ${s.join(", ")}
|
|
15
|
+
`)),n){if(T)try{T()}catch{}e===130||e===143||(process.stderr.write(`
|
|
16
|
+
kane-cli crashed: ${t}
|
|
17
|
+
`+(s.length>0?`Resources cleaned up (${s.join(", ")}).
|
|
18
|
+
`:"")),f&&process.stderr.write(`session: ${f.session_id} \u2014 share this id with support
|
|
19
|
+
`),r&&N()?process.stderr.write(`${r}
|
|
20
|
+
`):process.stderr.write(`(re-run with KANE_DEV_MODE=1 for the full stack)
|
|
21
|
+
`)),process.exit(e);return}if(m&&!n){m();return}process.exit(e)}function Le(e){m=e}function ve(){m=null}function Me(e){T=e}var x=!1;function we(){x||(x=!0,process.on("SIGINT",()=>{I(130,"Received SIGINT",!0)}),process.on("SIGTERM",()=>{I(143,"Received SIGTERM",!0)}),process.on("uncaughtException",e=>{I(1,`Uncaught exception: ${e.name}: ${e.message}`,!0,e.stack)}),process.on("unhandledRejection",e=>{I(1,`Unhandled rejection: ${String(e)}`,!0,e instanceof Error?e.stack:void 0)}))}function be(){d=[],h=!1,D=null,m=null,T=null,l=null,g=[],x=!1,f=null}export{se as a,ce as b,C as c,F as d,y as e,Se as f,ee as g,Ae as h,ye as i,Ie as j,he as k,Te as l,Ne as m,De as n,xe as o,Oe as p,Ce as q,I as r,Le as s,ve as t,Me as u,we as v,be as w};
|