@testmuai/kane-cli 0.4.0 → 0.4.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 (109) hide show
  1. package/dist/{ChromeProfilePicker-27QCT4NT.js → ChromeProfilePicker-HNP7QQ4J.js} +1 -1
  2. package/dist/{CliFeedbackPrompt-LMXDRY5F.js → CliFeedbackPrompt-OSNATI4W.js} +1 -1
  3. package/dist/{CliUploadProgress-QP5SPC7G.js → CliUploadProgress-7HRWDZ4P.js} +1 -1
  4. package/dist/ConfigView-PQH67FUK.js +2 -0
  5. package/dist/FolderPicker-SET7IG6S.js +2 -0
  6. package/dist/HelpView-HFKFRKG3.js +2 -0
  7. package/dist/{InfoBox-JELKGWY5.js → InfoBox-3IN3IZ2I.js} +1 -1
  8. package/dist/{LinksBox-NUSUOUIW.js → LinksBox-DI5QKX6K.js} +1 -1
  9. package/dist/{ProfilesView-RXYI2IS3.js → ProfilesView-N6XNSUHQ.js} +1 -1
  10. package/dist/ProjectPicker-6QIVHOO7.js +2 -0
  11. package/dist/{SaveSessionPrompt-GUBVAQ3O.js → SaveSessionPrompt-7CZHPNYK.js} +1 -1
  12. package/dist/SingleShotApp-A4VXMXEZ.js +2 -0
  13. package/dist/{SummaryBox-5Y2YYOUM.js → SummaryBox-7ZK2A6MA.js} +1 -1
  14. package/dist/TestMdRunView-KGHEZZBK.js +2 -0
  15. package/dist/WhoamiView-3E447A3G.js +2 -0
  16. package/dist/{changelog-N4SSER5V.js → changelog-ZBTZCYKI.js} +1 -1
  17. package/dist/chunk-34YRU7WM.js +6 -0
  18. package/dist/chunk-3QWAABMG.js +2 -0
  19. package/dist/{chunk-CKY3UXTY.js → chunk-4UKCDU64.js} +1 -1
  20. package/dist/{chunk-PWHFNSDC.js → chunk-4ZHU4DLD.js} +1 -1
  21. package/dist/{chunk-5TOE4RHH.js → chunk-7CBWZLRS.js} +1 -1
  22. package/dist/{chunk-PKQJHIKJ.js → chunk-AAJSF67A.js} +1 -1
  23. package/dist/{chunk-JCR3T34A.js → chunk-AKKATURY.js} +2 -2
  24. package/dist/chunk-BM25JQ3Z.js +17 -0
  25. package/dist/chunk-C6S4IEBC.js +2 -0
  26. package/dist/{chunk-TAEW7PXN.js → chunk-CZBHDBID.js} +1 -1
  27. package/dist/chunk-DGUXTSHM.js +11 -0
  28. package/dist/chunk-DQASLGFG.js +60 -0
  29. package/dist/{chunk-6NEJEMA6.js → chunk-EEF6OT52.js} +1 -1
  30. package/dist/{chunk-LMV2F35W.js → chunk-ELZIC2EH.js} +1 -1
  31. package/dist/chunk-FFTIDI5K.js +5 -0
  32. package/dist/chunk-FPFOW6BS.js +2 -0
  33. package/dist/{chunk-AT2Y5UNP.js → chunk-GNJBT6SS.js} +1 -1
  34. package/dist/{chunk-UJZCMEEH.js → chunk-H2P7UJAU.js} +1 -1
  35. package/dist/chunk-K4PLPKPF.js +5 -0
  36. package/dist/{chunk-7RPMUEEN.js → chunk-KPF3BPJ5.js} +1 -1
  37. package/dist/chunk-LOIRZFV3.js +10 -0
  38. package/dist/{chunk-O2UU4TS5.js → chunk-LOSNFBZV.js} +1 -1
  39. package/dist/chunk-LPUQ4HWQ.js +2 -0
  40. package/dist/chunk-LY5LHKGG.js +18 -0
  41. package/dist/chunk-NKFXY5TF.js +22 -0
  42. package/dist/chunk-OISHNB7D.js +2 -0
  43. package/dist/chunk-PF7PBYCJ.js +5 -0
  44. package/dist/{chunk-VS2BXLH4.js → chunk-PQIPYWTP.js} +1 -1
  45. package/dist/chunk-QXVI3LI4.js +6 -0
  46. package/dist/{chunk-CGAX3AXA.js → chunk-R7T6Z6QW.js} +1 -1
  47. package/dist/chunk-RCL22HDJ.js +2 -0
  48. package/dist/{chunk-XQXSPUIX.js → chunk-RD6G3CMN.js} +1 -1
  49. package/dist/chunk-RLSBAT6P.js +2 -0
  50. package/dist/chunk-S7JV4A3U.js +2 -0
  51. package/dist/{chunk-IH45REQA.js → chunk-TQGNNJX5.js} +1 -1
  52. package/dist/{chunk-VTDVK3DK.js → chunk-UHGECBEN.js} +1 -1
  53. package/dist/chunk-VBZIIF5N.js +17 -0
  54. package/dist/chunk-VL57GII7.js +2 -0
  55. package/dist/chunk-WFSTRBQF.js +2 -0
  56. package/dist/chunk-Y6IUJZMV.js +2 -0
  57. package/dist/{chunk-HYVAYSRZ.js → chunk-YB67GRWE.js} +1 -1
  58. package/dist/exit-manager-V2NW7A7U.js +2 -0
  59. package/dist/generate-headless-WL6A6ACX.js +21 -0
  60. package/dist/index.js +41 -31
  61. package/dist/list-commands-MK4W3Q7O.js +2 -0
  62. package/dist/login-flow-CDR6ARK3.js +2 -0
  63. package/dist/{persist-recorded-session-VEFILVPX.js → persist-recorded-session-A5EJ25AE.js} +1 -1
  64. package/dist/{pipeline-3GVPCDRE.js → pipeline-L5TDZMLS.js} +1 -1
  65. package/dist/{recording-banner-WS4Y7LVH.js → recording-banner-6UI6NNRK.js} +1 -1
  66. package/dist/require-project-folder-J5WZR653.js +2 -0
  67. package/dist/resolver-IDCGRPFJ.js +2 -0
  68. package/dist/run-test-md-I76IV7QA.js +14 -0
  69. package/dist/scrollback-6GINSTL2.js +2 -0
  70. package/dist/skill-installer-ZLBRT4QP.js +3 -0
  71. package/dist/tcg-generate-R6P4QUGO.js +2 -0
  72. package/dist/testmd-actions-W2INQVTH.js +2 -0
  73. package/dist/{tms-client-R5ZIAOBH.js → tms-client-NNYXLXZK.js} +1 -1
  74. package/dist/token-refresh-4QLWR5ZI.js +2 -0
  75. package/dist/validate-basic-QUPVT2EV.js +2 -0
  76. package/dist/{version-check-LNKXGYZE.js → version-check-RVK5YKDZ.js} +1 -1
  77. package/package.json +8 -6
  78. package/dist/ConfigView-RQM2JY4K.js +0 -2
  79. package/dist/FolderPicker-YN2YQJXI.js +0 -2
  80. package/dist/HelpView-2IYG5AC3.js +0 -2
  81. package/dist/ProjectPicker-RUR7HH2P.js +0 -2
  82. package/dist/SingleShotApp-3XDTU2BU.js +0 -2
  83. package/dist/TestMdRunView-PPZPUVVZ.js +0 -2
  84. package/dist/WhoamiView-IJZUFJ7B.js +0 -2
  85. package/dist/chunk-3C7ATCDM.js +0 -2
  86. package/dist/chunk-3Z4EHIOW.js +0 -2
  87. package/dist/chunk-6IQWD272.js +0 -2
  88. package/dist/chunk-7CLUJYMW.js +0 -2
  89. package/dist/chunk-7G7ZLAJH.js +0 -5
  90. package/dist/chunk-BKXTOQWL.js +0 -5
  91. package/dist/chunk-BPF7TDRU.js +0 -2
  92. package/dist/chunk-DTFPHZE7.js +0 -62
  93. package/dist/chunk-H4XV224I.js +0 -6
  94. package/dist/chunk-H6OVTXJQ.js +0 -2
  95. package/dist/chunk-J37YPPCD.js +0 -2
  96. package/dist/chunk-JLOY7SNA.js +0 -14
  97. package/dist/chunk-L3RTVAPG.js +0 -6
  98. package/dist/chunk-LRF6UP42.js +0 -10
  99. package/dist/chunk-M5RHRHFC.js +0 -9
  100. package/dist/chunk-PN7LNQ7G.js +0 -5
  101. package/dist/chunk-SJ7VGRQU.js +0 -17
  102. package/dist/chunk-UVBDUDSL.js +0 -2
  103. package/dist/generate-headless-7UYAPXE5.js +0 -18
  104. package/dist/login-flow-LK7GAUCZ.js +0 -2
  105. package/dist/resolver-OA35IO7J.js +0 -2
  106. package/dist/run-test-md-SXZUOYSG.js +0 -14
  107. package/dist/tcg-generate-CEBFKKJE.js +0 -2
  108. package/dist/testmd-actions-IZPOBSTC.js +0 -2
  109. package/dist/validate-basic-Y73NBDAD.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-HYVAYSRZ.js";import"./chunk-AT2Y5UNP.js";import"./chunk-HCBYKLMW.js";import"./chunk-3Z4EHIOW.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-YB67GRWE.js";import"./chunk-GNJBT6SS.js";import"./chunk-3QWAABMG.js";import"./chunk-HCBYKLMW.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-H6OVTXJQ.js";import"./chunk-AT2Y5UNP.js";import"./chunk-HCBYKLMW.js";import"./chunk-3Z4EHIOW.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-OISHNB7D.js";import"./chunk-GNJBT6SS.js";import"./chunk-3QWAABMG.js";import"./chunk-HCBYKLMW.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-6IQWD272.js";import"./chunk-VS2BXLH4.js";import{a as c}from"./chunk-HCBYKLMW.js";import"./chunk-3Z4EHIOW.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-VL57GII7.js";import"./chunk-PQIPYWTP.js";import"./chunk-3QWAABMG.js";import{a as c}from"./chunk-HCBYKLMW.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};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as p,b as l,c as n}from"./chunk-UHGECBEN.js";import{v as o}from"./chunk-3QWAABMG.js";import{a as g}from"./chunk-HCBYKLMW.js";import{a,j as c}from"./chunk-C44QQJR4.js";import{a as R}from"./chunk-6YGTRKDT.js";import{e as t}from"./chunk-UR6MHSHU.js";var b=t(R(),1);var e=t(g(),1);function A({model:d,authLabel:v,profile:x,env:w,defaultUrl:u,projectId:r,projectName:s,folderId:i,folderName:f,windowSize:B,chromeProfile:C}){let h=r?s?`${s} (${r})`:r:"(none)",D=i?f?`${f} (${i})`:i:"(none)",{exit:m}=c();return(0,b.useEffect)(()=>{let P=setTimeout(()=>m(),50);return()=>clearTimeout(P)},[m]),(0,e.jsx)(a,{flexDirection:"column",children:(0,e.jsx)(p,{title:"Configuration",children:(0,e.jsxs)(a,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(n,{label:"Auth"}),(0,e.jsx)(l,{label:" method",value:v}),(0,e.jsx)(l,{label:" profile",value:x}),(0,e.jsx)(l,{label:" env",value:w}),(0,e.jsx)(n,{label:"Defaults"}),(0,e.jsx)(l,{label:" url",value:u??"(none)",valueColor:u?o.orange:o.dim}),(0,e.jsx)(l,{label:" model",value:d}),(0,e.jsx)(l,{label:" window",value:B}),(0,e.jsx)(l,{label:" project",value:h}),(0,e.jsx)(l,{label:" folder",value:D}),(0,e.jsx)(n,{label:"Paths"}),(0,e.jsx)(l,{label:" chrome",value:C,valueColor:o.dim})]})})})}export{A as ConfigView};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b}from"./chunk-4UKCDU64.js";import"./chunk-YCCUBQY4.js";import"./chunk-CZBHDBID.js";import"./chunk-LPUQ4HWQ.js";import"./chunk-NLCCBXXV.js";import"./chunk-S7JV4A3U.js";import"./chunk-RZ4F3BHX.js";import"./chunk-GNJBT6SS.js";import"./chunk-3QWAABMG.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.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 f,b as i,v as t}from"./chunk-3QWAABMG.js";import{a as T}from"./chunk-HCBYKLMW.js";import{a as n,b as o,j as p,k as x}from"./chunk-C44QQJR4.js";import{a as b}from"./chunk-6YGTRKDT.js";import{e as h}from"./chunk-UR6MHSHU.js";var w=h(b(),1);var e=h(T(),1),S="https://www.testmuai.com/support/docs/kane-cli-introduction",v="https://github.com/LambdaTest/kane-cli/issues";function k(){let{exit:l}=p(),{stdout:r}=x(),c=r?.columns??80;return(0,w.useEffect)(()=>{let m=setTimeout(()=>l(),50);return()=>clearTimeout(m)},[l]),(0,e.jsxs)(n,{flexDirection:"column",children:[(0,e.jsxs)(n,{paddingX:1,paddingTop:1,flexDirection:"column",children:[(0,e.jsx)(o,{color:t.orange,bold:!0,children:i}),(0,e.jsxs)(n,{children:[(0,e.jsx)(o,{color:t.dim,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)(g,{cmd:`${i}`,desc:"Single-shot prompt (no args, TTY)"}),(0,e.jsx)(g,{cmd:`${i} --tui`,desc:"Full interactive TUI",highlight:!0}),(0,e.jsx)(g,{cmd:`${i} run "<objective>"`,desc:"Inline objective"}),(0,e.jsx)(g,{cmd:`${i} testmd run <path>.md`,desc:"Replay a saved *_test.md file"})]}),(0,e.jsxs)(d,{title:"HELP",children:[(0,e.jsx)(g,{cmd:`${i} --help`,desc:"Show this help (long form)"}),(0,e.jsx)(g,{cmd:`${i} -h`,desc:"Show this help (short form)"}),(0,e.jsx)(g,{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.dim,children:["These are the only supported help invocations. Anything else (e.g. ",(0,e.jsx)(o,{color:t.orange,children:"-help"}),") is an unknown flag."]}),(0,e.jsxs)(o,{color:t.dim,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.dim,children:[(0,e.jsx)(o,{color:t.orange,children:"*_test.md"})," \u2014 markdown test files with YAML frontmatter and ",(0,e.jsx)(o,{color:t.orange,children:"## "}),"step headings."]}),(0,e.jsxs)(o,{color:t.dim,children:["Run with ",(0,e.jsxs)(o,{color:t.orange,children:[i," testmd run path/to/foo_test.md"]}),". (`.md` paths are not accepted by `",i," run`.)"]}),(0,e.jsxs)(o,{color:t.dim,children:["Sessions you run in TUI auto-save to ",(0,e.jsx)(o,{color:t.orange,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(c-2,70))}),(0,e.jsxs)(n,{gap:3,children:[(0,e.jsxs)(n,{children:[(0,e.jsx)(o,{color:t.dim,children:"Docs "}),(0,e.jsx)(o,{color:t.orange,underline:!0,children:S})]}),(0,e.jsxs)(n,{children:[(0,e.jsx)(o,{color:t.dim,children:"Bugs "}),(0,e.jsx)(o,{color:t.orange,underline:!0,children:v})]})]})]}),(0,e.jsx)(o,{children:" "})]})}function d({title:l,children:r}){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.dim,children:l})}),r]})}function g({cmd:l,desc:r,highlight:c}){return(0,e.jsxs)(n,{marginLeft:2,children:[(0,e.jsxs)(n,{width:40,children:[(0,e.jsx)(o,{color:t.dim,children:"$ "}),(0,e.jsx)(o,{color:c?t.orange:t.orange,children:l})]}),(0,e.jsx)(o,{color:t.dim,children:r})]})}function a({cmd:l,args:r,desc:c,highlight:m}){return(0,e.jsxs)(n,{marginLeft:2,children:[(0,e.jsx)(n,{width:16,children:(0,e.jsx)(o,{color:m?t.orange:t.green,bold:!0,children:l})}),(0,e.jsx)(n,{width:32,children:r?(0,e.jsx)(o,{color:t.dim,children:r}):null}),(0,e.jsx)(o,{color:t.dim,children:c})]})}function s({long:l,arg:r,desc:c,highlight:m}){return(0,e.jsxs)(n,{marginLeft:2,children:[(0,e.jsxs)(n,{width:30,children:[(0,e.jsx)(o,{color:m?t.orange:t.orange,children:l}),r&&(0,e.jsxs)(o,{color:t.dim,children:[" ",r]})]}),(0,e.jsx)(o,{color:t.dim,children:c})]})}function u({label:l,cmd:r}){return(0,e.jsxs)(n,{marginLeft:2,flexDirection:"column",children:[(0,e.jsxs)(o,{color:t.dim,children:["# ",l]}),(0,e.jsxs)(o,{color:t.orange,children:["$ ",r]})]})}export{k as HelpView};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-5TOE4RHH.js";import"./chunk-VTDVK3DK.js";import"./chunk-HCBYKLMW.js";import"./chunk-3Z4EHIOW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as InfoBox};
