@testmuai/kane-cli 0.8.22 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ChatSurface-PA73V3NT.js → ChatSurface-FJPK3XEJ.js} +1 -1
- package/dist/{ChromeProfilePicker-XX223SYB.js → ChromeProfilePicker-7DUDJTE2.js} +1 -1
- package/dist/{CliFeedbackPrompt-J6DW6TZL.js → CliFeedbackPrompt-ZZPYC6OS.js} +1 -1
- package/dist/{CliUploadProgress-TWEL7NWG.js → CliUploadProgress-WQYKIBAR.js} +1 -1
- package/dist/ConfigView-KXNOODDW.js +2 -0
- package/dist/EvidenceViewOffer-BTBVPBZX.js +2 -0
- package/dist/FolderPicker-H4YEX5LV.js +2 -0
- package/dist/{InfoBox-ELZ5Q65V.js → InfoBox-DTM7X24Z.js} +1 -1
- package/dist/{LinksBox-2V26KLTJ.js → LinksBox-KFG3FVOT.js} +1 -1
- package/dist/{ProfilesView-P4Z42LSX.js → ProfilesView-KBZHT4KL.js} +1 -1
- package/dist/{ProjectPicker-2QNFNN7T.js → ProjectPicker-OARWULNN.js} +1 -1
- package/dist/{SaveSessionPrompt-XMWL3P6G.js → SaveSessionPrompt-37SMU5MC.js} +1 -1
- package/dist/SingleShotApp-UYCAW65Y.js +2 -0
- package/dist/{SummaryBox-RWO4BYYD.js → SummaryBox-6RB5DSAH.js} +1 -1
- package/dist/TestMdRunView-ZMOII3PL.js +2 -0
- package/dist/{TestrunEvidenceTable-MUOGF6CZ.js → TestrunEvidenceTable-3UP2EYIV.js} +1 -1
- package/dist/{WhoamiView-4EYWZR4N.js → WhoamiView-MC62GERR.js} +1 -1
- package/dist/app-client-PQFJAB63.js +2 -0
- package/dist/app-download-P6YXWSVQ.js +2 -0
- package/dist/{auth-5HAY24TN.js → auth-LXW4OFKF.js} +1 -1
- package/dist/{binary-6UEOI7PT.js → binary-LVHXED3O.js} +1 -1
- package/dist/{bind-3C2IIPML.js → bind-ZYESQSCJ.js} +2 -2
- package/dist/{bootstrap-DBAQWVNA.js → bootstrap-DI4UGMH3.js} +1 -1
- package/dist/bridge-7J3JE3JS.js +2 -0
- package/dist/catalog-LLME3744.js +2 -0
- package/dist/{changelog-QAGRYBEZ.js → changelog-N5AZHXOS.js} +1 -1
- package/dist/{chunk-2G5CJQOR.js → chunk-243ZJHT6.js} +1 -1
- package/dist/{chunk-BNC4DJCC.js → chunk-2PKME4VT.js} +4 -4
- package/dist/{chunk-XQNJSM5C.js → chunk-3MCPTVJX.js} +1 -1
- package/dist/{chunk-VW3PFRCO.js → chunk-3YIZG7WZ.js} +1 -1
- package/dist/{chunk-CE23VDW5.js → chunk-4BZOG6PE.js} +1 -1
- package/dist/{chunk-5TQIKRKP.js → chunk-4CYBXJIA.js} +1 -1
- package/dist/{chunk-P37ALET7.js → chunk-4FHK4LKQ.js} +1 -1
- package/dist/{chunk-MXI5P373.js → chunk-4Y2WH77W.js} +1 -1
- package/dist/{chunk-GF32QBCM.js → chunk-5HMN74RZ.js} +1 -1
- package/dist/chunk-5RCS2LIQ.js +26 -0
- package/dist/chunk-5TQFOPJV.js +2 -0
- package/dist/{chunk-SREUA7YQ.js → chunk-6HU5M2DS.js} +1 -1
- package/dist/{chunk-WGIZQGR5.js → chunk-6MD7SR7D.js} +1 -1
- package/dist/{chunk-NMAPNJRY.js → chunk-6VY62QC2.js} +1 -1
- package/dist/{chunk-JHYWNWS5.js → chunk-75MMTNPB.js} +2 -2
- package/dist/{chunk-SIXPXYCH.js → chunk-7GAHJZLH.js} +1 -1
- package/dist/chunk-7WXMV3O3.js +7 -0
- package/dist/{chunk-FR3LVUAB.js → chunk-AHFIRHSP.js} +1 -1
- package/dist/chunk-AJT34ESA.js +38 -0
- package/dist/chunk-AKE2CTV6.js +2 -0
- package/dist/{chunk-WRGPMDDE.js → chunk-AUMJ4RVA.js} +1 -1
- package/dist/chunk-BL3SJDCG.js +10 -0
- package/dist/chunk-BUPRL2TE.js +2 -0
- package/dist/chunk-C25M2J5Q.js +4 -0
- package/dist/{chunk-5FQYB5SM.js → chunk-C6S2RPZA.js} +1 -1
- package/dist/{chunk-YFBJWIBU.js → chunk-CNUCP6DK.js} +1 -1
- package/dist/chunk-CSNJPD2J.js +5 -0
- package/dist/{chunk-GVE5GEW2.js → chunk-CW3RHKLA.js} +1 -1
- package/dist/{chunk-6C35NKQ7.js → chunk-DOOI2JBD.js} +1 -1
- package/dist/{chunk-T6MGCP57.js → chunk-DTRKTBCE.js} +4 -4
- package/dist/{chunk-LSRNUBIV.js → chunk-DTRSYWZE.js} +1 -1
- package/dist/{chunk-Z2XKFYMH.js → chunk-DWMESHFI.js} +1 -1
- package/dist/chunk-EBLXHOE3.js +2 -0
- package/dist/{chunk-RFDL7MHI.js → chunk-EOA6YPES.js} +1 -1
- package/dist/{chunk-HKIBJDKE.js → chunk-F7NSSQYZ.js} +1 -1
- package/dist/chunk-FMUV6UCX.js +2 -0
- package/dist/chunk-GCISXCDU.js +2 -0
- package/dist/chunk-GFBAK7WQ.js +8 -0
- package/dist/{chunk-5D6YMG63.js → chunk-GTVQYT3D.js} +2 -2
- package/dist/{chunk-QV445GUU.js → chunk-HAYV4D2I.js} +1 -1
- package/dist/{chunk-PUFZTE6L.js → chunk-HG5LLZBU.js} +1 -1
- package/dist/chunk-HGFWIBVF.js +8 -0
- package/dist/{chunk-R43ELADV.js → chunk-ILDHE4P4.js} +2 -2
- package/dist/{chunk-REPKBN7I.js → chunk-IPXKUYUK.js} +1 -1
- package/dist/{chunk-R7ZDLGMU.js → chunk-J3BGYSMD.js} +12 -10
- package/dist/{chunk-NAWGHDA3.js → chunk-JQY5HRZ4.js} +1 -1
- package/dist/{chunk-6MCQ2UKE.js → chunk-JX6BFEDO.js} +1 -1
- package/dist/chunk-K3IQEL7R.js +7 -0
- package/dist/{chunk-NUYGWRB2.js → chunk-KWEOLPBJ.js} +1 -1
- package/dist/{chunk-EVBCKI7D.js → chunk-KXEE6VCA.js} +1 -1
- package/dist/{chunk-XFQLR6MF.js → chunk-LH4IPANP.js} +1 -1
- package/dist/{chunk-UXR57BCE.js → chunk-LLG7NEGX.js} +1 -1
- package/dist/{chunk-O4LJWUSJ.js → chunk-M3UAZTDK.js} +1 -1
- package/dist/{chunk-MHMEEA4S.js → chunk-NMSZ7G6P.js} +1 -1
- package/dist/chunk-NOL7MNZH.js +2 -0
- package/dist/{chunk-SW54RAAT.js → chunk-OC6H6BYI.js} +1 -1
- package/dist/{chunk-RUSRN7YE.js → chunk-OHOJSADN.js} +1 -1
- package/dist/chunk-OIUV3ISA.js +2 -0
- package/dist/{chunk-LKPOOZYN.js → chunk-OJAXOOZ5.js} +2 -2
- package/dist/{chunk-RGRFL7XG.js → chunk-OMNLAGQC.js} +1 -1
- package/dist/{chunk-WBH5GYFM.js → chunk-OOCCUUR2.js} +1 -1
- package/dist/{chunk-SVJBOVI4.js → chunk-OXC6O5O7.js} +1 -1
- package/dist/chunk-OZQDD2EX.js +94 -0
- package/dist/{chunk-FDXDFZ7J.js → chunk-PCKIANML.js} +1 -1
- package/dist/{chunk-ZUJGYHZ2.js → chunk-PEDINHVU.js} +1 -1
- package/dist/{chunk-3H3KTCL7.js → chunk-PNUAP3RY.js} +2 -2
- package/dist/{chunk-5ILTSBWT.js → chunk-Q5CINJYL.js} +1 -1
- package/dist/{chunk-PLIQ72LH.js → chunk-Q5RDCSYM.js} +1 -1
- package/dist/chunk-QAB3Y5FQ.js +4 -0
- package/dist/{chunk-WJR2FU7S.js → chunk-RTSBKCZY.js} +1 -1
- package/dist/{chunk-3M6OM3T4.js → chunk-RWSOZPJQ.js} +1 -1
- package/dist/{chunk-5XAX4C5N.js → chunk-SID4X77D.js} +1 -1
- package/dist/chunk-SOCHN2PY.js +2 -0
- package/dist/{chunk-L35DJDX7.js → chunk-SRTKRHYI.js} +1 -1
- package/dist/chunk-TM7VRLWS.js +2 -0
- package/dist/{chunk-VCY7UNEL.js → chunk-UA2QDAWT.js} +1 -1
- package/dist/{chunk-JHBNXTG6.js → chunk-USOYXCZ4.js} +1 -1
- package/dist/{chunk-CBUSNWHA.js → chunk-USY7VAO6.js} +1 -1
- package/dist/{chunk-BPYRVV7O.js → chunk-UWXDURAB.js} +1 -1
- package/dist/{chunk-D7WG7SRA.js → chunk-VBS33P2C.js} +1 -1
- package/dist/{chunk-XKYL4K4A.js → chunk-VHW7BMZQ.js} +1 -1
- package/dist/{chunk-4ZBI54KE.js → chunk-VORWZLS3.js} +2 -2
- package/dist/{chunk-3MWLFHPO.js → chunk-WDMUPK6I.js} +1 -1
- package/dist/{chunk-BPDFI2DC.js → chunk-WMI4P76K.js} +2 -2
- package/dist/{chunk-4VW3B7SE.js → chunk-WNOC6MQC.js} +1 -1
- package/dist/{chunk-JQ3JB5CO.js → chunk-WRSIKZ2V.js} +1 -1
- package/dist/chunk-X2A6CC6B.js +2 -0
- package/dist/{chunk-I4SO2FQV.js → chunk-XBX643ZD.js} +1 -1
- package/dist/{chunk-E2KV4BQB.js → chunk-XKHWWKJZ.js} +1 -1
- package/dist/{chunk-JPOFRYTX.js → chunk-XT7XA4DN.js} +1 -1
- package/dist/{chunk-WPBETG6U.js → chunk-Y3ZYN6AK.js} +3 -3
- package/dist/chunk-YBAVDT3G.js +2 -0
- package/dist/{chunk-OT3VKXJX.js → chunk-YWYORBY3.js} +1 -1
- package/dist/{chunk-DZCJE77P.js → chunk-Z7IGTVJW.js} +1 -1
- package/dist/{chunk-2OIIXLXW.js → chunk-ZC2CKWLB.js} +1 -1
- package/dist/{chunk-3BUYTNAV.js → chunk-ZER3FZSZ.js} +2 -2
- package/dist/chunk-ZJYT72BA.js +9 -0
- package/dist/{chunk-5BHB5D2C.js → chunk-ZXY4P76I.js} +1 -1
- package/dist/{config-HVSKN6L4.js → config-YGTHSGQN.js} +1 -1
- package/dist/cover-cmd-6RO366CC.js +3 -0
- package/dist/{credentials-FH6VZPJS.js → credentials-QD32Y7K7.js} +1 -1
- package/dist/{deps-bundle-QUROUKJI.js → deps-bundle-OI7JJ22L.js} +1 -1
- package/dist/{deps-resolve-N2KKJ37Q.js → deps-resolve-ZOALDS6H.js} +1 -1
- package/dist/device-env-DXDJJMTL.js +2 -0
- package/dist/{dispatch-BYA5Q2SD.js → dispatch-7EWWQRQ5.js} +1 -1
- package/dist/{doctor-MGHY2M36.js → doctor-TPYPEEUL.js} +1 -1
- package/dist/evidence-NPFTBGDF.js +2 -0
- package/dist/evolve-cmd-VGVXV6XW.js +2 -0
- package/dist/explain-cmd-GOP5TE63.js +9 -0
- package/dist/{explain-cmd-JAOHSI4F.js → explain-cmd-M7IX2YNB.js} +1 -1
- package/dist/{extract-bind-T7GKUEJ6.js → extract-bind-CKIRLXAJ.js} +2 -2
- package/dist/{extract-cmd-WXG34RMY.js → extract-cmd-3EWLSPGS.js} +1 -1
- package/dist/gaps-cmd-WVC5GXQC.js +3 -0
- package/dist/{generate-headless-BSBY47K2.js → generate-headless-6WMJYNI6.js} +2 -2
- package/dist/index.js +175 -174
- package/dist/ingest-cmd-AECK5T4H.js +2 -0
- package/dist/install-ZV3KJZV4.js +2 -0
- package/dist/{interactive-bind-JAB6XUPX.js → interactive-bind-IYS6KDOH.js} +3 -3
- package/dist/lifecycle-cmd-XCSBELFQ.js +2 -0
- package/dist/list-cmd-S4DSN2ET.js +3 -0
- package/dist/{list-commands-VTWPMFG3.js → list-commands-GLNGHPDU.js} +1 -1
- package/dist/login-flow-ASUUU7SO.js +2 -0
- package/dist/maintenance-cmd-K5KXRIFL.js +2 -0
- package/dist/mobile-prompts-ZUZTA3RV.js +2 -0
- package/dist/{objective-variable-gate-WZFN5I7Y.js → objective-variable-gate-CG2KK5UX.js} +1 -1
- package/dist/{open-provider-YXHFPVDE.js → open-provider-YIBB77FE.js} +1 -1
- package/dist/persist-recorded-session-EWV56TSZ.js +3 -0
- package/dist/pipeline-LAWACB2O.js +2 -0
- package/dist/prepare-target-WGPCZKLE.js +2 -0
- package/dist/real-device-run-MDLFKFVQ.js +2 -0
- package/dist/reconcile-cmd-XFM2ZXUJ.js +2 -0
- package/dist/reconcile-deps-V5VLDPYT.js +4 -0
- package/dist/reconcile-engine-VZBTMPUK.js +2 -0
- package/dist/{recording-banner-FRH2EJBM.js → recording-banner-CJHRPHHF.js} +1 -1
- package/dist/registry-3JXQFZEG.js +2 -0
- package/dist/{require-project-folder-A6YTVLAK.js → require-project-folder-SE5GVCYJ.js} +1 -1
- package/dist/resolve-run-intent-DD4MB6UD.js +2 -0
- package/dist/{resolver-U55SNASN.js → resolver-TLO4SRWV.js} +1 -1
- package/dist/review-cmd-7EOYQMPE.js +5 -0
- package/dist/run-EHUNJPW6.js +2 -0
- package/dist/run-OTMPUQSH.js +2 -0
- package/dist/run-test-md-KBDEHGXJ.js +17 -0
- package/dist/session-target-UMNASXI7.js +2 -0
- package/dist/{sessions-cmd-IV25N2L7.js → sessions-cmd-M3SECFKQ.js} +1 -1
- package/dist/{skill-installer-LSDCMJ6P.js → skill-installer-32YYMM4N.js} +1 -1
- package/dist/{spawner-HZXP66DS.js → spawner-DPT2RLAO.js} +1 -1
- package/dist/store-guard-U32JE6JJ.js +2 -0
- package/dist/structured-answers-ZI2B6JJE.js +1 -1
- package/dist/sync-cmd-3EP7LZGL.js +2 -0
- package/dist/sync-setup-SWTBVQEV.js +2 -0
- package/dist/tcg-generate-KXU7E2GF.js +2 -0
- package/dist/testmd-actions-PEWCPQ5R.js +2 -0
- package/dist/testmd-sync-ZWFQWZ2X.js +2 -0
- package/dist/token-refresh-QD3OCGJJ.js +2 -0
- package/dist/{validate-basic-5NYH5WYI.js → validate-basic-AAIXSAWH.js} +1 -1
- package/dist/{variable-receipt-C3US6X4M.js → variable-receipt-YWNS24TH.js} +1 -1
- package/dist/{verdicts-VPTU4YAS.js → verdicts-LAB5BGCC.js} +1 -1
- package/dist/{version-check-YY57B2A4.js → version-check-EHOLX3YH.js} +1 -1
- package/dist/{view-cmd-KWIBYZ5S.js → view-cmd-3WHG6MVB.js} +1 -1
- package/dist/walk-session-XP4KYFKO.js +2 -0
- package/dist/with-telemetry-FJMJQDCM.js +2 -0
- package/package.json +11 -11
- package/dist/ConfigView-ROFNVFDQ.js +0 -2
- package/dist/EvidenceViewOffer-XUP44BGJ.js +0 -2
- package/dist/FolderPicker-XLAK7324.js +0 -2
- package/dist/SingleShotApp-3YZSE3AA.js +0 -2
- package/dist/TestMdRunView-QHPMG46M.js +0 -2
- package/dist/app-client-ZCCNE3RV.js +0 -2
- package/dist/app-download-KUJVMZ7L.js +0 -2
- package/dist/bridge-NHXCRSIU.js +0 -2
- package/dist/chunk-26HZJJN6.js +0 -5
- package/dist/chunk-2HFNP2LM.js +0 -2
- package/dist/chunk-3NMXXTHE.js +0 -2
- package/dist/chunk-44NNFVCJ.js +0 -7
- package/dist/chunk-46U7TRPE.js +0 -98
- package/dist/chunk-5E4JLXR5.js +0 -2
- package/dist/chunk-ADBOWRMW.js +0 -2
- package/dist/chunk-BL5QHONU.js +0 -2
- package/dist/chunk-DF4EBXGN.js +0 -8
- package/dist/chunk-EYOCNMUM.js +0 -2
- package/dist/chunk-FBRTUEAL.js +0 -26
- package/dist/chunk-GYLMH2EX.js +0 -4
- package/dist/chunk-OBB57E2L.js +0 -4
- package/dist/chunk-ODU2JSMA.js +0 -8
- package/dist/chunk-SB5XM4YV.js +0 -6
- package/dist/chunk-SJZJ7ASF.js +0 -2
- package/dist/chunk-TAOHYWEO.js +0 -2
- package/dist/chunk-WHNF5SWS.js +0 -9
- package/dist/chunk-YFQGOOF7.js +0 -2
- package/dist/cover-cmd-ZZJA5C6H.js +0 -3
- package/dist/device-env-ID7EDDOD.js +0 -2
- package/dist/evidence-XYKLWPPY.js +0 -2
- package/dist/evolve-cmd-BURJDLVF.js +0 -2
- package/dist/explain-cmd-53EO2IMN.js +0 -9
- package/dist/gaps-cmd-T55FFFVB.js +0 -3
- package/dist/ingest-cmd-BYOZCTVG.js +0 -2
- package/dist/install-OABVIXAE.js +0 -2
- package/dist/lifecycle-cmd-QVGYYJSG.js +0 -2
- package/dist/list-cmd-RQYRC345.js +0 -3
- package/dist/login-flow-HUORIV6P.js +0 -2
- package/dist/maintenance-cmd-NC2VI5G7.js +0 -2
- package/dist/mobile-prompts-VCA73IYP.js +0 -2
- package/dist/persist-recorded-session-SZDBBSNH.js +0 -3
- package/dist/pipeline-FAU3PBDH.js +0 -2
- package/dist/prepare-target-XYOTVK2I.js +0 -2
- package/dist/reconcile-cmd-2BFK7RFL.js +0 -2
- package/dist/reconcile-deps-CYWH6GM4.js +0 -4
- package/dist/reconcile-engine-ZWIJFYBP.js +0 -2
- package/dist/registry-QR3BDI5F.js +0 -2
- package/dist/resolve-run-intent-PHAXPW6C.js +0 -2
- package/dist/review-cmd-ZKCXBMFP.js +0 -5
- package/dist/run-76I4OYXD.js +0 -2
- package/dist/run-XJK3YOW2.js +0 -2
- package/dist/run-test-md-A3QRWLCW.js +0 -17
- package/dist/session-target-UWROGOCY.js +0 -2
- package/dist/store-guard-27XJZ7WF.js +0 -2
- package/dist/sync-cmd-JZ3MXGEU.js +0 -2
- package/dist/sync-setup-HGG7ALGA.js +0 -2
- package/dist/tcg-generate-S77VVSVU.js +0 -2
- package/dist/testmd-actions-VQJ22WZZ.js +0 -2
- package/dist/testmd-sync-RKSGTCZA.js +0 -2
- package/dist/token-refresh-AOCGYGEC.js +0 -2
- package/dist/walk-session-YSKEJM2F.js +0 -2
- package/dist/with-telemetry-2NY4CPL5.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as Me}from"./chunk-
|
|
2
|
+
import{b as Me}from"./chunk-4Y2WH77W.js";import{c as Ft}from"./chunk-T2ONUKTL.js";import{a as Jt}from"./chunk-66MOZKD2.js";import{a as g,c as Mt,d as Bt,e as _,f as Le,g as Fe,h as Wt,i as Je,j as Ht}from"./chunk-YLQHY4A7.js";import{h as ut,k as ft,m as ht,o as _e,r as Pt,t as Lt}from"./chunk-OMNLAGQC.js";import{a as At,b as Pe,c as Ct,d as Tt}from"./chunk-VVOKM2VO.js";import{u as qt}from"./chunk-IICT4VOU.js";import{B as re,D as Ie,E as Et,F as xt,G as L,I as qe,J as he,K as Ot,O as $,P as y,Q as Ae,R as _t,S as Ce,U as Te,V as It,W as Ne,X as se,a as pt,b as fe,h as te,i as mt,j as gt,n as wt,p as x,r as St,s as $t,t as kt,v as Rt,x as vt,z as Y}from"./chunk-RDHWNSDP.js";import{b as ne,c as bt,h as yt}from"./chunk-FQNQVC5O.js";import{a as ee}from"./chunk-XLSOQLVT.js";import{a as Nt}from"./chunk-CH273NAE.js";import{b as dt}from"./chunk-5LJRZI7S.js";import{a as lt}from"./chunk-BKM2LWU2.js";import{s as at,t as ct}from"./chunk-RSSOJ3L2.js";import{y as O}from"./chunk-5TQFOPJV.js";import{a as it}from"./chunk-DFS4RMVP.js";import{a as ue}from"./chunk-HCBYKLMW.js";import{a as U,b,i as pe}from"./chunk-C44QQJR4.js";import{a as Pn}from"./chunk-6YGTRKDT.js";import{e as D}from"./chunk-UR6MHSHU.js";import{existsSync as fs}from"fs";var V=D(Pn(),1);import{existsSync as de,mkdirSync as xn,readdirSync as Hr,readFileSync as Re,rmSync as En,writeFileSync as Ur,renameSync as Yr}from"fs";import{randomBytes as jr}from"crypto";import{basename as zr,join as tt}from"path";import{appendFileSync as ye,closeSync as hr,existsSync as w,fsyncSync as mr,mkdirSync as F,openSync as gr,readdirSync as G,readFileSync as S,renameSync as $e,rmdirSync as wr,rmSync as q,realpathSync as br,statfsSync as yr,statSync as pn,writeFileSync as Sr}from"fs";import{randomBytes as un}from"crypto";import{basename as fn,dirname as R,join as h,relative as Ge}from"path";var Ln=/^sha256:[0-9a-f]{64}$/;function oe(t){let e=new Set,n=r=>{typeof r=="string"&&Ln.test(r)&&e.add(r)};for(let r of t.nodes??[])n(r.content?.blob);for(let r of Object.values(t.media??{})){n(r.text_blob);for(let s of r.images??[])n(s.blob)}return{blobs:[...e].sort(),proposalId:t.proposal_id??null}}function Be(t){return"sha256:"+fe(Buffer.from("assurance.proposal\0"+pt(JSON.parse(t)),"utf8"))}import{mkdirSync as Fn,readFileSync as Jn}from"fs";import{dirname as Mn,join as Bn}from"path";var Ut="locations.json",Yt="state.json";function me(t,e){return Bn(t,"sync",e)}function jt(t){return Zt(me(t,Ut),{version:1,locations:[]})}function Es(t,e){Xt(me(t,Ut),e)}function B(t){return Zt(me(t,Yt),{version:1,entries:{}})}function zt(t,e){Xt(me(t,Yt),e)}function Gt(t,e){let n=t.locations;if(n.length===0)throw new Error("no locations yet \u2014 add one with kane-cli context sync add <name> <descriptor>");if(e!==void 0){let s=n.find(i=>i.name===e);if(s)return s;throw new Error(`no location named ${e} \u2014 known locations: ${n.map(i=>i.name).join(", ")}`)}if(n.length===1)return n[0];let r=n.find(s=>s.name==="origin");if(r)return r;throw new Error(`name a location: ${n.map(s=>s.name).join(", ")}`)}var j=class extends Error{code="WITNESS_LOWERED"};function Kt(t,e,n){let r=t.entries[e];if(!r)throw new Error(`no sync state for ${e} \u2014 run kane-cli context sync add ${e} <descriptor> first`);let s=r.witness;if(s){if(n.seq<s.seq)throw new j(`${e} is behind what it already served: position ${s.seq} was seen there, now ${n.seq}`);if(n.seq===s.seq&&n.hash!==s.hash)throw new j(`${e} changed the record at position ${s.seq}: ${s.hash} was seen there, now ${n.hash}`)}r.witness=n}function xs(t,e,n){let r=t.locations.length,s=t.locations.filter(i=>i.name!==n);if(s.length===r){let i=r===0?"none":t.locations.map(o=>o.name).join(", ");throw new Error(`no location named ${n} \u2014 known locations: ${i}`)}return t.locations=s,e.entries[n]?.witness??null}function Zt(t,e){let n;try{n=Jn(t,"utf-8")}catch(s){if(s.code==="ENOENT")return e;throw new Error(`${t} could not be read: ${s instanceof Error?s.message:String(s)}`)}let r;try{r=JSON.parse(n)}catch(s){throw new Error(`${t} is not readable JSON: ${s instanceof Error?s.message:String(s)}`)}if(typeof r!="object"||r===null||!("version"in r)||r.version!==1)throw new Error(`${t} is not a version 1 sync file \u2014 this store was written by a newer kane-cli`);return r}function Xt(t,e){Fn(Mn(t),{recursive:!0}),$(t,JSON.stringify(e,null,2)+`
|
|
3
3
|
`)}import{closeSync as Gn,existsSync as tn,fsyncSync as Kn,linkSync as Zn,mkdirSync as Xn,openSync as Vn,readFileSync as Qn,rmSync as nn,writeFileSync as Dn}from"fs";import{dirname as ge,join as rn}from"path";import{existsSync as jn}from"fs";import{join as zn}from"path";var Vt=1e3,Wn=999999999,Qt=/^assurance\/context@(\d+)$/,Hn=Number(Qt.exec(ee)[1]);async function ae(t,e){let n=await t.get(_(e));if(n===null)throw ie(`position ${e} is absent`);return{hash:We(e,n).hash,raw:n}}function We(t,e){let n=s=>new g("SYNC_OBJECT_CORRUPT",`the record at position ${t} on the storage is not usable: ${s}`,"the storage object needs a human look; nothing was changed"),r;try{r=JSON.parse(Buffer.from(e).toString("utf8"))}catch(s){throw n(`not JSON (${s instanceof Error?s.message:String(s)})`)}if(typeof r!="object"||r===null||Array.isArray(r)||r.seq!==t)throw n(`it says it is position ${String(r?.seq)}`);if(r.schema_version!==void 0&&r.schema_version!==ee){let s=Qt.exec(r.schema_version);throw s&&Number(s[1])>Hn?new g("SYNC_CLIENT_TOO_OLD",`position ${t} is stamped ${r.schema_version}; this kane-cli reads ${ee}`,`upgrade kane-cli to a release that reads ${r.schema_version}, then run the command again`):n(`it is stamped ${r.schema_version}, this build reads ${ee}`)}if(r.parents!==void 0&&!(r.prev_hash===null?r.parents.length===0:r.parents.length===1&&r.parents[0]===r.prev_hash))throw n("parents does not mirror prev_hash");return{record:r,hash:re(r)}}async function W(t,e,n=0){let r=e,s=1,i;for(;;){let u=e+s;if(!await t.head(_(u))){i=u;break}r=u,s*=2}if(r===e&&e>0&&!await t.head(_(e)))return W(t,0);for(;i-r>1;){let u=r+Math.floor((i-r)/2);await t.head(_(u))?r=u:i=u}let o=r;if(o===0){if(await t.head(Bt))throw ie("meta.json exists but position 1 is gone");let u=(await t.list(Mt)).map(Fe).find(f=>f!==null);if(u!==void 0)throw ie(`position ${u} exists but position 1 is gone`);return{seq:0,hash:null,raw:null}}let a=[Le(o),Le(Math.min(o+Vt,Wn))];a[1]===a[0]&&a.pop();let c=new Set;for(let u of a)for(let f of await t.list(u)){let k=Fe(f);if(k!==null){if(k>o){if(await t.head(_(o+1))){if(n>=Un)throw Yn(o);return W(t,o,n+1)}throw ie(`position ${k} exists above the tail at ${o}`)}c.add(k)}}let p=o-(o-1)%Vt;for(let u=p;u<=o;u++)if(!c.has(u))throw ie(`position ${u} is missing below the tail at ${o}`);let{hash:d,raw:l}=await ae(t,o);return{seq:o,hash:d,raw:l}}var Un=3;function Yn(t){return new g("SYNC_REMOTE_HOLE",`the storage kept growing while its tail was being found (last seen at ${t}); nothing was changed`,"run the command again in a moment")}function ie(t){return new g("SYNC_REMOTE_HOLE",`the storage has a hole: ${t} \u2014 a position was deleted below evidence of a later one`,"restore the missing position from a copy that holds it; nothing was changed")}function Dt(t,e){let n=he(t,e);if(n===null)throw new x(`no local record at position ${e} \u2014 run kane-cli context fsck`);if(!(n!==qe&&jn(zn(t,"commits",`${String(e).padStart(6,"0")}-${n.slice(7,19)}.json`))))throw new g("SYNC_LOCAL_RECORD_CORRUPT",`the local record at position ${e} ${n===qe?"is unreadable":"does not hash to its file name"}`,"run kane-cli context fsck, then restore the record from a backup or a clone; nothing was changed");return n}async function en(t,e,n){let r=L(t),s=await W(e,n?.seq??0),i=async l=>l===s.seq?s.hash:(await ae(e,l)).hash;if(n&&(s.seq<n.seq||await i(n.seq)!==n.hash))throw new g("SYNC_REMOTE_ROLLED_BACK",`the storage was rolled back: position ${n.seq} was seen there with ${n.hash}, `+(s.seq<n.seq?`now its tail is ${s.seq}`:"now a different record sits there"),"restore the storage from a copy that holds the witnessed records, or remove and re-add the location after a human has decided it was rebuilt on purpose");let o=s.seq===0?null:{seq:s.seq,hash:s.hash};if(o===null)return{kind:"empty-storage",local:r,storage:o};if(r===null)return{kind:"empty-local",local:r,storage:o};if(Dt(t,1)!==await i(1))return{kind:"foreign-lineage",local:r,storage:o};let a=Math.min(r.seq,o.seq),c=async l=>(l===r.seq?r.hash:Dt(t,l))===await i(l);if(await c(a))return{kind:r.seq===o.seq?"up-to-date":r.seq<o.seq?"behind":"ahead",local:r,storage:o};let p=1,d=a;for(;d-p>1;){let l=p+Math.floor((d-p)/2);await c(l)?p=l:d=l}return{kind:"diverged",local:r,storage:o,at:d}}var er=2e3;async function Qs(t,e,n,r,s){let i=B(t).entries[n]?.witness??null,o=await en(t,e,i),a=o.local?.seq??0,c={imported:0,from:a,to:a,blobs:0,proposals:0};switch(o.kind){case"empty-storage":return r(`nothing to pull: ${n} is empty`),c;case"up-to-date":return r("up to date"),c;case"ahead":return s?.quietAhead||r(`nothing to pull; you are ahead of ${n} \u2014 run kane-cli context push ${n}`),c;case"diverged":throw new g("SYNC_DIVERGED",`you and ${n} both added work after position ${o.at-1}; nothing was pulled`,`run kane-cli context pull ${n} --rebase to save your local work, take the team version from ${n}, and then reapply yours`);case"foreign-lineage":throw new g("SYNC_FOREIGN_LINEAGE",`${n} holds a different history (its first record is not this store's)`,`to work on it, clone it: kane-cli context clone <descriptor of ${n}> <dir>; to share this store, add an empty location`);case"behind":case"empty-local":break}let p=o.storage.seq,d=await Ue(t,e,o.local,o.storage,tr(t,o.local),r);return Ye(t,d,o.local?.hash??null,n),se(t),He(t,n,{seq:p,hash:d.records[d.records.length-1].hash}),{imported:d.records.length,from:a,to:p,blobs:d.blobs.size,proposals:d.proposals.size}}function He(t,e,n,r){let s=r?.lockHeld?()=>{}:Y(t,{deadlineMs:er});try{let i=B(t),o=i.entries[e]?.witness??null;if(r?.forwardOnly&&o&&o.seq>n.seq)return;try{Kt(i,e,n)}catch(a){throw a instanceof j?new g("SYNC_REMOTE_ROLLED_BACK",a.message,"restore the storage from a copy that holds the witnessed records, or remove and re-add the location after a human has decided it was rebuilt on purpose"):a}zt(t,i)}finally{s()}}function tr(t,e){let n=It(t);return n&&n.applied.seq===(e?.seq??0)&&n.applied.hash===(e?.hash??null)?n:se(t)}async function Ue(t,e,n,r,s,i=()=>{}){let o=await rr(e,n?.seq??0,n?.hash??null,r.seq,r.hash);ir(t,o,s);let a=await sr(t,e,o),c=await or(t,e,o,i);return{records:o,blobs:a,proposals:c}}function Ye(t,e,n,r,s){for(let[a,c]of e.proposals){let[p,d]=a.split("/");nr(rn(ge(te(t,p)),d),c)}let i=n,o=null;for(let a=0;a<e.records.length;a+=Ae){let c=e.records.slice(a,a+Ae),p=s?.lockHeld?()=>{}:Y(t);try{_t(t,c.map(({seq:d,raw:l})=>({seq:d,raw:l})),i,{...s,lockHeld:!0})}catch(d){if(!(d instanceof vt))throw d;let l=`this store appended position ${L(t)?.seq??0} while the pull was`;throw new g("SYNC_LOCAL_MOVED",o===null?`${l} being prepared; nothing was imported`:`${l} landing; positions ${e.records[0].seq}..${o} were imported, a valid prefix, and nothing more`,`kane-cli context pull ${r}`)}finally{p()}i=c[c.length-1].hash,o=c[c.length-1].seq,s?.afterChunk?.(o)}}function nr(t,e){Xn(ge(t),{recursive:!0});let n=`${t}.tmp-${process.pid}`,r=Vn(n,"w");try{Dn(r,e),Kn(r)}finally{Gn(r)}try{Zn(n,t)}catch(s){if(s.code!=="EEXIST")throw nn(n,{force:!0}),s}nn(n,{force:!0}),y(ge(t))}async function rr(t,e,n,r,s){let i=[],o=n;for(let a=e+1;a<=r;a++){let c=await t.get(_(a));if(c===null)throw new g("SYNC_REMOTE_HOLE",`the storage has a hole: position ${a} is missing below its tail at ${r}`,"restore the missing position from a copy that holds it; nothing was changed");let{record:p,hash:d}=We(a,c);if(p.prev_hash!==o)throw new g("SYNC_REMOTE_CHAIN_BROKEN",`position ${a} on the storage is sealed onto ${String(p.prev_hash)}, but position ${a-1} hashes ${String(o)}`,"the storage chain needs a human look; nothing was changed");if(a===r&&d!==s)throw new g("SYNC_REMOTE_CHAIN_BROKEN",`the tail at position ${r} changed while this pull ran: it hashed ${s}, now ${d}`,"run kane-cli context pull again");i.push({seq:a,hash:d,raw:Buffer.from(c).toString("utf8"),record:p}),o=d}return i}async function sr(t,e,n){let r=new Set;for(let{seq:s,record:i}of n)for(let o of oe(i).blobs){if(r.has(o))continue;let a=Tt(t,o);if(a!==null&&Pe(a)===o)continue;let c=await e.get(Wt(o));if(c===null)throw new g("SYNC_REMOTE_HOLE",`the storage has a hole: position ${s} names blob ${o}, which the storage does not hold`,"restore the blob from a copy that holds it; nothing was changed");let p=Buffer.from(c);if(Pe(p)!==o)throw new g("SYNC_OBJECT_CORRUPT",`the blob ${o} on the storage does not hash to its name (named by position ${s})`,"the storage object needs a human look; nothing was changed");a===null?Ct(t,p):$(At(t,o),p),r.add(o)}return r}async function or(t,e,n,r){let s=new Map,i=new Set;for(let{seq:o,record:a}of n){let c=oe(a).proposalId;if(c===null||i.has(c))continue;i.add(c);let p=te(t,c),d=null;if(tn(p))try{d=Be(Qn(p,"utf8"))}catch{d=""}let l=await e.list(Ht(c));if(l.length===0)continue;if(l.length>1){r(`proposal ${c} (position ${o}) has ${l.length} payloads on the storage and the record names none of them; skipped`);continue}if(d!==null&&Je(c,d)===l[0])continue;let u=await e.get(l[0]);if(u===null)continue;let f=null;try{f=Be(Buffer.from(u).toString("utf8"))}catch{f=null}if(f===null||Je(c,f)!==l[0]){r(`proposal ${c} (position ${o}) on the storage does not digest to its key ${l[0]}; skipped`);continue}if(d===null){s.set(`${c}/proposal.json`,Buffer.from(u));continue}let k=`${c}/proposal.${f.slice(7,19)}.json`;tn(rn(ge(p),k.slice(c.length+1)))||(r(`proposal ${c} (position ${o}) differs from the one here; the storage's payload is installed beside it as ${k}`),s.set(k,Buffer.from(u)))}return s}function ir(t,e,n){let r=structuredClone(n);for(let{seq:s,hash:i,record:o}of e)try{gt(t,r,o,i)}catch(a){throw a instanceof mt?new g("SYNC_REMOTE_ADMISSION_RED",`position ${s} would not pass this store's checks: ${a.message}`,`nothing was imported; ask whoever pushed position ${s} to run kane-cli context fsck on their store, or upgrade kane-cli if theirs is newer`):a}}import{existsSync as on,mkdirSync as ar,readdirSync as cr,readFileSync as an,renameSync as dr,writeFileSync as lr}from"fs";import{join as we}from"path";var pr=/^@import\s+(\S+)\s*$/;function sn(t,e){let n=t.resolve(e),r=n?String(t.getNode(n.tip)?.content.title??""):"";return r&&qt(r,()=>!1)||e}function je(t){return we(t,".testmuai","tests")}function ze(t){let e=new Map;if(!on(t))return e;for(let n of cr(t)){if(!n.endsWith("_test.md"))continue;let r=we(t,n);try{let s=_e(an(r,"utf8"))?.id;s&&e.set(s,[...e.get(s)??[],r])}catch{}}return e}function ur(t,e,n){let r=`assurance:
|
|
4
4
|
id: ${e}
|
|
5
5
|
base: ${n}
|
|
@@ -32,4 +32,4 @@ ${s}`}function fr(t,e){let n=`${t}.tmp-mint`;lr(n,e),dr(n,t)}function oo(t){let{
|
|
|
32
32
|
`),q(s),i.length}var Wr=/^sha256:[0-9a-f]{64}$/,De=class t{m=new Map;get size(){return this.m.size}set(e,n){this.m.set(e,n)}get(e){return this.m.get(e)}rewrite(e){if(typeof e=="string")return Wr.test(e)?this.m.get(e)??e:e;if(Array.isArray(e))return e.map(n=>this.rewrite(n));if(e!==null&&typeof e=="object"){let n={};for(let[r,s]of Object.entries(e))n[r]=this.rewrite(s);return n}return e}toJSON(){return Object.fromEntries(this.m)}static fromJSON(e){let n=new t;for(let[r,s]of Object.entries(e??{}))n.set(r,s);return n}},et=class t{m=new Map;set(e,n){this.m.set(e.hash,{orig:e,fate:n})}get(e){let n=this.m.get(e.hash);return n&&n.orig.seq===e.seq?n.fate:void 0}byHash(e){return this.m.get(e)?.fate}toJSON(){return[...this.m.values()]}static fromJSON(e){let n=new t;for(let r of e??[])n.set(r.orig,r.fate);return n}},Rn=t=>({cid:t.cid.toJSON(),record:t.record.toJSON()}),vn=t=>({cid:De.fromJSON(t?.cid),record:et.fromJSON(t?.record)});var Jo=["keep-theirs","apply-mine","apply-mine-as-new"];function nt(t,e,n){switch(e){case"keep-theirs":return t==="generation"?"the local design stays in the backup; after this rebase, run design again if you want both":"the local change stays in the backup";case"apply-mine":return t==="slug"?`the name moves to the local node; the node that holds it on ${n} is reached by its id again`:t==="head"?`retire the source as it is now, ${n}'s version included`:`the local version lands on top of ${n}'s`;case"apply-mine-as-new":return`a new node beside ${n}'s (duplicate check first)`;case"later":return"leaves the rebase open; kane-cli context sync or kane-cli context pull asks again"}}function Mo(t,e,n){return{rebase_id:t,decision_id:e.holdId,kind:e.kind,intent:e.verb,seq:e.orig.seq,label:e.label,location:n,mine:e.mine,theirs:e.theirs,answers:e.answers.map(r=>({answer:r,consequence:nt(e.kind,r,n)}))}}var Bo=t=>({from:(e,n)=>Ot(t,e,n),hashAt:e=>{let n=he(t,e);return n===null||n==="corrupt"?null:n}}),ke=(t,e)=>tt(v(t),`${e}.json`),Gr=(t,e)=>tt(v(t),`${e}.lock`),Z=class t{constructor(e,n){this.contextDir=e;this.data=n;this.maps=vn(n.maps)}maps;static create(e,n,r,s,i){let o=zr(n);if(de(ke(e,o)))throw new x(`rebase ${o} already has a ledger \u2014 run kane-cli context sync or kane-cli context pull to continue it, or kane-cli context sync doctor --abort to close it`);let a=new t(e,{version:1,backup:n,backupId:o,from:s,state:"open",...i?{location:i}:{},items:r.map(p=>({...p})),maps:{cid:{},record:[]},aliases:[]}),c=!de(v(e));return xn(v(e),{recursive:!0}),c&&y(tt(e,"sync")),a.save(),a}static open(e,n){let r=ke(e,n);if(!de(r))throw new x(`no rebase ${n} here \u2014 kane-cli context sync doctor lists the rebases this store has`);let s;try{s=JSON.parse(Re(r,"utf8"))}catch{s=null}if(!$t(s)||typeof s.backup!="string")throw new x(Kr(n));return new t(e,s)}get backupId(){return this.data.backupId}get location(){return this.data.location??"the location"}get rev(){return this.data.rev??0}get backup(){return this.data.backup}get from(){return this.data.from}get state(){return this.data.state}get closedBy(){return this.data.closedBy}get items(){return this.data.items}get aliases(){return this.data.aliases}item(e){let n=this.data.items.find(r=>r.k===e);if(!n)throw new Error(`no replay item ${e}`);return n}itemAt(e){return this.data.items.find(n=>n.orig.seq===e||n.group?.some(r=>r.seq===e))}beginItem(e,n){this.assertOpen();let r=this.item(e);r.begin={expectPrev:n},delete r.outcome,this.save()}endItem(e,n){this.assertOpen(),this.item(e).outcome=n,this.save()}pendingItem(){return this.data.items.find(e=>e.begin!==void 0&&e.outcome===void 0)}reconcileAll(e,n){let r=this.item(e);if(!r.begin)return[];let s=r.origins??Object.fromEntries((r.group??[r.orig]).map(c=>[c.hash,c.seq])),{records:i,hashes:o}=n.from(r.begin.expectPrev.seq,r.begin.expectPrev.hash),a=[];return i.forEach((c,p)=>{let d=c.replayed_from===void 0?void 0:s[c.replayed_from.orig.hash];d!==void 0&&a.push({seq:c.seq,hash:o[p],member:d})}),a}reconcileFrom(e,n,r){let s=this.item(e),i=s.origins??Object.fromEntries((s.group??[s.orig]).map(p=>[p.hash,p.seq])),{records:o,hashes:a}=n.from(r.seq,r.hash),c=[];return o.forEach((p,d)=>{let l=p.replayed_from===void 0?void 0:i[p.replayed_from.orig.hash];l!==void 0&&c.push({seq:p.seq,hash:a[d],member:l})}),c}reconcile(e,n){let r=this.reconcileAll(e,n).at(-1);return r?{seq:r.seq,hash:r.hash}:void 0}lastAppliedInChain(e){for(let n of[...this.data.items].reverse()){let r=n.outcome;if(r&&"applied"in r)return e.hashAt(r.applied.newSeq)===r.applied.newHash;if(r&&"deduped"in r&&r.deduped.newSeq!==void 0)return e.hashAt(r.deduped.newSeq)===r.deduped.newHash}return!0}setMaps(e){this.maps=e,this.data.maps=Rn(e),this.save()}addAlias(e){this.data.aliases.push(e),this.save()}listHolds(){return this.data.items.flatMap(e=>e.outcome&&"held"in e.outcome?[e.outcome.held]:[])}resolveHold(e,n){let r=this.heldItem(e);if(!r.outcome.held.answers.includes(n))throw new x(`${n} is not an answer ${e} accepts`);return r.answer=n,this.reopen(r)}reopenHold(e){let n=this.heldItem(e);return delete n.answer,this.reopen(n)}heldItem(e){this.assertOpen();let n=this.data.items.find(r=>r.outcome&&"held"in r.outcome&&r.outcome.held.holdId===e);if(!n)throw new x(`${e} is not an open decision \u2014 kane-cli context sync status lists them`);return n}reopen(e){return delete e.outcome,delete e.begin,this.save(),e}close(e){this.data.state="closed",this.data.closedBy=e,this.save()}toJSON(){return structuredClone(this.data)}assertOpen(){if(this.data.state!=="open")throw new x(`rebase ${this.data.backupId} is closed \u2014 kane-cli context sync doctor lists every rebase and what it reapplied`)}save(){let e=ke(this.contextDir,this.data.backupId);if(de(e)){let n=0;try{n=JSON.parse(Re(e,"utf8")).rev??0}catch{n=0}if(n>(this.data.rev??0))throw new x(`the replay ledger for ${this.data.backupId} changed on disk (rev ${n}, this process holds rev ${this.data.rev??0}) \u2014 another process is working on it; run the command again`)}this.data.rev=(this.data.rev??0)+1,$(e,JSON.stringify(this.data,null,2)+`
|
|
33
33
|
`)}};function Wo(t,e){let n=Gr(t,e);xn(v(t),{recursive:!0});let r=jr(6).toString("hex");for(;;)try{return Ur(n,JSON.stringify({pid:process.pid,nonce:r}),{flag:"wx"}),()=>{try{JSON.parse(Re(n,"utf8")).nonce===r&&En(n)}catch{}}}catch(s){if(s.code!=="EEXIST")throw s;let i={};try{i=JSON.parse(Re(n,"utf8"))}catch{i={}}if(typeof i.pid=="number"&&ne(i.pid))throw new x(`rebase ${e} is being worked on by pid ${i.pid} \u2014 wait for it to finish`);En(n,{force:!0})}}var Ho=(t,e,n,r,s)=>Z.create(t,e,n,r,s),Uo=(t,e)=>Z.open(t,e),Kr=t=>`rebase ${t} has a ledger this store cannot read (sync/replay/${t}.json) \u2014 ${St}`,On=t=>{let e=v(t);return de(e)?Hr(e).filter(n=>n.endsWith(".json")&&!n.endsWith(".receipt.json")).sort().reverse().map(n=>n.slice(0,-5)):[]};function Zr(t,e={}){let n=[];for(let r of On(t))try{n.push(Z.open(t,r))}catch(s){if(!e.tolerant)throw s}return n}function Yo(t){return On(t).filter(e=>{try{return Z.open(t,e),!1}catch{return!0}})}function jo(t,e){let n=ke(t,e),r=`${n}.unreadable`;return Yr(n,r),y(v(t)),r}function kn(t){return Zr(t).find(e=>e.state==="open")}function Xr(t){let e=t.outcome;return e?"applied"in e?`reapplied \u2192 record ${e.applied.newSeq}`:"held"in e?`decision ${e.held.holdId} (${e.held.kind})`:"deduped"in e?`already present: ${e.deduped.as.slice(0,19)}`:`not reapplied: ${e.skipped.reason}`:t.begin?"pending":"waiting"}function zo(t,e,n={}){let r=t.itemAt(e);if(!r)throw new x(`no moved record at position ${e} in rebase ${t.backupId}`);let s=r.label.startsWith(`${r.verb} `)||r.label===r.verb?r.label:`${r.verb} ${r.label}`,i=[`record ${r.orig.seq}: ${s}`,`origin ${r.orig.hash}`,`outcome: ${Xr(r)}`];if(r.group&&i.push(`group: records ${r.group.map(o=>o.seq).join(", ")}`),r.outcome&&"held"in r.outcome){let o=r.outcome.held,a=Math.max(5,t.location.length)+1;i.push(`${"local:".padEnd(a+1)}${o.mine}`,`${`${t.location}:`.padEnd(a+1)}${o.theirs}`,`choose: ${o.answers.join(", ")}`),n.detail!==!1&&i.push(JSON.stringify(o.detail,null,2))}return i}var m=D(ue(),1);function _n(t,e,n){let r={"keep-theirs":`keep ${n}'s version`,"apply-mine":"apply the local version","apply-mine-as-new":"add the local version as new",later:"decide later"},s=t.answers.map(i=>({key:i,answer:i,label:r[i],detail:e(i)}));return s.push({key:"later",answer:"later",label:r.later,detail:e("later")}),s}function X({label:t,text:e,accent:n}){return(0,m.jsxs)(b,{children:[(0,m.jsx)(b,{color:O.dim,children:` ${t.padEnd(15)}`}),(0,m.jsx)(b,{color:n?O.assuranceAccent:void 0,children:e})]})}function In({card:t,index:e,total:n,rebaseId:r,location:s,diff:i,rows:o,sel:a,focused:c,expanded:p}){let d=Math.max(...(i??[]).map(l=>Math.max(l.was.length,l.local.length,l.origin.length)),8);return(0,m.jsxs)(U,{flexDirection:"column",children:[(0,m.jsxs)(b,{bold:!0,children:[`decision ${e} of ${n}`,(0,m.jsx)(b,{color:O.dim,children:` \xB7 ${t.kind} on your ${t.verb} from record ${t.orig.seq}`})]}),i&&i.length>0?(0,m.jsxs)(U,{flexDirection:"column",children:[(0,m.jsx)(b,{color:O.dim,children:` ${"".padEnd(12)}${"was".padEnd(d+2)}${"local".padEnd(d+2)}${s}`}),i.map(l=>(0,m.jsxs)(b,{children:[(0,m.jsx)(b,{color:O.dim,children:` ${l.field.padEnd(12)}`}),l.was.padEnd(d+2),(0,m.jsx)(b,{color:O.assuranceAccent,children:l.local.padEnd(d+2)}),l.origin]},l.field))]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(X,{label:"local",text:t.mine,accent:!0}),(0,m.jsx)(X,{label:s,text:t.theirs})]}),p?p.map((l,u)=>(0,m.jsx)(b,{color:O.dim,children:` ${l}`},`x-${u}`)):null,(0,m.jsx)(Me,{headline:`what should happen to the local ${t.verb} from record ${t.orig.seq}`,ask:!0,rows:o,sel:a,focused:c}),(0,m.jsx)(b,{color:O.dim,children:" \u2191\u2193 select \xB7 \u23CE confirm \xB7 1\u20139 jump \xB7 v full record \xB7 a decide everything later \xB7 ctrl+c pause"})]})}function qn({name:t,count:e,from:n,backupPath:r,taking:s,sel:i,focused:o}){let a=[{key:"continue",label:"continue",detail:"save, take, reapply"},{key:"not-now",label:"not now",detail:"nothing changes"}];return(0,m.jsxs)(U,{flexDirection:"column",children:[(0,m.jsx)(b,{bold:!0,children:`rebase from ${t}`}),(0,m.jsx)(X,{label:"local",text:`${e} record${e===1?"":"s"} from position ${n} saved to ${r}`}),(0,m.jsx)(X,{label:t,text:`records ${s.from}..${s.to} taken into this store`}),(0,m.jsx)(X,{label:"then",text:"the local records reapplied on top; a disagreement becomes a decision you answer"}),(0,m.jsx)(X,{label:"never",text:`history on ${t} rewritten`}),(0,m.jsx)(Me,{headline:"continue",ask:!0,rows:a,sel:i,focused:o}),(0,m.jsx)(b,{color:O.dim,children:" \u2191\u2193 select \xB7 \u23CE confirm \xB7 esc not now"})]})}var E=D(ue(),1);function Vr(t){let e=t.detail,n=c=>c&&typeof c=="object"&&!Array.isArray(c)?c:null,r=n(e.was),s=n(e.mine),i=n(e.theirs);if(!r||!s||!i)return[];let o=c=>c==null?"":typeof c=="string"?c:JSON.stringify(c);return[...new Set([...Object.keys(r),...Object.keys(s),...Object.keys(i)])].filter(c=>o(s[c])!==o(r[c])||o(i[c])!==o(r[c])).map(c=>({field:c,was:o(r[c]),local:o(s[c]),origin:o(i[c])}))}function oi(t,e,n,r){let s={"keep-theirs":`kept ${n}'s version`,"apply-mine":"applied the local version","apply-mine-as-new":"added the local version as new",later:"decided later","later-all":"decided later"},i=r&&"deduped"in r?`already present on ${n}`:r&&"skipped"in r&&e!=="keep-theirs"?`not reapplied (${r.skipped.reason})`:s[e];return`decision ${t.holdId}: ${i}`}var rt=class{screen={kind:"idle"};version=0;interrupted=!1;scrollback={current:null};listeners=new Set;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));set(e){this.screen=e,this.emit()}note(e){this.scrollback.current?.append((0,E.jsx)(b,{children:e}))}flush(){return this.scrollback.current?.flush()??Promise.resolve()}emit(){this.version+=1;for(let e of this.listeners)e()}};function Qr(t){return(0,V.useSyncExternalStore)(t.subscribe,()=>t.version),t.screen}function Dr({ask:t,rows:e,done:n}){let[r,s]=(0,V.useState)(0),[i,o]=(0,V.useState)(!1);pe((c,p)=>{if(p.ctrl&&c==="c")return n("later-all");if(p.escape)return n("later");if(c==="a")return n("later-all");if(c==="v")return o(l=>!l);if(p.upArrow)return s(l=>Math.max(0,l-1));if(p.downArrow)return s(l=>Math.min(e.length-1,l+1));if(p.return)return n(e[r].answer);let d=Number(c);Number.isInteger(d)&&d>=1&&d<=e.length&&s(d-1)});let a=Vr(t.card);return(0,E.jsx)(In,{card:t.card,index:t.index,total:t.total,rebaseId:t.rebaseId,location:t.location,diff:a,rows:e,sel:r,focused:!0,expanded:i?t.record:void 0})}function es({ask:t,done:e}){let[n,r]=(0,V.useState)(0);return pe((s,i)=>{if(i.ctrl&&s==="c"||i.escape)return e(!1);if(i.upArrow)return r(0);if(i.downArrow)return r(1);if(s==="1")return r(0);if(s==="2")return r(1);if(i.return)return e(n===0)}),(0,E.jsx)(qn,{...t,sel:n,focused:!0})}function ts({store:t}){return pe((e,n)=>{n.ctrl&&e==="c"&&(t.interrupted=!0)}),null}function ns({store:t}){let e=Qr(t);return e.kind==="decide"?(0,E.jsx)(Dr,{ask:e.ask,rows:e.rows,done:e.done},e.ask.card.holdId):e.kind==="confirm"?(0,E.jsx)(es,{ask:e.ask,done:e.done}):(0,E.jsx)(ts,{store:t})}function rs({store:t}){return(0,E.jsxs)(it,{children:[(0,E.jsx)(Jt,{into:t.scrollback}),(0,E.jsx)(U,{flexDirection:"column",children:(0,E.jsx)(ns,{store:t})})]})}function ss(t,e){return _n(t,n=>nt(t.kind,n,e),e)}function An(){let t=new rt,e=null,n=async()=>{if(e)return;let{render:s}=await import("./build-JIKYOZUH.js");e=s((0,E.jsx)(rs,{store:t}),{exitOnCtrlC:!1}),at(()=>e?.unmount())},r=async()=>{if(!e)return;let s=e;e=null,await t.flush();let i=s.waitUntilExit().catch(()=>{});s.unmount(),await i,ct()};return{async confirm(s){await n();let i=await new Promise(o=>t.set({kind:"confirm",ask:s,done:o}));return t.set({kind:"idle"}),await r(),i},async decide(s){await n();let i=await new Promise(o=>t.set({kind:"decide",ask:s,rows:ss(s.card,s.location),done:o}));return t.set({kind:"idle"}),i},note(s){t.note(s)},close:r,interrupted:()=>t.interrupted}}import{resolve as os}from"path";import{fileURLToPath as is,pathToFileURL as as}from"url";var cs="us-east-1",ds=/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//,xe="use file:///abs/path, an absolute or relative directory path, s3://<bucket>/<prefix>?endpoint=<url>®ion=<region>, or a GitHub HTTPS/SSH repository URL";function Tn(t,e){let n=t.trim();if(n==="")throw new Error(`a location is required \u2014 ${xe}`);if(/^(?:git\+)?https:\/\//i.test(n)||/^(?:git\+)?ssh:\/\//i.test(n)||/^[^/\s@:]+@[^/\s:]+:/.test(n)||n.startsWith("git+scp://"))return us(n);if(!ds.test(n))return Cn(os(e,n));let r=new URL(n);switch(r.protocol){case"fake:":if(r.hostname==="")throw new Error(`fake:// needs a name \u2014 ${xe}`);return{kind:"fake",location:`fake://${r.hostname}`};case"file:":return Cn(is(r));case"s3:":return ls(r);default:throw new Error(`this release does not speak "${r.protocol}" \u2014 ${xe}`)}}function Cn(t){return{kind:"dir",location:as(t).href,path:t}}function ls(t){let e=t.hostname;if(e==="")throw new Error(`an s3 location needs a bucket \u2014 ${xe}`);let n=t.pathname.replace(/^\/+/,"").replace(/\/+$/,""),r=n===""?"":`${n}/`,s=t.searchParams.get("region")||cs;if(!/^[A-Za-z0-9-]{1,64}$/.test(s))throw new Error("the region must be letters, digits and dashes only, like us-east-1");let i=t.searchParams.get("endpoint"),o=i===null||i===""?null:ps(i),a=o===null?`?region=${s}`:`?endpoint=${o}®ion=${s}`,c={kind:"s3",location:`s3://${e}/${r}${a}`,bucket:e,prefix:r,region:s};return o!==null&&(c.endpoint=o),c}function ps(t){let e="the endpoint must be an http URL like http://127.0.0.1:9000",n;try{n=new URL(t)}catch{throw new Error(e)}if(n.protocol!=="http:"&&n.protocol!=="https:")throw new Error(e);if(n.username||n.password)throw new Error("an endpoint never carries a user name or password; pass credentials with --credential-env or --credential-file");if(n.search!==""||n.hash!==""||n.pathname!=="/")throw new Error(`the endpoint must be a host and port only, with no path or query \u2014 got ${n.origin}`);return`${n.protocol}//${n.host}`}var ve="Use a Git repository address with no dot or parent segments";function Ee(t){return t.split("/").some(e=>e==="."||e==="..")}function us(t){if(/[\x00-\x20\x7f]/.test(t))throw new Error("A Git location cannot contain whitespace or control characters");let e=t;if(e.startsWith("git+scp://")){let u=e.slice(10).replace(/[?#].*$/,"").replace(/^[^/]*/,"");if(Ee(u.slice(1)))throw new Error(ve);let f=new URL(e);e=`${decodeURIComponent(f.username)}@${f.hostname}:${f.pathname.slice(1)}${f.search}${f.hash}`}else e=e.replace(/^git\+/,"");let n=e.indexOf("#"),r=n<0?"main":decodeURIComponent(e.slice(n+1)),s=n<0?e:e.slice(0,n),i=s.indexOf("?"),o=i<0?s:s.slice(0,i),a=new URLSearchParams(i<0?"":s.slice(i+1));for(let u of a.keys())if(u!=="prefix")throw new Error("https: and ssh: Git locations accept only the prefix query option; never put credentials in a location");if(a.getAll("prefix").length>1)throw new Error("Only one Git prefix may be supplied");let c=a.get("prefix")??"";if(c&&(!/^[a-zA-Z0-9_~./-]+$/.test(c)||c.split("/").some(u=>!u||u==="."||u===".."||u.toLowerCase()===".git")))throw new Error("Use a relative Git prefix with no empty, dot or parent segments");if(!/^[A-Za-z0-9][A-Za-z0-9._/-]*$/.test(r)||r.includes("..")||r.includes("//")||r.endsWith(".")||r.split("/").some(u=>!u||u.startsWith(".")||u.endsWith(".lock")))throw new Error("Use a valid Git branch name");let p=/^([^/@:]+)@([^/:]+):(.+)$/.exec(o),d;if(p){if(!/^[A-Za-z0-9._-]+$/.test(p[1])||!/^[A-Za-z0-9.-]+$/.test(p[2])||!/^[A-Za-z0-9_~./-]+$/.test(p[3]))throw new Error("Use a valid SSH repository address");if(Ee(p[3]))throw new Error(ve);d=`git+scp://${p[1]}@${p[2]}/${p[3]}`}else{if(Ee(o.replace(/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\/[^/]*/,"")))throw new Error(ve);let u=new URL(o);if(!["https:","ssh:"].includes(u.protocol)||!u.hostname||!u.pathname||u.pathname==="/"||u.password||u.protocol==="https:"&&u.username)throw new Error("Use a secret-free HTTPS or SSH repository URL; sign in through Git instead");if(/%(?:00|0a|0d)/i.test(u.pathname))throw new Error("Invalid repository path");if(Ee(u.pathname))throw new Error(ve);o=u.href,d=`git+${u.href}`}let l=c?`?${new URLSearchParams({prefix:c})}`:"";return{kind:"git",gitUrl:o,branch:r,prefix:c,location:`${d}${l}#${encodeURIComponent(r)}`}}function di(t){if(t.kind==="dir")return t.path;if(t.kind!=="git")return t.location;let e=t.prefix?`?${new URLSearchParams({prefix:t.prefix})}`:"",n=t.branch&&t.branch!=="main"?`#${encodeURIComponent(t.branch)}`:"";return`${t.gitUrl}${e}${n}`}function st(t,e){(t.err??t.out)(`error: ${e}`)}function $i(t,e){let n=Nt(t);return fs(n)?n:(st(e,"no context store here (run `kane-cli context ingest <files>` first)"),null)}async function ki(t,e,n){return n?!0:t.isTTY?t.confirm(`${e}?`):(st(t,`refusing to ${e} without --yes (no TTY to confirm)`),!1)}function Ri(){return{out:t=>process.stdout.write(t+`
|
|
34
34
|
`),err:t=>process.stderr.write(t+`
|
|
35
|
-
`),isTTY:Ft(),walkUI:An,confirm:async t=>{let{createInterface:e}=await import("readline/promises"),n=e({input:process.stdin,output:process.stdout});try{let r=await n.question(`${t} [y/N] `);return/^y(es)?$/i.test(r.trim())}catch(r){if(r.name==="AbortError")return!1;throw r}finally{n.close()}},ask:async t=>{let{createInterface:e}=await import("readline/promises"),n=e({input:process.stdin,output:process.stdout});try{return await n.question(t)}finally{n.close()}}}}var hs=1500;function ms(t,e){return t==="behind"?`${e} has moved past this machine \u2014 run kane-cli context pull ${e}`:`this store and ${e} have diverged \u2014 run kane-cli context pull ${e} --rebase`}async function vi(t,e,n){let r=await gs(t,n);r&&e(r.text)}async function gs(t,e){if(process.env.KANE_SYNC_GUARD==="0")return null;try{let n=jt(t);if(n.locations.length===0)return null;let r=Gt(n),s=B(t).entries[r.name]?.witness;if(!s)return null;let{openProvider:i}=await import("./open-provider-
|
|
35
|
+
`),isTTY:Ft(),walkUI:An,confirm:async t=>{let{createInterface:e}=await import("readline/promises"),n=e({input:process.stdin,output:process.stdout});try{let r=await n.question(`${t} [y/N] `);return/^y(es)?$/i.test(r.trim())}catch(r){if(r.name==="AbortError")return!1;throw r}finally{n.close()}},ask:async t=>{let{createInterface:e}=await import("readline/promises"),n=e({input:process.stdin,output:process.stdout});try{return await n.question(t)}finally{n.close()}}}}var hs=1500;function ms(t,e){return t==="behind"?`${e} has moved past this machine \u2014 run kane-cli context pull ${e}`:`this store and ${e} have diverged \u2014 run kane-cli context pull ${e} --rebase`}async function vi(t,e,n){let r=await gs(t,n);r&&e(r.text)}async function gs(t,e){if(process.env.KANE_SYNC_GUARD==="0")return null;try{let n=jt(t);if(n.locations.length===0)return null;let r=Gt(n),s=B(t).entries[r.name]?.witness;if(!s)return null;let{openProvider:i}=await import("./open-provider-YIBB77FE.js"),o=i(Tn(r.location,t),r.name,e),a=await Promise.race([ws(t,o,s),bs()]);return a?{text:ms(a.kind,r.name),name:r.name,localSeq:a.localSeq,storageSeq:a.storageSeq}:null}catch{return null}}function Ei(t){return{type:"sync_behind",name:t.name,local_seq:t.localSeq,storage_seq:t.storageSeq,text:t.text}}async function ws(t,e,n){try{let r=L(t),s=r?.seq??0;return await e.head(_(n.seq+1))?{kind:"behind",localSeq:s,storageSeq:(await W(e,n.seq+1)).seq}:r===null||(await ae(e,r.seq)).hash===r.hash?null:{kind:"diverged",localSeq:s,storageSeq:(await W(e,r.seq)).seq}}catch{return null}}function bs(){return new Promise(t=>{setTimeout(()=>t(null),hs).unref()})}function ys(t){try{return Rt(t),null}catch(e){if(e instanceof kt)return{code:e.code,text:e.message,remedy:e.remedy};throw e}}function xi(t){return{type:"sync_error",code:t.code,detail:t.text,remedy:t.remedy}}function Oi(t,e){let n=ys(t);return n?(st(e,n.text),(e.err??e.out)(`next: ${n.remedy}`),!0):!1}export{oe as a,Be as b,jt as c,Es as d,B as e,zt as f,Gt as g,xs as h,ae as i,W as j,en as k,Qs as l,He as m,sn as n,je as o,ze as p,oo as q,vr as r,Er as s,xr as t,v as u,Ke as v,mn as w,xo as x,Oo as y,dn as z,_o as A,Jo as B,Mo as C,Bo as D,Wo as E,Ho as F,Uo as G,Zr as H,Yo as I,jo as J,kn as K,zo as L,oi as M,Tn as N,di as O,st as P,$i as Q,ki as R,Ri as S,vi as T,gs as U,Ei as V,ys as W,xi as X,Oi as Y};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as Ve}from"./chunk-
|
|
2
|
+
import{a as Ve}from"./chunk-QAB3Y5FQ.js";import{a as Ye}from"./chunk-4BZOG6PE.js";import{a as We}from"./chunk-YCCUBQY4.js";import{a as qe}from"./chunk-VE3SUJMA.js";import{a as be}from"./chunk-ZC2CKWLB.js";import{a as Ge}from"./chunk-C6S2RPZA.js";import{a as He}from"./chunk-NMSZ7G6P.js";import{b as Le,y as u}from"./chunk-5TQFOPJV.js";import{a as re}from"./chunk-HCBYKLMW.js";import{a as h,b as f,h as Fe,i as Se,k as Ne}from"./chunk-C44QQJR4.js";import{a as we}from"./chunk-6YGTRKDT.js";import{e as $}from"./chunk-UR6MHSHU.js";var je=$(we(),1);import{readFileSync as ct,writeFileSync as ut,mkdirSync as ft}from"fs";import{dirname as dt,join as ze}from"path";var mt=ze(Le,"command-history.json"),Dt=ze(Le,"generate-history.json"),ht=200,De=class{entries;filePath;max;constructor(t=mt,e=ht){this.filePath=t,this.max=e,this.entries=this._load()}push(t){this.entries.length>0&&this.entries[this.entries.length-1]===t||(this.entries.push(t),this.entries.length>this.max&&(this.entries=this.entries.slice(this.entries.length-this.max)),this._save())}getAll(){return[...this.entries]}search(t){let e=t.toLowerCase(),o=[];for(let s=this.entries.length-1;s>=0;s--)this.entries[s].toLowerCase().includes(e)&&o.push(this.entries[s]);return o}_load(){if(this.filePath===null)return[];try{let t=ct(this.filePath,"utf-8"),e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}}_save(){if(this.filePath!==null)try{ft(dt(this.filePath),{recursive:!0}),ut(this.filePath,JSON.stringify(this.entries)+`
|
|
3
3
|
`)}catch{}}};function kt(n){let t=(0,je.useRef)(null);return t.current||(t.current=new De(n)),t.current}var D=$(we(),1);var ke=$(we(),1);var Z=$(re(),1);function Xe({history:n,onSelect:t,onClose:e}){let[o,s]=(0,ke.useState)(""),[l,m]=(0,ke.useState)(0),v=o?n.search(o).slice(0,8):[];return Se((b,d)=>{if(d.escape){e();return}if(d.return){v.length>0&&v[l]?t(v[l]):e();return}if(d.upArrow){m(S=>Math.max(0,S-1));return}if(d.downArrow){m(S=>Math.min(v.length-1,S+1));return}if(d.backspace||d.delete){s(S=>S.slice(0,-1)),m(0);return}b&&!d.ctrl&&!d.meta&&(s(S=>S+b),m(0))}),(0,Z.jsxs)(h,{flexDirection:"column",marginLeft:2,borderStyle:"single",paddingX:1,children:[(0,Z.jsx)(f,{color:u.muted,bold:!0,children:"reverse search"}),(0,Z.jsxs)(h,{gap:1,children:[(0,Z.jsx)(f,{color:u.dim,children:"search:"}),(0,Z.jsx)(f,{children:o}),(0,Z.jsx)(f,{color:u.orange,children:"\u2588"})]}),v.length>0&&(0,Z.jsx)(f,{children:" "}),v.map((b,d)=>(0,Z.jsx)(h,{marginLeft:2,children:(0,Z.jsxs)(f,{color:d===l?u.orange:u.dim,bold:d===l,children:[d===l?"\u25B8 ":" ",b]})},`${d}-${b}`))]})}var X=$(re(),1);function Je({commands:n,selectedIndex:t}){return n.length===0?null:(0,X.jsx)(h,{flexDirection:"column",marginBottom:0,children:n.map((e,o)=>{let s=o===t;return e.disabled?(0,X.jsxs)(h,{children:[(0,X.jsx)(f,{color:u.dim,children:s?"\u276F ":" "}),(0,X.jsxs)(f,{color:u.dim,children:["/",e.name]}),(0,X.jsxs)(f,{color:u.dim,children:[" ",e.disabledReason??e.description]})]},e.name):(0,X.jsxs)(h,{children:[(0,X.jsx)(f,{color:s?u.orange:u.dim,children:s?"\u276F ":" "}),(0,X.jsxs)(f,{color:s?u.orange:void 0,bold:s,children:["/",e.name]}),e.args&&(0,X.jsxs)(f,{color:u.dim,children:[" ",e.args]}),(0,X.jsxs)(f,{color:u.dim,children:[" ",e.description]})]},e.name)})})}var Ze=$(we(),1);var q=$(re(),1),et={scenario:"Scenarios",case:"Test Cases",file:"Files",artifact:"Artifact candidates",installed:"Installed on device"};function Qe(n){let t={scenario:0,case:0,file:0,artifact:0,installed:0};for(let e of n)t[e.kind]++;return["scenario","case","file","artifact","installed"].filter(e=>t[e]>0).map(e=>`${t[e]} ${et[e]}`).join(" \xB7 ")}var Pe=7;function tt({items:n,selectedIndex:t,accent:e=u.orange}){let o=n.length;if(o===0)return null;let s=Math.floor(Pe/2),l=o<=Pe?0:Math.max(0,Math.min(t-s,o-Pe)),m=Math.min(o,l+Pe),v=l,b=o-m;return(0,q.jsxs)(h,{flexDirection:"column",marginBottom:0,children:[v>0&&(0,q.jsx)(h,{children:(0,q.jsx)(f,{color:u.dim,children:` \u22EF ${v} above \u2014 ${Qe(n.slice(0,l))}`})}),n.slice(l,m).map((d,S)=>{let U=l+S,F=d.selectable!==!1,E=U===t&&F,R=S===0||n[U-1].kind!==d.kind;return(0,q.jsxs)(Ze.default.Fragment,{children:[R&&(0,q.jsx)(h,{children:(0,q.jsx)(f,{color:u.dim,children:et[d.kind]})}),(0,q.jsxs)(h,{children:[(0,q.jsx)(f,{color:E?e:u.dim,children:E?"\u276F ":" "}),(0,q.jsxs)(f,{color:E?e:F?void 0:u.dim,bold:E,children:[d.label,d.reason?` \u2014 ${d.reason}`:""]})]})]},`${d.kind}:${d.value}:${U}`)}),b>0&&(0,q.jsx)(h,{children:(0,q.jsx)(f,{color:u.dim,children:` \u22EF ${b} more \u2014 ${Qe(n.slice(m))}`})})]})}var Be=$(we(),1);var gt=27,pt=127,xt=11;function bt(n){return n>=64&&n<=126}function Tt(n,t){n===xt&&t({killToEnd:!0,ctrl:!0,raw:String.fromCharCode(n)})}function vt(n,t){n===pt&&t({backspace:!0,meta:!0,raw:"\x1B\x7F"})}function wt(n,t){let e=n.map(s=>String.fromCharCode(s)).join(""),o=/^\[1;([0-9]+)([A-D])$/.exec(e);if(o){let s=parseInt(o[1],10),l=o[2],m={raw:"\x1B"+e};if(s===2)m.shift=!0;else if(s===3)m.meta=!0;else if(s===5)m.ctrl=!0;else return;l==="A"?m.arrowUp=!0:l==="B"?m.arrowDown=!0:l==="C"?m.arrowRight=!0:l==="D"&&(m.arrowLeft=!0),t(m);return}if(e==="[H"||e==="[1~"||e==="[7~"){t({home:!0,raw:"\x1B"+e});return}if(e==="[F"||e==="[4~"||e==="[8~"){t({end:!0,raw:"\x1B"+e});return}if(e==="[3;5~"){t({delete:!0,ctrl:!0,raw:"\x1B"+e});return}if(e==="[3;3~"){t({delete:!0,meta:!0,raw:"\x1B"+e});return}}function St(n,t){n===72?t({home:!0,raw:"\x1BO"+String.fromCharCode(n)}):n===70&&t({end:!0,raw:"\x1BO"+String.fromCharCode(n)})}function Et(){let n="IDLE",t=[];function e(){n="IDLE",t=[]}return{feed(o,s){for(let l of o)n==="IDLE"?l===gt?(n="ESC",t=[]):Tt(l,s):n==="ESC"?l===91?(n="CSI",t=[]):l===79?(n="SS3",t=[]):(vt(l,s),e()):n==="CSI"?(t.push(l),bt(l)&&(wt([91,...t],s),e())):n==="SS3"&&(St(l,s),e())},flushIdle(o){n==="ESC"&&t.length===0&&o({raw:"\x1B"}),e()}}}function nt(n,t={}){let e=(0,Be.useRef)(n);e.current=n;let{stdin:o}=Fe();(0,Be.useEffect)(()=>{if(t.isActive===!1||!o)return;let s=Et(),l=null,m=v=>{l&&(clearTimeout(l),l=null);let b=Buffer.isBuffer(v)?v:Buffer.from(v,"binary");s.feed(b,d=>e.current(d)),l=setTimeout(()=>{s.flushIdle(d=>e.current(d)),l=null},50)};return o.on("data",m),()=>{o.removeListener("data",m),l&&clearTimeout(l)}},[t.isActive,o])}var w=$(re(),1);function yt(n,t){let e=t-1;for(;e>=0&&n[e]!=="@"&&n[e]!==" "&&n[e]!==`
|
|
4
4
|
`;)e--;return e<0||n[e]!=="@"||e>0&&n[e-1]!==" "&&n[e-1]!==`
|
|
5
5
|
`?null:{at:e,query:n.slice(e+1,t).join("")}}function rt(n,t,e){for(let o=t+e;o>=0&&o<n.length;o+=e)if(n[o]?.selectable!==!1)return o;return t}function At(n){let t=n.findIndex(e=>e.selectable!==!1);return t===-1?0:t}var Oe=10;function Rt(n){return n.replace(/\x1b?\[200~/g,"").replace(/\x1b?\[201~/g,"").replace(/\r\n/g,`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as s}from"./chunk-
|
|
2
|
+
import{b as s}from"./chunk-XT7XA4DN.js";import{promises as o}from"fs";import{basename as d,join as a}from"path";function l(t){let e=(t??"").trim().replace(/^lt:\/\//i,"").trim();if(e)return(s(e)?e:d(e))||void 0}function g(t){return t.replace(/\([^)]*\)/g," ").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||void 0}async function w(t){try{let e=a(t,"steps"),u=(await o.readdir(e,{withFileTypes:!0})).filter(n=>n.isDirectory()).map(n=>n.name).sort((n,i)=>(parseInt(n,10)||0)-(parseInt(i,10)||0));for(let n of u)try{let i=await o.readFile(a(e,n,"step.json"),"utf8"),r=JSON.parse(i).basis?.window;if(Array.isArray(r)&&r.length===2&&Number.isFinite(Number(r[0]))&&Number.isFinite(Number(r[1]))&&Number(r[0])>0&&Number(r[1])>0)return`${Math.round(Number(r[0]))}x${Math.round(Number(r[1]))}`}catch{}return}catch{return}}export{l as a,g as b,w as c};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{b as R}from"./chunk-VZ7KXRXB.js";import{d as $,f as b,g as _,h as v,r as O,s as S,u as k,v as x}from"./chunk-NOL7MNZH.js";import{dirname as B,isAbsolute as D,resolve as G}from"path";var L=["db","api","js","smartui","network_query","network_assertion","gps","accessibility","media_injection","network_throttle","deeplink"];var a=class extends Error{constructor(r,o,e){super(`[${o}${e!=null?`:${e}`:""}] ${r}`);this.file=o;this.line=e;this.name="TestMdParseError"}};var E=["if","elif","else","end-if","while","end-while"];var M={"end-if":"if","end-while":"while"};function A(n,t){let r=[],o=()=>r[r.length-1];for(let i of t){let s=i.controlFlow;if(s==="if"||s==="while"){r.push({kind:s,id:i.index,branch:0,elseSeen:!1}),i.block={id:i.index,branch:0,depth:r.length};continue}if(s==="elif"||s==="else"){let d=o();if(!d||d.kind!=="if")throw new a(`@${s} outside an open @if`,n,i.headingLine);if(d.elseSeen)throw new a(`@${s} after @else`,n,i.headingLine);d.branch+=1,d.elseSeen=s==="else",i.block={id:d.id,branch:d.branch,depth:r.length};continue}if(s==="end-if"||s==="end-while"){let d=o(),l=M[s];if(!d||d.kind!==l)throw new a(`@${s} without an open @${l}`,n,i.headingLine);i.block={id:d.id,branch:-1,depth:r.length},r.pop();continue}let c=o();c&&(i.block={id:c.id,branch:c.branch,depth:r.length})}let e=o();if(e){let i=t.find(s=>s.index===e.id);throw new a(`unclosed @${e.kind} block`,n,i?.headingLine)}}var I=new Set(["username","access_key","oauth","profile","project_id","folder_id"]),C=new Set(["mode","max_steps","timeout","global_context","local_context","variables","session_context","code_export","code_language","url","target","chrome_profile","cdp_endpoint","ws_endpoint","headless","app","no_reset","os_version","device_name","on_lock_conflict","tags","assurance","dataset"]),K=new Set(["optional"]),V=new Set(["optional","variables"]),W=new Set(["target","chrome_profile","cdp_endpoint","ws_endpoint","headless"]),H=new Set(["app","no_reset","os_version","device_name"]),q=new Set(["mode","on_lock_conflict","tags","assurance","dataset"]);function Oe(n,t){let r=t.split(`
|
|
3
|
+
`),{global:o,bodyStartLine:e}=z(n,r),{title:i,steps:s}=ce(n,r,e);return{path:n,title:i,global:o,steps:s}}function z(n,t){if(t[0]?.trim()!=="---")return{global:{},bodyStartLine:0};let r=-1;for(let l=1;l<t.length;l++)if(t[l].trim()==="---"){r=l;break}if(r===-1)throw new a("frontmatter is missing closing '---'",n,1);let o=t.slice(1,r).join(`
|
|
4
|
+
`),e;try{e=R(o)??{}}catch(l){throw new a(`invalid YAML in frontmatter: ${l.message}`,n,1)}if(P(n,e,"frontmatter",1),e.on_lock_conflict!==void 0){let l=e.on_lock_conflict;if(l!=="readonly"&&l!=="fail"&&l!=="wait")throw new a(`on_lock_conflict must be 'readonly' | 'fail' | 'wait', got: ${JSON.stringify(l)}`,n,1)}if(j(n,e,1),pe(n,e,1),e.assurance!==void 0){let l=e.assurance;if(l===null||typeof l!="object"||Array.isArray(l))throw new a("assurance must be a mapping with sub-keys {id, base}",n,1);let f=l;for(let p of Object.keys(f))if(p!=="id"&&p!=="base")throw new a(`unknown assurance sub-key '${p}' \u2014 the engine block allows only {id, base}`,n,1);if(typeof f.id!="string"||f.id.length===0)throw new a("assurance.id must be a non-empty string (logical id)",n,1);if(f.base!==void 0&&!(typeof f.base=="string"&&/^sha256:[0-9a-f]+$/.test(f.base)))throw new a("assurance.base must be a 'sha256:<hex>' string",n,1)}if(e.tags!==void 0){let l=e.tags,f=Array.isArray(l)?l.map(p=>String(p)).join(","):String(l);e.tags=J(f,n,1)}if(e.target!==void 0&&(e.target=Q(e.target,n,1)),e.app!==void 0&&(e.app=X(e.app,n,1,e.target)),e.no_reset!==void 0&&typeof e.no_reset!="boolean")throw new a(`no_reset must be boolean: got ${typeof e.no_reset}`,n,1);if(e.os_version!==void 0&&typeof e.os_version!="string")if(typeof e.os_version=="number")e.os_version=String(e.os_version);else throw new a(`os_version must be a string: got ${typeof e.os_version}`,n,1);let i=e.target,s=_(i),c=b(i),d=$(i);if(c&&e.no_reset!==void 0)throw new a(`no_reset is not supported with target: ${i} \u2014 a real-device session always starts with a fresh install of the app. Remove no_reset from the file.`,n,1);if(s&&e.app===void 0)throw new a(`target: ${String(i)} needs an app \u2014 add \`app: <path-to-build | AppId>\``,n,1);if(!d&&e.app!==void 0)throw new a("app is only for mobile tests \u2014 add `target: emulator`, `simulator`, `android` or `ios`, or remove app from this web test",n,1);if(!d&&e.no_reset!==void 0)throw new a("no_reset requires a mobile target \u2014 add `target: emulator` or `target: simulator`",n,1);if(!d&&e.os_version!==void 0)throw new a("os_version is only for mobile tests \u2014 add `target: emulator`, `simulator`, `android` or `ios`, or remove os_version from this web test",n,1);if(e.device_name!==void 0&&typeof e.device_name!="string")throw new a(`device_name must be a string: got ${typeof e.device_name}`,n,1);if(!d&&e.device_name!==void 0)throw new a("device_name is only for mobile tests \u2014 add `target: emulator`, `simulator`, `android` or `ios`, or remove device_name from this web test",n,1);return{global:e,bodyStartLine:r+1}}function J(n,t,r){let e=n.trim().replace(/^\[/,"").replace(/\]$/,"").split(",").map(i=>i.trim().toLowerCase());if(e.length===0||e.some(i=>i.length===0))throw new a("tags must be a non-empty list of non-empty strings",t,r);return[...new Set(e)]}var U=new Set(["chrome","cdp","ws","emulator","simulator","android","ios"]),Z="target must be one of 'chrome' | 'cdp' | 'ws' (web), 'emulator' | 'simulator' (mobile, with a root `app:` key) or 'android' | 'ios' (a real device)";function Q(n,t,r){if(typeof n=="string"&&U.has(n))return n;throw n!==null&&typeof n=="object"&&!Array.isArray(n)?new a(`the mapping form of target is no longer accepted \u2014 write flat keys:
|
|
5
|
+
target: emulator | simulator
|
|
6
|
+
app: <path-to-build | AppId>`,t,r):new a(`${Z} \u2014 got: ${JSON.stringify(n)}`,t,r)}function X(n,t,r,o){if(typeof n!="string"||n.trim().length===0)throw new a("app must be a build (e.g. ./builds/app-debug.apk) or an app id from your cloud uploads",t,r);let e=n.trim(),i=b(o),s=O(i?["android","ios"]:["emulator","simulator"]);if(S(e,s)===void 0&&!/^APP\d{6,}$/.test(e))throw new a(i?`app '${e}' cannot run on a real device \u2014 use ${k("android")} (Android), ${k("ios")} (iOS), or an app ID from \`kane-cli apps list --target ${o}\`.`:`app '${e}' is not a build \u2014 expected a path ending in ${x(s,"or")}, or an app id from your cloud uploads.`,t,r);return ee(e,t)}function ee(n,t){return/^APP[0-9A-Za-z_-]+$/.test(n)||D(n)?n:G(B(t),n)}function Se(n){let t=n.target;if(b(t))return{platform:v(t),app:n.app??"",realDevice:!0,...n.os_version!==void 0?{os_version:n.os_version}:{},...n.device_name!==void 0?{device_name:n.device_name}:{}};if(_(t))return{platform:v(t)??"",app:n.app??"",...n.no_reset!==void 0?{no_reset:n.no_reset}:{},...n.os_version!==void 0?{os_version:n.os_version}:{},...n.device_name!==void 0?{device_name:n.device_name}:{}}}function xe(n){let t=n.target;return t==="chrome"||t==="cdp"||t==="ws"?t:void 0}var ne=/\s@verifies\s+(ac-[\w.:\/-]+(?:\s*,\s*ac-[\w.:\/-]+)*)\s*$/;function te(n,t,r){let o=ne.exec(t);if(o)return{label:t.slice(0,o.index).trim(),verifies:o[1].split(",").map(i=>i.trim())};let e=t.lastIndexOf("@verifies");if(e>0&&/\s/.test(t[e-1])){let i=t.slice(e+9).split(/[\s,]+/).filter(s=>s.length>0);if(i.length===0||i.every(s=>s.startsWith("ac-")))throw new a("malformed @verifies directive \u2014 expected '@verifies ac-<id>[, ac-<id>\u2026]' at the end of the heading",n,r)}return{label:t,verifies:[]}}var T=L.join("|"),oe=new RegExp(`^(.*\\S)\\s+@(${T})\\s*$`),re=new RegExp(`^@(${T})\\s*$`);function ie(n,t,r,o){let e=re.exec(t);if(e)throw new a(`replay-only marker @${e[1]} needs a step label before it (e.g. '## Step 3 @${e[1]}')`,n,r);let i=oe.exec(t);if(!i)return null;let s=i[2];if(o)throw new a(`only one replay-only marker per step \u2014 found @${o} and @${s}`,n,r);return{label:i[1].trim(),replayOnly:s}}var F=E.join("|"),se=new RegExp(`^(.*\\S)\\s+@(${F})\\s*$`),ae=new RegExp(`^@(${F})\\s*$`);function le(n,t,r,o){let e=ae.exec(t);if(e)throw new a(`control-flow marker @${e[1]} needs a step label before it (e.g. '## banner is visible @${e[1]}')`,n,r);let i=se.exec(t);if(!i)return null;let s=i[2];if(o)throw new a(`only one control-flow marker per step \u2014 found @${o} and @${s}`,n,r);return{label:i[1].trim(),controlFlow:s}}function de(n,t,r){let o=t,e,i,s=()=>{let d=ie(n,o,r,e);d&&({label:o,replayOnly:e}=d);let l=le(n,o,r,i);l&&({label:o,controlFlow:i}=l)};s();let c=te(n,o,r);if(o=c.label,s(),e&&i)throw new a(`@${i} is a control-flow marker and @${e} a replay-only marker \u2014 a step carries one or the other`,n,r);return{label:o,verifies:c.verifies,...e?{replayOnly:e}:{},...i?{controlFlow:i}:{}}}function ce(n,t,r){let o,e=r;for(;e<t.length&&t[e].trim()==="";)e++;let i=e<t.length?/^#\s+(.+?)\s*$/.exec(t[e]):null;i&&(o=i[1],e++);let s=[];for(let d=e;d<t.length;d++)/^##\s/.test(t[d])&&s.push(d);let c=[];for(let d=0;d<s.length;d++){let l=s[d],f=s[d+1]??t.length,p=t[l].replace(/^##\s+/,"").trim(),{label:w,verifies:u,replayOnly:g,controlFlow:m}=de(n,p,l+1),y=t.slice(l+1,f),{config:Y,body:h,optional:N}=fe(n,l+1,y);if(g&&h.kind==="import_ref")throw new a(`@${g} is a replay-only marker for objective steps \u2014 it cannot mark an @import row`,n,l+1);if(m&&h.kind==="import_ref")throw new a(`@${m} is a control-flow marker for objective steps \u2014 it cannot mark an @import row`,n,l+1);c.push({index:d+1,heading:w,verifies:u,config:Y,body:h,headingLine:l+1,optional:N,...g?{replayOnly:g}:{},...m?{controlFlow:m}:{}})}return A(n,c),{title:o,steps:c}}function fe(n,t,r){let o=0;for(;o<r.length&&r[o].trim()==="";)o++;let e,i=t;if(o<r.length&&/^```yaml\s*$/.test(r[o])){let u=o;i=t+u,o++;let g=-1;for(;o<r.length;){if(/^```\s*$/.test(r[o])){g=o;break}o++}if(g===-1)throw new a("step-config fenced ```yaml block is not closed",n,i);let m=r.slice(u+1,g).join(`
|
|
7
|
+
`);try{e=R(m)??{}}catch(y){throw new a(`invalid YAML in step config: ${y.message}`,n,i)}o=g+1}let s=ue(r.slice(o)),c=s.filter(u=>u.trim()!=="");if(c.length>0&&/^@session\s+/.test(c[0].trim()))throw new a("@session is no longer supported (iteration 3); use @import instead",n,t);let d=/^@import\s+(\S.*)$/,f=s.filter(u=>d.test(u.trim())).length>0;if(f&&c.length!==1)throw new a("step body must be exactly one of prose / @import",n,t);let p=!1,w;if(e){if(P(n,e,f?"step config (ref)":"step config (objective)",i),j(n,e,i),typeof e.optional=="boolean")p=e.optional;else if(e.optional!==void 0)throw new a(`step config 'optional' must be boolean: got ${typeof e.optional}`,n,i);let u={...e};delete u.optional,f&&delete u.variables,!f&&Object.keys(u).length>0&&(w=u)}if(f){let g=d.exec(c[0].trim())[1].trim(),m=e?.variables;return{body:{kind:"import_ref",path:g,...m&&Object.keys(m).length>0?{bindings:m}:{}},optional:p}}return{body:{kind:"objective",text:s.join(`
|
|
8
|
+
`).trim()},config:w,optional:p}}function ue(n){let t=0,r=n.length;for(;t<r&&n[t].trim()==="";)t++;for(;r>t&&n[r-1].trim()==="";)r--;return n.slice(t,r)}function j(n,t,r){let o=t.variables;if(o==null)return;if(typeof o!="object"||Array.isArray(o))throw new a("variables must be an object map",n,r);let e={};for(let[i,s]of Object.entries(o))if(typeof s=="string")e[i]={value:s};else if(s&&typeof s=="object"&&!Array.isArray(s)&&typeof s.value=="string")e[i]=s;else throw new a(`variable '${i}' must be a string or { value: ... } object`,n,r);t.variables=e}function pe(n,t,r){let o=t.dataset;if(o==null)return;if(typeof o=="string"){if(!o.trim())throw new a("dataset needs an id",n,r);t.dataset={id:o.trim()};return}if(typeof o!="object"||Array.isArray(o))throw new a("dataset must be an id or a mapping { id, row }",n,r);let e=o;for(let s of Object.keys(e))if(s!=="id"&&s!=="row")throw new a(`unknown dataset sub-key '${s}' \u2014 only { id, row } are allowed`,n,r);if(typeof e.id!="string"||!e.id.trim())throw new a("dataset needs an id",n,r);let i={id:e.id.trim()};if(e.row!==void 0){let s=e.row;if(!(typeof s=="string"&&s.trim().length>0&&!/^\d+$/.test(s.trim())))throw new a(`dataset row must be the row's _id as Test Manager shows it, not a position: got ${JSON.stringify(s)}`,n,r);i.row=s.trim()}t.dataset=i}function P(n,t,r,o){for(let e of Object.keys(t)){if(I.has(e))throw new a(`auth/identity keys are CLI-only: ${e}`,n,o);if(r==="frontmatter"){if(K.has(e))throw new a(`step-only key in frontmatter: ${e}`,n,o);if(!C.has(e))throw new a(`unknown config key: ${e}`,n,o)}else if(r==="step config (objective)"){if(!C.has(e)&&!K.has(e))throw new a(`unknown config key: ${e}`,n,o);if(W.has(e))throw new a(`chrome config is global-only: ${e}`,n,o);if(H.has(e))throw new a(`'${e}' is global-only: the whole run drives one app`,n,o);if(q.has(e))throw new a(`'${e}' is run-level and cannot be set per-step`,n,o)}else if(!V.has(e))throw new a(`step config on @import may only contain 'optional' / 'variables': got ${e}`,n,o)}}export{Oe as a,Se as b,xe as c,ne as d};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as y}from"./chunk-WD52ZNQY.js";import{
|
|
2
|
+
import{b as y}from"./chunk-WD52ZNQY.js";import{b as l,d,e as m,g,h as S}from"./chunk-JQY5HRZ4.js";import{a as f}from"./chunk-QAB3Y5FQ.js";import{r as u,s as p}from"./chunk-RSSOJ3L2.js";import{existsSync as s,mkdirSync as h,readFileSync as C,renameSync as w,writeFileSync as R}from"fs";import{join as x}from"path";function G(e){y(l(e));let r=l(e);if(!s(r))return;let n=x(r,"meta.json"),o=m(e);if(s(n)&&!s(o))try{h(d(e),{recursive:!0}),w(n,o)}catch(t){process.stderr.write(`warn: meta.json migration failed: ${t.message}
|
|
3
3
|
`)}let a=S(e);if(s(a)){let t="python";try{let i=new f().load();i.code_export?.language&&(t=i.code_export.language)}catch{}let c=g(e,"playwright",t);if(!s(c))try{w(a,c)}catch(i){process.stderr.write(`warn: generated-code migration failed: ${i.message}
|
|
4
4
|
`)}}if(s(o))try{let t=JSON.parse(C(o,"utf8"));"md5sum"in t&&(delete t.md5sum,R(o,JSON.stringify(t,null,2)+`
|
|
5
5
|
`,"utf8"))}catch(t){process.stderr.write(`warn: meta.json md5sum strip failed: ${t.message}
|
|
6
|
-
`)}}async function O(e){if(!e.isInteractive)return{recovered:!1};if(E(e.creds))return{recovered:!1};let{SingleShotApp:r}=await import("./SingleShotApp-
|
|
6
|
+
`)}}async function O(e){if(!e.isInteractive)return{recovered:!1};if(E(e.creds))return{recovered:!1};let{SingleShotApp:r}=await import("./SingleShotApp-UYCAW65Y.js"),{ScrollbackProvider:n}=await import("./scrollback-JLPJR25X.js"),{render:o}=await import("./build-JIKYOZUH.js"),a=await import("./react-QWOAB3TB.js"),t={current:null},c={current:!1},{waitUntilExit:i,unmount:v}=o(a.default.createElement(n,null,a.default.createElement(r,{resultRef:t,mode:"login",loginCompleteRef:c})),{exitOnCtrlC:!1});p(()=>v()),await i();try{process.stdin.setRawMode?.(!1)}catch{}return process.stdout.write("\x1B[?25h"),c.current?{recovered:!0}:(u(0,"Startup gate cancelled"),{recovered:!1})}function E(e){let r=e.getActiveProfile(),n=e.getDefaultEnv();if(!r||!!!(e.loadBasicAuth(r,n)||e.loadCredentials(r,n)))return!1;let a=e.loadProfileConfig(r,n)??{};return!!a.project_id&&!!a.folder_id}export{G as a,O as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as S}from"./chunk-I7TIGB7K.js";import{a as x,b as P,c as C,d as V,e as j}from"./chunk-
|
|
2
|
+
import{a as S}from"./chunk-I7TIGB7K.js";import{a as x,b as P,c as C,d as V,e as j}from"./chunk-XKHWWKJZ.js";import{a as R,b as D}from"./chunk-KDNNMU7Q.js";import{o as f,p as k,z as y}from"./chunk-IICT4VOU.js";import{e as b}from"./chunk-3UI5VTQS.js";import{f as w}from"./chunk-FQNQVC5O.js";function I(o,t){return{contextDir:o,rootSid:t,locks:w(o,t),probe:S(o,{resolveAlias:i=>P(i),embed:(i,s)=>C(i,s),readVector:(i,s)=>V(o,i,s),writeVector:(i,s,n)=>j(o,i,s,n)})}}var N=new Set(["archive"]);async function Y(o,t,i,s){let n=y(o.contextDir);if(i.v==="defer")return{outcome:"deferred"};if(t.kind==="MODIFY_HELD"){if(!t.heldPayload)return{outcome:"failed",detail:`${t.ref} carries no held payload`};let e=t.heldPayload;if(i.v==="keep_current"){if(!e.event_id)return{outcome:"failed",detail:`this held row has no durable event id \u2014 resume the owner to drop it: kane-cli context extract --resume ${e.sid}`};let{commitChatTurn:r}=await import("./chat-committer-6D7AQI6Z.js"),u=r({contextDir:o.contextDir,graph:n,ops:[{kind:"resolve_question",questionId:`drop-held:${e.sid}:${e.tempRef}`,resolution:"deferred",eventId:e.event_id}],by:s});return u.errors?{outcome:"failed",detail:u.errors.map(d=>`${d.code}: ${d.detail}`).join("; ")}:(o.signals?.({ref:t.ref,verdict:"held-dropped"}),{outcome:"committed",detail:"held payload dropped (recorded) \u2014 the owner's resume will not re-present it"})}if(i.v==="approve"){let r=e.content._held??null;if(!r?.source_id||!r.source_cid||!r.anchor||!r.quote)return{outcome:"failed",detail:`this held row carries no committable provenance \u2014 resume the owner to apply it: kane-cli context extract --resume ${e.sid}`};{let a=n.mediaOf(r.source_cid),m=R(o.contextDir,n,r.source_cid),g=a.format==="image"?null:m?D(m):null;if(a.format!=="image"&&g===null)return{outcome:"failed",detail:`the pinned source ${r.source_id} (${r.source_cid.slice(0,19)}) has no citable text to verify this held row against \u2014 resume the owner: kane-cli context extract --resume ${e.sid}`};let _=b(a,{anchor:r.anchor,quote:r.quote},g);if(_.length>0)return{outcome:"failed",detail:`held provenance does not verify against the pinned source (${_.map($=>`${$.code}: ${$.detail}`).join("; ")}) \u2014 resume the owner: kane-cli context extract --resume ${e.sid}`}}let{commitProposal:u}=await import("./committer-2QPBANRD.js"),{_held:d,...c}=e.content,q={version:1,read_basis:n.latestHash,source:{source_id:r.source_id,source_cid:r.source_cid},use_cases:[{temp_ref:e.tempRef,title:String(c.title??e.tempRef),...c.summary!==void 0?{summary:c.summary}:{},risk:String(c.risk??"med"),cite:{anchor:r.anchor,quote:r.quote},depends_on_hint:[],matches_existing:null}]},l=await x(I(o.contextDir,o.rootSid??`review-${process.pid}`),{verb:"maintain",ucTargets:[],newBuCandidates:[{tempRef:e.tempRef,title:String(c.title??e.tempRef),probeText:`${String(c.title??"")} ${String(c.summary??"")}`.trim()}],sourcePins:[{source_id:r.source_id,source_cid:r.source_cid}],readBasis:n.latestHash,...e.event_id?{eventIds:[e.event_id]}:{}},a=>{let m=u({contextDir:o.contextDir,graph:a.graph,proposal:q,proposalId:null,verdicts:new Map([[e.tempRef,{resolution:"skipped"}]]),by:s,autoName:!0,allowStaleBasis:!0,eventIds:e.event_id?[e.event_id]:a.eventIds("maintain",1),sid:a.sid,probeHits:a.probeHits});return m.errors!==null?{errors:m.errors}:{result:m,record:m.record}}),h=l.ok&&"result"in l?l.result:{record:null,errors:l.ok?null:l.kind==="validation"?l.errors:[{code:l.kind==="contended"?l.err.code:"UNSETTLED",detail:l.kind==="contended"?`held by ${l.err.holder?.owner_sid??"another session"}`:"concurrent activity kept moving the store"}]};return h.errors?{outcome:"failed",detail:h.errors.map(a=>`${a.code}: ${a.detail}`).join("; ")}:(o.signals?.({ref:t.ref,verdict:"held-applied"}),{outcome:"committed",detail:`held payload committed (derived) by ${s.id}`})}return{outcome:"failed",detail:`verdict ${i.v} does not apply to a MODIFY_HELD card`}}let v=n.resolve(t.ref);if(!v)return{outcome:"failed",detail:`${t.ref} names nothing in the graph`};let p=n.tipOf(v.cid);if(i.v==="archive"){if(!i.because||!i.because.trim())return{outcome:"failed",detail:"archive requires --because (a reason the record keeps)"};let e=f({contextDir:o.contextDir,graph:n,verdicts:new Map([[p,{resolution:"rejected",reason:i.because}]]),by:s});return e.errors?{outcome:"failed",detail:e.errors.map(r=>`${r.code}: ${r.detail}`).join("; ")}:(o.signals?.({ref:t.ref,verdict:"archived",reason:i.because}),{outcome:"retired"})}if(i.v==="approve"){let e=f({contextDir:o.contextDir,graph:n,verdicts:new Map([[p,{resolution:"approved"}]]),by:s});return e.errors?{outcome:"failed",detail:e.errors.map(r=>`${r.code}: ${r.detail}`).join("; ")}:(o.signals?.({ref:t.ref,verdict:"approved"}),{outcome:"applied"})}if(i.v==="merge"||i.v==="keep_both"){if(t.kind!=="PAIR"||!t.pair)return{outcome:"failed",detail:`${t.ref} is not a PAIR card`};let e=n.resolve(t.pair.candidate_cid);if(!e)return{outcome:"failed",detail:`pair candidate ${t.pair.candidate_ref} names nothing`};let r=n.tipOf(e.cid);if(i.v==="merge"){let d=k({contextDir:o.contextDir,graph:n,survivor:r,merged:p,reason:`pair merge: duplicate of ${t.pair.candidate_ref} (score ${t.pair.score})`,by:s});return d.errors?{outcome:"failed",detail:d.errors.map(c=>`${c.code}: ${c.detail}`).join("; ")}:(o.signals?.({ref:t.ref,verdict:"pair-merged",reason:t.pair.candidate_ref}),{outcome:"committed",detail:`merged into ${t.pair.candidate_ref} \u2014 survivor stays derived`})}let u=f({contextDir:o.contextDir,graph:n,verdicts:new Map([[p,{resolution:"approved"}],[r,{resolution:"approved"}]]),by:s});return u.errors?{outcome:"failed",detail:u.errors.map(d=>`${d.code}: ${d.detail}`).join("; ")}:(o.signals?.({ref:t.ref,verdict:"pair-kept-both",reason:t.pair.candidate_ref}),{outcome:"applied",detail:"both promoted as distinct"})}return{outcome:"failed",detail:`verdict ${i.v} does not apply to a ${t.kind} card`}}export{I as a,N as b,Y as c};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as
|
|
2
|
+
import{c as d,d as p,e as g}from"./chunk-7GAHJZLH.js";import{b as m}from"./chunk-5TQFOPJV.js";import{mkdirSync as y,writeFileSync as o,existsSync as u,readFileSync as M}from"fs";import{join as a}from"path";var E={name:"remote-execution",version:"0.5.0",backendId:"hyper",kaneCompat:">=0.4.0",defaults:{runson:"mac",concurrency:1}},f={runson:"mac",concurrency:1,timeoutMinutes:120,mobile:{runson:"mac26",queueTimeout:300,appiumPort:4739,androidHome:"$HOME/android-sdk-shim",globalTimeout:90,testSuiteTimeout:90,testSuiteStep:45,ios:{runson:{}},realDevice:{runson:"linux"}}},v=`version: "0.1"
|
|
3
3
|
runson: {{runson}}
|
|
4
4
|
autosplit: true
|
|
5
5
|
concurrency: {{concurrency}}
|
|
@@ -25,28 +25,30 @@ uploadArtefacts:
|
|
|
25
25
|
- name: kane-testrun
|
|
26
26
|
path:
|
|
27
27
|
{{uploadPaths}}
|
|
28
|
-
`,
|
|
28
|
+
`,R=` KANE_SESSIONS="$HOME/.testmuai/kaneai/sessions"
|
|
29
29
|
mkdir -p "$KANE_SESSIONS"
|
|
30
30
|
KANE_MARK=$(mktemp)
|
|
31
|
-
`,
|
|
31
|
+
`,h=` mkdir -p artifacts/session
|
|
32
32
|
find "$KANE_SESSIONS" -mindepth 1 -maxdepth 1 -type d -newer "$KANE_MARK" -exec cp -R {} artifacts/session/ \\; 2>/dev/null || true
|
|
33
33
|
rm -f "$KANE_MARK" 2>/dev/null || true
|
|
34
|
-
|
|
34
|
+
`,$=`{{kaneDistSwap}} C=$(find /Users/ltuser/lrc/chrome /Applications "$HOME/Applications" -maxdepth 6 -name 'Google Chrome' -path '*/MacOS/*' -type f 2>/dev/null | head -1)
|
|
35
35
|
if [ -z "$C" ]; then C=$(command -v google-chrome || command -v google-chrome-stable || true); fi
|
|
36
36
|
if [ -n "$C" ]; then export KANE_CLI_CHROME_PATH="$C"; echo "using chrome: $C"; fi
|
|
37
37
|
{{sessionMark}} kane-cli testmd run "$test" --env {{env}} --no-evidence-publish --headless --agent{{memberFlags}}
|
|
38
38
|
rc=$?
|
|
39
|
-
{{sessionCopy}} exit $rc
|
|
39
|
+
{{sessionCopy}} exit $rc`,P=` NPMROOT=$(npm root -g)
|
|
40
40
|
rm -rf "$NPMROOT/@testmuai/kane-cli/dist"
|
|
41
41
|
cp -R {{kaneDist}} "$NPMROOT/@testmuai/kane-cli/dist"
|
|
42
42
|
echo "[swap] patched kane-cli dist installed from {{kaneDist}}"
|
|
43
43
|
`,C=`{{kaneDistSwap}} adb devices
|
|
44
|
-
{{
|
|
44
|
+
{{memberLookup}}{{sessionMark}} kane-cli testmd run "$test" --env {{env}} --no-evidence-publish --agent{{deviceFlags}}{{memberFlags}}
|
|
45
45
|
rc=$?
|
|
46
46
|
{{sessionCopy}} exit $rc`,x=`{{kaneDistSwap}} xcrun simctl list devices available | grep -v -- '-- Unavailable' || true
|
|
47
|
-
{{
|
|
47
|
+
{{memberLookup}}{{sessionMark}} kane-cli testmd run "$test" --env {{env}} --no-evidence-publish --agent{{deviceFlags}}{{memberFlags}}
|
|
48
48
|
rc=$?
|
|
49
|
-
{{sessionCopy}} exit $rc
|
|
50
|
-
|
|
49
|
+
{{sessionCopy}} exit $rc`,b=`{{kaneDistSwap}}{{memberLookup}}{{sessionMark}} kane-cli testmd run "$test" --env {{env}} --no-evidence-publish --agent{{deviceFlags}}{{memberFlags}}
|
|
50
|
+
rc=$?
|
|
51
|
+
{{sessionCopy}} exit $rc`;var k={"remote-execution":{manifest:E,templates:{"hyperexecute.yaml.tmpl":v},config:f}};function S(e){return k[e]}function B(e,i){let l=i.base??m,s=S(e);if(!s)return{status:"failed",name:e,version:"",dir:"",error:`unknown plugin '${e}'`};let n=s.manifest.version;if(i.version&&i.version!==n)return{status:"failed",name:e,version:n,dir:"",error:`only bundled version ${n} is available (requested ${i.version})`};let t=d(e,n,l),c=p(e,l),_=u(a(t,"plugin.json"))&&u(c)&&M(c,"utf8").trim()===n;try{y(a(t,"templates"),{recursive:!0}),o(a(t,"plugin.json"),JSON.stringify(s.manifest,null,2)+`
|
|
52
|
+
`);for(let[N,O]of Object.entries(s.templates))o(a(t,"templates",N),O);let r=g(e,l);return u(r)||o(r,JSON.stringify(s.config,null,2)+`
|
|
51
53
|
`),o(c,n+`
|
|
52
|
-
`),{status:
|
|
54
|
+
`),{status:_?"already-installed":"installed",name:e,version:n,dir:t}}catch(r){return{status:"failed",name:e,version:n,dir:t,error:r.message}}}export{v as a,R as b,h as c,$ as d,P as e,C as f,x as g,b as h,B as i};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{e as O}from"./chunk-
|
|
2
|
+
import{e as O}from"./chunk-VHW7BMZQ.js";import{a as k,c as j}from"./chunk-HGFWIBVF.js";import{dirname as J,basename as L,join as p}from"path";function H(e){let t=L(e);return t.endsWith("_test.md")?t.slice(0,-8):t.endsWith("_module.md")?t.slice(0,-10):t.endsWith(".md")?t.slice(0,-3):t}function b(e){return p(J(e),`output-${H(e)}`)}function pe(e){return p(b(e),"Result.md")}function M(e){return p(b(e),".internal")}function R(e){return p(M(e),"meta.json")}function ue(e){return p(M(e),"execution.json")}function ge(e,t,n){return p(b(e),`${t}-${n}-code`)}function le(e){return p(b(e),"generated-code")}function fe(e){return b(e)+".staging"}function U(e){return p(M(e),"steps")}function me(e,t,n){return p(U(e),`${t}-${n}`)}import{writeFileSync as Y,mkdirSync as z,readFileSync as B}from"fs";import{dirname as T}from"path";function q(e){return typeof e=="string"&&e.trim()||void 0}function ve(e){return q(y(e)?.tc_id)}function Me(e){let t=y(e)?.environment_id;return typeof t=="number"&&Number.isInteger(t)&&t>0?t:void 0}function y(e){try{return JSON.parse(B(R(e),"utf8"))}catch{return null}}function Re(e){let t=R(e.sourcePath);try{z(T(t),{recursive:!0})}catch(i){return process.stderr.write(`
|
|
3
3
|
\u26A0 Failed to create output directory.
|
|
4
4
|
${i.message}
|
|
5
5
|
Path: ${T(t)}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as N,c as O,e as S,f as D,j as T,q as y,s as z,u as U}from"./chunk-
|
|
2
|
+
import{b as N,c as O,e as S,f as D,j as T,q as y,s as z,u as U}from"./chunk-JQY5HRZ4.js";import{a as Y,b as M}from"./chunk-NBXYL2JT.js";import{a as F}from"./chunk-HGFWIBVF.js";import{a as R}from"./chunk-DHJSM5DT.js";import{a as A}from"./chunk-5TQFOPJV.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 c=[s];for(let n of l.steps)for(let a of n.trace.slice(1))c.includes(a.file)||c.push(a.file);Q(c);let o=[],d=[];for(let n of l.unitFiles){if(n.file===s)continue;let a=N(n.file);o.includes(a)||o.push(a),n.kind==="module"&&d.push(S(n.file))}let m=[...c],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 w=m.map(n=>{let a=n===r&&t.identityOverride?Buffer.from(JSON.stringify({...JSON.parse(I(n,"utf8")),commit_id:t.identityOverride.commit_id},null,2)+`
|
|
3
3
|
`):void 0,E=a??I(n);return{abs:n,rel:B(P(f,n)),sha256:q("sha256").update(E).digest("hex"),bytes:E.length,...a?{contents:a}:{}}}).sort((n,a)=>n.rel<a.rel?-1:1),x=B(P(f,s)),L={schema_version:2,entry:x,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:w.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:x,files:w,manifest:L}}var g=e=>e instanceof Error?e.message:String(e);function W(e){return new Promise((t,s)=>{let r=(0,C.default)("zip",{zlib:{level:6}}),i=[];r.on("data",l=>i.push(l)),r.on("error",s),r.on("end",()=>t(Buffer.concat(i))),r.append(JSON.stringify(e.manifest,null,2)+`
|
|
4
4
|
`,{name:b});for(let l of e.files)l.contents?r.append(l.contents,{name:l.rel}):r.file(l.abs,{name:l.rel});r.finalize()})}async function X(e){let{plan:t,controller:s,testId:r,sessionId:i,commitId:l}=e,c;try{c=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,c,"application/zip")}catch(d){return{ok:!1,stage:"upload",error:g(d)}}return{ok:!0,bytes:c.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,c=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}),c({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}),c({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}),c({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,7 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as x}from"./chunk-TDPWFYTJ.js";import{a as A}from"./chunk-QAB3Y5FQ.js";import{d as S}from"./chunk-ZXY4P76I.js";import{a as R}from"./chunk-MMBBQ4OZ.js";import{a as m}from"./chunk-NMSZ7G6P.js";import{f as g}from"./chunk-NOL7MNZH.js";import{d as E,i as y}from"./chunk-5TQFOPJV.js";import{spawn as h,execSync as U}from"child_process";import{appendFileSync as M,existsSync as f,mkdirSync as P}from"fs";import{homedir as L}from"os";import{join as V,resolve as s,dirname as v,delimiter as b}from"path";import{fileURLToPath as D}from"url";import{createInterface as I}from"readline";async function*T(e){let n=I({input:e,crlfDelay:1/0});for await(let r of n){let o=r.trim();if(o)try{let i=JSON.parse(o);i&&typeof i.type=="string"&&(yield i)}catch{}}}function N(e){return e==="action"?{set:{V16_AGENT_ENABLE_ALL_BLOCKERS:"true",V16_BIFURCATION_PHASES:"1"},unset:["V16_NETWORK_WS","V16_NETWORK_SSE"]}:{set:{V16_BIFURCATION_PHASES:"1"},unset:["V16_AGENT_ENABLE_ALL_BLOCKERS","V16_NETWORK_WS","V16_NETWORK_SSE"]}}function O(e){return e?{set:{},unset:["V16_AGENT_SKIP_CP_FINAL"]}:{set:{V16_AGENT_SKIP_CP_FINAL:"true"},unset:[]}}function w(e){return e==="dom"?{set:{V16_AGENT_ENABLE_TEXTUAL_VISUAL:"true"},unset:[]}:{set:{},unset:["V16_AGENT_ENABLE_TEXTUAL_VISUAL"]}}var c=v(D(import.meta.url));function k(){for(let e of["python3","python"])try{return U(`${e} --version`,{stdio:"ignore"}),e}catch{}return null}function B(){let n=process.platform==="win32"?"v16-runner.exe":"v16-runner",r={"darwin-arm64":["@testmuai/kane-cli-darwin-arm64","@lambdatestincprivate/kane-cli-darwin-arm64"],"darwin-x64":["@testmuai/kane-cli-darwin-x64","@lambdatestincprivate/kane-cli-darwin-x64"],"linux-x64":["@testmuai/kane-cli-linux-x64","@lambdatestincprivate/kane-cli-linux-x64"],"linux-arm64":["@testmuai/kane-cli-linux-arm64","@lambdatestincprivate/kane-cli-linux-arm64"],"win32-x64":["@testmuai/kane-cli-win-x64","@lambdatestincprivate/kane-cli-win-x64"]},o=`${process.platform}-${process.arch}`,i=r[o];if(i)for(let t of i){let a=[s(c,"..","node_modules",t,"bin",n),s(c,"..","..","node_modules",t,"bin",n),s(c,"..","..","..","node_modules",t,"bin",n),s(c,"..","..","..","..","node_modules",t,"bin",n)];for(let u of a)if(f(u))return{cmd:u,args:[]}}let d=[s(c,"bin",n),s(c,"..","bin",n),s(c,"..","..","..","..","v16-runner","dist",n),s(c,"..","..","..","v16-runner","dist",n),s(c,"..","..","v16-runner","dist",n),s(process.cwd(),"v16-runner","dist",n),s(process.cwd(),"..","v16-runner","dist",n)];for(let t of d)if(f(t))return{cmd:t,args:[]};let l=[s(c,"..","..","v16-runner"),s(c,"..","..","..","..","v16-runner"),s(c,"..","..","..","v16-runner"),s(process.cwd(),"v16-runner"),s(process.cwd(),"..","v16-runner")];for(let t of l)if(f(s(t,"main.py"))){for(let u of[s(t,".venv","bin","python"),s(t,"..",".venv","bin","python"),s(t,"..","browser-agent",".venv","bin","python")])if(f(u))return{cmd:u,args:["main.py"],cwd:t};let a=k();if(a)return{cmd:a,args:["main.py"],cwd:t}}return null}function C(e){return e?V(L(),".testmuai","kaneai","sessions",e,"runner-stderr.log"):null}function H(e){let n=h(e.runner.cmd,e.runner.args,{stdio:["pipe","pipe","pipe"],env:e.env,cwd:e.runner.cwd});n.stdin.on("error",()=>{});let r=C(e.sessionId);if(r)try{P(v(r),{recursive:!0})}catch{}let o=1e5,i="";n.stderr.on("data",u=>{if(i+=u.toString(),i.length>o&&(i=i.slice(-o)),r)try{M(r,u)}catch{}}),n.on("error",u=>{e.log?.("error","RUNNER_SPAWN_ERROR","Runner spawn error",{error:u.message})});let d=null,l=null,t=new Promise(u=>{n.on("close",(p,_)=>{d=p,l=_?String(_):null,e.log?.("info","RUNNER_EXIT","Runner exited",{code:p,signal:l??"none"}),u({code:p,signal:l})})}),a=T(n.stdout);return{child:n,events:a,getStderr:()=>i,getExitCode:()=>d,getExitSignal:()=>l,exited:t}}async function K(e,n){if(!n?.platform||!n.target)return;if(g(n.target)){e.TESTMU_RUN_TARGET??="cloud",e.LT_HUB_URL??=m(e.TESTMUAI_ENV==="stage"?"stage":"prod").mobileHubUrl;return}let r=await S(n.platform)?.toolEnv(n.target)??{dirs:[]};if(r.dirs.length>0&&(e.PATH=[...r.dirs,e.PATH??""].filter(Boolean).join(b)),r.appiumHome&&(e.APPIUM_HOME=r.appiumHome),r.wdaRoot&&(e.TESTMU_IOS_WDA_DERIVED_DATA=r.wdaRoot),n.platform==="android"){let o=R();o&&(e.PATH=[o.platformToolsDir,e.PATH??""].filter(Boolean).join(b),e.ANDROID_HOME=o.root,e.ANDROID_SDK_ROOT=o.root)}}function G(e){let n={...process.env};e.environment&&(n.TESTMUAI_ENV=e.environment),n.TESTMUAI_SOURCE="kane-cli",process.platform==="win32"&&(n.PYTHONIOENCODING="utf-8",n.PYTHONUTF8="1");let r=m(e.environment);n.V16_SERVER_API_HOST=r.v16ServerHost,n.ATMS_URL=r.tmsBaseUrl.replace(/\/api\/?$/,""),e.username&&e.accessKey&&(n.LT_USERNAME=e.username,n.LT_ACCESS_KEY=e.accessKey),e.sessionId&&(n.TESTMUAI_SESSION_ID=e.sessionId);let o=N(e.mode??"testing");Object.assign(n,o.set);for(let a of o.unset)delete n[a];let i=new A().load(),d=w(e.assertionMode??(i.assertion_mode==="visual"?"visual":"dom"));Object.assign(n,d.set);for(let a of d.unset)delete n[a];let l=e.finalValidation??i.final_validation,t=O(l);Object.assign(n,t.set);for(let a of t.unset)delete n[a];return n}function j(e,n){let r=m(n?.environment),o=x();o!==void 0&&e.ap_mode===void 0&&(e.ap_mode=o),e.telemetry_proxy_url===void 0&&process.env.KANE_TELEMETRY!=="0"&&(e.telemetry_proxy_url=y),e.media_upload===void 0&&e.org_id&&e.username&&e.access_key&&(e.media_upload=W(r,e.org_id))}function W(e,n){return{url:e.shareApiBaseUrl.replace(/\/$/,"")+"/mfs/v1.0/media/upload",artefacts_host:e.mediaArtefactsHost,org_id:n,media_dir:E,files_url:e.tmsBaseUrl.replace(/\/api\/?$/,"")}}async function de(e,n){let r=B();if(!r)throw new Error("v16-runner not found. Build the binary with `cd v16-runner && python build.py` or ensure Python is available.");process.env.KANE_SPAWN_DEBUG&&process.stderr.write(`[spawn-debug] ${JSON.stringify(r)}
|
|
3
|
+
`);let o=G({environment:n?.environment,mode:n?.mode,assertionMode:n?.assertionMode,finalValidation:n?.finalValidation,username:e.username,accessKey:e.access_key,sessionId:e.session_id});e.device?.platform&&await K(o,e.device),j(e,{environment:n?.environment});let i=H({env:o,runner:r,log:n?.log,sessionId:e.session_id}),d=i.child;d.stdin.write(JSON.stringify(e)+`
|
|
4
|
+
`);let l=C(e.session_id);if(l)try{P(v(l),{recursive:!0}),M(l,`--- runner spawn ${new Date().toISOString()} run_index=${e.run_index} ---
|
|
5
|
+
`)}catch{}return{child:d,events:i.events,sendUserResponse(t){let a=JSON.stringify({type:"user_response",answer:t});try{d.stdin.write(a+`
|
|
6
|
+
`)}catch{}},sendCancel(t){let a=JSON.stringify({type:"cancel",reason:t});try{d.stdin.write(a+`
|
|
7
|
+
`)}catch{}},cancel(){d.kill("SIGTERM")},get stderr(){return i.getStderr()},get exitCode(){return i.getExitCode()},get exitSignal(){return i.getExitSignal()},exited:i.exited}}export{B as a,H as b,K as c,G as d,j as e,W as f,de as g};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as p}from"./chunk-
|
|
2
|
+
import{a as p}from"./chunk-USY7VAO6.js";import{a as g}from"./chunk-VHW7BMZQ.js";import{existsSync as f}from"fs";import{isAbsolute as m,join as d,relative as v}from"path";function c(t){let n=f(d(t,".context"))?"assurance.json":"variables.json";return d(".testmuai","variables",n)}function h(t,n){if(!m(t))return t;let e=v(n,t);return e.startsWith("..")?t:e}function w(t,n){let e=t.used_by;if(e.length===0||e.every(s=>s.file===p))return"";if(n===void 0||!e.every(s=>s.file===n))return e.map(s=>`${s.file} step ${s.step}`).join(" \xB7 ");let a=[...new Set(e.map(s=>s.step))].sort((s,i)=>s-i);return a.length===1?`step ${a[0]}`:`steps ${a.join(", ")}`}function b(t,n){let e=new Map,a=new Map,s={header:"Not in any variables file",rows:[],declare:!0};for(let i of t){if(i.reason==="not_a_dataset_column"){let l=i.dataset??"",u=a.get(l);u||(u={header:`Not a column of dataset ${l}`.trimEnd(),rows:[],declare:!1},a.set(l,u)),u.rows.push(i);continue}if(i.reason!=="value_missing"){s.rows.push(i);continue}let r=h(i.file??c(n),n),o=e.get(r);o||(o={header:r===g?"Waiting for a value passed with --variables":`Waiting for a value in ${r}`,rows:[],declare:!1},e.set(r,o)),o.rows.push(i)}return[...e.values(),...a.values(),...s.rows.length>0?[s]:[]]}function $(t,n){let e=c(n);if(f(d(n,e)))return["",` Add ${t.length===1?"it":"them"} to ${e}`];let a=t.map(r=>`${JSON.stringify(r.name)}:`),s=Math.max(...a.map(r=>r.length))+1,i=a.map((r,o)=>` ${r.padEnd(s)}{ "value": "" }${o<a.length-1?",":""}`);return["",` Create ${e}:`,""," {",...i," }"]}function _(t,n){let e=t.length,a=`warning: ${e} variable${e===1?" has":"s have"} no value`,s=Math.max(...t.map(r=>r.name.length),8)+2,i=b(t,n.cwd).map(r=>{let o=[` ${r.header}`];for(let l of r.rows)o.push(` ${l.name.padEnd(s)}${w(l,n.entryFile)}`.trimEnd());return r.declare&&o.push(...$(r.rows,n.cwd)),o.join(`
|
|
3
3
|
`)});return`${a}
|
|
4
4
|
|
|
5
5
|
${i.join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as l}from"./chunk-
|
|
2
|
+
import{b as l}from"./chunk-DTRSYWZE.js";import{a as m}from"./chunk-NMSZ7G6P.js";import{a as p}from"./chunk-RZ4F3BHX.js";import{a as f}from"./chunk-YWYORBY3.js";import{a as c,b as s,h as a,x as u}from"./chunk-5TQFOPJV.js";var v="/public/skills/kane-cli";function C(){try{let n=new f().getDefaultEnv();if(n in u)return n}catch{}return"prod"}function k(){return`${m(C()).controllerBaseUrl}${v}`}import{readFileSync as S,writeFileSync as E,mkdirSync as g}from"fs";import{join as d}from"path";var h=d(s,"skill-check.json"),y=3600*1e3;function V(){try{let n=JSON.parse(S(h,"utf-8"));if(Date.now()-n.checkedAt<y)return n}catch{}return null}function A(n){try{g(s,{recursive:!0}),E(h,JSON.stringify({map:n,checkedAt:Date.now()}))}catch{}}function I(){for(let{dir:n}of a)try{let t=S(d(n,"VERSION"),"utf-8").trim();if(t)return t}catch{}return null}function M(n,t){let i=Object.keys(n.versions??{});if(i.length===0)return null;let o=i.slice().sort((r,e)=>l(r,e));for(let r of o){let e=n.versions[r]?.kaneCliMinVersion;if(!e||l(t,e)<=0)return r}return null}async function U(){try{let n=V()?.map;if(!n){let o=new AbortController,r=setTimeout(()=>o.abort(),5e3),e=await p(k(),{headers:{Accept:"application/json"},signal:o.signal});if(clearTimeout(r),!e.ok)return null;n=await e.json(),A(n)}let t=M(n,c);if(!t)return null;let i=I();return i===null?{current:null,latestCompatible:t}:l(i,t)>0?{current:i,latestCompatible:t}:null}catch{return null}}export{k as a,M as b,U as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{y as m}from"./chunk-
|
|
2
|
+
import{y as m}from"./chunk-5TQFOPJV.js";import{a as x}from"./chunk-HCBYKLMW.js";import{a as u,b as a,j as g}from"./chunk-C44QQJR4.js";import{a as b}from"./chunk-6YGTRKDT.js";import{e as f}from"./chunk-UR6MHSHU.js";var T=f(b(),1);function k(i,n){if(!n)return i;let l=i.trim()||n;return`\x1B]8;;${n}\x07${l}\x1B]8;;\x07`}var r=f(x(),1);function $({shareableLink:i,testCaseLink:n,codeExportDir:l,recordedTestPath:s,outputDir:o,autoExit:p=!0}){let{exit:c}=g();(0,T.useEffect)(()=>{if(!p)return;let t=setTimeout(()=>c(),100);return()=>clearTimeout(t)},[c,p]);let e=[];return s&&e.push({label:"Test",url:s,linkUrl:`file://${s}`}),o&&e.push({label:"Output",url:o,linkUrl:`file://${o}`}),i&&e.push({label:"ShareLink",url:i}),n&&e.push({label:"TestCase",url:n}),l&&!o&&e.push({label:"CodeExport",url:l,linkUrl:`file://${l}`}),e.length===0?(0,r.jsx)(r.Fragment,{}):(0,r.jsx)(u,{flexDirection:"column",marginTop:1,marginLeft:1,children:e.map(t=>(0,r.jsxs)(u,{flexDirection:"column",marginBottom:1,children:[(0,r.jsxs)(a,{color:m.orange,children:[t.label,":"]}),(0,r.jsx)(a,{color:m.dim,children:k(t.url,t.linkUrl??t.url)})]},t.label))})}export{$ as a};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as v}from"./chunk-QSCXXNC2.js";import{n as g}from"./chunk-RSSOJ3L2.js";import{a as u,b as d}from"./chunk-
|
|
2
|
+
import{a as v}from"./chunk-QSCXXNC2.js";import{n as g}from"./chunk-RSSOJ3L2.js";import{a as u,b as d}from"./chunk-5TQFOPJV.js";import{existsSync as F}from"fs";import{join as P}from"path";import{mkdirSync as w,rmSync as b,writeFileSync as h}from"fs";import{join as S,resolve as k}from"path";import{join as W}from"path";function f(){return process.env.KANE_CLI_WIRE_BASE_DIR||d}function B(e){return W(f(),"sessions",`testrun-${e}`)}function E(e=f()){return S(e,"sessions","active")}function y(e,r){return S(E(r),`${e}.json`)}function _(e){let r=e.pid??process.pid,n=y(r,e.baseDir);try{w(E(e.baseDir),{recursive:!0}),h(n,JSON.stringify({pid:r,cwd:process.cwd(),surface:e.surface,session_dir:k(e.sessionDir),started:new Date().toISOString(),cli_version:u,host_agent:v()},null,2)+`
|
|
3
3
|
`)}catch{}return n}function m(e=process.pid,r){try{b(y(e,r),{force:!0})}catch{}}var R={run:"run_end",testmd:"test_md_done",testrun:"testrun_done"};import{appendFileSync as A,mkdirSync as I}from"fs";import{dirname as N}from"path";function x(e){let r=!1;return{path:e,append(n){try{r||(I(N(e),{recursive:!0}),r=!0),A(e,n+`
|
|
4
4
|
`)}catch{}}}}function D(e,r=()=>new Date){let{v:n,ts:c,...i}=e;return{...i,v:1,ts:typeof c=="string"?c:r().toISOString()}}function T(e){let r=e.stdout??(t=>{process.stdout.write(t)}),n=R[e.surface],c=!1,i=null,o=null,p=[],l=()=>{if(!(o||!i||!F(i))){o=x(P(i,"events.ndjson"));for(let t of p)o.append(t);p=[];try{e.onAttach?.(i)}catch{}}};return{emit(t){if(c)return;let a=JSON.stringify(D(t,e.now));r(a+`
|
|
5
5
|
`),l(),o?o.append(a):p.push(a),t.type===n&&(c=!0,p=[])},attachSessionDir(t){i=t,l()},setTerminal(t){n=t},get logPath(){return o?o.path:null}}}var s=null;function V(e){return r=>{_({surface:e,sessionDir:r}),g("wire-active-run",()=>m()),process.once("exit",()=>m())}}function ie(e,r){return s=T({surface:e,cliVersion:u,onAttach:r??V(e)}),s.emit({type:"stream_start",cli_version:u,surface:e,pid:process.pid}),s}function oe(){return s}function se(e){if(s){s.emit(e);return}process.stdout.write(JSON.stringify(D(e))+`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as g}from"./chunk-2KVECC36.js";import{b as f,c as j}from"./chunk-VE3SUJMA.js";import{a as m}from"./chunk-
|
|
2
|
+
import{a as g}from"./chunk-2KVECC36.js";import{b as f,c as j}from"./chunk-VE3SUJMA.js";import{a as m}from"./chunk-NMSZ7G6P.js";var _="KaneAI Generated",E="Untitled";async function p(e){let r=e.config.load(),d=new g(m(e.env).tmsBaseUrl,e.tmsCreds.username,e.tmsCreds.access_key),n=e.projectName??_,o=e.folderName??E,t=r.project_id??null,s=r.project_name??null;if(!t){let a=(await d.listProjects()).find(l=>l.name===n);if(a)t=a.project_id,s=a.name,e.log("info","ENSURE_PROJECT_FOUND","Found default project",{project_id:t,name:s});else{let l=await d.createProject(n);t=l.id,s=l.name,e.log("info","ENSURE_PROJECT_CREATED","Created default project",{project_id:t,name:s})}f(e.creds,e.config,e.profile,e.env,{projectId:t,projectName:s})}let c=r.folder_id??null,i=r.folder_name??null,u=!r.project_id;if(!c||u){let a=(await d.listFolders(t)).find(l=>l.name===o);if(a)c=a.id,i=a.name,e.log("info","ENSURE_FOLDER_FOUND","Found default folder",{folder_id:c,name:i});else{let l=await d.createFolder(t,o);c=l.id,i=l.name,e.log("info","ENSURE_FOLDER_CREATED","Created default folder",{folder_id:c,name:i})}f(e.creds,e.config,e.profile,e.env,{folderId:c,folderName:i})}return{projectId:t,projectName:s??n,folderId:c,folderName:i??o}}function A(e,r,d){let n=e.loadProfileConfig(r,d)??{};return{projectId:n.project_id??null,folderId:n.folder_id??null}}function N(e,r){return e.projectId===null||e.folderId===null||r===null?"needs-picker":r.project==="ok"&&r.folder==="ok"?"ok":r.project==="error"&&r.folder==="error"?"ok-tms-degraded":"needs-picker"}var k=(e,r)=>`error: profile "${e}" (${r}) has no project/folder configured AND no TMS credentials were available to auto-configure one.
|
|
3
3
|
|
|
4
4
|
discover IDs:
|
|
5
5
|
kane-cli projects list --search "<keyword>" --limit 10
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{x as s}from"./chunk-
|
|
2
|
+
import{x as s}from"./chunk-5TQFOPJV.js";function n(r="prod"){let e=s[r];return r!=="stage"?e:{authBaseUrl:process.env.KANE_STAGE_AUTH_URL??e.authBaseUrl,consentUrl:process.env.KANE_STAGE_CONSENT_URL??e.consentUrl,controllerBaseUrl:process.env.TESTMUAI_BASE_URL??e.controllerBaseUrl,tmsBaseUrl:process.env.KANE_STAGE_TMS_URL??e.tmsBaseUrl,testGeneratorBaseUrl:process.env.KANE_STAGE_TCG_URL??e.testGeneratorBaseUrl,secretsBaseUrl:process.env.KANE_STAGE_SECRETS_URL??e.secretsBaseUrl,testManagerUiUrl:process.env.KANE_STAGE_TEST_MANAGER_UI_URL??e.testManagerUiUrl,shareApiBaseUrl:process.env.KANE_STAGE_SHARE_API_URL??e.shareApiBaseUrl,v16ServerHost:process.env.KANE_STAGE_V16_SERVER_HOST??e.v16ServerHost,evidenceViewerUrl:process.env.KANE_STAGE_EVIDENCE_VIEWER_URL??e.evidenceViewerUrl,mediaArtefactsHost:process.env.KANE_STAGE_MEDIA_ARTEFACTS_HOST??e.mediaArtefactsHost,mobileAppBaseUrl:process.env.KANE_STAGE_MOBILE_APP_URL??e.mobileAppBaseUrl,mobileHubUrl:process.env.KANE_STAGE_MOBILE_HUB_URL??e.mobileHubUrl,lrmaaBaseUrl:process.env.KANE_STAGE_LRMAA_URL??e.lrmaaBaseUrl,deviceStreamUrl:process.env.KANE_STAGE_DEVICE_STREAM_URL??e.deviceStreamUrl}}export{n as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
var t={desktop:{label:"Desktop",hint:"Chrome on this machine",phrase:"the desktop browser",realDevice:!1,needsMobileHost:!1,builds:[]},emulator:{label:"Emulator",hint:"a virtual Android device on this machine",phrase:"an emulator",platform:"android",realDevice:!1,needsMobileHost:!0,builds:[".apk"]},simulator:{label:"Simulator",hint:"a virtual iOS device on this machine",phrase:"a simulator",platform:"ios",realDevice:!1,needsMobileHost:!0,builds:[".zip"]},android:{label:"Android",hint:"a real Android device in the TestMu AI cloud",phrase:"a real Android device",platform:"android",realDevice:!0,needsMobileHost:!1,builds:[".apk",".aab"]},ios:{label:"iOS",hint:"a real iOS device in the TestMu AI cloud",phrase:"a real iOS device",platform:"ios",realDevice:!0,needsMobileHost:!1,builds:[".ipa"]}},n=["desktop","emulator","simulator","android","ios"],c=["emulator","simulator","android","ios"];function o(e){return typeof e=="string"&&n.includes(e)}function a(e){return o(e)&&e!=="desktop"}function p(e){return a(e)?e:void 0}function g(e){return o(e)&&t[e].realDevice}function f(e){return a(e)&&!t[e].realDevice}function T(e){return t[e].platform}function b(e){return e==="ios"?"iOS":"Android"}function v(e){return t[e].label}function m(e){return t[e].hint}function D(e){return t[e].phrase}function l(e){return t[e].needsMobileHost}function S(e){return n.filter(r=>e||!l(r))}function h(e){return e==="ios"?"ios":"android"}function x(e){return e==="ios"?"simulator":"emulator"}function k(e){return t[e].builds}function y(e){return[...new Set(e.flatMap(r=>t[r].builds))]}function u(e,r){let i=e.trim().toLowerCase();return r.find(s=>i.endsWith(s))}function M(e,r){return u(r,t[e].builds)!==void 0}function A(e){let r=t[e].builds;return`${/^\.[aeiou]/i.test(r[0]??"")?"an":"a"} ${d(r,"or")}`}function d(e,r){return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} ${r} ${e[e.length-1]}`}export{n as a,c as b,o as c,a as d,p as e,g as f,f as g,T as h,b as i,v as j,m as k,D as l,l as m,S as n,h as o,x as p,k as q,y as r,u as s,M as t,A as u,d as v};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as u,d as p}from"./chunk-
|
|
2
|
+
import{c as u,d as p}from"./chunk-OXC6O5O7.js";import{spawn as h}from"child_process";var k=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"]);function v(g,n={}){let a=n.spawnCmd!==void 0?n.spawnCmd:u();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 f=g.source.images?.length??0;a.tier==="dev-python"&&f>0&&n.onWarn?.("warn: development agent in use \u2014 if image citations are missing, update the agent package");let t=h(a.cmd,a.args,{stdio:["pipe","pipe","pipe"],env:p(g.session_id,n.auth)});if(t.stdin.write(JSON.stringify(g)+`
|
|
3
3
|
`),n.onStderr){let e="";t.stderr.on("data",r=>{e+=r.toString("utf8");let i;for(;(i=e.indexOf(`
|
|
4
4
|
`))>=0;){let o=e.slice(0,i);e=e.slice(i+1),o.trim()&&n.onStderr(o)}})}let d=new Promise(e=>{t.on("exit",(r,i)=>e({code:r,signal:i}))});async function*m(){let e="",r=!1;for await(let i of t.stdout){e+=i.toString("utf8");let o;for(;(o=e.indexOf(`
|
|
5
5
|
`))>=0;){let l=e.slice(0,o).trim();if(e=e.slice(o+1),!l)continue;let c;try{c=JSON.parse(l)}catch{n.onWarn?.(`agent: skipping malformed line: ${l.slice(0,120)}`);continue}let s=c;if(!s||typeof s!="object"||!k.has(s.type)){n.onWarn?.(`agent: skipping unknown event type "${s&&typeof s=="object"?String(s.type??"?"):"?"}"`);continue}if(yield s,s.type==="done"){r=!0;break}}if(r)break}await d.catch(()=>{})}return{events:m(),send:e=>{t.stdin&&!t.stdin.destroyed&&t.stdin.write(JSON.stringify(e)+`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as $}from"./chunk-MMBBQ4OZ.js";import{j as h}from"./chunk-
|
|
2
|
+
import{a as $}from"./chunk-MMBBQ4OZ.js";import{j as h}from"./chunk-75MMTNPB.js";import{a as w}from"./chunk-RZ4F3BHX.js";import{b as v}from"./chunk-5TQFOPJV.js";import{spawn as V,spawnSync as _}from"child_process";import{createServer as K}from"net";import{mkdirSync as g,openSync as W,readFileSync as I,renameSync as j,rmSync as x,statSync as Y,writeFileSync as M}from"fs";import{readFile as q}from"fs/promises";import{dirname as l,join as y}from"path";var G=[4723,4724,4725,4726,4727,4728,4729,4730],X={emulator:4750,simulator:4790},z=40,E=2e3,D=3e4,T=500,Ce=["emulator","simulator"];function Q(e){return y(v,"mobile",`appium-server-${e}.log`)}function m(){return y(v,"mobile","appium-servers.json")}function Z(){return y(v,"mobile","appium-servers.lock")}var ee=1e4,re=50;function C(e){let r=Z();try{g(l(r),{recursive:!0})}catch{return e()}let n=!1;for(let o=0;o<re;o++)try{g(r),n=!0;break}catch{try{Date.now()-Y(r).mtimeMs>ee&&x(r,{recursive:!0,force:!0})}catch{}ne(10)}try{return e()}finally{if(n)try{x(r,{recursive:!0,force:!0})}catch{}}}function ne(e){try{Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)}catch{}}function te(){try{let e=JSON.parse(I(m(),"utf8"));return Array.isArray(e)?e:[]}catch{return[]}}function oe(e){let r=m();g(l(r),{recursive:!0});let n=`${r}.tmp`;M(n,JSON.stringify(e,null,2)),j(n,r)}function se(e,r,n){return`Another mobile session is already running${n?` on ${n}`:""}. Wait for it to finish, or close the terminal running it.`}var A=class extends Error{constructor(n,o){super(n);this.port=o;this.name="DeviceBusyError"}};function ie(e){return w(e,{signal:AbortSignal.timeout(E)}).then(r=>r.ok,()=>!1)}async function ae(e,r){try{return(await w(`http://127.0.0.1:${e}/session/${r}`,{method:"DELETE",signal:AbortSignal.timeout(E)})).ok}catch{return!1}}function R(e){let r=e?.value;return Array.isArray(r)?r.map(n=>{let o=n??{},t=o.capabilities??o;return{...typeof o.id=="string"?{id:o.id}:{},caps:t}}):[]}async function ue(e){try{let r=await w(`http://127.0.0.1:${e}/sessions`,{signal:AbortSignal.timeout(E)});return r.ok?R(await r.json()):[]}catch{return[]}}var ce=["udid","appium:udid","deviceUDID","appium:deviceUDID","deviceName","appium:deviceName"];function L(){let e=r=>{try{let n=_("curl",["-s","--noproxy","*","--max-time","2",...r],{encoding:"utf8",timeout:5e3});return{ok:n.status===0,stdout:n.stdout??""}}catch{return{ok:!1,stdout:""}}};return{readState:()=>{try{let r=JSON.parse(I(m(),"utf8"));return Array.isArray(r)?r:[]}catch{return[]}},alive:b,getJson:r=>{let n=e([r]);if(n.ok)try{return JSON.parse(n.stdout)}catch{return}},del:r=>{let n=e(["-o","/dev/null","-w","%{http_code}","-X","DELETE",r]);return n.ok&&/^2\d\d$/.test(n.stdout.trim())}}}function Le(e,r={}){let n={...L(),...r},o=0;try{for(let t of n.readState()){if(!n.alive(t.pid))continue;let i=R(n.getJson(`http://127.0.0.1:${t.port}/sessions`));for(let s of i)s.id&&de(s.caps,e.udid,e.displayName)&&n.del(`http://127.0.0.1:${t.port}/session/${s.id}`)&&(o+=1)}}catch{}return o}function de(e,r,n){let o=[r,n].filter(t=>!!t).map(t=>t.toLowerCase());for(let t of ce){let i=e[t];if(typeof i=="string"&&o.includes(i.toLowerCase()))return!0}return!1}function pe(e,r,n){let o=W(n.logPath,"a"),t=V(e,r,{stdio:["ignore",o,o],detached:!0,env:{...process.env,...n.env}});return t.unref(),t.pid}async function le(e,r){for(let n=e;n<e+r;n++)if(await new Promise(t=>{let i=K();i.once("error",()=>t(!1)),i.once("listening",()=>i.close(()=>t(!0))),i.listen(n)}))return n;throw new Error(`No free port for the managed Appium server in ${e}-${e+r-1}.`)}function b(e){try{return process.kill(e,0),!0}catch{return!1}}function P(e){try{let r=_("ps",["-o","comm=","-p",String(e)],{encoding:"utf8",timeout:2e3});if(r.status!==0)return!1;let n=r.stdout.trim().toLowerCase();return n===""?!0:n.includes("node")||n.includes("kane")}catch{return!0}}function k(e){try{process.kill(e)}catch{}}async function me(){try{let e=JSON.parse(await q(m(),"utf8"));return Array.isArray(e)?e:[]}catch{return[]}}async function fe(e){let r=process.pid,n=e.filter(o=>o.owner===r);C(()=>{let o=[];for(let t of te())t.owner!==r&&(Se(t)?o.push(t):b(t.pid)&&k(t.pid));oe([...o,...n])})}function Se(e){return e.owner===void 0?!1:b(e.owner)&&P(e.owner)}function ve(){return{probe:ie,sessions:ue,deleteSession:ae,spawn:pe,freePort:le,alive:b,kill:k,readState:me,writeState:fe,owner:process.pid,depsEnv:e=>h().environment(e),bundleVersion:async e=>(await h().status(e)).version,nodeBinary:process.execPath,env:process.env,os:process.platform,now:()=>Date.now(),sleep:e=>new Promise(r=>setTimeout(r,e))}}function we(e,r,n){if(!e.platformToolsDir)return{};let o=n==="win32"?";":":",t=$(r),i=t?.root??l(e.platformToolsDir),s=t?.platformToolsDir??e.platformToolsDir;return{ANDROID_HOME:i,ANDROID_SDK_ROOT:i,PATH:r.PATH?`${s}${o}${r.PATH}`:s}}async function ge(e){let r=await e.readState(),n=[],o=[];for(let t of r)t.owner!==void 0&&e.alive(t.owner)&&(e.ownerIsOurs??P)(t.owner)?n.push(t):o.push(t);for(let t of o){let i=e.ownerIsOurs??P;e.alive(t.pid)&&i(t.pid)&&e.kill(t.pid)}return o.length>0&&await e.writeState(n),n}async function Je(e,r={}){if(r.appiumUrl)return{result:"external",url:r.appiumUrl};let n={...ve(),...r.deps},o=await ge(n),t=o.filter(a=>a.owner===n.owner),i=new Set(t.map(a=>a.port)),s=new Set(o.map(a=>a.port));if(r.device){let a=await ye(n,s,i,e);if(a!==null)throw new A(se(r.device,a.port,a.device),a.port)}let c=await n.bundleVersion(e),u=t.find(a=>a.deviceClass===e&&(a.bundleVersion??c)===c);if(u&&await n.probe(`http://127.0.0.1:${u.port}/status`))return{result:"reused",url:`http://127.0.0.1:${u.port}`};for(let a of t.filter(S=>S.deviceClass===e&&S!==u))n.kill(a.pid);u&&n.kill(u.pid);let d=await n.depsEnv(e);if(!d.appiumHome)throw new Error(`The managed dependencies for the ${e} class are not installed.
|
|
3
3
|
Run \`kane-cli doctor --target ${e} --install\` to install them, or pass --appium-url for an external server.`);let p=await n.freePort(X[e],z),O=`http://127.0.0.1:${p}`,J=l(d.appiumHome),U=y(J,"appium","node_modules","appium","index.js"),N=Q(e);r.onProgress?.(`starting the managed Appium server (${e}, port ${p})\u2026`);let f=n.spawn(n.nodeBinary,[U,"--port",String(p),"--allow-insecure=uiautomator2:adb_shell"],{env:{APPIUM_HOME:d.appiumHome,...we(d,n.env,n.os)},logPath:N}),B=n.now()+D,F=Math.ceil(D/T)+1;for(let a=0;a<F&&n.now()<B;a++)if(await n.sleep(T),await n.probe(`${O}/status`)){if(f!==void 0){let S=t.filter(H=>H.deviceClass!==e);await n.writeState([...S,{port:p,pid:f,owner:n.owner,deviceClass:e,...c?{bundleVersion:c}:{},startedAt:new Date(n.now()).toISOString()}])}return r.onProgress?.("Appium server ready"),{result:"started",url:O}}throw f!==void 0&&n.kill(f),new Error(`The managed Appium server (${e}) did not answer on ${p} within ${D/1e3}s.
|
|
4
4
|
Check its log: ${N}`)}async function ye(e,r=[],n=[],o){let t=new Set(n),i=new Set([...G,...r]);for(let s of i)if(!t.has(s))for(let c of await e.sessions(s)){if(!c.id)continue;if(o){let d=be(c.caps);if(d&&d!==o)continue}let u=De(c.caps);return{port:s,...u?{device:u}:{}}}return null}function be(e){let r=t=>{let i=e[t];return typeof i=="string"?i.toLowerCase():""},n=r("platformName")||r("appium:platformName");if(n.includes("ios"))return"simulator";if(n.includes("android"))return"emulator";let o=r("appium:automationName")||r("automationName");if(o.includes("xcuitest"))return"simulator";if(o.includes("uiautomator"))return"emulator"}var he=["appium:deviceName","deviceName","appium:udid","udid","appium:deviceUDID","deviceUDID"];function De(e){for(let r of he){let n=e[r];if(typeof n=="string"&&n.trim())return n}}function Ue(e={}){let r={...L(),kill:k,writeState:Ae,...e.deps};try{let n=r.readState(),o=e.owner??process.pid,t=n.filter(s=>s.owner===o&&(!e.deviceClass||s.deviceClass===e.deviceClass));for(let s of t){if(!r.alive(s.pid))continue;let c=R(r.getJson(`http://127.0.0.1:${s.port}/sessions`));for(let u of c)u.id&&r.del(`http://127.0.0.1:${s.port}/session/${u.id}`);r.kill(s.pid)}let i=new Set(t.map(s=>`${s.port}:${s.pid}`));C(()=>{r.writeState(r.readState().filter(s=>!i.has(`${s.port}:${s.pid}`)))})}catch{}}function Ae(e){try{let r=m();g(l(r),{recursive:!0}),M(r,JSON.stringify(e,null,2))}catch{}}export{Ce as a,Q as b,se as c,Le as d,ve as e,Je as f,ye as g,Ue as h};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{h as c,i as d}from"./chunk-NOL7MNZH.js";import{readFileSync as l}from"fs";import{resolve as p}from"path";var i="KANE_CLI_DEVICE_CONFIG";function w(e=process.env){return(e[i]??"").trim()!==""}function v(e=process.env){let r=(e[i]??"").trim();if(!r)throw new Error(`a real-device run needs ${i} to name the run's device-config.json, and it is not set.`);let t=p(r),n;try{n=JSON.parse(l(t,"utf8"))}catch(o){throw new Error(`${i}: cannot read the device config at ${t}: ${o.message}`)}if(!n||typeof n!="object"||Array.isArray(n))throw new Error(`${i}: ${t} is not a device config object.`);return{path:t,entry:n}}function s(e){if(typeof e=="number")return String(e);if(typeof e=="string")return e.trim()||void 0}function _(e,r=process.env){let{path:t,entry:n}=v(r),o=s(n.platform_name)?.toLowerCase();if(o!==e.platform)throw new Error(`${i}: ${t} describes ${o?`a "${o}" device`:"no platform_name"}, but the test file's target is ${e.platform}.`);if(!e.hasCredentials)throw new Error("a real-device run needs your TestMu AI username and access key, and none were found. Run kane-cli login, or pass --username and --access-key.");let a=s(n.device_name),f=s(n.platform_version),u=s(n.app);return{device:{platform:e.platform,target:e.platform,device_config_path:t},...a?{deviceName:a}:{},...f?{osVersion:f}:{},...u?{app:u}:{}}}function h(e){return`Connecting to a real ${d(c(e))} device\u2026`}function C(e){let r=e.deviceName??"any device";return e.osVersion?`${r} (${e.osVersion})`:r}function m(e){return/[*?^$[\]{}|\\]/.test(e)}function g(e){return e?.name&&!m(e.name)?e.name:void 0}function D(e){return g(e)||e?.model}function R(e,r,t){let n=D(r),o=r?.os_version?`${d(c(e))} ${r.os_version}`:void 0,a=t?`App ${t.replace(/^lt:\/\//,"")}`:void 0;return`Running on: ${["Real device",n,o,a].filter(Boolean).join(" \xB7 ")}`}function N(e,r,t){let n=!1;return o=>{n||o.type!=="run_start"||o.child_id||(n=!0,t(R(e,o.environment?.device,r)))}}export{w as a,_ as b,h as c,C as d,g as e,D as f,N as g};
|