@testmuai/kane-cli 0.6.8 → 0.6.9
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-QLRMFZJG.js → ChatSurface-B2QJYKV4.js} +1 -1
- package/dist/{ChromeProfilePicker-FJOUNY2B.js → ChromeProfilePicker-FSZB4SZR.js} +1 -1
- package/dist/{CliFeedbackPrompt-HC4NNBTK.js → CliFeedbackPrompt-WNMDCIHZ.js} +1 -1
- package/dist/{CliUploadProgress-VIEZQNZ5.js → CliUploadProgress-H4265KXU.js} +1 -1
- package/dist/{ConfigView-LK5F4F7W.js → ConfigView-XCUZ44SP.js} +1 -1
- package/dist/{EvidenceViewOffer-HZ4WZKGM.js → EvidenceViewOffer-5TJCRM2T.js} +1 -1
- package/dist/{FolderPicker-3S57MSC6.js → FolderPicker-S2XVCPYN.js} +1 -1
- package/dist/{HelpView-BQ3TS7WE.js → HelpView-OPKRGNNM.js} +1 -1
- package/dist/{InfoBox-4HVXV3TD.js → InfoBox-TW2PGJK5.js} +1 -1
- package/dist/{LinksBox-3B2KO5S4.js → LinksBox-66M7XP5Y.js} +1 -1
- package/dist/{ProfilesView-FLRMROUR.js → ProfilesView-T2CFQPR5.js} +1 -1
- package/dist/{ProjectPicker-R3KLRGHH.js → ProjectPicker-7ALN52CY.js} +1 -1
- package/dist/{SaveSessionPrompt-P7HSG7R7.js → SaveSessionPrompt-HM3F6QML.js} +1 -1
- package/dist/SingleShotApp-YQYS6HTB.js +2 -0
- package/dist/{SummaryBox-HCDIWKPS.js → SummaryBox-BQZEGOIV.js} +1 -1
- package/dist/TestMdRunView-7CL3PM3J.js +2 -0
- package/dist/{WhoamiView-ZD6FIBMK.js → WhoamiView-722MBPSG.js} +1 -1
- package/dist/{bind-RSVQXQJT.js → bind-HNI5LCNK.js} +2 -2
- package/dist/{bridge-D2HETW5M.js → bridge-V4FF5QPK.js} +1 -1
- package/dist/{changelog-QB7S4VV4.js → changelog-KMYZW5MI.js} +1 -1
- package/dist/{chunk-35RV2AAV.js → chunk-2Z5MSC23.js} +1 -1
- package/dist/{chunk-ELN3EN4K.js → chunk-345PY4SZ.js} +1 -1
- package/dist/{chunk-GO4CBUB6.js → chunk-3YI4QRXF.js} +1 -1
- package/dist/{chunk-K7P6VNLI.js → chunk-4BAL4OGF.js} +1 -1
- package/dist/{chunk-BSFONZ2E.js → chunk-4CKZAGBD.js} +1 -1
- package/dist/{chunk-3BIEIXJK.js → chunk-4FH2KFRT.js} +1 -1
- package/dist/{chunk-YKZIACYJ.js → chunk-7BCZLDNX.js} +1 -1
- package/dist/{chunk-ATO6NM45.js → chunk-AU7WQ2O5.js} +2 -2
- package/dist/{chunk-D5IZ77YG.js → chunk-CLYG26XV.js} +2 -2
- package/dist/{chunk-F4FXE466.js → chunk-DKERZJYF.js} +1 -1
- package/dist/{chunk-BUVRZXO3.js → chunk-DPOES6G3.js} +1 -1
- package/dist/{chunk-Q3WHZ26R.js → chunk-EASTDHNW.js} +1 -1
- package/dist/{chunk-D4WLVWJQ.js → chunk-EWLLPUP4.js} +1 -1
- package/dist/{chunk-N5YIMTGV.js → chunk-F42YVALT.js} +1 -1
- package/dist/{chunk-B22NUHB2.js → chunk-FFHBQK5N.js} +2 -2
- package/dist/{chunk-VRVSOGXH.js → chunk-FT4G3QGO.js} +1 -1
- package/dist/{chunk-NKCXCCPM.js → chunk-FVM7TWKT.js} +1 -1
- package/dist/{chunk-A6TFZQV6.js → chunk-G6F2BOFT.js} +1 -1
- package/dist/{chunk-AXJIXRYF.js → chunk-GBYH35H5.js} +1 -1
- package/dist/{chunk-VZHXNQDO.js → chunk-GNNMHYWE.js} +1 -1
- package/dist/{chunk-TBXIOT6M.js → chunk-IWBPV3VS.js} +1 -1
- package/dist/{chunk-66LXV7NN.js → chunk-JHAGEBKE.js} +1 -1
- package/dist/{chunk-TRXNJZSL.js → chunk-LMMOR7CR.js} +1 -1
- package/dist/{chunk-EQORZ6RT.js → chunk-LRA3V5GY.js} +1 -1
- package/dist/{chunk-5VC7MBHR.js → chunk-MXLXKHW4.js} +1 -1
- package/dist/{chunk-HCWEZCKP.js → chunk-NIKA2V6B.js} +1 -1
- package/dist/{chunk-EYZWG32F.js → chunk-O4HWPV67.js} +2 -2
- package/dist/{chunk-JKHQBGFY.js → chunk-OAEZKYYQ.js} +2 -2
- package/dist/{chunk-OYOTWI53.js → chunk-OV2W7KBC.js} +1 -1
- package/dist/{chunk-6WHKJSMJ.js → chunk-P4SE6YON.js} +1 -1
- package/dist/{chunk-PV4EDQY4.js → chunk-QB4IOM3X.js} +1 -1
- package/dist/{chunk-BLHCGRSK.js → chunk-QM3XF5TW.js} +1 -1
- package/dist/{chunk-MEHEGW3V.js → chunk-QTHITA73.js} +1 -1
- package/dist/{chunk-K4ERF7GT.js → chunk-QZJID3OZ.js} +1 -1
- package/dist/{chunk-GFKIE3AL.js → chunk-QZNUTCSD.js} +1 -1
- package/dist/{chunk-IQFUBT6Z.js → chunk-R65HNFRB.js} +1 -1
- package/dist/{chunk-YEMR62WY.js → chunk-RLICAFFQ.js} +1 -1
- package/dist/{chunk-NVGTSXCJ.js → chunk-RQM3DUSB.js} +1 -1
- package/dist/{chunk-K4LCN5X4.js → chunk-SORKKW7B.js} +1 -1
- package/dist/{chunk-YTK3IQUB.js → chunk-T2ULEJK7.js} +1 -1
- package/dist/{chunk-QOGQBVTP.js → chunk-T4WZWKIU.js} +1 -1
- package/dist/{chunk-FCZ2YFD3.js → chunk-TACPTX64.js} +2 -2
- package/dist/{chunk-NKUA3TSO.js → chunk-U5QTE3WX.js} +1 -1
- package/dist/{chunk-TAUSKB3O.js → chunk-U6TLLYRG.js} +1 -1
- package/dist/{chunk-PXPXK4Q7.js → chunk-VCYVSKPM.js} +1 -1
- package/dist/{chunk-XSAZDIQV.js → chunk-VXLOEM2U.js} +1 -1
- package/dist/{chunk-QZ7DZXLQ.js → chunk-XTO236AL.js} +2 -2
- package/dist/{chunk-27GF2OQ7.js → chunk-YY6WPFMT.js} +3 -3
- package/dist/{chunk-QFD6CB4P.js → chunk-ZA4GR5R7.js} +1 -1
- package/dist/{config-JV7HNJ3I.js → config-Z4OS3HEE.js} +1 -1
- package/dist/{credentials-TQW3TT2I.js → credentials-TNEVAUHI.js} +1 -1
- package/dist/{evidence-ZFYDHO73.js → evidence-MA3LDBWG.js} +1 -1
- package/dist/{evolve-cmd-YGJECGND.js → evolve-cmd-DTW4EOXM.js} +1 -1
- package/dist/{extract-bind-7UZXDON6.js → extract-bind-DZLG4GUE.js} +2 -2
- package/dist/{extract-cmd-TQ2MYXOG.js → extract-cmd-LFVMG6UE.js} +1 -1
- package/dist/{generate-headless-XXECVP6L.js → generate-headless-TYQRYQKJ.js} +2 -2
- package/dist/index.js +12 -12
- package/dist/{interactive-bind-WA2YVAUW.js → interactive-bind-QEBWUJCN.js} +2 -2
- package/dist/{list-commands-I577A5LK.js → list-commands-BU2MSYRH.js} +1 -1
- package/dist/login-flow-4L62GWLT.js +2 -0
- package/dist/{persist-recorded-session-DT3K6ZYQ.js → persist-recorded-session-RAL7UCQT.js} +1 -1
- package/dist/{pipeline-5N7HWGAL.js → pipeline-PLI5WQKX.js} +1 -1
- package/dist/{reconcile-cmd-HYYH3SZS.js → reconcile-cmd-UXY36ROJ.js} +1 -1
- package/dist/{recording-banner-QI77ERTZ.js → recording-banner-MBR3Q7VD.js} +1 -1
- package/dist/{require-project-folder-2UAXXZA4.js → require-project-folder-KE7XOOFN.js} +1 -1
- package/dist/{run-VMKZDO7J.js → run-5DQSL5KH.js} +1 -1
- package/dist/{run-RYIYWV63.js → run-B7BRNC3X.js} +1 -1
- package/dist/{run-test-md-DKRJOUFA.js → run-test-md-ZCAWNP35.js} +2 -2
- package/dist/{skill-installer-TK5REDD6.js → skill-installer-H5DPJJFW.js} +1 -1
- package/dist/{spawner-K7LWPNIC.js → spawner-C6B5J73J.js} +1 -1
- package/dist/tcg-generate-DIMZXAV3.js +2 -0
- package/dist/{testmd-actions-Q2XWL7P5.js → testmd-actions-X6XCV53D.js} +1 -1
- package/dist/token-refresh-7PAPCMQK.js +2 -0
- package/dist/{validate-basic-XEJGB4GN.js → validate-basic-VBPGGHES.js} +1 -1
- package/dist/{version-check-IT7T5YKJ.js → version-check-YPRCQJ7E.js} +1 -1
- package/dist/{walk-session-HCTG4LN2.js → walk-session-GWOP27TX.js} +1 -1
- package/package.json +6 -6
- package/dist/SingleShotApp-ZBZY7KGR.js +0 -2
- package/dist/TestMdRunView-GQP2QGFU.js +0 -2
- package/dist/login-flow-OVEZXSMW.js +0 -2
- package/dist/tcg-generate-6EJLU5KX.js +0 -2
- package/dist/token-refresh-NQZJEUQE.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as sn}from"./chunk-GLS46X7N.js";import{c as Tt,d as Qr}from"./chunk-
|
|
2
|
+
import{c as sn}from"./chunk-GLS46X7N.js";import{c as Tt,d as Qr}from"./chunk-TACPTX64.js";import{d as Wr}from"./chunk-2YQ6TW77.js";import{a as Lt,b as Zr,c as et,d as tt,e as Xr,f as Dt,g as rn,h as nn}from"./chunk-RHNKYNNZ.js";import{a as Te,b as ne,e as _e,f as xt,k as Yr,p as he,q as Pt,t as Jr}from"./chunk-RKWJG3WW.js";import{b as Se}from"./chunk-R65HNFRB.js";import{a as Ze,b as At}from"./chunk-U6TLLYRG.js";import{a as Or,b as Et}from"./chunk-4BAL4OGF.js";import{a as Le,b as en}from"./chunk-C5UNZ6ZY.js";import{c as tn}from"./chunk-S3DAAAE5.js";import{a as we}from"./chunk-WAOCHXJ5.js";import{B as jr,C as Fr,D as Nr,F as $r,G as Mr,I as Vr,J as Kr,K as Hr,X as qr,aa as Gr,ba as zr,j as Xe,x as Ur}from"./chunk-O4HWPV67.js";import{a as Br}from"./chunk-BC7UVJJB.js";import{a as xr,c as kt,d as Ct,e as Qe,f as Pr,g as Tr}from"./chunk-M5JQXOCE.js";import{g as Lr,h as Dr}from"./chunk-T2ULEJK7.js";import{a as Je}from"./chunk-2WVKOZ6W.js";import{a as We,b as Ar}from"./chunk-NLCCBXXV.js";import{a as M}from"./chunk-RZ4F3BHX.js";import{a as re}from"./chunk-QZJID3OZ.js";import{a as Cr}from"./chunk-E47GFYXA.js";import{a as ze,c as _t,j as Er,k as Ye,l as It,m as Rt}from"./chunk-VCYVSKPM.js";import{join as le,basename as as}from"path";import{existsSync as Ro,readFileSync as cs}from"fs";function on(e,t){if(process.env.KANE_REPLAY_TRACE==="1")for(let r=0;r<e.steps.length;r++){let n=e.steps[r],s=t[r],o=" ".repeat(n.trace.length-1),i=`step ${n.flatIndex}`;s.kind==="replay"?process.stderr.write(`[replay-trace] ${o}${i}: REPLAY (would skip; v1 always authors)
|
|
3
3
|
`):process.stderr.write(`[replay-trace] ${o}${i}: AUTHOR (${s.reason})
|
|
4
4
|
`)}}function Ie(e){process.env.KANE_REPLAY_TRACE==="1"&&process.stderr.write(e)}function an(e,t){let r=e===0?"(none)":`0..${e-1}`,n=e>=t?"(none)":`${e}..${t-1}`;Ie(`[replay-trace] phase: replay ${r}, author ${n}
|
|
5
5
|
`)}function ln(e,t){Ie(`[replay-trace] step ${e}: REPLAY ${t==="ok"?"OK":"FAILED"}
|
|
@@ -44,7 +44,7 @@ import{c as sn}from"./chunk-GLS46X7N.js";import{c as Tt,d as Qr}from"./chunk-FCZ
|
|
|
44
44
|
`);else if(_r&&(_||m.isFirstRun))process.stderr.write(`note: --no-evidence-publish has no effect on author/commit runs
|
|
45
45
|
`);else if(Ir){let d=c.basicAuth,u=L,p=F,b=await ss({controller:new we(A.controllerBaseUrl,{username:d.username,accessKey:d.access_key}),tms:new Je(A.tmsBaseUrl,c.resolvedCreds?.username??d.username,c.resolvedCreds?.access_key??d.access_key),testId:m.testId,sessionId:l.sessionId,executionId:u.executionId,sealedPackPath:Z.pack,projectId:p});b.ok?l.log("info","EVIDENCE_INGESTED","Replay evidence uploaded and ingested",{execution_id:u.executionId,project_id:p}):(l.log("warn","EVIDENCE_PUBLISH_FAILED","Replay evidence publish failed",{execution_id:u.executionId,stage:b.stage,error:b.error}),process.stderr.write(` \u26A0 evidence publish failed (${b.stage}): ${b.error}
|
|
46
46
|
`)),t.onAgentEvent({type:"test_md_evidence_ingest",status:b.ok?"ok":"failed",evidence_id:u.executionId,...b.ok?{}:{stage:b.stage}})}await Lo(n,m,l,z.outcomes,z.overallStatus,Ve,ge,oe.uploadResult,j,o,{resolvedAuth:c,tmsBaseUrl:A.tmsBaseUrl},_,J);try{let d=he(n);if(Qr({shouldUploadPipeline:He,uploadSucceeded:!!oe.uploadResult?.success,metaCommitId:d?.commit_id,metaTestId:d?.test_id})){let u=await Tt({sourcePath:n,testId:d.test_id,sessionId:l.sessionId,commitId:d.commit_id,controller:new we(A.controllerBaseUrl,{username:c.basicAuth.username,accessKey:c.basicAuth.access_key})});u.ok?l.log("info","BUNDLE_SYNC_OK","testmd bundle pushed",{commit_id:d.commit_id,bytes:u.bytes}):(l.log("warn","BUNDLE_SYNC_FAILED","testmd bundle sync failed",{commit_id:d.commit_id,stage:u.stage,error:u.error}),process.stderr.write(` \u26A0 bundle sync failed (${u.stage}): ${u.error}
|
|
47
|
-
`)),t.onAgentEvent({type:"test_md_bundle_sync",status:u.ok?"ok":"failed",commit_id:d.commit_id,path:n,...u.ok?{bytes:u.bytes}:{stage:u.stage}})}}catch(d){l.log("warn","BUNDLE_SYNC_FAILED","testmd bundle sync threw",{error:d instanceof Error?d.message:String(d)})}if(He&&oe.uploadResult?.success)for(let d of m.unitLocks)try{let u=he(d.file);if(u?.commit_id!==l.sessionId||!u?.test_id)continue;let p=await Tt({sourcePath:d.file,testId:String(u.test_id),sessionId:l.sessionId,commitId:String(u.commit_id),controller:new we(A.controllerBaseUrl,{username:c.basicAuth.username,accessKey:c.basicAuth.access_key})});p.ok?l.log("info","BUNDLE_SYNC_OK","unit bundle pushed",{commit_id:u.commit_id,path:d.file,bytes:p.bytes}):l.log("warn","BUNDLE_SYNC_FAILED","unit bundle sync failed",{commit_id:u.commit_id,path:d.file,stage:p.stage,error:p.error}),t.onAgentEvent({type:"test_md_bundle_sync",status:p.ok?"ok":"failed",commit_id:u.commit_id,path:d.file,...p.ok?{bytes:p.bytes}:{stage:p.stage}})}catch(u){l.log("warn","BUNDLE_SYNC_FAILED","unit bundle sync threw",{path:d.file,error:u instanceof Error?u.message:String(u)})}let Rr=re(w),qe=oe.uploadResult?.testcaseId,Ge=qe&&oe.uploadResult?.shareId&&F?ot(Rr.testManagerUiUrl,F,qe,oe.uploadResult.shareId):void 0,Ss=a.unitFiles.filter(d=>d.file!==a.rootPath).map(d=>{let u=a.steps.filter(g=>g.owningFile===d.file),p=u.filter(g=>ce.has(g.flatIndex)).length,h=(d.kind==="test"?he(d.file):null)?.commit_id===l.sessionId;return{path:d.file,kind:d.kind,replayed:u.length-p,authored:p,committed:h,...h?{commit_id:l.sessionId}:{}}}),kr={overallStatus:z.overallStatus,durationS:ge,decisions:m.decisions,outcomes:z.outcomes,cancelled:J,retryTriggered:X,lockHeld:_,anyAuthorStepRan:D,isFirstRun:m.isFirstRun,wantsPush:o.push===!0,uploadResult:oe.uploadResult,shouldUploadArtifacts:ve,shouldReplaceLocalOutput:D&&!J,shouldCommit:(_||m.isFirstRun)&&!J&&z.overallStatus==="passed"&&!m.degradedReadonly,shareUrl:Ge,imports:Ss},{buildSummaryEvent:ws}=await import("./SummaryBox-
|
|
47
|
+
`)),t.onAgentEvent({type:"test_md_bundle_sync",status:u.ok?"ok":"failed",commit_id:d.commit_id,path:n,...u.ok?{bytes:u.bytes}:{stage:u.stage}})}}catch(d){l.log("warn","BUNDLE_SYNC_FAILED","testmd bundle sync threw",{error:d instanceof Error?d.message:String(d)})}if(He&&oe.uploadResult?.success)for(let d of m.unitLocks)try{let u=he(d.file);if(u?.commit_id!==l.sessionId||!u?.test_id)continue;let p=await Tt({sourcePath:d.file,testId:String(u.test_id),sessionId:l.sessionId,commitId:String(u.commit_id),controller:new we(A.controllerBaseUrl,{username:c.basicAuth.username,accessKey:c.basicAuth.access_key})});p.ok?l.log("info","BUNDLE_SYNC_OK","unit bundle pushed",{commit_id:u.commit_id,path:d.file,bytes:p.bytes}):l.log("warn","BUNDLE_SYNC_FAILED","unit bundle sync failed",{commit_id:u.commit_id,path:d.file,stage:p.stage,error:p.error}),t.onAgentEvent({type:"test_md_bundle_sync",status:p.ok?"ok":"failed",commit_id:u.commit_id,path:d.file,...p.ok?{bytes:p.bytes}:{stage:p.stage}})}catch(u){l.log("warn","BUNDLE_SYNC_FAILED","unit bundle sync threw",{path:d.file,error:u instanceof Error?u.message:String(u)})}let Rr=re(w),qe=oe.uploadResult?.testcaseId,Ge=qe&&oe.uploadResult?.shareId&&F?ot(Rr.testManagerUiUrl,F,qe,oe.uploadResult.shareId):void 0,Ss=a.unitFiles.filter(d=>d.file!==a.rootPath).map(d=>{let u=a.steps.filter(g=>g.owningFile===d.file),p=u.filter(g=>ce.has(g.flatIndex)).length,h=(d.kind==="test"?he(d.file):null)?.commit_id===l.sessionId;return{path:d.file,kind:d.kind,replayed:u.length-p,authored:p,committed:h,...h?{commit_id:l.sessionId}:{}}}),kr={overallStatus:z.overallStatus,durationS:ge,decisions:m.decisions,outcomes:z.outcomes,cancelled:J,retryTriggered:X,lockHeld:_,anyAuthorStepRan:D,isFirstRun:m.isFirstRun,wantsPush:o.push===!0,uploadResult:oe.uploadResult,shouldUploadArtifacts:ve,shouldReplaceLocalOutput:D&&!J,shouldCommit:(_||m.isFirstRun)&&!J&&z.overallStatus==="passed"&&!m.degradedReadonly,shareUrl:Ge,imports:Ss},{buildSummaryEvent:ws}=await import("./SummaryBox-BQZEGOIV.js");if(i?t.onAgentEvent(ws(kr)):await t.onSummary(kr),!i){let d=qe&&F?Ln(Rr.testManagerUiUrl,F,qe):void 0;await t.onLinks({recordedTestPath:n,outputDir:ne(n),shareableLink:Ge,testCaseLink:d,codeExportDir:oe.uploadResult?.codeExportDir})}if(ae.ownsLifecycle&&Z&&wr){let{offerEvidenceView:d}=await import("./evidence-MA3LDBWG.js");await d({packPath:Z.pack,env:w,isTTY:!i&&!J&&!!process.stdin.isTTY&&!!process.stderr.isTTY,log:u=>process.stderr.write(u+`
|
|
48
48
|
`)})}return t.onAgentEvent({type:"test_md_done",overall_status:z.overallStatus,duration_s:ge,session_id:l.sessionId,...Ge?{share_url:Ge}:{}}),{overallStatus:z.overallStatus,exitCode:z.overallStatus==="passed"?0:1,outputDir:ne(n),durationS:ge,uploadResult:oe.uploadResult,anyAuthorStepRan:D,resultCode:Ur(Ke),...St.length?{pendingInvestigations:St}:{}}}function Ao(e,t){let r={...e,...t},n=Object.keys(r).length>0?Se(r,""):{variables:{},objective:"",keyMap:{}};return{raw:r,auteur:n.variables,auteurObjective:"",secretEntries:Object.entries(r).filter(([,s])=>s.secret),nonSecretEntries:Object.entries(r).filter(([,s])=>!s.secret)}}function Ce(e,t,r){let n={...e,...t??{}};if(Object.keys(n).length===0)return{raw:n,variables:{},objective:r};let s=Se(n,r);return{raw:n,variables:qn(s.variables,s.objective),objective:s.objective}}function xo(e,t,r){let n=Ce(e,t,r).variables;return Object.keys(n).length>0?n:void 0}function ls(e,t){let r=new Set(dt),n={...e};for(let[s,o]of Object.entries(t))r.has(s)||s!=="variables"&&o!==void 0&&e[s]===void 0&&(n[s]=o);return n}function Po(e,t){return e.length<=t?e:e.slice(0,t-1)+"\u2026"}async function To(e,t,r,n,s,o){let i=Zr(t);on(t,i);let f=_e(e),a=Ro(f)?JSON.parse(cs(f,"utf8")):null,c=a?.testcase_id,y=a?.test_id,w=a?.commit_id,A=r.push===!0,R=r.retry===!0||r.retryCount!==void 0,x=r.author===!0;A&&!c&&process.stderr.write(`[--push] no meta.json yet \u2014 flag is a no-op on first run
|
|
49
49
|
`),x&&(c=void 0,y=void 0,w=void 0);let k=n.resolvedAuth.basicAuth;if(!k){let N=await n.resolvedAuth.resolver.resolve(!0);N?.username&&N?.access_key&&(k={username:N.username,access_key:N.access_key},n.resolvedAuth.basicAuth=k)}let C=!!k,l=!r.local&&C&&y!=null&&w!=null&&c!=null,H=l&&(et(i)||A);if(A&&!l)return process.stderr.write(`error: --push requires authenticated credentials for the lock API. Run 'kane-cli login' (OAuth) or pass --username/--access-key inline.
|
|
50
50
|
`),{resolved:t,decisions:i,testId:y,testcaseId:c,fromCommitId:w,newCommitId:null,isFirstRun:!1,hasAuth:C,canLock:l,lockAcquired:!1,unitLocks:[],degradedReadonly:!1,abort:{exitCode:2}};if(R&&!l)return process.stderr.write(`error: --retry requires authenticated credentials for the lock API. Run 'kane-cli login' (OAuth) or pass --username/--access-key inline.
|
|
@@ -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-3YI4QRXF.js";import{y as m}from"./chunk-VCYVSKPM.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,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as g}from"./chunk-
|
|
2
|
+
import{c as g}from"./chunk-VCYVSKPM.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{c as L}from"./chunk-RFHMDQXZ.js";import{Q as O,S}from"./chunk-
|
|
2
|
+
import{c as L}from"./chunk-RFHMDQXZ.js";import{Q as O,S}from"./chunk-O4HWPV67.js";import{e as P,f as R}from"./chunk-M5JQXOCE.js";import{y as s}from"./chunk-VCYVSKPM.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,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as l}from"./chunk-RZ4F3BHX.js";import{a,c,f as o}from"./chunk-
|
|
2
|
+
import{a as l}from"./chunk-RZ4F3BHX.js";import{a,c,f as o}from"./chunk-VCYVSKPM.js";import{readFileSync as f,writeFileSync as d,mkdirSync as h,realpathSync as g}from"fs";import{join as y}from"path";var C="npm install -g @testmuai/kane-cli@latest",b="brew upgrade lambdatest/kane/kane-cli";function w(){try{let t=process.argv[1];if(t&&g(t).includes("/Cellar/"))return b}catch{}return C}var m=y(c,"version-check.json"),S=1440*60*1e3;function k(){try{let t=JSON.parse(f(m,"utf-8"));if(Date.now()-t.checkedAt<S)return t}catch{}return null}function A(t){try{h(c,{recursive:!0}),d(m,JSON.stringify({latest:t,checkedAt:Date.now()}))}catch{}}function u(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);for(let s=0;s<3;s++){let e=(n[s]??0)-(i[s]??0);if(e!==0)return e}return 0}function p(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);return(n[0]??0)!==(i[0]??0)?"major":(n[1]??0)!==(i[1]??0)?"minor":"patch"}async function j(){try{let t=k();if(t)return u(a,t.latest)>0?{current:a,latest:t.latest,severity:p(a,t.latest)}:null;let r=new AbortController,i=setTimeout(()=>r.abort(),5e3),n=await l(o,{headers:{Accept:"application/json"},signal:r.signal});if(clearTimeout(i),!n.ok)return null;let e=(await n.json())["dist-tags"]?.latest;return e?(A(e),u(a,e)>0?{current:a,latest:e,severity:p(a,e)}:null):null}catch{return null}}export{w as a,u as b,p as c,j as d};
|
|
@@ -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-VCYVSKPM.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,7 +1,7 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as k}from"./chunk-FPFOW6BS.js";import{h as a}from"./chunk-M5JQXOCE.js";import{a as m}from"./chunk-2WVKOZ6W.js";import{a as y}from"./chunk-
|
|
2
|
+
import{a as k}from"./chunk-FPFOW6BS.js";import{h as a}from"./chunk-M5JQXOCE.js";import{a as m}from"./chunk-2WVKOZ6W.js";import{a as y}from"./chunk-QZJID3OZ.js";import{a as h}from"./chunk-DPOES6G3.js";var $=10,u=200,N=1e4,S=1e6;function T(t,e,r="streaming"){let n=r==="full-fetch"?S:N,o=$,i=0;if(t!==void 0){let s=Number(t);if(!Number.isInteger(s)||s<1||s>u)return{error:`--limit must be an integer in [1, ${u}] (got "${t}")`};o=s}if(e!==void 0){let s=Number(e);if(!Number.isInteger(s)||s<0||s>n)return{error:`--offset must be an integer in [0, ${n}] (got "${e}")`};i=s}return{limit:o,offset:i}}function C(t,e){if(!e)return t;let r=e.toLowerCase();return t.filter(n=>n.name.toLowerCase().includes(r))}function j(t,{limit:e,offset:r}){let n=t.slice(r,r+e),o=t.length>r+e;return{slice:n,hasMore:o}}function v(t,e,r=n=>process.stdout.write(`${n}
|
|
3
3
|
`)){for(let n of t)r(JSON.stringify(n));r(JSON.stringify({_meta:"page",limit:e.limit,offset:e.offset,returned:t.length,has_more:e.has_more}))}function b(t,e,r=n=>process.stdout.write(`${n}
|
|
4
|
-
`)){if(t.length===0){r("(no results)");return}let n=Math.max(2,...t.map(s=>s.id.length)),o=`${"ID".padEnd(n)} NAME`;r(o),r(`${"-".repeat(n)} ----`);for(let s of t)r(`${s.id.padEnd(n)} ${s.name}`);r("");let i=e.offset+t.length;if(e.hasMore){let s=e.totalIsLowerBound?`${e.total}+`:`${e.total}`;r(`${i} of ${s} \u2014 next: --offset ${e.offset+e.limit}`)}else r(`${t.length} shown (${e.total} total)`)}async function B(t,e,r){if(r.username&&r.accessKey)return{ok:!0,creds:{username:r.username,access_key:r.accessKey}};let n=new h,o=n.loadBasicAuth(t,e);if(o)return{ok:!0,creds:{username:o.username,access_key:o.access_key}};let i=n.loadCredentials(t,e);if(!i)return{ok:!1,reason:"no_credentials"};let s=i.access_token;try{let{refreshOAuthToken:d}=await import("./token-refresh-
|
|
4
|
+
`)){if(t.length===0){r("(no results)");return}let n=Math.max(2,...t.map(s=>s.id.length)),o=`${"ID".padEnd(n)} NAME`;r(o),r(`${"-".repeat(n)} ----`);for(let s of t)r(`${s.id.padEnd(n)} ${s.name}`);r("");let i=e.offset+t.length;if(e.hasMore){let s=e.totalIsLowerBound?`${e.total}+`:`${e.total}`;r(`${i} of ${s} \u2014 next: --offset ${e.offset+e.limit}`)}else r(`${t.length} shown (${e.total} total)`)}async function B(t,e,r){if(r.username&&r.accessKey)return{ok:!0,creds:{username:r.username,access_key:r.accessKey}};let n=new h,o=n.loadBasicAuth(t,e);if(o)return{ok:!0,creds:{username:o.username,access_key:o.access_key}};let i=n.loadCredentials(t,e);if(!i)return{ok:!1,reason:"no_credentials"};let s=i.access_token;try{let{refreshOAuthToken:d}=await import("./token-refresh-7PAPCMQK.js"),w=await d({creds:n,profile:t,env:e,credentials:i});w&&(s=w.accessToken)}catch(d){return{ok:!1,reason:"refresh_failed",detail:d instanceof Error?d.message:String(d)}}let c=y(e),f=await new k(c.controllerBaseUrl,async()=>s,null).resolve();return f?{ok:!0,creds:{username:f.username,access_key:f.access_key}}:{ok:!1,reason:"exchange_failed"}}function E(t,e,r){switch(r.reason){case"no_credentials":return{message:`error: no credentials for profile "${t}" [${e}]. Run \`kane-cli login\` or pass --username/--access-key.
|
|
5
5
|
`,exitCode:2};case"refresh_failed":return{message:`error: OAuth token refresh failed for profile "${t}" [${e}]${r.detail?`: ${r.detail}`:""}. Run \`kane-cli login\` to re-auth.
|
|
6
6
|
`,exitCode:2};case"exchange_failed":return{message:`error: TMS credential exchange failed for profile "${t}" [${e}]. Token may be revoked \u2014 try \`kane-cli login\`; if the problem persists, TMS may be down.
|
|
7
7
|
`,exitCode:2}}}function O(t){return{id:t.project_id,name:t.name}}function M(t){return{id:t.id,name:t.name}}async function P(t,e,r,n){let o=r+n+1,i=[],s=!0;for await(let c of t.listProjectsStream({name:e})){if(i.push(...c.projects),c.done){s=!0;break}if(i.length>=o){s=!1;break}}return{items:i,doneStreaming:s}}function g(t){return!!t.agent||!process.stdin.isTTY||!process.stdout.isTTY}function _(t,e=r=>process.stdout.write(`${r}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as $}from"./chunk-YCCUBQY4.js";import{a as U}from"./chunk-
|
|
2
|
+
import{a as $}from"./chunk-YCCUBQY4.js";import{a as U}from"./chunk-JHAGEBKE.js";import{a as T}from"./chunk-2WVKOZ6W.js";import{a as k}from"./chunk-QZJID3OZ.js";import{a as _}from"./chunk-QTHITA73.js";import{y as i}from"./chunk-VCYVSKPM.js";import{a as O}from"./chunk-HCBYKLMW.js";import{a as u,b as s}from"./chunk-C44QQJR4.js";import{a as K}from"./chunk-6YGTRKDT.js";import{e as S}from"./chunk-UR6MHSHU.js";var e=S(K(),1);var r=S(O(),1);function V(n,x,c){return{id:n,label:`${x} (${n})`,isActive:n===c}}function se({resolver:n,currentProjectId:x,env:c,onSelect:w,onCancel:C}){let[q,B]=(0,e.useState)([]),[D,l]=(0,e.useState)(!0),[H,m]=(0,e.useState)(!1),[J,g]=(0,e.useState)(!1),[Q,P]=(0,e.useState)(null),[d,p]=(0,e.useState)("list"),[v,R]=(0,e.useState)(""),[E,h]=(0,e.useState)(null),[I,X]=(0,e.useState)(""),b=(0,e.useRef)(!1),A=(0,e.useRef)(!0);(0,e.useEffect)(()=>{if(!n){P("Login first to browse projects"),l(!1);return}let o=new AbortController,a=I.trim();return A.current?l(!0):a&&g(!0),m(!0),P(null),(async()=>{try{let t=n.cached??await n.resolve();if(!t){P("Login first to browse projects"),l(!1),m(!1),g(!1);return}let L=k(c),F=new T(L.tmsBaseUrl,t.username,t.access_key),f=!0,N=0,G=a?{signal:o.signal,name:a,perPage:10}:{signal:o.signal,perPage:10};for await(let y of F.listProjectsStream(G)){if(f&&(l(!1),g(!1),A.current=!1,f=!1),y.totalLoaded===0&&y.done&&N===0&&!a){b.current=!0,p("naming"),m(!1);return}let M=y.projects.map(j=>V(j.project_id,j.name,x));B(N===0?M:j=>[...j,...M]),N+=y.projects.length,y.done&&m(!1)}f&&(l(!1),m(!1),g(!1))}catch(t){if(t?.name==="AbortError")return;P(t instanceof Error?t.message:String(t)),l(!1),m(!1),g(!1)}})(),()=>o.abort()},[n,x,c,I]);let Y=(0,e.useCallback)(o=>{let a=o.trim();if(!a){h("Name cannot be empty");return}h(null),p("creating"),(async()=>{try{if(!n)throw new Error("Not authenticated");let t=n.cached??await n.resolve();if(!t)throw new Error("Not authenticated");let L=k(c),f=await new T(L.tmsBaseUrl,t.username,t.access_key).createProject(a);w(f.id,f.name)}catch(t){h(t instanceof Error?t.message:String(t)),p("naming")}})()},[n,c,w]),z=(0,e.useCallback)(()=>{R(""),h(null),b.current?C():p("list")},[C]);return d==="naming"||d==="creating"?(0,r.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:i.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(s,{color:i.orange,bold:!0,children:"Create new project"}),b.current&&(0,r.jsx)(u,{marginTop:1,children:(0,r.jsx)(s,{color:i.dim,children:"No projects yet \u2014 let's create one."})}),(0,r.jsxs)(u,{marginTop:1,children:[(0,r.jsx)(s,{color:i.dim,children:"Name: "}),d==="naming"?(0,r.jsx)($,{value:v,onChange:o=>{R(o),E&&h(null)},onSubmit:Y,onCancel:z}):(0,r.jsx)(s,{children:v})]}),E&&(0,r.jsx)(u,{marginTop:1,children:(0,r.jsx)(s,{color:i.red,children:E})}),d==="creating"&&(0,r.jsx)(u,{marginTop:1,children:(0,r.jsx)(s,{color:i.dim,children:"Creating..."})}),d==="naming"&&(0,r.jsx)(_,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:b.current?"cancel":"back"})]}):(0,r.jsx)(U,{title:"Projects",items:q,loading:D,loadingMore:H,searching:J,preserveSelectionById:!0,onSearch:X,error:Q,itemNoun:"projects",onTab:()=>{b.current=!1,p("naming")},extraHint:"tab to create new",onSelect:o=>{let a=o.label.replace(` (${o.id})`,"");w(o.id,a)},onCancel:C})}export{V as a,se as b};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{d as s,k as l}from"./chunk-
|
|
2
|
+
import{d as s,k as l}from"./chunk-VCYVSKPM.js";import{readFileSync as g,writeFileSync as o,mkdirSync as i,existsSync as p}from"fs";import{dirname as a}from"path";var n={window_size:{width:1920,height:1080},chrome_profile_path:"",default_url:l,model:"v16-alpha",project_id:null,project_name:null,folder_id:null,folder_name:null,mode:"testing",assertion_mode:"dom",network_ws:!1,network_sse:!1,bug_detection:"off",final_validation:!1,code_export:{enabled:!0,language:"python",skip_validation:!0},generate:{scenario_limit:2,per_scenario_limit:3,memory_enabled:!1},last_seen_version:"",hints_enabled:!0},c=class{constructor(r=s){this.path=r}exists(){return p(this.path)}load(){try{let r=g(this.path,"utf-8"),e=JSON.parse(r);return{...n,...e,code_export:{...n.code_export,...e.code_export??{}},generate:{...n.generate,...e.generate??{}}}}catch{return{...n,code_export:{...n.code_export},generate:{...n.generate}}}}set(r,e){try{let t=this.load();t[r]=e,i(a(this.path),{recursive:!0}),o(this.path,JSON.stringify(t,null,2)+`
|
|
3
3
|
`)}catch(t){let d=t instanceof Error?t.message:String(t);process.stderr.write(`[config] Failed to save config: ${d}
|
|
4
4
|
`)}}save(r){try{let t={...this.load(),...r};i(a(this.path),{recursive:!0}),o(this.path,JSON.stringify(t,null,2)+`
|
|
5
5
|
`)}catch(e){let t=e instanceof Error?e.message:String(e);process.stderr.write(`[config] Failed to save config: ${t}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
2
|
function l(r){let{isAgent:c,log:m}=r,a=r.stdout??process.stderr,s=r.stdin??process.stdin,p=t=>{c&&process.stdout.write(JSON.stringify(t)+`
|
|
3
|
-
`)};return{async runSteps(t){let{default:e}=await import("./react-QWOAB3TB.js"),{render:o}=await import("./build-JIKYOZUH.js"),{TestMdRunView:i}=await import("./TestMdRunView-
|
|
3
|
+
`)};return{async runSteps(t){let{default:e}=await import("./react-QWOAB3TB.js"),{render:o}=await import("./build-JIKYOZUH.js"),{TestMdRunView:i}=await import("./TestMdRunView-7CL3PM3J.js"),{ScrollbackProvider:n}=await import("./scrollback-JLPJR25X.js"),{waitUntilExit:d}=o(e.createElement(n,null,e.createElement(i,t)),{stdout:a,stdin:s,exitOnCtrlC:!1});await d()},async runUpload(t,e){let{renderUploadProgress:o}=await import("./CliUploadProgress-H4265KXU.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-BQZEGOIV.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-66M7XP5Y.js"),{waitUntilExit:n}=o(e.createElement(i,t),{stdout:a,stdin:s});await n()}catch(e){m("warn","TEST_MD_LINKS_RENDER_FAILED","LinksBox render failed",{error:String(e)})}},onLockState(t){p({type:"test_md_lock_state",...t})},onRetryAttempt(t){p({type:"test_md_retry_attempt",...t})},onAgentEvent(t){p(t)}}}export{l as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as m}from"./chunk-
|
|
2
|
+
import{a as m}from"./chunk-QTHITA73.js";import{y as t}from"./chunk-VCYVSKPM.js";import{a as p}from"./chunk-HCBYKLMW.js";import{a,b as r,i as u}from"./chunk-C44QQJR4.js";import{a as b}from"./chunk-6YGTRKDT.js";import{e as n}from"./chunk-UR6MHSHU.js";var c=n(b(),1);var e=n(p(),1);function R({onSubmit:l}){let[o,f]=(0,c.useState)(0),s=(0,c.useRef)(!1);return u((x,i)=>{s.current||(i.leftArrow||i.rightArrow?f(d=>d===0?1:0):i.return?(s.current=!0,l(o===0?"positive":"negative")):i.escape&&(s.current=!0,l(null)))}),(0,e.jsxs)(a,{flexDirection:"column",marginTop:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(r,{color:t.secondary,children:"Rate this session: "}),(0,e.jsx)(r,{color:o===0?t.orange:t.dim,children:o===0?"[ \u{1F44D} ]":" \u{1F44D} "}),(0,e.jsx)(r,{children:" "}),(0,e.jsx)(r,{color:o===1?t.orange:t.dim,children:o===1?"[ \u{1F44E} ]":" \u{1F44E} "})]}),(0,e.jsx)(m,{bindings:[{keys:"\u2190/\u2192",label:"select"},{keys:"\u21B5",label:"submit"}],escBackLabel:"skip"})]})}export{R as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as f}from"./chunk-
|
|
2
|
+
import{a as f}from"./chunk-F42YVALT.js";import{y as t}from"./chunk-VCYVSKPM.js";import{a as x}from"./chunk-HCBYKLMW.js";import{a as r,b as n}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as p}from"./chunk-UR6MHSHU.js";var c=p(B(),1);var e=p(x(),1);function v(){return[{name:"convert",label:"Converting session data",status:"pending"},{name:"zip",label:"Compressing artifacts",status:"pending"},{name:"presign",label:"Requesting upload URLs",status:"pending"},{name:"upload",label:"Uploading to KaneAI",status:"pending"},{name:"atomic_replace",label:"Replacing local output",status:"pending"},{name:"commit_lock",label:"Committing to TMS",status:"pending"},{name:"finalize",label:"Finalizing test case",status:"pending"},{name:"code_export",label:"Downloading test code",status:"pending"}]}function U(s,o,d,a){return s.map(l=>l.name===o?{...l,status:d,detail:a}:l)}function R(s){let o=s/1e3;if(o<60)return`${o.toFixed(1)}s`;let d=Math.floor(o/60),a=Math.round(o%60);return`${d}m ${a}s`}function D(s){let[o,d]=(0,c.useState)(0),a=c.default.useRef(Date.now());return(0,c.useEffect)(()=>{if(!s)return;a.current=Date.now();let l=setInterval(()=>{d(Date.now()-a.current)},100);return()=>clearInterval(l)},[s]),o}function h({steps:s,status:o,testUrl:d,error:a}){let l=D(o==="uploading");return o==="uploading"?(0,e.jsxs)(r,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(r,{children:[(0,e.jsx)(n,{color:t.orange,children:"\u2601 "}),(0,e.jsx)(n,{color:t.orange,bold:!0,children:"Saving to KaneAI"}),(0,e.jsxs)(n,{color:t.dim,children:[" ",R(l)]})]}),(0,e.jsx)(r,{flexDirection:"column",marginTop:1,children:s.filter(i=>i.status!=="skipped").map((i,S,T)=>{let b=S===T.length-1?"\u2514\u2500":"\u251C\u2500",u=i.status==="done",m=i.status==="running",g=i.status==="failed";return(0,e.jsxs)(r,{children:[(0,e.jsxs)(n,{color:t.dim,children:[" ",b," "]}),(0,e.jsx)(r,{width:3,children:m?(0,e.jsx)(f,{}):u?(0,e.jsx)(n,{color:t.green,children:"\u2713"}):g?(0,e.jsx)(n,{color:t.red,children:"\u2717"}):(0,e.jsx)(n,{color:t.muted,children:"\u25CB"})}),(0,e.jsx)(n,{color:u?t.dim:m?void 0:g?t.red:t.muted,children:i.label}),i.detail&&(0,e.jsxs)(n,{color:t.dim,children:[" ",i.detail]})]},i.name)})}),(0,e.jsx)(r,{marginTop:1,children:(0,e.jsx)(n,{color:t.muted,children:" press Ctrl+C twice to force exit"})})]}):o==="success"?(0,e.jsx)(e.Fragment,{}):(0,e.jsxs)(r,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(r,{children:[(0,e.jsx)(n,{color:t.red,children:"\u2601 "}),(0,e.jsx)(n,{color:t.red,bold:!0,children:"Save failed"})]}),a&&(0,e.jsxs)(r,{marginTop:0,children:[(0,e.jsx)(n,{color:t.dim,children:" "}),(0,e.jsx)(n,{color:t.dim,children:a})]})]})}export{v as a,U as b,h as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{y as m}from"./chunk-
|
|
2
|
+
import{y as m}from"./chunk-VCYVSKPM.js";import{a as x}from"./chunk-HCBYKLMW.js";import{a as u,b as a,j as g}from"./chunk-C44QQJR4.js";import{a as b}from"./chunk-6YGTRKDT.js";import{e as f}from"./chunk-UR6MHSHU.js";var T=f(b(),1);function k(i,n){if(!n)return i;let l=i.trim()||n;return`\x1B]8;;${n}\x07${l}\x1B]8;;\x07`}var r=f(x(),1);function $({shareableLink:i,testCaseLink:n,codeExportDir:l,recordedTestPath:s,outputDir:o,autoExit:p=!0}){let{exit:c}=g();(0,T.useEffect)(()=>{if(!p)return;let t=setTimeout(()=>c(),100);return()=>clearTimeout(t)},[c,p]);let e=[];return s&&e.push({label:"Test",url:s,linkUrl:`file://${s}`}),o&&e.push({label:"Output",url:o,linkUrl:`file://${o}`}),i&&e.push({label:"ShareLink",url:i}),n&&e.push({label:"TestCase",url:n}),l&&!o&&e.push({label:"CodeExport",url:l,linkUrl:`file://${l}`}),e.length===0?(0,r.jsx)(r.Fragment,{}):(0,r.jsx)(u,{flexDirection:"column",marginTop:1,marginLeft:1,children:e.map(t=>(0,r.jsxs)(u,{flexDirection:"column",marginBottom:1,children:[(0,r.jsxs)(a,{color:m.orange,children:[t.label,":"]}),(0,r.jsx)(a,{color:m.dim,children:k(t.url,t.linkUrl??t.url)})]},t.label))})}export{$ as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as R}from"./chunk-
|
|
2
|
+
import{a as R}from"./chunk-QTHITA73.js";import{y as r}from"./chunk-VCYVSKPM.js";import{a as Y}from"./chunk-HCBYKLMW.js";import{a,b as i,i as X}from"./chunk-C44QQJR4.js";import{a as G}from"./chunk-6YGTRKDT.js";import{e as P}from"./chunk-UR6MHSHU.js";var u=P(G(),1);var e=P(Y(),1),f=5;function K(t,I){if(!I)return t;let c=I.toLowerCase();return t.filter(B=>B.label.toLowerCase().includes(c))}function J(t){let{title:I,items:c,loading:B=!1,loadingText:F,error:L=null,itemNoun:T="items",onSelect:H,onCancel:E,defaultActiveId:w,onTab:y,extraHint:N}=t,[x,d]=(0,u.useState)(0),[S,g]=(0,u.useState)(0),[s,A]=(0,u.useState)(""),[C,h]=(0,u.useState)(null);(0,u.useEffect)(()=>{if(c.length===0)return;if(t.preserveSelectionById&&C!==null){let n=c.findIndex(o=>o.id===C);if(n>=0){g(Math.floor(n/f)),d(n%f);return}}let l=w?c.findIndex(n=>n.id===w):c.findIndex(n=>n.isActive);l>=0?(g(Math.floor(l/f)),d(l%f),t.preserveSelectionById&&h(c[l].id)):t.preserveSelectionById&&(g(0),d(0),h(c[0]?.id??null))},[c,w,t.preserveSelectionById,C]),(0,u.useEffect)(()=>{if(!t.onSearch)return;let l=setTimeout(()=>t.onSearch(s),t.searchDebounceMs??250);return()=>clearTimeout(l)},[s,t.onSearch,t.searchDebounceMs]);let m=t.onSearch?c:K(c,s),M=S*f,p=Math.min(M+f,m.length),D=Math.ceil(m.length/f),O=p-M,v=m.slice(M,p);return X((l,n)=>{if(L){n.escape&&E();return}if(n.escape){s?(A(""),d(0),g(0)):E();return}if(n.tab&&y){y();return}if(n.upArrow){if(x>0){let o=x-1;d(o),t.preserveSelectionById&&h(v[o]?.id??null)}else if(S>0){let o=S-1,b=f-1;g(o),d(b),t.preserveSelectionById&&h(m[o*f+b]?.id??null)}return}if(n.downArrow){if(x<O-1){let o=x+1;d(o),t.preserveSelectionById&&h(v[o]?.id??null)}else if(S<D-1){let o=S+1,b=0;g(o),d(b),t.preserveSelectionById&&h(m[o*f+b]?.id??null)}return}if(n.return&&v[x]){H(v[x]);return}if(n.backspace||n.delete){A(o=>o.slice(0,-1)),d(0),g(0);return}l&&!n.ctrl&&!n.meta&&(A(o=>o+l),d(0),g(0))},{isActive:!B}),B?(0,e.jsxs)(a,{flexDirection:"column",borderStyle:"round",borderColor:r.orange,paddingX:2,paddingY:1,children:[(0,e.jsx)(i,{color:r.orange,bold:!0,children:I}),(0,e.jsx)(a,{marginTop:1,children:(0,e.jsx)(i,{color:r.secondary,children:F??`Loading ${T}\u2026`})})]}):L?(0,e.jsxs)(a,{flexDirection:"column",borderStyle:"round",borderColor:r.red,paddingX:2,paddingY:1,children:[(0,e.jsx)(i,{color:r.red,bold:!0,children:I}),(0,e.jsx)(a,{marginTop:1,children:(0,e.jsx)(i,{color:r.red,children:L})}),(0,e.jsx)(R,{bindings:[]})]}):(0,e.jsxs)(a,{flexDirection:"column",borderStyle:"round",borderColor:r.orange,paddingX:2,paddingY:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(i,{color:r.orange,bold:!0,children:I}),(0,e.jsxs)(i,{color:r.dim,children:[" (",m.length,!t.onSearch&&s?`/${c.length}`:""," ",T,t.loadingMore?" \xB7 loading more":"",")"]})]}),(0,e.jsxs)(a,{marginTop:1,children:[(0,e.jsx)(i,{color:r.secondary,children:s?"filter: ":""}),s?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i,{children:s}),(0,e.jsx)(i,{inverse:!0,children:" "})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(i,{color:r.dim,children:["Search ",T,"\u2026"]}),(0,e.jsx)(i,{inverse:!0,children:" "})]})]}),(0,e.jsx)(a,{flexDirection:"column",marginTop:1,children:t.searching?(0,e.jsxs)(i,{color:r.secondary,children:["Searching ",T,"\u2026"]}):m.length===0?(0,e.jsxs)(i,{color:r.dim,children:["No ",T,' match "',s,'"']}):v.map((l,n)=>{let o=n===x,b=o?"\u276F ":" ",$=l.isActive?r.green:o?r.orange:void 0;return(0,e.jsxs)(i,{color:$,children:[b,l.label,l.isActive?" \u25CF selected":""]},l.id)})}),!t.searching&&D>1&&(0,e.jsx)(a,{marginTop:1,children:(0,e.jsxs)(i,{color:r.dim,children:["Page ",S+1,"/",D]})}),t.footer&&(0,e.jsx)(a,{marginTop:1,flexDirection:"column",children:t.footer}),(0,e.jsx)(R,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"type",label:"to search"},{keys:"\u21B5",label:"select"},...y&&N?[{keys:"tab",label:N}]:[]],escBackLabel:s?"clear":"back to chat"})]})}export{J as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as $e}from"./chunk-
|
|
2
|
+
import{c as $e}from"./chunk-U6TLLYRG.js";import{a as te}from"./chunk-F42YVALT.js";import{a as K}from"./chunk-5Y2G4NC7.js";import{a as Be}from"./chunk-DKERZJYF.js";import{a as ve}from"./chunk-3YI4QRXF.js";import{b as ye}from"./chunk-DFS4RMVP.js";import{y as i}from"./chunk-VCYVSKPM.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,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as S}from"./chunk-
|
|
2
|
+
import{a as S}from"./chunk-DKERZJYF.js";import{y as o}from"./chunk-VCYVSKPM.js";import{a as R}from"./chunk-HCBYKLMW.js";import{a as y,b as c,j as x}from"./chunk-C44QQJR4.js";import{a as w}from"./chunk-6YGTRKDT.js";import{e as b}from"./chunk-UR6MHSHU.js";var k=b(w(),1);var i=b(R(),1);function A(e){let t=e.decisions.filter(r=>r.kind==="replay").length,l=e.decisions.filter(r=>r.kind==="author").length,p=e.outcomes.filter(r=>r.status==="passed").length,d=e.outcomes.filter(r=>r.status==="failed").length,f=e.outcomes.filter(r=>r.status==="skipped").length,a=o.green,n;e.cancelled||e.overallStatus==="interrupted"?(a=o.orange,n="CANCELLED"):e.overallStatus==="failed"?(a=o.red,n="FAILED"):n="PASSED";let s=`${n} \xB7 ${e.durationS}s \xB7 ${e.outcomes.length} steps (${p} passed, ${d} failed, ${f} skipped)`,T=`${t} replay \xB7 ${l} author`,C=e.retryTriggered,_="yes \u2014 run recovered after a replay miss",u,h=o.dim;if(e.cancelled)u="\u2013 not committed (cancellation)";else if(e.overallStatus==="failed")u="\u2013 not committed (run failed)",h=o.red;else if(!e.shouldCommit)e.isFirstRun?u="\u2013 not committed (first run skipped commit)":e.lockHeld?u="\u2013 not committed":u="\u2013 not committed (readonly fallback / no lock)";else{let r=e.uploadResult?.testcaseId;u=r?`\u2713 pushed (testcase=${r})`:"\u2713 pushed",h=o.green}let v=e.shouldReplaceLocalOutput?"output dir replaced":e.anyAuthorStepRan?"untouched (cancellation or no replace)":"untouched (replay-only)",m,g=o.dim;return e.shouldUploadArtifacts?e.uploadResult?.success?(m="\u2713 TMS",g=o.green):e.uploadResult?(m=`\u2717 failed${e.uploadResult.error?`: ${e.uploadResult.error}`:""}`,g=o.red):m="\u2013 not run":m="\u2013 skipped (--local or no auth)",{resultLine:{color:a,text:s},breakdown:T,showRetries:C,retriesText:_,commitText:u,commitColor:h,artifactsText:v,uploadText:m,uploadColor:g}}function O(e){let t=e.decisions.filter(s=>s.kind==="replay").length,l=e.decisions.filter(s=>s.kind==="author").length,p=e.outcomes.filter(s=>s.status==="passed").length,d=e.outcomes.filter(s=>s.status==="failed").length,f=e.outcomes.filter(s=>s.status==="skipped").length,a,n=!1;return e.cancelled?a="cancellation":e.overallStatus==="failed"?a="run_failed":e.shouldCommit&&e.uploadResult?.testcaseId?(a="ok",n=!0):!e.shouldCommit&&!e.lockHeld&&!e.isFirstRun?a="readonly_fallback":a="not_committed",{type:"test_md_summary",overall_status:e.overallStatus,duration_s:e.durationS,steps:{total:e.outcomes.length,passed:p,failed:d,skipped:f,replay_decisions:t,author_decisions:l},retries:{triggered:e.retryTriggered},commit:{committed:n,reason:a,...e.uploadResult?.testcaseId?{testcase_id:e.uploadResult.testcaseId}:{}},artifacts:{replaced:e.shouldReplaceLocalOutput},upload:{performed:e.shouldUploadArtifacts,...e.uploadResult?{succeeded:!!e.uploadResult.success}:{}},...e.shareUrl?{share_url:e.shareUrl}:{},cancelled:e.cancelled,...e.imports&&e.imports.length>0?{imports:e.imports}:{}}}function D({data:e}){let t=A(e),l=[{label:"result",value:(0,i.jsx)(c,{color:t.resultLine.color,bold:!0,children:t.resultLine.text})},{label:"breakdown",value:(0,i.jsx)(c,{color:o.dim,children:t.breakdown})}];return t.showRetries&&l.push({label:"retries",value:(0,i.jsx)(c,{color:o.orange,children:t.retriesText})}),l.push({label:"commit",value:(0,i.jsx)(c,{color:t.commitColor,children:t.commitText})}),l.push({label:"artifacts",value:(0,i.jsx)(c,{color:o.dim,children:t.artifactsText})}),l.push({label:"upload",value:(0,i.jsx)(c,{color:t.uploadColor,children:t.uploadText})}),(0,i.jsx)(S,{title:"Run summary",titleColor:"#ff9500",rows:l})}function I({data:e}){let{exit:t}=x();return(0,k.useEffect)(()=>{let l=setTimeout(()=>t(),50);return()=>clearTimeout(l)},[t]),(0,i.jsx)(y,{flexDirection:"column",children:(0,i.jsx)(D,{data:e})})}export{A as a,O as b,D as c,I as d};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as K,c as V,d as z,e as ee,f as te}from"./chunk-
|
|
2
|
+
import{b as K,c as V,d as z,e as ee,f as te}from"./chunk-QM3XF5TW.js";import{c as J}from"./chunk-R65HNFRB.js";import{a as Q}from"./chunk-FVM7TWKT.js";import{a as Z}from"./chunk-FPFOW6BS.js";import{b as H}from"./chunk-FT4G3QGO.js";import{b as W}from"./chunk-QB4IOM3X.js";import{h as E}from"./chunk-M5JQXOCE.js";import{a as O}from"./chunk-2WVKOZ6W.js";import{a as _}from"./chunk-QZJID3OZ.js";import{a as k,b as A,d as Y}from"./chunk-VE3SUJMA.js";import{a as q}from"./chunk-DPOES6G3.js";import{a as G}from"./chunk-HCBYKLMW.js";import{a as c,b as u,i as I,j as X}from"./chunk-C44QQJR4.js";import{a as ue}from"./chunk-6YGTRKDT.js";import{e as F}from"./chunk-UR6MHSHU.js";var i=F(ue(),1);var r=F(G(),1);function _e({resultRef:h,mode:d="singleshot",loginCompleteRef:f}){let{exit:m}=X(),C=(0,i.useRef)(new q),S=(0,i.useRef)(new Q),v=(0,i.useRef)(new J),t=C.current,l=S.current,$=v.current,ne=K(),[P,g]=(0,i.useState)(d==="login"?"login":"gate"),[L,re]=(0,i.useState)(null),[de,R]=(0,i.useState)(null),[ge,T]=(0,i.useState)(null),[N,oe]=(0,i.useState)(null),[U,B]=(0,i.useState)([]),x=(0,i.useCallback)((e,n,s,o)=>$.log(e,n,s,o),[$]),pe=(0,i.useCallback)((e,n)=>{e?k(t,l,e,n):l.save({project_id:null,project_name:null,folder_id:null,folder_name:null})},[t,l]),y=(0,i.useCallback)(()=>{d==="login"?(f&&(f.current=!0),m()):g("input")},[d,m,f]),D=(0,i.useCallback)((e,n)=>{let s=k(t,l,e,n);if(d==="login"){g("ensure-project");return}Y(s)?y():s.projectId?g("ensure-folder"):g("ensure-project")},[t,l,y,d]);I((e,n)=>{n.ctrl&&e==="c"&&E(0,"Ctrl+C exit")});let M=(0,i.useRef)(!1);i.default.useEffect(()=>{M.current||(M.current=!0,d!=="login"&&te(t,x).then(e=>{re(e),e.status==="authenticated"?D(e.result.profile,e.result.env):e.status==="needs_pick"?g("pick"):(R(e.profile??null),T(e.env??null),g("login"))}).catch(e=>{oe(`Auth check failed: ${e instanceof Error?e.message:String(e)}`)}))},[t,x]);let ie=(0,i.useCallback)(e=>{h.current={objective:e},m()},[h,m]),se=(0,i.useCallback)(async(e,n)=>{t.setActiveProfile(e),t.setDefaultEnv(n),(await ee(t,e,n,x)).status==="authenticated"?D(e,n):(R(e),T(n),g("login"))},[t,x,D]),w=(0,i.useCallback)(()=>{let e=t.getActiveProfile(),n=t.getDefaultEnv();if(!e)return null;let s=_(n),o=t.loadBasicAuth(e,n);return new Z(s.controllerBaseUrl,async()=>t.loadCredentials(e,n)?.access_token??null,o,x)},[t,x]),le=(0,i.useCallback)(async()=>{let e=w();if(!e)return null;let n=e.cached??await e.resolve();if(!n)return null;let s=_(t.getDefaultEnv()),o=new O(s.tmsBaseUrl,n.username,n.access_key);try{let p=(await o.listProjects()).find(b=>b.name==="KaneAI Generated");if(p)return{id:p.project_id,name:p.name};let j=await o.createProject("KaneAI Generated");return{id:j.id,name:j.name}}catch{return null}},[w,t]),ae=(0,i.useCallback)(async e=>{let n=w();if(!n)return null;let s=n.cached??await n.resolve();if(!s)return null;let o=_(t.getDefaultEnv()),a=new O(o.tmsBaseUrl,s.username,s.access_key);try{let j=(await a.listFolders(e)).find(ce=>ce.name==="Untitled");if(j)return{id:j.id,name:j.name};let b=await a.createFolder(e,"Untitled");return{id:b.id,name:b.name}}catch{return null}},[w,t]);if(P==="gate")return(0,r.jsx)(c,{paddingX:1,children:(0,r.jsx)(u,{color:"yellow",children:"Checking authentication..."})});if(N)return(0,r.jsxs)(c,{flexDirection:"column",paddingX:1,children:[(0,r.jsx)(u,{color:"red",children:N}),(0,r.jsx)(u,{color:"gray",children:"Press Ctrl+C to exit."})]});if(P==="pick"&&L?.status==="needs_pick")return(0,r.jsx)(fe,{profiles:L.profiles,onSelect:se});if(P==="login")return(0,r.jsx)(z,{devMode:process.env.KANE_DEV_MODE==="1",profiles:t.listProfiles(),onBasicLogin:async(e,n,s,o)=>{let{validateBasicAuth:a}=await import("./validate-basic-VBPGGHES.js");await a(n,s,o),t.saveBasicAuth(e,n,{username:s,access_key:o}),t.setActiveProfile(e),t.setDefaultEnv(n)},onOAuthLogin:async(e,n)=>{let{LoginFlow:s}=await import("./login-flow-4L62GWLT.js");t.setDefaultEnv(n),t.setActiveProfile(e),await new s(e,n,t).login()},onComplete:(e,n)=>{R(e),T(n),t.setActiveProfile(e),t.setDefaultEnv(n),D(e,n)},onCancel:()=>{E(0,"Login cancelled")}});if(P==="ensure-project"){let e=t.getActiveProfile()??"default",n=t.getDefaultEnv(),s=()=>{if(d==="login"){g("ensure-folder");return}k(t,l,e,n).folderId?y():g("ensure-folder")};return(0,r.jsxs)(c,{flexDirection:"column",children:[(0,r.jsx)(c,{paddingX:1,marginBottom:1,children:(0,r.jsx)(u,{color:"yellow",children:"Project & folder are required to save tests \xB7 Esc to use defaults \xB7 Ctrl+C to exit"})}),(0,r.jsx)(H,{resolver:w(),currentProjectId:l.load().project_id,env:n,onSelect:(o,a)=>{A(t,l,e,n,{projectId:o,projectName:a}),B(p=>[...p,`\u2713 Project: ${a} (${o})`]),s()},onCancel:async()=>{let o=await le();o&&(A(t,l,e,n,{projectId:o.id,projectName:o.name}),B(a=>[...a,`\u2713 Default project: ${o.name} (${o.id})`]),s())}})]})}if(P==="ensure-folder"){let e=t.getActiveProfile()??"default",n=t.getDefaultEnv(),s=t.loadProfileConfig(e,n);return(0,r.jsxs)(c,{flexDirection:"column",children:[(0,r.jsx)(c,{paddingX:1,marginBottom:1,children:(0,r.jsx)(u,{color:"yellow",children:"Project & folder are required to save tests \xB7 Esc to use defaults \xB7 Ctrl+C to exit"})}),(0,r.jsx)(W,{resolver:w(),projectId:s?.project_id??"",currentFolderId:l.load().folder_id,env:n,onSelect:(o,a)=>{A(t,l,e,n,{folderId:o,folderName:a}),B(p=>[...p,`\u2713 Folder: ${a} (${o})`]),y()},onCancel:async()=>{if(!s?.project_id)return;let o=await ae(s.project_id);o&&(A(t,l,e,n,{folderId:o.id,folderName:o.name}),B(a=>[...a,`\u2713 Default folder: ${o.name} (${o.id})`]),y())}})]})}return P==="input"?(0,r.jsxs)(c,{flexDirection:"column",children:[U.length>0&&(0,r.jsx)(c,{flexDirection:"column",paddingX:1,marginBottom:1,children:U.map((e,n)=>(0,r.jsx)(u,{color:"green",children:e},n))}),(0,r.jsx)(V,{onSubmit:ie,onEscape:()=>E(0,"User pressed Escape"),history:ne,placeholder:"Type an objective..."})]}):(0,r.jsx)(r.Fragment,{})}function fe({profiles:h,onSelect:d}){let[f,m]=(0,i.useState)(0),[C,S]=(0,i.useState)(!1);return I((v,t)=>{if(!C){if(t.escape){E(0,"Profile picker cancelled");return}if(t.upArrow&&f>0&&m(l=>l-1),t.downArrow&&f<h.length-1&&m(l=>l+1),t.return){S(!0);let l=h[f];d(l.profile,l.env).catch(()=>S(!1))}}}),(0,r.jsxs)(c,{flexDirection:"column",paddingX:1,children:[(0,r.jsx)(u,{color:"#ff9500",bold:!0,children:"Select a profile:"}),(0,r.jsx)(c,{marginTop:1,flexDirection:"column",children:h.map((v,t)=>(0,r.jsxs)(u,{children:[t===f?"\u276F ":" ",(0,r.jsx)(u,{color:t===f?"#ff9500":"white",bold:t===f,children:v.profile}),(0,r.jsxs)(u,{color:"gray",children:[" [",v.env,"]"]})]},`${v.profile}-${v.env}`))}),C&&(0,r.jsx)(c,{marginTop:1,children:(0,r.jsx)(u,{color:"yellow",children:"Validating credentials..."})})]})}export{_e as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as l}from"./chunk-
|
|
2
|
+
import{b as l}from"./chunk-EWLLPUP4.js";import{a as p}from"./chunk-RZ4F3BHX.js";import{a as m}from"./chunk-QZJID3OZ.js";import{a as f}from"./chunk-DPOES6G3.js";import{a as c,c as s,i as a,x as u}from"./chunk-VCYVSKPM.js";var v="/public/skills/kane-cli";function C(){try{let n=new f().getDefaultEnv();if(n in u)return n}catch{}return"prod"}function k(){return`${m(C()).controllerBaseUrl}${v}`}import{readFileSync as S,writeFileSync as E,mkdirSync as g}from"fs";import{join as d}from"path";var h=d(s,"skill-check.json"),y=3600*1e3;function V(){try{let n=JSON.parse(S(h,"utf-8"));if(Date.now()-n.checkedAt<y)return n}catch{}return null}function A(n){try{g(s,{recursive:!0}),E(h,JSON.stringify({map:n,checkedAt:Date.now()}))}catch{}}function I(){for(let{dir:n}of a)try{let t=S(d(n,"VERSION"),"utf-8").trim();if(t)return t}catch{}return null}function M(n,t){let i=Object.keys(n.versions??{});if(i.length===0)return null;let o=i.slice().sort((r,e)=>l(r,e));for(let r of o){let e=n.versions[r]?.kaneCliMinVersion;if(!e||l(t,e)<=0)return r}return null}async function U(){try{let n=V()?.map;if(!n){let o=new AbortController,r=setTimeout(()=>o.abort(),5e3),e=await p(k(),{headers:{Accept:"application/json"},signal:o.signal});if(clearTimeout(r),!e.ok)return null;n=await e.json(),A(n)}let t=M(n,c);if(!t)return null;let i=I();return i===null?{current:null,latestCompatible:t}:l(i,t)>0?{current:i,latestCompatible:t}:null}catch{return null}}export{k as a,M as b,U as c};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{d as Qe,g as qe}from"./chunk-FCMLIK7P.js";import{b as w,c as Q,d as Ge,f as q,g as ee}from"./chunk-CJJXT5DO.js";import{a as Ke,e as P,f as j,g as We,h as H,i as D,j as Je}from"./chunk-ZPDM6FO7.js";import{a as G}from"./chunk-BC7UVJJB.js";import{d as et}from"./chunk-NVGBE2DR.js";import{a as F,b as L,d as Ye}from"./chunk-EHN5HTUD.js";import{a as R,b as y}from"./chunk-L5LI2JF4.js";import{a as b}from"./chunk-LEA6IHXC.js";import{b as Y}from"./chunk-RGDQMKNJ.js";import{a as Ze}from"./chunk-L4JIMNKW.js";import{c as z,e as U}from"./chunk-MBXWXBDM.js";import{d as te,f as Xe}from"./chunk-5YPBPZUR.js";import{a as Ue}from"./chunk-
|
|
2
|
+
import{d as Qe,g as qe}from"./chunk-FCMLIK7P.js";import{b as w,c as Q,d as Ge,f as q,g as ee}from"./chunk-CJJXT5DO.js";import{a as Ke,e as P,f as j,g as We,h as H,i as D,j as Je}from"./chunk-ZPDM6FO7.js";import{a as G}from"./chunk-BC7UVJJB.js";import{d as et}from"./chunk-NVGBE2DR.js";import{a as F,b as L,d as Ye}from"./chunk-EHN5HTUD.js";import{a as R,b as y}from"./chunk-L5LI2JF4.js";import{a as b}from"./chunk-LEA6IHXC.js";import{b as Y}from"./chunk-RGDQMKNJ.js";import{a as Ze}from"./chunk-L4JIMNKW.js";import{c as z,e as U}from"./chunk-MBXWXBDM.js";import{d as te,f as Xe}from"./chunk-5YPBPZUR.js";import{a as Ue}from"./chunk-QZJID3OZ.js";import{a as ze}from"./chunk-VCYVSKPM.js";function $(t){if(t===null)return"broken";let e=Math.floor(t/100);return e===1?"passed":e===7?"failed":e===2?"skipped":"broken"}var C={failed:3,broken:2,passed:1,skipped:0};function re(t){let e="skipped";for(let r of t)C[r]>C[e]&&(e=r);return e}import{createHash as Dt}from"crypto";import{basename as Ot}from"path";function ne(t){let e=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40);return e.length>0?e:"session"}function ie(t){return Dt("sha256").update(t).digest("hex").slice(0,8)}function oe(t){let e=Ot(t).replace(/_test\.md$/i,"").replace(/\.md$/i,"");return`${ne(e)}-${ie(t)}`}function se(t,e){return`${ne(t)}-${ie(e)}`}function ae(t){let e={};for(let[r,n]of Object.entries(t))typeof n=="string"&&n.length>0&&(e[r]=n);return e}var At={darwin:"macOS",linux:"Linux",win32:"Windows"};function ce(t){return At[t]??t}function de(t,e){let r={},n=(i,o)=>{o!==void 0&&o!==""&&(r[i]=o)};return n("model",e.model),n("os",t.os),n("browser",t.browser),n("browser_version",t.browser_version),n("resolution",t.resolution),n("platform",e.platform),n("platform_type",e.platform_type),n("run_kind",e.run_kind),n("os_version",t.os_version),t.device!==void 0&&t.device!==""?r.device=t.device:e.platform_type&&e.platform_type!=="web"&&(r.device=null),r}function Ft(t,e){return{pack_test_dir:t,ordinal_offset:e}}import{promises as _}from"fs";import{join as I}from"path";function ue(t){let e={evidence:"0.1",run_id:t.execution_id,status:"running",title:t.title,started:t.started,environment:{producer:{name:"kane-cli",version:t.producerVersion},...t.surfaces?{surfaces:t.surfaces}:{},run_kind:t.run_kind,origin:t.origin,pid:t.pid},...t.credits!==void 0?{metrics:{credits:{value:t.credits,type:"count"}}}:{}};return y(e,{lineWidth:-1})}async function le(t,e,r,n=process.cwd(),i){let o=i??w(t.execution_id,n),a=I(o,"tests",e);return await _.mkdir(I(o,"coverage"),{recursive:!0}),await _.writeFile(I(o,"coverage",".keep"),""),await _.mkdir(a,{recursive:!0}),await _.writeFile(I(o,"run.yaml"),ue(t)),r&&await _.writeFile(I(a,r.path),r.content),o}async function Lt(t,e=process.cwd()){let r=w(t.execution_id,e);await _.mkdir(I(r,"coverage"),{recursive:!0}),await _.writeFile(I(r,"coverage",".keep"),"");let n=R(ue(t));return n.environment&&delete n.environment.run_kind,await _.writeFile(I(r,"run.yaml"),y(n,{lineWidth:-1})),r}async function jt(t,e=process.cwd()){return L(w(t,e),new Date().toISOString())}async function pe(t,e=process.cwd()){await _.rm(w(t,e),{recursive:!0,force:!0})}import{promises as fe}from"fs";import{join as me}from"path";function ge(t){let e={evidence:"0.1",test:t.testId,status:t.status,...t.durationMs!==void 0?{duration_ms:t.durationMs}:{},...t.definitionPath?{definition:{path:t.definitionPath}}:{},...t.definitionId?{definition_id:t.definitionId}:{},...t.assuranceId?{assurance_id:t.assuranceId}:{},...Object.keys(t.externalId).length?{external_id:t.externalId}:{},...t.tags&&t.tags.length?{tags:t.tags}:{},...Object.keys(t.environment).length?{environment:t.environment}:{},steps:t.steps};return y(e,{lineWidth:-1})}function ve(t){return y({logs:t},{lineWidth:-1})}async function he(t,e,r){await fe.writeFile(me(t,"tests",e,"result.yaml"),r)}async function we(t,e,r){let n=me(t,"tests",e,"logs");await fe.mkdir(n,{recursive:!0}),await fe.writeFile(me(n,"meta.yaml"),r)}import{promises as K}from"fs";import{join as tt}from"path";function rt(t){return tt(t,".internal","meta.json")}async function nt(t){let e;try{e=await K.readFile(rt(t),"utf8")}catch(n){if(n?.code==="ENOENT")return null;throw n}let r=JSON.parse(e);if(!r||typeof r!="object"||Array.isArray(r))throw new Error("meta.json is not a JSON object");return r}async function ye(t,e){let r;try{r=await nt(t)??{}}catch(a){console.warn(`evidence: meta.json at ${t} unreadable \u2014 skipping execution-pointer append to preserve identity`,a);return}let n=Array.isArray(r.executions)?r.executions:[];n.push(e),r.executions=n,await K.mkdir(tt(t,".internal"),{recursive:!0});let i=rt(t),o=`${i}.tmp-${process.pid}-${Date.now()}`;await K.writeFile(o,JSON.stringify(r,null,2)+`
|
|
3
3
|
`),await K.rename(o,i)}async function Tt(t){try{let e=await nt(t);return e&&Array.isArray(e.executions)?e.executions:[]}catch{return[]}}async function Nt(t,e,r=process.cwd()){let n=await q(t,r);if(!n){let o=`evidence: no pack found for "${t}"`;return e.json?console.log(JSON.stringify({valid:!1,error:"not_found",target:t})):console.error(o),2}let i=await F(n,e.profile??"L1");return e.json?console.log(JSON.stringify({valid:i.valid,status:i.status,diagnostics:i.diagnostics})):console.log(`evidence: ${i.valid?"valid":"INVALID"} (${e.profile??"L1"}, status ${i.status})`),i.valid?0:1}function _e(t){let e=[];for(let r of t){let n=r.perFlow&&r.perFlow.length?r.perFlow.map(i=>i.resultCode):[r.resultCode];for(let i of n)e.push($(i))}return re(e)}function Vt(t){let e=null;for(let r of t){let n=r.perFlow&&r.perFlow.length?r.perFlow.map(i=>i.resultCode):[r.resultCode];for(let i of n)i!=null&&(e==null||C[$(i)]>C[$(e)]||C[$(i)]===C[$(e)]&&i>e)&&(e=i)}return e}import{promises as Mt}from"fs";import{extname as it,basename as Bt}from"path";var Ht={".ndjson":"ndjson",".log":"log",".json":"json",".har":"har"};async function xe(t){let e;try{e=await Mt.readdir(t)}catch{return[]}return e.filter(r=>r!=="meta.yaml").sort().map(r=>({name:Bt(r,it(r)),file:r,format:Ht[it(r)]??"txt"}))}import{mkdirSync as zt,appendFileSync as Ut}from"fs";import{join as ot}from"path";function ke(t,e){return ot(t,"tests",e,"logs")}function be(t,e,r,n={},i){try{i?.(e,r,r,n)}catch{}if(t)try{zt(t,{recursive:!0});let o=JSON.stringify({ts:new Date().toISOString(),level:e,event:r,...n})+`
|
|
4
4
|
`;Ut(ot(t,"diagnostics.ndjson"),o)}catch{}}import{promises as E}from"fs";import{join as O}from"path";async function Yt(t){try{let e=O(t,"tests"),r=await E.readdir(e).catch(()=>[]);for(let n of r){let i=O(e,n,"steps"),o=await E.readdir(i).catch(()=>[]);for(let a of o){let s=await E.readFile(O(i,a,"failure.yaml"),"utf8").catch(()=>null);if(s!=null)try{let c=R(s);if(c&&typeof c=="object"&&c.triage)return!0}catch{}}}}catch{}return!1}async function st(t,e,r){let n=O(t,"tests",e,"logs");if(r)try{await E.mkdir(n,{recursive:!0}),await E.copyFile(r,O(n,"tui.log"))}catch{}let i=await xe(n);i.length&&await we(t,e,ve(i))}async function Ie(t){let e=t.cwd??process.cwd(),r=t.packDir??w(t.executionId,e);if(!t.saved&&!t.packDir)return await pe(t.executionId,e),{sealed:!1};await st(r,t.testId,t.tuiLogPath);let n=O(r,"run.yaml"),i=R(await E.readFile(n,"utf8"));i.environment={...i.environment??{},saved:t.saved,run_kind:t.runKind},await E.writeFile(n,y(i,{lineWidth:-1}));let o=await E.open(n,"r+");try{await o.sync()}finally{await o.close()}let a=await Yt(r);await L(r,new Date().toISOString());let s;try{let d=await F(r,"L1");s=d.valid;let p=(d.diagnostics??[]).filter(u=>String(u?.code??"").includes("failure.status_disagrees"));if(p.length>0)if(t.expectStatusDisagrees||a){let u=t.expectStatusDisagrees?"expected under --bug-detection continue":"self-explained by triaged failure record(s)";console.warn(`evidence: ${p.length} status_disagrees advisory(ies) \u2014 ${u}`)}else console.warn(`evidence: ${p.length} status_disagrees advisory(ies) \u2014 step verdicts disagree with their failure records`,p);if(!d.valid){console.warn(`evidence: sealed pack ${t.executionId} failed L1 validation`,d.diagnostics);let u=String(d.diagnostics?.[0]?.code??"");be(ke(r,t.testId),"warn","EVIDENCE_INVALID",{execution_id:t.executionId,first_code:u,surface:t.surface??"testmd"},t.log)}}catch(d){console.warn(`evidence: validation error for ${t.executionId}`,d)}let c;if(t.saved&&t.packDir)try{c=await Ge(r,t.executionId,e)}catch(d){console.warn(`evidence: store install failed for ${t.executionId}`,d)}if(t.outputStemDir)try{await ye(t.outputStemDir,{execution_id:t.executionId,run_kind:t.runKind,status:t.verdict,valid:s,at:new Date().toISOString()})}catch(d){console.warn(`evidence: execution-pointer append failed for ${t.executionId} (pack is sealed)`,d)}return{sealed:!0,valid:s,storePath:c}}import{release as at}from"os";import{execFileSync as Gt}from"child_process";var ct=!1,W;function Kt(){if(!ct)if(ct=!0,process.platform==="darwin")try{W=Gt("sw_vers",["-productVersion"],{timeout:2e3}).toString().trim()||void 0}catch{W=at()||void 0}else W=at()||void 0;return W}function Ee(t){let e={os:ce(process.platform)},r=Kt();if(r&&(e.os_version=r),t.cdpBrowser){let n=/^([A-Za-z]+)\/(\d+)/.exec(t.cdpBrowser);n&&(e.browser=n[1].replace(/^Headless/,""),e.browser_version=n[2])}return t.resolution&&(e.resolution=t.resolution),e}async function dt(t){if(t)try{let e=await fetch(`${t}/json/version`,{signal:AbortSignal.timeout(2e3)});if(!e.ok)return;let r=await e.json();return typeof r.Browser=="string"?r.Browser:void 0}catch{return}}function Wt(t){let e;return()=>(e||(e=dt(t)),e)}import{promises as Se,existsSync as Re,readFileSync as Qt}from"fs";import{basename as qt,join as S}from"path";import{readFileSync as Jt}from"fs";import{dirname as Xt,resolve as Zt}from"path";function ut(t,e){let r=Zt(t),n=Jt(r,"utf8");return P(e?j(n,H(Xt(r),e)):n)}var T=class t{constructor(e){this.opts=e}executionId;testId;definitionPath=null;definitionContent=null;accumulatedSteps=[];maxOrdinal=0;_packDirOverride;_attached=!1;get attached(){return this._attached}static async attach(e){let r=qt(e.packDir).replace(/\.evidence$/,""),n=new t({origin:"testrun",runKind:"author",pid:process.pid,title:e.testId,started:new Date().toISOString(),producerVersion:ze,cwd:e.cwd});n.executionId=r,n.testId=e.testId,n._packDirOverride=e.packDir,n._attached=!0;let i=S(e.packDir,"tests",e.testId);return await Se.mkdir(i,{recursive:!0}),e.definition&&(await Se.writeFile(S(i,e.definition.path),e.definition.content),n.definitionPath=e.definition.path,n.definitionContent=e.definition.content),n}async start(){if(this._attached)throw new Error("attach-mode session is already started");this.executionId=Q(),this.testId=this.opts.testmdRelPath?oe(this.opts.testmdRelPath):se(this.opts.objectiveOrName??"session",this.opts.sessionId??this.executionId);let e=this.opts.definition??null;return await le({execution_id:this.executionId,title:this.opts.title,started:this.opts.started,producerVersion:this.opts.producerVersion,surfaces:this.opts.surfaces,run_kind:this.opts.runKind,origin:this.opts.origin,pid:this.opts.pid,...this.opts.credits!==void 0?{credits:this.opts.credits}:{}},this.testId,e,this.opts.cwd,this.opts.packRootDir?this.pack:void 0),e&&(this.definitionPath=e.path,this.definitionContent=e.content),{executionId:this.executionId,testId:this.testId,packTestDir:this.packTestDir}}get pack(){return this._packDirOverride?this._packDirOverride:this.opts.packRootDir?S(this.opts.packRootDir,`${this.executionId}.evidence`):w(this.executionId,this.opts.cwd)}get packTestDir(){return S(this.pack,"tests",this.testId)}async writeDefinition(e,r="test.md"){await Se.writeFile(S(this.packTestDir,r),e),this.definitionPath=r,this.definitionContent=e}computeAssuranceId(){try{if(this.opts.testmdRelPath&&this.opts.cwd){let e=S(this.opts.cwd,this.opts.testmdRelPath);if(Re(e))return D(Qt(e,"utf8"))?.id}}catch{}}computeDefinitionId(){try{if(this.opts.testmdRelPath&&this.opts.cwd){let e=S(this.opts.cwd,this.opts.testmdRelPath),r=S(this.opts.cwd,".context"),n=Re(r)?b(r):void 0;if(Re(e))return ut(e,n)}if(this.definitionContent!=null)return P(this.definitionContent)}catch{}}noteSpawn(e){this.accumulatedSteps.push(...e.steps),this.maxOrdinal=Math.max(this.maxOrdinal,e.maxOrdinal)}nextOrdinalOffset(){return this.maxOrdinal}get steps(){return this.accumulatedSteps}async writeResult(e){let r=_e(e.spawns),n=this.pack;await he(n,this.testId,ge({testId:this.testId,status:r,durationMs:e.durationMs,definitionPath:this.definitionPath,definitionId:this.computeDefinitionId(),assuranceId:this.computeAssuranceId(),externalId:ae(e.externalIdInput),environment:de(e.runnerEnv,e.intentEnv),steps:e.steps,tags:e.tags}));let i=e.externalIdInput;return e.log&&(i.commit_id||i.test_id||i.testcase_id)&&e.log("info","EVIDENCE_EXTERNAL_ID","Evidence external-id mapping",{execution_id:this.executionId,commit_id:i.commit_id??null,test_id:i.test_id??null,testcase_id:i.testcase_id??null,project_id:i.project_id??null,session_id:i.session_id??null,session_name:i.session_name??null}),r}get id(){return this.executionId}get test(){return this.testId}};async function er(t,e,r=ee){try{let n=await r(t);if(n.aborted.length>0||n.removed.length>0)try{e?.("info","EVIDENCE_RECOVERY","Startup evidence recovery swept incomplete packs",{aborted:n.aborted,removed:n.removed,origin:"startup"})}catch{}return n}catch(n){return console.warn("evidence: startup recovery failed",n),{aborted:[],removed:[]}}}import{promises as _r}from"fs";import{existsSync as $e,mkdirSync as fr,readdirSync as mr,readFileSync as gr,rmSync as vr,statSync as hr,writeFileSync as wr}from"fs";import{join as A}from"path";import{mkdirSync as tr,renameSync as rr,rmSync as nr,writeFileSync as ir}from"fs";import{join as lt}from"path";var or=5e6;function pt(t,e,r){let n=lt(t,"coverage","sources"),i=new Map,o=!1;try{for(let a of r.usecases)for(let s of a.sources){if(i.has(s.id)){s.file=i.get(s.id);continue}if(!s.cid)continue;let c=et(e,s.cid);if(c===null||c.byteLength>or)continue;o||(tr(n,{recursive:!0}),o=!0);let d=lt(n,s.id),l=`${d}.tmp-${process.pid}`;ir(l,c),rr(l,d);let p=`coverage/sources/${s.id}`;i.set(s.id,p),s.file=p}}catch{for(let a of r.usecases)for(let s of a.sources)delete s.file;if(o)try{nr(n,{recursive:!0,force:!0})}catch{}}}import{existsSync as Ce,readFileSync as N,renameSync as cr,writeFileSync as dr}from"fs";import{dirname as ht,isAbsolute as wt,resolve as yt}from"path";var sr=new Set(["inline","testmd","testrun"]),ar=new Set(["inferred","authored","runtime-derived"]),Pe=new Set(["passed","failed","broken","skipped"]);function ft(t,e,r){let n=[];if(r.facts.length===0)return{record:null,errors:[{code:"EMPTY_EXECUTIONS",detail:"a run with no designed units attaches no facts \u2014 skip the call"}]};let i=z(t);if(e.latestHash!==i)return{record:null,errors:[{code:"STALE_BASIS",detail:`graph opened at ${String(e.latestHash)} but chain head is ${String(i)} \u2014 re-open and retry`}]};let o=[];for(let s of r.facts){let c=`executions[${s.ref}]`,d=e.resolve(s.ref),l=d?e.tipOf(d.cid):null;if(!d||!l||e.superseded.has(l)){n.push({code:"UNKNOWN_REF",detail:`${c}: '${s.ref}' is not a live committed node`});continue}if(e.nodeLabel.get(l)!==te.TEST){n.push({code:"ILLEGAL_TARGET",detail:`${c}: execution facts attach to tests \u2014 '${s.ref}' is a ${e.nodeLabel.get(l)}`});continue}if(!sr.has(s.mode)){n.push({code:"BAD_MODE",detail:`${c}: mode '${s.mode}' not in inline|testmd|testrun`});continue}if(!Pe.has(s.verdict)){n.push({code:"BAD_VERDICT",detail:`${c}: verdict '${s.verdict}' not in ${[...Pe].join("|")}`});continue}if(!ar.has(s.oracle_mode)){n.push({code:"BAD_ORACLE_MODE",detail:`${c}: oracle_mode '${s.oracle_mode}' not in inferred|authored|runtime-derived`});continue}if(typeof s.drift_flag!="boolean"||typeof s.stale_at_run!="boolean"){n.push({code:"MISSING_FIELD",detail:`${c}: drift_flag and stale_at_run are required booleans`});continue}if(!s.execution_id||!s.started_at||!s.definition_id_at_run){n.push({code:"MISSING_FIELD",detail:`${c}: execution_id, started_at and definition_id_at_run are required`});continue}let p=[];for(let u of s.per_ac??[]){let m=e.resolve(u.ac_ref),f=m?e.tipOf(m.cid):null;if(!m||!f||e.superseded.has(f)||e.nodeLabel.get(f)!==te.AC){n.push({code:"UNKNOWN_REF",detail:`${c}.per_ac: '${u.ac_ref}' is not a live AC`});continue}if(!Pe.has(u.verdict)){n.push({code:"BAD_VERDICT",detail:`${c}.per_ac['${u.ac_ref}']: verdict '${u.verdict}'`});continue}p.push({ac_ref:e.nameOf.get(f)??f,verdict:u.verdict})}o.push({about:l,definition_id_at_run:s.definition_id_at_run,verdict:s.verdict,...p.length?{per_ac:p}:{},drift_flag:s.drift_flag,oracle_mode:s.oracle_mode,stale_at_run:s.stale_at_run,...s.unresolved_acs?.length?{unresolved_acs:s.unresolved_acs}:{},execution_id:s.execution_id,...s.evidence_id?{evidence_id:s.evidence_id}:{},...s.duration_ms!==void 0?{duration_ms:s.duration_ms}:{},started_at:s.started_at,mode:s.mode,local:s.local,...s.via_parent?{via_parent:s.via_parent}:{}})}if(n.length>0)return{record:null,errors:n};let a=U(t,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[],executions:o,source_head_moves:{}});return Y(t),{record:a.record,errors:null}}function _t(t){let e={failed:3,broken:2,skipped:1,passed:0},r=new Map;for(let n of t)for(let i of n.verifies??[]){let o=r.get(i);(o===void 0||(e[n.status]??0)>(e[o]??0))&&r.set(i,n.status)}return[...r.entries()].map(([n,i])=>({ref:n,verdict:i}))}function xt(t){let e=[],r=G(t.cwd);if(!Ce(r))return{synced:0,superseded:0,skipped:"no-context",warnings:e};let n=t.by??{kind:"ai",id:"exec-sync"},i=b(r),o=[],a=0,s=new Set;for(let d of t.members){let l=wt(d.path)?d.path:yt(t.cwd,d.path);for(let p of ur(l)){if(s.has(p.path))continue;s.add(p.path);let u=p.path===l?void 0:D(N(l,"utf8"))?.id,m=N(p.path,"utf8"),f=D(m);if(!f?.id)continue;let g=i.resolve(f.id),x=g?i.tipOf(g.cid):null;if(!g||!x||i.superseded.has(x)){e.push(`sync: ${f.id} does not resolve to a live test \u2014 skipped (foreign store?)`);continue}let k=P(j(m,H(ht(p.path),i))),v=String(i.getNode(x)?.content.test_md_blob??""),M=P(j(v,We(i))),B=!1,Z=x;if(k===M)f.base!==M&&vt(p.path,m,M,e);else if(f.base===M){let h=lr(r,i,x,m,k,n);h.error?(e.push(`sync: could not supersede ${f.id}: ${h.error}`),B=!0):(a++,Z=h.newCid,B=h.oracleTier,vt(p.path,N(p.path,"utf8"),k,e),i=b(r))}else B=!0,e.push(f.base?`sync: ${f.id} was edited from an older version \u2014 graph kept; reconcile via a redesign or maintain`:`sync: ${f.id} carries no base pin (hand-copied file?) \u2014 fact attached with drift flag`);let Ve=i.getNode(Z)?.content.check,Me=p.path===l?d.acs??[]:[],Be=Me.filter(h=>mt(i,h.ref)),He=Me.filter(h=>!mt(i,h.ref)).map(h=>h.ref);o.push({ref:f.id,definition_id_at_run:k,verdict:d.verdict,...Be.length?{per_ac:Be.map(h=>({ac_ref:h.ref,verdict:h.verdict}))}:{},drift_flag:B,oracle_mode:Ve?.expected_mode??(Ke(Ve?.operand)?"runtime-derived":"inferred"),stale_at_run:i.stale(Z)!=="fresh",...He.length?{unresolved_acs:He}:{},execution_id:d.executionId,...d.evidenceId?{evidence_id:d.evidenceId}:{},...d.durationMs!==void 0?{duration_ms:d.durationMs}:{},started_at:d.startedAt,mode:d.mode,local:d.local,...u?{via_parent:u}:{}})}}if(o.length===0)return{synced:0,superseded:a,warnings:e};let c=ft(r,b(r),{facts:o,by:n});return c.errors?(e.push(...c.errors.map(d=>`sync facts: ${d.code}: ${d.detail}`)),{synced:0,superseded:a,warnings:e}):{synced:o.length,superseded:a,warnings:e}}function ur(t){let e=[],r=new Set,n=i=>{if(r.has(i)||!Ce(i))return;r.add(i);let o=N(i,"utf8");for(let a of o.split(`
|
|
5
5
|
`)){let s=/^@import\s+(\S+)\s*$/.exec(a.trim());if(!s)continue;let c=wt(s[1])?s[1]:yt(ht(i),s[1]);Ce(c)&&D(N(c,"utf8"))?.id&&n(c)}e.push({path:i})};return n(t),e}function mt(t,e){let r=t.resolve(e),n=r?t.tipOf(r.cid):null;return!!(r&&n&&!t.superseded.has(n)&&t.nodeLabel.get(n)==="ac")}function lr(t,e,r,n,i,o){let a=e.getNode(r);if(!a)return{oracleTier:!1,error:"tip unreadable"};let s=Je(n),c=String(a.content.test_md_blob??""),d=/^#\s+(.+?)\s*$/m.exec(s)?.[1]??String(a.content.title??""),l={...a.content,test_md_blob:s,definitionId:i,title:d},p=Xe("test",l);if(p.length>0)return{oracleTier:!1,error:p.map(g=>g.detail).join("; ")};let u=Ze("test",l);if(u===r)return{newCid:r,oracleTier:!1};let m=gt(c)!==gt(s),f=z(t);if(e.latestHash!==f)return{oracleTier:m,error:`store advanced under the sync (basis ${String(e.latestHash)} vs head ${String(f)}) \u2014 re-run to retry`};try{U(t,{ts:new Date().toISOString(),proposal_id:null,nodes:[{cid:u,label:"test",content:l}],edges:[],review:[{id:u,kind:"review-item",resolution:"edited",edit:null,reason:"edited on disk (run sync)",by:o}],supersessions:[{kind:"node",old:r,new:u,reason:"edited on disk (run sync)",by:o}],source_head_moves:{}},{expectPrev:f})}catch(g){return{oracleTier:m,error:g instanceof Error?g.message:String(g)}}return Y(t),{newCid:u,oracleTier:m}}var pr=/\s@verifies\s+(ac-[\w.:\/-]+(?:\s*,\s*ac-[\w.:\/-]+)*)\s*$/;function gt(t){let e=[],r=t.split(`
|
|
@@ -8,6 +8,6 @@ import{d as Qe,g as qe}from"./chunk-FCMLIK7P.js";import{b as w,c as Q,d as Ge,f
|
|
|
8
8
|
`),o=-1;if(i[0]?.trim()==="---"){for(let c=1;c<i.length;c++)if(i[c].trim()==="---"){o=c;break}}if(o<0)return;let a=!1;for(let c=1;c<o;c++){if(/^\s+base:\s*sha256:[0-9a-f]+\s*$/.test(i[c])){i[c]=i[c].replace(/sha256:[0-9a-f]+/,r),a=!0;break}if(/^assurance:\s*$/.test(i[c])&&!i.slice(c,Math.min(c+3,o)).some(d=>/^\s+base:/.test(d))){i.splice(c+2,0,` base: ${r}`),a=!0;break}}if(!a)return;let s=`${t}.tmp-sync`;dr(s,i.join(`
|
|
9
9
|
`)),cr(s,t)}catch(i){n.push(`sync: pin refresh failed for ${t} (${i instanceof Error?i.message:String(i)}) \u2014 next run self-heals`)}}var yr={passed:"passed",failed:"failed",broken:"blocked",skipped:"not-run"},kt=(t,e)=>{try{if(!$e(e))return{status:"skipped",reason:"no context store at the project root"};let r=A(t,"tests");if(!$e(r))return{status:"skipped",reason:"pack has no tests/"};let n=new Map;for(let s of mr(r)){let c=A(r,s,"result.yaml");if(!$e(c)||!hr(A(r,s)).isDirectory())continue;let d=R(gr(c,"utf8"));if(!d?.definition_id&&!d?.assurance_id)continue;let l=_t(d.steps??[]),p={testShortId:String(d.test??s),execution:yr[String(d.status)]??"not-run",...l.length?{acs:l}:{}};d.assurance_id&&n.set(`id:${d.assurance_id}`,p),d.definition_id&&n.set(`def:${d.definition_id}`,p)}let i=qe(b(e),n,{scope:"run"}),o=Qe(i);pt(t,e,i);let a=y({...i,rollup:o},{lineWidth:-1});return fr(A(t,"coverage"),{recursive:!0}),wr(A(t,"coverage","usecases.yaml"),a),{status:"written"}}catch(r){try{vr(A(t,"coverage","sources"),{recursive:!0,force:!0})}catch{}return{status:"skipped",reason:r instanceof Error?r.message:String(r)}}};async function xr(t){try{let e=new T({origin:"inline",runKind:"author",pid:t.pid,title:t.title,started:new Date().toISOString(),producerVersion:t.producerVersion,surfaces:t.surfaces,objectiveOrName:t.objectiveOrName,sessionId:t.sessionId,cwd:t.cwd,packRootDir:t.packRootDir}),r=await e.start();return{session:e,...r,packDir:e.pack,spawns:[],startedAtMs:Date.now(),cwd:t.cwd}}catch(e){return console.warn("evidence: inline pack creation failed",e),null}}function kr(t,e,r){if(!t)return;t.session.noteSpawn(e),e.resolution&&(t.resolution=e.resolution);let n=(r?.per_flow_metadata??[]).map(i=>({resultCode:i?.result_code!=null?Number(i.result_code):null}));t.spawns.push({resultCode:r?.result_code!=null?Number(r.result_code):null,...n.length?{perFlow:n}:{}})}function br(t){if(t)return{packTestDir:t.packTestDir,ordinalOffset:t.session.nextOrdinalOffset()}}async function Ir(t,e){if(!t)return null;if(t.finalized)return t.finalized;let r=(n,i,o)=>e.log?e.log("warn",n,i,o):console.warn(`evidence: ${i}`,o??"");try{if(e.recordedTestPath)try{await t.session.writeDefinition(await _r.readFile(e.recordedTestPath,"utf8"))}catch(a){r("EVIDENCE_DEFINITION_FAILED","could not attach synthesized test.md",{error:String(a)})}let n=e.cdpBrowserCapture?await e.cdpBrowserCapture():void 0,i=await t.session.writeResult({steps:t.session.steps,spawns:t.spawns.length?t.spawns:[{resultCode:null}],externalIdInput:{...e.externalIdInput,execution_id:t.executionId},runnerEnv:Ee({cdpBrowser:n,resolution:t.resolution}),intentEnv:{model:e.model,platform:"Desktop",platform_type:"web"},durationMs:e.durationMs??Date.now()-t.startedAtMs,log:e.log});try{if(e.recordedTestPath){let a=xt({cwd:e.cwd??t.cwd??process.cwd(),members:[{path:e.recordedTestPath,verdict:i,executionId:t.executionId,startedAt:new Date(t.startedAtMs).toISOString(),mode:"inline",local:e.local??!1}]});for(let s of a.warnings)r("EXEC_SYNC",s)}}catch(a){r("EXEC_SYNC","exec-sync failed",{error:String(a)})}try{let a=(e.coverageWriter??kt)(t.packDir,G(e.cwd??t.cwd??process.cwd()));a.status==="skipped"&&r("EVIDENCE_COVERAGE_SKIPPED",`coverage/usecases.yaml not written: ${a.reason}`)}catch(a){r("EVIDENCE_COVERAGE_SKIPPED","coverage writer threw",{error:String(a)})}let o=await Ie({executionId:t.executionId,testId:t.testId,saved:e.saved,runKind:"author",verdict:i,cwd:e.cwd??t.cwd,packDir:t.packDir,tuiLogPath:e.tuiLogPath,log:e.log,surface:"inline"});return t.finalized=o,e.log?.("info","EVIDENCE_SEALED","Inline pack sealed",{execution_id:t.executionId,verdict:i,valid:o.valid,pack:t.packDir,store_copy:o.storePath??null}),o}catch(n){return r("EVIDENCE_SEAL_FAILED","inline pack finalize failed",{error:String(n)}),null}}import{statSync as $r,openSync as Dr,readSync as Or,closeSync as Ar}from"fs";import{basename as Fr,resolve as Lr}from"path";import{createServer as Er}from"http";import{createReadStream as Sr,promises as Rr}from"fs";import{randomBytes as Pr}from"crypto";var J="127.0.0.1";function bt(t,e){if(!t)return null;let r=/^bytes=(\d*)-(\d*)$/.exec(t.trim());if(!r)return null;let[,n,i]=r;if(n===""&&i==="")return null;if(n===""){let s=Number(i);return s===0||e===0?"unsatisfiable":{start:Math.max(0,e-s),end:e-1}}let o=Number(n);if(o>=e)return"unsatisfiable";let a=i===""?e-1:Math.min(Number(i),e-1);return a<o?null:{start:o,end:a}}async function De(t){let e=Pr(16).toString("hex"),r=Er((i,o)=>{Cr(i,o,t,e).catch(()=>o.destroy())});await new Promise((i,o)=>{r.once("error",o),r.listen(t.port??0,J,()=>{r.removeListener("error",o),i()})});let n=r.address().port;return{port:n,urlFor:i=>`http://${J}:${n}/${e}/${encodeURIComponent(i)}`,close:()=>new Promise(i=>{r.close(()=>i()),r.closeAllConnections()})}}async function Cr(t,e,r,n){let i=t.url??"/",o=v=>{try{r.log?.("warn","EVIDENCE_SERVE_DENIED",{reason:v,path:i})}catch{}};if(t.headers.host!==`${J}:${t.socket.localPort}`){o("host_mismatch"),e.writeHead(403).end();return}let a=t.headers.origin;if(a!==void 0&&!r.allowedOrigins.includes(a)){o("origin_denied"),e.writeHead(403).end();return}let s=a?{"Access-Control-Allow-Origin":a,Vary:"Origin","Access-Control-Expose-Headers":"Content-Range, Content-Length"}:{};if(t.method==="OPTIONS"){let v={...s,"Access-Control-Allow-Methods":"GET, HEAD, OPTIONS","Access-Control-Allow-Headers":"range","Access-Control-Max-Age":"86400"};t.headers["access-control-request-private-network"]==="true"&&(v["Access-Control-Allow-Private-Network"]="true"),e.writeHead(204,v).end();return}if(t.method!=="GET"&&t.method!=="HEAD"){e.writeHead(405,s).end();return}let c;try{let v=new URL(t.url??"/",`http://${J}`).pathname.split("/");if(v.length!==3||v[1]!==n){o("bad_token"),e.writeHead(404,s).end();return}c=decodeURIComponent(v[2])}catch{o("not_found"),e.writeHead(404,s).end();return}let d=r.packs.get(c);if(!d){o("not_found"),e.writeHead(404,s).end();return}let l;try{let v=await Rr.stat(d);if(!v.isFile())throw new Error("not a file");l=v.size}catch{o("not_found"),e.writeHead(404,s).end();return}let p={...s,"Accept-Ranges":"bytes","Content-Type":"application/zip","Cache-Control":"no-store"};if(t.method==="HEAD"){e.writeHead(200,{...p,"Content-Length":String(l)}).end();return}let u=bt(t.headers.range,l);if(u==="unsatisfiable"){o("unsatisfiable"),e.writeHead(416,{...s,"Content-Range":`bytes */${l}`}).end();return}let[m,f,g]=u===null?[0,l-1,200]:[u.start,u.end,206],x={...p,"Content-Length":String(f-m+1)};if(g===206&&(x["Content-Range"]=`bytes ${m}-${f}/${l}`),e.writeHead(g,x),l===0){e.end();return}let k=Sr(d,{start:m,end:f});k.on("error",()=>e.destroy()),e.on("close",()=>k.destroy()),k.pipe(e)}function V(t,e){return(e??Ue(t).evidenceViewerUrl).replace(/\/+$/,"")}function Oe(t,e){return`${e}/?pack=${encodeURIComponent(t)}`}function Ae(t){return`evidence: view locally with \`kane-cli evidence serve ${t}\``}async function jr(t,e,r={}){let n=r.out??(l=>process.stdout.write(l+`
|
|
10
10
|
`)),i=l=>(n(`error: ${l}`),2);if(e.env!=="prod"&&e.env!=="stage")return i(`invalid --env: ${String(e.env)}`);if(e.port!==void 0&&(!Number.isInteger(e.port)||e.port<1||e.port>65535))return i("invalid --port: expected an integer 1-65535");let o;try{o=V(e.env,e.viewerUrl),new URL(o)}catch{return i(`invalid --viewer-url: ${e.viewerUrl}`)}if(t.length===0)return i("no pack paths given");let a=new Map;for(let l of t){let p=Lr(l),u;try{u=$r(p)}catch{return i(`${l}: not found`)}if(u.isDirectory())return i(`${l}: is a directory \u2014 packs must be sealed .evidence files (run the execution to completion, or seal it, first)`);if(!u.isFile())return i(`${l}: not a regular file`);let m=Buffer.alloc(2),f=Dr(p,"r");try{Or(f,m,0,2,0)}finally{Ar(f)}if(m.toString("latin1")!=="PK")return i(`${l}: not a sealed evidence pack (zip magic missing)`);let g=Fr(p);if(a.has(g))return i(`duplicate pack basename: ${g} (URL names collide \u2014 rename one)`);a.set(g,p)}let s=r.log??((l,p,u)=>process.stderr.write(`warn: ${p} reason=${u.reason} path=${u.path}
|
|
11
|
-
`)),c;try{c=await De({packs:a,allowedOrigins:[new URL(o).origin],port:e.port,log:s})}catch(l){return i(`could not bind 127.0.0.1${e.port?`:${e.port}`:""} \u2014 ${l.message}`)}n(`serving ${a.size} pack${a.size===1?"":"s"} on http://127.0.0.1:${c.port}`);for(let l of a.keys()){let p=c.urlFor(l);n(l),n(` pack ${p}`),n(` viewer ${Oe(p,o)}`)}return n("press Ctrl-C to stop"),await(r.hold??Tr)(),await c.close(),0}function Tr(){return new Promise(t=>{let e=process.listeners("SIGINT");process.removeAllListeners("SIGINT"),process.once("SIGINT",()=>{for(let r of e)process.on("SIGINT",r);t()})})}import{promises as X}from"fs";import{tmpdir as Br}from"os";import{join as St,resolve as Le}from"path";var Nr=["error","prefer_first","prefer_latest","discard"],Vr=["external_id.commit_id","external_id.test_id"];function It(t){let e=t.replace(/-/g,"_");return Nr.includes(e)?e:null}function Et(t){let e=t==="discard"?{on_collision:"discard"}:{on_collision:"error",identity:{keys:[...Vr],on_same:t??"nest",on_different:t?"error":"split"}};return y({packs:{require_status:"finalized",require_valid:"L1",on_ineligible:"abort"},tests:e,rules:[{file:"run.yaml",key:"run_id",must:"different",on_violation:"skip"},{file:"result.yaml",key:"external_id.project_id",must:"same",on_violation:"error"},{file:"result.yaml",key:"external_id.org_id",must:"same",on_violation:"error"}]},{lineWidth:-1})}async function Fe(t){try{if(!t.isTTY){t.log(Ae(t.packPath));return}let e=V(t.env);await(t.renderPrompt??Mr)(t.packPath,e)}catch(e){try{t.log(`evidence view failed \u2014 ${e.message}`)}catch{}}}async function Mr(t,e){let r=await import("./react-QWOAB3TB.js"),{render:n}=await import("./build-JIKYOZUH.js"),{EvidenceViewOffer:i}=await import("./EvidenceViewOffer-
|
|
11
|
+
`)),c;try{c=await De({packs:a,allowedOrigins:[new URL(o).origin],port:e.port,log:s})}catch(l){return i(`could not bind 127.0.0.1${e.port?`:${e.port}`:""} \u2014 ${l.message}`)}n(`serving ${a.size} pack${a.size===1?"":"s"} on http://127.0.0.1:${c.port}`);for(let l of a.keys()){let p=c.urlFor(l);n(l),n(` pack ${p}`),n(` viewer ${Oe(p,o)}`)}return n("press Ctrl-C to stop"),await(r.hold??Tr)(),await c.close(),0}function Tr(){return new Promise(t=>{let e=process.listeners("SIGINT");process.removeAllListeners("SIGINT"),process.once("SIGINT",()=>{for(let r of e)process.on("SIGINT",r);t()})})}import{promises as X}from"fs";import{tmpdir as Br}from"os";import{join as St,resolve as Le}from"path";var Nr=["error","prefer_first","prefer_latest","discard"],Vr=["external_id.commit_id","external_id.test_id"];function It(t){let e=t.replace(/-/g,"_");return Nr.includes(e)?e:null}function Et(t){let e=t==="discard"?{on_collision:"discard"}:{on_collision:"error",identity:{keys:[...Vr],on_same:t??"nest",on_different:t?"error":"split"}};return y({packs:{require_status:"finalized",require_valid:"L1",on_ineligible:"abort"},tests:e,rules:[{file:"run.yaml",key:"run_id",must:"different",on_violation:"skip"},{file:"result.yaml",key:"external_id.project_id",must:"same",on_violation:"error"},{file:"result.yaml",key:"external_id.org_id",must:"same",on_violation:"error"}]},{lineWidth:-1})}async function Fe(t){try{if(!t.isTTY){t.log(Ae(t.packPath));return}let e=V(t.env);await(t.renderPrompt??Mr)(t.packPath,e)}catch(e){try{t.log(`evidence view failed \u2014 ${e.message}`)}catch{}}}async function Mr(t,e){let r=await import("./react-QWOAB3TB.js"),{render:n}=await import("./build-JIKYOZUH.js"),{EvidenceViewOffer:i}=await import("./EvidenceViewOffer-5TJCRM2T.js");await new Promise(o=>{let a=n(r.default.createElement(i,{packPath:t,viewerBase:e,onDone:()=>{a.unmount(),o()}}),{stdout:process.stderr,exitOnCtrlC:!1})})}async function Hr(t,e,r=process.cwd(),n={}){let i=n.out??(u=>process.stdout.write(u+`
|
|
12
12
|
`)),o=n.err??(u=>process.stderr.write(u+`
|
|
13
13
|
`)),a=u=>(o(`evidence merge: ${u}`),2);if(!e.runId)return a("--run-id is required (merged identity is the caller's fact)");if(e.rules&&e.onCollision)return a("--rules and --on-collision are mutually exclusive");let s;if(e.onCollision!==void 0){let u=It(e.onCollision);if(!u)return a(`invalid --on-collision: ${e.onCollision} (expected error | prefer-first | prefer-latest | discard)`);s=u}let c=[];for(let u of t){let m=await zr(u,r);if(!m)return a(`no pack found for "${u}"`);c.push(m)}let d=e.out?Le(r,e.out):w(e.runId,r),l=null,p;e.rules?p=Le(r,e.rules):(l=await X.mkdtemp(St(Br(),"kane-merge-rules-")),p=St(l,"merge-rules.yaml"),await X.writeFile(p,Et(s)));try{let u=await(n.mergeFn??Ye)(c,{runId:e.runId,out:d,rulesPath:p,title:e.title,finalize:e.finalize});return e.json?i(JSON.stringify(u)):Ur(i,u),u.output.finalized&&!e.json&&await(n.offer??Fe)({packPath:d,env:e.env,isTTY:n.isTTY??(!!process.stdin.isTTY&&!!process.stderr.isTTY),log:o}),0}catch(u){let m=u instanceof Error?u.message:String(u);return u?.code==="ABORT"?(o(`evidence merge: aborted \u2014 ${m}`),1):a(m)}finally{l&&await X.rm(l,{recursive:!0,force:!0}).catch(()=>{})}}async function zr(t,e){let r=Le(e,t);if(await Rt(r))return r;let n=w(t,e);return await Rt(n)?n:null}async function Rt(t){try{return await X.stat(t),!0}catch{return!1}}function Ur(t,e){let{packs:r,tests:n,output:i}=e;t(`evidence: merged ${n.merged} tests from ${r.eligible.length} packs -> ${i.path} (${i.finalized?"sealed":"live"})`);for(let o of r.skipped)t(` skipped ${o.runId}: ${o.rule} \u2014 ${o.reason}`);for(let o of n.collisions){let a;o.action==="nest"?a=`nested into ${o.folder}, latest ${o.winner}`:o.action==="split"?a=`split into ${o.folder}`:a=`winner ${o.winner}`,t(` collision ${o.test}: ${a} (${o.rule})`)}for(let o of n.discarded)t(` discarded ${o}`)}import{copyFileSync as Yr,existsSync as je,mkdirSync as Gr}from"fs";import{join as Pt}from"path";function Kr(t,e,r){try{let n=Pt(t,"auteur","execution.json");if(je(n))return!0;for(let i of e)if(!(!i||!je(i)))return Gr(Pt(t,"auteur"),{recursive:!0}),Yr(i,n),!0}catch(n){try{r?.("debug","EVIDENCE_BLOB_COPY_FAILED","auteur execution blob copy failed",{operation:"ensureAuteurExecution",source:e.find(i=>i&&je(i))??null,error:n instanceof Error?n.message:String(n)})}catch{}}return!1}import{readFileSync as Wr}from"fs";import{join as Jr}from"path";function Ne(t){let e=[],r=!0,n=o=>{if(o===null||typeof o!="object")return;let a=o;if(Array.isArray(a.operations))for(let s of a.operations){let c=s?.operation_id;typeof c=="string"&&c&&e.push(c)}if(Array.isArray(a.children)){a.content_type!=="generative_block"&&(r=!1);for(let s of a.children)n(s)}if(Array.isArray(a.branches)){r=!1;for(let s of a.branches){let c=s?.children;if(Array.isArray(c))for(let d of c)n(d)}}},i=t?.instructions;if(Array.isArray(i))for(let o of i)n(o);return{ids:e,linear:r}}function Xr(t){return Ne(t).ids}function Te(t,e){let r=new Set(e.map(s=>s.action_id).filter(Boolean)),n=-1;for(let s of r){let c=t.indexOf(s);c>n&&(n=c)}let i=e.reduce((s,c)=>Math.max(s,c.ordinal),0),o=new Set,a=[];for(let s of t.slice(n+1))r.has(s)||o.has(s)||(o.add(s),a.push({id:s,ordinal:++i,status:"skipped",action_id:s}));return a}function Ct(t,e){let r=new Set(e),n=t.filter(o=>o.action_id);if(n.some(o=>r.has(o.action_id))||n.length>e.length)return null;let i=0;return t.map(o=>o.action_id?{...o,action_id:e[i++]}:o)}function Zr(t,e){if(t.length>e.length)return!1;for(let r=0;r<t.length;r++)if(e[r]!==t[r].action_id)return!1;return!0}function Qr(t,e,r,n=!0){if(e.length===0)return{steps:t,tail:[]};let i=(r&&n?Ct(t,e):null)??t,o=i.filter(s=>s.action_id),a=new Set(e);return o.length>0&&o.every(s=>a.has(s.action_id))?{steps:i,tail:Te(e,i)}:o.length>0&&!Zr(o,e)?{steps:i,tail:[],unjoined:!0}:{steps:i,tail:Te(e,i)}}function $t(t){try{let e=Wr(Jr(t,"auteur","execution.json"),"utf8");return Ne(JSON.parse(e))}catch{return{ids:[],linear:!0}}}function qr(t){return $t(t).ids}export{$ as a,re as b,ne as c,ie as d,oe as e,se as f,ae as g,ce as h,de as i,Ft as j,ue as k,le as l,Lt as m,jt as n,pe as o,ge as p,ve as q,he as r,we as s,ye as t,Tt as u,Nt as v,_e as w,Vt as x,xe as y,ke as z,be as A,st as B,Ie as C,Ee as D,dt as E,Wt as F,T as G,er as H,_t as I,xt as J,kt as K,xr as L,kr as M,br as N,Ir as O,bt as P,De as Q,V as R,Oe as S,Ae as T,jr as U,Fe as V,Hr as W,Kr as X,Ne as Y,Xr as Z,Te as _,Ct as $,Qr as aa,$t as ba,qr as ca};
|