2
+ import{a}from"./chunk-7CBWZLRS.js";import"./chunk-UHGECBEN.js";import"./chunk-3QWAABMG.js";import"./chunk-HCBYKLMW.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-XQXSPUIX.js";import"./chunk-HCBYKLMW.js";import"./chunk-3Z4EHIOW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as LinksBox};
2
+ import{a}from"./chunk-RD6G3CMN.js";import"./chunk-3QWAABMG.js";import"./chunk-HCBYKLMW.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-LMV2F35W.js";import"./chunk-AT2Y5UNP.js";import"./chunk-HCBYKLMW.js";import"./chunk-3Z4EHIOW.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-ELZIC2EH.js";import"./chunk-GNJBT6SS.js";import"./chunk-3QWAABMG.js";import"./chunk-HCBYKLMW.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-4ZHU4DLD.js";import"./chunk-YCCUBQY4.js";import"./chunk-CZBHDBID.js";import"./chunk-LPUQ4HWQ.js";import"./chunk-NLCCBXXV.js";import"./chunk-S7JV4A3U.js";import"./chunk-RZ4F3BHX.js";import"./chunk-GNJBT6SS.js";import"./chunk-3QWAABMG.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.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-CGAX3AXA.js";import"./chunk-S3DAAAE5.js";import"./chunk-5TOE4RHH.js";import"./chunk-VTDVK3DK.js";import"./chunk-HCBYKLMW.js";import"./chunk-3Z4EHIOW.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-R7T6Z6QW.js";import"./chunk-S3DAAAE5.js";import"./chunk-7CBWZLRS.js";import"./chunk-UHGECBEN.js";import"./chunk-3QWAABMG.js";import"./chunk-HCBYKLMW.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{a}from"./chunk-AAJSF67A.js";import"./chunk-DGUXTSHM.js";import"./chunk-BM25JQ3Z.js";import"./chunk-L5LI2JF4.js";import"./chunk-H2P7UJAU.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-4ZHU4DLD.js";import"./chunk-4UKCDU64.js";import"./chunk-YCCUBQY4.js";import"./chunk-CZBHDBID.js";import"./chunk-LOIRZFV3.js";import"./chunk-LPUQ4HWQ.js";import"./chunk-NLCCBXXV.js";import"./chunk-VE3SUJMA.js";import"./chunk-PF7PBYCJ.js";import"./chunk-WFSTRBQF.js";import"./chunk-S7JV4A3U.js";import"./chunk-RZ4F3BHX.js";import"./chunk-GNJBT6SS.js";import"./chunk-3QWAABMG.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.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,b,c,d}from"./chunk-IH45REQA.js";import"./chunk-5TOE4RHH.js";import"./chunk-VTDVK3DK.js";import"./chunk-HCBYKLMW.js";import"./chunk-3Z4EHIOW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{d as AutoExitSummaryBox,c as SummaryBox,b as buildSummaryEvent,a as buildSummaryRendered};
2
+ import{a,b,c,d}from"./chunk-TQGNNJX5.js";import"./chunk-7CBWZLRS.js";import"./chunk-UHGECBEN.js";import"./chunk-3QWAABMG.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{d as AutoExitSummaryBox,c as SummaryBox,b as buildSummaryEvent,a as buildSummaryRendered};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{h as a}from"./chunk-FFTIDI5K.js";import"./chunk-K4PLPKPF.js";import"./chunk-PQIPYWTP.js";import"./chunk-LOIRZFV3.js";import"./chunk-S7JV4A3U.js";import"./chunk-7CBWZLRS.js";import"./chunk-UHGECBEN.js";import"./chunk-C6S4IEBC.js";import"./chunk-3QWAABMG.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as TestMdRunView};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as b,b as r}from"./chunk-UHGECBEN.js";import{v as o}from"./chunk-3QWAABMG.js";import{a as p}from"./chunk-HCBYKLMW.js";import{a as i,b as l,j as s}from"./chunk-C44QQJR4.js";import{a as T}from"./chunk-6YGTRKDT.js";import{e as a}from"./chunk-UR6MHSHU.js";var f=a(T(),1);var e=a(p(),1);function V({profile:g,env:v,authenticated:n,authMethod:h,username:c,tokenStatus:t,expiresAt:d,serverStatus:u,detail:m}){let{exit:x}=s();return(0,f.useEffect)(()=>{let B=setTimeout(()=>x(),50);return()=>clearTimeout(B)},[x]),(0,e.jsx)(i,{flexDirection:"column",children:(0,e.jsx)(b,{title:"Identity",variant:n?"success":"warning",children:(0,e.jsxs)(i,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(i,{children:u==="rejected"?(0,e.jsx)(l,{color:o.red,bold:!0,children:"\u2717 Not authenticated"}):u==="unreachable"?(0,e.jsx)(l,{color:o.orange,bold:!0,children:"\u26A0 Couldn't verify"}):n?(0,e.jsx)(l,{color:o.green,bold:!0,children:"\u2713 Authenticated"}):(0,e.jsx)(l,{color:o.orange,bold:!0,children:"\u26A0 Not logged in"})}),(0,e.jsxs)(i,{flexDirection:"column",marginTop:1,children:[(0,e.jsx)(r,{label:"Profile",value:g}),(0,e.jsx)(r,{label:"Environment",value:v}),(0,e.jsx)(r,{label:"Method",value:h}),c&&(0,e.jsx)(r,{label:"User",value:c}),t&&(0,e.jsx)(r,{label:"Token",value:t,valueColor:t==="valid"?o.green:t==="expired"?o.red:o.dim}),d&&(0,e.jsx)(r,{label:"Expires",value:d}),m&&(0,e.jsx)(r,{label:"Detail",value:m})]})]})})})}export{V as WhoamiView};
@@ -1,4 +1,4 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as i,f as c}from"./chunk-3Z4EHIOW.js";import{a as l}from"./chunk-RZ4F3BHX.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(`
2
+ import{a as l}from"./chunk-RZ4F3BHX.js";import{c as i,f as c}from"./chunk-3QWAABMG.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
3
  `).filter(a=>a.trim());for(let a of o)t.push(` ${a}`)}t.push("")}return t.join(`
