@testmuai/kane-cli 0.6.3 → 0.6.4
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-VXYU6KFW.js +8 -0
- package/dist/{ChromeProfilePicker-UUGUMJPI.js → ChromeProfilePicker-QWTM7DK6.js} +1 -1
- package/dist/{CliFeedbackPrompt-JZWESL7Z.js → CliFeedbackPrompt-6NVWMONO.js} +1 -1
- package/dist/{CliUploadProgress-62U3LAUU.js → CliUploadProgress-2YRQLECI.js} +1 -1
- package/dist/{ConfigView-WHEFCVHR.js → ConfigView-I4R5M7BO.js} +1 -1
- package/dist/EvidenceViewOffer-54GEARRX.js +2 -0
- package/dist/{FolderPicker-HJUUHQEI.js → FolderPicker-5VWBYTAK.js} +1 -1
- package/dist/{HelpView-EWHP7LSJ.js → HelpView-OJZW4XWX.js} +1 -1
- package/dist/{InfoBox-GQQJVTI5.js → InfoBox-TGELGCBR.js} +1 -1
- package/dist/{LinksBox-EWCPAZFN.js → LinksBox-B5EBRY26.js} +1 -1
- package/dist/{ProfilesView-5FJNQMUW.js → ProfilesView-3SJRIBHQ.js} +1 -1
- package/dist/{ProjectPicker-IN7GFN7I.js → ProjectPicker-72HKMBEY.js} +1 -1
- package/dist/{SaveSessionPrompt-ISODGFP7.js → SaveSessionPrompt-CK5SGNRO.js} +1 -1
- package/dist/SingleShotApp-AJBIWW74.js +2 -0
- package/dist/{SummaryBox-R6WHU7VD.js → SummaryBox-ABB7ST26.js} +1 -1
- package/dist/TestMdRunView-5PMLLLFT.js +2 -0
- package/dist/{WhoamiView-YRQNOSOH.js → WhoamiView-OF354UGC.js} +1 -1
- package/dist/bind-BWILBZGR.js +6 -0
- package/dist/{bridge-7UMWMIJJ.js → bridge-LNDJS3HH.js} +1 -1
- package/dist/{changelog-YQC2QDCO.js → changelog-BWCEZQ23.js} +1 -1
- package/dist/{chat-committer-GHDZY5XF.js → chat-committer-ADJJTDUT.js} +1 -1
- package/dist/{chat-controller-QXFAB2DK.js → chat-controller-VAC57IEV.js} +1 -1
- package/dist/{chunk-F66SSA4C.js → chunk-2K4XOHVK.js} +1 -1
- package/dist/{chunk-KHDUQ33H.js → chunk-2PQXEEVY.js} +1 -1
- package/dist/{chunk-NNZV5RCE.js → chunk-3C5GMAM4.js} +1 -1
- package/dist/{chunk-7YQW4TFI.js → chunk-3HEPW6SN.js} +1 -1
- package/dist/{chunk-WFRL54GK.js → chunk-3WJJ43MT.js} +1 -1
- package/dist/{chunk-SL7AJ7JQ.js → chunk-4MUHS3UL.js} +1 -1
- package/dist/{chunk-2TVRHXRK.js → chunk-5CTMOJG4.js} +1 -1
- package/dist/{chunk-OGVIHL5G.js → chunk-5KSB5MOF.js} +1 -1
- package/dist/chunk-5YPBPZUR.js +2 -0
- package/dist/chunk-64LC36AF.js +2 -0
- package/dist/{chunk-CIW2KP4C.js → chunk-64QURIT6.js} +1 -1
- package/dist/{chunk-326XAPMW.js → chunk-652FEDL4.js} +2 -2
- package/dist/{chunk-Z56AWGVY.js → chunk-6AYUSR7X.js} +1 -1
- package/dist/{chunk-VJUIW2ES.js → chunk-6GTOYTCQ.js} +1 -1
- package/dist/chunk-6LRKYF67.js +14 -0
- package/dist/{chunk-AE6SS34N.js → chunk-74RUSHIB.js} +1 -1
- package/dist/chunk-ACEODVSC.js +14 -0
- package/dist/{chunk-FFL2TQEJ.js → chunk-ADOXYGZE.js} +1 -1
- package/dist/chunk-ANIVHX3P.js +5 -0
- package/dist/{chunk-B5LJCGAY.js → chunk-AXABTFCD.js} +1 -1
- package/dist/{chunk-7LFCSSPX.js → chunk-BNN6ZDJW.js} +1 -1
- package/dist/{chunk-TZZYRDCF.js → chunk-BOO7YXAV.js} +1 -1
- package/dist/{chunk-Y6LMHBLE.js → chunk-BYUARJE7.js} +1 -1
- package/dist/{chunk-FYOCF7DY.js → chunk-CJJXT5DO.js} +1 -1
- package/dist/{chunk-F2K3XFFH.js → chunk-CLTANA4L.js} +2 -2
- package/dist/{chunk-YZSYXNMB.js → chunk-CT2I5KUM.js} +1 -1
- package/dist/{chunk-RZFINU7J.js → chunk-CY5NDMO7.js} +1 -1
- package/dist/{chunk-RLG5NUTE.js → chunk-DNOBOZPO.js} +1 -1
- package/dist/chunk-DXK55KGR.js +9 -0
- package/dist/{chunk-Q4HLQOJI.js → chunk-E3BO7OVR.js} +1 -1
- package/dist/chunk-EHN5HTUD.js +147 -0
- package/dist/{chunk-RGEAEAZB.js → chunk-FJTWJ243.js} +1 -1
- package/dist/{chunk-G6AF2JUA.js → chunk-FV4LLU3T.js} +1 -1
- package/dist/{chunk-CE664P73.js → chunk-GBBVP2JW.js} +1 -1
- package/dist/{chunk-AD46OCZ4.js → chunk-GRB66C5S.js} +1 -1
- package/dist/{chunk-22A2ECA2.js → chunk-GYW7LVVL.js} +1 -1
- package/dist/{chunk-E4OYR32M.js → chunk-HJGUEZLW.js} +1 -1
- package/dist/{chunk-DEEBPSJN.js → chunk-HNE4TDOZ.js} +1 -1
- package/dist/{chunk-7MV5UF6O.js → chunk-I2JUBAPU.js} +1 -1
- package/dist/chunk-IJPFAWBH.js +5 -0
- package/dist/{chunk-53VDR5DN.js → chunk-IOTJZTHX.js} +3 -3
- package/dist/{chunk-SHSV64GX.js → chunk-IRRGSC7B.js} +1 -1
- package/dist/{chunk-BFFCGEUH.js → chunk-IXVR66NS.js} +1 -1
- package/dist/chunk-K5JGCJ2K.js +6 -0
- package/dist/{chunk-D5T4ARTB.js → chunk-MCQXRJGH.js} +1 -1
- package/dist/{chunk-UXJPCWGW.js → chunk-MK2G7VIF.js} +1 -1
- package/dist/{chunk-P46TIMGQ.js → chunk-MVF4KRHA.js} +1 -1
- package/dist/{chunk-ARS72637.js → chunk-O66EU5UV.js} +1 -1
- package/dist/{chunk-Y7KW5AEN.js → chunk-OB6CKLEL.js} +1 -1
- package/dist/{chunk-2S4S2XJC.js → chunk-OLXOZJ7X.js} +1 -1
- package/dist/{chunk-YZKPZXHY.js → chunk-PICCLJSO.js} +1 -1
- package/dist/{chunk-EWFFJBAM.js → chunk-POI6DCP6.js} +1 -1
- package/dist/{chunk-C5POEXSX.js → chunk-PYB2EXRE.js} +2 -2
- package/dist/{chunk-OE7TVGNB.js → chunk-QNNBNIR7.js} +3 -3
- package/dist/{chunk-TTSYHJLX.js → chunk-QZI43UNV.js} +1 -1
- package/dist/{chunk-LMJTY32X.js → chunk-RHNKYNNZ.js} +1 -1
- package/dist/{chunk-ZKYYZ5NO.js → chunk-RN4OSVTG.js} +2 -2
- package/dist/chunk-SJ2KQKOV.js +3 -0
- package/dist/{chunk-BGGNBWAJ.js → chunk-STH6I3UB.js} +1 -1
- package/dist/{chunk-PJDOXRLB.js → chunk-UZSG54OY.js} +1 -1
- package/dist/{chunk-XBE7PGVY.js → chunk-W36P7S5W.js} +1 -1
- package/dist/{chunk-EEO4XWY6.js → chunk-WE57PD6K.js} +1 -1
- package/dist/{chunk-NFGG5DA2.js → chunk-WFEGGQJ4.js} +1 -1
- package/dist/chunk-WIA7TPK3.js +2 -0
- package/dist/{chunk-SQFNMZJ2.js → chunk-WT3SMSY5.js} +1 -1
- package/dist/{chunk-AV5SUGRY.js → chunk-XUJ5EPVW.js} +1 -1
- package/dist/{chunk-BO3JA2GS.js → chunk-YI4XULHR.js} +2 -2
- package/dist/{chunk-VXGOWBET.js → chunk-YMSN25DX.js} +1 -1
- package/dist/{chunk-B2PZAB7J.js → chunk-ZG2V2ODK.js} +1 -1
- package/dist/{chunk-ME5QSYWX.js → chunk-ZQP3MCZW.js} +1 -1
- package/dist/{chunk-GIRXJOJI.js → chunk-ZZLR3O5A.js} +1 -1
- package/dist/{config-5OOP2BO3.js → config-OJF53CHL.js} +1 -1
- package/dist/{cover-cmd-Y5L4O4Q3.js → cover-cmd-K3LCXHAQ.js} +1 -1
- package/dist/{credentials-XCP6DJZZ.js → credentials-NLJHSVBY.js} +1 -1
- package/dist/descriptor-EHK3DRCZ.js +2 -0
- package/dist/{evidence-AX67Q6RN.js → evidence-UPOFW3XC.js} +1 -1
- package/dist/evolve-cmd-MVALOB3G.js +2 -0
- package/dist/explain-VFIZTHFN.js +2 -0
- package/dist/{explain-cmd-RIDEMDMY.js → explain-cmd-KV5YUXKB.js} +1 -1
- package/dist/{explain-cmd-55WRDIMW.js → explain-cmd-U367SD4N.js} +1 -1
- package/dist/{extract-bind-ZDAXRQUS.js → extract-bind-SSTKQGTV.js} +2 -2
- package/dist/{extract-cmd-5GGI6LAM.js → extract-cmd-GO4UV7ER.js} +2 -2
- package/dist/{gaps-cmd-P2DRK6FW.js → gaps-cmd-DTVDIOED.js} +1 -1
- package/dist/{gate-FACZRGOC.js → gate-B6C6KLFA.js} +1 -1
- package/dist/{generate-headless-DRDE46ON.js → generate-headless-2HYMSVN5.js} +2 -2
- package/dist/{headless-io-GXHKDPHB.js → headless-io-PWW6YKH2.js} +1 -1
- package/dist/index.js +43 -43
- package/dist/ingest-C5ANIN7S.js +2 -0
- package/dist/ingest-cmd-LLC5CDQ5.js +3 -0
- package/dist/interactive-bind-Q5TQFQ6N.js +7 -0
- package/dist/{lifecycle-cmd-55NZL3UO.js → lifecycle-cmd-BXE5IMFN.js} +1 -1
- package/dist/{list-cmd-JB2ABACD.js → list-cmd-KBWPYJMV.js} +1 -1
- package/dist/{list-commands-UDAL3SBY.js → list-commands-6WDXAECV.js} +1 -1
- package/dist/{logical-ids-ATVR6PF2.js → logical-ids-3Y6RX5C2.js} +1 -1
- package/dist/login-flow-XQMJFC4H.js +2 -0
- package/dist/{maintenance-cmd-E3HEEVQW.js → maintenance-cmd-VS3APIUN.js} +1 -1
- package/dist/{persist-recorded-session-BW3YSFMP.js → persist-recorded-session-KHIMN4A3.js} +1 -1
- package/dist/pipeline-2HRAWT5U.js +2 -0
- package/dist/readmodel-XOGOELUP.js +2 -0
- package/dist/reconcile-cmd-DH4VV6PG.js +2 -0
- package/dist/{recording-banner-6FVTCUWQ.js → recording-banner-SADVYNEP.js} +1 -1
- package/dist/{require-project-folder-AQUVEEJB.js → require-project-folder-LP7V26IU.js} +1 -1
- package/dist/{revert-3TKLOYQA.js → revert-AQQ2VHRM.js} +1 -1
- package/dist/{review-cmd-RXPPC5GK.js → review-cmd-4WZUUOE4.js} +1 -1
- package/dist/run-RT2VMPTQ.js +2 -0
- package/dist/run-XAZMT7WO.js +2 -0
- package/dist/{run-test-md-AUK7NGLL.js → run-test-md-ATB2HZRG.js} +2 -2
- package/dist/{skill-installer-2MNPCPRD.js → skill-installer-DE2LSSKU.js} +1 -1
- package/dist/{spawner-XCOMTJJC.js → spawner-GOTVIFR5.js} +1 -1
- package/dist/tcg-generate-7PUXJ5R4.js +2 -0
- package/dist/{testmd-actions-TU4KTO32.js → testmd-actions-RYQHBX4K.js} +1 -1
- package/dist/token-refresh-F5KRV7ER.js +2 -0
- package/dist/{validate-basic-IYMPP7C7.js → validate-basic-6BQ2L7TT.js} +1 -1
- package/dist/{version-check-MUPSKONS.js → version-check-YW3FUWDH.js} +1 -1
- package/dist/{view-cmd-QE2FS3GB.js → view-cmd-FRMQF76B.js} +1 -1
- package/dist/walk-session-O4TMVORI.js +2 -0
- package/package.json +7 -7
- package/dist/ChatSurface-J777M5WC.js +0 -8
- package/dist/EvidenceViewOffer-JQDEAE2T.js +0 -2
- package/dist/SingleShotApp-QANGFAPO.js +0 -2
- package/dist/TestMdRunView-74A3LCNE.js +0 -2
- package/dist/archive-committer-3NI773TP.js +0 -2
- package/dist/bind-FZ4X4SOK.js +0 -6
- package/dist/chunk-6RQAUK5F.js +0 -5
- package/dist/chunk-FTD3B7QA.js +0 -2
- package/dist/chunk-GIGD4M7V.js +0 -5
- package/dist/chunk-I2S6KNZW.js +0 -2
- package/dist/chunk-IACKIGPX.js +0 -2
- package/dist/chunk-NFOBDHZK.js +0 -147
- package/dist/chunk-SGU72YLH.js +0 -9
- package/dist/chunk-TY5LWU6I.js +0 -14
- package/dist/chunk-YANCBRER.js +0 -3
- package/dist/descriptor-SL5A7RQE.js +0 -2
- package/dist/distill-cmd-EYCCCFL3.js +0 -2
- package/dist/evolve-cmd-HR25DRTC.js +0 -2
- package/dist/explain-JIXUWEFJ.js +0 -2
- package/dist/ingest-4CGBXC2L.js +0 -2
- package/dist/ingest-cmd-X7BWGIN7.js +0 -3
- package/dist/interactive-bind-T6OBLZCT.js +0 -7
- package/dist/login-flow-LJ4BH3OS.js +0 -2
- package/dist/pipeline-TZJ652NT.js +0 -2
- package/dist/readmodel-MPTENJ2R.js +0 -2
- package/dist/reconcile-cmd-242S7XNO.js +0 -8
- package/dist/run-UGAOGR3B.js +0 -2
- package/dist/signals-cmd-LXHZQLXZ.js +0 -2
- package/dist/tcg-generate-E5X23RVP.js +0 -2
- package/dist/token-refresh-GGLARJV4.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{x as o}from"./chunk-
|
|
2
|
+
import{x as o}from"./chunk-HJGUEZLW.js";import{a as m}from"./chunk-HCBYKLMW.js";import{a as e,b as i}from"./chunk-C44QQJR4.js";import{e as d}from"./chunk-UR6MHSHU.js";var r=d(m(),1),s={default:o.muted,error:o.red,success:o.green,info:o.orange,warning:o.orange};function h({title:t,titleColor:a,borderColor:l,variant:n="default",children:c,width:u,paddingX:x=2,paddingY:g=0,marginBottom:f=0}){let p=l??s[n],B=a??(n==="default"?o.orange:s[n]);return(0,r.jsxs)(e,{flexDirection:"column",marginBottom:f,children:[t&&(0,r.jsx)(e,{marginBottom:0,children:(0,r.jsxs)(i,{color:B,bold:!0,children:[" ",t]})}),(0,r.jsx)(e,{borderStyle:"round",borderColor:p,flexDirection:"column",paddingX:x,paddingY:g,width:u,children:c})]})}function k({label:t,value:a,labelColor:l=o.dim,valueColor:n,labelWidth:c=14}){return(0,r.jsxs)(e,{children:[(0,r.jsx)(e,{width:c,flexShrink:0,children:(0,r.jsx)(i,{color:l,children:t})}),(0,r.jsx)(e,{flexShrink:1,children:(0,r.jsx)(i,{color:n,wrap:"wrap",children:a})})]})}function I({label:t}){return(0,r.jsx)(e,{marginTop:1,marginBottom:0,children:(0,r.jsx)(i,{bold:!0,children:t})})}export{h as a,k as b,I as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as h}from"./chunk-
|
|
2
|
+
import{a as h}from"./chunk-XUJ5EPVW.js";import{x as l}from"./chunk-HJGUEZLW.js";import{a as A}from"./chunk-HCBYKLMW.js";import{a as c,b as f,i as P}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as x}from"./chunk-UR6MHSHU.js";var L=x(B(),1);var n=x(A(),1);function S(r,d,s,u,m){let p=s==="basic"&&u?`basic (${u})`:s,i=20,a=`${r} [${d}]`,g="\xB7".repeat(Math.max(2,i-a.length+3));return{label:`${a} ${g} ${p}`,profile:r,env:d,isActive:m}}function M({creds:r,onSwitch:d,onCancel:s}){let u=r.listProfiles(),m=r.getActiveProfile(),p=r.getDefaultEnv(),i=u.map(e=>{let o=r.loadBasicAuth(e.profile,e.env),t=r.loadCredentials(e.profile,e.env)!==null,v=o?"basic":t?"oauth":"none",b=o?o.username:null,w=e.profile===m&&e.env===p;return S(e.profile,e.env,v,b,w)}),[a,g]=(0,L.useState)(()=>{let e=i.findIndex(o=>o.isActive);return e>=0?e:0});return P((e,o)=>{if(o.escape){s();return}if(o.upArrow){g(t=>Math.max(0,t-1));return}if(o.downArrow){g(t=>Math.min(i.length-1,t+1));return}if(o.return&&i[a]){let t=i[a];t.isActive||d(t.profile,t.env),s();return}}),i.length===0?(0,n.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:l.orange,paddingX:2,paddingY:1,children:[(0,n.jsx)(f,{color:l.orange,bold:!0,children:"Profiles"}),(0,n.jsx)(c,{marginTop:1,children:(0,n.jsx)(f,{color:l.dim,children:"No profiles \u2014 use Login to create one"})}),(0,n.jsx)(h,{bindings:[],escBackLabel:"back"})]}):(0,n.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:l.orange,paddingX:2,paddingY:1,children:[(0,n.jsx)(f,{color:l.orange,bold:!0,children:"Profiles"}),(0,n.jsx)(c,{flexDirection:"column",marginTop:1,children:i.map((e,o)=>{let t=o===a,v=t?"\u276F ":" ",b=e.isActive?l.green:t?l.orange:void 0;return(0,n.jsxs)(f,{color:b,children:[v,e.label,e.isActive?" \u25CF active":""]},`${e.profile}-${e.env}`)})}),(0,n.jsx)(h,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"switch"}],escBackLabel:"back"})]})}export{S as a,M as b};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{closeSync as A,existsSync as $,mkdirSync as h,openSync as k,readFileSync as p,readdirSync as w,renameSync as S,rmSync as g,writeFileSync as m}from"fs";import{join as l}from"path";var a=class extends Error{constructor(r,t){super(`${r}: ${t}`);this.code=r}},d=e=>l(e,"reconcile","plans");function u(e,n){let r=`${e}.tmp-${process.pid}`;m(r,n,{mode:384}),S(r,e)}function N(e,n){let r=d(e);h(r,{recursive:!0});let t=l(r,`${n.created}-${n.source_id}.json`);return u(t,JSON.stringify(n,null,2)+`
|
|
3
|
+
`),t}function y(e,n){let r=n;if(r===void 0){let s=d(e),c=[];try{c=w(s).filter(P=>P.endsWith(".json")).sort()}catch{}if(c.length===0)return{error:`no stored plans under ${s} \u2014 run reconcile --plan first`};r=l(s,c[c.length-1])}if(!$(r))return{error:`no such plan file: ${r}`};let t;try{t=p(r,"utf8")}catch(s){return{error:`cannot read plan ${r}: ${s instanceof Error?s.message:String(s)}`}}let i;try{i=JSON.parse(t)}catch(s){return{error:`corrupted plan ${r}: ${s instanceof Error?s.message:String(s)}`}}let o=i?.version;return o===1?{error:`plan predates the vocabulary change \u2014 recompute with --from <file> --source-id <id> (${r})`}:o!==2?{error:`unsupported plan version ${String(o)} in ${r} (expected 2)`}:Array.isArray(i.rows)?{plan:i,path:r}:{error:`not a reconcile plan \u2014 ${r} has no rows[] (hand-edited?)`}}function R(e){let n=e.archive_state??{};return(e.changeset??[]).filter(r=>r.kind==="ARCHIVE"&&n[r.ref]===void 0).map(r=>r.ref)}function D(e,n,r){let t=y("",e);if("error"in t)throw new a("PLAN_UNREADABLE",t.error);let i=t.plan,o=i.archive_state??{};if(o[n]!==void 0)throw new a("ROW_ALREADY_APPLIED",`archive ${n} already ${o[n].outcome}`);o[n]={at:new Date().toISOString(),outcome:r},i.archive_state=o,u(e,JSON.stringify(i,null,2)+`
|
|
4
|
+
`)}function _(e,n){let r=d(e),t=[];try{t=w(r).filter(i=>i.endsWith(`-${n}.json`)).sort()}catch{}return t.length===0?null:y(e,l(r,t[t.length-1]))}function O(e,n){let r=_(e,n);if(r===null||"error"in r)return null;let t=r.plan.rows.filter(i=>i.applied===void 0).length+R(r.plan).length;return t>0?{path:r.path,created:r.plan.created,pending:t}:null}function I(e,n,r){let t;try{t=JSON.parse(p(e,"utf8"))}catch(o){throw new a("PLAN_UNREADABLE",`${e}: ${o instanceof Error?o.message:String(o)}`)}let i=t.rows?.[n];if(!i)throw new a("ROW_MISSING",`${e} has no row ${n}`);if(i.applied)throw new a("ROW_ALREADY_APPLIED",`row ${n} of ${e} was already applied (${i.applied.outcome} at ${i.applied.at})`);i.applied={at:new Date().toISOString(),outcome:r},u(e,JSON.stringify(t,null,2)+`
|
|
5
|
+
`)}function x(e){let n=d(e);h(n,{recursive:!0});let r=l(n,".walk-lock");for(let t=0;t<2;t++)try{let i=k(r,"wx");return m(i,`${process.pid}
|
|
6
|
+
`),A(i),()=>{try{g(r)}catch{}}}catch(i){if(i.code!=="EEXIST")throw i;let o=f(r);if(!Number.isFinite(o)){let c=Date.now()+50;for(;Date.now()<c;);o=f(r)}if(Number.isFinite(o)&&v(o))throw new a("WALK_LOCKED",`another reconcile walk is running (pid ${o}) \u2014 remove ${r} if that process is gone`);try{g(r)}catch{}}throw new a("WALK_LOCKED",`could not take the walk lock at ${l(n,".walk-lock")}`)}function f(e){try{return parseInt(p(e,"utf8").trim(),10)}catch{return NaN}}function v(e){try{return process.kill(e,0),!0}catch{return!1}}export{N as a,y as b,R as c,D as d,_ as e,O as f,I as g,x as h};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as L,b as N}from"./chunk-
|
|
2
|
+
import{a as L,b as N}from"./chunk-74RUSHIB.js";import{c as G}from"./chunk-ZG2V2ODK.js";import{e as _,g as v}from"./chunk-5YPBPZUR.js";import{existsSync as k,readFileSync as q}from"fs";function J(a){let s=N(a),u=new Map(Object.entries(s.heads)),d=new Map(Object.entries(s.trust)),r=new Map(Object.entries(s.nodeLabel)),i=new Map(Object.entries(s.superseded)),g=new Map(Object.entries(s.names)),R=new Map(Object.entries(s.archivedReason)),I=new Set(s.appliedEvents),S=new Map(Object.entries(s.conv)),T=e=>s.media[e]??{format:"text",media_type:"text/plain",anchors_supported:["L-L"]},M=new Map;for(let[e,t]of g)M.set(t,e);let h=new Map,E=e=>{if(h.has(e))return h.get(e);if(!r.has(e))return h.set(e,null),null;let t=L(a,e);if(!k(t))throw new G(`derived node file missing for ${e} \u2014 run kane-cli context rebuild`);let n=JSON.parse(q(t,"utf8"));return h.set(e,n),n},m=e=>{let t=e,n=new Set;for(;i.has(t)&&!n.has(t);){n.add(t);let o=i.get(t);if(typeof o!="string")break;t=o}return t},x=e=>{let t=u.get(e),n=r.has(e)?e:g.get(e)??(typeof t=="string"?t:void 0);if(n===void 0||!r.has(n))return null;let o=m(n);return{cid:n,tip:o,superseded:i.has(n)||i.has(o)}},b=new Map;for(let e of Object.values(s.forward))for(let t of e){let n=b.get(t.dst);n?n.push(t):b.set(t.dst,[t])}let w=e=>(e??[]).filter(t=>!i.has(t.ecid)),C=e=>w(b.get(e)),O=e=>C(e).filter(t=>t.type===_.DERIVES),y=e=>w(s.forward[e]).some(t=>v(t.type)?.pin?.comparesTo==="dst_tip"&&i.has(t.dst)),F=e=>{if(i.has(e))return"superseded";let t=O(e);if(t.length===0)return y(e)?"stale":"fresh";let n=new Map;for(let p of t)n.set(p.props.source_id,p);let o=!1,f=!1;for(let[p,c]of n){let l=u.get(p);if(l!=null&&(o=!0,l!==c.props.source_cid)){let j=S.get(p)?.chain;(!j||!j.includes(c.props.source_cid))&&(f=!0)}}return o?f||y(e)?"stale":"fresh":"orphaned"};return{heads:u,trust:d,nodeLabel:r,superseded:i,names:g,nameOf:M,archivedReason:R,appliedEvents:I,convChains:S,mediaOf:T,extractedSourceCids:new Set(s.extracted),designOf:new Map(Object.entries(s.design_of??{})),latestHash:s.applied.hash,lastSeq:s.applied.seq,hasNode:e=>r.has(e),getNode:E,byLabel:e=>[...r.entries()].filter(([,t])=>t===e).map(([t])=>({cid:t,content:E(t)?.content??{}})),edgesFrom:e=>w(s.forward[e]),edgesInto:C,derivesInto:O,resolve:x,tipOf:m,stale:F,staleList:()=>[...r.keys()].map(e=>({cid:e,state:F(e)})).filter(e=>e.state!=="fresh"),execHistory:e=>{let t=x(e);if(!t)return[];let n=m(t.cid),o=new Set([n]),f=!0;for(;f;){f=!1;for(let[c,l]of i)l!==null&&o.has(l)&&!o.has(c)&&(o.add(c),f=!0)}let p=[];for(let c of Object.entries(s.exec??{}))o.has(c[0])&&p.push(...c[1]);return p.sort((c,l)=>c.started_at<l.started_at?-1:1)}}}function V(a,s){if(a.stale(s)!=="stale")return!1;let u=new Map;for(let d of a.derivesInto(s))u.set(d.props.source_id,d);for(let[d,r]of u){let i=a.heads.get(d);if(i==null||i===r.props.source_cid)continue;let g=a.convChains.get(d)?.chain;if(!g||!g.includes(r.props.source_cid))return!0}for(let d of a.edgesFrom(s)){if(v(d.type)?.pin?.comparesTo!=="dst_tip"||!a.superseded.has(d.dst))continue;let r=a.tipOf(d.dst);if(a.superseded.has(r)||a.nodeLabel.get(r)==="usecase")return!0}return!1}export{J as a,V as b};
|
|
@@ -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-ADOXYGZE.js";import{a as te}from"./chunk-2K4XOHVK.js";import{a as K}from"./chunk-5Y2G4NC7.js";import{a as Be}from"./chunk-POI6DCP6.js";import{a as ve}from"./chunk-IRRGSC7B.js";import{b as ye}from"./chunk-DFS4RMVP.js";import{x as i}from"./chunk-HJGUEZLW.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 t}from"./chunk-
|
|
2
|
+
import{a as t}from"./chunk-4MUHS3UL.js";async function l(e){let o=e.credentials.expires_at,i=e.thresholdSeconds??300;if(o-Date.now()/1e3>=i)return null;let r=e.creds.loadClient(e.profile,e.env);if(!r)return null;let n=await new t(e.env).refreshToken(e.credentials.refresh_token,r.client_id),s=Math.floor(Date.now()/1e3)+n.expires_in;return e.creds.saveCredentials(e.profile,e.env,{access_token:n.access_token,refresh_token:n.refresh_token,expires_at:s,scope:n.scope}),{accessToken:n.access_token,refreshToken:n.refresh_token,expiresAt:s,scope:n.scope}}export{l as a};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as b}from"./chunk-
|
|
2
|
+
import{a as b}from"./chunk-IRRGSC7B.js";import{x as l}from"./chunk-HJGUEZLW.js";import{a as f}from"./chunk-HCBYKLMW.js";import{a as m,b as s}from"./chunk-C44QQJR4.js";import{e as p}from"./chunk-UR6MHSHU.js";var u=p(f(),1),T=5;function _({thinking:t,expanded:e,thinkingDone:o,maxLines:i=T}){if(!e)return(0,u.jsxs)(m,{paddingX:1,children:[(0,u.jsx)(s,{color:l.dim,children:o?"\u2237 thinking complete ":"\u2237 thinking\u2026 "}),(0,u.jsx)(s,{color:l.muted,children:o?"(ctrl+t to view)":"(ctrl+t to show)"})]});let g=t.split(`
|
|
3
3
|
`),n=Math.max(0,g.length-i),a=n>0?g.slice(-i).join(`
|
|
4
4
|
`):t;return(0,u.jsxs)(b,{variant:"default",paddingX:1,children:[n>0&&(0,u.jsxs)(s,{color:l.muted,children:["\u22EE (",n," earlier line",n===1?"":"s"," hidden)"]}),(0,u.jsx)(s,{color:l.dim,children:a}),o&&(0,u.jsx)(s,{color:l.muted,children:"\u2014 thinking complete"})]})}function k(t){let e=t;return e=e.replace(/@TS\{([^}]+)\}/g,"@S{$1}"),e=e.replace(/@TS-(\d+)/g,(o,i)=>`@S${parseInt(i,10)}.C1`),e=e.replace(/@TS(\d+)/g,(o,i)=>`@S${parseInt(i,10)}`),e=e.replace(/\\n/g,`
|
|
5
5
|
`),e}var c=p(f(),1),B=t=>t!==void 0&&/[A-Za-z0-9]/.test(t);function x(t){let e=[],o="",i=()=>{o&&(e.push({text:o}),o="")},g=(a,d,r)=>(a===0||!B(t[a-1]))&&(d+r>=t.length||!B(t[d+r])),n=0;for(;n<t.length;){let a=t.slice(n,n+2),d=t[n];if(a==="**"||a==="__"){let r=t.indexOf(a,n+2);if(r!==-1&&r>n+2&&(a==="**"||g(n,r,2))){i(),e.push({text:t.slice(n+2,r),bold:!0}),n=r+2;continue}}if(d==="`"){let r=t.indexOf("`",n+1);if(r!==-1&&r>n+1){i(),e.push({text:t.slice(n+1,r),code:!0}),n=r+1;continue}}if(d==="*"||d==="_"){let r=t.indexOf(d,n+1);if(r!==-1&&r>n+1&&(d==="*"||g(n,r,1))){i(),e.push({text:t.slice(n+1,r),italic:!0}),n=r+1;continue}}o+=d,n+=1}return i(),e.length===0&&e.push({text:""}),e}function h(t){return t.map((e,o)=>(0,c.jsx)(s,{bold:e.bold,italic:e.italic,color:e.code?l.dim:void 0,children:e.text},o))}function S(t){return t.split(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as ve}from"./chunk-
|
|
2
|
+
import{a as ve}from"./chunk-XUJ5EPVW.js";import{c as we,x as d}from"./chunk-HJGUEZLW.js";import{a as V}from"./chunk-HCBYKLMW.js";import{a as v,b as u,h as Te,i as de,k as Ae}from"./chunk-C44QQJR4.js";import{a as ue}from"./chunk-6YGTRKDT.js";import{e as B}from"./chunk-UR6MHSHU.js";var Be=B(ue(),1);import{readFileSync as Ye,writeFileSync as Ve,mkdirSync as Xe}from"fs";import{dirname as Ge,join as Pe}from"path";var Je=Pe(we,"command-history.json"),gt=Pe(we,"generate-history.json"),ze=200,Ee=class{entries;filePath;max;constructor(o=Je,n=ze){this.filePath=o,this.max=n,this.entries=this._load()}push(o){this.entries.length>0&&this.entries[this.entries.length-1]===o||(this.entries.push(o),this.entries.length>this.max&&(this.entries=this.entries.slice(this.entries.length-this.max)),this._save())}getAll(){return[...this.entries]}search(o){let n=o.toLowerCase(),l=[];for(let s=this.entries.length-1;s>=0;s--)this.entries[s].toLowerCase().includes(n)&&l.push(this.entries[s]);return l}_load(){if(this.filePath===null)return[];try{let o=Ye(this.filePath,"utf-8"),n=JSON.parse(o);return Array.isArray(n)?n:[]}catch{return[]}}_save(){if(this.filePath!==null)try{Xe(Ge(this.filePath),{recursive:!0}),Ve(this.filePath,JSON.stringify(this.entries)+`
|
|
3
3
|
`)}catch{}}};function pt(r){let o=(0,Be.useRef)(null);return o.current||(o.current=new Ee(r)),o.current}var C=B(ue(),1);var Se=B(ue(),1);var $=B(V(),1);function Le({history:r,onSelect:o,onClose:n}){let[l,s]=(0,Se.useState)(""),[c,m]=(0,Se.useState)(0),S=l?r.search(l).slice(0,8):[];return de((y,g)=>{if(g.escape){n();return}if(g.return){S.length>0&&S[c]?o(S[c]):n();return}if(g.upArrow){m(M=>Math.max(0,M-1));return}if(g.downArrow){m(M=>Math.min(S.length-1,M+1));return}if(g.backspace||g.delete){s(M=>M.slice(0,-1)),m(0);return}y&&!g.ctrl&&!g.meta&&(s(M=>M+y),m(0))}),(0,$.jsxs)(v,{flexDirection:"column",marginLeft:2,borderStyle:"single",paddingX:1,children:[(0,$.jsx)(u,{color:d.muted,bold:!0,children:"reverse search"}),(0,$.jsxs)(v,{gap:1,children:[(0,$.jsx)(u,{color:d.dim,children:"search:"}),(0,$.jsx)(u,{children:l}),(0,$.jsx)(u,{color:d.orange,children:"\u2588"})]}),S.length>0&&(0,$.jsx)(u,{children:" "}),S.map((y,g)=>(0,$.jsx)(v,{marginLeft:2,children:(0,$.jsxs)(u,{color:g===c?d.orange:d.dim,bold:g===c,children:[g===c?"\u25B8 ":" ",y]})},`${g}-${y}`))]})}var X=B(V(),1);function De({commands:r,selectedIndex:o}){return r.length===0?null:(0,X.jsx)(v,{flexDirection:"column",marginBottom:0,children:r.map((n,l)=>{let s=l===o;return(0,X.jsxs)(v,{children:[(0,X.jsx)(u,{color:s?d.orange:d.dim,children:s?"\u276F ":" "}),(0,X.jsxs)(u,{color:s?d.orange:void 0,bold:s,children:["/",n.name]}),n.args&&(0,X.jsxs)(u,{color:d.dim,children:[" ",n.args]}),(0,X.jsxs)(u,{color:d.dim,children:[" ",n.description]})]},n.name)})})}var _e=B(ue(),1);var P=B(V(),1),$e={scenario:"Scenarios",case:"Test Cases",file:"Files"};function Oe(r){let o={scenario:0,case:0,file:0};for(let n of r)o[n.kind]++;return["scenario","case","file"].filter(n=>o[n]>0).map(n=>`${o[n]} ${$e[n]}`).join(" \xB7 ")}var ge=7;function Ke({items:r,selectedIndex:o,accent:n=d.orange}){let l=r.length;if(l===0)return null;let s=Math.floor(ge/2),c=l<=ge?0:Math.max(0,Math.min(o-s,l-ge)),m=Math.min(l,c+ge),S=c,y=l-m;return(0,P.jsxs)(v,{flexDirection:"column",marginBottom:0,children:[S>0&&(0,P.jsx)(v,{children:(0,P.jsx)(u,{color:d.dim,children:` \u22EF ${S} above \u2014 ${Oe(r.slice(0,c))}`})}),r.slice(c,m).map((g,M)=>{let W=c+M,H=W===o,Q=M===0||r[W-1].kind!==g.kind;return(0,P.jsxs)(_e.default.Fragment,{children:[Q&&(0,P.jsx)(v,{children:(0,P.jsx)(u,{color:d.dim,children:$e[g.kind]})}),(0,P.jsxs)(v,{children:[(0,P.jsx)(u,{color:H?n:d.dim,children:H?"\u276F ":" "}),(0,P.jsx)(u,{color:H?n:void 0,bold:H,children:g.label})]})]},`${g.kind}:${g.value}:${W}`)}),y>0&&(0,P.jsx)(v,{children:(0,P.jsx)(u,{color:d.dim,children:` \u22EF ${y} more \u2014 ${Oe(r.slice(m))}`})})]})}var pe=B(ue(),1);var Qe=27,Ze=127,et=11;function tt(r){return r>=64&&r<=126}function nt(r,o){r===et&&o({killToEnd:!0,ctrl:!0,raw:String.fromCharCode(r)})}function rt(r,o){r===Ze&&o({backspace:!0,meta:!0,raw:"\x1B\x7F"})}function ot(r,o){let n=r.map(s=>String.fromCharCode(s)).join(""),l=/^\[1;([0-9]+)([A-D])$/.exec(n);if(l){let s=parseInt(l[1],10),c=l[2],m={raw:"\x1B"+n};if(s===2)m.shift=!0;else if(s===3)m.meta=!0;else if(s===5)m.ctrl=!0;else return;c==="A"?m.arrowUp=!0:c==="B"?m.arrowDown=!0:c==="C"?m.arrowRight=!0:c==="D"&&(m.arrowLeft=!0),o(m);return}if(n==="[H"||n==="[1~"||n==="[7~"){o({home:!0,raw:"\x1B"+n});return}if(n==="[F"||n==="[4~"||n==="[8~"){o({end:!0,raw:"\x1B"+n});return}if(n==="[3;5~"){o({delete:!0,ctrl:!0,raw:"\x1B"+n});return}if(n==="[3;3~"){o({delete:!0,meta:!0,raw:"\x1B"+n});return}}function it(r,o){r===72?o({home:!0,raw:"\x1BO"+String.fromCharCode(r)}):r===70&&o({end:!0,raw:"\x1BO"+String.fromCharCode(r)})}function st(){let r="IDLE",o=[];function n(){r="IDLE",o=[]}return{feed(l,s){for(let c of l)r==="IDLE"?c===Qe?(r="ESC",o=[]):nt(c,s):r==="ESC"?c===91?(r="CSI",o=[]):c===79?(r="SS3",o=[]):(rt(c,s),n()):r==="CSI"?(o.push(c),tt(c)&&(ot([91,...o],s),n())):r==="SS3"&&(it(c,s),n())},flushIdle(l){r==="ESC"&&o.length===0&&l({raw:"\x1B"}),n()}}}function He(r,o={}){let n=(0,pe.useRef)(r);n.current=r;let{stdin:l}=Te();(0,pe.useEffect)(()=>{if(o.isActive===!1||!l)return;let s=st(),c=null,m=S=>{c&&(clearTimeout(c),c=null);let y=Buffer.isBuffer(S)?S:Buffer.from(S,"binary");s.feed(y,g=>n.current(g)),c=setTimeout(()=>{s.flushIdle(g=>n.current(g)),c=null},50)};return l.on("data",m),()=>{l.removeListener("data",m),c&&clearTimeout(c)}},[o.isActive,l])}var x=B(V(),1);function lt(r,o){let n=o-1;for(;n>=0&&r[n]!=="@"&&r[n]!==" "&&r[n]!==`
|
|
4
4
|
`;)n--;return n<0||r[n]!=="@"||n>0&&r[n-1]!==" "&&r[n-1]!==`
|
|
5
5
|
`?null:{at:n,query:r.slice(n+1,o).join("")}}var ye=10;function at(r){return r.replace(/\x1b?\[200~/g,"").replace(/\x1b?\[201~/g,"").replace(/\r\n/g,`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as c,c as p}from"./chunk-
|
|
2
|
+
import{b as c,c as p}from"./chunk-CT2I5KUM.js";import{spawn as m}from"child_process";var y=new Set(["progress","ask_user","graph_query","proposal","design","error","done","reasoning_delta","reasoning_done","tool_activity","decision_activity","text_delta","usage","receipt","chat_ops","session_paused","session_complete"]);function S(d,s={}){let a=s.spawnCmd!==void 0?s.spawnCmd:c();if(!a)throw new Error("assurance agent not found \u2014 your platform package may be missing; reinstall kane-cli (npm i -g @testmuai/kane-cli)");let n=m(a.cmd,a.args,{stdio:["pipe","pipe","pipe"],env:p(d.session_id,s.auth)});if(n.stdin.write(JSON.stringify(d)+`
|
|
3
3
|
`),s.onStderr){let e="";n.stderr.on("data",r=>{e+=r.toString("utf8");let i;for(;(i=e.indexOf(`
|
|
4
4
|
`))>=0;){let o=e.slice(0,i);e=e.slice(i+1),o.trim()&&s.onStderr(o)}})}let g=new Promise(e=>{n.on("exit",(r,i)=>e({code:r,signal:i}))});async function*f(){let e="",r=!1;for await(let i of n.stdout){e+=i.toString("utf8");let o;for(;(o=e.indexOf(`
|
|
5
5
|
`))>=0;){let l=e.slice(0,o).trim();if(e=e.slice(o+1),!l)continue;let u;try{u=JSON.parse(l)}catch{s.onWarn?.(`agent: skipping malformed line: ${l.slice(0,120)}`);continue}let t=u;if(!t||typeof t!="object"||!y.has(t.type)){s.onWarn?.(`agent: skipping unknown event type "${t&&typeof t=="object"?String(t.type??"?"):"?"}"`);continue}if(yield t,t.type==="done"){r=!0;break}}if(r)break}await g.catch(()=>{})}return{events:f(),send:e=>{n.stdin&&!n.stdin.destroyed&&n.stdin.write(JSON.stringify(e)+`
|
|
@@ -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-XUJ5EPVW.js";import{x as r}from"./chunk-HJGUEZLW.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,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-IRRGSC7B.js";import{x as m}from"./chunk-HJGUEZLW.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,7 +1,7 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as H,d as z}from"./chunk-2YQ6TW77.js";import{b as p,c as E,d as j,e as y,f as M,g as C,i as A,l as D,m as F,p as T,r as $,s as O}from"./chunk-RKWJG3WW.js";import{a as B}from"./chunk-
|
|
2
|
+
import{c as H,d as z}from"./chunk-2YQ6TW77.js";import{b as p,c as E,d as j,e as y,f as M,g as C,i as A,l as D,m as F,p as T,r as $,s as O}from"./chunk-RKWJG3WW.js";import{a as B}from"./chunk-W36P7S5W.js";import{h as R,i as k}from"./chunk-M5JQXOCE.js";import{a as P}from"./chunk-HJGUEZLW.js";import{e as q}from"./chunk-UR6MHSHU.js";import{existsSync as f,mkdirSync as V,readFileSync as Z,renameSync as N,writeFileSync as K}from"fs";import{join as Q}from"path";function fe(e){D(p(e));let t=p(e);if(!f(t))return;let n=Q(t,"meta.json"),r=y(e);if(f(n)&&!f(r))try{V(j(e),{recursive:!0}),N(n,r)}catch(o){process.stderr.write(`warn: meta.json migration failed: ${o.message}
|
|
3
3
|
`)}let i=C(e);if(f(i)){let o="python";try{let c=new B().load();c.code_export?.language&&(o=c.code_export.language)}catch{}let a=M(e,"playwright",o);if(!f(a))try{N(i,a)}catch(c){process.stderr.write(`warn: generated-code migration failed: ${c.message}
|
|
4
4
|
`)}}if(f(r))try{let o=JSON.parse(Z(r,"utf8"));"md5sum"in o&&(delete o.md5sum,K(r,JSON.stringify(o,null,2)+`
|
|
5
5
|
`,"utf8"))}catch(o){process.stderr.write(`warn: meta.json md5sum strip failed: ${o.message}
|
|
6
|
-
`)}}async function ye(e){if(!e.isInteractive)return{recovered:!1};if(W(e.creds))return{recovered:!1};let{SingleShotApp:t}=await import("./SingleShotApp-
|
|
6
|
+
`)}}async function ye(e){if(!e.isInteractive)return{recovered:!1};if(W(e.creds))return{recovered:!1};let{SingleShotApp:t}=await import("./SingleShotApp-AJBIWW74.js"),{ScrollbackProvider:n}=await import("./scrollback-JLPJR25X.js"),{render:r}=await import("./build-JIKYOZUH.js"),i=await import("./react-QWOAB3TB.js"),o={current:null},a={current:!1},{waitUntilExit:c,unmount:l}=r(i.default.createElement(n,null,i.default.createElement(t,{resultRef:o,mode:"login",loginCompleteRef:a})),{exitOnCtrlC:!1});k(()=>l()),await c();try{process.stdin.setRawMode?.(!1)}catch{}return process.stdout.write("\x1B[?25h"),a.current?{recovered:!0}:(R(0,"Startup gate cancelled"),{recovered:!1})}function W(e){let t=e.getActiveProfile(),n=e.getDefaultEnv();if(!t||!!!(e.loadBasicAuth(t,n)||e.loadCredentials(t,n)))return!1;let i=e.loadProfileConfig(t,n)??{};return!!i.project_id&&!!i.folder_id}var J=q(H(),1);import{existsSync as v,readFileSync as U,readdirSync as X,statSync as Y}from"fs";import{dirname as ee,isAbsolute as te,join as g,relative as x,resolve as re,sep as h}from"path";import{createHash as ne}from"crypto";var S="testmd-bundle.json",d=class extends Error{constructor(t){super(t),this.name="BundleUsageError"}},_=e=>e.split(h).join("/");function I(e){if(!v(e))return[];let t=[];for(let n of X(e).sort()){let r=g(e,n);Y(r).isDirectory()?t.push(...I(r)):t.push(r)}return t}function se(e){let t=e.map(r=>ee(r).split(h)),n=t[0];for(let r of t.slice(1)){let i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;n=n.slice(0,i)}return n.join(h)||h}function ie(e){for(let t of e){let n=F(t,U(t,"utf8"));for(let r of n.steps)if(r.body.kind==="import_ref"&&te(r.body.path))throw new d(`bundle sync: absolute @import is not portable after unzip: ${t} step ${r.index} (@import ${r.body.path})`)}}function G(e){let t=re(e),n=T(t);if(!n?.commit_id||!n?.test_id)throw new d(`bundle sync: ${t} is not authored \u2014 run \`kane-cli testmd run\` first (output-<stem>/.internal/meta.json needs commit_id + test_id)`);let r;try{r=O(t)}catch(s){throw s instanceof $?new d(`bundle sync: ${s.message}`):s}let i=[t];for(let s of r.steps)for(let u of s.trace.slice(1))i.includes(u.file)||i.push(u.file);ie(i);let o=[];for(let s of r.unitFiles){if(s.file===t)continue;let u=p(s.file);o.includes(u)||o.push(u)}let a=[...i],c=s=>{v(s)&&a.push(s)};c(E(t)),a.push(y(t)),c(g(p(t),".internal","execution.json")),a.push(...I(A(t)));for(let s of o)c(g(s,"Result.md")),a.push(...I(g(s,".internal","steps")));let l=se(a);if(v(g(l,S)))throw new d(`bundle sync: a real file named ${S} exists at the zip root (${l}) \u2014 it would collide with the generated manifest`);let b=a.map(s=>{let u=U(s);return{abs:s,rel:_(x(l,s)),sha256:ne("sha256").update(u).digest("hex"),bytes:u.length}}).sort((s,u)=>s.rel<u.rel?-1:1),m=_(x(l,t)),L={schema_version:2,entry:m,commit_id:n.commit_id,test_id:n.test_id,testcase_id:n.testcase_id??null,project_id:n.project_id??null,folder_id:n.folder_id??null,org_id:n.org_id??null,created_at:new Date().toISOString(),producer:{name:"kane-cli",version:P},files:b.map(s=>({path:s.rel,sha256:s.sha256,bytes:s.bytes})),units:r.unitFiles.filter(s=>s.file!==t).map(s=>({path:_(x(l,s.file)),kind:s.kind}))};return{zipRoot:l,entry:m,files:b,manifest:L}}var w=e=>e instanceof Error?e.message:String(e);function oe(e){return new Promise((t,n)=>{let r=(0,J.default)("zip",{zlib:{level:6}}),i=[];r.on("data",o=>i.push(o)),r.on("error",n),r.on("end",()=>t(Buffer.concat(i))),r.append(JSON.stringify(e.manifest,null,2)+`
|
|
7
7
|
`,{name:S});for(let o of e.files)r.file(o.abs,{name:o.rel});r.finalize()})}async function ae(e){let{plan:t,controller:n,testId:r,sessionId:i,commitId:o}=e,a;try{a=await oe(t)}catch(l){return{ok:!1,stage:"zip",error:w(l)}}let c;try{let l={key:"testmd",content_type:"application/zip",filename:`${o}-testmd.zip`},m=(await n.getPresignedUrls(r,i,[l])).urls?.testmd?.upload_url;if(!m)return{ok:!1,stage:"presign",error:"presign response missing testmd upload_url"};c=m}catch(l){return{ok:!1,stage:"presign",error:w(l)}}try{await z(c,a,"application/zip")}catch(l){return{ok:!1,stage:"upload",error:w(l)}}return{ok:!0,bytes:a.length}}async function Ee(e){let t;try{t=G(e.sourcePath)}catch(n){return n instanceof d?{ok:!1,stage:"collect",error:n.message}:{ok:!1,stage:"collect",error:w(n)}}return ae({...e,plan:t})}function je(e){return e.shouldUploadPipeline&&e.uploadSucceeded&&!!e.metaCommitId&&!!e.metaTestId}export{fe as a,ye as b,Ee as c,je as d};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b,c as ge,d as ct,f as ve,g as he}from"./chunk-
|
|
2
|
+
import{b,c as ge,d as ct,f as ve,g as he}from"./chunk-CJJXT5DO.js";import{a as at,e as N,f as J,g as dt,h as te,i as U,j as ut}from"./chunk-FJTWJ243.js";import{a as oe}from"./chunk-BC7UVJJB.js";import{d as ft}from"./chunk-2PQXEEVY.js";import{a as K,b as W,d as st}from"./chunk-EHN5HTUD.js";import{a as T,b as S}from"./chunk-L5LI2JF4.js";import{a as O}from"./chunk-MCQXRJGH.js";import{b as ie}from"./chunk-74RUSHIB.js";import{a as pt}from"./chunk-ZZLR3O5A.js";import{e as re,g as ne}from"./chunk-ZG2V2ODK.js";import{d as R,e as H,f as lt}from"./chunk-5YPBPZUR.js";import{a as ot}from"./chunk-DNOBOZPO.js";import{a as it}from"./chunk-HJGUEZLW.js";function M(e){if(e===null)return"broken";let t=Math.floor(e/100);return t===1?"passed":t===7?"failed":t===2?"skipped":"broken"}var j={failed:3,broken:2,passed:1,skipped:0};function we(e){let t="skipped";for(let r of e)j[r]>j[t]&&(t=r);return t}import{createHash as Wt}from"crypto";import{basename as Jt}from"path";function ye(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40);return t.length>0?t:"session"}function _e(e){return Wt("sha256").update(e).digest("hex").slice(0,8)}function xe(e){let t=Jt(e).replace(/_test\.md$/i,"").replace(/\.md$/i,"");return`${ye(t)}-${_e(e)}`}function Se(e,t){return`${ye(e)}-${_e(t)}`}function be(e){let t={};for(let[r,n]of Object.entries(e))typeof n=="string"&&n.length>0&&(t[r]=n);return t}var Xt={darwin:"macOS",linux:"Linux",win32:"Windows"};function ke(e){return Xt[e]??e}function Ee(e,t){let r={},n=(i,o)=>{o!==void 0&&o!==""&&(r[i]=o)};return n("model",t.model),n("os",e.os),n("browser",e.browser),n("browser_version",e.browser_version),n("resolution",e.resolution),n("platform",t.platform),n("platform_type",t.platform_type),n("run_kind",t.run_kind),n("os_version",e.os_version),e.device!==void 0&&e.device!==""?r.device=e.device:t.platform_type&&t.platform_type!=="web"&&(r.device=null),r}function Zt(e,t){return{pack_test_dir:e,ordinal_offset:t}}import{promises as P}from"fs";import{join as D}from"path";function Ie(e){let t={evidence:"0.1",run_id:e.execution_id,status:"running",title:e.title,started:e.started,environment:{producer:{name:"kane-cli",version:e.producerVersion},...e.surfaces?{surfaces:e.surfaces}:{},run_kind:e.run_kind,origin:e.origin,pid:e.pid},...e.credits!==void 0?{metrics:{credits:{value:e.credits,type:"count"}}}:{}};return S(t,{lineWidth:-1})}async function Re(e,t,r,n=process.cwd(),i){let o=i??b(e.execution_id,n),a=D(o,"tests",t);return await P.mkdir(D(o,"coverage"),{recursive:!0}),await P.writeFile(D(o,"coverage",".keep"),""),await P.mkdir(a,{recursive:!0}),await P.writeFile(D(o,"run.yaml"),Ie(e)),r&&await P.writeFile(D(a,r.path),r.content),o}async function Qt(e,t=process.cwd()){let r=b(e.execution_id,t);await P.mkdir(D(r,"coverage"),{recursive:!0}),await P.writeFile(D(r,"coverage",".keep"),"");let n=T(Ie(e));return n.environment&&delete n.environment.run_kind,await P.writeFile(D(r,"run.yaml"),S(n,{lineWidth:-1})),r}async function qt(e,t=process.cwd()){return W(b(e,t),new Date().toISOString())}async function Pe(e,t=process.cwd()){await P.rm(b(e,t),{recursive:!0,force:!0})}import{promises as Ce}from"fs";import{join as Ae}from"path";function Oe(e){let t={evidence:"0.1",test:e.testId,status:e.status,...e.durationMs!==void 0?{duration_ms:e.durationMs}:{},...e.definitionPath?{definition:{path:e.definitionPath}}:{},...e.definitionId?{definition_id:e.definitionId}:{},...e.assuranceId?{assurance_id:e.assuranceId}:{},...Object.keys(e.externalId).length?{external_id:e.externalId}:{},...e.tags&&e.tags.length?{tags:e.tags}:{},...Object.keys(e.environment).length?{environment:e.environment}:{},steps:e.steps};return S(t,{lineWidth:-1})}function De(e){return S({logs:e},{lineWidth:-1})}async function $e(e,t,r){await Ce.writeFile(Ae(e,"tests",t,"result.yaml"),r)}async function Fe(e,t,r){let n=Ae(e,"tests",t,"logs");await Ce.mkdir(n,{recursive:!0}),await Ce.writeFile(Ae(n,"meta.yaml"),r)}import{promises as se}from"fs";import{join as mt}from"path";function gt(e){return mt(e,".internal","meta.json")}async function vt(e){let t;try{t=await se.readFile(gt(e),"utf8")}catch(n){if(n?.code==="ENOENT")return null;throw n}let r=JSON.parse(t);if(!r||typeof r!="object"||Array.isArray(r))throw new Error("meta.json is not a JSON object");return r}async function Le(e,t){let r;try{r=await vt(e)??{}}catch(a){console.warn(`evidence: meta.json at ${e} unreadable \u2014 skipping execution-pointer append to preserve identity`,a);return}let n=Array.isArray(r.executions)?r.executions:[];n.push(t),r.executions=n,await se.mkdir(mt(e,".internal"),{recursive:!0});let i=gt(e),o=`${i}.tmp-${process.pid}-${Date.now()}`;await se.writeFile(o,JSON.stringify(r,null,2)+`
|
|
3
3
|
`),await se.rename(o,i)}async function er(e){try{let t=await vt(e);return t&&Array.isArray(t.executions)?t.executions:[]}catch{return[]}}async function tr(e,t,r=process.cwd()){let n=await ve(e,r);if(!n){let o=`evidence: no pack found for "${e}"`;return t.json?console.log(JSON.stringify({valid:!1,error:"not_found",target:e})):console.error(o),2}let i=await K(n,t.profile??"L1");return t.json?console.log(JSON.stringify({valid:i.valid,status:i.status,diagnostics:i.diagnostics})):console.log(`evidence: ${i.valid?"valid":"INVALID"} (${t.profile??"L1"}, status ${i.status})`),i.valid?0:1}function Te(e){let t=[];for(let r of e){let n=r.perFlow&&r.perFlow.length?r.perFlow.map(i=>i.resultCode):[r.resultCode];for(let i of n)t.push(M(i))}return we(t)}function rr(e){let t=null;for(let r of e){let n=r.perFlow&&r.perFlow.length?r.perFlow.map(i=>i.resultCode):[r.resultCode];for(let i of n)i!=null&&(t==null||j[M(i)]>j[M(t)]||j[M(i)]===j[M(t)]&&i>t)&&(t=i)}return t}import{promises as nr}from"fs";import{extname as ht,basename as ir}from"path";var or={".ndjson":"ndjson",".log":"log",".json":"json",".har":"har"};async function Ne(e){let t;try{t=await nr.readdir(e)}catch{return[]}return t.filter(r=>r!=="meta.yaml").sort().map(r=>({name:ir(r,ht(r)),file:r,format:or[ht(r)]??"txt"}))}import{mkdirSync as sr,appendFileSync as cr}from"fs";import{join as wt}from"path";function je(e,t){return wt(e,"tests",t,"logs")}function Me(e,t,r,n={},i){try{i?.(t,r,r,n)}catch{}if(e)try{sr(e,{recursive:!0});let o=JSON.stringify({ts:new Date().toISOString(),level:t,event:r,...n})+`
|
|
4
4
|
`;cr(wt(e,"diagnostics.ndjson"),o)}catch{}}import{promises as $}from"fs";import{join as G}from"path";async function ar(e){try{let t=G(e,"tests"),r=await $.readdir(t).catch(()=>[]);for(let n of r){let i=G(t,n,"steps"),o=await $.readdir(i).catch(()=>[]);for(let a of o){let s=await $.readFile(G(i,a,"failure.yaml"),"utf8").catch(()=>null);if(s!=null)try{let u=T(s);if(u&&typeof u=="object"&&u.triage)return!0}catch{}}}}catch{}return!1}async function yt(e,t,r){let n=G(e,"tests",t,"logs");if(r)try{await $.mkdir(n,{recursive:!0}),await $.copyFile(r,G(n,"tui.log"))}catch{}let i=await Ne(n);i.length&&await Fe(e,t,De(i))}async function Ve(e){let t=e.cwd??process.cwd(),r=e.packDir??b(e.executionId,t);if(!e.saved&&!e.packDir)return await Pe(e.executionId,t),{sealed:!1};await yt(r,e.testId,e.tuiLogPath);let n=G(r,"run.yaml"),i=T(await $.readFile(n,"utf8"));i.environment={...i.environment??{},saved:e.saved,run_kind:e.runKind},await $.writeFile(n,S(i,{lineWidth:-1}));let o=await $.open(n,"r+");try{await o.sync()}finally{await o.close()}let a=await ar(r);await W(r,new Date().toISOString());let s;try{let c=await K(r,"L1");s=c.valid;let p=(c.diagnostics??[]).filter(l=>String(l?.code??"").includes("failure.status_disagrees"));if(p.length>0)if(e.expectStatusDisagrees||a){let l=e.expectStatusDisagrees?"expected under --bug-detection continue":"self-explained by triaged failure record(s)";console.warn(`evidence: ${p.length} status_disagrees advisory(ies) \u2014 ${l}`)}else console.warn(`evidence: ${p.length} status_disagrees advisory(ies) \u2014 step verdicts disagree with their failure records`,p);if(!c.valid){console.warn(`evidence: sealed pack ${e.executionId} failed L1 validation`,c.diagnostics);let l=String(c.diagnostics?.[0]?.code??"");Me(je(r,e.testId),"warn","EVIDENCE_INVALID",{execution_id:e.executionId,first_code:l,surface:e.surface??"testmd"},e.log)}}catch(c){console.warn(`evidence: validation error for ${e.executionId}`,c)}let u;if(e.saved&&e.packDir)try{u=await ct(r,e.executionId,t)}catch(c){console.warn(`evidence: store install failed for ${e.executionId}`,c)}if(e.outputStemDir)try{await Le(e.outputStemDir,{execution_id:e.executionId,run_kind:e.runKind,status:e.verdict,valid:s,at:new Date().toISOString()})}catch(c){console.warn(`evidence: execution-pointer append failed for ${e.executionId} (pack is sealed)`,c)}return{sealed:!0,valid:s,storePath:u}}import{release as _t}from"os";import{execFileSync as dr}from"child_process";var xt=!1,ce;function ur(){if(!xt)if(xt=!0,process.platform==="darwin")try{ce=dr("sw_vers",["-productVersion"],{timeout:2e3}).toString().trim()||void 0}catch{ce=_t()||void 0}else ce=_t()||void 0;return ce}function Be(e){let t={os:ke(process.platform)},r=ur();if(r&&(t.os_version=r),e.cdpBrowser){let n=/^([A-Za-z]+)\/(\d+)/.exec(e.cdpBrowser);n&&(t.browser=n[1].replace(/^Headless/,""),t.browser_version=n[2])}return e.resolution&&(t.resolution=e.resolution),t}async function St(e){if(e)try{let t=await fetch(`${e}/json/version`,{signal:AbortSignal.timeout(2e3)});if(!t.ok)return;let r=await t.json();return typeof r.Browser=="string"?r.Browser:void 0}catch{return}}function lr(e){let t;return()=>(t||(t=St(e)),t)}import{promises as Ue,existsSync as He,readFileSync as gr}from"fs";import{basename as vr,join as F}from"path";import{readFileSync as pr}from"fs";import{dirname as fr,resolve as mr}from"path";function bt(e,t){let r=mr(e),n=pr(r,"utf8");return N(t?J(n,te(fr(r),t)):n)}var X=class e{constructor(t){this.opts=t}executionId;testId;definitionPath=null;definitionContent=null;accumulatedSteps=[];maxOrdinal=0;_packDirOverride;_attached=!1;get attached(){return this._attached}static async attach(t){let r=vr(t.packDir).replace(/\.evidence$/,""),n=new e({origin:"testrun",runKind:"author",pid:process.pid,title:t.testId,started:new Date().toISOString(),producerVersion:it,cwd:t.cwd});n.executionId=r,n.testId=t.testId,n._packDirOverride=t.packDir,n._attached=!0;let i=F(t.packDir,"tests",t.testId);return await Ue.mkdir(i,{recursive:!0}),t.definition&&(await Ue.writeFile(F(i,t.definition.path),t.definition.content),n.definitionPath=t.definition.path,n.definitionContent=t.definition.content),n}async start(){if(this._attached)throw new Error("attach-mode session is already started");this.executionId=ge(),this.testId=this.opts.testmdRelPath?xe(this.opts.testmdRelPath):Se(this.opts.objectiveOrName??"session",this.opts.sessionId??this.executionId);let t=this.opts.definition??null;return await Re({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,t,this.opts.cwd,this.opts.packRootDir?this.pack:void 0),t&&(this.definitionPath=t.path,this.definitionContent=t.content),{executionId:this.executionId,testId:this.testId,packTestDir:this.packTestDir}}get pack(){return this._packDirOverride?this._packDirOverride:this.opts.packRootDir?F(this.opts.packRootDir,`${this.executionId}.evidence`):b(this.executionId,this.opts.cwd)}get packTestDir(){return F(this.pack,"tests",this.testId)}async writeDefinition(t,r="test.md"){await Ue.writeFile(F(this.packTestDir,r),t),this.definitionPath=r,this.definitionContent=t}computeAssuranceId(){try{if(this.opts.testmdRelPath&&this.opts.cwd){let t=F(this.opts.cwd,this.opts.testmdRelPath);if(He(t))return U(gr(t,"utf8"))?.id}}catch{}}computeDefinitionId(){try{if(this.opts.testmdRelPath&&this.opts.cwd){let t=F(this.opts.cwd,this.opts.testmdRelPath),r=F(this.opts.cwd,".context"),n=He(r)?O(r):void 0;if(He(t))return bt(t,n)}if(this.definitionContent!=null)return N(this.definitionContent)}catch{}}noteSpawn(t){this.accumulatedSteps.push(...t.steps),this.maxOrdinal=Math.max(this.maxOrdinal,t.maxOrdinal)}nextOrdinalOffset(){return this.maxOrdinal}get steps(){return this.accumulatedSteps}async writeResult(t){let r=Te(t.spawns),n=this.pack;await $e(n,this.testId,Oe({testId:this.testId,status:r,durationMs:t.durationMs,definitionPath:this.definitionPath,definitionId:this.computeDefinitionId(),assuranceId:this.computeAssuranceId(),externalId:be(t.externalIdInput),environment:Ee(t.runnerEnv,t.intentEnv),steps:t.steps,tags:t.tags}));let i=t.externalIdInput;return t.log&&(i.commit_id||i.test_id||i.testcase_id)&&t.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 hr(e,t,r=he){try{let n=await r(e);if(n.aborted.length>0||n.removed.length>0)try{t?.("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 Jr}from"fs";import{existsSync as Ye,mkdirSync as Ur,readdirSync as Hr,readFileSync as Gr,rmSync as zr,statSync as Yr,writeFileSync as Kr}from"fs";import{join as z}from"path";var wr={window:10,latest_only:!1,stale_at_run_weight:.5,counted_verdicts:["passed","failed"],accepted_oracle_modes:["authored","inferred","runtime-derived"],verified_threshold:.5,min_passes:1,risk_weights:{high:3}},yr={window:10,latest_only:!0,stale_at_run_weight:0,counted_verdicts:["passed","failed"],accepted_oracle_modes:["authored","inferred"],verified_threshold:1,min_passes:1,risk_weights:{high:3}},_r={lenient:wr,strict:yr};function xr(e,t){let r=e.slice(-t.window),n=new Map;for(let c of r)n.set(c.execution_id,c);let i=[...n.values()].sort((c,d)=>c.ts<d.ts?-1:c.ts>d.ts?1:c.execution_id<d.execution_id?-1:1).filter(c=>t.counted_verdicts.includes(c.verdict)&&t.accepted_oracle_modes.includes(c.oracle_mode));t.latest_only&&i.length>1&&(i=[i[i.length-1]]);let o=0,a=0,s=0;for(let c of i){let d=c.stale_at_run?t.stale_at_run_weight:1;o+=d,c.verdict==="passed"&&(a+=d,s++)}let u=o>0?Math.round(a/o*100)/100:0;return{score:u,verified:u>=t.verified_threshold&&s>=t.min_passes,passes:s,counted:i.length}}function kt(e,t){let r=0,n=0;for(let i of e){let o=t.risk_weights[i.risk]??1;r+=o,i.verified&&(n+=o)}return r>0?Math.round(n/r*100):0}function Sr(e,t){let r={},n={},i=[],o=0;for(let a of e.usecases){let s=[];for(let d of a.acceptance_criteria){let p=xr(d.executions??[],t);r[d.id]=p;let l={risk:d.risk,verified:p.verified};s.push(l),i.push(l)}let u=s.filter(d=>d.verified).length,c=s.length>0&&u===s.length?"covered":u>0?"partial":"uncovered";c==="covered"&&o++,n[a.id]={status:c,pct:kt(s,t)}}return{config:t,acs:r,usecases:n,summary:{coverage_pct:kt(i,t),acs_verified:`${i.filter(a=>a.verified).length}/${i.length}`,usecases_covered:`${o}/${e.usecases.length}`,uncovered:Object.values(n).filter(a=>a.status==="uncovered").length}}}function Et(e,t=_r){return{rollup_version:1,stale_sources:new Set(e.usecases.flatMap(r=>r.stale_sources??[])).size,high_risk_gaps:(e.gaps??[]).filter(r=>r.risk==="high").length,aspects:Object.fromEntries(Object.entries(t).map(([r,n])=>[r,Sr(e,n)]))}}var C=(e,t)=>e.nameOf.get(t)??t,V=(e,t)=>!e.superseded.has(t);function br(e,t){return e.byLabel(R.SCENARIO).filter(({cid:r})=>V(e,r)).filter(({cid:r})=>e.edgesFrom(r).some(n=>n.type===H.BELONGS_TO&&e.tipOf(n.dst)===t)).map(({cid:r})=>r)}function kr(e,t,r){let n=[];for(let{cid:i}of e.byLabel(R.AC)){if(!V(e,i))continue;let o=e.edgesFrom(i).find(s=>s.type===H.SCOPED_TO);if(!o)continue;let a=e.tipOf(o.dst);a===t?n.push({cid:i,scope:{type:"usecase",ref:C(e,t)}}):r.has(a)&&n.push({cid:i,scope:{type:"scenario",ref:C(e,a)}})}return n}function Er(e){let t=e.filter(r=>r!==void 0).map(r=>r.execution);return t.includes("failed")?"failed":t.includes("blocked")?"blocked":t.includes("passed")?"passed":"not-run"}var Ir={passed:"passed",failed:"failed",broken:"blocked",skipped:"not-run"};function Rr(e,t){let r=t.flatMap(n=>n?.acs??[]).filter(n=>n.ref===e).map(n=>Ir[n.verdict]??"not-run");return r.length===0?Er(t):r.includes("failed")?"failed":r.includes("blocked")?"blocked":r.includes("passed")?"passed":"not-run"}function It(e,t,r){let n=r?.scope==="run",i=[],o=new Set,a=new Map;for(let[c,d]of e.nameOf)a.set(e.tipOf(c)??c,d);let s=c=>a.get(c)??C(e,c);for(let{cid:c,content:d}of e.byLabel(R.USECASE)){if(!V(e,c)||e.trust.get(c)==="archived")continue;let p=e.tipOf(c),l=e.derivesInto(p).filter(f=>!e.superseded.has(f.ecid)),v=[...new Set(l.map(f=>String(f.props?.source_id??"")).filter(Boolean))].sort(),g=v.map(f=>{let y=e.heads.get(f);if(typeof y!="string")return{id:f};let m=e.getNode(y)?.content.blob;return{id:f,media_type:e.mediaOf(y).media_type,...typeof m=="string"?{cid:m}:{}}}),w=l[0],E=new Map;for(let f of l)f.props?.source_id&&f.props?.source_cid&&E.set(String(f.props.source_id),String(f.props.source_cid));let I=v.filter(f=>{let y=e.heads.get(f),m=E.get(f);return y!=null&&m!==void 0&&y!==m}).sort(),_=e.edgesFrom(c).filter(f=>f.type===H.DEPENDS_ON&&!e.superseded.has(f.ecid)).map(f=>Cr(e,f.dst)).filter(f=>f!==null).sort(),A=br(e,p),B=new Set(A),Y=A.map(f=>{let y=e.getNode(f)?.content??{},m=e.edgesFrom(f).filter(k=>k.type===H.EXERCISES&&!e.superseded.has(k.ecid)&&V(e,e.tipOf(k.dst))).map(k=>C(e,e.tipOf(k.dst))).sort();return{id:C(e,f),case_type:String(y.case_type??""),intent:String(y.intent??""),exercises:m}}).sort((f,y)=>f.id<y.id?-1:1),ue=!1,L=new Set([p]);for(let f of A)L.add(f);let q=kr(e,p,B).map(({cid:f,scope:y})=>{let m=e.getNode(f)?.content??{},k=[...new Set(e.edgesInto(f).filter(h=>h.type===H.VERIFIES&&!e.superseded.has(h.ecid)).map(h=>e.tipOf(h.src)).filter(h=>!!h&&V(e,h)))].sort((h,x)=>s(h)<s(x)?-1:1),le=k.length>0,pe=k.map(h=>t.get(`id:${s(h)}`)??t.get(`def:${String(e.getNode(h)?.content.definitionId??"")}`)),tt=pe.some(h=>h!==void 0);tt&&(ue=!0),L.add(f);for(let h of k)L.add(h);let Kt=le&&!tt?"unknown":e.stale(f)==="fresh"?"fresh":"stale",ee=m.expected_answer??{},fe=C(e,f),rt=k.flatMap(h=>(e.execHistory?.(s(h))??[]).map(x=>({execution_id:String(x.execution_id),ts:String(x.started_at),verdict:String(x.per_ac?.find(me=>me.ac_ref===fe)?.verdict??x.verdict),stale_at_run:!!x.stale_at_run,oracle_mode:String(x.oracle_mode),...x.via_parent?{via_parent:String(x.via_parent)}:{}}))).sort((h,x)=>h.ts<x.ts?-1:1).slice(-10);return{id:fe,text:String(m.text??""),risk:String(m.risk??""),scope:y,covered_by:k.map(h=>s(h)),...le?{link_type:"verifies"}:{},execution:Rr(fe,pe),fresh:Kt,derived:!!m.derived,...m.kind||m.expected_answer?{expected_answer:{...m.kind?{kind:String(m.kind)}:{},statement:String(m.text??""),...ee.operator!==void 0?{operator:ee.operator}:{},...ee.operand!==void 0?{operand:ee.operand}:{}}}:{},...le?{satisfied_by:k.map((h,x)=>{let me=e.getNode(h)?.content.check??{},nt=pe[x]?.steps?.checkStepId??me.verified_against;return{test:s(h),...nt?{step:nt}:{}}})}:{},...rt.length?{executions:rt}:{}}}).sort((f,y)=>f.id<y.id?-1:1);if(!(n&&!ue)){for(let f of L)o.add(f);i.push({id:C(e,c),title:String(d.title??""),...d.description||d.summary?{description:String(d.description??d.summary)}:{},...Array.isArray(d.actors)&&d.actors.length?{actors:d.actors.map(String)}:{},...d.value?{value:String(d.value)}:{},risk:String(d.risk??""),status:e.trust.get(c)==="trusted"?"approved":"draft",sources:g,...I.length?{stale_sources:I}:{},..._.length?{depends_on:_}:{},...w?{provenance:{derived_from:`${String(w.props?.source_id??"")}#${String(w.props?.anchor??"")}`}}:{},scenarios:Y,acceptance_criteria:q})}}i.sort((c,d)=>c.id<d.id?-1:1);let u=e.byLabel(R.GAP).filter(({cid:c})=>V(e,c)&&e.trust.get(c)!=="archived").filter(({content:c})=>{if(!n||typeof c.uc=="string"&&o.has(e.tipOf(c.uc)))return!0;let d=typeof c.ref=="string"?e.resolve(c.ref):null;return d!==null&&o.has(e.tipOf(d.cid))}).map(({cid:c,content:d})=>({ref:C(e,c),kind:String(d.kind??""),...d.risk?{risk:String(d.risk)}:{},...d.question?{question:Pr(d.question)}:{}})).sort((c,d)=>c.ref<d.ref?-1:1);return{usecases:i,...u.length?{gaps:u}:{},...n?{scope:"run"}:{}}}function Pr(e){if(typeof e=="string")return e;let t=e?.header;return typeof t=="string"?t:""}function Cr(e,t){let r=e.tipOf(t);return e.nodeLabel.get(r)!==R.USECASE||!V(e,r)?null:C(e,r)}import{mkdirSync as Ar,renameSync as Or,rmSync as Dr,writeFileSync as $r}from"fs";import{join as Rt}from"path";var Fr=5e6;function Pt(e,t,r){let n=Rt(e,"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 u=ft(t,s.cid);if(u===null||u.byteLength>Fr)continue;o||(Ar(n,{recursive:!0}),o=!0);let c=Rt(n,s.id),d=`${c}.tmp-${process.pid}`;$r(d,u),Or(d,c);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{Dr(n,{recursive:!0,force:!0})}catch{}}}import{existsSync as ze,readFileSync as Z,renameSync as Nr,writeFileSync as jr}from"fs";import{dirname as $t,isAbsolute as Ft,resolve as Lt}from"path";var Lr=new Set(["inline","testmd","testrun"]),Tr=new Set(["inferred","authored","runtime-derived"]),Ge=new Set(["passed","failed","broken","skipped"]);function Ct(e,t,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=re(e);if(t.latestHash!==i)return{record:null,errors:[{code:"STALE_BASIS",detail:`graph opened at ${String(t.latestHash)} but chain head is ${String(i)} \u2014 re-open and retry`}]};let o=[];for(let s of r.facts){let u=`executions[${s.ref}]`,c=t.resolve(s.ref),d=c?t.tipOf(c.cid):null;if(!c||!d||t.superseded.has(d)){n.push({code:"UNKNOWN_REF",detail:`${u}: '${s.ref}' is not a live committed node`});continue}if(t.nodeLabel.get(d)!==R.TEST){n.push({code:"ILLEGAL_TARGET",detail:`${u}: execution facts attach to tests \u2014 '${s.ref}' is a ${t.nodeLabel.get(d)}`});continue}if(!Lr.has(s.mode)){n.push({code:"BAD_MODE",detail:`${u}: mode '${s.mode}' not in inline|testmd|testrun`});continue}if(!Ge.has(s.verdict)){n.push({code:"BAD_VERDICT",detail:`${u}: verdict '${s.verdict}' not in ${[...Ge].join("|")}`});continue}if(!Tr.has(s.oracle_mode)){n.push({code:"BAD_ORACLE_MODE",detail:`${u}: 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:`${u}: 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:`${u}: execution_id, started_at and definition_id_at_run are required`});continue}let p=[];for(let l of s.per_ac??[]){let v=t.resolve(l.ac_ref),g=v?t.tipOf(v.cid):null;if(!v||!g||t.superseded.has(g)||t.nodeLabel.get(g)!==R.AC){n.push({code:"UNKNOWN_REF",detail:`${u}.per_ac: '${l.ac_ref}' is not a live AC`});continue}if(!Ge.has(l.verdict)){n.push({code:"BAD_VERDICT",detail:`${u}.per_ac['${l.ac_ref}']: verdict '${l.verdict}'`});continue}p.push({ac_ref:t.nameOf.get(g)??g,verdict:l.verdict})}o.push({about:d,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=ne(e,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[],executions:o,source_head_moves:{}});return ie(e),{record:a.record,errors:null}}function Tt(e){let t={failed:3,broken:2,skipped:1,passed:0},r=new Map;for(let n of e)for(let i of n.verifies??[]){let o=r.get(i);(o===void 0||(t[n.status]??0)>(t[o]??0))&&r.set(i,n.status)}return[...r.entries()].map(([n,i])=>({ref:n,verdict:i}))}function Nt(e){let t=[],r=oe(e.cwd);if(!ze(r))return{synced:0,superseded:0,skipped:"no-context",warnings:t};let n=e.by??{kind:"ai",id:"exec-sync"},i=O(r),o=[],a=0,s=new Set;for(let c of e.members){let d=Ft(c.path)?c.path:Lt(e.cwd,c.path);for(let p of Mr(d)){if(s.has(p.path))continue;s.add(p.path);let l=p.path===d?void 0:U(Z(d,"utf8"))?.id,v=Z(p.path,"utf8"),g=U(v);if(!g?.id)continue;let w=i.resolve(g.id),E=w?i.tipOf(w.cid):null;if(!w||!E||i.superseded.has(E)){t.push(`sync: ${g.id} does not resolve to a live test \u2014 skipped (foreign store?)`);continue}let I=N(J(v,te($t(p.path),i))),_=String(i.getNode(E)?.content.test_md_blob??""),A=N(J(_,dt(i))),B=!1,Y=E;if(I===A)g.base!==A&&Dt(p.path,v,A,t);else if(g.base===A){let m=Vr(r,i,E,v,I,n);m.error?(t.push(`sync: could not supersede ${g.id}: ${m.error}`),B=!0):(a++,Y=m.newCid,B=m.oracleTier,Dt(p.path,Z(p.path,"utf8"),I,t),i=O(r))}else B=!0,t.push(g.base?`sync: ${g.id} was edited from an older version \u2014 graph kept; reconcile via a redesign or maintain`:`sync: ${g.id} carries no base pin (hand-copied file?) \u2014 fact attached with drift flag`);let L=i.getNode(Y)?.content.check,q=p.path===d?c.acs??[]:[],f=q.filter(m=>At(i,m.ref)),y=q.filter(m=>!At(i,m.ref)).map(m=>m.ref);o.push({ref:g.id,definition_id_at_run:I,verdict:c.verdict,...f.length?{per_ac:f.map(m=>({ac_ref:m.ref,verdict:m.verdict}))}:{},drift_flag:B,oracle_mode:L?.expected_mode??(at(L?.operand)?"runtime-derived":"inferred"),stale_at_run:i.stale(Y)!=="fresh",...y.length?{unresolved_acs:y}:{},execution_id:c.executionId,...c.evidenceId?{evidence_id:c.evidenceId}:{},...c.durationMs!==void 0?{duration_ms:c.durationMs}:{},started_at:c.startedAt,mode:c.mode,local:c.local,...l?{via_parent:l}:{}})}}if(o.length===0)return{synced:0,superseded:a,warnings:t};let u=Ct(r,O(r),{facts:o,by:n});return u.errors?(t.push(...u.errors.map(c=>`sync facts: ${c.code}: ${c.detail}`)),{synced:0,superseded:a,warnings:t}):{synced:o.length,superseded:a,warnings:t}}function Mr(e){let t=[],r=new Set,n=i=>{if(r.has(i)||!ze(i))return;r.add(i);let o=Z(i,"utf8");for(let a of o.split(`
|
|
5
5
|
`)){let s=/^@import\s+(\S+)\s*$/.exec(a.trim());if(!s)continue;let u=Ft(s[1])?s[1]:Lt($t(i),s[1]);ze(u)&&U(Z(u,"utf8"))?.id&&n(u)}t.push({path:i})};return n(e),t}function At(e,t){let r=e.resolve(t),n=r?e.tipOf(r.cid):null;return!!(r&&n&&!e.superseded.has(n)&&e.nodeLabel.get(n)==="ac")}function Vr(e,t,r,n,i,o){let a=t.getNode(r);if(!a)return{oracleTier:!1,error:"tip unreadable"};let s=ut(n),u=String(a.content.test_md_blob??""),c=/^#\s+(.+?)\s*$/m.exec(s)?.[1]??String(a.content.title??""),d={...a.content,test_md_blob:s,definitionId:i,title:c},p=lt("test",d);if(p.length>0)return{oracleTier:!1,error:p.map(w=>w.detail).join("; ")};let l=pt("test",d);if(l===r)return{newCid:r,oracleTier:!1};let v=Ot(u)!==Ot(s),g=re(e);if(t.latestHash!==g)return{oracleTier:v,error:`store advanced under the sync (basis ${String(t.latestHash)} vs head ${String(g)}) \u2014 re-run to retry`};try{ne(e,{ts:new Date().toISOString(),proposal_id:null,nodes:[{cid:l,label:"test",content:d}],edges:[],review:[{id:l,kind:"review-item",resolution:"edited",edit:null,reason:"edited on disk (run sync)",by:o}],supersessions:[{kind:"node",old:r,new:l,reason:"edited on disk (run sync)",by:o}],source_head_moves:{}},{expectPrev:g})}catch(w){return{oracleTier:v,error:w instanceof Error?w.message:String(w)}}return ie(e),{newCid:l,oracleTier:v}}var Br=/\s@verifies\s+(ac-[\w.:\/-]+(?:\s*,\s*ac-[\w.:\/-]+)*)\s*$/;function Ot(e){let t=[],r=e.split(`
|
|
@@ -8,6 +8,6 @@ import{b,c as ge,d as ct,f as ve,g as he}from"./chunk-FYOCF7DY.js";import{a as a
|
|
|
8
8
|
`),o=-1;if(i[0]?.trim()==="---"){for(let u=1;u<i.length;u++)if(i[u].trim()==="---"){o=u;break}}if(o<0)return;let a=!1;for(let u=1;u<o;u++){if(/^\s+base:\s*sha256:[0-9a-f]+\s*$/.test(i[u])){i[u]=i[u].replace(/sha256:[0-9a-f]+/,r),a=!0;break}if(/^assurance:\s*$/.test(i[u])&&!i.slice(u,Math.min(u+3,o)).some(c=>/^\s+base:/.test(c))){i.splice(u+2,0,` base: ${r}`),a=!0;break}}if(!a)return;let s=`${e}.tmp-sync`;jr(s,i.join(`
|
|
9
9
|
`)),Nr(s,e)}catch(i){n.push(`sync: pin refresh failed for ${e} (${i instanceof Error?i.message:String(i)}) \u2014 next run self-heals`)}}var Wr={passed:"passed",failed:"failed",broken:"blocked",skipped:"not-run"},jt=(e,t)=>{try{if(!Ye(t))return{status:"skipped",reason:"no context store at the project root"};let r=z(e,"tests");if(!Ye(r))return{status:"skipped",reason:"pack has no tests/"};let n=new Map;for(let s of Hr(r)){let u=z(r,s,"result.yaml");if(!Ye(u)||!Yr(z(r,s)).isDirectory())continue;let c=T(Gr(u,"utf8"));if(!c?.definition_id&&!c?.assurance_id)continue;let d=Tt(c.steps??[]),p={testShortId:String(c.test??s),execution:Wr[String(c.status)]??"not-run",...d.length?{acs:d}:{}};c.assurance_id&&n.set(`id:${c.assurance_id}`,p),c.definition_id&&n.set(`def:${c.definition_id}`,p)}let i=It(O(t),n,{scope:"run"}),o=Et(i);Pt(e,t,i);let a=S({...i,rollup:o},{lineWidth:-1});return Ur(z(e,"coverage"),{recursive:!0}),Kr(z(e,"coverage","usecases.yaml"),a),{status:"written"}}catch(r){try{zr(z(e,"coverage","sources"),{recursive:!0,force:!0})}catch{}return{status:"skipped",reason:r instanceof Error?r.message:String(r)}}};async function Xr(e){try{let t=new X({origin:"inline",runKind:"author",pid:e.pid,title:e.title,started:new Date().toISOString(),producerVersion:e.producerVersion,surfaces:e.surfaces,objectiveOrName:e.objectiveOrName,sessionId:e.sessionId,cwd:e.cwd,packRootDir:e.packRootDir}),r=await t.start();return{session:t,...r,packDir:t.pack,spawns:[],startedAtMs:Date.now(),cwd:e.cwd}}catch(t){return console.warn("evidence: inline pack creation failed",t),null}}function Zr(e,t,r){if(!e)return;e.session.noteSpawn(t),t.resolution&&(e.resolution=t.resolution);let n=(r?.per_flow_metadata??[]).map(i=>({resultCode:i?.result_code!=null?Number(i.result_code):null}));e.spawns.push({resultCode:r?.result_code!=null?Number(r.result_code):null,...n.length?{perFlow:n}:{}})}function Qr(e){if(e)return{packTestDir:e.packTestDir,ordinalOffset:e.session.nextOrdinalOffset()}}async function qr(e,t){if(!e)return null;if(e.finalized)return e.finalized;let r=(n,i,o)=>t.log?t.log("warn",n,i,o):console.warn(`evidence: ${i}`,o??"");try{if(t.recordedTestPath)try{await e.session.writeDefinition(await Jr.readFile(t.recordedTestPath,"utf8"))}catch(a){r("EVIDENCE_DEFINITION_FAILED","could not attach synthesized test.md",{error:String(a)})}let n=t.cdpBrowserCapture?await t.cdpBrowserCapture():void 0,i=await e.session.writeResult({steps:e.session.steps,spawns:e.spawns.length?e.spawns:[{resultCode:null}],externalIdInput:{...t.externalIdInput,execution_id:e.executionId},runnerEnv:Be({cdpBrowser:n,resolution:e.resolution}),intentEnv:{model:t.model,platform:"Desktop",platform_type:"web"},durationMs:t.durationMs??Date.now()-e.startedAtMs,log:t.log});try{if(t.recordedTestPath){let a=Nt({cwd:t.cwd??e.cwd??process.cwd(),members:[{path:t.recordedTestPath,verdict:i,executionId:e.executionId,startedAt:new Date(e.startedAtMs).toISOString(),mode:"inline",local:t.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=(t.coverageWriter??jt)(e.packDir,oe(t.cwd??e.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 Ve({executionId:e.executionId,testId:e.testId,saved:t.saved,runKind:"author",verdict:i,cwd:t.cwd??e.cwd,packDir:e.packDir,tuiLogPath:t.tuiLogPath,log:t.log,surface:"inline"});return e.finalized=o,t.log?.("info","EVIDENCE_SEALED","Inline pack sealed",{execution_id:e.executionId,verdict:i,valid:o.valid,pack:e.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 sn,openSync as cn,readSync as an,closeSync as dn}from"fs";import{basename as un,resolve as ln}from"path";import{createServer as en}from"http";import{createReadStream as tn,promises as rn}from"fs";import{randomBytes as nn}from"crypto";var ae="127.0.0.1";function Mt(e,t){if(!e)return null;let r=/^bytes=(\d*)-(\d*)$/.exec(e.trim());if(!r)return null;let[,n,i]=r;if(n===""&&i==="")return null;if(n===""){let s=Number(i);return s===0||t===0?"unsatisfiable":{start:Math.max(0,t-s),end:t-1}}let o=Number(n);if(o>=t)return"unsatisfiable";let a=i===""?t-1:Math.min(Number(i),t-1);return a<o?null:{start:o,end:a}}async function Ke(e){let t=nn(16).toString("hex"),r=en((i,o)=>{on(i,o,e,t).catch(()=>o.destroy())});await new Promise((i,o)=>{r.once("error",o),r.listen(e.port??0,ae,()=>{r.removeListener("error",o),i()})});let n=r.address().port;return{port:n,urlFor:i=>`http://${ae}:${n}/${t}/${encodeURIComponent(i)}`,close:()=>new Promise(i=>{r.close(()=>i()),r.closeAllConnections()})}}async function on(e,t,r,n){let i=e.url??"/",o=_=>{try{r.log?.("warn","EVIDENCE_SERVE_DENIED",{reason:_,path:i})}catch{}};if(e.headers.host!==`${ae}:${e.socket.localPort}`){o("host_mismatch"),t.writeHead(403).end();return}let a=e.headers.origin;if(a!==void 0&&!r.allowedOrigins.includes(a)){o("origin_denied"),t.writeHead(403).end();return}let s=a?{"Access-Control-Allow-Origin":a,Vary:"Origin","Access-Control-Expose-Headers":"Content-Range, Content-Length"}:{};if(e.method==="OPTIONS"){let _={...s,"Access-Control-Allow-Methods":"GET, HEAD, OPTIONS","Access-Control-Allow-Headers":"range","Access-Control-Max-Age":"86400"};e.headers["access-control-request-private-network"]==="true"&&(_["Access-Control-Allow-Private-Network"]="true"),t.writeHead(204,_).end();return}if(e.method!=="GET"&&e.method!=="HEAD"){t.writeHead(405,s).end();return}let u;try{let _=new URL(e.url??"/",`http://${ae}`).pathname.split("/");if(_.length!==3||_[1]!==n){o("bad_token"),t.writeHead(404,s).end();return}u=decodeURIComponent(_[2])}catch{o("not_found"),t.writeHead(404,s).end();return}let c=r.packs.get(u);if(!c){o("not_found"),t.writeHead(404,s).end();return}let d;try{let _=await rn.stat(c);if(!_.isFile())throw new Error("not a file");d=_.size}catch{o("not_found"),t.writeHead(404,s).end();return}let p={...s,"Accept-Ranges":"bytes","Content-Type":"application/zip","Cache-Control":"no-store"};if(e.method==="HEAD"){t.writeHead(200,{...p,"Content-Length":String(d)}).end();return}let l=Mt(e.headers.range,d);if(l==="unsatisfiable"){o("unsatisfiable"),t.writeHead(416,{...s,"Content-Range":`bytes */${d}`}).end();return}let[v,g,w]=l===null?[0,d-1,200]:[l.start,l.end,206],E={...p,"Content-Length":String(g-v+1)};if(w===206&&(E["Content-Range"]=`bytes ${v}-${g}/${d}`),t.writeHead(w,E),d===0){t.end();return}let I=tn(c,{start:v,end:g});I.on("error",()=>t.destroy()),t.on("close",()=>I.destroy()),I.pipe(t)}function Q(e,t){return(t??ot(e).evidenceViewerUrl).replace(/\/+$/,"")}function We(e,t){return`${t}/?pack=${encodeURIComponent(e)}`}function Je(e){return`evidence: view locally with \`kane-cli evidence serve ${e}\``}async function pn(e,t,r={}){let n=r.out??(d=>process.stdout.write(d+`
|
|
10
10
|
`)),i=d=>(n(`error: ${d}`),2);if(t.env!=="prod"&&t.env!=="stage")return i(`invalid --env: ${String(t.env)}`);if(t.port!==void 0&&(!Number.isInteger(t.port)||t.port<1||t.port>65535))return i("invalid --port: expected an integer 1-65535");let o;try{o=Q(t.env,t.viewerUrl),new URL(o)}catch{return i(`invalid --viewer-url: ${t.viewerUrl}`)}if(e.length===0)return i("no pack paths given");let a=new Map;for(let d of e){let p=ln(d),l;try{l=sn(p)}catch{return i(`${d}: not found`)}if(l.isDirectory())return i(`${d}: is a directory \u2014 packs must be sealed .evidence files (run the execution to completion, or seal it, first)`);if(!l.isFile())return i(`${d}: not a regular file`);let v=Buffer.alloc(2),g=cn(p,"r");try{an(g,v,0,2,0)}finally{dn(g)}if(v.toString("latin1")!=="PK")return i(`${d}: not a sealed evidence pack (zip magic missing)`);let w=un(p);if(a.has(w))return i(`duplicate pack basename: ${w} (URL names collide \u2014 rename one)`);a.set(w,p)}let s=r.log??((d,p,l)=>process.stderr.write(`warn: ${p} reason=${l.reason} path=${l.path}
|
|
11
|
-
`)),u;try{u=await Ke({packs:a,allowedOrigins:[new URL(o).origin],port:t.port,log:s})}catch(d){return i(`could not bind 127.0.0.1${t.port?`:${t.port}`:""} \u2014 ${d.message}`)}n(`serving ${a.size} pack${a.size===1?"":"s"} on http://127.0.0.1:${u.port}`);for(let d of a.keys()){let p=u.urlFor(d);n(d),n(` pack ${p}`),n(` viewer ${We(p,o)}`)}return n("press Ctrl-C to stop"),await(r.hold??fn)(),await u.close(),0}function fn(){return new Promise(e=>{let t=process.listeners("SIGINT");process.removeAllListeners("SIGINT"),process.once("SIGINT",()=>{for(let r of t)process.on("SIGINT",r);e()})})}import{promises as de}from"fs";import{tmpdir as
|
|
11
|
+
`)),u;try{u=await Ke({packs:a,allowedOrigins:[new URL(o).origin],port:t.port,log:s})}catch(d){return i(`could not bind 127.0.0.1${t.port?`:${t.port}`:""} \u2014 ${d.message}`)}n(`serving ${a.size} pack${a.size===1?"":"s"} on http://127.0.0.1:${u.port}`);for(let d of a.keys()){let p=u.urlFor(d);n(d),n(` pack ${p}`),n(` viewer ${We(p,o)}`)}return n("press Ctrl-C to stop"),await(r.hold??fn)(),await u.close(),0}function fn(){return new Promise(e=>{let t=process.listeners("SIGINT");process.removeAllListeners("SIGINT"),process.once("SIGINT",()=>{for(let r of t)process.on("SIGINT",r);e()})})}import{promises as de}from"fs";import{tmpdir as hn}from"os";import{join as Ut,resolve as Ze}from"path";var mn=["error","prefer_first","prefer_latest","discard"],gn=["external_id.commit_id","external_id.test_id"];function Vt(e){let t=e.replace(/-/g,"_");return mn.includes(t)?t:null}function Bt(e){let t=e==="discard"?{on_collision:"discard"}:{on_collision:"error",identity:{keys:[...gn],on_same:e??"nest",on_different:e?"error":"split"}};return S({packs:{require_status:"finalized",require_valid:"L1",on_ineligible:"abort"},tests:t,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 Xe(e){try{if(!e.isTTY){e.log(Je(e.packPath));return}let t=Q(e.env);await(e.renderPrompt??vn)(e.packPath,t)}catch(t){try{e.log(`evidence view failed \u2014 ${t.message}`)}catch{}}}async function vn(e,t){let r=await import("./react-QWOAB3TB.js"),{render:n}=await import("./build-JIKYOZUH.js"),{EvidenceViewOffer:i}=await import("./EvidenceViewOffer-54GEARRX.js");await new Promise(o=>{let a=n(r.default.createElement(i,{packPath:e,viewerBase:t,onDone:()=>{a.unmount(),o()}}),{stdout:process.stderr,exitOnCtrlC:!1})})}async function wn(e,t,r=process.cwd(),n={}){let i=n.out??(l=>process.stdout.write(l+`
|
|
12
12
|
`)),o=n.err??(l=>process.stderr.write(l+`
|
|
13
|
-
`)),a=l=>(o(`evidence merge: ${l}`),2);if(!t.runId)return a("--run-id is required (merged identity is the caller's fact)");if(t.rules&&t.onCollision)return a("--rules and --on-collision are mutually exclusive");let s
|
|
13
|
+
`)),a=l=>(o(`evidence merge: ${l}`),2);if(!t.runId)return a("--run-id is required (merged identity is the caller's fact)");if(t.rules&&t.onCollision)return a("--rules and --on-collision are mutually exclusive");let s;if(t.onCollision!==void 0){let l=Vt(t.onCollision);if(!l)return a(`invalid --on-collision: ${t.onCollision} (expected error | prefer-first | prefer-latest | discard)`);s=l}let u=[];for(let l of e){let v=await yn(l,r);if(!v)return a(`no pack found for "${l}"`);u.push(v)}let c=t.out?Ze(r,t.out):b(t.runId,r),d=null,p;t.rules?p=Ze(r,t.rules):(d=await de.mkdtemp(Ut(hn(),"kane-merge-rules-")),p=Ut(d,"merge-rules.yaml"),await de.writeFile(p,Bt(s)));try{let l=await(n.mergeFn??st)(u,{runId:t.runId,out:c,rulesPath:p,title:t.title,finalize:t.finalize});return t.json?i(JSON.stringify(l)):_n(i,l),l.output.finalized&&!t.json&&await(n.offer??Xe)({packPath:c,env:t.env,isTTY:n.isTTY??(!!process.stdin.isTTY&&!!process.stderr.isTTY),log:o}),0}catch(l){let v=l instanceof Error?l.message:String(l);return l?.code==="ABORT"?(o(`evidence merge: aborted \u2014 ${v}`),1):a(v)}finally{d&&await de.rm(d,{recursive:!0,force:!0}).catch(()=>{})}}async function yn(e,t){let r=Ze(t,e);if(await Ht(r))return r;let n=b(e,t);return await Ht(n)?n:null}async function Ht(e){try{return await de.stat(e),!0}catch{return!1}}function _n(e,t){let{packs:r,tests:n,output:i}=t;e(`evidence: merged ${n.merged} tests from ${r.eligible.length} packs -> ${i.path} (${i.finalized?"sealed":"live"})`);for(let o of r.skipped)e(` 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}`,e(` collision ${o.test}: ${a} (${o.rule})`)}for(let o of n.discarded)e(` discarded ${o}`)}import{copyFileSync as xn,existsSync as Qe,mkdirSync as Sn}from"fs";import{join as Gt}from"path";function bn(e,t,r){try{let n=Gt(e,"auteur","execution.json");if(Qe(n))return!0;for(let i of t)if(!(!i||!Qe(i)))return Sn(Gt(e,"auteur"),{recursive:!0}),xn(i,n),!0}catch(n){try{r?.("debug","EVIDENCE_BLOB_COPY_FAILED","auteur execution blob copy failed",{operation:"ensureAuteurExecution",source:t.find(i=>i&&Qe(i))??null,error:n instanceof Error?n.message:String(n)})}catch{}}return!1}import{readFileSync as kn}from"fs";import{join as En}from"path";function et(e){let t=[],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 u=s?.operation_id;typeof u=="string"&&u&&t.push(u)}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 u=s?.children;if(Array.isArray(u))for(let c of u)n(c)}}},i=e?.instructions;if(Array.isArray(i))for(let o of i)n(o);return{ids:t,linear:r}}function In(e){return et(e).ids}function qe(e,t){let r=new Set(t.map(s=>s.action_id).filter(Boolean)),n=-1;for(let s of r){let u=e.indexOf(s);u>n&&(n=u)}let i=t.reduce((s,u)=>Math.max(s,u.ordinal),0),o=new Set,a=[];for(let s of e.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 zt(e,t){let r=new Set(t),n=e.filter(o=>o.action_id);if(n.some(o=>r.has(o.action_id))||n.length>t.length)return null;let i=0;return e.map(o=>o.action_id?{...o,action_id:t[i++]}:o)}function Rn(e,t){if(e.length>t.length)return!1;for(let r=0;r<e.length;r++)if(t[r]!==e[r].action_id)return!1;return!0}function Pn(e,t,r,n=!0){if(t.length===0)return{steps:e,tail:[]};let i=(r&&n?zt(e,t):null)??e,o=i.filter(s=>s.action_id),a=new Set(t);return o.length>0&&o.every(s=>a.has(s.action_id))?{steps:i,tail:qe(t,i)}:o.length>0&&!Rn(o,t)?{steps:i,tail:[],unjoined:!0}:{steps:i,tail:qe(t,i)}}function Yt(e){try{let t=kn(En(e,"auteur","execution.json"),"utf8");return et(JSON.parse(t))}catch{return{ids:[],linear:!0}}}function Cn(e){return Yt(e).ids}export{M as a,we as b,ye as c,_e as d,xe as e,Se as f,be as g,ke as h,Ee as i,Zt as j,Ie as k,Re as l,Qt as m,qt as n,Pe as o,Oe as p,De as q,$e as r,Fe as s,Le as t,er as u,tr as v,Te as w,rr as x,Ne as y,je as z,Me as A,yt as B,Ve as C,Be as D,St as E,lr as F,X as G,hr as H,Tt as I,Nt as J,jt as K,Xr as L,Zr as M,Qr as N,qr as O,Mt as P,Ke as Q,Q as R,We as S,Je as T,pn as U,Xe as V,wn as W,bn as X,et as Y,In as Z,qe as _,zt as $,Pn as aa,Yt as ba,Cn as ca};
|
|
@@ -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,e as o}from"./chunk-
|
|
2
|
+
import{a as l}from"./chunk-RZ4F3BHX.js";import{a,c,e as o}from"./chunk-HJGUEZLW.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,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as G,c as P,e as J,h as q,i as z,j as Q,m as V,n as X,o as T}from"./chunk-RKWJG3WW.js";import{e as U}from"./chunk-
|
|
2
|
+
import{b as G,c as P,e as J,h as q,i as z,j as Q,m as V,n as X,o as T}from"./chunk-RKWJG3WW.js";import{e as U}from"./chunk-EHN5HTUD.js";import{copyFileSync as ae,cpSync as le,existsSync as w,mkdirSync as ue,readFileSync as je,readdirSync as pe,rmSync as Fe,writeFileSync as Oe}from"fs";import{dirname as Te,isAbsolute as _e,join as R,relative as Le,resolve as Ae}from"path";import{writeFileSync as ge,mkdirSync as Se,readFileSync as Re}from"fs";import{dirname as Ie,basename as Y}from"path";function ee(e){let t=e.outPath??P(e.sourcePath);Se(Ie(t),{recursive:!0});let r=[];r.push("---"),r.push(`test: ../${Y(e.sourcePath)}`),r.push(`status: ${e.overallStatus}`),r.push(`started: ${e.startedISO}`),r.push(`duration_s: ${e.durationS}`),r.push(`session_id: ${e.sessionId}`),r.push("---",""),r.push(`# ${e.title??Y(e.sourcePath)} \u2014 Result`,"");for(let l=0;l<e.rootSteps.length;l++){let a=e.rootSteps[l],i=e.outcomes.find(p=>p.rootStepIndex===l+1);if(r.push(xe(a,i)),i?.stepMd5&&r.push(`md5: ${i.stepMd5}`),i?.status==="failed"&&i.reason&&r.push(`Reason: ${i.reason}`),i?.softFailures?.length)for(let p of i.softFailures){let o=p.reason?`: ${p.reason}`:"";r.push(`\u26A0 optional sub-step ${p.subStepIndex} failed${o}`)}a.body.kind==="objective"&&i?.status!=="skipped"&&r.push(a.body.text),r.push("")}return ge(t,r.join(`
|
|
3
3
|
`),"utf8"),t}function xe(e,t){if(!t)return`## ${e.heading} (no outcome)`;let r=t.duration_s!=null?`${t.duration_s}s`:"\u2014";if(t.status==="skipped")return`## ${e.heading} \u23ED skipped`;let l=t.softFailed?" (optional)":"";if(t.refKind&&t.status==="passed"){let a=t.helperResultRelPath?` \u2192 ${t.helperResultRelPath}`:"";return`## ${e.heading} \u2713 passed (via @${t.refKind} ${t.refLabel} \u2014 ${t.inlinedCount} inlined steps, ${r}${a})`}if(t.refKind&&t.status==="failed"){let a=t.failedSubStepIndex&&t.failedSubStepIndex.length>0?` \u2014 at sub-step ${t.failedSubStepIndex.join(" \u2192 sub-step ")}`:"",i=t.helperResultRelPath?` \u2192 ${t.helperResultRelPath}`:"";return`## ${e.heading} \u2717 failed${l} (via @${t.refKind} ${t.refLabel}${a}, ${r}${i})`}return t.status==="passed"?`## ${e.heading} \u2713 passed (${r})`:`## ${e.heading} \u2717 failed${l} (${r})`}var ye=/^##\s+(.+?)\s+(✓ passed|✗ failed(?:\s+\(optional\))?|⏭ skipped)(?:\s+\((.*)\))?\s*$/,be=/via\s+@\w+\s+(\S+).*?(?:→\s+(\S+))?\s*$/,ke=/^md5:\s+([a-f0-9]{32})\s*$/;function Z(e,t){for(let r=t;r<e.length&&!/^##\s/.test(e[r]);r++){if(e[r].trim()==="")continue;let l=ke.exec(e[r]);return l?l[1]:null}return null}function $(e){let r=Re(e,"utf8").split(`
|
|
4
4
|
`),l="passed";if(r[0]?.trim()==="---")for(let i=1;i<r.length&&r[i].trim()!=="---";i++){let p=/^status:\s+(passed|failed|interrupted)\s*$/.exec(r[i]);p&&(l=p[1])}let a=[];for(let i=0;i<r.length;i++){let p=ye.exec(r[i]);if(!p)continue;let o=p[1],s=p[2],c=p[3]??"",m=s.startsWith("\u2713")?"passed":s.startsWith("\u23ED")?"skipped":"failed";if(/via\s+@/.test(c)){let f=be.exec(c),b=f?.[1]??"",g=f?.[2]??null;a.push({kind:"import",heading:o,status:m,md5:Z(r,i+1),importPath:b,helperResultRelPath:g})}else a.push({kind:"objective",heading:o,status:m,md5:Z(r,i+1)})}return{overallStatus:l,steps:a}}import{copyFileSync as te,existsSync as N,mkdirSync as ve,writeFileSync as se,promises as Be}from"fs";import{join as D,dirname as re,basename as Pe}from"path";async function ne(e){for(let t=0;t<e.totalRunDirs;t++){let r=e.runIndex+t,l=D(e.sessionDir,"runs",String(r)),a=D(e.stagingStepDir,"flows",String(t));ve(a,{recursive:!0});let i=D(a,"actions.ndjson");if(e.packTestDir){let s=D(e.packTestDir,"logs",`${r}-actions.ndjson`);if(N(s)){te(s,i);continue}let c=re(re(e.packTestDir)),m=Pe(e.packTestDir),I=N(c)?await U(c,`tests/${m}/logs/${r}-actions.ndjson`).catch(()=>null):null;se(i,I??"");continue}let p=[D(l,"run-test","actions.ndjson"),D(l,"actions.ndjson")],o=!1;for(let s of p)if(N(s)){te(s,i),o=!0;break}o||se(i,"")}}import{existsSync as K}from"fs";import{dirname as we,join as j,basename as H}from"path";function Ye(e){let t=[],r=new Set,l=new Map;function a(s){if(l.has(s))return l.get(s);let c=P(s),m=K(c)?$(c):null;return l.set(s,m),m}let i=new Map;function p(s){if(i.has(s))return i.get(s);let c=j(s,"Result.md"),m=K(c)?$(c):null;return i.set(s,m),m}function o(s){for(let c=1;c<s.trace.length;c++){let m=s.trace[c-1],I=a(m.file);if(!I)continue;let f=I.steps[m.stepIndex-1];if(f){if(f.kind!=="import")return{kind:"author",reason:"structure-mismatch"};if(H(f.importPath)!==H(s.trace[c].file))return{kind:"author",reason:"structure-mismatch"};if(f.md5!=null&&f.md5!==m.rowMd5)return{kind:"author",reason:"structure-mismatch"}}}return null}for(let s of e.steps){let c=s.trace[s.trace.length-1].stepIndex,m=r.has(s.owningFile);for(let g=0;g<s.trace.length-1&&!m;g++)r.has(s.trace[g].file)&&(m=!0);if(m){t.push({kind:"author",reason:a(s.owningFile)===null?"no-result-md":"downstream-of-divergence"});continue}let I=o(s);if(I){t.push(I);for(let g=0;g<s.trace.length;g++)r.add(s.trace[g].file);continue}let f=a(s.owningFile),b;if(f===null&&s.trace.length>1){let g=W(s.trace);b=ie(s,p(g),c,g)}else b=ie(s,f,c);if(t.push(b),b.kind==="author"){r.add(s.owningFile);for(let g=0;g<s.trace.length-1;g++)r.add(s.trace[g].file)}}return t}function ie(e,t,r,l=null){if(!t)return{kind:"author",reason:"no-result-md"};let a=t.steps[r-1];if(!a)return{kind:"author",reason:"no-result-md"};if(a.kind!=="objective")return{kind:"author",reason:"structure-mismatch"};if(a.status!=="passed")return{kind:"author",reason:"recorded-failed"};let i=T(e);if(i!==a.md5)return{kind:"author",reason:"md5-mismatch"};let p=l===null?Q(e.owningFile,r,i.slice(0,8)):j(l,".internal","steps",`${r}-${i.slice(0,8)}`),o=j(p,"flows","0","actions.ndjson");return K(o)?{kind:"replay",recordingDir:p}:{kind:"author",reason:"missing-recording"}}function Ze(e){return e.some(t=>t.kind==="author")}function et(e){for(let t=0;t<e.length;t++)if(e[t].kind==="author")return t;return e.length}function W(e){let t=i=>{let p=H(i);return p.endsWith("_test.md")?p.slice(0,-8):p.endsWith(".md")?p.slice(0,-3):p},r=t(e[0].file),l=t(e[e.length-1].file),a=e.slice(0,-1).map(i=>String(i.stepIndex));return j(we(e[e.length-1].file),`helper-output-${l}-${r}-${a.join("-")}`)}function tt(e){return j(e.recordingDir,"flows","0","actions.ndjson")}import{existsSync as oe,mkdirSync as $e,rmSync as De,cpSync as Me}from"fs";function de(e,t){oe(e)&&(oe(t)&&De(t,{recursive:!0,force:!0}),$e(t,{recursive:!0}),Me(e,t,{recursive:!0}))}async function mt(e){let t=new Map;for(let o of e.stepRunRecords)t.set(o.testmdStepIndex,o);let r=e.authoredFlatIdx??new Set,l=[],a=[],i=new Map,p=o=>{if(i.has(o))return i.get(o);let s=R(o,"Result.md"),c=w(s)?$(s):null;return i.set(o,c),c};for(let o of e.resolvedTest.unitFiles){let s=o.file===e.resolvedTest.rootPath,c=V(o.file,je(o.file,"utf8")),m=P(o.file),I=w(m)?$(m):null,f=[],b=[],g=[],M=[];if(!s)for(let d of e.resolvedTest.steps){if(d.owningFile!==o.file||d.trace.length<2)continue;let n=W(d.trace);M.includes(n)||M.push(n)}let F=d=>{if(I!==null)return null;for(let n of M){let v=p(n)?.steps[d-1];if(v)return{row:v,dir:n}}return null},C=[],_=!1,B=!1,L=!1,A=!1;for(let d of c.steps){let n=d.index,u=I?.steps[n-1];if(d.body.kind==="objective"){let h=e.resolvedTest.steps.filter(S=>S.owningFile===o.file&&S.trace[S.trace.length-1].stepIndex===n&&t.has(S.flatIndex)),x=h.length>0?h[h.length-1]:null;if(x){_=!0,r.has(x.flatIndex)&&(B=!0);let S=T(x),y;s?y=e.outcomes.find(he=>he.rootStepIndex===n)??{rootStepIndex:n,status:"skipped"}:y={rootStepIndex:n,status:ce(x,e.outcomes)},y.status==="failed"&&(L=!0),y.stepMd5==null&&(y.stepMd5=S),f.push(y),b.push({stepIndex:n,md5:S,rec:t.get(x.flatIndex)}),(!u||u.kind!=="objective"||u.status!==y.status||y.status==="passed"&&u.md5!==S)&&(A=!0)}else if(u&&u.kind==="objective")f.push({rootStepIndex:n,status:u.status,...u.md5?{stepMd5:u.md5}:{}}),g.push(n);else if(!s&&F(n)?.row.kind==="objective"){let S=F(n),y=S.row;f.push({rootStepIndex:n,status:y.status,...y.md5?{stepMd5:y.md5}:{}}),C.push({psIdx:n,dir:S.dir})}else s?f.push(e.outcomes.find(S=>S.rootStepIndex===n)??{rootStepIndex:n,status:"skipped"}):f.push({rootStepIndex:n,status:"skipped"});continue}let v=_e(d.body.path)?d.body.path:Ae(Te(o.file),d.body.path),O=X({path:d.body.path,bindings:d.body.bindings,optional:d.optional??!1}),me=Le(G(o.file),P(v)),E=e.resolvedTest.steps.filter(h=>h.trace.some((x,S)=>S<h.trace.length-1&&x.file===o.file&&x.stepIndex===n)&&t.has(h.flatIndex));if(E.length>0){_=!0;let h;if(s)h=e.outcomes.find(x=>x.rootStepIndex===n)??{rootStepIndex:n,status:"passed",refKind:"import",refLabel:d.body.path};else{let x=E.some(S=>ce(S,e.outcomes)==="failed");h={rootStepIndex:n,status:x?"failed":"passed",refKind:"import",refLabel:d.body.path,inlinedCount:E.length}}h.status==="failed"&&(L=!0),h.stepMd5==null&&(h.stepMd5=O),h.helperResultRelPath==null&&(h.helperResultRelPath=me),f.push(h),(!u||u.kind!=="import"||u.status!==h.status||u.md5!==O)&&(A=!0)}else if(u&&u.kind==="import")f.push({rootStepIndex:n,status:u.status,refKind:"import",refLabel:u.importPath,...u.md5?{stepMd5:u.md5}:{},...u.helperResultRelPath?{helperResultRelPath:u.helperResultRelPath}:{}});else if(!s&&F(n)?.row.kind==="import"){let h=F(n).row;f.push({rootStepIndex:n,status:h.status,refKind:"import",refLabel:d.body.path})}else s?f.push(e.outcomes.find(h=>h.rootStepIndex===n)??{rootStepIndex:n,status:"skipped",refKind:"import",refLabel:d.body.path}):f.push({rootStepIndex:n,status:"skipped",refKind:"import",refLabel:d.body.path})}if(!(s||_&&(B||L||I===null||A)))continue;l.push(o.file);let k=q(o.file);ue(R(k,".internal"),{recursive:!0});for(let d of b){let n=R(k,".internal","steps",`${d.stepIndex}-${d.md5.slice(0,8)}`);ue(n,{recursive:!0}),await ne({sessionDir:e.sessionDir,runIndex:d.rec.runIndex,totalRunDirs:d.rec.totalRunDirs,stagingStepDir:n,packTestDir:e.packTestDir})}if(g.length>0){let d=z(o.file);if(w(d))for(let n of pe(d)){let u=parseInt(n.split("-")[0]??"",10);!Number.isNaN(u)&&g.includes(u)&&le(R(d,n),R(k,".internal","steps",n),{recursive:!0})}}for(let d of C){let n=R(d.dir,".internal","steps");if(w(n))for(let u of pe(n))parseInt(u.split("-")[0]??"",10)===d.psIdx&&le(R(n,u),R(k,".internal","steps",u),{recursive:!0})}let fe=f.some(d=>d.status==="failed");if(ee({sourcePath:o.file,title:c.title,rootSteps:c.steps,outcomes:f,overallStatus:s?e.overallStatus:fe?"failed":"passed",startedISO:e.startedISO,durationS:s?e.durationS:0,sessionId:e.sessionId,outPath:R(k,"Result.md")}),s){let d={};e.commitId&&(d.commit_id=e.commitId),e.tmsIds.testId&&(d.test_id=e.tmsIds.testId),e.tmsIds.testcaseId&&(d.testcase_id=e.tmsIds.testcaseId),e.tmsIds.projectId&&(d.project_id=e.tmsIds.projectId),e.tmsIds.folderId&&(d.folder_id=e.tmsIds.folderId),e.tmsIds.orgId&&(d.org_id=e.tmsIds.orgId),e.tmsIds.sessionName&&(d.session_name=e.tmsIds.sessionName),Oe(R(k,".internal","meta.json"),JSON.stringify(d,null,2)+`
|
|
5
5
|
`,"utf8");let n=R(e.sessionDir,"execution.json");if(w(n))try{ae(n,R(k,".internal","execution.json"))}catch{}if(e.codeExportDir){let u=e.codeExportLanguage??"python",v=R(k,`playwright-${u}-code`);try{de(e.codeExportDir,v)}catch(O){process.stderr.write(`warn: codegen copy failed: ${O.message}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
var p=1;function f(e){return e==="agent"?"ndjson":"human"}function
|
|
2
|
+
var p=1;function f(e){return e==="agent"?"ndjson":"human"}function c(){return!!(process.stdin.isTTY&&process.stdout.isTTY)}var a=/^(∷ |· |→ |✓ |✗ |… )/;function d(e){return e===0?"complete":e===2?"refused":e===3?"paused":e===130?"interrupted":"error"}function l(e,n,s={stdout:t=>process.stdout.write(t),stderr:t=>process.stderr.write(t)}){let t=!1,i=r=>{if(e!=="ndjson")return;if(r.type==="done"){if(t)return;t=!0}let{type:o,...u}=r;s.stdout(JSON.stringify({type:o,v:1,verb:n,...u})+`
|
|
3
3
|
`)};return{encoding:e,out:e==="ndjson"?r=>s.stderr(r+`
|
|
4
4
|
`):r=>s.stdout(r+`
|
|
5
5
|
`),progress:e==="ndjson"?()=>{}:r=>s.stderr(r.replace(a,"").replace(/…$/,"")+`
|
|
6
|
-
`),event:
|
|
6
|
+
`),event:i,done:(r,o)=>(i({type:"done",status:o??d(r),exit_code:r}),r)}}var g=8*1024;function m(e,n){return e.message==null?null:e.message.trim()?e.resume?Buffer.byteLength(e.message,"utf8")>g?`${n==="extract"?"extract":"design"}: --message is over 8KB \u2014 the agent would silently drop it; shorten the statement`:null:`${n==="extract"?"extract":"design"}: --message only rides a resume \u2014 pair it with --resume <sid> (a fresh run takes its direction from the sources)`:`${n==="extract"?"extract":"design"}: --message is empty \u2014 say what you want the agent to know`}function E(e,n,s){return e.event({type:"error",message:n,...s?{code:s}:{}}),e.done(2,"refused")}function x(e,n,s){return{out:t=>{n()&&s.test(t)||e.out(t)},emit:t=>{n()&&t.type==="error"&&s.test(String(t.message??""))||e.event(t)}}}export{p as a,f as b,c,l as d,g as e,m as f,E as g,x as h};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{b as k,c as I}from"./chunk-2PQXEEVY.js";import{a as E}from"./chunk-MCQXRJGH.js";import{a as h,c as w}from"./chunk-ZZLR3O5A.js";import{g as S}from"./chunk-ZG2V2ODK.js";import{a as x,d as y,f as b}from"./chunk-5YPBPZUR.js";import{existsSync as M,mkdirSync as R,readFileSync as C,writeFileSync as F}from"fs";import{basename as P,extname as v,join as U}from"path";var A=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;function D(e){return typeof e=="string"&&e!=="."&&e!==".."&&A.test(e)}function f(e){if(!D(e))throw new Error(`unsafe logical_id: ${JSON.stringify(e)} \u2014 must match ${String(A)} (no path separators)`)}import{extname as $}from"path";var O=[{kind:"text",media_type:"text/plain",extensions:[".txt"],cite:"verbatim",maxBytes:2e6},{kind:"markdown",media_type:"text/markdown",extensions:[".md",".markdown"],cite:"verbatim",maxBytes:2e6},{kind:"image",media_type:"image/png",extensions:[".png"],cite:"anchor-only",maxBytes:5e6},{kind:"image",media_type:"image/jpeg",extensions:[".jpg",".jpeg"],cite:"anchor-only",maxBytes:5e6},{kind:"image",media_type:"image/webp",extensions:[".webp"],cite:"anchor-only",maxBytes:5e6}];function L(e){let n=$(e).toLowerCase(),t=O.find(r=>r.extensions.includes(n));return t?{ok:!0,media:t}:{ok:!1,code:"UNSUPPORTED_MEDIA",allowlist:O.flatMap(r=>r.extensions)}}function j(e){let t=P(e,v(e)).toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"");return f(t),t}function ee(e){let n=/^(.*?)[-_.]?v?\d+$/.exec(e);if(!n)return null;let t=(n[1]??"").replace(/[-_.]+$/,"");return t.length>0&&t!==e?t:null}function z(e){let n=U(e,"meta.json");M(n)||(R(e,{recursive:!0}),F(n,JSON.stringify({schema:x,canonicalizer:"v1"},null,2)+`
|
|
3
|
+
`))}async function te(e){let{contextDir:n,filePath:t,asId:r,confirmSameSource:_}=e;z(n);let c=C(t),i=L(t);if(!i.ok)throw new Error(`UNSUPPORTED_MEDIA: ${v(t)} \u2014 supported: ${i.allowlist.join(" ")}`);if(c.byteLength>i.media.maxBytes)throw new Error(`FILE_TOO_LARGE: ${c.byteLength} bytes > ${i.media.maxBytes} cap for ${i.media.media_type}`);let s=k(c),o;r!==void 0?(f(r),o=r):o=j(t);let d=E(n),a=d.heads.get(o),N=a!=null?d.getNode(a)?.content:void 0;if(a!=null&&N?.blob===s)return{status:"unchanged",source_id:o,cid:a,blob:s};if(a==null){for(let[g,p]of d.heads.entries())if(!(g===o||p==null)&&d.getNode(p)?.content.blob===s){if(_&&await _(g))return{status:"unchanged",source_id:g,cid:p,blob:s};break}}I(n,c);let m=w(o,s),l=b("source",m);if(l.length>0)throw new Error(`source node fails ${l[0].code}: ${l[0].detail}`);let u=h("source",m);return S(n,{ts:new Date().toISOString(),proposal_id:null,nodes:[{cid:u,label:y.SOURCE,content:m}],edges:[],review:[],supersessions:[],media:{[o]:{format:i.media.kind,media_type:i.media.media_type,anchors_supported:i.media.cite==="verbatim"?["L-L"]:[]}},source_head_moves:{[o]:u}}),{status:a!=null?"versioned":"created",source_id:o,cid:u,blob:s}}export{L as a,j as b,ee as c,te as d};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as A}from"./chunk-YCCUBQY4.js";import{a as _}from"./chunk-
|
|
2
|
+
import{a as A}from"./chunk-YCCUBQY4.js";import{a as _}from"./chunk-PICCLJSO.js";import{a as k}from"./chunk-2WVKOZ6W.js";import{a as B}from"./chunk-DNOBOZPO.js";import{a as R}from"./chunk-XUJ5EPVW.js";import{x as c}from"./chunk-HJGUEZLW.js";import{a as P}from"./chunk-HCBYKLMW.js";import{a as u,b as l}from"./chunk-C44QQJR4.js";import{a as J}from"./chunk-6YGTRKDT.js";import{e as L}from"./chunk-UR6MHSHU.js";var t=L(J(),1);var e=L(P(),1);function X(n,i,y,m){return{id:n,label:`${i} (${n}) \xB7 ${y} tests`,isActive:n===m}}function W({resolver:n,projectId:i,currentFolderId:y,env:m,onSelect:x,onCancel:w}){let[I,M]=(0,t.useState)([]),[$,d]=(0,t.useState)(!0),[O,g]=(0,t.useState)(!1),[U,N]=(0,t.useState)(null),[p,b]=(0,t.useState)("list"),[S,v]=(0,t.useState)(""),[E,f]=(0,t.useState)(null),h=(0,t.useRef)(!1);(0,t.useEffect)(()=>{if(!n){N("Login first to browse folders"),d(!1);return}let o=new AbortController;return d(!0),g(!0),(async()=>{try{let r=n.cached??await n.resolve();if(!r){N("Login first to browse folders"),d(!1),g(!1);return}let a=B(m),T=new k(a.tmsBaseUrl,r.username,r.access_key),F=(async function*(){if(o.signal.aborted)return;let s=await T.listFolders(i);yield{page:1,folders:s,totalLoaded:s.length,done:!0}})();for await(let s of F){if(d(!1),s.totalLoaded===0){h.current=!0,b("naming"),g(!1);return}M(s.folders.map(C=>X(C.id,C.name,C.test_cases_count,y))),s.done&&g(!1)}}catch(r){if(r?.name==="AbortError")return;N(r instanceof Error?r.message:String(r)),d(!1),g(!1)}})(),()=>o.abort()},[n,i,y,m]);let D=(0,t.useCallback)(o=>{let r=o.trim();if(!r){f("Name cannot be empty");return}if(!i){f("No project selected \u2014 pick a project first");return}f(null),b("creating"),(async()=>{try{if(!n)throw new Error("Not authenticated");let a=n.cached??await n.resolve();if(!a)throw new Error("Not authenticated");let T=B(m),s=await new k(T.tmsBaseUrl,a.username,a.access_key).createFolder(i,r);x(s.id,s.name)}catch(a){f(a instanceof Error?a.message:String(a)),b("naming")}})()},[n,i,m,x]),H=(0,t.useCallback)(()=>{v(""),f(null),h.current?w():b("list")},[w]);return p==="naming"||p==="creating"?(0,e.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:c.orange,paddingX:2,paddingY:1,children:[(0,e.jsx)(l,{color:c.orange,bold:!0,children:"Create new folder"}),h.current&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.dim,children:"No folders yet \u2014 let's create one."})}),(0,e.jsxs)(u,{marginTop:1,children:[(0,e.jsx)(l,{color:c.dim,children:"Name: "}),p==="naming"?(0,e.jsx)(A,{value:S,onChange:o=>{v(o),E&&f(null)},onSubmit:D,onCancel:H}):(0,e.jsx)(l,{children:S})]}),E&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.red,children:E})}),p==="creating"&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.dim,children:"Creating..."})}),p==="naming"&&(0,e.jsx)(R,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:h.current?"cancel":"back"})]}):(0,e.jsx)(_,{title:"Folders",items:I,loading:$,loadingMore:O,preserveSelectionById:!0,error:U,itemNoun:"folders",onTab:()=>{h.current=!1,b("naming")},extraHint:"tab to create new",onSelect:o=>{let r=o.label.split(" (")[0];x(o.id,r)},onCancel:w})}export{X as a,W as b};
|
|
@@ -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-2K4XOHVK.js";import{x as t}from"./chunk-HJGUEZLW.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,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{d as s,j as l}from"./chunk-
|
|
2
|
+
import{d as s,j as l}from"./chunk-HJGUEZLW.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,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as B}from"./chunk-S3DAAAE5.js";import{a as g}from"./chunk-
|
|
2
|
+
import{b as B}from"./chunk-S3DAAAE5.js";import{a as g}from"./chunk-POI6DCP6.js";import{x as s}from"./chunk-HJGUEZLW.js";import{a as w}from"./chunk-HCBYKLMW.js";import{a as x,b as t,c as h,i as P,j as S}from"./chunk-C44QQJR4.js";import{a as C}from"./chunk-6YGTRKDT.js";import{e as T}from"./chunk-UR6MHSHU.js";var o=T(C(),1);var e=T(w(),1);function D({defaultName:i,onSubmit:c}){let[d,p]=(0,o.useState)("confirm"),[f,a]=(0,o.useState)(""),[m,u]=(0,o.useState)(null),l=(0,o.useMemo)(()=>f.trim()||i,[f,i]);return P((n,r)=>{if(d==="confirm"){if(n==="y"||n==="Y"){a(i),p("name");return}if(n==="n"||n==="N"||r.escape||r.ctrl&&n==="c"){c(null);return}if(r.return){c(i);return}return}if(r.return){if(!B(l)){u(`name "${l}" is invalid; allowed: letters, digits, underscore, hyphen`);return}c(l);return}if(r.escape||r.ctrl&&n==="c"){c(null);return}if(r.backspace||r.delete){a(v=>v.slice(0,-1)),u(null);return}n&&!r.ctrl&&!r.meta&&(a(v=>v+n),u(null))}),d==="confirm"?(0,e.jsx)(g,{title:"Save session?",titleColor:"#ff9500",rows:[{label:"name",value:(0,e.jsx)(t,{color:s.orange,children:i})}],footer:(0,e.jsxs)(x,{flexDirection:"column",children:[(0,e.jsx)(t,{color:s.dim,children:"enter \u2014 save with this name"}),(0,e.jsx)(t,{color:s.dim,children:"Y \u2014 edit name"}),(0,e.jsx)(t,{color:s.dim,children:"N/esc \u2014 discard session"})]})}):(0,e.jsx)(g,{title:"Save session?",titleColor:"#ff9500",rows:[{label:"name",value:(0,e.jsxs)(x,{children:[(0,e.jsx)(t,{color:s.orange,children:f}),(0,e.jsx)(t,{inverse:!0,children:" "})]})}],footer:(0,e.jsxs)(x,{flexDirection:"column",children:[m&&(0,e.jsx)(t,{color:s.red,children:m}),(0,e.jsx)(t,{color:s.dim,children:"enter \u2014 save \xB7 esc \u2014 discard"})]})})}function V(){return new Date().toISOString().slice(0,19).replace(/:/g,"-")}async function Y(i){return new Promise(c=>{function d(){let{exit:a}=S(),[m,u]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{if(m){let l=setTimeout(()=>a(),50);return()=>clearTimeout(l)}},[m,a]),(0,e.jsx)(D,{defaultName:i,onSubmit:l=>{c(l),u(!0)}})}let{waitUntilExit:p,unmount:f}=h((0,e.jsx)(d,{}),{stdout:process.stderr,exitOnCtrlC:!1});p().then(()=>{try{f()}catch{}})})}export{D as a,V as b,Y as c};
|