@testmuai/kane-cli 0.8.22 → 0.8.23
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-GBZX4LWL.js} +1 -1
- package/dist/{ChromeProfilePicker-XX223SYB.js → ChromeProfilePicker-UONX2UVC.js} +1 -1
- package/dist/{CliFeedbackPrompt-J6DW6TZL.js → CliFeedbackPrompt-6BJCNRNG.js} +1 -1
- package/dist/{CliUploadProgress-TWEL7NWG.js → CliUploadProgress-K4Z22DSY.js} +1 -1
- package/dist/{ConfigView-ROFNVFDQ.js → ConfigView-BB22G7JO.js} +1 -1
- package/dist/{EvidenceViewOffer-XUP44BGJ.js → EvidenceViewOffer-25IQF3TX.js} +1 -1
- package/dist/FolderPicker-65JFR2NW.js +2 -0
- package/dist/{InfoBox-ELZ5Q65V.js → InfoBox-OU5PLRIL.js} +1 -1
- package/dist/{LinksBox-2V26KLTJ.js → LinksBox-DH7TSUXW.js} +1 -1
- package/dist/{ProfilesView-P4Z42LSX.js → ProfilesView-MGJKBOF5.js} +1 -1
- package/dist/{ProjectPicker-2QNFNN7T.js → ProjectPicker-YFV6K77F.js} +1 -1
- package/dist/{SaveSessionPrompt-XMWL3P6G.js → SaveSessionPrompt-64QKQB6B.js} +1 -1
- package/dist/SingleShotApp-VYKUCRVW.js +2 -0
- package/dist/{SummaryBox-RWO4BYYD.js → SummaryBox-DGS3LVRF.js} +1 -1
- package/dist/TestMdRunView-LKAITAA4.js +2 -0
- package/dist/{TestrunEvidenceTable-MUOGF6CZ.js → TestrunEvidenceTable-PHBAB4XQ.js} +1 -1
- package/dist/{WhoamiView-4EYWZR4N.js → WhoamiView-6HWPYN6Y.js} +1 -1
- package/dist/{app-download-KUJVMZ7L.js → app-download-SQ2LYYL7.js} +1 -1
- package/dist/{auth-5HAY24TN.js → auth-NWBIFCB7.js} +1 -1
- package/dist/{binary-6UEOI7PT.js → binary-MOJTQGUV.js} +1 -1
- package/dist/{bind-3C2IIPML.js → bind-S3IQTPNN.js} +2 -2
- package/dist/{bootstrap-DBAQWVNA.js → bootstrap-RCV7PNMQ.js} +1 -1
- package/dist/bridge-O7ENTV4K.js +2 -0
- package/dist/{changelog-QAGRYBEZ.js → changelog-2N6HKKKQ.js} +1 -1
- package/dist/{chunk-T6MGCP57.js → chunk-2A7OQRAD.js} +4 -4
- package/dist/{chunk-GVE5GEW2.js → chunk-2FH4HJYB.js} +1 -1
- package/dist/{chunk-5ILTSBWT.js → chunk-2MEQTHNI.js} +1 -1
- package/dist/{chunk-YFBJWIBU.js → chunk-3C32LVLX.js} +1 -1
- package/dist/{chunk-XQNJSM5C.js → chunk-3OKX64UR.js} +1 -1
- package/dist/{chunk-R43ELADV.js → chunk-3UMVRJX3.js} +2 -2
- package/dist/{chunk-OT3VKXJX.js → chunk-5ESGUPSR.js} +1 -1
- package/dist/{chunk-Z2XKFYMH.js → chunk-5HOHXV2K.js} +1 -1
- package/dist/{chunk-NUYGWRB2.js → chunk-5RHR4DMF.js} +1 -1
- package/dist/{chunk-VW3PFRCO.js → chunk-5UHY3PTQ.js} +1 -1
- package/dist/{chunk-PUFZTE6L.js → chunk-6YZ3VP3E.js} +1 -1
- package/dist/{chunk-OBB57E2L.js → chunk-7KRY26OF.js} +1 -1
- package/dist/{chunk-6MCQ2UKE.js → chunk-AGDPEZXT.js} +1 -1
- package/dist/{chunk-LKPOOZYN.js → chunk-AIK7BAME.js} +2 -2
- package/dist/{chunk-BPYRVV7O.js → chunk-AT3RME5W.js} +1 -1
- package/dist/{chunk-SB5XM4YV.js → chunk-ATYXPCM6.js} +1 -1
- package/dist/{chunk-P37ALET7.js → chunk-BASTDR3M.js} +1 -1
- package/dist/{chunk-SW54RAAT.js → chunk-C7NWWGLT.js} +1 -1
- package/dist/{chunk-E2KV4BQB.js → chunk-CAJZQQ3G.js} +1 -1
- package/dist/{chunk-QV445GUU.js → chunk-CLQP3DHT.js} +1 -1
- package/dist/{chunk-2OIIXLXW.js → chunk-CSVPZ33X.js} +1 -1
- package/dist/{chunk-SJZJ7ASF.js → chunk-CXF6AZWY.js} +1 -1
- package/dist/{chunk-R7ZDLGMU.js → chunk-D4XR7EEQ.js} +1 -1
- package/dist/{chunk-FDXDFZ7J.js → chunk-D6BULK7E.js} +1 -1
- package/dist/{chunk-5E4JLXR5.js → chunk-DDHGEJJP.js} +1 -1
- package/dist/{chunk-3MWLFHPO.js → chunk-DSKJ6J7Y.js} +1 -1
- package/dist/{chunk-MHMEEA4S.js → chunk-DUYRCVI5.js} +1 -1
- package/dist/{chunk-CBUSNWHA.js → chunk-DWHF5HUD.js} +1 -1
- package/dist/{chunk-ADBOWRMW.js → chunk-EM3PU2YW.js} +1 -1
- package/dist/{chunk-DF4EBXGN.js → chunk-FMBPUXWL.js} +1 -1
- package/dist/{chunk-XFQLR6MF.js → chunk-FORNRNHU.js} +1 -1
- package/dist/{chunk-HKIBJDKE.js → chunk-FPFS6OSR.js} +1 -1
- package/dist/{chunk-2HFNP2LM.js → chunk-FQJOWUEN.js} +1 -1
- package/dist/{chunk-JHYWNWS5.js → chunk-GFNCGN5V.js} +2 -2
- package/dist/{chunk-RUSRN7YE.js → chunk-HBSYBL6J.js} +1 -1
- package/dist/{chunk-5XAX4C5N.js → chunk-HJGVM6TS.js} +1 -1
- package/dist/{chunk-JPOFRYTX.js → chunk-HJX5PQRD.js} +1 -1
- package/dist/{chunk-WBH5GYFM.js → chunk-HPHETGRE.js} +1 -1
- package/dist/{chunk-VCY7UNEL.js → chunk-IEW7AW64.js} +1 -1
- package/dist/{chunk-DZCJE77P.js → chunk-IGHK2ENL.js} +1 -1
- package/dist/{chunk-FR3LVUAB.js → chunk-IIDBLJ5A.js} +1 -1
- package/dist/{chunk-6C35NKQ7.js → chunk-J2FJ62K4.js} +1 -1
- package/dist/{chunk-NMAPNJRY.js → chunk-J6TBTWW7.js} +1 -1
- package/dist/{chunk-WGIZQGR5.js → chunk-JFZA4UON.js} +1 -1
- package/dist/{chunk-3M6OM3T4.js → chunk-K6VDRR3H.js} +1 -1
- package/dist/{chunk-SREUA7YQ.js → chunk-KJIDMW6N.js} +1 -1
- package/dist/{chunk-BNC4DJCC.js → chunk-LF42V6P6.js} +1 -1
- package/dist/{chunk-5BHB5D2C.js → chunk-LHUW5QDT.js} +1 -1
- package/dist/{chunk-I4SO2FQV.js → chunk-LNFU4JZ7.js} +1 -1
- package/dist/{chunk-MXI5P373.js → chunk-LNSBC32V.js} +1 -1
- package/dist/{chunk-5TQIKRKP.js → chunk-MBJHS653.js} +1 -1
- package/dist/{chunk-3H3KTCL7.js → chunk-MKMJOMLX.js} +2 -2
- package/dist/{chunk-4VW3B7SE.js → chunk-MKQ7ZRDW.js} +1 -1
- package/dist/{chunk-44NNFVCJ.js → chunk-MV3Q335C.js} +1 -1
- package/dist/{chunk-GYLMH2EX.js → chunk-MWIE6LOZ.js} +1 -1
- package/dist/{chunk-2G5CJQOR.js → chunk-MZ7W4WLF.js} +1 -1
- package/dist/{chunk-L35DJDX7.js → chunk-NIFJJX6N.js} +1 -1
- package/dist/{chunk-SIXPXYCH.js → chunk-OFRYEWZE.js} +1 -1
- package/dist/{chunk-NAWGHDA3.js → chunk-OYKRCDT4.js} +1 -1
- package/dist/{chunk-RFDL7MHI.js → chunk-PXHN7SFG.js} +1 -1
- package/dist/{chunk-LSRNUBIV.js → chunk-QAG67DUT.js} +1 -1
- package/dist/{chunk-BPDFI2DC.js → chunk-QGXVQIN5.js} +2 -2
- package/dist/{chunk-REPKBN7I.js → chunk-QQCEP3QP.js} +1 -1
- package/dist/{chunk-WPBETG6U.js → chunk-QU7P7B3W.js} +3 -3
- package/dist/{chunk-5FQYB5SM.js → chunk-RAARDC2O.js} +1 -1
- package/dist/{chunk-46U7TRPE.js → chunk-RAPV3BTA.js} +2 -2
- package/dist/{chunk-ZUJGYHZ2.js → chunk-RD72POF2.js} +1 -1
- package/dist/{chunk-5D6YMG63.js → chunk-RMVASIVL.js} +2 -2
- package/dist/{chunk-SVJBOVI4.js → chunk-SB2SKN34.js} +1 -1
- package/dist/{chunk-4ZBI54KE.js → chunk-SFFDVF3J.js} +2 -2
- package/dist/{chunk-PLIQ72LH.js → chunk-SY4T44VC.js} +1 -1
- package/dist/{chunk-EVBCKI7D.js → chunk-SYJXTB4J.js} +1 -1
- package/dist/{chunk-CE23VDW5.js → chunk-TONFENRW.js} +1 -1
- package/dist/{chunk-3BUYTNAV.js → chunk-UF4MU2AZ.js} +2 -2
- package/dist/{chunk-GF32QBCM.js → chunk-UQSVO7TY.js} +1 -1
- package/dist/{chunk-WHNF5SWS.js → chunk-URWWROLS.js} +2 -2
- package/dist/{chunk-O4LJWUSJ.js → chunk-UYI4WPNQ.js} +1 -1
- package/dist/{chunk-WRGPMDDE.js → chunk-VACHFCNC.js} +1 -1
- package/dist/{chunk-3NMXXTHE.js → chunk-VAN7ECN6.js} +1 -1
- package/dist/{chunk-26HZJJN6.js → chunk-VOYMN2WQ.js} +1 -1
- package/dist/{chunk-UXR57BCE.js → chunk-WICJY6KL.js} +1 -1
- package/dist/{chunk-FBRTUEAL.js → chunk-X4NUVVCJ.js} +3 -3
- package/dist/{chunk-JQ3JB5CO.js → chunk-XQQHSC7G.js} +1 -1
- package/dist/{chunk-XKYL4K4A.js → chunk-YI3H2UIB.js} +1 -1
- package/dist/{chunk-JHBNXTG6.js → chunk-ZIHG6EKH.js} +1 -1
- package/dist/{config-HVSKN6L4.js → config-7E4NS553.js} +1 -1
- package/dist/{cover-cmd-ZZJA5C6H.js → cover-cmd-6KZX46S2.js} +1 -1
- package/dist/{credentials-FH6VZPJS.js → credentials-PSQWWFGD.js} +1 -1
- package/dist/{deps-bundle-QUROUKJI.js → deps-bundle-PPOQHJTB.js} +1 -1
- package/dist/{deps-resolve-N2KKJ37Q.js → deps-resolve-AX6ZAKLH.js} +1 -1
- package/dist/{device-env-ID7EDDOD.js → device-env-TZQDB5T3.js} +1 -1
- package/dist/{dispatch-BYA5Q2SD.js → dispatch-KMWEDMKE.js} +1 -1
- package/dist/{doctor-MGHY2M36.js → doctor-XDF3MA4W.js} +1 -1
- package/dist/{evidence-XYKLWPPY.js → evidence-EUIDOVOR.js} +1 -1
- package/dist/{evolve-cmd-BURJDLVF.js → evolve-cmd-QVTGTCJ5.js} +1 -1
- package/dist/{explain-cmd-53EO2IMN.js → explain-cmd-36SVSHU7.js} +1 -1
- package/dist/{extract-bind-T7GKUEJ6.js → extract-bind-PLMSZKLZ.js} +2 -2
- package/dist/{extract-cmd-WXG34RMY.js → extract-cmd-RJBHPPF3.js} +1 -1
- package/dist/{gaps-cmd-T55FFFVB.js → gaps-cmd-3WZPDDYS.js} +1 -1
- package/dist/{generate-headless-BSBY47K2.js → generate-headless-TEDHS3F2.js} +2 -2
- package/dist/index.js +16 -16
- package/dist/{ingest-cmd-BYOZCTVG.js → ingest-cmd-JDIOPJBN.js} +1 -1
- package/dist/install-Y3VKFBK3.js +2 -0
- package/dist/{interactive-bind-JAB6XUPX.js → interactive-bind-XUMKEGAN.js} +3 -3
- package/dist/{lifecycle-cmd-QVGYYJSG.js → lifecycle-cmd-FBDRFIOE.js} +1 -1
- package/dist/{list-cmd-RQYRC345.js → list-cmd-TFUACRAM.js} +1 -1
- package/dist/{list-commands-VTWPMFG3.js → list-commands-OHIQFJGQ.js} +1 -1
- package/dist/login-flow-OHNKSVYZ.js +2 -0
- package/dist/{maintenance-cmd-NC2VI5G7.js → maintenance-cmd-7OSUIDL4.js} +1 -1
- package/dist/{mobile-prompts-VCA73IYP.js → mobile-prompts-DEVUZRG3.js} +1 -1
- package/dist/{objective-variable-gate-WZFN5I7Y.js → objective-variable-gate-JALOH6SL.js} +1 -1
- package/dist/{open-provider-YXHFPVDE.js → open-provider-746LLSEO.js} +1 -1
- package/dist/{persist-recorded-session-SZDBBSNH.js → persist-recorded-session-GPP6UKN6.js} +1 -1
- package/dist/{pipeline-FAU3PBDH.js → pipeline-QPTPZVUJ.js} +1 -1
- package/dist/prepare-target-N7QRNYOS.js +2 -0
- package/dist/{reconcile-cmd-2BFK7RFL.js → reconcile-cmd-SMGLHMLF.js} +1 -1
- package/dist/{reconcile-deps-CYWH6GM4.js → reconcile-deps-DVIJK5UZ.js} +2 -2
- package/dist/{reconcile-engine-ZWIJFYBP.js → reconcile-engine-KL2J5SNQ.js} +1 -1
- package/dist/{recording-banner-FRH2EJBM.js → recording-banner-TCFFB6KE.js} +1 -1
- package/dist/registry-BFFA4YJK.js +2 -0
- package/dist/{require-project-folder-A6YTVLAK.js → require-project-folder-2224ZMJ5.js} +1 -1
- package/dist/{resolve-run-intent-PHAXPW6C.js → resolve-run-intent-HFXGEOYK.js} +1 -1
- package/dist/{resolver-U55SNASN.js → resolver-GJR2Z7JY.js} +1 -1
- package/dist/{review-cmd-ZKCXBMFP.js → review-cmd-CQE6SBZA.js} +1 -1
- package/dist/{run-76I4OYXD.js → run-BXKWDJFJ.js} +1 -1
- package/dist/{run-XJK3YOW2.js → run-HSP2MZPU.js} +1 -1
- package/dist/{run-test-md-A3QRWLCW.js → run-test-md-2ELPAASM.js} +2 -2
- package/dist/{skill-installer-LSDCMJ6P.js → skill-installer-T2IOCPET.js} +1 -1
- package/dist/{spawner-HZXP66DS.js → spawner-HQM2757J.js} +1 -1
- package/dist/{store-guard-27XJZ7WF.js → store-guard-NAW26EEQ.js} +1 -1
- package/dist/{sync-cmd-JZ3MXGEU.js → sync-cmd-Q6ZYEVWI.js} +1 -1
- package/dist/{sync-setup-HGG7ALGA.js → sync-setup-CA362C5S.js} +1 -1
- package/dist/tcg-generate-CDB2N5LD.js +2 -0
- package/dist/testmd-actions-BDWDE2TG.js +2 -0
- package/dist/{testmd-sync-RKSGTCZA.js → testmd-sync-EPTUVJYJ.js} +1 -1
- package/dist/token-refresh-TKBOHXSD.js +2 -0
- package/dist/{validate-basic-5NYH5WYI.js → validate-basic-V7R4RH5M.js} +1 -1
- package/dist/{variable-receipt-C3US6X4M.js → variable-receipt-F55CSW5Z.js} +1 -1
- package/dist/{verdicts-VPTU4YAS.js → verdicts-7IUZFXB4.js} +1 -1
- package/dist/{version-check-YY57B2A4.js → version-check-PUUSB7AY.js} +1 -1
- package/dist/{view-cmd-KWIBYZ5S.js → view-cmd-ELDKYRMZ.js} +1 -1
- package/dist/{walk-session-YSKEJM2F.js → walk-session-EGIMA4VG.js} +1 -1
- package/dist/{with-telemetry-2NY4CPL5.js → with-telemetry-LRWWBISP.js} +1 -1
- package/package.json +11 -11
- package/dist/FolderPicker-XLAK7324.js +0 -2
- package/dist/SingleShotApp-3YZSE3AA.js +0 -2
- package/dist/TestMdRunView-QHPMG46M.js +0 -2
- package/dist/bridge-NHXCRSIU.js +0 -2
- package/dist/install-OABVIXAE.js +0 -2
- package/dist/login-flow-HUORIV6P.js +0 -2
- package/dist/prepare-target-XYOTVK2I.js +0 -2
- package/dist/registry-QR3BDI5F.js +0 -2
- package/dist/tcg-generate-S77VVSVU.js +0 -2
- package/dist/testmd-actions-VQJ22WZZ.js +0 -2
- package/dist/token-refresh-AOCGYGEC.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as o,d as a}from"./chunk-T2ONUKTL.js";import{a as m,b as d}from"./chunk-
|
|
2
|
+
import{b as o,d as a}from"./chunk-T2ONUKTL.js";import{a as m,b as d}from"./chunk-5UHY3PTQ.js";import{t as c}from"./chunk-RDHWNSDP.js";import{resolve as l}from"path";async function u(n,w,t={}){let r=d({verb:n,mode:"cli",contextRoot:l(process.cwd(),".context"),env:m(),write:t.write}),s=()=>{o(t.mode??"")!=="ndjson"&&process.stderr.write(r.supportFooter()+`
|
|
3
3
|
`)};try{let e=await w(r);return t.write&&e===0&&await r.lateBindContext(l(process.cwd(),".context")),e===1&&s(),await r.end({exit_code:e}),e}catch(e){if(e instanceof c){if(o(t.mode??"")==="ndjson"){let i=a("ndjson",t.streamVerb??n,{stdout:y=>process.stdout.write(y),stderr:()=>{}});i.event({type:"sync_error",code:e.code,detail:e.message,remedy:e.remedy}),i.done(2,"refused")}else process.stderr.write(`error: ${e.message}
|
|
4
4
|
next: ${e.remedy}
|
|
5
5
|
`);return r.error("rebase_open"),await r.end({exit_code:2}),2}throw r.error("cli_crash"),s(),await r.end({exit_code:1}),e}}export{u as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{f as d}from"./chunk-
|
|
2
|
+
import{f as d}from"./chunk-WICJY6KL.js";function w(r){let{isAgent:c,log:m}=r,a=r.stdout??process.stderr,s=r.stdin??process.stdin,p=t=>{c&&d(t)};return{async runSteps(t){let{default:e}=await import("./react-QWOAB3TB.js"),{render:o}=await import("./build-JIKYOZUH.js"),{TestMdRunView:i}=await import("./TestMdRunView-LKAITAA4.js"),{ScrollbackProvider:n}=await import("./scrollback-JLPJR25X.js"),{waitUntilExit:l}=o(e.createElement(n,null,e.createElement(i,t)),{stdout:a,stdin:s,exitOnCtrlC:!1});await l()},async runUpload(t,e){let{renderUploadProgress:o}=await import("./CliUploadProgress-K4Z22DSY.js");return await o(t,e)},async onSummary(t){try{let{default:e}=await import("./react-QWOAB3TB.js"),{render:o}=await import("./build-JIKYOZUH.js"),{AutoExitSummaryBox:i}=await import("./SummaryBox-DGS3LVRF.js"),{waitUntilExit:n}=o(e.createElement(i,{data:t}),{stdout:a,stdin:s});await n()}catch(e){m("warn","TEST_MD_SUMMARY_RENDER_FAILED","Summary box render failed",{error:String(e)})}},async onLinks(t){try{let{default:e}=await import("./react-QWOAB3TB.js"),{render:o}=await import("./build-JIKYOZUH.js"),{LinksBox:i}=await import("./LinksBox-DH7TSUXW.js"),{waitUntilExit:n}=o(e.createElement(i,t),{stdout:a,stdin:s});await n()}catch(e){m("warn","TEST_MD_LINKS_RENDER_FAILED","LinksBox render failed",{error:String(e)})}},onLockState(t){p({type:"test_md_lock_state",...t})},onAdaptiveHeal(t){p({type:"test_md_adaptive_heal",...t})},onAgentEvent(t){p(t)}}}export{w as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as u,b as x}from"./chunk-
|
|
2
|
+
import{a as u,b as x}from"./chunk-IGHK2ENL.js";import{y as m}from"./chunk-CXF6AZWY.js";import{a as f}from"./chunk-HCBYKLMW.js";import{a as r,b as i}from"./chunk-C44QQJR4.js";import{e as n}from"./chunk-UR6MHSHU.js";var e=n(f(),1);function C({title:B,titleColor:c,borderColor:d,variant:p,rows:s,footer:t,labelWidth:l=14,marginBottom:b=1}){return(0,e.jsxs)(u,{title:B,titleColor:c,borderColor:d,variant:p,marginBottom:b,children:[s.map((o,a)=>typeof o.value=="string"?(0,e.jsx)(x,{label:o.label,value:o.value,valueColor:o.valueColor,labelWidth:l},`${o.label}-${a}`):(0,e.jsxs)(r,{children:[(0,e.jsx)(r,{width:l,children:(0,e.jsx)(i,{color:m.dim,children:o.label})}),o.value]},`${o.label}-${a}`)),t&&(0,e.jsx)(r,{marginTop:1,children:t})]})}export{C as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as h}from"./chunk-
|
|
2
|
+
import{a as h}from"./chunk-TONFENRW.js";import{a as f}from"./chunk-FPFS6OSR.js";import{a as m}from"./chunk-DUYRCVI5.js";var i=class extends Error{constructor(a,l){super(a);this.code=l;this.name="AuthError"}};async function S(c){let{creds:o,env:a,usernameFlag:l,accessKeyFlag:g,log:t}=c,e=null,u=null;if(l&&g)e={username:l,access_key:g},t("info","AUTH_RESOLVE_FLAGS","Auth resolved via CLI flags",{username:l});else{let r=o.resolveAuth();r?.method==="basic"&&(e={username:r.username,access_key:r.access_key},t("info","AUTH_RESOLVE_CONFIG","Auth resolved via config",{username:r.username}))}if(!e){let{credentials:r,profile:E}=o.getActiveCredentials();if(!r)throw new i("Not authenticated \u2014 no credentials found","not_authenticated");if(u=r.access_token,r.expires_at-Date.now()/1e3<300)try{let n=await f({creds:o,profile:E,env:a,credentials:r});n&&(u=n.accessToken,t("info","AUTH_TOKEN_REFRESHED","OAuth token refreshed"))}catch(n){let d=n instanceof Error?n.message:String(n);throw t("error","TOKEN_REFRESH_FAILED","Token refresh failed",{error:d}),new i(`Token refresh failed: ${d}`,"refresh_failed")}}let v=m(a),b=async()=>u,y=e?{username:e.username,access_key:e.access_key}:null,p=new h(v.controllerBaseUrl,b,y,t),s=await p.resolve();return s&&!e&&(e={username:s.username,access_key:s.access_key},t("info","AUTH_RESOLVE_CONTROLLER","Auth resolved via controller",{username:s.username})),{basicAuth:e,token:u,resolver:p,resolvedCreds:s}}export{i as a,S as b};
|
|
@@ -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{a as f}from"./chunk-
|
|
2
|
+
import{b as y}from"./chunk-WD52ZNQY.js";import{a as f}from"./chunk-MWIE6LOZ.js";import{b as l,d,e as m,g,h as S}from"./chunk-OYKRCDT4.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-VYKUCRVW.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,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as g}from"./chunk-
|
|
2
|
+
import{b as g}from"./chunk-CXF6AZWY.js";import{readFileSync as o,writeFileSync as h,mkdirSync as u,readdirSync as a,unlinkSync as s,existsSync as l,chmodSync as f}from"fs";import{join as n,dirname as P}from"path";var d=class{baseDir;profilesDir;configFile;constructor(t=g){this.baseDir=t,this.profilesDir=n(t,"profiles"),this.configFile=n(t,"config.json")}readConfig(){try{return JSON.parse(o(this.configFile,"utf-8"))}catch{return{}}}writeConfig(t){u(this.baseDir,{recursive:!0,mode:448}),h(this.configFile,JSON.stringify(t,null,2)+`
|
|
3
3
|
`),f(this.configFile,384)}getActiveProfile(){return this.readConfig().active_profile??null}setActiveProfile(t){let i=this.readConfig();i.active_profile=t,this.writeConfig(i)}getDefaultEnv(){return this.readConfig().default_env??"prod"}setDefaultEnv(t){let i=this.readConfig();i.default_env=t,this.writeConfig(i)}credentialsPath(t,i){return n(this.profilesDir,t,i,"credentials")}clientPath(t,i){return n(this.profilesDir,t,i,"client.json")}basicAuthPath(t,i){return n(this.profilesDir,t,i,"basic-auth")}profileConfigPath(t,i){return n(this.profilesDir,t,i,"profile-config.json")}saveProfileConfig(t,i,r){let e=this.loadProfileConfig(t,i)??{};this.writeSecure(this.profileConfigPath(t,i),{...e,...r})}loadProfileConfig(t,i){try{return JSON.parse(o(this.profileConfigPath(t,i),"utf-8"))}catch{return null}}writeSecure(t,i){try{u(P(t),{recursive:!0,mode:448}),h(t,JSON.stringify(i,null,2)+`
|
|
4
4
|
`),f(t,384)}catch(r){let e=r instanceof Error?r.message:String(r);process.stderr.write(`[auth] Failed to save credentials: ${e}
|
|
5
5
|
`)}}saveCredentials(t,i,r){this.writeSecure(this.credentialsPath(t,i),r)}loadCredentials(t,i){try{return JSON.parse(o(this.credentialsPath(t,i),"utf-8"))}catch{return null}}saveClient(t,i,r){this.writeSecure(this.clientPath(t,i),r)}loadClient(t,i){try{return JSON.parse(o(this.clientPath(t,i),"utf-8"))}catch{return null}}getActiveCredentials(){let t=this.getActiveProfile();if(!t)return{credentials:null,profile:null,env:null};let i=this.getDefaultEnv();return{credentials:this.loadCredentials(t,i),profile:t,env:i}}saveBasicAuth(t,i,r){this.writeSecure(this.basicAuthPath(t,i),r)}loadBasicAuth(t,i){try{return JSON.parse(o(this.basicAuthPath(t,i),"utf-8"))}catch{return null}}deleteBasicAuth(t,i){try{s(this.basicAuthPath(t,i))}catch{}}resolveAuth(){let t=this.getActiveProfile();if(!t)return null;let i=this.getDefaultEnv(),r=this.loadBasicAuth(t,i);return r?{method:"basic",...r,profile:t,env:i}:this.loadCredentials(t,i)?{method:"oauth",profile:t,env:i}:null}listProfiles(){let t=[];try{for(let i of a(this.profilesDir)){let r=n(this.profilesDir,i);try{for(let e of a(r)){let c=n(r,e),v=l(n(c,"credentials")),p=l(n(c,"client.json")),y=l(n(c,"basic-auth"));(v||p||y)&&t.push({profile:i,env:e})}}catch{}}}catch{}return t}deleteProfile(t,i){try{s(this.credentialsPath(t,i))}catch{}if(this.getActiveProfile()===t){let r=this.readConfig();delete r.active_profile,this.writeConfig(r)}}deleteProfileFull(t,i){if(i){try{s(this.credentialsPath(t,i))}catch{}try{s(this.clientPath(t,i))}catch{}try{s(this.basicAuthPath(t,i))}catch{}try{s(this.profileConfigPath(t,i))}catch{}}else try{let r=n(this.profilesDir,t);for(let e of a(r)){try{s(n(r,e,"credentials"))}catch{}try{s(n(r,e,"client.json"))}catch{}try{s(n(r,e,"basic-auth"))}catch{}try{s(n(r,e,"profile-config.json"))}catch{}}}catch{}}};export{d as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-5Y2G4NC7.js";import{y as o}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-5Y2G4NC7.js";import{y as o}from"./chunk-CXF6AZWY.js";import{a as n}from"./chunk-HCBYKLMW.js";import{b as t}from"./chunk-C44QQJR4.js";import{a as s}from"./chunk-6YGTRKDT.js";import{e as r}from"./chunk-UR6MHSHU.js";var l=r(s(),1);var m=r(n(),1),i=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function b({active:e=!0}){let[p,c]=(0,l.useState)(0);return a(()=>{c(f=>(f+1)%i.length)},e?80:null),(0,m.jsx)(t,{color:o.orange,children:e?i[p]:"\u25CF"})}export{b as a};
|
|
@@ -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-DWHF5HUD.js";import{a as g}from"./chunk-YI3H2UIB.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,3 +1,3 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as w}from"./chunk-ZLWURCJ7.js";import{a as O}from"./chunk-QSCXXNC2.js";import{a as I}from"./chunk-KBM3XHAM.js";import{f as L}from"./chunk-5LJRZI7S.js";import{a as N,b as k}from"./chunk-BKM2LWU2.js";import{a as R,b as y,c as T,d as m,e as A,g as b,h as r}from"./chunk-RSSOJ3L2.js";import{b as x}from"./chunk-5EOX4MEY.js";import{a as E}from"./chunk-RZ4F3BHX.js";import{a as g,i as v}from"./chunk-
|
|
2
|
+
import{a as w}from"./chunk-ZLWURCJ7.js";import{a as O}from"./chunk-QSCXXNC2.js";import{a as I}from"./chunk-KBM3XHAM.js";import{f as L}from"./chunk-5LJRZI7S.js";import{a as N,b as k}from"./chunk-BKM2LWU2.js";import{a as R,b as y,c as T,d as m,e as A,g as b,h as r}from"./chunk-RSSOJ3L2.js";import{b as x}from"./chunk-5EOX4MEY.js";import{a as E}from"./chunk-RZ4F3BHX.js";import{a as g,i as v}from"./chunk-CXF6AZWY.js";import{platform as X,arch as Y}from"os";import P from"fs";import M from"fs";import D from"path";var V=1e3,d=0,j=new Set([130,3]),a=class t{ids;logger;opts;ended=!1;createdAt=Date.now();errorState;constructor(e,n={emitted:!1}){this.ids=e.envelope,this.logger=e.logger,this.opts=e,this.errorState=n}get enabled(){return this.logger!==null}event(e,n={}){if(!this.logger)return;e==="ASR_ERROR"&&(this.errorState.emitted=!0);let i=m(this.ids,e,n);this.logger.log(R[e],e,e,C(i))}error(e,n={}){this.logger&&(this.logger.escalate(d),this.event("ASR_ERROR",{...n,error_code:e}))}child(e,n){return new t({...this.opts,envelope:{...this.ids,operation_id:n,parent_operation_id:this.ids.operation_id,verb:"design"}},this.errorState)}async lateBindContext(e){if(!(!this.logger||this.ids.context_instance_id))try{let{ensureStoreIds:n}=await import("./store-id-EOSGEKVK.js"),{ids:i,cloned:s}=n(e);this.ids.context_lineage_id=i.context_lineage_id,this.ids.context_instance_id=i.context_instance_id,s&&this.event("ASR_CONTEXT_CLONED")}catch{}}agentSession(e){this.ids.agent_session_id=e}spawnEnv(){if(!this.opts.telemetryEnabled)return{};let e={TESTMUAI_USER_SESSION_ID:this.ids.session_id,TESTMUAI_OPERATION_ID:this.ids.operation_id,TESTMUAI_CLIENT_VERSION:this.opts.clientVersion,TESTMUAI_TELEMETRY_PROXY_URL:this.opts.proxyUrl};return this.ids.context_instance_id&&(e.TESTMUAI_CONTEXT_INSTANCE_ID=this.ids.context_instance_id),e}traceTee(){return e=>{if(!this.logger)return;let n=typeof e.kind=="string"?e.kind.slice(0,64):"trace",i={...C(m(this.ids,"ASR_CMD_START",{})),trace_kind:n};typeof e.code=="string"&&(i.trace_code=e.code.slice(0,64)),delete i.event,this.logger.logStep(d,`trace_${n}`,n,i)}}wireTrace(e,n,i){if(!this.logger)return;i&&this.agentSession(i);let s=n&&typeof n=="object"?n:{};switch(e){case"spawn":this.event("ASR_AGENT_SPAWN",{tier:s.tier});break;case"session_paused":this.event("ASR_SESSION_PAUSED",s);break;case"commit":this.event("ASR_COMMIT",s);break;default:this.traceTee()({kind:e,code:typeof s.code=="string"?s.code:void 0})}}banner(){return`session: ${this.ids.session_id}`}supportFooter(){return`if this keeps failing, share this id with support: ${this.ids.session_id}`}async end(e){if(!this.ended){if(this.ended=!0,e.duration_ms===void 0&&(e={...e,duration_ms:Date.now()-this.createdAt}),this.logger)if(e.exit_code===0?this.logger.discardSteps(d):this.logger.escalate(d),e.exit_code>0&&!j.has(e.exit_code)&&!this.errorState.emitted&&this.event("ASR_ERROR",{error_code:e.exit_code===2?"usage_exit_unattributed":`exit_${e.exit_code}_unattributed`,exit_code:e.exit_code}),this.event("ASR_CMD_END",e),this.opts.longSession)await this.logger.shutdown();else{let n=await this.logger.flushOnce(V);(n==="failed"||n==="timeout")&&A(this.logger.drainBuffer())}this.logger&&this.writeManifestLine(e.exit_code),r(null)}}writeManifestLine(e){try{let n=x(this.ids.context_instance_id??null);M.mkdirSync(D.dirname(n),{recursive:!0});let i={ts:new Date().toISOString(),session_id:this.ids.session_id,operation_id:this.ids.operation_id,agent_session_id:this.ids.agent_session_id,verb:this.ids.verb,mode:this.ids.mode,exit_code:e};M.appendFileSync(n,JSON.stringify(i)+`
|
|
3
3
|
`,{flag:"a",mode:384})}catch{}}};function C(t){let e={event:t.event,session_id:t.session_id,operation_id:t.operation_id,verb:t.verb,mode:t.mode,component:t.component,seq:t.seq,context_lineage_id:t.context_lineage_id,context_instance_id:t.context_instance_id};t.parent_operation_id&&(e.parent_operation_id=t.parent_operation_id),t.agent_session_id&&(e.agent_session_id=t.agent_session_id);for(let[n,i]of Object.entries(t.context))e[n]=i;return e}var u=process.env.KANE_TELEMETRY_URL||v;function B(){return process.env.TESTMUAI_BASE_URL?"custom":process.env.TESTMUAI_ENV==="stage"?"stage":"prod"}function _e(t){let e=process.env.KANE_TELEMETRY!=="0"&&(!process.env.VITEST||process.env.KANE_TELEMETRY==="1"),n=t.env??B(),i=null;if(t.resumeSid&&t.contextRoot)try{let o=L(t.contextRoot,t.resumeSid);o?.user_session_id&&(i=o.user_session_id)}catch{}if(!i&&t.applyPlanPath)try{let o=JSON.parse(P.readFileSync(t.applyPlanPath,"utf8"));o.telemetry?.user_session_id&&(i=o.telemetry.user_session_id)}catch{}let s=i!==null;i||(i=y());let l=null,c=null,f=!1;if(t.contextRoot&&P.existsSync(t.contextRoot))if(t.write&&e){let o=k(t.contextRoot);l=o.ids.context_lineage_id,c=o.ids.context_instance_id,f=o.cloned}else{let o=N(t.contextRoot);l=o?.context_lineage_id??null,c=o?.context_instance_id??null}let h={session_id:i,operation_id:T(),context_lineage_id:l,context_instance_id:c,verb:t.verb,mode:t.mode,component:"kane-cli"},_=null;if(e){let o=I(n),S={org_id:o.org_id??"",user_id:o.user_id??"",machine_id:o.machine_id,email:null,email_domain:"",user_type:o.user_type??"unknown",env:o.env,plan:o.plan??"unknown"},U=t.mode==="interactive"||t.mode==="cli"?"cli":"agent";_=new w({proxyUrl:u,sessionId:i,identity:S,device:{cli_version:g,platform:X(),arch:Y(),host_agent:O(),invocation_mode:U},getToken:async()=>null}),t.longSession&&_.start()}let p=new a({envelope:h,logger:_,longSession:!!t.longSession,proxyUrl:u,clientVersion:`kane-cli/${g}`,telemetryEnabled:e});return e&&(r(h),p.event("ASR_CMD_START",{resumed:s,applied_plan:!!t.applyPlanPath}),f&&p.event("ASR_CONTEXT_CLONED"),b(async o=>{try{return(await E(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)})).ok}catch{return!1}}).catch(()=>{})),p}export{B as a,_e as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as s}from"./chunk-
|
|
2
|
+
import{b as s}from"./chunk-HJX5PQRD.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};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{e as $e}from"./chunk-
|
|
2
|
+
import{e as $e}from"./chunk-ATYXPCM6.js";import{a as te}from"./chunk-5HOHXV2K.js";import{a as K}from"./chunk-5Y2G4NC7.js";import{a as Be}from"./chunk-3C32LVLX.js";import{a as ve}from"./chunk-IGHK2ENL.js";import{y as i}from"./chunk-CXF6AZWY.js";import{b as ye}from"./chunk-DFS4RMVP.js";import{a as k}from"./chunk-HCBYKLMW.js";import{a as s,b as o,i as Se,j as Te,k as ee}from"./chunk-C44QQJR4.js";import{a as V}from"./chunk-6YGTRKDT.js";import{e as R}from"./chunk-UR6MHSHU.js";var A=R(V(),1);var C=R(V(),1);function de(e){let t=e.flatMap(u=>[u,...u.children??[]]),n=t.filter(u=>u.status==="passed").length,l=t.filter(u=>u.status==="failed").length,a=t.filter(u=>u.status==="passed"||u.status==="failed").length;return{passed:n,failed:l,total:a}}function we(e){let t=$e(e.screenshotDispatcher,e.stepLogger,e.onReasoning,e.onStepComplete),[n,l]=(0,C.useState)(0),[a,u]=(0,C.useState)("idle"),c=(0,C.useRef)("idle"),v=(0,C.useRef)(0),S=(0,C.useRef)(!1),T=(0,C.useRef)(null),d=(0,C.useRef)(null),L=(0,C.useCallback)(h=>{c.current=h,u(h)},[]),O=(0,C.useCallback)(async h=>{let b=await e.getNextConfig(h);if(!b){L("done"),e.onAllComplete?.();return}let B=h?v.current+1:0;v.current=B,l(B),e.onStepStart?.(b,B),T.current=null,d.current=null,L("running"),await t.startRun(b,e.spawnOpts)},[t,e,L]);(0,C.useEffect)(()=>{S.current||(S.current=!0,O(null))},[]),(0,C.useEffect)(()=>{if(!t.lastRunEnd||t.lastRunEnd===T.current||c.current!=="running")return;T.current=t.lastRunEnd,c.current="transitioning",u("transitioning");let h=t.lastRunEnd,b=de(t.steps),B=t.bifurcationInfo,F={status:h.status==="passed"?"passed":"failed",duration_s:h.duration??0,reason:h.reason,runEnd:h,hadError:!1,stepsPassed:b.passed,stepsFailed:b.failed,stepsTotal:b.total,bifurcationFlows:B&&!B.isSingleFlow?B.flows:null,evidence:t.getEvidenceState()};if(!(e.onStepEnd?.(F,v.current)??!0)){L("done"),e.onAllComplete?.();return}O(F)},[t.lastRunEnd]),(0,C.useEffect)(()=>{if(!t.runError||t.runError===d.current||t.lastRunEnd||c.current!=="running")return;d.current=t.runError,c.current="transitioning",u("transitioning");let h=de(t.steps),b={status:"failed",duration_s:0,reason:t.runError,runEnd:null,hadError:!0,stepsPassed:h.passed,stepsFailed:h.failed,stepsTotal:h.total,bifurcationFlows:null,evidence:t.getEvidenceState()};if(!(e.onStepEnd?.(b,v.current)??!0)){L("done"),e.onAllComplete?.();return}O(b)},[t.runError,t.lastRunEnd]);let y=(0,C.useCallback)(()=>{t.cancelRun()},[t]);return{runner:t,currentStepIndex:n,phase:a,cancel:y}}var pe=R(V(),1);var ne=R(k(),1),Ee=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function ke({label:e,hasBifurcation:t=!1}){let[n,l]=(0,pe.useState)(0),[a,u]=(0,pe.useState)(0);K(()=>{l(v=>(v+1)%Ee.length)},80),K(()=>{u(v=>(v+1)%4)},400);let c=e??(t?"Planning approach":"Analyzing objective");return(0,ne.jsxs)(s,{marginLeft:1,children:[(0,ne.jsxs)(o,{color:i.orange,children:[Ee[n]," "]}),(0,ne.jsxs)(o,{color:i.dim,children:[c,".".repeat(a+1)]})]})}function Ie(e){if(!e.isRunning||e.replayInfo)return null;let t=e.bifurcationInfo;if(t&&!t.isSingleFlow){let n=e.steps.findIndex(a=>a.status==="running");return(n===-1?e.cmInitCounts.length===0:n>=e.cmInitCounts.length)?{label:n>0?`Planning flow ${n+1}`:void 0,hasBifurcation:!0}:null}return e.cmInitCounts.length>0||e.steps.some(n=>n.children?.length)?null:{hasBifurcation:!!t}}var I=R(V(),1);var Ce=R(V(),1);var re=R(k(),1),He="#ffc580",Ue="#ffd9a8",Le="#ffffff";function oe({text:e,active:t=!0}){let[n,l]=(0,Ce.useState)(0),a=4;if(K(()=>{l(c=>(c+1)%(e.length+a*2))},t?80:null),!t)return(0,re.jsx)(o,{color:Le,children:e});let u=e.split("").map((c,v)=>{let S=n-a,T=Math.abs(v-S-a/2),d;return T<=a/2?d=He:T<=a?d=Ue:d=Le,(0,re.jsx)(o,{color:d,children:c},v)});return(0,re.jsx)(o,{children:u})}var _=R(k(),1),We={starting:i.orange,running:i.orange,passed:i.green,failed:i.red,cancelled:i.dim,timed_out:i.orange};function ie({currentStep:e,maxSteps:t,elapsed:n,status:l}){let a=We[l]??i.orange,u=n<60?`${n.toFixed(1)}s`:`${Math.floor(n/60)}m ${Math.round(n%60)}s`;return(0,_.jsxs)(s,{marginLeft:3,children:[(0,_.jsx)(o,{color:i.dim,children:"Steps "}),(0,_.jsx)(o,{bold:!0,children:e}),(0,_.jsxs)(o,{color:i.dim,children:["/",t]}),(0,_.jsx)(o,{children:" "}),(0,_.jsx)(o,{color:i.dim,children:"Elapsed "}),(0,_.jsx)(o,{bold:!0,children:u}),(0,_.jsx)(o,{children:" "}),(0,_.jsx)(o,{color:i.dim,children:"Status "}),(0,_.jsx)(o,{bold:!0,color:a,children:l})]})}var Ve={click:"\u25CF",type:"\u229E",scroll:"\u2195",navigate:"\u2192",analyze:"\u25CE",assert:"\u25C8","if-else":"\u2442",select:"\u25BC",press_key:"\u21B5",wait:"\u2026",tool_call:"\u2299"};function Oe(e){return Ve[e]??"\u25CF"}var q=R(k(),1);function fe({steps:e,flows:t,cmInitCounts:n,renderStep:l}){return(0,q.jsxs)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:[(0,q.jsxs)(o,{color:i.dim,children:["\u2501\u2501 Bifurcated into ",t?.length??e.length," flows \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"]}),e.map((a,u)=>(0,q.jsxs)(s,{flexDirection:"column",marginTop:u>0?1:0,children:[(0,q.jsxs)(o,{color:i.orange,children:["Flow ",u+1,": ",t?.[u]??a.objective]}),n&&n[u]!=null&&(0,q.jsxs)(o,{color:i.dim,children:[" \u25AA Generated task with ",n[u]," checkpoints"]}),a.children&&a.children.length>0?a.children.map(c=>{let v=!!c.branchObjective,S=`f${u}-${c.childId??"p"}-${c.index}`;return v?(0,q.jsxs)(s,{flexDirection:"column",children:[l({...c,children:void 0},S),(c.children??[]).map(T=>(0,q.jsx)(s,{marginLeft:2,children:l(T,`${S}-${T.childId??"p"}-${T.index}`)},`${S}-${T.childId??"p"}-${T.index}`))]},`${S}-host`):l(c,S)}):a.status==="pending"&&(0,q.jsx)(o,{color:i.dim,children:" \u25CB Waiting..."})]},u))]})}var H=R(k(),1);function Pe({label:e,shimmer:t=!1}){return(0,H.jsxs)(s,{marginLeft:6,children:[(0,H.jsx)(te,{}),(0,H.jsx)(o,{children:" "}),t?(0,H.jsx)(oe,{text:e,active:!0}):(0,H.jsx)(o,{color:i.dim,children:e})]})}var De=R(V(),1);var me=R(k(),1);function ze(e,t){let n=[];for(let l of e.split(`
|
|
3
3
|
`)){if(l===""){n.push("");continue}let a="";for(let u of l.split(" ")){let c=u;for(;c.length>t;)a&&(n.push(a),a=""),n.push(c.slice(0,t)),c=c.slice(t);a===""?a=c:a.length+1+c.length<=t?a+=" "+c:(n.push(a),a=c)}n.push(a)}return n}function je({text:e,maxLines:t=3}){let{stdout:n}=ee(),l=Math.max(20,(n?.columns??80)-7),a=!e.trim(),[u,c]=(0,De.useState)(!0);K(()=>c(T=>!T),500);let v=(a?"Thinking\u2026":e)+(u?"\u258C":" "),S=ze(v,l).slice(-t);for(;S.length<t;)S.push("");return(0,me.jsx)(s,{borderStyle:"round",borderColor:i.muted,paddingX:1,marginLeft:3,flexDirection:"column",children:S.map((T,d)=>(0,me.jsx)(o,{color:a?i.dim:i.secondary,wrap:"truncate-end",children:T.length?T:" "},d))})}var U=R(k(),1);function se({activity:e,describe:t,describeVisible:n}){return(0,U.jsxs)(U.Fragment,{children:[e?(0,U.jsx)(Pe,{label:e.label,shimmer:e.shimmer}):null,n?(0,U.jsx)(je,{text:t??""}):null]})}var r=R(k(),1);function le(e){for(let t of e){if(t.children&&t.children.length>0){let n=le(t.children);if(n)return n}if(t.status==="running")return t}}function z(e){return e.status==="running"&&!e.branchObjective&&(!e.children||e.children.length===0)}function Fe(e){let t=[];for(let n of e)z(n)||(n.children&&n.children.length>0?t.push({...n,children:Fe(n.children)}):t.push(n));return t}function ge(e,t){if(!e)return null;let n=e.objective??"";return n.length>0&&!/^Step \d+$/.test(n)?{label:n+"\u2026",shimmer:!1}:{label:t?"Looking at the screen\u2026":"Deciding next action\u2026",shimmer:!0}}function P({step:e,indent:t=2}){let n=e.actionType?Oe(e.actionType):null,l=e.status==="running",a=e.status==="passed",u=e.status==="failed",c=e.status==="pending"||e.status==="stopped",{stdout:v}=ee(),S=v?.columns??80,T=Math.max(20,S-t-21),d=e.objective??"",L=d.length>T?d.slice(0,T-1)+"\u2026":d,O=(e.duration??0)*1e3,y=e.duration!=null?O<1e3?`${Math.round(O)}ms`:`${(O/1e3).toFixed(1)}s`:"";return(0,r.jsxs)(s,{flexDirection:"column",children:[(0,r.jsxs)(s,{marginLeft:t,children:[(0,r.jsx)(s,{width:4,children:(0,r.jsxs)(o,{color:i.muted,children:[String(e.index).padStart(2," ")," "]})}),(0,r.jsx)(s,{width:3,children:l?(0,r.jsx)(te,{}):a?(0,r.jsx)(o,{color:i.green,bold:!0,children:"\u2713"}):u?(0,r.jsx)(o,{color:i.red,bold:!0,children:"\u2717"}):(0,r.jsx)(o,{color:i.muted,children:"\u25CB"})}),(0,r.jsx)(s,{flexGrow:1,children:l?(0,r.jsx)(oe,{text:L,active:!0}):u?(0,r.jsx)(o,{color:i.red,children:L}):c?(0,r.jsx)(o,{color:i.dim,children:L}):(0,r.jsx)(o,{color:i.dim,children:L})}),(a||u)&&n?(0,r.jsx)(s,{width:3,marginLeft:1,children:(0,r.jsx)(o,{color:i.muted,children:n})}):(0,r.jsx)(s,{width:3,marginLeft:1}),(0,r.jsx)(s,{width:7,justifyContent:"flex-end",children:(0,r.jsx)(o,{color:i.dim,children:y})})]}),e.children&&e.children.length>0&&(0,r.jsx)(s,{flexDirection:"column",children:e.children.map((h,b)=>(0,r.jsx)(P,{step:h,indent:t+2},`child-${b}`))})]})}function Xe(e){return e.type==="cm_init"?(0,r.jsx)(s,{marginLeft:2,paddingLeft:1,children:(0,r.jsxs)(o,{color:i.dim,children:["\u25AA Generated task with ",e.count," checkpoints"]})}):(0,r.jsx)(s,{marginLeft:2,paddingLeft:1,children:(0,r.jsx)(P,{step:e.step})})}function _e({steps:e,bifurcated:t,flows:n,cmInitCounts:l,maxSteps:a=50,staticSteps:u=!1,onStepCommit:c,describe:v,describeVisible:S,describeRevealing:T}){let d=(0,I.useRef)(new Set),L=(0,I.useRef)(!1),O=(0,I.useRef)(new Set),y=(0,I.useRef)(!1),h=(0,I.useRef)(new Set),b=(0,I.useRef)(0);(0,I.useEffect)(()=>{e.length===0&&b.current>0&&(d.current.clear(),L.current=!1,O.current.clear(),y.current=!1,h.current.clear()),b.current=e.length},[e.length]);let B=e.flatMap(p=>[p,...p.children??[]]),F=B.some(p=>p.status==="running"),M=B.some(p=>p.status==="failed"),X=B.length===0||B.every(p=>p.status==="pending"),Y=B.filter(p=>p.status==="passed"||p.status==="failed").length,N;X?N="starting":F?N="running":M?N="failed":N="passed";let J=(0,I.useRef)(null),[ce,he]=(0,I.useState)(0);(0,I.useEffect)(()=>{B.length===0||X?(J.current=null,he(0)):F&&J.current==null&&(J.current=Date.now())},[F,X,B.length]),(0,I.useEffect)(()=>{if(!F)return;let p=setInterval(()=>{J.current!=null&&he((Date.now()-J.current)/1e3)},500);return()=>clearInterval(p)},[F]);let ae=(0,I.useRef)(new Set),[,xe]=(0,I.useState)(0),be=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(!c||!u||t)return;let p=[];!be.current&&l&&l[0]!=null&&(be.current=!0,l[0]>0&&p.push({key:"cm_init_0",type:"cm_init",count:l[0]}));for(let g of e)(g.status==="passed"||g.status==="failed")&&!ae.current.has(g.index)&&(ae.current.add(g.index),p.push({key:`step_${g.index}`,type:"step",step:{...g,children:g.children?[...g.children]:void 0}}));if(p.length>0){for(let g of p)c(Xe(g));xe(g=>g+1)}},[e,t,l,u,c]),(0,I.useEffect)(()=>{if(!c||u)return;let p=d.current.size;if(!t&&!y.current&&l&&l[0]!=null&&(y.current=!0,l[0]>0&&c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsxs)(o,{color:i.dim,children:["\u25A0 Generated task with ",l[0]," checkpoints"]})}))),t&&n&&!L.current&&(L.current=!0,c((0,r.jsx)(o,{color:i.purple,children:"\u2501\u2501 Bifurcated into "+n.length+" flows \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"}))),t){let g=e.flatMap((x,f)=>{let m=x.children??[];return!O.current.has(f)&&m.length>0&&(O.current.add(f),c((0,r.jsx)(o,{color:i.purple,children:" Flow "+(f+1)+": "+(n?.[f]??"")})),l?.[f]!=null&&l[f]>0&&!h.current.has(f)&&(h.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsxs)(o,{color:i.dim,children:[" \u25AA Generated task with ",l[f]," checkpoints"]})})))),l?.[f]!=null&&l[f]>0&&O.current.has(f)&&!h.current.has(f)&&(h.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsxs)(o,{color:i.dim,children:[" \u25AA Generated task with ",l[f]," checkpoints"]})}))),m});for(let x of g){let f=`${x.childId??"p"}-${x.index}-${x.objective}`;if(!!x.branchObjective){d.current.has(f)||(d.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:{...x,children:void 0}})})));for(let $ of x.children??[]){let w=`child-${x.childId??"p"}-${x.index}-${$.childId??"p"}-${$.index}-${$.objective}`;d.current.has(w)||($.status==="passed"||$.status==="failed"||$.status==="stopped")&&(d.current.add(w),c((0,r.jsx)(s,{marginLeft:4,children:(0,r.jsx)(P,{step:$})})))}continue}d.current.has(f)||(x.status==="passed"||x.status==="failed"||x.status==="stopped")&&(d.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:x})})))}}else for(let g of e){let x=`${g.index}-${g.objective}`,f=!!g.branchObjective;f&&!d.current.has(x)&&(d.current.add(x),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:{...g,children:void 0}})})));for(let m of g.children??[]){let $=`child-${g.index}-${m.childId??"p"}-${m.index}-${m.objective}`;d.current.has($)||(m.status==="passed"||m.status==="failed"||m.status==="stopped")&&(d.current.add($),c((0,r.jsx)(s,{marginLeft:4,children:(0,r.jsx)(P,{step:m})})))}!f&&!d.current.has(x)&&(g.status==="passed"||g.status==="failed"||g.status==="stopped")&&(d.current.add(x),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:{...g,children:void 0}})})))}d.current.size>p&&xe(g=>g+1)},[e,c,t,n,l]);let G=[];if(u&&!t)for(let p of e)ae.current.has(p.index)||G.push(p);else if(c&&!u)if(t)for(let p of e){let g=p.children??[],x=[];for(let f of g){let m=`${f.childId??"p"}-${f.index}-${f.objective}`,$=d.current.has(m);if(f.branchObjective){let w=(f.children??[]).filter(Q=>{let ue=`child-${f.childId??"p"}-${f.index}-${Q.childId??"p"}-${Q.index}-${Q.objective}`;return!d.current.has(ue)});(!$||w.length>0)&&x.push({...f,children:w})}else $||x.push(f)}x.length>0&&G.push({...p,children:x})}else for(let p of e){let g=`${p.index}-${p.objective}`,x=d.current.has(g),f=(p.children??[]).filter(m=>{let $=`child-${p.index}-${m.childId??"p"}-${m.index}-${m.objective}`;return!d.current.has($)});x?f.length>0&&G.push({...p,children:f}):G.push({...p,children:f})}if(!u){let p=c?G:e,g=le(p),x=ge(g,T);return(0,r.jsxs)(s,{flexDirection:"column",children:[t?c?p.length>0?(0,r.jsx)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:p.map((m,$)=>(0,r.jsx)(s,{flexDirection:"column",marginTop:$>0?1:0,children:m.children&&m.children.length>0?m.children.map(w=>{if(z(w))return null;let Q=!!w.branchObjective,ue=`${w.childId??"p"}-${w.index}-${w.objective}`,Ke=d.current.has(ue);return Q?(0,r.jsxs)(s,{flexDirection:"column",children:[!Ke&&(0,r.jsx)(P,{step:{...w,children:void 0}}),(w.children??[]).filter(Z=>!z(Z)).map(Z=>(0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:Z})},`f${$}-${w.index}-${Z.childId??"p"}-${Z.index}`))]},`f${$}-host-${w.childId??"p"}-${w.index}`):(0,r.jsx)(P,{step:w},`f${$}-${w.childId??"p"}-${w.index}`)}):m.status==="pending"&&(0,r.jsx)(o,{color:i.dim,children:" \u25CB Waiting..."})},$))}):null:(0,r.jsx)(fe,{steps:e,flows:n,cmInitCounts:l,renderStep:(m,$)=>z(m)?null:(0,r.jsx)(P,{step:m},$)}):(0,r.jsxs)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:[!c&&l&&l[0]!=null&&(0,r.jsxs)(o,{color:i.dim,children:["\u25AA Generated task with ",l[0]," checkpoints"]}),p.filter(m=>!(m.status==="running"&&(!m.children||m.children.length===0))).map(m=>{let $=`${m.index}-${m.objective}`;return c&&d.current.has($)?(0,r.jsx)(s,{flexDirection:"column",children:(m.children??[]).filter(w=>!z(w)).map(w=>(0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:w})},`${w.childId??"p"}-${w.index}`))},`branch-children-${m.index}`):(0,r.jsx)(P,{step:m},m.index)})]}),(0,r.jsx)(se,{activity:x,describe:v,describeVisible:S}),B.length>0&&(0,r.jsx)(ie,{currentStep:Y,maxSteps:a,elapsed:ce,status:N})]})}if(t){let p=le(e),g=ge(p,T);return(0,r.jsxs)(s,{flexDirection:"column",children:[(0,r.jsx)(fe,{steps:e,flows:n,cmInitCounts:l,renderStep:(x,f)=>z(x)?null:(0,r.jsx)(P,{step:x},f)}),(0,r.jsx)(se,{activity:g,describe:v,describeVisible:S}),B.length>0&&(0,r.jsx)(ie,{currentStep:Y,maxSteps:a,elapsed:ce,status:N})]})}let Ne=le(G),Ge=ge(Ne,T),Re=Fe(G);return(0,r.jsxs)(s,{flexDirection:"column",children:[Re.length>0&&(0,r.jsx)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:Re.map(p=>(0,r.jsx)(P,{step:p},p.index))}),(0,r.jsx)(se,{activity:Ge,describe:v,describeVisible:S}),B.length>0&&(0,r.jsx)(ie,{currentStep:Y,maxSteps:a,elapsed:ce,status:N})]})}var W=R(k(),1);function Ae({runner:e,runKey:t,onStepCommit:n}){let l=Ie({isRunning:e.isRunning,bifurcationInfo:e.bifurcationInfo,steps:e.steps,cmInitCounts:e.cmInitCounts,replayInfo:e.replayInfo});return(0,W.jsxs)(W.Fragment,{children:[l&&(0,W.jsx)(ke,{label:l.label,hasBifurcation:l.hasBifurcation}),e.isRunning&&e.steps.length>0&&(0,W.jsx)(_e,{steps:e.steps,bifurcated:!!e.bifurcationInfo&&!e.bifurcationInfo.isSingleFlow,flows:e.bifurcationInfo?.flows,cmInitCounts:e.cmInitCounts,maxSteps:e.maxSteps,onStepCommit:n},`run-${t}`)]})}var D=R(k(),1),Ye=64;function Je(e){return e.split(`
|
|
4
4
|
`).map(t=>t.replace(/^[-–•]\s*/,"").trim()).filter(t=>t.length>0)}function qe({status:e,summary:t,duration:n,steps:l,stepsPassed:a,stepsFailed:u,reason:c,creditsConsumed:v}){let S=e==="passed",T=S?i.green:i.red,d=S?"\u2713":"\u2717",L=e.toUpperCase(),O=a??(S?l:Math.max(0,l-1)),y=u??(S?0:1),h=y>0?`${l} steps (${O} passed, ${y} failed)`:`${l} steps`,b=n<60?`${n.toFixed(1)}s`:`${Math.floor(n/60)}m ${Math.round(n%60)}s`,B=Je(t);return(0,D.jsx)(s,{flexDirection:"column",marginTop:1,children:(0,D.jsxs)(s,{borderStyle:"round",borderColor:T,flexDirection:"column",paddingX:2,paddingY:1,width:Ye+6,children:[(0,D.jsxs)(s,{flexDirection:"column",children:[(0,D.jsxs)(o,{bold:!0,color:T,children:[d," ",L]}),(0,D.jsxs)(o,{color:i.dim,wrap:"wrap",children:[h," \xB7 ",b,typeof v=="number"&&v>0?` \xB7 ${parseFloat(v.toFixed(4))} credits`:""]})]}),B.length>0&&(0,D.jsx)(s,{flexDirection:"column",marginTop:1,marginLeft:1,children:B.map((F,M)=>(0,D.jsxs)(s,{marginBottom:M<B.length-1?1:0,children:[(0,D.jsx)(o,{color:i.orange,children:"\u25CF "}),(0,D.jsx)(s,{flexShrink:1,children:(0,D.jsx)(o,{wrap:"wrap",children:F})})]},M))}),c&&!S&&(0,D.jsx)(s,{marginTop:1,children:(0,D.jsxs)(o,{color:i.red,wrap:"wrap",children:["Reason: ",c]})})]})})}var j=R(k(),1);function Me({message:e,code:t,remediation:n,docsUrl:l}){return(0,j.jsx)(ve,{title:"Error",variant:"error",children:(0,j.jsxs)(s,{flexDirection:"column",paddingY:1,children:[(0,j.jsxs)(o,{color:i.red,bold:!0,children:[" \u2717 ",e]}),t&&(0,j.jsxs)(s,{marginTop:0,marginLeft:5,children:[(0,j.jsx)(o,{color:i.muted,children:"Code: "}),(0,j.jsx)(o,{color:i.dim,children:t})]}),n&&(0,j.jsxs)(s,{flexDirection:"column",marginTop:1,marginLeft:5,children:[(0,j.jsx)(o,{color:i.green,bold:!0,children:"Fix:"}),(0,j.jsxs)(o,{color:i.orange,children:["$ ",n]})]}),l&&(0,j.jsxs)(s,{marginTop:1,marginLeft:5,children:[(0,j.jsx)(o,{color:i.muted,children:"Docs: "}),(0,j.jsx)(o,{color:i.orange,underline:!0,children:l})]})]})})}var E=R(k(),1);function un(e){let{exit:t}=Te(),{append:n}=ye(),l=(0,A.useRef)(!1);(0,A.useEffect)(()=>{l.current||(l.current=!0,n((0,E.jsx)(s,{flexDirection:"column",marginBottom:1,children:(0,E.jsxs)(s,{borderStyle:"round",borderColor:"#dc4e08",paddingX:2,children:[(0,E.jsx)(o,{color:"#ff9500",bold:!0,children:"KaneAI CLI"}),(0,E.jsx)(o,{color:i.dim,children:" \u2502 "}),(0,E.jsx)(o,{color:i.orange,children:e.topBanner.model}),(0,E.jsx)(o,{color:i.dim,children:" \u2502 "}),(0,E.jsx)(o,{color:i.dim,children:e.topBanner.auth})]})})),n((0,E.jsx)(Qe,{data:e.globalConfig})),e.priorAttemptRollup&&n((0,E.jsx)(o,{color:i.dim,children:` \u21B3 replayed ${e.priorAttemptRollup.startIdx}..${e.priorAttemptRollup.endIdx-1} (${e.priorAttemptRollup.count} steps, from prior attempt)`})))},[]);let a=(0,A.useRef)(null),u=(0,A.useCallback)(async y=>{let h=await e.getNextStep(y);return h?(a.current=h,h.config):(a.current=null,null)},[e]),c=(0,A.useCallback)((y,h)=>{let b=a.current;if(!b)return;let B=b.mode==="replay"?"cyan":"#dc4e08",F=b.modeReason?` (${b.modeReason})`:"",M=b.perStepOverrides?Object.entries(b.perStepOverrides):[];n((0,E.jsxs)(s,{flexDirection:"column",marginBottom:0,children:[(0,E.jsxs)(o,{children:[(0,E.jsxs)(o,{color:i.dim,children:[b.banner.stepLabel," "]}),(0,E.jsxs)(o,{color:B,children:["[",b.mode,"]"]}),(0,E.jsx)(o,{color:i.dim,children:F})]}),(0,E.jsx)(o,{color:i.dim,children:b.banner.objective}),M.length>0&&(0,E.jsxs)(o,{color:i.dim,children:["overrides: ",M.map(([X,Y])=>`${X}=${Y}`).join(", ")]})]}))},[n]),v=(0,A.useRef)(0),S=(0,A.useRef)(!1),T=(0,A.useCallback)((y,h)=>(y.hadError?n((0,E.jsx)(Me,{message:y.reason??"Runner error",code:"RUNNER_ERROR"})):n((0,E.jsx)(s,{flexDirection:"column",marginBottom:1,children:(0,E.jsx)(qe,{status:y.status,summary:y.runEnd?.summary??"",duration:y.runEnd?.duration??0,steps:y.stepsTotal,stepsPassed:y.stepsPassed,stepsFailed:y.stepsFailed,reason:y.runEnd?.reason,creditsConsumed:y.runEnd?.credits_consumed})})),e.onStepEnd?.(y,h)??!0),[n,e]),d=we({getNextConfig:u,onStepStart:c,onStepEnd:T,onAllComplete:()=>{e.onAllComplete(),e.exitOnComplete!==!1&&setImmediate(()=>t())},screenshotDispatcher:e.screenshotDispatcher,stepLogger:e.stepLogger,onReasoning:e.onReasoning,onStepComplete:e.onStepComplete,spawnOpts:e.spawnOpts}),L=250,O=5e3;return Se((y,h)=>{if(h.ctrl&&y==="c"){let b=Date.now(),B=b-v.current;if(B<L)return;S.current&&B<O?(d.cancel(),e.onCancel?.(),e.exitOnComplete!==!1&&setImmediate(()=>t())):(S.current=!0,n((0,E.jsx)(o,{color:"yellow",children:"press Ctrl+C again to cancel run"}))),v.current=b}}),(0,E.jsx)(s,{flexDirection:"column",children:d.phase!=="done"&&(0,E.jsx)(Ae,{runner:d.runner,runKey:d.currentStepIndex,onStepCommit:n})})}function Qe({data:e}){return(0,E.jsx)(Be,{title:"test.md run",titleColor:"#ff9500",borderColor:i.dim,rows:[{label:"source",value:e.source},{label:"steps",value:`${e.steps.total} (${e.steps.replay} replay, ${e.steps.author} author per walker)`},{label:"model",value:e.model},{label:"viewport",value:`${e.viewport.width} x ${e.viewport.height}`},{label:"chrome",value:e.chrome},{label:"session",value:e.session},{label:"variables",value:`${e.variables.count} (${e.variables.secrets} secret)`},{label:"flags",value:e.flags.length>0?e.flags.join(" "):"(none)"}]})}export{_e as a,ke as b,Ie as c,de as d,qe as e,Me as f,un as g};
|
|
@@ -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-OYKRCDT4.js";import{a as Y,b as M}from"./chunk-NBXYL2JT.js";import{a as F}from"./chunk-ODU2JSMA.js";import{a as R}from"./chunk-DHJSM5DT.js";import{a as A}from"./chunk-CXF6AZWY.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};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as N,c as V}from"./chunk-Q6AHSGOE.js";import{b as Y}from"./chunk-LDPLJFCV.js";import{a as M,b as U}from"./chunk-UJZZDPDY.js";import{b as B}from"./chunk-5ZFOKYFB.js";import{a as K}from"./chunk-BZAGVBCX.js";import{a as k}from"./chunk-LSDWPG6C.js";import{P as E,Q as F,S as L}from"./chunk-
|
|
2
|
+
import{a as N,c as V}from"./chunk-Q6AHSGOE.js";import{b as Y}from"./chunk-LDPLJFCV.js";import{a as M,b as U}from"./chunk-UJZZDPDY.js";import{b as B}from"./chunk-5ZFOKYFB.js";import{a as K}from"./chunk-BZAGVBCX.js";import{a as k}from"./chunk-LSDWPG6C.js";import{P as E,Q as F,S as L}from"./chunk-RMVASIVL.js";import{B as I,z as A}from"./chunk-IICT4VOU.js";import{f as p,g as $}from"./chunk-XLSOQLVT.js";var q=new Set([p.USECASE,p.SCENARIO,p.AC,p.TEST]);function w(t,e){return!t.superseded.has(e)&&t.trust.get(e)!=="archived"}function T(t,e,n){let r=t.edgesFrom(e).find(s=>s.type===n);return r?t.tipOf(r.dst):null}function _(t,e,n){if(n===p.USECASE)return e;if(n===p.SCENARIO)return T(t,e,$.BELONGS_TO);if(n===p.AC){let r=T(t,e,$.SCOPED_TO);return r?t.nodeLabel.get(r)===p.USECASE?r:T(t,r,$.BELONGS_TO):null}if(n===p.TEST){let r=T(t,e,$.AUTOMATES);return r?T(t,r,$.BELONGS_TO):null}return null}function G(t,e){let n=t.nameOf.get(e);if(n)return n;for(let[r,s]of t.names)if(t.tipOf(s)===e)return r;return e}function J(t,e){return{ucTip:e,display:G(t,e),seamRef:t.nameOf.get(e)??e}}function se(t,e){let n=t.resolve(e);if(!n)return{ok:!1,message:`unknown ref '${e}' \u2014 no test/scenario/ac/use-case by that id or cid`};let r=n.tip,s=t.nodeLabel.get(r);if(!s||!q.has(s))return{ok:!1,message:`'${e}' is a ${s??"missing node"} \u2014 evolve takes a test, scenario, acceptance criterion, or use-case`};let o=_(t,r,s);return!o||t.nodeLabel.get(o)!==p.USECASE?{ok:!1,message:`cannot resolve '${e}' to a parent use-case \u2014 its ${s} chain is broken`}:t.superseded.has(o)?{ok:!1,message:`use-case ${G(t,o)} was removed \u2014 nothing to evolve`}:t.trust.get(o)==="archived"?{ok:!1,message:`use-case ${G(t,o)} was archived \u2014 nothing to evolve`}:{ok:!0,target:J(t,o)}}function Ie(t,e){return R(t,e)}function R(t,e){let n=[];for(let{cid:s}of t.byLabel(p.SCENARIO)){if(!w(t,s)||!t.edgesFrom(s).some(i=>i.type===$.BELONGS_TO&&t.tipOf(i.dst)===e))continue;let o=t.edgesInto(s).filter(i=>i.type===$.AUTOMATES&&w(t,i.src));if(o.length===0)n.push({scenario:s,test:null});else for(let i of o)n.push({scenario:s,test:i.src})}let r=new Map;for(let{cid:s}of t.byLabel(p.AC)){if(!w(t,s)||_(t,s,p.AC)!==e)continue;let o=t.edgesInto(s).filter(i=>i.type===$.VERIFIES&&w(t,i.src)).map(i=>i.src).sort();r.set(s,o)}return{pairs:n,verifies:r}}function re(t,e){let n=i=>`${i.scenario}\0${i.test??""}`,r=new Set(t.pairs.map(n)),s=new Set(e.pairs.map(n)),o=[];for(let[i,c]of t.verifies){let d=e.verifies.get(i);d&&(c.length===d.length&&c.every((f,u)=>f===d[u])||o.push({ac:i,before:c,after:d}))}return{superseded:t.pairs.filter(i=>!s.has(n(i))),minted:e.pairs.filter(i=>!r.has(n(i))),retained:e.pairs.filter(i=>r.has(n(i))),moves:o}}function ie(t,e,n,r,s){let o=c=>e.nameOf.get(c)??c,i=c=>` - ${o(c.scenario)} \xB7 ${c.test?o(c.test):"(no test)"}`;t.out(`evolved: use-case ${n} \u2014 design record ${r.before} \u2192 ${r.after}`),t.out(` superseded ${s.superseded.length} pair(s)`);for(let c of s.superseded)t.out(i(c));t.out(` minted ${s.minted.length} pair(s)`);for(let c of s.minted)t.out(i(c));t.out(` retained ${s.retained.length} pair(s)`);for(let c of s.retained)t.out(i(c));if(s.moves.length===0)t.out(" verifies none moved");else{t.out(" verifies moved:");for(let c of s.moves){let d=f=>f.length>0?f.map(o).join(" + "):"(none)";t.out(` - ${o(c.ac)}: ${d(c.before)} \u2192 ${d(c.after)}`)}}}async function j(t,e,n,r,s,o,i,c){let d=A(t),f=k(d,e.ucTip);if(!f)return o==="batch"?(r.out(`note: ${e.display} has no design output \u2014 nothing to evolve; run kane-cli design tests --use-case ${e.display} first`),c?.({type:"evolve_skipped",use_case:e.display,reason:"no-design"}),{code:0,outcome:"no-design"}):(E(r,`nothing to evolve \u2014 run kane-cli design tests --use-case ${e.display} first (no design output)`),{code:2,outcome:"no-design"});let u=R(d,e.ucTip),g=[`evolve ${e.display}`,` re-designs use-case ${e.display}`,` affects ${u.pairs.length} pair(s)`,...n.because?[` because ${n.because}`]:[]];if(n.yes)for(let S of g)r.out(S);else{for(let b of g)r.out(b);if(!await r.confirm(`proceed with the re-design of ${e.display}?`))return r.out(o==="batch"?`skipped ${e.display}`:"declined \u2014 nothing evolved"),{code:0,outcome:"declined"}}let h=e.named?de(e.named):void 0,m=V(t,d,e.ucTip,n.because,h),v=e.named?fe(d,e.named,e.display,n.because,e.ucTip):void 0,l=await M(i,{verb:"evolve",subject:e.display},()=>s(e.seamRef,{yes:!!n.yes,...n.mode?{mode:n.mode}:{},...n.because?{because:n.because}:{},...m!==void 0?{changeDelta:m.change_delta,priorDesign:m.prior_design}:{},...c?{onChildEvent:c}:{},...v?{statement:v}:{}}),S=>({ok:S===0,exitCode:S}));if(l===3)return r.out(`design session for ${e.display} paused \u2014 resume with \`kane-cli design tests --resume\`, then re-run evolve for the diff`),{code:l,outcome:"paused"};if(l!==0)return E(r,`design run for ${e.display} ended with exit code ${l} \u2014 no diff to report`),{code:l,outcome:"failed"};let a=A(t),y=a.tipOf(e.ucTip),O=k(a,y)?.seq,C={before:f.seq,after:O??"?"},x=re(u,R(a,y));return ie(r,a,e.display,C,x),c?.(me(a,e.display,C,x)),{code:0,outcome:"evolved"}}function oe(t){let e=new Map,n=0;for(let{cid:s,state:o}of t.staleList()){if(o==="superseded")continue;let i=t.nodeLabel.get(s);if(!i||!q.has(i)||!w(t,s)||!I(t,s))continue;let c=_(t,s,i);!c||t.nodeLabel.get(c)!==p.USECASE||!w(t,c)||(n++,e.has(c)||e.set(c,J(t,c)))}return{targets:[...e.values()].sort((s,o)=>s.display<o.display?-1:s.display>o.display?1:0),staleCount:n}}function ae(t,e){for(let{cid:n,state:r}of t.staleList()){if(r==="superseded")continue;let s=t.nodeLabel.get(n);if(!(!s||!q.has(s)||!w(t,n))&&I(t,n)&&_(t,n,s)===e)return!0}return!1}async function Q(t,e,n,r={},s=process.cwd()){let o=e.mode==="agent";if(t&&e.fromStale)return E(n,"pass a <ref> OR --from-stale, not both"),2;if(!t&&!e.fromStale)return E(n,"evolve needs a <ref> or --from-stale"),2;if(!o&&(e.answer?.length??0)>0)return E(n,"--answer rides --mode agent: the blast-radius question is asked on the stream and answered on the next call. In a terminal, answer the prompt instead"),2;let i=F(s,n);if(!i)return 2;let c=r.runDesignForUc??we,d=r.emitEvent,f=r.onChild??(d?be(d):n.isTTY?$e(n):void 0);n.out(`evolving ${t??"stale use-cases"}: reading the graph\u2026`);let u=A(i),g,h=null,m;if(t){let l=se(u,t);if(!l.ok)return E(n,l.message),2;if(!e.because&&k(u,l.target.ucTip)&&!ae(u,l.target.ucTip))return E(n,`nothing changed underneath ${t} \u2014 its sources and requirements are current; use --because "<reason>" to re-design anyway`),2;let a=ce(u,t);g=[{...l.target,ref:t,...a?{named:a}:{}}]}else{let{targets:l,staleCount:a}=oe(u);if(l.length===0){if(o&&(e.answer?.length??0)>0){let y=ee(e.answer,[]);if("error"in y)return te(n,y.error)}return d?.({type:"evolve_batch",stale_nodes:a,use_cases:0}),n.out("nothing stale \u2014 nothing to evolve"),0}h=`from-stale: ${a} stale node(s) \u2192 ${l.length} use-case(s)`,m={stale_nodes:a,use_cases:l.length},g=l}if(!e.yes&&!n.isTTY&&!o)return E(n,"evolve needs a TTY \u2014 the blast-radius confirm is the point; headless, run with --mode agent (the question rides the stream and is answered with --answer on the next call) or let kane-cli maintain reconcile drive it"),2;if(h&&n.out(h),o)return Ee({ref:t,opts:e,io:n,dir:i,graph:u,targets:g,batch:m,runDesign:c,onChild:f,emit:d??(()=>{})});if(t){let l=await j(i,g[0],e,n,c,"single",f);return l.outcome==="evolved"&&e.because&&P(i,t,e.because),l.code}let v=[];for(let l of g){let a=await j(i,l,e,n,c,"batch",f);a.outcome==="evolved"&&e.because&&P(i,l.display,e.because),v.push(a.code)}return X(v)}function X(t){let e=t.find(n=>n!==0&&n!==3);return e!==void 0?e:t.includes(3)?3:0}function P(t,e,n){K(t,{ts:new Date().toISOString(),command:"evolve",id:e,verdict:"gap-resolved-evolve",polarity:"preference",by:{kind:"human",id:process.env.USER??"operator"},target:e,reason:n})}var z={[p.TEST]:"test",[p.SCENARIO]:"scenario",[p.AC]:"ac",[p.USECASE]:"usecase"},Z={test:"test",scenario:"scenario",ac:"acceptance criterion",usecase:"use-case"},W=120;function ce(t,e){let n=t.resolve(e);if(!n)return null;let r=z[t.nodeLabel.get(n.tip)??""];if(!r)return null;let s=t.getNode(n.tip)?.content??{},o=r==="ac"?s.text:s.title,i=typeof o=="string"?o.replace(/[\u0000-\u001f\u007f]+/g," ").trim():"",c=Array.from(i),d=c.length===0?void 0:c.length>W?`${c.slice(0,W-1).join("")}\u2026`:i,f=t.superseded.has(n.tip)?"removed":t.trust.get(n.tip)==="archived"?"archived":void 0;return{ref:t.nameOf.get(n.tip)??t.displayNameOf(n.tip)??e,label:r,...d?{title:d}:{},cid:n.tip,...f?{dead:f}:{}}}function de(t){if(!t.dead)return{ref:t.ref,label:t.label,...t.title?{title:t.title}:{}}}function ue(t,e,n){let r=[];for(let{cid:s,state:o}of t.staleList()){if(o==="superseded"||s===n)continue;let i=t.nodeLabel.get(s),c=z[i??""];if(!i||!c||!w(t,s)||!I(t,s)||_(t,s,i)!==e)continue;let d=N(t,s);if(!d)continue;let f=t.nameOf.get(s)??t.displayNameOf(s)??s;r.push({display:f,text:`${Z[c]} ${f} \u2014 ${d}`})}return r.sort((s,o)=>s.display<o.display?-1:s.display>o.display?1:0),r[0]?.text??null}var le=`Judge the scope yourself: change what this genuinely affects and leave the rest as designed.
|
|
3
3
|
If it is ambiguous what should change, ask before changing anything.`;function fe(t,e,n,r,s){let o=e.label==="usecase"?"":` in use-case ${n}`,i=[e.title?`"${e.title}"`:"",e.dead?`${e.dead} earlier`:""].filter(Boolean).join(", "),c=`[kane] evolve started on ${Z[e.label]} ${e.ref}${i?` (${i})`:""}${o}.`,d=r?.trim(),f=d||e.dead?void 0:N(t,e.cid),u=d?void 0:f??(s?ue(t,s,e.cid):null),g=d?`Because: ${d}`:u?`Stale: ${u}`:null;return[c,g,le].filter(h=>h!==null).join(`
|
|
4
|
-
`)}function D(t){return`evolve:${t.display}`}function ge(t,e,n){return{type:"evolve_target",...t.ref!==void 0?{ref:t.ref}:{},use_case:t.display,pairs:e,...n?{because:n}:{}}}function pe(t,e,n){return{id:D(t),header:"Re-design?",text:`Re-design use-case ${t.display}? ${e} scenario/test pair(s) are affected${n?` \u2014 because: ${n}`:""}.`,risk:"med",rationale:"evolve re-designs the whole parent use-case: what the change touches is superseded, the rest is re-emitted verbatim; the run spends design credits",options:[{label:"proceed",detail:`re-design use-case ${t.display} now (${e} pair(s) affected)`},{label:"decline",detail:"leave the current design as it is"}],recommended_index:0,allow_free_text:!1}}function me(t,e,n,r){let s=i=>t.nameOf.get(i)??i,o=i=>({scenario:s(i.scenario),test:i.test?s(i.test):null});return{type:"evolve_diff",use_case:e,generation:n,superseded:r.superseded.map(o),minted:r.minted.map(o),retained:r.retained.map(o),moves:r.moves.map(i=>({ac:s(i.ac),before:i.before.map(s),after:i.after.map(s)}))}}function ve(t){return`'${t.replace(/'/g,"'\\''")}'`}function he(t,e,n){return`kane-cli maintain evolve ${t??"--from-stale"}${e?` --because ${ve(e)}`:""} --mode agent`+[...n.entries()].map(([s,o])=>` --answer ${s}=${o==="proceed"?1:2}`).join("")}function ye(t){if(t.optionIndex===0)return"proceed";if(t.optionIndex===1)return"decline";if(t.optionIndex!==void 0)return null;let e=(t.freeText??"").trim().toLowerCase();return e==="proceed"||e==="yes"||e==="y"?"proceed":e==="decline"||e==="no"||e==="n"?"decline":null}function ee(t,e){let n=new Map;if(!t||t.length===0)return n;let r=B({answer:t});if(!r.ok)return{error:r.error};for(let s of r.value?.answers??[]){if(!e.includes(s.target))return{error:`${s.target} is not a question this run asks \u2014 addressable: ${e.length>0?e.join(", "):"(none)"}`};let o=ye(s);if(o===null)return{error:`'${s.optionIndex!==void 0?String(s.optionIndex+1):s.freeText??""}' is not a choice for ${s.target} \u2014 use 1 or proceed, 2 or decline`};n.set(s.target,o)}return n}function te(t,e){return t.err?t.err(`error: ${e}`,"ANSWER_USAGE"):t.out(`error: ${e}`),2}function be(t){return e=>{e.kind==="start"?t({type:"child_start",child:"design",subject:e.subject}):e.kind==="end"&&t({type:"child_end",ok:e.ok,dur_s:e.durS,...e.exitCode!==void 0?{exit_code:e.exitCode}:{}})}}async function Ee(t){let{ref:e,opts:n,io:r,dir:s,graph:o,targets:i,batch:c,runDesign:d,onChild:f,emit:u}=t,g=[],h=[];for(let a of i){if(!k(o,a.ucTip)){if(e)return E(r,`nothing to evolve \u2014 run kane-cli design tests --use-case ${a.display} first (no design output)`),2;h.push(a);continue}g.push({target:a,pairs:R(o,a.ucTip).pairs.length})}let m=ee(n.answer,g.map(a=>D(a.target)));if("error"in m)return te(r,m.error);c&&u({type:"evolve_batch",...c});for(let a of h)r.out(`note: ${a.display} has no design output \u2014 nothing to evolve; run kane-cli design tests --use-case ${a.display} first`),u({type:"evolve_skipped",use_case:a.display,reason:"no-design"});for(let a of g)u(ge(a.target,a.pairs,n.because));let v=g.filter(a=>!m.has(D(a.target)));if(v.length>0){let a=he(e,n.because,m),y=b=>a+v.map(ne=>` --answer ${D(ne.target)}=${b==="proceed"?1:2}`).join(""),O=v.length===1?`use-case ${v[0].target.display}`:`${v.length} use-cases`,C=[...m.values()].filter(b=>b==="proceed").length,x=C>0?`; the ${C} use-case(s) already answered proceed still re-design`:"",S=[{cmd:y("proceed"),why:`re-design ${O} now \u2014 supersedes what the change touches, spends design credits${x}`,title:C>0?"Proceed with the remaining re-design":"Proceed with the re-design"},{cmd:y("decline"),why:`leave ${O} as designed${x}`,title:C>0?"Decline the remaining question(s)":"Decline"}].filter(b=>Y(b.cmd));return u({type:"evolve_paused",pending_questions:v.map(b=>pe(b.target,b.pairs,n.because)),resume:a,next:S}),3}let l=[];for(let{target:a}of g){if(m.get(D(a))==="decline"){r.out(e?"declined \u2014 nothing evolved":`skipped ${a.display}`),u({type:"evolve_skipped",use_case:a.display,reason:"declined"});continue}let O=await j(s,a,{...n,yes:!0},r,d,e?"single":"batch",f,u);O.outcome==="evolved"&&n.because&&P(s,e??a.display,n.because),l.push(O.code)}return X(l)}function $e(t){let e="",n="evolve";return r=>{r.kind==="start"?(e=r.subject,n=r.verb,t.out(`\u25CF ${U(r.verb).ing} ${r.subject}`)):r.kind==="end"&&t.out(r.ok?`\u25CF ${U(n).ed} ${e} \u2014 ${r.durS}s`:`\u25CF ${n} failed \u2014 ${r.exitCode!=null?`exited ${r.exitCode}`:"error"}${r.fixCmd?` \xB7 ${r.fixCmd}`:""}`)}}var we=async(t,e)=>{let{designTestsCommand:n}=await import("./bind-
|
|
4
|
+
`)}function D(t){return`evolve:${t.display}`}function ge(t,e,n){return{type:"evolve_target",...t.ref!==void 0?{ref:t.ref}:{},use_case:t.display,pairs:e,...n?{because:n}:{}}}function pe(t,e,n){return{id:D(t),header:"Re-design?",text:`Re-design use-case ${t.display}? ${e} scenario/test pair(s) are affected${n?` \u2014 because: ${n}`:""}.`,risk:"med",rationale:"evolve re-designs the whole parent use-case: what the change touches is superseded, the rest is re-emitted verbatim; the run spends design credits",options:[{label:"proceed",detail:`re-design use-case ${t.display} now (${e} pair(s) affected)`},{label:"decline",detail:"leave the current design as it is"}],recommended_index:0,allow_free_text:!1}}function me(t,e,n,r){let s=i=>t.nameOf.get(i)??i,o=i=>({scenario:s(i.scenario),test:i.test?s(i.test):null});return{type:"evolve_diff",use_case:e,generation:n,superseded:r.superseded.map(o),minted:r.minted.map(o),retained:r.retained.map(o),moves:r.moves.map(i=>({ac:s(i.ac),before:i.before.map(s),after:i.after.map(s)}))}}function ve(t){return`'${t.replace(/'/g,"'\\''")}'`}function he(t,e,n){return`kane-cli maintain evolve ${t??"--from-stale"}${e?` --because ${ve(e)}`:""} --mode agent`+[...n.entries()].map(([s,o])=>` --answer ${s}=${o==="proceed"?1:2}`).join("")}function ye(t){if(t.optionIndex===0)return"proceed";if(t.optionIndex===1)return"decline";if(t.optionIndex!==void 0)return null;let e=(t.freeText??"").trim().toLowerCase();return e==="proceed"||e==="yes"||e==="y"?"proceed":e==="decline"||e==="no"||e==="n"?"decline":null}function ee(t,e){let n=new Map;if(!t||t.length===0)return n;let r=B({answer:t});if(!r.ok)return{error:r.error};for(let s of r.value?.answers??[]){if(!e.includes(s.target))return{error:`${s.target} is not a question this run asks \u2014 addressable: ${e.length>0?e.join(", "):"(none)"}`};let o=ye(s);if(o===null)return{error:`'${s.optionIndex!==void 0?String(s.optionIndex+1):s.freeText??""}' is not a choice for ${s.target} \u2014 use 1 or proceed, 2 or decline`};n.set(s.target,o)}return n}function te(t,e){return t.err?t.err(`error: ${e}`,"ANSWER_USAGE"):t.out(`error: ${e}`),2}function be(t){return e=>{e.kind==="start"?t({type:"child_start",child:"design",subject:e.subject}):e.kind==="end"&&t({type:"child_end",ok:e.ok,dur_s:e.durS,...e.exitCode!==void 0?{exit_code:e.exitCode}:{}})}}async function Ee(t){let{ref:e,opts:n,io:r,dir:s,graph:o,targets:i,batch:c,runDesign:d,onChild:f,emit:u}=t,g=[],h=[];for(let a of i){if(!k(o,a.ucTip)){if(e)return E(r,`nothing to evolve \u2014 run kane-cli design tests --use-case ${a.display} first (no design output)`),2;h.push(a);continue}g.push({target:a,pairs:R(o,a.ucTip).pairs.length})}let m=ee(n.answer,g.map(a=>D(a.target)));if("error"in m)return te(r,m.error);c&&u({type:"evolve_batch",...c});for(let a of h)r.out(`note: ${a.display} has no design output \u2014 nothing to evolve; run kane-cli design tests --use-case ${a.display} first`),u({type:"evolve_skipped",use_case:a.display,reason:"no-design"});for(let a of g)u(ge(a.target,a.pairs,n.because));let v=g.filter(a=>!m.has(D(a.target)));if(v.length>0){let a=he(e,n.because,m),y=b=>a+v.map(ne=>` --answer ${D(ne.target)}=${b==="proceed"?1:2}`).join(""),O=v.length===1?`use-case ${v[0].target.display}`:`${v.length} use-cases`,C=[...m.values()].filter(b=>b==="proceed").length,x=C>0?`; the ${C} use-case(s) already answered proceed still re-design`:"",S=[{cmd:y("proceed"),why:`re-design ${O} now \u2014 supersedes what the change touches, spends design credits${x}`,title:C>0?"Proceed with the remaining re-design":"Proceed with the re-design"},{cmd:y("decline"),why:`leave ${O} as designed${x}`,title:C>0?"Decline the remaining question(s)":"Decline"}].filter(b=>Y(b.cmd));return u({type:"evolve_paused",pending_questions:v.map(b=>pe(b.target,b.pairs,n.because)),resume:a,next:S}),3}let l=[];for(let{target:a}of g){if(m.get(D(a))==="decline"){r.out(e?"declined \u2014 nothing evolved":`skipped ${a.display}`),u({type:"evolve_skipped",use_case:a.display,reason:"declined"});continue}let O=await j(s,a,{...n,yes:!0},r,d,e?"single":"batch",f,u);O.outcome==="evolved"&&n.because&&P(s,e??a.display,n.because),l.push(O.code)}return X(l)}function $e(t){let e="",n="evolve";return r=>{r.kind==="start"?(e=r.subject,n=r.verb,t.out(`\u25CF ${U(r.verb).ing} ${r.subject}`)):r.kind==="end"&&t.out(r.ok?`\u25CF ${U(n).ed} ${e} \u2014 ${r.durS}s`:`\u25CF ${n} failed \u2014 ${r.exitCode!=null?`exited ${r.exitCode}`:"error"}${r.fixCmd?` \xB7 ${r.fixCmd}`:""}`)}}var we=async(t,e)=>{let{designTestsCommand:n}=await import("./bind-S3IQTPNN.js"),r=()=>n({useCase:t,force:!0,...e.mode?{mode:e.mode}:e.yes?{mode:"override"}:{},...e.because?{because:e.because}:{},...e.changeDelta!==void 0?{changeDelta:e.changeDelta}:{},...e.priorDesign!==void 0?{priorDesign:e.priorDesign}:{},...e.statement?{statement:e.statement}:{}});if(e.mode!=="agent")return r();let s=e.onChildEvent,o=process.stdout.write,i="";process.stdout.write=((c,d,f)=>{if(s){i+=typeof c=="string"?c:Buffer.isBuffer(c)?c.toString("utf8"):String(c);let g=i.indexOf(`
|
|
5
5
|
`);for(;g>=0;)H(i.slice(0,g),s),i=i.slice(g+1),g=i.indexOf(`
|
|
6
6
|
`)}let u=typeof d=="function"?d:f;return typeof u=="function"&&queueMicrotask(()=>u(null)),!0});try{return await r()}finally{process.stdout.write=o,s&&i.length>0&&H(i,s)}};function H(t,e){let n=t.trim();if(!n.startsWith("{"))return;let r;try{r=JSON.parse(n)}catch{return}if(!r||typeof r!="object"||typeof r.type!="string")return;let s=r;s.type!=="done"&&e(s)}async function Re(t,e,n={},r,s=process.cwd()){let{makeHeadlessIO:o,agentRefusal:i}=await import("./headless-io-75HUMWZB.js");if(e.mode!==void 0&&e.mode!=="interactive"&&e.mode!=="agent")return i(o("ndjson","evolve",r),`--mode must be interactive | agent, got '${e.mode}'`,"MODE_USAGE");if(e.mode==="agent"){let d=process.stdout.write.bind(process.stdout),f=process.stderr.write.bind(process.stderr),u=o("ndjson","evolve",r??{stdout:a=>{d(a)},stderr:a=>{f(a)}}),g=[],h=a=>{(a.type==="evolve_paused"||a.type==="session_paused")&&Array.isArray(a.next)&&g.push(...a.next),u.event(a)},m={out:u.out,err:(a,y)=>u.event({type:"error",message:a,...y?{code:y}:{}}),isTTY:!1,confirm:async()=>!1,ask:async()=>""},{runWithChannel:v}=await import("./run-channel-RGH4WIQX.js"),l=2;try{l=await v({event:a=>u.event(a)},()=>Q(t,e,m,{...n,emitEvent:h},s))}catch(a){l=1,u.event({type:"error",message:a instanceof Error?a.message:String(a)})}return u.done(l,void 0,g.length>0?g:void 0)}let c=r?{...L(),out:d=>r.stdout(`${d}
|
|
7
7
|
`),err:d=>r.stderr(`${d}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as O,d as S}from"./chunk-
|
|
2
|
+
import{b as O,d as S}from"./chunk-MBJHS653.js";import{c as L}from"./chunk-RFHMDQXZ.js";import{n as P,o as R}from"./chunk-RSSOJ3L2.js";import{y as s}from"./chunk-CXF6AZWY.js";import{a as y}from"./chunk-HCBYKLMW.js";import{a as E,b as o,i as h}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as d}from"./chunk-UR6MHSHU.js";var n=d(B(),1);import{basename as D}from"path";var r=d(y(),1),U="evidence-view-server";function Q({packPath:m,viewerBase:w,onDone:V,openUrl:k}){let[t,a]=(0,n.useState)("ask"),[g,b]=(0,n.useState)(null),[l,p]=(0,n.useState)(null),f=(0,n.useRef)(null),u=(0,n.useRef)(!1),x=async()=>{let e=f.current;f.current=null,e&&(R(U),await e.close())},v=()=>{u.current||(u.current=!0,V())};return h((e,i)=>{u.current||(t==="ask"?e==="y"||e==="Y"?a("starting"):(e==="n"||e==="N"||i.return||i.escape)&&v():t==="serving"&&(e==="q"||e==="Q"||i.escape)&&x().then(v))}),(0,n.useEffect)(()=>{if(t!=="starting")return;let e=!1;return(async()=>{try{let i=D(m),c=await O({packs:new Map([[i,m]]),allowedOrigins:[new URL(w).origin]});if(e){await c.close();return}f.current=c,P(U,()=>{c.close()});let T=S(c.urlFor(i),w);b(T);try{await(k??(q=>L(q)))(T)}catch{p("could not open browser \u2014 open the URL manually")}a("serving")}catch(i){p(`evidence view failed \u2014 ${i.message}`),a("failed")}})(),()=>{e=!0}},[t]),(0,n.useEffect)(()=>{if(t!=="failed")return;let e=setTimeout(v,0);return()=>clearTimeout(e)},[t]),(0,n.useEffect)(()=>()=>{x()},[]),t==="ask"?(0,r.jsxs)(o,{children:["View evidence in browser? ",(0,r.jsx)(o,{color:s.dim,children:"(y/N)"})]}):t==="serving"||t==="starting"?(0,r.jsxs)(E,{flexDirection:"column",children:[g?(0,r.jsxs)(o,{children:["viewer ",(0,r.jsx)(o,{color:s.orange,children:g})]}):(0,r.jsx)(o,{color:s.dim,children:"starting\u2026"}),l?(0,r.jsx)(o,{color:"yellow",children:l}):null,t==="serving"?(0,r.jsx)(o,{color:s.dim,children:"Press q when done"}):null]}):l?(0,r.jsx)(o,{color:"yellow",children:l}):null}export{Q as a};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as Y,b as Z,c as ee,d as ne,e as te}from"./chunk-
|
|
2
|
+
import{a as Y,b as Z,c as ee,d as ne,e as te}from"./chunk-MV3Q335C.js";import{b as ie,c as re}from"./chunk-YFQGOOF7.js";import{n as X,p as P}from"./chunk-RSSOJ3L2.js";import{a as Pe}from"./chunk-6YGTRKDT.js";import{e as Ce}from"./chunk-UR6MHSHU.js";function se(i){return{command:"start",...i}}function oe(i,n,s){return{command:"run",run_id:i,kind:n,...s}}function ae(i){return{command:"cancel",...i?{run_id:i}:{}}}function ue(i){return{command:"ask_user_response",answer:i}}function de(i={}){return{command:"shutdown",...i.testStatus?{test_status:i.testStatus,remark:i.remark??""}:{}}}var z=Symbol("run-queue-end"),G=class{items=[];waiting=null;ended=!1;error=null;push(n){if(this.waiting){let{resolve:s}=this.waiting;this.waiting=null,s(n)}else this.items.push(n)}end(){if(this.ended=!0,this.waiting){let{resolve:n}=this.waiting;this.waiting=null,n(z)}}fail(n){if(this.error=n,this.waiting){let{reject:s}=this.waiting;this.waiting=null,s(n)}}next(){return this.items.length>0?Promise.resolve(this.items.shift()):this.error?Promise.reject(this.error):this.ended?Promise.resolve(z):new Promise((n,s)=>{this.waiting={resolve:n,reject:s}})}},D=class{env;runner;log;sessionId;spawnFn;proc=null;activeRun=null;pendingReady=null;shuttingDown=!1;finalized=!1;exitInfo=null;exitedUnexpectedly=!1;exitResolve;exited;constructor(n){this.env=n.env,this.runner=n.runner,this.log=n.log,this.sessionId=n.sessionId,this.spawnFn=n.spawn??Z;let s;this.exited=new Promise(l=>{s=l}),this.exitResolve=s}async start(n){if(this.proc)throw new Error("PersistentRunner.start called twice");this.proc=this.spawnFn({env:this.env,runner:this.runner,log:this.log,sessionId:this.sessionId}),this.consume();let s=new Promise((l,g)=>{this.pendingReady={resolve:l,reject:g}});this.writeCommand(se(n)),await s}async*run(n,s,l){if(!this.proc)throw new Error("PersistentRunner.run called before start");if(this.finalized)throw new Error(`v16-runner is not running (exited code=${this.exitInfo?.code??"null"}, signal=${this.exitInfo?.signal??"none"}) \u2014 cannot start run '${n}'`);if(this.activeRun)throw new Error(`PersistentRunner.run overlap: '${this.activeRun.runId}' still in flight`);let g=new G,w={runId:n,queue:g};this.activeRun=w,this.writeCommand(oe(n,s,l));try{for(;;){let v=await g.next();if(v===z||(yield v,v.type==="run_end"&&(v.run_id===void 0||v.run_id===n)))break}}finally{this.activeRun===w&&(this.activeRun=null)}}sendUserResponse(n){this.writeCommand(ue(n))}cancel(n){this.writeCommand(ae(n))}kill(){this.proc?.child.kill("SIGTERM")}async shutdown(n={}){this.shuttingDown=!0,this.proc&&(this.writeCommand(de(n)),await this.exited)}get stderr(){return this.proc?.getStderr()??""}get diedUnexpectedly(){return this.exitedUnexpectedly}writeCommand(n){let s=JSON.stringify(n)+`
|
|
3
3
|
`;try{this.proc?.child.stdin?.write(s)}catch{}}async consume(){if(!this.proc)return;try{for await(let l of this.proc.events){if(l.type==="ready"){this.onReady();continue}if(l.type==="error"&&this.pendingReady){this.onStartError(l.message);continue}this.routeEvent(l)}}catch(l){this.log?.("error","PERSISTENT_RUNNER_STREAM_ERROR","Runner stdout stream errored",{error:l instanceof Error?l.message:String(l)})}let{code:n,signal:s}=await this.proc.exited;this.onExit(n,s)}onReady(){if(this.pendingReady){let{resolve:n}=this.pendingReady;this.pendingReady=null,n()}}onStartError(n){if(!this.pendingReady)return;let{reject:s}=this.pendingReady;this.pendingReady=null,s(new Error(`failed to start: ${n??"unknown error"}`))}routeEvent(n){let s=this.activeRun;if(!s){this.log?.("warn","PERSISTENT_RUNNER_ORPHAN_EVENT","Runner event with no active run",{event_type:n.type});return}s.queue.push(n)}onExit(n,s){if(!this.finalized){if(this.finalized=!0,this.exitInfo={code:n,signal:s},this.shuttingDown||(this.exitedUnexpectedly=!0),this.exitResolve({code:n,signal:s}),this.pendingReady){let{reject:l}=this.pendingReady;this.pendingReady=null,l(new Error(`v16-runner exited before ready (code=${n}, signal=${s??"none"})`))}if(this.activeRun){let{queue:l}=this.activeRun;if(this.activeRun=null,this.shuttingDown)l.end();else{let g=this.proc?.getStderr()?.slice(-500)??"";l.fail(new Error(`v16-runner exited unexpectedly mid-run (code=${n}, signal=${s??"none"})${g?`
|
|
4
4
|
${g}`:""}`))}}}}};var p=Ce(Pe(),1);function le(i){let n={cdp_endpoint:i.cdp_endpoint,ws_endpoint:i.ws_endpoint,width:i.width,height:i.height,headless:i.headless,model:i.model,max_steps:i.max_steps,network_ws:i.network_ws,network_sse:i.network_sse,session_id:i.session_id};return i.device&&(n.device=i.device),i.auth&&(n.auth=i.auth),i.project_id&&(n.project_id=i.project_id),i.disable_ask_user&&(n.disable_ask_user=!0),i.username&&(n.username=i.username),i.access_key&&(n.access_key=i.access_key),n}function j(i,n){let s=null,l=(g,w)=>{for(let v=0;v<g.length;v++){let _=g[v],h=[...w,v];n(_)&&(s===null||h.length>s.length)&&(s=h),_.children&&_.children.length>0&&l(_.children,h)}};return l(i,[]),s}function N(i,n,s){if(n.length===0)return[...i];let l=n[0],g=[...i],w=g[l];if(n.length===1)g[l]=s(w);else{let v=n.slice(1),_=N(w.children??[],v,s);g[l]={...w,children:_}}return g}function ce(){return{steps:[],maxOrdinal:0}}function je(i,n){if(n.type==="run_start"&&n.child_id)return n.environment?.resolution?{...i,resolution:n.environment.resolution}:i;if(n.type==="run_start"){let s=re(i.runnerEnvironment,ie(n.environment));if(s)return{...i,runnerEnvironment:s,...s.resolution?{resolution:s.resolution}:{}}}if(n.type==="step_end"&&typeof n.ordinal=="number"&&n.id){let s={id:n.id,ordinal:n.ordinal,status:n.status,...n.kind?{kind:n.kind}:{},...typeof n.duration=="number"?{duration_ms:Math.round(n.duration*1e3)}:{},...typeof n.action_id=="string"&&n.action_id?{action_id:n.action_id}:{}};return{...i,steps:[...i.steps,s],maxOrdinal:Math.max(i.maxOrdinal,n.ordinal)}}return i}function K(i){let n=i.indexOf(": ");return n>0&&n<15?i.slice(n+2):i}function V(i){return i.map(n=>{let s=n.children?V(n.children):n.children;return n.status==="running"?{...n,status:"stopped",phase:void 0,children:s}:s!==n.children?{...n,children:s}:n})}function ze(i,n,s,l,g){let[w,v]=(0,p.useState)(!1),[_,h]=(0,p.useState)([]),[pe,T]=(0,p.useState)(null),[he,B]=(0,p.useState)(null),[fe,k]=(0,p.useState)(null),[me,W]=(0,p.useState)(null),[ve,J]=(0,p.useState)([]),[ge,H]=(0,p.useState)(null),[Re,Se]=(0,p.useState)(void 0),[ye,$]=(0,p.useState)(0),y=(0,p.useRef)(null),E=(0,p.useRef)(null),S=(0,p.useRef)(null),b=(0,p.useRef)(0),F=(0,p.useRef)(!1),U=(0,p.useRef)(ce()),O=(0,p.useRef)(null),we=(0,p.useCallback)(async(m,x)=>{let Q=O.current;if(Q)try{await Q}catch{}h([]),T(null),B(null),k(null),W(null),J([]),H(null),Se(m.max_steps),v(!0),S.current=null,b.current=0,U.current=ce();let I=y.current;if(I&&E.current!==m.session_id){try{I.kill()}catch{}y.current=null,E.current=null,$(e=>e+1),I=null}if(!I){let e=Y();if(!e){k("v16-runner not found. Build the binary with `cd v16-runner && python build.py` or ensure Python is available."),v(!1);return}let d=ne({environment:x?.environment,mode:x?.mode,assertionMode:x?.assertionMode,finalValidation:x?.finalValidation,username:m.username,accessKey:m.access_key,sessionId:m.session_id});m.device?.platform&&await ee(d,m.device);let u=new D({env:d,runner:e,log:x?.log,sessionId:m.session_id});y.current=u,E.current=m.session_id,I=u,X("runner",()=>{try{u.kill()}catch{}});let o=le(m);try{await u.start(o)}catch(a){k(a instanceof Error?a.message:String(a)),v(!1),P("runner","Runner start failed"),y.current=null,E.current=null,$(t=>t+1);return}}let M={...m};delete M.run_id,te(M,{environment:x?.environment});let ke=`run-${m.run_index}`,Ie=m.mode==="replay"?"replay":"author",L=I,q=(async()=>{F.current=!1;for await(let e of L.run(ke,Ie,M)){if(F.current)break;switch(U.current=je(U.current,e),e.type){case"run_start":if(e.child_id)break;if(S.current&&!S.current.isSingleFlow){let d=b.current;b.current++,h(u=>u.map((o,a)=>a===d?{...o,status:"running"}:o.status==="running"&&!o.children?.some(t=>t.status==="running")?{...o,status:o.children?.some(t=>t.status==="failed")?"failed":"passed"}:o))}break;case"bifurcation":{let d=e.flows??[],u=e.count??d.length,o={flows:d,isSingleFlow:e.is_single_flow??u<=1};W(o),S.current=o,b.current=0,h(d.map((a,t)=>({index:t+1,objective:a??`Flow ${t+1}`,status:"pending"})));break}case"step_start":{n?.("STEP_START",`Step ${e.index} started`,{index:e.index,objective:e.objective,child_id:e.child_id});let d=e.index,u=e.objective??`Step ${d}`,o=e.child_id,a=S.current&&!S.current.isSingleFlow;if(o)h(t=>{let r=j(t,c=>c.branchChildId===o)??j(t,c=>c.status==="running");return r?N(t,r,c=>{let f=(c.children??[]).map(R=>R.status==="running"&&R.childId===o?{...R,status:"stopped",phase:void 0}:R);return f.push({index:d,objective:u,status:"running",childId:o}),{...c,children:f}}):t});else if(a){let t=Math.max(0,b.current-1);h(r=>{let c=[...r];if(t>=c.length)return r;let f={...c[t]},C=[...f.children??[]].map(A=>A.status==="running"&&A.childId===void 0?{...A,status:"stopped",phase:void 0}:A);return C.push({index:d,objective:u,status:"running"}),f.children=C,f.status="running",c[t]=f,c})}else h(t=>{let r=V(t);return r.some(f=>f.index===d)?r.map(f=>f.index===d?{...f,status:"running",objective:u}:f):[...r,{index:d,objective:u,status:"running"}]});break}case"step_event":{n?.("STEP_EVENT",`Step ${e.index} ${e.event}`,{index:e.index,phase:e.event,action_type:e.action_type,detail:e.detail,child_id:e.child_id});let d=e.child_id,u=S.current&&!S.current.isSingleFlow;if(e.event==="cm_init"&&e.checkpoint_count!=null){J(o=>[...o,e.checkpoint_count]);break}if(e.event==="replay_started"){H({recordingLength:e.recording_length??0});break}if(e.event==="reasoning"&&e.detail&&e.detail!=="reasoning"&&s?.(e.detail),d){let o=t=>{if(t.index!==e.index||t.childId!==d)return t;let r={phase:e.event};return e.event==="reasoning"&&e.detail&&e.detail!=="reasoning"&&(r.objective=e.detail),e.action_type&&(r.actionType=e.action_type),{...t,...r}},a=t=>t.map(r=>{let c=o(r);return c!==r?c:r.children&&r.children.length>0?{...r,children:a(r.children)}:r});h(t=>t.map(r=>r.children?{...r,children:a(r.children)}:r))}else if(u){let o=Math.max(0,b.current-1);h(a=>{let t=[...a];if(o>=t.length)return a;let r={...t[o]},c=[...r.children??[]];if(!c.some(R=>R.index===e.index&&R.childId===void 0))c.push({index:e.index,objective:`Step ${e.index}`,status:"running",phase:e.event,actionType:e.action_type});else for(let R=0;R<c.length;R++){if(c[R].index!==e.index||c[R].childId!==void 0)continue;let C={phase:e.event};e.event==="reasoning"&&e.detail&&e.detail!=="reasoning"&&(C.objective=e.detail),e.action_type&&(C.actionType=e.action_type),c[R]={...c[R],...C}}return r.children=c,t[o]=r,t})}else h(o=>o.some(t=>t.index===e.index)?o.map(t=>{if(t.index!==e.index)return t;let r={phase:e.event};return e.event==="reasoning"&&e.detail&&e.detail!=="reasoning"&&(r.objective=e.detail),e.action_type&&(r.actionType=e.action_type),{...t,...r}}):[...V(o),{index:e.index,objective:`Step ${e.index}`,status:"running",phase:e.event,actionType:e.action_type}]);break}case"step_end":{n?.("STEP_END",`Step ${e.index} ${e.status}`,{index:e.index,status:e.status,duration:e.duration,summary:e.summary,child_id:e.child_id}),l?.();let d=e.child_id,u=S.current&&!S.current.isSingleFlow;if(d){let o=t=>t.index===e.index&&t.childId===d?{...t,status:e.status,duration:e.duration,phase:void 0,objective:t.objective.startsWith("Step ")?K(e.summary||t.objective):t.objective}:t,a=t=>t.map(r=>{let c=o(r);return c!==r?c:r.children&&r.children.length>0?{...r,children:a(r.children)}:r});h(t=>t.map(r=>r.children?{...r,children:a(r.children)}:r))}else if(u){let o=Math.max(0,b.current-1);h(a=>{let t=[...a];if(o>=t.length)return a;let r={...t[o]},c=(r.children??[]).map(f=>f.index===e.index&&f.childId===void 0?{...f,status:e.status,duration:e.duration,phase:void 0,objective:f.objective.startsWith("Step ")?K(e.summary||f.objective):f.objective}:f);return r.children=c,t[o]=r,t})}else h(o=>o.map(a=>a.index===e.index?{...a,status:e.status,duration:e.duration,phase:void 0,objective:a.objective.startsWith("Step ")?K(e.summary||a.objective):a.objective}:a));{let a=S.current&&!S.current.isSingleFlow?Math.max(0,b.current-1):0,t=typeof e.ordinal=="number"&&e.id?{ordinal:e.ordinal,id:e.id}:void 0;i?.(e.index,a,e.child_id,t)}break}case"child_agent_start":{let d=e.objective??"",u=e.child_id;h(o=>{let a=j(o,t=>t.status==="running");return a?N(o,a,t=>({...t,objective:`${d} (branch)`,phase:`child: ${d.slice(0,50)}`,branchObjective:d,branchChildId:u})):o});break}case"child_agent_end":{let d=e.child_id,u=`child ${e.success?"done":"failed"}`;h(o=>{let a=j(o,t=>t.branchChildId===d);return a?N(o,a,t=>({...t,phase:u})):o.map(t=>t.phase?.startsWith("child:")?{...t,phase:u}:t)});break}case"describe_trigger":g?.(e);break;case"ask_user":T(e.question??"");break;case"run_end":h(d=>d.map(u=>u.status==="running"?{...u,status:e.status,phase:void 0}:u)),v(!1),B(e);break;case"error":v(!1),k(e.message??"Runner error"),h(d=>d.map(u=>u.status==="running"?{...u,status:"failed",phase:void 0}:u));break}}})().catch(e=>{if(y.current!==L)return;let u=[e instanceof Error?e.message:String(e)],o=L.stderr;o&&!u.join(`
|
|
5
5
|
`).includes(o)&&u.push(o),k(u.join(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as k}from"./chunk-RFHMDQXZ.js";import{a as b}from"./chunk-
|
|
2
|
+
import{c as k}from"./chunk-RFHMDQXZ.js";import{a as b}from"./chunk-RAARDC2O.js";import{a as C}from"./chunk-5ESGUPSR.js";import{q as m,r as u,s as f,t as x,u as y}from"./chunk-CXF6AZWY.js";import{createServer as S}from"http";import{randomBytes as A}from"crypto";import{URL as L}from"url";var P=class{profile;environment;creds;oauth;constructor(r="default",o="prod",e){this.profile=r,this.environment=o,this.creds=e??new C,this.oauth=new b(o)}async login(){let{server:r,port:o}=await this.startCallbackServer(),e=y(o);try{let t=this.creds.loadClient(this.profile,this.environment),i=t?.redirect_uris;(!t||!i?.includes(e))&&(t=await this.oauth.registerClient(e),this.creds.saveClient(this.profile,this.environment,t));let c=t.client_id,[h,d]=b.generatePkce(),a=A(32).toString("hex"),n=this.oauth.buildAuthorizationUrl(c,d,a,e),l=await this.waitForCallback(r,o,n,a);if(!l)throw new Error("Login cancelled or timed out");let p=await this.oauth.exchangeCode(l,c,h,e),g={access_token:p.access_token,refresh_token:p.refresh_token,expires_at:Math.floor(Date.now()/1e3)+p.expires_in,scope:p.scope??"*"};return this.creds.saveCredentials(this.profile,this.environment,g),this.creds.setActiveProfile(this.profile),g}catch(t){throw r.close(),t}}startCallbackServer(){return new Promise((r,o)=>{let e=u,t=()=>{let i=S();i.on("error",c=>{c.code==="EADDRINUSE"&&e<f?(e++,t()):o(new Error(`Failed to start callback server: ${c.message}. Ports ${u}-${f} are all in use.`))}),i.listen(e,m,()=>{r({server:i,port:e})})};t()})}waitForCallback(r,o,e,t){return new Promise(i=>{let c=!1,h=setTimeout(()=>d(null),12e4),d=a=>{c||(c=!0,clearTimeout(h),r.close(),i(a))};r.on("request",(a,n)=>{let l=new L(a.url??"/",`http://${m}:${o}`);if(l.pathname!==x){n.writeHead(404),n.end();return}let p=l.searchParams.get("state"),g=l.searchParams.get("code");if(l.searchParams.get("error")){n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Login failed",message:"We couldn't complete the sign-in. You can close this tab and try again from your terminal."})),d(null);return}if(p!==t){n.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Invalid state",message:"The sign-in response didn't match this session. Please return to your terminal and try again."})),d(null);return}n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"success",title:"You're signed in",message:"Head back to your terminal \u2014 KaneAI is ready when you are.",autoClose:!0})),d(g)}),k(e).catch(a=>{let n=a instanceof Error?a.message:String(a);process.stderr.write(`[auth] Could not open browser: ${n}
|
|
3
3
|
Please open this URL manually: ${e}
|
|
4
4
|
`)})})}};function v(s){let r=s.state==="success",o=r?"#22c55e":"#ef4444",e=r?"rgba(34, 197, 94, 0.12)":"rgba(239, 68, 68, 0.12)",t=r?'<svg viewBox="0 0 24 24" width="36" height="36" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7"/></svg>':'<svg viewBox="0 0 24 24" width="36" height="36" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>',i=s.autoClose?"<script>setTimeout(function(){try{window.close();}catch(e){}}, 1500);</script>":"";return`<!doctype html>
|
|
5
5
|
<html lang="en">
|
|
@@ -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-SB2SKN34.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,3 +1,3 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{d as X}from"./chunk-BB2W35TW.js";import{a as $}from"./chunk-YKTYVJBN.js";import{k as z,l as Y,m as H,z as T}from"./chunk-IICT4VOU.js";import{K as N,x as q}from"./chunk-RDHWNSDP.js";import{a as W,e as S,g as L}from"./chunk-FQNQVC5O.js";import{c as C}from"./chunk-UD7KKHPW.js";import{a as K,b as J}from"./chunk-
|
|
2
|
+
import{d as X}from"./chunk-BB2W35TW.js";import{a as $}from"./chunk-YKTYVJBN.js";import{k as z,l as Y,m as H,z as T}from"./chunk-IICT4VOU.js";import{K as N,x as q}from"./chunk-RDHWNSDP.js";import{a as W,e as S,g as L}from"./chunk-FQNQVC5O.js";import{c as C}from"./chunk-UD7KKHPW.js";import{a as K,b as J}from"./chunk-CXF6AZWY.js";var ce=3,de=1e4,Q=()=>new Promise(r=>setTimeout(r,25+Math.floor(Math.random()*50))),Z=r=>r==="design"||r==="maintain"?"session":r==="revert"||r==="shape-op"?"exclusive":"commit";function le(r,e,o){for(let s of r){for(let t of s.supersessions)if(t.kind==="node"&&(o.has(t.old)||t.new!==null&&o.has(t.new)))return!0;for(let t of s.nodes)if(t.label==="usecase"&&e.newBuCandidates.length>0||o.has(t.cid))return!0;if(s.design_generation&&e.generationTicket&&s.design_generation.uc_root===e.generationTicket.uc_root)return!0;for(let t of e.sourcePins)if(Object.prototype.hasOwnProperty.call(s.source_head_moves,t.source_id))return!0}return!1}async function De(r,e,o){let{contextDir:s,locks:t,probe:a}=r,m=r.sid??r.rootSid,f=e.newBuCandidates.map(b=>({tempRef:b.tempRef,probeText:b.probeText})),k=0,g=!0,p={hits:[],degraded:!1,probeBasis:null};for(;;){g&&(f.length>0&&(p=await a.batchSimilar(T(s),f)),g=!1);let b=T(s),_={seq:b.lastSeq,hash:b.latestHash},P=new Map,w=[],v=[],R=new Set;for(let d of e.ucTargets){let c=H(b,d.ref);if(c===null)return{ok:!1,kind:"validation",errors:[{code:"UNKNOWN_REF",detail:`${d.ref}: names no living node (unknown or tombstoned chain)`}]};d.expectedTip!==void 0&&d.expectedTip!==c.cid&&P.set(d.expectedTip,c.cid),R.add(c.cid),v.push(L(b,d.ref).key)}(e.verb==="revert"||e.verb==="shape-op")&&(v.length=0,v.push({kind:"context",mode:"exclusive"}));let y;try{y=t.acquire(S(v),{hold:Z(e.verb),verb:e.verb})}catch(d){if(d instanceof W&&(d.code==="UC_HELD"||d.code==="CONTEXT_HELD"))return{ok:!1,kind:"contended",err:d};throw d}let V=!1,M=!1;try{let d=await t.withKeySerialized(v,async()=>{let c=T(s),O=_.hash===c.latestHash?[]:N(s,_.seq,_.hash).records;for(let n of e.ucTargets){let i=H(c,n.ref);if(i===null){w.push({kind:"supersession",ref:n.ref,detail:`${n.ref} was retired while this commit staged \u2014 re-ground or abandon`});continue}for(let l of R)c.superseded.has(l)&&c.tipOf(l)===i.cid&&P.set(l,i.cid)}for(let n of e.sourcePins){let i=c.heads.get(n.source_id);i!=null&&i!==n.source_cid&&w.push({kind:"pin",ref:n.source_id,detail:`source '${n.source_id}' moved (pinned ${n.source_cid.slice(0,19)}, head ${i.slice(0,19)}) \u2014 re-ground or abandon`})}if(w.length>0)return{ok:!1,kind:"drifted",asks:w};if(e.generationTicket){let n=X(c,e.generationTicket);if(n!==null)return{ok:!1,kind:"validation",errors:[n]}}if(f.length>0&&O.length>0){let n=new Set(p.hits.map(u=>u.candidateCid)),i=a.recheckLocal(c,f,p.probeBasis,O);if(i.hits.some(u=>!n.has(u.candidateCid))||i.uncachedNewNodes.length>0)return M=!0,"restart"}if(e.verb!=="revert"&&e.verb!=="shape-op"){let n=S(e.ucTargets.map(u=>L(c,u.ref).key)),i=S(v);if(!(n.length===i.length&&n.every((u,h)=>JSON.stringify(u)===JSON.stringify(i[h]))))return"restart"}if(e.eventIds&&e.eventIds.length>0&&e.eventIds.every(n=>c.appliedEvents.has(n)))return{ok:!0,skipped:"already-applied"};let ae=Date.now()+de,j=c.latestHash,E=c;for(;;){let n={graph:E,expectPrev:j,redirects:P,probeHits:p.hits,degradedProbe:p.degraded,sid:m,eventIds:(l,u)=>{if(e.eventIds&&e.eventIds.length>0)return e.eventIds.slice(0,u);let h=Y(E,r.rootSid,l,u),U=r.reservedEventIds??[];if(U.length===0)return h;let D=`${r.rootSid}:${l}:`,A=0;for(let F of U){if(!F.startsWith(D))continue;let x=F.slice(D.length);/^\d+$/.test(x)&&(A=Math.max(A,Number.parseInt(x,10)))}if(A===0)return h;let G=Number.parseInt(h[0].slice(D.length),10);return!Number.isInteger(G)||G>A?h:Array.from({length:u},(F,x)=>z(r.rootSid,l,A+1+x))},assertLocks:()=>y.assertHeld()};if(r.revalidate){let l=r.revalidate(n);if(l.length>0)return{ok:!1,kind:"validation",errors:l}}y.assertHeld();let i;try{i=o(n)}catch(l){if(l instanceof q){let u=T(s),h=N(s,E.lastSeq,E.latestHash).records;if(!le(h,e,R)&&Date.now()<ae){await Q(),E=u,j=u.latestHash;continue}return"restart"}throw l}return"errors"in i?{ok:!1,kind:"validation",errors:i.errors}:(Z(e.verb)==="session"&&y.touch(),{ok:!0,result:i.result,record:i.record})}});if(d==="restart")V=!0;else return d}finally{y.release()}if(V){if(k+=1,k>=ce)return{ok:!1,kind:"unsettled",attempts:k};M&&(g=!0),await Q();continue}}}import{readFileSync as ue,writeFileSync as fe,renameSync as me,mkdirSync as pe}from"fs";import{dirname as he,join as ge}from"path";var B=1,be=720*60*1e3;function I(r){return ge(J,"embeddings",`alias-${r}.json`)}function ee(r,e=Date.now()){return r!==null&&e-r.fetchedAt<be}function re(r){try{let e=JSON.parse(ue(r,"utf-8"));return e.wrapperVersion!==B||typeof e.purposes!="object"||e.purposes===null?null:{wrapperVersion:B,writtenByVersion:String(e.writtenByVersion??""),purposes:e.purposes}}catch{return null}}function te(r,e,o=I(r)){let t=re(o)?.purposes?.[e];return!t||typeof t.alias!="string"||typeof t.dims!="number"||typeof t.fetchedAt!="number"?null:{alias:t.alias,dims:t.dims,fetchedAt:t.fetchedAt}}function se(r,e,o,s=I(r)){try{pe(he(s),{recursive:!0});let a=re(s)?.purposes??{};a[e]={alias:o.alias,dims:o.dims,fetchedAt:Date.now()};let m={wrapperVersion:B,writtenByVersion:K,purposes:a},f=`${s}.tmp`;fe(f,JSON.stringify(m,null,2)+`
|
|
3
3
|
`),me(f,s)}catch(t){C(`[embed] Failed to save alias cache: ${t instanceof Error?t.message:String(t)}`,"EMBED_CACHE_WRITE_FAILED")}}function ve(r){return r.TESTMUAI_ENV==="stage"?"stage":"prod"}function oe(r){let e=r.env??process.env,o=r.auth?.TESTMUAI_BASIC_AUTH||e.TESTMUAI_BASIC_AUTH;if(o)return{authorization:`Basic ${o}`};let s=r.auth?.TESTMUAI_API_KEY||e.TESTMUAI_API_KEY;return s?{authorization:`Bearer ${s}`}:{}}async function Oe(r,e={}){let o=e.env??process.env,s=ve(o),t=e.aliasCacheFile??I(s),a=e.now??Date.now,m=te(s,r,t);if(ee(m,a()))return{alias:m.alias,dims:m.dims};let k=`${$(o)}/assurance/embed/alias?purpose=${encodeURIComponent(r)}`,g=await(e.fetchImpl??fetch)(k,{method:"GET",headers:oe(e)});if(!g.ok)throw new Error(`embed alias resolve failed: ${g.status}`);let p=await g.json();return se(s,r,{alias:p.alias,dims:p.dims},t),{alias:p.alias,dims:p.dims}}async function je(r,e,o={}){let s=o.env??process.env,t=$(s),a=await(o.fetchImpl??fetch)(`${t}/assurance/embed`,{method:"POST",headers:{...oe(o),"content-type":"application/json"},body:JSON.stringify({purpose:r,input:e})});if(!a.ok)throw new Error(`embed failed: ${a.status}`);return await a.json()}import{readFileSync as ke,writeFileSync as ye,renameSync as Ee,mkdirSync as Ae}from"fs";import{dirname as Te,join as ne}from"path";function we(r){return ne(r,"embeddings")}function xe(r){let e=r.indexOf(":");return e>=0?r.slice(e+1):r}function ie(r,e,o){let s=xe(o);return ne(we(r),e,s.slice(0,2),`${s.slice(2)}.f32`)}function We(r,e,o){try{let s=ke(ie(r,e,o)),t=new Float32Array(Math.floor(s.length/4));for(let a=0;a<t.length;a++)t[a]=s.readFloatLE(a*4);return t}catch{return null}}function qe(r,e,o,s){try{let t=ie(r,e,o);Ae(Te(t),{recursive:!0});let a=Buffer.alloc(s.length*4);for(let f=0;f<s.length;f++)a.writeFloatLE(s[f],f*4);let m=`${t}.tmp`;ye(m,a),Ee(m,t)}catch(t){C(`[embed] Failed to cache vector: ${t instanceof Error?t.message:String(t)}`,"EMBED_CACHE_WRITE_FAILED")}}export{De as a,Oe as b,je as c,We as d,qe as e};
|
|
@@ -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-MWIE6LOZ.js";import{a as Ye}from"./chunk-TONFENRW.js";import{a as We}from"./chunk-YCCUBQY4.js";import{a as qe}from"./chunk-VE3SUJMA.js";import{a as be}from"./chunk-CSVPZ33X.js";import{a as Ge}from"./chunk-RAARDC2O.js";import{a as He}from"./chunk-DUYRCVI5.js";import{b as Le,y as u}from"./chunk-CXF6AZWY.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{y as n}from"./chunk-
|
|
2
|
+
import{y as n}from"./chunk-CXF6AZWY.js";import{a as s}from"./chunk-HCBYKLMW.js";import{a,b as i}from"./chunk-C44QQJR4.js";import{e as r}from"./chunk-UR6MHSHU.js";var o=r(s(),1);function g({bindings:c,suppressEscBack:p=!1,escBackLabel:m="back to chat"}){let e=c.map(t=>`${t.keys} ${t.label}`);return p||e.push(`esc \xB7 ${m}`),(0,o.jsx)(a,{marginTop:1,children:(0,o.jsx)(i,{color:n.dim,children:e.join(" \xB7 ")})})}export{g as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{homedir as s}from"os";import{join as t}from"path";var g="0.8.
|
|
2
|
+
import{homedir as s}from"os";import{join as t}from"path";var g="0.8.23";var a=t(s(),".testmuai","kaneai"),b=t(a,"profiles"),h=t(a,"tui-config.json"),_=t(a,"media"),A="https://registry.npmjs.org/@testmuai/kane-cli",x="https://api.github.com/repos/LambdaTest/kane-cli/releases",i="@testmuai/kane-cli-skill",L=`https://registry.npmjs.org/${i}`,r="kane-cli",u=[{dir:t(s(),".claude","skills",r),agent:"Claude Code"},{dir:t(s(),".agents","skills",r),agent:"Codex CLI"},{dir:t(s(),".gemini","skills",r),agent:"Gemini CLI"}],U="https://dd-proxy.lambdatest.com/intake/kane-cli",R="https://kaneai-playground.lambdatest.io",I=9222,E=9230,C=t(a,"chrome-profiles"),o=t(a,"hints"),T=t(o,"state.json");function f(e){return t(o,`catalog-${e}.json`)}var c=t(a,"mobile");function S(e,n="android"){return t(c,n==="ios"?`device-catalog-ios-${e}.json`:`device-catalog-${e}.json`)}var l="127.0.0.1",B=18392,v=18400,p="/callback";function N(e){return`http://${l}:${e}${p}`}var O="KANE CLI",P="*",k={prod:{authBaseUrl:"https://auth.lambdatest.com",consentUrl:"https://accounts.lambdatest.com",controllerBaseUrl:"https://kaneai-api.lambdatest.com/v16-controller/v1",tmsBaseUrl:"https://test-manager-api.lambdatest.com/api",testGeneratorBaseUrl:"https://test-manager-api.lambdatest.com",secretsBaseUrl:"https://api-hyperexecute.lambdatest.com",testManagerUiUrl:"https://test-manager.lambdatest.com",shareApiBaseUrl:"https://api.lambdatest.com",v16ServerHost:"https://kaneai-api.lambdatest.com/v16-server",evidenceViewerUrl:"https://evidence.lambdatest.com",mediaArtefactsHost:"prod-mobile-artefacts.lambdatest.com",mobileAppBaseUrl:"https://api.lambdatest.com"},stage:{authBaseUrl:"https://stage-auth.lambdatestinternal.com",consentUrl:"https://stage-accounts.lambdatestinternal.com",controllerBaseUrl:"https://auteur-stage-automind.lambdatestinternal.com/v16-controller/v1",tmsBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com/api",testGeneratorBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com",secretsBaseUrl:"https://api-stage-hyperexecute.lambdatestinternal.com",testManagerUiUrl:"https://stage-test-manager.lambdatestinternal.com",shareApiBaseUrl:"https://stage-api.lambdatestinternal.com",v16ServerHost:"https://auteur-stage-automind.lambdatestinternal.com/v16-server",evidenceViewerUrl:"https://stage-evidence.lambdatestinternal.com",mediaArtefactsHost:"stage-mobile-artefacts.lambdatestinternal.com",mobileAppBaseUrl:"https://stage-api.lambdatestinternal.com"}},D={orange:"#ff9500",generateAccent:"#0d9488",assuranceAccent:"#b388ff",purple:"#b388ff",secondary:"#888888",dim:"#666666",muted:"#444444",green:"#4ade80",red:"#ef4444",amber:"#fbbf24"};export{g as a,a as b,h as c,_ as d,A as e,x as f,i as g,u as h,U as i,R as j,I as k,E as l,C as m,T as n,f as o,S as p,l as q,B as r,v as s,p as t,N as u,O as v,P as w,k as x,D as y};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as m,d as p,e as g}from"./chunk-
|
|
2
|
+
import{c as m,d as p,e as g}from"./chunk-OFRYEWZE.js";import{b as d}from"./chunk-CXF6AZWY.js";import{mkdirSync as h,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",deviceName:"Galaxy A53 5G",osVersion:"15",queueTimeout:300,appiumPort:4739,androidHome:"$HOME/android-sdk-shim",globalTimeout:90,testSuiteTimeout:90,testSuiteStep:45,ios:{deviceName:"iPhone 15",osVersion:"17.5",runson:{}}}},v=`version: "0.1"
|
|
3
3
|
runson: {{runson}}
|
|
4
4
|
autosplit: true
|
|
5
5
|
concurrency: {{concurrency}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as b}from"./chunk-
|
|
2
|
+
import{a as b}from"./chunk-CSVPZ33X.js";import{m as d,y as o}from"./chunk-CXF6AZWY.js";import{a as L}from"./chunk-HCBYKLMW.js";import{a as u,b as c,i as A}from"./chunk-C44QQJR4.js";import{a as D}from"./chunk-6YGTRKDT.js";import{e as h}from"./chunk-UR6MHSHU.js";var x=h(D(),1);import{readdirSync as N,mkdirSync as B,statSync as k}from"fs";import{join as P}from"path";var r=h(L(),1);function O(n){try{return N(n).filter(l=>{try{return k(P(n,l)).isDirectory()}catch{return!1}})}catch{return[]}}function E(n,l,f,v){return{name:n,path:l,label:n,isActive:v}}function H({currentPath:n,onSelect:l,onCancel:f}){let s=O(d).map(i=>{let e=P(d,i);return E(i,e,n,e===n)}),p=!n,R=s.length+2,[a,C]=(0,x.useState)(()=>{if(p)return 0;let i=s.findIndex(e=>e.isActive);return i>=0?i+1:0}),[T,I]=(0,x.useState)(!1),[S,g]=(0,x.useState)("");return A((i,e)=>{if(T){if(e.escape){I(!1),g("");return}if(e.return){let t=S.trim();if(t){let m=P(d,t);B(m,{recursive:!0}),l(m),f()}return}if(e.backspace||e.delete){g(t=>t.slice(0,-1));return}i&&!e.ctrl&&!e.meta&&g(t=>t+i);return}if(e.escape){f();return}if(e.upArrow){C(t=>Math.max(0,t-1));return}if(e.downArrow){C(t=>Math.min(R-1,t+1));return}if(e.return){if(a===0){p||l(""),f();return}if(a===s.length+1){B(d,{recursive:!0}),I(!0),g("");return}let t=s[a-1];t&&!t.isActive&&l(t.path),f();return}}),T?(0,r.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(c,{color:o.orange,bold:!0,children:"Chrome Profile \u203A New"}),(0,r.jsxs)(u,{marginTop:1,children:[(0,r.jsx)(c,{color:o.secondary,children:"Name: "}),(0,r.jsx)(c,{children:S}),(0,r.jsx)(c,{color:o.dim,children:"\u2588"})]}),(0,r.jsx)(b,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:"back"})]}):(0,r.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(c,{color:o.orange,bold:!0,children:"Chrome Profile"}),(0,r.jsxs)(u,{flexDirection:"column",marginTop:1,children:[(0,r.jsxs)(c,{color:p?o.green:a===0?o.orange:o.dim,children:[a===0?"\u276F ":" ","Use temporary (no profile)",p?" \u25CF active":""]}),s.map((i,e)=>{let m=e+1===a,w=m?"\u276F ":" ",y=i.isActive?o.green:m?o.orange:void 0;return(0,r.jsxs)(c,{color:y,children:[w,i.label,i.isActive?" \u25CF active":""]},i.name)}),(0,r.jsxs)(c,{color:a===s.length+1?o.orange:o.dim,children:[a===s.length+1?"\u276F ":" ","+ Create new"]})]}),(0,r.jsx)(b,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"select"}],escBackLabel:"back"})]})}export{O as a,E as b,H as c};
|