@testmuai/kane-cli 0.5.0 → 0.6.1
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-R55VO3VW.js +9 -0
- package/dist/{ChromeProfilePicker-PIWZY4WH.js → ChromeProfilePicker-BZKLIO2T.js} +1 -1
- package/dist/{CliFeedbackPrompt-URXCHBZ5.js → CliFeedbackPrompt-3HYRBMXS.js} +1 -1
- package/dist/CliUploadProgress-OAPMO5I3.js +2 -0
- package/dist/{ConfigView-NWNDNTKW.js → ConfigView-YIAAISLE.js} +1 -1
- package/dist/EvidenceViewOffer-DBMZQ34Z.js +2 -0
- package/dist/FolderPicker-ILK4AIKL.js +2 -0
- package/dist/HelpView-HBQX64VR.js +2 -0
- package/dist/{InfoBox-FPAWQZGQ.js → InfoBox-DKJO73HM.js} +1 -1
- package/dist/{LinksBox-O5ZFYSK2.js → LinksBox-44WCVBT4.js} +1 -1
- package/dist/{ProfilesView-SPECXHZE.js → ProfilesView-NVEDYU3H.js} +1 -1
- package/dist/{ProjectPicker-ANJ6NGNY.js → ProjectPicker-COBY7TCY.js} +1 -1
- package/dist/{SaveSessionPrompt-W2GWELOP.js → SaveSessionPrompt-O4ENMYHP.js} +1 -1
- package/dist/ScrollbackTap-Q3IOKNMS.js +2 -0
- package/dist/SingleShotApp-NA6A2S6I.js +2 -0
- package/dist/{SummaryBox-DJUDYML7.js → SummaryBox-ROV7TNK4.js} +1 -1
- package/dist/TestMdRunView-U5YTNLY6.js +2 -0
- package/dist/{WhoamiView-DH25ZD4C.js → WhoamiView-4QV3DPN2.js} +1 -1
- package/dist/archive-committer-3NI773TP.js +2 -0
- package/dist/bind-RDTZZ6ZI.js +6 -0
- package/dist/bridge-VY2Q3HQU.js +2 -0
- package/dist/{changelog-RCKUVBFL.js → changelog-JMFGVNEU.js} +1 -1
- package/dist/chat-committer-RTJCKQMM.js +2 -0
- package/dist/chat-controller-OTBYHB4Y.js +3 -0
- package/dist/chunk-22A2ECA2.js +2 -0
- package/dist/{chunk-T4PKTWZ6.js → chunk-2PDWMY2B.js} +1 -1
- package/dist/{chunk-I4B2KY4X.js → chunk-2T4JPBB5.js} +1 -1
- package/dist/{chunk-AM5WZPPY.js → chunk-37CI4EJX.js} +1 -1
- package/dist/chunk-427OQS2N.js +2 -0
- package/dist/chunk-47RNFG2V.js +23 -0
- package/dist/{chunk-IECUFWIZ.js → chunk-4CRKK5WV.js} +1 -1
- package/dist/chunk-5446YVGQ.js +4 -0
- package/dist/{chunk-TJWU7DOO.js → chunk-5FD6ZXB5.js} +1 -1
- package/dist/chunk-5ILXUQIX.js +2 -0
- package/dist/chunk-5UXL6RNG.js +2 -0
- package/dist/chunk-5Y2G4NC7.js +2 -0
- package/dist/chunk-6PS65QFF.js +2 -0
- package/dist/chunk-7DBQEOFL.js +9 -0
- package/dist/{chunk-R5RHRG65.js → chunk-7SUKUJO2.js} +1 -1
- package/dist/{chunk-LOQV5GME.js → chunk-AAWRKFE4.js} +1 -1
- package/dist/chunk-AD46OCZ4.js +4 -0
- package/dist/chunk-AE6SS34N.js +4 -0
- package/dist/chunk-B2PZAB7J.js +4 -0
- package/dist/chunk-BC7UVJJB.js +2 -0
- package/dist/{chunk-DTM4ZMMJ.js → chunk-BMSWIYYK.js} +1 -1
- package/dist/{chunk-YSIYPC4R.js → chunk-CB3TEWZJ.js} +1 -1
- package/dist/chunk-CE664P73.js +2 -0
- package/dist/chunk-CP4XCWAJ.js +5 -0
- package/dist/chunk-D5T4ARTB.js +2 -0
- package/dist/chunk-DFS4RMVP.js +2 -0
- package/dist/chunk-DM2GL24Z.js +3 -0
- package/dist/{chunk-HZ46P2GR.js → chunk-FAIH2K2U.js} +1 -1
- package/dist/chunk-FS4YJM22.js +2 -0
- package/dist/chunk-FXPPQL4D.js +6 -0
- package/dist/chunk-FYOCF7DY.js +2 -0
- package/dist/chunk-GIGD4M7V.js +5 -0
- package/dist/chunk-GIRXJOJI.js +2 -0
- package/dist/chunk-HGL3RM7P.js +8 -0
- package/dist/{chunk-HFXQU7UZ.js → chunk-HMGNPFXP.js} +1 -1
- package/dist/chunk-I2S6KNZW.js +2 -0
- package/dist/chunk-IACKIGPX.js +2 -0
- package/dist/{chunk-C4LYBQT3.js → chunk-IRDMEYJB.js} +2 -2
- package/dist/{chunk-4IOOBSNB.js → chunk-ISAE457F.js} +1 -1
- package/dist/{chunk-AFCEFOIK.js → chunk-J5BUMF3G.js} +1 -1
- package/dist/chunk-JFAFKHDX.js +4 -0
- package/dist/{chunk-6E5UYAEB.js → chunk-KFAYCOTB.js} +1 -1
- package/dist/{chunk-UOGJUJCF.js → chunk-KGP7NSXH.js} +1 -1
- package/dist/chunk-KHDUQ33H.js +2 -0
- package/dist/chunk-KHU7C6EE.js +2 -0
- package/dist/chunk-LMJTY32X.js +6 -0
- package/dist/chunk-M5JQXOCE.js +12 -0
- package/dist/chunk-MJFYMMX2.js +2 -0
- package/dist/chunk-MMI3VSCA.js +6 -0
- package/dist/{chunk-NLIOFVMP.js → chunk-MZ2PXBKK.js} +1 -1
- package/dist/chunk-N2ZW5635.js +6 -0
- package/dist/chunk-NNZV5RCE.js +2 -0
- package/dist/{chunk-7IBNOVML.js → chunk-NSSKSXCT.js} +1 -1
- package/dist/{chunk-PISZLYS5.js → chunk-O4O4KL6Z.js} +1 -1
- package/dist/{chunk-QO6PAA7Q.js → chunk-OBBXDBEE.js} +2 -2
- package/dist/chunk-Q4P2L7DY.js +2 -0
- package/dist/chunk-Q4PUOA46.js +61 -0
- package/dist/chunk-QPZRHAYK.js +4 -0
- package/dist/chunk-QZWQCHXK.js +11 -0
- package/dist/{chunk-7AEC572G.js → chunk-R2K2SGGE.js} +1 -1
- package/dist/{chunk-3FN66LTP.js → chunk-RFHMDQXZ.js} +1 -1
- package/dist/chunk-RGEAEAZB.js +20 -0
- package/dist/{chunk-GEAWRRR7.js → chunk-RH2OAIJI.js} +1 -1
- package/dist/chunk-RKWJG3WW.js +19 -0
- package/dist/{chunk-IU53F4ZV.js → chunk-ROPXE7TF.js} +1 -1
- package/dist/chunk-RY4OOGSC.js +14 -0
- package/dist/chunk-S74MQRDN.js +2 -0
- package/dist/{chunk-ZWAZ4QU4.js → chunk-SB6MBQKR.js} +1 -1
- package/dist/{chunk-XDERMCAU.js → chunk-SQJWMOJQ.js} +1 -1
- package/dist/{chunk-ELBPBHTE.js → chunk-SUDAFBVD.js} +2 -2
- package/dist/chunk-VJUIW2ES.js +4 -0
- package/dist/chunk-VXD5667K.js +7 -0
- package/dist/chunk-WAGJLR5X.js +356 -0
- package/dist/chunk-WGG5XURS.js +13 -0
- package/dist/chunk-WRHZCHZY.js +2 -0
- package/dist/chunk-XDW2RGIL.js +7 -0
- package/dist/chunk-YANCBRER.js +3 -0
- package/dist/{chunk-THEZSXZM.js → chunk-YJ6AQ2KP.js} +1 -1
- package/dist/chunk-Z56AWGVY.js +2 -0
- package/dist/{chunk-PTP3WS3N.js → chunk-ZA67EBYF.js} +1 -1
- package/dist/chunk-ZKYYZ5NO.js +6 -0
- package/dist/{chunk-TPG2T5GH.js → chunk-ZNANAARA.js} +1 -1
- package/dist/cover-cmd-Y5L4O4Q3.js +2 -0
- package/dist/{credentials-52QRPGET.js → credentials-L63BBW2S.js} +1 -1
- package/dist/descriptor-SL5A7RQE.js +2 -0
- package/dist/distill-cmd-EYCCCFL3.js +2 -0
- package/dist/evidence-UAFPTHQX.js +2 -0
- package/dist/evolve-cmd-2SPNVTT4.js +2 -0
- package/dist/{exit-manager-IUHAXFJ6.js → exit-manager-VCSIUYBR.js} +1 -1
- package/dist/explain-JIXUWEFJ.js +2 -0
- package/dist/explain-cmd-55WRDIMW.js +9 -0
- package/dist/explain-cmd-RIDEMDMY.js +3 -0
- package/dist/extract-bind-DS4UP23P.js +5 -0
- package/dist/extract-cmd-PMZHMMU7.js +6 -0
- package/dist/gaps-cmd-P2DRK6FW.js +2 -0
- package/dist/gate-FACZRGOC.js +2 -0
- package/dist/{generate-headless-WG6ZPINI.js → generate-headless-C3UZKDS5.js} +2 -2
- package/dist/headless-io-GXHKDPHB.js +2 -0
- package/dist/index.js +55 -54
- package/dist/ingest-4CGBXC2L.js +2 -0
- package/dist/ingest-cmd-FJ3SLTT4.js +3 -0
- package/dist/interactive-bind-SJLDJULN.js +7 -0
- package/dist/interrupt-guard-UREUWNRL.js +2 -0
- package/dist/lifecycle-cmd-56OZT4LY.js +2 -0
- package/dist/list-cmd-JB2ABACD.js +3 -0
- package/dist/list-commands-PGAX5HRB.js +2 -0
- package/dist/logical-ids-QRRUXV5E.js +2 -0
- package/dist/login-flow-4OJ34VDP.js +2 -0
- package/dist/maintenance-cmd-E3HEEVQW.js +2 -0
- package/dist/open-MQLQKFAW.js +2 -0
- package/dist/{persist-recorded-session-XKPZX7HW.js → persist-recorded-session-WFU4M4SQ.js} +1 -1
- package/dist/pipeline-EYQUM27P.js +2 -0
- package/dist/readmodel-MPTENJ2R.js +2 -0
- package/dist/reconcile-cmd-TFFYCTCY.js +8 -0
- package/dist/{recording-banner-2TNKQHP2.js → recording-banner-PH2NND2X.js} +1 -1
- package/dist/{require-project-folder-SJG5FQY6.js → require-project-folder-RD2UAB7E.js} +1 -1
- package/dist/revert-3TKLOYQA.js +2 -0
- package/dist/review-cmd-SL52N4TM.js +4 -0
- package/dist/run-NODOSQUL.js +2 -0
- package/dist/run-test-md-I6O4H7B2.js +17 -0
- package/dist/{scrollback-6GINSTL2.js → scrollback-JLPJR25X.js} +1 -1
- package/dist/sessions-cmd-STHKGDX4.js +23 -0
- package/dist/signals-cmd-LXHZQLXZ.js +2 -0
- package/dist/{skill-installer-M6AREQQW.js → skill-installer-BJLHH3DW.js} +1 -1
- package/dist/spawner-UDCF35OA.js +2 -0
- package/dist/tcg-generate-E7H4LF7Y.js +2 -0
- package/dist/testmd-actions-FMVUXZGX.js +2 -0
- package/dist/token-refresh-OGBTJGZ2.js +2 -0
- package/dist/turn-preflight-I5SM4UIZ.js +2 -0
- package/dist/ui-JEJGTURD.js +4 -0
- package/dist/{validate-basic-FO7C2URG.js → validate-basic-WILRWRRP.js} +1 -1
- package/dist/{version-check-PHZX5WS7.js → version-check-TXTCVX2N.js} +1 -1
- package/dist/view-cmd-QE2FS3GB.js +436 -0
- package/package.json +6 -6
- package/dist/CliUploadProgress-DMH3C3UZ.js +0 -2
- package/dist/EvidenceViewOffer-HEBQ7C4H.js +0 -2
- package/dist/FolderPicker-5S23OTSY.js +0 -2
- package/dist/HelpView-YYKTP4JH.js +0 -2
- package/dist/SingleShotApp-5TYM356H.js +0 -2
- package/dist/TestMdRunView-BIVXQE54.js +0 -2
- package/dist/chunk-54TKNWXF.js +0 -5
- package/dist/chunk-5MTRNUAK.js +0 -2
- package/dist/chunk-7KDNH6JP.js +0 -10
- package/dist/chunk-7YRNLGUT.js +0 -11
- package/dist/chunk-C6S4IEBC.js +0 -2
- package/dist/chunk-DJL47DYJ.js +0 -8
- package/dist/chunk-H6QJ4YU7.js +0 -2
- package/dist/chunk-J75KVNX5.js +0 -18
- package/dist/chunk-MUPHP5W6.js +0 -27
- package/dist/chunk-NAYAVVTP.js +0 -6
- package/dist/chunk-P5XBCJYQ.js +0 -7
- package/dist/chunk-Q2I65L2W.js +0 -6
- package/dist/chunk-QCEWUUE6.js +0 -55
- package/dist/chunk-V2GYBVSM.js +0 -2
- package/dist/chunk-Y44AETOW.js +0 -2
- package/dist/chunk-YCNCW4O4.js +0 -8
- package/dist/evidence-O4AON5FU.js +0 -2
- package/dist/list-commands-VJAL4J3O.js +0 -2
- package/dist/login-flow-VZ2MITFA.js +0 -2
- package/dist/pipeline-CADTHPDV.js +0 -2
- package/dist/run-test-md-INJKPE2I.js +0 -13
- package/dist/tcg-generate-VKFXR5JT.js +0 -2
- package/dist/testmd-actions-4QLHD74A.js +0 -2
- package/dist/token-refresh-2HKIYD4Y.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{
|
|
2
|
+
import{c as $e}from"./chunk-O4O4KL6Z.js";import{a as te}from"./chunk-FS4YJM22.js";import{a as K}from"./chunk-5Y2G4NC7.js";import{a as Be}from"./chunk-SB6MBQKR.js";import{a as ve}from"./chunk-NSSKSXCT.js";import{b as ye}from"./chunk-DFS4RMVP.js";import{x as i}from"./chunk-HMGNPFXP.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};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{appendFileSync as o,existsSync as u,mkdirSync as g,readFileSync as p}from"fs";import{join as d}from"path";function m(e,n){g(e,{recursive:!0}),o(d(e,"signals.ndjson"),JSON.stringify(n)+`
|
|
3
|
+
`)}function v(e,n){switch(n){case"approved":return[{...e,verdict:"approved",polarity:"preference"}];case"rejected":return[{...e,verdict:"rejected",polarity:"preference"},{...e,verdict:"rejected",polarity:"mistake",tag:"wrong-uc-inference"}];case"edited":return[{...e,verdict:"edited",polarity:"correction"}];case"supersede":return[{...e,verdict:"supersede",polarity:"preference"},{...e,verdict:"supersede",polarity:"correction",tag:"superseded-prior-version"}];case"skipped":return[]}}function S(e,n){let r=(t,i,s,c)=>({...n,id:s,verdict:t,polarity:i,...c!==void 0?{tag:c}:{},event_id:e.eventId,target:s});switch(e.kind){case"approve":return[r("approve","preference",e.target)];case"edit":return[r("edit","preference",e.target),r("edit","correction",e.target)];case"enhance":return[r("enhance","preference",e.target)];case"reject":{let t=[r("reject","preference",e.target),r("reject","mistake",e.target,"wrong-uc-inference")];return e.redirectTo!==void 0&&t.push(r("dedup_dropped","correction",e.target),r("dedup_kept","preference",e.redirectTo)),t}case"add":return[];case"resolve_question":{if(e.resolution==="deferred")return[];if(e.resolution==="assumed-default")return[r("default_accepted","preference",e.questionId)];let t=e.answer?.optionIds?.[0]??(e.answer?.freeText!==void 0?"free-text":void 0),i=[r("gap_resolution","preference",e.questionId,t)];return e.overrodeRecommendation&&i.push(r("default_overridden","correction",e.questionId,t)),i}}}function y(e,n){let r=d(e,"signals.ndjson");if(!u(r))return{signals:[],watermark:0};let t=p(r),i=t.lastIndexOf(10),s=i===-1?0:i+1;n!==void 0&&n<s&&(s=n);let c=[];for(let a of t.subarray(0,s).toString("utf8").split(`
|
|
4
|
+
`))if(a.trim())try{c.push(JSON.parse(a))}catch{}return{signals:c,watermark:s}}export{m as a,v as b,S as c,y as d};
|
|
@@ -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-37CI4EJX.js";import{a as T}from"./chunk-2WVKOZ6W.js";import{a as k}from"./chunk-KGP7NSXH.js";import{a as _}from"./chunk-CB3TEWZJ.js";import{x as i}from"./chunk-HMGNPFXP.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{w as s}from"./chunk-
|
|
2
|
+
import{w as s}from"./chunk-HMGNPFXP.js";function n(r="prod"){let e=s[r];return r!=="stage"?e:{authBaseUrl:process.env.KANE_STAGE_AUTH_URL??e.authBaseUrl,consentUrl:process.env.KANE_STAGE_CONSENT_URL??e.consentUrl,controllerBaseUrl:process.env.TESTMUAI_BASE_URL??e.controllerBaseUrl,tmsBaseUrl:process.env.KANE_STAGE_TMS_URL??e.tmsBaseUrl,testGeneratorBaseUrl:process.env.KANE_STAGE_TCG_URL??e.testGeneratorBaseUrl,secretsBaseUrl:process.env.KANE_STAGE_SECRETS_URL??e.secretsBaseUrl,testManagerUiUrl:process.env.KANE_STAGE_TEST_MANAGER_UI_URL??e.testManagerUiUrl,shareApiBaseUrl:process.env.KANE_STAGE_SHARE_API_URL??e.shareApiBaseUrl,v16ServerHost:process.env.KANE_STAGE_V16_SERVER_HOST??e.v16ServerHost,evidenceViewerUrl:process.env.KANE_STAGE_EVIDENCE_VIEWER_URL??e.evidenceViewerUrl}}export{n as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{b as o}from"./chunk-B2PZAB7J.js";import{existsSync as c,mkdirSync as f,readFileSync as u,renameSync as l,writeFileSync as g}from"fs";import{dirname as p,join as a}from"path";function i(t,r){let n=r.startsWith("sha256:")?r.slice(7):r;return a(t,"blobs",n.slice(0,2),n.slice(2))}function B(t,r){return i(t,r)}function m(t){let r=Buffer.concat([Buffer.from("assurance.blob\0","utf8"),t]);return"sha256:"+o(r)}function d(t,r){let n=m(r),e=i(t,n);if(!c(e)){f(p(e),{recursive:!0});let s=`${e}.tmp-${process.pid}`;g(s,r),l(s,e)}return n}function S(t,r){let n=i(t,r);return c(n)?u(n):null}export{B as a,m as b,d as c,S as d};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as i,b as s}from"./chunk-L5LI2JF4.js";import{existsSync as o,mkdirSync as l,readFileSync as c,writeFileSync as g}from"fs";import{dirname as u,join as m}from"path";function a(t,r){let e=r.startsWith("sha256:")?r.slice(7):r;return m(t,"design","rationale",`${e}.yaml`)}function h(t,r,e){let n=a(t,r);return l(u(n),{recursive:!0}),g(n,s(e,{sortKeys:!0,lineWidth:-1})),n}function y(t,r){let e=a(t,r);return o(e)?i(c(e,"utf8")):null}export{h as a,y as b};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{b as G,c as P,e as J,h as q,i as z,j as Q,m as V,n as X,o as T}from"./chunk-RKWJG3WW.js";import{e as U}from"./chunk-NFOBDHZK.js";import{copyFileSync as ae,cpSync as le,existsSync as w,mkdirSync as ue,readFileSync as je,readdirSync as pe,rmSync as Fe,writeFileSync as Oe}from"fs";import{dirname as Te,isAbsolute as _e,join as R,relative as Le,resolve as Ae}from"path";import{writeFileSync as ge,mkdirSync as Se,readFileSync as Re}from"fs";import{dirname as Ie,basename as Y}from"path";function ee(e){let t=e.outPath??P(e.sourcePath);Se(Ie(t),{recursive:!0});let r=[];r.push("---"),r.push(`test: ../${Y(e.sourcePath)}`),r.push(`status: ${e.overallStatus}`),r.push(`started: ${e.startedISO}`),r.push(`duration_s: ${e.durationS}`),r.push(`session_id: ${e.sessionId}`),r.push("---",""),r.push(`# ${e.title??Y(e.sourcePath)} \u2014 Result`,"");for(let l=0;l<e.rootSteps.length;l++){let a=e.rootSteps[l],i=e.outcomes.find(p=>p.rootStepIndex===l+1);if(r.push(xe(a,i)),i?.stepMd5&&r.push(`md5: ${i.stepMd5}`),i?.status==="failed"&&i.reason&&r.push(`Reason: ${i.reason}`),i?.softFailures?.length)for(let p of i.softFailures){let o=p.reason?`: ${p.reason}`:"";r.push(`\u26A0 optional sub-step ${p.subStepIndex} failed${o}`)}a.body.kind==="objective"&&i?.status!=="skipped"&&r.push(a.body.text),r.push("")}return ge(t,r.join(`
|
|
3
|
+
`),"utf8"),t}function xe(e,t){if(!t)return`## ${e.heading} (no outcome)`;let r=t.duration_s!=null?`${t.duration_s}s`:"\u2014";if(t.status==="skipped")return`## ${e.heading} \u23ED skipped`;let l=t.softFailed?" (optional)":"";if(t.refKind&&t.status==="passed"){let a=t.helperResultRelPath?` \u2192 ${t.helperResultRelPath}`:"";return`## ${e.heading} \u2713 passed (via @${t.refKind} ${t.refLabel} \u2014 ${t.inlinedCount} inlined steps, ${r}${a})`}if(t.refKind&&t.status==="failed"){let a=t.failedSubStepIndex&&t.failedSubStepIndex.length>0?` \u2014 at sub-step ${t.failedSubStepIndex.join(" \u2192 sub-step ")}`:"",i=t.helperResultRelPath?` \u2192 ${t.helperResultRelPath}`:"";return`## ${e.heading} \u2717 failed${l} (via @${t.refKind} ${t.refLabel}${a}, ${r}${i})`}return t.status==="passed"?`## ${e.heading} \u2713 passed (${r})`:`## ${e.heading} \u2717 failed${l} (${r})`}var ye=/^##\s+(.+?)\s+(✓ passed|✗ failed(?:\s+\(optional\))?|⏭ skipped)(?:\s+\((.*)\))?\s*$/,be=/via\s+@\w+\s+(\S+).*?(?:→\s+(\S+))?\s*$/,ke=/^md5:\s+([a-f0-9]{32})\s*$/;function Z(e,t){for(let r=t;r<e.length&&!/^##\s/.test(e[r]);r++){if(e[r].trim()==="")continue;let l=ke.exec(e[r]);return l?l[1]:null}return null}function $(e){let r=Re(e,"utf8").split(`
|
|
4
|
+
`),l="passed";if(r[0]?.trim()==="---")for(let i=1;i<r.length&&r[i].trim()!=="---";i++){let p=/^status:\s+(passed|failed|interrupted)\s*$/.exec(r[i]);p&&(l=p[1])}let a=[];for(let i=0;i<r.length;i++){let p=ye.exec(r[i]);if(!p)continue;let o=p[1],s=p[2],c=p[3]??"",m=s.startsWith("\u2713")?"passed":s.startsWith("\u23ED")?"skipped":"failed";if(/via\s+@/.test(c)){let f=be.exec(c),b=f?.[1]??"",g=f?.[2]??null;a.push({kind:"import",heading:o,status:m,md5:Z(r,i+1),importPath:b,helperResultRelPath:g})}else a.push({kind:"objective",heading:o,status:m,md5:Z(r,i+1)})}return{overallStatus:l,steps:a}}import{copyFileSync as te,existsSync as N,mkdirSync as ve,writeFileSync as se,promises as Be}from"fs";import{join as D,dirname as re,basename as Pe}from"path";async function ne(e){for(let t=0;t<e.totalRunDirs;t++){let r=e.runIndex+t,l=D(e.sessionDir,"runs",String(r)),a=D(e.stagingStepDir,"flows",String(t));ve(a,{recursive:!0});let i=D(a,"actions.ndjson");if(e.packTestDir){let s=D(e.packTestDir,"logs",`${r}-actions.ndjson`);if(N(s)){te(s,i);continue}let c=re(re(e.packTestDir)),m=Pe(e.packTestDir),I=N(c)?await U(c,`tests/${m}/logs/${r}-actions.ndjson`).catch(()=>null):null;se(i,I??"");continue}let p=[D(l,"run-test","actions.ndjson"),D(l,"actions.ndjson")],o=!1;for(let s of p)if(N(s)){te(s,i),o=!0;break}o||se(i,"")}}import{existsSync as K}from"fs";import{dirname as we,join as j,basename as H}from"path";function Ye(e){let t=[],r=new Set,l=new Map;function a(s){if(l.has(s))return l.get(s);let c=P(s),m=K(c)?$(c):null;return l.set(s,m),m}let i=new Map;function p(s){if(i.has(s))return i.get(s);let c=j(s,"Result.md"),m=K(c)?$(c):null;return i.set(s,m),m}function o(s){for(let c=1;c<s.trace.length;c++){let m=s.trace[c-1],I=a(m.file);if(!I)continue;let f=I.steps[m.stepIndex-1];if(f){if(f.kind!=="import")return{kind:"author",reason:"structure-mismatch"};if(H(f.importPath)!==H(s.trace[c].file))return{kind:"author",reason:"structure-mismatch"};if(f.md5!=null&&f.md5!==m.rowMd5)return{kind:"author",reason:"structure-mismatch"}}}return null}for(let s of e.steps){let c=s.trace[s.trace.length-1].stepIndex,m=r.has(s.owningFile);for(let g=0;g<s.trace.length-1&&!m;g++)r.has(s.trace[g].file)&&(m=!0);if(m){t.push({kind:"author",reason:a(s.owningFile)===null?"no-result-md":"downstream-of-divergence"});continue}let I=o(s);if(I){t.push(I);for(let g=0;g<s.trace.length;g++)r.add(s.trace[g].file);continue}let f=a(s.owningFile),b;if(f===null&&s.trace.length>1){let g=W(s.trace);b=ie(s,p(g),c,g)}else b=ie(s,f,c);if(t.push(b),b.kind==="author"){r.add(s.owningFile);for(let g=0;g<s.trace.length-1;g++)r.add(s.trace[g].file)}}return t}function ie(e,t,r,l=null){if(!t)return{kind:"author",reason:"no-result-md"};let a=t.steps[r-1];if(!a)return{kind:"author",reason:"no-result-md"};if(a.kind!=="objective")return{kind:"author",reason:"structure-mismatch"};if(a.status!=="passed")return{kind:"author",reason:"recorded-failed"};let i=T(e);if(i!==a.md5)return{kind:"author",reason:"md5-mismatch"};let p=l===null?Q(e.owningFile,r,i.slice(0,8)):j(l,".internal","steps",`${r}-${i.slice(0,8)}`),o=j(p,"flows","0","actions.ndjson");return K(o)?{kind:"replay",recordingDir:p}:{kind:"author",reason:"missing-recording"}}function Ze(e){return e.some(t=>t.kind==="author")}function et(e){for(let t=0;t<e.length;t++)if(e[t].kind==="author")return t;return e.length}function W(e){let t=i=>{let p=H(i);return p.endsWith("_test.md")?p.slice(0,-8):p.endsWith(".md")?p.slice(0,-3):p},r=t(e[0].file),l=t(e[e.length-1].file),a=e.slice(0,-1).map(i=>String(i.stepIndex));return j(we(e[e.length-1].file),`helper-output-${l}-${r}-${a.join("-")}`)}function tt(e){return j(e.recordingDir,"flows","0","actions.ndjson")}import{existsSync as oe,mkdirSync as $e,rmSync as De,cpSync as Me}from"fs";function de(e,t){oe(e)&&(oe(t)&&De(t,{recursive:!0,force:!0}),$e(t,{recursive:!0}),Me(e,t,{recursive:!0}))}async function mt(e){let t=new Map;for(let o of e.stepRunRecords)t.set(o.testmdStepIndex,o);let r=e.authoredFlatIdx??new Set,l=[],a=[],i=new Map,p=o=>{if(i.has(o))return i.get(o);let s=R(o,"Result.md"),c=w(s)?$(s):null;return i.set(o,c),c};for(let o of e.resolvedTest.unitFiles){let s=o.file===e.resolvedTest.rootPath,c=V(o.file,je(o.file,"utf8")),m=P(o.file),I=w(m)?$(m):null,f=[],b=[],g=[],M=[];if(!s)for(let d of e.resolvedTest.steps){if(d.owningFile!==o.file||d.trace.length<2)continue;let n=W(d.trace);M.includes(n)||M.push(n)}let F=d=>{if(I!==null)return null;for(let n of M){let v=p(n)?.steps[d-1];if(v)return{row:v,dir:n}}return null},C=[],_=!1,B=!1,L=!1,A=!1;for(let d of c.steps){let n=d.index,u=I?.steps[n-1];if(d.body.kind==="objective"){let h=e.resolvedTest.steps.filter(S=>S.owningFile===o.file&&S.trace[S.trace.length-1].stepIndex===n&&t.has(S.flatIndex)),x=h.length>0?h[h.length-1]:null;if(x){_=!0,r.has(x.flatIndex)&&(B=!0);let S=T(x),y;s?y=e.outcomes.find(he=>he.rootStepIndex===n)??{rootStepIndex:n,status:"skipped"}:y={rootStepIndex:n,status:ce(x,e.outcomes)},y.status==="failed"&&(L=!0),y.stepMd5==null&&(y.stepMd5=S),f.push(y),b.push({stepIndex:n,md5:S,rec:t.get(x.flatIndex)}),(!u||u.kind!=="objective"||u.status!==y.status||y.status==="passed"&&u.md5!==S)&&(A=!0)}else if(u&&u.kind==="objective")f.push({rootStepIndex:n,status:u.status,...u.md5?{stepMd5:u.md5}:{}}),g.push(n);else if(!s&&F(n)?.row.kind==="objective"){let S=F(n),y=S.row;f.push({rootStepIndex:n,status:y.status,...y.md5?{stepMd5:y.md5}:{}}),C.push({psIdx:n,dir:S.dir})}else s?f.push(e.outcomes.find(S=>S.rootStepIndex===n)??{rootStepIndex:n,status:"skipped"}):f.push({rootStepIndex:n,status:"skipped"});continue}let v=_e(d.body.path)?d.body.path:Ae(Te(o.file),d.body.path),O=X({path:d.body.path,bindings:d.body.bindings,optional:d.optional??!1}),me=Le(G(o.file),P(v)),E=e.resolvedTest.steps.filter(h=>h.trace.some((x,S)=>S<h.trace.length-1&&x.file===o.file&&x.stepIndex===n)&&t.has(h.flatIndex));if(E.length>0){_=!0;let h;if(s)h=e.outcomes.find(x=>x.rootStepIndex===n)??{rootStepIndex:n,status:"passed",refKind:"import",refLabel:d.body.path};else{let x=E.some(S=>ce(S,e.outcomes)==="failed");h={rootStepIndex:n,status:x?"failed":"passed",refKind:"import",refLabel:d.body.path,inlinedCount:E.length}}h.status==="failed"&&(L=!0),h.stepMd5==null&&(h.stepMd5=O),h.helperResultRelPath==null&&(h.helperResultRelPath=me),f.push(h),(!u||u.kind!=="import"||u.status!==h.status||u.md5!==O)&&(A=!0)}else if(u&&u.kind==="import")f.push({rootStepIndex:n,status:u.status,refKind:"import",refLabel:u.importPath,...u.md5?{stepMd5:u.md5}:{},...u.helperResultRelPath?{helperResultRelPath:u.helperResultRelPath}:{}});else if(!s&&F(n)?.row.kind==="import"){let h=F(n).row;f.push({rootStepIndex:n,status:h.status,refKind:"import",refLabel:d.body.path})}else s?f.push(e.outcomes.find(h=>h.rootStepIndex===n)??{rootStepIndex:n,status:"skipped",refKind:"import",refLabel:d.body.path}):f.push({rootStepIndex:n,status:"skipped",refKind:"import",refLabel:d.body.path})}if(!(s||_&&(B||L||I===null||A)))continue;l.push(o.file);let k=q(o.file);ue(R(k,".internal"),{recursive:!0});for(let d of b){let n=R(k,".internal","steps",`${d.stepIndex}-${d.md5.slice(0,8)}`);ue(n,{recursive:!0}),await ne({sessionDir:e.sessionDir,runIndex:d.rec.runIndex,totalRunDirs:d.rec.totalRunDirs,stagingStepDir:n,packTestDir:e.packTestDir})}if(g.length>0){let d=z(o.file);if(w(d))for(let n of pe(d)){let u=parseInt(n.split("-")[0]??"",10);!Number.isNaN(u)&&g.includes(u)&&le(R(d,n),R(k,".internal","steps",n),{recursive:!0})}}for(let d of C){let n=R(d.dir,".internal","steps");if(w(n))for(let u of pe(n))parseInt(u.split("-")[0]??"",10)===d.psIdx&&le(R(n,u),R(k,".internal","steps",u),{recursive:!0})}let fe=f.some(d=>d.status==="failed");if(ee({sourcePath:o.file,title:c.title,rootSteps:c.steps,outcomes:f,overallStatus:s?e.overallStatus:fe?"failed":"passed",startedISO:e.startedISO,durationS:s?e.durationS:0,sessionId:e.sessionId,outPath:R(k,"Result.md")}),s){let d={};e.commitId&&(d.commit_id=e.commitId),e.tmsIds.testId&&(d.test_id=e.tmsIds.testId),e.tmsIds.testcaseId&&(d.testcase_id=e.tmsIds.testcaseId),e.tmsIds.projectId&&(d.project_id=e.tmsIds.projectId),e.tmsIds.folderId&&(d.folder_id=e.tmsIds.folderId),e.tmsIds.orgId&&(d.org_id=e.tmsIds.orgId),e.tmsIds.sessionName&&(d.session_name=e.tmsIds.sessionName),Oe(R(k,".internal","meta.json"),JSON.stringify(d,null,2)+`
|
|
5
|
+
`,"utf8");let n=R(e.sessionDir,"execution.json");if(w(n))try{ae(n,R(k,".internal","execution.json"))}catch{}if(e.codeExportDir){let u=e.codeExportLanguage??"python",v=R(k,`playwright-${u}-code`);try{de(e.codeExportDir,v)}catch(O){process.stderr.write(`warn: codegen copy failed: ${O.message}
|
|
6
|
+
`)}}}else if(o.kind==="test"){let d=J(o.file);if(w(d))try{ae(d,R(k,".internal","meta.json"))}catch{}}!s&&M.length>0&&f.every(n=>n.status!=="skipped")&&a.push({unitFile:o.file,dirs:M.filter(n=>w(n))})}return{changedUnitFiles:l,legacySweep:a}}function ht(e){for(let t of e)try{Fe(t,{recursive:!0,force:!0})}catch{}}function ce(e,t){let r=e.trace[0].stepIndex,l=t.find(o=>o.rootStepIndex===r);if(!l)return"skipped";if(l.status==="passed")return"passed";if(l.status==="skipped")return"skipped";let a=e.trace.slice(1).map(o=>o.stepIndex),i=l.failedSubStepIndex??[],p=Math.min(a.length,i.length);for(let o=0;o<p;o++)if(a[o]!==i[o])return a[o]<i[o]?"passed":"skipped";return a.length===i.length?"failed":a.length<i.length?"passed":"skipped"}export{ee as a,Ye as b,Ze as c,et as d,tt as e,de as f,mt as g,ht as h};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
var v=()=>!!process.env.KANE_DEV_MODE,r=[],g=!1,m=null,a=null,d=null,s=null,u=[];function h(e){if(s=e,e&&u.length>0){let t=u;u=[];for(let n of t)try{e.log(n.level,n.event,n.message,n.context)}catch{}}}function y(e,t,n,o){if(s){try{s.log(e,t,n,o)}catch{}return}u.push({level:e,event:t,message:n,context:o})}function R(){return s}function w(){return g}function E(e,t){r=r.filter(n=>n.name!==e),r.push({name:e,fn:t})}function $(e){r=r.filter(t=>t.name!==e)}function L(e,t){let n=r.find(i=>i.name===e);if(!n)return;r=r.filter(i=>i.name!==e);let o=!0;try{n.fn()}catch(i){o=!1,process.stderr.write(`[exit-manager] cleanup(${e}) failed: ${i instanceof Error?i.message:String(i)}
|
|
3
|
+
`)}t&&o&&v()&&process.stderr.write(`[exit-manager] cleanup(${e}): ${t}
|
|
4
|
+
`)}function f(e,t,n=!1,o){if(g){process.exit(m??e);return}if(g=!0,m=e,n&&s)try{s.log("error","CRASH",t),s.shutdownSync()}catch{}let i=[...r].reverse(),l=[];for(let c of i)try{c.fn(),l.push(c.name)}catch(p){process.stderr.write(`[exit-manager] cleanup(${c.name}) failed: ${p instanceof Error?p.message:String(p)}
|
|
5
|
+
`)}if(r=[],v()&&(process.stderr.write(`[exit-manager] shutdown(${e}): ${t}
|
|
6
|
+
`),l.length>0&&process.stderr.write(`[exit-manager] cleaned up: ${l.join(", ")}
|
|
7
|
+
`)),n){if(d)try{d()}catch{}e===130||e===143||(process.stderr.write(`
|
|
8
|
+
kane-cli crashed: ${t}
|
|
9
|
+
`+(l.length>0?`Resources cleaned up (${l.join(", ")}).
|
|
10
|
+
`:"")),o&&v()?process.stderr.write(`${o}
|
|
11
|
+
`):process.stderr.write(`(re-run with KANE_DEV_MODE=1 for the full stack)
|
|
12
|
+
`)),process.exit(e);return}if(a&&!n){a();return}process.exit(e)}function S(e){a=e}function k(e){d=e}var x=!1;function I(){x||(x=!0,process.on("SIGINT",()=>{f(130,"Received SIGINT",!0)}),process.on("SIGTERM",()=>{f(143,"Received SIGTERM",!0)}),process.on("uncaughtException",e=>{f(1,`Uncaught exception: ${e.name}: ${e.message}`,!0,e.stack)}),process.on("unhandledRejection",e=>{f(1,`Unhandled rejection: ${String(e)}`,!0,e instanceof Error?e.stack:void 0)}))}function D(){r=[],g=!1,m=null,a=null,d=null,s=null,u=[],x=!1}export{h as a,y as b,R as c,w as d,E as e,$ as f,L as g,f as h,S as i,k as j,I as k,D as l};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{existsSync as c}from"fs";import{dirname as m,resolve as i}from"path";import{fileURLToPath as d}from"url";var g=m(d(import.meta.url));function f(){return[i(g,".."),i(g,"../../..")]}function p(r){return{"darwin-arm64":"kane-cli-darwin-arm64","darwin-x64":"kane-cli-darwin-x64","linux-x64":"kane-cli-linux-x64","linux-arm64":"kane-cli-linux-arm64","win32-x64":"kane-cli-win-x64"}[r]??null}function S(){let r=p(`${process.platform}-${process.arch}`),n=process.platform==="win32"?"assurance-agent.exe":"assurance-agent";for(let e of f()){for(let t of r?["@testmuai","@lambdatestincprivate"]:[]){let a=i(e,"node_modules",t,r,"bin",n);if(c(a))return{cmd:a,args:[]}}let s=i(e,"../assurance-agent/dist",n);if(c(s))return{cmd:s,args:[]};let o=i(e,"../assurance-agent/main.py");if(c(o)){let t=i(e,"../assurance-agent/.venv/bin/python");return{cmd:c(t)?t:"python3",args:[o]}}}return null}function T(r,n={}){return{...process.env,...n,TESTMUAI_SOURCE:"kane-cli",TESTMUAI_SESSION_ID:r,ASSURANCE_LOG_LEVEL:process.env.ASSURANCE_LOG_LEVEL??"info"}}async function v(){if(process.env.TESTMUAI_API_KEY||process.env.TESTMUAI_BASIC_AUTH)return{};try{let{CredentialsManager:r}=await import("./credentials-L63BBW2S.js"),n=process.env.TESTMUAI_ENV==="stage"?"stage":"prod",e=new r,s=e.getActiveProfile()??"default",o={TESTMUAI_ENV:n},t=e.loadBasicAuth(s,n);if(t)return o.TESTMUAI_BASIC_AUTH=Buffer.from(`${t.username}:${t.access_key}`,"utf8").toString("base64"),o;let a=e.loadCredentials(s,n);if(a){try{let{refreshOAuthToken:l}=await import("./token-refresh-OGBTJGZ2.js");await l({creds:e,profile:s,env:n,credentials:a})}catch{}let u=e.loadCredentials(s,n)??a;if(typeof u.access_token=="string")return o.TESTMUAI_API_KEY=u.access_token,o}return{}}catch{return{}}}export{p as a,S as b,T as c,v as d};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as b}from"./chunk-NSSKSXCT.js";import{x as l}from"./chunk-HMGNPFXP.js";import{a as f}from"./chunk-HCBYKLMW.js";import{a as m,b as s}from"./chunk-C44QQJR4.js";import{e as p}from"./chunk-UR6MHSHU.js";var u=p(f(),1),T=5;function _({thinking:t,expanded:e,thinkingDone:o,maxLines:i=T}){if(!e)return(0,u.jsxs)(m,{paddingX:1,children:[(0,u.jsx)(s,{color:l.dim,children:o?"\u2237 thinking complete ":"\u2237 thinking\u2026 "}),(0,u.jsx)(s,{color:l.muted,children:o?"(ctrl+t to view)":"(ctrl+t to show)"})]});let g=t.split(`
|
|
3
|
+
`),n=Math.max(0,g.length-i),a=n>0?g.slice(-i).join(`
|
|
4
|
+
`):t;return(0,u.jsxs)(b,{variant:"default",paddingX:1,children:[n>0&&(0,u.jsxs)(s,{color:l.muted,children:["\u22EE (",n," earlier line",n===1?"":"s"," hidden)"]}),(0,u.jsx)(s,{color:l.dim,children:a}),o&&(0,u.jsx)(s,{color:l.muted,children:"\u2014 thinking complete"})]})}function k(t){let e=t;return e=e.replace(/@TS\{([^}]+)\}/g,"@S{$1}"),e=e.replace(/@TS-(\d+)/g,(o,i)=>`@S${parseInt(i,10)}.C1`),e=e.replace(/@TS(\d+)/g,(o,i)=>`@S${parseInt(i,10)}`),e=e.replace(/\\n/g,`
|
|
5
|
+
`),e}var c=p(f(),1),B=t=>t!==void 0&&/[A-Za-z0-9]/.test(t);function x(t){let e=[],o="",i=()=>{o&&(e.push({text:o}),o="")},g=(a,d,r)=>(a===0||!B(t[a-1]))&&(d+r>=t.length||!B(t[d+r])),n=0;for(;n<t.length;){let a=t.slice(n,n+2),d=t[n];if(a==="**"||a==="__"){let r=t.indexOf(a,n+2);if(r!==-1&&r>n+2&&(a==="**"||g(n,r,2))){i(),e.push({text:t.slice(n+2,r),bold:!0}),n=r+2;continue}}if(d==="`"){let r=t.indexOf("`",n+1);if(r!==-1&&r>n+1){i(),e.push({text:t.slice(n+1,r),code:!0}),n=r+1;continue}}if(d==="*"||d==="_"){let r=t.indexOf(d,n+1);if(r!==-1&&r>n+1&&(d==="*"||g(n,r,1))){i(),e.push({text:t.slice(n+1,r),italic:!0}),n=r+1;continue}}o+=d,n+=1}return i(),e.length===0&&e.push({text:""}),e}function h(t){return t.map((e,o)=>(0,c.jsx)(s,{bold:e.bold,italic:e.italic,color:e.code?l.dim:void 0,children:e.text},o))}function S(t){return t.split(`
|
|
6
|
+
`).map(e=>{if(e.trim()==="")return{kind:"blank"};let o=e.match(/^\s*[-*+]\s+(.*)$/);if(o)return{kind:"bullet",segs:x(o[1])};let i=e.match(/^\s*(\d+)\.\s+(.*)$/);if(i)return{kind:"numbered",n:i[1],segs:x(i[2])};let g=e.match(/^#{1,6}\s+(.*)$/);return g?{kind:"heading",segs:x(g[1])}:{kind:"para",segs:x(e)}})}function R(t,e,o=""){switch(t.kind){case"blank":return(0,c.jsx)(s,{children:o||" "},e);case"heading":return(0,c.jsxs)(s,{bold:!0,children:[o,h(t.segs)]},e);case"bullet":return(0,c.jsx)(m,{marginLeft:1,children:(0,c.jsxs)(s,{children:[o,"\u2022 ",h(t.segs)]})},e);case"numbered":return(0,c.jsx)(m,{marginLeft:1,children:(0,c.jsxs)(s,{children:[o,`${t.n}. `,h(t.segs)]})},e);default:return(0,c.jsxs)(s,{children:[o,h(t.segs)]},e)}}function E({text:t}){let e=S(k(t));return(0,c.jsxs)(m,{marginBottom:1,children:[(0,c.jsx)(s,{color:l.generateAccent,children:"\u2503 "}),(0,c.jsx)(m,{flexDirection:"column",children:e.map((o,i)=>R(o,i))})]})}export{E as a,_ as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{x as m}from"./chunk-
|
|
2
|
+
import{x as m}from"./chunk-HMGNPFXP.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};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{b as u,c as p}from"./chunk-MJFYMMX2.js";import{spawn as m}from"child_process";var y=new Set(["progress","ask_user","graph_query","proposal","design","error","done","reasoning_delta","reasoning_done","tool_activity","decision_activity","text_delta","usage","receipt","chat_ops","session_paused","session_complete"]);function v(l,s={}){let a=s.spawnCmd!==void 0?s.spawnCmd:u();if(!a)throw new Error("assurance-agent not found \u2014 expected an npm platform package, a sibling assurance-agent/dist binary, or assurance-agent/main.py (dev)");let n=m(a.cmd,a.args,{stdio:["pipe","pipe","pipe"],env:p(l.session_id,s.auth)});if(n.stdin.write(JSON.stringify(l)+`
|
|
3
|
+
`),s.onStderr){let e="";n.stderr.on("data",r=>{e+=r.toString("utf8");let i;for(;(i=e.indexOf(`
|
|
4
|
+
`))>=0;){let o=e.slice(0,i);e=e.slice(i+1),o.trim()&&s.onStderr(o)}})}let g=new Promise(e=>{n.on("exit",(r,i)=>e({code:r,signal:i}))});async function*f(){let e="",r=!1;for await(let i of n.stdout){e+=i.toString("utf8");let o;for(;(o=e.indexOf(`
|
|
5
|
+
`))>=0;){let d=e.slice(0,o).trim();if(e=e.slice(o+1),!d)continue;let c;try{c=JSON.parse(d)}catch{s.onWarn?.(`agent: skipping malformed line: ${d.slice(0,120)}`);continue}let t=c;if(!t||typeof t!="object"||!y.has(t.type)){s.onWarn?.(`agent: skipping unknown event type "${t&&typeof t=="object"?String(t.type??"?"):"?"}"`);continue}if(yield t,t.type==="done"){r=!0;break}}if(r)break}await g.catch(()=>{})}return{events:f(),send:e=>{n.stdin&&!n.stdin.destroyed&&n.stdin.write(JSON.stringify(e)+`
|
|
6
|
+
`)},kill:()=>{n.kill("SIGTERM")},exited:g}}export{v as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{d as g}from"./chunk-IACKIGPX.js";function $(s,n){let t=null;for(let[i,e]of s.designOf)i!==n&&s.tipOf(i)!==n||(t==null||e.seq>t.seq)&&(t={...e,designed_at_cid:i});return t}function v(s,n){let t=new Map;for(let[c,o]of s.superseded)o!=null&&t.set(o,c);let i=[n],e=n;for(;t.has(e);)e=t.get(e),i.unshift(e);return i}function h(s,n,t){let i=s.resolve(n);if(!i){let r=[...s.names.keys()].filter(m=>m.startsWith("uc-")).sort().slice(0,6);return{ok:!1,code:2,message:`unknown use-case '${n}' \u2014 no live node by that logical id or cid${r.length?` (known: ${r.join(", ")})`:""}`}}let e=i.tip;if(s.superseded.has(e)&&s.superseded.get(e)===null)return{ok:!1,code:2,message:`use-case '${n}' was removed (tombstoned) \u2014 nothing to design`};let c=s.nodeLabel.get(e);if(c!==g.USECASE)return{ok:!1,code:2,message:`'${n}' is a ${c??"missing node"}, not a use-case \u2014 design runs per use-case`};let o=s.nameOf.get(e)??s.nameOf.get(i.cid)??e.slice(0,19);if(s.trust.get(e)==="archived"){let r=s.archivedReason.get(e);return{ok:!1,code:2,message:`use-case '${o}' is archived${r?` (${r})`:""} \u2014 design runs only over live use-cases`}}let d=$(s,e);if(d==null||t)return{ok:!0};let a=v(s,e),l=a.length;if(d.designed_at_cid===e)return{ok:!1,code:2,message:`'${o}' is already designed @ v${l} \u2014 current; use --force to redesign`};let u=a.indexOf(d.designed_at_cid),f=u>=0?`v${u+1}`:"an earlier version";return{ok:!1,code:2,message:`'${o}' was designed @ ${f} \u2014 the use-case is now @ v${l} (STALE); use --force to redesign`}}export{$ as a,h as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{x as o}from"./chunk-
|
|
2
|
+
import{x as o}from"./chunk-HMGNPFXP.js";import{a as m}from"./chunk-HCBYKLMW.js";import{a as e,b as i}from"./chunk-C44QQJR4.js";import{e as d}from"./chunk-UR6MHSHU.js";var r=d(m(),1),s={default:o.muted,error:o.red,success:o.green,info:o.orange,warning:o.orange};function h({title:t,titleColor:a,borderColor:l,variant:n="default",children:c,width:u,paddingX:x=2,paddingY:g=0,marginBottom:f=0}){let p=l??s[n],B=a??(n==="default"?o.orange:s[n]);return(0,r.jsxs)(e,{flexDirection:"column",marginBottom:f,children:[t&&(0,r.jsx)(e,{marginBottom:0,children:(0,r.jsxs)(i,{color:B,bold:!0,children:[" ",t]})}),(0,r.jsx)(e,{borderStyle:"round",borderColor:p,flexDirection:"column",paddingX:x,paddingY:g,width:u,children:c})]})}function k({label:t,value:a,labelColor:l=o.dim,valueColor:n,labelWidth:c=14}){return(0,r.jsxs)(e,{children:[(0,r.jsx)(e,{width:c,flexShrink:0,children:(0,r.jsx)(i,{color:l,children:t})}),(0,r.jsx)(e,{flexShrink:1,children:(0,r.jsx)(i,{color:n,wrap:"wrap",children:a})})]})}function I({label:t}){return(0,r.jsx)(e,{marginTop:1,marginBottom:0,children:(0,r.jsx)(i,{bold:!0,children:t})})}export{h as a,k as b,I as c};
|
|
@@ -1,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-XDW2RGIL.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,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as m}from"./chunk-2WVKOZ6W.js";import{b as f,c as j}from"./chunk-VE3SUJMA.js";import{a as g}from"./chunk-
|
|
2
|
+
import{a as m}from"./chunk-2WVKOZ6W.js";import{b as f,c as j}from"./chunk-VE3SUJMA.js";import{a as g}from"./chunk-KGP7NSXH.js";var _="KaneAI Generated",E="Untitled";async function p(e){let r=e.config.load(),d=new m(g(e.env).tmsBaseUrl,e.tmsCreds.username,e.tmsCreds.access_key),n=e.projectName??_,o=e.folderName??E,t=r.project_id??null,s=r.project_name??null;if(!t){let a=(await d.listProjects()).find(l=>l.name===n);if(a)t=a.project_id,s=a.name,e.log("info","ENSURE_PROJECT_FOUND","Found default project",{project_id:t,name:s});else{let l=await d.createProject(n);t=l.id,s=l.name,e.log("info","ENSURE_PROJECT_CREATED","Created default project",{project_id:t,name:s})}f(e.creds,e.config,e.profile,e.env,{projectId:t,projectName:s})}let c=r.folder_id??null,i=r.folder_name??null,u=!r.project_id;if(!c||u){let a=(await d.listFolders(t)).find(l=>l.name===o);if(a)c=a.id,i=a.name,e.log("info","ENSURE_FOLDER_FOUND","Found default folder",{folder_id:c,name:i});else{let l=await d.createFolder(t,o);c=l.id,i=l.name,e.log("info","ENSURE_FOLDER_CREATED","Created default folder",{folder_id:c,name:i})}f(e.creds,e.config,e.profile,e.env,{folderId:c,folderName:i})}return{projectId:t,projectName:s??n,folderId:c,folderName:i??o}}function A(e,r,d){let n=e.loadProfileConfig(r,d)??{};return{projectId:n.project_id??null,folderId:n.folder_id??null}}function N(e,r){return e.projectId===null||e.folderId===null||r===null?"needs-picker":r.project==="ok"&&r.folder==="ok"?"ok":r.project==="error"&&r.folder==="error"?"ok-tms-degraded":"needs-picker"}var k=(e,r)=>`error: profile "${e}" (${r}) has no project/folder configured AND no TMS credentials were available to auto-configure one.
|
|
3
3
|
|
|
4
4
|
discover IDs:
|
|
5
5
|
kane-cli projects list --search "<keyword>" --limit 10
|
|
@@ -14,4 +14,4 @@ set them:
|
|
|
14
14
|
kane-cli config folder <folder-id>
|
|
15
15
|
`;function C(e,r){return k(e,r)}function D(e){return`info: auto-configured project "${e.projectName}" (${e.projectId}) and folder "${e.folderName}" (${e.folderId}). Change with: kane-cli config project <id> / kane-cli config folder <id>.`}function S(e){return`${JSON.stringify(T(e))}
|
|
16
16
|
`}function T(e){return{type:"project_folder_auto_defaulted",project_id:e.projectId,project_name:e.projectName,folder_id:e.folderId,folder_name:e.folderName}}async function x(e){if(e.isLocal)return e.log("info","GATE_SKIP_LOCAL","Gate skipped (--local)",{}),{status:"skip",reason:"local"};j(e.creds,e.config,e.profile,e.env,e.log);let r=A(e.creds,e.profile,e.env),d=null;if(r.projectId!==null){let o=g(e.env);d=await new m(o.tmsBaseUrl,e.tmsCreds.username,e.tmsCreds.access_key).validateProjectFolder(r.projectId,r.folderId??""),e.log("info","GATE_VALIDATE","TMS project/folder validation",{project:d.project,folder:d.folder,folder_was_cached:r.folderId!==null})}else r.folderId!==null&&(f(e.creds,e.config,e.profile,e.env,{folderId:null,folderName:null}),e.log("warn","GATE_CLEARED_ORPHAN_FOLDER","Cleared orphan folder (no project cached)",{folder_id:r.folderId}),r.folderId=null);let n=N(r,d);if(n==="ok")return{status:"ok",projectId:r.projectId,folderId:r.folderId};if(n==="ok-tms-degraded")return e.log("warn","GATE_TMS_DEGRADED","TMS validation failed; using cached IDs",{project_id:r.projectId,folder_id:r.folderId}),{status:"ok",projectId:r.projectId,folderId:r.folderId};if(d){let o={};d.project==="missing"?(o.projectId=null,o.projectName=null,o.folderId=null,o.folderName=null):d.folder==="missing"&&(o.folderId=null,o.folderName=null),Object.keys(o).length>0&&(f(e.creds,e.config,e.profile,e.env,o),e.log("info","GATE_CLEARED_STALE","Cleared stale cached IDs before re-resolve",{project_cleared:d.project==="missing",folder_cleared:d.folder==="missing"||d.project==="missing"}))}try{let o=await p({creds:e.creds,config:e.config,profile:e.profile,env:e.env,tmsCreds:e.tmsCreds,log:e.log}),t={projectId:o.projectId,projectName:o.projectName,folderId:o.folderId,folderName:o.folderName};return e.log("info","GATE_AUTO_DEFAULTED","Auto-configured project/folder",{project_id:t.projectId,project_name:t.projectName,folder_id:t.folderId,folder_name:t.folderName}),e.onAnnounce?e.onAnnounce(t):process.stderr.write(`${D(t)}
|
|
17
|
-
`),{status:"ok",projectId:t.projectId,folderId:t.folderId,autoDefaulted:t}}catch(o){let t=C(e.profile,e.env);if(e.log("error","GATE_FATAL","Auto-default failed",{profile:e.profile,env:e.env,cached_project_id:r.projectId,cached_folder_id:r.folderId,validation:d,error:o instanceof Error?o.message:String(o)}),e.onFatalExit)e.onFatalExit(t);else{process.stderr.write(t);let{shutdown:s}=await import("./exit-manager-
|
|
17
|
+
`),{status:"ok",projectId:t.projectId,folderId:t.folderId,autoDefaulted:t}}catch(o){let t=C(e.profile,e.env);if(e.log("error","GATE_FATAL","Auto-default failed",{profile:e.profile,env:e.env,cached_project_id:r.projectId,cached_folder_id:r.folderId,validation:d,error:o instanceof Error?o.message:String(o)}),e.onFatalExit)e.onFatalExit(t);else{process.stderr.write(t);let{shutdown:s}=await import("./exit-manager-VCSIUYBR.js");s(2,"Project/folder gate failed")}return{status:"cancelled"}}}export{p as a,A as b,N as c,C as d,D as e,S as f,T as g,x as h};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as z,b as ee,c as te}from"./chunk-S74MQRDN.js";import{c as K,d as V}from"./chunk-QZWQCHXK.js";import{c as J}from"./chunk-2PDWMY2B.js";import{a as Q}from"./chunk-HGL3RM7P.js";import{a as Z}from"./chunk-FPFOW6BS.js";import{b as H}from"./chunk-KFAYCOTB.js";import{b as W}from"./chunk-SQJWMOJQ.js";import{h as E}from"./chunk-M5JQXOCE.js";import{a as O}from"./chunk-2WVKOZ6W.js";import{a as k,b as A,d as Y}from"./chunk-VE3SUJMA.js";import{a as _}from"./chunk-KGP7NSXH.js";import{a as q}from"./chunk-4CRKK5WV.js";import{a as G}from"./chunk-HCBYKLMW.js";import{a as c,b as u,i as I,j as X}from"./chunk-C44QQJR4.js";import{a as ue}from"./chunk-6YGTRKDT.js";import{e as F}from"./chunk-UR6MHSHU.js";var i=F(ue(),1);var r=F(G(),1);function _e({resultRef:h,mode:d="singleshot",loginCompleteRef:f}){let{exit:m}=X(),C=(0,i.useRef)(new q),S=(0,i.useRef)(new Q),v=(0,i.useRef)(new J),t=C.current,l=S.current,$=v.current,ne=K(),[P,g]=(0,i.useState)(d==="login"?"login":"gate"),[L,re]=(0,i.useState)(null),[de,R]=(0,i.useState)(null),[ge,T]=(0,i.useState)(null),[N,oe]=(0,i.useState)(null),[U,B]=(0,i.useState)([]),x=(0,i.useCallback)((e,n,s,o)=>$.log(e,n,s,o),[$]),pe=(0,i.useCallback)((e,n)=>{e?k(t,l,e,n):l.save({project_id:null,project_name:null,folder_id:null,folder_name:null})},[t,l]),y=(0,i.useCallback)(()=>{d==="login"?(f&&(f.current=!0),m()):g("input")},[d,m,f]),D=(0,i.useCallback)((e,n)=>{let s=k(t,l,e,n);if(d==="login"){g("ensure-project");return}Y(s)?y():s.projectId?g("ensure-folder"):g("ensure-project")},[t,l,y,d]);I((e,n)=>{n.ctrl&&e==="c"&&E(0,"Ctrl+C exit")});let M=(0,i.useRef)(!1);i.default.useEffect(()=>{M.current||(M.current=!0,d!=="login"&&te(t,x).then(e=>{re(e),e.status==="authenticated"?D(e.result.profile,e.result.env):e.status==="needs_pick"?g("pick"):(R(e.profile??null),T(e.env??null),g("login"))}).catch(e=>{oe(`Auth check failed: ${e instanceof Error?e.message:String(e)}`)}))},[t,x]);let ie=(0,i.useCallback)(e=>{h.current={objective:e},m()},[h,m]),se=(0,i.useCallback)(async(e,n)=>{t.setActiveProfile(e),t.setDefaultEnv(n),(await ee(t,e,n,x)).status==="authenticated"?D(e,n):(R(e),T(n),g("login"))},[t,x,D]),w=(0,i.useCallback)(()=>{let e=t.getActiveProfile(),n=t.getDefaultEnv();if(!e)return null;let s=_(n),o=t.loadBasicAuth(e,n);return new Z(s.controllerBaseUrl,async()=>t.loadCredentials(e,n)?.access_token??null,o,x)},[t,x]),le=(0,i.useCallback)(async()=>{let e=w();if(!e)return null;let n=e.cached??await e.resolve();if(!n)return null;let s=_(t.getDefaultEnv()),o=new O(s.tmsBaseUrl,n.username,n.access_key);try{let p=(await o.listProjects()).find(b=>b.name==="KaneAI Generated");if(p)return{id:p.project_id,name:p.name};let j=await o.createProject("KaneAI Generated");return{id:j.id,name:j.name}}catch{return null}},[w,t]),ae=(0,i.useCallback)(async e=>{let n=w();if(!n)return null;let s=n.cached??await n.resolve();if(!s)return null;let o=_(t.getDefaultEnv()),a=new O(o.tmsBaseUrl,s.username,s.access_key);try{let j=(await a.listFolders(e)).find(ce=>ce.name==="Untitled");if(j)return{id:j.id,name:j.name};let b=await a.createFolder(e,"Untitled");return{id:b.id,name:b.name}}catch{return null}},[w,t]);if(P==="gate")return(0,r.jsx)(c,{paddingX:1,children:(0,r.jsx)(u,{color:"yellow",children:"Checking authentication..."})});if(N)return(0,r.jsxs)(c,{flexDirection:"column",paddingX:1,children:[(0,r.jsx)(u,{color:"red",children:N}),(0,r.jsx)(u,{color:"gray",children:"Press Ctrl+C to exit."})]});if(P==="pick"&&L?.status==="needs_pick")return(0,r.jsx)(fe,{profiles:L.profiles,onSelect:se});if(P==="login")return(0,r.jsx)(z,{devMode:process.env.KANE_DEV_MODE==="1",profiles:t.listProfiles(),onBasicLogin:async(e,n,s,o)=>{let{validateBasicAuth:a}=await import("./validate-basic-WILRWRRP.js");await a(n,s,o),t.saveBasicAuth(e,n,{username:s,access_key:o}),t.setActiveProfile(e),t.setDefaultEnv(n)},onOAuthLogin:async(e,n)=>{let{LoginFlow:s}=await import("./login-flow-4OJ34VDP.js");t.setDefaultEnv(n),t.setActiveProfile(e),await new s(e,n,t).login()},onComplete:(e,n)=>{R(e),T(n),t.setActiveProfile(e),t.setDefaultEnv(n),D(e,n)},onCancel:()=>{E(0,"Login cancelled")}});if(P==="ensure-project"){let e=t.getActiveProfile()??"default",n=t.getDefaultEnv(),s=()=>{if(d==="login"){g("ensure-folder");return}k(t,l,e,n).folderId?y():g("ensure-folder")};return(0,r.jsxs)(c,{flexDirection:"column",children:[(0,r.jsx)(c,{paddingX:1,marginBottom:1,children:(0,r.jsx)(u,{color:"yellow",children:"Project & folder are required to save tests \xB7 Esc to use defaults \xB7 Ctrl+C to exit"})}),(0,r.jsx)(H,{resolver:w(),currentProjectId:l.load().project_id,env:n,onSelect:(o,a)=>{A(t,l,e,n,{projectId:o,projectName:a}),B(p=>[...p,`\u2713 Project: ${a} (${o})`]),s()},onCancel:async()=>{let o=await le();o&&(A(t,l,e,n,{projectId:o.id,projectName:o.name}),B(a=>[...a,`\u2713 Default project: ${o.name} (${o.id})`]),s())}})]})}if(P==="ensure-folder"){let e=t.getActiveProfile()??"default",n=t.getDefaultEnv(),s=t.loadProfileConfig(e,n);return(0,r.jsxs)(c,{flexDirection:"column",children:[(0,r.jsx)(c,{paddingX:1,marginBottom:1,children:(0,r.jsx)(u,{color:"yellow",children:"Project & folder are required to save tests \xB7 Esc to use defaults \xB7 Ctrl+C to exit"})}),(0,r.jsx)(W,{resolver:w(),projectId:s?.project_id??"",currentFolderId:l.load().folder_id,env:n,onSelect:(o,a)=>{A(t,l,e,n,{folderId:o,folderName:a}),B(p=>[...p,`\u2713 Folder: ${a} (${o})`]),y()},onCancel:async()=>{if(!s?.project_id)return;let o=await ae(s.project_id);o&&(A(t,l,e,n,{folderId:o.id,folderName:o.name}),B(a=>[...a,`\u2713 Default folder: ${o.name} (${o.id})`]),y())}})]})}return P==="input"?(0,r.jsxs)(c,{flexDirection:"column",children:[U.length>0&&(0,r.jsx)(c,{flexDirection:"column",paddingX:1,marginBottom:1,children:U.map((e,n)=>(0,r.jsx)(u,{color:"green",children:e},n))}),(0,r.jsx)(V,{onSubmit:ie,onEscape:()=>E(0,"User pressed Escape"),history:ne,placeholder:"Type an objective..."})]}):(0,r.jsx)(r.Fragment,{})}function fe({profiles:h,onSelect:d}){let[f,m]=(0,i.useState)(0),[C,S]=(0,i.useState)(!1);return I((v,t)=>{if(!C){if(t.escape){E(0,"Profile picker cancelled");return}if(t.upArrow&&f>0&&m(l=>l-1),t.downArrow&&f<h.length-1&&m(l=>l+1),t.return){S(!0);let l=h[f];d(l.profile,l.env).catch(()=>S(!1))}}}),(0,r.jsxs)(c,{flexDirection:"column",paddingX:1,children:[(0,r.jsx)(u,{color:"#ff9500",bold:!0,children:"Select a profile:"}),(0,r.jsx)(c,{marginTop:1,flexDirection:"column",children:h.map((v,t)=>(0,r.jsxs)(u,{children:[t===f?"\u276F ":" ",(0,r.jsx)(u,{color:t===f?"#ff9500":"white",bold:t===f,children:v.profile}),(0,r.jsxs)(u,{color:"gray",children:[" [",v.env,"]"]})]},`${v.profile}-${v.env}`))}),C&&(0,r.jsx)(c,{marginTop:1,children:(0,r.jsx)(u,{color:"yellow",children:"Validating credentials..."})})]})}export{_e as a};
|