@testmuai/kane-cli 0.4.5 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/{ChromeProfilePicker-DHEEFWVV.js → ChromeProfilePicker-HBFXP75A.js} +1 -1
  2. package/dist/{CliFeedbackPrompt-XVBAXCYR.js → CliFeedbackPrompt-WICQY46X.js} +1 -1
  3. package/dist/{CliUploadProgress-4S3BH3LI.js → CliUploadProgress-XJ6CCNCR.js} +1 -1
  4. package/dist/{ConfigView-Q5NNM5T5.js → ConfigView-GPMON37C.js} +1 -1
  5. package/dist/FolderPicker-IZXWPOTS.js +2 -0
  6. package/dist/{HelpView-2T36LFLG.js → HelpView-7SDQKJFW.js} +1 -1
  7. package/dist/{InfoBox-TBM3RTBH.js → InfoBox-PNFLVOCW.js} +1 -1
  8. package/dist/{LinksBox-WRMIRJLF.js → LinksBox-R23D7MOQ.js} +1 -1
  9. package/dist/{ProfilesView-GGYBHIOM.js → ProfilesView-7BXBJQWU.js} +1 -1
  10. package/dist/{ProjectPicker-UEVYQGLY.js → ProjectPicker-ZZQKNTV5.js} +1 -1
  11. package/dist/{SaveSessionPrompt-KYL6AOGP.js → SaveSessionPrompt-HJYSPZH5.js} +1 -1
  12. package/dist/SingleShotApp-SLABQ7BW.js +2 -0
  13. package/dist/{SummaryBox-B4QJDLQD.js → SummaryBox-WWMBNF6O.js} +1 -1
  14. package/dist/TestMdRunView-33RBMIZB.js +2 -0
  15. package/dist/{WhoamiView-BY57RUTR.js → WhoamiView-JEXEKDXI.js} +1 -1
  16. package/dist/{changelog-OM726WGL.js → changelog-74AVV4RG.js} +1 -1
  17. package/dist/{chunk-SNV7DD5M.js → chunk-264ZEJT7.js} +1 -1
  18. package/dist/{chunk-E5WH7UGU.js → chunk-2RXJ7SIN.js} +1 -1
  19. package/dist/{chunk-AYWWHMM7.js → chunk-2TT2RIVP.js} +1 -1
  20. package/dist/{chunk-F22NYY2I.js → chunk-33273OM4.js} +1 -1
  21. package/dist/{chunk-BDMQY6N6.js → chunk-3TNWLCIU.js} +1 -1
  22. package/dist/{chunk-S6DJADYF.js → chunk-554BXLWE.js} +1 -1
  23. package/dist/{chunk-VF6NQFGC.js → chunk-6E4FS7EC.js} +1 -1
  24. package/dist/{chunk-GG73PQBI.js → chunk-6IE22TW6.js} +2 -2
  25. package/dist/{chunk-LY2SBSUM.js → chunk-7NELLGD4.js} +1 -1
  26. package/dist/{chunk-FTWHK7PH.js → chunk-7YZO2QQ6.js} +1 -1
  27. package/dist/{chunk-K77SVBYU.js → chunk-AFUGVKF7.js} +1 -1
  28. package/dist/{chunk-WGYUOXJX.js → chunk-AR6VSIYN.js} +1 -1
  29. package/dist/{chunk-I5KH34BI.js → chunk-BACEOONG.js} +1 -1
  30. package/dist/{chunk-N7OAA2OD.js → chunk-BFYV4TJW.js} +1 -1
  31. package/dist/chunk-BSTC6BLT.js +5 -0
  32. package/dist/{chunk-GVXJKQF7.js → chunk-BY7T5OJN.js} +1 -1
  33. package/dist/{chunk-62ZUB3DG.js → chunk-H7TODYZ2.js} +1 -1
  34. package/dist/{chunk-4D5Z4OAS.js → chunk-HHDG2TGX.js} +1 -1
  35. package/dist/{chunk-XT45Z36Q.js → chunk-HWCBOJOP.js} +1 -1
  36. package/dist/{chunk-X6FNT3EY.js → chunk-J54IX7BP.js} +1 -1
  37. package/dist/{chunk-73TFORTS.js → chunk-J7QJ5Q3J.js} +1 -1
  38. package/dist/{chunk-DVRZITSK.js → chunk-JTXYQ2KH.js} +1 -1
  39. package/dist/{chunk-6XWZHEQR.js → chunk-KKXWOTVX.js} +1 -1
  40. package/dist/{chunk-Q5XYITHT.js → chunk-LAPX4BA7.js} +1 -1
  41. package/dist/{chunk-7XX4XFCV.js → chunk-LFQ2MZYC.js} +1 -1
  42. package/dist/{chunk-4EDPYAMW.js → chunk-NURJMABT.js} +2 -2
  43. package/dist/{chunk-D2J4EILJ.js → chunk-OUO4AO3Z.js} +3 -3
  44. package/dist/{chunk-EWID6VQA.js → chunk-Q3RXDN74.js} +1 -1
  45. package/dist/{chunk-MBK47QLD.js → chunk-SC4KKGUA.js} +1 -1
  46. package/dist/{chunk-HIFHTE2F.js → chunk-T7ECNTOU.js} +2 -2
  47. package/dist/{chunk-EQLDX5LN.js → chunk-TOR7WEDD.js} +1 -1
  48. package/dist/{chunk-5WMT2WVI.js → chunk-TQZPYXN7.js} +1 -1
  49. package/dist/{chunk-SDY6K7ZR.js → chunk-WILJRFXU.js} +1 -1
  50. package/dist/{chunk-UJJX2Y5K.js → chunk-WVAX7IIU.js} +2 -2
  51. package/dist/{chunk-6GWQ2RA4.js → chunk-WXV73W6R.js} +1 -1
  52. package/dist/{chunk-D3NAXZ2R.js → chunk-Y6MB5JP7.js} +9 -9
  53. package/dist/{chunk-T4WDQ7I4.js → chunk-YC7GOEEW.js} +1 -1
  54. package/dist/{generate-headless-6SH67NQN.js → generate-headless-FX7EAINU.js} +2 -2
  55. package/dist/index.js +8 -8
  56. package/dist/{list-commands-4OC75YL3.js → list-commands-M35SC7YD.js} +1 -1
  57. package/dist/login-flow-OBWXOIJ2.js +2 -0
  58. package/dist/{persist-recorded-session-HXVQRBJV.js → persist-recorded-session-V4OYUDBM.js} +1 -1
  59. package/dist/{pipeline-IXEPO6AR.js → pipeline-26FR6BXR.js} +1 -1
  60. package/dist/{recording-banner-G3BDHTZU.js → recording-banner-5V66U2RF.js} +1 -1
  61. package/dist/{require-project-folder-VSJ3UJL6.js → require-project-folder-J5IFDFQZ.js} +1 -1
  62. package/dist/{run-test-md-JVYGWYZJ.js → run-test-md-XSR7NXBR.js} +3 -3
  63. package/dist/{skill-installer-2CMWR2TX.js → skill-installer-WZCILRBJ.js} +1 -1
  64. package/dist/tcg-generate-2H5AUMWY.js +2 -0
  65. package/dist/testmd-actions-QKMEYBUJ.js +2 -0
  66. package/dist/token-refresh-VUGZH2DA.js +2 -0
  67. package/dist/{validate-basic-F6DP3VUX.js → validate-basic-3W5ODPRI.js} +1 -1
  68. package/dist/{version-check-JHH3FYZ4.js → version-check-43WUFMCW.js} +1 -1
  69. package/package.json +6 -6
  70. package/dist/FolderPicker-T575L6QE.js +0 -2
  71. package/dist/SingleShotApp-DOEY5FTW.js +0 -2
  72. package/dist/TestMdRunView-J3M33BMA.js +0 -2
  73. package/dist/chunk-K74XYWPF.js +0 -5
  74. package/dist/login-flow-GLIUZ3XD.js +0 -2
  75. package/dist/tcg-generate-JNA7RLSH.js +0 -2
  76. package/dist/testmd-actions-3YF6E3W6.js +0 -2
  77. package/dist/token-refresh-TPRQLK6B.js +0 -2
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as Le}from"./chunk-K74XYWPF.js";import{a as de,b as je}from"./chunk-6XWZHEQR.js";import{d as Oe,f as pe}from"./chunk-LOIRZFV3.js";import{a as Pe}from"./chunk-7XX4XFCV.js";import{a as Ce}from"./chunk-AYWWHMM7.js";import{b as _e}from"./chunk-C6S4IEBC.js";import{x as l}from"./chunk-X6FNT3EY.js";import{a as N}from"./chunk-HCBYKLMW.js";import{a as u,b as i,i as Ee,j as ke,k as xe}from"./chunk-C44QQJR4.js";import{a as le}from"./chunk-6YGTRKDT.js";import{e as j}from"./chunk-UR6MHSHU.js";var te=j(le(),1);var q=j(le(),1);var D=j(le(),1);function fe(e,n){let s=null,c=(g,p)=>{for(let d=0;d<g.length;d++){let o=g[d],w=[...p,d];n(o)&&(s===null||w.length>s.length)&&(s=w),o.children&&o.children.length>0&&c(o.children,w)}};return c(e,[]),s}function me(e,n,s){if(n.length===0)return[...e];let c=n[0],g=[...e],p=g[c];if(n.length===1)g[c]=s(p);else{let d=n.slice(1),o=me(p.children??[],d,s);g[c]={...p,children:o}}return g}function Te(e){let n=e.indexOf(": ");return n>0&&n<15?e.slice(n+2):e}function Be(e){return e.map(n=>{let s=n.children?Be(n.children):n.children;return n.status==="running"?{...n,status:"stopped",phase:void 0,children:s}:s!==n.children?{...n,children:s}:n})}function De(e,n,s,c){let[g,p]=(0,D.useState)(!1),[d,o]=(0,D.useState)([]),[w,I]=(0,D.useState)(null),[k,_]=(0,D.useState)(null),[U,S]=(0,D.useState)(null),[v,B]=(0,D.useState)(null),[O,Q]=(0,D.useState)([]),[G,ne]=(0,D.useState)(null),[se,ge]=(0,D.useState)(void 0),K=(0,D.useRef)(null),H=(0,D.useRef)(null),Z=(0,D.useRef)(0),ee=(0,D.useRef)(!1),h=(0,D.useCallback)(async(x,A)=>{let re=K.current;if(re){try{await re.exited}catch{}K.current=null}o([]),I(null),_(null),S(null),B(null),Q([]),ne(null),ge(x.max_steps),p(!0),H.current=null,Z.current=0;let F;try{F=Le(x,A)}catch(X){S(X instanceof Error?X.message:String(X)),p(!1);return}K.current=F,Oe("runner",()=>F.cancel()),(async()=>{ee.current=!1;let X=!1;for await(let t of F.events){if(ee.current)break;switch(t.type){case"run_start":if(t.child_id)break;if(H.current&&!H.current.isSingleFlow){let E=Z.current;Z.current++,o(C=>C.map((b,T)=>T===E?{...b,status:"running"}:b.status==="running"&&!b.children?.some(a=>a.status==="running")?{...b,status:b.children?.some(a=>a.status==="failed")?"failed":"passed"}:b))}break;case"bifurcation":{let E=t.flows??[],C=t.count??E.length,b={flows:E,isSingleFlow:t.is_single_flow??C<=1};B(b),H.current=b,Z.current=0,o(E.map((T,a)=>({index:a+1,objective:T??`Flow ${a+1}`,status:"pending"})));break}case"step_start":{n?.("STEP_START",`Step ${t.index} started`,{index:t.index,objective:t.objective,child_id:t.child_id});let E=t.index,C=t.objective??`Step ${E}`,b=t.child_id,T=H.current&&!H.current.isSingleFlow;if(b)o(a=>{let f=fe(a,$=>$.branchChildId===b)??fe(a,$=>$.status==="running");return f?me(a,f,$=>{let L=($.children??[]).map(V=>V.status==="running"&&V.childId===b?{...V,status:"stopped",phase:void 0}:V);return L.push({index:E,objective:C,status:"running",childId:b}),{...$,children:L}}):a});else if(T){let a=Math.max(0,Z.current-1);o(f=>{let $=[...f];if(a>=$.length)return f;let L={...$[a]},ce=[...L.children??[]].map(he=>he.status==="running"&&he.childId===void 0?{...he,status:"stopped",phase:void 0}:he);return ce.push({index:E,objective:C,status:"running"}),L.children=ce,L.status="running",$[a]=L,$})}else o(a=>{let f=Be(a);return f.some(L=>L.index===E)?f.map(L=>L.index===E?{...L,status:"running",objective:C}:L):[...f,{index:E,objective:C,status:"running"}]});break}case"step_event":{n?.("STEP_EVENT",`Step ${t.index} ${t.event}`,{index:t.index,phase:t.event,action_type:t.action_type,detail:t.detail,child_id:t.child_id});let E=t.child_id,C=H.current&&!H.current.isSingleFlow;if(t.event==="cm_init"&&t.checkpoint_count!=null){Q(b=>[...b,t.checkpoint_count]);break}if(t.event==="replay_started"){ne({recordingLength:t.recording_length??0});break}if(t.event==="reasoning"&&t.detail&&t.detail!=="reasoning"&&s?.(t.detail),E){let b=a=>{if(a.index!==t.index||a.childId!==E)return a;let f={phase:t.event};return t.event==="reasoning"&&t.detail&&t.detail!=="reasoning"&&(f.objective=t.detail),t.action_type&&(f.actionType=t.action_type),{...a,...f}},T=a=>a.map(f=>{let $=b(f);return $!==f?$:f.children&&f.children.length>0?{...f,children:T(f.children)}:f});o(a=>a.map(f=>f.children?{...f,children:T(f.children)}:f))}else if(C){let b=Math.max(0,Z.current-1);o(T=>{let a=[...T];if(b>=a.length)return T;let f={...a[b]},$=[...f.children??[]];if(!$.some(V=>V.index===t.index&&V.childId===void 0))$.push({index:t.index,objective:`Step ${t.index}`,status:"running",phase:t.event,actionType:t.action_type});else for(let V=0;V<$.length;V++){if($[V].index!==t.index||$[V].childId!==void 0)continue;let ce={phase:t.event};t.event==="reasoning"&&t.detail&&t.detail!=="reasoning"&&(ce.objective=t.detail),t.action_type&&(ce.actionType=t.action_type),$[V]={...$[V],...ce}}return f.children=$,a[b]=f,a})}else o(b=>b.some(a=>a.index===t.index)?b.map(a=>{if(a.index!==t.index)return a;let f={phase:t.event};return t.event==="reasoning"&&t.detail&&t.detail!=="reasoning"&&(f.objective=t.detail),t.action_type&&(f.actionType=t.action_type),{...a,...f}}):[...Be(b),{index:t.index,objective:`Step ${t.index}`,status:"running",phase:t.event,actionType:t.action_type}]);break}case"step_end":{n?.("STEP_END",`Step ${t.index} ${t.status}`,{index:t.index,status:t.status,duration:t.duration,summary:t.summary,child_id:t.child_id}),c?.();let E=t.child_id,C=H.current&&!H.current.isSingleFlow;if(E){let b=a=>a.index===t.index&&a.childId===E?{...a,status:t.status,duration:t.duration,phase:void 0,objective:a.objective.startsWith("Step ")?Te(t.summary||a.objective):a.objective}:a,T=a=>a.map(f=>{let $=b(f);return $!==f?$:f.children&&f.children.length>0?{...f,children:T(f.children)}:f});o(a=>a.map(f=>f.children?{...f,children:T(f.children)}:f))}else if(C){let b=Math.max(0,Z.current-1);o(T=>{let a=[...T];if(b>=a.length)return T;let f={...a[b]},$=(f.children??[]).map(L=>L.index===t.index&&L.childId===void 0?{...L,status:t.status,duration:t.duration,phase:void 0,objective:L.objective.startsWith("Step ")?Te(t.summary||L.objective):L.objective}:L);return f.children=$,a[b]=f,a})}else o(b=>b.map(T=>T.index===t.index?{...T,status:t.status,duration:t.duration,phase:void 0,objective:T.objective.startsWith("Step ")?Te(t.summary||T.objective):T.objective}:T));{let T=H.current&&!H.current.isSingleFlow?Math.max(0,Z.current-1):0;e?.(t.index,T,t.child_id)}break}case"child_agent_start":{let E=t.objective??"",C=t.child_id;o(b=>{let T=fe(b,a=>a.status==="running");return T?me(b,T,a=>({...a,objective:`${E} (branch)`,phase:`child: ${E.slice(0,50)}`,branchObjective:E,branchChildId:C})):b});break}case"child_agent_end":{let E=t.child_id,C=`child ${t.success?"done":"failed"}`;o(b=>{let T=fe(b,a=>a.branchChildId===E);return T?me(b,T,a=>({...a,phase:C})):b.map(a=>a.phase?.startsWith("child:")?{...a,phase:C}:a)});break}case"ask_user":I(t.question??"");break;case"run_end":o(E=>E.map(C=>C.status==="running"?{...C,status:t.status,phase:void 0}:C)),p(!1),_(t),X=!0;break;case"error":p(!1),S(t.message??"Runner error"),o(E=>E.map(C=>C.status==="running"?{...C,status:"failed",phase:void 0}:C));break}}let{code:ie,signal:ve}=await F.exited,ye=F.stderr,Xe=ie===0&&!ve,ue=[];ie!==null&&ie!==0&&ue.push(`Runner exited with code ${ie}`),ve&&ue.push(`Runner killed by signal ${ve}`),ye&&(!Xe||!X?ue.push(ye):A?.log?.("debug","RUNNER_STDERR_BENIGN","Runner stderr on clean exit",{stderr:ye})),K.current===F&&(ue.length>0&&S(ue.join(`
2
+ import{b as Le}from"./chunk-BSTC6BLT.js";import{a as de,b as je}from"./chunk-KKXWOTVX.js";import{d as Oe,f as pe}from"./chunk-LOIRZFV3.js";import{a as Pe}from"./chunk-LFQ2MZYC.js";import{a as Ce}from"./chunk-2TT2RIVP.js";import{b as _e}from"./chunk-C6S4IEBC.js";import{x as l}from"./chunk-J54IX7BP.js";import{a as N}from"./chunk-HCBYKLMW.js";import{a as u,b as i,i as Ee,j as ke,k as xe}from"./chunk-C44QQJR4.js";import{a as le}from"./chunk-6YGTRKDT.js";import{e as j}from"./chunk-UR6MHSHU.js";var te=j(le(),1);var q=j(le(),1);var D=j(le(),1);function fe(e,n){let s=null,c=(g,p)=>{for(let d=0;d<g.length;d++){let o=g[d],w=[...p,d];n(o)&&(s===null||w.length>s.length)&&(s=w),o.children&&o.children.length>0&&c(o.children,w)}};return c(e,[]),s}function me(e,n,s){if(n.length===0)return[...e];let c=n[0],g=[...e],p=g[c];if(n.length===1)g[c]=s(p);else{let d=n.slice(1),o=me(p.children??[],d,s);g[c]={...p,children:o}}return g}function Te(e){let n=e.indexOf(": ");return n>0&&n<15?e.slice(n+2):e}function Be(e){return e.map(n=>{let s=n.children?Be(n.children):n.children;return n.status==="running"?{...n,status:"stopped",phase:void 0,children:s}:s!==n.children?{...n,children:s}:n})}function De(e,n,s,c){let[g,p]=(0,D.useState)(!1),[d,o]=(0,D.useState)([]),[w,I]=(0,D.useState)(null),[k,_]=(0,D.useState)(null),[U,S]=(0,D.useState)(null),[v,B]=(0,D.useState)(null),[O,Q]=(0,D.useState)([]),[G,ne]=(0,D.useState)(null),[se,ge]=(0,D.useState)(void 0),K=(0,D.useRef)(null),H=(0,D.useRef)(null),Z=(0,D.useRef)(0),ee=(0,D.useRef)(!1),h=(0,D.useCallback)(async(x,A)=>{let re=K.current;if(re){try{await re.exited}catch{}K.current=null}o([]),I(null),_(null),S(null),B(null),Q([]),ne(null),ge(x.max_steps),p(!0),H.current=null,Z.current=0;let F;try{F=Le(x,A)}catch(X){S(X instanceof Error?X.message:String(X)),p(!1);return}K.current=F,Oe("runner",()=>F.cancel()),(async()=>{ee.current=!1;let X=!1;for await(let t of F.events){if(ee.current)break;switch(t.type){case"run_start":if(t.child_id)break;if(H.current&&!H.current.isSingleFlow){let E=Z.current;Z.current++,o(C=>C.map((b,T)=>T===E?{...b,status:"running"}:b.status==="running"&&!b.children?.some(a=>a.status==="running")?{...b,status:b.children?.some(a=>a.status==="failed")?"failed":"passed"}:b))}break;case"bifurcation":{let E=t.flows??[],C=t.count??E.length,b={flows:E,isSingleFlow:t.is_single_flow??C<=1};B(b),H.current=b,Z.current=0,o(E.map((T,a)=>({index:a+1,objective:T??`Flow ${a+1}`,status:"pending"})));break}case"step_start":{n?.("STEP_START",`Step ${t.index} started`,{index:t.index,objective:t.objective,child_id:t.child_id});let E=t.index,C=t.objective??`Step ${E}`,b=t.child_id,T=H.current&&!H.current.isSingleFlow;if(b)o(a=>{let f=fe(a,$=>$.branchChildId===b)??fe(a,$=>$.status==="running");return f?me(a,f,$=>{let L=($.children??[]).map(V=>V.status==="running"&&V.childId===b?{...V,status:"stopped",phase:void 0}:V);return L.push({index:E,objective:C,status:"running",childId:b}),{...$,children:L}}):a});else if(T){let a=Math.max(0,Z.current-1);o(f=>{let $=[...f];if(a>=$.length)return f;let L={...$[a]},ce=[...L.children??[]].map(he=>he.status==="running"&&he.childId===void 0?{...he,status:"stopped",phase:void 0}:he);return ce.push({index:E,objective:C,status:"running"}),L.children=ce,L.status="running",$[a]=L,$})}else o(a=>{let f=Be(a);return f.some(L=>L.index===E)?f.map(L=>L.index===E?{...L,status:"running",objective:C}:L):[...f,{index:E,objective:C,status:"running"}]});break}case"step_event":{n?.("STEP_EVENT",`Step ${t.index} ${t.event}`,{index:t.index,phase:t.event,action_type:t.action_type,detail:t.detail,child_id:t.child_id});let E=t.child_id,C=H.current&&!H.current.isSingleFlow;if(t.event==="cm_init"&&t.checkpoint_count!=null){Q(b=>[...b,t.checkpoint_count]);break}if(t.event==="replay_started"){ne({recordingLength:t.recording_length??0});break}if(t.event==="reasoning"&&t.detail&&t.detail!=="reasoning"&&s?.(t.detail),E){let b=a=>{if(a.index!==t.index||a.childId!==E)return a;let f={phase:t.event};return t.event==="reasoning"&&t.detail&&t.detail!=="reasoning"&&(f.objective=t.detail),t.action_type&&(f.actionType=t.action_type),{...a,...f}},T=a=>a.map(f=>{let $=b(f);return $!==f?$:f.children&&f.children.length>0?{...f,children:T(f.children)}:f});o(a=>a.map(f=>f.children?{...f,children:T(f.children)}:f))}else if(C){let b=Math.max(0,Z.current-1);o(T=>{let a=[...T];if(b>=a.length)return T;let f={...a[b]},$=[...f.children??[]];if(!$.some(V=>V.index===t.index&&V.childId===void 0))$.push({index:t.index,objective:`Step ${t.index}`,status:"running",phase:t.event,actionType:t.action_type});else for(let V=0;V<$.length;V++){if($[V].index!==t.index||$[V].childId!==void 0)continue;let ce={phase:t.event};t.event==="reasoning"&&t.detail&&t.detail!=="reasoning"&&(ce.objective=t.detail),t.action_type&&(ce.actionType=t.action_type),$[V]={...$[V],...ce}}return f.children=$,a[b]=f,a})}else o(b=>b.some(a=>a.index===t.index)?b.map(a=>{if(a.index!==t.index)return a;let f={phase:t.event};return t.event==="reasoning"&&t.detail&&t.detail!=="reasoning"&&(f.objective=t.detail),t.action_type&&(f.actionType=t.action_type),{...a,...f}}):[...Be(b),{index:t.index,objective:`Step ${t.index}`,status:"running",phase:t.event,actionType:t.action_type}]);break}case"step_end":{n?.("STEP_END",`Step ${t.index} ${t.status}`,{index:t.index,status:t.status,duration:t.duration,summary:t.summary,child_id:t.child_id}),c?.();let E=t.child_id,C=H.current&&!H.current.isSingleFlow;if(E){let b=a=>a.index===t.index&&a.childId===E?{...a,status:t.status,duration:t.duration,phase:void 0,objective:a.objective.startsWith("Step ")?Te(t.summary||a.objective):a.objective}:a,T=a=>a.map(f=>{let $=b(f);return $!==f?$:f.children&&f.children.length>0?{...f,children:T(f.children)}:f});o(a=>a.map(f=>f.children?{...f,children:T(f.children)}:f))}else if(C){let b=Math.max(0,Z.current-1);o(T=>{let a=[...T];if(b>=a.length)return T;let f={...a[b]},$=(f.children??[]).map(L=>L.index===t.index&&L.childId===void 0?{...L,status:t.status,duration:t.duration,phase:void 0,objective:L.objective.startsWith("Step ")?Te(t.summary||L.objective):L.objective}:L);return f.children=$,a[b]=f,a})}else o(b=>b.map(T=>T.index===t.index?{...T,status:t.status,duration:t.duration,phase:void 0,objective:T.objective.startsWith("Step ")?Te(t.summary||T.objective):T.objective}:T));{let T=H.current&&!H.current.isSingleFlow?Math.max(0,Z.current-1):0;e?.(t.index,T,t.child_id)}break}case"child_agent_start":{let E=t.objective??"",C=t.child_id;o(b=>{let T=fe(b,a=>a.status==="running");return T?me(b,T,a=>({...a,objective:`${E} (branch)`,phase:`child: ${E.slice(0,50)}`,branchObjective:E,branchChildId:C})):b});break}case"child_agent_end":{let E=t.child_id,C=`child ${t.success?"done":"failed"}`;o(b=>{let T=fe(b,a=>a.branchChildId===E);return T?me(b,T,a=>({...a,phase:C})):b.map(a=>a.phase?.startsWith("child:")?{...a,phase:C}:a)});break}case"ask_user":I(t.question??"");break;case"run_end":o(E=>E.map(C=>C.status==="running"?{...C,status:t.status,phase:void 0}:C)),p(!1),_(t),X=!0;break;case"error":p(!1),S(t.message??"Runner error"),o(E=>E.map(C=>C.status==="running"?{...C,status:"failed",phase:void 0}:C));break}}let{code:ie,signal:ve}=await F.exited,ye=F.stderr,Xe=ie===0&&!ve,ue=[];ie!==null&&ie!==0&&ue.push(`Runner exited with code ${ie}`),ve&&ue.push(`Runner killed by signal ${ve}`),ye&&(!Xe||!X?ue.push(ye):A?.log?.("debug","RUNNER_STDERR_BENIGN","Runner stderr on clean exit",{stderr:ye})),K.current===F&&(ue.length>0&&S(ue.join(`
3
3
  `)),p(!1),pe("runner","Event stream ended"),K.current=null)})().catch(X=>{let ie=[`Runner event loop error: ${X}`];F.exitCode!==null&&F.exitCode!==0&&ie.push(`Exit code: ${F.exitCode}`),F.exitSignal&&ie.push(`Signal: ${F.exitSignal}`),F.stderr&&ie.push(F.stderr),K.current===F&&(S(ie.join(`
4
4
  `)),p(!1),pe("runner","Event loop error"),K.current=null)})},[e,n,s,c]),y=(0,D.useCallback)(x=>{K.current?.sendUserResponse(x),I(null)},[]),R=(0,D.useCallback)(()=>{let x=K.current;x&&(x.sendCancel("user"),p(!1),I(null),setTimeout(()=>{K.current===x&&(pe("runner","User cancelled run"),K.current=null)},5e3))},[]),m=(0,D.useCallback)(()=>{o([]),_(null),S(null)},[]);return(0,D.useEffect)(()=>()=>{ee.current=!0,pe("runner","Component unmounted"),K.current=null},[]),{isRunning:g,steps:d,askingUser:w,lastRunEnd:k,runError:U,bifurcationInfo:v,cmInitCounts:O,replayInfo:G,maxSteps:se,startRun:h,sendAnswer:y,cancelRun:R,clearLastRun:m}}function we(e){let n=e.flatMap(p=>[p,...p.children??[]]),s=n.filter(p=>p.status==="passed").length,c=n.filter(p=>p.status==="failed").length,g=n.filter(p=>p.status==="passed"||p.status==="failed").length;return{passed:s,failed:c,total:g}}function Fe(e){let n=De(e.screenshotDispatcher,e.stepLogger,e.onReasoning,e.onStepComplete),[s,c]=(0,q.useState)(0),[g,p]=(0,q.useState)("idle"),d=(0,q.useRef)("idle"),o=(0,q.useRef)(0),w=(0,q.useRef)(!1),I=(0,q.useRef)(null),k=(0,q.useRef)(null),_=(0,q.useCallback)(v=>{d.current=v,p(v)},[]),U=(0,q.useCallback)(async v=>{let B=await e.getNextConfig(v);if(!B){_("done"),e.onAllComplete?.();return}let O=v?o.current+1:0;o.current=O,c(O),e.onStepStart?.(B,O),I.current=null,k.current=null,_("running"),await n.startRun(B,e.spawnOpts)},[n,e,_]);(0,q.useEffect)(()=>{w.current||(w.current=!0,U(null))},[]),(0,q.useEffect)(()=>{if(!n.lastRunEnd||n.lastRunEnd===I.current||d.current!=="running")return;I.current=n.lastRunEnd,d.current="transitioning",p("transitioning");let v=n.lastRunEnd,B=we(n.steps),O=n.bifurcationInfo,Q={status:v.status==="passed"?"passed":"failed",duration_s:v.duration??0,reason:v.reason,runEnd:v,hadError:!1,stepsPassed:B.passed,stepsFailed:B.failed,stepsTotal:B.total,bifurcationFlows:O&&!O.isSingleFlow?O.flows:null};if(!(e.onStepEnd?.(Q,o.current)??!0)){_("done"),e.onAllComplete?.();return}U(Q)},[n.lastRunEnd]),(0,q.useEffect)(()=>{if(!n.runError||n.runError===k.current||n.lastRunEnd||d.current!=="running")return;k.current=n.runError,d.current="transitioning",p("transitioning");let v=we(n.steps),B={status:"failed",duration_s:0,reason:n.runError,runEnd:null,hadError:!0,stepsPassed:v.passed,stepsFailed:v.failed,stepsTotal:v.total,bifurcationFlows:null};if(!(e.onStepEnd?.(B,o.current)??!0)){_("done"),e.onAllComplete?.();return}U(B)},[n.runError,n.lastRunEnd]);let S=(0,q.useCallback)(()=>{n.cancelRun()},[n]);return{runner:n,currentStepIndex:s,phase:g,cancel:S}}var Ie=j(le(),1);var be=j(N(),1),Ae=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function Me({label:e,hasBifurcation:n=!1}){let[s,c]=(0,Ie.useState)(0),[g,p]=(0,Ie.useState)(0);de(()=>{c(o=>(o+1)%Ae.length)},80),de(()=>{p(o=>(o+1)%4)},400);let d=e??(n?"Planning approach":"Analyzing objective");return(0,be.jsxs)(u,{marginLeft:1,children:[(0,be.jsxs)(i,{color:l.orange,children:[Ae[s]," "]}),(0,be.jsxs)(i,{color:l.dim,children:[d,".".repeat(g+1)]})]})}function Ne(e){if(!e.isRunning||e.replayInfo)return null;let n=e.bifurcationInfo;if(n&&!n.isSingleFlow){let s=e.steps.findIndex(g=>g.status==="running");return(s===-1?e.cmInitCounts.length===0:s>=e.cmInitCounts.length)?{label:s>0?`Planning flow ${s+1}`:void 0,hasBifurcation:!0}:null}return e.cmInitCounts.length>0||e.steps.some(s=>s.children?.length)?null:{hasBifurcation:!!n}}var M=j(le(),1);var Ue=j(le(),1);var Re=j(N(),1),Ye="#ffc580",Je="#ffd9a8",qe="#ffffff";function Ge({text:e,active:n=!0}){let[s,c]=(0,Ue.useState)(0),g=4;if(de(()=>{c(d=>(d+1)%(e.length+g*2))},n?80:null),!n)return(0,Re.jsx)(i,{color:qe,children:e});let p=e.split("").map((d,o)=>{let w=s-g,I=Math.abs(o-w-g/2),k;return I<=g/2?k=Ye:I<=g?k=Je:k=qe,(0,Re.jsx)(i,{color:k,children:d},o)});return(0,Re.jsx)(i,{children:p})}var z=j(N(),1),Qe={starting:l.orange,running:l.orange,passed:l.green,failed:l.red,cancelled:l.dim,timed_out:l.orange};function Se({currentStep:e,maxSteps:n,elapsed:s,status:c}){let{stdout:g}=xe(),p=g?.columns??80,d=Qe[c]??l.orange,o=s<60?`${s.toFixed(1)}s`:`${Math.floor(s/60)}m ${Math.round(s%60)}s`;return(0,z.jsxs)(u,{flexDirection:"column",marginTop:1,children:[(0,z.jsx)(i,{color:l.muted,children:"\u2500".repeat(Math.min(p,60))}),(0,z.jsxs)(u,{children:[(0,z.jsx)(i,{children:" "}),(0,z.jsx)(i,{color:l.dim,children:"Steps "}),(0,z.jsx)(i,{bold:!0,children:e}),(0,z.jsxs)(i,{color:l.dim,children:["/",n]}),(0,z.jsx)(i,{children:" "}),(0,z.jsx)(i,{color:l.dim,children:"Elapsed "}),(0,z.jsx)(i,{bold:!0,children:o}),(0,z.jsx)(i,{children:" "}),(0,z.jsx)(i,{color:l.dim,children:"Status "}),(0,z.jsx)(i,{bold:!0,color:d,children:c})]})]})}var Ze={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 Ke(e){return Ze[e]??"\u25CF"}var oe=j(N(),1);function $e({steps:e,flows:n,cmInitCounts:s,renderStep:c}){return(0,oe.jsxs)(u,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:[(0,oe.jsxs)(i,{color:l.dim,children:["\u2501\u2501 Bifurcated into ",n?.length??e.length," flows \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"]}),e.map((g,p)=>(0,oe.jsxs)(u,{flexDirection:"column",marginTop:p>0?1:0,children:[(0,oe.jsxs)(i,{color:l.orange,children:["Flow ",p+1,": ",n?.[p]??g.objective]}),s&&s[p]!=null&&(0,oe.jsxs)(i,{color:l.dim,children:[" \u25AA Generated task with ",s[p]," checkpoints"]}),g.children&&g.children.length>0?g.children.map(d=>{let o=!!d.branchObjective,w=`f${p}-${d.childId??"p"}-${d.index}`;return o?(0,oe.jsxs)(u,{flexDirection:"column",children:[c({...d,children:void 0},w),(d.children??[]).map(I=>(0,oe.jsx)(u,{marginLeft:2,children:c(I,`${w}-${I.childId??"p"}-${I.index}`)},`${w}-${I.childId??"p"}-${I.index}`))]},`${w}-host`):c(d,w)}):g.status==="pending"&&(0,oe.jsx)(i,{color:l.dim,children:" \u25CB Waiting..."})]},p))]})}var r=j(N(),1);function W({step:e,indent:n=2}){let s=e.actionType?Ke(e.actionType):null,c=e.status==="running",g=e.status==="passed",p=e.status==="failed",d=e.status==="pending"||e.status==="stopped",{stdout:o}=xe(),w=o?.columns??80,I=Math.max(20,w-n-21),k=e.objective??"",_=k.length>I?k.slice(0,I-1)+"\u2026":k,U=(e.duration??0)*1e3,S=e.duration!=null?U<1e3?`${Math.round(U)}ms`:`${(U/1e3).toFixed(1)}s`:"";return(0,r.jsxs)(u,{flexDirection:"column",children:[(0,r.jsxs)(u,{marginLeft:n,children:[(0,r.jsx)(u,{width:4,children:(0,r.jsxs)(i,{color:l.muted,children:[String(e.index).padStart(2," ")," "]})}),(0,r.jsx)(u,{width:3,children:c?(0,r.jsx)(je,{}):g?(0,r.jsx)(i,{color:l.green,bold:!0,children:"\u2713"}):p?(0,r.jsx)(i,{color:l.red,bold:!0,children:"\u2717"}):(0,r.jsx)(i,{color:l.muted,children:"\u25CB"})}),(0,r.jsx)(u,{flexGrow:1,children:c?(0,r.jsx)(Ge,{text:_,active:!0}):p?(0,r.jsx)(i,{color:l.red,children:_}):d?(0,r.jsx)(i,{color:l.dim,children:_}):(0,r.jsx)(i,{color:l.dim,children:_})}),(g||p)&&s?(0,r.jsx)(u,{width:3,marginLeft:1,children:(0,r.jsx)(i,{color:l.muted,children:s})}):(0,r.jsx)(u,{width:3,marginLeft:1}),(0,r.jsx)(u,{width:7,justifyContent:"flex-end",children:(0,r.jsx)(i,{color:l.dim,children:S})})]}),e.children&&e.children.length>0&&(0,r.jsx)(u,{flexDirection:"column",children:e.children.map((v,B)=>(0,r.jsx)(W,{step:v,indent:n+2},`child-${B}`))})]})}function et(e){return e.type==="cm_init"?(0,r.jsx)(u,{marginLeft:2,paddingLeft:1,children:(0,r.jsxs)(i,{color:l.dim,children:["\u25AA Generated task with ",e.count," checkpoints"]})}):(0,r.jsx)(u,{marginLeft:2,paddingLeft:1,children:(0,r.jsx)(W,{step:e.step})})}function We({steps:e,bifurcated:n,flows:s,cmInitCounts:c,maxSteps:g=50,staticSteps:p=!1,onStepCommit:d}){let o=(0,M.useRef)(new Set),w=(0,M.useRef)(!1),I=(0,M.useRef)(new Set),k=(0,M.useRef)(!1),_=(0,M.useRef)(new Set),U=(0,M.useRef)(0);(0,M.useEffect)(()=>{e.length===0&&U.current>0&&(o.current.clear(),w.current=!1,I.current.clear(),k.current=!1,_.current.clear()),U.current=e.length},[e.length]);let S=e.flatMap(h=>[h,...h.children??[]]),v=S.some(h=>h.status==="running"),B=S.some(h=>h.status==="failed"),O=S.length===0||S.every(h=>h.status==="pending"),Q=S.filter(h=>h.status==="passed"||h.status==="failed").length,G;O?G="starting":v?G="running":B?G="failed":G="passed";let ne=(0,M.useRef)(null),[se,ge]=(0,M.useState)(0);(0,M.useEffect)(()=>{S.length===0||O?(ne.current=null,ge(0)):v&&ne.current==null&&(ne.current=Date.now())},[v,O,S.length]),(0,M.useEffect)(()=>{if(!v)return;let h=setInterval(()=>{ne.current!=null&&ge((Date.now()-ne.current)/1e3)},500);return()=>clearInterval(h)},[v]);let K=(0,M.useRef)(new Set),[,H]=(0,M.useState)(0),Z=(0,M.useRef)(!1);(0,M.useEffect)(()=>{if(!d||!p||n)return;let h=[];!Z.current&&c&&c[0]!=null&&(Z.current=!0,c[0]>0&&h.push({key:"cm_init_0",type:"cm_init",count:c[0]}));for(let y of e)(y.status==="passed"||y.status==="failed")&&!K.current.has(y.index)&&(K.current.add(y.index),h.push({key:`step_${y.index}`,type:"step",step:{...y,children:y.children?[...y.children]:void 0}}));if(h.length>0){for(let y of h)d(et(y));H(y=>y+1)}},[e,n,c,p,d]),(0,M.useEffect)(()=>{if(!d||p)return;let h=o.current.size;if(!n&&!k.current&&c&&c[0]!=null&&(k.current=!0,c[0]>0&&d((0,r.jsx)(u,{marginLeft:2,children:(0,r.jsxs)(i,{color:l.dim,children:["\u25A0 Generated task with ",c[0]," checkpoints"]})}))),n&&s&&!w.current&&(w.current=!0,d((0,r.jsx)(i,{color:l.purple,children:"\u2501\u2501 Bifurcated into "+s.length+" flows \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"}))),n){let y=e.flatMap((R,m)=>{let x=R.children??[];return!I.current.has(m)&&x.length>0&&(I.current.add(m),d((0,r.jsx)(i,{color:l.purple,children:" Flow "+(m+1)+": "+(s?.[m]??"")})),c?.[m]!=null&&c[m]>0&&!_.current.has(m)&&(_.current.add(m),d((0,r.jsx)(u,{marginLeft:2,children:(0,r.jsxs)(i,{color:l.dim,children:[" \u25AA Generated task with ",c[m]," checkpoints"]})})))),c?.[m]!=null&&c[m]>0&&I.current.has(m)&&!_.current.has(m)&&(_.current.add(m),d((0,r.jsx)(u,{marginLeft:2,children:(0,r.jsxs)(i,{color:l.dim,children:[" \u25AA Generated task with ",c[m]," checkpoints"]})}))),x});for(let R of y){let m=`${R.childId??"p"}-${R.index}-${R.objective}`;if(!!R.branchObjective){o.current.has(m)||(o.current.add(m),d((0,r.jsx)(u,{marginLeft:2,children:(0,r.jsx)(W,{step:{...R,children:void 0}})})));for(let A of R.children??[]){let re=`child-${R.childId??"p"}-${R.index}-${A.childId??"p"}-${A.index}-${A.objective}`;o.current.has(re)||(A.status==="passed"||A.status==="failed"||A.status==="stopped")&&(o.current.add(re),d((0,r.jsx)(u,{marginLeft:4,children:(0,r.jsx)(W,{step:A})})))}continue}o.current.has(m)||(R.status==="passed"||R.status==="failed"||R.status==="stopped")&&(o.current.add(m),d((0,r.jsx)(u,{marginLeft:2,children:(0,r.jsx)(W,{step:R})})))}}else for(let y of e){let R=`${y.index}-${y.objective}`,m=!!y.branchObjective;m&&!o.current.has(R)&&(o.current.add(R),d((0,r.jsx)(u,{marginLeft:2,children:(0,r.jsx)(W,{step:{...y,children:void 0}})})));for(let x of y.children??[]){let A=`child-${y.index}-${x.childId??"p"}-${x.index}-${x.objective}`;o.current.has(A)||(x.status==="passed"||x.status==="failed"||x.status==="stopped")&&(o.current.add(A),d((0,r.jsx)(u,{marginLeft:4,children:(0,r.jsx)(W,{step:x})})))}!m&&!o.current.has(R)&&(y.status==="passed"||y.status==="failed"||y.status==="stopped")&&(o.current.add(R),d((0,r.jsx)(u,{marginLeft:2,children:(0,r.jsx)(W,{step:{...y,children:void 0}})})))}o.current.size>h&&H(y=>y+1)},[e,d,n,s,c]);let ee=[];if(p&&!n)for(let h of e)K.current.has(h.index)||ee.push(h);else if(d&&!p)if(n)for(let h of e){let y=h.children??[],R=[];for(let m of y){let x=`${m.childId??"p"}-${m.index}-${m.objective}`,A=o.current.has(x);if(m.branchObjective){let re=(m.children??[]).filter(F=>{let X=`child-${m.childId??"p"}-${m.index}-${F.childId??"p"}-${F.index}-${F.objective}`;return!o.current.has(X)});(!A||re.length>0)&&R.push({...m,children:re})}else A||R.push(m)}R.length>0&&ee.push({...h,children:R})}else for(let h of e){let y=`${h.index}-${h.objective}`,R=o.current.has(y),m=(h.children??[]).filter(x=>{let A=`child-${h.index}-${x.childId??"p"}-${x.index}-${x.objective}`;return!o.current.has(A)});R?m.length>0&&ee.push({...h,children:m}):ee.push({...h,children:m})}if(!p){let h=d?ee:e;return(0,r.jsxs)(u,{flexDirection:"column",children:[n?d?h.length>0?(0,r.jsx)(u,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:h.map((R,m)=>(0,r.jsx)(u,{flexDirection:"column",marginTop:m>0?1:0,children:R.children&&R.children.length>0?R.children.map(x=>{let A=!!x.branchObjective,re=`${x.childId??"p"}-${x.index}-${x.objective}`,F=o.current.has(re);return A?(0,r.jsxs)(u,{flexDirection:"column",children:[!F&&(0,r.jsx)(W,{step:{...x,children:void 0}}),(x.children??[]).map(X=>(0,r.jsx)(u,{marginLeft:2,children:(0,r.jsx)(W,{step:X})},`f${m}-${x.index}-${X.childId??"p"}-${X.index}`))]},`f${m}-host-${x.childId??"p"}-${x.index}`):(0,r.jsx)(W,{step:x},`f${m}-${x.childId??"p"}-${x.index}`)}):R.status==="pending"&&(0,r.jsx)(i,{color:l.dim,children:" \u25CB Waiting..."})},m))}):null:(0,r.jsx)($e,{steps:e,flows:s,cmInitCounts:c,renderStep:(R,m)=>(0,r.jsx)(W,{step:R},m)}):(0,r.jsxs)(u,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:[!d&&c&&c[0]!=null&&(0,r.jsxs)(i,{color:l.dim,children:["\u25AA Generated task with ",c[0]," checkpoints"]}),h.map(R=>{let m=`${R.index}-${R.objective}`;return d&&o.current.has(m)?(0,r.jsx)(u,{flexDirection:"column",children:(R.children??[]).map(x=>(0,r.jsx)(u,{marginLeft:2,children:(0,r.jsx)(W,{step:x})},`${x.childId??"p"}-${x.index}`))},`branch-children-${R.index}`):(0,r.jsx)(W,{step:R},R.index)})]}),v&&(0,r.jsx)(Se,{currentStep:Q,maxSteps:g,elapsed:se,status:G})]})}return n?(0,r.jsxs)(u,{flexDirection:"column",children:[(0,r.jsx)($e,{steps:e,flows:s,cmInitCounts:c,renderStep:(h,y)=>(0,r.jsx)(W,{step:h},y)}),v&&(0,r.jsx)(Se,{currentStep:Q,maxSteps:g,elapsed:se,status:G})]}):(0,r.jsxs)(u,{flexDirection:"column",children:[ee.length>0&&(0,r.jsx)(u,{flexDirection:"column",marginLeft:2,paddingLeft:1,children:ee.map(h=>(0,r.jsx)(W,{step:h},h.index))}),v&&(0,r.jsx)(Se,{currentStep:Q,maxSteps:g,elapsed:se,status:G})]})}var ae=j(N(),1);function He({runner:e,runKey:n,onStepCommit:s}){let c=Ne({isRunning:e.isRunning,bifurcationInfo:e.bifurcationInfo,steps:e.steps,cmInitCounts:e.cmInitCounts,replayInfo:e.replayInfo});return(0,ae.jsxs)(ae.Fragment,{children:[c&&(0,ae.jsx)(Me,{label:c.label,hasBifurcation:c.hasBifurcation}),e.isRunning&&e.steps.length>0&&(0,ae.jsx)(We,{steps:e.steps,bifurcated:!!e.bifurcationInfo&&!e.bifurcationInfo.isSingleFlow,flows:e.bifurcationInfo?.flows,cmInitCounts:e.cmInitCounts,maxSteps:e.maxSteps,onStepCommit:s},`run-${n}`)]})}var Y=j(N(),1),tt=64;function nt(e){return e.split(`
5
5
  `).map(n=>n.replace(/^[-–•]\s*/,"").trim()).filter(n=>n.length>0)}function Ve({status:e,summary:n,duration:s,steps:c,stepsPassed:g,stepsFailed:p,reason:d,creditsConsumed:o}){let w=e==="passed",I=w?l.green:l.red,k=w?"\u2713":"\u2717",_=e.toUpperCase(),U=g??(w?c:Math.max(0,c-1)),S=p??(w?0:1),v=S>0?`${c} steps (${U} passed, ${S} failed)`:`${c} steps`,B=s<60?`${s.toFixed(1)}s`:`${Math.floor(s/60)}m ${Math.round(s%60)}s`,O=nt(n);return(0,Y.jsx)(u,{flexDirection:"column",marginTop:1,children:(0,Y.jsxs)(u,{borderStyle:"round",borderColor:I,flexDirection:"column",paddingX:2,paddingY:1,width:tt+6,children:[(0,Y.jsxs)(u,{flexDirection:"column",children:[(0,Y.jsxs)(i,{bold:!0,color:I,children:[k," ",_]}),(0,Y.jsxs)(i,{color:l.dim,wrap:"wrap",children:[v," \xB7 ",B,typeof o=="number"&&o>0?` \xB7 ${parseFloat(o.toFixed(4))} credits`:""]})]}),O.length>0&&(0,Y.jsx)(u,{flexDirection:"column",marginTop:1,marginLeft:1,children:O.map((Q,G)=>(0,Y.jsxs)(u,{marginBottom:G<O.length-1?1:0,children:[(0,Y.jsx)(i,{color:l.orange,children:"\u25CF "}),(0,Y.jsx)(u,{flexShrink:1,children:(0,Y.jsx)(i,{wrap:"wrap",children:Q})})]},G))}),d&&!w&&(0,Y.jsx)(u,{marginTop:1,children:(0,Y.jsxs)(i,{color:l.red,wrap:"wrap",children:["Reason: ",d]})})]})})}var J=j(N(),1);function ze({message:e,code:n,remediation:s,docsUrl:c}){return(0,J.jsx)(Ce,{title:"Error",variant:"error",children:(0,J.jsxs)(u,{flexDirection:"column",paddingY:1,children:[(0,J.jsxs)(i,{color:l.red,bold:!0,children:[" \u2717 ",e]}),n&&(0,J.jsxs)(u,{marginTop:0,marginLeft:5,children:[(0,J.jsx)(i,{color:l.muted,children:"Code: "}),(0,J.jsx)(i,{color:l.dim,children:n})]}),s&&(0,J.jsxs)(u,{flexDirection:"column",marginTop:1,marginLeft:5,children:[(0,J.jsx)(i,{color:l.green,bold:!0,children:"Fix:"}),(0,J.jsxs)(i,{color:l.orange,children:["$ ",s]})]}),c&&(0,J.jsxs)(u,{marginTop:1,marginLeft:5,children:[(0,J.jsx)(i,{color:l.muted,children:"Docs: "}),(0,J.jsx)(i,{color:l.orange,underline:!0,children:c})]})]})})}var P=j(N(),1);function sn(e){let{exit:n}=ke(),{append:s}=_e(),c=(0,te.useRef)(!1);(0,te.useEffect)(()=>{c.current||(c.current=!0,s((0,P.jsx)(u,{flexDirection:"column",marginBottom:1,children:(0,P.jsxs)(u,{borderStyle:"round",borderColor:"#dc4e08",paddingX:2,children:[(0,P.jsx)(i,{color:"#ff9500",bold:!0,children:"KaneAI CLI"}),(0,P.jsx)(i,{color:l.dim,children:" \u2502 "}),(0,P.jsx)(i,{color:l.orange,children:e.topBanner.model}),(0,P.jsx)(i,{color:l.dim,children:" \u2502 "}),(0,P.jsx)(i,{color:l.dim,children:e.topBanner.auth})]})})),s((0,P.jsx)(rt,{data:e.globalConfig})),e.priorAttemptRollup&&s((0,P.jsx)(i,{color:l.dim,children:` \u21B3 replayed ${e.priorAttemptRollup.startIdx}..${e.priorAttemptRollup.endIdx-1} (${e.priorAttemptRollup.count} steps, from prior attempt)`})))},[]);let g=(0,te.useRef)(null),p=(0,te.useCallback)(async S=>{let v=await e.getNextStep(S);return v?(g.current=v,v.config):(g.current=null,null)},[e]),d=(0,te.useCallback)((S,v)=>{let B=g.current;if(!B)return;let O=B.mode==="replay"?"cyan":"#dc4e08",Q=B.modeReason?` (${B.modeReason})`:"",G=B.perStepOverrides?Object.entries(B.perStepOverrides):[];s((0,P.jsxs)(u,{flexDirection:"column",marginBottom:0,children:[(0,P.jsxs)(i,{children:[(0,P.jsxs)(i,{color:l.dim,children:[B.banner.stepLabel," "]}),(0,P.jsxs)(i,{color:O,children:["[",B.mode,"]"]}),(0,P.jsx)(i,{color:l.dim,children:Q})]}),(0,P.jsx)(i,{color:l.dim,children:B.banner.objective}),G.length>0&&(0,P.jsxs)(i,{color:l.dim,children:["overrides: ",G.map(([ne,se])=>`${ne}=${se}`).join(", ")]})]}))},[s]),o=(0,te.useRef)(0),w=(0,te.useRef)(!1),I=(0,te.useCallback)((S,v)=>(S.hadError?s((0,P.jsx)(ze,{message:S.reason??"Runner error",code:"RUNNER_ERROR"})):s((0,P.jsx)(u,{flexDirection:"column",marginBottom:1,children:(0,P.jsx)(Ve,{status:S.status,summary:S.runEnd?.summary??"",duration:S.runEnd?.duration??0,steps:S.stepsTotal,stepsPassed:S.stepsPassed,stepsFailed:S.stepsFailed,reason:S.runEnd?.reason,creditsConsumed:S.runEnd?.credits_consumed})})),e.onStepEnd?.(S,v)??!0),[s,e]),k=Fe({getNextConfig:p,onStepStart:d,onStepEnd:I,onAllComplete:()=>{e.onAllComplete(),e.exitOnComplete!==!1&&setImmediate(()=>n())},screenshotDispatcher:e.screenshotDispatcher,stepLogger:e.stepLogger,onReasoning:e.onReasoning,onStepComplete:e.onStepComplete,spawnOpts:e.spawnOpts}),_=250,U=5e3;return Ee((S,v)=>{if(v.ctrl&&S==="c"){let B=Date.now(),O=B-o.current;if(O<_)return;w.current&&O<U?(k.cancel(),e.onCancel?.(),e.exitOnComplete!==!1&&setImmediate(()=>n())):(w.current=!0,s((0,P.jsx)(i,{color:"yellow",children:"press Ctrl+C again to cancel run"}))),o.current=B}}),(0,P.jsx)(u,{flexDirection:"column",children:k.phase!=="done"&&(0,P.jsx)(He,{runner:k.runner,runKey:k.currentStepIndex,onStepCommit:s})})}function rt({data:e}){return(0,P.jsx)(Pe,{title:"test.md run",titleColor:"#ff9500",borderColor:l.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{We as a,Me as b,Ne as c,De as d,we as e,Ve as f,ze as g,sn as h};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as h}from"./chunk-XT45Z36Q.js";import{x as l}from"./chunk-X6FNT3EY.js";import{a as A}from"./chunk-HCBYKLMW.js";import{a as c,b as f,i as P}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as x}from"./chunk-UR6MHSHU.js";var L=x(B(),1);var n=x(A(),1);function S(r,d,s,u,m){let p=s==="basic"&&u?`basic (${u})`:s,i=20,a=`${r} [${d}]`,g="\xB7".repeat(Math.max(2,i-a.length+3));return{label:`${a} ${g} ${p}`,profile:r,env:d,isActive:m}}function M({creds:r,onSwitch:d,onCancel:s}){let u=r.listProfiles(),m=r.getActiveProfile(),p=r.getDefaultEnv(),i=u.map(e=>{let o=r.loadBasicAuth(e.profile,e.env),t=r.loadCredentials(e.profile,e.env)!==null,v=o?"basic":t?"oauth":"none",b=o?o.username:null,w=e.profile===m&&e.env===p;return S(e.profile,e.env,v,b,w)}),[a,g]=(0,L.useState)(()=>{let e=i.findIndex(o=>o.isActive);return e>=0?e:0});return P((e,o)=>{if(o.escape){s();return}if(o.upArrow){g(t=>Math.max(0,t-1));return}if(o.downArrow){g(t=>Math.min(i.length-1,t+1));return}if(o.return&&i[a]){let t=i[a];t.isActive||d(t.profile,t.env),s();return}}),i.length===0?(0,n.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:l.orange,paddingX:2,paddingY:1,children:[(0,n.jsx)(f,{color:l.orange,bold:!0,children:"Profiles"}),(0,n.jsx)(c,{marginTop:1,children:(0,n.jsx)(f,{color:l.dim,children:"No profiles \u2014 use Login to create one"})}),(0,n.jsx)(h,{bindings:[],escBackLabel:"back"})]}):(0,n.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:l.orange,paddingX:2,paddingY:1,children:[(0,n.jsx)(f,{color:l.orange,bold:!0,children:"Profiles"}),(0,n.jsx)(c,{flexDirection:"column",marginTop:1,children:i.map((e,o)=>{let t=o===a,v=t?"\u276F ":" ",b=e.isActive?l.green:t?l.orange:void 0;return(0,n.jsxs)(f,{color:b,children:[v,e.label,e.isActive?" \u25CF active":""]},`${e.profile}-${e.env}`)})}),(0,n.jsx)(h,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"switch"}],escBackLabel:"back"})]})}export{S as a,M as b};
2
+ import{a as h}from"./chunk-HWCBOJOP.js";import{x as l}from"./chunk-J54IX7BP.js";import{a as A}from"./chunk-HCBYKLMW.js";import{a as c,b as f,i as P}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as x}from"./chunk-UR6MHSHU.js";var L=x(B(),1);var n=x(A(),1);function S(r,d,s,u,m){let p=s==="basic"&&u?`basic (${u})`:s,i=20,a=`${r} [${d}]`,g="\xB7".repeat(Math.max(2,i-a.length+3));return{label:`${a} ${g} ${p}`,profile:r,env:d,isActive:m}}function M({creds:r,onSwitch:d,onCancel:s}){let u=r.listProfiles(),m=r.getActiveProfile(),p=r.getDefaultEnv(),i=u.map(e=>{let o=r.loadBasicAuth(e.profile,e.env),t=r.loadCredentials(e.profile,e.env)!==null,v=o?"basic":t?"oauth":"none",b=o?o.username:null,w=e.profile===m&&e.env===p;return S(e.profile,e.env,v,b,w)}),[a,g]=(0,L.useState)(()=>{let e=i.findIndex(o=>o.isActive);return e>=0?e:0});return P((e,o)=>{if(o.escape){s();return}if(o.upArrow){g(t=>Math.max(0,t-1));return}if(o.downArrow){g(t=>Math.min(i.length-1,t+1));return}if(o.return&&i[a]){let t=i[a];t.isActive||d(t.profile,t.env),s();return}}),i.length===0?(0,n.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:l.orange,paddingX:2,paddingY:1,children:[(0,n.jsx)(f,{color:l.orange,bold:!0,children:"Profiles"}),(0,n.jsx)(c,{marginTop:1,children:(0,n.jsx)(f,{color:l.dim,children:"No profiles \u2014 use Login to create one"})}),(0,n.jsx)(h,{bindings:[],escBackLabel:"back"})]}):(0,n.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:l.orange,paddingX:2,paddingY:1,children:[(0,n.jsx)(f,{color:l.orange,bold:!0,children:"Profiles"}),(0,n.jsx)(c,{flexDirection:"column",marginTop:1,children:i.map((e,o)=>{let t=o===a,v=t?"\u276F ":" ",b=e.isActive?l.green:t?l.orange:void 0;return(0,n.jsxs)(f,{color:b,children:[v,e.label,e.isActive?" \u25CF active":""]},`${e.profile}-${e.env}`)})}),(0,n.jsx)(h,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"switch"}],escBackLabel:"back"})]})}export{S as a,M as b};
@@ -0,0 +1,5 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as y}from"./chunk-TQZPYXN7.js";import{spawn as x,execSync as b}from"child_process";import{existsSync as g}from"fs";import{resolve as e,dirname as N}from"path";import{fileURLToPath as A}from"url";import{createInterface as w}from"readline";async function*_(i){let n=w({input:i,crlfDelay:1/0});for await(let l of n){let r=l.trim();if(r)try{let d=JSON.parse(r);d&&typeof d.type=="string"&&(yield d)}catch{}}}function E(i){return i==="action"?{set:{V16_AGENT_ENABLE_ALL_BLOCKERS:"true",V16_AGENT_SKIP_CP_FINAL:"true",V16_BIFURCATION_PHASES:"1"},unset:[]}:{set:{V16_BIFURCATION_PHASES:"1"},unset:["V16_AGENT_ENABLE_ALL_BLOCKERS","V16_AGENT_SKIP_CP_FINAL"]}}var a=N(A(import.meta.url));function C(){for(let i of["python3","python"])try{return b(`${i} --version`,{stdio:"ignore"}),i}catch{}return null}function h(){let n=process.platform==="win32"?"v16-runner.exe":"v16-runner",l={"darwin-arm64":["@testmuai/kane-cli-darwin-arm64","@lambdatestincprivate/kane-cli-darwin-arm64"],"darwin-x64":["@testmuai/kane-cli-darwin-x64","@lambdatestincprivate/kane-cli-darwin-x64"],"linux-x64":["@testmuai/kane-cli-linux-x64","@lambdatestincprivate/kane-cli-linux-x64"],"linux-arm64":["@testmuai/kane-cli-linux-arm64","@lambdatestincprivate/kane-cli-linux-arm64"],"win32-x64":["@testmuai/kane-cli-win-x64","@lambdatestincprivate/kane-cli-win-x64"]},r=`${process.platform}-${process.arch}`,d=l[r];if(d)for(let t of d){let c=[e(a,"..","node_modules",t,"bin",n),e(a,"..","..","node_modules",t,"bin",n),e(a,"..","..","..","node_modules",t,"bin",n),e(a,"..","..","..","..","node_modules",t,"bin",n)];for(let u of c)if(g(u))return{cmd:u,args:[]}}let p=[e(a,"bin",n),e(a,"..","bin",n),e(a,"..","..","..","..","v16-runner","dist",n),e(a,"..","..","..","v16-runner","dist",n),e(process.cwd(),"v16-runner","dist",n),e(process.cwd(),"..","v16-runner","dist",n)];for(let t of p)if(g(t))return{cmd:t,args:[]};let s=[e(a,"..","..","v16-runner"),e(a,"..","..","..","..","v16-runner"),e(a,"..","..","..","v16-runner"),e(process.cwd(),"v16-runner"),e(process.cwd(),"..","v16-runner")];for(let t of s)if(g(e(t,"main.py"))){for(let u of[e(t,".venv","bin","python"),e(t,"..","browser-agent",".venv","bin","python")])if(g(u))return{cmd:u,args:["main.py"],cwd:t};let c=C();if(c)return{cmd:c,args:["main.py"],cwd:t}}return null}function G(i,n){let l=h();if(!l)throw new Error("v16-runner not found. Build the binary with `cd v16-runner && python build.py` or ensure Python is available.");let r={...process.env};n?.environment&&(r.TESTMUAI_ENV=n.environment),r.TESTMUAI_SOURCE="kane-cli",process.platform==="win32"&&(r.PYTHONIOENCODING="utf-8");let d=y(n?.environment);r.V16_SERVER_API_HOST=d.v16ServerHost,r.ATMS_URL=d.tmsBaseUrl.replace(/\/api\/?$/,""),i.username&&i.access_key&&(r.LT_USERNAME=i.username,r.LT_ACCESS_KEY=i.access_key),i.session_id&&(r.TESTMUAI_SESSION_ID=i.session_id);let p=E(n?.mode??"testing");Object.assign(r,p.set);for(let o of p.unset)delete r[o];let s=x(l.cmd,l.args,{stdio:["pipe","pipe","pipe"],env:r,cwd:l.cwd});s.stdin.on("error",()=>{}),s.stdin.write(JSON.stringify(i)+`
3
+ `);let t=1e5,c="";s.stderr.on("data",o=>{c+=o.toString(),c.length>t&&(c=c.slice(-t))}),s.on("error",o=>{n?.log?.("error","RUNNER_SPAWN_ERROR","Runner spawn error",{error:o.message})});let u=null,f=null,S=new Promise(o=>{s.on("close",(m,v)=>{u=m,f=v?String(v):null,n?.log?.("info","RUNNER_EXIT","Runner exited",{code:m,signal:f??"none"}),o({code:m,signal:f})})}),R=_(s.stdout);return{child:s,events:R,sendUserResponse(o){let m=JSON.stringify({type:"user_response",answer:o});try{s.stdin.write(m+`
4
+ `)}catch{}},sendCancel(o){let m=JSON.stringify({type:"cancel",reason:o});try{s.stdin.write(m+`
5
+ `)}catch{}},cancel(){s.kill("SIGTERM")},get stderr(){return c},get exitCode(){return u},get exitSignal(){return f},exited:S}}export{h as a,G as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as f}from"./chunk-6XWZHEQR.js";import{x as t}from"./chunk-X6FNT3EY.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};
2
+ import{b as f}from"./chunk-KKXWOTVX.js";import{x as t}from"./chunk-J54IX7BP.js";import{a as x}from"./chunk-HCBYKLMW.js";import{a as r,b as n}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as p}from"./chunk-UR6MHSHU.js";var c=p(B(),1);var e=p(x(),1);function v(){return[{name:"convert",label:"Converting session data",status:"pending"},{name:"zip",label:"Compressing artifacts",status:"pending"},{name:"presign",label:"Requesting upload URLs",status:"pending"},{name:"upload",label:"Uploading to KaneAI",status:"pending"},{name:"atomic_replace",label:"Replacing local output",status:"pending"},{name:"commit_lock",label:"Committing to TMS",status:"pending"},{name:"finalize",label:"Finalizing test case",status:"pending"},{name:"code_export",label:"Downloading test code",status:"pending"}]}function U(s,o,d,a){return s.map(l=>l.name===o?{...l,status:d,detail:a}:l)}function R(s){let o=s/1e3;if(o<60)return`${o.toFixed(1)}s`;let d=Math.floor(o/60),a=Math.round(o%60);return`${d}m ${a}s`}function D(s){let[o,d]=(0,c.useState)(0),a=c.default.useRef(Date.now());return(0,c.useEffect)(()=>{if(!s)return;a.current=Date.now();let l=setInterval(()=>{d(Date.now()-a.current)},100);return()=>clearInterval(l)},[s]),o}function h({steps:s,status:o,testUrl:d,error:a}){let l=D(o==="uploading");return o==="uploading"?(0,e.jsxs)(r,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(r,{children:[(0,e.jsx)(n,{color:t.orange,children:"\u2601 "}),(0,e.jsx)(n,{color:t.orange,bold:!0,children:"Saving to KaneAI"}),(0,e.jsxs)(n,{color:t.dim,children:[" ",R(l)]})]}),(0,e.jsx)(r,{flexDirection:"column",marginTop:1,children:s.filter(i=>i.status!=="skipped").map((i,S,T)=>{let b=S===T.length-1?"\u2514\u2500":"\u251C\u2500",u=i.status==="done",m=i.status==="running",g=i.status==="failed";return(0,e.jsxs)(r,{children:[(0,e.jsxs)(n,{color:t.dim,children:[" ",b," "]}),(0,e.jsx)(r,{width:3,children:m?(0,e.jsx)(f,{}):u?(0,e.jsx)(n,{color:t.green,children:"\u2713"}):g?(0,e.jsx)(n,{color:t.red,children:"\u2717"}):(0,e.jsx)(n,{color:t.muted,children:"\u25CB"})}),(0,e.jsx)(n,{color:u?t.dim:m?void 0:g?t.red:t.muted,children:i.label}),i.detail&&(0,e.jsxs)(n,{color:t.dim,children:[" ",i.detail]})]},i.name)})}),(0,e.jsx)(r,{marginTop:1,children:(0,e.jsx)(n,{color:t.muted,children:" press Ctrl+C twice to force exit"})})]}):o==="success"?(0,e.jsx)(e.Fragment,{}):(0,e.jsxs)(r,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(r,{children:[(0,e.jsx)(n,{color:t.red,children:"\u2601 "}),(0,e.jsx)(n,{color:t.red,bold:!0,children:"Save failed"})]}),a&&(0,e.jsxs)(r,{marginTop:0,children:[(0,e.jsx)(n,{color:t.dim,children:" "}),(0,e.jsx)(n,{color:t.dim,children:a})]})]})}export{v as a,U as b,h as c};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as f}from"./chunk-FPFOW6BS.js";import{a as h}from"./chunk-FTWHK7PH.js";import{a as d}from"./chunk-5WMT2WVI.js";var o=class extends Error{constructor(a,l){super(a);this.code=l;this.name="AuthError"}};async function k(c){let{creds:i,env:a,usernameFlag:l,accessKeyFlag:g,log:t}=c,e=null,u=null;if(l&&g)e={username:l,access_key:g},t("info","AUTH_RESOLVE_FLAGS","Auth resolved via CLI flags",{username:l});else{let r=i.resolveAuth();r?.method==="basic"&&(e={username:r.username,access_key:r.access_key},t("info","AUTH_RESOLVE_CONFIG","Auth resolved via config",{username:r.username}))}if(!e){let{credentials:r,profile:E}=i.getActiveCredentials();if(!r)throw new o("Not authenticated \u2014 no credentials found","not_authenticated");if(u=r.access_token,r.expires_at-Date.now()/1e3<300)try{let n=await h({creds:i,profile:E,env:a,credentials:r});n&&(u=n.accessToken,t("info","AUTH_TOKEN_REFRESHED","OAuth token refreshed"))}catch(n){let m=n instanceof Error?n.message:String(n);throw t("error","TOKEN_REFRESH_FAILED","Token refresh failed",{error:m}),new o(`Token refresh failed: ${m}`,"refresh_failed")}}let v=d(a),b=async()=>u,y=e?{username:e.username,access_key:e.access_key}:null,p=new f(v.controllerBaseUrl,b,y,t),s=await p.resolve();return s&&!e&&(e={username:s.username,access_key:s.access_key},t("info","AUTH_RESOLVE_CONTROLLER","Auth resolved via controller",{username:s.username})),{basicAuth:e,token:u,resolver:p,resolvedCreds:s}}export{o as a,k as b};
2
+ import{a as f}from"./chunk-FPFOW6BS.js";import{a as h}from"./chunk-7YZO2QQ6.js";import{a as d}from"./chunk-TQZPYXN7.js";var o=class extends Error{constructor(a,l){super(a);this.code=l;this.name="AuthError"}};async function k(c){let{creds:i,env:a,usernameFlag:l,accessKeyFlag:g,log:t}=c,e=null,u=null;if(l&&g)e={username:l,access_key:g},t("info","AUTH_RESOLVE_FLAGS","Auth resolved via CLI flags",{username:l});else{let r=i.resolveAuth();r?.method==="basic"&&(e={username:r.username,access_key:r.access_key},t("info","AUTH_RESOLVE_CONFIG","Auth resolved via config",{username:r.username}))}if(!e){let{credentials:r,profile:E}=i.getActiveCredentials();if(!r)throw new o("Not authenticated \u2014 no credentials found","not_authenticated");if(u=r.access_token,r.expires_at-Date.now()/1e3<300)try{let n=await h({creds:i,profile:E,env:a,credentials:r});n&&(u=n.accessToken,t("info","AUTH_TOKEN_REFRESHED","OAuth token refreshed"))}catch(n){let m=n instanceof Error?n.message:String(n);throw t("error","TOKEN_REFRESH_FAILED","Token refresh failed",{error:m}),new o(`Token refresh failed: ${m}`,"refresh_failed")}}let v=d(a),b=async()=>u,y=e?{username:e.username,access_key:e.access_key}:null,p=new f(v.controllerBaseUrl,b,y,t),s=await p.resolve();return s&&!e&&(e={username:s.username,access_key:s.access_key},t("info","AUTH_RESOLVE_CONTROLLER","Auth resolved via controller",{username:s.username})),{basicAuth:e,token:u,resolver:p,resolvedCreds:s}}export{o as a,k as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as b}from"./chunk-XT45Z36Q.js";import{m as d,x as o}from"./chunk-X6FNT3EY.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};
2
+ import{a as b}from"./chunk-HWCBOJOP.js";import{m as d,x as o}from"./chunk-J54IX7BP.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};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{x as n}from"./chunk-X6FNT3EY.js";import{a as s}from"./chunk-HCBYKLMW.js";import{a,b as i}from"./chunk-C44QQJR4.js";import{e as r}from"./chunk-UR6MHSHU.js";var o=r(s(),1);function g({bindings:c,suppressEscBack:p=!1,escBackLabel:m="back to chat"}){let e=c.map(t=>`${t.keys} ${t.label}`);return p||e.push(`esc \xB7 ${m}`),(0,o.jsx)(a,{marginTop:1,children:(0,o.jsx)(i,{color:n.dim,children:e.join(" \xB7 ")})})}export{g as a};
2
+ import{x as n}from"./chunk-J54IX7BP.js";import{a as s}from"./chunk-HCBYKLMW.js";import{a,b as i}from"./chunk-C44QQJR4.js";import{e as r}from"./chunk-UR6MHSHU.js";var o=r(s(),1);function g({bindings:c,suppressEscBack:p=!1,escBackLabel:m="back to chat"}){let e=c.map(t=>`${t.keys} ${t.label}`);return p||e.push(`esc \xB7 ${m}`),(0,o.jsx)(a,{marginTop:1,children:(0,o.jsx)(i,{color:n.dim,children:e.join(" \xB7 ")})})}export{g as a};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{homedir as e}from"os";import{join as t}from"path";var m="0.4.5",d="kane-cli",a=t(e(),".testmuai","kaneai"),g=t(a,"profiles"),h=t(a,"tui-config.json"),_="https://registry.npmjs.org/@testmuai/kane-cli",L="https://api.github.com/repos/LambdaTest/kane-cli/releases",n="@testmuai/kane-cli-skill",x=`https://registry.npmjs.org/${n}`,r="kane-cli",A=[{dir:t(e(),".claude","skills",r),agent:"Claude Code"},{dir:t(e(),".agents","skills",r),agent:"Codex CLI"},{dir:t(e(),".gemini","skills",r),agent:"Gemini CLI"}],u="https://dd-proxy.lambdatest.com/intake/kane-cli",R="https://kaneai-playground.lambdatest.io",U=9222,b=9230,I=t(a,"chrome-profiles"),o=t(a,"hints"),C=t(o,"state.json");function E(s){return t(o,`catalog-${s}.json`)}var p="127.0.0.1",T=18392,S=18400,c="/callback";function N(s){return`http://${p}:${s}${c}`}var P="KANE CLI",B="*",O={prod:{authBaseUrl:"https://auth.lambdatest.com",consentUrl:"https://accounts.lambdatest.com",controllerBaseUrl:"https://kaneai-api.lambdatest.com/v16-controller/v1",tmsBaseUrl:"https://test-manager-api.lambdatest.com/api",testGeneratorBaseUrl:"https://test-manager-api.lambdatest.com",secretsBaseUrl:"https://api-hyperexecute.lambdatest.com",testManagerUiUrl:"https://test-manager.lambdatest.com",shareApiBaseUrl:"https://api.lambdatest.com",v16ServerHost:"https://kaneai-api.lambdatest.com/v16-server"},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"}},k={orange:"#ff9500",generateAccent:"#0d9488",purple:"#b388ff",secondary:"#888888",dim:"#666666",muted:"#444444",green:"#4ade80",red:"#ef4444"};export{m as a,d as b,a as c,h as d,_ as e,L as f,n as g,A as h,u as i,R as j,U as k,b as l,I as m,C as n,E as o,p,T as q,S as r,c as s,N as t,P as u,B as v,O as w,k as x};
2
+ import{homedir as e}from"os";import{join as t}from"path";var m="0.4.6",d="kane-cli",a=t(e(),".testmuai","kaneai"),g=t(a,"profiles"),h=t(a,"tui-config.json"),_="https://registry.npmjs.org/@testmuai/kane-cli",L="https://api.github.com/repos/LambdaTest/kane-cli/releases",n="@testmuai/kane-cli-skill",x=`https://registry.npmjs.org/${n}`,r="kane-cli",A=[{dir:t(e(),".claude","skills",r),agent:"Claude Code"},{dir:t(e(),".agents","skills",r),agent:"Codex CLI"},{dir:t(e(),".gemini","skills",r),agent:"Gemini CLI"}],u="https://dd-proxy.lambdatest.com/intake/kane-cli",R="https://kaneai-playground.lambdatest.io",U=9222,b=9230,I=t(a,"chrome-profiles"),o=t(a,"hints"),C=t(o,"state.json");function E(s){return t(o,`catalog-${s}.json`)}var p="127.0.0.1",T=18392,S=18400,c="/callback";function N(s){return`http://${p}:${s}${c}`}var P="KANE CLI",B="*",O={prod:{authBaseUrl:"https://auth.lambdatest.com",consentUrl:"https://accounts.lambdatest.com",controllerBaseUrl:"https://kaneai-api.lambdatest.com/v16-controller/v1",tmsBaseUrl:"https://test-manager-api.lambdatest.com/api",testGeneratorBaseUrl:"https://test-manager-api.lambdatest.com",secretsBaseUrl:"https://api-hyperexecute.lambdatest.com",testManagerUiUrl:"https://test-manager.lambdatest.com",shareApiBaseUrl:"https://api.lambdatest.com",v16ServerHost:"https://kaneai-api.lambdatest.com/v16-server"},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"}},k={orange:"#ff9500",generateAccent:"#0d9488",purple:"#b388ff",secondary:"#888888",dim:"#666666",muted:"#444444",green:"#4ade80",red:"#ef4444"};export{m as a,d as b,a as c,h as d,_ as e,L as f,n as g,A as h,u as i,R as j,U as k,b as l,I as m,C as n,E as o,p,T as q,S as r,c as s,N as t,P as u,B as v,O as w,k as x};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{d as s,j as l}from"./chunk-X6FNT3EY.js";import{readFileSync as d,writeFileSync as i,mkdirSync as o,existsSync as p}from"fs";import{dirname as a}from"path";var n={window_size:{width:1920,height:1080},chrome_profile_path:"",default_url:l,model:"v16-alpha",project_id:null,project_name:null,folder_id:null,folder_name:null,mode:"testing",code_export:{enabled:!0,language:"python",skip_validation:!0},generate:{scenario_limit:2,per_scenario_limit:3,memory_enabled:!1},last_seen_version:"",hints_enabled:!0},c=class{constructor(r=s){this.path=r}exists(){return p(this.path)}load(){try{let r=d(this.path,"utf-8"),e=JSON.parse(r);return{...n,...e,code_export:{...n.code_export,...e.code_export??{}},generate:{...n.generate,...e.generate??{}}}}catch{return{...n,code_export:{...n.code_export},generate:{...n.generate}}}}set(r,e){try{let t=this.load();t[r]=e,o(a(this.path),{recursive:!0}),i(this.path,JSON.stringify(t,null,2)+`
2
+ import{d as s,j as l}from"./chunk-J54IX7BP.js";import{readFileSync as d,writeFileSync as i,mkdirSync as o,existsSync as p}from"fs";import{dirname as a}from"path";var n={window_size:{width:1920,height:1080},chrome_profile_path:"",default_url:l,model:"v16-alpha",project_id:null,project_name:null,folder_id:null,folder_name:null,mode:"testing",code_export:{enabled:!0,language:"python",skip_validation:!0},generate:{scenario_limit:2,per_scenario_limit:3,memory_enabled:!1},last_seen_version:"",hints_enabled:!0},c=class{constructor(r=s){this.path=r}exists(){return p(this.path)}load(){try{let r=d(this.path,"utf-8"),e=JSON.parse(r);return{...n,...e,code_export:{...n.code_export,...e.code_export??{}},generate:{...n.generate,...e.generate??{}}}}catch{return{...n,code_export:{...n.code_export},generate:{...n.generate}}}}set(r,e){try{let t=this.load();t[r]=e,o(a(this.path),{recursive:!0}),i(this.path,JSON.stringify(t,null,2)+`
3
3
  `)}catch(t){let g=t instanceof Error?t.message:String(t);process.stderr.write(`[config] Failed to save config: ${g}
4
4
  `)}}save(r){try{let t={...this.load(),...r};o(a(this.path),{recursive:!0}),i(this.path,JSON.stringify(t,null,2)+`
5
5
  `)}catch(e){let t=e instanceof Error?e.message:String(e);process.stderr.write(`[config] Failed to save config: ${t}
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as m}from"./chunk-LPUQ4HWQ.js";import{b as f,c as j}from"./chunk-VE3SUJMA.js";import{a as g}from"./chunk-5WMT2WVI.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),l=e.projectName??_,o=e.folderName??E,t=r.project_id??null,s=r.project_name??null;if(!t){let a=(await d.listProjects()).find(n=>n.name===l);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 n=await d.createProject(l);t=n.id,s=n.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(n=>n.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 n=await d.createFolder(t,o);c=n.id,i=n.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??l,folderId:c,folderName:i??o}}function N(e,r,d){let l=e.loadProfileConfig(r,d)??{};return{projectId:l.project_id??null,folderId:l.folder_id??null}}function A(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.
2
+ import{a as m}from"./chunk-LPUQ4HWQ.js";import{b as f,c as j}from"./chunk-VE3SUJMA.js";import{a as g}from"./chunk-TQZPYXN7.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),l=e.projectName??_,o=e.folderName??E,t=r.project_id??null,s=r.project_name??null;if(!t){let a=(await d.listProjects()).find(n=>n.name===l);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 n=await d.createProject(l);t=n.id,s=n.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(n=>n.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 n=await d.createFolder(t,o);c=n.id,i=n.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??l,folderId:c,folderName:i??o}}function N(e,r,d){let l=e.loadProfileConfig(r,d)??{};return{projectId:l.project_id??null,folderId:l.folder_id??null}}function A(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
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{x as a}from"./chunk-X6FNT3EY.js";import{a as c}from"./chunk-HCBYKLMW.js";import{b as u}from"./chunk-C44QQJR4.js";import{a as l}from"./chunk-6YGTRKDT.js";import{e as n}from"./chunk-UR6MHSHU.js";var s=n(l(),1);var o=n(l(),1);function f(r,e){let t=(0,o.useRef)(r);t.current=r,(0,o.useEffect)(()=>{if(e===null)return;let i=setInterval(()=>t.current(),e);return()=>clearInterval(i)},[e])}var p=n(c(),1),m=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function I({active:r=!0}){let[e,t]=(0,s.useState)(0);return f(()=>{t(i=>(i+1)%m.length)},r?80:null),(0,p.jsx)(u,{color:a.orange,children:r?m[e]:"\u25CF"})}export{f as a,I as b};
2
+ import{x as a}from"./chunk-J54IX7BP.js";import{a as c}from"./chunk-HCBYKLMW.js";import{b as u}from"./chunk-C44QQJR4.js";import{a as l}from"./chunk-6YGTRKDT.js";import{e as n}from"./chunk-UR6MHSHU.js";var s=n(l(),1);var o=n(l(),1);function f(r,e){let t=(0,o.useRef)(r);t.current=r,(0,o.useEffect)(()=>{if(e===null)return;let i=setInterval(()=>t.current(),e);return()=>clearInterval(i)},[e])}var p=n(c(),1),m=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function I({active:r=!0}){let[e,t]=(0,s.useState)(0);return f(()=>{t(i=>(i+1)%m.length)},r?80:null),(0,p.jsx)(u,{color:a.orange,children:r?m[e]:"\u25CF"})}export{f as a,I 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-X6FNT3EY.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};
2
+ import{x as m}from"./chunk-J54IX7BP.js";import{a as x}from"./chunk-HCBYKLMW.js";import{a as u,b as a,j as g}from"./chunk-C44QQJR4.js";import{a as b}from"./chunk-6YGTRKDT.js";import{e as f}from"./chunk-UR6MHSHU.js";var T=f(b(),1);function k(i,n){if(!n)return i;let l=i.trim()||n;return`\x1B]8;;${n}\x07${l}\x1B]8;;\x07`}var r=f(x(),1);function $({shareableLink:i,testCaseLink:n,codeExportDir:l,recordedTestPath:s,outputDir:o,autoExit:p=!0}){let{exit:c}=g();(0,T.useEffect)(()=>{if(!p)return;let t=setTimeout(()=>c(),100);return()=>clearTimeout(t)},[c,p]);let e=[];return s&&e.push({label:"Test",url:s,linkUrl:`file://${s}`}),o&&e.push({label:"Output",url:o,linkUrl:`file://${o}`}),i&&e.push({label:"ShareLink",url:i}),n&&e.push({label:"TestCase",url:n}),l&&!o&&e.push({label:"CodeExport",url:l,linkUrl:`file://${l}`}),e.length===0?(0,r.jsx)(r.Fragment,{}):(0,r.jsx)(u,{flexDirection:"column",marginTop:1,marginLeft:1,children:e.map(t=>(0,r.jsxs)(u,{flexDirection:"column",marginBottom:1,children:[(0,r.jsxs)(a,{color:m.orange,children:[t.label,":"]}),(0,r.jsx)(a,{color:m.dim,children:k(t.url,t.linkUrl??t.url)})]},t.label))})}export{$ as a};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as u,b as x}from"./chunk-AYWWHMM7.js";import{x as m}from"./chunk-X6FNT3EY.js";import{a as f}from"./chunk-HCBYKLMW.js";import{a as r,b as i}from"./chunk-C44QQJR4.js";import{e as n}from"./chunk-UR6MHSHU.js";var e=n(f(),1);function C({title:B,titleColor:c,borderColor:d,variant:p,rows:s,footer:t,labelWidth:l=14,marginBottom:b=1}){return(0,e.jsxs)(u,{title:B,titleColor:c,borderColor:d,variant:p,marginBottom:b,children:[s.map((o,a)=>typeof o.value=="string"?(0,e.jsx)(x,{label:o.label,value:o.value,valueColor:o.valueColor,labelWidth:l},`${o.label}-${a}`):(0,e.jsxs)(r,{children:[(0,e.jsx)(r,{width:l,children:(0,e.jsx)(i,{color:m.dim,children:o.label})}),o.value]},`${o.label}-${a}`)),t&&(0,e.jsx)(r,{marginTop:1,children:t})]})}export{C as a};
2
+ import{a as u,b as x}from"./chunk-2TT2RIVP.js";import{x as m}from"./chunk-J54IX7BP.js";import{a as f}from"./chunk-HCBYKLMW.js";import{a as r,b as i}from"./chunk-C44QQJR4.js";import{e as n}from"./chunk-UR6MHSHU.js";var e=n(f(),1);function C({title:B,titleColor:c,borderColor:d,variant:p,rows:s,footer:t,labelWidth:l=14,marginBottom:b=1}){return(0,e.jsxs)(u,{title:B,titleColor:c,borderColor:d,variant:p,marginBottom:b,children:[s.map((o,a)=>typeof o.value=="string"?(0,e.jsx)(x,{label:o.label,value:o.value,valueColor:o.valueColor,labelWidth:l},`${o.label}-${a}`):(0,e.jsxs)(r,{children:[(0,e.jsx)(r,{width:l,children:(0,e.jsx)(i,{color:m.dim,children:o.label})}),o.value]},`${o.label}-${a}`)),t&&(0,e.jsx)(r,{marginTop:1,children:t})]})}export{C as a};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as Se,b as sr}from"./chunk-C5UNZ6ZY.js";import{a as ir}from"./chunk-D3NAXZ2R.js";import{c as nr}from"./chunk-S3DAAAE5.js";import{b as rr,c as ut,d as dt,e as ve,f as mt,g as or}from"./chunk-PUU7A26K.js";import{a as Ue,b as se,c as er,e as le,f as lt,i as tr,j as ct}from"./chunk-AH4AXJML.js";import{b as ue}from"./chunk-EWID6VQA.js";import{a as Zt}from"./chunk-WAOCHXJ5.js";import{a as Xt,b as at}from"./chunk-K74XYWPF.js";import{a as zt,b as ot,c as it,d as je,e as Wt,f as Jt}from"./chunk-LOIRZFV3.js";import{f as Qt,g as Yt}from"./chunk-DVRZITSK.js";import{a as Gt}from"./chunk-LPUQ4HWQ.js";import{a as De,b as qt}from"./chunk-NLCCBXXV.js";import{a as W}from"./chunk-5WMT2WVI.js";import{a as D}from"./chunk-RZ4F3BHX.js";import{a as Vt}from"./chunk-E47GFYXA.js";import{a as Ht,c as rt,i as Kt,j as Oe,k as st,l as nt}from"./chunk-X6FNT3EY.js";import{join as qe,basename as kn}from"path";import{existsSync as us,readFileSync as En}from"fs";import{existsSync as ft}from"fs";import{join as Fe,basename as ar}from"path";function lr(e,t){if(!t||!ft(t))return e.steps.map(()=>({kind:"author",reason:"no-result-md"}));let r=dt(t),s=[],n=new Set,o=new Map;function a(i){let l=ve(i),h=Fe(l,"Result.md");if(o.has(h))return o.get(h);let f=ft(h)?dt(h):null;return o.set(h,f),f}function u(i){for(let l=1;l<i.trace.length;l++){let f=i.trace[l-1].file===e.rootPath?r:a(i.trace.slice(0,l));if(!f)return{kind:"author",reason:"no-result-md"};let w=i.trace[l-1].stepIndex,g=f.steps[w-1];if(!g)return{kind:"author",reason:"no-result-md"};if(g.kind!=="import")return{kind:"author",reason:"structure-mismatch"};let _=ar(g.importPath),S=ar(i.trace[l].file);if(_!==S)return{kind:"author",reason:"structure-mismatch"};if(g.status!=="passed")return{kind:"author",reason:"recorded-failed"}}return null}for(let i of e.steps){let l=i.trace[i.trace.length-1].file,h=i.trace[i.trace.length-1].stepIndex,f=n.has(l);for(let S=0;S<i.trace.length-1&&!f;S++)n.has(i.trace[S].file)&&(f=!0);if(f){s.push({kind:"author",reason:"downstream-of-divergence"});continue}let w=u(i);if(w){s.push(w);for(let S=0;S<i.trace.length;S++)n.add(i.trace[S].file);continue}let g=l===e.rootPath?r:a(i.trace),_=ks(i,g,h);if(s.push(_),_.kind==="author"){n.add(l);for(let S=0;S<i.trace.length-1;S++)n.add(i.trace[S].file)}}return s}function ks(e,t,r){if(!t)return{kind:"author",reason:"no-result-md"};let s=t.steps[r-1];if(!s)return{kind:"author",reason:"no-result-md"};if(s.kind!=="objective")return{kind:"author",reason:"structure-mismatch"};if(s.status!=="passed")return{kind:"author",reason:"recorded-failed"};let n=rr(e);if(n!==s.md5)return{kind:"author",reason:"md5-mismatch"};let o=e.trace.length===1?tr(e.trace[0].file,r,n.slice(0,8)):Fe(ve(e.trace),".internal","steps",`${r}-${n.slice(0,8)}`),a=Fe(o,"flows","0","actions.ndjson");return ft(a)?{kind:"replay",recordingDir:o}:{kind:"author",reason:"missing-recording"}}function cr(e){return e.some(t=>t.kind==="author")}function Ne(e){for(let t=0;t<e.length;t++)if(e[t].kind==="author")return t;return e.length}function ur(e){return Fe(e.recordingDir,"flows","0","actions.ndjson")}function dr(e,t){if(process.env.KANE_REPLAY_TRACE==="1")for(let r=0;r<e.steps.length;r++){let s=e.steps[r],n=t[r],o=" ".repeat(s.trace.length-1),a=`step ${s.flatIndex}`;n.kind==="replay"?process.stderr.write(`[replay-trace] ${o}${a}: REPLAY (would skip; v1 always authors)
2
+ import{a as Se,b as sr}from"./chunk-C5UNZ6ZY.js";import{a as ir}from"./chunk-Y6MB5JP7.js";import{c as nr}from"./chunk-S3DAAAE5.js";import{b as rr,c as ut,d as dt,e as ve,f as mt,g as or}from"./chunk-PUU7A26K.js";import{a as Ue,b as se,c as er,e as le,f as lt,i as tr,j as ct}from"./chunk-AH4AXJML.js";import{b as ue}from"./chunk-Q3RXDN74.js";import{a as Zt}from"./chunk-WAOCHXJ5.js";import{a as Xt,b as at}from"./chunk-BSTC6BLT.js";import{a as zt,b as ot,c as it,d as je,e as Wt,f as Jt}from"./chunk-LOIRZFV3.js";import{f as Qt,g as Yt}from"./chunk-JTXYQ2KH.js";import{a as Gt}from"./chunk-LPUQ4HWQ.js";import{a as De,b as qt}from"./chunk-NLCCBXXV.js";import{a as W}from"./chunk-TQZPYXN7.js";import{a as D}from"./chunk-RZ4F3BHX.js";import{a as Vt}from"./chunk-E47GFYXA.js";import{a as Ht,c as rt,i as Kt,j as Oe,k as st,l as nt}from"./chunk-J54IX7BP.js";import{join as qe,basename as kn}from"path";import{existsSync as us,readFileSync as En}from"fs";import{existsSync as ft}from"fs";import{join as Fe,basename as ar}from"path";function lr(e,t){if(!t||!ft(t))return e.steps.map(()=>({kind:"author",reason:"no-result-md"}));let r=dt(t),s=[],n=new Set,o=new Map;function a(i){let l=ve(i),h=Fe(l,"Result.md");if(o.has(h))return o.get(h);let f=ft(h)?dt(h):null;return o.set(h,f),f}function u(i){for(let l=1;l<i.trace.length;l++){let f=i.trace[l-1].file===e.rootPath?r:a(i.trace.slice(0,l));if(!f)return{kind:"author",reason:"no-result-md"};let w=i.trace[l-1].stepIndex,g=f.steps[w-1];if(!g)return{kind:"author",reason:"no-result-md"};if(g.kind!=="import")return{kind:"author",reason:"structure-mismatch"};let _=ar(g.importPath),S=ar(i.trace[l].file);if(_!==S)return{kind:"author",reason:"structure-mismatch"};if(g.status!=="passed")return{kind:"author",reason:"recorded-failed"}}return null}for(let i of e.steps){let l=i.trace[i.trace.length-1].file,h=i.trace[i.trace.length-1].stepIndex,f=n.has(l);for(let S=0;S<i.trace.length-1&&!f;S++)n.has(i.trace[S].file)&&(f=!0);if(f){s.push({kind:"author",reason:"downstream-of-divergence"});continue}let w=u(i);if(w){s.push(w);for(let S=0;S<i.trace.length;S++)n.add(i.trace[S].file);continue}let g=l===e.rootPath?r:a(i.trace),_=ks(i,g,h);if(s.push(_),_.kind==="author"){n.add(l);for(let S=0;S<i.trace.length-1;S++)n.add(i.trace[S].file)}}return s}function ks(e,t,r){if(!t)return{kind:"author",reason:"no-result-md"};let s=t.steps[r-1];if(!s)return{kind:"author",reason:"no-result-md"};if(s.kind!=="objective")return{kind:"author",reason:"structure-mismatch"};if(s.status!=="passed")return{kind:"author",reason:"recorded-failed"};let n=rr(e);if(n!==s.md5)return{kind:"author",reason:"md5-mismatch"};let o=e.trace.length===1?tr(e.trace[0].file,r,n.slice(0,8)):Fe(ve(e.trace),".internal","steps",`${r}-${n.slice(0,8)}`),a=Fe(o,"flows","0","actions.ndjson");return ft(a)?{kind:"replay",recordingDir:o}:{kind:"author",reason:"missing-recording"}}function cr(e){return e.some(t=>t.kind==="author")}function Ne(e){for(let t=0;t<e.length;t++)if(e[t].kind==="author")return t;return e.length}function ur(e){return Fe(e.recordingDir,"flows","0","actions.ndjson")}function dr(e,t){if(process.env.KANE_REPLAY_TRACE==="1")for(let r=0;r<e.steps.length;r++){let s=e.steps[r],n=t[r],o=" ".repeat(s.trace.length-1),a=`step ${s.flatIndex}`;n.kind==="replay"?process.stderr.write(`[replay-trace] ${o}${a}: REPLAY (would skip; v1 always authors)
3
3
  `):process.stderr.write(`[replay-trace] ${o}${a}: AUTHOR (${n.reason})
4
4
  `)}}function de(e){process.env.KANE_REPLAY_TRACE==="1"&&process.stderr.write(e)}function mr(e,t){let r=e===0?"(none)":`0..${e-1}`,s=e>=t?"(none)":`${e}..${t-1}`;de(`[replay-trace] phase: replay ${r}, author ${s}
5
5
  `)}function fr(e,t){de(`[replay-trace] step ${e}: REPLAY ${t==="ok"?"OK":"FAILED"}
@@ -45,7 +45,7 @@ import{a as Se,b as sr}from"./chunk-C5UNZ6ZY.js";import{a as ir}from"./chunk-D3N
45
45
  `),!1;let m=c.sessionId,v=o.onLockConflict??i.rootGlobal.on_lock_conflict??"readonly",y=await ms({tmsBaseUrl:w.tmsBaseUrl,testId:p.testId,fromCommitId:p.fromCommitId,newCommitId:m,basicAuth:d,onLockConflict:v});return y==="ok"?(I=!0,p.newCommitId=m,c.log("info","MID_RUN_LOCK_ACQUIRED","Mid-run lock acquired",{test_id:p.testId}),a&&t.onLockState({phase:"acquired",scope:"mid_run"}),vt({baseUrl:ze(w.tmsBaseUrl),testId:p.testId,auth:We(d),lifecycle:r}),!0):(c.log("error","MID_RUN_LOCK_CONFLICT","Mid-run lock acquisition failed",{reason:y}),a&&t.onLockState({phase:"conflict",scope:"mid_run",reason:y}),process.stderr.write(`error: mid-run lock acquisition failed (${y})
46
46
  `),!1)};if(a){let d=o.author===!0;d&&(pt(),c.log("info","FORCE_AUTHOR_RUN","--author flag set; walker bypassed"));let{authorBoundary:m,cancelledInPhase:v,shrinkCount:y}=await br({decisions:p.decisions,forceAuthor:d,hasRetry:o.retry===!0||o.retryCount!==void 0,maxShrinks:o.retryCount!==void 0?parseInt(o.retryCount,10):Se.maxShrinks,runReplayPhase:Ss,session:c,accumulator:te,acquireLockIfNeeded:Mt});if(M=y>0,y>0&&(c.log("info","RETRY_TRIGGERED","Retry loop triggered",{shrink_count:y,final_author_boundary:m}),t.onRetryAttempt({shrink_count:y,final_author_boundary:m,complete_reauthor:m===0})),m===0&&y>0&&c.log("info","COMPLETE_REAUTHOR_TRIGGERED","Complete reauthor fallback",{shrink_count:y}),!v&&m>=0)for(let b=m;b<i.steps.length;b++){let R=i.steps[b];if(!te.shouldRunFlatStep(R))continue;Nt(b),O=!0;let C=c.nextRunIndex();ne=C,await Ze(he(oe.raw,R.config.variables,R.objective).raw);let A=Ft(b,C),J=Date.now(),z=null,U=null,K=null,$=!1,Y=0;try{let E=at(A,{environment:f});r.register("runner",()=>{it()&&(P=!0);try{E.cancel()}catch{}}),F?.setRunActive(!0);try{for await(let T of E.events){if(t.onAgentEvent(T),T.type==="bifurcation"){let x=T.count??T.flows?.length??0;(T.is_single_flow??x<=1)||(K=T.flows??null,$=!0,Y=0)}else if(T.type==="run_start"&&$)Y++;else if(T.type==="step_event"&&T.event==="reasoning")F?.setStepText(T.detail);else if(T.type==="step_end"&&(T.status==="passed"&&F?.setStepComplete(),be)){let x=$?Math.max(0,Y-1):0;be(T.index,x,T.child_id)}if(T.type==="run_end"){z=T;break}if(T.type==="error"){U=T.message??"runner error";break}}try{E.cancel()}catch{}}finally{F?.setRunActive(!1),r.cleanup("runner","Step complete")}}catch(E){U=E.message}let Z=Math.round((Date.now()-J)/1e3),L=et(b,C,z,K,U,Z);if(c.recordStepRun({testmdStepIndex:i.steps[b].flatIndex,runIndex:C,totalRunDirs:z?.total_runs??1}),!L||P)break}}else{let{effectiveDecisions:d}=await import("./effective-decisions-DRM3JSR4.js"),{decideRetry:m}=await import("./replay-policy-6USQBT3E.js"),v=o.retry===!0||o.retryCount!==void 0,y=o.retryCount!==void 0?parseInt(o.retryCount,10):Se.maxShrinks,b=o.author===!0;b&&(pt(),c.log("info","FORCE_AUTHOR_RUN","--author flag set; walker bypassed"));let R=b?0:Ne(p.decisions),C=0,A=null,J=p.decisions.filter($=>$.kind==="replay").length,z=p.decisions.length-J,U=[];o.push&&U.push("--push"),v&&U.push("--retry"),o.retryCount!==void 0&&U.push(`--retry-count=${o.retryCount}`),b&&U.push("--author");let K={source:s,steps:{total:p.decisions.length,replay:J,author:z},model:_,viewport:{width:V.window_size.width,height:V.window_size.height},chrome:Q.cdpEndpoint??Q.wsEndpoint??"managed",session:c.sessionName??"ephemeral",variables:{count:Object.keys(H.raw).length,secrets:Object.values(H.raw).filter($=>$.secret).length,names:Object.keys(H.raw)},flags:U,mode:h.mode??"testing"};for(;;){let $=c.snapshot(),Y=te.snapshot(),Z=d(p.decisions,R,b);if(C>=1){let x=R===0?`\u21BB Complete re-author \u2014 retry budget exhausted (${C}/${y})`:`\u21BB Retry ${C}/${y} \u2014 replay 0..${R-1}, author ${R}..${p.decisions.length-1}
47
47
  reason: replay miss at step ${(A??0)+1}`;process.stderr.write(x+`
48
- `)}let L=C>=1&&R>0&&A!==null?{startIdx:0,endIdx:A,count:A}:void 0;F?.setRunActive(!0);let E=await Dn({decisions:Z,resolved:i,session:c,accumulator:te,tuiConfig:V,globalConfig:K,buildStepConfigAt:Ft,buildReplayConfig:x=>{let X=p.decisions[x];if(X.kind!=="replay")throw new Error("expected replay decision at index "+x);let re=i.steps[x];return ht({step:re,decision:X,chrome:Q,auth:l,sessionId:c.sessionId,runIndex:c.nextRunIndex(),sessionDir:c.sessionDir,windowSize:{width:V.window_size.width,height:V.window_size.height},forceNavigateUrl:x===0?ye??void 0:void 0,sessionContext:c.getContext(),variables:xn(oe.raw,re.config.variables,re.objective)})},onAnyAuthorStep:()=>{O=!0},onCancel:()=>{B=!0},topBannerModel:_,topBannerAuth:`${S.getActiveProfile()??"no profile"}/${f}`,spawnOpts:{environment:f,mode:h.mode??"testing",log:(x,X,re,tt)=>c.log(x,X,re,tt)},priorAttemptRollup:L,pushStepLevelDelta:(x,X)=>Ze(he(oe.raw,x,X).raw),onSequencerStepEnd:(x,X,re,tt)=>{let Is=Math.round((Date.now()-tt)/1e3),_s=x.hadError?x.reason??"runner error":null,Cs=et(X,re,x.runEnd,x.bifurcationFlows??null,_s,Is);return c.recordStepRun({testmdStepIndex:i.steps[X].flatIndex,runIndex:re,totalRunDirs:x.runEnd?.total_runs??x.bifurcationFlows?.length??1}),Cs},screenshotDispatcher:be,onReasoning:x=>F?.setStepText(x),onStepComplete:()=>F?.setStepComplete(),onSpawnStart:x=>{ne=x},host:t});if(F?.setRunActive(!1),E.cancelled){r.cleanup("marker-overlay","user cancelled run"),r.cleanup("chrome","user cancelled run");break}if(E.failedAt===null)break;let T=m({failedAt:E.failedAt,shrinkCount:C,hasRetry:v,maxShrinks:y});if(T.kind==="fail"||!I&&!await Mt())break;c.rollback($),te.rollback(Y),T.kind==="complete-reauthor"?R=0:R=T.newAuthorBoundary,C++,M=!0,c.log("info","RETRY_TRIGGERED","Retry loop triggered (TTY)",{shrink_count:C,failed_at:A}),R===0&&c.log("info","COMPLETE_REAUTHOR_TRIGGERED","Complete reauthor fallback (TTY)",{shrink_count:C}),A=E.failedAt}}let N=te.finalize(),ie=Math.round((Date.now()-ys)/1e3),Rs={session:c,resolvedAuth:l,chromeResult:Q,chromeInstance:xe??null,testId:c.testId??null,preparedVariables:H,variableIds:Pe,globalContext:Dt,localContext:jt,tuiConfig:V,env:f,localMode:!!o.local},ae=await Xr(Rs,{performUpload:async()=>{if(!l.basicAuth)return null;let d=W(f),m=(O||o.push===!0)&&!B,v=(I||p.isFirstRun)&&!B&&N.overallStatus==="passed",y=ge&&(I||p.isFirstRun);c.log("info","PIPELINE_GATE_STATE","Derived gate state (finalize)",{phase:"finalize",shouldUploadArtifacts:ge,shouldUploadPipeline:y,shouldReplaceLocalOutput:m,shouldCommit:v,lockHeld:I,anyAuthorStepRan:O,cancelled:B,overallStatus:N.overallStatus});let b=ns({session:c,env:f,auth:l,variables:H,variableIds:Pe,projectId:G,folderId:Ae,totalSteps:N.outcomes.length,totalDuration:ie,screenshotExtMap:Ee?.getExtMap(),codeExport:is({codeExport:o.codeExport,codeLanguage:o.codeLanguage,skipCodeValidation:o.skipCodeValidation},V.code_export),onProgress:()=>{},log:(C,A,J,z)=>c.log(C,A,J,z),shouldUploadArtifacts:y,shouldReplaceLocalOutput:m,shouldCommit:v,isFirstRun:p.isFirstRun,resolvedTest:i,sourcePath:s,stepRunRecords:c.getStepRunRecords(),outcomes:N.outcomes,overallStatus:N.overallStatus,fromCommitId:p.fromCommitId,startedISO:Xe,durationS:ie,tmsIds:{testId:p.testId??c.testId??void 0,testcaseId:p.testcaseId??c.testcaseId??void 0,projectId:G??void 0,folderId:Ae??void 0,orgId:c.orgId??void 0,sessionName:c.sessionName??Ue(s)},tmsBaseUrl:w.tmsBaseUrl,testId:p.testId??void 0,newCommitId:p.newCommitId??void 0,basicAuth:l.basicAuth??void 0,decisions:p.decisions,wantsPush:o.push===!0,retryTriggered:M,forceAuthor:o.author===!0});p.newCommitId!=null&&(b.skipTmsFinalize=!0);let R=new ir(b);return a?await R.execute():await t.runUpload(R,C=>{if(C.testcaseId&&C.shareId&&G)return wt(d.testManagerUiUrl,G,C.testcaseId,C.shareId)})},runCleanup:()=>{r.cleanup("chrome","test.md run complete")},log:(d,m,v,y)=>c.log(d,m,v,y)},{overallStatus:N.overallStatus,outcomes:N.outcomes,sourcePath:s,title:i.rootTitle,rootSteps:i.rootSteps,startedISO:Xe,durationS:ie,localMode:!!o.local,skipLocalWrites:!0});await Ln(s,p,c,N.outcomes,N.overallStatus,Xe,ie,ae.uploadResult,V,o,{resolvedAuth:l,tmsBaseUrl:w.tmsBaseUrl},I,B);let $t=W(f),Te=ae.uploadResult?.testcaseId,Le=Te&&ae.uploadResult?.shareId&&G?wt($t.testManagerUiUrl,G,Te,ae.uploadResult.shareId):void 0,Bt={overallStatus:N.overallStatus,durationS:ie,decisions:p.decisions,outcomes:N.outcomes,cancelled:B,retryTriggered:M,lockHeld:I,anyAuthorStepRan:O,isFirstRun:p.isFirstRun,wantsPush:o.push===!0,uploadResult:ae.uploadResult,shouldUploadArtifacts:ge,shouldReplaceLocalOutput:O&&!B,shouldCommit:(I||p.isFirstRun)&&!B&&N.overallStatus==="passed",shareUrl:Le},{buildSummaryEvent:ws}=await import("./SummaryBox-B4QJDLQD.js");if(a?t.onAgentEvent(ws(Bt)):await t.onSummary(Bt),!a){let d=Te&&G?Ur($t.testManagerUiUrl,G,Te):void 0;await t.onLinks({recordedTestPath:s,outputDir:se(s),shareableLink:Le,testCaseLink:d,codeExportDir:ae.uploadResult?.codeExportDir})}return t.onAgentEvent({type:"test_md_done",overall_status:N.overallStatus,duration_s:ie,session_id:c.sessionId,...Le?{share_url:Le}:{}}),{overallStatus:N.overallStatus,exitCode:N.overallStatus==="passed"?0:1,outputDir:se(s),durationS:ie,uploadResult:ae.uploadResult}}function An(e,t){let r={...e,...t},s=Object.keys(r).length>0?ue(r,""):{variables:{},objective:"",keyMap:{}};return{raw:r,auteur:s.variables,auteurObjective:"",secretEntries:Object.entries(r).filter(([,n])=>n.secret),nonSecretEntries:Object.entries(r).filter(([,n])=>!n.secret)}}function he(e,t,r){let s={...e,...t??{}};if(Object.keys(s).length===0)return{raw:s,variables:{},objective:r};let n=ue(s,r);return{raw:s,variables:Jr(n.variables,n.objective),objective:n.objective}}function xn(e,t,r){let s=he(e,t,r).variables;return Object.keys(s).length>0?s:void 0}function ds(e,t){let r=new Set(Ge),s={...e};for(let[n,o]of Object.entries(t))r.has(n)||n!=="variables"&&o!==void 0&&e[n]===void 0&&(s[n]=o);return s}function Pn(e,t){return e.length<=t?e:e.slice(0,t-1)+"\u2026"}async function Tn(e,t,r,s,n,o){let a=er(e),u=lr(t,us(a)?a:null);dr(t,u);let i=le(e),l=us(i)?JSON.parse(En(i,"utf8")):null,h=l?.testcase_id,f=l?.test_id,w=l?.commit_id,g=r.push===!0,_=r.retry===!0||r.retryCount!==void 0,S=r.author===!0;g&&!h&&process.stderr.write(`[--push] no meta.json yet \u2014 flag is a no-op on first run
48
+ `)}let L=C>=1&&R>0&&A!==null?{startIdx:0,endIdx:A,count:A}:void 0;F?.setRunActive(!0);let E=await Dn({decisions:Z,resolved:i,session:c,accumulator:te,tuiConfig:V,globalConfig:K,buildStepConfigAt:Ft,buildReplayConfig:x=>{let X=p.decisions[x];if(X.kind!=="replay")throw new Error("expected replay decision at index "+x);let re=i.steps[x];return ht({step:re,decision:X,chrome:Q,auth:l,sessionId:c.sessionId,runIndex:c.nextRunIndex(),sessionDir:c.sessionDir,windowSize:{width:V.window_size.width,height:V.window_size.height},forceNavigateUrl:x===0?ye??void 0:void 0,sessionContext:c.getContext(),variables:xn(oe.raw,re.config.variables,re.objective)})},onAnyAuthorStep:()=>{O=!0},onCancel:()=>{B=!0},topBannerModel:_,topBannerAuth:`${S.getActiveProfile()??"no profile"}/${f}`,spawnOpts:{environment:f,mode:h.mode??"testing",log:(x,X,re,tt)=>c.log(x,X,re,tt)},priorAttemptRollup:L,pushStepLevelDelta:(x,X)=>Ze(he(oe.raw,x,X).raw),onSequencerStepEnd:(x,X,re,tt)=>{let Is=Math.round((Date.now()-tt)/1e3),_s=x.hadError?x.reason??"runner error":null,Cs=et(X,re,x.runEnd,x.bifurcationFlows??null,_s,Is);return c.recordStepRun({testmdStepIndex:i.steps[X].flatIndex,runIndex:re,totalRunDirs:x.runEnd?.total_runs??x.bifurcationFlows?.length??1}),Cs},screenshotDispatcher:be,onReasoning:x=>F?.setStepText(x),onStepComplete:()=>F?.setStepComplete(),onSpawnStart:x=>{ne=x},host:t});if(F?.setRunActive(!1),E.cancelled){r.cleanup("marker-overlay","user cancelled run"),r.cleanup("chrome","user cancelled run");break}if(E.failedAt===null)break;let T=m({failedAt:E.failedAt,shrinkCount:C,hasRetry:v,maxShrinks:y});if(T.kind==="fail"||!I&&!await Mt())break;c.rollback($),te.rollback(Y),T.kind==="complete-reauthor"?R=0:R=T.newAuthorBoundary,C++,M=!0,c.log("info","RETRY_TRIGGERED","Retry loop triggered (TTY)",{shrink_count:C,failed_at:A}),R===0&&c.log("info","COMPLETE_REAUTHOR_TRIGGERED","Complete reauthor fallback (TTY)",{shrink_count:C}),A=E.failedAt}}let N=te.finalize(),ie=Math.round((Date.now()-ys)/1e3),Rs={session:c,resolvedAuth:l,chromeResult:Q,chromeInstance:xe??null,testId:c.testId??null,preparedVariables:H,variableIds:Pe,globalContext:Dt,localContext:jt,tuiConfig:V,env:f,localMode:!!o.local},ae=await Xr(Rs,{performUpload:async()=>{if(!l.basicAuth)return null;let d=W(f),m=(O||o.push===!0)&&!B,v=(I||p.isFirstRun)&&!B&&N.overallStatus==="passed",y=ge&&(I||p.isFirstRun);c.log("info","PIPELINE_GATE_STATE","Derived gate state (finalize)",{phase:"finalize",shouldUploadArtifacts:ge,shouldUploadPipeline:y,shouldReplaceLocalOutput:m,shouldCommit:v,lockHeld:I,anyAuthorStepRan:O,cancelled:B,overallStatus:N.overallStatus});let b=ns({session:c,env:f,auth:l,variables:H,variableIds:Pe,projectId:G,folderId:Ae,totalSteps:N.outcomes.length,totalDuration:ie,screenshotExtMap:Ee?.getExtMap(),codeExport:is({codeExport:o.codeExport,codeLanguage:o.codeLanguage,skipCodeValidation:o.skipCodeValidation},V.code_export),onProgress:()=>{},log:(C,A,J,z)=>c.log(C,A,J,z),shouldUploadArtifacts:y,shouldReplaceLocalOutput:m,shouldCommit:v,isFirstRun:p.isFirstRun,resolvedTest:i,sourcePath:s,stepRunRecords:c.getStepRunRecords(),outcomes:N.outcomes,overallStatus:N.overallStatus,fromCommitId:p.fromCommitId,startedISO:Xe,durationS:ie,tmsIds:{testId:p.testId??c.testId??void 0,testcaseId:p.testcaseId??c.testcaseId??void 0,projectId:G??void 0,folderId:Ae??void 0,orgId:c.orgId??void 0,sessionName:c.sessionName??Ue(s)},tmsBaseUrl:w.tmsBaseUrl,testId:p.testId??void 0,newCommitId:p.newCommitId??void 0,basicAuth:l.basicAuth??void 0,decisions:p.decisions,wantsPush:o.push===!0,retryTriggered:M,forceAuthor:o.author===!0});p.newCommitId!=null&&(b.skipTmsFinalize=!0);let R=new ir(b);return a?await R.execute():await t.runUpload(R,C=>{if(C.testcaseId&&C.shareId&&G)return wt(d.testManagerUiUrl,G,C.testcaseId,C.shareId)})},runCleanup:()=>{r.cleanup("chrome","test.md run complete")},log:(d,m,v,y)=>c.log(d,m,v,y)},{overallStatus:N.overallStatus,outcomes:N.outcomes,sourcePath:s,title:i.rootTitle,rootSteps:i.rootSteps,startedISO:Xe,durationS:ie,localMode:!!o.local,skipLocalWrites:!0});await Ln(s,p,c,N.outcomes,N.overallStatus,Xe,ie,ae.uploadResult,V,o,{resolvedAuth:l,tmsBaseUrl:w.tmsBaseUrl},I,B);let $t=W(f),Te=ae.uploadResult?.testcaseId,Le=Te&&ae.uploadResult?.shareId&&G?wt($t.testManagerUiUrl,G,Te,ae.uploadResult.shareId):void 0,Bt={overallStatus:N.overallStatus,durationS:ie,decisions:p.decisions,outcomes:N.outcomes,cancelled:B,retryTriggered:M,lockHeld:I,anyAuthorStepRan:O,isFirstRun:p.isFirstRun,wantsPush:o.push===!0,uploadResult:ae.uploadResult,shouldUploadArtifacts:ge,shouldReplaceLocalOutput:O&&!B,shouldCommit:(I||p.isFirstRun)&&!B&&N.overallStatus==="passed",shareUrl:Le},{buildSummaryEvent:ws}=await import("./SummaryBox-WWMBNF6O.js");if(a?t.onAgentEvent(ws(Bt)):await t.onSummary(Bt),!a){let d=Te&&G?Ur($t.testManagerUiUrl,G,Te):void 0;await t.onLinks({recordedTestPath:s,outputDir:se(s),shareableLink:Le,testCaseLink:d,codeExportDir:ae.uploadResult?.codeExportDir})}return t.onAgentEvent({type:"test_md_done",overall_status:N.overallStatus,duration_s:ie,session_id:c.sessionId,...Le?{share_url:Le}:{}}),{overallStatus:N.overallStatus,exitCode:N.overallStatus==="passed"?0:1,outputDir:se(s),durationS:ie,uploadResult:ae.uploadResult}}function An(e,t){let r={...e,...t},s=Object.keys(r).length>0?ue(r,""):{variables:{},objective:"",keyMap:{}};return{raw:r,auteur:s.variables,auteurObjective:"",secretEntries:Object.entries(r).filter(([,n])=>n.secret),nonSecretEntries:Object.entries(r).filter(([,n])=>!n.secret)}}function he(e,t,r){let s={...e,...t??{}};if(Object.keys(s).length===0)return{raw:s,variables:{},objective:r};let n=ue(s,r);return{raw:s,variables:Jr(n.variables,n.objective),objective:n.objective}}function xn(e,t,r){let s=he(e,t,r).variables;return Object.keys(s).length>0?s:void 0}function ds(e,t){let r=new Set(Ge),s={...e};for(let[n,o]of Object.entries(t))r.has(n)||n!=="variables"&&o!==void 0&&e[n]===void 0&&(s[n]=o);return s}function Pn(e,t){return e.length<=t?e:e.slice(0,t-1)+"\u2026"}async function Tn(e,t,r,s,n,o){let a=er(e),u=lr(t,us(a)?a:null);dr(t,u);let i=le(e),l=us(i)?JSON.parse(En(i,"utf8")):null,h=l?.testcase_id,f=l?.test_id,w=l?.commit_id,g=r.push===!0,_=r.retry===!0||r.retryCount!==void 0,S=r.author===!0;g&&!h&&process.stderr.write(`[--push] no meta.json yet \u2014 flag is a no-op on first run
49
49
  `),S&&(h=void 0,f=void 0,w=void 0);let k=s.resolvedAuth.basicAuth;if(!k){let M=await s.resolvedAuth.resolver.resolve(!0);M?.username&&M?.access_key&&(k={username:M.username,access_key:M.access_key},s.resolvedAuth.basicAuth=k)}let c=!!k,P=!r.local&&c&&f!=null&&w!=null&&h!=null,p=P&&(cr(u)||g);if(g&&!P)return process.stderr.write(`error: --push requires authenticated credentials for the lock API. Run 'kane-cli login' (OAuth) or pass --username/--access-key inline.
50
50
  `),{resolved:t,decisions:u,testId:f,testcaseId:h,fromCommitId:w,newCommitId:null,isFirstRun:!1,hasAuth:c,canLock:P,lockAcquired:!1,abort:{exitCode:2}};if(_&&!P)return process.stderr.write(`error: --retry requires authenticated credentials for the lock API. Run 'kane-cli login' (OAuth) or pass --username/--access-key inline.
51
51
  `),{resolved:t,decisions:u,testId:f,testcaseId:h,fromCommitId:w,newCommitId:null,isFirstRun:!1,hasAuth:c,canLock:P,lockAcquired:!1,abort:{exitCode:2}};if(S&&!c)return process.stderr.write(`error: --author requires authenticated credentials for the TMS API. Run 'kane-cli login' (OAuth) or pass --username/--access-key inline.