@testmuai/kane-cli 0.6.4 → 0.6.6
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/bin/kane-cli.cjs +91 -0
- package/bin/resolve-runtime.cjs +45 -0
- package/dist/{ChatSurface-VXYU6KFW.js → ChatSurface-LV3KW6WN.js} +1 -1
- package/dist/{ChromeProfilePicker-QWTM7DK6.js → ChromeProfilePicker-6PLUQ5TW.js} +1 -1
- package/dist/{CliFeedbackPrompt-6NVWMONO.js → CliFeedbackPrompt-I4F56IVK.js} +1 -1
- package/dist/{CliUploadProgress-2YRQLECI.js → CliUploadProgress-ULRSPKY3.js} +1 -1
- package/dist/{ConfigView-I4R5M7BO.js → ConfigView-7NMYALEA.js} +1 -1
- package/dist/{EvidenceViewOffer-54GEARRX.js → EvidenceViewOffer-KQKPTMXA.js} +1 -1
- package/dist/{FolderPicker-5VWBYTAK.js → FolderPicker-4IOVDO2P.js} +1 -1
- package/dist/{HelpView-OJZW4XWX.js → HelpView-SHMVMHNU.js} +1 -1
- package/dist/{InfoBox-TGELGCBR.js → InfoBox-W2LZVGQS.js} +1 -1
- package/dist/{LinksBox-B5EBRY26.js → LinksBox-ZS25VTBY.js} +1 -1
- package/dist/{ProfilesView-3SJRIBHQ.js → ProfilesView-XBBRIQ3U.js} +1 -1
- package/dist/{ProjectPicker-72HKMBEY.js → ProjectPicker-AUN47FXS.js} +1 -1
- package/dist/{SaveSessionPrompt-CK5SGNRO.js → SaveSessionPrompt-Z2K225VN.js} +1 -1
- package/dist/SingleShotApp-M7R5PW4X.js +2 -0
- package/dist/{SummaryBox-ABB7ST26.js → SummaryBox-4T545XRB.js} +1 -1
- package/dist/TestMdRunView-JXRXMACE.js +2 -0
- package/dist/{WhoamiView-OF354UGC.js → WhoamiView-GCVD35EX.js} +1 -1
- package/dist/{bind-BWILBZGR.js → bind-JLMT57Q3.js} +2 -2
- package/dist/{bridge-LNDJS3HH.js → bridge-PDJEOSAJ.js} +1 -1
- package/dist/{changelog-BWCEZQ23.js → changelog-D65HWZDM.js} +1 -1
- package/dist/{chunk-AXABTFCD.js → chunk-24OFJ7SE.js} +1 -1
- package/dist/{chunk-UZSG54OY.js → chunk-24VYAMMK.js} +1 -1
- package/dist/{chunk-6LRKYF67.js → chunk-262ES67I.js} +2 -2
- package/dist/{chunk-64QURIT6.js → chunk-2BWRAY3Y.js} +1 -1
- package/dist/{chunk-2K4XOHVK.js → chunk-2WO7G2HO.js} +1 -1
- package/dist/{chunk-BYUARJE7.js → chunk-32GP7KTM.js} +1 -1
- package/dist/{chunk-IRRGSC7B.js → chunk-3Z3UIW5H.js} +1 -1
- package/dist/{chunk-QNNBNIR7.js → chunk-4A6BLXQN.js} +2 -2
- package/dist/{chunk-ACEODVSC.js → chunk-4R2HOA7J.js} +1 -1
- package/dist/{chunk-XUJ5EPVW.js → chunk-4SXD6XWV.js} +1 -1
- package/dist/{chunk-ADOXYGZE.js → chunk-5JJ245FW.js} +1 -1
- package/dist/{chunk-OB6CKLEL.js → chunk-6CZIEK6B.js} +1 -1
- package/dist/{chunk-POI6DCP6.js → chunk-6NIV7AVZ.js} +1 -1
- package/dist/chunk-6SGPN76K.js +2 -0
- package/dist/{chunk-I2JUBAPU.js → chunk-6XHAXAL2.js} +1 -1
- package/dist/{chunk-DNOBOZPO.js → chunk-AKHUNBQS.js} +1 -1
- package/dist/{chunk-IOTJZTHX.js → chunk-BLSZ4H5W.js} +12 -12
- package/dist/{chunk-5KSB5MOF.js → chunk-BV5QKFMJ.js} +1 -1
- package/dist/{chunk-4MUHS3UL.js → chunk-C42WWO7Y.js} +1 -1
- package/dist/chunk-D7L6UW5Z.js +7 -0
- package/dist/{chunk-MVF4KRHA.js → chunk-EOLQUB4Q.js} +1 -1
- package/dist/{chunk-PYB2EXRE.js → chunk-EWTX7HSU.js} +2 -2
- package/dist/chunk-GLS46X7N.js +5 -0
- package/dist/{chunk-YI4XULHR.js → chunk-HA5GE57Z.js} +15 -15
- package/dist/{chunk-YMSN25DX.js → chunk-HWA7WD44.js} +1 -1
- package/dist/{chunk-3HEPW6SN.js → chunk-JF7Q2I45.js} +1 -1
- package/dist/{chunk-QZI43UNV.js → chunk-JTEY32TL.js} +1 -1
- package/dist/{chunk-HNE4TDOZ.js → chunk-JU5KRCKD.js} +4 -4
- package/dist/{chunk-ANIVHX3P.js → chunk-JV356AYH.js} +1 -1
- package/dist/{chunk-MK2G7VIF.js → chunk-KI2DVQSA.js} +1 -1
- package/dist/{chunk-DXK55KGR.js → chunk-KNCHEM6A.js} +1 -1
- package/dist/{chunk-CT2I5KUM.js → chunk-KYHXDJN4.js} +1 -1
- package/dist/{chunk-652FEDL4.js → chunk-L26LU6TU.js} +2 -2
- package/dist/{chunk-3WJJ43MT.js → chunk-LABIRPOT.js} +1 -1
- package/dist/{chunk-IXVR66NS.js → chunk-LEQ2B3PR.js} +1 -1
- package/dist/{chunk-WE57PD6K.js → chunk-LLS47HUA.js} +1 -1
- package/dist/{chunk-OLXOZJ7X.js → chunk-LURGFJEE.js} +1 -1
- package/dist/{chunk-5CTMOJG4.js → chunk-MSPZOEFB.js} +1 -1
- package/dist/{chunk-PICCLJSO.js → chunk-MY32TBBR.js} +1 -1
- package/dist/{chunk-STH6I3UB.js → chunk-N6DO2LBH.js} +1 -1
- package/dist/{chunk-O66EU5UV.js → chunk-OFEOWKM3.js} +1 -1
- package/dist/{chunk-BOO7YXAV.js → chunk-P4HW2NTZ.js} +1 -1
- package/dist/{chunk-CY5NDMO7.js → chunk-RIMJDJWY.js} +1 -1
- package/dist/{chunk-ZQP3MCZW.js → chunk-RV2NXHIC.js} +1 -1
- package/dist/{chunk-WT3SMSY5.js → chunk-S2C62SDY.js} +1 -1
- package/dist/{chunk-FV4LLU3T.js → chunk-UZJ7MRBV.js} +1 -1
- package/dist/{chunk-W36P7S5W.js → chunk-VBCE4U4B.js} +1 -1
- package/dist/{chunk-CLTANA4L.js → chunk-WJGBXJT4.js} +2 -2
- package/dist/{chunk-BNN6ZDJW.js → chunk-WWH7CW5R.js} +1 -1
- package/dist/{chunk-WFEGGQJ4.js → chunk-XQL53VB7.js} +1 -1
- package/dist/{config-OJF53CHL.js → config-6PAZZ7CR.js} +1 -1
- package/dist/{credentials-NLJHSVBY.js → credentials-BJCIWQWA.js} +1 -1
- package/dist/{evidence-UPOFW3XC.js → evidence-7VE5EGEF.js} +1 -1
- package/dist/{evolve-cmd-MVALOB3G.js → evolve-cmd-RUGUWKAG.js} +1 -1
- package/dist/{extract-bind-SSTKQGTV.js → extract-bind-YS7C4KZ3.js} +2 -2
- package/dist/{extract-cmd-GO4UV7ER.js → extract-cmd-Z4PMDIMZ.js} +1 -1
- package/dist/{generate-headless-2HYMSVN5.js → generate-headless-IWY32HC4.js} +2 -2
- package/dist/index.js +12 -12
- package/dist/{interactive-bind-Q5TQFQ6N.js → interactive-bind-ZIIJDRBU.js} +2 -2
- package/dist/{list-commands-6WDXAECV.js → list-commands-SSXJQGE7.js} +1 -1
- package/dist/login-flow-HRS6YACY.js +2 -0
- package/dist/{persist-recorded-session-KHIMN4A3.js → persist-recorded-session-3AOYZJT2.js} +1 -1
- package/dist/{pipeline-2HRAWT5U.js → pipeline-IZSODNCC.js} +1 -1
- package/dist/{reconcile-cmd-DH4VV6PG.js → reconcile-cmd-6HVZJFG3.js} +1 -1
- package/dist/{recording-banner-SADVYNEP.js → recording-banner-KKEUWS3N.js} +1 -1
- package/dist/{require-project-folder-LP7V26IU.js → require-project-folder-NPTKR2AW.js} +1 -1
- package/dist/{run-RT2VMPTQ.js → run-2A7M7EJK.js} +1 -1
- package/dist/{run-XAZMT7WO.js → run-6AFY35QW.js} +1 -1
- package/dist/{run-test-md-ATB2HZRG.js → run-test-md-QNC6KDMN.js} +2 -2
- package/dist/{skill-installer-DE2LSSKU.js → skill-installer-ULFNSE6X.js} +1 -1
- package/dist/{spawner-GOTVIFR5.js → spawner-DWONVIPI.js} +1 -1
- package/dist/tcg-generate-IHHPRVNG.js +2 -0
- package/dist/{testmd-actions-RYQHBX4K.js → testmd-actions-S3ZNOZEK.js} +1 -1
- package/dist/token-refresh-CFVOA62N.js +2 -0
- package/dist/{validate-basic-6BQ2L7TT.js → validate-basic-4OLDKIA2.js} +1 -1
- package/dist/{version-check-YW3FUWDH.js → version-check-UL4S6R4N.js} +1 -1
- package/dist/{walk-session-O4TMVORI.js → walk-session-N3BP57HK.js} +1 -1
- package/package.json +15 -7
- package/bin/kane-cli.js +0 -2
- package/dist/SingleShotApp-AJBIWW74.js +0 -2
- package/dist/TestMdRunView-5PMLLLFT.js +0 -2
- package/dist/chunk-E3BO7OVR.js +0 -7
- package/dist/chunk-HJGUEZLW.js +0 -2
- package/dist/chunk-IJPFAWBH.js +0 -5
- package/dist/login-flow-XQMJFC4H.js +0 -2
- package/dist/tcg-generate-7PUXJ5R4.js +0 -2
- package/dist/token-refresh-F5KRV7ER.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as G,b as Z,c as J,d as Q}from"./chunk-6LRKYF67.js";import"./chunk-GBBVP2JW.js";import{a as N,c as q,d as ue,f as z}from"./chunk-ANIVHX3P.js";import"./chunk-3C5GMAM4.js";import{a as P,b as le,d as de}from"./chunk-GRB66C5S.js";import{a as se,b as oe}from"./chunk-SJ2KQKOV.js";import{a as B,b as T,c as L,d as V,e as ce,g as I,h as K}from"./chunk-K5JGCJ2K.js";import{a as ae}from"./chunk-JFAFKHDX.js";import"./chunk-WIA7TPK3.js";import"./chunk-QPZRHAYK.js";import"./chunk-RN4OSVTG.js";import"./chunk-BC7UVJJB.js";import"./chunk-2PQXEEVY.js";import{a as x}from"./chunk-MCQXRJGH.js";import"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import{e as F}from"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";import{existsSync as ve,statSync as we}from"fs";import{basename as j,resolve as pe}from"path";var ge=new Set(["interactive","agent","ci","override"]);function ke(e,t){if(e.mode!==void 0&&!ge.has(e.mode))return{error:`--mode must be interactive | agent | ci | override, got '${e.mode}'`};let r=e.mode,n="reconcile without a TTY needs an explicit mode \u2014 pass --mode agent|ci|override, or --plan for a preview";return r==="interactive"&&!t?{error:n}:r||(t?"interactive":e.plan?"override":{error:n})}function ye(e,t,r,n){let i=pe(t,r);if(!ve(i)||!we(i).isFile())return{error:`--from '${r}' is not a file \u2014 pass the changed source document`};let p=se(i);if(!p.ok)return{error:`--from '${r}' is not an ingestable document \u2014 allowed: ${p.allowlist.join(", ")}`};let f=x(e);if(!f.heads.has(n))return{error:`unknown source '${n}' \u2014 see \`kane-cli context list --type source\``};if(f.heads.get(n)==null)return{error:`source '${n}' is retired \u2014 restore it first with \`kane-cli context revert\`, then reconcile`};let d=null;try{d=oe(i)}catch{}return d!==null&&d!==n&&f.heads.get(d)!=null?{error:`'${j(i)}' already backs live source '${d}' \u2014 did you mean --source-id ${d}? To truly move these bytes under '${n}', retire '${d}' first`}:{sourceId:n,filePath:i}}function O(e){return e==null?"(none)":e.slice(0,19)}function M(e,t,r){if(e.out(`reconcile ${t.source_id}: head ${t.head.status} \u2014 ${O(t.head.before)} \u2192 ${O(t.head.after)}`),e.out(`note: ${t.note}`),e.out(`skipped arms: ${t.skipped_arms}`),t.changed&&e.out(t.held?`extract ran in override mode; ${r?.defaultsTaken??0} default(s) auto-taken; matched-but-changed and new proposals HELD for your verdict (staged \u2014 nothing committed)`:`extract ran in override mode; ${r?.defaultsTaken??0} default(s) auto-taken; matched-but-changed proposals auto-committed as edits`),t.changed){let n=t.changeset??[];e.out(`changeset: ${n.length} item(s)`);for(let i of n)if(i.kind==="MODIFY")e.out(` [MODIFY] ${i.ref} \u2014 ${i.summary} (${O(i.old_cid)} \u2192 ${i.new_cid===null?"(staged)":O(i.new_cid)})`);else if(i.kind==="ADD")e.out(` [ADD] ${i.ref}`);else{e.out(` [ARCHIVE] ${i.ref} \u2014 ${i.why}`);let p=X(i.impact,"retiring drops");p&&e.out(` ${p}`)}}e.out(`plan: ${t.rows.length} row(s)`);for(let n of t.rows){e.out(` [${n.kind}] ${n.ref} \u2014 ${n.reason}`);let i=X(n.impact,"approving marks");i&&e.out(` ${i}`),e.out(` provenance: ${n.provenance}`),e.out(` action: ${n.action}`)}}function X(e,t){if(!e||e.stale_refs.length===0)return null;let r=e.direct_refs??[];return`impact: ${t} ${e.stale_refs.length} item(s) stale`+(r.length>0?` \u2014 ${r.length} directly touched: ${r.join(", ")}`:"")}function E(e){return e==="interactive"?"override":e}async function A(e,t,r,n,i,p,f=[],d="override",y,w,s,u,h){let l;try{l=K(e)}catch($){return P(n,$ instanceof Error?$.message:String($)),1}try{if(!r){let{runWalkSession:$}=await import("./walk-session-O4TMVORI.js");return await $({dir:e,rows:t,archive:f,held:y??null,childMode:d,runDesign:u??null,mark:p,markA:s,...w?{archiveState:w}:{},signals:k=>C(e,k.ref,k.verdict,k.reason),...h?{script:h}:{}})}return await $e(e,t,r,n,i,p,f,d,y,w)}finally{l()}}var H=e=>`${e} high-risk item(s) need a human \u2014 ci mode won't guess. Walk interactively or use --mode agent.`;function W(e,t,r){let n=t.rows;e({type:"reconcile_plan",source_id:t.source_id,plan_path:r,rows:n.map(i=>({kind:i.kind,ref:i.ref,why:i.reason})),archive:t.changeset.filter(i=>i.kind==="ARCHIVE").map(i=>({ref:i.ref,why:i.why}))})}function ne(e={}){return{type:"reconcile_summary",applied:0,skipped:0,deferred:0,plan_only:0,failed:0,paused:0,stale_created:0,...e}}var ee=ne();async function U(e,t,r,n,i,p,f,d,y){W(i,t,r);let w=t.changeset.filter(h=>h.kind==="ARCHIVE"&&y?.[h.ref]===void 0),s=t.rows,u;try{u=K(e)}catch(h){return i({type:"error",message:h instanceof Error?h.message:String(h)}),i(ne()),2}try{return await Re(e,t,r,n,i,p,f,s,w,d)}finally{u()}}async function Re(e,t,r,n,i,p,f,d,y,w){let s=0,u=0,h=0,l=0,$=0,k=0,a=0,R=new Set,v=(c,o)=>{try{w?.(c,o)}catch{}};for(let[c,o]of d.entries()){i({type:"reconcile_row_start",kind:o.kind,ref:o.ref,...o.impact?{stale:o.impact.stale_refs.length,direct:o.impact.direct_refs?.length??0}:{}});let g=(m,D,S)=>i({type:"reconcile_row_end",kind:o.kind,ref:o.ref,outcome:m,...D!==void 0?{exit_code:D}:{},...S?{detail:S}:{}});if(o.applied){u++,g("skipped");continue}if(o.kind==="REMOVE"){$++,g("plan-only");continue}if(o.held_ref&&t.held){let m=new Set;if(o.kind==="MODIFY"&&o.impact){let S=x(e);for(let re of o.impact.stale_refs){let ie=S.resolve(re);ie&&S.stale(ie.tip)==="fresh"&&m.add(re)}}let D=G(e,t.held,o.held_ref,te);if(!D.ok){h++,a===0&&(a=1),g("failed",1,D.message);continue}if(D.kind==="ADD"){let S=await n(D.ref,{yes:!0,mode:f});if(S!==0){S===3?(l++,a===0&&(a=3),g("paused",3)):(h++,a===0&&(a=1),g("failed",S));continue}}s++,D.kind!=="ADD"&&o.impact&&(k+=m.size),v(c,"approved"),C(e,o.ref,D.kind==="ADD"?"gap-resolved-create":"gap-resolved-evolve"),g("applied");continue}let _=N(x(e),o.ref);if(!_.ok){u++,g("skipped");continue}let b=_.target;if(R.has(b.ucTip)){u++,g("skipped");continue}if(o.kind==="ADD"){let m=await n(b.seamRef,{yes:!0,mode:f});if(m===3){l++,a===0&&(a=3),g("paused",3);continue}if(m!==0){h++,a===0&&(a=1),g("failed",m);continue}R.add(b.ucTip),s++,v(c,"approved"),C(e,o.ref,"gap-resolved-create"),g("applied")}else{let m=await q(e,b,{yes:!0,mode:f},p,n,"batch");m.outcome==="evolved"?(R.add(b.ucTip),s++,v(c,"approved"),C(e,o.ref,"gap-resolved-evolve"),g("applied")):m.outcome==="paused"?(l++,a===0&&(a=m.code),g("paused",m.code)):m.outcome==="failed"?(h++,a===0&&(a=1),g("failed",m.code)):(u++,g("skipped"))}}return y.length>0&&(i({type:"reconcile_paused",plan_path:r,pending:y.map(c=>({ref:c.ref,why:c.why}))}),l+=y.length,a===0&&(a=3)),i(ne({applied:s,skipped:u,plan_only:$,failed:h,paused:l,stale_created:k})),a}var te={kind:"human",id:process.env.USER??"operator"};function C(e,t,r,n){ae(e,{ts:new Date().toISOString(),command:"reconcile-walk",id:t,verdict:r,polarity:"preference",by:te,target:t,...n!==void 0?{reason:n}:{}})}async function $e(e,t,r,n,i,p,f=[],d="override",y,w){let s=0,u=0,h=0,l=0,$=0,k=0,a=0,R=new Set;for(let[v,c]of t.entries()){if(c.applied){n.out(`skipped ${c.ref} \u2014 already applied (${c.applied.outcome} at ${c.applied.at})`),u++;continue}let o=m=>{try{p?.(v,m)}catch(D){P(n,`could not record applied state for ${c.ref}: ${D instanceof Error?D.message:String(D)}`)}};if(c.kind==="REMOVE"){n.out(`REMOVE ${c.ref} \u2014 plan-only in this release (not executed)`),l++;continue}if(c.held_ref&&y){let m=G(e,y,c.held_ref,te);if(!m.ok){P(n,`held ${c.ref}: ${m.message}`),$++,a===0&&(a=1);continue}if(n.out(`committed ${m.ref} (${c.kind==="ADD"?"minted":"updated \u2014 old\u2192new redirect"})`),m.kind==="ADD"){let D=await i(m.ref,{yes:r,mode:d});if(D===3){n.out(`design session for ${m.ref} paused \u2014 resume with "kane-cli design tests --resume"`),k++,a===0&&(a=3),o("approved");continue}if(D!==0){P(n,`design run for ${m.ref} ended with exit code ${D}`),$++,a===0&&(a=1),o("approved");continue}}s++,o("approved"),C(e,c.ref,c.kind==="ADD"?"gap-resolved-create":"gap-resolved-evolve");continue}let g=x(e),_=N(g,c.ref);if(!_.ok){n.out(`skipped ${c.ref} \u2014 ${_.message}`),u++;continue}let b=_.target;if(R.has(b.ucTip)){n.out(`skipped ${c.ref} \u2014 use-case ${b.display} already handled in this walk`),u++;continue}if(c.kind==="ADD"){let m=await i(b.seamRef,{yes:r,mode:d});if(m===3){n.out(`design session for ${b.display} paused \u2014 resume with "kane-cli design tests --resume"; this row lands when that session completes`),k++,a===0&&(a=3);continue}if(m!==0){P(n,`design run for ${b.display} ended with exit code ${m}`),$++,a===0&&(a=1);continue}R.add(b.ucTip),s++,o("approved"),C(e,c.ref,"gap-resolved-create")}else{let m=await q(e,b,{yes:!0,mode:d},n,i,"batch");m.outcome==="evolved"?(R.add(b.ucTip),s++,o("approved"),C(e,c.ref,"gap-resolved-evolve")):m.outcome==="paused"?(k++,a===0&&(a=m.code)):m.outcome==="failed"?($++,a===0&&(a=m.code)):u++}}for(let v of f)if(v.kind==="ARCHIVE"&&w?.[v.ref]===void 0){n.out(`[ARCHIVE] ${v.ref} \u2014 ${v.why}`);{let c=X(v.impact,"retiring drops");c&&n.out(` ${c}`)}n.out(" plan-only \u2014 retire belongs to the interactive session (never headless)"),l++}return n.out(`reconcile walk: ${s} applied, ${u} skipped, ${h} deferred, ${l} plan-only`+($>0?`, ${$} failed`:"")+(k>0?`, ${k} paused`:"")),a}async function me(e,t,r,n,i,p=!1){let f=i.seams??{reingest:J(e,r),reextract:Q(e,{stage:p})},d=null,y={reingest:f.reingest,reextract:async s=>d=await f.reextract(s)},w;try{n.out(`reconciling ${t}: re-reading the source and comparing against the graph\u2026`),w=await(i.buildPlan??Z)(e,t,y)}catch(s){return P(n,`reconcile failed: ${s instanceof Error?s.message:String(s)}`),null}return w.changed&&M(n,w,d),w}async function _e(e,t,r,n,i){let p=T(e,t);if("error"in p)return P(n,p.error),2;let{plan:f,path:d}=p,y=r==="override"||r==="ci";if(t===void 0&&r==="interactive"&&n.isTTY&&!await n.confirm(`apply plan ${j(d)} for ${f.source_id} (created ${f.created})?`))return n.out(`not applying ${j(d)}`),0;let w=i.runDesignForUc??z,s=i.runDesignForUc??null,u=i.sessionScript,h=(R,v)=>I(d,R,v),l=(R,v)=>V(d,R,v),$=F(e);if($===f.head_pin){if(r==="agent"){let v=i.emitEvent??(()=>{});return U(e,Y(f),d,w,v,n,E(r),h,f.archive_state)}let R=L(f);return r==="ci"&&R.length>0?(P(n,H(R.length)),2):(n.out(`applying stored plan ${j(d)} for ${f.source_id} (${f.rows.length} row(s))`),A(e,f.rows,y,n,w,h,f.changeset??[],E(r),f.held,f.archive_state,l,s,u))}if(n.out(`graph moved since this plan (${O(f.head_pin)} \u2192 ${O($)}) \u2014 recomputing`),f.held)return he(e,f,n,i,r,w,!1);let k=await me(e,f.source_id,f.backing_path,n,i);if(!k)return 1;if(!k.changed)return M(n,k,null),0;if(r==="agent"){let R=i.emitEvent??(()=>{});return U(e,k,null,w,R,n,E(r))}let a=k.changeset.filter(R=>R.kind==="ARCHIVE");return r==="ci"&&a.length>0?(P(n,H(a.length)),2):A(e,k.rows,y,n,w,void 0,k.changeset,E(r),k.held,void 0,void 0,s,u)}function Y(e,t=!1){return{source_id:e.source_id,changed:!0,head:{status:"unchanged",before:e.head_pin,after:e.head_pin},note:e.note,skipped_arms:e.skipped_arms,changeset:e.changeset??[],rows:t?e.rows.filter(r=>r.applied===void 0):e.rows,...e.held?{held:e.held}:{}}}async function Pe(e,t,r,n,i,p,f){let d=n.runDesignForUc??null,y=n.sessionScript,w=ce(e,t);if(w===null)return null;if("error"in w)return P(r,w.error),2;let{plan:s,path:u}=w,h=s.rows.filter(a=>a.applied===void 0),l=L(s),$=n.emitEvent??(()=>{});if(h.length===0&&l.length===0){r.out(`already reconciled \u2014 plan ${s.created} applied ${s.rows.length} row(s)`);let a=ue(x(e)).staleCount;return a>0&&r.out(`${a} item(s) still stale \u2014 kane-cli maintain evolve --from-stale`),i==="agent"&&(W($,Y(s),u),$({...ee})),0}let k=F(e);return k!==s.head_pin?(r.out(`plan ${s.created} superseded \u2014 graph moved (${O(s.head_pin)} \u2192 ${O(k)}); recomputing`),he(e,s,r,n,i,p,f)):(r.out(`resuming plan ${s.created} \u2014 ${h.length} pending row(s)${l.length>0?`, ${l.length} undecided archive item(s)`:""}`),f?(M(r,Y(s),null),r.out(`plan stored: ${u}`),0):i==="agent"?U(e,Y(s),u,p,$,r,E(i),(a,R)=>I(u,a,R),s.archive_state):i==="ci"&&l.length>0?(P(r,H(l.length)),2):A(e,s.rows,i==="override"||i==="ci",r,p,(a,R)=>I(u,a,R),s.changeset??[],E(i),s.held,s.archive_state,(a,R)=>V(u,a,R),d,y))}async function he(e,t,r,n,i,p,f){let d=n.runDesignForUc??null,y=n.sessionScript,w;if(t.held){let c=x(e),o=new Set(t.rows.filter(_=>_.held_ref!==void 0&&_.applied!==void 0).map(_=>_.held_ref)),g=[];for(let _ of t.held.rows){if(o.has(_.temp_ref))continue;if(!_.matched_cid){g.push(_);continue}let b=c.tipOf(_.matched_cid);if(c.superseded.get(b)===null){r.out(`dropped held "${_.title}" \u2014 its use-case was retired meanwhile`);continue}g.push(b===_.matched_cid?_:{..._,matched_cid:b,uc:{..._.uc,matches_existing:{cid:b}}})}w={source_id:t.held.source_id,rows:g}}let s=n.seams??{reingest:J(e,t.backing_path),reextract:Q(e,{stage:w!==void 0})},u;try{u=await(n.buildPlan??Z)(e,t.source_id,s,{resumeHeld:w})}catch(c){return P(r,`reconcile failed: ${c instanceof Error?c.message:String(c)}`),1}M(r,u,null);let h=F(e),l=null;if(h!=null){let c={},o=new Set(u.changeset.filter(g=>g.kind==="ARCHIVE").map(g=>g.ref));for(let[g,_]of Object.entries(t.archive_state??{}))o.has(g)&&(c[g]=_);l=B(e,{version:2,source_id:u.source_id,backing_path:t.backing_path,head_pin:h,created:new Date().toISOString().replace(/[:.]/g,"-"),skipped_arms:u.skipped_arms,note:u.note,changeset:u.changeset,rows:u.rows,...u.held?{held:u.held}:{},...Object.keys(c).length>0?{archive_state:c}:{}}),r.out(`plan stored: ${l}`)}if(f)return 0;let $=n.emitEvent??(()=>{}),k=l?T(e,l).plan.archive_state:void 0,a=l?(c,o)=>I(l,c,o):void 0,R=l?(c,o)=>V(l,c,o):void 0;if(i==="agent")return U(e,u,l,p,$,r,E(i),a,k);let v=u.changeset.filter(c=>c.kind==="ARCHIVE"&&k?.[c.ref]===void 0);return i==="ci"&&v.length>0?(P(r,H(v.length)),2):A(e,u.rows,i==="override"||i==="ci",r,p,a,u.changeset,E(i),u.held,k,R,d,y)}async function fe(e,t,r={},n=process.cwd()){let i=e.apply!==void 0&&e.apply!==!1,p=typeof e.apply=="string"?e.apply:void 0;if(e.plan&&i)return P(t,"pass --plan OR --apply, not both"),2;if((e.from!==void 0||!i)&&(!e.from||!e.sourceId))return P(t,"reconcile needs --from <file> AND --source-id <id> \u2014 see `kane-cli context list --type source` for ids"),2;if(e.from&&p!==void 0)return P(t,"pass --from OR --apply <path>, not both \u2014 a stored plan names its own source"),2;let d=le(n,t);if(!d)return 2;if(e.mode!==void 0&&!ge.has(e.mode))return P(t,`--mode must be interactive | agent | ci | override, got '${e.mode}'`),2;let y=e.mode==="agent"||e.mode==="ci"||e.mode==="override";if(i&&!y&&!t.isTTY)return P(t,"refusing to apply without a TTY to confirm \u2014 pass --mode override|ci"),2;let w=!e.plan,s="override";if(e.from){let o=ke(e,t.isTTY);if(typeof o=="object")return P(t,o.error),2;s=o}let u=s==="override"||s==="ci";if(i&&!e.from){let o=e.mode??"interactive";return _e(d,p===void 0?void 0:pe(n,p),o,t,r)}let h=ye(d,n,e.from,e.sourceId);if("error"in h)return P(t,h.error),2;let l=await me(d,h.sourceId,h.filePath,t,r,!!e.plan||s==="interactive");if(!l)return 1;let $=r.runDesignForUc??z,k=r.runDesignForUc??null,a=r.sessionScript;if(!l.changed){let o=await Pe(d,h.sourceId,t,r,s,$,!!e.plan);if(o!==null)return o;if(M(t,l,null),s==="agent"){let g=r.emitEvent??(()=>{});W(g,l,null),g({...ee})}return 0}let R=F(d),v=null;if(R!=null?v=B(d,{version:2,source_id:l.source_id,backing_path:h.filePath,head_pin:R,created:new Date().toISOString().replace(/[:.]/g,"-"),skipped_arms:l.skipped_arms,note:l.note,changeset:l.changeset,rows:l.rows,...l.held?{held:l.held}:{}}):P(t,"no chain head after extract \u2014 plan not stored"),s==="agent"){let o=r.emitEvent??(()=>{});if(!w)return W(o,l,v),o({...ee}),0;let g=v?(_,b)=>I(v,_,b):void 0;return U(d,l,v,$,o,t,E(s),g)}if(!w)return v&&t.out(`plan stored: ${v}`),0;let c=l.changeset.filter(o=>o.kind==="ARCHIVE");if(s==="ci"&&c.length>0)return v&&t.out(`plan stored: ${v}`),P(t,H(c.length)),2;if(v){t.out(`plan stored: ${v}`);let o=v;return A(d,be(d,o)??l.rows,u,t,$,(g,_)=>I(o,g,_),l.changeset,E(s),l.held,void 0,void 0,k,a)}return A(d,l.rows,u,t,$,void 0,l.changeset,E(s),l.held,void 0,void 0,k,a)}function be(e,t){let r=T(e,t);return"error"in r?null:r.plan.rows}async function Te(e,t={},r,n=process.cwd()){if(e.mode==="agent"){let{makeHeadlessIO:i}=await import("./headless-io-PWW6YKH2.js"),p=r?i("ndjson","reconcile",r):i("ndjson","reconcile"),f={out:p.out,err:y=>p.event({type:"error",message:y}),isTTY:!1,confirm:async()=>!1,ask:async()=>""},d=2;try{d=await fe(e,f,{...t,emitEvent:y=>p.event(y)},n)}catch(y){p.event({type:"error",message:y instanceof Error?y.message:String(y)})}return p.done(d)}return fe(e,de(),t,n)}export{E as childModeFor,Te as reconcileCommand,ke as resolveReconcileMode,fe as runReconcileCommand,ye as validateReconcileInputs};
|
|
2
|
+
import{a as G,b as Z,c as J,d as Q}from"./chunk-262ES67I.js";import"./chunk-GBBVP2JW.js";import{a as N,c as q,d as ue,f as z}from"./chunk-JV356AYH.js";import"./chunk-3C5GMAM4.js";import{a as P,b as le,d as de}from"./chunk-GRB66C5S.js";import{a as se,b as oe}from"./chunk-SJ2KQKOV.js";import{a as B,b as T,c as L,d as V,e as ce,g as I,h as K}from"./chunk-K5JGCJ2K.js";import{a as ae}from"./chunk-JFAFKHDX.js";import"./chunk-WIA7TPK3.js";import"./chunk-QPZRHAYK.js";import"./chunk-RN4OSVTG.js";import"./chunk-BC7UVJJB.js";import"./chunk-2PQXEEVY.js";import{a as x}from"./chunk-MCQXRJGH.js";import"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import{e as F}from"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";import{existsSync as ve,statSync as we}from"fs";import{basename as j,resolve as pe}from"path";var ge=new Set(["interactive","agent","ci","override"]);function ke(e,t){if(e.mode!==void 0&&!ge.has(e.mode))return{error:`--mode must be interactive | agent | ci | override, got '${e.mode}'`};let r=e.mode,n="reconcile without a TTY needs an explicit mode \u2014 pass --mode agent|ci|override, or --plan for a preview";return r==="interactive"&&!t?{error:n}:r||(t?"interactive":e.plan?"override":{error:n})}function ye(e,t,r,n){let i=pe(t,r);if(!ve(i)||!we(i).isFile())return{error:`--from '${r}' is not a file \u2014 pass the changed source document`};let p=se(i);if(!p.ok)return{error:`--from '${r}' is not an ingestable document \u2014 allowed: ${p.allowlist.join(", ")}`};let f=x(e);if(!f.heads.has(n))return{error:`unknown source '${n}' \u2014 see \`kane-cli context list --type source\``};if(f.heads.get(n)==null)return{error:`source '${n}' is retired \u2014 restore it first with \`kane-cli context revert\`, then reconcile`};let d=null;try{d=oe(i)}catch{}return d!==null&&d!==n&&f.heads.get(d)!=null?{error:`'${j(i)}' already backs live source '${d}' \u2014 did you mean --source-id ${d}? To truly move these bytes under '${n}', retire '${d}' first`}:{sourceId:n,filePath:i}}function O(e){return e==null?"(none)":e.slice(0,19)}function M(e,t,r){if(e.out(`reconcile ${t.source_id}: head ${t.head.status} \u2014 ${O(t.head.before)} \u2192 ${O(t.head.after)}`),e.out(`note: ${t.note}`),e.out(`skipped arms: ${t.skipped_arms}`),t.changed&&e.out(t.held?`extract ran in override mode; ${r?.defaultsTaken??0} default(s) auto-taken; matched-but-changed and new proposals HELD for your verdict (staged \u2014 nothing committed)`:`extract ran in override mode; ${r?.defaultsTaken??0} default(s) auto-taken; matched-but-changed proposals auto-committed as edits`),t.changed){let n=t.changeset??[];e.out(`changeset: ${n.length} item(s)`);for(let i of n)if(i.kind==="MODIFY")e.out(` [MODIFY] ${i.ref} \u2014 ${i.summary} (${O(i.old_cid)} \u2192 ${i.new_cid===null?"(staged)":O(i.new_cid)})`);else if(i.kind==="ADD")e.out(` [ADD] ${i.ref}`);else{e.out(` [ARCHIVE] ${i.ref} \u2014 ${i.why}`);let p=X(i.impact,"retiring drops");p&&e.out(` ${p}`)}}e.out(`plan: ${t.rows.length} row(s)`);for(let n of t.rows){e.out(` [${n.kind}] ${n.ref} \u2014 ${n.reason}`);let i=X(n.impact,"approving marks");i&&e.out(` ${i}`),e.out(` provenance: ${n.provenance}`),e.out(` action: ${n.action}`)}}function X(e,t){if(!e||e.stale_refs.length===0)return null;let r=e.direct_refs??[];return`impact: ${t} ${e.stale_refs.length} item(s) stale`+(r.length>0?` \u2014 ${r.length} directly touched: ${r.join(", ")}`:"")}function E(e){return e==="interactive"?"override":e}async function A(e,t,r,n,i,p,f=[],d="override",y,w,s,u,h){let l;try{l=K(e)}catch($){return P(n,$ instanceof Error?$.message:String($)),1}try{if(!r){let{runWalkSession:$}=await import("./walk-session-N3BP57HK.js");return await $({dir:e,rows:t,archive:f,held:y??null,childMode:d,runDesign:u??null,mark:p,markA:s,...w?{archiveState:w}:{},signals:k=>C(e,k.ref,k.verdict,k.reason),...h?{script:h}:{}})}return await $e(e,t,r,n,i,p,f,d,y,w)}finally{l()}}var H=e=>`${e} high-risk item(s) need a human \u2014 ci mode won't guess. Walk interactively or use --mode agent.`;function W(e,t,r){let n=t.rows;e({type:"reconcile_plan",source_id:t.source_id,plan_path:r,rows:n.map(i=>({kind:i.kind,ref:i.ref,why:i.reason})),archive:t.changeset.filter(i=>i.kind==="ARCHIVE").map(i=>({ref:i.ref,why:i.why}))})}function ne(e={}){return{type:"reconcile_summary",applied:0,skipped:0,deferred:0,plan_only:0,failed:0,paused:0,stale_created:0,...e}}var ee=ne();async function U(e,t,r,n,i,p,f,d,y){W(i,t,r);let w=t.changeset.filter(h=>h.kind==="ARCHIVE"&&y?.[h.ref]===void 0),s=t.rows,u;try{u=K(e)}catch(h){return i({type:"error",message:h instanceof Error?h.message:String(h)}),i(ne()),2}try{return await Re(e,t,r,n,i,p,f,s,w,d)}finally{u()}}async function Re(e,t,r,n,i,p,f,d,y,w){let s=0,u=0,h=0,l=0,$=0,k=0,a=0,R=new Set,v=(c,o)=>{try{w?.(c,o)}catch{}};for(let[c,o]of d.entries()){i({type:"reconcile_row_start",kind:o.kind,ref:o.ref,...o.impact?{stale:o.impact.stale_refs.length,direct:o.impact.direct_refs?.length??0}:{}});let g=(m,D,S)=>i({type:"reconcile_row_end",kind:o.kind,ref:o.ref,outcome:m,...D!==void 0?{exit_code:D}:{},...S?{detail:S}:{}});if(o.applied){u++,g("skipped");continue}if(o.kind==="REMOVE"){$++,g("plan-only");continue}if(o.held_ref&&t.held){let m=new Set;if(o.kind==="MODIFY"&&o.impact){let S=x(e);for(let re of o.impact.stale_refs){let ie=S.resolve(re);ie&&S.stale(ie.tip)==="fresh"&&m.add(re)}}let D=G(e,t.held,o.held_ref,te);if(!D.ok){h++,a===0&&(a=1),g("failed",1,D.message);continue}if(D.kind==="ADD"){let S=await n(D.ref,{yes:!0,mode:f});if(S!==0){S===3?(l++,a===0&&(a=3),g("paused",3)):(h++,a===0&&(a=1),g("failed",S));continue}}s++,D.kind!=="ADD"&&o.impact&&(k+=m.size),v(c,"approved"),C(e,o.ref,D.kind==="ADD"?"gap-resolved-create":"gap-resolved-evolve"),g("applied");continue}let _=N(x(e),o.ref);if(!_.ok){u++,g("skipped");continue}let b=_.target;if(R.has(b.ucTip)){u++,g("skipped");continue}if(o.kind==="ADD"){let m=await n(b.seamRef,{yes:!0,mode:f});if(m===3){l++,a===0&&(a=3),g("paused",3);continue}if(m!==0){h++,a===0&&(a=1),g("failed",m);continue}R.add(b.ucTip),s++,v(c,"approved"),C(e,o.ref,"gap-resolved-create"),g("applied")}else{let m=await q(e,b,{yes:!0,mode:f},p,n,"batch");m.outcome==="evolved"?(R.add(b.ucTip),s++,v(c,"approved"),C(e,o.ref,"gap-resolved-evolve"),g("applied")):m.outcome==="paused"?(l++,a===0&&(a=m.code),g("paused",m.code)):m.outcome==="failed"?(h++,a===0&&(a=1),g("failed",m.code)):(u++,g("skipped"))}}return y.length>0&&(i({type:"reconcile_paused",plan_path:r,pending:y.map(c=>({ref:c.ref,why:c.why}))}),l+=y.length,a===0&&(a=3)),i(ne({applied:s,skipped:u,plan_only:$,failed:h,paused:l,stale_created:k})),a}var te={kind:"human",id:process.env.USER??"operator"};function C(e,t,r,n){ae(e,{ts:new Date().toISOString(),command:"reconcile-walk",id:t,verdict:r,polarity:"preference",by:te,target:t,...n!==void 0?{reason:n}:{}})}async function $e(e,t,r,n,i,p,f=[],d="override",y,w){let s=0,u=0,h=0,l=0,$=0,k=0,a=0,R=new Set;for(let[v,c]of t.entries()){if(c.applied){n.out(`skipped ${c.ref} \u2014 already applied (${c.applied.outcome} at ${c.applied.at})`),u++;continue}let o=m=>{try{p?.(v,m)}catch(D){P(n,`could not record applied state for ${c.ref}: ${D instanceof Error?D.message:String(D)}`)}};if(c.kind==="REMOVE"){n.out(`REMOVE ${c.ref} \u2014 plan-only in this release (not executed)`),l++;continue}if(c.held_ref&&y){let m=G(e,y,c.held_ref,te);if(!m.ok){P(n,`held ${c.ref}: ${m.message}`),$++,a===0&&(a=1);continue}if(n.out(`committed ${m.ref} (${c.kind==="ADD"?"minted":"updated \u2014 old\u2192new redirect"})`),m.kind==="ADD"){let D=await i(m.ref,{yes:r,mode:d});if(D===3){n.out(`design session for ${m.ref} paused \u2014 resume with "kane-cli design tests --resume"`),k++,a===0&&(a=3),o("approved");continue}if(D!==0){P(n,`design run for ${m.ref} ended with exit code ${D}`),$++,a===0&&(a=1),o("approved");continue}}s++,o("approved"),C(e,c.ref,c.kind==="ADD"?"gap-resolved-create":"gap-resolved-evolve");continue}let g=x(e),_=N(g,c.ref);if(!_.ok){n.out(`skipped ${c.ref} \u2014 ${_.message}`),u++;continue}let b=_.target;if(R.has(b.ucTip)){n.out(`skipped ${c.ref} \u2014 use-case ${b.display} already handled in this walk`),u++;continue}if(c.kind==="ADD"){let m=await i(b.seamRef,{yes:r,mode:d});if(m===3){n.out(`design session for ${b.display} paused \u2014 resume with "kane-cli design tests --resume"; this row lands when that session completes`),k++,a===0&&(a=3);continue}if(m!==0){P(n,`design run for ${b.display} ended with exit code ${m}`),$++,a===0&&(a=1);continue}R.add(b.ucTip),s++,o("approved"),C(e,c.ref,"gap-resolved-create")}else{let m=await q(e,b,{yes:!0,mode:d},n,i,"batch");m.outcome==="evolved"?(R.add(b.ucTip),s++,o("approved"),C(e,c.ref,"gap-resolved-evolve")):m.outcome==="paused"?(k++,a===0&&(a=m.code)):m.outcome==="failed"?($++,a===0&&(a=m.code)):u++}}for(let v of f)if(v.kind==="ARCHIVE"&&w?.[v.ref]===void 0){n.out(`[ARCHIVE] ${v.ref} \u2014 ${v.why}`);{let c=X(v.impact,"retiring drops");c&&n.out(` ${c}`)}n.out(" plan-only \u2014 retire belongs to the interactive session (never headless)"),l++}return n.out(`reconcile walk: ${s} applied, ${u} skipped, ${h} deferred, ${l} plan-only`+($>0?`, ${$} failed`:"")+(k>0?`, ${k} paused`:"")),a}async function me(e,t,r,n,i,p=!1){let f=i.seams??{reingest:J(e,r),reextract:Q(e,{stage:p})},d=null,y={reingest:f.reingest,reextract:async s=>d=await f.reextract(s)},w;try{n.out(`reconciling ${t}: re-reading the source and comparing against the graph\u2026`),w=await(i.buildPlan??Z)(e,t,y)}catch(s){return P(n,`reconcile failed: ${s instanceof Error?s.message:String(s)}`),null}return w.changed&&M(n,w,d),w}async function _e(e,t,r,n,i){let p=T(e,t);if("error"in p)return P(n,p.error),2;let{plan:f,path:d}=p,y=r==="override"||r==="ci";if(t===void 0&&r==="interactive"&&n.isTTY&&!await n.confirm(`apply plan ${j(d)} for ${f.source_id} (created ${f.created})?`))return n.out(`not applying ${j(d)}`),0;let w=i.runDesignForUc??z,s=i.runDesignForUc??null,u=i.sessionScript,h=(R,v)=>I(d,R,v),l=(R,v)=>V(d,R,v),$=F(e);if($===f.head_pin){if(r==="agent"){let v=i.emitEvent??(()=>{});return U(e,Y(f),d,w,v,n,E(r),h,f.archive_state)}let R=L(f);return r==="ci"&&R.length>0?(P(n,H(R.length)),2):(n.out(`applying stored plan ${j(d)} for ${f.source_id} (${f.rows.length} row(s))`),A(e,f.rows,y,n,w,h,f.changeset??[],E(r),f.held,f.archive_state,l,s,u))}if(n.out(`graph moved since this plan (${O(f.head_pin)} \u2192 ${O($)}) \u2014 recomputing`),f.held)return he(e,f,n,i,r,w,!1);let k=await me(e,f.source_id,f.backing_path,n,i);if(!k)return 1;if(!k.changed)return M(n,k,null),0;if(r==="agent"){let R=i.emitEvent??(()=>{});return U(e,k,null,w,R,n,E(r))}let a=k.changeset.filter(R=>R.kind==="ARCHIVE");return r==="ci"&&a.length>0?(P(n,H(a.length)),2):A(e,k.rows,y,n,w,void 0,k.changeset,E(r),k.held,void 0,void 0,s,u)}function Y(e,t=!1){return{source_id:e.source_id,changed:!0,head:{status:"unchanged",before:e.head_pin,after:e.head_pin},note:e.note,skipped_arms:e.skipped_arms,changeset:e.changeset??[],rows:t?e.rows.filter(r=>r.applied===void 0):e.rows,...e.held?{held:e.held}:{}}}async function Pe(e,t,r,n,i,p,f){let d=n.runDesignForUc??null,y=n.sessionScript,w=ce(e,t);if(w===null)return null;if("error"in w)return P(r,w.error),2;let{plan:s,path:u}=w,h=s.rows.filter(a=>a.applied===void 0),l=L(s),$=n.emitEvent??(()=>{});if(h.length===0&&l.length===0){r.out(`already reconciled \u2014 plan ${s.created} applied ${s.rows.length} row(s)`);let a=ue(x(e)).staleCount;return a>0&&r.out(`${a} item(s) still stale \u2014 kane-cli maintain evolve --from-stale`),i==="agent"&&(W($,Y(s),u),$({...ee})),0}let k=F(e);return k!==s.head_pin?(r.out(`plan ${s.created} superseded \u2014 graph moved (${O(s.head_pin)} \u2192 ${O(k)}); recomputing`),he(e,s,r,n,i,p,f)):(r.out(`resuming plan ${s.created} \u2014 ${h.length} pending row(s)${l.length>0?`, ${l.length} undecided archive item(s)`:""}`),f?(M(r,Y(s),null),r.out(`plan stored: ${u}`),0):i==="agent"?U(e,Y(s),u,p,$,r,E(i),(a,R)=>I(u,a,R),s.archive_state):i==="ci"&&l.length>0?(P(r,H(l.length)),2):A(e,s.rows,i==="override"||i==="ci",r,p,(a,R)=>I(u,a,R),s.changeset??[],E(i),s.held,s.archive_state,(a,R)=>V(u,a,R),d,y))}async function he(e,t,r,n,i,p,f){let d=n.runDesignForUc??null,y=n.sessionScript,w;if(t.held){let c=x(e),o=new Set(t.rows.filter(_=>_.held_ref!==void 0&&_.applied!==void 0).map(_=>_.held_ref)),g=[];for(let _ of t.held.rows){if(o.has(_.temp_ref))continue;if(!_.matched_cid){g.push(_);continue}let b=c.tipOf(_.matched_cid);if(c.superseded.get(b)===null){r.out(`dropped held "${_.title}" \u2014 its use-case was retired meanwhile`);continue}g.push(b===_.matched_cid?_:{..._,matched_cid:b,uc:{..._.uc,matches_existing:{cid:b}}})}w={source_id:t.held.source_id,rows:g}}let s=n.seams??{reingest:J(e,t.backing_path),reextract:Q(e,{stage:w!==void 0})},u;try{u=await(n.buildPlan??Z)(e,t.source_id,s,{resumeHeld:w})}catch(c){return P(r,`reconcile failed: ${c instanceof Error?c.message:String(c)}`),1}M(r,u,null);let h=F(e),l=null;if(h!=null){let c={},o=new Set(u.changeset.filter(g=>g.kind==="ARCHIVE").map(g=>g.ref));for(let[g,_]of Object.entries(t.archive_state??{}))o.has(g)&&(c[g]=_);l=B(e,{version:2,source_id:u.source_id,backing_path:t.backing_path,head_pin:h,created:new Date().toISOString().replace(/[:.]/g,"-"),skipped_arms:u.skipped_arms,note:u.note,changeset:u.changeset,rows:u.rows,...u.held?{held:u.held}:{},...Object.keys(c).length>0?{archive_state:c}:{}}),r.out(`plan stored: ${l}`)}if(f)return 0;let $=n.emitEvent??(()=>{}),k=l?T(e,l).plan.archive_state:void 0,a=l?(c,o)=>I(l,c,o):void 0,R=l?(c,o)=>V(l,c,o):void 0;if(i==="agent")return U(e,u,l,p,$,r,E(i),a,k);let v=u.changeset.filter(c=>c.kind==="ARCHIVE"&&k?.[c.ref]===void 0);return i==="ci"&&v.length>0?(P(r,H(v.length)),2):A(e,u.rows,i==="override"||i==="ci",r,p,a,u.changeset,E(i),u.held,k,R,d,y)}async function fe(e,t,r={},n=process.cwd()){let i=e.apply!==void 0&&e.apply!==!1,p=typeof e.apply=="string"?e.apply:void 0;if(e.plan&&i)return P(t,"pass --plan OR --apply, not both"),2;if((e.from!==void 0||!i)&&(!e.from||!e.sourceId))return P(t,"reconcile needs --from <file> AND --source-id <id> \u2014 see `kane-cli context list --type source` for ids"),2;if(e.from&&p!==void 0)return P(t,"pass --from OR --apply <path>, not both \u2014 a stored plan names its own source"),2;let d=le(n,t);if(!d)return 2;if(e.mode!==void 0&&!ge.has(e.mode))return P(t,`--mode must be interactive | agent | ci | override, got '${e.mode}'`),2;let y=e.mode==="agent"||e.mode==="ci"||e.mode==="override";if(i&&!y&&!t.isTTY)return P(t,"refusing to apply without a TTY to confirm \u2014 pass --mode override|ci"),2;let w=!e.plan,s="override";if(e.from){let o=ke(e,t.isTTY);if(typeof o=="object")return P(t,o.error),2;s=o}let u=s==="override"||s==="ci";if(i&&!e.from){let o=e.mode??"interactive";return _e(d,p===void 0?void 0:pe(n,p),o,t,r)}let h=ye(d,n,e.from,e.sourceId);if("error"in h)return P(t,h.error),2;let l=await me(d,h.sourceId,h.filePath,t,r,!!e.plan||s==="interactive");if(!l)return 1;let $=r.runDesignForUc??z,k=r.runDesignForUc??null,a=r.sessionScript;if(!l.changed){let o=await Pe(d,h.sourceId,t,r,s,$,!!e.plan);if(o!==null)return o;if(M(t,l,null),s==="agent"){let g=r.emitEvent??(()=>{});W(g,l,null),g({...ee})}return 0}let R=F(d),v=null;if(R!=null?v=B(d,{version:2,source_id:l.source_id,backing_path:h.filePath,head_pin:R,created:new Date().toISOString().replace(/[:.]/g,"-"),skipped_arms:l.skipped_arms,note:l.note,changeset:l.changeset,rows:l.rows,...l.held?{held:l.held}:{}}):P(t,"no chain head after extract \u2014 plan not stored"),s==="agent"){let o=r.emitEvent??(()=>{});if(!w)return W(o,l,v),o({...ee}),0;let g=v?(_,b)=>I(v,_,b):void 0;return U(d,l,v,$,o,t,E(s),g)}if(!w)return v&&t.out(`plan stored: ${v}`),0;let c=l.changeset.filter(o=>o.kind==="ARCHIVE");if(s==="ci"&&c.length>0)return v&&t.out(`plan stored: ${v}`),P(t,H(c.length)),2;if(v){t.out(`plan stored: ${v}`);let o=v;return A(d,be(d,o)??l.rows,u,t,$,(g,_)=>I(o,g,_),l.changeset,E(s),l.held,void 0,void 0,k,a)}return A(d,l.rows,u,t,$,void 0,l.changeset,E(s),l.held,void 0,void 0,k,a)}function be(e,t){let r=T(e,t);return"error"in r?null:r.plan.rows}async function Te(e,t={},r,n=process.cwd()){if(e.mode==="agent"){let{makeHeadlessIO:i}=await import("./headless-io-PWW6YKH2.js"),p=r?i("ndjson","reconcile",r):i("ndjson","reconcile"),f={out:p.out,err:y=>p.event({type:"error",message:y}),isTTY:!1,confirm:async()=>!1,ask:async()=>""},d=2;try{d=await fe(e,f,{...t,emitEvent:y=>p.event(y)},n)}catch(y){p.event({type:"error",message:y instanceof Error?y.message:String(y)})}return p.done(d)}return fe(e,de(),t,n)}export{E as childModeFor,Te as reconcileCommand,ke as resolveReconcileMode,fe as runReconcileCommand,ye as validateReconcileInputs};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
2
|
import{a as n}from"./chunk-3MSXQU2C.js";import"./chunk-UR6MHSHU.js";function p(t){let s=t.sessionName!==null,e={type:"recording_state",enabled:!0,session_id:t.sessionId,persist:s};return t.sessionName&&(e.session_name=t.sessionName),t.testPath&&(e.test_path=t.testPath),t.outputPath&&(e.output_path=t.outputPath),e}async function g(t){if(t.isAgent){process.stdout.write(JSON.stringify(p(t))+`
|
|
3
|
-
`);return}let s=(await import("./react-QWOAB3TB.js")).default,{render:e,useApp:a}=await import("./build-JIKYOZUH.js"),{useEffect:o}=s,{InfoBox:r}=await import("./InfoBox-
|
|
3
|
+
`);return}let s=(await import("./react-QWOAB3TB.js")).default,{render:e,useApp:a}=await import("./build-JIKYOZUH.js"),{useEffect:o}=s,{InfoBox:r}=await import("./InfoBox-W2LZVGQS.js"),u=t.sessionName?[{label:"session",value:t.sessionName},{label:"test",value:n(t.testPath??"")},{label:"output",value:n(t.outputPath??"")}]:[{label:"session",value:"ephemeral"},{label:"note",value:"use /name <name> to persist this session"}];function l(){let{exit:i}=a();return o(()=>{let c=setTimeout(()=>i(),50);return()=>clearTimeout(c)},[i]),s.createElement(r,{title:"Recording",titleColor:"#ff9500",rows:u})}await e(s.createElement(l),{stdout:process.stderr}).waitUntilExit()}export{p as buildRecordingStateEvent,g as printRecordingBanner};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as a,c as b,d as c,e as d,f as e,g as f,h as g}from"./chunk-
|
|
2
|
+
import{b as a,c as b,d as c,e as d,f as e,g as f,h as g}from"./chunk-2BWRAY3Y.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-AKHUNBQS.js";import"./chunk-VE3SUJMA.js";import"./chunk-6SGPN76K.js";import"./chunk-UR6MHSHU.js";export{d as buildAutoDefaultAnnouncement,f as buildAutoDefaultedEvent,e as buildAutoDefaultedNdjson,c as buildRemediationMessage,b as decideGateAction,a as loadCachedIds,g as requireProjectFolder};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as b,b as c,c as d,d as e,e as f}from"./chunk-
|
|
2
|
+
import{a as b,b as c,c as d,d as e,e as f}from"./chunk-4R2HOA7J.js";import"./chunk-K5JGCJ2K.js";import{f as a}from"./chunk-KNCHEM6A.js";import"./chunk-FXPPQL4D.js";import"./chunk-RE3BZVGE.js";import"./chunk-6PS65QFF.js";import"./chunk-JFAFKHDX.js";import"./chunk-WIA7TPK3.js";import"./chunk-QPZRHAYK.js";import"./chunk-6GTOYTCQ.js";import"./chunk-YKTYVJBN.js";import"./chunk-6AYUSR7X.js";import"./chunk-427OQS2N.js";import"./chunk-2PQXEEVY.js";import"./chunk-MCQXRJGH.js";import"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import"./chunk-6SGPN76K.js";import"./chunk-UR6MHSHU.js";export{e as dedupPreFlags,c as displaySourceName,a as resolveAnswers,f as runExtract,b as sessionSourceRef,d as sourceBanner};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-WWH7CW5R.js";import"./chunk-KHU7C6EE.js";import"./chunk-3C5GMAM4.js";import"./chunk-KNCHEM6A.js";import"./chunk-FXPPQL4D.js";import"./chunk-RE3BZVGE.js";import"./chunk-6PS65QFF.js";import"./chunk-JFAFKHDX.js";import"./chunk-WIA7TPK3.js";import"./chunk-QPZRHAYK.js";import"./chunk-6GTOYTCQ.js";import"./chunk-YKTYVJBN.js";import"./chunk-6AYUSR7X.js";import"./chunk-427OQS2N.js";import"./chunk-FJTWJ243.js";import"./chunk-2PQXEEVY.js";import"./chunk-L5LI2JF4.js";import"./chunk-MCQXRJGH.js";import"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import"./chunk-6SGPN76K.js";import"./chunk-UR6MHSHU.js";export{a as runDesign};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as A}from"./chunk-
|
|
2
|
+
import{a as A}from"./chunk-BV5QKFMJ.js";import{E as M,F as P,G as K,H,I as U}from"./chunk-HA5GE57Z.js";import"./chunk-GLS46X7N.js";import{a as _,b as E}from"./chunk-EWTX7HSU.js";import{a as h,b as k}from"./chunk-32GP7KTM.js";import"./chunk-2YQ6TW77.js";import"./chunk-RHNKYNNZ.js";import{s as L}from"./chunk-RKWJG3WW.js";import{c as R}from"./chunk-6XHAXAL2.js";import"./chunk-5JJ245FW.js";import"./chunk-D7L6UW5Z.js";import{a as x}from"./chunk-VBCE4U4B.js";import"./chunk-C5UNZ6ZY.js";import"./chunk-S3DAAAE5.js";import"./chunk-EOLQUB4Q.js";import"./chunk-C42WWO7Y.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-4A6BLXQN.js";import"./chunk-CJJXT5DO.js";import"./chunk-FJTWJ243.js";import"./chunk-BC7UVJJB.js";import"./chunk-2PQXEEVY.js";import"./chunk-EHN5HTUD.js";import"./chunk-L5LI2JF4.js";import"./chunk-MCQXRJGH.js";import"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import{e as b,f as S,g as T}from"./chunk-M5JQXOCE.js";import"./chunk-2BWRAY3Y.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import{a as C}from"./chunk-AKHUNBQS.js";import"./chunk-VE3SUJMA.js";import"./chunk-E47GFYXA.js";import{a as v}from"./chunk-P4HW2NTZ.js";import"./chunk-6SGPN76K.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";import{resolve as Y}from"path";import{existsSync as D}from"fs";function O(){return{register:(n,r)=>b(n,r),deregister:n=>S(n),cleanup:(n,r)=>T(n,r),remoteLogger:null}}async function le(n,r){let t=Y(n);if(!D(t))return process.stderr.write(`error: file not found: ${t}
|
|
3
3
|
`),2;if(r.finalValidation!==void 0&&r.finalValidation!=="on"&&r.finalValidation!=="off")return process.stderr.write(`error: --final-validation must be 'on' or 'off'
|
|
4
4
|
`),2;if(!t.endsWith("_test.md"))return process.stderr.write(`error: not a *_test.md file: ${t}
|
|
5
5
|
helpers are import-only \u2014 run a test that @imports it.
|
|
@@ -12,6 +12,6 @@ import{a as A}from"./chunk-5KSB5MOF.js";import{E as M,F as P,G as K,H,I as U}fro
|
|
|
12
12
|
\u2022 Run 'kane-cli login --username <user> --access-key <key>'
|
|
13
13
|
`):e instanceof h&&e.code==="refresh_failed"?process.stderr.write(`error: Token refresh failed. Run 'kane-cli login' to re-authenticate.
|
|
14
14
|
`):process.stderr.write(`error: auth resolution failed: ${e.message}
|
|
15
|
-
`),2}let y=String(p.resolvedCreds?.org_id??"");if(!y)return process.stderr.write("error: TMS did not return an org_id. Run `kane-cli login` again.\n"),2;{let{readMetaIfExists:e,assertOrgMatchOrExit:g}=await import("./testmd-actions-
|
|
15
|
+
`),2}let y=String(p.resolvedCreds?.org_id??"");if(!y)return process.stderr.write("error: TMS did not return an org_id. Run `kane-cli login` again.\n"),2;{let{readMetaIfExists:e,assertOrgMatchOrExit:g}=await import("./testmd-actions-S3ZNOZEK.js"),d=g(e(t),y);if(d!==null)return d}let w=new R,j=A({isAgent:a,log:(e,g,d,V)=>w.log(e,g,d,V)}),F={path:t,cwd:process.cwd(),opts:r,isAgent:a,disableAskUser:!0,resolved:s,resolvedAuth:p,cliOverrides:i,environment:f,envConfig:N,profile:I,model:$,creds:o,configStore:l,session:w};try{return(await M(F,j,c)).exitCode}catch(e){return process.stderr.write(`error: ${e.message}
|
|
16
16
|
`),2}}var m=class extends Error{constructor(t,a){super(t);this.exitCode=a;this.name="CliArgError"}};function G(n){let r={mode:"mode",assertionMode:"assertion_mode",finalValidation:"final_validation",maxSteps:"max_steps",timeout:"timeout",globalContext:"global_context",localContext:"local_context",codeExport:"code_export",codeLanguage:"code_language",headless:"headless",cdpEndpoint:"cdp_endpoint",wsEndpoint:"ws_endpoint"},t=new Set(["max_steps","timeout"]),a={};for(let[c,s]of Object.entries(r)){let i=n[c];if(i===void 0||i==="")continue;let o=i;if(t.has(s)&&(o=Number(i),Number.isNaN(o))){let l="--"+c.replace(/[A-Z]/g,u=>"-"+u.toLowerCase());throw new m(`error: ${l} must be a number
|
|
17
17
|
`,2)}a[s]=o}return a}export{U as applyCliStepConfig,K as buildStepRunVariables,P as buildTestLevelVariables,G as optsToOverrides,H as replayVariablesForStep,le as runTestMdFile};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as p,b as g}from"./chunk-
|
|
2
|
+
import{a as p,b as g}from"./chunk-UZJ7MRBV.js";import{b as m}from"./chunk-JTEY32TL.js";import{a as d}from"./chunk-RZ4F3BHX.js";import"./chunk-AKHUNBQS.js";import"./chunk-P4HW2NTZ.js";import{a as f,h as a,i as u}from"./chunk-6SGPN76K.js";import"./chunk-UR6MHSHU.js";import{mkdirSync as y,writeFileSync as w,readFileSync as S,rmSync as c,cpSync as v,createWriteStream as T,existsSync as b}from"fs";import{join as s}from"path";import{tmpdir as k}from"os";import{spawn as h}from"child_process";import{Readable as I}from"stream";import{pipeline as $}from"stream/promises";function E(t){try{return S(s(t,"VERSION"),"utf-8").trim()||null}catch{return null}}function L(t,r,l){return l?t!==r:t===null||m(t,r)>0}function C(t){let r=a.split("/").pop()??a;return`https://registry.npmjs.org/${a}/-/${r}-${t}.tgz`}var R=5e3,A=6e4;async function x(){let t=new AbortController,r=setTimeout(()=>t.abort(),R);try{let l=await d(p(),{headers:{Accept:"application/json"},signal:t.signal});if(!l.ok)throw new Error(`Controller returned ${l.status} fetching skill version map`);let i=await l.json(),n=g(i,f);if(!n)throw new Error("No compatible skill version found for this kane-cli build");return n}finally{clearTimeout(r)}}async function _(t){let r=C(t),l=new AbortController,i=setTimeout(()=>l.abort(),A);try{let n=await d(r,{headers:{Accept:"application/octet-stream"},signal:l.signal});if(!n.ok||!n.body)throw new Error(`Failed to download skill tarball (${n.status})`);let e=s(k(),`kane-cli-skill-${t}-${process.pid}.tgz`);return await $(I.fromWeb(n.body),T(e)),e}finally{clearTimeout(i)}}function M(t,r){return new Promise((l,i)=>{y(r,{recursive:!0});let n=h("tar",["-xzf",t,"-C",r,"--strip-components=2","package/skills"],{stdio:["ignore","ignore","pipe"]}),e="";n.stderr?.on("data",o=>{e+=o.toString()}),n.on("error",o=>i(o)),n.on("close",o=>{o===0?l():i(new Error(`tar exited ${o}${e?`: ${e.trim()}`:""}`))})})}async function W(t){let r;try{r=t??await x()}catch(e){return{status:"failed",version:t??"unknown",installedTargets:0,error:e instanceof Error?e.message:String(e)}}let l=u.filter(({dir:e})=>L(E(e),r,!!t));if(l.length===0)return{status:"already-installed",version:r,installedTargets:0};let i=null,n=null;try{if(n=await _(r),i=s(k(),`kane-cli-skill-${r}-stage-${process.pid}`),c(i,{recursive:!0,force:!0}),await M(n,i),!b(s(i,"SKILL.md")))throw new Error(`Unexpected skill tarball layout for v${r}: SKILL.md not at package/skills/ root`);let e=0;for(let{dir:o}of l)try{c(o,{recursive:!0,force:!0}),y(o,{recursive:!0}),v(i,o,{recursive:!0,force:!0}),w(s(o,"VERSION"),r+`
|
|
3
3
|
`),e++}catch{}return e===0?{status:"failed",version:r,installedTargets:0,error:"Could not write to any agent skill directory"}:{status:"installed",version:r,installedTargets:e}}catch(e){return{status:"failed",version:r,installedTargets:0,error:e instanceof Error?e.message:String(e)}}finally{if(n)try{c(n,{force:!0})}catch{}if(i)try{c(i,{recursive:!0,force:!0})}catch{}}}function D(t){switch(t.status){case"installed":return`Installed kane-cli skill v${t.version} (${t.installedTargets}/${u.length} agent dirs). Restart your AI agent (Claude Code / Codex CLI / Gemini CLI) to load it.`;case"already-installed":return`kane-cli skill v${t.version} already installed.`;case"failed":return`Failed to install kane-cli skill: ${t.error??"unknown error"}`}}export{D as formatInstallResult,W as installSkill,L as targetNeedsInstall};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d}from"./chunk-
|
|
2
|
+
import{a,b,c,d}from"./chunk-KYHXDJN4.js";import"./chunk-UR6MHSHU.js";export{c as buildAgentEnv,b as findAssuranceAgent,a as platformPackageName,d as resolveAgentAuthEnv};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{d as a}from"./chunk-BLSZ4H5W.js";import"./chunk-S2C62SDY.js";import"./chunk-JU5KRCKD.js";import"./chunk-3MSXQU2C.js";import"./chunk-OFEOWKM3.js";import"./chunk-HA5GE57Z.js";import"./chunk-GLS46X7N.js";import"./chunk-WJGBXJT4.js";import"./chunk-EWTX7HSU.js";import"./chunk-32GP7KTM.js";import"./chunk-2YQ6TW77.js";import"./chunk-LLS47HUA.js";import"./chunk-RHNKYNNZ.js";import"./chunk-RKWJG3WW.js";import"./chunk-JF7Q2I45.js";import"./chunk-6CZIEK6B.js";import"./chunk-6XHAXAL2.js";import"./chunk-KI2DVQSA.js";import"./chunk-5JJ245FW.js";import"./chunk-D7L6UW5Z.js";import"./chunk-VBCE4U4B.js";import"./chunk-24VYAMMK.js";import"./chunk-2WO7G2HO.js";import"./chunk-5Y2G4NC7.js";import"./chunk-RV2NXHIC.js";import"./chunk-XQL53VB7.js";import"./chunk-C5UNZ6ZY.js";import"./chunk-S3DAAAE5.js";import"./chunk-EOLQUB4Q.js";import"./chunk-MSPZOEFB.js";import"./chunk-C42WWO7Y.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-24OFJ7SE.js";import"./chunk-RFHMDQXZ.js";import"./chunk-4A6BLXQN.js";import"./chunk-CJJXT5DO.js";import"./chunk-FJTWJ243.js";import"./chunk-BC7UVJJB.js";import"./chunk-2PQXEEVY.js";import"./chunk-EHN5HTUD.js";import"./chunk-L5LI2JF4.js";import"./chunk-MCQXRJGH.js";import"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import"./chunk-LABIRPOT.js";import"./chunk-HWA7WD44.js";import"./chunk-N6DO2LBH.js";import"./chunk-YCCUBQY4.js";import"./chunk-MY32TBBR.js";import"./chunk-M5JQXOCE.js";import"./chunk-2BWRAY3Y.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-AKHUNBQS.js";import"./chunk-VE3SUJMA.js";import"./chunk-E47GFYXA.js";import"./chunk-P4HW2NTZ.js";import"./chunk-6NIV7AVZ.js";import"./chunk-3Z3UIW5H.js";import{a as o}from"./chunk-DFS4RMVP.js";import"./chunk-LEQ2B3PR.js";import"./chunk-4SXD6XWV.js";import"./chunk-6SGPN76K.js";import{a as t}from"./chunk-HCBYKLMW.js";import{c as n}from"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import{e as r}from"./chunk-UR6MHSHU.js";var e=r(t(),1);async function p(i){let c=i.scenarioLimit!==void 0||i.perScenarioLimit!==void 0?{scenarioLimit:i.scenarioLimit,perScenarioLimit:i.perScenarioLimit}:void 0,{waitUntilExit:m}=n((0,e.jsx)(o,{children:(0,e.jsx)(a,{initialChatMode:"generate",initialObjective:i.objective,initialGenerateLimits:c})}),{exitOnCtrlC:!1});await m()}export{p as runGenerate};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{e as a,f as b,g as c,h as d,i as e,j as f,k as g,l as h,m as i,n as j,o as k,p as l,q as m}from"./chunk-
|
|
2
|
+
import{e as a,f as b,g as c,h as d,i as e,j as f,k as g,l as h,m as i,n as j,o as k,p as l,q as m}from"./chunk-WJGBXJT4.js";import"./chunk-EWTX7HSU.js";import"./chunk-32GP7KTM.js";import"./chunk-2YQ6TW77.js";import"./chunk-RKWJG3WW.js";import"./chunk-VBCE4U4B.js";import"./chunk-EOLQUB4Q.js";import"./chunk-C42WWO7Y.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-L5LI2JF4.js";import"./chunk-MY32TBBR.js";import"./chunk-M5JQXOCE.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-AKHUNBQS.js";import"./chunk-P4HW2NTZ.js";import"./chunk-4SXD6XWV.js";import"./chunk-6SGPN76K.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{i as ExportError,c as assertOrgMatchOrExit,j as exportTestmd,b as metaMatchesOrg,a as readMetaIfExists,d as resolveCurrentOrgId,l as resolveSyncAuth,h as runDeleteAction,k as runExportAction,e as runListAction,f as runListTui,g as runStatusAction,m as runSyncAction};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a}from"./chunk-EOLQUB4Q.js";import"./chunk-C42WWO7Y.js";import"./chunk-RZ4F3BHX.js";import"./chunk-AKHUNBQS.js";import"./chunk-6SGPN76K.js";import"./chunk-UR6MHSHU.js";export{a as refreshOAuthToken};
|
|
@@ -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-AKHUNBQS.js";import"./chunk-6SGPN76K.js";import"./chunk-UR6MHSHU.js";async function l(n,o,r){let{ControllerClient:e}=await import("./controller-client-RD2YEMAH.js");await new e(t(n).controllerBaseUrl,{username:o,accessKey:r}).getTmsCredentials()}export{l as validateBasicAuth};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d}from"./chunk-
|
|
2
|
+
import{a,b,c,d}from"./chunk-JTEY32TL.js";import"./chunk-RZ4F3BHX.js";import"./chunk-6SGPN76K.js";import"./chunk-UR6MHSHU.js";export{d as checkForUpdate,b as compareVersions,c as getSeverity,a as getUpdateCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as Y}from"./chunk-6LRKYF67.js";import"./chunk-GBBVP2JW.js";import{a as j,c as F}from"./chunk-ANIVHX3P.js";import"./chunk-3C5GMAM4.js";import"./chunk-GRB66C5S.js";import{a as B}from"./chunk-64LC36AF.js";import"./chunk-JFAFKHDX.js";import"./chunk-WIA7TPK3.js";import"./chunk-QPZRHAYK.js";import"./chunk-RN4OSVTG.js";import"./chunk-BC7UVJJB.js";import"./chunk-2PQXEEVY.js";import{a as I}from"./chunk-MCQXRJGH.js";import{b as U}from"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import{g as N}from"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import{a as V}from"./chunk-YCCUBQY4.js";import{x as m}from"./chunk-HJGUEZLW.js";import{a as P}from"./chunk-HCBYKLMW.js";import{a as A,b as u,k as M}from"./chunk-C44QQJR4.js";import{a as Q}from"./chunk-6YGTRKDT.js";import{e as O}from"./chunk-UR6MHSHU.js";var T=O(Q(),1);function K(e,p,k){let{ref:D,reason:d,by:y}=k;if(!d||d.trim().length===0)return{record:null,errors:[{code:"REASON_REQUIRED",detail:"archiving a node needs a reason \u2014 it becomes the tombstone's provenance"}]};let x=p.resolve(D);if(!x)return{record:null,errors:[{code:"UNKNOWN_REF",detail:`no node '${D}' in the graph`}]};let r=p.tipOf(x.cid);if(p.superseded.has(r))return{record:null,errors:[{code:"ALREADY_ARCHIVED",detail:`${D} is already superseded at its tip (${r.slice(0,19)}\u2026)`}]};let t=N(e,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[{kind:"node",old:r,new:null,reason:d,by:y}],source_head_moves:{}},{expectPrev:p.latestHash});return U(e),{record:t.record,errors:null}}function L(e){let p=e.by??{kind:"human",id:process.env.USER??"operator"},k=e.mode==="interactive"?"override":e.mode,D={out:()=>{},err:()=>{},isTTY:!1,confirm:async()=>!0},d={applied:0,committed:0,retired:0,skipped:0,deferred:0,failed:0},y=new Map;for(let r of e.planRows)if(r.held_ref&&e.held){let t=e.held.rows.find($=>$.temp_ref===r.held_ref);if(!t)continue;let l={kind:t.kind,ref:t.temp_ref,title:t.title,why:t.why,origin:"content-change",...r.impact?{impact:r.impact}:{}};y.set(l.ref,{card:l,source:"held",heldRef:t.temp_ref})}else if(r.kind==="MODIFY"){let t={kind:"MODIFY",ref:r.ref,title:r.ref,why:`${r.reason}: ${r.provenance}`,origin:r.origin??"structural-stale",...r.impact?{impact:r.impact}:{}};y.set(t.ref,{card:t,source:"row",row:r})}else if(r.kind==="ADD"){let t={kind:"ADD",ref:r.ref,title:r.ref,why:r.reason,origin:r.origin??"content-change"};y.set(t.ref,{card:t,source:"row",row:r})}for(let r of e.archive){if(r.kind!=="ARCHIVE")continue;let t={kind:"ARCHIVE",ref:r.ref,title:r.ref,why:r.why,provenance:r.why,...r.impact?{impact:r.impact}:{}};y.set(t.ref,{card:t,source:"archive",row:r})}let x=r=>(d.failed++,{outcome:"failed",detail:r});return{cards:()=>[...y.values()].map(r=>r.card),async submit(r,t){let l=y.get(r);if(!l)return x(`no card ${r}`);if(t.v==="skip")return d.skipped++,e.signals({ref:r,verdict:"gap-dismissed"}),{outcome:"skipped"};if(t.v==="defer")return d.deferred++,{outcome:"deferred"};if(t.v==="archive"){if(l.source!=="archive")return x(`${r} is not an ARCHIVE card`);let c=I(e.contextDir),C=c.resolve(l.row.ref);if(C&&c.superseded.has(c.tipOf(C.cid)))return d.skipped++,{outcome:"skipped",detail:"already retired \u2014 nothing to do"};let n=K(e.contextDir,I(e.contextDir),{ref:l.row.ref,reason:`reconcile retire: ${l.row.why}`,by:p});return n.errors?x(n.errors.map(s=>`${s.code}: ${s.detail}`).join("; ")):(d.retired++,e.signals({ref:r,verdict:"gap-resolved-archive",reason:l.row.why}),{outcome:"retired"})}if(l.source==="archive")return x(`${r} takes archive/skip/defer, not approve`);if(l.source==="held"){let c=Y(e.contextDir,e.held,l.heldRef,p,t.edits);if(!c.ok)return x(c.message);if(c.kind==="ADD"){let C=await e.runDesign(c.ref,{yes:!0,mode:k,...t.steering?{because:t.steering}:{}});return C!==0?(d.failed++,{outcome:"failed",landed:!0,detail:`committed ${c.ref}, but its design run exited ${C} \u2014 finish with kane-cli design tests --use-case ${c.ref}`}):(d.applied++,e.signals({ref:r,verdict:"gap-resolved-create",...t.steering?{reason:t.steering}:{}}),{outcome:"applied",detail:c.ref})}if(t.steering){let C=I(e.contextDir),n=j(C,c.ref);if(!n.ok)return d.committed++,{outcome:"committed",detail:`committed ${c.ref}, but steering could not resolve it (${n.message}) \u2014 steer via kane-cli maintain evolve ${c.ref}`};let s=await F(e.contextDir,n.target,{yes:!0,mode:k,because:t.steering},D,e.runDesign,"batch");if(s.outcome==="no-design"){let R=await e.runDesign(n.target.seamRef,{yes:!0,mode:k,because:t.steering});return R!==0?(d.failed++,{outcome:"failed",landed:!0,detail:`committed ${c.ref}, but its steered design run exited ${R} \u2014 finish with kane-cli design tests --use-case ${n.target.seamRef}`}):(d.applied++,e.signals({ref:r,verdict:"gap-resolved-create",reason:t.steering}),{outcome:"applied",detail:c.ref})}return s.outcome==="failed"||s.outcome==="paused"?(d.failed++,{outcome:"failed",landed:!0,detail:`committed ${c.ref}, but the steering evolve ${s.outcome} (exit ${s.code}) \u2014 finish with kane-cli maintain evolve ${c.ref}`}):s.outcome==="declined"?(d.committed++,{outcome:"committed",detail:`committed ${c.ref} \u2014 the steering evolve was declined; re-run kane-cli maintain evolve ${c.ref}`}):(d.applied++,e.signals({ref:r,verdict:"gap-resolved-evolve",reason:t.steering}),{outcome:"applied",detail:c.ref})}return d.committed++,e.signals({ref:r,verdict:"gap-resolved-evolve"}),{outcome:"committed",detail:c.ref}}let $=I(e.contextDir),b=j($,l.row.ref);if(!b.ok)return x(b.message);if(l.card.kind==="ADD"){let c=await e.runDesign(b.target.seamRef,{yes:!0,mode:k});return c!==0?x(`design run exited ${c}`):(d.applied++,e.signals({ref:r,verdict:"gap-resolved-create"}),{outcome:"applied"})}let h=await F(e.contextDir,b.target,{yes:!0,mode:k,...t.steering?{because:t.steering}:{}},D,e.runDesign,"batch");return h.outcome==="evolved"?(d.applied++,e.signals({ref:r,verdict:"gap-resolved-evolve",...t.steering?{reason:t.steering}:{}}),{outcome:"applied"}):h.outcome==="failed"||h.outcome==="paused"?x(`evolve ${h.outcome} (exit ${h.code})`):(d.skipped++,{outcome:"skipped",detail:h.outcome})},summary:()=>({...d})}}var v=O(P(),1);function S(e){return e.kind==="ARCHIVE"?[{v:"archive",label:"retire",detail:"tombstone it \u2014 the graph forgets forward"},{v:"skip",label:"skip",detail:"keep it \u2014 decided, never re-offered"},{v:"defer",label:"defer",detail:"not now \u2014 the plan re-offers it"}]:[{v:"approve",label:"approve",detail:e.kind==="ADD"?"commit + design it":"commit the updated version (old\u2192new redirect)"},{v:"skip",label:e.origin==="content-change"?"reject":"skip",detail:e.origin==="content-change"?"drop the staged proposal \u2014 nothing committed":"leave it as is"},{v:"defer",label:"defer",detail:"not now \u2014 the plan keeps it staged"}]}function E(e){return e.kind==="ARCHIVE"?null:S(e).length}var X={ADD:{color:m.green??"green"},MODIFY:{color:"yellow"},ARCHIVE:{color:m.red}},z=60;function G({card:e,position:p,sel:k=0,focused:D=!1,freeText:d=null}){let{stdout:y}=M(),r=(y?.columns??80)<z,t=S(e),l=E(e),$=X[e.kind],b=n=>D&&k===n?(0,v.jsx)(u,{color:m.generateAccent,children:"\u25B8"}):" ",h=e.impact,c=h&&h.stale_refs.length>0?`${e.kind==="ARCHIVE"?"retiring drops":"approving marks"} ${h.stale_refs.length} item(s) stale`+((h.direct_refs?.length??0)>0?` \u2014 ${h.direct_refs.length} directly touched: ${h.direct_refs.join(", ")}`:""):null,C=(0,v.jsxs)(A,{flexDirection:"column",children:[(0,v.jsx)(u,{bold:!0,color:m.generateAccent,children:`? reconcile \u2014 item ${p.n} of ${p.of}`}),(0,v.jsxs)(u,{bold:!0,children:[" ",(0,v.jsx)(u,{color:$.color,children:`[${e.kind}]`}),` ${e.title}`]}),(0,v.jsx)(u,{color:m.muted,children:` ${e.why}`}),c?(0,v.jsx)(u,{color:m.muted,children:` impact: ${c}`}):null,e.kind==="ARCHIVE"&&e.provenance&&e.provenance!==e.why?(0,v.jsx)(u,{color:m.muted,children:` ${e.provenance}`}):null,t.map((n,s)=>(0,v.jsxs)(u,{children:[" ",b(s),` ${s+1} ${n.label}`,(0,v.jsx)(u,{color:m.dim,children:` \u2014 ${n.detail}`})]},`o-${s}`)),l!==null?d?(0,v.jsxs)(A,{children:[(0,v.jsxs)(u,{children:[" ",(0,v.jsx)(u,{color:m.generateAccent,children:"\u25B8"})," ",(0,v.jsx)(u,{color:m.dim,children:"\u270E "})]}),(0,v.jsx)(V,{value:d.value,onChange:d.onChange,onSubmit:d.onSubmit,onCancel:d.onCancel,placeholder:"steer the redesign (approves, then evolves with your words)"})]}):(0,v.jsxs)(u,{children:[" ",b(l)," ",(0,v.jsx)(u,{color:m.dim,children:"\u270E steer the redesign"})]}):null]});return r?C:(0,v.jsx)(A,{flexDirection:"column",borderStyle:"round",borderColor:m.generateAccent,paddingX:1,children:C})}var g=O(P(),1);function q(e){return e.landed?"committed":e.outcome}var J={applied:"\u2713",committed:"\u2713",retired:"\u2713",skipped:"\xB7",deferred:"\u2013",failed:"\u2717"};function Z({controller:e,cards:p,note:k,markOutcome:D,routeChat:d,onFinish:y,onCtrlC:x,pauseRef:r}){let[t,l]=(0,T.useState)(p.length>0?{at:"card",idx:0,sel:0,editor:null}:{at:"chat",text:"",busy:null}),$=(0,T.useRef)(0),b=(0,T.useRef)(t);b.current=t;let h=(0,T.useRef)(!1),c=()=>{k((0,g.jsx)(u,{color:m.dim,children:"walk paused \u2014 every verdict so far is committed; re-run the same command to continue"})),y(3)},C=()=>{if(h.current)return;h.current=!0;let i=b.current;if(i.at==="busy"||i.at==="chat"&&i.busy!==null){k((0,g.jsx)(u,{color:m.dim,children:"finishing the current item, then pausing\u2026"}));return}if(i.at==="chat"){y($.current);return}c()};r&&(r.current=C);let n=t.at==="card"||t.at==="busy"?p[t.idx]:null,s=i=>{let o=i+1;if(o<p.length)l({at:"card",idx:o,sel:0,editor:null});else{let a=e.summary();k((0,g.jsx)(u,{color:m.dim,children:`reconcile walk: ${a.applied} applied, ${a.committed} committed, ${a.retired} retired, ${a.skipped} skipped, ${a.deferred} deferred`+(a.failed>0?`, ${a.failed} failed`:"")})),k((0,g.jsx)(u,{color:m.dim,children:"anything else? steer a redesign \u2014 `<uc-ref> <what to change>` \u2014 or press Enter to finish"})),l({at:"chat",text:"",busy:null})}},R=(0,T.useRef)(!1),w=(i,o)=>{if(R.current)return;R.current=!0;let a=p[i];l({at:"busy",idx:i,label:o.v==="archive"?"retiring\u2026":o.v==="approve"&&o.steering?"committing, then steering the redesign\u2026":"applying\u2026"}),e.submit(a.ref,o).catch(f=>({outcome:"failed",detail:f instanceof Error?f.message:String(f)})).then(f=>{let _=J[f.outcome]??"\xB7";if(k((0,g.jsxs)(u,{children:[(0,g.jsx)(u,{color:f.outcome==="failed"?m.red:m.green,children:_}),` ${f.outcome} [${a.kind}] ${a.title}`,f.detail?(0,g.jsx)(u,{color:m.dim,children:` \u2014 ${f.detail}`}):null,f.outcome!=="failed"&&f.outcome!=="skipped"&&f.outcome!=="deferred"&&a.impact&&a.impact.stale_refs.length>0?(0,g.jsx)(u,{color:m.dim,children:` \xB7 ${a.impact.stale_refs.length} item(s) now stale`}):null]})),f.outcome==="failed"&&($.current=$.current===0?1:$.current),D(a.ref,q(f)),R.current=!1,h.current){c();return}s(i)})},W=(0,T.useMemo)(()=>({isFocused:()=>b.current.at==="card"&&b.current.editor===null,onMove:i=>{l(o=>{if(o.at!=="card")return o;let a=p[o.idx],f=E(a)??S(a).length-1;return{...o,sel:Math.max(0,Math.min(f,o.sel+i))}})},onSelect:()=>{let i=b.current;if(i.at!=="card")return;let o=p[i.idx],a=E(o);if(a!==null&&i.sel===a){l({...i,editor:""});return}let f=S(o)[i.sel];f&&w(i.idx,{v:f.v})},onDigit:i=>{let o=b.current;if(o.at!=="card")return;let a=S(p[o.idx])[i-1];a&&w(o.idx,{v:a.v})},onType:i=>{l(o=>o.at!=="card"||E(p[o.idx])===null?o:{...o,editor:(o.editor??"")+i})},onBack:()=>{}}),[p]);return(0,T.useEffect)(()=>{t.at==="done"&&y($.current)},[t.at]),(0,g.jsxs)(A,{flexDirection:"column",children:[(0,g.jsx)(B,{onToggleThinking:()=>{},onCtrlC:()=>{x(),C()},panel:W}),t.at==="card"&&n?(0,g.jsx)(G,{card:n,position:{n:t.idx+1,of:p.length},sel:t.sel,focused:t.editor===null,freeText:t.editor!==null?{value:t.editor,onChange:i=>l(o=>o.at==="card"?{...o,editor:i}:o),onSubmit:i=>{let o=b.current;o.at==="card"&&(i.trim()?w(o.idx,{v:"approve",steering:i.trim()}):l({...o,editor:null}))},onCancel:()=>l(i=>i.at==="card"?{...i,editor:null}:i)}:null}):null,t.at==="busy"?(0,g.jsx)(u,{color:m.dim,children:`\u2026 ${t.label}`}):null,t.at==="chat"?t.busy?(0,g.jsx)(u,{color:m.dim,children:`\u2026 ${t.busy}`}):(0,g.jsxs)(A,{children:[(0,g.jsx)(u,{color:m.generateAccent,children:"\u203A "}),(0,g.jsx)(V,{value:t.text,onChange:i=>l(o=>o.at==="chat"?{...o,text:i}:o),onSubmit:i=>{let o=i.trim();if(!o){l({at:"done"});return}l({at:"chat",text:"",busy:"redesigning\u2026"}),d(o).catch(a=>`\u2717 redesign failed: ${a instanceof Error?a.message:String(a)}`).then(a=>{if(k((0,g.jsx)(u,{children:a})),h.current){c();return}l({at:"chat",text:"",busy:null})})},onCancel:()=>{},placeholder:"uc-\u2026 what to change (Enter on empty = finish)"})]}):null]})}async function xe(e){let p={current:null},k=n=>{p.current?.append(n)},D=null,d=async(n,s)=>{let[{runDesign:R},{resolveAgentAuthEnv:w},{runAgent:W},{preflightTurn:i}]=await Promise.all([import("./run-XAZMT7WO.js"),import("./spawner-GOTVIFR5.js"),import("./bridge-LNDJS3HH.js"),import("./turn-preflight-JGYT7LXP.js")]);D??=await w();let o=D;return R({useCase:n,force:!0,mode:s.mode??"override",...s.because?{because:s.because}:{},...s.changeDelta!==void 0?{changeDelta:s.changeDelta}:{},...s.priorDesign!==void 0?{priorDesign:s.priorDesign}:{}},{contextDir:e.dir,agent:W,preflightTurn:()=>i(o),ask:async()=>[],out:a=>k((0,g.jsx)(u,{color:m.dim,children:` ${a}`})),progress:()=>{},isTTY:!1,auth:o})},y=e.runDesign??d,x=L({contextDir:e.dir,held:e.held,archive:e.archive,planRows:e.rows,runDesign:y,mode:"interactive",signals:e.signals}),r=new Set(e.rows.filter(n=>n.applied!==void 0).map(n=>n.held_ref??n.ref)),t=x.cards().filter(n=>!r.has(n.ref)&&!(n.kind==="ARCHIVE"&&e.archiveState?.[n.ref]!==void 0)),l=n=>e.rows.findIndex(s=>(s.held_ref??s.ref)===n),$=(n,s)=>{try{if(t.find(W=>W.ref===n)?.kind==="ARCHIVE"){s==="retired"?e.markA?.(n,"retired"):s==="skipped"&&e.markA?.(n,"skipped");return}let w=l(n);if(w<0)return;s==="applied"||s==="committed"?e.mark?.(w,"approved"):s==="skipped"&&e.mark?.(w,"skipped")}catch{}},b=async n=>{let[{openGraph:s},{resolveParentUc:R,evolveOneUc:w}]=await Promise.all([import("./readmodel-XOGOELUP.js"),import("./evolve-cmd-MVALOB3G.js")]),[W,...i]=n.split(/\s+/),o=s(e.dir),a=R(o,W);if(!a.ok)return`couldn't resolve '${W}' \u2014 start with a use-case id (uc-\u2026): ${a.message}`;if(i.length===0)return`say what to change: \`${W} <your words>\` \u2014 the words become the redesign's change delta`;let f=i.join(" "),_={out:()=>{},err:()=>{},isTTY:!1,confirm:async()=>!0},H=await w(e.dir,a.target,{yes:!0,mode:"override",because:f},_,y,"batch");return H.outcome==="evolved"?(e.signals({ref:a.target.display,verdict:"gap-resolved-evolve",reason:f}),`\u2713 redesigned ${a.target.display} \u2014 "${f}"`):`\u2717 evolve ${H.outcome} for ${a.target.display} (exit ${H.code})`};if(e.script){let n=0;for(let s of t){let R=await e.script(s),w=await x.submit(s.ref,R);w.outcome==="failed"&&n===0&&(n=1),$(s.ref,q(w))}return n}let[{render:h},{ScrollbackProvider:c},{ScrollbackTap:C}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./scrollback-JLPJR25X.js"),import("./ScrollbackTap-Q3IOKNMS.js")]);return new Promise(n=>{let s=!1,R=f=>{s||(s=!0,(async()=>{process.removeListener("SIGINT",o),await p.current?.flush();try{a.unmount()}catch{}n(f)})())},w=0,W={current:null},i=()=>{if(w+=1,w>=2){process.removeListener("SIGINT",o);try{a.unmount()}catch{}n(130)}},o=()=>{i(),W.current?.()};process.on("SIGINT",o);let a=h((0,g.jsxs)(c,{children:[(0,g.jsx)(C,{into:p}),(0,g.jsx)(Z,{controller:x,cards:t,note:k,markOutcome:$,routeChat:b,onFinish:R,onCtrlC:i,pauseRef:W})]}),{exitOnCtrlC:!1})})}export{Z as WalkSessionSurface,q as outcomeToMark,xe as runWalkSession};
|
|
2
|
+
import{a as Y}from"./chunk-262ES67I.js";import"./chunk-GBBVP2JW.js";import{a as j,c as F}from"./chunk-JV356AYH.js";import"./chunk-3C5GMAM4.js";import"./chunk-GRB66C5S.js";import{a as B}from"./chunk-64LC36AF.js";import"./chunk-JFAFKHDX.js";import"./chunk-WIA7TPK3.js";import"./chunk-QPZRHAYK.js";import"./chunk-RN4OSVTG.js";import"./chunk-BC7UVJJB.js";import"./chunk-2PQXEEVY.js";import{a as I}from"./chunk-MCQXRJGH.js";import{b as U}from"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import{g as N}from"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import{a as V}from"./chunk-YCCUBQY4.js";import{y as m}from"./chunk-6SGPN76K.js";import{a as P}from"./chunk-HCBYKLMW.js";import{a as A,b as u,k as M}from"./chunk-C44QQJR4.js";import{a as Q}from"./chunk-6YGTRKDT.js";import{e as O}from"./chunk-UR6MHSHU.js";var T=O(Q(),1);function K(e,p,k){let{ref:D,reason:d,by:y}=k;if(!d||d.trim().length===0)return{record:null,errors:[{code:"REASON_REQUIRED",detail:"archiving a node needs a reason \u2014 it becomes the tombstone's provenance"}]};let x=p.resolve(D);if(!x)return{record:null,errors:[{code:"UNKNOWN_REF",detail:`no node '${D}' in the graph`}]};let r=p.tipOf(x.cid);if(p.superseded.has(r))return{record:null,errors:[{code:"ALREADY_ARCHIVED",detail:`${D} is already superseded at its tip (${r.slice(0,19)}\u2026)`}]};let t=N(e,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[{kind:"node",old:r,new:null,reason:d,by:y}],source_head_moves:{}},{expectPrev:p.latestHash});return U(e),{record:t.record,errors:null}}function L(e){let p=e.by??{kind:"human",id:process.env.USER??"operator"},k=e.mode==="interactive"?"override":e.mode,D={out:()=>{},err:()=>{},isTTY:!1,confirm:async()=>!0},d={applied:0,committed:0,retired:0,skipped:0,deferred:0,failed:0},y=new Map;for(let r of e.planRows)if(r.held_ref&&e.held){let t=e.held.rows.find($=>$.temp_ref===r.held_ref);if(!t)continue;let l={kind:t.kind,ref:t.temp_ref,title:t.title,why:t.why,origin:"content-change",...r.impact?{impact:r.impact}:{}};y.set(l.ref,{card:l,source:"held",heldRef:t.temp_ref})}else if(r.kind==="MODIFY"){let t={kind:"MODIFY",ref:r.ref,title:r.ref,why:`${r.reason}: ${r.provenance}`,origin:r.origin??"structural-stale",...r.impact?{impact:r.impact}:{}};y.set(t.ref,{card:t,source:"row",row:r})}else if(r.kind==="ADD"){let t={kind:"ADD",ref:r.ref,title:r.ref,why:r.reason,origin:r.origin??"content-change"};y.set(t.ref,{card:t,source:"row",row:r})}for(let r of e.archive){if(r.kind!=="ARCHIVE")continue;let t={kind:"ARCHIVE",ref:r.ref,title:r.ref,why:r.why,provenance:r.why,...r.impact?{impact:r.impact}:{}};y.set(t.ref,{card:t,source:"archive",row:r})}let x=r=>(d.failed++,{outcome:"failed",detail:r});return{cards:()=>[...y.values()].map(r=>r.card),async submit(r,t){let l=y.get(r);if(!l)return x(`no card ${r}`);if(t.v==="skip")return d.skipped++,e.signals({ref:r,verdict:"gap-dismissed"}),{outcome:"skipped"};if(t.v==="defer")return d.deferred++,{outcome:"deferred"};if(t.v==="archive"){if(l.source!=="archive")return x(`${r} is not an ARCHIVE card`);let c=I(e.contextDir),C=c.resolve(l.row.ref);if(C&&c.superseded.has(c.tipOf(C.cid)))return d.skipped++,{outcome:"skipped",detail:"already retired \u2014 nothing to do"};let n=K(e.contextDir,I(e.contextDir),{ref:l.row.ref,reason:`reconcile retire: ${l.row.why}`,by:p});return n.errors?x(n.errors.map(s=>`${s.code}: ${s.detail}`).join("; ")):(d.retired++,e.signals({ref:r,verdict:"gap-resolved-archive",reason:l.row.why}),{outcome:"retired"})}if(l.source==="archive")return x(`${r} takes archive/skip/defer, not approve`);if(l.source==="held"){let c=Y(e.contextDir,e.held,l.heldRef,p,t.edits);if(!c.ok)return x(c.message);if(c.kind==="ADD"){let C=await e.runDesign(c.ref,{yes:!0,mode:k,...t.steering?{because:t.steering}:{}});return C!==0?(d.failed++,{outcome:"failed",landed:!0,detail:`committed ${c.ref}, but its design run exited ${C} \u2014 finish with kane-cli design tests --use-case ${c.ref}`}):(d.applied++,e.signals({ref:r,verdict:"gap-resolved-create",...t.steering?{reason:t.steering}:{}}),{outcome:"applied",detail:c.ref})}if(t.steering){let C=I(e.contextDir),n=j(C,c.ref);if(!n.ok)return d.committed++,{outcome:"committed",detail:`committed ${c.ref}, but steering could not resolve it (${n.message}) \u2014 steer via kane-cli maintain evolve ${c.ref}`};let s=await F(e.contextDir,n.target,{yes:!0,mode:k,because:t.steering},D,e.runDesign,"batch");if(s.outcome==="no-design"){let R=await e.runDesign(n.target.seamRef,{yes:!0,mode:k,because:t.steering});return R!==0?(d.failed++,{outcome:"failed",landed:!0,detail:`committed ${c.ref}, but its steered design run exited ${R} \u2014 finish with kane-cli design tests --use-case ${n.target.seamRef}`}):(d.applied++,e.signals({ref:r,verdict:"gap-resolved-create",reason:t.steering}),{outcome:"applied",detail:c.ref})}return s.outcome==="failed"||s.outcome==="paused"?(d.failed++,{outcome:"failed",landed:!0,detail:`committed ${c.ref}, but the steering evolve ${s.outcome} (exit ${s.code}) \u2014 finish with kane-cli maintain evolve ${c.ref}`}):s.outcome==="declined"?(d.committed++,{outcome:"committed",detail:`committed ${c.ref} \u2014 the steering evolve was declined; re-run kane-cli maintain evolve ${c.ref}`}):(d.applied++,e.signals({ref:r,verdict:"gap-resolved-evolve",reason:t.steering}),{outcome:"applied",detail:c.ref})}return d.committed++,e.signals({ref:r,verdict:"gap-resolved-evolve"}),{outcome:"committed",detail:c.ref}}let $=I(e.contextDir),b=j($,l.row.ref);if(!b.ok)return x(b.message);if(l.card.kind==="ADD"){let c=await e.runDesign(b.target.seamRef,{yes:!0,mode:k});return c!==0?x(`design run exited ${c}`):(d.applied++,e.signals({ref:r,verdict:"gap-resolved-create"}),{outcome:"applied"})}let h=await F(e.contextDir,b.target,{yes:!0,mode:k,...t.steering?{because:t.steering}:{}},D,e.runDesign,"batch");return h.outcome==="evolved"?(d.applied++,e.signals({ref:r,verdict:"gap-resolved-evolve",...t.steering?{reason:t.steering}:{}}),{outcome:"applied"}):h.outcome==="failed"||h.outcome==="paused"?x(`evolve ${h.outcome} (exit ${h.code})`):(d.skipped++,{outcome:"skipped",detail:h.outcome})},summary:()=>({...d})}}var v=O(P(),1);function S(e){return e.kind==="ARCHIVE"?[{v:"archive",label:"retire",detail:"tombstone it \u2014 the graph forgets forward"},{v:"skip",label:"skip",detail:"keep it \u2014 decided, never re-offered"},{v:"defer",label:"defer",detail:"not now \u2014 the plan re-offers it"}]:[{v:"approve",label:"approve",detail:e.kind==="ADD"?"commit + design it":"commit the updated version (old\u2192new redirect)"},{v:"skip",label:e.origin==="content-change"?"reject":"skip",detail:e.origin==="content-change"?"drop the staged proposal \u2014 nothing committed":"leave it as is"},{v:"defer",label:"defer",detail:"not now \u2014 the plan keeps it staged"}]}function E(e){return e.kind==="ARCHIVE"?null:S(e).length}var X={ADD:{color:m.green??"green"},MODIFY:{color:"yellow"},ARCHIVE:{color:m.red}},z=60;function G({card:e,position:p,sel:k=0,focused:D=!1,freeText:d=null}){let{stdout:y}=M(),r=(y?.columns??80)<z,t=S(e),l=E(e),$=X[e.kind],b=n=>D&&k===n?(0,v.jsx)(u,{color:m.generateAccent,children:"\u25B8"}):" ",h=e.impact,c=h&&h.stale_refs.length>0?`${e.kind==="ARCHIVE"?"retiring drops":"approving marks"} ${h.stale_refs.length} item(s) stale`+((h.direct_refs?.length??0)>0?` \u2014 ${h.direct_refs.length} directly touched: ${h.direct_refs.join(", ")}`:""):null,C=(0,v.jsxs)(A,{flexDirection:"column",children:[(0,v.jsx)(u,{bold:!0,color:m.generateAccent,children:`? reconcile \u2014 item ${p.n} of ${p.of}`}),(0,v.jsxs)(u,{bold:!0,children:[" ",(0,v.jsx)(u,{color:$.color,children:`[${e.kind}]`}),` ${e.title}`]}),(0,v.jsx)(u,{color:m.muted,children:` ${e.why}`}),c?(0,v.jsx)(u,{color:m.muted,children:` impact: ${c}`}):null,e.kind==="ARCHIVE"&&e.provenance&&e.provenance!==e.why?(0,v.jsx)(u,{color:m.muted,children:` ${e.provenance}`}):null,t.map((n,s)=>(0,v.jsxs)(u,{children:[" ",b(s),` ${s+1} ${n.label}`,(0,v.jsx)(u,{color:m.dim,children:` \u2014 ${n.detail}`})]},`o-${s}`)),l!==null?d?(0,v.jsxs)(A,{children:[(0,v.jsxs)(u,{children:[" ",(0,v.jsx)(u,{color:m.generateAccent,children:"\u25B8"})," ",(0,v.jsx)(u,{color:m.dim,children:"\u270E "})]}),(0,v.jsx)(V,{value:d.value,onChange:d.onChange,onSubmit:d.onSubmit,onCancel:d.onCancel,placeholder:"steer the redesign (approves, then evolves with your words)"})]}):(0,v.jsxs)(u,{children:[" ",b(l)," ",(0,v.jsx)(u,{color:m.dim,children:"\u270E steer the redesign"})]}):null]});return r?C:(0,v.jsx)(A,{flexDirection:"column",borderStyle:"round",borderColor:m.generateAccent,paddingX:1,children:C})}var g=O(P(),1);function q(e){return e.landed?"committed":e.outcome}var J={applied:"\u2713",committed:"\u2713",retired:"\u2713",skipped:"\xB7",deferred:"\u2013",failed:"\u2717"};function Z({controller:e,cards:p,note:k,markOutcome:D,routeChat:d,onFinish:y,onCtrlC:x,pauseRef:r}){let[t,l]=(0,T.useState)(p.length>0?{at:"card",idx:0,sel:0,editor:null}:{at:"chat",text:"",busy:null}),$=(0,T.useRef)(0),b=(0,T.useRef)(t);b.current=t;let h=(0,T.useRef)(!1),c=()=>{k((0,g.jsx)(u,{color:m.dim,children:"walk paused \u2014 every verdict so far is committed; re-run the same command to continue"})),y(3)},C=()=>{if(h.current)return;h.current=!0;let i=b.current;if(i.at==="busy"||i.at==="chat"&&i.busy!==null){k((0,g.jsx)(u,{color:m.dim,children:"finishing the current item, then pausing\u2026"}));return}if(i.at==="chat"){y($.current);return}c()};r&&(r.current=C);let n=t.at==="card"||t.at==="busy"?p[t.idx]:null,s=i=>{let o=i+1;if(o<p.length)l({at:"card",idx:o,sel:0,editor:null});else{let a=e.summary();k((0,g.jsx)(u,{color:m.dim,children:`reconcile walk: ${a.applied} applied, ${a.committed} committed, ${a.retired} retired, ${a.skipped} skipped, ${a.deferred} deferred`+(a.failed>0?`, ${a.failed} failed`:"")})),k((0,g.jsx)(u,{color:m.dim,children:"anything else? steer a redesign \u2014 `<uc-ref> <what to change>` \u2014 or press Enter to finish"})),l({at:"chat",text:"",busy:null})}},R=(0,T.useRef)(!1),w=(i,o)=>{if(R.current)return;R.current=!0;let a=p[i];l({at:"busy",idx:i,label:o.v==="archive"?"retiring\u2026":o.v==="approve"&&o.steering?"committing, then steering the redesign\u2026":"applying\u2026"}),e.submit(a.ref,o).catch(f=>({outcome:"failed",detail:f instanceof Error?f.message:String(f)})).then(f=>{let _=J[f.outcome]??"\xB7";if(k((0,g.jsxs)(u,{children:[(0,g.jsx)(u,{color:f.outcome==="failed"?m.red:m.green,children:_}),` ${f.outcome} [${a.kind}] ${a.title}`,f.detail?(0,g.jsx)(u,{color:m.dim,children:` \u2014 ${f.detail}`}):null,f.outcome!=="failed"&&f.outcome!=="skipped"&&f.outcome!=="deferred"&&a.impact&&a.impact.stale_refs.length>0?(0,g.jsx)(u,{color:m.dim,children:` \xB7 ${a.impact.stale_refs.length} item(s) now stale`}):null]})),f.outcome==="failed"&&($.current=$.current===0?1:$.current),D(a.ref,q(f)),R.current=!1,h.current){c();return}s(i)})},W=(0,T.useMemo)(()=>({isFocused:()=>b.current.at==="card"&&b.current.editor===null,onMove:i=>{l(o=>{if(o.at!=="card")return o;let a=p[o.idx],f=E(a)??S(a).length-1;return{...o,sel:Math.max(0,Math.min(f,o.sel+i))}})},onSelect:()=>{let i=b.current;if(i.at!=="card")return;let o=p[i.idx],a=E(o);if(a!==null&&i.sel===a){l({...i,editor:""});return}let f=S(o)[i.sel];f&&w(i.idx,{v:f.v})},onDigit:i=>{let o=b.current;if(o.at!=="card")return;let a=S(p[o.idx])[i-1];a&&w(o.idx,{v:a.v})},onType:i=>{l(o=>o.at!=="card"||E(p[o.idx])===null?o:{...o,editor:(o.editor??"")+i})},onBack:()=>{}}),[p]);return(0,T.useEffect)(()=>{t.at==="done"&&y($.current)},[t.at]),(0,g.jsxs)(A,{flexDirection:"column",children:[(0,g.jsx)(B,{onToggleThinking:()=>{},onCtrlC:()=>{x(),C()},panel:W}),t.at==="card"&&n?(0,g.jsx)(G,{card:n,position:{n:t.idx+1,of:p.length},sel:t.sel,focused:t.editor===null,freeText:t.editor!==null?{value:t.editor,onChange:i=>l(o=>o.at==="card"?{...o,editor:i}:o),onSubmit:i=>{let o=b.current;o.at==="card"&&(i.trim()?w(o.idx,{v:"approve",steering:i.trim()}):l({...o,editor:null}))},onCancel:()=>l(i=>i.at==="card"?{...i,editor:null}:i)}:null}):null,t.at==="busy"?(0,g.jsx)(u,{color:m.dim,children:`\u2026 ${t.label}`}):null,t.at==="chat"?t.busy?(0,g.jsx)(u,{color:m.dim,children:`\u2026 ${t.busy}`}):(0,g.jsxs)(A,{children:[(0,g.jsx)(u,{color:m.generateAccent,children:"\u203A "}),(0,g.jsx)(V,{value:t.text,onChange:i=>l(o=>o.at==="chat"?{...o,text:i}:o),onSubmit:i=>{let o=i.trim();if(!o){l({at:"done"});return}l({at:"chat",text:"",busy:"redesigning\u2026"}),d(o).catch(a=>`\u2717 redesign failed: ${a instanceof Error?a.message:String(a)}`).then(a=>{if(k((0,g.jsx)(u,{children:a})),h.current){c();return}l({at:"chat",text:"",busy:null})})},onCancel:()=>{},placeholder:"uc-\u2026 what to change (Enter on empty = finish)"})]}):null]})}async function xe(e){let p={current:null},k=n=>{p.current?.append(n)},D=null,d=async(n,s)=>{let[{runDesign:R},{resolveAgentAuthEnv:w},{runAgent:W},{preflightTurn:i}]=await Promise.all([import("./run-6AFY35QW.js"),import("./spawner-DWONVIPI.js"),import("./bridge-PDJEOSAJ.js"),import("./turn-preflight-JGYT7LXP.js")]);D??=await w();let o=D;return R({useCase:n,force:!0,mode:s.mode??"override",...s.because?{because:s.because}:{},...s.changeDelta!==void 0?{changeDelta:s.changeDelta}:{},...s.priorDesign!==void 0?{priorDesign:s.priorDesign}:{}},{contextDir:e.dir,agent:W,preflightTurn:()=>i(o),ask:async()=>[],out:a=>k((0,g.jsx)(u,{color:m.dim,children:` ${a}`})),progress:()=>{},isTTY:!1,auth:o})},y=e.runDesign??d,x=L({contextDir:e.dir,held:e.held,archive:e.archive,planRows:e.rows,runDesign:y,mode:"interactive",signals:e.signals}),r=new Set(e.rows.filter(n=>n.applied!==void 0).map(n=>n.held_ref??n.ref)),t=x.cards().filter(n=>!r.has(n.ref)&&!(n.kind==="ARCHIVE"&&e.archiveState?.[n.ref]!==void 0)),l=n=>e.rows.findIndex(s=>(s.held_ref??s.ref)===n),$=(n,s)=>{try{if(t.find(W=>W.ref===n)?.kind==="ARCHIVE"){s==="retired"?e.markA?.(n,"retired"):s==="skipped"&&e.markA?.(n,"skipped");return}let w=l(n);if(w<0)return;s==="applied"||s==="committed"?e.mark?.(w,"approved"):s==="skipped"&&e.mark?.(w,"skipped")}catch{}},b=async n=>{let[{openGraph:s},{resolveParentUc:R,evolveOneUc:w}]=await Promise.all([import("./readmodel-XOGOELUP.js"),import("./evolve-cmd-RUGUWKAG.js")]),[W,...i]=n.split(/\s+/),o=s(e.dir),a=R(o,W);if(!a.ok)return`couldn't resolve '${W}' \u2014 start with a use-case id (uc-\u2026): ${a.message}`;if(i.length===0)return`say what to change: \`${W} <your words>\` \u2014 the words become the redesign's change delta`;let f=i.join(" "),_={out:()=>{},err:()=>{},isTTY:!1,confirm:async()=>!0},H=await w(e.dir,a.target,{yes:!0,mode:"override",because:f},_,y,"batch");return H.outcome==="evolved"?(e.signals({ref:a.target.display,verdict:"gap-resolved-evolve",reason:f}),`\u2713 redesigned ${a.target.display} \u2014 "${f}"`):`\u2717 evolve ${H.outcome} for ${a.target.display} (exit ${H.code})`};if(e.script){let n=0;for(let s of t){let R=await e.script(s),w=await x.submit(s.ref,R);w.outcome==="failed"&&n===0&&(n=1),$(s.ref,q(w))}return n}let[{render:h},{ScrollbackProvider:c},{ScrollbackTap:C}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./scrollback-JLPJR25X.js"),import("./ScrollbackTap-Q3IOKNMS.js")]);return new Promise(n=>{let s=!1,R=f=>{s||(s=!0,(async()=>{process.removeListener("SIGINT",o),await p.current?.flush();try{a.unmount()}catch{}n(f)})())},w=0,W={current:null},i=()=>{if(w+=1,w>=2){process.removeListener("SIGINT",o);try{a.unmount()}catch{}n(130)}},o=()=>{i(),W.current?.()};process.on("SIGINT",o);let a=h((0,g.jsxs)(c,{children:[(0,g.jsx)(C,{into:p}),(0,g.jsx)(Z,{controller:x,cards:t,note:k,markOutcome:$,routeChat:b,onFinish:R,onCtrlC:i,pauseRef:W})]}),{exitOnCtrlC:!1})})}export{Z as WalkSessionSurface,q as outcomeToMark,xe as runWalkSession};
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testmuai/kane-cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.6",
|
|
4
4
|
"description": "KaneAI Terminal UI — browser automation testing agent",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=18"
|
|
9
|
+
},
|
|
7
10
|
"bin": {
|
|
8
|
-
"kane-cli": "./bin/kane-cli.
|
|
11
|
+
"kane-cli": "./bin/kane-cli.cjs"
|
|
9
12
|
},
|
|
10
13
|
"files": [
|
|
11
14
|
"dist/",
|
|
@@ -26,11 +29,16 @@
|
|
|
26
29
|
"ws": "^8.20.0"
|
|
27
30
|
},
|
|
28
31
|
"optionalDependencies": {
|
|
29
|
-
"@testmuai/kane-cli-darwin-arm64": "0.6.
|
|
30
|
-
"@testmuai/kane-cli-darwin-x64": "0.6.
|
|
31
|
-
"@testmuai/kane-cli-linux-x64": "0.6.
|
|
32
|
-
"@testmuai/kane-cli-linux-arm64": "0.6.
|
|
33
|
-
"@testmuai/kane-cli-win-x64": "0.6.
|
|
32
|
+
"@testmuai/kane-cli-darwin-arm64": "0.6.6",
|
|
33
|
+
"@testmuai/kane-cli-darwin-x64": "0.6.6",
|
|
34
|
+
"@testmuai/kane-cli-linux-x64": "0.6.6",
|
|
35
|
+
"@testmuai/kane-cli-linux-arm64": "0.6.6",
|
|
36
|
+
"@testmuai/kane-cli-win-x64": "0.6.6",
|
|
37
|
+
"@testmuai/kane-cli-node-darwin-arm64": "24.18.0",
|
|
38
|
+
"@testmuai/kane-cli-node-darwin-x64": "24.18.0",
|
|
39
|
+
"@testmuai/kane-cli-node-linux-x64": "24.18.0",
|
|
40
|
+
"@testmuai/kane-cli-node-linux-arm64": "24.18.0",
|
|
41
|
+
"@testmuai/kane-cli-node-win-x64": "24.18.0",
|
|
34
42
|
"sharp": "^0.34.5"
|
|
35
43
|
},
|
|
36
44
|
"publishConfig": {
|
package/bin/kane-cli.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-CY5NDMO7.js";import"./chunk-3HEPW6SN.js";import"./chunk-OB6CKLEL.js";import"./chunk-I2JUBAPU.js";import"./chunk-W36P7S5W.js";import"./chunk-4MUHS3UL.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-L5LI2JF4.js";import"./chunk-YMSN25DX.js";import"./chunk-STH6I3UB.js";import"./chunk-YCCUBQY4.js";import"./chunk-PICCLJSO.js";import"./chunk-M5JQXOCE.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-DNOBOZPO.js";import"./chunk-VE3SUJMA.js";import"./chunk-BOO7YXAV.js";import"./chunk-XUJ5EPVW.js";import"./chunk-HJGUEZLW.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as SingleShotApp};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{g as a}from"./chunk-MK2G7VIF.js";import"./chunk-ADOXYGZE.js";import"./chunk-E3BO7OVR.js";import"./chunk-W36P7S5W.js";import"./chunk-2K4XOHVK.js";import"./chunk-5Y2G4NC7.js";import"./chunk-M5JQXOCE.js";import"./chunk-DNOBOZPO.js";import"./chunk-POI6DCP6.js";import"./chunk-IRRGSC7B.js";import"./chunk-DFS4RMVP.js";import"./chunk-HJGUEZLW.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as TestMdRunView};
|
package/dist/chunk-E3BO7OVR.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as x}from"./chunk-W36P7S5W.js";import{a as w}from"./chunk-DNOBOZPO.js";import{spawn as M,execSync as V}from"child_process";import{appendFileSync as T,existsSync as g,mkdirSync as k}from"fs";import{homedir as P}from"os";import{join as U,resolve as t,dirname as h}from"path";import{fileURLToPath as B}from"url";import{createInterface as L}from"readline";async function*A(n){let e=L({input:n,crlfDelay:1/0});for await(let d of e){let r=d.trim();if(r)try{let l=JSON.parse(r);l&&typeof l.type=="string"&&(yield l)}catch{}}}function N(n){return n==="action"?{set:{V16_AGENT_ENABLE_ALL_BLOCKERS:"true",V16_BIFURCATION_PHASES:"1"},unset:["V16_NETWORK_WS","V16_NETWORK_SSE"]}:{set:{V16_BIFURCATION_PHASES:"1"},unset:["V16_AGENT_ENABLE_ALL_BLOCKERS","V16_NETWORK_WS","V16_NETWORK_SSE"]}}function O(n){return n?{set:{},unset:["V16_AGENT_SKIP_CP_FINAL"]}:{set:{V16_AGENT_SKIP_CP_FINAL:"true"},unset:[]}}function b(n){return n==="dom"?{set:{V16_AGENT_ENABLE_TEXTUAL_VISUAL:"true"},unset:[]}:{set:{},unset:["V16_AGENT_ENABLE_TEXTUAL_VISUAL"]}}var o=h(B(import.meta.url));function G(){for(let n of["python3","python"])try{return V(`${n} --version`,{stdio:"ignore"}),n}catch{}return null}function K(){let e=process.platform==="win32"?"v16-runner.exe":"v16-runner",d={"darwin-arm64":["@testmuai/kane-cli-darwin-arm64","@lambdatestincprivate/kane-cli-darwin-arm64"],"darwin-x64":["@testmuai/kane-cli-darwin-x64","@lambdatestincprivate/kane-cli-darwin-x64"],"linux-x64":["@testmuai/kane-cli-linux-x64","@lambdatestincprivate/kane-cli-linux-x64"],"linux-arm64":["@testmuai/kane-cli-linux-arm64","@lambdatestincprivate/kane-cli-linux-arm64"],"win32-x64":["@testmuai/kane-cli-win-x64","@lambdatestincprivate/kane-cli-win-x64"]},r=`${process.platform}-${process.arch}`,l=d[r];if(l)for(let i of l){let m=[t(o,"..","node_modules",i,"bin",e),t(o,"..","..","node_modules",i,"bin",e),t(o,"..","..","..","node_modules",i,"bin",e),t(o,"..","..","..","..","node_modules",i,"bin",e)];for(let c of m)if(g(c))return{cmd:c,args:[]}}let v=[t(o,"bin",e),t(o,"..","bin",e),t(o,"..","..","..","..","v16-runner","dist",e),t(o,"..","..","..","v16-runner","dist",e),t(o,"..","..","v16-runner","dist",e),t(process.cwd(),"v16-runner","dist",e),t(process.cwd(),"..","v16-runner","dist",e)];for(let i of v)if(g(i))return{cmd:i,args:[]};let _=[t(o,"..","..","v16-runner"),t(o,"..","..","..","..","v16-runner"),t(o,"..","..","..","v16-runner"),t(process.cwd(),"v16-runner"),t(process.cwd(),"..","v16-runner")];for(let i of _)if(g(t(i,"main.py"))){for(let c of[t(i,".venv","bin","python"),t(i,"..",".venv","bin","python"),t(i,"..","browser-agent",".venv","bin","python")])if(g(c))return{cmd:c,args:["main.py"],cwd:i};let m=G();if(m)return{cmd:m,args:["main.py"],cwd:i}}return null}function Z(n,e){let d=K();if(!d)throw new Error("v16-runner not found. Build the binary with `cd v16-runner && python build.py` or ensure Python is available.");process.env.KANE_SPAWN_DEBUG&&process.stderr.write(`[spawn-debug] ${JSON.stringify(d)}
|
|
3
|
-
`);let r={...process.env};e?.environment&&(r.TESTMUAI_ENV=e.environment),r.TESTMUAI_SOURCE="kane-cli",process.platform==="win32"&&(r.PYTHONIOENCODING="utf-8");let l=w(e?.environment);r.V16_SERVER_API_HOST=l.v16ServerHost,r.ATMS_URL=l.tmsBaseUrl.replace(/\/api\/?$/,""),n.username&&n.access_key&&(r.LT_USERNAME=n.username,r.LT_ACCESS_KEY=n.access_key),n.session_id&&(r.TESTMUAI_SESSION_ID=n.session_id);let v=N(e?.mode??"testing");Object.assign(r,v.set);for(let s of v.unset)delete r[s];let _=new x().load(),i=b(e?.assertionMode??(_.assertion_mode==="visual"?"visual":"dom"));Object.assign(r,i.set);for(let s of i.unset)delete r[s];let m=e?.finalValidation??_.final_validation,c=O(m);Object.assign(r,c.set);for(let s of c.unset)delete r[s];let a=M(d.cmd,d.args,{stdio:["pipe","pipe","pipe"],env:r,cwd:d.cwd});a.stdin.on("error",()=>{}),a.stdin.write(JSON.stringify(n)+`
|
|
4
|
-
`);let p=n.session_id?U(P(),".testmuai","kaneai","sessions",n.session_id,"runner-stderr.log"):null;if(p)try{k(h(p),{recursive:!0}),T(p,`--- runner spawn ${new Date().toISOString()} run_index=${n.run_index} ---
|
|
5
|
-
`)}catch{}let E=1e5,f="";a.stderr.on("data",s=>{if(f+=s.toString(),f.length>E&&(f=f.slice(-E)),p)try{T(p,s)}catch{}}),a.on("error",s=>{e?.log?.("error","RUNNER_SPAWN_ERROR","Runner spawn error",{error:s.message})});let S=null,y=null,C=new Promise(s=>{a.on("close",(u,R)=>{S=u,y=R?String(R):null,e?.log?.("info","RUNNER_EXIT","Runner exited",{code:u,signal:y??"none"}),s({code:u,signal:y})})}),I=A(a.stdout);return{child:a,events:I,sendUserResponse(s){let u=JSON.stringify({type:"user_response",answer:s});try{a.stdin.write(u+`
|
|
6
|
-
`)}catch{}},sendCancel(s){let u=JSON.stringify({type:"cancel",reason:s});try{a.stdin.write(u+`
|
|
7
|
-
`)}catch{}},cancel(){a.kill("SIGTERM")},get stderr(){return f},get exitCode(){return S},get exitSignal(){return y},exited:C}}export{K as a,Z as b};
|
package/dist/chunk-HJGUEZLW.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{homedir as e}from"os";import{join as t}from"path";var m="0.6.4",d="kane-cli",a=t(e(),".testmuai","kaneai"),g=t(a,"profiles"),h=t(a,"tui-config.json"),_="https://registry.npmjs.org/@testmuai/kane-cli",L="https://api.github.com/repos/LambdaTest/kane-cli/releases",n="@testmuai/kane-cli-skill",x=`https://registry.npmjs.org/${n}`,r="kane-cli",A=[{dir:t(e(),".claude","skills",r),agent:"Claude Code"},{dir:t(e(),".agents","skills",r),agent:"Codex CLI"},{dir:t(e(),".gemini","skills",r),agent:"Gemini CLI"}],u="https://dd-proxy.lambdatest.com/intake/kane-cli",U="https://kaneai-playground.lambdatest.io",b=9222,R=9230,I=t(a,"chrome-profiles"),o=t(a,"hints"),C=t(o,"state.json");function E(s){return t(o,`catalog-${s}.json`)}var i="127.0.0.1",T=18392,S=18400,c="/callback";function N(s){return`http://${i}:${s}${c}`}var P="KANE CLI",B="*",O={prod:{authBaseUrl:"https://auth.lambdatest.com",consentUrl:"https://accounts.lambdatest.com",controllerBaseUrl:"https://kaneai-api.lambdatest.com/v16-controller/v1",tmsBaseUrl:"https://test-manager-api.lambdatest.com/api",testGeneratorBaseUrl:"https://test-manager-api.lambdatest.com",secretsBaseUrl:"https://api-hyperexecute.lambdatest.com",testManagerUiUrl:"https://test-manager.lambdatest.com",shareApiBaseUrl:"https://api.lambdatest.com",v16ServerHost:"https://kaneai-api.lambdatest.com/v16-server",evidenceViewerUrl:"https://evidence.lambdatest.com"},stage:{authBaseUrl:"https://stage-auth.lambdatestinternal.com",consentUrl:"https://stage-accounts.lambdatestinternal.com",controllerBaseUrl:"https://auteur-stage-automind.lambdatestinternal.com/v16-controller/v1",tmsBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com/api",testGeneratorBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com",secretsBaseUrl:"https://api-stage-hyperexecute.lambdatestinternal.com",testManagerUiUrl:"https://stage-test-manager.lambdatestinternal.com",shareApiBaseUrl:"https://stage-api.lambdatestinternal.com",v16ServerHost:"https://auteur-stage-automind.lambdatestinternal.com/v16-server",evidenceViewerUrl:"https://stage-evidence.lambdatestinternal.com"}},k={orange:"#ff9500",generateAccent:"#0d9488",purple:"#b388ff",secondary:"#888888",dim:"#666666",muted:"#444444",green:"#4ade80",red:"#ef4444"};export{m as a,d as b,a as c,h as d,_ as e,L as f,n as g,A as h,u as i,U as j,b as k,R as l,I as m,C as n,E as o,i as p,T as q,S as r,c as s,N as t,P as u,B as v,O as w,k as x};
|
package/dist/chunk-IJPFAWBH.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as F,b as z,c as ne,d as R}from"./chunk-2YQ6TW77.js";import{a as D}from"./chunk-WAOCHXJ5.js";import{b as U}from"./chunk-CJJXT5DO.js";import{a as j}from"./chunk-2WVKOZ6W.js";import{a as C}from"./chunk-NLCCBXXV.js";import{a as O}from"./chunk-RZ4F3BHX.js";import{e as te}from"./chunk-UR6MHSHU.js";import{readFileSync as Z,existsSync as w,readdirSync as Ee,mkdirSync as T,writeFileSync as x}from"fs";import{readFile as ee,unlink as be}from"fs/promises";import{join as E}from"path";import{randomUUID as P}from"crypto";function V(t){return t?t.includes(`
|
|
3
|
-
`)?t.split(`
|
|
4
|
-
`).map(e=>e.trim()).filter(Boolean):t.split(". ").map(e=>e.trim()).filter(Boolean).map(e=>e.endsWith(".")?e:e+"."):[]}function L(t,e){return!t||!e?t:t.replace(/\{\{(.+?)\}\}/g,(s,n)=>{let o=e[n];return o?o.value:s}).replace(/\$\{(.+?)\}/g,(s,n)=>{let o=e[n];return o?o.value:s})}var ie={click:"CLICK",double_click:"CLICK",type:"TYPE",fill:"TYPE",select:"SELECT",hover:"HOVER",drag:"DRAG_DROP",upload_files:"UPLOAD",navigate:"OPEN",go_back:"NAVIGATE",go_forward:"NAVIGATE",refresh:"REFRESH",press_key:"SENDKEYS",scroll:"SCROLL_PIXELS",scroll_into_view:"SCROLL_UNTIL_ELEMENT",wait:"WAIT",wait_until:"WAIT_UNTIL",wait_for_load:"WAIT_FOR_LOAD",switch_tab:"SWITCH_TAB",new_tab:"NEW_TAB",close_tab:"CLOSE_TAB",api:"API",evaluate_js:"EVALUATE_JS",vision_query:"VISION_QUERY",textual_query:"TEXTUAL_QUERY",get_url:"GET_URL",get_title:"GET_TITLE",assert:"ASSERTION",math:"MATHEMATICAL_OPERATION",set_cookies:"SET_COOKIES",delete_cookies:"DELETE_COOKIES",clear_cookies:"CLEAR_COOKIES",set_local_storage:"SET_LOCAL_STORAGE",delete_local_storage:"DELETE_LOCAL_STORAGE",clear_local_storage:"CLEAR_LOCAL_STORAGE",set_clipboard:"SET_CLIPBOARD",paste_clipboard:"PASTE_CLIPBOARD",clear_clipboard:"CLEAR_CLIPBOARD"},q={literal:"SET_VARIABLE",condition:"SET_VARIABLE",visual:"VISION_QUERY",dom:"TEXTUAL_QUERY",url:"GET_URL",title:"GET_TITLE",devtool_network:"DEVTOOLS_NETWORK_QUERY",devtool_console:"DEVTOOLS_CONSOLE_QUERY",devtool_cookies:"DEVTOOLS_COOKIES_QUERY",devtool_storage:"DEVTOOLS_STORAGE_QUERY",devtool_performance:"DEVTOOLS_PERFORMANCE",api_response:"API_CALLS_QUERY",textual_visual:"TEXTUAL_ANALYZER"},se=new Set(["CLICK","TYPE","FILL","HOVER","SCROLL_UNTIL_ELEMENT","UPLOAD","VISION_QUERY","DRAG_DROP","SELECT"]);function $(t,e){if(t==="analyze"){let n=e?.action_params?.analyzer_type??"";return q[n]}let s=ie[t];return s||console.warn(`[migrator] UNKNOWN action_type "${t}" \u2014 falling back to "${t.toUpperCase()}"; explicit mapping required`),s??t.toUpperCase()}function K(t,e){if(!t||!e)return"";try{let s=new Date(t);return isNaN(s.getTime())?"":new Date(s.getTime()+e).toISOString()}catch{return""}}function G(t){try{return JSON.parse(t.output_value??"{}")}catch{return{}}}function oe(t){let e=t.output_variable??"";if(!e)return"[]";let n={...G(t)};return delete n.body,JSON.stringify([{name:e,unique_key:(t.action_id??"").replace(/-/g,"").slice(0,8)||P().replace(/-/g,"").slice(0,8),value:n,variable_description:"API Response"}])}function re(t,e,s){let n=t.action_params??{},o=se.has(e)?"Vision Agent":"Operation Agent",c={operation_type:e};e==="OPEN"&&(c.url=n.url??""),e==="SET_VARIABLE"&&(c.variable_name=t.output_variable??n.key??"",c.variable_value=t.output_value??"");let i={},r={},a=t.action_instruction??"",u=n.text??"",d=n.url??"",g=[["intent",a],["value",u],["url",d]];for(let[h,m]of Object.entries(s)){let b=String(m);if(h.startsWith("secrets."))for(let[I,v]of g)v.includes(b)&&(r[I]=h);for(let[I,v]of g)v.includes(b)&&!(I in i)&&(i[I]=v)}let _=t.action_type,l={operation:t.action_instruction??"",agent:o,operation_dict:c,reasoning:_==="analyze"?n.query??"":t.intent??t.action_instruction??"",variable:i,secrets:r,params:{}};_==="analyze"&&typeof n.code=="string"&&n.code&&(l.code=n.code),_==="analyze"&&typeof n.code_js=="string"&&n.code_js&&(l.code_js=n.code_js),_==="analyze"&&typeof n.condition_expression=="string"&&n.condition_expression&&(l.condition_expression=n.condition_expression),n.uses_websocket===!0&&(l.uses_websocket=!0),n.uses_sse===!0&&(l.uses_sse=!0),_==="analyze"&&n.analyzer_type==="textual_visual"&&(typeof n.wrapped_js=="string"&&(l.wrapped_js=n.wrapped_js),Array.isArray(n.locators)&&(l.locators=n.locators),typeof n.operator=="string"&&(l.operator=n.operator),Array.isArray(n.transforms)&&(l.transforms=n.transforms),typeof n.query=="string"&&(l.query=n.query),typeof n.expected_value=="string"&&(l.expected_value=n.expected_value),typeof n.needs_unit_conversion=="boolean"&&(l.needs_unit_conversion=n.needs_unit_conversion),typeof n.condition=="string"&&(l.condition=n.condition));let f={set_cookies:"cookies",set_clipboard:"text",delete_cookies:"names",set_local_storage:"items",delete_local_storage:"keys"}[_];return f&&n[f]!==void 0&&(l[f]=n[f]),_==="set_clipboard"&&typeof n.html=="string"&&n.html&&(l.html=n.html),l}function ae(t){let e=t.assertion_tree??{};if(typeof e.passed=="boolean")return e.passed;let s=e.sub_results??[];return s.length===0?e.status==="passed":(e.composite_operator??"and")==="or"?s.some(o=>o.passed===!0):s.every(o=>o.passed===!0)}function X(t){return t.map(e=>({description:e.description??"",store_key:e.store_key??"",expected_value:e.expected??"",extracted_value:e.extracted_value??"",operator:e.operator??"equals",transforms:e.transforms??[]}))}function ce(t){let e=t.assertion_tree??{},s=e.sub_results??[],n=X(s);return{operator:[],assertion_operands:[],left_operand:null,right_operand:null,operands:[],sub_results:s,sub_checks:n,composite_operator:e.composite_operator??"and",verification:e.verification??"",claim:e.description??""}}function le(t){let s=(t.action_params??{}).assertion_tree??{},n=s.sub_results??[],o=X(n);return[{operation:t.action_instruction??"",agent:"Operation Agent",operation_dict:{operation_type:"ASSERTION",assertion_tree:{sub_results:n,sub_checks:o,composite_operator:s.composite_operator??"and",verification:"",claim:s.description??t.action_instruction??"",operator:[],assertion_operands:[],left_operand:null,right_operand:null,operands:[]}},variable:{},secrets:{},params:{}}]}function ue(t,e,s,n){let o=t.visual_data;if(!o||o.x==null||o.y==null)return null;let c=e?`${e}/test_screenshots`:"";return{x:o.x,y:o.y,confidence:0,bbox:o.bbox??null,bbox_source:o.bbox?"accessibility_tree":"fallback",viewport_width:o.viewport_width??1280,viewport_height:o.viewport_height??800,scale_factor:null,raw_image_url:c?`${c}/untagged_screenshot/${s}.${n?.get(s)??"png"}`:"",raw_image_sas_url:"",annotated_image_url:"",annotated_image_sas_url:""}}function B(t,e={},s="",n){let o=t.action_type,c=$(o,t),i=t.action_params??{},r=t.coordinates??null,a=t.selectors??null,u=!!(a&&a.length>0),d=t.timestamp??"",g=t.duration_ms??0,_=t.variables_used??{},l=t.action_id??P(),p=P(),f=K(d,g),h="",m="";o==="navigate"?(m=i.url??"",h=m):o==="type"||o==="fill"?h=i.text??"":o==="press_key"?h=i.key??"":o==="wait"?h=String(i.ms??i.timeout_ms??""):o==="evaluate_js"?h=i.script??"":o==="analyze"&&c==="SET_VARIABLE"&&(h=t.output_value??"");let b="";o==="go_back"?b="back":o==="go_forward"&&(b="forward");let I=L(h,e),v=L(m,e),A=L(t.action_instruction??"",e),y=re(t,c,_);return{operation_id:l,instruction_id:p,instruction:A,intent:A,operation_start:d,operation_end:f,status:t.status??"",command:c,name:"",target:"",value:I,message:"",operation_dict:"",frame:t.frame_info?JSON.stringify(t.frame_info):"",error_message:t.error??"",code_snippet:"",sub_instruction_obj:JSON.stringify(y),test_id:"",test_version:"",action:"",string_to_float:!1,feedback_msg:"",time_taken:"",create_time_stamp:"",update_time_stamp:"",locator_variable:"",locator_variable_name:"",image_url:s?`${s}/test_screenshots/untagged_screenshot/${l}.${n?.get(l)??"png"}`:"",alternative_xpaths:[],attribute:"",value_description:"",url:v,navigation_direction:b,tagified_image_url:"",query_variable_name:t.output_variable??"",query_variable_value:t.output_value??"",query_variable_type:"",expected_value:"",queried_value:"",operator:"",assertion_status:c==="ASSERTION"?ae(i):"",query_info_dict:{},query_content_confidence:"none",debugging_logs:[],locator_index:0,query_html:"",user_variables:"[]",optional_flag:!1,max_retries:0,retries_delay:0,explicit_wait:0,implicit_wait:0,tab_index:String(i.tab_index??""),tab_identifier:String(i.tab_identifier??""),scroll_value:i.amount??1,scroll_direction:i.direction??"",mi_scroll_payload:{},sleep_duration:0,app_id:"",manual_interaction_tag:"",string_to_float_list:[],js_snippet:o==="evaluate_js"?i.script??"":"",code_error:"",hide:!1,dismiss_dialog:!1,use_v2_mobile_tagging:!1,multiple_inputs:!1,dialog_action:"",dialog_type:"",is_coordinates_used_for_interaction:r!==null&&!u,element_coordinates_ratio:[],element_bounds_ratio:[],x_coord:u?null:r?.x??null,y_coord:u?null:r?.y??null,target_x_coord:i.target_x??null,target_y_coord:i.target_y??null,source_description:i.source_description??null,target_description:i.target_description??null,use_coordinates:r!==null&&!u,kaneaiMobileTaggingImageLimit:1,clicks_order_code:"se_js_ac",selector:u?a.map(k=>({type:k.isXPath?"xpath":"css",...k})):"",selector_target:"",math_result_variable_name:"",math_result_variable_value:"",expression_tree:c==="ASSERTION"?ce(i):i.expression_tree??{},assertion_tree:i.assertion_tree??{},assertion_tree_simplified:{},network_throttle:{},is_mobile_offline:!1,autoheal:!1,db_query:"",db_details:{},db_query_decoded:"",is_global_variable:!1,is_global_variable_persist:!1,global_variable_id:"",wait_for_element_timeout:0,failure_condition:c==="ASSERTION"?"Fail test immediately":"",screenshot_command:"",smartui_contents:{},smartui_results:{},result_type:"",result_hint:"",drag_offset:{},start_coordinates:i.source_coordinates?{x:i.source_coordinates[0],y:i.source_coordinates[1]}:{},end_coordinates:i.target_coordinates?{x:i.target_coordinates[0],y:i.target_coordinates[1]}:{},element_rect:null,is_canvas:!1,until_condition:"",until_max_retries:0,until_settle_ms:0,api_data:o==="api"?{request:t.action_params?.api_data?.request??{}}:{},output_variables:o==="api"?t.output_variable?{[t.output_variable]:null}:{}:t.output_variable?{[t.output_variable]:t.output_value??""}:{},visual_context:ue(t,s,l,n),reasoning:o==="analyze"?i.query??"":t.intent??t.action_instruction??""}}function M(t,e,s={}){let n=t.action_type,o=$(n,t),c=t.timestamp??"",i=t.duration_ms??0,r=K(c,i),a=o==="ASSERTION"||o==="MATHEMATICAL_OPERATION";return{instruction_id:e.instruction_id,instruction_class:a?"non_driver_action":"driver_action",module_id:"",instruction:L(t.action_instruction??"",s),command:o,error:null,parent_instruction_id:"",classification_layer_resp:o==="ASSERTION"?le(t):[],classification_error:{},operations:[e],status:t.status??"",start_timestamp:c,end_timestamp:r,type:"agent_generated",tags:[],html_paths:[],optional_flag:!1,max_retries:0,retries_delay:0,explicit_wait:0,implicit_wait:0,content_type:n==="api"?"api":n==="analyze"&&t.action_params?.analyzer_type==="api_response"?"api_calls_query":n==="analyze"&&t.action_params?.analyzer_type?.startsWith("devtool_")?t.action_params.analyzer_type.replace("devtool_","devtools_"):"instruction",js_snippet:n==="evaluate_js"?t.action_params?.script??"":"",user_variables:n==="api"?oe(t):"[]",api_data:n==="api"?{request:t.action_params?.api_data?.request??{},response:G(t)}:{},params_used:!1,hard_assertion:o==="ASSERTION"?t.action_params?.failure_condition==="hard":!1,expected_outcome:"",module_execution_index:0,module_version:null,network_throttle:{},isEdited:!1,use_query_assertion_v2:!1,db_query:"",db_details:{},network_assertion_content:{},screenshot_command:"",smartui_contents:{},generative_id:"",plan_id:"",generative_objective:"",error_message:"",error_code:"",reason:"",title:"",used_variables:[],reasoning:n==="analyze"?t.action_params?.query??"":t.intent??t.action_instruction??""}}function de(t,e=[]){let s=t.action_params??{},n=s.branches??[],o=s.winning_index??-1,c=s.sub_results??[],i={};for(let a of c){let u=a.sub_results;if(u)for(let d of u){let g=d.store_key;g&&(i[g]=d)}}let r=n.map((a,u)=>{let d=u===o,g=(a.sub_checks??[]).map(_=>{let l=i[_.store_key];return{description:_.description,store_key:_.store_key,expected_value:_.expected_value,stored_value:l?.extracted_value??_.stored_value,operator:_.operator??l?.operator??"equals",transforms:_.transforms??l?.transforms??[]}});if(g.length===0&&a.condition&&c.length>0){let l=c.find(p=>p.branch_index===u)?.sub_results??[];l.length>0&&(g=l.map(p=>({description:p.description??a.condition,store_key:p.store_key??"",expected_value:p.expected??"true",stored_value:p.extracted_value??void 0,operator:p.operator??"equals",transforms:p.transforms??[]})))}return{branch_index:u,condition:a.condition??null,branch_type:a.branch_type??"sub_objective",passed:d,sub_objective:null,custom_event:a.custom_event??null,children:d?e:[],sub_checks:a.condition?g:[],composite_operator:a.composite_operator??"and"}});return{content_type:"conditional_block",instruction_id:`if_else_${P().slice(0,8)}`,instruction:t.action_instruction??"",instruction_class:"driver_action",command:"",status:t.status??"success",resolved_branch_index:o,branches:r,generative_id:"",generative_objective:"",variables_used:{},classification_layer_resp:[],classification_error:{},used_variables:[],user_variables:"[]",module_id:"",module_execution_index:0,module_version:"",plan_id:"",optional_flag:!1,max_retries:0,retries_delay:0,explicit_wait:0,implicit_wait:0,error:null,error_message:"",error_code:"",reason:"",start_timestamp:t.timestamp??"",end_timestamp:"",type:"agent_generated",hook:null,hook_type:null,evaluation_context:{},query_variables:{}}}function Y(t,e,s){for(let n of t)n.content_type==="instruction"&&"generative_id"in n&&(n.generative_id=e,n.generative_objective=s)}function N(t,e={},s="",n,o){let c=[],i=0;for(;i<t.length;){let r=t[i],a=r.action_type;if(!o?.keepFailedActions&&r.status==="error"&&a!=="assert"&&a!=="if_else"&&a!=="child_agent_start"&&a!=="child_agent_end"&&!(r.until_condition&&!r.error)){i+=1;continue}if(a==="analyze"&&!q[r.action_params?.analyzer_type??""]){i+=1;continue}if(a==="child_agent_start"){let u=r.action_params?.child_id??"",d=r.action_params?.objective??"",g=[];i+=1;let _=1,l="error",p;for(;i<t.length&&_>0;){let y=t[i],k=y.action_type;if(k==="child_agent_start")_+=1;else if(k==="child_agent_end"&&(_-=1,_===0)){l=y.status??"success",p=y,i+=1;break}_>0&&g.push(y),i+=1}let f=N(g,e,s,n);Y(f,u,d);let h=p?.action_params?.result_code??null,m=p?.action_params?.reason_code??null,b=p?.action_params?.error_message??null,I=p?.action_params?.summary??null,v=p?.action_params?.one_liner??null,A=l==="error";c.push({content_type:"generative_block",instruction_id:`generative_block_${u}`,generative_id:u,objective:d,status:l,children:f,error_message:A?b??null:null,error_code:A?m??null:null,result_code:h??null,bifurcation_context:[],approach_reason:V(I),one_liner:v??null});continue}else if(a==="child_agent_end"){i+=1;continue}else if(a==="if_else"){i+=1;let u=[];for(;i<t.length&&t[i].action_type==="child_agent_start";){let d=t[i],g=d.action_params?.child_id??"",_=d.action_params?.objective??"",l=[];i+=1;let p=1,f="error";for(;i<t.length&&p>0;){let m=t[i];if(m.action_type==="child_agent_start")p+=1;else if(m.action_type==="child_agent_end"&&(p-=1,p===0)){f=m.status??"success",i+=1;break}p>0&&l.push(m),i+=1}let h=N(l,e,s,n);u.push(...h)}c.push(de(r,u));continue}else if(a==="query_tool"){i+=1;continue}else if(r.until_condition){let u=B(r,e,s,n),d=M(r,u,e),g=typeof r.until_condition_met=="boolean"?r.until_condition_met:r.status==="success";c.push({content_type:"until_block",instruction_id:`until_${P().slice(0,8)}`,condition:r.until_condition,max_retries:r.until_max_retries??10,settle_ms:r.until_settle_ms??500,current_count:0,condition_met:g,children:[d],generative_id:"",generative_objective:"",variables_used:{},status:r.status??"success"})}else{let u=B(r,e,s,n),d=M(r,u,e);c.push(d)}i+=1}return c}function S(t,e={},s="",n,o){let c=[];for(let i of t){let r=N(i.records,e,s,n,o);if(r.length===0)continue;let a=P().replace(/-/g,"");Y(r,a,i.objective);let u=r.some(l=>"status"in l&&typeof l.status=="string"?l.status==="error"||l.status==="failed":!1),d=i.resultCode?parseInt(i.resultCode,10):null,g=d!==null&&!isNaN(d)&&d>=200,_=u||g?"error":"success";c.push({content_type:"generative_block",instruction_id:`generative_block_${a}`,generative_id:a,objective:i.objective,status:_,children:r,error_message:_==="error"?i.errorMessage??null:null,error_code:_==="error"?i.reasonCode??null:null,result_code:i.resultCode??null,bifurcation_context:[],approach_reason:V(i.summary),one_liner:i.oneLiner??null})}return{instructions:c}}var H=te(ne(),1);import{createWriteStream as _e}from"fs";import{readFile as pe}from"fs/promises";import{join as ge,basename as fe}from"path";import{tmpdir as he}from"os";var me=["**/screenshots/**","**/annotated/**","**/tcg/**","**/bifurcation/**"];async function W(t){let e=ge(he(),`${fe(t)}_artifacts.zip`);return new Promise((s,n)=>{let o=_e(e),c=(0,H.default)("zip",{zlib:{level:6}});o.on("close",()=>s(e)),c.on("error",n),c.pipe(o),c.glob("**/*",{cwd:t,ignore:me}),c.finalize()})}async function J(t){return pe(t)}async function Ie(t,e){return ee(U(t,e))}function ve(t){return{key:"artifacts",content_type:"application/zip",filename:`${t}.evidence`}}var Q=class{config;controller;testId;constructor(e){this.config=e,this.controller=new D(e.controllerBaseUrl,e.auth),this.testId=e.testId}log(e,s,n,o){this.config.log?.(e,s,n,o)}async execute(){let{onProgress:e}=this.config;try{if(!this.testId)return this.log("error","PIPELINE_ABORT","No test_id available"),{success:!1,testId:null,error:"No test_id available"};let s=this.config.evidence,n=null;if(this.config.shouldUploadArtifacts!==!1){e("convert","running");let r=this.collectNdjsonPerRun(),a=r.reduce((f,h)=>f+h.records.length,0);this.log("info","PIPELINE_CONVERT","Collected NDJSON records",{total_records:a,run_groups:r.length});let u=this.config.variables??{};this.log("info","PIPELINE_CONVERT_VARS","Variables for template resolution",{keys:Object.keys(u)});let{instructions:d}=r.length>0?S(r,u,this.config.screenshotBaseUrl??"",this.config.screenshotExtMap):{instructions:[]};this.log("info","PIPELINE_CONVERT_INSTRUCTIONS","Auteur instructions produced",{count:d.length});let g=this.buildExecutionEnvelope(d),_=Buffer.from(JSON.stringify(g));this.log("info","PIPELINE_CONVERT_BLOB","Blob created",{size_kb:+(_.length/1024).toFixed(1)});let l=E(this.config.sessionDir,"execution.json");x(l,JSON.stringify(g,null,2)),this.log("info","PIPELINE_CONVERT_LOCAL_SAVE","Execution blob saved locally",{path:l});let p=s?.packTestDir??this.config.evidenceRead?.packTestDir;if(p){let f=E(p,"auteur");T(f,{recursive:!0}),x(E(f,"execution.json"),JSON.stringify(g,null,2)),this.log("info","PIPELINE_CONVERT_PACK_COPY","Execution blob copied into pack",{path:E(f,"execution.json")})}if(e("convert","done"),s)n=_;else{e("zip","running"),this.log("info","PIPELINE_ZIP_START","Zipping session",{session_dir:this.config.sessionDir});let f=null,h;try{f=await W(this.config.sessionDir),h=await J(f),this.log("info","PIPELINE_ZIP_DONE","Zip complete",{size_mb:+(h.length/1024/1024).toFixed(1),path:f}),e("zip","done",`${(h.length/1024/1024).toFixed(1)}MB`)}finally{f&&await be(f).catch(()=>{})}e("presign","running"),this.log("info","PIPELINE_PRESIGN_START","Requesting presigned URLs",{url:`${this.config.controllerBaseUrl}/upload/presign`,test_id:this.testId,session_id:this.config.sessionId});let m=await this.controller.getPresignedUrls(this.testId,this.config.sessionId,[{key:"artifacts",content_type:"application/zip",filename:`${this.config.sessionId}_artifacts.zip`},{key:"blob",content_type:"application/json",filename:`${this.config.commitId}.json`}]);this.log("info","PIPELINE_PRESIGN_OK","Presigned URLs received",{artifacts_url:m.urls.artifacts?.blob_url,blob_url:m.urls.blob?.blob_url}),e("presign","done"),e("upload","running"),this.log("info","PIPELINE_UPLOAD_START","Uploading artifacts and blob",{artifact_size_mb:+(h.length/1024/1024).toFixed(1),blob_size_kb:+(_.length/1024).toFixed(1)}),await Promise.all([R(m.urls.artifacts.upload_url,h,"application/zip"),R(m.urls.blob.upload_url,_,"application/json")]),this.log("info","PIPELINE_UPLOAD_OK","Upload complete"),e("upload","done")}}else{let r=this.collectNdjsonPerRun(),a=this.config.variables??{},{instructions:u}=r.length>0?S(r,a,this.config.screenshotBaseUrl??"",this.config.screenshotExtMap,{keepFailedActions:!0}):{instructions:[]},d=this.buildExecutionEnvelope(u),g=E(this.config.sessionDir,"execution.json");x(g,JSON.stringify(d,null,2)),this.log("info","PIPELINE_LOCAL_SAVE","Execution blob saved locally (no upload)",{path:g});let _=this.config.evidence?.packTestDir??this.config.evidenceRead?.packTestDir;if(_){let l=E(_,"auteur");T(l,{recursive:!0});let p=this.readAuthoredExecution();x(E(l,"execution.json"),p??JSON.stringify(d,null,2)),this.log("info","PIPELINE_CONVERT_PACK_COPY","Execution blob copied into pack (gated)",{path:E(l,"execution.json"),source:p?"authored":"run_envelope"})}e("convert","skipped"),e("zip","skipped"),e("presign","skipped"),e("upload","skipped"),this.log("info","PIPELINE_UPLOAD_SKIPPED","Upload steps skipped (gate disabled)")}if(this.config.shouldReplaceLocalOutput&&this.config.onAtomicReplace){e("atomic_replace","running");try{await this.config.onAtomicReplace(),this.log("info","PIPELINE_ATOMIC_REPLACE_OK","Local output replaced"),e("atomic_replace","done")}catch(r){let a=r instanceof Error?r.message:String(r);throw this.log("error","PIPELINE_ATOMIC_REPLACE_FAILED","Atomic-replace failed",{error:a}),e("atomic_replace","failed",a),r}}else e("atomic_replace","skipped");let o,c;if(this.config.shouldCommit&&!this.config.isFirstRun&&this.config.onCommitLock){e("commit_lock","running");let r=await this.config.onCommitLock();if(r.ok)o=r.testcaseId,this.log("info","PIPELINE_COMMIT_LOCK_OK","Commit lock acquired",{testcase_id:o??"none"}),e("commit_lock","done");else return this.log("error","PIPELINE_COMMIT_LOCK_FAILED","Commit lock failed",{reason:r.reason,message:r.message}),e("commit_lock","failed",`${r.reason??"unknown"}: ${r.message??""}`),{success:!1,testId:this.testId,error:`commit-lock failed: ${r.reason??"unknown"}`}}else e("commit_lock","skipped");if(this.config.isFirstRun&&!this.config.skipTmsFinalize){e("finalize","running"),this.log("info","PIPELINE_FINALIZE_START","Finalizing test (first-run)",{test_id:this.testId,commit_id:this.config.commitId});let r=new j(this.config.tmsBaseUrl,this.config.tmsUsername,this.config.tmsAccessKey),a=this.config.runObjectives&&this.config.runObjectives.length>0?this.config.runObjectives:[this.config.firstObjective];if(o=(await r.endTest(this.testId,{commit_id:this.config.commitId,time_taken:Math.round(this.config.totalDuration),steps_count:this.config.totalSteps,commit_message:this.config.firstObjective.slice(0,255),objectives:a})).testcase_id||void 0,this.log("info","PIPELINE_FINALIZE_OK","Test finalized",{testcase_id:o??"none"}),this.config.onFinalizeSuccess)try{await this.config.onFinalizeSuccess(o)}catch(d){this.log("warn","PIPELINE_FINALIZE_META_FAILED","Meta-rewrite after endTest failed",{error:String(d)})}e("finalize","done")}else e("finalize","skipped"),this.log("info","PIPELINE_FINALIZE_SKIPPED","Finalize skipped (evolve flow or first-run disabled)");if(o&&this.config.shareApiBaseUrl)try{c=await this.generateShareLink(o),this.log("info","PIPELINE_SHARE_OK","Share link generated",{share_id:c})}catch(r){this.log("warn","PIPELINE_SHARE_FAILED","Share link failed",{error:String(r)})}if(s&&n){let r=null;e("zip","running");try{await s.sealFn({testcaseId:o,shareId:c}),r=s.sealedPackPath?await ee(s.sealedPackPath):await Ie(s.executionId,s.cwd),this.log("info","PIPELINE_EVIDENCE_SEALED","Evidence pack sealed",{execution_id:s.executionId}),this.log("info","PIPELINE_PACK_READ","Sealed pack read",{size_mb:+(r.length/1024/1024).toFixed(1)})}catch(a){let u=a instanceof Error?a.message:String(a);this.log("warn","PIPELINE_EVIDENCE_UPLOAD_SKIPPED","Evidence seal/read failed \u2014 uploading blob only",{execution_id:s.executionId,error:u})}if(r){e("zip","done",`${(r.length/1024/1024).toFixed(1)}MB`),e("presign","running");let a=await this.controller.getPresignedUrls(this.testId,this.config.sessionId,[ve(s.executionId),{key:"blob",content_type:"application/json",filename:`${this.config.commitId}.json`}]);this.log("info","PIPELINE_PRESIGN_OK","Presigned URLs received",{artifacts_url:a.urls.artifacts?.blob_url,blob_url:a.urls.blob?.blob_url}),e("presign","done"),e("upload","running"),this.log("info","PIPELINE_UPLOAD_START","Uploading pack and blob",{artifact_size_mb:+(r.length/1024/1024).toFixed(1),blob_size_kb:+(n.length/1024).toFixed(1)}),await Promise.all([R(a.urls.artifacts.upload_url,r,"application/zip"),R(a.urls.blob.upload_url,n,"application/json")]),this.log("info","PIPELINE_UPLOAD_OK","Upload complete"),e("upload","done")}else{e("zip","skipped"),e("presign","running");let a=await this.controller.getPresignedUrls(this.testId,this.config.sessionId,[{key:"blob",content_type:"application/json",filename:`${this.config.commitId}.json`}]);e("presign","done"),e("upload","running"),this.log("info","PIPELINE_UPLOAD_START","Uploading blob only (evidence skipped)",{blob_size_kb:+(n.length/1024).toFixed(1)}),await R(a.urls.blob.upload_url,n,"application/json"),this.log("info","PIPELINE_UPLOAD_OK","Blob upload complete (pack skipped)"),e("upload","done")}}let i;if(this.config.codeExport?.enabled&&o){let r=!1;try{await this.triggerCodeExport(o),this.log("info","PIPELINE_CODE_EXPORT_START","Code export triggered"),r=!0}catch(a){let u=a instanceof Error?a.message:String(a);this.log("error","PIPELINE_CODE_EXPORT_FAILED","Code export trigger failed; skipping poll",{error:u}),e("code_export","failed",`trigger failed: ${u}`)}if(r){e("code_export","running","Waiting for code generation\u2026");try{i=await this.pollAndDownloadCode(o,e),this.log("info","PIPELINE_CODE_EXPORT_OK","Code export complete",{dir:i}),e("code_export","done",i)}catch(a){let u=a instanceof Error?a.message:String(a);this.log("error","PIPELINE_CODE_EXPORT_FAILED","Code export failed",{error:u}),e("code_export","failed",u)}}}else e("code_export","skipped");return this.log("info","PIPELINE_COMPLETE","Pipeline complete"),{success:!0,testId:this.testId,testcaseId:o,shareId:c,codeExportDir:i}}catch(s){return{success:!1,testId:this.testId,error:s instanceof Error?s.message:String(s)}}}async runCodeExport(e,s){let n=s??this.config.onProgress,o=!1;try{await this.triggerCodeExport(e),this.log("info","PIPELINE_CODE_EXPORT_TRIGGER","Code export triggered",{testcase_id:e}),o=!0}catch(c){let i=c instanceof Error?c.message:String(c);this.log("error","PIPELINE_CODE_EXPORT_TRIGGER_FAILED","Code export trigger failed; skipping poll",{error:i}),n("code_export","failed",`trigger failed: ${i}`)}if(o){n("code_export","running","Waiting for code generation\u2026");try{let c=await this.pollAndDownloadCode(e,n);return this.log("info","PIPELINE_CODE_EXPORT_OK","Code export complete",{dir:c}),n("code_export","done",c),c}catch(c){let i=c instanceof Error?c.message:String(c);this.log("error","PIPELINE_CODE_EXPORT_FAILED","Code export failed",{error:i}),n("code_export","failed",i);return}}}collectNdjsonPerRun(){let e=[],s=this.config.runObjectives??[],n=this.config.runMetadata??[],o=this.config.evidence??this.config.evidenceRead;for(let c=0;c<this.config.runDirs.length;c++){let i=this.config.runDirs[c],r=s[c]||this.config.firstObjective,a=n[c],u=o?this.readNdjsonFromFile(E(o.packTestDir,"logs",`${o.runIndices?.[c]??c}-actions.ndjson`)):this.readNdjsonFromDir(i);u.length>0&&e.push({objective:r,records:u,resultCode:a?.resultCode,reasonCode:a?.reasonCode,errorMessage:a?.errorMessage,summary:a?.summary,oneLiner:a?.oneLiner})}if(e.length===0){let c=E(this.config.sessionDir,"runs");if(w(c))try{let r=Ee(c,{withFileTypes:!0}).filter(a=>a.isDirectory()).map(a=>a.name).sort();for(let a of r){let u=E(c,a),d=this.readNdjsonFromDir(u);d.length>0&&e.push({objective:this.config.firstObjective,records:d})}}catch{}}return e}readNdjsonFromDir(e){let s=[E(e,"run-test","actions.ndjson"),E(e,"actions.ndjson")];for(let n of s)if(w(n))return this.readNdjsonFromFile(n);return[]}readNdjsonFromFile(e){let s=[];if(!w(e))return s;this.log("debug","PIPELINE_COLLECT_READ","Reading NDJSON file",{path:e});let n=Z(e,"utf-8");for(let o of n.split(`
|
|
5
|
-
`)){let c=o.trim();if(c)try{s.push(JSON.parse(c))}catch{}}return s}async generateShareLink(e){let s=`${this.config.shareApiBaseUrl}/lshs/api/v1.0/share-item/generate-sharable-link`;this.log("info","PIPELINE_SHARE_START","Requesting share link",{url:s,testcase_id:e});let n={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({entityIds:[e],entityType:"Test Case Details",expiresAt:7})},o=!!this.config.authResolver;this.log("debug","PIPELINE_SHARE_AUTH","Share link auth config",{resolver:o,fallback_auth_type:typeof this.config.auth=="string"?"bearer":"basic",tms_user:this.config.tmsUsername});let c=o?await this.config.authResolver.fetch(s,n):await O(s,{...n,headers:{...n.headers,Authorization:this.buildAuthHeader()}});if(!c.ok)throw new Error(`Share link API failed: ${c.status} ${await c.text()}`);let i=await c.json();if(!i.shareId)throw new Error("Share link API returned no shareId");return i.shareId}async triggerCodeExport(e){if(!this.config.codeExport)throw new Error("triggerCodeExport called without resolved codeExport config");let{url:s,body:n}=F({tmsBaseUrl:this.config.tmsBaseUrl,testcaseId:e,codeExport:this.config.codeExport});this.log("info","PIPELINE_CODE_EXPORT_POST","Triggering code export",{url:s});let o={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(n)},c=this.config.authResolver?await this.config.authResolver.fetch(s,o):await O(s,{...o,headers:{...o.headers,Authorization:this.buildAuthHeader()}});if(!c.ok)throw new Error(`Code export failed: ${c.status} ${await c.text()}`)}async pollAndDownloadCode(e,s){let n=z({tmsBaseUrl:this.config.tmsBaseUrl,testcaseId:e}),o=this.config.exitTimeoutMs??3e5,c=5e3,i=Date.now()+o;this.log("info","PIPELINE_CODE_EXPORT_POLL","Polling for code export",{url:n,timeout_ms:o});let r=(a,u)=>this.config.authResolver?this.config.authResolver.fetch(a,u):O(a,{...u,headers:{...u?.headers,Authorization:this.buildAuthHeader()}});for(;Date.now()<i;){let a=await r(n,{method:"GET",headers:{Accept:"application/json"}});if(!a.ok){let l=await a.text().catch(()=>"");throw this.log("warn","PIPELINE_CODE_EXPORT_POLL_FAILED","Code export poll non-200; skipping",{status:a.status,body:l.slice(0,200)}),new Error(`code export poll skipped: HTTP ${a.status}`)}let d=(await a.json()).data?.find(l=>l.code_name==="kane-cli-trigger");if(!d){this.log("debug","PIPELINE_CODE_EXPORT_WAITING","No kane-cli-trigger entry yet"),s("code_export","running","Waiting for code generation\u2026"),await this.sleep(c);continue}let g=d.status.toLowerCase();if(g==="in progress"||g==="in_progress"||g==="pending"){this.log("debug","PIPELINE_CODE_EXPORT_IN_PROGRESS","Code export in progress",{status:d.status}),s("code_export","running","Generating code\u2026"),await this.sleep(c);continue}if(!d.url||d.url.length===0)throw new Error(`Code export status=${d.status} but no files returned`);let _=this.config.codeExportDir??E(this.config.sessionDir,"code-export");T(_,{recursive:!0}),this.log("info","PIPELINE_CODE_EXPORT_DOWNLOAD","Downloading code files",{file_count:d.url.length,dir:_}),s("code_export","running",`Downloading ${d.url.length} files\u2026`);for(let l of d.url){let p=E(_,l.file_name),f=await O(l.file_url);if(!f.ok){this.log("warn","PIPELINE_CODE_EXPORT_FILE_FAILED","Failed to download file",{file_name:l.file_name,status:f.status});continue}let h=await f.text();x(p,h,"utf-8"),this.log("info","PIPELINE_CODE_EXPORT_FILE_SAVED","File saved",{file_name:l.file_name,size_bytes:h.length})}return _}throw new Error("Code export timed out")}sleep(e){return new Promise(s=>setTimeout(s,e))}buildAuthHeader(){return typeof this.config.auth=="string"?`Bearer ${this.config.auth}`:C(this.config.auth.username,this.config.auth.accessKey)}readAuthoredExecution(){let e=this.config.authoredExecutionPath;if(!e)return null;try{let s=Z(e,"utf8");return JSON.parse(s),s}catch{return this.log("warn","PIPELINE_AUTHORED_BLOB_UNREADABLE","Authored execution.json missing/unreadable \u2014 pack gets this run's envelope",{path:e}),null}}buildExecutionEnvelope(e){let s=this.config.runStatuses.every(i=>i==="passed")?"success":"error",n=this.config.variableIds??{},o=[];if(this.config.variables)for(let[i,r]of Object.entries(this.config.variables)){if(r.secret)continue;let a=i.startsWith("global.")?i.slice(7):i;o.push({id:n[a]??0,name:a,value:r.value,session_value:r.value,is_persist:!1,environment_id:0,environment_name:"No Env"})}let c=[];for(let i of this.collectNdjsonPerRun())for(let r of i.records)r.output_variable&&r.output_value!=null&&c.push({name:r.output_variable,value:String(r.output_value),value_type:"test_level",variable_description:"ANALYZE result"});return{test_id:this.testId,version:"v4",session_id:this.config.sessionId,org_id:String(this.config.orgId),user_id:String(this.config.userId),url:this.config.firstUrl??"",start_timestamp:this.config.startedAt,end_timestamp:this.config.endedAt,status:s,commit_id:this.config.commitId,instructions:e,modules:[],uploaded_files:[],test_params:[],test_level_variables:JSON.stringify(c),test_global_variables:o,max_network_wait:0,wait_buffer:0,network_throttle:{},secrets:this.config.secrets??[],totp:[],environment_id:0,environment:"",mobile_browser:!1,native_popups:[],smartui:{},module_index:0}}};export{Ie as a,ve as b,Q as c};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-5CTMOJG4.js";import"./chunk-4MUHS3UL.js";import"./chunk-RFHMDQXZ.js";import"./chunk-RZ4F3BHX.js";import"./chunk-DNOBOZPO.js";import"./chunk-BOO7YXAV.js";import"./chunk-HJGUEZLW.js";import"./chunk-UR6MHSHU.js";export{a as LoginFlow};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{d as a}from"./chunk-IOTJZTHX.js";import"./chunk-WT3SMSY5.js";import"./chunk-HNE4TDOZ.js";import"./chunk-3MSXQU2C.js";import"./chunk-O66EU5UV.js";import"./chunk-YI4XULHR.js";import"./chunk-IJPFAWBH.js";import"./chunk-CLTANA4L.js";import"./chunk-PYB2EXRE.js";import"./chunk-BYUARJE7.js";import"./chunk-2YQ6TW77.js";import"./chunk-WE57PD6K.js";import"./chunk-RHNKYNNZ.js";import"./chunk-RKWJG3WW.js";import"./chunk-3HEPW6SN.js";import"./chunk-OB6CKLEL.js";import"./chunk-I2JUBAPU.js";import"./chunk-MK2G7VIF.js";import"./chunk-ADOXYGZE.js";import"./chunk-E3BO7OVR.js";import"./chunk-W36P7S5W.js";import"./chunk-UZSG54OY.js";import"./chunk-2K4XOHVK.js";import"./chunk-5Y2G4NC7.js";import"./chunk-ZQP3MCZW.js";import"./chunk-WFEGGQJ4.js";import"./chunk-C5UNZ6ZY.js";import"./chunk-S3DAAAE5.js";import"./chunk-MVF4KRHA.js";import"./chunk-5CTMOJG4.js";import"./chunk-4MUHS3UL.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-AXABTFCD.js";import"./chunk-RFHMDQXZ.js";import"./chunk-QNNBNIR7.js";import"./chunk-CJJXT5DO.js";import"./chunk-FJTWJ243.js";import"./chunk-BC7UVJJB.js";import"./chunk-2PQXEEVY.js";import"./chunk-EHN5HTUD.js";import"./chunk-L5LI2JF4.js";import"./chunk-MCQXRJGH.js";import"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import"./chunk-3WJJ43MT.js";import"./chunk-YMSN25DX.js";import"./chunk-STH6I3UB.js";import"./chunk-YCCUBQY4.js";import"./chunk-PICCLJSO.js";import"./chunk-M5JQXOCE.js";import"./chunk-64QURIT6.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-DNOBOZPO.js";import"./chunk-VE3SUJMA.js";import"./chunk-E47GFYXA.js";import"./chunk-BOO7YXAV.js";import"./chunk-POI6DCP6.js";import"./chunk-IRRGSC7B.js";import{a as o}from"./chunk-DFS4RMVP.js";import"./chunk-IXVR66NS.js";import"./chunk-XUJ5EPVW.js";import"./chunk-HJGUEZLW.js";import{a as t}from"./chunk-HCBYKLMW.js";import{c as n}from"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import{e as r}from"./chunk-UR6MHSHU.js";var e=r(t(),1);async function p(i){let c=i.scenarioLimit!==void 0||i.perScenarioLimit!==void 0?{scenarioLimit:i.scenarioLimit,perScenarioLimit:i.perScenarioLimit}:void 0,{waitUntilExit:m}=n((0,e.jsx)(o,{children:(0,e.jsx)(a,{initialChatMode:"generate",initialObjective:i.objective,initialGenerateLimits:c})}),{exitOnCtrlC:!1});await m()}export{p as runGenerate};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-MVF4KRHA.js";import"./chunk-4MUHS3UL.js";import"./chunk-RZ4F3BHX.js";import"./chunk-DNOBOZPO.js";import"./chunk-HJGUEZLW.js";import"./chunk-UR6MHSHU.js";export{a as refreshOAuthToken};
|