@testmuai/kane-cli 0.6.7 → 0.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ChatSurface-QLRMFZJG.js +8 -0
- package/dist/{ChromeProfilePicker-IW3K43VC.js → ChromeProfilePicker-FJOUNY2B.js} +1 -1
- package/dist/{CliFeedbackPrompt-ZJ4LZGPK.js → CliFeedbackPrompt-HC4NNBTK.js} +1 -1
- package/dist/{CliUploadProgress-SMPVN7Q6.js → CliUploadProgress-VIEZQNZ5.js} +1 -1
- package/dist/{ConfigView-RTAGKZH4.js → ConfigView-LK5F4F7W.js} +1 -1
- package/dist/EvidenceViewOffer-HZ4WZKGM.js +2 -0
- package/dist/{FolderPicker-QUY7LNVZ.js → FolderPicker-3S57MSC6.js} +1 -1
- package/dist/{HelpView-47J2NZWJ.js → HelpView-BQ3TS7WE.js} +1 -1
- package/dist/{InfoBox-G63WZAMH.js → InfoBox-4HVXV3TD.js} +1 -1
- package/dist/{LinksBox-2HIHDT5K.js → LinksBox-3B2KO5S4.js} +1 -1
- package/dist/{ProfilesView-TUXQXPXJ.js → ProfilesView-FLRMROUR.js} +1 -1
- package/dist/{ProjectPicker-VUABWG2P.js → ProjectPicker-R3KLRGHH.js} +1 -1
- package/dist/{SaveSessionPrompt-PNVGNLGO.js → SaveSessionPrompt-P7HSG7R7.js} +1 -1
- package/dist/SingleShotApp-ZBZY7KGR.js +2 -0
- package/dist/{SummaryBox-36MDDDYQ.js → SummaryBox-HCDIWKPS.js} +1 -1
- package/dist/TestMdRunView-GQP2QGFU.js +2 -0
- package/dist/{WhoamiView-LHU6RGIY.js → WhoamiView-ZD6FIBMK.js} +1 -1
- package/dist/{bind-E67W2DXG.js → bind-RSVQXQJT.js} +2 -2
- package/dist/{bridge-WVFTWHKP.js → bridge-D2HETW5M.js} +1 -1
- package/dist/{changelog-D4Y5QJIZ.js → changelog-QB7S4VV4.js} +1 -1
- package/dist/chat-committer-MWZ4JQMM.js +2 -0
- package/dist/chat-controller-YX5A7R52.js +2 -0
- package/dist/{chunk-3GOZ7R4G.js → chunk-27GF2OQ7.js} +3 -3
- package/dist/{chunk-GAD6IBZ6.js → chunk-35RV2AAV.js} +8 -8
- package/dist/{chunk-7ZMYAXES.js → chunk-3BIEIXJK.js} +1 -1
- package/dist/{chunk-UZWOHCFX.js → chunk-4GXOBABK.js} +1 -1
- package/dist/chunk-5VC7MBHR.js +2 -0
- package/dist/{chunk-XUHVQ5VL.js → chunk-66LXV7NN.js} +1 -1
- package/dist/{chunk-JR37W7IJ.js → chunk-6WHKJSMJ.js} +1 -1
- package/dist/{chunk-BBZBXSTP.js → chunk-A6TFZQV6.js} +1 -1
- package/dist/{chunk-AASBJJCU.js → chunk-ATO6NM45.js} +1 -1
- package/dist/{chunk-LVWB6TB2.js → chunk-AXJIXRYF.js} +1 -1
- package/dist/{chunk-RBLZUDMZ.js → chunk-B22NUHB2.js} +2 -2
- package/dist/chunk-BLHCGRSK.js +11 -0
- package/dist/chunk-BSFONZ2E.js +2 -0
- package/dist/{chunk-Z34XRBKQ.js → chunk-BUVRZXO3.js} +1 -1
- package/dist/{chunk-G5CYSC23.js → chunk-D4WLVWJQ.js} +1 -1
- package/dist/{chunk-3CY3DZDH.js → chunk-D5IZ77YG.js} +2 -2
- package/dist/{chunk-UQVKNUYO.js → chunk-ELN3EN4K.js} +1 -1
- package/dist/{chunk-QG6LJCZG.js → chunk-EQORZ6RT.js} +1 -1
- package/dist/chunk-EYZWG32F.js +13 -0
- package/dist/{chunk-TADJIOHV.js → chunk-F4FXE466.js} +1 -1
- package/dist/chunk-FCMLIK7P.js +2 -0
- package/dist/{chunk-TSWGQKUK.js → chunk-FCZ2YFD3.js} +2 -2
- package/dist/{chunk-QVJ7C4GW.js → chunk-GFKIE3AL.js} +1 -1
- package/dist/chunk-GG43HSU2.js +3 -0
- package/dist/{chunk-KVAALPTA.js → chunk-GO4CBUB6.js} +1 -1
- package/dist/{chunk-RWIHSR4H.js → chunk-HCWEZCKP.js} +1 -1
- package/dist/{chunk-SK2GVMTJ.js → chunk-IQFUBT6Z.js} +1 -1
- package/dist/{chunk-77PBBYRZ.js → chunk-JKHQBGFY.js} +2 -2
- package/dist/{chunk-3NR6OTHL.js → chunk-K4ERF7GT.js} +1 -1
- package/dist/chunk-K4LCN5X4.js +6 -0
- package/dist/{chunk-NEHF4C6X.js → chunk-K7P6VNLI.js} +1 -1
- package/dist/chunk-L3HG5ONB.js +4 -0
- package/dist/chunk-LEA6IHXC.js +2 -0
- package/dist/{chunk-RGQIBS32.js → chunk-MEHEGW3V.js} +1 -1
- package/dist/{chunk-WFQUDSKY.js → chunk-N5YIMTGV.js} +1 -1
- package/dist/{chunk-QYTMD6NM.js → chunk-NKCXCCPM.js} +1 -1
- package/dist/{chunk-DL5CXC64.js → chunk-NKUA3TSO.js} +1 -1
- package/dist/chunk-NVGTSXCJ.js +9 -0
- package/dist/{chunk-IX34JIXK.js → chunk-OYOTWI53.js} +1 -1
- package/dist/{chunk-X47VFBIV.js → chunk-PV4EDQY4.js} +1 -1
- package/dist/{chunk-NMKZHHB6.js → chunk-PXPXK4Q7.js} +1 -1
- package/dist/{chunk-EDM6YACR.js → chunk-Q3WHZ26R.js} +1 -1
- package/dist/{chunk-WJG4ZPUH.js → chunk-QFD6CB4P.js} +1 -1
- package/dist/chunk-QM4S2APK.js +2 -0
- package/dist/{chunk-OPDJD7WS.js → chunk-QOGQBVTP.js} +2 -2
- package/dist/{chunk-I37UOX73.js → chunk-QZ7DZXLQ.js} +3 -3
- package/dist/chunk-SHAA6FOD.js +11 -0
- package/dist/{chunk-6EC54ZHT.js → chunk-TAUSKB3O.js} +1 -1
- package/dist/{chunk-A2AZQ4PQ.js → chunk-TBXIOT6M.js} +1 -1
- package/dist/chunk-TFVMSEIA.js +2 -0
- package/dist/{chunk-5J3HQZNU.js → chunk-TRXNJZSL.js} +1 -1
- package/dist/{chunk-FYSWQ4K7.js → chunk-VRVSOGXH.js} +1 -1
- package/dist/{chunk-MTG2LRGV.js → chunk-VZHXNQDO.js} +1 -1
- package/dist/chunk-XSAZDIQV.js +347 -0
- package/dist/chunk-XWIN3S7O.js +4 -0
- package/dist/{chunk-YB54MHKU.js → chunk-YEMR62WY.js} +1 -1
- package/dist/{chunk-GLVDOR5G.js → chunk-YKZIACYJ.js} +1 -1
- package/dist/{chunk-TTJ4XMWP.js → chunk-YTK3IQUB.js} +1 -1
- package/dist/{config-BZ7C5NU5.js → config-JV7HNJ3I.js} +1 -1
- package/dist/cover-cmd-L2HSVDLH.js +2 -0
- package/dist/{credentials-BPJL6YIZ.js → credentials-TQW3TT2I.js} +1 -1
- package/dist/dossier-ZHSHATVU.js +3 -0
- package/dist/evidence-ZFYDHO73.js +2 -0
- package/dist/evolve-cmd-YGJECGND.js +2 -0
- package/dist/{explain-cmd-AG6ZDXV6.js → explain-cmd-327F6ESA.js} +1 -1
- package/dist/{explain-cmd-NZPC6537.js → explain-cmd-E366QTAD.js} +1 -1
- package/dist/extract-bind-7UZXDON6.js +5 -0
- package/dist/{extract-cmd-4PGUDJMU.js → extract-cmd-TQ2MYXOG.js} +1 -1
- package/dist/gaps-cmd-IAEXXESW.js +2 -0
- package/dist/{generate-headless-NZUDYIKJ.js → generate-headless-XXECVP6L.js} +2 -2
- package/dist/index.js +12 -12
- package/dist/ingest-CBQAXVH6.js +2 -0
- package/dist/ingest-cmd-JN6PLDE3.js +3 -0
- package/dist/interactive-bind-WA2YVAUW.js +7 -0
- package/dist/lifecycle-cmd-KZOC4WDW.js +2 -0
- package/dist/list-cmd-6X5U46RD.js +3 -0
- package/dist/{list-commands-55RCFEOL.js → list-commands-I577A5LK.js} +1 -1
- package/dist/logical-ids-RFGWBVML.js +2 -0
- package/dist/login-flow-OVEZXSMW.js +2 -0
- package/dist/{persist-recorded-session-HK7JUONC.js → persist-recorded-session-DT3K6ZYQ.js} +1 -1
- package/dist/pipeline-5N7HWGAL.js +2 -0
- package/dist/readmodel-V3DVL6NP.js +2 -0
- package/dist/reconcile-cmd-HYYH3SZS.js +2 -0
- package/dist/{recording-banner-5IYX2KBV.js → recording-banner-QI77ERTZ.js} +1 -1
- package/dist/{require-project-folder-J4Q4FRQ4.js → require-project-folder-2UAXXZA4.js} +1 -1
- package/dist/review-cmd-XVWPSWU2.js +4 -0
- package/dist/run-RYIYWV63.js +2 -0
- package/dist/run-VMKZDO7J.js +2 -0
- package/dist/{run-test-md-WN6BH3PC.js → run-test-md-DKRJOUFA.js} +2 -2
- package/dist/{skill-installer-4HYPUBNB.js → skill-installer-TK5REDD6.js} +1 -1
- package/dist/{spawner-VD6YFZ43.js → spawner-K7LWPNIC.js} +1 -1
- package/dist/tcg-generate-6EJLU5KX.js +2 -0
- package/dist/{testmd-actions-LT5FNIR6.js → testmd-actions-Q2XWL7P5.js} +1 -1
- package/dist/token-refresh-NQZJEUQE.js +2 -0
- package/dist/{validate-basic-XWGKC5VF.js → validate-basic-XEJGB4GN.js} +1 -1
- package/dist/{version-check-6FDTS6MK.js → version-check-IT7T5YKJ.js} +1 -1
- package/dist/{view-cmd-PCDG3FIC.js → view-cmd-G4PGJRQH.js} +3 -3
- package/dist/walk-session-HCTG4LN2.js +2 -0
- package/package.json +6 -6
- package/dist/ChatSurface-Y2M6HB2R.js +0 -8
- package/dist/EvidenceViewOffer-LHPIZUGQ.js +0 -2
- package/dist/SingleShotApp-BZV5CULT.js +0 -2
- package/dist/TestMdRunView-A655PMEY.js +0 -2
- package/dist/chat-committer-WOTCC7L3.js +0 -2
- package/dist/chat-controller-MONWZKS7.js +0 -4
- package/dist/chunk-64LC36AF.js +0 -2
- package/dist/chunk-6PS65QFF.js +0 -2
- package/dist/chunk-CIFVUX3B.js +0 -4
- package/dist/chunk-DCWCANNS.js +0 -6
- package/dist/chunk-GBBVP2JW.js +0 -2
- package/dist/chunk-IYTHPCQ2.js +0 -356
- package/dist/chunk-NMZATEKQ.js +0 -9
- package/dist/chunk-QHFUDBQH.js +0 -2
- package/dist/chunk-R7NNIQMH.js +0 -11
- package/dist/chunk-RE3BZVGE.js +0 -3
- package/dist/chunk-VLC24QVT.js +0 -2
- package/dist/chunk-Y6HPW2OQ.js +0 -2
- package/dist/chunk-YTZUYCFZ.js +0 -2
- package/dist/chunk-YZBLBPOE.js +0 -13
- package/dist/cover-cmd-DN5D6A3S.js +0 -2
- package/dist/evidence-E5B24ZO6.js +0 -2
- package/dist/evolve-cmd-V7H4PLCX.js +0 -2
- package/dist/extract-bind-3QBBCWYE.js +0 -5
- package/dist/gaps-cmd-42LPHWFP.js +0 -2
- package/dist/ingest-GOKIMEP4.js +0 -2
- package/dist/ingest-cmd-BTYHVJ33.js +0 -3
- package/dist/interactive-bind-TKRWAPJU.js +0 -7
- package/dist/lifecycle-cmd-E6AXODQD.js +0 -2
- package/dist/list-cmd-RJVLH2GR.js +0 -3
- package/dist/logical-ids-QZQRQ3TV.js +0 -2
- package/dist/login-flow-WNIHDQXF.js +0 -2
- package/dist/pipeline-FTLXJQRT.js +0 -2
- package/dist/readmodel-KTNI6QDC.js +0 -2
- package/dist/reconcile-cmd-5XC4AUSJ.js +0 -2
- package/dist/review-cmd-XB2DCTMZ.js +0 -4
- package/dist/run-2RFR2ASQ.js +0 -2
- package/dist/run-3ZYJQBBC.js +0 -2
- package/dist/tcg-generate-77QKMB63.js +0 -2
- package/dist/token-refresh-PCOAZBKK.js +0 -2
- package/dist/walk-session-YS62CWX5.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{homedir as a}from"os";import{join as t}from"path";var m="0.6.
|
|
2
|
+
import{homedir as a}from"os";import{join as t}from"path";var m="0.6.8",d="kane-cli",e=t(a(),".testmuai","kaneai"),g=t(e,"profiles"),h=t(e,"tui-config.json"),_=t(e,"media"),A="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",b=[{dir:t(a(),".claude","skills",r),agent:"Claude Code"},{dir:t(a(),".agents","skills",r),agent:"Codex CLI"},{dir:t(a(),".gemini","skills",r),agent:"Gemini CLI"}],u="https://dd-proxy.lambdatest.com/intake/kane-cli",U="https://kaneai-playground.lambdatest.io",R=9222,I=9230,E=t(e,"chrome-profiles"),o=t(e,"hints"),C=t(o,"state.json");function T(s){return t(o,`catalog-${s}.json`)}var c="127.0.0.1",S=18392,N=18400,i="/callback";function P(s){return`http://${c}:${s}${i}`}var B="KANE CLI",O="*",f={prod:{authBaseUrl:"https://auth.lambdatest.com",consentUrl:"https://accounts.lambdatest.com",controllerBaseUrl:"https://kaneai-api.lambdatest.com/v16-controller/v1",tmsBaseUrl:"https://test-manager-api.lambdatest.com/api",testGeneratorBaseUrl:"https://test-manager-api.lambdatest.com",secretsBaseUrl:"https://api-hyperexecute.lambdatest.com",testManagerUiUrl:"https://test-manager.lambdatest.com",shareApiBaseUrl:"https://api.lambdatest.com",v16ServerHost:"https://kaneai-api.lambdatest.com/v16-server",evidenceViewerUrl:"https://evidence.lambdatest.com",mediaArtefactsHost:"prod-mobile-artefacts.lambdatest.com"},stage:{authBaseUrl:"https://stage-auth.lambdatestinternal.com",consentUrl:"https://stage-accounts.lambdatestinternal.com",controllerBaseUrl:"https://auteur-stage-automind.lambdatestinternal.com/v16-controller/v1",tmsBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com/api",testGeneratorBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com",secretsBaseUrl:"https://api-stage-hyperexecute.lambdatestinternal.com",testManagerUiUrl:"https://stage-test-manager.lambdatestinternal.com",shareApiBaseUrl:"https://stage-api.lambdatestinternal.com",v16ServerHost:"https://auteur-stage-automind.lambdatestinternal.com/v16-server",evidenceViewerUrl:"https://stage-evidence.lambdatestinternal.com",mediaArtefactsHost:"stage-mobile-artefacts.lambdatestinternal.com"}},k={orange:"#ff9500",generateAccent:"#0d9488",purple:"#b388ff",secondary:"#888888",dim:"#666666",muted:"#444444",green:"#4ade80",red:"#ef4444"};export{m as a,d as b,e as c,h as d,_ as e,A as f,L as g,n as h,b as i,u as j,U as k,R as l,I as m,E as n,C as o,T as p,c as q,S as r,N as s,i as t,P as u,B as v,O as w,f as x,k as y};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as L}from"./chunk-RFHMDQXZ.js";import{Q as O,S}from"./chunk-
|
|
2
|
+
import{c as L}from"./chunk-RFHMDQXZ.js";import{Q as O,S}from"./chunk-EYZWG32F.js";import{e as P,f as R}from"./chunk-M5JQXOCE.js";import{y as s}from"./chunk-PXPXK4Q7.js";import{a as y}from"./chunk-HCBYKLMW.js";import{a as E,b as o,i as h}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as d}from"./chunk-UR6MHSHU.js";var n=d(B(),1);import{basename as D}from"path";var r=d(y(),1),U="evidence-view-server";function Q({packPath:m,viewerBase:w,onDone:V,openUrl:k}){let[t,a]=(0,n.useState)("ask"),[g,b]=(0,n.useState)(null),[l,p]=(0,n.useState)(null),f=(0,n.useRef)(null),u=(0,n.useRef)(!1),x=async()=>{let e=f.current;f.current=null,e&&(R(U),await e.close())},v=()=>{u.current||(u.current=!0,V())};return h((e,i)=>{u.current||(t==="ask"?e==="y"||e==="Y"?a("starting"):(e==="n"||e==="N"||i.return||i.escape)&&v():t==="serving"&&(e==="q"||e==="Q"||i.escape)&&x().then(v))}),(0,n.useEffect)(()=>{if(t!=="starting")return;let e=!1;return(async()=>{try{let i=D(m),c=await O({packs:new Map([[i,m]]),allowedOrigins:[new URL(w).origin]});if(e){await c.close();return}f.current=c,P(U,()=>{c.close()});let T=S(c.urlFor(i),w);b(T);try{await(k??(q=>L(q)))(T)}catch{p("could not open browser \u2014 open the URL manually")}a("serving")}catch(i){p(`evidence view failed \u2014 ${i.message}`),a("failed")}})(),()=>{e=!0}},[t]),(0,n.useEffect)(()=>{if(t!=="failed")return;let e=setTimeout(v,0);return()=>clearTimeout(e)},[t]),(0,n.useEffect)(()=>()=>{x()},[]),t==="ask"?(0,r.jsxs)(o,{children:["View evidence in browser? ",(0,r.jsx)(o,{color:s.dim,children:"(y/N)"})]}):t==="serving"||t==="starting"?(0,r.jsxs)(E,{flexDirection:"column",children:[g?(0,r.jsxs)(o,{children:["viewer ",(0,r.jsx)(o,{color:s.orange,children:g})]}):(0,r.jsx)(o,{color:s.dim,children:"starting\u2026"}),l?(0,r.jsx)(o,{color:"yellow",children:l}):null,t==="serving"?(0,r.jsx)(o,{color:s.dim,children:"Press q when done"}):null]}):l?(0,r.jsx)(o,{color:"yellow",children:l}):null}export{Q as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as b}from"./chunk-
|
|
2
|
+
import{a as b}from"./chunk-MEHEGW3V.js";import{n as d,y as o}from"./chunk-PXPXK4Q7.js";import{a as L}from"./chunk-HCBYKLMW.js";import{a as u,b as c,i as A}from"./chunk-C44QQJR4.js";import{a as D}from"./chunk-6YGTRKDT.js";import{e as h}from"./chunk-UR6MHSHU.js";var x=h(D(),1);import{readdirSync as N,mkdirSync as B,statSync as k}from"fs";import{join as P}from"path";var r=h(L(),1);function O(n){try{return N(n).filter(l=>{try{return k(P(n,l)).isDirectory()}catch{return!1}})}catch{return[]}}function E(n,l,f,v){return{name:n,path:l,label:n,isActive:v}}function H({currentPath:n,onSelect:l,onCancel:f}){let s=O(d).map(i=>{let e=P(d,i);return E(i,e,n,e===n)}),p=!n,R=s.length+2,[a,C]=(0,x.useState)(()=>{if(p)return 0;let i=s.findIndex(e=>e.isActive);return i>=0?i+1:0}),[T,I]=(0,x.useState)(!1),[S,g]=(0,x.useState)("");return A((i,e)=>{if(T){if(e.escape){I(!1),g("");return}if(e.return){let t=S.trim();if(t){let m=P(d,t);B(m,{recursive:!0}),l(m),f()}return}if(e.backspace||e.delete){g(t=>t.slice(0,-1));return}i&&!e.ctrl&&!e.meta&&g(t=>t+i);return}if(e.escape){f();return}if(e.upArrow){C(t=>Math.max(0,t-1));return}if(e.downArrow){C(t=>Math.min(R-1,t+1));return}if(e.return){if(a===0){p||l(""),f();return}if(a===s.length+1){B(d,{recursive:!0}),I(!0),g("");return}let t=s[a-1];t&&!t.isActive&&l(t.path),f();return}}),T?(0,r.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(c,{color:o.orange,bold:!0,children:"Chrome Profile \u203A New"}),(0,r.jsxs)(u,{marginTop:1,children:[(0,r.jsx)(c,{color:o.secondary,children:"Name: "}),(0,r.jsx)(c,{children:S}),(0,r.jsx)(c,{color:o.dim,children:"\u2588"})]}),(0,r.jsx)(b,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:"back"})]}):(0,r.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(c,{color:o.orange,bold:!0,children:"Chrome Profile"}),(0,r.jsxs)(u,{flexDirection:"column",marginTop:1,children:[(0,r.jsxs)(c,{color:p?o.green:a===0?o.orange:o.dim,children:[a===0?"\u276F ":" ","Use temporary (no profile)",p?" \u25CF active":""]}),s.map((i,e)=>{let m=e+1===a,w=m?"\u276F ":" ",y=i.isActive?o.green:m?o.orange:void 0;return(0,r.jsxs)(c,{color:y,children:[w,i.label,i.isActive?" \u25CF active":""]},i.name)}),(0,r.jsxs)(c,{color:a===s.length+1?o.orange:o.dim,children:[a===s.length+1?"\u276F ":" ","+ Create new"]})]}),(0,r.jsx)(b,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"select"}],escBackLabel:"back"})]})}export{O as a,E as b,H as c};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{d,e as f}from"./chunk-5YPBPZUR.js";var G={high:3,med:2,low:1},R={create:0,evolve:1,"reuse-candidate":2},_=.75;function a(e,n){return!e.superseded.has(n)&&e.trust.get(n)!=="archived"}function E(e,n){return e.edgesInto(n).some(t=>t.type===f.VERIFIES&&a(e,t.src))}function m(e,n="med"){let t=e.risk;return t==="high"||t==="med"||t==="low"?t:n}function u(e,n){return e.displayNameOf(n)??n}function y(e,n){return`kane-cli design tests --use-case ${u(e,n)}`}function b(e,n){let t=e.edgesFrom(n).find(i=>i.type===f.SCOPED_TO&&a(e,i.dst));if(!t)return null;let s=e.nodeLabel.get(t.dst);if(s===d.USECASE)return t.dst;if(s===d.SCENARIO){let i=e.edgesFrom(t.dst).find(r=>r.type===f.BELONGS_TO&&a(e,r.dst));return i?i.dst:null}return null}function v(e,n){let t=b(e,n);return t?y(e,t):w(e,n)}function w(e,n){return`kane-cli design explain ${u(e,n)}`}function h(e,n){let t=e.edgesFrom(n).find(i=>i.type===f.AUTOMATES&&a(e,i.dst));if(!t)return null;let s=e.edgesFrom(t.dst).find(i=>i.type===f.BELONGS_TO&&a(e,i.dst));return s?s.dst:null}function x(e){let n=[];for(let{cid:t,content:s}of e.byLabel(d.AC))a(e,t)&&(E(e,t)||n.push({ref:u(e,t),kind:"no-verifies",why:"no live test verifies this acceptance criterion",risk:m(s),stage:"design",tag:"create",ready_command:v(e,t)}));return n}function S(e){let n=[];for(let{cid:t,content:s}of e.byLabel(d.USECASE)){if(!a(e,t))continue;let i=e.edgesInto(t).filter(o=>o.type===f.BELONGS_TO&&a(e,o.src));if(i.length===0){n.push({ref:u(e,t),kind:"zero-scenario",why:"use-case has no scenarios",risk:m(s),stage:"design",tag:"create",ready_command:y(e,t)});continue}i.every(o=>e.getNode(o.src)?.content.case_type==="happy")&&n.push({ref:u(e,t),kind:"happy-only",why:"use-case is exercised by happy-path scenarios only",risk:m(s),stage:"design",tag:"create",ready_command:y(e,t)})}return n}function L(e){let n=[];for(let{cid:t,content:s}of e.byLabel(d.GAP)){if(!a(e,t))continue;let i=s.ref,r=typeof i=="string"?e.resolve(i):null,o=r&&a(e,r.tip)?r.tip:null,l=o?e.nodeLabel.get(o):null,p=l===d.USECASE?y(e,o):l===d.AC?v(e,o):w(e,t),c=s.question&&typeof s.question=="object"?s.question:void 0,k=typeof s.text=="string"&&s.text||(c&&typeof c.header=="string"?c.header:"")||"design gap";n.push({ref:u(e,t),kind:String(s.kind),why:k,risk:m(s),stage:"design",tag:"create",ready_command:p,...typeof s.risk_rationale=="string"?{risk_rationale:s.risk_rationale}:{},...c?{question:c}:{}})}return n}function C(e){let n=[];for(let{cid:t,content:s}of e.byLabel(d.AC)){if(!a(e,t))continue;let i=e.stale(t);i==="fresh"||i==="superseded"||n.push({ref:u(e,t),kind:"stale-ac",why:`acceptance criterion is ${i} \u2014 its source moved since this was authored \xB7 why: kane-cli design explain ${u(e,t)}`,risk:m(s),stage:"design",tag:"evolve",ready_command:"kane-cli maintain reconcile"})}for(let{cid:t,content:s}of e.byLabel(d.TEST)){if(!a(e,t))continue;let i=e.stale(t);if(i==="fresh"||i==="superseded")continue;let r=e.edgesFrom(t).filter(g=>g.type===f.VERIFIES&&a(e,g.dst)),o=r.map(g=>m(e.getNode(g.dst)?.content??{})),l=o.includes("high")?"high":o.includes("med")?"med":o.includes("low")?"low":"med",p=r[0]?.dst??null,c=p?null:h(e,t),k=p?v(e,p):c?y(e,c):w(e,t);n.push({ref:u(e,t),kind:"stale-test",why:`test is ${i} \u2014 its source moved since this was authored`,risk:l,stage:"design",tag:"evolve",ready_command:k})}return n}async function O(e,n,t){for(let s of e)if(s.tag==="create"){if(!t){s.meta={embed_arm:"skipped"};continue}try{let i=n.resolve(s.ref),r=i?n.getNode(i.tip):null,o=r&&(String(r.content.title??"")||String(r.content.text??""))||s.why,l=r?.label===d.USECASE?"scenario":"test",c=(await t.searchSimilar(o,{label:l,k:1}))[0];c&&c.score>=_?(s.tag="reuse-candidate",s.meta={embed_arm:"used",near_hit:{ref:u(n,c.cid),score:c.score}}):s.meta={embed_arm:"used",near_hit:null}}catch{s.meta={embed_arm:"skipped"}}}}function A(e,n){let t=G[n.risk]-G[e.risk];if(t!==0)return t;let s=R[e.tag]-R[n.tag];return s!==0?s:e.ref<n.ref?-1:e.ref>n.ref?1:0}function T(e,n){let t=[],s=r=>{let o=e.resolve(r);return o&&!o.superseded?m(e.getNode(o.tip)?.content??{}):"med"},i=r=>{let o=e.resolve(r),l=o&&!o.superseded?b(e,o.tip):null;return l?u(e,l):r};for(let r of n.usecases??[])for(let o of r.acceptance_criteria??[])(o.covered_by??[]).length>0&&(o.execution==="failed"?t.push({ref:o.id,kind:"execution-failed",stage:"cover",tag:"evolve",risk:s(o.id),why:`covering test failed against this AC (tests: ${(o.covered_by??[]).join(", ")})`,ready_command:`kane-cli maintain evolve ${i(o.id)}`}):o.execution==="blocked"?t.push({ref:o.id,kind:"execution-blocked",stage:"cover",tag:"reuse-candidate",risk:s(o.id),why:"the oracle could not run (infrastructure) \u2014 the covering test exists and is reusable",ready_command:"kane-cli testrun run"}):o.execution==="not-run"&&t.push({ref:o.id,kind:"covered-not-run",stage:"cover",tag:"reuse-candidate",risk:s(o.id),why:"a covering test exists but never joined this pack \u2014 run it",ready_command:"kane-cli testrun run"}));return t}async function N(e,n,t,s){if(n!=="design"&&!s)throw new Error(`gaps-engine: stage "${n}" requires a pack's usecases doc`);let i=[];return(n==="design"||n==="all")&&i.push(...x(e),...S(e),...L(e),...C(e)),(n==="cover"||n==="all")&&i.push(...T(e,s)),await O(i,e,t),i.sort(A),i}export{a,E as b,b as c,N as d};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as
|
|
2
|
+
import{a as S,b as A,d as P}from"./chunk-GRB66C5S.js";import{a as O}from"./chunk-3C5GMAM4.js";import{a as U}from"./chunk-JFAFKHDX.js";import{a as G}from"./chunk-DNNZ353O.js";import{a as E,b as $}from"./chunk-LEA6IHXC.js";import{b as T}from"./chunk-L3HG5ONB.js";import{d as g,e as m}from"./chunk-5YPBPZUR.js";var v=(e,t,n=new Set)=>{let o=e.nameOf.get(t);if(o!==void 0)return o;if(n.has(t))return t;n.add(t);for(let[s,r]of e.superseded){if(r!==t)continue;let c=v(e,s,n);if(c!==s)return c}return t};function M(e,t){let n=e.stale(t);if(n==="fresh")return;if(n==="orphaned")return"orphaned \u2014 no live source evidences this item";let o=[],s=new Map;for(let r of e.derivesInto(t))s.set(String(r.props.source_id),r);for(let[r,c]of s){let i=e.heads.get(r);if(i==null||i===c.props.source_cid)continue;let u=e.convChains.get(r)?.chain;u&&u.includes(String(c.props.source_cid))||o.push(`DERIVES pin ${r}@${String(c.props.source_cid).slice(0,19)} broke \u2014 the source head moved`)}for(let r of e.edgesFrom(t)){if(r.type===m.DERIVES||!e.superseded.has(r.dst))continue;let c=e.tipOf(r.dst);if(e.superseded.has(c)){o.push(`${r.type} pin \u2192 ${v(e,r.dst)} \u2014 target retired`);continue}let i=L(e,r.dst,c);o.push(i.length>0?`${v(e,r.dst)} updated: ${i.map(u=>u.field).join(", ")}`:`${r.type} pin \u2192 ${v(e,r.dst)} \u2014 target superseded`)}return o.length>0?o.join("; "):"stale \u2014 a pinned dependency moved"}function L(e,t,n){let o=e.getNode(t)?.content??{},s=e.getNode(n)?.content??{},r=i=>i===void 0?"":Array.isArray(i)?i.map(String).join(" \xB7 "):typeof i=="object"?JSON.stringify(i):String(i),c=[];for(let i of[...new Set([...Object.keys(o),...Object.keys(s)])].sort())JSON.stringify(o[i])!==JSON.stringify(s[i])&&c.push({field:i,old:r(o[i]),new:r(s[i])});return c}function V(e,t){let n=[];for(let{cid:o}of e.byLabel(g.SCENARIO))e.superseded.has(o)||e.edgesFrom(o).some(s=>s.type===m.BELONGS_TO&&e.tipOf(s.dst)===t)&&n.push(o);return n}function R(e,t){let n=[],o=[],s=[],r=V(e,t),c=new Set(r),i=(u,f)=>{let a=M(e,f);return a===void 0?u:{...u,stale:!0,stale_reason:a}};for(let u of r){let f=e.getNode(u)?.content??{};n.push(i({ref:v(e,u),title:String(f.title??""),case_type:String(f.case_type??""),intent:String(f.intent??"")},u));for(let a of e.edgesInto(u)){if(a.type!==m.AUTOMATES||e.superseded.has(a.src))continue;let d=e.getNode(a.src)?.content??{},l=e.edgesFrom(a.src).filter(p=>p.type===m.VERIFIES&&!e.superseded.has(p.dst)).map(p=>v(e,p.dst));o.push(i({ref:v(e,a.src),title:String(d.title??""),check:d.check,verifies:l},a.src))}}for(let{cid:u}of e.byLabel(g.AC)){if(e.superseded.has(u))continue;let f=e.edgesFrom(u).find(p=>p.type===m.SCOPED_TO);if(!f)continue;let a=e.tipOf(f.dst);if(!(a===t||c.has(a)))continue;let l=e.getNode(u)?.content??{};s.push(i({ref:v(e,u),text:String(l.text??""),kind:String(l.kind??""),scope:a===t?"use-case":v(e,a)},u))}return{scenarios:n,tests:o,acs:s}}function I(e,t,n){let o=G(e,t,n);return o===null?null:o.toString("utf8")}function q(e,t){let n=t.split(`
|
|
3
3
|
`).map(s=>s.replace(/^\d+\| /,"")),o=[];for(let s of e.split(`
|
|
4
4
|
`)){let r=s.trim();if(r.length===0)continue;let c=n.find(i=>i.includes(r));c!==void 0&&!o.includes(c.trim())&&o.push(c.trim())}return o.length>0?o.join(`
|
|
5
|
-
`):{removed:!0}}function J(e,t,n,o){if(o!==void 0&&o.trim().length>0)return{kind:"user-directive",text:o.trim()};let s=[n,...R(t,n).acs.map(u=>t.resolve(u.ref)?.cid??"")].filter(Boolean),r=[],c=new Set;for(let u of s){let f=new Map;for(let a of t.derivesInto(u))f.set(String(a.props.source_id),a);for(let[a,d]of f){let l=t.heads.get(a);if(l==null||l===d.props.source_cid)continue;let p=String(d.props.anchor),b=`${a}\0${p}`;if(c.has(b)||p==="img#whole")continue;c.add(b);let k=I(e,t,String(d.props.source_cid)),w=k===null?null:
|
|
5
|
+
`):{removed:!0}}function J(e,t,n,o){if(o!==void 0&&o.trim().length>0)return{kind:"user-directive",text:o.trim()};let s=[n,...R(t,n).acs.map(u=>t.resolve(u.ref)?.cid??"")].filter(Boolean),r=[],c=new Set;for(let u of s){let f=new Map;for(let a of t.derivesInto(u))f.set(String(a.props.source_id),a);for(let[a,d]of f){let l=t.heads.get(a);if(l==null||l===d.props.source_cid)continue;let p=String(d.props.anchor),b=`${a}\0${p}`;if(c.has(b)||p==="img#whole")continue;c.add(b);let k=I(e,t,String(d.props.source_cid)),w=k===null?null:T(k,p);if(w===null)continue;let x=I(e,t,l);r.push({source_id:a,anchor:p,old_anchor_text:w,new_anchor_text:x===null?{removed:!0}:q(w,x)})}}let i;for(let[u,f]of t.superseded){if(f!==n||t.nodeLabel.get(u)!==g.USECASE)continue;let a=L(t,u,n);a.length>0&&(i=a);break}return{kind:"source-change",changes:r,...i?{uc_updated:i}:{}}}function N(e,t,n,o){let s=R(t,n);if(s.scenarios.length===0&&s.tests.length===0&&s.acs.length===0)return;let r=J(e,t,n,o);if(!(r.kind==="source-change"&&r.changes.length===0&&!r.uc_updated))return{prior_design:s,change_delta:r}}var _=new Set([g.USECASE,g.SCENARIO,g.AC,g.TEST]);function h(e,t){return!e.superseded.has(t)&&e.trust.get(t)!=="archived"}function y(e,t,n){let o=e.edgesFrom(t).find(s=>s.type===n);return o?e.tipOf(o.dst):null}function D(e,t,n){if(n===g.USECASE)return t;if(n===g.SCENARIO)return y(e,t,m.BELONGS_TO);if(n===g.AC){let o=y(e,t,m.SCOPED_TO);return o?e.nodeLabel.get(o)===g.USECASE?o:y(e,o,m.BELONGS_TO):null}if(n===g.TEST){let o=y(e,t,m.AUTOMATES);return o?y(e,o,m.BELONGS_TO):null}return null}function j(e,t){let n=e.nameOf.get(t);if(n)return n;for(let[o,s]of e.names)if(e.tipOf(s)===t)return o;return t}function B(e,t){return{ucTip:t,display:j(e,t),seamRef:e.nameOf.get(t)??t}}function Y(e,t){let n=e.resolve(t);if(!n)return{ok:!1,message:`unknown ref '${t}' \u2014 no test/scenario/ac/use-case by that id or cid`};let o=n.tip,s=e.nodeLabel.get(o);if(!s||!_.has(s))return{ok:!1,message:`'${t}' is a ${s??"missing node"} \u2014 evolve takes a test, scenario, acceptance criterion, or use-case`};let r=D(e,o,s);return!r||e.nodeLabel.get(r)!==g.USECASE?{ok:!1,message:`cannot resolve '${t}' to a parent use-case \u2014 its ${s} chain is broken`}:e.superseded.has(r)?{ok:!1,message:`use-case ${j(e,r)} was removed \u2014 nothing to evolve`}:{ok:!0,target:B(e,r)}}function ae(e,t){return C(e,t)}function C(e,t){let n=[];for(let{cid:s}of e.byLabel(g.SCENARIO)){if(!h(e,s)||!e.edgesFrom(s).some(c=>c.type===m.BELONGS_TO&&e.tipOf(c.dst)===t))continue;let r=e.edgesInto(s).filter(c=>c.type===m.AUTOMATES&&h(e,c.src));if(r.length===0)n.push({scenario:s,test:null});else for(let c of r)n.push({scenario:s,test:c.src})}let o=new Map;for(let{cid:s}of e.byLabel(g.AC)){if(!h(e,s)||D(e,s,g.AC)!==t)continue;let r=e.edgesInto(s).filter(c=>c.type===m.VERIFIES&&h(e,c.src)).map(c=>c.src).sort();o.set(s,r)}return{pairs:n,verifies:o}}function H(e,t){let n=c=>`${c.scenario}\0${c.test??""}`,o=new Set(e.pairs.map(n)),s=new Set(t.pairs.map(n)),r=[];for(let[c,i]of e.verifies){let u=t.verifies.get(c);u&&(i.length===u.length&&i.every((f,a)=>f===u[a])||r.push({ac:c,before:i,after:u}))}return{superseded:e.pairs.filter(c=>!s.has(n(c))),minted:t.pairs.filter(c=>!o.has(n(c))),retained:t.pairs.filter(c=>o.has(n(c))),moves:r}}function z(e,t,n,o,s){let r=i=>t.nameOf.get(i)??i,c=i=>` - ${r(i.scenario)} \xB7 ${i.test?r(i.test):"(no test)"}`;e.out(`evolved: use-case ${n} \u2014 design record ${o.before} \u2192 ${o.after}`),e.out(`superseded: ${s.superseded.length} pair(s)`);for(let i of s.superseded)e.out(c(i));e.out(`minted: ${s.minted.length} pair(s)`);for(let i of s.minted)e.out(c(i));e.out(`retained: ${s.retained.length} pair(s)`);for(let i of s.retained)e.out(c(i));if(s.moves.length===0)e.out("verifies moves: none");else{e.out("verifies moves:");for(let i of s.moves){let u=f=>f.length>0?f.map(r).join(" + "):"(none)";e.out(` - ${r(i.ac)}: ${u(i.before)} \u2192 ${u(i.after)}`)}}}async function F(e,t,n,o,s,r){let c=E(e),i=O(c,t.ucTip);if(!i)return r==="batch"?(o.out(`note: ${t.display} has no design output \u2014 nothing to evolve; run kane-cli design tests --use-case ${t.display} first`),{code:0,outcome:"no-design"}):(S(o,`nothing to evolve \u2014 run kane-cli design tests --use-case ${t.display} first (no design output)`),{code:2,outcome:"no-design"});let u=C(c,t.ucTip),f=`evolve re-designs the parent use-case ${t.display}; ${u.pairs.length} pair(s) affected`;if(n.yes)o.out(f);else if(!await o.confirm(`${f} \u2014 proceed?`))return o.out(r==="batch"?`skipped ${t.display}`:"declined \u2014 nothing evolved"),{code:0,outcome:"declined"};let a=N(e,c,t.ucTip,n.because),d=await s(t.seamRef,{yes:!!n.yes,...n.mode?{mode:n.mode}:{},...n.because?{because:n.because}:{},...a!==void 0?{changeDelta:a.change_delta,priorDesign:a.prior_design}:{}});if(d===3)return o.out(`design session for ${t.display} paused \u2014 resume with \`kane-cli design tests --resume\`, then re-run evolve for the diff`),{code:d,outcome:"paused"};if(d!==0)return S(o,`design run for ${t.display} ended with exit code ${d} \u2014 no diff to report`),{code:d,outcome:"failed"};let l=E(e),p=l.tipOf(t.ucTip),b=O(l,p)?.seq;return z(o,l,t.display,{before:i.seq,after:b??"?"},H(u,C(l,p))),{code:0,outcome:"evolved"}}function K(e){let t=new Map,n=0;for(let{cid:s,state:r}of e.staleList()){if(r==="superseded")continue;let c=e.nodeLabel.get(s);if(!c||!_.has(c)||!h(e,s)||!$(e,s))continue;let i=D(e,s,c);!i||e.nodeLabel.get(i)!==g.USECASE||e.superseded.has(i)||(n++,t.has(i)||t.set(i,B(e,i)))}return{targets:[...t.values()].sort((s,r)=>s.display<r.display?-1:s.display>r.display?1:0),staleCount:n}}function Q(e,t){for(let{cid:n,state:o}of e.staleList()){if(o==="superseded")continue;let s=e.nodeLabel.get(n);if(!(!s||!_.has(s)||!h(e,n))&&$(e,n)&&D(e,n,s)===t)return!0}return!1}async function W(e,t,n,o={},s=process.cwd()){if(e&&t.fromStale)return S(n,"pass a <ref> OR --from-stale, not both"),2;if(!e&&!t.fromStale)return S(n,"evolve needs a <ref> or --from-stale"),2;let r=A(s,n);if(!r)return 2;let c=o.runDesignForUc??X;n.out(`evolving ${e??"stale use-cases"}: reading the graph\u2026`);let i=E(r),u,f=null;if(e){let d=Y(i,e);if(!d.ok)return S(n,d.message),2;if(!t.because&&O(i,d.target.ucTip)&&!Q(i,d.target.ucTip))return S(n,`nothing changed underneath ${e} \u2014 its sources and requirements are current; use --because "<reason>" to re-design anyway`),2;u=[d.target]}else{let{targets:d,staleCount:l}=K(i);if(d.length===0)return n.out("nothing stale \u2014 nothing to evolve"),0;f=`from-stale: ${l} stale node(s) \u2192 ${d.length} use-case(s)`,u=d}if(!t.yes&&!n.isTTY)return S(n,"evolve needs a TTY \u2014 the blast-radius confirm is the point; headless evolution rides `kane-cli maintain reconcile`"),2;if(f&&n.out(f),e){let d=await F(r,u[0],t,n,c,"single");return d.outcome==="evolved"&&t.because&&U(r,{ts:new Date().toISOString(),command:"evolve",id:e,verdict:"gap-resolved-evolve",polarity:"preference",by:{kind:"human",id:process.env.USER??"operator"},target:e,reason:t.because}),d.code}let a=0;for(let d of u){let{code:l}=await F(r,d,t,n,c,"batch");l!==0&&a===0&&(a=l)}return a}var X=async(e,t)=>{let{designTestsCommand:n}=await import("./bind-RSVQXQJT.js"),o=()=>n({useCase:e,force:!0,...t.mode?{mode:t.mode}:t.yes?{mode:"override"}:{},...t.because?{because:t.because}:{},...t.changeDelta!==void 0?{changeDelta:t.changeDelta}:{},...t.priorDesign!==void 0?{priorDesign:t.priorDesign}:{}});if(t.mode!=="agent")return o();let s=process.stdout.write;process.stdout.write=((...r)=>!0);try{return await o()}finally{process.stdout.write=s}};async function de(e,t){return W(e,t,P(),{})}export{Y as a,ae as b,F as c,K as d,W as e,X as f,de as g};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{
|
|
2
|
+
import{b as j}from"./chunk-QOGQBVTP.js";import{a as U}from"./chunk-DNNZ353O.js";import{d as F}from"./chunk-QM4S2APK.js";import{a as C}from"./chunk-LEA6IHXC.js";import{a as L,b as M,e as G,f as N}from"./chunk-L3HG5ONB.js";import{b as V}from"./chunk-MBXWXBDM.js";import{d as E,e as $,g as P}from"./chunk-5YPBPZUR.js";function W(e,n,t,i,r){let d=t.rows.filter(p=>{let u=i.get(p.temp_ref);return u!==void 0&&u!=="reject"});if(d.length===0)return{record:null,errors:null};let s={version:1,read_basis:n.latestHash,source:{source_id:t.source_id,source_cid:n.heads.get(t.source_id)??""},use_cases:d.map(p=>p.uc)},g=new Map;for(let p of d){let u=i.get(p.temp_ref);typeof u=="object"?g.set(p.temp_ref,{resolution:"edited",edit:u.edited}):g.set(p.temp_ref,{resolution:p.uc.matches_existing&&p.uc.changed?"edited":"approved"})}let l=ee(s,n,t.staged_source_cid);if(l.errors!==null)return{record:null,errors:l.errors};let o=l.proposal,f=s.source.source_cid?D(e,n,s.source.source_cid):null;if(f!==null){o=Z(o,f);let p=G(o,z(f),n);if(p.length>0)return{record:null,errors:[{code:"HELD_CITES_STALE",detail:"the source moved after this plan staged \u2014 its quotes no longer verify against the current head; re-run kane-cli maintain reconcile to re-stage"},...p]}}let m=`held-${(n.latestHash??"root").slice(-12)}-${d.length}`;return N({contextDir:e,graph:n,proposal:o,proposalId:m,verdicts:g,by:r,autoName:!0})}function z(e){return e.replace(/\n$/,"").split(`
|
|
3
3
|
`).map((t,i)=>`${String(i+1).padStart(4,"0")}| ${t}`).join(`
|
|
4
4
|
`)}function Z(e,n){let t=n.replace(/\n$/,""),i=z(n),r=d=>{if(!d?.quote)return d;let s=M(i,d.anchor);if(s!==null&&s.includes(d.quote))return d;let g=t.indexOf(d.quote);if(g===-1||t.indexOf(d.quote,g+1)!==-1)return d;let l=t.slice(0,g).split(`
|
|
5
5
|
`).length,o=l+d.quote.replace(/\n$/,"").split(`
|
|
6
|
-
`).length-1;return{...d,anchor:`L${l}-L${o}`}};return{...e,use_cases:e.use_cases.map(d=>({...d,cite:r(d.cite)??d.cite,...d.criteria?{criteria:d.criteria.map(s=>({...s,cite:r(s.cite)??s.cite}))}:{},...d.updated?.criteria?{updated:{...d.updated,criteria:d.updated.criteria.map(s=>({...s,cite:r(s.cite)??s.cite}))}}:{}}))}}function ee(e,n,t){let i=[],r=n.mediaOf(e.source.source_cid).images??[],d=t!==void 0?n.mediaOf(t).images??[]:null,s=(l,o)=>{let f=l?L(l.anchor):null;if(!l||f?.kind!=="img-part")return l;if(d===null)return i.push({code:"HELD_CITES_STALE",detail:`${o}: this plan predates image-part staging \u2014 ${l.anchor} cannot be verified against the version it staged under; re-run kane-cli maintain reconcile to re-stage`}),l;let m=d.find(c=>c.ref===f.ref)?.blob;if(m===void 0)return i.push({code:"HELD_CITES_STALE",detail:`${o}: ${l.anchor} names no decodable image of the staged version \u2014 re-run kane-cli maintain reconcile to re-stage`}),l;if(r.some(c=>c.ref===f.ref&&c.blob===m))return l;let p=r.filter(c=>c.blob===m),u=p.filter(c=>c.delivery==="selected");return u.length===1?{...l,anchor:`img#${u[0].ref}`}:p.length===1?{...l,anchor:`img#${p[0].ref}`}:(i.push({code:"HELD_CITES_STALE",detail:`${o}: the image behind ${l.anchor} is ${p.length===0?"no longer in":"ambiguous in"} the current head \u2014 re-run kane-cli maintain reconcile to re-stage`}),l)};return{proposal:{...e,use_cases:e.use_cases.map(l=>({...l,cite:s(l.cite,l.temp_ref)??l.cite,...l.criteria?{criteria:l.criteria.map(o=>({...o,cite:s(o.cite,l.temp_ref)??o.cite}))}:{},...l.updated?.criteria?{updated:{...l.updated,criteria:l.updated.criteria.map(o=>({...o,cite:s(o.cite,l.temp_ref)??o.cite}))}}:{}}))},errors:i.length>0?i:null}}function J(e,n,t=[]){let i=
|
|
6
|
+
`).length-1;return{...d,anchor:`L${l}-L${o}`}};return{...e,use_cases:e.use_cases.map(d=>({...d,cite:r(d.cite)??d.cite,...d.criteria?{criteria:d.criteria.map(s=>({...s,cite:r(s.cite)??s.cite}))}:{},...d.updated?.criteria?{updated:{...d.updated,criteria:d.updated.criteria.map(s=>({...s,cite:r(s.cite)??s.cite}))}}:{}}))}}function ee(e,n,t){let i=[],r=n.mediaOf(e.source.source_cid).images??[],d=t!==void 0?n.mediaOf(t).images??[]:null,s=(l,o)=>{let f=l?L(l.anchor):null;if(!l||f?.kind!=="img-part")return l;if(d===null)return i.push({code:"HELD_CITES_STALE",detail:`${o}: this plan predates image-part staging \u2014 ${l.anchor} cannot be verified against the version it staged under; re-run kane-cli maintain reconcile to re-stage`}),l;let m=d.find(c=>c.ref===f.ref)?.blob;if(m===void 0)return i.push({code:"HELD_CITES_STALE",detail:`${o}: ${l.anchor} names no decodable image of the staged version \u2014 re-run kane-cli maintain reconcile to re-stage`}),l;if(r.some(c=>c.ref===f.ref&&c.blob===m))return l;let p=r.filter(c=>c.blob===m),u=p.filter(c=>c.delivery==="selected");return u.length===1?{...l,anchor:`img#${u[0].ref}`}:p.length===1?{...l,anchor:`img#${p[0].ref}`}:(i.push({code:"HELD_CITES_STALE",detail:`${o}: the image behind ${l.anchor} is ${p.length===0?"no longer in":"ambiguous in"} the current head \u2014 re-run kane-cli maintain reconcile to re-stage`}),l)};return{proposal:{...e,use_cases:e.use_cases.map(l=>({...l,cite:s(l.cite,l.temp_ref)??l.cite,...l.criteria?{criteria:l.criteria.map(o=>({...o,cite:s(o.cite,l.temp_ref)??o.cite}))}:{},...l.updated?.criteria?{updated:{...l.updated,criteria:l.updated.criteria.map(o=>({...o,cite:s(o.cite,l.temp_ref)??o.cite}))}}:{}}))},errors:i.length>0?i:null}}function J(e,n,t=[]){let i=j(e,n),r=new Set,d=[],s=f=>{!f||r.has(f)||(r.add(f),d.push(R(e,f)))};for(let f of i.pairs)s(f.scenario),s(f.test);for(let[f,m]of i.verifies){s(f);for(let p of m)s(p)}if(t.length===0)return{stale_refs:d};let g=f=>`${String(f.props.source_id)}\0${String(f.props.anchor)}`,l=new Set;for(let{cid:f}of e.byLabel(E.USECASE))if(e.tipOf(f)===n)for(let m of e.edgesInto(f)){if(m.type!==$.DERIVES)continue;let p=m.props.claim;typeof p=="string"&&t.includes(p)&&l.add(g(m))}if(l.size===0)return{stale_refs:d};let o=new Set;for(let[f,m]of i.verifies)if(e.edgesInto(f).some(u=>u.type===$.DERIVES&&l.has(g(u)))){o.add(R(e,f));for(let u of m)o.add(R(e,u))}return{stale_refs:d,...o.size>0?{direct_refs:[...o]}:{}}}var B="this release plans changes only \u2014 blast-radius impact and drift meaning-checks are not measured, and REMOVE rows are never executed automatically",te="suite untouched; graph updated";function T(e,n){return!e.superseded.has(n)&&e.trust.get(n)!=="archived"}function R(e,n,t=new Set){let i=e.nameOf.get(n);if(i!==void 0)return i;if(t.has(n))return n;t.add(n);for(let[r,d]of e.superseded){if(d!==n)continue;let s=R(e,r,t);if(s!==r)return s}return n}function k(e){return String(e).slice(0,19)}function A(e,n,t){let i=e.edgesFrom(n).find(r=>r.type===t);return i?e.tipOf(i.dst):null}function Y(e,n){let t=e.nodeLabel.get(n);if(t===E.USECASE)return n;if(t===E.SCENARIO)return A(e,n,$.BELONGS_TO);if(t===E.AC){let i=A(e,n,$.SCOPED_TO);return i?e.nodeLabel.get(i)===E.USECASE?i:A(e,i,$.BELONGS_TO):null}if(t===E.TEST){let i=A(e,n,$.AUTOMATES);return i?A(e,i,$.BELONGS_TO):null}return null}function q(e,n){let t=[],i=new Map;for(let r of e.derivesInto(n))i.set(String(r.props.source_id),r);for(let[r,d]of i){let s=e.heads.get(r);if(s==null){t.push(`DERIVES pin ${r} @ ${k(d.props.source_cid)} \u2014 source retired`);continue}if(s!==d.props.source_cid){let g=e.convChains.get(r)?.chain;if(g&&g.includes(String(d.props.source_cid)))continue;t.push(`DERIVES pin ${r} @ ${k(d.props.source_cid)} \u2014 source head moved to ${k(s)}`)}}for(let r of e.edgesFrom(n))P(r.type)?.pin?.comparesTo==="dst_tip"&&e.superseded.has(r.dst)&&t.push(`${r.type} pin \u2192 ${R(e,r.dst)} \u2014 target superseded`);return t.join("; ")||"structural pin broken"}var ne=new Set([E.USECASE,E.SCENARIO,E.AC,E.TEST]);function O(e,n){return e.ref<n.ref?-1:e.ref>n.ref?1:0}function D(e,n,t){let i=U(e,n,t);return i===null?null:i.toString("utf8")}function re(e,n,t,i,r){let d=t.props.quote;if(typeof d=="string"&&d.length>0)return i.includes(d);let s=String(t.props.source_cid);r.has(s)||r.set(s,D(e,n,s));let g=r.get(s);if(g===null)return!1;let l=M(g,String(t.props.anchor));return l===null?!1:l.split(`
|
|
7
7
|
`).some(o=>o.trim().length>0&&i.includes(o.trim()))}function se(e,n,t){let i=L(String(n.props.anchor));if(i?.kind!=="img-part")return!1;let d=(e.mediaOf(String(n.props.source_cid)).images??[]).find(s=>s.ref===i.ref)?.blob;return d===void 0?!1:(e.mediaOf(t).images??[]).some(s=>s.blob===d)}var K=128*1024,X=64*1024;function oe(e,n){let t=e.split(`
|
|
8
8
|
`),i=n.split(`
|
|
9
9
|
`),r=0;for(;r<t.length&&r<i.length&&t[r]===i[r];)r++;let d=t.length,s=i.length;for(;d>r&&s>r&&t[d-1]===i[s-1];)d--,s--;if(d===r&&s===r)return"";let g=t.slice(r,d),l=i.slice(r,s),f=ie(g,l,2e3),m=[];if(f===null)m.push(`@@ old L${r+1}-L${d} \u2192 new L${r+1}-L${s} @@`,...g.map(p=>`- ${p}`),...l.map(p=>`+ ${p}`));else{let p=f.map((c,h)=>c.op==="="?-1:h).filter(c=>c>=0),u=0;for(;u<p.length;){let c=u;for(;c+1<p.length&&p[c+1]-p[c]<=3;)c++;let h=Math.max(p[u]-1,0),v=Math.min(p[c]+1,f.length-1),y=f.slice(h,v+1),S=r+(y[0].ai??0)+1,w=r+(y[0].bi??0)+1,a=y.filter(b=>b.op!=="+").length,_=y.filter(b=>b.op!=="-").length;m.push(`@@ old L${S}-L${S+Math.max(a-1,0)} \u2192 new L${w}-L${w+Math.max(_-1,0)} @@`);for(let b of y)m.push(b.op==="="?` ${b.line}`:`${b.op} ${b.line}`);u=c+1}}return m.join(`
|
|
10
10
|
`)}function ie(e,n,t){let i=e.length,r=n.length,d=Math.min(i+r,t),s=new Map([[1,0]]),g=[],l=!1;for(let p=0;p<=d&&!l;p++){g.push(new Map(s));for(let u=-p;u<=p;u+=2){let c=u===-p||u!==p&&(s.get(u-1)??0)<(s.get(u+1)??0)?s.get(u+1)??0:(s.get(u-1)??0)+1,h=c-u;for(;c<i&&h<r&&e[c]===n[h];)c++,h++;if(s.set(u,c),c>=i&&h>=r){l=!0;break}}}if(!l)return null;let o=i,f=r,m=[];for(let p=g.length-1;p>0;p--){let u=g[p],c=o-f,h=c===-p||c!==p&&(u.get(c-1)??0)<(u.get(c+1)??0)?c+1:c-1,v=u.get(h)??0,y=v-h;for(;o>v&&f>y;)m.push({op:"=",line:e[o-1],ai:o-1,bi:f-1}),o--,f--;p>0&&(o===v?(m.push({op:"+",line:n[f-1],ai:o,bi:f-1}),f--):(m.push({op:"-",line:e[o-1],ai:o-1,bi:f}),o--))}for(;o>0&&f>0;)m.push({op:"=",line:e[o-1],ai:o-1,bi:f-1}),o--,f--;for(;o>0;)m.push({op:"-",line:e[o-1],ai:o-1,bi:0}),o--;for(;f>0;)m.push({op:"+",line:n[f-1],ai:0,bi:f-1}),f--;return m.reverse()}function ce(e){let n=Buffer.byteLength(e,"utf8");if(n<=K+X)return{diff:e,truncated:!1};let t=Buffer.from(e,"utf8"),i=K;for(;i>0&&(t[i]&192)===128;)i--;let r=n-X;for(;r<n&&(t[r]&192)===128;)r++;let d=t.subarray(0,i).toString("utf8"),s=t.subarray(r).toString("utf8");return{diff:`${d}
|
|
11
11
|
\u2026 [diff truncated: ${n-i-(n-r)} bytes omitted] \u2026
|
|
12
|
-
${s}`,truncated:!0}}function ae(e,n){let t=C(e),i=t.heads.get(n);if(typeof i!="string")return null;let r=[];for(let u of V(e).records){let c=u.source_head_moves?.[n];c!==void 0&&c!==r[r.length-1]&&r.push(c)}let d=r.lastIndexOf(i),s=d>0?r[d-1]:null;if(typeof s!="string"||s===i)return null;let g=D(e,t,s),l=D(e,t,i);if(g===null||l===null)return null;let{diff:o,truncated:f}=ce(oe(g,l)),m=new Set,p=[];for(let u of t.edgesFrom(s))u.type!==$.DERIVES||t.nodeLabel.get(u.dst)!==E.USECASE||m.has(u.dst)||(m.add(u.dst),p.push({id:u.dst,title:String(t.getNode(u.dst)?.content.title??"")}));return{source_id:n,old_head:s,new_head:i,diff:o,...f?{truncated:!0}:{},prior_ucs:p}}function de(e,n,t){let i=e.getNode(n)?.content??{},r=e.getNode(t)?.content??{},s=[...new Set([...Object.keys(i),...Object.keys(r)])].sort().filter(g=>JSON.stringify(i[g])!==JSON.stringify(r[g]));return s.length>0?`updated: ${s.join(", ")}`:"updated"}function le(e,n,t,i,r,d,s){let g=new Set((s?.rows??[]).map(c=>c.matched_cid).filter(c=>!!c)),l=[];for(let[c,h]of t.superseded)h===null||c===h||n.superseded.has(c)||t.nodeLabel.get(c)===E.USECASE&&l.push({kind:"MODIFY",ref:R(t,c),old_cid:c,new_cid:h,summary:de(t,c,h)});let o=d.map(c=>({kind:"ADD",ref:R(t,c),cid:c}));for(let c of s?.rows??[])c.kind==="MODIFY"&&c.matched_cid?l.push({kind:"MODIFY",ref:R(t,c.matched_cid),old_cid:c.matched_cid,new_cid:null,summary:`${c.why} (staged)`}):c.kind==="ADD"&&o.push({kind:"ADD",ref:c.title,cid:null});let f=[],m=D(e,t,r),p=new Map;for(let{cid:c}of t.byLabel(E.USECASE)){if(!T(t,c)||g.has(c))continue;let h=t.derivesInto(c),v=h.filter(w=>String(w.props.source_id)===i);v.length===0||v.some(w=>w.props.source_cid===r)||v.some(w=>{let a=String(w.props.anchor),_=L(a);return _?.kind==="img-whole"?!1:_?.kind==="img-part"?se(t,w,r):m!==null&&re(e,t,w,m,p)})||h.some(w=>{let a=String(w.props.source_id);if(a===i)return!1;let _=t.heads.get(a);return _!=null})||f.push({kind:"ARCHIVE",ref:R(t,c),cid:c,why:`evidence decayed: no quote from ${i} relocates into @${k(r)}, no other live source, no fresh evidence this run`,impact:J(t,t.tipOf(c))})}let u=(c,h)=>c.ref<h.ref?-1:c.ref>h.ref?1:0;return[...l.sort(u),...o.sort(u),...f.sort(u)]}function Ee(e,n,t,i,r){let d=n.rows.find(u=>u.temp_ref===t);if(!d)return{ok:!1,message:`held item ${t} missing from the plan artifact`};let s=d,g=C(e);if(s.matched_cid){let u=g.tipOf(s.matched_cid);if(g.superseded.get(u)===null)return{ok:!1,message:`use-case for "${s.title}" was retired meanwhile \u2014 nothing to update`};u!==s.matched_cid&&(s={...s,matched_cid:u,uc:{...s.uc,matches_existing:{cid:u}}})}let l=r?{edited:r}:"approve",o=W(e,g,{source_id:n.source_id,...n.staged_source_cid!==void 0?{staged_source_cid:n.staged_source_cid}:{},rows:[s]},new Map([[s.temp_ref,l]]),i);if(o.errors)return{ok:!1,message:o.errors.map(u=>`${u.code}: ${u.detail}`).join("; ")};let f=C(e),m=s.matched_cid?f.tipOf(s.matched_cid):o.record?.nodes.find(u=>u.label==="usecase")?.cid??o.record?.review[0]?.id;return{ok:!0,ref:m?R(f,m):s.title,kind:s.kind}}async function be(e,n,t,i={}){let r=C(e),d=r.heads.get(n)??null,s=new Set(r.staleList().filter(a=>a.state==="stale").map(a=>a.cid)),g=await t.reingest(n);if(g.status==="unchanged"&&!i.resumeHeld)return{source_id:n,changed:!1,head:{status:g.status,before:d,after:g.cid},note:`nothing to reconcile \u2014 ${n} is unchanged`,skipped_arms:B,changeset:[],rows:[]};let l=i.resumeHeld?{minted:[],matched:[],held:i.resumeHeld}:await t.reextract(n),o=C(e),f=l.minted.map(a=>{let _=R(o,a);return{kind:"ADD",origin:"content-change",ref:_,reason:`new use-case extracted from ${n}`,provenance:`extraction commit \u2014 DERIVES ${n} @ ${k(g.cid)}`,action:`kane-cli design tests --use-case ${_}`}}),m=o.staleList().filter(a=>a.state==="stale"&&!s.has(a.cid)&&T(o,a.cid)).map(a=>a.cid),p=m.map(a=>{let _=R(o,a),b=ne.has(o.nodeLabel.get(a)??"");return{kind:"MODIFY",origin:"structural-stale",ref:_,reason:"stale (structural)",provenance:q(o,a),action:b?`kane-cli maintain evolve ${_}`:`kane-cli design explain ${_}`}}),u=[],c=[];for(let a of l.held?.rows??[])if(a.kind==="ADD")u.push({kind:"ADD",origin:"content-change",ref:a.title,held_ref:a.temp_ref,reason:`${a.why} (staged \u2014 commits on approval)`,provenance:`staged extraction of ${n} @ ${k(g.cid)}`,action:"approve to commit + design"});else{let _=a.matched_cid?o.tipOf(a.matched_cid):null,b=_?o.getNode(_)?.content.criteria??[]:[],I=(a.uc.updated?.criteria??[]).map(x=>typeof x=="string"?x:x.text),Q=[...I.filter(x=>!b.includes(x)),...a.uc.updated?.criteria!==void 0?b.filter(x=>!I.includes(x)):[]],H=_?J(o,_,Q):void 0;c.push({kind:"MODIFY",origin:"content-change",ref:a.matched_cid?R(o,a.matched_cid):a.title,held_ref:a.temp_ref,reason:`${a.why} (staged \u2014 commits on approval)`,provenance:`staged extraction of ${n} @ ${k(g.cid)}`,action:"approve to commit the updated version (old\u2192new redirect)",...H?{impact:H}:{}})}let h=new Set;for(let a of[...l.minted,...l.matched])h.add(o.tipOf(a));for(let a of l.held?.rows??[])a.matched_cid&&h.add(o.tipOf(a.matched_cid));for(let a of m){let _=Y(o,o.tipOf(a));_&&o.nodeLabel.get(_)===E.USECASE&&h.add(o.tipOf(_))}let v=[];for(let a of await
|
|
12
|
+
${s}`,truncated:!0}}function ae(e,n){let t=C(e),i=t.heads.get(n);if(typeof i!="string")return null;let r=[];for(let u of V(e).records){let c=u.source_head_moves?.[n];c!==void 0&&c!==r[r.length-1]&&r.push(c)}let d=r.lastIndexOf(i),s=d>0?r[d-1]:null;if(typeof s!="string"||s===i)return null;let g=D(e,t,s),l=D(e,t,i);if(g===null||l===null)return null;let{diff:o,truncated:f}=ce(oe(g,l)),m=new Set,p=[];for(let u of t.edgesFrom(s))u.type!==$.DERIVES||t.nodeLabel.get(u.dst)!==E.USECASE||m.has(u.dst)||(m.add(u.dst),p.push({id:u.dst,title:String(t.getNode(u.dst)?.content.title??"")}));return{source_id:n,old_head:s,new_head:i,diff:o,...f?{truncated:!0}:{},prior_ucs:p}}function de(e,n,t){let i=e.getNode(n)?.content??{},r=e.getNode(t)?.content??{},s=[...new Set([...Object.keys(i),...Object.keys(r)])].sort().filter(g=>JSON.stringify(i[g])!==JSON.stringify(r[g]));return s.length>0?`updated: ${s.join(", ")}`:"updated"}function le(e,n,t,i,r,d,s){let g=new Set((s?.rows??[]).map(c=>c.matched_cid).filter(c=>!!c)),l=[];for(let[c,h]of t.superseded)h===null||c===h||n.superseded.has(c)||t.nodeLabel.get(c)===E.USECASE&&l.push({kind:"MODIFY",ref:R(t,c),old_cid:c,new_cid:h,summary:de(t,c,h)});let o=d.map(c=>({kind:"ADD",ref:R(t,c),cid:c}));for(let c of s?.rows??[])c.kind==="MODIFY"&&c.matched_cid?l.push({kind:"MODIFY",ref:R(t,c.matched_cid),old_cid:c.matched_cid,new_cid:null,summary:`${c.why} (staged)`}):c.kind==="ADD"&&o.push({kind:"ADD",ref:c.title,cid:null});let f=[],m=D(e,t,r),p=new Map;for(let{cid:c}of t.byLabel(E.USECASE)){if(!T(t,c)||g.has(c))continue;let h=t.derivesInto(c),v=h.filter(w=>String(w.props.source_id)===i);v.length===0||v.some(w=>w.props.source_cid===r)||v.some(w=>{let a=String(w.props.anchor),_=L(a);return _?.kind==="img-whole"?!1:_?.kind==="img-part"?se(t,w,r):m!==null&&re(e,t,w,m,p)})||h.some(w=>{let a=String(w.props.source_id);if(a===i)return!1;let _=t.heads.get(a);return _!=null})||f.push({kind:"ARCHIVE",ref:R(t,c),cid:c,why:`evidence decayed: no quote from ${i} relocates into @${k(r)}, no other live source, no fresh evidence this run`,impact:J(t,t.tipOf(c))})}let u=(c,h)=>c.ref<h.ref?-1:c.ref>h.ref?1:0;return[...l.sort(u),...o.sort(u),...f.sort(u)]}function Ee(e,n,t,i,r){let d=n.rows.find(u=>u.temp_ref===t);if(!d)return{ok:!1,message:`held item ${t} missing from the plan artifact`};let s=d,g=C(e);if(s.matched_cid){let u=g.tipOf(s.matched_cid);if(g.superseded.get(u)===null)return{ok:!1,message:`use-case for "${s.title}" was retired meanwhile \u2014 nothing to update`};u!==s.matched_cid&&(s={...s,matched_cid:u,uc:{...s.uc,matches_existing:{cid:u}}})}let l=r?{edited:r}:"approve",o=W(e,g,{source_id:n.source_id,...n.staged_source_cid!==void 0?{staged_source_cid:n.staged_source_cid}:{},rows:[s]},new Map([[s.temp_ref,l]]),i);if(o.errors)return{ok:!1,message:o.errors.map(u=>`${u.code}: ${u.detail}`).join("; ")};let f=C(e),m=s.matched_cid?f.tipOf(s.matched_cid):o.record?.nodes.find(u=>u.label==="usecase")?.cid??o.record?.review[0]?.id;return{ok:!0,ref:m?R(f,m):s.title,kind:s.kind}}async function be(e,n,t,i={}){let r=C(e),d=r.heads.get(n)??null,s=new Set(r.staleList().filter(a=>a.state==="stale").map(a=>a.cid)),g=await t.reingest(n);if(g.status==="unchanged"&&!i.resumeHeld)return{source_id:n,changed:!1,head:{status:g.status,before:d,after:g.cid},note:`nothing to reconcile \u2014 ${n} is unchanged`,skipped_arms:B,changeset:[],rows:[]};let l=i.resumeHeld?{minted:[],matched:[],held:i.resumeHeld}:await t.reextract(n),o=C(e),f=l.minted.map(a=>{let _=R(o,a);return{kind:"ADD",origin:"content-change",ref:_,reason:`new use-case extracted from ${n}`,provenance:`extraction commit \u2014 DERIVES ${n} @ ${k(g.cid)}`,action:`kane-cli design tests --use-case ${_}`}}),m=o.staleList().filter(a=>a.state==="stale"&&!s.has(a.cid)&&T(o,a.cid)).map(a=>a.cid),p=m.map(a=>{let _=R(o,a),b=ne.has(o.nodeLabel.get(a)??"");return{kind:"MODIFY",origin:"structural-stale",ref:_,reason:"stale (structural)",provenance:q(o,a),action:b?`kane-cli maintain evolve ${_}`:`kane-cli design explain ${_}`}}),u=[],c=[];for(let a of l.held?.rows??[])if(a.kind==="ADD")u.push({kind:"ADD",origin:"content-change",ref:a.title,held_ref:a.temp_ref,reason:`${a.why} (staged \u2014 commits on approval)`,provenance:`staged extraction of ${n} @ ${k(g.cid)}`,action:"approve to commit + design"});else{let _=a.matched_cid?o.tipOf(a.matched_cid):null,b=_?o.getNode(_)?.content.criteria??[]:[],I=(a.uc.updated?.criteria??[]).map(x=>typeof x=="string"?x:x.text),Q=[...I.filter(x=>!b.includes(x)),...a.uc.updated?.criteria!==void 0?b.filter(x=>!I.includes(x)):[]],H=_?J(o,_,Q):void 0;c.push({kind:"MODIFY",origin:"content-change",ref:a.matched_cid?R(o,a.matched_cid):a.title,held_ref:a.temp_ref,reason:`${a.why} (staged \u2014 commits on approval)`,provenance:`staged extraction of ${n} @ ${k(g.cid)}`,action:"approve to commit the updated version (old\u2192new redirect)",...H?{impact:H}:{}})}let h=new Set;for(let a of[...l.minted,...l.matched])h.add(o.tipOf(a));for(let a of l.held?.rows??[])a.matched_cid&&h.add(o.tipOf(a.matched_cid));for(let a of m){let _=Y(o,o.tipOf(a));_&&o.nodeLabel.get(_)===E.USECASE&&h.add(o.tipOf(_))}let v=[];for(let a of await F(o,"design")){if(a.kind!=="no-verifies")continue;let _=o.resolve(a.ref);if(!_)continue;let b=Y(o,_.tip);!b||!h.has(o.tipOf(b))||v.push({kind:"ADD",origin:"content-change",ref:a.ref,reason:a.why,provenance:`gaps engine (design) \u2014 uncovered AC of touched use-case ${R(o,b)}`,action:a.ready_command})}let y=[];for(let{cid:a}of o.byLabel(E.USECASE))T(o,a)&&o.stale(a)==="orphaned"&&y.push({kind:"REMOVE",ref:R(o,a),reason:"orphaned \u2014 no live source evidences this use-case",provenance:q(o,a),action:"plan-only \u2014 REMOVE is not executed in this release"});let S=new Set,w=[...f.sort(O),...u.sort(O),...v.sort(O),...c.sort(O),...p.sort(O),...y.sort(O)].filter(a=>{let _=`${a.kind}\0${a.ref}`;return S.has(_)?!1:(S.add(_),!0)});return{source_id:n,changed:!0,head:{status:g.status,before:d,after:g.cid},note:te,skipped_arms:B,changeset:le(e,r,o,n,g.cid,l.minted,l.held),rows:w,...l.held?{held:l.held}:{}}}function ve(e,n){return async t=>{let{ingestFile:i}=await import("./ingest-CBQAXVH6.js"),{convertPdf:r}=await import("./pdf-convert-KYXI4FU4.js"),d=await i({contextDir:e,filePath:n,asId:t,pdfConverter:r});return{status:d.status,cid:d.cid}}}function Re(e,n={}){return async t=>{let i=[],[{runExtract:r},{resolveAgentAuthEnv:d},{runAgent:s},{preflightTurn:g}]=await Promise.all([import("./run-RYIYWV63.js"),import("./spawner-K7LWPNIC.js"),import("./bridge-D2HETW5M.js"),import("./turn-preflight-JGYT7LXP.js")]),l=await d(),o=new Set(C(e).byLabel(E.USECASE).map(S=>S.cid)),f=ae(e,t)??void 0,m=0,p=await r({mode:"override",...f?{changeContext:f}:{}},{contextDir:e,agent:s,preflightTurn:()=>g(l),ask:async()=>[],review:async S=>{if(!n.stage)return new Map(S.map(a=>[a.temp_ref,{resolution:a.matches_existing&&a.changed?"edited":"skipped"}]));let w=new Map;for(let a of S){if(a.matches_existing&&!a.changed){w.set(a.temp_ref,{resolution:"skipped"});continue}i.push({kind:a.matches_existing?"MODIFY":"ADD",temp_ref:a.temp_ref,title:a.title,why:a.matches_existing?`updated: ${Object.keys(a.updated??{}).join(", ")||"content"}`:`newly extracted from ${t}`,...a.matches_existing?{matched_cid:a.matches_existing.cid,updated:a.updated}:{},uc:a}),w.set(a.temp_ref,{resolution:"rejected"})}return w},confirmStale:async()=>!1,out:S=>process.stderr.write(S+`
|
|
13
13
|
`),progress:S=>process.stderr.write(S+`
|
|
14
14
|
`),emit:S=>{S.type==="commit"&&typeof S.assumed=="number"&&(m+=S.assumed)},isTTY:!1,auth:l});if(p!==0)throw new Error(`reconcile: re-extract of ${t} failed (exit ${p})`);let u=C(e),c=u.heads.get(t),h=[],v=[];if(typeof c=="string"){let S=new Set;for(let w of u.edgesFrom(c))w.type!==$.DERIVES||u.nodeLabel.get(w.dst)!==E.USECASE||S.has(w.dst)||(S.add(w.dst),!(n.stage&&u.trust.get(w.dst)==="archived")&&(o.has(w.dst)?v:h).push(w.dst))}let y=C(e).heads.get(t);return{minted:h,matched:v,defaultsTaken:m,...n.stage?{held:{source_id:t,...y!=null?{staged_source_cid:y}:{},rows:i}}:{}}}}export{Ee as a,be as b,ve as c,Re as d};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{e as M,f as R,h as j,i as y}from"./chunk-ZPDM6FO7.js";import{j as k}from"./chunk-L3HG5ONB.js";import{existsSync as A,mkdirSync as W,readdirSync as B,readFileSync as N,renameSync as E,writeFileSync as G}from"fs";import{join as p}from"path";var P=/^@import\s+(\S+)\s*$/;function O(e,n){let s=e.resolve(n),l=s?String(e.getNode(s.tip)?.content.title??""):"";return l&&k(l,()=>!1)||n}function D(e){return p(e,".testmuai","tests")}function L(e){let n=new Map;if(!A(e))return n;for(let s of B(e)){if(!s.endsWith("_test.md"))continue;let l=p(e,s);try{let r=y(N(l,"utf8"))?.id;r&&n.set(r,[...n.get(r)??[],l])}catch{}}return n}function q(e,n){let s=`${e}.tmp-mint`;G(s,n),E(s,e)}function U(e){let{graph:n,cids:s,cwd:l}=e,r=D(l),w=[],d=[],m=L(r),$=new Set,b=(t,f)=>{let c=m.get(t);if(c&&c.length>1)return d.push({id:t,reason:`two files claim assurance.id ${t}: ${c.join(" \xB7 ")} \u2014 resolve the duplicate first`}),null;if($.has(t))return I(t);if(f.includes(t))return I(t)??`${O(n,t)}_test.md`;let S=n.resolve(t),v=S?n.getNode(S.tip):void 0,x=v?.content.test_md_blob,F=v?.content.definitionId;if(!x||!F)return d.push({id:t,reason:`${t} has no test definition in the graph`}),null;let h=x.split(`
|
|
3
|
+
`).map(o=>{let i=P.exec(o.trim());if(!i)return o;let u=i[1];if(!n.resolve(u))return o;let _=b(u,[...f,t]);if(!_)throw new g(`dependency ${u} could not be minted/located`);return`@import ./${_}`}).join(`
|
|
4
|
+
`),T=`---
|
|
5
|
+
assurance:
|
|
6
|
+
id: ${t}
|
|
7
|
+
base: ${F}
|
|
8
|
+
---
|
|
9
|
+
${h.endsWith(`
|
|
10
|
+
`)?h:h+`
|
|
11
|
+
`}`,a=c?.[0];if(a){let o=N(a,"utf8"),i=y(o)?.base,u=M(R(o,j(r,n)));if(!i||u!==i)return d.push({id:t,reason:`${a} was edited since the engine last wrote it \u2014 keeping yours (reconcile via a run or maintain)`}),null}else{let o=O(n,t),i=p(r,`${o}_test.md`);for(let u=2;A(i);u++)i=p(r,`${o}-${u}_test.md`);a=i}return W(r,{recursive:!0}),q(a,T),$.add(t),m.set(t,[a]),w.push({id:t,path:a}),a.split("/").pop()},I=t=>m.get(t)?.[0]?.split("/").pop()??null;for(let t of s){let f=n.nameOf.get(t);if(!f){d.push({id:t,reason:"minted test has no logical id"});continue}try{b(f,[])}catch(c){if(c instanceof g)d.push({id:f,reason:c.message});else throw c}}return{wrote:w,refused:d}}var g=class extends Error{};export{D as a,L as b,U as c};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as J}from"./chunk-
|
|
2
|
+
import{b as J}from"./chunk-K7P6VNLI.js";import{e as H,g as P}from"./chunk-M5JQXOCE.js";import{a as ce}from"./chunk-6YGTRKDT.js";import{e as ue}from"./chunk-UR6MHSHU.js";var u=ue(ce(),1);function $(p,r){let f=null,R=(b,j)=>{for(let S=0;S<b.length;S++){let y=b[S],l=[...j,S];r(y)&&(f===null||l.length>f.length)&&(f=l),y.children&&y.children.length>0&&R(y.children,l)}};return R(p,[]),f}function T(p,r,f){if(r.length===0)return[...p];let R=r[0],b=[...p],j=b[R];if(r.length===1)b[R]=f(j);else{let S=r.slice(1),y=T(j.children??[],S,f);b[R]={...j,children:y}}return b}function K(){return{steps:[],maxOrdinal:0}}function le(p,r){if(r.type==="run_start"&&r.environment?.resolution)return{...p,resolution:r.environment.resolution};if(r.type==="step_end"&&typeof r.ordinal=="number"&&r.id){let f={id:r.id,ordinal:r.ordinal,status:r.status,...r.kind?{kind:r.kind}:{},...typeof r.duration=="number"?{duration_ms:Math.round(r.duration*1e3)}:{},...typeof r.action_id=="string"&&r.action_id?{action_id:r.action_id}:{}};return{...p,steps:[...p.steps,f],maxOrdinal:Math.max(p.maxOrdinal,r.ordinal)}}return p}function D(p){let r=p.indexOf(": ");return r>0&&r<15?p.slice(r+2):p}function W(p){return p.map(r=>{let f=r.children?W(r.children):r.children;return r.status==="running"?{...r,status:"stopped",phase:void 0,children:f}:f!==r.children?{...r,children:f}:r})}function Se(p,r,f,R,b){let[j,S]=(0,u.useState)(!1),[y,l]=(0,u.useState)([]),[Q,B]=(0,u.useState)(null),[X,F]=(0,u.useState)(null),[Y,w]=(0,u.useState)(null),[Z,L]=(0,u.useState)(null),[ee,q]=(0,u.useState)([]),[ne,G]=(0,u.useState)(null),[te,ie]=(0,u.useState)(void 0),m=(0,u.useRef)(null),x=(0,u.useRef)(null),_=(0,u.useRef)(0),A=(0,u.useRef)(!1),O=(0,u.useRef)(K()),re=(0,u.useCallback)(async(I,V)=>{let z=m.current;if(z){try{await z.exited}catch{}m.current=null}l([]),B(null),F(null),w(null),L(null),q([]),G(null),ie(I.max_steps),S(!0),x.current=null,_.current=0,O.current=K();let h;try{h=J(I,V)}catch(E){w(E instanceof Error?E.message:String(E)),S(!1);return}m.current=h,H("runner",()=>h.cancel()),(async()=>{A.current=!1;let E=!1;for await(let e of h.events){if(A.current)break;switch(O.current=le(O.current,e),e.type){case"run_start":if(e.child_id)break;if(x.current&&!x.current.isSingleFlow){let o=_.current;_.current++,l(d=>d.map((i,s)=>s===o?{...i,status:"running"}:i.status==="running"&&!i.children?.some(n=>n.status==="running")?{...i,status:i.children?.some(n=>n.status==="failed")?"failed":"passed"}:i))}break;case"bifurcation":{let o=e.flows??[],d=e.count??o.length,i={flows:o,isSingleFlow:e.is_single_flow??d<=1};L(i),x.current=i,_.current=0,l(o.map((s,n)=>({index:n+1,objective:s??`Flow ${n+1}`,status:"pending"})));break}case"step_start":{r?.("STEP_START",`Step ${e.index} started`,{index:e.index,objective:e.objective,child_id:e.child_id});let o=e.index,d=e.objective??`Step ${o}`,i=e.child_id,s=x.current&&!x.current.isSingleFlow;if(i)l(n=>{let t=$(n,a=>a.branchChildId===i)??$(n,a=>a.status==="running");return t?T(n,t,a=>{let c=(a.children??[]).map(g=>g.status==="running"&&g.childId===i?{...g,status:"stopped",phase:void 0}:g);return c.push({index:o,objective:d,status:"running",childId:i}),{...a,children:c}}):n});else if(s){let n=Math.max(0,_.current-1);l(t=>{let a=[...t];if(n>=a.length)return t;let c={...a[n]},k=[...c.children??[]].map(U=>U.status==="running"&&U.childId===void 0?{...U,status:"stopped",phase:void 0}:U);return k.push({index:o,objective:d,status:"running"}),c.children=k,c.status="running",a[n]=c,a})}else l(n=>{let t=W(n);return t.some(c=>c.index===o)?t.map(c=>c.index===o?{...c,status:"running",objective:d}:c):[...t,{index:o,objective:d,status:"running"}]});break}case"step_event":{r?.("STEP_EVENT",`Step ${e.index} ${e.event}`,{index:e.index,phase:e.event,action_type:e.action_type,detail:e.detail,child_id:e.child_id});let o=e.child_id,d=x.current&&!x.current.isSingleFlow;if(e.event==="cm_init"&&e.checkpoint_count!=null){q(i=>[...i,e.checkpoint_count]);break}if(e.event==="replay_started"){G({recordingLength:e.recording_length??0});break}if(e.event==="reasoning"&&e.detail&&e.detail!=="reasoning"&&f?.(e.detail),o){let i=n=>{if(n.index!==e.index||n.childId!==o)return n;let t={phase:e.event};return e.event==="reasoning"&&e.detail&&e.detail!=="reasoning"&&(t.objective=e.detail),e.action_type&&(t.actionType=e.action_type),{...n,...t}},s=n=>n.map(t=>{let a=i(t);return a!==t?a:t.children&&t.children.length>0?{...t,children:s(t.children)}:t});l(n=>n.map(t=>t.children?{...t,children:s(t.children)}:t))}else if(d){let i=Math.max(0,_.current-1);l(s=>{let n=[...s];if(i>=n.length)return s;let t={...n[i]},a=[...t.children??[]];if(!a.some(g=>g.index===e.index&&g.childId===void 0))a.push({index:e.index,objective:`Step ${e.index}`,status:"running",phase:e.event,actionType:e.action_type});else for(let g=0;g<a.length;g++){if(a[g].index!==e.index||a[g].childId!==void 0)continue;let k={phase:e.event};e.event==="reasoning"&&e.detail&&e.detail!=="reasoning"&&(k.objective=e.detail),e.action_type&&(k.actionType=e.action_type),a[g]={...a[g],...k}}return t.children=a,n[i]=t,n})}else l(i=>i.some(n=>n.index===e.index)?i.map(n=>{if(n.index!==e.index)return n;let t={phase:e.event};return e.event==="reasoning"&&e.detail&&e.detail!=="reasoning"&&(t.objective=e.detail),e.action_type&&(t.actionType=e.action_type),{...n,...t}}):[...W(i),{index:e.index,objective:`Step ${e.index}`,status:"running",phase:e.event,actionType:e.action_type}]);break}case"step_end":{r?.("STEP_END",`Step ${e.index} ${e.status}`,{index:e.index,status:e.status,duration:e.duration,summary:e.summary,child_id:e.child_id}),R?.();let o=e.child_id,d=x.current&&!x.current.isSingleFlow;if(o){let i=n=>n.index===e.index&&n.childId===o?{...n,status:e.status,duration:e.duration,phase:void 0,objective:n.objective.startsWith("Step ")?D(e.summary||n.objective):n.objective}:n,s=n=>n.map(t=>{let a=i(t);return a!==t?a:t.children&&t.children.length>0?{...t,children:s(t.children)}:t});l(n=>n.map(t=>t.children?{...t,children:s(t.children)}:t))}else if(d){let i=Math.max(0,_.current-1);l(s=>{let n=[...s];if(i>=n.length)return s;let t={...n[i]},a=(t.children??[]).map(c=>c.index===e.index&&c.childId===void 0?{...c,status:e.status,duration:e.duration,phase:void 0,objective:c.objective.startsWith("Step ")?D(e.summary||c.objective):c.objective}:c);return t.children=a,n[i]=t,n})}else l(i=>i.map(s=>s.index===e.index?{...s,status:e.status,duration:e.duration,phase:void 0,objective:s.objective.startsWith("Step ")?D(e.summary||s.objective):s.objective}:s));{let s=x.current&&!x.current.isSingleFlow?Math.max(0,_.current-1):0,n=typeof e.ordinal=="number"&&e.id?{ordinal:e.ordinal,id:e.id}:void 0;p?.(e.index,s,e.child_id,n)}break}case"child_agent_start":{let o=e.objective??"",d=e.child_id;l(i=>{let s=$(i,n=>n.status==="running");return s?T(i,s,n=>({...n,objective:`${o} (branch)`,phase:`child: ${o.slice(0,50)}`,branchObjective:o,branchChildId:d})):i});break}case"child_agent_end":{let o=e.child_id,d=`child ${e.success?"done":"failed"}`;l(i=>{let s=$(i,n=>n.branchChildId===o);return s?T(i,s,n=>({...n,phase:d})):i.map(n=>n.phase?.startsWith("child:")?{...n,phase:d}:n)});break}case"describe_trigger":b?.(e);break;case"ask_user":B(e.question??"");break;case"run_end":l(o=>o.map(d=>d.status==="running"?{...d,status:e.status,phase:void 0}:d)),S(!1),F(e),E=!0;break;case"error":S(!1),w(e.message??"Runner error"),l(o=>o.map(d=>d.status==="running"?{...d,status:"failed",phase:void 0}:d));break}}let{code:v,signal:M}=await h.exited,N=h.stderr,de=v===0&&!M,C=[];v!==null&&v!==0&&C.push(`Runner exited with code ${v}`),M&&C.push(`Runner killed by signal ${M}`),N&&(!de||!E?C.push(N):V?.log?.("debug","RUNNER_STDERR_BENIGN","Runner stderr on clean exit",{stderr:N})),m.current===h&&(C.length>0&&w(C.join(`
|
|
3
3
|
`)),S(!1),P("runner","Event stream ended"),m.current=null)})().catch(E=>{let v=[`Runner event loop error: ${E}`];h.exitCode!==null&&h.exitCode!==0&&v.push(`Exit code: ${h.exitCode}`),h.exitSignal&&v.push(`Signal: ${h.exitSignal}`),h.stderr&&v.push(h.stderr),m.current===h&&(w(v.join(`
|
|
4
4
|
`)),S(!1),P("runner","Event loop error"),m.current=null)})},[p,r,f,R,b]),se=(0,u.useCallback)(I=>{m.current?.sendUserResponse(I),B(null)},[]),ae=(0,u.useCallback)(()=>{let I=m.current;I&&(I.sendCancel("user"),S(!1),B(null),setTimeout(()=>{m.current===I&&(P("runner","User cancelled run"),m.current=null)},5e3))},[]),oe=(0,u.useCallback)(()=>{l([]),F(null),w(null)},[]);return(0,u.useEffect)(()=>()=>{A.current=!0,P("runner","Component unmounted"),m.current=null},[]),{isRunning:j,steps:y,askingUser:Q,lastRunEnd:X,runError:Y,bifurcationInfo:Z,cmInitCounts:ee,replayInfo:ne,maxSteps:te,startRun:re,sendAnswer:se,cancelRun:ae,clearLastRun:oe,getEvidenceState:()=>O.current}}export{K as a,le as b,Se as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{y as m}from"./chunk-
|
|
2
|
+
import{y as m}from"./chunk-PXPXK4Q7.js";import{a as x}from"./chunk-HCBYKLMW.js";import{a as u,b as a,j as g}from"./chunk-C44QQJR4.js";import{a as b}from"./chunk-6YGTRKDT.js";import{e as f}from"./chunk-UR6MHSHU.js";var T=f(b(),1);function k(i,n){if(!n)return i;let l=i.trim()||n;return`\x1B]8;;${n}\x07${l}\x1B]8;;\x07`}var r=f(x(),1);function $({shareableLink:i,testCaseLink:n,codeExportDir:l,recordedTestPath:s,outputDir:o,autoExit:p=!0}){let{exit:c}=g();(0,T.useEffect)(()=>{if(!p)return;let t=setTimeout(()=>c(),100);return()=>clearTimeout(t)},[c,p]);let e=[];return s&&e.push({label:"Test",url:s,linkUrl:`file://${s}`}),o&&e.push({label:"Output",url:o,linkUrl:`file://${o}`}),i&&e.push({label:"ShareLink",url:i}),n&&e.push({label:"TestCase",url:n}),l&&!o&&e.push({label:"CodeExport",url:l,linkUrl:`file://${l}`}),e.length===0?(0,r.jsx)(r.Fragment,{}):(0,r.jsx)(u,{flexDirection:"column",marginTop:1,marginLeft:1,children:e.map(t=>(0,r.jsxs)(u,{flexDirection:"column",marginBottom:1,children:[(0,r.jsxs)(a,{color:m.orange,children:[t.label,":"]}),(0,r.jsx)(a,{color:m.dim,children:k(t.url,t.linkUrl??t.url)})]},t.label))})}export{$ as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as $e}from"./chunk-
|
|
2
|
+
import{c as $e}from"./chunk-TAUSKB3O.js";import{a as te}from"./chunk-N5YIMTGV.js";import{a as K}from"./chunk-5Y2G4NC7.js";import{a as Be}from"./chunk-F4FXE466.js";import{a as ve}from"./chunk-GO4CBUB6.js";import{b as ye}from"./chunk-DFS4RMVP.js";import{y as i}from"./chunk-PXPXK4Q7.js";import{a as k}from"./chunk-HCBYKLMW.js";import{a as s,b as o,i as Se,j as Te,k as ee}from"./chunk-C44QQJR4.js";import{a as V}from"./chunk-6YGTRKDT.js";import{e as R}from"./chunk-UR6MHSHU.js";var A=R(V(),1);var C=R(V(),1);function de(e){let t=e.flatMap(u=>[u,...u.children??[]]),n=t.filter(u=>u.status==="passed").length,l=t.filter(u=>u.status==="failed").length,a=t.filter(u=>u.status==="passed"||u.status==="failed").length;return{passed:n,failed:l,total:a}}function we(e){let t=$e(e.screenshotDispatcher,e.stepLogger,e.onReasoning,e.onStepComplete),[n,l]=(0,C.useState)(0),[a,u]=(0,C.useState)("idle"),c=(0,C.useRef)("idle"),v=(0,C.useRef)(0),S=(0,C.useRef)(!1),T=(0,C.useRef)(null),d=(0,C.useRef)(null),L=(0,C.useCallback)(h=>{c.current=h,u(h)},[]),O=(0,C.useCallback)(async h=>{let b=await e.getNextConfig(h);if(!b){L("done"),e.onAllComplete?.();return}let B=h?v.current+1:0;v.current=B,l(B),e.onStepStart?.(b,B),T.current=null,d.current=null,L("running"),await t.startRun(b,e.spawnOpts)},[t,e,L]);(0,C.useEffect)(()=>{S.current||(S.current=!0,O(null))},[]),(0,C.useEffect)(()=>{if(!t.lastRunEnd||t.lastRunEnd===T.current||c.current!=="running")return;T.current=t.lastRunEnd,c.current="transitioning",u("transitioning");let h=t.lastRunEnd,b=de(t.steps),B=t.bifurcationInfo,F={status:h.status==="passed"?"passed":"failed",duration_s:h.duration??0,reason:h.reason,runEnd:h,hadError:!1,stepsPassed:b.passed,stepsFailed:b.failed,stepsTotal:b.total,bifurcationFlows:B&&!B.isSingleFlow?B.flows:null,evidence:t.getEvidenceState()};if(!(e.onStepEnd?.(F,v.current)??!0)){L("done"),e.onAllComplete?.();return}O(F)},[t.lastRunEnd]),(0,C.useEffect)(()=>{if(!t.runError||t.runError===d.current||t.lastRunEnd||c.current!=="running")return;d.current=t.runError,c.current="transitioning",u("transitioning");let h=de(t.steps),b={status:"failed",duration_s:0,reason:t.runError,runEnd:null,hadError:!0,stepsPassed:h.passed,stepsFailed:h.failed,stepsTotal:h.total,bifurcationFlows:null,evidence:t.getEvidenceState()};if(!(e.onStepEnd?.(b,v.current)??!0)){L("done"),e.onAllComplete?.();return}O(b)},[t.runError,t.lastRunEnd]);let y=(0,C.useCallback)(()=>{t.cancelRun()},[t]);return{runner:t,currentStepIndex:n,phase:a,cancel:y}}var pe=R(V(),1);var ne=R(k(),1),Ee=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function ke({label:e,hasBifurcation:t=!1}){let[n,l]=(0,pe.useState)(0),[a,u]=(0,pe.useState)(0);K(()=>{l(v=>(v+1)%Ee.length)},80),K(()=>{u(v=>(v+1)%4)},400);let c=e??(t?"Planning approach":"Analyzing objective");return(0,ne.jsxs)(s,{marginLeft:1,children:[(0,ne.jsxs)(o,{color:i.orange,children:[Ee[n]," "]}),(0,ne.jsxs)(o,{color:i.dim,children:[c,".".repeat(a+1)]})]})}function Ie(e){if(!e.isRunning||e.replayInfo)return null;let t=e.bifurcationInfo;if(t&&!t.isSingleFlow){let n=e.steps.findIndex(a=>a.status==="running");return(n===-1?e.cmInitCounts.length===0:n>=e.cmInitCounts.length)?{label:n>0?`Planning flow ${n+1}`:void 0,hasBifurcation:!0}:null}return e.cmInitCounts.length>0||e.steps.some(n=>n.children?.length)?null:{hasBifurcation:!!t}}var I=R(V(),1);var Ce=R(V(),1);var re=R(k(),1),He="#ffc580",Ue="#ffd9a8",Le="#ffffff";function oe({text:e,active:t=!0}){let[n,l]=(0,Ce.useState)(0),a=4;if(K(()=>{l(c=>(c+1)%(e.length+a*2))},t?80:null),!t)return(0,re.jsx)(o,{color:Le,children:e});let u=e.split("").map((c,v)=>{let S=n-a,T=Math.abs(v-S-a/2),d;return T<=a/2?d=He:T<=a?d=Ue:d=Le,(0,re.jsx)(o,{color:d,children:c},v)});return(0,re.jsx)(o,{children:u})}var _=R(k(),1),We={starting:i.orange,running:i.orange,passed:i.green,failed:i.red,cancelled:i.dim,timed_out:i.orange};function ie({currentStep:e,maxSteps:t,elapsed:n,status:l}){let a=We[l]??i.orange,u=n<60?`${n.toFixed(1)}s`:`${Math.floor(n/60)}m ${Math.round(n%60)}s`;return(0,_.jsxs)(s,{marginLeft:3,children:[(0,_.jsx)(o,{color:i.dim,children:"Steps "}),(0,_.jsx)(o,{bold:!0,children:e}),(0,_.jsxs)(o,{color:i.dim,children:["/",t]}),(0,_.jsx)(o,{children:" "}),(0,_.jsx)(o,{color:i.dim,children:"Elapsed "}),(0,_.jsx)(o,{bold:!0,children:u}),(0,_.jsx)(o,{children:" "}),(0,_.jsx)(o,{color:i.dim,children:"Status "}),(0,_.jsx)(o,{bold:!0,color:a,children:l})]})}var Ve={click:"\u25CF",type:"\u229E",scroll:"\u2195",navigate:"\u2192",analyze:"\u25CE",assert:"\u25C8","if-else":"\u2442",select:"\u25BC",press_key:"\u21B5",wait:"\u2026",tool_call:"\u2299"};function Oe(e){return Ve[e]??"\u25CF"}var q=R(k(),1);function fe({steps:e,flows:t,cmInitCounts:n,renderStep:l}){return(0,q.jsxs)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:[(0,q.jsxs)(o,{color:i.dim,children:["\u2501\u2501 Bifurcated into ",t?.length??e.length," flows \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"]}),e.map((a,u)=>(0,q.jsxs)(s,{flexDirection:"column",marginTop:u>0?1:0,children:[(0,q.jsxs)(o,{color:i.orange,children:["Flow ",u+1,": ",t?.[u]??a.objective]}),n&&n[u]!=null&&(0,q.jsxs)(o,{color:i.dim,children:[" \u25AA Generated task with ",n[u]," checkpoints"]}),a.children&&a.children.length>0?a.children.map(c=>{let v=!!c.branchObjective,S=`f${u}-${c.childId??"p"}-${c.index}`;return v?(0,q.jsxs)(s,{flexDirection:"column",children:[l({...c,children:void 0},S),(c.children??[]).map(T=>(0,q.jsx)(s,{marginLeft:2,children:l(T,`${S}-${T.childId??"p"}-${T.index}`)},`${S}-${T.childId??"p"}-${T.index}`))]},`${S}-host`):l(c,S)}):a.status==="pending"&&(0,q.jsx)(o,{color:i.dim,children:" \u25CB Waiting..."})]},u))]})}var H=R(k(),1);function Pe({label:e,shimmer:t=!1}){return(0,H.jsxs)(s,{marginLeft:6,children:[(0,H.jsx)(te,{}),(0,H.jsx)(o,{children:" "}),t?(0,H.jsx)(oe,{text:e,active:!0}):(0,H.jsx)(o,{color:i.dim,children:e})]})}var De=R(V(),1);var me=R(k(),1);function ze(e,t){let n=[];for(let l of e.split(`
|
|
3
3
|
`)){if(l===""){n.push("");continue}let a="";for(let u of l.split(" ")){let c=u;for(;c.length>t;)a&&(n.push(a),a=""),n.push(c.slice(0,t)),c=c.slice(t);a===""?a=c:a.length+1+c.length<=t?a+=" "+c:(n.push(a),a=c)}n.push(a)}return n}function je({text:e,maxLines:t=3}){let{stdout:n}=ee(),l=Math.max(20,(n?.columns??80)-7),a=!e.trim(),[u,c]=(0,De.useState)(!0);K(()=>c(T=>!T),500);let v=(a?"Thinking\u2026":e)+(u?"\u258C":" "),S=ze(v,l).slice(-t);for(;S.length<t;)S.push("");return(0,me.jsx)(s,{borderStyle:"round",borderColor:i.muted,paddingX:1,marginLeft:3,flexDirection:"column",children:S.map((T,d)=>(0,me.jsx)(o,{color:a?i.dim:i.secondary,wrap:"truncate-end",children:T.length?T:" "},d))})}var U=R(k(),1);function se({activity:e,describe:t,describeVisible:n}){return(0,U.jsxs)(U.Fragment,{children:[e?(0,U.jsx)(Pe,{label:e.label,shimmer:e.shimmer}):null,n?(0,U.jsx)(je,{text:t??""}):null]})}var r=R(k(),1);function le(e){for(let t of e){if(t.children&&t.children.length>0){let n=le(t.children);if(n)return n}if(t.status==="running")return t}}function z(e){return e.status==="running"&&!e.branchObjective&&(!e.children||e.children.length===0)}function Fe(e){let t=[];for(let n of e)z(n)||(n.children&&n.children.length>0?t.push({...n,children:Fe(n.children)}):t.push(n));return t}function ge(e,t){if(!e)return null;let n=e.objective??"";return n.length>0&&!/^Step \d+$/.test(n)?{label:n+"\u2026",shimmer:!1}:{label:t?"Looking at the screen\u2026":"Deciding next action\u2026",shimmer:!0}}function P({step:e,indent:t=2}){let n=e.actionType?Oe(e.actionType):null,l=e.status==="running",a=e.status==="passed",u=e.status==="failed",c=e.status==="pending"||e.status==="stopped",{stdout:v}=ee(),S=v?.columns??80,T=Math.max(20,S-t-21),d=e.objective??"",L=d.length>T?d.slice(0,T-1)+"\u2026":d,O=(e.duration??0)*1e3,y=e.duration!=null?O<1e3?`${Math.round(O)}ms`:`${(O/1e3).toFixed(1)}s`:"";return(0,r.jsxs)(s,{flexDirection:"column",children:[(0,r.jsxs)(s,{marginLeft:t,children:[(0,r.jsx)(s,{width:4,children:(0,r.jsxs)(o,{color:i.muted,children:[String(e.index).padStart(2," ")," "]})}),(0,r.jsx)(s,{width:3,children:l?(0,r.jsx)(te,{}):a?(0,r.jsx)(o,{color:i.green,bold:!0,children:"\u2713"}):u?(0,r.jsx)(o,{color:i.red,bold:!0,children:"\u2717"}):(0,r.jsx)(o,{color:i.muted,children:"\u25CB"})}),(0,r.jsx)(s,{flexGrow:1,children:l?(0,r.jsx)(oe,{text:L,active:!0}):u?(0,r.jsx)(o,{color:i.red,children:L}):c?(0,r.jsx)(o,{color:i.dim,children:L}):(0,r.jsx)(o,{color:i.dim,children:L})}),(a||u)&&n?(0,r.jsx)(s,{width:3,marginLeft:1,children:(0,r.jsx)(o,{color:i.muted,children:n})}):(0,r.jsx)(s,{width:3,marginLeft:1}),(0,r.jsx)(s,{width:7,justifyContent:"flex-end",children:(0,r.jsx)(o,{color:i.dim,children:y})})]}),e.children&&e.children.length>0&&(0,r.jsx)(s,{flexDirection:"column",children:e.children.map((h,b)=>(0,r.jsx)(P,{step:h,indent:t+2},`child-${b}`))})]})}function Xe(e){return e.type==="cm_init"?(0,r.jsx)(s,{marginLeft:2,paddingLeft:1,children:(0,r.jsxs)(o,{color:i.dim,children:["\u25AA Generated task with ",e.count," checkpoints"]})}):(0,r.jsx)(s,{marginLeft:2,paddingLeft:1,children:(0,r.jsx)(P,{step:e.step})})}function _e({steps:e,bifurcated:t,flows:n,cmInitCounts:l,maxSteps:a=50,staticSteps:u=!1,onStepCommit:c,describe:v,describeVisible:S,describeRevealing:T}){let d=(0,I.useRef)(new Set),L=(0,I.useRef)(!1),O=(0,I.useRef)(new Set),y=(0,I.useRef)(!1),h=(0,I.useRef)(new Set),b=(0,I.useRef)(0);(0,I.useEffect)(()=>{e.length===0&&b.current>0&&(d.current.clear(),L.current=!1,O.current.clear(),y.current=!1,h.current.clear()),b.current=e.length},[e.length]);let B=e.flatMap(p=>[p,...p.children??[]]),F=B.some(p=>p.status==="running"),M=B.some(p=>p.status==="failed"),X=B.length===0||B.every(p=>p.status==="pending"),Y=B.filter(p=>p.status==="passed"||p.status==="failed").length,N;X?N="starting":F?N="running":M?N="failed":N="passed";let J=(0,I.useRef)(null),[ce,he]=(0,I.useState)(0);(0,I.useEffect)(()=>{B.length===0||X?(J.current=null,he(0)):F&&J.current==null&&(J.current=Date.now())},[F,X,B.length]),(0,I.useEffect)(()=>{if(!F)return;let p=setInterval(()=>{J.current!=null&&he((Date.now()-J.current)/1e3)},500);return()=>clearInterval(p)},[F]);let ae=(0,I.useRef)(new Set),[,xe]=(0,I.useState)(0),be=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(!c||!u||t)return;let p=[];!be.current&&l&&l[0]!=null&&(be.current=!0,l[0]>0&&p.push({key:"cm_init_0",type:"cm_init",count:l[0]}));for(let g of e)(g.status==="passed"||g.status==="failed")&&!ae.current.has(g.index)&&(ae.current.add(g.index),p.push({key:`step_${g.index}`,type:"step",step:{...g,children:g.children?[...g.children]:void 0}}));if(p.length>0){for(let g of p)c(Xe(g));xe(g=>g+1)}},[e,t,l,u,c]),(0,I.useEffect)(()=>{if(!c||u)return;let p=d.current.size;if(!t&&!y.current&&l&&l[0]!=null&&(y.current=!0,l[0]>0&&c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsxs)(o,{color:i.dim,children:["\u25A0 Generated task with ",l[0]," checkpoints"]})}))),t&&n&&!L.current&&(L.current=!0,c((0,r.jsx)(o,{color:i.purple,children:"\u2501\u2501 Bifurcated into "+n.length+" flows \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"}))),t){let g=e.flatMap((x,f)=>{let m=x.children??[];return!O.current.has(f)&&m.length>0&&(O.current.add(f),c((0,r.jsx)(o,{color:i.purple,children:" Flow "+(f+1)+": "+(n?.[f]??"")})),l?.[f]!=null&&l[f]>0&&!h.current.has(f)&&(h.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsxs)(o,{color:i.dim,children:[" \u25AA Generated task with ",l[f]," checkpoints"]})})))),l?.[f]!=null&&l[f]>0&&O.current.has(f)&&!h.current.has(f)&&(h.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsxs)(o,{color:i.dim,children:[" \u25AA Generated task with ",l[f]," checkpoints"]})}))),m});for(let x of g){let f=`${x.childId??"p"}-${x.index}-${x.objective}`;if(!!x.branchObjective){d.current.has(f)||(d.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:{...x,children:void 0}})})));for(let $ of x.children??[]){let w=`child-${x.childId??"p"}-${x.index}-${$.childId??"p"}-${$.index}-${$.objective}`;d.current.has(w)||($.status==="passed"||$.status==="failed"||$.status==="stopped")&&(d.current.add(w),c((0,r.jsx)(s,{marginLeft:4,children:(0,r.jsx)(P,{step:$})})))}continue}d.current.has(f)||(x.status==="passed"||x.status==="failed"||x.status==="stopped")&&(d.current.add(f),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:x})})))}}else for(let g of e){let x=`${g.index}-${g.objective}`,f=!!g.branchObjective;f&&!d.current.has(x)&&(d.current.add(x),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:{...g,children:void 0}})})));for(let m of g.children??[]){let $=`child-${g.index}-${m.childId??"p"}-${m.index}-${m.objective}`;d.current.has($)||(m.status==="passed"||m.status==="failed"||m.status==="stopped")&&(d.current.add($),c((0,r.jsx)(s,{marginLeft:4,children:(0,r.jsx)(P,{step:m})})))}!f&&!d.current.has(x)&&(g.status==="passed"||g.status==="failed"||g.status==="stopped")&&(d.current.add(x),c((0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:{...g,children:void 0}})})))}d.current.size>p&&xe(g=>g+1)},[e,c,t,n,l]);let G=[];if(u&&!t)for(let p of e)ae.current.has(p.index)||G.push(p);else if(c&&!u)if(t)for(let p of e){let g=p.children??[],x=[];for(let f of g){let m=`${f.childId??"p"}-${f.index}-${f.objective}`,$=d.current.has(m);if(f.branchObjective){let w=(f.children??[]).filter(Q=>{let ue=`child-${f.childId??"p"}-${f.index}-${Q.childId??"p"}-${Q.index}-${Q.objective}`;return!d.current.has(ue)});(!$||w.length>0)&&x.push({...f,children:w})}else $||x.push(f)}x.length>0&&G.push({...p,children:x})}else for(let p of e){let g=`${p.index}-${p.objective}`,x=d.current.has(g),f=(p.children??[]).filter(m=>{let $=`child-${p.index}-${m.childId??"p"}-${m.index}-${m.objective}`;return!d.current.has($)});x?f.length>0&&G.push({...p,children:f}):G.push({...p,children:f})}if(!u){let p=c?G:e,g=le(p),x=ge(g,T);return(0,r.jsxs)(s,{flexDirection:"column",children:[t?c?p.length>0?(0,r.jsx)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:p.map((m,$)=>(0,r.jsx)(s,{flexDirection:"column",marginTop:$>0?1:0,children:m.children&&m.children.length>0?m.children.map(w=>{if(z(w))return null;let Q=!!w.branchObjective,ue=`${w.childId??"p"}-${w.index}-${w.objective}`,Ke=d.current.has(ue);return Q?(0,r.jsxs)(s,{flexDirection:"column",children:[!Ke&&(0,r.jsx)(P,{step:{...w,children:void 0}}),(w.children??[]).filter(Z=>!z(Z)).map(Z=>(0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:Z})},`f${$}-${w.index}-${Z.childId??"p"}-${Z.index}`))]},`f${$}-host-${w.childId??"p"}-${w.index}`):(0,r.jsx)(P,{step:w},`f${$}-${w.childId??"p"}-${w.index}`)}):m.status==="pending"&&(0,r.jsx)(o,{color:i.dim,children:" \u25CB Waiting..."})},$))}):null:(0,r.jsx)(fe,{steps:e,flows:n,cmInitCounts:l,renderStep:(m,$)=>z(m)?null:(0,r.jsx)(P,{step:m},$)}):(0,r.jsxs)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:[!c&&l&&l[0]!=null&&(0,r.jsxs)(o,{color:i.dim,children:["\u25AA Generated task with ",l[0]," checkpoints"]}),p.filter(m=>!(m.status==="running"&&(!m.children||m.children.length===0))).map(m=>{let $=`${m.index}-${m.objective}`;return c&&d.current.has($)?(0,r.jsx)(s,{flexDirection:"column",children:(m.children??[]).filter(w=>!z(w)).map(w=>(0,r.jsx)(s,{marginLeft:2,children:(0,r.jsx)(P,{step:w})},`${w.childId??"p"}-${w.index}`))},`branch-children-${m.index}`):(0,r.jsx)(P,{step:m},m.index)})]}),(0,r.jsx)(se,{activity:x,describe:v,describeVisible:S}),B.length>0&&(0,r.jsx)(ie,{currentStep:Y,maxSteps:a,elapsed:ce,status:N})]})}if(t){let p=le(e),g=ge(p,T);return(0,r.jsxs)(s,{flexDirection:"column",children:[(0,r.jsx)(fe,{steps:e,flows:n,cmInitCounts:l,renderStep:(x,f)=>z(x)?null:(0,r.jsx)(P,{step:x},f)}),(0,r.jsx)(se,{activity:g,describe:v,describeVisible:S}),B.length>0&&(0,r.jsx)(ie,{currentStep:Y,maxSteps:a,elapsed:ce,status:N})]})}let Ne=le(G),Ge=ge(Ne,T),Re=Fe(G);return(0,r.jsxs)(s,{flexDirection:"column",children:[Re.length>0&&(0,r.jsx)(s,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:Re.map(p=>(0,r.jsx)(P,{step:p},p.index))}),(0,r.jsx)(se,{activity:Ge,describe:v,describeVisible:S}),B.length>0&&(0,r.jsx)(ie,{currentStep:Y,maxSteps:a,elapsed:ce,status:N})]})}var W=R(k(),1);function Ae({runner:e,runKey:t,onStepCommit:n}){let l=Ie({isRunning:e.isRunning,bifurcationInfo:e.bifurcationInfo,steps:e.steps,cmInitCounts:e.cmInitCounts,replayInfo:e.replayInfo});return(0,W.jsxs)(W.Fragment,{children:[l&&(0,W.jsx)(ke,{label:l.label,hasBifurcation:l.hasBifurcation}),e.isRunning&&e.steps.length>0&&(0,W.jsx)(_e,{steps:e.steps,bifurcated:!!e.bifurcationInfo&&!e.bifurcationInfo.isSingleFlow,flows:e.bifurcationInfo?.flows,cmInitCounts:e.cmInitCounts,maxSteps:e.maxSteps,onStepCommit:n},`run-${t}`)]})}var D=R(k(),1),Ye=64;function Je(e){return e.split(`
|
|
4
4
|
`).map(t=>t.replace(/^[-–•]\s*/,"").trim()).filter(t=>t.length>0)}function qe({status:e,summary:t,duration:n,steps:l,stepsPassed:a,stepsFailed:u,reason:c,creditsConsumed:v}){let S=e==="passed",T=S?i.green:i.red,d=S?"\u2713":"\u2717",L=e.toUpperCase(),O=a??(S?l:Math.max(0,l-1)),y=u??(S?0:1),h=y>0?`${l} steps (${O} passed, ${y} failed)`:`${l} steps`,b=n<60?`${n.toFixed(1)}s`:`${Math.floor(n/60)}m ${Math.round(n%60)}s`,B=Je(t);return(0,D.jsx)(s,{flexDirection:"column",marginTop:1,children:(0,D.jsxs)(s,{borderStyle:"round",borderColor:T,flexDirection:"column",paddingX:2,paddingY:1,width:Ye+6,children:[(0,D.jsxs)(s,{flexDirection:"column",children:[(0,D.jsxs)(o,{bold:!0,color:T,children:[d," ",L]}),(0,D.jsxs)(o,{color:i.dim,wrap:"wrap",children:[h," \xB7 ",b,typeof v=="number"&&v>0?` \xB7 ${parseFloat(v.toFixed(4))} credits`:""]})]}),B.length>0&&(0,D.jsx)(s,{flexDirection:"column",marginTop:1,marginLeft:1,children:B.map((F,M)=>(0,D.jsxs)(s,{marginBottom:M<B.length-1?1:0,children:[(0,D.jsx)(o,{color:i.orange,children:"\u25CF "}),(0,D.jsx)(s,{flexShrink:1,children:(0,D.jsx)(o,{wrap:"wrap",children:F})})]},M))}),c&&!S&&(0,D.jsx)(s,{marginTop:1,children:(0,D.jsxs)(o,{color:i.red,wrap:"wrap",children:["Reason: ",c]})})]})})}var j=R(k(),1);function Me({message:e,code:t,remediation:n,docsUrl:l}){return(0,j.jsx)(ve,{title:"Error",variant:"error",children:(0,j.jsxs)(s,{flexDirection:"column",paddingY:1,children:[(0,j.jsxs)(o,{color:i.red,bold:!0,children:[" \u2717 ",e]}),t&&(0,j.jsxs)(s,{marginTop:0,marginLeft:5,children:[(0,j.jsx)(o,{color:i.muted,children:"Code: "}),(0,j.jsx)(o,{color:i.dim,children:t})]}),n&&(0,j.jsxs)(s,{flexDirection:"column",marginTop:1,marginLeft:5,children:[(0,j.jsx)(o,{color:i.green,bold:!0,children:"Fix:"}),(0,j.jsxs)(o,{color:i.orange,children:["$ ",n]})]}),l&&(0,j.jsxs)(s,{marginTop:1,marginLeft:5,children:[(0,j.jsx)(o,{color:i.muted,children:"Docs: "}),(0,j.jsx)(o,{color:i.orange,underline:!0,children:l})]})]})})}var E=R(k(),1);function un(e){let{exit:t}=Te(),{append:n}=ye(),l=(0,A.useRef)(!1);(0,A.useEffect)(()=>{l.current||(l.current=!0,n((0,E.jsx)(s,{flexDirection:"column",marginBottom:1,children:(0,E.jsxs)(s,{borderStyle:"round",borderColor:"#dc4e08",paddingX:2,children:[(0,E.jsx)(o,{color:"#ff9500",bold:!0,children:"KaneAI CLI"}),(0,E.jsx)(o,{color:i.dim,children:" \u2502 "}),(0,E.jsx)(o,{color:i.orange,children:e.topBanner.model}),(0,E.jsx)(o,{color:i.dim,children:" \u2502 "}),(0,E.jsx)(o,{color:i.dim,children:e.topBanner.auth})]})})),n((0,E.jsx)(Qe,{data:e.globalConfig})),e.priorAttemptRollup&&n((0,E.jsx)(o,{color:i.dim,children:` \u21B3 replayed ${e.priorAttemptRollup.startIdx}..${e.priorAttemptRollup.endIdx-1} (${e.priorAttemptRollup.count} steps, from prior attempt)`})))},[]);let a=(0,A.useRef)(null),u=(0,A.useCallback)(async y=>{let h=await e.getNextStep(y);return h?(a.current=h,h.config):(a.current=null,null)},[e]),c=(0,A.useCallback)((y,h)=>{let b=a.current;if(!b)return;let B=b.mode==="replay"?"cyan":"#dc4e08",F=b.modeReason?` (${b.modeReason})`:"",M=b.perStepOverrides?Object.entries(b.perStepOverrides):[];n((0,E.jsxs)(s,{flexDirection:"column",marginBottom:0,children:[(0,E.jsxs)(o,{children:[(0,E.jsxs)(o,{color:i.dim,children:[b.banner.stepLabel," "]}),(0,E.jsxs)(o,{color:B,children:["[",b.mode,"]"]}),(0,E.jsx)(o,{color:i.dim,children:F})]}),(0,E.jsx)(o,{color:i.dim,children:b.banner.objective}),M.length>0&&(0,E.jsxs)(o,{color:i.dim,children:["overrides: ",M.map(([X,Y])=>`${X}=${Y}`).join(", ")]})]}))},[n]),v=(0,A.useRef)(0),S=(0,A.useRef)(!1),T=(0,A.useCallback)((y,h)=>(y.hadError?n((0,E.jsx)(Me,{message:y.reason??"Runner error",code:"RUNNER_ERROR"})):n((0,E.jsx)(s,{flexDirection:"column",marginBottom:1,children:(0,E.jsx)(qe,{status:y.status,summary:y.runEnd?.summary??"",duration:y.runEnd?.duration??0,steps:y.stepsTotal,stepsPassed:y.stepsPassed,stepsFailed:y.stepsFailed,reason:y.runEnd?.reason,creditsConsumed:y.runEnd?.credits_consumed})})),e.onStepEnd?.(y,h)??!0),[n,e]),d=we({getNextConfig:u,onStepStart:c,onStepEnd:T,onAllComplete:()=>{e.onAllComplete(),e.exitOnComplete!==!1&&setImmediate(()=>t())},screenshotDispatcher:e.screenshotDispatcher,stepLogger:e.stepLogger,onReasoning:e.onReasoning,onStepComplete:e.onStepComplete,spawnOpts:e.spawnOpts}),L=250,O=5e3;return Se((y,h)=>{if(h.ctrl&&y==="c"){let b=Date.now(),B=b-v.current;if(B<L)return;S.current&&B<O?(d.cancel(),e.onCancel?.(),e.exitOnComplete!==!1&&setImmediate(()=>t())):(S.current=!0,n((0,E.jsx)(o,{color:"yellow",children:"press Ctrl+C again to cancel run"}))),v.current=b}}),(0,E.jsx)(s,{flexDirection:"column",children:d.phase!=="done"&&(0,E.jsx)(Ae,{runner:d.runner,runKey:d.currentStepIndex,onStepCommit:n})})}function Qe({data:e}){return(0,E.jsx)(Be,{title:"test.md run",titleColor:"#ff9500",borderColor:i.dim,rows:[{label:"source",value:e.source},{label:"steps",value:`${e.steps.total} (${e.steps.replay} replay, ${e.steps.author} author per walker)`},{label:"model",value:e.model},{label:"viewport",value:`${e.viewport.width} x ${e.viewport.height}`},{label:"chrome",value:e.chrome},{label:"session",value:e.session},{label:"variables",value:`${e.variables.count} (${e.variables.secrets} secret)`},{label:"flags",value:e.flags.length>0?e.flags.join(" "):"(none)"}]})}export{_e as a,ke as b,Ie as c,de as d,qe as e,Me as f,un as g};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as $}from"./chunk-YCCUBQY4.js";import{a as U}from"./chunk-
|
|
2
|
+
import{a as $}from"./chunk-YCCUBQY4.js";import{a as U}from"./chunk-66LXV7NN.js";import{a as T}from"./chunk-2WVKOZ6W.js";import{a as k}from"./chunk-K4ERF7GT.js";import{a as _}from"./chunk-MEHEGW3V.js";import{y as i}from"./chunk-PXPXK4Q7.js";import{a as O}from"./chunk-HCBYKLMW.js";import{a as u,b as s}from"./chunk-C44QQJR4.js";import{a as K}from"./chunk-6YGTRKDT.js";import{e as S}from"./chunk-UR6MHSHU.js";var e=S(K(),1);var r=S(O(),1);function V(n,x,c){return{id:n,label:`${x} (${n})`,isActive:n===c}}function se({resolver:n,currentProjectId:x,env:c,onSelect:w,onCancel:C}){let[q,B]=(0,e.useState)([]),[D,l]=(0,e.useState)(!0),[H,m]=(0,e.useState)(!1),[J,g]=(0,e.useState)(!1),[Q,P]=(0,e.useState)(null),[d,p]=(0,e.useState)("list"),[v,R]=(0,e.useState)(""),[E,h]=(0,e.useState)(null),[I,X]=(0,e.useState)(""),b=(0,e.useRef)(!1),A=(0,e.useRef)(!0);(0,e.useEffect)(()=>{if(!n){P("Login first to browse projects"),l(!1);return}let o=new AbortController,a=I.trim();return A.current?l(!0):a&&g(!0),m(!0),P(null),(async()=>{try{let t=n.cached??await n.resolve();if(!t){P("Login first to browse projects"),l(!1),m(!1),g(!1);return}let L=k(c),F=new T(L.tmsBaseUrl,t.username,t.access_key),f=!0,N=0,G=a?{signal:o.signal,name:a,perPage:10}:{signal:o.signal,perPage:10};for await(let y of F.listProjectsStream(G)){if(f&&(l(!1),g(!1),A.current=!1,f=!1),y.totalLoaded===0&&y.done&&N===0&&!a){b.current=!0,p("naming"),m(!1);return}let M=y.projects.map(j=>V(j.project_id,j.name,x));B(N===0?M:j=>[...j,...M]),N+=y.projects.length,y.done&&m(!1)}f&&(l(!1),m(!1),g(!1))}catch(t){if(t?.name==="AbortError")return;P(t instanceof Error?t.message:String(t)),l(!1),m(!1),g(!1)}})(),()=>o.abort()},[n,x,c,I]);let Y=(0,e.useCallback)(o=>{let a=o.trim();if(!a){h("Name cannot be empty");return}h(null),p("creating"),(async()=>{try{if(!n)throw new Error("Not authenticated");let t=n.cached??await n.resolve();if(!t)throw new Error("Not authenticated");let L=k(c),f=await new T(L.tmsBaseUrl,t.username,t.access_key).createProject(a);w(f.id,f.name)}catch(t){h(t instanceof Error?t.message:String(t)),p("naming")}})()},[n,c,w]),z=(0,e.useCallback)(()=>{R(""),h(null),b.current?C():p("list")},[C]);return d==="naming"||d==="creating"?(0,r.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:i.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(s,{color:i.orange,bold:!0,children:"Create new project"}),b.current&&(0,r.jsx)(u,{marginTop:1,children:(0,r.jsx)(s,{color:i.dim,children:"No projects yet \u2014 let's create one."})}),(0,r.jsxs)(u,{marginTop:1,children:[(0,r.jsx)(s,{color:i.dim,children:"Name: "}),d==="naming"?(0,r.jsx)($,{value:v,onChange:o=>{R(o),E&&h(null)},onSubmit:Y,onCancel:z}):(0,r.jsx)(s,{children:v})]}),E&&(0,r.jsx)(u,{marginTop:1,children:(0,r.jsx)(s,{color:i.red,children:E})}),d==="creating"&&(0,r.jsx)(u,{marginTop:1,children:(0,r.jsx)(s,{color:i.dim,children:"Creating..."})}),d==="naming"&&(0,r.jsx)(_,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:b.current?"cancel":"back"})]}):(0,r.jsx)(U,{title:"Projects",items:q,loading:D,loadingMore:H,searching:J,preserveSelectionById:!0,onSearch:X,error:Q,itemNoun:"projects",onTab:()=>{b.current=!1,p("naming")},extraHint:"tab to create new",onSelect:o=>{let a=o.label.replace(` (${o.id})`,"");w(o.id,a)},onCancel:C})}export{V as a,se as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as f}from"./chunk-
|
|
2
|
+
import{a as f}from"./chunk-N5YIMTGV.js";import{y as t}from"./chunk-PXPXK4Q7.js";import{a as x}from"./chunk-HCBYKLMW.js";import{a as r,b as n}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as p}from"./chunk-UR6MHSHU.js";var c=p(B(),1);var e=p(x(),1);function v(){return[{name:"convert",label:"Converting session data",status:"pending"},{name:"zip",label:"Compressing artifacts",status:"pending"},{name:"presign",label:"Requesting upload URLs",status:"pending"},{name:"upload",label:"Uploading to KaneAI",status:"pending"},{name:"atomic_replace",label:"Replacing local output",status:"pending"},{name:"commit_lock",label:"Committing to TMS",status:"pending"},{name:"finalize",label:"Finalizing test case",status:"pending"},{name:"code_export",label:"Downloading test code",status:"pending"}]}function U(s,o,d,a){return s.map(l=>l.name===o?{...l,status:d,detail:a}:l)}function R(s){let o=s/1e3;if(o<60)return`${o.toFixed(1)}s`;let d=Math.floor(o/60),a=Math.round(o%60);return`${d}m ${a}s`}function D(s){let[o,d]=(0,c.useState)(0),a=c.default.useRef(Date.now());return(0,c.useEffect)(()=>{if(!s)return;a.current=Date.now();let l=setInterval(()=>{d(Date.now()-a.current)},100);return()=>clearInterval(l)},[s]),o}function h({steps:s,status:o,testUrl:d,error:a}){let l=D(o==="uploading");return o==="uploading"?(0,e.jsxs)(r,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(r,{children:[(0,e.jsx)(n,{color:t.orange,children:"\u2601 "}),(0,e.jsx)(n,{color:t.orange,bold:!0,children:"Saving to KaneAI"}),(0,e.jsxs)(n,{color:t.dim,children:[" ",R(l)]})]}),(0,e.jsx)(r,{flexDirection:"column",marginTop:1,children:s.filter(i=>i.status!=="skipped").map((i,S,T)=>{let b=S===T.length-1?"\u2514\u2500":"\u251C\u2500",u=i.status==="done",m=i.status==="running",g=i.status==="failed";return(0,e.jsxs)(r,{children:[(0,e.jsxs)(n,{color:t.dim,children:[" ",b," "]}),(0,e.jsx)(r,{width:3,children:m?(0,e.jsx)(f,{}):u?(0,e.jsx)(n,{color:t.green,children:"\u2713"}):g?(0,e.jsx)(n,{color:t.red,children:"\u2717"}):(0,e.jsx)(n,{color:t.muted,children:"\u25CB"})}),(0,e.jsx)(n,{color:u?t.dim:m?void 0:g?t.red:t.muted,children:i.label}),i.detail&&(0,e.jsxs)(n,{color:t.dim,children:[" ",i.detail]})]},i.name)})}),(0,e.jsx)(r,{marginTop:1,children:(0,e.jsx)(n,{color:t.muted,children:" press Ctrl+C twice to force exit"})})]}):o==="success"?(0,e.jsx)(e.Fragment,{}):(0,e.jsxs)(r,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(r,{children:[(0,e.jsx)(n,{color:t.red,children:"\u2601 "}),(0,e.jsx)(n,{color:t.red,bold:!0,children:"Save failed"})]}),a&&(0,e.jsxs)(r,{marginTop:0,children:[(0,e.jsx)(n,{color:t.dim,children:" "}),(0,e.jsx)(n,{color:t.dim,children:a})]})]})}export{v as a,U as b,h as c};
|