@testmuai/kane-cli 0.3.1 → 0.3.2

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 (97) hide show
  1. package/dist/{ChromeProfilePicker-HGRJNQDM.js → ChromeProfilePicker-ETBZA64A.js} +1 -1
  2. package/dist/{CliFeedbackPrompt-JXEPBJ63.js → CliFeedbackPrompt-S7RZGMBQ.js} +1 -1
  3. package/dist/{CliUploadProgress-L5VJUXUC.js → CliUploadProgress-TPWX5ARU.js} +1 -1
  4. package/dist/{ConfigView-LOEAT3HQ.js → ConfigView-BSIS2LOH.js} +1 -1
  5. package/dist/FolderPicker-7FXP3PIM.js +2 -0
  6. package/dist/HelpView-MUIOT5UN.js +2 -0
  7. package/dist/{InfoBox-MK7EEGCH.js → InfoBox-3EY4ARJG.js} +1 -1
  8. package/dist/{LinksBox-RSWQWL6G.js → LinksBox-UD364LBX.js} +1 -1
  9. package/dist/{ProfilesView-KCOMTDR5.js → ProfilesView-UOJP2KA2.js} +1 -1
  10. package/dist/ProjectPicker-5ZPZNRSS.js +2 -0
  11. package/dist/{SaveSessionPrompt-RGL3LAEB.js → SaveSessionPrompt-D4PETK7B.js} +1 -1
  12. package/dist/SingleShotApp-N4AGSAPW.js +2 -0
  13. package/dist/{SummaryBox-5YPKUIHB.js → SummaryBox-L4ZXY4S4.js} +1 -1
  14. package/dist/{TestMdRunView-QS7IUANM.js → TestMdRunView-YD3Z6MCR.js} +1 -1
  15. package/dist/{WhoamiView-GL3HZQ4Q.js → WhoamiView-ZZUFXKDU.js} +1 -1
  16. package/dist/changelog-H2RXH4LH.js +4 -0
  17. package/dist/{chunk-3ELBJPHQ.js → chunk-2FCAWRCU.js} +1 -1
  18. package/dist/{chunk-L4GAZTAQ.js → chunk-3UDKGPAS.js} +1 -1
  19. package/dist/chunk-3YGQYJ3D.js +2 -0
  20. package/dist/chunk-477FDDDW.js +13 -0
  21. package/dist/{chunk-XMK4GYI7.js → chunk-4GQZBMTW.js} +1 -1
  22. package/dist/{chunk-THNGNS36.js → chunk-7ECMUWV2.js} +1 -1
  23. package/dist/chunk-7JB4RPI2.js +2 -0
  24. package/dist/chunk-AH4AXJML.js +2 -0
  25. package/dist/{chunk-XP5SMOND.js → chunk-AH7HH3OE.js} +1 -1
  26. package/dist/chunk-AMCAQCEV.js +17 -0
  27. package/dist/{chunk-ZLQ7YLXO.js → chunk-BSHGW3QM.js} +1 -1
  28. package/dist/{chunk-NOH6RERF.js → chunk-E7QWDV7M.js} +1 -1
  29. package/dist/chunk-EZJNX4VE.js +5 -0
  30. package/dist/chunk-FMMDLDDI.js +2 -0
  31. package/dist/chunk-GCAHPH2E.js +2 -0
  32. package/dist/{chunk-34DK2AUH.js → chunk-HXIGYD2T.js} +1 -1
  33. package/dist/chunk-JI7KJKG4.js +2 -0
  34. package/dist/{chunk-KVDOQY2Q.js → chunk-KGZATJQN.js} +1 -1
  35. package/dist/chunk-KKZRPFWO.js +2 -0
  36. package/dist/chunk-L5LI2JF4.js +38 -0
  37. package/dist/{chunk-ZX3PMRMO.js → chunk-MVX3N7GI.js} +1 -1
  38. package/dist/{chunk-BR2S57O2.js → chunk-O22K3JLR.js} +1 -1
  39. package/dist/{chunk-VUBZQUP4.js → chunk-OQ64GUQE.js} +1 -1
  40. package/dist/chunk-OQZG3V6B.js +2 -0
  41. package/dist/{chunk-TK7ZJ7YX.js → chunk-PAQGYV5G.js} +1 -1
  42. package/dist/{chunk-L4OZRHUT.js → chunk-RBED7RVV.js} +1 -1
  43. package/dist/{chunk-3QD3LA72.js → chunk-RDJPZQBU.js} +1 -1
  44. package/dist/{chunk-QO6VFDI4.js → chunk-RVQBAKOK.js} +1 -1
  45. package/dist/{chunk-L2HVRWIT.js → chunk-UFNKCPUB.js} +11 -11
  46. package/dist/chunk-V4S5H6O2.js +9 -0
  47. package/dist/chunk-V7QXJKX7.js +3 -0
  48. package/dist/{chunk-RXMOIIQD.js → chunk-WCRLZETG.js} +1 -1
  49. package/dist/chunk-X7VI7KK3.js +11 -0
  50. package/dist/{chunk-HJ3CHMEM.js → chunk-XK33C64U.js} +1 -1
  51. package/dist/{chunk-MEB2KLWF.js → chunk-XUDEM7I6.js} +1 -1
  52. package/dist/chunk-YZTCCQHR.js +2 -0
  53. package/dist/chunk-ZB72T6HB.js +5 -0
  54. package/dist/controller-client-OMKEBP4B.js +2 -0
  55. package/dist/index.js +23 -23
  56. package/dist/logging-RMC6R23F.js +2 -0
  57. package/dist/login-flow-NL3LNSP5.js +2 -0
  58. package/dist/persist-recorded-session-GG732QRB.js +3 -0
  59. package/dist/pipeline-EUZIM2ZO.js +2 -0
  60. package/dist/{recording-banner-IDLY2FM6.js → recording-banner-LAAAMKIM.js} +1 -1
  61. package/dist/resolver-F6HCOZOX.js +2 -0
  62. package/dist/run-test-md-IAEJXIVK.js +65 -0
  63. package/dist/testmd-actions-5O7F22EC.js +20 -0
  64. package/dist/tms-client-XOARLBEP.js +2 -0
  65. package/dist/{validate-basic-27BIMJ2F.js → validate-basic-NIEIKFGP.js} +1 -1
  66. package/dist/version-check-WHWTPX6C.js +2 -0
  67. package/package.json +5 -5
  68. package/dist/FolderPicker-I6JTRNAU.js +0 -2
  69. package/dist/HelpView-UEUKYHFR.js +0 -2
  70. package/dist/ProjectPicker-AX6H5MX3.js +0 -2
  71. package/dist/SingleShotApp-YTFAGVZD.js +0 -2
  72. package/dist/changelog-CLQ7HCB3.js +0 -4
  73. package/dist/chunk-BM4COXQU.js +0 -53
  74. package/dist/chunk-BQKDPI6L.js +0 -2
  75. package/dist/chunk-DUR6AFYA.js +0 -5
  76. package/dist/chunk-DXKKUGFG.js +0 -2
  77. package/dist/chunk-F6HEB4PA.js +0 -2
  78. package/dist/chunk-FFO5XXKV.js +0 -4
  79. package/dist/chunk-GTFULP6B.js +0 -13
  80. package/dist/chunk-K7MSPKEM.js +0 -5
  81. package/dist/chunk-KULEBWMB.js +0 -2
  82. package/dist/chunk-L5Y2GUO6.js +0 -2
  83. package/dist/chunk-NZSHFIZX.js +0 -3
  84. package/dist/chunk-PWGEMRBD.js +0 -2
  85. package/dist/chunk-SLA75N5B.js +0 -2
  86. package/dist/chunk-WAFO4MT4.js +0 -20
  87. package/dist/chunk-YUUZDFT7.js +0 -2
  88. package/dist/controller-client-7BIK5FYL.js +0 -2
  89. package/dist/logging-GG23EW5G.js +0 -2
  90. package/dist/login-flow-ZUZUZIXD.js +0 -2
  91. package/dist/persist-recorded-session-ZXKA4H7E.js +0 -5
  92. package/dist/pipeline-BVH3R7YP.js +0 -2
  93. package/dist/resolver-QLDOAIXU.js +0 -2
  94. package/dist/run-test-md-UPAR3DQY.js +0 -54
  95. package/dist/testmd-actions-YYFFNNIH.js +0 -20
  96. package/dist/tms-client-CTH4NVFM.js +0 -2
  97. package/dist/version-check-6DXFF6IN.js +0 -2
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c}from"./chunk-MEB2KLWF.js";import"./chunk-HJ3CHMEM.js";import"./chunk-HCBYKLMW.js";import"./chunk-3ELBJPHQ.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{c as ChromeProfilePicker,b as formatChromeProfileLine,a as listChromeProfiles};
2
+ import{a,b,c}from"./chunk-XUDEM7I6.js";import"./chunk-XK33C64U.js";import"./chunk-HCBYKLMW.js";import"./chunk-2FCAWRCU.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{c as ChromeProfilePicker,b as formatChromeProfileLine,a as listChromeProfiles};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as r}from"./chunk-L4GAZTAQ.js";import"./chunk-HJ3CHMEM.js";import"./chunk-HCBYKLMW.js";import"./chunk-3ELBJPHQ.js";import{c as e}from"./chunk-C44QQJR4.js";import{a as i}from"./chunk-6YGTRKDT.js";import{e as m}from"./chunk-UR6MHSHU.js";var t=m(i(),1);async function d(){return new Promise(o=>{let c=e(t.default.createElement(r,{onSubmit:n=>{c.unmount(),o(n)}}),{stdout:process.stderr,exitOnCtrlC:!1})})}export{d as renderFeedbackPrompt};
2
+ import{a as r}from"./chunk-3UDKGPAS.js";import"./chunk-XK33C64U.js";import"./chunk-HCBYKLMW.js";import"./chunk-2FCAWRCU.js";import{c as e}from"./chunk-C44QQJR4.js";import{a as i}from"./chunk-6YGTRKDT.js";import{e as m}from"./chunk-UR6MHSHU.js";var t=m(i(),1);async function d(){return new Promise(o=>{let c=e(t.default.createElement(r,{onSubmit:n=>{c.unmount(),o(n)}}),{stdout:process.stderr,exitOnCtrlC:!1})})}export{d as renderFeedbackPrompt};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as P,b as g,c as f}from"./chunk-VUBZQUP4.js";import"./chunk-RXMOIIQD.js";import{a as c}from"./chunk-HCBYKLMW.js";import"./chunk-3ELBJPHQ.js";import{c as d}from"./chunk-C44QQJR4.js";import{a as h}from"./chunk-6YGTRKDT.js";import{e as p}from"./chunk-UR6MHSHU.js";var e=p(h(),1);var m=p(c(),1);function w({pipeline:t,buildShareUrl:r,onDone:o}){let[n,i]=(0,e.useState)(P()),[S,l]=(0,e.useState)("uploading"),[U,R]=(0,e.useState)(),[C,E]=(0,e.useState)();return(0,e.useEffect)(()=>{let x=t.config.onProgress;t.config.onProgress=(s,u,a)=>{x(s,u,a),i(y=>g(y,s,u,a))},t.execute().then(s=>{s.success?(R(r?.(s)),l("success")):(E(s.error),l("failed")),setTimeout(()=>o(s),1500)})},[]),(0,m.jsx)(f,{steps:n,status:S,testUrl:U,error:C})}async function O(t,r){return new Promise(o=>{let n=d(e.default.createElement(w,{pipeline:t,buildShareUrl:r,onDone:i=>{n.unmount(),o(i)}}),{stdout:process.stderr,exitOnCtrlC:!1})})}export{O as renderUploadProgress};
2
+ import{a as P,b as g,c as f}from"./chunk-OQ64GUQE.js";import"./chunk-WCRLZETG.js";import{a as c}from"./chunk-HCBYKLMW.js";import"./chunk-2FCAWRCU.js";import{c as d}from"./chunk-C44QQJR4.js";import{a as h}from"./chunk-6YGTRKDT.js";import{e as p}from"./chunk-UR6MHSHU.js";var e=p(h(),1);var m=p(c(),1);function w({pipeline:t,buildShareUrl:r,onDone:o}){let[n,i]=(0,e.useState)(P()),[S,l]=(0,e.useState)("uploading"),[U,R]=(0,e.useState)(),[C,E]=(0,e.useState)();return(0,e.useEffect)(()=>{let x=t.config.onProgress;t.config.onProgress=(s,u,a)=>{x(s,u,a),i(y=>g(y,s,u,a))},t.execute().then(s=>{s.success?(R(r?.(s)),l("success")):(E(s.error),l("failed")),setTimeout(()=>o(s),1500)})},[]),(0,m.jsx)(f,{steps:n,status:S,testUrl:U,error:C})}async function O(t,r){return new Promise(o=>{let n=d(e.default.createElement(w,{pipeline:t,buildShareUrl:r,onDone:i=>{n.unmount(),o(i)}}),{stdout:process.stderr,exitOnCtrlC:!1})})}export{O as renderUploadProgress};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as d,b as l,c as r}from"./chunk-34DK2AUH.js";import{a as m}from"./chunk-HCBYKLMW.js";import{t as o}from"./chunk-3ELBJPHQ.js";import{a as t,j as u}from"./chunk-C44QQJR4.js";import{a as C}from"./chunk-6YGTRKDT.js";import{e as n}from"./chunk-UR6MHSHU.js";var f=n(C(),1);var e=n(m(),1);function D({model:c,authLabel:s,profile:g,env:p,defaultUrl:i,projectId:b,folderId:v,windowSize:x,chromeProfile:w}){let{exit:a}=u();return(0,f.useEffect)(()=>{let B=setTimeout(()=>a(),50);return()=>clearTimeout(B)},[a]),(0,e.jsx)(t,{flexDirection:"column",children:(0,e.jsx)(d,{title:"Configuration",children:(0,e.jsxs)(t,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(r,{label:"Auth"}),(0,e.jsx)(l,{label:" method",value:s}),(0,e.jsx)(l,{label:" profile",value:g}),(0,e.jsx)(l,{label:" env",value:p}),(0,e.jsx)(r,{label:"Defaults"}),(0,e.jsx)(l,{label:" url",value:i??"(none)",valueColor:i?o.cyan:o.dimmed}),(0,e.jsx)(l,{label:" model",value:c}),(0,e.jsx)(l,{label:" window",value:x}),(0,e.jsx)(l,{label:" project",value:b??"(none)"}),(0,e.jsx)(l,{label:" folder",value:v??"(none)"}),(0,e.jsx)(r,{label:"Paths"}),(0,e.jsx)(l,{label:" chrome",value:w,valueColor:o.dimmed})]})})})}export{D as ConfigView};
2
+ import{a as d,b as l,c as r}from"./chunk-HXIGYD2T.js";import{a as m}from"./chunk-HCBYKLMW.js";import{t as o}from"./chunk-2FCAWRCU.js";import{a as t,j as u}from"./chunk-C44QQJR4.js";import{a as C}from"./chunk-6YGTRKDT.js";import{e as n}from"./chunk-UR6MHSHU.js";var f=n(C(),1);var e=n(m(),1);function D({model:c,authLabel:s,profile:g,env:p,defaultUrl:i,projectId:b,folderId:v,windowSize:x,chromeProfile:w}){let{exit:a}=u();return(0,f.useEffect)(()=>{let B=setTimeout(()=>a(),50);return()=>clearTimeout(B)},[a]),(0,e.jsx)(t,{flexDirection:"column",children:(0,e.jsx)(d,{title:"Configuration",children:(0,e.jsxs)(t,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(r,{label:"Auth"}),(0,e.jsx)(l,{label:" method",value:s}),(0,e.jsx)(l,{label:" profile",value:g}),(0,e.jsx)(l,{label:" env",value:p}),(0,e.jsx)(r,{label:"Defaults"}),(0,e.jsx)(l,{label:" url",value:i??"(none)",valueColor:i?o.cyan:o.dimmed}),(0,e.jsx)(l,{label:" model",value:c}),(0,e.jsx)(l,{label:" window",value:x}),(0,e.jsx)(l,{label:" project",value:b??"(none)"}),(0,e.jsx)(l,{label:" folder",value:v??"(none)"}),(0,e.jsx)(r,{label:"Paths"}),(0,e.jsx)(l,{label:" chrome",value:w,valueColor:o.dimmed})]})})})}export{D as ConfigView};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b}from"./chunk-RDJPZQBU.js";import"./chunk-YCCUBQY4.js";import"./chunk-7ECMUWV2.js";import"./chunk-PAQGYV5G.js";import"./chunk-XK33C64U.js";import"./chunk-HCBYKLMW.js";import"./chunk-2FCAWRCU.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-YZTCCQHR.js";import"./chunk-KKZRPFWO.js";import"./chunk-V7QXJKX7.js";import"./chunk-UR6MHSHU.js";export{b as FolderPicker,a as formatFolderLine};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as T}from"./chunk-HCBYKLMW.js";import{a as f,b as i,t}from"./chunk-2FCAWRCU.js";import{a as n,b as o,j as h,k as x}from"./chunk-C44QQJR4.js";import{a as b}from"./chunk-6YGTRKDT.js";import{e as p}from"./chunk-UR6MHSHU.js";var w=p(b(),1);var e=p(T(),1),S="https://www.testmuai.com/support/docs/kane-cli-introduction",v="https://github.com/LambdaTest/kane-cli/issues";function L(){let{exit:r}=h(),{stdout:c}=x(),l=c?.columns??80;return(0,w.useEffect)(()=>{let g=setTimeout(()=>r(),50);return()=>clearTimeout(g)},[r]),(0,e.jsxs)(n,{flexDirection:"column",children:[(0,e.jsxs)(n,{paddingX:1,paddingTop:1,flexDirection:"column",children:[(0,e.jsx)(o,{color:t.purple,bold:!0,children:i}),(0,e.jsxs)(n,{children:[(0,e.jsx)(o,{color:t.dimmed,children:"Browser automation powered by AI "}),(0,e.jsxs)(o,{color:t.muted,children:[" v",f]})]})]}),(0,e.jsx)(o,{children:" "}),(0,e.jsxs)(d,{title:"USAGE",children:[(0,e.jsx)(m,{cmd:`${i}`,desc:"Single-shot prompt (no args, TTY)"}),(0,e.jsx)(m,{cmd:`${i} --tui`,desc:"Full interactive TUI",highlight:!0}),(0,e.jsx)(m,{cmd:`${i} run "<objective>"`,desc:"Inline objective"}),(0,e.jsx)(m,{cmd:`${i} testmd run <path>.md`,desc:"Replay a saved *_test.md file"})]}),(0,e.jsxs)(d,{title:"HELP",children:[(0,e.jsx)(m,{cmd:`${i} --help`,desc:"Show this help (long form)"}),(0,e.jsx)(m,{cmd:`${i} -h`,desc:"Show this help (short form)"}),(0,e.jsx)(m,{cmd:`${i} help`,desc:"Show this help (subcommand form)"}),(0,e.jsxs)(n,{marginLeft:2,marginTop:0,flexDirection:"column",children:[(0,e.jsxs)(o,{color:t.dimmed,children:["These are the only supported help invocations. Anything else (e.g. ",(0,e.jsx)(o,{color:t.cyan,children:"-help"}),") is an unknown flag."]}),(0,e.jsxs)(o,{color:t.dimmed,children:["Terminal tab-completion is a shell feature; ",i," does not ship shell-completion scripts, so any flag your shell suggests is a generic guess \u2014 not from ",i,"."]})]})]}),(0,e.jsxs)(d,{title:"COMMANDS",children:[(0,e.jsx)(a,{cmd:"run",args:"<objective>",desc:"Run an objective (inline string)",highlight:!0}),(0,e.jsx)(a,{cmd:"testmd",args:"run|list|status|delete|export",desc:"Manage *_test.md files"}),(0,e.jsx)(a,{cmd:"login",desc:"Auth setup (interactive, --oauth, or --username)"}),(0,e.jsx)(a,{cmd:"logout",desc:"Revoke tokens + delete profile"}),(0,e.jsx)(a,{cmd:"whoami",desc:"Show authenticated identity"}),(0,e.jsx)(a,{cmd:"config",args:"show|set-\u2026|reset",desc:"Manage configuration"}),(0,e.jsx)(a,{cmd:"profiles",args:"list|switch|delete",desc:"Manage auth profiles"}),(0,e.jsx)(a,{cmd:"changelog",args:"[--all]",desc:"Show recent release notes"})]}),(0,e.jsxs)(d,{title:"TESTMD ACTIONS",children:[(0,e.jsx)(a,{cmd:"testmd run",args:"<path>",desc:"Replay a saved *_test.md file",highlight:!0}),(0,e.jsx)(a,{cmd:"testmd list",desc:"List *_test.md files in cwd (recursive)"}),(0,e.jsx)(a,{cmd:"testmd status",args:"<path>",desc:"Print local meta.json for a test"}),(0,e.jsx)(a,{cmd:"testmd delete",args:"<path>",desc:"Remove output-<stem>/ and the source file"}),(0,e.jsx)(a,{cmd:"testmd export",args:"<path> --language <py|js>",desc:"Generate standalone Playwright code"})]}),(0,e.jsxs)(d,{title:"RUN FLAGS",children:[(0,e.jsx)(s,{long:"--max-steps",arg:"<n>",desc:"Max agent steps (default: 30)"}),(0,e.jsx)(s,{long:"--timeout",arg:"<sec>",desc:"Kill run after N seconds"}),(0,e.jsx)(s,{long:"--headless",desc:"No visible browser window"}),(0,e.jsx)(s,{long:"--mode",arg:"<action|testing>",desc:"Run mode (default: testing)"}),(0,e.jsx)(s,{long:"--name",arg:"<name>",desc:"Persist session under this name"}),(0,e.jsx)(s,{long:"--variables",arg:"<json>",desc:"Inline variables as JSON"}),(0,e.jsx)(s,{long:"--variables-file",arg:"<path>",desc:"Load variables from file"}),(0,e.jsx)(s,{long:"--session-context",arg:"<json>",desc:"Prior runs context JSON"}),(0,e.jsx)(s,{long:"--global-context",arg:"<file>",desc:"Override global context markdown"}),(0,e.jsx)(s,{long:"--local-context",arg:"<file>",desc:"Override local context markdown"}),(0,e.jsx)(s,{long:"--ws-endpoint",arg:"<url>",desc:"Remote browser (LambdaTest)"}),(0,e.jsx)(s,{long:"--cdp-endpoint",arg:"<url>",desc:"Connect to existing Chrome CDP"}),(0,e.jsx)(s,{long:"--task-skills",desc:"Domain-specific task skills (experimental)"}),(0,e.jsx)(s,{long:"--code-export",desc:"Generate code export after upload"}),(0,e.jsx)(s,{long:"--code-language",arg:"<lang>",desc:"Code export language: python | javascript"}),(0,e.jsx)(s,{long:"--skip-code-validation",desc:"Skip post-codegen validation"}),(0,e.jsx)(s,{long:"--username",arg:"<user>",desc:"Basic auth (skip OAuth)"}),(0,e.jsx)(s,{long:"--access-key",arg:"<key>",desc:"Basic auth access key"}),(0,e.jsx)(s,{long:"--env",arg:"<name>",desc:"Environment (prod or stage)"}),(0,e.jsx)(s,{long:"--agent",desc:"NDJSON output (no UI)",highlight:!0})]}),(0,e.jsxs)(d,{title:"EXAMPLES",children:[(0,e.jsx)(u,{label:"Inline objective",cmd:`${i} run "Search for laptop"`}),(0,e.jsx)(u,{label:"Replay a saved test",cmd:`${i} testmd run smoke_test.md`}),(0,e.jsx)(u,{label:"Variables",cmd:`${i} run "Login as {{user}}" --variables '{"user":{"value":"alice"}}'`}),(0,e.jsx)(u,{label:"Agent mode (NDJSON)",cmd:`${i} run "Add to cart" --agent | jq .status`})]}),(0,e.jsx)(d,{title:"TEST FILES",children:(0,e.jsxs)(n,{marginLeft:2,flexDirection:"column",children:[(0,e.jsxs)(o,{color:t.dimmed,children:[(0,e.jsx)(o,{color:t.cyan,children:"*_test.md"})," \u2014 markdown test files with YAML frontmatter and ",(0,e.jsx)(o,{color:t.cyan,children:"## "}),"step headings."]}),(0,e.jsxs)(o,{color:t.dimmed,children:["Run with ",(0,e.jsxs)(o,{color:t.cyan,children:[i," testmd run path/to/foo_test.md"]}),". (`.md` paths are not accepted by `",i," run`.)"]}),(0,e.jsxs)(o,{color:t.dimmed,children:["Sessions you run in TUI auto-save to ",(0,e.jsx)(o,{color:t.cyan,children:"<cwd>/.testmuai/tests/<name>_test.md"})," (testing mode prompts on exit)."]})]})}),(0,e.jsxs)(n,{flexDirection:"column",marginTop:0,paddingX:1,children:[(0,e.jsx)(o,{color:t.muted,children:"\u2500".repeat(Math.min(l-2,70))}),(0,e.jsxs)(n,{gap:3,children:[(0,e.jsxs)(n,{children:[(0,e.jsx)(o,{color:t.dimmed,children:"Docs "}),(0,e.jsx)(o,{color:t.cyan,underline:!0,children:S})]}),(0,e.jsxs)(n,{children:[(0,e.jsx)(o,{color:t.dimmed,children:"Bugs "}),(0,e.jsx)(o,{color:t.cyan,underline:!0,children:v})]})]})]}),(0,e.jsx)(o,{children:" "})]})}function d({title:r,children:c}){return(0,e.jsxs)(n,{flexDirection:"column",marginBottom:1,children:[(0,e.jsx)(n,{marginLeft:1,children:(0,e.jsx)(o,{bold:!0,color:t.dimmed,children:r})}),c]})}function m({cmd:r,desc:c,highlight:l}){return(0,e.jsxs)(n,{marginLeft:2,children:[(0,e.jsxs)(n,{width:40,children:[(0,e.jsx)(o,{color:t.dimmed,children:"$ "}),(0,e.jsx)(o,{color:l?t.purple:t.cyan,children:r})]}),(0,e.jsx)(o,{color:t.dimmed,children:c})]})}function a({cmd:r,args:c,desc:l,highlight:g}){return(0,e.jsxs)(n,{marginLeft:2,children:[(0,e.jsx)(n,{width:16,children:(0,e.jsx)(o,{color:g?t.purple:t.green,bold:!0,children:r})}),(0,e.jsx)(n,{width:32,children:c?(0,e.jsx)(o,{color:t.dimmed,children:c}):null}),(0,e.jsx)(o,{color:t.dimmed,children:l})]})}function s({long:r,arg:c,desc:l,highlight:g}){return(0,e.jsxs)(n,{marginLeft:2,children:[(0,e.jsxs)(n,{width:30,children:[(0,e.jsx)(o,{color:g?t.purple:t.cyan,children:r}),c&&(0,e.jsxs)(o,{color:t.dimmed,children:[" ",c]})]}),(0,e.jsx)(o,{color:t.dimmed,children:l})]})}function u({label:r,cmd:c}){return(0,e.jsxs)(n,{marginLeft:2,flexDirection:"column",children:[(0,e.jsxs)(o,{color:t.dimmed,children:["# ",r]}),(0,e.jsxs)(o,{color:t.cyan,children:["$ ",c]})]})}export{L as HelpView};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-ZX3PMRMO.js";import"./chunk-34DK2AUH.js";import"./chunk-HCBYKLMW.js";import"./chunk-3ELBJPHQ.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as InfoBox};
2
+ import{a}from"./chunk-MVX3N7GI.js";import"./chunk-HXIGYD2T.js";import"./chunk-HCBYKLMW.js";import"./chunk-2FCAWRCU.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as InfoBox};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-XP5SMOND.js";import"./chunk-HCBYKLMW.js";import"./chunk-3ELBJPHQ.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as LinksBox};
2
+ import{a}from"./chunk-AH7HH3OE.js";import"./chunk-HCBYKLMW.js";import"./chunk-2FCAWRCU.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as LinksBox};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-QO6VFDI4.js";import"./chunk-HJ3CHMEM.js";import"./chunk-HCBYKLMW.js";import"./chunk-3ELBJPHQ.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as ProfilesView,a as formatProfileLine};
2
+ import{a,b}from"./chunk-RVQBAKOK.js";import"./chunk-XK33C64U.js";import"./chunk-HCBYKLMW.js";import"./chunk-2FCAWRCU.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as ProfilesView,a as formatProfileLine};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b}from"./chunk-BSHGW3QM.js";import"./chunk-YCCUBQY4.js";import"./chunk-7ECMUWV2.js";import"./chunk-PAQGYV5G.js";import"./chunk-XK33C64U.js";import"./chunk-HCBYKLMW.js";import"./chunk-2FCAWRCU.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-YZTCCQHR.js";import"./chunk-KKZRPFWO.js";import"./chunk-V7QXJKX7.js";import"./chunk-UR6MHSHU.js";export{b as ProjectPicker,a as formatProjectLine};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c}from"./chunk-XMK4GYI7.js";import"./chunk-S3DAAAE5.js";import"./chunk-ZX3PMRMO.js";import"./chunk-34DK2AUH.js";import"./chunk-HCBYKLMW.js";import"./chunk-3ELBJPHQ.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as SaveSessionPrompt,b as defaultSessionTimestamp,c as renderSavePrompt};
2
+ import{a,b,c}from"./chunk-4GQZBMTW.js";import"./chunk-S3DAAAE5.js";import"./chunk-MVX3N7GI.js";import"./chunk-HXIGYD2T.js";import"./chunk-HCBYKLMW.js";import"./chunk-2FCAWRCU.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as SaveSessionPrompt,b as defaultSessionTimestamp,c as renderSavePrompt};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{f as a}from"./chunk-V4S5H6O2.js";import"./chunk-AMCAQCEV.js";import"./chunk-G7VF5SDK.js";import"./chunk-L5LI2JF4.js";import"./chunk-KGZATJQN.js";import"./chunk-BSHGW3QM.js";import"./chunk-RDJPZQBU.js";import"./chunk-YCCUBQY4.js";import"./chunk-7ECMUWV2.js";import"./chunk-VE3SUJMA.js";import"./chunk-ZB72T6HB.js";import"./chunk-PAQGYV5G.js";import"./chunk-GCAHPH2E.js";import"./chunk-JI7KJKG4.js";import"./chunk-XK33C64U.js";import"./chunk-HCBYKLMW.js";import"./chunk-2FCAWRCU.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-YZTCCQHR.js";import"./chunk-KKZRPFWO.js";import"./chunk-V7QXJKX7.js";import"./chunk-UR6MHSHU.js";export{a as SingleShotApp};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as S}from"./chunk-ZX3PMRMO.js";import"./chunk-34DK2AUH.js";import{a as R}from"./chunk-HCBYKLMW.js";import{t as o}from"./chunk-3ELBJPHQ.js";import{a as b,b as c,j as x}from"./chunk-C44QQJR4.js";import{a as w}from"./chunk-6YGTRKDT.js";import{e as y}from"./chunk-UR6MHSHU.js";var T=y(w(),1);var i=y(R(),1);function L(e){let t=e.decisions.filter(l=>l.kind==="replay").length,s=e.decisions.filter(l=>l.kind==="author").length,d=e.outcomes.filter(l=>l.status==="passed").length,p=e.outcomes.filter(l=>l.status==="failed").length,f=e.outcomes.filter(l=>l.status==="skipped").length,a=o.green,n;e.cancelled||e.overallStatus==="interrupted"?(a=o.yellow,n="CANCELLED"):e.overallStatus==="failed"?(a=o.red,n="FAILED"):n="PASSED";let r=`${n} \xB7 ${e.durationS}s \xB7 ${e.outcomes.length} steps (${d} passed, ${p} failed, ${f} skipped)`,k=`${t} replay \xB7 ${s} author`,C=e.retryTriggered,v="yes \u2014 run recovered after a replay miss",u,g=o.dimmed;if(e.cancelled)u="\u2013 not committed (cancellation)";else if(e.overallStatus==="failed")u="\u2013 not committed (run failed)",g=o.red;else if(!e.shouldCommit)e.isFirstRun?u="\u2013 not committed (first run skipped commit)":e.lockHeld?u="\u2013 not committed":u="\u2013 not committed (readonly fallback / no lock)";else{let l=e.uploadResult?.testcaseId;u=l?`\u2713 pushed (testcase=${l})`:"\u2713 pushed",g=o.green}let _=e.shouldReplaceLocalOutput?"output dir replaced":e.anyAuthorStepRan?"untouched (cancellation or no replace)":"untouched (replay-only)",m,h=o.dimmed;return e.shouldUploadArtifacts?e.uploadResult?.success?(m="\u2713 TMS",h=o.green):e.uploadResult?(m=`\u2717 failed${e.uploadResult.error?`: ${e.uploadResult.error}`:""}`,h=o.red):m="\u2013 not run":m="\u2013 skipped (--local or no auth)",{resultLine:{color:a,text:r},breakdown:k,showRetries:C,retriesText:v,commitText:u,commitColor:g,artifactsText:_,uploadText:m,uploadColor:h}}function O(e){let t=e.decisions.filter(r=>r.kind==="replay").length,s=e.decisions.filter(r=>r.kind==="author").length,d=e.outcomes.filter(r=>r.status==="passed").length,p=e.outcomes.filter(r=>r.status==="failed").length,f=e.outcomes.filter(r=>r.status==="skipped").length,a,n=!1;return e.cancelled?a="cancellation":e.overallStatus==="failed"?a="run_failed":e.shouldCommit&&e.uploadResult?.testcaseId?(a="ok",n=!0):!e.shouldCommit&&!e.lockHeld&&!e.isFirstRun?a="readonly_fallback":a="not_committed",{type:"test_md_summary",overall_status:e.overallStatus,duration_s:e.durationS,steps:{total:e.outcomes.length,passed:d,failed:p,skipped:f,replay_decisions:t,author_decisions:s},retries:{triggered:e.retryTriggered},commit:{committed:n,reason:a,...e.uploadResult?.testcaseId?{testcase_id:e.uploadResult.testcaseId}:{}},artifacts:{replaced:e.shouldReplaceLocalOutput},upload:{performed:e.shouldUploadArtifacts,...e.uploadResult?{succeeded:!!e.uploadResult.success}:{}},cancelled:e.cancelled}}function A({data:e}){let t=L(e),s=[{label:"result",value:(0,i.jsx)(c,{color:t.resultLine.color,bold:!0,children:t.resultLine.text})},{label:"breakdown",value:(0,i.jsx)(c,{color:o.dimmed,children:t.breakdown})}];return t.showRetries&&s.push({label:"retries",value:(0,i.jsx)(c,{color:o.yellow,children:t.retriesText})}),s.push({label:"commit",value:(0,i.jsx)(c,{color:t.commitColor,children:t.commitText})}),s.push({label:"artifacts",value:(0,i.jsx)(c,{color:o.dimmed,children:t.artifactsText})}),s.push({label:"upload",value:(0,i.jsx)(c,{color:t.uploadColor,children:t.uploadText})}),(0,i.jsx)(S,{title:"Run summary",titleColor:"#ff9500",rows:s})}function I({data:e}){let{exit:t}=x();return(0,T.useEffect)(()=>{let s=setTimeout(()=>t(),50);return()=>clearTimeout(s)},[t]),(0,i.jsx)(b,{flexDirection:"column",children:(0,i.jsx)(A,{data:e})})}export{I as AutoExitSummaryBox,A as SummaryBox,O as buildSummaryEvent,L as buildSummaryRendered};
2
+ import{a as S}from"./chunk-MVX3N7GI.js";import"./chunk-HXIGYD2T.js";import{a as R}from"./chunk-HCBYKLMW.js";import{t as o}from"./chunk-2FCAWRCU.js";import{a as b,b as c,j as x}from"./chunk-C44QQJR4.js";import{a as w}from"./chunk-6YGTRKDT.js";import{e as y}from"./chunk-UR6MHSHU.js";var T=y(w(),1);var i=y(R(),1);function L(e){let t=e.decisions.filter(l=>l.kind==="replay").length,s=e.decisions.filter(l=>l.kind==="author").length,d=e.outcomes.filter(l=>l.status==="passed").length,p=e.outcomes.filter(l=>l.status==="failed").length,f=e.outcomes.filter(l=>l.status==="skipped").length,a=o.green,n;e.cancelled||e.overallStatus==="interrupted"?(a=o.yellow,n="CANCELLED"):e.overallStatus==="failed"?(a=o.red,n="FAILED"):n="PASSED";let r=`${n} \xB7 ${e.durationS}s \xB7 ${e.outcomes.length} steps (${d} passed, ${p} failed, ${f} skipped)`,k=`${t} replay \xB7 ${s} author`,C=e.retryTriggered,v="yes \u2014 run recovered after a replay miss",u,g=o.dimmed;if(e.cancelled)u="\u2013 not committed (cancellation)";else if(e.overallStatus==="failed")u="\u2013 not committed (run failed)",g=o.red;else if(!e.shouldCommit)e.isFirstRun?u="\u2013 not committed (first run skipped commit)":e.lockHeld?u="\u2013 not committed":u="\u2013 not committed (readonly fallback / no lock)";else{let l=e.uploadResult?.testcaseId;u=l?`\u2713 pushed (testcase=${l})`:"\u2713 pushed",g=o.green}let _=e.shouldReplaceLocalOutput?"output dir replaced":e.anyAuthorStepRan?"untouched (cancellation or no replace)":"untouched (replay-only)",m,h=o.dimmed;return e.shouldUploadArtifacts?e.uploadResult?.success?(m="\u2713 TMS",h=o.green):e.uploadResult?(m=`\u2717 failed${e.uploadResult.error?`: ${e.uploadResult.error}`:""}`,h=o.red):m="\u2013 not run":m="\u2013 skipped (--local or no auth)",{resultLine:{color:a,text:r},breakdown:k,showRetries:C,retriesText:v,commitText:u,commitColor:g,artifactsText:_,uploadText:m,uploadColor:h}}function O(e){let t=e.decisions.filter(r=>r.kind==="replay").length,s=e.decisions.filter(r=>r.kind==="author").length,d=e.outcomes.filter(r=>r.status==="passed").length,p=e.outcomes.filter(r=>r.status==="failed").length,f=e.outcomes.filter(r=>r.status==="skipped").length,a,n=!1;return e.cancelled?a="cancellation":e.overallStatus==="failed"?a="run_failed":e.shouldCommit&&e.uploadResult?.testcaseId?(a="ok",n=!0):!e.shouldCommit&&!e.lockHeld&&!e.isFirstRun?a="readonly_fallback":a="not_committed",{type:"test_md_summary",overall_status:e.overallStatus,duration_s:e.durationS,steps:{total:e.outcomes.length,passed:d,failed:p,skipped:f,replay_decisions:t,author_decisions:s},retries:{triggered:e.retryTriggered},commit:{committed:n,reason:a,...e.uploadResult?.testcaseId?{testcase_id:e.uploadResult.testcaseId}:{}},artifacts:{replaced:e.shouldReplaceLocalOutput},upload:{performed:e.shouldUploadArtifacts,...e.uploadResult?{succeeded:!!e.uploadResult.success}:{}},cancelled:e.cancelled}}function A({data:e}){let t=L(e),s=[{label:"result",value:(0,i.jsx)(c,{color:t.resultLine.color,bold:!0,children:t.resultLine.text})},{label:"breakdown",value:(0,i.jsx)(c,{color:o.dimmed,children:t.breakdown})}];return t.showRetries&&s.push({label:"retries",value:(0,i.jsx)(c,{color:o.yellow,children:t.retriesText})}),s.push({label:"commit",value:(0,i.jsx)(c,{color:t.commitColor,children:t.commitText})}),s.push({label:"artifacts",value:(0,i.jsx)(c,{color:o.dimmed,children:t.artifactsText})}),s.push({label:"upload",value:(0,i.jsx)(c,{color:t.uploadColor,children:t.uploadText})}),(0,i.jsx)(S,{title:"Run summary",titleColor:"#ff9500",rows:s})}function I({data:e}){let{exit:t}=x();return(0,T.useEffect)(()=>{let s=setTimeout(()=>t(),50);return()=>clearTimeout(s)},[t]),(0,i.jsx)(b,{flexDirection:"column",children:(0,i.jsx)(A,{data:e})})}export{I as AutoExitSummaryBox,A as SummaryBox,O as buildSummaryEvent,L as buildSummaryRendered};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as $,b as j,c as L,d as N,e as T,f as _,g as F}from"./chunk-L4OZRHUT.js";import"./chunk-RXMOIIQD.js";import"./chunk-DUR6AFYA.js";import"./chunk-G7VF5SDK.js";import"./chunk-TK7ZJ7YX.js";import{a as A}from"./chunk-ZX3PMRMO.js";import"./chunk-34DK2AUH.js";import{a as I}from"./chunk-HCBYKLMW.js";import{t as p}from"./chunk-3ELBJPHQ.js";import{a as R,b as l,d as P,i as k,j as D}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as C}from"./chunk-UR6MHSHU.js";var a=C(B(),1);var i=C(B(),1);function U(e){let r=N(e.screenshotDispatcher,e.stepLogger,e.onReasoning,e.onStepComplete),[h,f]=(0,i.useState)(0),[y,c]=(0,i.useState)("idle"),d=(0,i.useRef)("idle"),S=(0,i.useRef)(0),w=(0,i.useRef)(!1),x=(0,i.useRef)(null),v=(0,i.useRef)(null),g=(0,i.useCallback)(u=>{d.current=u,c(u)},[]),m=(0,i.useCallback)(async u=>{let n=await e.getNextConfig(u);if(!n){g("done"),e.onAllComplete?.();return}let o=u?S.current+1:0;S.current=o,f(o),e.onStepStart?.(n,o),x.current=null,v.current=null,g("running"),await r.startRun(n,e.spawnOpts)},[r,e,g]);(0,i.useEffect)(()=>{w.current||(w.current=!0,m(null))},[]),(0,i.useEffect)(()=>{if(!r.lastRunEnd||r.lastRunEnd===x.current||d.current!=="running")return;x.current=r.lastRunEnd,d.current="transitioning",c("transitioning");let u=r.lastRunEnd,n=T(r.steps),o=r.bifurcationInfo,s={status:u.status==="passed"?"passed":"failed",duration_s:u.duration??0,reason:u.reason,runEnd:u,hadError:!1,stepsPassed:n.passed,stepsFailed:n.failed,stepsTotal:n.total,bifurcationFlows:o&&!o.isSingleFlow?o.flows:null};if(!(e.onStepEnd?.(s,S.current)??!0)){g("done"),e.onAllComplete?.();return}m(s)},[r.lastRunEnd]),(0,i.useEffect)(()=>{if(!r.runError||r.runError===v.current||r.lastRunEnd||d.current!=="running")return;v.current=r.runError,d.current="transitioning",c("transitioning");let u=T(r.steps),n={status:"failed",duration_s:0,reason:r.runError,runEnd:null,hadError:!0,stepsPassed:u.passed,stepsFailed:u.failed,stepsTotal:u.total,bifurcationFlows:null};if(!(e.onStepEnd?.(n,S.current)??!0)){g("done"),e.onAllComplete?.();return}m(n)},[r.runError,r.lastRunEnd]);let O=(0,i.useCallback)(()=>{r.cancelRun()},[r]);return{runner:r,currentStepIndex:h,phase:y,cancel:O}}var b=C(I(),1);function G({runner:e,runKey:r,onStepCommit:h}){let f=L({isRunning:e.isRunning,bifurcationInfo:e.bifurcationInfo,steps:e.steps,cmInitCounts:e.cmInitCounts,replayInfo:e.replayInfo});return(0,b.jsxs)(b.Fragment,{children:[f&&(0,b.jsx)(j,{label:f.label,hasBifurcation:f.hasBifurcation}),e.isRunning&&e.steps.length>0&&(0,b.jsx)($,{steps:e.steps,bifurcated:!!e.bifurcationInfo&&!e.bifurcationInfo.isSingleFlow,flows:e.bifurcationInfo?.flows,cmInitCounts:e.cmInitCounts,maxSteps:e.maxSteps,onStepCommit:h},`run-${r}`)]})}var t=C(I(),1);function le(e){let{exit:r}=D(),h=(0,a.useRef)(0),[f,y]=(0,a.useState)([{id:"top-banner",content:(0,t.jsx)(R,{flexDirection:"column",marginBottom:1,children:(0,t.jsxs)(R,{borderStyle:"round",borderColor:"#dc4e08",paddingX:2,children:[(0,t.jsx)(l,{color:"#ff9500",bold:!0,children:"KaneAI CLI"}),(0,t.jsx)(l,{color:p.dimmed,children:" \u2502 "}),(0,t.jsx)(l,{color:p.cyan,children:e.topBanner.model}),(0,t.jsx)(l,{color:p.dimmed,children:" \u2502 "}),(0,t.jsx)(l,{color:p.dimmed,children:e.topBanner.auth})]})})},{id:"global-config",content:(0,t.jsx)(W,{data:e.globalConfig})},...e.priorAttemptRollup?[{id:"prior-rollup",content:(0,t.jsx)(l,{color:p.dimmed,children:` \u21B3 replayed ${e.priorAttemptRollup.startIdx}..${e.priorAttemptRollup.endIdx-1} (${e.priorAttemptRollup.count} steps, from prior attempt)`})}]:[]]),c=(0,a.useCallback)(n=>{let o=`s-${++h.current}`;y(s=>[...s,{id:o,content:n}])},[]),d=(0,a.useRef)(null),S=(0,a.useCallback)(async n=>{let o=await e.getNextStep(n);return o?(d.current=o,o.config):(d.current=null,null)},[e]),w=(0,a.useCallback)((n,o)=>{let s=d.current;if(!s)return;let E=s.mode==="replay"?"cyan":"#dc4e08",M=s.modeReason?` (${s.modeReason})`:"",q=s.perStepOverrides?Object.entries(s.perStepOverrides):[];c((0,t.jsxs)(R,{flexDirection:"column",marginBottom:0,children:[(0,t.jsxs)(l,{children:[(0,t.jsxs)(l,{color:p.dimmed,children:[s.banner.stepLabel," "]}),(0,t.jsxs)(l,{color:E,children:["[",s.mode,"]"]}),(0,t.jsx)(l,{color:p.dimmed,children:M})]}),(0,t.jsx)(l,{color:p.dimmed,children:s.banner.objective}),q.length>0&&(0,t.jsxs)(l,{color:p.dimmed,children:["overrides: ",q.map(([V,K])=>`${V}=${K}`).join(", ")]})]}))},[c]),x=(0,a.useRef)(0),v=(0,a.useRef)(!1),g=(0,a.useCallback)((n,o)=>(n.hadError?c((0,t.jsx)(F,{message:n.reason??"Runner error",code:"RUNNER_ERROR"})):c((0,t.jsx)(R,{flexDirection:"column",marginBottom:1,children:(0,t.jsx)(_,{status:n.status,summary:n.runEnd?.summary??"",duration:n.runEnd?.duration??0,steps:n.stepsTotal,stepsPassed:n.stepsPassed,stepsFailed:n.stepsFailed,reason:n.runEnd?.reason,creditsConsumed:n.runEnd?.credits_consumed})})),e.onStepEnd?.(n,o)??!0),[c,e]),m=U({getNextConfig:S,onStepStart:w,onStepEnd:g,onAllComplete:()=>{e.onAllComplete(),setImmediate(()=>r())},screenshotDispatcher:e.screenshotDispatcher,stepLogger:e.stepLogger,onReasoning:e.onReasoning,onStepComplete:e.onStepComplete,spawnOpts:e.spawnOpts}),O=250,u=5e3;return k((n,o)=>{if(o.ctrl&&n==="c"){let s=Date.now(),E=s-x.current;if(E<O)return;v.current&&E<u?(m.cancel(),e.onCancel?.(),setImmediate(()=>r())):(v.current=!0,c((0,t.jsx)(l,{color:"yellow",children:"press Ctrl+C again to cancel run"}))),x.current=s}}),(0,t.jsxs)(R,{flexDirection:"column",children:[(0,t.jsx)(P,{items:f,children:n=>(0,t.jsx)(R,{children:n.content},n.id)}),m.phase!=="done"&&(0,t.jsx)(G,{runner:m.runner,runKey:m.currentStepIndex,onStepCommit:c})]})}function W({data:e}){return(0,t.jsx)(A,{title:"test.md run",titleColor:"#ff9500",borderColor:p.dimmed,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{le as TestMdRunView};
2
+ import{a as $,b as j,c as L,d as N,e as T,f as _,g as F}from"./chunk-RBED7RVV.js";import"./chunk-WCRLZETG.js";import"./chunk-EZJNX4VE.js";import"./chunk-G7VF5SDK.js";import"./chunk-PAQGYV5G.js";import{a as A}from"./chunk-MVX3N7GI.js";import"./chunk-HXIGYD2T.js";import{a as I}from"./chunk-HCBYKLMW.js";import{t as p}from"./chunk-2FCAWRCU.js";import{a as R,b as l,d as P,i as k,j as D}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as C}from"./chunk-UR6MHSHU.js";var a=C(B(),1);var i=C(B(),1);function U(e){let r=N(e.screenshotDispatcher,e.stepLogger,e.onReasoning,e.onStepComplete),[h,f]=(0,i.useState)(0),[y,c]=(0,i.useState)("idle"),d=(0,i.useRef)("idle"),S=(0,i.useRef)(0),w=(0,i.useRef)(!1),x=(0,i.useRef)(null),v=(0,i.useRef)(null),g=(0,i.useCallback)(u=>{d.current=u,c(u)},[]),m=(0,i.useCallback)(async u=>{let n=await e.getNextConfig(u);if(!n){g("done"),e.onAllComplete?.();return}let o=u?S.current+1:0;S.current=o,f(o),e.onStepStart?.(n,o),x.current=null,v.current=null,g("running"),await r.startRun(n,e.spawnOpts)},[r,e,g]);(0,i.useEffect)(()=>{w.current||(w.current=!0,m(null))},[]),(0,i.useEffect)(()=>{if(!r.lastRunEnd||r.lastRunEnd===x.current||d.current!=="running")return;x.current=r.lastRunEnd,d.current="transitioning",c("transitioning");let u=r.lastRunEnd,n=T(r.steps),o=r.bifurcationInfo,s={status:u.status==="passed"?"passed":"failed",duration_s:u.duration??0,reason:u.reason,runEnd:u,hadError:!1,stepsPassed:n.passed,stepsFailed:n.failed,stepsTotal:n.total,bifurcationFlows:o&&!o.isSingleFlow?o.flows:null};if(!(e.onStepEnd?.(s,S.current)??!0)){g("done"),e.onAllComplete?.();return}m(s)},[r.lastRunEnd]),(0,i.useEffect)(()=>{if(!r.runError||r.runError===v.current||r.lastRunEnd||d.current!=="running")return;v.current=r.runError,d.current="transitioning",c("transitioning");let u=T(r.steps),n={status:"failed",duration_s:0,reason:r.runError,runEnd:null,hadError:!0,stepsPassed:u.passed,stepsFailed:u.failed,stepsTotal:u.total,bifurcationFlows:null};if(!(e.onStepEnd?.(n,S.current)??!0)){g("done"),e.onAllComplete?.();return}m(n)},[r.runError,r.lastRunEnd]);let O=(0,i.useCallback)(()=>{r.cancelRun()},[r]);return{runner:r,currentStepIndex:h,phase:y,cancel:O}}var b=C(I(),1);function G({runner:e,runKey:r,onStepCommit:h}){let f=L({isRunning:e.isRunning,bifurcationInfo:e.bifurcationInfo,steps:e.steps,cmInitCounts:e.cmInitCounts,replayInfo:e.replayInfo});return(0,b.jsxs)(b.Fragment,{children:[f&&(0,b.jsx)(j,{label:f.label,hasBifurcation:f.hasBifurcation}),e.isRunning&&e.steps.length>0&&(0,b.jsx)($,{steps:e.steps,bifurcated:!!e.bifurcationInfo&&!e.bifurcationInfo.isSingleFlow,flows:e.bifurcationInfo?.flows,cmInitCounts:e.cmInitCounts,maxSteps:e.maxSteps,onStepCommit:h},`run-${r}`)]})}var t=C(I(),1);function le(e){let{exit:r}=D(),h=(0,a.useRef)(0),[f,y]=(0,a.useState)([{id:"top-banner",content:(0,t.jsx)(R,{flexDirection:"column",marginBottom:1,children:(0,t.jsxs)(R,{borderStyle:"round",borderColor:"#dc4e08",paddingX:2,children:[(0,t.jsx)(l,{color:"#ff9500",bold:!0,children:"KaneAI CLI"}),(0,t.jsx)(l,{color:p.dimmed,children:" \u2502 "}),(0,t.jsx)(l,{color:p.cyan,children:e.topBanner.model}),(0,t.jsx)(l,{color:p.dimmed,children:" \u2502 "}),(0,t.jsx)(l,{color:p.dimmed,children:e.topBanner.auth})]})})},{id:"global-config",content:(0,t.jsx)(W,{data:e.globalConfig})},...e.priorAttemptRollup?[{id:"prior-rollup",content:(0,t.jsx)(l,{color:p.dimmed,children:` \u21B3 replayed ${e.priorAttemptRollup.startIdx}..${e.priorAttemptRollup.endIdx-1} (${e.priorAttemptRollup.count} steps, from prior attempt)`})}]:[]]),c=(0,a.useCallback)(n=>{let o=`s-${++h.current}`;y(s=>[...s,{id:o,content:n}])},[]),d=(0,a.useRef)(null),S=(0,a.useCallback)(async n=>{let o=await e.getNextStep(n);return o?(d.current=o,o.config):(d.current=null,null)},[e]),w=(0,a.useCallback)((n,o)=>{let s=d.current;if(!s)return;let E=s.mode==="replay"?"cyan":"#dc4e08",M=s.modeReason?` (${s.modeReason})`:"",q=s.perStepOverrides?Object.entries(s.perStepOverrides):[];c((0,t.jsxs)(R,{flexDirection:"column",marginBottom:0,children:[(0,t.jsxs)(l,{children:[(0,t.jsxs)(l,{color:p.dimmed,children:[s.banner.stepLabel," "]}),(0,t.jsxs)(l,{color:E,children:["[",s.mode,"]"]}),(0,t.jsx)(l,{color:p.dimmed,children:M})]}),(0,t.jsx)(l,{color:p.dimmed,children:s.banner.objective}),q.length>0&&(0,t.jsxs)(l,{color:p.dimmed,children:["overrides: ",q.map(([V,K])=>`${V}=${K}`).join(", ")]})]}))},[c]),x=(0,a.useRef)(0),v=(0,a.useRef)(!1),g=(0,a.useCallback)((n,o)=>(n.hadError?c((0,t.jsx)(F,{message:n.reason??"Runner error",code:"RUNNER_ERROR"})):c((0,t.jsx)(R,{flexDirection:"column",marginBottom:1,children:(0,t.jsx)(_,{status:n.status,summary:n.runEnd?.summary??"",duration:n.runEnd?.duration??0,steps:n.stepsTotal,stepsPassed:n.stepsPassed,stepsFailed:n.stepsFailed,reason:n.runEnd?.reason,creditsConsumed:n.runEnd?.credits_consumed})})),e.onStepEnd?.(n,o)??!0),[c,e]),m=U({getNextConfig:S,onStepStart:w,onStepEnd:g,onAllComplete:()=>{e.onAllComplete(),setImmediate(()=>r())},screenshotDispatcher:e.screenshotDispatcher,stepLogger:e.stepLogger,onReasoning:e.onReasoning,onStepComplete:e.onStepComplete,spawnOpts:e.spawnOpts}),O=250,u=5e3;return k((n,o)=>{if(o.ctrl&&n==="c"){let s=Date.now(),E=s-x.current;if(E<O)return;v.current&&E<u?(m.cancel(),e.onCancel?.(),setImmediate(()=>r())):(v.current=!0,c((0,t.jsx)(l,{color:"yellow",children:"press Ctrl+C again to cancel run"}))),x.current=s}}),(0,t.jsxs)(R,{flexDirection:"column",children:[(0,t.jsx)(P,{items:f,children:n=>(0,t.jsx)(R,{children:n.content},n.id)}),m.phase!=="done"&&(0,t.jsx)(G,{runner:m.runner,runKey:m.currentStepIndex,onStepCommit:c})]})}function W({data:e}){return(0,t.jsx)(A,{title:"test.md run",titleColor:"#ff9500",borderColor:p.dimmed,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{le as TestMdRunView};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as s,b as o}from"./chunk-34DK2AUH.js";import{a as x}from"./chunk-HCBYKLMW.js";import{t as i}from"./chunk-3ELBJPHQ.js";import{a as r,b as n,j as u}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as t}from"./chunk-UR6MHSHU.js";var p=t(B(),1);var e=t(x(),1);function R({profile:f,env:g,authenticated:a,authMethod:v,username:m,tokenStatus:l,expiresAt:c}){let{exit:d}=u();return(0,p.useEffect)(()=>{let b=setTimeout(()=>d(),50);return()=>clearTimeout(b)},[d]),(0,e.jsx)(r,{flexDirection:"column",children:(0,e.jsx)(s,{title:"Identity",variant:a?"success":"warning",children:(0,e.jsxs)(r,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(r,{children:a?(0,e.jsx)(n,{color:i.green,bold:!0,children:"\u2713 Authenticated"}):(0,e.jsx)(n,{color:i.yellow,bold:!0,children:"\u26A0 Not logged in"})}),(0,e.jsxs)(r,{flexDirection:"column",marginTop:1,children:[(0,e.jsx)(o,{label:"Profile",value:f}),(0,e.jsx)(o,{label:"Environment",value:g}),(0,e.jsx)(o,{label:"Method",value:v}),m&&(0,e.jsx)(o,{label:"User",value:m}),l&&(0,e.jsx)(o,{label:"Token",value:l,valueColor:l==="valid"?i.green:l==="expired"?i.red:i.dimmed}),c&&(0,e.jsx)(o,{label:"Expires",value:c})]})]})})})}export{R as WhoamiView};
2
+ import{a as s,b as o}from"./chunk-HXIGYD2T.js";import{a as x}from"./chunk-HCBYKLMW.js";import{t as i}from"./chunk-2FCAWRCU.js";import{a as r,b as n,j as u}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as t}from"./chunk-UR6MHSHU.js";var p=t(B(),1);var e=t(x(),1);function R({profile:f,env:g,authenticated:a,authMethod:v,username:m,tokenStatus:l,expiresAt:c}){let{exit:d}=u();return(0,p.useEffect)(()=>{let b=setTimeout(()=>d(),50);return()=>clearTimeout(b)},[d]),(0,e.jsx)(r,{flexDirection:"column",children:(0,e.jsx)(s,{title:"Identity",variant:a?"success":"warning",children:(0,e.jsxs)(r,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(r,{children:a?(0,e.jsx)(n,{color:i.green,bold:!0,children:"\u2713 Authenticated"}):(0,e.jsx)(n,{color:i.yellow,bold:!0,children:"\u26A0 Not logged in"})}),(0,e.jsxs)(r,{flexDirection:"column",marginTop:1,children:[(0,e.jsx)(o,{label:"Profile",value:f}),(0,e.jsx)(o,{label:"Environment",value:g}),(0,e.jsx)(o,{label:"Method",value:v}),m&&(0,e.jsx)(o,{label:"User",value:m}),l&&(0,e.jsx)(o,{label:"Token",value:l,valueColor:l==="valid"?i.green:l==="expired"?i.red:i.dimmed}),c&&(0,e.jsx)(o,{label:"Expires",value:c})]})]})})})}export{R as WhoamiView};
@@ -0,0 +1,4 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{c as i,f as c}from"./chunk-2FCAWRCU.js";import{a as l}from"./chunk-V7QXJKX7.js";import"./chunk-UR6MHSHU.js";import{readFileSync as u,writeFileSync as g,mkdirSync as d}from"fs";import{join as f}from"path";var h=f(i,"changelog-cache.json"),p=3600*1e3;function y(){try{let e=JSON.parse(u(h,"utf-8"));if(Date.now()-e.cachedAt<p)return e}catch{}return null}function m(e){try{d(i,{recursive:!0}),g(h,JSON.stringify({entries:e,cachedAt:Date.now()}))}catch{}}async function A(e){try{let t=y();if(t){let r=t.entries;return e?.all?r:r.slice(0,5)}let n=new AbortController,o=setTimeout(()=>n.abort(),5e3),a=await l(`${c}?per_page=30`,{headers:{Accept:"application/vnd.github+json"},signal:n.signal});if(clearTimeout(o),!a.ok)return[];let s=(await a.json()).map(r=>({version:r.tag_name.replace(/^v/,""),date:r.published_at?r.published_at.slice(0,10):"",body:r.body??""}));return m(s),e?.all?s:s.slice(0,5)}catch{return[]}}function v(e){if(e.length===0)return"Could not fetch changelog. Visit https://github.com/LambdaTest/kane-cli/releases";let t=["kane-cli Changelog","\u2500".repeat(40),""];for(let n of e){if(t.push(`v${n.version} (${n.date})`),n.body){let o=n.body.split(`
3
+ `).filter(a=>a.trim());for(let a of o)t.push(` ${a}`)}t.push("")}return t.join(`
4
+ `)}export{A as fetchChangelog,v as formatChangelog};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{homedir as s}from"os";import{join as t}from"path";var c="0.3.1",l="kane-cli",e=t(s(),".testmuai","kaneai"),m=t(e,"profiles"),i=t(e,"tui-config.json"),d="https://registry.npmjs.org/@testmuai/kane-cli",h="https://api.github.com/repos/LambdaTest/kane-cli/releases",f="https://dd-proxy.lambdatest.com/intake/kane-cli",u="https://kaneai-playground.lambdatest.io",_=9222,b=9230,U=t(e,"chrome-profiles"),r="127.0.0.1",x=18392,g=18400,o="/callback";function A(a){return`http://${r}:${a}${o}`}var R="KANE CLI",L="*",C={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",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",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"}},E={base:"#ffffff",primary:"#ff9500",secondary:"#888888",accent:"#ffffff",dim:"#666666",ambient:"#444444",statusPass:"#4ade80",statusFail:"#ef4444",purple:"#ff9500",cyan:"#ff9500",yellow:"#ff9500",green:"#4ade80",greenDim:"#666666",red:"#ef4444",redDim:"#666666",dimmed:"#666666",muted:"#444444"};export{c as a,l as b,e as c,i as d,d as e,h as f,f as g,u as h,_ as i,b as j,U as k,r as l,x as m,g as n,o,A as p,R as q,L as r,C as s,E as t};
2
+ import{homedir as s}from"os";import{join as t}from"path";var c="0.3.2",l="kane-cli",e=t(s(),".testmuai","kaneai"),m=t(e,"profiles"),i=t(e,"tui-config.json"),d="https://registry.npmjs.org/@testmuai/kane-cli",h="https://api.github.com/repos/LambdaTest/kane-cli/releases",f="https://dd-proxy.lambdatest.com/intake/kane-cli",u="https://kaneai-playground.lambdatest.io",_=9222,b=9230,U=t(e,"chrome-profiles"),r="127.0.0.1",x=18392,g=18400,o="/callback";function A(a){return`http://${r}:${a}${o}`}var R="KANE CLI",L="*",C={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",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",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"}},E={base:"#ffffff",primary:"#ff9500",secondary:"#888888",accent:"#ffffff",dim:"#666666",ambient:"#444444",statusPass:"#4ade80",statusFail:"#ef4444",purple:"#ff9500",cyan:"#ff9500",yellow:"#ff9500",green:"#4ade80",greenDim:"#666666",red:"#ef4444",redDim:"#666666",dimmed:"#666666",muted:"#444444"};export{c as a,l as b,e as c,i as d,d as e,h as f,f as g,u as h,_ as i,b as j,U as k,r as l,x as m,g as n,o,A as p,R as q,L as r,C as s,E as t};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as m}from"./chunk-HJ3CHMEM.js";import{a as p}from"./chunk-HCBYKLMW.js";import{t}from"./chunk-3ELBJPHQ.js";import{a,b as o,i as u}from"./chunk-C44QQJR4.js";import{a as b}from"./chunk-6YGTRKDT.js";import{e as n}from"./chunk-UR6MHSHU.js";var c=n(b(),1);var e=n(p(),1);function T({onSubmit:l}){let[r,f]=(0,c.useState)(0),s=(0,c.useRef)(!1);return u((x,i)=>{s.current||(i.leftArrow||i.rightArrow?f(d=>d===0?1:0):i.return?(s.current=!0,l(r===0?"positive":"negative")):i.escape&&(s.current=!0,l(null)))}),(0,e.jsxs)(a,{flexDirection:"column",marginTop:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(o,{color:t.secondary,children:"Rate this session: "}),(0,e.jsx)(o,{color:r===0?t.primary:t.dim,children:r===0?"[ \u{1F44D} ]":" \u{1F44D} "}),(0,e.jsx)(o,{children:" "}),(0,e.jsx)(o,{color:r===1?t.primary:t.dim,children:r===1?"[ \u{1F44E} ]":" \u{1F44E} "})]}),(0,e.jsx)(m,{bindings:[{keys:"\u2190/\u2192",label:"select"},{keys:"\u21B5",label:"submit"}],escBackLabel:"skip"})]})}export{T as a};
2
+ import{a as m}from"./chunk-XK33C64U.js";import{a as p}from"./chunk-HCBYKLMW.js";import{t}from"./chunk-2FCAWRCU.js";import{a,b as o,i as u}from"./chunk-C44QQJR4.js";import{a as b}from"./chunk-6YGTRKDT.js";import{e as n}from"./chunk-UR6MHSHU.js";var c=n(b(),1);var e=n(p(),1);function T({onSubmit:l}){let[r,f]=(0,c.useState)(0),s=(0,c.useRef)(!1);return u((x,i)=>{s.current||(i.leftArrow||i.rightArrow?f(d=>d===0?1:0):i.return?(s.current=!0,l(r===0?"positive":"negative")):i.escape&&(s.current=!0,l(null)))}),(0,e.jsxs)(a,{flexDirection:"column",marginTop:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(o,{color:t.secondary,children:"Rate this session: "}),(0,e.jsx)(o,{color:r===0?t.primary:t.dim,children:r===0?"[ \u{1F44D} ]":" \u{1F44D} "}),(0,e.jsx)(o,{children:" "}),(0,e.jsx)(o,{color:r===1?t.primary:t.dim,children:r===1?"[ \u{1F44E} ]":" \u{1F44E} "})]}),(0,e.jsx)(m,{bindings:[{keys:"\u2190/\u2192",label:"select"},{keys:"\u21B5",label:"submit"}],escBackLabel:"skip"})]})}export{T as a};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as u,g as p}from"./chunk-2FCAWRCU.js";import{a as f}from"./chunk-V7QXJKX7.js";var n=class{config;buffer=[];stepBuffer=new Map;flushTimer=null;currentRunIndex=null;stopped=!1;_droppedBatches=0;_droppedEntries=0;constructor(e){this.config=e}start(){if(this.flushTimer)return;let e=this.config.flushIntervalMs??5e3;this.flushTimer=setInterval(()=>{this.flush().catch(()=>{})},e),this.flushTimer.unref&&this.flushTimer.unref()}setRunIndex(e){this.currentRunIndex=e}log(e,t,i,s={}){if(this.stopped)return;let r=this.buildEntry(e,t,i,s);this.buffer.push(r)}logStep(e,t,i,s={}){if(this.stopped)return;let r=this.buildEntry("debug",t,i,s);r.run_index=e,this.stepBuffer.has(e)||this.stepBuffer.set(e,[]),this.stepBuffer.get(e).push(r)}escalate(e){let t=this.stepBuffer.get(e);t&&t.length>0&&this.buffer.push(...t),this.stepBuffer.delete(e)}discardSteps(e){this.stepBuffer.delete(e)}async flush(){if(this.buffer.length===0)return;let e=this.buffer.splice(0),t=null;try{t=await this.config.getToken()}catch{this.buffer.unshift(...e);return}let i={"Content-Type":"application/json"};t&&(i.Authorization=`Bearer ${t}`);let s=JSON.stringify(e);for(let r=0;r<3;r++){try{let h=new AbortController,d=setTimeout(()=>h.abort(),1e4),l=await f(this.config.proxyUrl,{method:"POST",headers:i,body:s,signal:h.signal});if(clearTimeout(d),l.ok)return}catch{}r<2&&await new Promise(h=>setTimeout(h,1e3*Math.pow(2,r)))}this._droppedBatches++,this._droppedEntries+=e.length}get droppedBatches(){return this._droppedBatches}get droppedEntries(){return this._droppedEntries}async shutdown(){this._droppedBatches>0&&this.log("warn","LOG_DROPS",`Dropped ${this._droppedEntries} entries in ${this._droppedBatches} batches`,{dropped_batches:this._droppedBatches,dropped_entries:this._droppedEntries}),this.stopped=!0,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null),await this.flush()}shutdownSync(){this.stopped=!0,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null)}get bufferSize(){return this.buffer.length}stepBufferSize(e){return this.stepBuffer.get(e)?.length??0}buildEntry(e,t,i,s){return{hostname:"kane-cli",service:"kane-cli",ddsource:"kane-cli",ddtags:`version:${this.config.device.cli_version}`,level:e,event:t,message:i,session_id:this.config.sessionId,run_index:this.currentRunIndex,identity:this.config.identity,device:this.config.device,context:s,timestamp:new Date().toISOString()}}};import{platform as g,arch as a}from"os";function L(o){let e={proxyUrl:p,sessionId:o.sessionId,identity:o.identity,device:{cli_version:u,platform:g(),arch:a()},getToken:o.getToken};return new n(e)}export{n as a,L as b};
@@ -0,0 +1,13 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as z}from"./chunk-EZJNX4VE.js";import{d as X,g as Y}from"./chunk-X7VI7KK3.js";import{b as Q,e as V,j as F}from"./chunk-AH4AXJML.js";import{b as J,d as W}from"./chunk-G7VF5SDK.js";import{b as $}from"./chunk-VE3SUJMA.js";import{a as E}from"./chunk-PAQGYV5G.js";import{a as q}from"./chunk-E47GFYXA.js";import{i as N,j as U}from"./chunk-2FCAWRCU.js";import{a as P}from"./chunk-YZTCCQHR.js";import{a as A,b as G}from"./chunk-KKZRPFWO.js";import{a as g}from"./chunk-V7QXJKX7.js";import{dirname as Ee,join as Re}from"path";function ot(e,r,t){let s=e.total_runs??1,o=e.run_dir,i,n;if(s>1&&o){let a=Ee(o);i=Array.from({length:s},(c,l)=>Re(a,String(r+l))),t&&t.length===s&&(n=t)}return{allRunDirs:i,flowObjectives:n}}function nt(e,r,t,s){return{index:t,objective:r,summary:e.summary,oneLiner:e.one_liner,status:e.status,resultCode:e.result_code,reasonCode:e.reason_code,perFlowMetadata:e.per_flow_metadata,context:e.context??{memory:{},variables:{},pointer:""},run_dir:e.run_dir,run_dirs:s.allRunDirs,flow_objectives:s.flowObjectives}}import{spawn as Ie}from"child_process";async function Z(e,r,t=100){let s=`${e.replace(/\/+$/,"")}/json/version`,o=await g(s);if(!o.ok)throw new Error(`CDP /json/version returned ${o.status}`);let i=await o.json();if(!i.webSocketDebuggerUrl)throw new Error("CDP /json/version missing webSocketDebuggerUrl");let n=new q(i.webSocketDebuggerUrl);await new Promise((C,u)=>{n.once("open",C),n.once("error",u)});let a=1,c=new Map;n.on("message",C=>{let u;try{u=JSON.parse(C.toString())}catch{return}if(u.id==null)return;let y=c.get(u.id);y&&(c.delete(u.id),u.error?y.reject(new Error(u.error.message)):y.resolve(u.result))});function l(C,u){let y=a++;return new Promise((Ce,Se)=>{c.set(y,{resolve:ve=>Ce(ve),reject:Se});let M={id:y,method:C};u&&(M.params=u),n.send(JSON.stringify(M))})}let d=(await l("Target.getTargets")).targetInfos.find(C=>C.type==="page");if(!d)throw n.close(),new Error("CDP: no page target found");let S=(await l("Browser.getWindowForTarget",{targetId:d.targetId})).windowId,b="",h=!1,_=null,R=!1;n.on("close",()=>{R=!0}),n.on("error",()=>{R=!0});async function B(){if(!h){if(R){h=!0;return}try{let u=(await l("Browser.getWindowBounds",{windowId:S})).bounds,y=`${u.left}:${u.top}:${u.width}:${u.height}`;y!==b&&(b=y,r({left:u.left,top:u.top,width:u.width,height:u.height}))}catch{}h||(_=setTimeout(B,t))}}return B(),{stop(){if(!h){h=!0,_&&clearTimeout(_);try{n.close()}catch{}}}}}var ke=new Set(["1","true","yes"]);function ft(e){if(e?.headless)return null;let r=process.env.KANE_CLI_DISABLE_MARKER;if(r!=null&&ke.has(r.toLowerCase()))return null;let t=z();if(!t)return null;let s=[...t.args,"overlay"];e?.text&&s.push(e.text);let o;try{o=Ie(t.cmd,s,{cwd:t.cwd,stdio:["pipe","ignore","ignore"],detached:!1,windowsHide:!0})}catch{return null}function i(c){if(!(!o.stdin||o.stdin.destroyed))try{o.stdin.write(JSON.stringify(c)+`
3
+ `)}catch{}}e?.chromePid&&e.chromePid>0&&i({type:"chrome_pid",pid:e.chromePid});let n=null;e?.cdpEndpoint&&Z(e.cdpEndpoint,c=>i({type:"bounds",...c})).then(c=>{n=c.stop}).catch(()=>{});let a=!1;return{setRunActive(c){a||i({type:"run_active",active:c})},setStepText(c){if(a)return;let l=c.trim();l&&i({type:"step_text",text:l})},setStepComplete(){a||i({type:"step_complete"})},kill(){if(!a){a=!0,n?.();try{o.stdin?.end()}catch{}try{o.kill("SIGTERM")}catch{}}}}}import{readFileSync as xe,existsSync as Ae}from"fs";function ht(e){if(!Ae(e))return null;try{return xe(e,"utf-8").trim()||null}catch{return null}}function ee(e,r,t){return`${e}/projects/${r}/test-cases/${t}`}function yt(e,r,t,s){return`${ee(e,r,t)}/dashboard/share/${s}?type=summary&agentView=true&fqdn=summary-page`}function wt(e,r,t){return`${ee(e,r,t)}/dashboard?type=summary&agentView=true&fqdn=summary-page`}import{readFileSync as te,readdirSync as re,existsSync as v}from"fs";import{join as w}from"path";function vt(e,r,t,s,o,i){try{let n=w(e,"runs",String(r),"run-test");if(!v(n)){o("warn","SCREENSHOT_SKIP","Runs dir not found",{step_index:t,reason:"runsDir_not_found",path:n});return}let a=n;if(i){let h=w(n,`child-${i}`);if(!v(h)){o("warn","SCREENSHOT_SKIP","Child dir not found",{step_index:t,child_id:i,reason:"child_dir_not_found",path:h});return}let _=re(h).filter(R=>v(w(h,R,"screenshots")));if(_.length===0){o("warn","SCREENSHOT_SKIP","No screenshots dir under child",{step_index:t,child_id:i,reason:"no_child_screenshots_dir"});return}a=w(h,_[0])}else if(!v(w(n,"screenshots"))){let h=re(n).filter(_=>v(w(n,_,"screenshots")));if(h.length===0){o("warn","SCREENSHOT_SKIP","No screenshots dir found",{step_index:t,reason:"no_screenshots_dir"});return}a=w(n,h[0])}let c=w(a,"screenshots",`step_${String(t).padStart(3,"0")}.png`);if(!v(c)){o("warn","SCREENSHOT_SKIP","Screenshot not found",{step_index:t,child_id:i,reason:"screenshot_not_found",path:c});return}let l=w(n,"actions.ndjson");if(!v(l)){o("warn","SCREENSHOT_SKIP","NDJSON not found",{step_index:t,reason:"ndjson_not_found"});return}let f=te(l,"utf-8").trim().split(`
4
+ `),d=f[f.length-1];if(!d){o("warn","SCREENSHOT_SKIP","NDJSON empty",{step_index:t,reason:"ndjson_empty"});return}let S=JSON.parse(d).action_id;if(!S){o("warn","SCREENSHOT_SKIP","No action_id in NDJSON",{step_index:t,reason:"no_action_id"});return}let b=te(c);s.enqueue(S,b),o("info","SCREENSHOT_ENQUEUED","Screenshot enqueued",{step_index:t,child_id:i,action_id:S,size:b.length})}catch(n){o("error","SCREENSHOT_DISPATCH_ERROR","Screenshot dispatch error",{step_index:t,error:n instanceof Error?n.message:String(n)})}}import Pe from"sharp";var se=class{maxWorkers;maxRetries=2;queue=[];activeCount=0;drainResolvers=[];sas;log;constructor(r,t=3,s){this.sas=r,this.maxWorkers=t,this.log=s}updateSas(r){this.sas=r}enqueue(r,t){this.queue.push({operationId:r,buffer:t}),this.pump()}async drain(r=3e4){if(!(this.queue.length===0&&this.activeCount===0))return new Promise(t=>{this.drainResolvers.push(t),setTimeout(()=>{t()},r)})}pump(){for(;this.activeCount<this.maxWorkers&&this.queue.length>0;){let r=this.queue.shift();this.activeCount++,this.processJob(r).finally(()=>{if(this.activeCount--,this.pump(),this.queue.length===0&&this.activeCount===0){for(let t of this.drainResolvers)t();this.drainResolvers=[]}})}}async processJob(r){let t,s="image/webp";try{let a=await Pe(r.buffer).webp({quality:80}).toBuffer();t=new Uint8Array(a)}catch(a){t=new Uint8Array(r.buffer),s="image/png",this.log?.("warn","SCREENSHOT_CONVERT_FAILED","WebP conversion failed, using PNG",{operation_id:r.operationId,error:a instanceof Error?a.message:String(a)})}let o=s==="image/webp"?"webp":"png",i=`test_screenshots/untagged_screenshot/${r.operationId}.${o}`,n=`${this.sas.base_url}/${this.sas.container}/${i}?${this.sas.sas_token}`;for(let a=0;a<=this.maxRetries;a++)try{let c=await g(n,{method:"PUT",headers:{"Content-Type":s,"x-ms-blob-type":"BlockBlob"},body:t});if(c.ok)return;if(a<this.maxRetries){await this.backoff(a);continue}this.log?.("warn","SCREENSHOT_UPLOAD_FAILED","Screenshot upload failed after retries",{operation_id:r.operationId,status:c.status,attempts:this.maxRetries+1})}catch{if(a<this.maxRetries){await this.backoff(a);continue}this.log?.("warn","SCREENSHOT_UPLOAD_FAILED","Screenshot upload failed (network error)",{operation_id:r.operationId,error:"network",attempts:this.maxRetries+1})}}backoff(r){let t=r===0?1e3:3e3;return new Promise(s=>setTimeout(s,t))}isNearExpiry(){if(!this.sas.expiry)return!1;let r=new Date(this.sas.expiry).getTime();return Date.now()>r-5*6e4}};function oe(e,r){let t={},s={},o=r;for(let[i,n]of Object.entries(e))if(n.secret){let a=`secrets.user.${i}`;t[a]={value:n.value,secret:!0,syntax:`{{secrets.user.${i}}}`,type:"secret"},s[i]=a,o=o.replaceAll(`{{${i}}}`,`{{secrets.user.${i}}}`)}else{let a=`global.${i}`;t[a]={value:n.value,secret:!1,syntax:`{{global.${i}}}`,type:"global"},s[i]=a,o=o.replaceAll(`{{${i}}}`,`{{global.${i}}}`)}return{variables:t,objective:o,keyMap:s}}var T=class{constructor(r){this.baseUrl=r}async pushSecret(r){let t=A(r.username,r.accessKey),s=await g(`${this.baseUrl}/logistics/v1.0/secrets/create`,{method:"PUT",headers:{Authorization:t,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({secretKey:r.secretKey,secretValue:r.secretValue,orgId:r.orgId,username:r.username,scope:"user",type:"user",accessKey:r.accessKey})});if(!s.ok)throw new Error(`Push secret failed: ${s.status} ${await s.text()}`)}static extractVariableKeys(r){let t=r.matchAll(/\{\{([a-zA-Z_][a-zA-Z0-9_]*)\}\}/g),s=new Set;for(let o of t)s.add(o[1]);return[...s]}};var j=class extends G{constructor(r,t,s){super(r,{username:t,accessKey:s})}async upsertVariable(r){let t=r.environmentId??0,s=await g(`${this.baseUrl}/v1/variables`,{method:"POST",headers:this.headers(),body:JSON.stringify({name:r.name,value:String(r.value),type:"variable",value_type:"string",is_persist:r.isPersist??!1,environment_id:t})});if(s.ok)return{id:(await s.json()).id??0};if(s.status!==409&&s.status!==422)return{id:0};if(!(await g(`${this.baseUrl}/v1/variables/name/${encodeURIComponent(r.name)}`,{method:"PUT",headers:this.headers(),body:JSON.stringify({value:String(r.value),value_type:"string",type:"variable",environment_id:t})})).ok)return{id:0};let i=await g(`${this.baseUrl}/v1/variables/${encodeURIComponent(r.name)}?environment_id=${t}`,{method:"GET",headers:this.headers()});return i.ok?{id:(await i.json()).data?.id??0}:{id:0}}};import{readdirSync as Te,readFileSync as ie,existsSync as ae}from"fs";import{join as je}from"path";function ne(e,r){if(!ae(e))return{};let t={},s;try{s=Te(e).filter(o=>o.endsWith(".json")).sort()}catch{return{}}for(let o of s)try{let i=ie(je(e,o),"utf-8"),n=JSON.parse(i);if(n&&typeof n=="object"){for(let[a,c]of Object.entries(n))if(c&&typeof c=="object"&&"value"in c){let l=c;t[a]={value:l.value,secret:l.secret??!1,syntax:l.syntax??`{{${a}}}`}}}}catch{r?r("warn","VARIABLE_PARSE_FAILED","Skipping invalid variables file",{file:o}):process.stderr.write(`[variables] Warning: skipping invalid variables file: ${o}
5
+ `)}return t}function ce(e){if(!ae(e))throw new Error(`Variables file not found: ${e}`);let r=ie(e,"utf-8"),t=JSON.parse(r),s={};if(t&&typeof t=="object"){for(let[o,i]of Object.entries(t))if(i&&typeof i=="object"&&"value"in i){let n=i;s[o]={value:n.value,secret:n.secret??!1,syntax:n.syntax??`{{${o}}}`}}}return s}function le(e){let r;try{r=JSON.parse(e)}catch{throw new Error("Invalid --variables JSON")}let t={};if(r&&typeof r=="object"){for(let[s,o]of Object.entries(r))if(o&&typeof o=="object"&&"value"in o){let i=o;t[s]={value:i.value,secret:i.secret??!1,syntax:i.syntax??`{{${s}}}`}}}return t}function de(e,r,t){let s=ne(e,t),o=ne(r,t);return{...s,...o}}function Bt(e,r){if(Object.keys(e).length===0)return{};let t={};for(let[s,o]of Object.entries(e)){let i=o.syntax??`{{${s}}}`;r.includes(i)&&(t[s]=o)}return t}function Mt(e){let r=de(e.globalDir,e.localDir,e.onLoadError),t=e.file?ce(e.file):{},s=e.inline?le(e.inline):{},o={...r,...t,...s},i=Object.keys(o).length>0,{variables:n,objective:a}=i?oe(o,e.objective):{variables:{},objective:e.objective},c=Object.entries(o).filter(([,f])=>f.secret),l=Object.entries(o).filter(([,f])=>!f.secret);return{raw:o,auteur:n,auteurObjective:a,secretEntries:c,nonSecretEntries:l}}async function qt(e){if(e.localMode)return{};let r=E(e.env);if(e.variables.secretEntries.length>0){let s=new T(r.secretsBaseUrl);for(let[o,i]of e.variables.secretEntries)s.pushSecret({secretKey:o,secretValue:i.value,username:e.auth.username,accessKey:e.auth.access_key,orgId:e.orgId}).then(()=>e.log("info","SECRET_PUSH_OK","Secret pushed",{key:o})).catch(n=>e.log("error","SECRET_PUSH_FAILED","Secret push failed",{key:o,error:String(n)}))}let t={};if(e.variables.nonSecretEntries.length>0){let s=new j(r.tmsBaseUrl,e.auth.username,e.auth.access_key);for(let[o,i]of e.variables.nonSecretEntries)try{let n=await s.upsertVariable({name:o,value:i.value});t[o]=n.id,e.log("info","VAR_PUSH_OK","Variable pushed",{name:o,id:n.id})}catch(n){e.log("error","VAR_PUSH_FAILED","Variable push failed",{name:o,error:String(n)})}}return t}function Jt(e){let r={objective:e.objective,model:e.model,width:e.windowSize.width,height:e.windowSize.height,session_id:e.sessionId,run_index:e.runIndex,stream:!0,max_steps:e.maxSteps??30,headless:e.headless??!1};return e.url&&(r.url=e.url),e.chrome.wsEndpoint?r.ws_endpoint=e.chrome.wsEndpoint:e.chrome.cdpEndpoint&&(r.cdp_endpoint=e.chrome.cdpEndpoint),e.auth.basicAuth?(r.username=e.auth.basicAuth.username,r.access_key=e.auth.basicAuth.access_key):e.auth.token&&(r.auth={type:"bearer",token:e.auth.token}),e.disableAskUser&&(r.disable_ask_user=!0),e.enableTaskSkills&&(r.enable_task_skills=!0),e.variables&&Object.keys(e.variables).length>0&&(r.variables=e.variables),e.globalContext&&(r.global_context=e.globalContext),e.localContext&&(r.local_context=e.localContext),e.sessionContext&&(r.session_context=e.sessionContext),r}var Oe=15e3,K=3,ue=[500,1e3];async function Xt(e){if(process.env.KANE_LOCK_CONFLICT_SIMULATE==="1")return{ok:!1,reason:"concurrent",httpStatus:409,message:"simulated contention (KANE_LOCK_CONFLICT_SIMULATE=1)"};let r=`${e.baseUrl}/test/${encodeURIComponent(e.testId)}/playground`,t=await O(r,{from_commit_id:e.fromCommitId,new_commit_id:e.newCommitId},e.auth);return t.ok?{ok:!0,sessionExpiresAt:m(t.body,"session_expires_at")??""}:{ok:!1,...De(t)}}function De(e){let r=m(e.body,"error")??m(e.body,"code")??"",t=m(e.body,"message")??m(e.body,"detail")??e.text??`HTTP ${e.status}`,s;return e.status===0?s="network":e.status===401||e.status===403?s="auth":e.status===409&&r==="PlaygroundBaseCommitMismatch"?s="base_mismatch":e.status===409?s="concurrent":e.status===422?s="disabled":e.status===400&&/no committed/i.test(t)?s="no_commits":e.status===400?s="missing_field":e.status>=500||e.status===408||e.status===429?s="network":s="other",{reason:s,httpStatus:e.status,message:t}}async function Yt(e){let r=`${e.baseUrl}/test/${encodeURIComponent(e.testId)}/playground/reserve`,t=await O(r,void 0,e.auth);return t.ok?{ok:!0,sessionExpiresAt:m(t.body,"session_expires_at")??""}:{ok:!1,expired:t.status===404,httpStatus:t.status,message:m(t.body,"message")??m(t.body,"detail")??t.text??`HTTP ${t.status}`}}async function fe(e){let r=`${e.baseUrl}/test/${encodeURIComponent(e.testId)}/commit`,t={commit_id:e.body.commitId,from_commit_id:e.body.fromCommitId,commit_message:e.body.commitMessage,total_steps:e.body.totalSteps};e.body.timeTaken!==void 0&&(t.time_taken=e.body.timeTaken),e.body.objectives!==void 0&&(t.objectives=e.body.objectives);let s=await O(r,t,e.auth);return s.ok?{ok:!0,testId:m(s.body,"test_id")??e.testId,testcaseId:m(s.body,"testcase_id")??"",projectId:m(s.body,"project_id"),isTestCaseDeleted:typeof s.body?.is_test_case_deleted=="boolean"?s.body.is_test_case_deleted:void 0}:{ok:!1,...Le(s)}}function Le(e){let r=m(e.body,"error")??m(e.body,"code")??"",t=m(e.body,"message")??m(e.body,"detail")??e.text??`HTTP ${e.status}`,s;return e.status===0?s="network":e.status===401||e.status===403?s="auth":e.status===409&&r==="PlaygroundBaseCommitMismatch"?s="base_mismatch":e.status===409&&r==="PlaygroundCommitLockMismatch"?s="lock_mismatch":e.status===409?s="expired":e.status===422?s="not_found":e.status>=500||e.status===408||e.status===429?s="network":s="other",{reason:s,httpStatus:e.status,message:t}}async function Zt(e){let r=`${e.baseUrl}/test/${encodeURIComponent(e.testId)}/commit`,t={discard:!0,commit_id:e.body.commitId,from_commit_id:e.body.fromCommitId,commit_message:"(discarded)",total_steps:1},s=await O(r,t,e.auth);return s.ok?{ok:!0}:{ok:!1,reason:m(s.body,"error")??"other",httpStatus:s.status,message:m(s.body,"message")??m(s.body,"detail")??s.text??`HTTP ${s.status}`}}async function O(e,r,t){let s=null;for(let o=1;o<=K;o++){let i=new AbortController,n=setTimeout(()=>i.abort(),Oe);try{let a=await g(e,{method:"POST",headers:{Authorization:A(t.username,t.accessKey),"Content-Type":"application/json",Accept:"application/json"},...r!==void 0?{body:JSON.stringify(r)}:{},signal:i.signal});clearTimeout(n);let c=await a.text(),l=null;if(c)try{l=JSON.parse(c)}catch{}let f=a.status>=500||a.status===408||a.status===429;if(a.ok||!f)return{ok:a.ok,status:a.status,body:l,text:c};if(o<K){await me(ue[o-1]??1e3);continue}return{ok:!1,status:a.status,body:l,text:c}}catch(a){if(clearTimeout(n),s=a,o<K){await me(ue[o-1]??1e3);continue}}}return{ok:!1,status:0,body:null,text:s?.message??"exhausted retries"}}function me(e){return new Promise(r=>setTimeout(r,e))}function m(e,r){if(typeof e!="object"||e===null)return;let t=e[r];return typeof t=="string"?t:void 0}import{readFileSync as pe,writeFileSync as he,existsSync as be}from"fs";function ge(e,r,t){if(t.forceAuthor)return"re-recorded from scratch";if(t.retryTriggered)return"re-recorded after retry";if(r.length>0&&r.every(n=>n.kind==="author"&&n.reason==="no-result-md"))return"initial recording";if(r.length>0&&r.every(n=>n.kind==="replay"))return t.wantsPush?"re-recorded (no source changes)":"no changes";let s=[];for(let n=0;n<r.length;n++){let a=r[n];if(!a||a.kind!=="author"||a.reason==="downstream-of-divergence"||a.reason==="no-result-md")continue;let c=Ne(e,e.steps[n]);switch(a.reason){case"structure-mismatch":s.push(`added/removed: ${c}`);break;case"md5-mismatch":s.push(`modified: ${c}`);break;case"missing-recording":s.push(`re-recorded: ${c}`);break;case"recorded-failed":s.push(`re-authored after failure: ${c}`);break}}if(s.length===0)return"automated commit";let o=s.filter((n,a)=>a===0||s[a-1]!==n),i=o.slice(0,3).join("; ");return o.length>3?`${i}; +${o.length-3} more`:i}function Ne(e,r){if(!r)return"unknown step";let t=r.trace[0]?.stepIndex;if(t==null)return"unknown step";let o=e.rootSteps[t-1]?.heading?.trim()??"";return r.trace.length>1?o?`imported step in "${o}"`:`imported step ${t}`:o||`step ${t}`}function Ue(e){if(!(!e.shouldReplaceLocalOutput||!e.resolvedTest||!e.sourcePath||!e.stepRunRecords||!e.outcomes||!e.overallStatus))return async()=>{Y({resolvedTest:e.resolvedTest,sessionDir:e.session.sessionDir,stepRunRecords:e.stepRunRecords,outcomes:e.outcomes,overallStatus:e.overallStatus,startedISO:e.startedISO??new Date().toISOString(),durationS:e.durationS??0,sessionId:e.session.sessionId,commitId:e.fromCommitId??"",tmsIds:e.tmsIds??{},codeExportDir:e.codeExportDir}),F(Q(e.sourcePath));let r=new Set;for(let t of e.resolvedTest.steps)if(t.trace.length>1){let s=X(t.trace);if(r.has(s))continue;r.add(s),be(`${s}.staging`)&&F(s)}}}function $e(e){if(!(!e.shouldCommit||e.isFirstRun||!e.tmsBaseUrl||!e.testId||!e.fromCommitId||!e.newCommitId||!e.basicAuth||!e.resolvedTest||!e.decisions))return async()=>{let r=ge(e.resolvedTest,e.decisions,{wantsPush:e.wantsPush??!1,retryTriggered:e.retryTriggered??!1,forceAuthor:e.forceAuthor??!1}),t=e.resolvedTest.steps.map(o=>o.objective).filter(o=>typeof o=="string"&&o.length>0).slice(0,50),s=await fe({baseUrl:`${e.tmsBaseUrl}/kane-cli/v1`,testId:e.testId,body:{commitId:e.newCommitId,fromCommitId:e.fromCommitId,commitMessage:r,totalSteps:e.resolvedTest.steps.length,timeTaken:Math.round(e.durationS??0),objectives:t},auth:{username:e.basicAuth.username,accessKey:e.basicAuth.access_key}});if(s.ok&&e.sourcePath){let o=V(e.sourcePath);try{let i=JSON.parse(pe(o,"utf8"));i.commit_id=e.newCommitId,he(o,JSON.stringify(i,null,2)+`
6
+ `,"utf8")}catch(i){process.stderr.write(`warn: failed to update meta.json commit_id: ${i.message}
7
+ `)}}return s}}function Ve(e){if(!(!e.isFirstRun||!e.sourcePath))return async r=>{if(!e.sourcePath)return;let t=V(e.sourcePath);try{let s=be(t)?JSON.parse(pe(t,"utf8")):{};e.session.sessionId&&(s.commit_id=e.session.sessionId),r&&(s.testcase_id=r),e.tmsIds?.testId&&(s.test_id=e.tmsIds.testId),e.tmsIds?.projectId&&(s.project_id=e.tmsIds.projectId),e.tmsIds?.folderId&&(s.folder_id=e.tmsIds.folderId),e.tmsIds?.orgId&&(s.org_id=e.tmsIds.orgId),e.tmsIds?.sessionName&&(s.session_name=e.tmsIds.sessionName),he(t,JSON.stringify(s,null,2)+`
8
+ `,"utf8")}catch(s){process.stderr.write(`warn: failed to update meta.json after endTest: ${s.message}
9
+ `)}}}function dr(e){let r=E(e.env),{session:t,auth:s}=e,o=s.basicAuth?{username:s.basicAuth.username,accessKey:s.basicAuth.access_key}:s.token,i=s.resolvedCreds?.username??s.basicAuth?.username??"",n=s.resolvedCreds?.access_key??s.basicAuth?.access_key??"",a=s.resolvedCreds?.org_id??0,c=s.resolvedCreds?.user_id??0,l=[];for(let b of Object.keys(t.auteurVariables))b.startsWith("secrets.user.")&&l.push({key_name:b.replace("secrets.user.",""),scope:"user"});let d=t.getContext().prior_runs.map(b=>b.status),p=t.auteurVariables,S=Object.keys(p).length>0;return{controllerBaseUrl:r.controllerBaseUrl,tmsBaseUrl:r.tmsBaseUrl,auth:o,authResolver:s.resolver,sessionId:t.sessionId,sessionDir:t.sessionDir,testId:t.testId,commitId:t.sessionId,projectId:e.projectId,folderId:e.folderId,firstObjective:t.firstObjective??"KaneAI Test",firstUrl:t.firstUrl??"",runDirs:t.getRunDirs(),runObjectives:t.getRunObjectives(),runMetadata:t.getRunMetadata(),startedAt:t.startedAt,endedAt:new Date().toISOString(),totalSteps:e.totalSteps,totalDuration:e.totalDuration,runStatuses:d,orgId:a,userId:c,tmsUsername:i,tmsAccessKey:n,screenshotBaseUrl:t.screenshotBaseUrl,shareApiBaseUrl:r.shareApiBaseUrl,variables:S?p:void 0,variableIds:e.variableIds,secrets:l,codeExport:e.codeExport,onProgress:e.onProgress,log:e.log,shouldUploadArtifacts:e.shouldUploadArtifacts,shouldReplaceLocalOutput:e.shouldReplaceLocalOutput,shouldCommit:e.shouldCommit,isFirstRun:e.isFirstRun,onAtomicReplace:Ue(e),onCommitLock:$e(e),onFinalizeSuccess:Ve(e)}}var ye=["python","javascript"];function Fe(e){if(e!==void 0){if(!ye.includes(e))throw new Error(`--code-language must be one of: ${ye.join(", ")} (got "${e}")`);return e}}function mr(e,r){let t=Fe(e.codeLanguage);return{enabled:e.codeExport??r.enabled,language:t??r.language,skipValidation:e.skipCodeValidation??r.skip_validation}}async function pr(e){try{let t=await new P(e.tmsBaseUrl,e.auth.username,e.auth.access_key).createAtmTest({objective:e.objective.slice(0,100),creation_mode:"KANECLI",playground_disabled:e.hasCustomProfile,testURL:e.url,project_id:e.projectId,folder_id:e.folderId,authoring_version:4});return e.log("info","ATM_CREATE_OK","Test created",{test_id:t}),t}catch(r){return e.log("error","ATM_CREATE_FAILED","Test creation failed",{error:r instanceof Error?r.message:String(r)}),null}}import{mkdtempSync as Xe,rmSync as Ye}from"fs";import{join as Ze}from"path";import{tmpdir as et}from"os";import{spawn as we,spawnSync as Ke}from"child_process";import{existsSync as H}from"fs";import{createConnection as He}from"net";import{homedir as I,platform as x}from"os";import{join as k}from"path";var Be=new Set(["1","true","yes"]),D=class extends Error{constructor(r){super(r),this.name="ChromeNotFoundError"}};function Rr(e){return e instanceof D?e.message:`Chrome failed: ${e instanceof Error?e.message:String(e)}`}var L={darwin:["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",k(I(),"Applications/Google Chrome.app/Contents/MacOS/Google Chrome"),"/Applications/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing",k(I(),"Applications/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing"),"/Applications/Chromium.app/Contents/MacOS/Chromium"],linux:["/usr/bin/google-chrome","/usr/bin/google-chrome-stable","/usr/bin/google-chrome-for-testing","/usr/local/bin/google-chrome-for-testing",k(I(),"chrome-for-testing/chrome-linux64/chrome"),"/usr/bin/chromium","/usr/bin/chromium-browser","/snap/bin/chromium"],win32:["C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe","C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",k(I(),"AppData\\Local\\Google\\Chrome\\Application\\chrome.exe"),"C:\\chrome-for-testing\\chrome-win64\\chrome.exe",k(I(),"AppData\\Local\\chrome-for-testing\\chrome-win64\\chrome.exe")]};function Me(){if(process.env.KANE_CLI_CHROME_PATH)return process.env.KANE_CLI_CHROME_PATH;let e=x(),r=L[e]??L.linux;for(let t of r)if(H(t))return t;return e==="win32"?"chrome.exe":"google-chrome"}function qe(){if(process.env.KANE_CLI_CHROME_PATH)return H(process.env.KANE_CLI_CHROME_PATH);let e=x();if((L[e]??L.linux).some(o=>H(o)))return!0;let t=e==="win32"?"chrome.exe":"google-chrome",s=e==="win32"?"where":"which";try{return Ke(s,[t],{stdio:"ignore"}).status===0}catch{return!1}}function Ge(){let e=x();return e==="darwin"?["Google Chrome is required but was not found at any standard path.","","Install via Homebrew (recommended):"," brew install --cask google-chrome","","Or download:"," https://www.google.com/chrome/","","Then re-run your command. Set KANE_CLI_CHROME_PATH=/path/to/chrome","to point at a non-standard install."].join(`
10
+ `):e==="linux"?["Google Chrome is required but was not found at /usr/bin/google-chrome.","(amd64 / x86_64 only \u2014 Google does not ship Chrome for Linux ARM.)","","Debian / Ubuntu (any version):"," wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"," sudo apt install -y ./google-chrome-stable_current_amd64.deb","","Fedora / RHEL / AlmaLinux / Rocky:"," sudo dnf install -y https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm","","Then re-run your command. Set KANE_CLI_CHROME_PATH=/path/to/chrome","to point at a non-standard install."].join(`
11
+ `):e==="win32"?["Google Chrome is required but was not found in Program Files or AppData.","","Install via winget (Windows 10 1809+):"," winget install --id Google.Chrome -e --silent","","Or download:"," https://www.google.com/chrome/","","Then re-run your command. Set KANE_CLI_CHROME_PATH=C:\\path\\to\\chrome.exe","to point at a non-standard install."].join(`
12
+ `):["Google Chrome is required.","Install from https://www.google.com/chrome/","(Note: no official Chrome builds for BSD or Alpine/musl Linux.)"].join(`
13
+ `)}function Je(e){let r=x(),t=[`--remote-debugging-port=${e.port}`,`--user-data-dir=${e.userDataDir}`,`--window-size=${e.width},${e.height}`,"--no-first-run","--no-default-browser-check","--disable-blink-features=AutomationControlled","--disable-features=DownloadBubble,DownloadBubbleV2","--safebrowsing-disable-download-protection","--disable-popup-blocking","--disable-notifications","--disable-infobars","--disable-translate","--disable-prompt-on-repost","--disable-background-networking","--disable-client-side-phishing-detection","--disable-default-apps","--disable-hang-monitor","--disable-sync","--metrics-recording-only","--safebrowsing-disable-auto-update","--disable-backgrounding-occluded-windows","--disable-background-timer-throttling","--test-type=webdriver","--allow-pre-commit-input","--enable-logging","--v=1"];return r==="linux"&&(t.push("--no-sandbox"),t.push("--disable-dev-shm-usage"),t.push("--password-store=basic")),r==="darwin"&&t.push("--use-mock-keychain"),e.headless&&t.push("--headless=new"),t}function We(e){return new Promise(r=>{let t=He({port:e,host:"127.0.0.1"});t.setTimeout(1e3),t.on("connect",()=>{t.destroy(),r(!0)}),t.on("timeout",()=>{t.destroy(),r(!1)}),t.on("error",()=>{t.destroy(),r(!1)})})}async function ze(){for(let e=N;e<=U;e++)if(!await We(e))return e;throw new Error(`All CDP ports ${N}-${U} are in use. Close other Chrome instances.`)}async function Qe(e,r=15e3){let t=Date.now(),s=`http://127.0.0.1:${e}/json/version`;for(;Date.now()-t<r;){try{if((await g(s)).ok)return`http://127.0.0.1:${e}`}catch{}await new Promise(o=>setTimeout(o,200))}throw new Error(`Chrome CDP not ready after ${r}ms on port ${e}`)}async function _e(e){let r=process.env.KANE_CLI_SKIP_BROWSER_DOWNLOAD;if(!(r!=null&&Be.has(r.toLowerCase()))&&!qe())throw J()?.log("error","CHROME_NOT_FOUND","Startup gate: Chrome unavailable at standard system paths",{platform:process.platform,kane_cli_chrome_path:process.env.KANE_CLI_CHROME_PATH??null,skip_browser_download:process.env.KANE_CLI_SKIP_BROWSER_DOWNLOAD??null}),new D(Ge());let s=x(),o=await ze(),i=Me(),n=Je({port:o,...e});e.startUrl&&n.push(e.startUrl);let a=we(i,n,{stdio:"ignore",detached:!0,windowsHide:!0});a.unref();let c=await new Promise((l,f)=>{a.on("error",d=>{f(new Error(`Failed to launch Chrome: ${d.message}. Is Chrome installed at ${i}?`))}),a.on("close",d=>{d!==null&&d!==0&&f(new Error(`Chrome exited during startup with code ${d}`))}),Qe(o).then(l,f)});return{process:a,port:o,cdpEndpoint:c,kill(){try{if(a.pid)if(s==="win32")we("taskkill",["/pid",String(a.pid),"/T","/F"],{stdio:"ignore"});else try{process.kill(-a.pid,"SIGKILL")}catch{a.kill("SIGKILL")}else a.kill("SIGKILL")}catch{}}}}async function Or(e){if(e.cft)return{instance:null,tempDir:null};if(e.wsEndpoint)return{wsEndpoint:e.wsEndpoint,instance:null,tempDir:null};if(e.cdpEndpoint){let o=await g(`${e.cdpEndpoint}/json/version`);if(!o.ok)throw new Error(`CDP endpoint not reachable: ${e.cdpEndpoint} (${o.status})`);return{cdpEndpoint:e.cdpEndpoint,instance:null,tempDir:null}}let r,t=null;if(e.config.chrome_profile_path)r=e.config.chrome_profile_path.replace("~",process.env.HOME??"~");else{t=Xe(Ze(et(),"kane-clean-")),r=t;let o=t;W("tempDir",()=>{try{Ye(o,{recursive:!0,force:!0})}catch{}})}let s=await _e({userDataDir:r,width:e.config.window_size.width,height:e.config.window_size.height,startUrl:e.startUrl,headless:e.headless});return{cdpEndpoint:s.cdpEndpoint,instance:s,tempDir:t}}var tt="KaneAI Generated",rt="Untitled";async function $r(e){let r=e.config.load(),t=new P(E(e.env).tmsBaseUrl,e.tmsCreds.username,e.tmsCreds.access_key),s=e.projectName??tt,o=e.folderName??rt,i=r.project_id??null,n=r.project_name??null;if(!i){let d=(await t.listProjects()).find(p=>p.name===s);if(d)i=d.project_id,n=d.name,e.log("info","ENSURE_PROJECT_FOUND","Found default project",{project_id:i,name:n});else{let p=await t.createProject(s);i=p.id,n=p.name,e.log("info","ENSURE_PROJECT_CREATED","Created default project",{project_id:i,name:n})}$(e.creds,e.config,e.profile,e.env,{projectId:i,projectName:n})}let a=r.folder_id??null,c=r.folder_name??null,l=!r.project_id;if(!a||l){let d=(await t.listFolders(i)).find(p=>p.name===o);if(d)a=d.id,c=d.name,e.log("info","ENSURE_FOLDER_FOUND","Found default folder",{folder_id:a,name:c});else{let p=await t.createFolder(i,o);a=p.id,c=p.name,e.log("info","ENSURE_FOLDER_CREATED","Created default folder",{folder_id:a,name:c})}$(e.creds,e.config,e.profile,e.env,{folderId:a,folderName:c})}return{projectId:i,projectName:n??s,folderId:a,folderName:c??o}}export{ot as a,nt as b,D as c,Rr as d,_e as e,ft as f,ht as g,yt as h,wt as i,vt as j,se as k,oe as l,T as m,j as n,Bt as o,Mt as p,qt as q,Jt as r,Xt as s,Yt as t,Zt as u,dr as v,mr as w,pr as x,Or as y,$r as z};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as B}from"./chunk-S3DAAAE5.js";import{a as h}from"./chunk-ZX3PMRMO.js";import{a as w}from"./chunk-HCBYKLMW.js";import{t as s}from"./chunk-3ELBJPHQ.js";import{a as x,b as t,c as g,i as P,j as S}from"./chunk-C44QQJR4.js";import{a as C}from"./chunk-6YGTRKDT.js";import{e as T}from"./chunk-UR6MHSHU.js";var o=T(C(),1);var e=T(w(),1);function D({defaultName:i,onSubmit:c}){let[d,p]=(0,o.useState)("confirm"),[m,a]=(0,o.useState)(""),[f,u]=(0,o.useState)(null),l=(0,o.useMemo)(()=>m.trim()||i,[m,i]);return P((n,r)=>{if(d==="confirm"){if(n==="y"||n==="Y"){a(i),p("name");return}if(n==="n"||n==="N"||r.escape||r.ctrl&&n==="c"){c(null);return}if(r.return){c(i);return}return}if(r.return){if(!B(l)){u(`name "${l}" is invalid; allowed: letters, digits, underscore, hyphen`);return}c(l);return}if(r.escape||r.ctrl&&n==="c"){c(null);return}if(r.backspace||r.delete){a(v=>v.slice(0,-1)),u(null);return}n&&!r.ctrl&&!r.meta&&(a(v=>v+n),u(null))}),d==="confirm"?(0,e.jsx)(h,{title:"Save session?",titleColor:"#ff9500",rows:[{label:"name",value:(0,e.jsx)(t,{color:s.cyan,children:i})}],footer:(0,e.jsxs)(x,{flexDirection:"column",children:[(0,e.jsx)(t,{color:s.dimmed,children:"enter \u2014 save with this name"}),(0,e.jsx)(t,{color:s.dimmed,children:"Y \u2014 edit name"}),(0,e.jsx)(t,{color:s.dimmed,children:"N/esc \u2014 discard session"})]})}):(0,e.jsx)(h,{title:"Save session?",titleColor:"#ff9500",rows:[{label:"name",value:(0,e.jsxs)(x,{children:[(0,e.jsx)(t,{color:s.cyan,children:m}),(0,e.jsx)(t,{inverse:!0,children:" "})]})}],footer:(0,e.jsxs)(x,{flexDirection:"column",children:[f&&(0,e.jsx)(t,{color:s.red,children:f}),(0,e.jsx)(t,{color:s.dimmed,children:"enter \u2014 save \xB7 esc \u2014 discard"})]})})}function V(){return new Date().toISOString().slice(0,19).replace(/:/g,"-")}async function Y(i){return new Promise(c=>{function d(){let{exit:a}=S(),[f,u]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{if(f){let l=setTimeout(()=>a(),50);return()=>clearTimeout(l)}},[f,a]),(0,e.jsx)(D,{defaultName:i,onSubmit:l=>{c(l),u(!0)}})}let{waitUntilExit:p,unmount:m}=g((0,e.jsx)(d,{}),{stdout:process.stderr,exitOnCtrlC:!1});p().then(()=>{try{m()}catch{}})})}export{D as a,V as b,Y as c};
2
+ import{b as B}from"./chunk-S3DAAAE5.js";import{a as h}from"./chunk-MVX3N7GI.js";import{a as w}from"./chunk-HCBYKLMW.js";import{t as s}from"./chunk-2FCAWRCU.js";import{a as x,b as t,c as g,i as P,j as S}from"./chunk-C44QQJR4.js";import{a as C}from"./chunk-6YGTRKDT.js";import{e as T}from"./chunk-UR6MHSHU.js";var o=T(C(),1);var e=T(w(),1);function D({defaultName:i,onSubmit:c}){let[d,p]=(0,o.useState)("confirm"),[m,a]=(0,o.useState)(""),[f,u]=(0,o.useState)(null),l=(0,o.useMemo)(()=>m.trim()||i,[m,i]);return P((n,r)=>{if(d==="confirm"){if(n==="y"||n==="Y"){a(i),p("name");return}if(n==="n"||n==="N"||r.escape||r.ctrl&&n==="c"){c(null);return}if(r.return){c(i);return}return}if(r.return){if(!B(l)){u(`name "${l}" is invalid; allowed: letters, digits, underscore, hyphen`);return}c(l);return}if(r.escape||r.ctrl&&n==="c"){c(null);return}if(r.backspace||r.delete){a(v=>v.slice(0,-1)),u(null);return}n&&!r.ctrl&&!r.meta&&(a(v=>v+n),u(null))}),d==="confirm"?(0,e.jsx)(h,{title:"Save session?",titleColor:"#ff9500",rows:[{label:"name",value:(0,e.jsx)(t,{color:s.cyan,children:i})}],footer:(0,e.jsxs)(x,{flexDirection:"column",children:[(0,e.jsx)(t,{color:s.dimmed,children:"enter \u2014 save with this name"}),(0,e.jsx)(t,{color:s.dimmed,children:"Y \u2014 edit name"}),(0,e.jsx)(t,{color:s.dimmed,children:"N/esc \u2014 discard session"})]})}):(0,e.jsx)(h,{title:"Save session?",titleColor:"#ff9500",rows:[{label:"name",value:(0,e.jsxs)(x,{children:[(0,e.jsx)(t,{color:s.cyan,children:m}),(0,e.jsx)(t,{inverse:!0,children:" "})]})}],footer:(0,e.jsxs)(x,{flexDirection:"column",children:[f&&(0,e.jsx)(t,{color:s.red,children:f}),(0,e.jsx)(t,{color:s.dimmed,children:"enter \u2014 save \xB7 esc \u2014 discard"})]})})}function V(){return new Date().toISOString().slice(0,19).replace(/:/g,"-")}async function Y(i){return new Promise(c=>{function d(){let{exit:a}=S(),[f,u]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{if(f){let l=setTimeout(()=>a(),50);return()=>clearTimeout(l)}},[f,a]),(0,e.jsx)(D,{defaultName:i,onSubmit:l=>{c(l),u(!0)}})}let{waitUntilExit:p,unmount:m}=g((0,e.jsx)(d,{}),{stdout:process.stderr,exitOnCtrlC:!1});p().then(()=>{try{m()}catch{}})})}export{D as a,V as b,Y as c};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as R}from"./chunk-HJ3CHMEM.js";import{a as X}from"./chunk-HCBYKLMW.js";import{t as n}from"./chunk-3ELBJPHQ.js";import{a as c,b as r,i as N}from"./chunk-C44QQJR4.js";import{a as G}from"./chunk-6YGTRKDT.js";import{e as M}from"./chunk-UR6MHSHU.js";var b=M(G(),1);var e=M(X(),1),d=5;function K(i,I){if(!I)return i;let a=I.toLowerCase();return i.filter(v=>v.label.toLowerCase().includes(a))}function Q(i){let{title:I,items:a,loading:v=!1,loadingText:Y,error:h=null,itemNoun:B="items",onSelect:H,onCancel:D,defaultActiveId:y,onTab:L,extraHint:E}=i,[x,s]=(0,b.useState)(0),[p,f]=(0,b.useState)(0),[u,w]=(0,b.useState)(""),[A,S]=(0,b.useState)(null);(0,b.useEffect)(()=>{if(a.length===0)return;if(i.preserveSelectionById&&A!==null){let t=a.findIndex(o=>o.id===A);if(t>=0){f(Math.floor(t/d)),s(t%d);return}}let l=y?a.findIndex(t=>t.id===y):a.findIndex(t=>t.isActive);l>=0?(f(Math.floor(l/d)),s(l%d),i.preserveSelectionById&&S(a[l].id)):i.preserveSelectionById&&(f(0),s(0),S(a[0]?.id??null))},[a,y,i.preserveSelectionById,A]);let g=K(a,u),C=p*d,F=Math.min(C+d,g.length),P=Math.ceil(g.length/d),O=F-C,T=g.slice(C,F);return N((l,t)=>{if(h){t.escape&&D();return}if(t.escape){u?(w(""),s(0),f(0)):D();return}if(t.tab&&L){L();return}if(t.upArrow){if(x>0){let o=x-1;s(o),i.preserveSelectionById&&S(T[o]?.id??null)}else if(p>0){let o=p-1,m=d-1;f(o),s(m),i.preserveSelectionById&&S(g[o*d+m]?.id??null)}return}if(t.downArrow){if(x<O-1){let o=x+1;s(o),i.preserveSelectionById&&S(T[o]?.id??null)}else if(p<P-1){let o=p+1,m=0;f(o),s(m),i.preserveSelectionById&&S(g[o*d+m]?.id??null)}return}if(t.return&&T[x]){H(T[x]);return}if(t.backspace||t.delete){w(o=>o.slice(0,-1)),s(0),f(0);return}l&&!t.ctrl&&!t.meta&&(w(o=>o+l),s(0),f(0))},{isActive:!v}),v?(0,e.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:n.primary,paddingX:2,paddingY:1,children:[(0,e.jsx)(r,{color:n.primary,bold:!0,children:I}),(0,e.jsx)(c,{marginTop:1,children:(0,e.jsx)(r,{color:n.secondary,children:Y??`Loading ${B}\u2026`})})]}):h?(0,e.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:n.statusFail,paddingX:2,paddingY:1,children:[(0,e.jsx)(r,{color:n.statusFail,bold:!0,children:I}),(0,e.jsx)(c,{marginTop:1,children:(0,e.jsx)(r,{color:n.statusFail,children:h})}),(0,e.jsx)(R,{bindings:[]})]}):(0,e.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:n.primary,paddingX:2,paddingY:1,children:[(0,e.jsxs)(c,{children:[(0,e.jsx)(r,{color:n.primary,bold:!0,children:I}),(0,e.jsxs)(r,{color:n.dim,children:[" (",g.length,u?`/${a.length}`:""," ",B,i.loadingMore?" \xB7 loading more":"",")"]})]}),(0,e.jsxs)(c,{marginTop:1,children:[(0,e.jsx)(r,{color:n.secondary,children:u?"filter: ":""}),u?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(r,{children:u}),(0,e.jsx)(r,{inverse:!0,children:" "})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(r,{color:n.dim,children:["Search ",B,"\u2026"]}),(0,e.jsx)(r,{inverse:!0,children:" "})]})]}),(0,e.jsx)(c,{flexDirection:"column",marginTop:1,children:g.length===0?(0,e.jsxs)(r,{color:n.dim,children:["No ",B,' match "',u,'"']}):T.map((l,t)=>{let o=t===x,m=o?"\u276F ":" ",$=l.isActive?n.statusPass:o?n.primary:void 0;return(0,e.jsxs)(r,{color:$,children:[m,l.label,l.isActive?" \u25CF selected":""]},l.id)})}),P>1&&(0,e.jsx)(c,{marginTop:1,children:(0,e.jsxs)(r,{color:n.dim,children:["Page ",p+1,"/",P]})}),i.footer&&(0,e.jsx)(c,{marginTop:1,flexDirection:"column",children:i.footer}),(0,e.jsx)(R,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"type",label:"to search"},{keys:"\u21B5",label:"select"},...L&&E?[{keys:"tab",label:E}]:[]],escBackLabel:u?"clear":"back to chat"})]})}export{Q as a};
2
+ import{a as R}from"./chunk-XK33C64U.js";import{a as X}from"./chunk-HCBYKLMW.js";import{t as n}from"./chunk-2FCAWRCU.js";import{a as c,b as r,i as N}from"./chunk-C44QQJR4.js";import{a as G}from"./chunk-6YGTRKDT.js";import{e as M}from"./chunk-UR6MHSHU.js";var b=M(G(),1);var e=M(X(),1),d=5;function K(i,I){if(!I)return i;let a=I.toLowerCase();return i.filter(v=>v.label.toLowerCase().includes(a))}function Q(i){let{title:I,items:a,loading:v=!1,loadingText:Y,error:h=null,itemNoun:B="items",onSelect:H,onCancel:D,defaultActiveId:y,onTab:L,extraHint:E}=i,[x,s]=(0,b.useState)(0),[p,f]=(0,b.useState)(0),[u,w]=(0,b.useState)(""),[A,S]=(0,b.useState)(null);(0,b.useEffect)(()=>{if(a.length===0)return;if(i.preserveSelectionById&&A!==null){let t=a.findIndex(o=>o.id===A);if(t>=0){f(Math.floor(t/d)),s(t%d);return}}let l=y?a.findIndex(t=>t.id===y):a.findIndex(t=>t.isActive);l>=0?(f(Math.floor(l/d)),s(l%d),i.preserveSelectionById&&S(a[l].id)):i.preserveSelectionById&&(f(0),s(0),S(a[0]?.id??null))},[a,y,i.preserveSelectionById,A]);let g=K(a,u),C=p*d,F=Math.min(C+d,g.length),P=Math.ceil(g.length/d),O=F-C,T=g.slice(C,F);return N((l,t)=>{if(h){t.escape&&D();return}if(t.escape){u?(w(""),s(0),f(0)):D();return}if(t.tab&&L){L();return}if(t.upArrow){if(x>0){let o=x-1;s(o),i.preserveSelectionById&&S(T[o]?.id??null)}else if(p>0){let o=p-1,m=d-1;f(o),s(m),i.preserveSelectionById&&S(g[o*d+m]?.id??null)}return}if(t.downArrow){if(x<O-1){let o=x+1;s(o),i.preserveSelectionById&&S(T[o]?.id??null)}else if(p<P-1){let o=p+1,m=0;f(o),s(m),i.preserveSelectionById&&S(g[o*d+m]?.id??null)}return}if(t.return&&T[x]){H(T[x]);return}if(t.backspace||t.delete){w(o=>o.slice(0,-1)),s(0),f(0);return}l&&!t.ctrl&&!t.meta&&(w(o=>o+l),s(0),f(0))},{isActive:!v}),v?(0,e.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:n.primary,paddingX:2,paddingY:1,children:[(0,e.jsx)(r,{color:n.primary,bold:!0,children:I}),(0,e.jsx)(c,{marginTop:1,children:(0,e.jsx)(r,{color:n.secondary,children:Y??`Loading ${B}\u2026`})})]}):h?(0,e.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:n.statusFail,paddingX:2,paddingY:1,children:[(0,e.jsx)(r,{color:n.statusFail,bold:!0,children:I}),(0,e.jsx)(c,{marginTop:1,children:(0,e.jsx)(r,{color:n.statusFail,children:h})}),(0,e.jsx)(R,{bindings:[]})]}):(0,e.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:n.primary,paddingX:2,paddingY:1,children:[(0,e.jsxs)(c,{children:[(0,e.jsx)(r,{color:n.primary,bold:!0,children:I}),(0,e.jsxs)(r,{color:n.dim,children:[" (",g.length,u?`/${a.length}`:""," ",B,i.loadingMore?" \xB7 loading more":"",")"]})]}),(0,e.jsxs)(c,{marginTop:1,children:[(0,e.jsx)(r,{color:n.secondary,children:u?"filter: ":""}),u?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(r,{children:u}),(0,e.jsx)(r,{inverse:!0,children:" "})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(r,{color:n.dim,children:["Search ",B,"\u2026"]}),(0,e.jsx)(r,{inverse:!0,children:" "})]})]}),(0,e.jsx)(c,{flexDirection:"column",marginTop:1,children:g.length===0?(0,e.jsxs)(r,{color:n.dim,children:["No ",B,' match "',u,'"']}):T.map((l,t)=>{let o=t===x,m=o?"\u276F ":" ",$=l.isActive?n.statusPass:o?n.primary:void 0;return(0,e.jsxs)(r,{color:$,children:[m,l.label,l.isActive?" \u25CF selected":""]},l.id)})}),P>1&&(0,e.jsx)(c,{marginTop:1,children:(0,e.jsxs)(r,{color:n.dim,children:["Page ",p+1,"/",P]})}),i.footer&&(0,e.jsx)(c,{marginTop:1,flexDirection:"column",children:i.footer}),(0,e.jsx)(R,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"type",label:"to search"},{keys:"\u21B5",label:"select"},...L&&E?[{keys:"tab",label:E}]:[]],escBackLabel:u?"clear":"back to chat"})]})}export{Q as a};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,c,e as o}from"./chunk-2FCAWRCU.js";import{a as l}from"./chunk-V7QXJKX7.js";import{readFileSync as f,writeFileSync as d,mkdirSync as h,realpathSync as g}from"fs";import{join as y}from"path";var C="npm install -g @testmuai/kane-cli@latest",b="brew upgrade lambdatest/kane/kane-cli";function w(){try{let t=process.argv[1];if(t&&g(t).includes("/Cellar/"))return b}catch{}return C}var m=y(c,"version-check.json"),S=1440*60*1e3;function k(){try{let t=JSON.parse(f(m,"utf-8"));if(Date.now()-t.checkedAt<S)return t}catch{}return null}function A(t){try{h(c,{recursive:!0}),d(m,JSON.stringify({latest:t,checkedAt:Date.now()}))}catch{}}function u(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);for(let s=0;s<3;s++){let e=(n[s]??0)-(i[s]??0);if(e!==0)return e}return 0}function p(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);return(n[0]??0)!==(i[0]??0)?"major":(n[1]??0)!==(i[1]??0)?"minor":"patch"}async function j(){try{let t=k();if(t)return u(a,t.latest)>0?{current:a,latest:t.latest,severity:p(a,t.latest)}:null;let r=new AbortController,i=setTimeout(()=>r.abort(),5e3),n=await l(o,{headers:{Accept:"application/json"},signal:r.signal});if(clearTimeout(i),!n.ok)return null;let e=(await n.json())["dist-tags"]?.latest;return e?(A(e),u(a,e)>0?{current:a,latest:e,severity:p(a,e)}:null):null}catch{return null}}export{w as a,u as b,p as c,j as d};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{dirname as p,basename as f,join as i}from"path";function g(r){let t=f(r);return t.endsWith("_test.md")?t.slice(0,-8):t.endsWith(".md")?t.slice(0,-3):t}function o(r){return i(p(r),`output-${g(r)}`)}function x(r){return i(o(r),"Result.md")}function c(r){return i(o(r),".internal")}function d(r){return i(c(r),"meta.json")}function l(r,t,n){return i(o(r),`${t}-${n}-code`)}function D(r){return i(o(r),"generated-code")}function b(r){return o(r)+".staging"}function m(r){return i(c(r),"steps")}function v(r,t,n){return i(m(r),`${t}-${n}`)}import{existsSync as e,renameSync as s,rmSync as u}from"fs";function h(r){let t=`${r}.staging`,n=`${r}.bak`;if(!e(t))throw new Error(`atomicReplaceDir: staging missing: ${t}`);if(process.platform==="win32"){e(r)&&u(r,{recursive:!0,force:!0}),s(t,r);return}e(r)&&(e(n)&&u(n,{recursive:!0,force:!0}),s(r,n)),s(t,r),e(n)&&u(n,{recursive:!0,force:!0})}function w(r){let t=`${r}.staging`,n=`${r}.bak`;if(process.platform==="win32"){e(t)&&(e(r)?u(t,{recursive:!0,force:!0}):s(t,r));return}if(e(n)&&!e(r)){s(n,r),e(t)&&u(t,{recursive:!0,force:!0});return}e(n)&&e(r)&&u(n,{recursive:!0,force:!0}),e(t)&&e(r)&&u(t,{recursive:!0,force:!0})}export{g as a,o as b,x as c,c as d,d as e,l as f,D as g,b as h,v as i,h as j,w as k};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as x}from"./chunk-HCBYKLMW.js";import{t as m}from"./chunk-3ELBJPHQ.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(n,t){if(!t)return n;let l=n.trim()||t;return`\x1B]8;;${t}\x07${l}\x1B]8;;\x07`}var r=f(x(),1);function $({shareableLink:n,testCaseLink:t,codeExportDir:l,recordedTestPath:s,outputDir:o,autoExit:p=!0}){let{exit:c}=g();(0,T.useEffect)(()=>{if(!p)return;let i=setTimeout(()=>c(),100);return()=>clearTimeout(i)},[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}`}),n&&e.push({label:"ShareLink",url:n}),t&&e.push({label:"TestCase",url:t}),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(i=>(0,r.jsxs)(u,{flexDirection:"column",marginBottom:1,children:[(0,r.jsxs)(a,{color:m.primary,children:[i.label,":"]}),(0,r.jsx)(a,{color:m.dim,children:k(i.url,i.linkUrl??i.url)})]},i.label))})}export{$ as a};
2
+ import{a as x}from"./chunk-HCBYKLMW.js";import{t as m}from"./chunk-2FCAWRCU.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(n,t){if(!t)return n;let l=n.trim()||t;return`\x1B]8;;${t}\x07${l}\x1B]8;;\x07`}var r=f(x(),1);function $({shareableLink:n,testCaseLink:t,codeExportDir:l,recordedTestPath:s,outputDir:o,autoExit:p=!0}){let{exit:c}=g();(0,T.useEffect)(()=>{if(!p)return;let i=setTimeout(()=>c(),100);return()=>clearTimeout(i)},[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}`}),n&&e.push({label:"ShareLink",url:n}),t&&e.push({label:"TestCase",url:t}),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(i=>(0,r.jsxs)(u,{flexDirection:"column",marginBottom:1,children:[(0,r.jsxs)(a,{color:m.primary,children:[i.label,":"]}),(0,r.jsx)(a,{color:m.dim,children:k(i.url,i.linkUrl??i.url)})]},i.label))})}export{$ as a};
@@ -0,0 +1,17 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b as m}from"./chunk-L5LI2JF4.js";import{c as p}from"./chunk-2FCAWRCU.js";import{randomUUID as L}from"crypto";import{mkdirSync as j,writeFileSync as _,appendFileSync as $,existsSync as f}from"fs";import{join as a}from"path";import{writeFileSync as R,mkdirSync as S,existsSync as b}from"fs";import{join as h,relative as w}from"path";var I=new Set(["username","access_key","oauth","profile","project_id","folder_id"]),x=new Set(["model","env"]),d=class{constructor(e){this.opts=e}objectives=[];flushed=!1;lastWrittenPath=null;lastCollisionSuffixed=!1;appendObjective(e){this.objectives.push(e)}flush(){if(this.flushed||(this.flushed=!0,this.objectives.length===0))return;let e=this.opts.getName();if(!e)return;let t=h(this.opts.cwd,".testmuai","tests");try{S(t,{recursive:!0})}catch(l){process.stderr.write(`
3
+ \u26A0 Failed to create ${w(this.opts.cwd,t)}/
4
+ ${l.message}
5
+ Your test recording was NOT saved.
6
+
7
+ `);return}let s=h(t,`${e}_test.md`),r=2,n=!1;for(;b(s);)s=h(t,`${e}-${r}_test.md`),r++,n=!0;let u=y(this.opts.getResolvedGlobal()),o=m(u).trimEnd(),i=[];i.push("---"),o&&i.push(o),i.push("---",""),i.push(`# Session: ${e}`,""),this.objectives.forEach((l,c)=>{i.push(`## Step ${c+1}`,l,"")});try{R(s,i.join(`
8
+ `),"utf8")}catch(l){process.stderr.write(`
9
+ \u26A0 Failed to save your test recording.
10
+ ${l.message}
11
+ Path: ${s}
12
+
13
+ `);return}this.lastWrittenPath=s,this.lastCollisionSuffixed=n}};function y(g){let e={};for(let[t,s]of Object.entries(g))I.has(t)||x.has(t)||(e[t]=s);return e}var E=a(p,"sessions"),v=class{sessionId;sessionDir;runs=[];_flows=[];_nextIndex=0;_started=!1;_testId=null;_testcaseId=null;_projectId=null;_orgId=null;_uploadStatus="pending";_uploadAttempts=0;_uploadError=null;_firstObjective=null;_firstUrl=null;_auteurVariables={};_screenshotSas=null;_model="";_environment="";_profile=null;_startedAt="";_remoteLogger=null;_earlyLogBuffer=[];_recorder=null;_resolvedGlobal={};_sessionName=null;_recordingEnabled=!0;_stepRunRecords=[];constructor(){this.sessionId=L(),this.sessionDir=a(E,this.sessionId)}setResolvedGlobal(e){this._resolvedGlobal={...this._resolvedGlobal,...e}}setSessionName(e){this._sessionName=e}get sessionName(){return this._sessionName}setRecordingEnabled(e){this._recordingEnabled=e}get recorder(){return this._recorder}flushRecorder(){try{this._recorder?.flush()}catch(e){process.stderr.write(`[recorder] flush failed: ${e.message}
14
+ `)}}start(e){if(!this._started){this._started=!0,this._model=e.model,this._environment=e.environment,this._profile=e.profile,this._startedAt=new Date().toISOString();try{j(this.sessionDir,{recursive:!0}),this._recorder=new d({cwd:process.cwd(),getResolvedGlobal:()=>this._resolvedGlobal,getName:()=>this._sessionName});let t={session_id:this.sessionId,started_at:this._startedAt,model:e.model,environment:e.environment,profile:e.profile,objectives:[],runs:[],status:"in_progress"};_(a(this.sessionDir,"session.json"),JSON.stringify(t,null,2)+`
15
+ `)}catch{}this._log(`SESSION START session_id=${this.sessionId}`),this._log(`CONFIG model=${e.model} env=${e.environment} profile=${e.profile}`),this._earlyLogBuffer.push({level:"info",event:"SESSION_START",message:"Session started",context:{session_id:this.sessionId}},{level:"info",event:"CONFIG",message:"Session config",context:{model:e.model,environment:e.environment,profile:e.profile}})}}setRemoteLogger(e){this._remoteLogger=e;for(let t of this._earlyLogBuffer)e.log(t.level,t.event,t.message,t.context);this._earlyLogBuffer=[]}get hasRemoteLogger(){return this._remoteLogger!==null}setAuteurVariables(e){Object.assign(this._auteurVariables,e)}get auteurVariables(){return this._auteurVariables}setScreenshotSas(e){this._screenshotSas=e}get screenshotSas(){return this._screenshotSas}get screenshotBaseUrl(){return this._screenshotSas?`${this._screenshotSas.base_url}/${this._screenshotSas.container}`:""}get startedAt(){return this._startedAt||new Date().toISOString()}log(e,t,s,r){if(t===void 0){this._log(e);let o=e.indexOf(" "),i=o>0?e.slice(0,o):e,l=o>0?e.slice(o+1):"",c=/fail|error/i.test(e)?"error":"info";this._remoteLogger?.log(c,i,l||e);return}let n=e,u=s;this._log(`${t} ${u}`),this._remoteLogger?.log(n,t,u,r)}logStep(e,t,s){this._log(`${e} ${t}`);let r=this._nextIndex>0?this._nextIndex-1:0;this._remoteLogger?.logStep(r,e,t,s)}logCommand(e){this._log(`COMMAND ${e}`)}logRunStart(e,t,s){this._log(`RUN ${e} START objective="${t.slice(0,100)}" url=${s}`),this._remoteLogger?.setRunIndex(e),this._remoteLogger?.log("info","RUN_START",`Run ${e} started`,{run_index:e,objective:t,url:s})}logRunEnd(e,t,s,r){let n=(s??0).toFixed(1),u=(r??"").slice(0,100);this._log(`RUN ${e} END status=${t} duration=${n}s summary="${u}"`),this._remoteLogger?.log("info","RUN_END",`Run ${e} ended`,{run_index:e,status:t,duration:s??0,summary:r??""}),t!=="failed"&&t!=="error"&&this._remoteLogger?.discardSteps(e)}escalateRun(e){this._remoteLogger?.escalate(e)}logChromeLaunch(e,t){this._log(`CHROME LAUNCH port=${e} endpoint=${t}`),this._remoteLogger?.log("info","CHROME_LAUNCH","Chrome launched",{port:e,cdp_endpoint:t})}async finish(e="complete"){this._log(`SESSION END status=${e} total_runs=${this.runs.length}`),this._remoteLogger?.log("info","SESSION_END","Session ended",{status:e,total_runs:this.runs.length}),await this._remoteLogger?.shutdown();let t={session_id:this.sessionId,started_at:this._startedAt,ended_at:new Date().toISOString(),model:this._model,environment:this._environment,profile:this._profile,status:e,total_runs:this.runs.length,test_id:this._testId,testcase_id:this._testcaseId,commit_id:this.sessionId,project_id:this._projectId,upload_status:this._uploadStatus,upload_attempts:this._uploadAttempts,last_upload_attempt:this._uploadAttempts>0?new Date().toISOString():null,upload_error:this._uploadError,runs:this.runs.map(s=>({index:s.index,objective:s.objective,status:s.status,summary:s.summary,run_dir:s.run_dir}))};f(this.sessionDir)&&_(a(this.sessionDir,"session.json"),JSON.stringify(t,null,2)+`
16
+ `),this.flushRecorder(),this._recorder=null}nextRunIndex(){return this._nextIndex}addRunResult(e,t){this.runs.push(e),this._nextIndex+=t??1,this._recordingEnabled&&this._recorder?.appendObjective(e.objective)}getContext(){return{prior_runs:this.runs.map(e=>({index:e.index,objective:e.objective,summary:e.summary,status:e.status,memory:e.context.memory,variables:e.context.variables,pointer:e.context.pointer}))}}addFlow(e){let t={...e,index:this._flows.length+1};return this._flows.push(t),t}getFlows(){return[...this._flows]}getFlow(e){return this._flows.find(t=>t.index===e)}clearFlows(){this._flows=[]}recordStepRun(e){this._stepRunRecords.push(e)}getStepRunRecords(){return[...this._stepRunRecords]}getRunsAsStepRecords(){return this.runs.map((e,t)=>({testmdStepIndex:t+1,runIndex:e.index,totalRunDirs:e.run_dirs?.length??1}))}snapshot(){return{runsLen:this.runs.length,nextRunIndex:this._nextIndex,stepRunRecordsLen:this._stepRunRecords.length}}rollback(e){this.runs.length=e.runsLen,this._nextIndex=e.nextRunIndex,this._stepRunRecords.length=e.stepRunRecordsLen}setTestId(e){this._testId=e}get testId(){return this._testId}setTestcaseId(e){this._testcaseId=e}get testcaseId(){return this._testcaseId}setProjectId(e){this._projectId=e}setOrgId(e){this._orgId=e}get orgId(){return this._orgId}setFirstRun(e,t){this._firstObjective||(this._firstObjective=e,this._firstUrl=t)}get firstObjective(){return this._firstObjective}get firstUrl(){return this._firstUrl}getRunDirs(){let e=[];for(let t of this.runs)t.run_dirs&&t.run_dirs.length>0?e.push(...t.run_dirs):t.run_dir&&e.push(t.run_dir);return e}getRunObjectives(){let e=[];for(let t of this.runs)t.flow_objectives&&t.flow_objectives.length>0?e.push(...t.flow_objectives):e.push(t.objective);return e}getRunMetadata(){let e=[];for(let t of this.runs)if(t.perFlowMetadata&&t.perFlowMetadata.length>0)e.push(...t.perFlowMetadata);else{let s={resultCode:t.resultCode,reasonCode:t.reasonCode,errorMessage:t.status==="failed"?t.summary??null:null,summary:t.summary,oneLiner:t.oneLiner},r=t.run_dirs?.length??1;for(let n=0;n<r;n++)e.push(s)}return e}setUploadStatus(e,t){this._uploadStatus=e,this._uploadAttempts+=1,this._uploadError=t??null}_log(e){if(!(!this._started||!f(this.sessionDir)))try{let t=new Date().toISOString().slice(0,19).replace("T"," "),s=a(this.sessionDir,"tui.log");$(s,`[${t}] ${e}
17
+ `)}catch{}}};export{v as a};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as I}from"./chunk-YCCUBQY4.js";import{a as A}from"./chunk-THNGNS36.js";import{a as L}from"./chunk-TK7ZJ7YX.js";import{a as R}from"./chunk-HJ3CHMEM.js";import{a as v}from"./chunk-HCBYKLMW.js";import{t as s}from"./chunk-3ELBJPHQ.js";import{a as u,b as i}from"./chunk-C44QQJR4.js";import{a as J}from"./chunk-6YGTRKDT.js";import{a as T}from"./chunk-YUUZDFT7.js";import{e as N}from"./chunk-UR6MHSHU.js";var t=N(J(),1);var e=N(v(),1);function X(n,y,c){return{id:n,label:`${y} (${n})`,isActive:n===c}}function Z({resolver:n,currentProjectId:y,env:c,onSelect:x,onCancel:w}){let[F,M]=(0,t.useState)([]),[_,l]=(0,t.useState)(!0),[$,m]=(0,t.useState)(!1),[O,P]=(0,t.useState)(null),[g,d]=(0,t.useState)("list"),[S,k]=(0,t.useState)(""),[C,p]=(0,t.useState)(null),h=(0,t.useRef)(!1);(0,t.useEffect)(()=>{if(!n){P("Login first to browse projects"),l(!1);return}let o=new AbortController;return l(!0),m(!0),(async()=>{try{let r=n.cached??await n.resolve();if(!r){P("Login first to browse projects"),l(!1),m(!1);return}let a=L(c),E=new T(a.tmsBaseUrl,r.username,r.access_key),j=!0,b=0;for await(let f of E.listProjectsStream({signal:o.signal})){if(j&&(l(!1),j=!1),f.totalLoaded===0&&f.done&&b===0){h.current=!0,d("naming"),m(!1);return}f.projects.length>0&&(M(H=>[...H,...f.projects.map(B=>X(B.project_id,B.name,y))]),b+=f.projects.length),f.done&&m(!1)}j&&(l(!1),m(!1))}catch(r){if(r?.name==="AbortError")return;P(r instanceof Error?r.message:String(r)),l(!1),m(!1)}})(),()=>o.abort()},[n,y,c]);let U=(0,t.useCallback)(o=>{let r=o.trim();if(!r){p("Name cannot be empty");return}p(null),d("creating"),(async()=>{try{if(!n)throw new Error("Not authenticated");let a=n.cached??await n.resolve();if(!a)throw new Error("Not authenticated");let E=L(c),b=await new T(E.tmsBaseUrl,a.username,a.access_key).createProject(r);x(b.id,b.name)}catch(a){p(a instanceof Error?a.message:String(a)),d("naming")}})()},[n,c,x]),D=(0,t.useCallback)(()=>{k(""),p(null),h.current?w():d("list")},[w]);return g==="naming"||g==="creating"?(0,e.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:s.primary,paddingX:2,paddingY:1,children:[(0,e.jsx)(i,{color:s.primary,bold:!0,children:"Create new project"}),h.current&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(i,{color:s.dim,children:"No projects yet \u2014 let's create one."})}),(0,e.jsxs)(u,{marginTop:1,children:[(0,e.jsx)(i,{color:s.dim,children:"Name: "}),g==="naming"?(0,e.jsx)(I,{value:S,onChange:o=>{k(o),C&&p(null)},onSubmit:U,onCancel:D}):(0,e.jsx)(i,{children:S})]}),C&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(i,{color:s.red,children:C})}),g==="creating"&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(i,{color:s.dim,children:"Creating..."})}),g==="naming"&&(0,e.jsx)(R,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:h.current?"cancel":"back"})]}):(0,e.jsx)(A,{title:"Projects",items:F,loading:_,loadingMore:$,preserveSelectionById:!0,error:O,itemNoun:"projects",onTab:()=>{h.current=!1,d("naming")},extraHint:"tab to create new",onSelect:o=>{let r=o.label.replace(` (${o.id})`,"");x(o.id,r)},onCancel:w})}export{X as a,Z as b};
2
+ import{a as I}from"./chunk-YCCUBQY4.js";import{a as A}from"./chunk-7ECMUWV2.js";import{a as L}from"./chunk-PAQGYV5G.js";import{a as R}from"./chunk-XK33C64U.js";import{a as v}from"./chunk-HCBYKLMW.js";import{t as s}from"./chunk-2FCAWRCU.js";import{a as u,b as i}from"./chunk-C44QQJR4.js";import{a as J}from"./chunk-6YGTRKDT.js";import{a as T}from"./chunk-YZTCCQHR.js";import{e as N}from"./chunk-UR6MHSHU.js";var t=N(J(),1);var e=N(v(),1);function X(n,y,c){return{id:n,label:`${y} (${n})`,isActive:n===c}}function Z({resolver:n,currentProjectId:y,env:c,onSelect:x,onCancel:w}){let[F,M]=(0,t.useState)([]),[_,l]=(0,t.useState)(!0),[$,m]=(0,t.useState)(!1),[O,P]=(0,t.useState)(null),[g,d]=(0,t.useState)("list"),[S,k]=(0,t.useState)(""),[C,p]=(0,t.useState)(null),h=(0,t.useRef)(!1);(0,t.useEffect)(()=>{if(!n){P("Login first to browse projects"),l(!1);return}let o=new AbortController;return l(!0),m(!0),(async()=>{try{let r=n.cached??await n.resolve();if(!r){P("Login first to browse projects"),l(!1),m(!1);return}let a=L(c),E=new T(a.tmsBaseUrl,r.username,r.access_key),j=!0,b=0;for await(let f of E.listProjectsStream({signal:o.signal})){if(j&&(l(!1),j=!1),f.totalLoaded===0&&f.done&&b===0){h.current=!0,d("naming"),m(!1);return}f.projects.length>0&&(M(H=>[...H,...f.projects.map(B=>X(B.project_id,B.name,y))]),b+=f.projects.length),f.done&&m(!1)}j&&(l(!1),m(!1))}catch(r){if(r?.name==="AbortError")return;P(r instanceof Error?r.message:String(r)),l(!1),m(!1)}})(),()=>o.abort()},[n,y,c]);let U=(0,t.useCallback)(o=>{let r=o.trim();if(!r){p("Name cannot be empty");return}p(null),d("creating"),(async()=>{try{if(!n)throw new Error("Not authenticated");let a=n.cached??await n.resolve();if(!a)throw new Error("Not authenticated");let E=L(c),b=await new T(E.tmsBaseUrl,a.username,a.access_key).createProject(r);x(b.id,b.name)}catch(a){p(a instanceof Error?a.message:String(a)),d("naming")}})()},[n,c,x]),D=(0,t.useCallback)(()=>{k(""),p(null),h.current?w():d("list")},[w]);return g==="naming"||g==="creating"?(0,e.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:s.primary,paddingX:2,paddingY:1,children:[(0,e.jsx)(i,{color:s.primary,bold:!0,children:"Create new project"}),h.current&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(i,{color:s.dim,children:"No projects yet \u2014 let's create one."})}),(0,e.jsxs)(u,{marginTop:1,children:[(0,e.jsx)(i,{color:s.dim,children:"Name: "}),g==="naming"?(0,e.jsx)(I,{value:S,onChange:o=>{k(o),C&&p(null)},onSubmit:U,onCancel:D}):(0,e.jsx)(i,{children:S})]}),C&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(i,{color:s.red,children:C})}),g==="creating"&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(i,{color:s.dim,children:"Creating..."})}),g==="naming"&&(0,e.jsx)(R,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:h.current?"cancel":"back"})]}):(0,e.jsx)(A,{title:"Projects",items:F,loading:_,loadingMore:$,preserveSelectionById:!0,error:O,itemNoun:"projects",onTab:()=>{h.current=!1,d("naming")},extraHint:"tab to create new",onSelect:o=>{let r=o.label.replace(` (${o.id})`,"");x(o.id,r)},onCancel:w})}export{X as a,Z as b};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as l}from"./chunk-F6HEB4PA.js";import{b as i,d as p,e as f,f as g,g as u}from"./chunk-SLA75N5B.js";import{a as d}from"./chunk-KVDOQY2Q.js";import{existsSync as t,mkdirSync as w,readFileSync as S,renameSync as y,writeFileSync as D}from"fs";import{join as j}from"path";function O(r){l(i(r));let a=i(r);if(!t(a))return;let s=j(a,"meta.json"),n=f(r);if(t(s)&&!t(n))try{w(p(r),{recursive:!0}),y(s,n)}catch(e){process.stderr.write(`warn: meta.json migration failed: ${e.message}
2
+ import{b as i,d as p,e as f,f as g,g as u,k as l}from"./chunk-AH4AXJML.js";import{a as d}from"./chunk-KGZATJQN.js";import{existsSync as t,mkdirSync as w,readFileSync as S,renameSync as y,writeFileSync as D}from"fs";import{join as j}from"path";function O(r){l(i(r));let a=i(r);if(!t(a))return;let s=j(a,"meta.json"),n=f(r);if(t(s)&&!t(n))try{w(p(r),{recursive:!0}),y(s,n)}catch(e){process.stderr.write(`warn: meta.json migration failed: ${e.message}
3
3
  `)}let c=u(r);if(t(c)){let e="python";try{let o=new d().load();o.code_export?.language&&(e=o.code_export.language)}catch{}let m=g(r,"playwright",e);if(!t(m))try{y(c,m)}catch(o){process.stderr.write(`warn: generated-code migration failed: ${o.message}
4
4
  `)}}if(t(n))try{let e=JSON.parse(S(n,"utf8"));"md5sum"in e&&(delete e.md5sum,D(n,JSON.stringify(e,null,2)+`
5
5
  `,"utf8"))}catch(e){process.stderr.write(`warn: meta.json md5sum strip failed: ${e.message}
@@ -0,0 +1,5 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as v}from"./chunk-PAQGYV5G.js";import{spawn as x,execSync as b}from"child_process";import{existsSync as g}from"fs";import{resolve as e,dirname as h}from"path";import{fileURLToPath as N}from"url";import{createInterface as S}from"readline";async function*E(i){let n=S({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 w(i){return i==="action"?{set:{V16_AGENT_ENABLE_ALL_BLOCKERS:"true"},unset:[]}:{set:{},unset:["V16_AGENT_ENABLE_ALL_BLOCKERS"]}}var c=h(N(import.meta.url));function O(){for(let i of["python3","python"])try{return b(`${i} --version`,{stdio:"ignore"}),i}catch{}return null}function C(){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"],"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 a=[e(c,"..","node_modules",t,"bin",n),e(c,"..","..","node_modules",t,"bin",n),e(c,"..","..","..","node_modules",t,"bin",n),e(c,"..","..","..","..","node_modules",t,"bin",n)];for(let u of a)if(g(u))return{cmd:u,args:[]}}let p=[e(c,"bin",n),e(c,"..","bin",n),e(c,"..","..","..","..","v16-runner","dist",n),e(c,"..","..","..","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(c,"..","..","..","..","v16-runner"),e(c,"..","..","..","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 a=O();if(a)return{cmd:a,args:["main.py"],cwd:t}}return null}function G(i,n){let l=C();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=v(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=w(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,a="";s.stderr.on("data",o=>{a+=o.toString(),a.length>t&&(a=a.slice(-t))}),s.on("error",o=>{n?.log?.("error","RUNNER_SPAWN_ERROR","Runner spawn error",{error:o.message})});let u=null,f=null,R=new Promise(o=>{s.on("close",(m,y)=>{u=m,f=y?String(y):null,n?.log?.("info","RUNNER_EXIT","Runner exited",{code:m,signal:f??"none"}),o({code:m,signal:f})})}),_=E(s.stdout);return{child:s,events:_,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 a},get exitCode(){return u},get exitSignal(){return f},exited:R}}export{C as a,G as b};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{f as v,g as b}from"./chunk-G7VF5SDK.js";import{b as f}from"./chunk-ZB72T6HB.js";import{a as m}from"./chunk-PAQGYV5G.js";import{a as h}from"./chunk-GCAHPH2E.js";var p=class extends Error{constructor(n,s){super(n);this.code=s;this.name="AuthError"}};async function y(e){let o=e.credentials.expires_at,n=e.thresholdSeconds??300;if(o-Date.now()/1e3>=n)return null;let s=e.creds.loadClient(e.profile,e.env);if(!s)return null;let r=await new f(e.env).refreshToken(e.credentials.refresh_token,s.client_id),t=Math.floor(Date.now()/1e3)+r.expires_in;return e.creds.saveCredentials(e.profile,e.env,{access_token:r.access_token,refresh_token:r.refresh_token,expires_at:t,scope:r.scope}),{accessToken:r.access_token,refreshToken:r.refresh_token,expiresAt:t,scope:r.scope}}async function L(e){let{creds:o,env:n,usernameFlag:s,accessKeyFlag:a,log:r}=e,t=null,l=null;if(s&&a)t={username:s,access_key:a},r("info","AUTH_RESOLVE_FLAGS","Auth resolved via CLI flags",{username:s});else{let i=o.resolveAuth();i?.method==="basic"&&(t={username:i.username,access_key:i.access_key},r("info","AUTH_RESOLVE_CONFIG","Auth resolved via config",{username:i.username}))}if(!t){let{credentials:i,profile:E}=o.getActiveCredentials();if(!i)throw new p("Not authenticated \u2014 no credentials found","not_authenticated");if(l=i.access_token,i.expires_at-Date.now()/1e3<300)try{let c=await y({creds:o,profile:E,env:n,credentials:i});c&&(l=c.accessToken,r("info","AUTH_TOKEN_REFRESHED","OAuth token refreshed"))}catch(c){let g=c instanceof Error?c.message:String(c);throw r("error","TOKEN_REFRESH_FAILED","Token refresh failed",{error:g}),new p(`Token refresh failed: ${g}`,"refresh_failed")}}let R=m(n),x=async()=>l,A=t?{username:t.username,access_key:t.access_key}:null,d=new h(R.controllerBaseUrl,x,A,r),u=await d.resolve();return u&&!t&&(t={username:u.username,access_key:u.access_key},r("info","AUTH_RESOLVE_CONTROLLER","Auth resolved via controller",{username:u.username})),{basicAuth:t,token:l,resolver:d,resolvedCreds:u}}async function V(e){if(!e.isInteractive)return{recovered:!1};if(C(e.creds,e.config))return{recovered:!1};let{SingleShotApp:o}=await import("./SingleShotApp-N4AGSAPW.js"),{render:n}=await import("./build-JIKYOZUH.js"),s=await import("./react-QWOAB3TB.js"),a={current:null},r={current:!1},{waitUntilExit:t,unmount:l}=n(s.default.createElement(o,{resultRef:a,mode:"login",loginCompleteRef:r}),{exitOnCtrlC:!1});b(()=>l()),await t();try{process.stdin.setRawMode?.(!1)}catch{}return process.stdout.write("\x1B[?25h"),r.current?{recovered:!0}:(v(0,"Startup gate cancelled"),{recovered:!1})}function C(e,o){let n=e.getActiveProfile(),s=e.getDefaultEnv();if(!n||!!!(e.loadBasicAuth(n,s)||e.loadCredentials(n,s)))return!1;let r=o.load();return!!r.project_id&&!!r.folder_id}export{y as a,p as b,L as c,V as d};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as o}from"./chunk-JI7KJKG4.js";import{a as c}from"./chunk-KKZRPFWO.js";import{a as n}from"./chunk-V7QXJKX7.js";var l=class{constructor(t,e,r,s){this.controllerBaseUrl=t;this.getOAuthToken=e;this.directBasicAuth=r;this.log=s}_cached=null;_revoked=!1;revoke(){this._revoked=!0,this._cached=null}get revoked(){return this._revoked}get cached(){return this._cached}async resolve(t=!1){if(this._cached&&!t)return this._cached;try{let e;if(this.directBasicAuth)e=new o(this.controllerBaseUrl,{username:this.directBasicAuth.username,accessKey:this.directBasicAuth.access_key});else{let s=await this.getOAuthToken();if(!s)return null;e=new o(this.controllerBaseUrl,s)}let r=await e.getTmsCredentials();return this.directBasicAuth&&!r.access_key&&(r.access_key=this.directBasicAuth.access_key),this._cached=r,this.log?.("info","AUTH_RESOLVE_OK","Auth resolved",{username:r.username,org_id:r.org_id,user_id:r.user_id}),r}catch(e){return this.log?.("warn","AUTH_RESOLVE_FAILED","Auth resolve failed",{error:e instanceof Error?e.message:String(e)}),null}}async fetch(t,e={}){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");let r=await this.resolve();if(!r)throw new Error("Not authenticated \u2014 no credentials resolved");let s=i=>({...e,headers:{...e.headers,Authorization:c(i.username,i.access_key)}}),a=await n(t,s(r));if(a.status===401){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");this.log?.("warn","AUTH_RESOLVE_401","Got 401, re-resolving",{url:t});let i=await this.resolve(!0);if(!i)throw new Error("Re-authentication failed after 401");return n(t,s(i))}return a}};export{l as a};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as m}from"./chunk-HCBYKLMW.js";import{t as o}from"./chunk-3ELBJPHQ.js";import{a as r,b as i}from"./chunk-C44QQJR4.js";import{e as a}from"./chunk-UR6MHSHU.js";var e=a(m(),1),u={default:o.muted,error:o.red,success:o.green,info:o.purple,warning:o.yellow};function T({title:t,titleColor:l,borderColor:d,variant:n="default",children:c,width:s,paddingX:x=2,paddingY:g=0,marginBottom:p=0}){let f=d??u[n],B=l??(n==="default"?o.purple:u[n]);return(0,e.jsxs)(r,{flexDirection:"column",marginBottom:p,children:[t&&(0,e.jsx)(r,{marginBottom:0,children:(0,e.jsxs)(i,{color:B,bold:!0,children:[" ",t]})}),(0,e.jsx)(r,{borderStyle:"round",borderColor:f,flexDirection:"column",paddingX:x,paddingY:g,width:s,children:c})]})}function h({label:t,value:l,labelColor:d=o.dimmed,valueColor:n,labelWidth:c=14}){return(0,e.jsxs)(r,{children:[(0,e.jsx)(r,{width:c,children:(0,e.jsx)(i,{color:d,children:t})}),(0,e.jsx)(i,{color:n,children:l})]})}function C({label:t}){return(0,e.jsx)(r,{marginTop:1,marginBottom:0,children:(0,e.jsx)(i,{bold:!0,children:t})})}export{T as a,h as b,C as c};
2
+ import{a as m}from"./chunk-HCBYKLMW.js";import{t as o}from"./chunk-2FCAWRCU.js";import{a as r,b as i}from"./chunk-C44QQJR4.js";import{e as a}from"./chunk-UR6MHSHU.js";var e=a(m(),1),u={default:o.muted,error:o.red,success:o.green,info:o.purple,warning:o.yellow};function T({title:t,titleColor:l,borderColor:d,variant:n="default",children:c,width:s,paddingX:x=2,paddingY:g=0,marginBottom:p=0}){let f=d??u[n],B=l??(n==="default"?o.purple:u[n]);return(0,e.jsxs)(r,{flexDirection:"column",marginBottom:p,children:[t&&(0,e.jsx)(r,{marginBottom:0,children:(0,e.jsxs)(i,{color:B,bold:!0,children:[" ",t]})}),(0,e.jsx)(r,{borderStyle:"round",borderColor:f,flexDirection:"column",paddingX:x,paddingY:g,width:s,children:c})]})}function h({label:t,value:l,labelColor:d=o.dimmed,valueColor:n,labelWidth:c=14}){return(0,e.jsxs)(r,{children:[(0,e.jsx)(r,{width:c,children:(0,e.jsx)(i,{color:d,children:t})}),(0,e.jsx)(i,{color:n,children:l})]})}function C({label:t}){return(0,e.jsx)(r,{marginTop:1,marginBottom:0,children:(0,e.jsx)(i,{bold:!0,children:t})})}export{T as a,h as b,C as c};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b as a}from"./chunk-KKZRPFWO.js";import{a as s}from"./chunk-V7QXJKX7.js";var i=class extends a{constructor(e,r){super(e,r)}headers(){return{Authorization:this.authHeader,"Content-Type":"application/json"}}async getTmsCredentials(){let e=await s(`${this.baseUrl}/auth/tms-credentials`,{method:"GET",headers:this.headers()});if(!e.ok)throw new Error(`Credential exchange failed: ${e.status} ${await e.text()}`);return await e.json()}async getPresignedUrls(e,r,n){let t=await s(`${this.baseUrl}/upload/presign`,{method:"POST",headers:this.headers(),body:JSON.stringify({test_id:e,session_id:r,files:n})});if(!t.ok)throw new Error(`Presign request failed: ${t.status} ${await t.text()}`);return await t.json()}async getScreenshotSas(){let e=await s(`${this.baseUrl}/upload/screenshot-sas`,{method:"GET",headers:this.headers()});if(!e.ok)throw new Error(`Screenshot SAS request failed: ${e.status} ${await e.text()}`);return await e.json()}async getCreditBalance(){let e=await s(`${this.baseUrl}/credits/balance`,{method:"GET",headers:this.headers()});if(!e.ok)throw new Error(`Credit balance request failed: ${e.status} ${await e.text()}`);return await e.json()}};export{i as a};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{d as a,h as c}from"./chunk-3ELBJPHQ.js";import{readFileSync as g,writeFileSync as n,mkdirSync as i,existsSync as p}from"fs";import{dirname as s}from"path";var o={window_size:{width:1920,height:1080},chrome_profile_path:"",default_url:c,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},last_seen_version:""},l=class{constructor(r=a){this.path=r}exists(){return p(this.path)}load(){try{let r=g(this.path,"utf-8"),e=JSON.parse(r);return{...o,...e,code_export:{...o.code_export,...e.code_export??{}}}}catch{return{...o,code_export:{...o.code_export}}}}set(r,e){try{let t=this.load();t[r]=e,i(s(this.path),{recursive:!0}),n(this.path,JSON.stringify(t,null,2)+`
2
+ import{d as a,h as c}from"./chunk-2FCAWRCU.js";import{readFileSync as g,writeFileSync as n,mkdirSync as i,existsSync as p}from"fs";import{dirname as s}from"path";var o={window_size:{width:1920,height:1080},chrome_profile_path:"",default_url:c,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},last_seen_version:""},l=class{constructor(r=a){this.path=r}exists(){return p(this.path)}load(){try{let r=g(this.path,"utf-8"),e=JSON.parse(r);return{...o,...e,code_export:{...o.code_export,...e.code_export??{}}}}catch{return{...o,code_export:{...o.code_export}}}}set(r,e){try{let t=this.load();t[r]=e,i(s(this.path),{recursive:!0}),n(this.path,JSON.stringify(t,null,2)+`
3
3
  `)}catch(t){let d=t instanceof Error?t.message:String(t);process.stderr.write(`[config] Failed to save config: ${d}
4
4
  `)}}save(r){try{let t={...this.load(),...r};i(s(this.path),{recursive:!0}),n(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}
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a}from"./chunk-V7QXJKX7.js";function c(n,r){return`Basic ${Buffer.from(`${n}:${r}`).toString("base64")}`}var u=class{constructor(r,e){this.baseUrl=r;typeof e=="string"?this.authHeader=`Bearer ${e}`:this.authHeader=c(e.username,e.accessKey)}authHeader;headers(){return{Authorization:this.authHeader,"Content-Type":"application/json",Accept:"application/json"}}async request(r,e,s,d){let o=new AbortController,i=setTimeout(()=>o.abort(),3e4);try{let t=await a(`${this.baseUrl}${e}`,{method:r,headers:{...this.headers(),...d},...s!==void 0?{body:JSON.stringify(s)}:{},signal:o.signal});if(clearTimeout(i),!t.ok){let g=await t.text();throw new Error(`${r} ${e} failed: ${t.status} ${g}`)}return(t.headers.get("content-type")??"").includes("application/json")?await t.json():await t.text()}catch(t){throw clearTimeout(i),t instanceof DOMException&&t.name==="AbortError"?new Error(`${r} ${e} timed out after 30s`):t}}};export{c as a,u as b};