4
4
  `)}export{A as fetchChangelog,v as formatChangelog};
@@ -0,0 +1,6 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b as l,d,e as m,f as g,g as S,k as y}from"./chunk-AH4AXJML.js";import{a as u}from"./chunk-H2P7UJAU.js";import{g as p,h as f}from"./chunk-LOIRZFV3.js";import{existsSync as s,mkdirSync as h,readFileSync as C,renameSync as w,writeFileSync as R}from"fs";import{join as x}from"path";function G(e){y(l(e));let r=l(e);if(!s(r))return;let n=x(r,"meta.json"),o=m(e);if(s(n)&&!s(o))try{h(d(e),{recursive:!0}),w(n,o)}catch(t){process.stderr.write(`warn: meta.json migration failed: ${t.message}
3
+ `)}let a=S(e);if(s(a)){let t="python";try{let i=new u().load();i.code_export?.language&&(t=i.code_export.language)}catch{}let c=g(e,"playwright",t);if(!s(c))try{w(a,c)}catch(i){process.stderr.write(`warn: generated-code migration failed: ${i.message}
4
+ `)}}if(s(o))try{let t=JSON.parse(C(o,"utf8"));"md5sum"in t&&(delete t.md5sum,R(o,JSON.stringify(t,null,2)+`
5
+ `,"utf8"))}catch(t){process.stderr.write(`warn: meta.json md5sum strip failed: ${t.message}
6
+ `)}}async function O(e){if(!e.isInteractive)return{recovered:!1};if(E(e.creds))return{recovered:!1};let{SingleShotApp:r}=await import("./SingleShotApp-A4VXMXEZ.js"),{ScrollbackProvider:n}=await import("./scrollback-6GINSTL2.js"),{render:o}=await import("./build-JIKYOZUH.js"),a=await import("./react-QWOAB3TB.js"),t={current:null},c={current:!1},{waitUntilExit:i,unmount:v}=o(a.default.createElement(n,null,a.default.createElement(r,{resultRef:t,mode:"login",loginCompleteRef:c})),{exitOnCtrlC:!1});f(()=>v()),await i();try{process.stdin.setRawMode?.(!1)}catch{}return process.stdout.write("\x1B[?25h"),c.current?{recovered:!0}:(p(0,"Startup gate cancelled"),{recovered:!1})}function E(e){let r=e.getActiveProfile(),n=e.getDefaultEnv();if(!r||!!!(e.loadBasicAuth(r,n)||e.loadCredentials(r,n)))return!1;let a=e.loadProfileConfig(r,n)??{};return!!a.project_id&&!!a.folder_id}export{G as a,O as b};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{homedir as e}from"os";import{join as t}from"path";var i="0.4.2",m="kane-cli",s=t(e(),".testmuai","kaneai"),d=t(s,"profiles"),g=t(s,"tui-config.json"),h="https://registry.npmjs.org/@testmuai/kane-cli",L="https://api.github.com/repos/LambdaTest/kane-cli/releases",o="@testmuai/kane-cli-skill",_=`https://registry.npmjs.org/${o}`,a="kane-cli",A=[{dir:t(e(),".claude","skills",a),agent:"Claude Code"},{dir:t(e(),".agents","skills",a),agent:"Codex CLI"},{dir:t(e(),".gemini","skills",a),agent:"Gemini CLI"}],x="https://dd-proxy.lambdatest.com/intake/kane-cli",u="https://kaneai-playground.lambdatest.io",U=9222,R=9230,b=t(s,"chrome-profiles"),n="127.0.0.1",C=18392,E=18400,p="/callback";function I(r){return`http://${n}:${r}${p}`}var P="KANE CLI",S="*",T={prod:{authBaseUrl:"https://auth.lambdatest.com",consentUrl:"https://accounts.lambdatest.com",controllerBaseUrl:"https://kaneai-api.lambdatest.com/v16-controller/v1",tmsBaseUrl:"https://test-manager-api.lambdatest.com/api",testGeneratorBaseUrl:"https://test-manager-api.lambdatest.com",secretsBaseUrl:"https://api-hyperexecute.lambdatest.com",testManagerUiUrl:"https://test-manager.lambdatest.com",shareApiBaseUrl:"https://api.lambdatest.com",v16ServerHost:"https://kaneai-api.lambdatest.com/v16-server"},stage:{authBaseUrl:"https://stage-auth.lambdatestinternal.com",consentUrl:"https://stage-accounts.lambdatestinternal.com",controllerBaseUrl:"https://auteur-stage-automind.lambdatestinternal.com/v16-controller/v1",tmsBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com/api",testGeneratorBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com",secretsBaseUrl:"https://api-stage-hyperexecute.lambdatestinternal.com",testManagerUiUrl:"https://stage-test-manager.lambdatestinternal.com",shareApiBaseUrl:"https://stage-api.lambdatestinternal.com",v16ServerHost:"https://auteur-stage-automind.lambdatestinternal.com/v16-server"}},B={orange:"#ff9500",generateAccent:"#0d9488",purple:"#b388ff",secondary:"#888888",dim:"#666666",muted:"#444444",green:"#4ade80",red:"#ef4444"};export{i as a,m as b,s as c,g as d,h as e,L as f,o as g,A as h,x as i,u as j,U as k,R as l,b as m,n,C as o,E as p,p as q,I as r,P as s,S as t,T as u,B as v};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as A}from"./chunk-YCCUBQY4.js";import{a as _}from"./chunk-TAEW7PXN.js";import{a as B}from"./chunk-J37YPPCD.js";import{a as R}from"./chunk-AT2Y5UNP.js";import{a as P}from"./chunk-HCBYKLMW.js";import{t as c}from"./chunk-3Z4EHIOW.js";import{a as u,b as l}from"./chunk-C44QQJR4.js";import{a as J}from"./chunk-6YGTRKDT.js";import{a as k}from"./chunk-7CLUJYMW.js";import{e as L}from"./chunk-UR6MHSHU.js";var t=L(J(),1);var e=L(P(),1);function X(n,i,y,m){return{id:n,label:`${i} (${n}) \xB7 ${y} tests`,isActive:n===m}}function W({resolver:n,projectId:i,currentFolderId:y,env:m,onSelect:x,onCancel:w}){let[I,M]=(0,t.useState)([]),[$,d]=(0,t.useState)(!0),[O,g]=(0,t.useState)(!1),[U,N]=(0,t.useState)(null),[p,b]=(0,t.useState)("list"),[S,v]=(0,t.useState)(""),[E,f]=(0,t.useState)(null),h=(0,t.useRef)(!1);(0,t.useEffect)(()=>{if(!n){N("Login first to browse folders"),d(!1);return}let o=new AbortController;return d(!0),g(!0),(async()=>{try{let r=n.cached??await n.resolve();if(!r){N("Login first to browse folders"),d(!1),g(!1);return}let a=B(m),T=new k(a.tmsBaseUrl,r.username,r.access_key),F=(async function*(){if(o.signal.aborted)return;let s=await T.listFolders(i);yield{page:1,folders:s,totalLoaded:s.length,done:!0}})();for await(let s of F){if(d(!1),s.totalLoaded===0){h.current=!0,b("naming"),g(!1);return}M(s.folders.map(C=>X(C.id,C.name,C.test_cases_count,y))),s.done&&g(!1)}}catch(r){if(r?.name==="AbortError")return;N(r instanceof Error?r.message:String(r)),d(!1),g(!1)}})(),()=>o.abort()},[n,i,y,m]);let D=(0,t.useCallback)(o=>{let r=o.trim();if(!r){f("Name cannot be empty");return}if(!i){f("No project selected \u2014 pick a project first");return}f(null),b("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 T=B(m),s=await new k(T.tmsBaseUrl,a.username,a.access_key).createFolder(i,r);x(s.id,s.name)}catch(a){f(a instanceof Error?a.message:String(a)),b("naming")}})()},[n,i,m,x]),H=(0,t.useCallback)(()=>{v(""),f(null),h.current?w():b("list")},[w]);return p==="naming"||p==="creating"?(0,e.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:c.orange,paddingX:2,paddingY:1,children:[(0,e.jsx)(l,{color:c.orange,bold:!0,children:"Create new folder"}),h.current&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.dim,children:"No folders yet \u2014 let's create one."})}),(0,e.jsxs)(u,{marginTop:1,children:[(0,e.jsx)(l,{color:c.dim,children:"Name: "}),p==="naming"?(0,e.jsx)(A,{value:S,onChange:o=>{v(o),E&&f(null)},onSubmit:D,onCancel:H}):(0,e.jsx)(l,{children:S})]}),E&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.red,children:E})}),p==="creating"&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.dim,children:"Creating..."})}),p==="naming"&&(0,e.jsx)(R,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:h.current?"cancel":"back"})]}):(0,e.jsx)(_,{title:"Folders",items:I,loading:$,loadingMore:O,preserveSelectionById:!0,error:U,itemNoun:"folders",onTab:()=>{h.current=!1,b("naming")},extraHint:"tab to create new",onSelect:o=>{let r=o.label.split(" (")[0];x(o.id,r)},onCancel:w})}export{X as a,W as b};
2
+ import{a as A}from"./chunk-YCCUBQY4.js";import{a as _}from"./chunk-CZBHDBID.js";import{a as k}from"./chunk-LPUQ4HWQ.js";import{a as B}from"./chunk-S7JV4A3U.js";import{a as R}from"./chunk-GNJBT6SS.js";import{v as c}from"./chunk-3QWAABMG.js";import{a as P}from"./chunk-HCBYKLMW.js";import{a as u,b as l}from"./chunk-C44QQJR4.js";import{a as J}from"./chunk-6YGTRKDT.js";import{e as L}from"./chunk-UR6MHSHU.js";var t=L(J(),1);var e=L(P(),1);function X(n,i,y,m){return{id:n,label:`${i} (${n}) \xB7 ${y} tests`,isActive:n===m}}function W({resolver:n,projectId:i,currentFolderId:y,env:m,onSelect:x,onCancel:w}){let[I,M]=(0,t.useState)([]),[$,d]=(0,t.useState)(!0),[O,g]=(0,t.useState)(!1),[U,N]=(0,t.useState)(null),[p,b]=(0,t.useState)("list"),[S,v]=(0,t.useState)(""),[E,f]=(0,t.useState)(null),h=(0,t.useRef)(!1);(0,t.useEffect)(()=>{if(!n){N("Login first to browse folders"),d(!1);return}let o=new AbortController;return d(!0),g(!0),(async()=>{try{let r=n.cached??await n.resolve();if(!r){N("Login first to browse folders"),d(!1),g(!1);return}let a=B(m),T=new k(a.tmsBaseUrl,r.username,r.access_key),F=(async function*(){if(o.signal.aborted)return;let s=await T.listFolders(i);yield{page:1,folders:s,totalLoaded:s.length,done:!0}})();for await(let s of F){if(d(!1),s.totalLoaded===0){h.current=!0,b("naming"),g(!1);return}M(s.folders.map(C=>X(C.id,C.name,C.test_cases_count,y))),s.done&&g(!1)}}catch(r){if(r?.name==="AbortError")return;N(r instanceof Error?r.message:String(r)),d(!1),g(!1)}})(),()=>o.abort()},[n,i,y,m]);let D=(0,t.useCallback)(o=>{let r=o.trim();if(!r){f("Name cannot be empty");return}if(!i){f("No project selected \u2014 pick a project first");return}f(null),b("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 T=B(m),s=await new k(T.tmsBaseUrl,a.username,a.access_key).createFolder(i,r);x(s.id,s.name)}catch(a){f(a instanceof Error?a.message:String(a)),b("naming")}})()},[n,i,m,x]),H=(0,t.useCallback)(()=>{v(""),f(null),h.current?w():b("list")},[w]);return p==="naming"||p==="creating"?(0,e.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:c.orange,paddingX:2,paddingY:1,children:[(0,e.jsx)(l,{color:c.orange,bold:!0,children:"Create new folder"}),h.current&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.dim,children:"No folders yet \u2014 let's create one."})}),(0,e.jsxs)(u,{marginTop:1,children:[(0,e.jsx)(l,{color:c.dim,children:"Name: "}),p==="naming"?(0,e.jsx)(A,{value:S,onChange:o=>{v(o),E&&f(null)},onSubmit:D,onCancel:H}):(0,e.jsx)(l,{children:S})]}),E&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.red,children:E})}),p==="creating"&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.dim,children:"Creating..."})}),p==="naming"&&(0,e.jsx)(R,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:h.current?"cancel":"back"})]}):(0,e.jsx)(_,{title:"Folders",items:I,loading:$,loadingMore:O,preserveSelectionById:!0,error:U,itemNoun:"folders",onTab:()=>{h.current=!1,b("naming")},extraHint:"tab to create new",onSelect:o=>{let r=o.label.split(" (")[0];x(o.id,r)},onCancel:w})}export{X as a,W as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as $}from"./chunk-YCCUBQY4.js";import{a as U}from"./chunk-TAEW7PXN.js";import{a as k}from"./chunk-J37YPPCD.js";import{a as _}from"./chunk-AT2Y5UNP.js";import{a as O}from"./chunk-HCBYKLMW.js";import{t as i}from"./chunk-3Z4EHIOW.js";import{a as u,b as s}from"./chunk-C44QQJR4.js";import{a as K}from"./chunk-6YGTRKDT.js";import{a as T}from"./chunk-7CLUJYMW.js";import{e as S}from"./chunk-UR6MHSHU.js";var e=S(K(),1);var r=S(O(),1);function V(n,x,c){return{id:n,label:`${x} (${n})`,isActive:n===c}}function se({resolver:n,currentProjectId:x,env:c,onSelect:w,onCancel:C}){let[q,B]=(0,e.useState)([]),[D,l]=(0,e.useState)(!0),[H,m]=(0,e.useState)(!1),[J,g]=(0,e.useState)(!1),[Q,P]=(0,e.useState)(null),[d,p]=(0,e.useState)("list"),[v,R]=(0,e.useState)(""),[E,h]=(0,e.useState)(null),[I,X]=(0,e.useState)(""),b=(0,e.useRef)(!1),A=(0,e.useRef)(!0);(0,e.useEffect)(()=>{if(!n){P("Login first to browse projects"),l(!1);return}let o=new AbortController,a=I.trim();return A.current?l(!0):a&&g(!0),m(!0),P(null),(async()=>{try{let t=n.cached??await n.resolve();if(!t){P("Login first to browse projects"),l(!1),m(!1),g(!1);return}let L=k(c),F=new T(L.tmsBaseUrl,t.username,t.access_key),f=!0,N=0,G=a?{signal:o.signal,name:a,perPage:10}:{signal:o.signal,perPage:10};for await(let y of F.listProjectsStream(G)){if(f&&(l(!1),g(!1),A.current=!1,f=!1),y.totalLoaded===0&&y.done&&N===0&&!a){b.current=!0,p("naming"),m(!1);return}let M=y.projects.map(j=>V(j.project_id,j.name,x));B(N===0?M:j=>[...j,...M]),N+=y.projects.length,y.done&&m(!1)}f&&(l(!1),m(!1),g(!1))}catch(t){if(t?.name==="AbortError")return;P(t instanceof Error?t.message:String(t)),l(!1),m(!1),g(!1)}})(),()=>o.abort()},[n,x,c,I]);let Y=(0,e.useCallback)(o=>{let a=o.trim();if(!a){h("Name cannot be empty");return}h(null),p("creating"),(async()=>{try{if(!n)throw new Error("Not authenticated");let t=n.cached??await n.resolve();if(!t)throw new Error("Not authenticated");let L=k(c),f=await new T(L.tmsBaseUrl,t.username,t.access_key).createProject(a);w(f.id,f.name)}catch(t){h(t instanceof Error?t.message:String(t)),p("naming")}})()},[n,c,w]),z=(0,e.useCallback)(()=>{R(""),h(null),b.current?C():p("list")},[C]);return d==="naming"||d==="creating"?(0,r.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:i.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(s,{color:i.orange,bold:!0,children:"Create new project"}),b.current&&(0,r.jsx)(u,{marginTop:1,children:(0,r.jsx)(s,{color:i.dim,children:"No projects yet \u2014 let's create one."})}),(0,r.jsxs)(u,{marginTop:1,children:[(0,r.jsx)(s,{color:i.dim,children:"Name: "}),d==="naming"?(0,r.jsx)($,{value:v,onChange:o=>{R(o),E&&h(null)},onSubmit:Y,onCancel:z}):(0,r.jsx)(s,{children:v})]}),E&&(0,r.jsx)(u,{marginTop:1,children:(0,r.jsx)(s,{color:i.red,children:E})}),d==="creating"&&(0,r.jsx)(u,{marginTop:1,children:(0,r.jsx)(s,{color:i.dim,children:"Creating..."})}),d==="naming"&&(0,r.jsx)(_,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:b.current?"cancel":"back"})]}):(0,r.jsx)(U,{title:"Projects",items:q,loading:D,loadingMore:H,searching:J,preserveSelectionById:!0,onSearch:X,error:Q,itemNoun:"projects",onTab:()=>{b.current=!1,p("naming")},extraHint:"tab to create new",onSelect:o=>{let a=o.label.replace(` (${o.id})`,"");w(o.id,a)},onCancel:C})}export{V as a,se as b};
2
+ import{a as $}from"./chunk-YCCUBQY4.js";import{a as U}from"./chunk-CZBHDBID.js";import{a as T}from"./chunk-LPUQ4HWQ.js";import{a as k}from"./chunk-S7JV4A3U.js";import{a as _}from"./chunk-GNJBT6SS.js";import{v as i}from"./chunk-3QWAABMG.js";import{a as O}from"./chunk-HCBYKLMW.js";import{a as u,b as s}from"./chunk-C44QQJR4.js";import{a as K}from"./chunk-6YGTRKDT.js";import{e as S}from"./chunk-UR6MHSHU.js";var e=S(K(),1);var r=S(O(),1);function V(n,x,c){return{id:n,label:`${x} (${n})`,isActive:n===c}}function se({resolver:n,currentProjectId:x,env:c,onSelect:w,onCancel:C}){let[q,B]=(0,e.useState)([]),[D,l]=(0,e.useState)(!0),[H,m]=(0,e.useState)(!1),[J,g]=(0,e.useState)(!1),[Q,P]=(0,e.useState)(null),[d,p]=(0,e.useState)("list"),[v,R]=(0,e.useState)(""),[E,h]=(0,e.useState)(null),[I,X]=(0,e.useState)(""),b=(0,e.useRef)(!1),A=(0,e.useRef)(!0);(0,e.useEffect)(()=>{if(!n){P("Login first to browse projects"),l(!1);return}let o=new AbortController,a=I.trim();return A.current?l(!0):a&&g(!0),m(!0),P(null),(async()=>{try{let t=n.cached??await n.resolve();if(!t){P("Login first to browse projects"),l(!1),m(!1),g(!1);return}let L=k(c),F=new T(L.tmsBaseUrl,t.username,t.access_key),f=!0,N=0,G=a?{signal:o.signal,name:a,perPage:10}:{signal:o.signal,perPage:10};for await(let y of F.listProjectsStream(G)){if(f&&(l(!1),g(!1),A.current=!1,f=!1),y.totalLoaded===0&&y.done&&N===0&&!a){b.current=!0,p("naming"),m(!1);return}let M=y.projects.map(j=>V(j.project_id,j.name,x));B(N===0?M:j=>[...j,...M]),N+=y.projects.length,y.done&&m(!1)}f&&(l(!1),m(!1),g(!1))}catch(t){if(t?.name==="AbortError")return;P(t instanceof Error?t.message:String(t)),l(!1),m(!1),g(!1)}})(),()=>o.abort()},[n,x,c,I]);let Y=(0,e.useCallback)(o=>{let a=o.trim();if(!a){h("Name cannot be empty");return}h(null),p("creating"),(async()=>{try{if(!n)throw new Error("Not authenticated");let t=n.cached??await n.resolve();if(!t)throw new Error("Not authenticated");let L=k(c),f=await new T(L.tmsBaseUrl,t.username,t.access_key).createProject(a);w(f.id,f.name)}catch(t){h(t instanceof Error?t.message:String(t)),p("naming")}})()},[n,c,w]),z=(0,e.useCallback)(()=>{R(""),h(null),b.current?C():p("list")},[C]);return d==="naming"||d==="creating"?(0,r.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:i.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(s,{color:i.orange,bold:!0,children:"Create new project"}),b.current&&(0,r.jsx)(u,{marginTop:1,children:(0,r.jsx)(s,{color:i.dim,children:"No projects yet \u2014 let's create one."})}),(0,r.jsxs)(u,{marginTop:1,children:[(0,r.jsx)(s,{color:i.dim,children:"Name: "}),d==="naming"?(0,r.jsx)($,{value:v,onChange:o=>{R(o),E&&h(null)},onSubmit:Y,onCancel:z}):(0,r.jsx)(s,{children:v})]}),E&&(0,r.jsx)(u,{marginTop:1,children:(0,r.jsx)(s,{color:i.red,children:E})}),d==="creating"&&(0,r.jsx)(u,{marginTop:1,children:(0,r.jsx)(s,{color:i.dim,children:"Creating..."})}),d==="naming"&&(0,r.jsx)(_,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:b.current?"cancel":"back"})]}):(0,r.jsx)(U,{title:"Projects",items:q,loading:D,loadingMore:H,searching:J,preserveSelectionById:!0,onSearch:X,error:Q,itemNoun:"projects",onTab:()=>{b.current=!1,p("naming")},extraHint:"tab to create new",onSelect:o=>{let a=o.label.replace(` (${o.id})`,"");w(o.id,a)},onCancel:C})}export{V as a,se as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as u,b as x}from"./chunk-VTDVK3DK.js";import{a as f}from"./chunk-HCBYKLMW.js";import{t as m}from"./chunk-3Z4EHIOW.js";import{a as r,b as i}from"./chunk-C44QQJR4.js";import{e as n}from"./chunk-UR6MHSHU.js";var e=n(f(),1);function C({title:B,titleColor:c,borderColor:d,variant:p,rows:s,footer:t,labelWidth:l=14,marginBottom:b=1}){return(0,e.jsxs)(u,{title:B,titleColor:c,borderColor:d,variant:p,marginBottom:b,children:[s.map((o,a)=>typeof o.value=="string"?(0,e.jsx)(x,{label:o.label,value:o.value,valueColor:o.valueColor,labelWidth:l},`${o.label}-${a}`):(0,e.jsxs)(r,{children:[(0,e.jsx)(r,{width:l,children:(0,e.jsx)(i,{color:m.dim,children:o.label})}),o.value]},`${o.label}-${a}`)),t&&(0,e.jsx)(r,{marginTop:1,children:t})]})}export{C as a};
2
+ import{a as u,b as x}from"./chunk-UHGECBEN.js";import{v as m}from"./chunk-3QWAABMG.js";import{a as f}from"./chunk-HCBYKLMW.js";import{a as r,b as i}from"./chunk-C44QQJR4.js";import{e as n}from"./chunk-UR6MHSHU.js";var e=n(f(),1);function C({title:B,titleColor:c,borderColor:d,variant:p,rows:s,footer:t,labelWidth:l=14,marginBottom:b=1}){return(0,e.jsxs)(u,{title:B,titleColor:c,borderColor:d,variant:p,marginBottom:b,children:[s.map((o,a)=>typeof o.value=="string"?(0,e.jsx)(x,{label:o.label,value:o.value,valueColor:o.valueColor,labelWidth:l},`${o.label}-${a}`):(0,e.jsxs)(r,{children:[(0,e.jsx)(r,{width:l,children:(0,e.jsx)(i,{color:m.dim,children:o.label})}),o.value]},`${o.label}-${a}`)),t&&(0,e.jsx)(r,{marginTop:1,children:t})]})}export{C as a};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as K,b as V,c as z,d as ee,e as te}from"./chunk-M5RHRHFC.js";import{b as J}from"./chunk-SJ7VGRQU.js";import{a as Q}from"./chunk-UJZCMEEH.js";import{g as E}from"./chunk-LRF6UP42.js";import{b as H}from"./chunk-PWHFNSDC.js";import{b as W}from"./chunk-CKY3UXTY.js";import{a as k,b as A,d as Y}from"./chunk-VE3SUJMA.js";import{a as q}from"./chunk-7G7ZLAJH.js";import{a as Z}from"./chunk-BPF7TDRU.js";import{a as _}from"./chunk-J37YPPCD.js";import{a as G}from"./chunk-HCBYKLMW.js";import{a as c,b as u,i as I,j as X}from"./chunk-C44QQJR4.js";import{a as ue}from"./chunk-6YGTRKDT.js";import{a as O}from"./chunk-7CLUJYMW.js";import{e as F}from"./chunk-UR6MHSHU.js";var i=F(ue(),1);var r=F(G(),1);function _e({resultRef:h,mode:d="singleshot",loginCompleteRef:f}){let{exit:m}=X(),C=(0,i.useRef)(new q),S=(0,i.useRef)(new Q),v=(0,i.useRef)(new J),t=C.current,l=S.current,$=v.current,ne=K(),[P,g]=(0,i.useState)(d==="login"?"login":"gate"),[L,re]=(0,i.useState)(null),[de,R]=(0,i.useState)(null),[ge,T]=(0,i.useState)(null),[N,oe]=(0,i.useState)(null),[U,B]=(0,i.useState)([]),x=(0,i.useCallback)((e,n,s,o)=>$.log(e,n,s,o),[$]),pe=(0,i.useCallback)((e,n)=>{e?k(t,l,e,n):l.save({project_id:null,project_name:null,folder_id:null,folder_name:null})},[t,l]),y=(0,i.useCallback)(()=>{d==="login"?(f&&(f.current=!0),m()):g("input")},[d,m,f]),D=(0,i.useCallback)((e,n)=>{let s=k(t,l,e,n);if(d==="login"){g("ensure-project");return}Y(s)?y():s.projectId?g("ensure-folder"):g("ensure-project")},[t,l,y,d]);I((e,n)=>{n.ctrl&&e==="c"&&E(0,"Ctrl+C exit")});let M=(0,i.useRef)(!1);i.default.useEffect(()=>{M.current||(M.current=!0,d!=="login"&&te(t,x).then(e=>{re(e),e.status==="authenticated"?D(e.result.profile,e.result.env):e.status==="needs_pick"?g("pick"):(R(e.profile??null),T(e.env??null),g("login"))}).catch(e=>{oe(`Auth check failed: ${e instanceof Error?e.message:String(e)}`)}))},[t,x]);let ie=(0,i.useCallback)(e=>{h.current={objective:e},m()},[h,m]),se=(0,i.useCallback)(async(e,n)=>{t.setActiveProfile(e),t.setDefaultEnv(n),(await ee(t,e,n,x)).status==="authenticated"?D(e,n):(R(e),T(n),g("login"))},[t,x,D]),w=(0,i.useCallback)(()=>{let e=t.getActiveProfile(),n=t.getDefaultEnv();if(!e)return null;let s=_(n),o=t.loadBasicAuth(e,n);return new Z(s.controllerBaseUrl,async()=>t.loadCredentials(e,n)?.access_token??null,o,x)},[t,x]),le=(0,i.useCallback)(async()=>{let e=w();if(!e)return null;let n=e.cached??await e.resolve();if(!n)return null;let s=_(t.getDefaultEnv()),o=new O(s.tmsBaseUrl,n.username,n.access_key);try{let p=(await o.listProjects()).find(b=>b.name==="KaneAI Generated");if(p)return{id:p.project_id,name:p.name};let j=await o.createProject("KaneAI Generated");return{id:j.id,name:j.name}}catch{return null}},[w,t]),ae=(0,i.useCallback)(async e=>{let n=w();if(!n)return null;let s=n.cached??await n.resolve();if(!s)return null;let o=_(t.getDefaultEnv()),a=new O(o.tmsBaseUrl,s.username,s.access_key);try{let j=(await a.listFolders(e)).find(ce=>ce.name==="Untitled");if(j)return{id:j.id,name:j.name};let b=await a.createFolder(e,"Untitled");return{id:b.id,name:b.name}}catch{return null}},[w,t]);if(P==="gate")return(0,r.jsx)(c,{paddingX:1,children:(0,r.jsx)(u,{color:"yellow",children:"Checking authentication..."})});if(N)return(0,r.jsxs)(c,{flexDirection:"column",paddingX:1,children:[(0,r.jsx)(u,{color:"red",children:N}),(0,r.jsx)(u,{color:"gray",children:"Press Ctrl+C to exit."})]});if(P==="pick"&&L?.status==="needs_pick")return(0,r.jsx)(fe,{profiles:L.profiles,onSelect:se});if(P==="login")return(0,r.jsx)(z,{devMode:process.env.KANE_DEV_MODE==="1",profiles:t.listProfiles(),onBasicLogin:async(e,n,s,o)=>{let{validateBasicAuth:a}=await import("./validate-basic-Y73NBDAD.js");await a(n,s,o),t.saveBasicAuth(e,n,{username:s,access_key:o}),t.setActiveProfile(e),t.setDefaultEnv(n)},onOAuthLogin:async(e,n)=>{let{LoginFlow:s}=await import("./login-flow-LK7GAUCZ.js");t.setDefaultEnv(n),t.setActiveProfile(e),await new s(e,n,t).login()},onComplete:(e,n)=>{R(e),T(n),t.setActiveProfile(e),t.setDefaultEnv(n),D(e,n)},onCancel:()=>{E(0,"Login cancelled")}});if(P==="ensure-project"){let e=t.getActiveProfile()??"default",n=t.getDefaultEnv(),s=()=>{if(d==="login"){g("ensure-folder");return}k(t,l,e,n).folderId?y():g("ensure-folder")};return(0,r.jsxs)(c,{flexDirection:"column",children:[(0,r.jsx)(c,{paddingX:1,marginBottom:1,children:(0,r.jsx)(u,{color:"yellow",children:"Project & folder are required to save tests \xB7 Esc to use defaults \xB7 Ctrl+C to exit"})}),(0,r.jsx)(H,{resolver:w(),currentProjectId:l.load().project_id,env:n,onSelect:(o,a)=>{A(t,l,e,n,{projectId:o,projectName:a}),B(p=>[...p,`\u2713 Project: ${a} (${o})`]),s()},onCancel:async()=>{let o=await le();o&&(A(t,l,e,n,{projectId:o.id,projectName:o.name}),B(a=>[...a,`\u2713 Default project: ${o.name} (${o.id})`]),s())}})]})}if(P==="ensure-folder"){let e=t.getActiveProfile()??"default",n=t.getDefaultEnv(),s=t.loadProfileConfig(e,n);return(0,r.jsxs)(c,{flexDirection:"column",children:[(0,r.jsx)(c,{paddingX:1,marginBottom:1,children:(0,r.jsx)(u,{color:"yellow",children:"Project & folder are required to save tests \xB7 Esc to use defaults \xB7 Ctrl+C to exit"})}),(0,r.jsx)(W,{resolver:w(),projectId:s?.project_id??"",currentFolderId:l.load().folder_id,env:n,onSelect:(o,a)=>{A(t,l,e,n,{folderId:o,folderName:a}),B(p=>[...p,`\u2713 Folder: ${a} (${o})`]),y()},onCancel:async()=>{if(!s?.project_id)return;let o=await ae(s.project_id);o&&(A(t,l,e,n,{folderId:o.id,folderName:o.name}),B(a=>[...a,`\u2713 Default folder: ${o.name} (${o.id})`]),y())}})]})}return P==="input"?(0,r.jsxs)(c,{flexDirection:"column",children:[U.length>0&&(0,r.jsx)(c,{flexDirection:"column",paddingX:1,marginBottom:1,children:U.map((e,n)=>(0,r.jsx)(u,{color:"green",children:e},n))}),(0,r.jsx)(V,{onSubmit:ie,onEscape:()=>E(0,"User pressed Escape"),history:ne,placeholder:"Type an objective..."})]}):(0,r.jsx)(r.Fragment,{})}function fe({profiles:h,onSelect:d}){let[f,m]=(0,i.useState)(0),[C,S]=(0,i.useState)(!1);return I((v,t)=>{if(!C){if(t.escape){E(0,"Profile picker cancelled");return}if(t.upArrow&&f>0&&m(l=>l-1),t.downArrow&&f<h.length-1&&m(l=>l+1),t.return){S(!0);let l=h[f];d(l.profile,l.env).catch(()=>S(!1))}}}),(0,r.jsxs)(c,{flexDirection:"column",paddingX:1,children:[(0,r.jsx)(u,{color:"#ff9500",bold:!0,children:"Select a profile:"}),(0,r.jsx)(c,{marginTop:1,flexDirection:"column",children:h.map((v,t)=>(0,r.jsxs)(u,{children:[t===f?"\u276F ":" ",(0,r.jsx)(u,{color:t===f?"#ff9500":"white",bold:t===f,children:v.profile}),(0,r.jsxs)(u,{color:"gray",children:[" [",v.env,"]"]})]},`${v.profile}-${v.env}`))}),C&&(0,r.jsx)(c,{marginTop:1,children:(0,r.jsx)(u,{color:"yellow",children:"Validating credentials..."})})]})}export{_e as a};
2
+ import{b as K,c as V,d as z,e as ee,f as te}from"./chunk-DGUXTSHM.js";import{c as J}from"./chunk-BM25JQ3Z.js";import{a as Q}from"./chunk-H2P7UJAU.js";import{a as Z}from"./chunk-FPFOW6BS.js";import{b as H}from"./chunk-4ZHU4DLD.js";import{b as W}from"./chunk-4UKCDU64.js";import{g as E}from"./chunk-LOIRZFV3.js";import{a as O}from"./chunk-LPUQ4HWQ.js";import{a as k,b as A,d as Y}from"./chunk-VE3SUJMA.js";import{a as q}from"./chunk-PF7PBYCJ.js";import{a as _}from"./chunk-S7JV4A3U.js";import{a as G}from"./chunk-HCBYKLMW.js";import{a as c,b as u,i as I,j as X}from"./chunk-C44QQJR4.js";import{a as ue}from"./chunk-6YGTRKDT.js";import{e as F}from"./chunk-UR6MHSHU.js";var i=F(ue(),1);var r=F(G(),1);function _e({resultRef:h,mode:d="singleshot",loginCompleteRef:f}){let{exit:m}=X(),C=(0,i.useRef)(new q),S=(0,i.useRef)(new Q),v=(0,i.useRef)(new J),t=C.current,l=S.current,$=v.current,ne=K(),[P,g]=(0,i.useState)(d==="login"?"login":"gate"),[L,re]=(0,i.useState)(null),[de,R]=(0,i.useState)(null),[ge,T]=(0,i.useState)(null),[N,oe]=(0,i.useState)(null),[U,B]=(0,i.useState)([]),x=(0,i.useCallback)((e,n,s,o)=>$.log(e,n,s,o),[$]),pe=(0,i.useCallback)((e,n)=>{e?k(t,l,e,n):l.save({project_id:null,project_name:null,folder_id:null,folder_name:null})},[t,l]),y=(0,i.useCallback)(()=>{d==="login"?(f&&(f.current=!0),m()):g("input")},[d,m,f]),D=(0,i.useCallback)((e,n)=>{let s=k(t,l,e,n);if(d==="login"){g("ensure-project");return}Y(s)?y():s.projectId?g("ensure-folder"):g("ensure-project")},[t,l,y,d]);I((e,n)=>{n.ctrl&&e==="c"&&E(0,"Ctrl+C exit")});let M=(0,i.useRef)(!1);i.default.useEffect(()=>{M.current||(M.current=!0,d!=="login"&&te(t,x).then(e=>{re(e),e.status==="authenticated"?D(e.result.profile,e.result.env):e.status==="needs_pick"?g("pick"):(R(e.profile??null),T(e.env??null),g("login"))}).catch(e=>{oe(`Auth check failed: ${e instanceof Error?e.message:String(e)}`)}))},[t,x]);let ie=(0,i.useCallback)(e=>{h.current={objective:e},m()},[h,m]),se=(0,i.useCallback)(async(e,n)=>{t.setActiveProfile(e),t.setDefaultEnv(n),(await ee(t,e,n,x)).status==="authenticated"?D(e,n):(R(e),T(n),g("login"))},[t,x,D]),w=(0,i.useCallback)(()=>{let e=t.getActiveProfile(),n=t.getDefaultEnv();if(!e)return null;let s=_(n),o=t.loadBasicAuth(e,n);return new Z(s.controllerBaseUrl,async()=>t.loadCredentials(e,n)?.access_token??null,o,x)},[t,x]),le=(0,i.useCallback)(async()=>{let e=w();if(!e)return null;let n=e.cached??await e.resolve();if(!n)return null;let s=_(t.getDefaultEnv()),o=new O(s.tmsBaseUrl,n.username,n.access_key);try{let p=(await o.listProjects()).find(b=>b.name==="KaneAI Generated");if(p)return{id:p.project_id,name:p.name};let j=await o.createProject("KaneAI Generated");return{id:j.id,name:j.name}}catch{return null}},[w,t]),ae=(0,i.useCallback)(async e=>{let n=w();if(!n)return null;let s=n.cached??await n.resolve();if(!s)return null;let o=_(t.getDefaultEnv()),a=new O(o.tmsBaseUrl,s.username,s.access_key);try{let j=(await a.listFolders(e)).find(ce=>ce.name==="Untitled");if(j)return{id:j.id,name:j.name};let b=await a.createFolder(e,"Untitled");return{id:b.id,name:b.name}}catch{return null}},[w,t]);if(P==="gate")return(0,r.jsx)(c,{paddingX:1,children:(0,r.jsx)(u,{color:"yellow",children:"Checking authentication..."})});if(N)return(0,r.jsxs)(c,{flexDirection:"column",paddingX:1,children:[(0,r.jsx)(u,{color:"red",children:N}),(0,r.jsx)(u,{color:"gray",children:"Press Ctrl+C to exit."})]});if(P==="pick"&&L?.status==="needs_pick")return(0,r.jsx)(fe,{profiles:L.profiles,onSelect:se});if(P==="login")return(0,r.jsx)(z,{devMode:process.env.KANE_DEV_MODE==="1",profiles:t.listProfiles(),onBasicLogin:async(e,n,s,o)=>{let{validateBasicAuth:a}=await import("./validate-basic-QUPVT2EV.js");await a(n,s,o),t.saveBasicAuth(e,n,{username:s,access_key:o}),t.setActiveProfile(e),t.setDefaultEnv(n)},onOAuthLogin:async(e,n)=>{let{LoginFlow:s}=await import("./login-flow-CDR6ARK3.js");t.setDefaultEnv(n),t.setActiveProfile(e),await new s(e,n,t).login()},onComplete:(e,n)=>{R(e),T(n),t.setActiveProfile(e),t.setDefaultEnv(n),D(e,n)},onCancel:()=>{E(0,"Login cancelled")}});if(P==="ensure-project"){let e=t.getActiveProfile()??"default",n=t.getDefaultEnv(),s=()=>{if(d==="login"){g("ensure-folder");return}k(t,l,e,n).folderId?y():g("ensure-folder")};return(0,r.jsxs)(c,{flexDirection:"column",children:[(0,r.jsx)(c,{paddingX:1,marginBottom:1,children:(0,r.jsx)(u,{color:"yellow",children:"Project & folder are required to save tests \xB7 Esc to use defaults \xB7 Ctrl+C to exit"})}),(0,r.jsx)(H,{resolver:w(),currentProjectId:l.load().project_id,env:n,onSelect:(o,a)=>{A(t,l,e,n,{projectId:o,projectName:a}),B(p=>[...p,`\u2713 Project: ${a} (${o})`]),s()},onCancel:async()=>{let o=await le();o&&(A(t,l,e,n,{projectId:o.id,projectName:o.name}),B(a=>[...a,`\u2713 Default project: ${o.name} (${o.id})`]),s())}})]})}if(P==="ensure-folder"){let e=t.getActiveProfile()??"default",n=t.getDefaultEnv(),s=t.loadProfileConfig(e,n);return(0,r.jsxs)(c,{flexDirection:"column",children:[(0,r.jsx)(c,{paddingX:1,marginBottom:1,children:(0,r.jsx)(u,{color:"yellow",children:"Project & folder are required to save tests \xB7 Esc to use defaults \xB7 Ctrl+C to exit"})}),(0,r.jsx)(W,{resolver:w(),projectId:s?.project_id??"",currentFolderId:l.load().folder_id,env:n,onSelect:(o,a)=>{A(t,l,e,n,{folderId:o,folderName:a}),B(p=>[...p,`\u2713 Folder: ${a} (${o})`]),y()},onCancel:async()=>{if(!s?.project_id)return;let o=await ae(s.project_id);o&&(A(t,l,e,n,{folderId:o.id,folderName:o.name}),B(a=>[...a,`\u2713 Default folder: ${o.name} (${o.id})`]),y())}})]})}return P==="input"?(0,r.jsxs)(c,{flexDirection:"column",children:[U.length>0&&(0,r.jsx)(c,{flexDirection:"column",paddingX:1,marginBottom:1,children:U.map((e,n)=>(0,r.jsx)(u,{color:"green",children:e},n))}),(0,r.jsx)(V,{onSubmit:ie,onEscape:()=>E(0,"User pressed Escape"),history:ne,placeholder:"Type an objective..."})]}):(0,r.jsx)(r.Fragment,{})}function fe({profiles:h,onSelect:d}){let[f,m]=(0,i.useState)(0),[C,S]=(0,i.useState)(!1);return I((v,t)=>{if(!C){if(t.escape){E(0,"Profile picker cancelled");return}if(t.upArrow&&f>0&&m(l=>l-1),t.downArrow&&f<h.length-1&&m(l=>l+1),t.return){S(!0);let l=h[f];d(l.profile,l.env).catch(()=>S(!1))}}}),(0,r.jsxs)(c,{flexDirection:"column",paddingX:1,children:[(0,r.jsx)(u,{color:"#ff9500",bold:!0,children:"Select a profile:"}),(0,r.jsx)(c,{marginTop:1,flexDirection:"column",children:h.map((v,t)=>(0,r.jsxs)(u,{children:[t===f?"\u276F ":" ",(0,r.jsx)(u,{color:t===f?"#ff9500":"white",bold:t===f,children:v.profile}),(0,r.jsxs)(u,{color:"gray",children:[" [",v.env,"]"]})]},`${v.profile}-${v.env}`))}),C&&(0,r.jsx)(c,{marginTop:1,children:(0,r.jsx)(u,{color:"yellow",children:"Validating credentials..."})})]})}export{_e as a};
@@ -1,10 +1,10 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as L,b as et}from"./chunk-L3RTVAPG.js";import{b as U,c as X}from"./chunk-3C7ATCDM.js";import{a as C,b as J,e as P,f as Q}from"./chunk-AH4AXJML.js";import{a as Z,b as tt}from"./chunk-MDBXYXSC.js";import{a as W}from"./chunk-UJZCMEEH.js";import{a as z}from"./chunk-TAEW7PXN.js";import{a as N}from"./chunk-7G7ZLAJH.js";import{a as G}from"./chunk-J37YPPCD.js";import{a as $}from"./chunk-HCBYKLMW.js";import{t as h}from"./chunk-3Z4EHIOW.js";import{a as k,b as g,i as K}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{a as I}from"./chunk-RZ4F3BHX.js";import{e as R}from"./chunk-UR6MHSHU.js";var M=R(B(),1);import{existsSync as D,readFileSync as jt,rmSync as dt,unlinkSync as Bt}from"fs";import{resolve as Y}from"path";import{promises as rt,realpathSync as _t}from"fs";import{homedir as xt}from"os";import{join as H,parse as wt,relative as nt,resolve as ot}from"path";var it=new Set(["node_modules",".git","dist","build",".next",".venv","venv","target","__pycache__"]),v=class extends Error{constructor(i){super(`refusing to scan '${i}'. Run from your project root, or pass --root <dir>.`);this.cwd=i;this.name="HomeRefusedError"}};function st(t){try{return _t(ot(t))}catch{return ot(t)}}function yt(t){let r=st(t),i=st(xt()),n=wt(r).root;if(process.platform==="win32"){let o=e=>e.toLowerCase();return o(r)===o(i)||o(r)===o(n)}return r===i||r===n}async function A(t){if(yt(t.root))throw new v(t.root);let r=t.maxEntries??5e4,i=t.maxResults??5e3,n=new Set(t.ignore??[]),o=[],e=0,s=0,c=!1,d,l=[t.root];for(;l.length>0&&!c;){let a=l.shift(),m;try{m=await rt.readdir(a,{withFileTypes:!0})}catch{continue}s++;for(let E of m){if(e++,e>r){c=!0,d="max_entries";break}let x=E.name,T=H(a,x);if(E.isDirectory()){if(it.has(x)||x.startsWith(".")||x.startsWith("output-")||n.has(x))continue;l.push(T)}else if(E.isFile()&&x.endsWith("_test.md")&&(o.push({path:T,relPath:nt(t.root,T),source:"cwd"}),o.length>=i)){c=!0,d="max_results";break}}t.onProgress?.(s,o.length)}if(!c){let m=[{dir:H(t.root,".testmuai","tests"),depth:0}];for(;m.length>0&&!c;){let{dir:E,depth:x}=m.shift(),T;try{T=await rt.readdir(E,{withFileTypes:!0})}catch{continue}s++;for(let f of T){if(e++,e>r){c=!0,d="max_entries";break}let w=f.name,y=H(E,w);if(f.isDirectory()){if(x>=20||w.startsWith(".")||w.startsWith("output-")||it.has(w))continue;m.push({dir:y,depth:x+1})}else if(f.isFile()&&w.endsWith("_test.md")&&(o.push({path:y,relPath:nt(t.root,y),source:"tests-dir"}),o.length>=i)){c=!0,d="max_results";break}}}}return{results:o,aborted:c,abortReason:d,dirsScanned:s}}import{mkdirSync as kt,writeFileSync as Et}from"fs";import{join as bt}from"path";function at(t,r){return`Basic ${Buffer.from(`${t}:${r}`).toString("base64")}`}async function Tt(t){let r=Z({tmsBaseUrl:t.tmsBaseUrl,testcaseId:t.testcaseId,codeExport:{enabled:!0,language:t.language,skipValidation:t.skipValidation}}),i=await I(r.url,{method:"POST",headers:{"content-type":"application/json",authorization:at(t.auth.username,t.auth.access_key)},body:JSON.stringify(r.body)});if(!i.ok)throw new Error(`code-export trigger failed: ${i.status} ${await i.text()}`);t.log("info","CODE_EXPORT_TRIGGERED","Code export triggered",{testcase_id:t.testcaseId})}async function St(t){let r=tt({tmsBaseUrl:t.tmsBaseUrl,testcaseId:t.testcaseId}),i=t.pollIntervalMs??5e3,n=t.timeoutMs??3e5,o=Date.now()+n;for(;Date.now()<o;){let e=await I(r,{headers:{authorization:at(t.auth.username,t.auth.access_key),accept:"application/json"}});if(!e.ok){await new Promise(l=>setTimeout(l,i));continue}let c=(await e.json()).data?.find(l=>l.code_name==="kane-cli-trigger");if(!c){await new Promise(l=>setTimeout(l,i));continue}let d=(c.status??"").toLowerCase();if(d==="in progress"||d==="in_progress"||d==="pending"){await new Promise(l=>setTimeout(l,i));continue}if(!c.url||c.url.length===0)throw new Error(`code-export status=${c.status} but no files returned`);kt(t.outDir,{recursive:!0});for(let l of c.url){let a=bt(t.outDir,l.file_name),m=await I(l.file_url);if(!m.ok){t.log("warn","CODE_EXPORT_FILE_FAILED","Failed to download file",{file_name:l.file_name,status:m.status});continue}let E=await m.text();Et(a,E,"utf-8")}return t.log("info","CODE_EXPORT_DOWNLOADED","Code export saved",{out_dir:t.outDir,file_count:c.url.length}),t.outDir}throw new Error("code-export polling timed out")}async function ct(t){return await Tt(t),await St(t)}var b=R(B(),1);import{existsSync as Rt,readFileSync as vt}from"fs";var p=R($(),1);function Pt(t){L(t);let r=P(t);if(!Rt(r))return null;try{return JSON.parse(vt(r,"utf8"))}catch{return{}}}function Mt(t){return t===null?"never_run":t.testcase_id?"synced":"local_only"}function Dt(t){return t==="synced"?"\u2601":t==="local_only"?"\u25A3":"\u25CB"}function Ct(t){return t==="tests-dir"?"\u2726":" "}function Ot(t,r){return r==="all"?!0:r==="synced"?t.status==="synced":r==="local"?t.status==="local_only":r==="never_run"?t.status==="never_run":r==="cli"?t.source==="tests-dir":r==="hand"?t.source==="cwd":!0}var V=["all","synced","local","never_run","cli","hand"];function Ft(t){let r=V.indexOf(t);return V[(r+1)%V.length]}function lt({root:t,currentOrgId:r,onSelect:i,onCancel:n}){let[o,e]=(0,b.useState)([]),[s,c]=(0,b.useState)(null),[d,l]=(0,b.useState)(!0),[a,m]=(0,b.useState)("all");(0,b.useEffect)(()=>{(async()=>{try{let f=await A({root:t}),w=[];for(let y of f.results){let j=Pt(y.path);j?.org_id!==void 0&&j.org_id!==r||w.push({path:y.path,relPath:y.relPath,name:C(y.path),status:Mt(j),source:y.source})}e(w),l(!1)}catch(f){f instanceof v,c(f.message),l(!1)}})()},[t,r]);let E=(0,b.useMemo)(()=>o.filter(f=>Ot(f,a)).map(f=>({id:f.path,label:`${Dt(f.status)} ${Ct(f.source)} ${f.relPath}`})),[o,a]),x=(0,b.useMemo)(()=>It(a,o),[a,o]);if(s)return(0,p.jsxs)(k,{flexDirection:"column",borderStyle:"round",borderColor:h.red,paddingX:2,paddingY:1,children:[(0,p.jsx)(g,{color:h.red,bold:!0,children:"testmd"}),(0,p.jsx)(k,{marginTop:1,children:(0,p.jsx)(g,{color:h.red,children:s})})]});let T=a==="all"?"all":$t(a);return(0,p.jsx)(z,{title:`testmd \xB7 filter: ${T}`,items:E,loading:d,itemNoun:"tests",onSelect:f=>{let w=o.find(y=>y.path===f.id);w&&i(w)},onCancel:n,onTab:()=>m(f=>Ft(f)),extraHint:"cycle filter",footer:x})}function $t(t){return t==="synced"?"synced (\u2601)":t==="local"?"local (\u25A3)":t==="never_run"?"never run (\u25CB)":t==="cli"?"cli-generated (\u2726)":t==="hand"?"hand-written":"all"}function It(t,r){let i={synced:r.filter(o=>o.status==="synced").length,local:r.filter(o=>o.status==="local_only").length,never:r.filter(o=>o.status==="never_run").length,cli:r.filter(o=>o.source==="tests-dir").length,hand:r.filter(o=>o.source==="cwd").length},n=o=>o?h.orange:h.dim;return(0,p.jsxs)(k,{flexDirection:"column",children:[(0,p.jsx)(g,{color:h.dim,children:"legend:"}),(0,p.jsxs)(k,{children:[(0,p.jsx)(g,{color:n(t==="synced"),children:` \u2601 synced (${i.synced}) `}),(0,p.jsx)(g,{color:n(t==="local"),children:`\u25A3 local (${i.local}) `}),(0,p.jsx)(g,{color:n(t==="never_run"),children:`\u25CB never run (${i.never})`})]}),(0,p.jsxs)(k,{children:[(0,p.jsx)(g,{color:n(t==="cli"),children:` \u2726 cli-generated (${i.cli}) `}),(0,p.jsx)(g,{color:n(t==="hand"),children:` hand-written (${i.hand})`})]})]})}var O=R(B(),1);import{existsSync as Lt,readFileSync as At}from"fs";var u=R($(),1);function ut({path:t,relPath:r,onAction:i,onBack:n,onView:o}){let[e,s]=(0,O.useState)(null),[c,d]=(0,O.useState)(!1);(0,O.useEffect)(()=>{let a=P(t);if(Lt(a))try{s(JSON.parse(At(a,"utf8")))}catch{s(null)}},[t]),K((a,m)=>{if(m.escape){if(c){d(!1);return}n();return}if(c){a==="y"||a==="Y"?(d(!1),i("delete")):(a==="n"||a==="N")&&d(!1);return}a==="r"&&i("run"),a==="e"&&e?.testcase_id&&i("export"),a==="d"&&d(!0),a==="v"&&o&&o()});let l=({k:a,v:m})=>m?(0,u.jsxs)(g,{children:[(0,u.jsx)(g,{color:h.dim,children:a.padEnd(14)}),m]}):null;return(0,u.jsxs)(k,{flexDirection:"column",borderStyle:"round",borderColor:h.orange,paddingX:2,paddingY:1,children:[(0,u.jsx)(g,{color:h.orange,bold:!0,children:r}),(0,u.jsx)(k,{marginTop:1,flexDirection:"column",children:e?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(l,{k:"test_id",v:e.test_id}),(0,u.jsx)(l,{k:"testcase_id",v:e.testcase_id}),(0,u.jsx)(l,{k:"project_id",v:e.project_id}),(0,u.jsx)(l,{k:"folder_id",v:e.folder_id}),(0,u.jsx)(l,{k:"org_id",v:e.org_id}),(0,u.jsx)(l,{k:"session_name",v:e.session_name}),(0,u.jsx)(l,{k:"commit_id",v:e.commit_id})]}):(0,u.jsx)(g,{color:h.dim,children:"(never run \u2014 no meta.json)"})}),c?(0,u.jsx)(k,{marginTop:1,children:(0,u.jsxs)(g,{color:h.red,bold:!0,children:["Delete ",r," and its output dir? [y/n]"]})}):(0,u.jsx)(k,{marginTop:1,children:(0,u.jsxs)(g,{color:h.dim,children:["[r] run [e] export",e?.testcase_id?"":" (need testcase_id)"," [d] delete",o?" [v] view":""," [Esc] back"]})})]})}function F(t){L(t);let r=P(t);if(!D(r))return null;try{return JSON.parse(jt(r,"utf8"))}catch{return null}}function ft(t,r){return!t||t.org_id===void 0?!0:t.org_id===r}function q(t,r){return ft(t,r)?null:(process.stderr.write(`error: this test belongs to org ${t.org_id}; you are logged in as org ${r}.
2
+ import{a as L,b as et}from"./chunk-34YRU7WM.js";import{a as U,b as X}from"./chunk-RCL22HDJ.js";import{a as Z,b as tt}from"./chunk-MDBXYXSC.js";import{a as C,b as J,e as P,f as Q}from"./chunk-AH4AXJML.js";import{a as W}from"./chunk-H2P7UJAU.js";import{a as z}from"./chunk-CZBHDBID.js";import{a as N}from"./chunk-PF7PBYCJ.js";import{a as G}from"./chunk-S7JV4A3U.js";import{a as I}from"./chunk-RZ4F3BHX.js";import{v as h}from"./chunk-3QWAABMG.js";import{a as $}from"./chunk-HCBYKLMW.js";import{a as k,b as g,i as K}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as R}from"./chunk-UR6MHSHU.js";var M=R(B(),1);import{existsSync as D,readFileSync as jt,rmSync as dt,unlinkSync as Bt}from"fs";import{resolve as Y}from"path";import{promises as rt,realpathSync as _t}from"fs";import{homedir as xt}from"os";import{join as H,parse as wt,relative as nt,resolve as ot}from"path";var it=new Set(["node_modules",".git","dist","build",".next",".venv","venv","target","__pycache__"]),v=class extends Error{constructor(i){super(`refusing to scan '${i}'. Run from your project root, or pass --root <dir>.`);this.cwd=i;this.name="HomeRefusedError"}};function st(t){try{return _t(ot(t))}catch{return ot(t)}}function yt(t){let r=st(t),i=st(xt()),n=wt(r).root;if(process.platform==="win32"){let o=e=>e.toLowerCase();return o(r)===o(i)||o(r)===o(n)}return r===i||r===n}async function A(t){if(yt(t.root))throw new v(t.root);let r=t.maxEntries??5e4,i=t.maxResults??5e3,n=new Set(t.ignore??[]),o=[],e=0,s=0,c=!1,d,l=[t.root];for(;l.length>0&&!c;){let a=l.shift(),m;try{m=await rt.readdir(a,{withFileTypes:!0})}catch{continue}s++;for(let E of m){if(e++,e>r){c=!0,d="max_entries";break}let x=E.name,T=H(a,x);if(E.isDirectory()){if(it.has(x)||x.startsWith(".")||x.startsWith("output-")||n.has(x))continue;l.push(T)}else if(E.isFile()&&x.endsWith("_test.md")&&(o.push({path:T,relPath:nt(t.root,T),source:"cwd"}),o.length>=i)){c=!0,d="max_results";break}}t.onProgress?.(s,o.length)}if(!c){let m=[{dir:H(t.root,".testmuai","tests"),depth:0}];for(;m.length>0&&!c;){let{dir:E,depth:x}=m.shift(),T;try{T=await rt.readdir(E,{withFileTypes:!0})}catch{continue}s++;for(let f of T){if(e++,e>r){c=!0,d="max_entries";break}let w=f.name,y=H(E,w);if(f.isDirectory()){if(x>=20||w.startsWith(".")||w.startsWith("output-")||it.has(w))continue;m.push({dir:y,depth:x+1})}else if(f.isFile()&&w.endsWith("_test.md")&&(o.push({path:y,relPath:nt(t.root,y),source:"tests-dir"}),o.length>=i)){c=!0,d="max_results";break}}}}return{results:o,aborted:c,abortReason:d,dirsScanned:s}}import{mkdirSync as kt,writeFileSync as Et}from"fs";import{join as bt}from"path";function at(t,r){return`Basic ${Buffer.from(`${t}:${r}`).toString("base64")}`}async function Tt(t){let r=Z({tmsBaseUrl:t.tmsBaseUrl,testcaseId:t.testcaseId,codeExport:{enabled:!0,language:t.language,skipValidation:t.skipValidation}}),i=await I(r.url,{method:"POST",headers:{"content-type":"application/json",authorization:at(t.auth.username,t.auth.access_key)},body:JSON.stringify(r.body)});if(!i.ok)throw new Error(`code-export trigger failed: ${i.status} ${await i.text()}`);t.log("info","CODE_EXPORT_TRIGGERED","Code export triggered",{testcase_id:t.testcaseId})}async function St(t){let r=tt({tmsBaseUrl:t.tmsBaseUrl,testcaseId:t.testcaseId}),i=t.pollIntervalMs??5e3,n=t.timeoutMs??3e5,o=Date.now()+n;for(;Date.now()<o;){let e=await I(r,{headers:{authorization:at(t.auth.username,t.auth.access_key),accept:"application/json"}});if(!e.ok){await new Promise(l=>setTimeout(l,i));continue}let c=(await e.json()).data?.find(l=>l.code_name==="kane-cli-trigger");if(!c){await new Promise(l=>setTimeout(l,i));continue}let d=(c.status??"").toLowerCase();if(d==="in progress"||d==="in_progress"||d==="pending"){await new Promise(l=>setTimeout(l,i));continue}if(!c.url||c.url.length===0)throw new Error(`code-export status=${c.status} but no files returned`);kt(t.outDir,{recursive:!0});for(let l of c.url){let a=bt(t.outDir,l.file_name),m=await I(l.file_url);if(!m.ok){t.log("warn","CODE_EXPORT_FILE_FAILED","Failed to download file",{file_name:l.file_name,status:m.status});continue}let E=await m.text();Et(a,E,"utf-8")}return t.log("info","CODE_EXPORT_DOWNLOADED","Code export saved",{out_dir:t.outDir,file_count:c.url.length}),t.outDir}throw new Error("code-export polling timed out")}async function ct(t){return await Tt(t),await St(t)}var b=R(B(),1);import{existsSync as Rt,readFileSync as vt}from"fs";var p=R($(),1);function Pt(t){L(t);let r=P(t);if(!Rt(r))return null;try{return JSON.parse(vt(r,"utf8"))}catch{return{}}}function Mt(t){return t===null?"never_run":t.testcase_id?"synced":"local_only"}function Dt(t){return t==="synced"?"\u2601":t==="local_only"?"\u25A3":"\u25CB"}function Ct(t){return t==="tests-dir"?"\u2726":" "}function Ot(t,r){return r==="all"?!0:r==="synced"?t.status==="synced":r==="local"?t.status==="local_only":r==="never_run"?t.status==="never_run":r==="cli"?t.source==="tests-dir":r==="hand"?t.source==="cwd":!0}var V=["all","synced","local","never_run","cli","hand"];function Ft(t){let r=V.indexOf(t);return V[(r+1)%V.length]}function lt({root:t,currentOrgId:r,onSelect:i,onCancel:n}){let[o,e]=(0,b.useState)([]),[s,c]=(0,b.useState)(null),[d,l]=(0,b.useState)(!0),[a,m]=(0,b.useState)("all");(0,b.useEffect)(()=>{(async()=>{try{let f=await A({root:t}),w=[];for(let y of f.results){let j=Pt(y.path);j?.org_id!==void 0&&j.org_id!==r||w.push({path:y.path,relPath:y.relPath,name:C(y.path),status:Mt(j),source:y.source})}e(w),l(!1)}catch(f){f instanceof v,c(f.message),l(!1)}})()},[t,r]);let E=(0,b.useMemo)(()=>o.filter(f=>Ot(f,a)).map(f=>({id:f.path,label:`${Dt(f.status)} ${Ct(f.source)} ${f.relPath}`})),[o,a]),x=(0,b.useMemo)(()=>It(a,o),[a,o]);if(s)return(0,p.jsxs)(k,{flexDirection:"column",borderStyle:"round",borderColor:h.red,paddingX:2,paddingY:1,children:[(0,p.jsx)(g,{color:h.red,bold:!0,children:"testmd"}),(0,p.jsx)(k,{marginTop:1,children:(0,p.jsx)(g,{color:h.red,children:s})})]});let T=a==="all"?"all":$t(a);return(0,p.jsx)(z,{title:`testmd \xB7 filter: ${T}`,items:E,loading:d,itemNoun:"tests",onSelect:f=>{let w=o.find(y=>y.path===f.id);w&&i(w)},onCancel:n,onTab:()=>m(f=>Ft(f)),extraHint:"cycle filter",footer:x})}function $t(t){return t==="synced"?"synced (\u2601)":t==="local"?"local (\u25A3)":t==="never_run"?"never run (\u25CB)":t==="cli"?"cli-generated (\u2726)":t==="hand"?"hand-written":"all"}function It(t,r){let i={synced:r.filter(o=>o.status==="synced").length,local:r.filter(o=>o.status==="local_only").length,never:r.filter(o=>o.status==="never_run").length,cli:r.filter(o=>o.source==="tests-dir").length,hand:r.filter(o=>o.source==="cwd").length},n=o=>o?h.orange:h.dim;return(0,p.jsxs)(k,{flexDirection:"column",children:[(0,p.jsx)(g,{color:h.dim,children:"legend:"}),(0,p.jsxs)(k,{children:[(0,p.jsx)(g,{color:n(t==="synced"),children:` \u2601 synced (${i.synced}) `}),(0,p.jsx)(g,{color:n(t==="local"),children:`\u25A3 local (${i.local}) `}),(0,p.jsx)(g,{color:n(t==="never_run"),children:`\u25CB never run (${i.never})`})]}),(0,p.jsxs)(k,{children:[(0,p.jsx)(g,{color:n(t==="cli"),children:` \u2726 cli-generated (${i.cli}) `}),(0,p.jsx)(g,{color:n(t==="hand"),children:` hand-written (${i.hand})`})]})]})}var O=R(B(),1);import{existsSync as Lt,readFileSync as At}from"fs";var u=R($(),1);function ut({path:t,relPath:r,onAction:i,onBack:n,onView:o}){let[e,s]=(0,O.useState)(null),[c,d]=(0,O.useState)(!1);(0,O.useEffect)(()=>{let a=P(t);if(Lt(a))try{s(JSON.parse(At(a,"utf8")))}catch{s(null)}},[t]),K((a,m)=>{if(m.escape){if(c){d(!1);return}n();return}if(c){a==="y"||a==="Y"?(d(!1),i("delete")):(a==="n"||a==="N")&&d(!1);return}a==="r"&&i("run"),a==="e"&&e?.testcase_id&&i("export"),a==="d"&&d(!0),a==="v"&&o&&o()});let l=({k:a,v:m})=>m?(0,u.jsxs)(g,{children:[(0,u.jsx)(g,{color:h.dim,children:a.padEnd(14)}),m]}):null;return(0,u.jsxs)(k,{flexDirection:"column",borderStyle:"round",borderColor:h.orange,paddingX:2,paddingY:1,children:[(0,u.jsx)(g,{color:h.orange,bold:!0,children:r}),(0,u.jsx)(k,{marginTop:1,flexDirection:"column",children:e?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(l,{k:"test_id",v:e.test_id}),(0,u.jsx)(l,{k:"testcase_id",v:e.testcase_id}),(0,u.jsx)(l,{k:"project_id",v:e.project_id}),(0,u.jsx)(l,{k:"folder_id",v:e.folder_id}),(0,u.jsx)(l,{k:"org_id",v:e.org_id}),(0,u.jsx)(l,{k:"session_name",v:e.session_name}),(0,u.jsx)(l,{k:"commit_id",v:e.commit_id})]}):(0,u.jsx)(g,{color:h.dim,children:"(never run \u2014 no meta.json)"})}),c?(0,u.jsx)(k,{marginTop:1,children:(0,u.jsxs)(g,{color:h.red,bold:!0,children:["Delete ",r," and its output dir? [y/n]"]})}):(0,u.jsx)(k,{marginTop:1,children:(0,u.jsxs)(g,{color:h.dim,children:["[r] run [e] export",e?.testcase_id?"":" (need testcase_id)"," [d] delete",o?" [v] view":""," [Esc] back"]})})]})}function F(t){L(t);let r=P(t);if(!D(r))return null;try{return JSON.parse(jt(r,"utf8"))}catch{return null}}function ft(t,r){return!t||t.org_id===void 0?!0:t.org_id===r}function q(t,r){return ft(t,r)?null:(process.stderr.write(`error: this test belongs to org ${t.org_id}; you are logged in as org ${r}.
3
3
  Switch profiles with \`kane-cli profiles switch\` to act on it.
4
4
  `),2)}async function Me(t={}){let r=!!process.stdin.isTTY&&!t.json,i=new N,n=new W;await et({isInteractive:r,creds:i,config:n});let o=i.getDefaultEnv()??"prod";try{let e=await X({creds:i,env:o,log:()=>{}});return e.resolvedCreds?.org_id===void 0?(process.stderr.write("error: TMS did not return an org_id. Run `kane-cli login` again.\n"),{ok:!1,code:2}):{ok:!0,orgId:String(e.resolvedCreds.org_id)}}catch(e){if(e instanceof U)return process.stderr.write("error: not authenticated. Run `kane-cli login` first.\n"),{ok:!1,code:2};throw e}}async function De(t,r){if(process.stdin.isTTY&&!t.json)return await Jt(r,t.root);let i=t.root??process.cwd(),n;try{n=await A({root:i,ignore:t.ignore})}catch(o){if(o instanceof v)return process.stderr.write(`error: ${o.message}
5
5
  `),2;throw o}for(let o of n.results){let e=F(o.path);if(!ft(e,r))continue;let s={path:o.relPath.startsWith(".")?o.relPath:`./${o.relPath}`,name:C(o.path),has_meta:e!==null,source:o.source,synced:!!e?.testcase_id};e&&(e.test_id&&(s.test_id=e.test_id),e.testcase_id&&(s.testcase_id=e.testcase_id),e.org_id&&(s.org_id=e.org_id),e.project_id&&(s.project_id=e.project_id),e.folder_id&&(s.folder_id=e.folder_id)),process.stdout.write(JSON.stringify(s)+`
6
6
  `)}return n.aborted&&process.stderr.write(`warn: walk aborted (${n.abortReason}). Pass --root or --ignore to narrow.
7
- `),0}var mt=-1001,gt=-1002,pt=-1003,_={action:null,path:null};function Nt(t,r){return _.action=t,_.path=r,t==="run"?mt:t==="export"?gt:pt}function Wt({root:t,currentOrgId:r,onComplete:i}){let[n,o]=M.default.useState({kind:"list"});return M.default.useEffect(()=>{n.kind==="exiting"&&i(n.code)},[n,i]),n.kind==="list"?M.default.createElement(lt,{root:t,currentOrgId:r,onSelect:e=>o({kind:"inspect",path:e.path,relPath:e.relPath}),onCancel:()=>o({kind:"exiting",code:0})}):n.kind==="inspect"?M.default.createElement(ut,{path:n.path,relPath:n.relPath,onAction:async e=>{o({kind:"exiting",code:Nt(e,n.path)})},onBack:()=>o({kind:"list"})}):null}async function Jt(t,r){let i=r??process.cwd(),{render:n}=await import("./build-JIKYOZUH.js"),o=await new Promise(e=>{let{unmount:s,waitUntilExit:c}=n(M.default.createElement(Wt,{root:i,currentOrgId:t,onComplete:d=>{s(),e(d)}}),{stdout:process.stderr,exitOnCtrlC:!0});c().then(()=>e(0)).catch(()=>e(0))});if(o===mt&&_.path){let{runTestMdFile:e}=await import("./run-test-md-SXZUOYSG.js"),s=await e(_.path,{});return _.action=null,_.path=null,s}if(o===gt&&_.path){let e=await Xt(_.path,{},t);return _.action=null,_.path=null,e}if(o===pt&&_.path){let e=await Ut(_.path,!0,t);return _.action=null,_.path=null,e}return o}async function Ce(t,r){let i=Y(t);if(!D(i))return process.stderr.write(`error: file not found: ${i}
7
+ `),0}var mt=-1001,gt=-1002,pt=-1003,_={action:null,path:null};function Nt(t,r){return _.action=t,_.path=r,t==="run"?mt:t==="export"?gt:pt}function Wt({root:t,currentOrgId:r,onComplete:i}){let[n,o]=M.default.useState({kind:"list"});return M.default.useEffect(()=>{n.kind==="exiting"&&i(n.code)},[n,i]),n.kind==="list"?M.default.createElement(lt,{root:t,currentOrgId:r,onSelect:e=>o({kind:"inspect",path:e.path,relPath:e.relPath}),onCancel:()=>o({kind:"exiting",code:0})}):n.kind==="inspect"?M.default.createElement(ut,{path:n.path,relPath:n.relPath,onAction:async e=>{o({kind:"exiting",code:Nt(e,n.path)})},onBack:()=>o({kind:"list"})}):null}async function Jt(t,r){let i=r??process.cwd(),{render:n}=await import("./build-JIKYOZUH.js"),o=await new Promise(e=>{let{unmount:s,waitUntilExit:c}=n(M.default.createElement(Wt,{root:i,currentOrgId:t,onComplete:d=>{s(),e(d)}}),{stdout:process.stderr,exitOnCtrlC:!0});c().then(()=>e(0)).catch(()=>e(0))});if(o===mt&&_.path){let{runTestMdFile:e}=await import("./run-test-md-I76IV7QA.js"),s=await e(_.path,{});return _.action=null,_.path=null,s}if(o===gt&&_.path){let e=await Xt(_.path,{},t);return _.action=null,_.path=null,e}if(o===pt&&_.path){let e=await Ut(_.path,!0,t);return _.action=null,_.path=null,e}return o}async function Ce(t,r){let i=Y(t);if(!D(i))return process.stderr.write(`error: file not found: ${i}
8
8
  `),2;let n=F(i),o=q(n,r);if(o!==null)return o;let e={path:i,name:C(i),has_meta:n!==null};return n&&(n.commit_id&&(e.commit_id=n.commit_id),n.test_id&&(e.test_id=n.test_id),n.testcase_id&&(e.testcase_id=n.testcase_id),n.project_id&&(e.project_id=n.project_id),n.folder_id&&(e.folder_id=n.folder_id),n.org_id&&(e.org_id=n.org_id),n.session_name&&(e.session_name=n.session_name)),process.stdout.write(JSON.stringify(e)+`
9
9
  `),0}async function Ut(t,r,i){let n=Y(t);if(!D(n))return process.stderr.write(`error: file not found: ${n}
10
10
  `),2;let o=F(n),e=q(o,i);if(e!==null)return e;if(!r)return process.stderr.write(`error: refusing to delete without --yes.
@@ -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 h}from"./chunk-3QWAABMG.js";import{randomUUID as N}from"crypto";import{mkdirSync as F,writeFileSync as f,appendFileSync as A,existsSync as v}from"fs";import{join as a}from"path";import{writeFileSync as w,mkdirSync as x,existsSync as I}from"fs";import{join as p,relative as j}from"path";function _(n){let t=Object.keys(n.frontmatter).length>0?m(n.frontmatter).trimEnd():"",s=["---"];return t&&s.push(t),s.push("---",""),s.push(`# ${n.heading}`,""),n.steps.forEach((i,r)=>{s.push(`## Step ${r+1}`,i,"")}),s.join(`
3
+ `)}function k(n,e){let t={},s={},i=e;for(let[r,l]of Object.entries(n)){if(r.startsWith("global.")||r.startsWith("secrets.user.")||r.startsWith("environment.")){let o=r.startsWith("secrets.user.");t[r]={value:l.value,secret:o,syntax:`{{${r}}}`,type:o?"secret":r.startsWith("environment.")?"environment":"global"},s[r]=r;continue}if(l.secret){let o=`secrets.user.${r}`;t[o]={value:l.value,secret:!0,syntax:`{{secrets.user.${r}}}`,type:"secret"},s[r]=o,i=i.replaceAll(`{{${r}}}`,`{{secrets.user.${r}}}`)}else{let o=`global.${r}`;t[o]={value:l.value,secret:!1,syntax:`{{global.${r}}}`,type:"global"},s[r]=o,i=i.replaceAll(`{{${r}}}`,`{{global.${r}}}`)}}return{variables:t,objective:i,keyMap:s}}var y=/\{\{\s*(?:global|secrets\.user|environment)\.([^{}]+?)\s*\}\}/g;function c(n){return typeof n!="string"||!n.includes("{{")?n:n.replace(y,"{{$1}}")}function d(n){if(typeof n=="string")return c(n);if(Array.isArray(n))return n.map(e=>d(e));if(n&&typeof n=="object"){let e={};for(let[t,s]of Object.entries(n))e[t]=d(s);return e}return n}var L=new Set(["username","access_key","oauth","profile","project_id","folder_id"]),$=new Set(["model","env"]),g=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=p(this.opts.cwd,".testmuai","tests");try{x(t,{recursive:!0})}catch(u){process.stderr.write(`
4
+ \u26A0 Failed to create ${j(this.opts.cwd,t)}/
5
+ ${u.message}
6
+ Your test recording was NOT saved.
7
+
8
+ `);return}let s=p(t,`${e}_test.md`),i=2,r=!1;for(;I(s);)s=p(t,`${e}-${i}_test.md`),i++,r=!0;let l=d(E(this.opts.getResolvedGlobal())),o=_({frontmatter:l,heading:`Session: ${e}`,steps:this.objectives.map(c)});try{w(s,o,"utf8")}catch(u){process.stderr.write(`
9
+ \u26A0 Failed to save your test recording.
10
+ ${u.message}
11
+ Path: ${s}
12
+
13
+ `);return}this.lastWrittenPath=s,this.lastCollisionSuffixed=r}};function E(n){let e={};for(let[t,s]of Object.entries(n))L.has(t)||$.has(t)||(e[t]=s);return e}var D=a(h,"sessions"),b=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;_plan=null;_startedAt="";_remoteLogger=null;_earlyLogBuffer=[];_recorder=null;_resolvedGlobal={};_sessionName=null;_recordingEnabled=!0;_stepRunRecords=[];constructor(e){this.sessionId=N();let t=e?.baseDir?a(e.baseDir,"sessions"):D;this.sessionDir=a(t,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{F(this.sessionDir,{recursive:!0}),this._recorder=new g({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,plan:this._plan,objectives:[],runs:[],status:"in_progress"};f(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}})}}setPlan(e){this._plan=e;let t={level:"info",event:"SESSION_INFO",message:"Session info",context:{session_id:this.sessionId,plan:e??null}};this._remoteLogger?this._remoteLogger.log(t.level,t.event,t.message,t.context):this._earlyLogBuffer.push(t)}get plan(){return this._plan}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,i){if(t===void 0){this._log(e);let o=e.indexOf(" "),u=o>0?e.slice(0,o):e,R=o>0?e.slice(o+1):"",S=/fail|error/i.test(e)?"error":"info";this._remoteLogger?.log(S,u,R||e);return}let r=e,l=s;this._log(`${t} ${l}`),this._remoteLogger?.log(r,t,l,i)}logStep(e,t,s){this._log(`${e} ${t}`);let i=this._nextIndex>0?this._nextIndex-1:0;this._remoteLogger?.logStep(i,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,i){let r=(s??0).toFixed(1),l=(i??"").slice(0,100);this._log(`RUN ${e} END status=${t} duration=${r}s summary="${l}"`),this._remoteLogger?.log("info","RUN_END",`Run ${e} ended`,{run_index:e,status:t,duration:s??0,summary:i??""}),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,plan:this._plan,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}))};v(this.sessionDir)&&f(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},i=t.run_dirs?.length??1;for(let r=0;r<i;r++)e.push(s)}return e}setUploadStatus(e,t){this._uploadStatus=e,this._uploadAttempts+=1,this._uploadError=t??null}_log(e){if(!(!this._started||!v(this.sessionDir)))try{let t=new Date().toISOString().slice(0,19).replace("T"," "),s=a(this.sessionDir,"tui.log");A(s,`[${t}] ${e}
17
+ `)}catch{}}};export{_ as a,k as b,b as c};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as l}from"./chunk-HCBYKLMW.js";import{a as i,d as a}from"./chunk-C44QQJR4.js";import{a as b}from"./chunk-6YGTRKDT.js";import{e as c}from"./chunk-UR6MHSHU.js";var e=c(b(),1);var t=c(l(),1),d=(0,e.createContext)(null);function f({children:o}){let[n,p]=(0,e.useState)([]),s=(0,e.useRef)(0),u=(0,e.useMemo)(()=>({append:r=>p(S=>[...S,{id:`sb-${++s.current}`,content:r}])}),[]);return(0,t.jsxs)(d.Provider,{value:u,children:[n.length>0&&(0,t.jsx)(a,{items:n,children:r=>(0,t.jsx)(i,{children:r.content},r.id)}),o]})}function v(){let o=(0,e.useContext)(d);if(!o)throw new Error("useScrollback must be used within a ScrollbackProvider. Wrap this Ink render() root in <ScrollbackProvider>. Never render <Static> directly \u2014 push via append().");return o}export{f as a,v as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as R}from"./chunk-AT2Y5UNP.js";import{a as Y}from"./chunk-HCBYKLMW.js";import{t as r}from"./chunk-3Z4EHIOW.js";import{a,b as i,i as X}from"./chunk-C44QQJR4.js";import{a as G}from"./chunk-6YGTRKDT.js";import{e as P}from"./chunk-UR6MHSHU.js";var u=P(G(),1);var e=P(Y(),1),f=5;function K(t,I){if(!I)return t;let c=I.toLowerCase();return t.filter(B=>B.label.toLowerCase().includes(c))}function J(t){let{title:I,items:c,loading:B=!1,loadingText:F,error:L=null,itemNoun:T="items",onSelect:H,onCancel:E,defaultActiveId:w,onTab:y,extraHint:N}=t,[x,d]=(0,u.useState)(0),[S,g]=(0,u.useState)(0),[s,A]=(0,u.useState)(""),[C,h]=(0,u.useState)(null);(0,u.useEffect)(()=>{if(c.length===0)return;if(t.preserveSelectionById&&C!==null){let n=c.findIndex(o=>o.id===C);if(n>=0){g(Math.floor(n/f)),d(n%f);return}}let l=w?c.findIndex(n=>n.id===w):c.findIndex(n=>n.isActive);l>=0?(g(Math.floor(l/f)),d(l%f),t.preserveSelectionById&&h(c[l].id)):t.preserveSelectionById&&(g(0),d(0),h(c[0]?.id??null))},[c,w,t.preserveSelectionById,C]),(0,u.useEffect)(()=>{if(!t.onSearch)return;let l=setTimeout(()=>t.onSearch(s),t.searchDebounceMs??250);return()=>clearTimeout(l)},[s,t.onSearch,t.searchDebounceMs]);let m=t.onSearch?c:K(c,s),M=S*f,p=Math.min(M+f,m.length),D=Math.ceil(m.length/f),O=p-M,v=m.slice(M,p);return X((l,n)=>{if(L){n.escape&&E();return}if(n.escape){s?(A(""),d(0),g(0)):E();return}if(n.tab&&y){y();return}if(n.upArrow){if(x>0){let o=x-1;d(o),t.preserveSelectionById&&h(v[o]?.id??null)}else if(S>0){let o=S-1,b=f-1;g(o),d(b),t.preserveSelectionById&&h(m[o*f+b]?.id??null)}return}if(n.downArrow){if(x<O-1){let o=x+1;d(o),t.preserveSelectionById&&h(v[o]?.id??null)}else if(S<D-1){let o=S+1,b=0;g(o),d(b),t.preserveSelectionById&&h(m[o*f+b]?.id??null)}return}if(n.return&&v[x]){H(v[x]);return}if(n.backspace||n.delete){A(o=>o.slice(0,-1)),d(0),g(0);return}l&&!n.ctrl&&!n.meta&&(A(o=>o+l),d(0),g(0))},{isActive:!B}),B?(0,e.jsxs)(a,{flexDirection:"column",borderStyle:"round",borderColor:r.orange,paddingX:2,paddingY:1,children:[(0,e.jsx)(i,{color:r.orange,bold:!0,children:I}),(0,e.jsx)(a,{marginTop:1,children:(0,e.jsx)(i,{color:r.secondary,children:F??`Loading ${T}\u2026`})})]}):L?(0,e.jsxs)(a,{flexDirection:"column",borderStyle:"round",borderColor:r.red,paddingX:2,paddingY:1,children:[(0,e.jsx)(i,{color:r.red,bold:!0,children:I}),(0,e.jsx)(a,{marginTop:1,children:(0,e.jsx)(i,{color:r.red,children:L})}),(0,e.jsx)(R,{bindings:[]})]}):(0,e.jsxs)(a,{flexDirection:"column",borderStyle:"round",borderColor:r.orange,paddingX:2,paddingY:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(i,{color:r.orange,bold:!0,children:I}),(0,e.jsxs)(i,{color:r.dim,children:[" (",m.length,!t.onSearch&&s?`/${c.length}`:""," ",T,t.loadingMore?" \xB7 loading more":"",")"]})]}),(0,e.jsxs)(a,{marginTop:1,children:[(0,e.jsx)(i,{color:r.secondary,children:s?"filter: ":""}),s?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i,{children:s}),(0,e.jsx)(i,{inverse:!0,children:" "})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(i,{color:r.dim,children:["Search ",T,"\u2026"]}),(0,e.jsx)(i,{inverse:!0,children:" "})]})]}),(0,e.jsx)(a,{flexDirection:"column",marginTop:1,children:t.searching?(0,e.jsxs)(i,{color:r.secondary,children:["Searching ",T,"\u2026"]}):m.length===0?(0,e.jsxs)(i,{color:r.dim,children:["No ",T,' match "',s,'"']}):v.map((l,n)=>{let o=n===x,b=o?"\u276F ":" ",$=l.isActive?r.green:o?r.orange:void 0;return(0,e.jsxs)(i,{color:$,children:[b,l.label,l.isActive?" \u25CF selected":""]},l.id)})}),!t.searching&&D>1&&(0,e.jsx)(a,{marginTop:1,children:(0,e.jsxs)(i,{color:r.dim,children:["Page ",S+1,"/",D]})}),t.footer&&(0,e.jsx)(a,{marginTop:1,flexDirection:"column",children:t.footer}),(0,e.jsx)(R,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"type",label:"to search"},{keys:"\u21B5",label:"select"},...y&&N?[{keys:"tab",label:N}]:[]],escBackLabel:s?"clear":"back to chat"})]})}export{J as a};
2
+ import{a as R}from"./chunk-GNJBT6SS.js";import{v as r}from"./chunk-3QWAABMG.js";import{a as Y}from"./chunk-HCBYKLMW.js";import{a,b as i,i as X}from"./chunk-C44QQJR4.js";import{a as G}from"./chunk-6YGTRKDT.js";import{e as P}from"./chunk-UR6MHSHU.js";var u=P(G(),1);var e=P(Y(),1),f=5;function K(t,I){if(!I)return t;let c=I.toLowerCase();return t.filter(B=>B.label.toLowerCase().includes(c))}function J(t){let{title:I,items:c,loading:B=!1,loadingText:F,error:L=null,itemNoun:T="items",onSelect:H,onCancel:E,defaultActiveId:w,onTab:y,extraHint:N}=t,[x,d]=(0,u.useState)(0),[S,g]=(0,u.useState)(0),[s,A]=(0,u.useState)(""),[C,h]=(0,u.useState)(null);(0,u.useEffect)(()=>{if(c.length===0)return;if(t.preserveSelectionById&&C!==null){let n=c.findIndex(o=>o.id===C);if(n>=0){g(Math.floor(n/f)),d(n%f);return}}let l=w?c.findIndex(n=>n.id===w):c.findIndex(n=>n.isActive);l>=0?(g(Math.floor(l/f)),d(l%f),t.preserveSelectionById&&h(c[l].id)):t.preserveSelectionById&&(g(0),d(0),h(c[0]?.id??null))},[c,w,t.preserveSelectionById,C]),(0,u.useEffect)(()=>{if(!t.onSearch)return;let l=setTimeout(()=>t.onSearch(s),t.searchDebounceMs??250);return()=>clearTimeout(l)},[s,t.onSearch,t.searchDebounceMs]);let m=t.onSearch?c:K(c,s),M=S*f,p=Math.min(M+f,m.length),D=Math.ceil(m.length/f),O=p-M,v=m.slice(M,p);return X((l,n)=>{if(L){n.escape&&E();return}if(n.escape){s?(A(""),d(0),g(0)):E();return}if(n.tab&&y){y();return}if(n.upArrow){if(x>0){let o=x-1;d(o),t.preserveSelectionById&&h(v[o]?.id??null)}else if(S>0){let o=S-1,b=f-1;g(o),d(b),t.preserveSelectionById&&h(m[o*f+b]?.id??null)}return}if(n.downArrow){if(x<O-1){let o=x+1;d(o),t.preserveSelectionById&&h(v[o]?.id??null)}else if(S<D-1){let o=S+1,b=0;g(o),d(b),t.preserveSelectionById&&h(m[o*f+b]?.id??null)}return}if(n.return&&v[x]){H(v[x]);return}if(n.backspace||n.delete){A(o=>o.slice(0,-1)),d(0),g(0);return}l&&!n.ctrl&&!n.meta&&(A(o=>o+l),d(0),g(0))},{isActive:!B}),B?(0,e.jsxs)(a,{flexDirection:"column",borderStyle:"round",borderColor:r.orange,paddingX:2,paddingY:1,children:[(0,e.jsx)(i,{color:r.orange,bold:!0,children:I}),(0,e.jsx)(a,{marginTop:1,children:(0,e.jsx)(i,{color:r.secondary,children:F??`Loading ${T}\u2026`})})]}):L?(0,e.jsxs)(a,{flexDirection:"column",borderStyle:"round",borderColor:r.red,paddingX:2,paddingY:1,children:[(0,e.jsx)(i,{color:r.red,bold:!0,children:I}),(0,e.jsx)(a,{marginTop:1,children:(0,e.jsx)(i,{color:r.red,children:L})}),(0,e.jsx)(R,{bindings:[]})]}):(0,e.jsxs)(a,{flexDirection:"column",borderStyle:"round",borderColor:r.orange,paddingX:2,paddingY:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(i,{color:r.orange,bold:!0,children:I}),(0,e.jsxs)(i,{color:r.dim,children:[" (",m.length,!t.onSearch&&s?`/${c.length}`:""," ",T,t.loadingMore?" \xB7 loading more":"",")"]})]}),(0,e.jsxs)(a,{marginTop:1,children:[(0,e.jsx)(i,{color:r.secondary,children:s?"filter: ":""}),s?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i,{children:s}),(0,e.jsx)(i,{inverse:!0,children:" "})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(i,{color:r.dim,children:["Search ",T,"\u2026"]}),(0,e.jsx)(i,{inverse:!0,children:" "})]})]}),(0,e.jsx)(a,{flexDirection:"column",marginTop:1,children:t.searching?(0,e.jsxs)(i,{color:r.secondary,children:["Searching ",T,"\u2026"]}):m.length===0?(0,e.jsxs)(i,{color:r.dim,children:["No ",T,' match "',s,'"']}):v.map((l,n)=>{let o=n===x,b=o?"\u276F ":" ",$=l.isActive?r.green:o?r.orange:void 0;return(0,e.jsxs)(i,{color:$,children:[b,l.label,l.isActive?" \u25CF selected":""]},l.id)})}),!t.searching&&D>1&&(0,e.jsx)(a,{marginTop:1,children:(0,e.jsxs)(i,{color:r.dim,children:["Page ",S+1,"/",D]})}),t.footer&&(0,e.jsx)(a,{marginTop:1,flexDirection:"column",children:t.footer}),(0,e.jsx)(R,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"type",label:"to search"},{keys:"\u21B5",label:"select"},...y&&N?[{keys:"tab",label:N}]:[]],escBackLabel:s?"clear":"back to chat"})]})}export{J as a};
@@ -0,0 +1,11 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as $e}from"./chunk-H2P7UJAU.js";import{a as Fe}from"./chunk-FPFOW6BS.js";import{a as ke}from"./chunk-YCCUBQY4.js";import{a as Ke}from"./chunk-VE3SUJMA.js";import{a as Ue}from"./chunk-WFSTRBQF.js";import{a as Oe}from"./chunk-S7JV4A3U.js";import{a as de}from"./chunk-GNJBT6SS.js";import{c as Re,v as u}from"./chunk-3QWAABMG.js";import{a as Z}from"./chunk-HCBYKLMW.js";import{a as x,b as f,h as Le,i as be,k as De}from"./chunk-C44QQJR4.js";import{a as xe}from"./chunk-6YGTRKDT.js";import{e as O}from"./chunk-UR6MHSHU.js";var Ne=O(xe(),1);import{readFileSync as et,writeFileSync as tt,mkdirSync as nt}from"fs";import{dirname as rt,join as We}from"path";var ot=We(Re,"command-history.json"),yt=We(Re,"generate-history.json"),it=200,_e=class{entries;filePath;max;constructor(t=ot,e=it){this.filePath=t,this.max=e,this.entries=this._load()}push(t){this.entries.length>0&&this.entries[this.entries.length-1]===t||(this.entries.push(t),this.entries.length>this.max&&(this.entries=this.entries.slice(this.entries.length-this.max)),this._save())}getAll(){return[...this.entries]}search(t){let e=t.toLowerCase(),i=[];for(let l=this.entries.length-1;l>=0;l--)this.entries[l].toLowerCase().includes(e)&&i.push(this.entries[l]);return i}_load(){try{let t=et(this.filePath,"utf-8"),e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}}_save(){try{nt(rt(this.filePath),{recursive:!0}),tt(this.filePath,JSON.stringify(this.entries)+`
3
+ `)}catch{}}};function At(r){let t=(0,Ne.useRef)(null);return t.current||(t.current=new _e(r)),t.current}var L=O(xe(),1);var Ie=O(xe(),1);var X=O(Z(),1);function He({history:r,onSelect:t,onClose:e}){let[i,l]=(0,Ie.useState)(""),[a,g]=(0,Ie.useState)(0),v=i?r.search(i).slice(0,8):[];return be((T,d)=>{if(d.escape){e();return}if(d.return){v.length>0&&v[a]?t(v[a]):e();return}if(d.upArrow){g(w=>Math.max(0,w-1));return}if(d.downArrow){g(w=>Math.min(v.length-1,w+1));return}if(d.backspace||d.delete){l(w=>w.slice(0,-1)),g(0);return}T&&!d.ctrl&&!d.meta&&(l(w=>w+T),g(0))}),(0,X.jsxs)(x,{flexDirection:"column",marginLeft:2,borderStyle:"single",paddingX:1,children:[(0,X.jsx)(f,{color:u.muted,bold:!0,children:"reverse search"}),(0,X.jsxs)(x,{gap:1,children:[(0,X.jsx)(f,{color:u.dim,children:"search:"}),(0,X.jsx)(f,{children:i}),(0,X.jsx)(f,{color:u.orange,children:"\u2588"})]}),v.length>0&&(0,X.jsx)(f,{children:" "}),v.map((T,d)=>(0,X.jsx)(x,{marginLeft:2,children:(0,X.jsxs)(f,{color:d===a?u.orange:u.dim,bold:d===a,children:[d===a?"\u25B8 ":" ",T]})},`${d}-${T}`))]})}var ce=O(Z(),1);function Ge({commands:r,selectedIndex:t}){return r.length===0?null:(0,ce.jsx)(x,{flexDirection:"column",marginBottom:0,children:r.map((e,i)=>{let l=i===t;return(0,ce.jsxs)(x,{children:[(0,ce.jsx)(f,{color:l?u.orange:u.dim,children:l?"\u276F ":" "}),(0,ce.jsxs)(f,{color:l?u.orange:void 0,bold:l,children:["/",e.name]}),e.args&&(0,ce.jsxs)(f,{color:u.dim,children:[" ",e.args]}),(0,ce.jsxs)(f,{color:u.dim,children:[" ",e.description]})]},e.name)})})}var Ye=O(xe(),1);var H=O(Z(),1),qe={scenario:"Scenarios",case:"Test Cases",file:"Files"};function Ve(r){let t={scenario:0,case:0,file:0};for(let e of r)t[e.kind]++;return["scenario","case","file"].filter(e=>t[e]>0).map(e=>`${t[e]} ${qe[e]}`).join(" \xB7 ")}var Ee=7;function je({items:r,selectedIndex:t,accent:e=u.orange}){let i=r.length;if(i===0)return null;let l=Math.floor(Ee/2),a=i<=Ee?0:Math.max(0,Math.min(t-l,i-Ee)),g=Math.min(i,a+Ee),v=a,T=i-g;return(0,H.jsxs)(x,{flexDirection:"column",marginBottom:0,children:[v>0&&(0,H.jsx)(x,{children:(0,H.jsx)(f,{color:u.dim,children:` \u22EF ${v} above \u2014 ${Ve(r.slice(0,a))}`})}),r.slice(a,g).map((d,w)=>{let K=a+w,D=K===t,C=w===0||r[K-1].kind!==d.kind;return(0,H.jsxs)(Ye.default.Fragment,{children:[C&&(0,H.jsx)(x,{children:(0,H.jsx)(f,{color:u.dim,children:qe[d.kind]})}),(0,H.jsxs)(x,{children:[(0,H.jsx)(f,{color:D?e:u.dim,children:D?"\u276F ":" "}),(0,H.jsx)(f,{color:D?e:void 0,bold:D,children:d.label})]})]},`${d.kind}:${d.value}:${K}`)}),T>0&&(0,H.jsx)(x,{children:(0,H.jsx)(f,{color:u.dim,children:` \u22EF ${T} more \u2014 ${Ve(r.slice(g))}`})})]})}var ye=O(xe(),1);var st=27,lt=127,at=11;function ct(r){return r>=64&&r<=126}function ut(r,t){r===at&&t({killToEnd:!0,ctrl:!0,raw:String.fromCharCode(r)})}function ft(r,t){r===lt&&t({backspace:!0,meta:!0,raw:"\x1B\x7F"})}function dt(r,t){let e=r.map(l=>String.fromCharCode(l)).join(""),i=/^\[1;([0-9]+)([A-D])$/.exec(e);if(i){let l=parseInt(i[1],10),a=i[2],g={raw:"\x1B"+e};if(l===2)g.shift=!0;else if(l===3)g.meta=!0;else if(l===5)g.ctrl=!0;else return;a==="A"?g.arrowUp=!0:a==="B"?g.arrowDown=!0:a==="C"?g.arrowRight=!0:a==="D"&&(g.arrowLeft=!0),t(g);return}if(e==="[H"||e==="[1~"||e==="[7~"){t({home:!0,raw:"\x1B"+e});return}if(e==="[F"||e==="[4~"||e==="[8~"){t({end:!0,raw:"\x1B"+e});return}if(e==="[3;5~"){t({delete:!0,ctrl:!0,raw:"\x1B"+e});return}if(e==="[3;3~"){t({delete:!0,meta:!0,raw:"\x1B"+e});return}}function mt(r,t){r===72?t({home:!0,raw:"\x1BO"+String.fromCharCode(r)}):r===70&&t({end:!0,raw:"\x1BO"+String.fromCharCode(r)})}function ht(){let r="IDLE",t=[];function e(){r="IDLE",t=[]}return{feed(i,l){for(let a of i)r==="IDLE"?a===st?(r="ESC",t=[]):ut(a,l):r==="ESC"?a===91?(r="CSI",t=[]):a===79?(r="SS3",t=[]):(ft(a,l),e()):r==="CSI"?(t.push(a),ct(a)&&(dt([91,...t],l),e())):r==="SS3"&&(mt(a,l),e())},flushIdle(i){r==="ESC"&&t.length===0&&i({raw:"\x1B"}),e()}}}function ze(r,t={}){let e=(0,ye.useRef)(r);e.current=r;let{stdin:i}=Le();(0,ye.useEffect)(()=>{if(t.isActive===!1||!i)return;let l=ht(),a=null,g=v=>{a&&(clearTimeout(a),a=null);let T=Buffer.isBuffer(v)?v:Buffer.from(v,"binary");l.feed(T,d=>e.current(d)),a=setTimeout(()=>{l.flushIdle(d=>e.current(d)),a=null},50)};return i.on("data",g),()=>{i.removeListener("data",g),a&&clearTimeout(a)}},[t.isActive,i])}var E=O(Z(),1);function gt(r,t){let e=t-1;for(;e>=0&&r[e]!=="@"&&r[e]!==" "&&r[e]!==`
4
+ `;)e--;return e<0||r[e]!=="@"||e>0&&r[e-1]!==" "&&r[e-1]!==`
5
+ `?null:{at:e,query:r.slice(e+1,t).join("")}}var Pe=10;function pt(r){return r.replace(/\x1b?\[200~/g,"").replace(/\x1b?\[201~/g,"").replace(/\r\n/g,`
6
+ `).replace(/\r/g,`
7
+ `).replace(/[\x00-\x08\x0b-\x1f\x7f]/g,"")}function xt(r,t){let e=[],i=0;for(;i<=r.length;){let l=i;for(;l<r.length&&r[l]!==`
8
+ `;)l++;if(i===l)e.push({start:i,end:i});else{let a=i;for(;a<l;){let g=Math.min(a+t,l);e.push({start:a,end:g}),a=g}}if(l>=r.length)break;i=l+1}return e}function bt(r,t,e){if(r.length===0)return 0;if(t>=e.length)return r.length-1;if(e[t]===`
9
+ `){for(let i=r.length-1;i>=0;i--)if(r[i].end===t)return i;return r.length-1}for(let i=0;i<r.length;i++){let l=r[i];if(l.start<=t&&t<l.end)return i}return r.length-1}function Xe(r,t,e,i){let l=xt(r,e);if(l.length===0)return null;let a=bt(l,t,r),g=a+i;if(g<0||g>=l.length)return null;let v=t-l[a].start,T=l[g],d=T.end-T.start;return T.start+Math.min(v,d)}function qt({onSubmit:r,onEscape:t,history:e,placeholder:i="Type an objective or /command...",commands:l,clearSeq:a,submitVerb:g,footerBindings:v,inert:T=!1,clearOnSubmit:d=!0,noHistory:w=!1,accent:K=u.orange,scenarios:D,mentionFiles:C}){let[s,R]=(0,L.useState)([]),[m,h]=(0,L.useState)(0),[W,G]=(0,L.useState)("none"),[ee,M]=(0,L.useState)(-1),V=(0,L.useRef)(""),[ve,ie]=(0,L.useState)(!0),{stdout:te}=De(),se=te?.columns??80,[U,Y]=(0,L.useState)(0),[ne,J]=(0,L.useState)(0),[Ae,Te]=(0,L.useState)([]),[me,he]=(0,L.useState)(null),P=(0,L.useRef)(!1);(0,L.useEffect)(()=>{if(a!==void 0){if(!P.current){P.current=!0;return}R([]),h(0),M(-1),V.current="",ie(!0),G("none"),Y(0)}},[a]);let p=s.join(""),A=(()=>{if(W!=="none"||s.length===0)return"";if(p.startsWith("/")&&l&&p.length>=2){let n=p.slice(1).toLowerCase(),o=l.find(S=>S.name.startsWith(n)&&S.name!==n);return o?`/${o.name}`.slice(p.length):""}if(p.startsWith("/")||w)return"";let c=e.getAll();for(let n=c.length-1;n>=0;n--)if(c[n].startsWith(p)&&c[n]!==p)return c[n].slice(p.length);return""})(),_=(()=>{if(!l||!p.startsWith("/"))return[];let c=p.length>=2?p.slice(1).toLowerCase():"";return c&&l.some(n=>n.name===c)?[]:l.filter(n=>!c||n.name.startsWith(c))})(),k=_.length>0&&p.startsWith("/"),q=!!C||!!(D&&D.length)?gt(s,m):null,Ce=q?q.query:null,re=(()=>{if(!q)return[];let c=q.query.toLowerCase(),n=[];(D??[]).forEach((o,S)=>{let y=`s${S+1}`;(!c||y.includes(c)||(o.title??"").toLowerCase().includes(c))&&n.push({kind:"scenario",value:y,label:`@${y} ${o.title??o.sid??""}`.trim()})}),(D??[]).forEach((o,S)=>{let I=S+1;(o.test_cases??[]).forEach((y,F)=>{let j=`s${I}.c${F+1}`;(!c||j.includes(c)||(y.title??"").toLowerCase().includes(c))&&n.push({kind:"case",value:j,label:`@${j} ${y.title??""}`.trim()})})});for(let o of Ae)n.push({kind:"file",value:o,label:o});return n})(),ge=q!==null&&q.at!==me&&!k&&W==="none"&&re.length>0;(0,L.useEffect)(()=>{if(!C||Ce===null){Te([]);return}let c=!1;return C(Ce).then(n=>{c||Te(n)}).catch(()=>{c||Te([])}),()=>{c=!0}},[Ce,C]),(0,L.useEffect)(()=>{ne>=re.length&&J(0)},[re.length]);let Me=c=>{if(!q)return;let n=c.kind==="file"&&/\s/.test(c.value)?`@"${c.value}"`:`@${c.value}`,o=[...s.slice(0,q.at),...n,...s.slice(m)];R(o),h(q.at+n.length),J(0),he(q.at),ie(!1)};if(be((c,n)=>{if(ve&&c&&ie(!1),n.return){if(ge&&re[ne]){Me(re[ne]);return}if(k&&_[U]){let o=`/${_[U].name}`;w||e.push(o),r(o),R([]),h(0),G("none"),M(-1),V.current="",ie(!0),Y(0);return}p.trim()&&(w||e.push(p.trim()),r(p.trim()),d&&(R([]),h(0),G("none"),M(-1),V.current="",ie(!0),Y(0)));return}if(n.escape){if(ge){he(q.at);return}W!=="none"?G("none"):s.length>0?(R([]),h(0),M(-1),V.current=""):t?.();return}if(n.tab&&!n.shift){if(ge&&re[ne]){Me(re[ne]);return}if(k&&_[U]){let o=`/${_[U].name}`;R([...o]),h(o.length),Y(0);return}if(A){let o=p+A;R([...o]),h(o.length);return}return}if(n.ctrl&&c==="r"){if(w)return;G("search");return}if(n.ctrl&&c==="a"){h(0);return}if(n.ctrl&&c==="e"){h(s.length);return}if(n.ctrl&&c==="w"){if(m===0)return;let o=m-1;for(;o>0&&s[o]===" ";)o--;for(;o>0&&s[o-1]!==" ";)o--;let S=[...s.slice(0,o),...s.slice(m)];R(S),h(o);return}if(n.ctrl&&c==="u"){R([]),h(0),M(-1),G("none");return}if(n.meta&&c==="b"){let o=m-1;for(;o>0&&s[o]===" ";)o--;for(;o>0&&s[o-1]!==" ";)o--;h(Math.max(0,o));return}if(n.meta&&c==="f"){let o=m;for(;o<s.length&&s[o]!==" ";)o++;for(;o<s.length&&s[o]===" ";)o++;h(o);return}if(n.leftArrow){if(n.ctrl||n.shift)return;h(o=>Math.max(0,o-1));return}if(n.rightArrow){if(n.ctrl||n.shift)return;if(m>=s.length&&A){let o=p+A;R([...o]),h(o.length)}else h(o=>Math.min(s.length,o+1));return}if(n.upArrow){if(n.shift)return;if(ge){J(o=>Math.max(0,o-1));return}if(k){Y(o=>Math.max(0,o-1));return}if(W==="none"){let o=Math.max(1,se-2),S=Xe(s,m,o,-1);if(S!==null){h(S);return}if(w)return;let I=e.getAll();if(I.length===0)return;if(ee===-1){V.current=p,M(I.length-1);let y=I[I.length-1];R([...y]),h(y.length)}else if(ee>0){let y=ee-1;M(y);let F=I[y];R([...F]),h(F.length)}}return}if(n.downArrow){if(n.shift)return;if(ge){J(o=>Math.min(re.length-1,o+1));return}if(k){Y(o=>Math.min(_.length-1,o+1));return}if(W==="none"){let o=Math.max(1,se-2),S=Xe(s,m,o,1);if(S!==null){h(S);return}if(w)return;let I=e.getAll();if(ee===-1)return;if(ee<I.length-1){let y=ee+1;M(y);let F=I[y];R([...F]),h(F.length)}else{M(-1);let y=V.current;R([...y]),h(y.length)}}return}if(n.backspace||n.delete){if(n.meta||n.ctrl)return;if(m>0){let o=[...s.slice(0,m-1),...s.slice(m)];R(o),h(m-1),M(-1),Y(0),he(null),J(0)}return}if(c&&!n.ctrl&&!n.meta){let o=pt(c);if(!o)return;let S=[...s.slice(0,m),...o,...s.slice(m)];R(S),h(m+o.length),M(-1),Y(0),he(null),J(0)}},{isActive:!T&&W!=="search"}),ze(c=>{if(c.home){h(0);return}if(c.end){h(s.length);return}if(c.killToEnd){R(s.slice(0,m));return}if(c.arrowLeft&&(c.ctrl||c.meta)){let n=m-1;for(;n>0&&s[n]===" ";)n--;for(;n>0&&s[n-1]!==" ";)n--;h(Math.max(0,n));return}if(c.arrowRight&&(c.ctrl||c.meta)){let n=m;for(;n<s.length&&s[n]!==" ";)n++;for(;n<s.length&&s[n]===" ";)n++;h(n);return}if(c.backspace&&c.meta){if(m===0)return;let n=m-1;for(;n>0&&s[n]===" ";)n--;for(;n>0&&s[n-1]!==" ";)n--;let o=[...s.slice(0,n),...s.slice(m)];R(o),h(n);return}if(c.delete&&(c.ctrl||c.meta)){let n=m;for(;n<s.length&&s[n]===" ";)n++;for(;n<s.length&&s[n]!==" ";)n++;R([...s.slice(0,m),...s.slice(n)]);return}},{isActive:!T&&W!=="search"}),T)return(0,E.jsxs)(x,{flexDirection:"column",children:[(0,E.jsx)(f,{color:u.muted,children:"\u2500".repeat(se)}),(0,E.jsxs)(x,{children:[(0,E.jsx)(f,{color:u.muted,children:"\u276F "}),(0,E.jsx)(f,{color:u.dim,children:i})]}),(0,E.jsx)(de,{bindings:v??[{keys:"ctrl+c",label:"cancel"},{keys:"/cancel",label:"stop turn"},{keys:"ctrl+t",label:"thinking"}],suppressEscBack:!0})]});let Qe=c=>{R([...c]),h(c.length),G("none")},Ze=()=>{G("none")},we=(()=>{if(ve&&s.length===0)return null;let c=m>=s.length,n=s.slice(0,m).join(""),o,S;c?(o=" ",S=""):s[m]===`
10
+ `?(o=" ",S=s.slice(m).join("")):(o=s[m],S=s.slice(m+1).join(""));let I=n+o+S+A,y=n.length,F=y+1,j=F+S.length,Se=Math.max(1,se-2),B=[],oe=0;for(;oe<=I.length;){let N=I.indexOf(`
11
+ `,oe);if(N===-1&&(N=I.length),oe===N)B.push({type:"content",start:oe,end:oe});else{let z=oe;for(;z<N;){let le=Math.min(z+Se,N);B.push({type:"content",start:z,end:le}),z=le}}if(N>=I.length)break;oe=N+1}let Q=Math.max(0,B.findIndex(N=>N.start<=y&&y<=N.end)),fe;if(B.length<=Pe)fe=B;else{let z=Pe-1-4;if(Q<4||Q>=B.length-z)fe=[...B.slice(0,4),{type:"ellipsis",hidden:B.length-4-z},...B.slice(B.length-z)];else{let le=Pe-2,Be=Math.floor(le/2),ae=Q-Be,pe=Q+(le-Be)-1;ae<1&&(pe+=1-ae,ae=1),pe>B.length-2&&(ae-=pe-(B.length-2),pe=B.length-2),ae=Math.max(1,ae),fe=[{type:"ellipsis",hidden:ae},...B.slice(ae,pe+1),{type:"ellipsis",hidden:B.length-pe-1}]}}return{full:I,b:y,c:F,a:j,rows:fe}})();return(0,E.jsxs)(x,{flexDirection:"column",children:[W==="search"&&(0,E.jsx)(He,{history:e,onSelect:Qe,onClose:Ze}),k&&(0,E.jsx)(Ge,{commands:_,selectedIndex:U}),ge&&(0,E.jsx)(je,{items:re,selectedIndex:ne,accent:K}),(0,E.jsx)(f,{color:u.muted,children:"\u2500".repeat(se)}),we===null?(0,E.jsxs)(x,{children:[(0,E.jsx)(f,{color:K,children:"\u276F "}),(0,E.jsx)(f,{inverse:!0,children:" "}),(0,E.jsx)(f,{color:u.dim,children:i})]}):(()=>{let c=we.rows.findIndex(n=>n.type==="content");return(0,E.jsx)(x,{flexDirection:"column",children:we.rows.map((n,o)=>{if(n.type==="ellipsis")return(0,E.jsx)(x,{children:(0,E.jsxs)(f,{color:u.dim,children:[" \u22EF ","(",n.hidden," more line",n.hidden===1?"":"s",")"]})},o);let{full:S,b:I,c:y,a:F}=we,j=n.start,ue=n.end,Se=o===c,B=Se?"\u276F ":" ",oe=Se?K:u.muted,Q=[(0,E.jsx)(f,{color:oe,children:B},"p")];j<Math.min(I,ue)&&Q.push((0,E.jsx)(f,{children:S.slice(j,Math.min(I,ue))},"b"));let fe=Math.max(I,j),N=Math.min(y,ue);fe<N&&Q.push((0,E.jsx)(f,{color:K,inverse:!0,children:S.slice(fe,N)},"c"));let z=Math.max(y,j),le=Math.min(F,ue);return z<le&&Q.push((0,E.jsx)(f,{children:S.slice(z,le)},"a")),ue>F&&Q.push((0,E.jsx)(f,{color:u.dim,children:S.slice(Math.max(F,j),ue)},"g")),(0,E.jsx)(x,{children:Q},o)})})})(),(0,E.jsx)(de,{bindings:v??[{keys:"\u2191\u2193",label:"history"},{keys:"\u21B5",label:g??"submit"},{keys:"tab",label:"complete"},{keys:"ctrl+r",label:"search"}],escBackLabel:"clear"})]})}var $=O(xe(),1);var b=O(Z(),1);function Tt(r){let t=[{id:"method",label:"Auth method",options:[{label:"Basic Auth",value:"basic"},{label:"OAuth (browser)",value:"oauth"}]}];return r&&t.push({id:"env",label:"Environment",options:[{label:"prod",value:"prod"},{label:"stage",value:"stage"}]}),t.push({id:"profile",label:"Profile"}),t.push({id:"credentials",label:"Credentials"}),t}function en({devMode:r,profiles:t,onBasicLogin:e,onOAuthLogin:i,onComplete:l,onCancel:a}){let g=Tt(r),[v,T]=(0,$.useState)(0),[d,w]=(0,$.useState)(0),[K,D]=(0,$.useState)({}),[C,s]=(0,$.useState)("select"),[R,m]=(0,$.useState)(""),[h,W]=(0,$.useState)("username"),[G,ee]=(0,$.useState)(""),[M,V]=(0,$.useState)(null),[ve,ie]=(0,$.useState)(null),te=g[v],se=K.method??"basic",U=K.env??"prod",Y=(0,$.useCallback)(()=>{let p=t.filter(A=>A.env===U).map(A=>({label:`${A.profile} [${A.env}]`,value:A.profile}));return p.push({label:"+ Create new",value:"__new__"}),p},[t,U]),ne=(0,$.useCallback)(()=>{v===0?a():(T(P=>P-1),w(0),s("select"),m(""),V(null))},[v,a]),J=(0,$.useCallback)(P=>{se==="basic"?(s("text-input"),W("username"),m("")):(s("waiting"),i(P,U).then(()=>{ie(`Logged in via OAuth as ${P} [${U}]`),s("done")}).catch(p=>{V(p.message),s("error")}))},[se,U,i]),Ae=(0,$.useCallback)(P=>{let p=P.trim();if(p){if(h==="profileName"){let A=p;D(_=>({..._,profile:A})),J(A);return}if(h==="username"){ee(p),m(""),W("accessKey"),s("text-input-masked");return}if(h==="accessKey"){let A=K.profile??"default";s("waiting"),(async()=>{try{await e(A,U,G,p),ie(`Logged in as ${A} [${U}] via basic auth`),s("done")}catch{V("Credentials not valid. Please use valid credentials."),ee(""),m(""),W("username"),s("text-input")}})()}}},[h,K.profile,U,e,G,J]),Te=(0,$.useCallback)(P=>{m(P),M&&V(null)},[M]);be((P,p)=>{if(C==="done"){let _=K.profile??"default";l(_,U);return}if(C==="error"){a();return}if(C==="waiting"){p.escape&&a();return}if(C==="text-input"||C==="text-input-masked")return;if(p.escape){ne();return}let A=te?.id==="profile"?Y():te?.options??[];if(p.upArrow){w(_=>Math.max(0,_-1));return}if(p.downArrow){w(_=>Math.min(A.length-1,_+1));return}if(p.return&&A[d]){let _=A[d];if(te.id==="profile"){if(_.value==="__new__"){s("text-input"),W("profileName"),m("");return}D(k=>({...k,profile:_.value})),T(k=>k+1),w(0),J(_.value);return}D(k=>({...k,[te.id]:_.value})),T(k=>k+1),w(0)}});let me="Login";if(C==="done")return(0,b.jsxs)(x,{flexDirection:"column",borderStyle:"round",borderColor:u.green,paddingX:2,paddingY:1,children:[(0,b.jsxs)(f,{color:u.green,bold:!0,children:["\u2713 ",ve]}),(0,b.jsx)(x,{marginTop:1,children:(0,b.jsx)(f,{color:u.dim,children:"press any key"})})]});if(C==="error")return(0,b.jsxs)(x,{flexDirection:"column",borderStyle:"round",borderColor:u.red,paddingX:2,paddingY:1,children:[(0,b.jsx)(f,{color:u.red,bold:!0,children:"Login failed"}),(0,b.jsx)(x,{marginTop:1,children:(0,b.jsx)(f,{color:u.red,children:M})}),(0,b.jsx)(x,{marginTop:1,children:(0,b.jsx)(f,{color:u.dim,children:"press any key"})})]});if(C==="waiting")return(0,b.jsxs)(x,{flexDirection:"column",borderStyle:"round",borderColor:u.orange,paddingX:2,paddingY:1,children:[(0,b.jsxs)(f,{color:u.orange,bold:!0,children:[me," \u203A OAuth"]}),(0,b.jsx)(x,{marginTop:1,children:(0,b.jsx)(f,{color:u.secondary,children:"Opening browser for login..."})}),(0,b.jsx)(x,{marginTop:1,children:(0,b.jsx)(f,{color:u.orange,children:"Waiting for callback \u27F3"})}),(0,b.jsx)(de,{bindings:[],escBackLabel:"cancel"})]});if(C==="text-input"||C==="text-input-masked"){let P=h==="username"?"Username":h==="accessKey"?"Access Key":"Profile name",p=h==="username"||h==="accessKey"?`${me} \u203A Basic Auth`:`${me} \u203A New Profile`;return(0,b.jsxs)(x,{flexDirection:"column",borderStyle:"round",borderColor:u.orange,paddingX:2,paddingY:1,children:[M&&(h==="username"||h==="accessKey")&&(0,b.jsx)(x,{marginBottom:1,children:(0,b.jsxs)(f,{color:u.red,children:["\u2717 ",M]})}),(0,b.jsx)(f,{color:u.orange,bold:!0,children:p}),h==="accessKey"&&(0,b.jsxs)(x,{marginTop:1,children:[(0,b.jsx)(f,{color:u.secondary,children:"Username: "}),(0,b.jsx)(f,{children:G})]}),(0,b.jsxs)(x,{marginTop:1,children:[(0,b.jsxs)(f,{color:u.secondary,children:[P,": "]}),(0,b.jsx)(ke,{value:R,onChange:Te,onSubmit:Ae,onCancel:ne,masked:C==="text-input-masked"})]}),(0,b.jsx)(de,{bindings:[{keys:"\u21B5",label:"confirm"}],escBackLabel:"back"})]})}let he=te?.id==="profile"?Y():te?.options??[];return(0,b.jsxs)(x,{flexDirection:"column",borderStyle:"round",borderColor:u.orange,paddingX:2,paddingY:1,children:[(0,b.jsx)(f,{color:u.orange,bold:!0,children:me}),(0,b.jsx)(x,{marginTop:1,children:(0,b.jsxs)(f,{color:u.secondary,children:[te?.label,":"]})}),(0,b.jsx)(x,{flexDirection:"column",marginTop:1,children:he.map((P,p)=>{let A=p===d,_=A?"\u276F ":" ",k=P.value==="__new__"?u.green:A?u.orange:void 0;return(0,b.jsxs)(f,{color:k,children:[_,P.label]},P.value)})}),(0,b.jsx)(de,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"select"}],escBackLabel:"back"})]})}async function Je(r,t,e,i){let l=r.loadBasicAuth(t,e),a=r.loadCredentials(t,e);if(!l&&!a)return i("info","STARTUP_GATE_NO_CREDS","Profile has no credentials",{profile:t,env:e}),{status:"needs_login",profile:t,env:e};let g=Oe(e),v=async()=>r.loadCredentials(t,e)?.access_token??null,T=new Fe(g.controllerBaseUrl,v,l,i);i("info","STARTUP_GATE_VALIDATE","Validating credentials with controller",{profile:t,env:e,method:l?"basic":"oauth"});let d=await T.resolve(!0);if(d)return i("info","STARTUP_GATE_VALID","Credentials validated",{profile:t,env:e,username:d.username,org_id:d.org_id}),{status:"authenticated",result:{profile:t,env:e,credentials:a,basicAuth:l,tmsCreds:d,resolver:T}};if(!l&&a){let w=a.refresh_token,D=r.loadClient(t,e)?.client_id;if(w&&D){i("info","STARTUP_GATE_REFRESH","Attempting token refresh",{profile:t,env:e});try{let s=await new Ue(e).refreshToken(w,D);if(s.access_token){r.saveCredentials(t,e,{...a,...s,expires_at:Date.now()/1e3+(s.expires_in??3600)});let m=await T.resolve(!0);if(m)return i("info","STARTUP_GATE_REFRESH_OK","Token refreshed and validated",{profile:t,env:e,username:m.username}),{status:"authenticated",result:{profile:t,env:e,credentials:{...a,...s},basicAuth:null,tmsCreds:m,resolver:T}}}i("warn","STARTUP_GATE_REFRESH_INVALID","Refreshed token still invalid",{profile:t,env:e})}catch(C){i("warn","STARTUP_GATE_REFRESH_FAILED","Token refresh failed",{profile:t,env:e,error:C instanceof Error?C.message:String(C)})}}else i("info","STARTUP_GATE_NO_REFRESH","No refresh_token or client_id \u2014 login required",{profile:t,env:e})}return i("info","STARTUP_GATE_INVALID","Credentials invalid \u2014 login required",{profile:t,env:e}),{status:"needs_login",profile:t,env:e}}async function an(r,t,e=new $e){let i=r.listProfiles();if(t("info","STARTUP_GATE_START","Auth startup gate",{profile_count:i.length}),i.length===0)return t("info","STARTUP_GATE_NONE","No profiles found \u2014 login required"),{status:"needs_login"};if(i.length>1){let g=r.getActiveProfile(),v=r.getDefaultEnv();if(g&&i.some(d=>d.profile===g&&d.env===v)){t("info","STARTUP_GATE_TRY_ACTIVE","Multiple profiles \u2014 trying active first",{activeProfile:g,activeEnv:v});let d=await Je(r,g,v,t);if(d.status==="authenticated")return d;t("info","STARTUP_GATE_ACTIVE_FAILED","Active profile invalid \u2014 showing picker",{activeProfile:g,activeEnv:v})}return t("info","STARTUP_GATE_MULTI","Multiple profiles \u2014 picker required",{profiles:i.map(T=>`${T.profile}/${T.env}`)}),{status:"needs_pick",profiles:i}}let{profile:l,env:a}=i[0];return r.setActiveProfile(l),r.setDefaultEnv(a),Ke(r,e,l,a),Je(r,l,a,t)}export{yt as a,At as b,qt as c,en as d,Je as e,an as f};