@testmuai/kane-cli 0.4.8 → 0.4.10

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 (78) hide show
  1. package/dist/{ChromeProfilePicker-B2PUH2LL.js → ChromeProfilePicker-EFEVOCWS.js} +1 -1
  2. package/dist/{CliFeedbackPrompt-647ESLIL.js → CliFeedbackPrompt-PPGJMKHQ.js} +1 -1
  3. package/dist/{CliUploadProgress-U325KQO6.js → CliUploadProgress-3GGOTLPQ.js} +1 -1
  4. package/dist/{ConfigView-NKD7QMUV.js → ConfigView-Y7E4Q647.js} +1 -1
  5. package/dist/FolderPicker-LI5JKG2S.js +2 -0
  6. package/dist/{HelpView-35KKWQVE.js → HelpView-KHQYGSD2.js} +1 -1
  7. package/dist/{InfoBox-OIZ3APE3.js → InfoBox-BQ2QOIUP.js} +1 -1
  8. package/dist/{LinksBox-DLIYPE3S.js → LinksBox-DX6BJAX5.js} +1 -1
  9. package/dist/{ProfilesView-CFYBJIL4.js → ProfilesView-X35WWM4L.js} +1 -1
  10. package/dist/{ProjectPicker-ASHXV4HU.js → ProjectPicker-Y4A4UVHA.js} +1 -1
  11. package/dist/{SaveSessionPrompt-ATKVPQEJ.js → SaveSessionPrompt-IS6HZSF4.js} +1 -1
  12. package/dist/SingleShotApp-RO25ZX2E.js +2 -0
  13. package/dist/{SummaryBox-AAXB55TE.js → SummaryBox-47MHU37V.js} +1 -1
  14. package/dist/TestMdRunView-OXVWHOV3.js +2 -0
  15. package/dist/{WhoamiView-TRGZE2NZ.js → WhoamiView-KVIQCGRC.js} +1 -1
  16. package/dist/{changelog-JBGYPN7J.js → changelog-S4ZLEQLC.js} +1 -1
  17. package/dist/chunk-53O3GMZR.js +8 -0
  18. package/dist/{chunk-LZEYE2WE.js → chunk-6ATKQYAL.js} +1 -1
  19. package/dist/{chunk-CVC6MQN6.js → chunk-7GOX44H7.js} +1 -1
  20. package/dist/{chunk-DMLJUTQO.js → chunk-AKLIPQVR.js} +1 -1
  21. package/dist/{chunk-F6VA5YBJ.js → chunk-AT45XB6X.js} +3 -3
  22. package/dist/chunk-BQACGLXW.js +5 -0
  23. package/dist/{chunk-UR4NSWY7.js → chunk-DMG5QABA.js} +1 -1
  24. package/dist/{chunk-F5ZL4XYL.js → chunk-EQC7WE2O.js} +1 -1
  25. package/dist/{chunk-5VZSCQXN.js → chunk-FKAXPYV7.js} +1 -1
  26. package/dist/{chunk-25YRWDQ7.js → chunk-G2GQ67DP.js} +1 -1
  27. package/dist/{chunk-LY3DAHNE.js → chunk-G3PWEKD7.js} +2 -2
  28. package/dist/{chunk-AD6DPSIZ.js → chunk-GF44B552.js} +1 -1
  29. package/dist/{chunk-SSPIKPHV.js → chunk-GSKA5DKJ.js} +1 -1
  30. package/dist/{chunk-C2E2DKY3.js → chunk-HPZREZKG.js} +1 -1
  31. package/dist/{chunk-YYSABHRE.js → chunk-HUAOH2JK.js} +1 -1
  32. package/dist/{chunk-ALF5ETLD.js → chunk-IGZPQQFP.js} +1 -1
  33. package/dist/{chunk-IXYUSFH2.js → chunk-IS62CNJW.js} +2 -2
  34. package/dist/{chunk-EAUU5F4P.js → chunk-IT66S24L.js} +1 -1
  35. package/dist/{chunk-SH5FUG47.js → chunk-JKLKZCJS.js} +1 -1
  36. package/dist/{chunk-GRIQ4OQL.js → chunk-KJLOYIWT.js} +1 -1
  37. package/dist/{chunk-3PISMPFM.js → chunk-KKIFXAJY.js} +1 -1
  38. package/dist/chunk-LRKWPAGK.js +2 -0
  39. package/dist/{chunk-K266M5ZM.js → chunk-NAAPNSZD.js} +1 -1
  40. package/dist/{chunk-ZQPTSSU6.js → chunk-NUGGT2XH.js} +1 -1
  41. package/dist/{chunk-CL5SB2I7.js → chunk-OHT5RY5E.js} +1 -1
  42. package/dist/{chunk-WKS4ST3B.js → chunk-QC73LMAN.js} +1 -1
  43. package/dist/{chunk-WZ6GNXM3.js → chunk-QSXYNJOW.js} +1 -1
  44. package/dist/{chunk-HZUTFC3G.js → chunk-RB2YKN77.js} +1 -1
  45. package/dist/{chunk-ZQ5IPBXJ.js → chunk-RQZCGHG7.js} +1 -1
  46. package/dist/{chunk-W67JBBQF.js → chunk-SQOIKS77.js} +2 -2
  47. package/dist/chunk-UAYCLUUZ.js +27 -0
  48. package/dist/{chunk-SVZUJ2QE.js → chunk-UBN6J3ZA.js} +1 -1
  49. package/dist/{chunk-SRQ7P3WI.js → chunk-VLWWDXBN.js} +1 -1
  50. package/dist/{chunk-YJVA6LBY.js → chunk-XCOU6AYD.js} +1 -1
  51. package/dist/{chunk-ZRGEUDG5.js → chunk-XCYCX4TU.js} +1 -1
  52. package/dist/{chunk-RBG4VTHQ.js → chunk-YAOWO2GE.js} +1 -1
  53. package/dist/{generate-headless-VB52MM2A.js → generate-headless-ODYT3HT7.js} +2 -2
  54. package/dist/index.js +13 -13
  55. package/dist/{list-commands-X6EXASQG.js → list-commands-PNYMVI6X.js} +1 -1
  56. package/dist/login-flow-FIYH6K4A.js +2 -0
  57. package/dist/{persist-recorded-session-EI4ISSRI.js → persist-recorded-session-OJPXI4HP.js} +1 -1
  58. package/dist/{recording-banner-BQQSRJIF.js → recording-banner-3XTXU2VL.js} +1 -1
  59. package/dist/{require-project-folder-LSM4YSKJ.js → require-project-folder-CFX6U6BZ.js} +1 -1
  60. package/dist/{run-test-md-VR2Q46Q3.js → run-test-md-YWKVMQDJ.js} +3 -3
  61. package/dist/{skill-installer-JS7LUETO.js → skill-installer-GYYMVNE4.js} +1 -1
  62. package/dist/tcg-generate-KLY7QZY2.js +2 -0
  63. package/dist/testmd-actions-OUY5BOAV.js +2 -0
  64. package/dist/token-refresh-QCHKMPCM.js +2 -0
  65. package/dist/{validate-basic-W7UJ5D25.js → validate-basic-4YMRWYLS.js} +1 -1
  66. package/dist/{version-check-ACQ5Z7JV.js → version-check-GU2LS6NM.js} +1 -1
  67. package/package.json +6 -6
  68. package/dist/FolderPicker-2LEIB5F5.js +0 -2
  69. package/dist/SingleShotApp-JYKEW3WS.js +0 -2
  70. package/dist/TestMdRunView-U35UBFHZ.js +0 -2
  71. package/dist/chunk-BGXAW2B5.js +0 -2
  72. package/dist/chunk-IT2GFEFH.js +0 -5
  73. package/dist/chunk-UVOM74DG.js +0 -27
  74. package/dist/chunk-XCMNFMSO.js +0 -8
  75. package/dist/login-flow-R5IGUIPA.js +0 -2
  76. package/dist/tcg-generate-YQJZTSSI.js +0 -2
  77. package/dist/testmd-actions-FAQYABQT.js +0 -2
  78. package/dist/token-refresh-XM3DXY2A.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-GRIQ4OQL.js";import"./chunk-EAUU5F4P.js";import"./chunk-BGXAW2B5.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};
2
+ import{a,b,c}from"./chunk-KJLOYIWT.js";import"./chunk-IT66S24L.js";import"./chunk-LRKWPAGK.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-F5ZL4XYL.js";import"./chunk-EAUU5F4P.js";import"./chunk-BGXAW2B5.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};
2
+ import{a as r}from"./chunk-EQC7WE2O.js";import"./chunk-IT66S24L.js";import"./chunk-LRKWPAGK.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-ZQ5IPBXJ.js";import"./chunk-UR4NSWY7.js";import"./chunk-BGXAW2B5.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};
2
+ import{a as P,b as g,c as f}from"./chunk-RQZCGHG7.js";import"./chunk-DMG5QABA.js";import"./chunk-LRKWPAGK.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};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as p,b as l,c as n}from"./chunk-WZ6GNXM3.js";import{x as o}from"./chunk-BGXAW2B5.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};
2
+ import{a as p,b as l,c as n}from"./chunk-QSXYNJOW.js";import{x as o}from"./chunk-LRKWPAGK.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-VLWWDXBN.js";import"./chunk-YCCUBQY4.js";import"./chunk-YAOWO2GE.js";import"./chunk-LPUQ4HWQ.js";import"./chunk-NLCCBXXV.js";import"./chunk-KKIFXAJY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-IT66S24L.js";import"./chunk-LRKWPAGK.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as FolderPicker,a as formatFolderLine};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as f,b as i,x as t}from"./chunk-BGXAW2B5.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-mode|set-assertion-mode|\u2026",desc:"Chrome, run & generate settings"}),(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};
2
+ import{a as f,b as i,x as t}from"./chunk-LRKWPAGK.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-mode|set-assertion-mode|\u2026",desc:"Chrome, run & generate settings"}),(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-LZEYE2WE.js";import"./chunk-WZ6GNXM3.js";import"./chunk-BGXAW2B5.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as InfoBox};
2
+ import{a}from"./chunk-6ATKQYAL.js";import"./chunk-QSXYNJOW.js";import"./chunk-LRKWPAGK.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-SSPIKPHV.js";import"./chunk-BGXAW2B5.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as LinksBox};
2
+ import{a}from"./chunk-GSKA5DKJ.js";import"./chunk-LRKWPAGK.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-AD6DPSIZ.js";import"./chunk-EAUU5F4P.js";import"./chunk-BGXAW2B5.js";import"./chunk-HCBYKLMW.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-GF44B552.js";import"./chunk-IT66S24L.js";import"./chunk-LRKWPAGK.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as ProfilesView,a as formatProfileLine};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-CL5SB2I7.js";import"./chunk-YCCUBQY4.js";import"./chunk-RBG4VTHQ.js";import"./chunk-LPUQ4HWQ.js";import"./chunk-NLCCBXXV.js";import"./chunk-3PISMPFM.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EAUU5F4P.js";import"./chunk-BGXAW2B5.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as ProjectPicker,a as formatProjectLine};
2
+ import{a,b}from"./chunk-OHT5RY5E.js";import"./chunk-YCCUBQY4.js";import"./chunk-YAOWO2GE.js";import"./chunk-LPUQ4HWQ.js";import"./chunk-NLCCBXXV.js";import"./chunk-KKIFXAJY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-IT66S24L.js";import"./chunk-LRKWPAGK.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-ZQPTSSU6.js";import"./chunk-S3DAAAE5.js";import"./chunk-LZEYE2WE.js";import"./chunk-WZ6GNXM3.js";import"./chunk-BGXAW2B5.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};
2
+ import{a,b,c}from"./chunk-NUGGT2XH.js";import"./chunk-S3DAAAE5.js";import"./chunk-6ATKQYAL.js";import"./chunk-QSXYNJOW.js";import"./chunk-LRKWPAGK.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-HPZREZKG.js";import"./chunk-G2GQ67DP.js";import"./chunk-NAAPNSZD.js";import"./chunk-L5LI2JF4.js";import"./chunk-53O3GMZR.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-OHT5RY5E.js";import"./chunk-VLWWDXBN.js";import"./chunk-YCCUBQY4.js";import"./chunk-YAOWO2GE.js";import"./chunk-LOIRZFV3.js";import"./chunk-LPUQ4HWQ.js";import"./chunk-NLCCBXXV.js";import"./chunk-VE3SUJMA.js";import"./chunk-RB2YKN77.js";import"./chunk-IGZPQQFP.js";import"./chunk-KKIFXAJY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-IT66S24L.js";import"./chunk-LRKWPAGK.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-SVZUJ2QE.js";import"./chunk-LZEYE2WE.js";import"./chunk-WZ6GNXM3.js";import"./chunk-BGXAW2B5.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};
2
+ import{a,b,c,d}from"./chunk-UBN6J3ZA.js";import"./chunk-6ATKQYAL.js";import"./chunk-QSXYNJOW.js";import"./chunk-LRKWPAGK.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-XCOU6AYD.js";import"./chunk-BQACGLXW.js";import"./chunk-DMG5QABA.js";import"./chunk-LOIRZFV3.js";import"./chunk-KKIFXAJY.js";import"./chunk-6ATKQYAL.js";import"./chunk-QSXYNJOW.js";import"./chunk-C6S4IEBC.js";import"./chunk-LRKWPAGK.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as TestMdRunView};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as b,b as r}from"./chunk-WZ6GNXM3.js";import{x as o}from"./chunk-BGXAW2B5.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};
2
+ import{a as b,b as r}from"./chunk-QSXYNJOW.js";import{x as o}from"./chunk-LRKWPAGK.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{a as l}from"./chunk-RZ4F3BHX.js";import{c as i,f as c}from"./chunk-BGXAW2B5.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-LRKWPAGK.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,8 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{d as a,j as l}from"./chunk-LRKWPAGK.js";import{readFileSync as g,writeFileSync as o,mkdirSync as i,existsSync as p}from"fs";import{dirname as s}from"path";var n={window_size:{width:1920,height:1080},chrome_profile_path:"",default_url:l,model:"v16-alpha",project_id:null,project_name:null,folder_id:null,folder_name:null,mode:"testing",assertion_mode:"visual",network_ws:!1,network_sse:!1,code_export:{enabled:!0,language:"python",skip_validation:!0},generate:{scenario_limit:2,per_scenario_limit:3,memory_enabled:!1},last_seen_version:"",hints_enabled:!0},c=class{constructor(r=a){this.path=r}exists(){return p(this.path)}load(){try{let r=g(this.path,"utf-8"),e=JSON.parse(r);return{...n,...e,code_export:{...n.code_export,...e.code_export??{}},generate:{...n.generate,...e.generate??{}}}}catch{return{...n,code_export:{...n.code_export},generate:{...n.generate}}}}set(r,e){try{let t=this.load();t[r]=e,i(s(this.path),{recursive:!0}),o(this.path,JSON.stringify(t,null,2)+`
3
+ `)}catch(t){let d=t instanceof Error?t.message:String(t);process.stderr.write(`[config] Failed to save config: ${d}
4
+ `)}}save(r){try{let t={...this.load(),...r};i(s(this.path),{recursive:!0}),o(this.path,JSON.stringify(t,null,2)+`
5
+ `)}catch(e){let t=e instanceof Error?e.message:String(e);process.stderr.write(`[config] Failed to save config: ${t}
6
+ `)}}writeRaw(r){try{i(s(this.path),{recursive:!0}),o(this.path,JSON.stringify(r,null,2)+`
7
+ `)}catch(e){let t=e instanceof Error?e.message:String(e);process.stderr.write(`[config] Failed to save config: ${t}
8
+ `)}}};export{c as a};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as u,b as x}from"./chunk-WZ6GNXM3.js";import{x as m}from"./chunk-BGXAW2B5.js";import{a as f}from"./chunk-HCBYKLMW.js";import{a as r,b as i}from"./chunk-C44QQJR4.js";import{e as n}from"./chunk-UR6MHSHU.js";var e=n(f(),1);function C({title:B,titleColor:c,borderColor:d,variant:p,rows:s,footer:t,labelWidth:l=14,marginBottom:b=1}){return(0,e.jsxs)(u,{title:B,titleColor:c,borderColor:d,variant:p,marginBottom:b,children:[s.map((o,a)=>typeof o.value=="string"?(0,e.jsx)(x,{label:o.label,value:o.value,valueColor:o.valueColor,labelWidth:l},`${o.label}-${a}`):(0,e.jsxs)(r,{children:[(0,e.jsx)(r,{width:l,children:(0,e.jsx)(i,{color:m.dim,children:o.label})}),o.value]},`${o.label}-${a}`)),t&&(0,e.jsx)(r,{marginTop:1,children:t})]})}export{C as a};
2
+ import{a as u,b as x}from"./chunk-QSXYNJOW.js";import{x as m}from"./chunk-LRKWPAGK.js";import{a as f}from"./chunk-HCBYKLMW.js";import{a as r,b as i}from"./chunk-C44QQJR4.js";import{e as n}from"./chunk-UR6MHSHU.js";var e=n(f(),1);function C({title:B,titleColor:c,borderColor:d,variant:p,rows:s,footer:t,labelWidth:l=14,marginBottom:b=1}){return(0,e.jsxs)(u,{title:B,titleColor:c,borderColor:d,variant:p,marginBottom:b,children:[s.map((o,a)=>typeof o.value=="string"?(0,e.jsx)(x,{label:o.label,value:o.value,valueColor:o.valueColor,labelWidth:l},`${o.label}-${a}`):(0,e.jsxs)(r,{children:[(0,e.jsx)(r,{width:l,children:(0,e.jsx)(i,{color:m.dim,children:o.label})}),o.value]},`${o.label}-${a}`)),t&&(0,e.jsx)(r,{marginTop:1,children:t})]})}export{C as a};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as D}from"./chunk-HZUTFC3G.js";import{a as A}from"./chunk-ALF5ETLD.js";import{p as S,q as C,r as P,s as U,t as N}from"./chunk-BGXAW2B5.js";import{createServer as Oe}from"http";import{randomBytes as He}from"crypto";import{URL as $e}from"url";import Z from"process";import{Buffer as ee}from"buffer";import re from"path";import{fileURLToPath as ke}from"url";import{promisify as Le}from"util";import te from"child_process";import Me,{constants as Ie}from"fs/promises";import Y from"process";import G,{constants as me}from"fs/promises";import j from"process";import le from"os";import L from"fs";import se from"fs";import z from"fs";var E;function ie(){try{return z.statSync("/.dockerenv"),!0}catch{return!1}}function ae(){try{return z.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function B(){return E===void 0&&(E=ie()||ae()),E}var k,ce=()=>{try{return se.statSync("/run/.containerenv"),!0}catch{return!1}};function u(){return k===void 0&&(k=ce()||B()),k}var K=()=>{if(j.platform!=="linux")return!1;if(le.release().toLowerCase().includes("microsoft"))return!u();try{if(L.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft"))return!u()}catch{}return L.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop")||L.existsSync("/run/WSL")?!u():!1},d=j.env.__IS_WSL_TEST__?K:K();var de=(()=>{let e="/mnt/",r;return async function(){if(r)return r;let t="/etc/wsl.conf",n=!1;try{await G.access(t,me.F_OK),n=!0}catch{}if(!n)return e;let o=await G.readFile(t,{encoding:"utf8"}),i=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(o);return i?(r=i.groups.mountPoint.trim(),r=r.endsWith("/")?r:`${r}/`,r):e}})(),fe=async()=>`${await de()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,M=async()=>d?fe():`${Y.env.SYSTEMROOT||Y.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;function f(e,r,t){let n=o=>Object.defineProperty(e,r,{value:o,enumerable:!0,writable:!0});return Object.defineProperty(e,r,{configurable:!0,enumerable:!0,get(){let o=t();return n(o),o},set(o){n(o)}}),e}import{promisify as Pe}from"util";import O from"process";import{execFile as Ae}from"child_process";import{promisify as pe}from"util";import ue from"process";import{execFile as ge}from"child_process";var he=pe(ge);async function I(){if(ue.platform!=="darwin")throw new Error("macOS only");let{stdout:e}=await he("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),t=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??"com.apple.Safari";return t==="com.apple.safari"?"com.apple.Safari":t}import we from"process";import{promisify as xe}from"util";import{execFile as ye,execFileSync as cr}from"child_process";var ve=xe(ye);async function X(e,{humanReadableOutput:r=!0,signal:t}={}){if(we.platform!=="darwin")throw new Error("macOS only");let n=r?[]:["-ss"],o={};t&&(o.signal=t);let{stdout:i}=await ve("osascript",["-e",e,n],o);return i.trim()}async function T(e){return X(`tell application "Finder" to set app_path to application file id "${e}" as string
2
+ import{a as D}from"./chunk-RB2YKN77.js";import{a as A}from"./chunk-IGZPQQFP.js";import{p as S,q as C,r as P,s as U,t as N}from"./chunk-LRKWPAGK.js";import{createServer as Oe}from"http";import{randomBytes as He}from"crypto";import{URL as $e}from"url";import Z from"process";import{Buffer as ee}from"buffer";import re from"path";import{fileURLToPath as ke}from"url";import{promisify as Le}from"util";import te from"child_process";import Me,{constants as Ie}from"fs/promises";import Y from"process";import G,{constants as me}from"fs/promises";import j from"process";import le from"os";import L from"fs";import se from"fs";import z from"fs";var E;function ie(){try{return z.statSync("/.dockerenv"),!0}catch{return!1}}function ae(){try{return z.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function B(){return E===void 0&&(E=ie()||ae()),E}var k,ce=()=>{try{return se.statSync("/run/.containerenv"),!0}catch{return!1}};function u(){return k===void 0&&(k=ce()||B()),k}var K=()=>{if(j.platform!=="linux")return!1;if(le.release().toLowerCase().includes("microsoft"))return!u();try{if(L.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft"))return!u()}catch{}return L.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop")||L.existsSync("/run/WSL")?!u():!1},d=j.env.__IS_WSL_TEST__?K:K();var de=(()=>{let e="/mnt/",r;return async function(){if(r)return r;let t="/etc/wsl.conf",n=!1;try{await G.access(t,me.F_OK),n=!0}catch{}if(!n)return e;let o=await G.readFile(t,{encoding:"utf8"}),i=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(o);return i?(r=i.groups.mountPoint.trim(),r=r.endsWith("/")?r:`${r}/`,r):e}})(),fe=async()=>`${await de()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,M=async()=>d?fe():`${Y.env.SYSTEMROOT||Y.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;function f(e,r,t){let n=o=>Object.defineProperty(e,r,{value:o,enumerable:!0,writable:!0});return Object.defineProperty(e,r,{configurable:!0,enumerable:!0,get(){let o=t();return n(o),o},set(o){n(o)}}),e}import{promisify as Pe}from"util";import O from"process";import{execFile as Ae}from"child_process";import{promisify as pe}from"util";import ue from"process";import{execFile as ge}from"child_process";var he=pe(ge);async function I(){if(ue.platform!=="darwin")throw new Error("macOS only");let{stdout:e}=await he("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),t=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??"com.apple.Safari";return t==="com.apple.safari"?"com.apple.Safari":t}import we from"process";import{promisify as xe}from"util";import{execFile as ye,execFileSync as cr}from"child_process";var ve=xe(ye);async function X(e,{humanReadableOutput:r=!0,signal:t}={}){if(we.platform!=="darwin")throw new Error("macOS only");let n=r?[]:["-ss"],o={};t&&(o.signal=t);let{stdout:i}=await ve("osascript",["-e",e,n],o);return i.trim()}async function T(e){return X(`tell application "Finder" to set app_path to application file id "${e}" as string
3
3
  tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}import{promisify as be}from"util";import{execFile as Se}from"child_process";var Ce=be(Se),y={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},ur=new Map(Object.entries(y)),F=class extends Error{};async function _(e=Ce){let{stdout:r}=await e("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),t=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(r);if(!t)throw new F(`Cannot find Windows browser in stdout: ${JSON.stringify(r)}`);let{id:n}=t.groups,o=n.lastIndexOf("."),i=n.lastIndexOf("-"),c=o===-1?void 0:n.slice(0,o),a=i===-1?void 0:n.slice(0,i);return y[n]??y[c]??y[a]??{name:n,id:n}}var Ee=Pe(Ae),Be=e=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,r=>r.toUpperCase());async function H(){if(O.platform==="darwin"){let e=await I();return{name:await T(e),id:e}}if(O.platform==="linux"){let{stdout:e}=await Ee("xdg-mime",["query","default","x-scheme-handler/http"]),r=e.trim();return{name:Be(r.replace(/.desktop$/,"").replace("-"," ")),id:r}}if(O.platform==="win32")return _();throw new Error("Only macOS, Linux, and Windows are supported")}var Te=Le(te.execFile),$=re.dirname(ke(import.meta.url)),q=re.join($,"xdg-open"),{platform:w,arch:V}=Z;async function Fe(){let e=await M(),r=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,t=ee.from(r,"utf16le").toString("base64"),{stdout:n}=await Te(e,["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",t],{encoding:"utf8"}),o=n.trim(),i={ChromeHTML:"com.google.chrome",BraveHTML:"com.brave.Browser",MSEdgeHTM:"com.microsoft.edge",FirefoxURL:"org.mozilla.firefox"};return i[o]?{id:i[o]}:{}}var J=async(e,r)=>{let t;for(let n of e)try{return await r(n)}catch(o){t=o}throw t},v=async e=>{if(e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e},Array.isArray(e.app))return J(e.app,a=>v({...e,app:a}));let{name:r,arguments:t=[]}=e.app??{};if(t=[...t],Array.isArray(r))return J(r,a=>v({...e,app:{name:a,arguments:t}}));if(r==="browser"||r==="browserPrivate"){let a={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.Browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge"},l={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},s=d?await Fe():await H();if(s.id in a){let m=a[s.id];return r==="browserPrivate"&&t.push(l[m]),v({...e,app:{name:g[m],arguments:t}})}throw new Error(`${s.name} is not supported as a default browser`)}let n,o=[],i={};if(w==="darwin")n="open",e.wait&&o.push("--wait-apps"),e.background&&o.push("--background"),e.newInstance&&o.push("--new"),r&&o.push("-a",r);else if(w==="win32"||d&&!u()&&!r){n=await M(),o.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),d||(i.windowsVerbatimArguments=!0);let a=["Start"];e.wait&&a.push("-Wait"),r?(a.push(`"\`"${r}\`""`),e.target&&t.push(e.target)):e.target&&a.push(`"${e.target}"`),t.length>0&&(t=t.map(l=>`"\`"${l}\`""`),a.push("-ArgumentList",t.join(","))),e.target=ee.from(a.join(" "),"utf16le").toString("base64")}else{if(r)n=r;else{let a=!$||$==="/",l=!1;try{await Me.access(q,Ie.X_OK),l=!0}catch{}n=Z.versions.electron??(w==="android"||a||!l)?"xdg-open":q}t.length>0&&o.push(...t),e.wait||(i.stdio="ignore",i.detached=!0)}w==="darwin"&&t.length>0&&o.push("--args",...t),e.target&&o.push(e.target);let c=te.spawn(n,o,i);return e.wait?new Promise((a,l)=>{c.once("error",l),c.once("close",s=>{if(!e.allowNonzeroExitCode&&s>0){l(new Error(`Exited with code ${s}`));return}a(c)})}):(c.unref(),c)},_e=(e,r)=>{if(typeof e!="string")throw new TypeError("Expected a `target`");return v({...r,target:e})};function Q(e){if(typeof e=="string"||Array.isArray(e))return e;let{[V]:r}=e;if(!r)throw new Error(`${V} is not supported`);return r}function b({[w]:e},{wsl:r}){if(r&&d)return Q(r);if(!e)throw new Error(`${w} is not supported`);return Q(e)}var g={};f(g,"chrome",()=>b({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));f(g,"brave",()=>b({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));f(g,"firefox",()=>b({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));f(g,"edge",()=>b({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));f(g,"browser",()=>"browser");f(g,"browserPrivate",()=>"browserPrivate");var oe=_e;var ne=class{profile;environment;creds;oauth;constructor(r="default",t="prod",n){this.profile=r,this.environment=t,this.creds=n??new D,this.oauth=new A(t)}async login(){let{server:r,port:t}=await this.startCallbackServer(),n=N(t);try{let o=this.creds.loadClient(this.profile,this.environment),i=o?.redirect_uris;(!o||!i?.includes(n))&&(o=await this.oauth.registerClient(n),this.creds.saveClient(this.profile,this.environment,o));let c=o.client_id,[a,l]=A.generatePkce(),s=He(32).toString("hex"),m=this.oauth.buildAuthorizationUrl(c,l,s,n),p=await this.waitForCallback(r,t,m,s);if(!p)throw new Error("Login cancelled or timed out");let h=await this.oauth.exchangeCode(p,c,a,n),x={access_token:h.access_token,refresh_token:h.refresh_token,expires_at:Math.floor(Date.now()/1e3)+h.expires_in,scope:h.scope??"*"};return this.creds.saveCredentials(this.profile,this.environment,x),this.creds.setActiveProfile(this.profile),x}catch(o){throw r.close(),o}}startCallbackServer(){return new Promise((r,t)=>{let n=C,o=()=>{let i=Oe();i.on("error",c=>{c.code==="EADDRINUSE"&&n<P?(n++,o()):t(new Error(`Failed to start callback server: ${c.message}. Ports ${C}-${P} are all in use.`))}),i.listen(n,S,()=>{r({server:i,port:n})})};o()})}waitForCallback(r,t,n,o){return new Promise(i=>{let c=!1,a=setTimeout(()=>l(null),12e4),l=s=>{c||(c=!0,clearTimeout(a),r.close(),i(s))};r.on("request",(s,m)=>{let p=new $e(s.url??"/",`http://${S}:${t}`);if(p.pathname!==U){m.writeHead(404),m.end();return}let h=p.searchParams.get("state"),x=p.searchParams.get("code");if(p.searchParams.get("error")){m.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),m.end(R({state:"error",title:"Login failed",message:"We couldn't complete the sign-in. You can close this tab and try again from your terminal."})),l(null);return}if(h!==o){m.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),m.end(R({state:"error",title:"Invalid state",message:"The sign-in response didn't match this session. Please return to your terminal and try again."})),l(null);return}m.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),m.end(R({state:"success",title:"You're signed in",message:"Head back to your terminal \u2014 KaneAI is ready when you are.",autoClose:!0})),l(x)}),oe(n).catch(s=>{let m=s instanceof Error?s.message:String(s);process.stderr.write(`[auth] Could not open browser: ${m}
4
4
  Please open this URL manually: ${n}
5
5
  `)})})}};function R(e){let r=e.state==="success",t=r?"#22c55e":"#ef4444",n=r?"rgba(34, 197, 94, 0.12)":"rgba(239, 68, 68, 0.12)",o=r?'<svg viewBox="0 0 24 24" width="36" height="36" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7"/></svg>':'<svg viewBox="0 0 24 24" width="36" height="36" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>',i=e.autoClose?"<script>setTimeout(function(){try{window.close();}catch(e){}}, 1500);</script>":"";return`<!doctype html>
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as f}from"./chunk-FPFOW6BS.js";import{a as h}from"./chunk-SH5FUG47.js";import{a as d}from"./chunk-3PISMPFM.js";var o=class extends Error{constructor(a,l){super(a);this.code=l;this.name="AuthError"}};async function k(c){let{creds:i,env:a,usernameFlag:l,accessKeyFlag:g,log:t}=c,e=null,u=null;if(l&&g)e={username:l,access_key:g},t("info","AUTH_RESOLVE_FLAGS","Auth resolved via CLI flags",{username:l});else{let r=i.resolveAuth();r?.method==="basic"&&(e={username:r.username,access_key:r.access_key},t("info","AUTH_RESOLVE_CONFIG","Auth resolved via config",{username:r.username}))}if(!e){let{credentials:r,profile:E}=i.getActiveCredentials();if(!r)throw new o("Not authenticated \u2014 no credentials found","not_authenticated");if(u=r.access_token,r.expires_at-Date.now()/1e3<300)try{let n=await h({creds:i,profile:E,env:a,credentials:r});n&&(u=n.accessToken,t("info","AUTH_TOKEN_REFRESHED","OAuth token refreshed"))}catch(n){let m=n instanceof Error?n.message:String(n);throw t("error","TOKEN_REFRESH_FAILED","Token refresh failed",{error:m}),new o(`Token refresh failed: ${m}`,"refresh_failed")}}let v=d(a),b=async()=>u,y=e?{username:e.username,access_key:e.access_key}:null,p=new f(v.controllerBaseUrl,b,y,t),s=await p.resolve();return s&&!e&&(e={username:s.username,access_key:s.access_key},t("info","AUTH_RESOLVE_CONTROLLER","Auth resolved via controller",{username:s.username})),{basicAuth:e,token:u,resolver:p,resolvedCreds:s}}export{o as a,k as b};
2
+ import{a as f}from"./chunk-FPFOW6BS.js";import{a as h}from"./chunk-JKLKZCJS.js";import{a as d}from"./chunk-KKIFXAJY.js";var o=class extends Error{constructor(a,l){super(a);this.code=l;this.name="AuthError"}};async function k(c){let{creds:i,env:a,usernameFlag:l,accessKeyFlag:g,log:t}=c,e=null,u=null;if(l&&g)e={username:l,access_key:g},t("info","AUTH_RESOLVE_FLAGS","Auth resolved via CLI flags",{username:l});else{let r=i.resolveAuth();r?.method==="basic"&&(e={username:r.username,access_key:r.access_key},t("info","AUTH_RESOLVE_CONFIG","Auth resolved via config",{username:r.username}))}if(!e){let{credentials:r,profile:E}=i.getActiveCredentials();if(!r)throw new o("Not authenticated \u2014 no credentials found","not_authenticated");if(u=r.access_token,r.expires_at-Date.now()/1e3<300)try{let n=await h({creds:i,profile:E,env:a,credentials:r});n&&(u=n.accessToken,t("info","AUTH_TOKEN_REFRESHED","OAuth token refreshed"))}catch(n){let m=n instanceof Error?n.message:String(n);throw t("error","TOKEN_REFRESH_FAILED","Token refresh failed",{error:m}),new o(`Token refresh failed: ${m}`,"refresh_failed")}}let b=d(a),v=async()=>u,y=e?{username:e.username,access_key:e.access_key}:null,p=new f(b.controllerBaseUrl,v,y,t),s=await p.resolve();return s&&!e&&(e={username:s.username,access_key:s.access_key},t("info","AUTH_RESOLVE_CONTROLLER","Auth resolved via controller",{username:s.username})),{basicAuth:e,token:u,resolver:p,resolvedCreds:s}}export{o as a,k as b};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as Se,b as nr}from"./chunk-C5UNZ6ZY.js";import{a as ar}from"./chunk-BH6EP2LD.js";import{c as or}from"./chunk-S3DAAAE5.js";import{b as sr,c as ut,d as dt,e as ve,f as mt,g as ir}from"./chunk-PUU7A26K.js";import{a as Ue,b as se,c as tr,e as le,f as lt,i as rr,j as ct}from"./chunk-AH4AXJML.js";import{b as ue}from"./chunk-K266M5ZM.js";import{a as Xt}from"./chunk-WAOCHXJ5.js";import{a as er,b as at}from"./chunk-IT2GFEFH.js";import{a as Wt,b as ot,c as it,d as je,e as Jt,f as Qt}from"./chunk-LOIRZFV3.js";import{f as Yt,g as Zt}from"./chunk-ZRGEUDG5.js";import{a as zt}from"./chunk-LPUQ4HWQ.js";import{a as De,b as Gt}from"./chunk-NLCCBXXV.js";import{a as W}from"./chunk-3PISMPFM.js";import{a as D}from"./chunk-RZ4F3BHX.js";import{a as Ht}from"./chunk-E47GFYXA.js";import{a as Kt,c as rt,i as qt,j as Le,k as st,l as nt}from"./chunk-BGXAW2B5.js";import{join as qe,basename as En}from"path";import{existsSync as ds,readFileSync as An}from"fs";import{existsSync as ft}from"fs";import{join as Fe,basename as lr}from"path";function cr(e,t){if(!t||!ft(t))return e.steps.map(()=>({kind:"author",reason:"no-result-md"}));let r=dt(t),s=[],n=new Set,o=new Map;function a(i){let l=ve(i),h=Fe(l,"Result.md");if(o.has(h))return o.get(h);let f=ft(h)?dt(h):null;return o.set(h,f),f}function u(i){for(let l=1;l<i.trace.length;l++){let f=i.trace[l-1].file===e.rootPath?r:a(i.trace.slice(0,l));if(!f)return{kind:"author",reason:"no-result-md"};let w=i.trace[l-1].stepIndex,g=f.steps[w-1];if(!g)return{kind:"author",reason:"no-result-md"};if(g.kind!=="import")return{kind:"author",reason:"structure-mismatch"};let I=lr(g.importPath),S=lr(i.trace[l].file);if(I!==S)return{kind:"author",reason:"structure-mismatch"};if(g.status!=="passed")return{kind:"author",reason:"recorded-failed"}}return null}for(let i of e.steps){let l=i.trace[i.trace.length-1].file,h=i.trace[i.trace.length-1].stepIndex,f=n.has(l);for(let S=0;S<i.trace.length-1&&!f;S++)n.has(i.trace[S].file)&&(f=!0);if(f){s.push({kind:"author",reason:"downstream-of-divergence"});continue}let w=u(i);if(w){s.push(w);for(let S=0;S<i.trace.length;S++)n.add(i.trace[S].file);continue}let g=l===e.rootPath?r:a(i.trace),I=Es(i,g,h);if(s.push(I),I.kind==="author"){n.add(l);for(let S=0;S<i.trace.length-1;S++)n.add(i.trace[S].file)}}return s}function Es(e,t,r){if(!t)return{kind:"author",reason:"no-result-md"};let s=t.steps[r-1];if(!s)return{kind:"author",reason:"no-result-md"};if(s.kind!=="objective")return{kind:"author",reason:"structure-mismatch"};if(s.status!=="passed")return{kind:"author",reason:"recorded-failed"};let n=sr(e);if(n!==s.md5)return{kind:"author",reason:"md5-mismatch"};let o=e.trace.length===1?rr(e.trace[0].file,r,n.slice(0,8)):Fe(ve(e.trace),".internal","steps",`${r}-${n.slice(0,8)}`),a=Fe(o,"flows","0","actions.ndjson");return ft(a)?{kind:"replay",recordingDir:o}:{kind:"author",reason:"missing-recording"}}function ur(e){return e.some(t=>t.kind==="author")}function Me(e){for(let t=0;t<e.length;t++)if(e[t].kind==="author")return t;return e.length}function dr(e){return Fe(e.recordingDir,"flows","0","actions.ndjson")}function mr(e,t){if(process.env.KANE_REPLAY_TRACE==="1")for(let r=0;r<e.steps.length;r++){let s=e.steps[r],n=t[r],o=" ".repeat(s.trace.length-1),a=`step ${s.flatIndex}`;n.kind==="replay"?process.stderr.write(`[replay-trace] ${o}${a}: REPLAY (would skip; v1 always authors)
2
+ import{a as Se,b as nr}from"./chunk-C5UNZ6ZY.js";import{a as ar}from"./chunk-BH6EP2LD.js";import{c as or}from"./chunk-S3DAAAE5.js";import{b as sr,c as ut,d as dt,e as ve,f as mt,g as ir}from"./chunk-PUU7A26K.js";import{a as Ue,b as se,c as tr,e as le,f as lt,i as rr,j as ct}from"./chunk-AH4AXJML.js";import{b as ue}from"./chunk-NAAPNSZD.js";import{a as Xt}from"./chunk-WAOCHXJ5.js";import{a as er,b as at}from"./chunk-BQACGLXW.js";import{a as Wt,b as ot,c as it,d as je,e as Jt,f as Qt}from"./chunk-LOIRZFV3.js";import{f as Yt,g as Zt}from"./chunk-XCYCX4TU.js";import{a as zt}from"./chunk-LPUQ4HWQ.js";import{a as De,b as Gt}from"./chunk-NLCCBXXV.js";import{a as W}from"./chunk-KKIFXAJY.js";import{a as D}from"./chunk-RZ4F3BHX.js";import{a as Ht}from"./chunk-E47GFYXA.js";import{a as Kt,c as rt,i as qt,j as Le,k as st,l as nt}from"./chunk-LRKWPAGK.js";import{join as qe,basename as En}from"path";import{existsSync as ds,readFileSync as An}from"fs";import{existsSync as ft}from"fs";import{join as Fe,basename as lr}from"path";function cr(e,t){if(!t||!ft(t))return e.steps.map(()=>({kind:"author",reason:"no-result-md"}));let r=dt(t),s=[],n=new Set,o=new Map;function a(i){let l=ve(i),h=Fe(l,"Result.md");if(o.has(h))return o.get(h);let f=ft(h)?dt(h):null;return o.set(h,f),f}function u(i){for(let l=1;l<i.trace.length;l++){let f=i.trace[l-1].file===e.rootPath?r:a(i.trace.slice(0,l));if(!f)return{kind:"author",reason:"no-result-md"};let w=i.trace[l-1].stepIndex,g=f.steps[w-1];if(!g)return{kind:"author",reason:"no-result-md"};if(g.kind!=="import")return{kind:"author",reason:"structure-mismatch"};let I=lr(g.importPath),S=lr(i.trace[l].file);if(I!==S)return{kind:"author",reason:"structure-mismatch"};if(g.status!=="passed")return{kind:"author",reason:"recorded-failed"}}return null}for(let i of e.steps){let l=i.trace[i.trace.length-1].file,h=i.trace[i.trace.length-1].stepIndex,f=n.has(l);for(let S=0;S<i.trace.length-1&&!f;S++)n.has(i.trace[S].file)&&(f=!0);if(f){s.push({kind:"author",reason:"downstream-of-divergence"});continue}let w=u(i);if(w){s.push(w);for(let S=0;S<i.trace.length;S++)n.add(i.trace[S].file);continue}let g=l===e.rootPath?r:a(i.trace),I=Es(i,g,h);if(s.push(I),I.kind==="author"){n.add(l);for(let S=0;S<i.trace.length-1;S++)n.add(i.trace[S].file)}}return s}function Es(e,t,r){if(!t)return{kind:"author",reason:"no-result-md"};let s=t.steps[r-1];if(!s)return{kind:"author",reason:"no-result-md"};if(s.kind!=="objective")return{kind:"author",reason:"structure-mismatch"};if(s.status!=="passed")return{kind:"author",reason:"recorded-failed"};let n=sr(e);if(n!==s.md5)return{kind:"author",reason:"md5-mismatch"};let o=e.trace.length===1?rr(e.trace[0].file,r,n.slice(0,8)):Fe(ve(e.trace),".internal","steps",`${r}-${n.slice(0,8)}`),a=Fe(o,"flows","0","actions.ndjson");return ft(a)?{kind:"replay",recordingDir:o}:{kind:"author",reason:"missing-recording"}}function ur(e){return e.some(t=>t.kind==="author")}function Me(e){for(let t=0;t<e.length;t++)if(e[t].kind==="author")return t;return e.length}function dr(e){return Fe(e.recordingDir,"flows","0","actions.ndjson")}function mr(e,t){if(process.env.KANE_REPLAY_TRACE==="1")for(let r=0;r<e.steps.length;r++){let s=e.steps[r],n=t[r],o=" ".repeat(s.trace.length-1),a=`step ${s.flatIndex}`;n.kind==="replay"?process.stderr.write(`[replay-trace] ${o}${a}: REPLAY (would skip; v1 always authors)
3
3
  `):process.stderr.write(`[replay-trace] ${o}${a}: AUTHOR (${n.reason})
4
4
  `)}}function de(e){process.env.KANE_REPLAY_TRACE==="1"&&process.stderr.write(e)}function fr(e,t){let r=e===0?"(none)":`0..${e-1}`,s=e>=t?"(none)":`${e}..${t-1}`;de(`[replay-trace] phase: replay ${r}, author ${s}
5
5
  `)}function pr(e,t){de(`[replay-trace] step ${e}: REPLAY ${t==="ok"?"OK":"FAILED"}
@@ -14,7 +14,7 @@ import{a as Se,b as nr}from"./chunk-C5UNZ6ZY.js";import{a as ar}from"./chunk-BH6
14
14
  `):e==="linux"?["Google Chrome is required but was not found at /usr/bin/google-chrome.","(amd64 / x86_64 only \u2014 Google does not ship Chrome for Linux ARM.)","","Debian / Ubuntu (any version):"," wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"," sudo apt install -y ./google-chrome-stable_current_amd64.deb","","Fedora / RHEL / AlmaLinux / Rocky:"," sudo dnf install -y https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm","","Then re-run your command. Set KANE_CLI_CHROME_PATH=/path/to/chrome","to point at a non-standard install."].join(`
15
15
  `):e==="win32"?["Google Chrome is required but was not found in Program Files or AppData.","","Install via winget (Windows 10 1809+):"," winget install --id Google.Chrome -e --silent","","Or download:"," https://www.google.com/chrome/","","Then re-run your command. Set KANE_CLI_CHROME_PATH=C:\\path\\to\\chrome.exe","to point at a non-standard install."].join(`
16
16
  `):["Google Chrome is required.","Install from https://www.google.com/chrome/","(Note: no official Chrome builds for BSD or Alpine/musl Linux.)"].join(`
17
- `)}function Hs(e){let t=Ie(),r=[`--remote-debugging-port=${e.port}`,`--user-data-dir=${e.userDataDir}`,`--window-size=${e.width},${e.height}`,"--no-first-run","--no-default-browser-check","--disable-blink-features=AutomationControlled","--disable-features=DownloadBubble,DownloadBubbleV2","--safebrowsing-disable-download-protection","--disable-popup-blocking","--disable-notifications","--disable-infobars","--disable-translate","--disable-prompt-on-repost","--disable-background-networking","--disable-client-side-phishing-detection","--disable-default-apps","--disable-hang-monitor","--disable-sync","--metrics-recording-only","--safebrowsing-disable-auto-update","--disable-backgrounding-occluded-windows","--disable-background-timer-throttling","--test-type=webdriver","--allow-pre-commit-input","--enable-logging","--v=1"];return t==="linux"&&(r.push("--no-sandbox"),r.push("--disable-dev-shm-usage"),r.push("--password-store=basic")),t==="darwin"&&r.push("--use-mock-keychain"),e.headless&&r.push("--headless=new"),r}function Ks(e){return new Promise(t=>{let r=Ms({port:e,host:"127.0.0.1"});r.setTimeout(1e3),r.on("connect",()=>{r.destroy(),t(!0)}),r.on("timeout",()=>{r.destroy(),t(!1)}),r.on("error",()=>{r.destroy(),t(!1)})})}async function qs(){for(let e=st;e<=nt;e++)if(!await Ks(e))return e;throw new Error(`All CDP ports ${st}-${nt} are in use. Close other Chrome instances.`)}var _e=class extends Error{constructor(t){super(t),this.name="CdpReadinessError"}};async function Gs(e,t){let r=Date.now(),s=`http://127.0.0.1:${e}/json/version`;for(;Date.now()-r<t;){try{if((await D(s)).ok)return`http://127.0.0.1:${e}`}catch{}await new Promise(n=>setTimeout(n,200))}throw new _e(`Chrome CDP not ready after ${t}ms on port ${e}`)}var zs=3e4,Ws=2;function Mr(e,t,r){let s=process.env[e];if(s==null||s.trim()==="")return t;let n=Number(s);return!Number.isInteger(n)||n<r?t:n}function Js(e){return Math.min(500*e,3e3)}function Nr(e,t){try{if(e.pid)if(t==="win32")$r("taskkill",["/pid",String(e.pid),"/T","/F"],{stdio:"ignore"});else try{process.kill(-e.pid,"SIGKILL")}catch{e.kill("SIGKILL")}else e.kill("SIGKILL")}catch{}}async function Br(e){let t=process.env.KANE_CLI_SKIP_BROWSER_DOWNLOAD;if(!(t!=null&&Ns.has(t.toLowerCase()))&&!Bs())throw ot()?.log("error","CHROME_NOT_FOUND","Startup gate: Chrome unavailable at standard system paths",{platform:process.platform,kane_cli_chrome_path:process.env.KANE_CLI_CHROME_PATH??null,skip_browser_download:process.env.KANE_CLI_SKIP_BROWSER_DOWNLOAD??null}),new Be(Vs());let s=Ie(),n=$s(),o=Mr("KANE_CLI_CDP_TIMEOUT_MS",zs,1),u=Mr("KANE_CLI_CDP_RETRIES",Ws,0)+1,i;for(let l=1;l<=u;l++){let h=await qs(),f=Hs({port:h,...e});e.startUrl&&f.push(e.startUrl);let w=$r(n,f,{stdio:"ignore",detached:!0});w.unref();try{let g=await new Promise((I,S)=>{w.on("error",k=>{S(new Error(`Failed to launch Chrome: ${k.message}. Is Chrome installed at ${n}?`))}),w.on("close",k=>{k!==null&&k!==0&&S(new _e(`Chrome exited during startup with code ${k}`))}),Gs(h,o).then(I,S)});return{process:w,port:h,cdpEndpoint:g,kill(){Nr(w,s)}}}catch(g){if(i=g,!(g instanceof _e))throw g;Nr(w,s),ot()?.log("warn","CHROME_CDP_LAUNCH_RETRY",`Chrome CDP launch attempt ${l}/${u} failed`,{attempt:l,max_attempts:u,port:h,timeout_ms:o,headless:e.headless??!1,error:g.message}),l<u&&await new Promise(I=>setTimeout(I,Js(l)))}}throw i??new Error("Chrome launch failed after retries")}async function Vr(e){if(e.cft)return{instance:null,tempDir:null};if(e.wsEndpoint)return{wsEndpoint:e.wsEndpoint,instance:null,tempDir:null};if(e.cdpEndpoint){let n=await D(`${e.cdpEndpoint}/json/version`);if(!n.ok)throw new Error(`CDP endpoint not reachable: ${e.cdpEndpoint} (${n.status})`);return{cdpEndpoint:e.cdpEndpoint,instance:null,tempDir:null}}let t,r=null;if(e.config.chrome_profile_path)t=e.config.chrome_profile_path.replace("~",process.env.HOME??"~");else{r=Qs(Zs(Xs(),"kane-clean-")),t=r;let n=r;je("tempDir",()=>{try{Ys(n,{recursive:!0,force:!0})}catch{}})}let s=await Br({userDataDir:t,width:e.config.window_size.width,height:e.config.window_size.height,startUrl:e.startUrl,headless:e.headless});return{cdpEndpoint:s.cdpEndpoint,instance:s,tempDir:r}}function Hr(e){let t={objective:e.objective,model:e.model,width:e.windowSize.width,height:e.windowSize.height,session_id:e.sessionId,run_index:e.runIndex,stream:!0,max_steps:e.maxSteps??30,headless:e.headless??!1};return e.url&&(t.url=e.url),e.requireStartUrl&&(t.require_start_url=!0),e.chrome.wsEndpoint?t.ws_endpoint=e.chrome.wsEndpoint:e.chrome.cdpEndpoint&&(t.cdp_endpoint=e.chrome.cdpEndpoint),e.auth.basicAuth?(t.username=e.auth.basicAuth.username,t.access_key=e.auth.basicAuth.access_key):e.auth.token&&(t.auth={type:"bearer",token:e.auth.token}),e.disableAskUser&&(t.disable_ask_user=!0),e.enableTaskSkills&&(t.enable_task_skills=!0),e.networkWs&&(t.network_ws=!0),e.variables&&Object.keys(e.variables).length>0&&(t.variables=e.variables),e.globalContext&&(t.global_context=e.globalContext),e.localContext&&(t.local_context=e.localContext),e.sessionContext&&(t.session_context=e.sessionContext),t}import{readdirSync as en,readFileSync as qr,existsSync as Gr}from"fs";import{join as tn}from"path";function Kr(e,t){if(!Gr(e))return{};let r={},s;try{s=en(e).filter(n=>n.endsWith(".json")).sort()}catch{return{}}for(let n of s)try{let o=qr(tn(e,n),"utf-8"),a=JSON.parse(o);if(a&&typeof a=="object"){for(let[u,i]of Object.entries(a))if(i&&typeof i=="object"&&"value"in i){let l=i;r[u]={value:l.value,secret:l.secret??!1,syntax:l.syntax??`{{${u}}}`}}}}catch{t?t("warn","VARIABLE_PARSE_FAILED","Skipping invalid variables file",{file:n}):process.stderr.write(`[variables] Warning: skipping invalid variables file: ${n}
17
+ `)}function Hs(e){let t=Ie(),r=[`--remote-debugging-port=${e.port}`,`--user-data-dir=${e.userDataDir}`,`--window-size=${e.width},${e.height}`,"--no-first-run","--no-default-browser-check","--disable-blink-features=AutomationControlled","--disable-features=DownloadBubble,DownloadBubbleV2","--safebrowsing-disable-download-protection","--disable-popup-blocking","--disable-notifications","--disable-infobars","--disable-translate","--disable-prompt-on-repost","--disable-background-networking","--disable-client-side-phishing-detection","--disable-default-apps","--disable-hang-monitor","--disable-sync","--metrics-recording-only","--safebrowsing-disable-auto-update","--disable-backgrounding-occluded-windows","--disable-background-timer-throttling","--test-type=webdriver","--allow-pre-commit-input","--enable-logging","--v=1"];return t==="linux"&&(r.push("--no-sandbox"),r.push("--disable-dev-shm-usage"),r.push("--password-store=basic")),t==="darwin"&&r.push("--use-mock-keychain"),e.headless&&r.push("--headless=new"),r}function Ks(e){return new Promise(t=>{let r=Ms({port:e,host:"127.0.0.1"});r.setTimeout(1e3),r.on("connect",()=>{r.destroy(),t(!0)}),r.on("timeout",()=>{r.destroy(),t(!1)}),r.on("error",()=>{r.destroy(),t(!1)})})}async function qs(){for(let e=st;e<=nt;e++)if(!await Ks(e))return e;throw new Error(`All CDP ports ${st}-${nt} are in use. Close other Chrome instances.`)}var _e=class extends Error{constructor(t){super(t),this.name="CdpReadinessError"}};async function Gs(e,t){let r=Date.now(),s=`http://127.0.0.1:${e}/json/version`;for(;Date.now()-r<t;){try{if((await D(s)).ok)return`http://127.0.0.1:${e}`}catch{}await new Promise(n=>setTimeout(n,200))}throw new _e(`Chrome CDP not ready after ${t}ms on port ${e}`)}var zs=3e4,Ws=2;function Mr(e,t,r){let s=process.env[e];if(s==null||s.trim()==="")return t;let n=Number(s);return!Number.isInteger(n)||n<r?t:n}function Js(e){return Math.min(500*e,3e3)}function Nr(e,t){try{if(e.pid)if(t==="win32")$r("taskkill",["/pid",String(e.pid),"/T","/F"],{stdio:"ignore"});else try{process.kill(-e.pid,"SIGKILL")}catch{e.kill("SIGKILL")}else e.kill("SIGKILL")}catch{}}async function Br(e){let t=process.env.KANE_CLI_SKIP_BROWSER_DOWNLOAD;if(!(t!=null&&Ns.has(t.toLowerCase()))&&!Bs())throw ot()?.log("error","CHROME_NOT_FOUND","Startup gate: Chrome unavailable at standard system paths",{platform:process.platform,kane_cli_chrome_path:process.env.KANE_CLI_CHROME_PATH??null,skip_browser_download:process.env.KANE_CLI_SKIP_BROWSER_DOWNLOAD??null}),new Be(Vs());let s=Ie(),n=$s(),o=Mr("KANE_CLI_CDP_TIMEOUT_MS",zs,1),u=Mr("KANE_CLI_CDP_RETRIES",Ws,0)+1,i;for(let l=1;l<=u;l++){let h=await qs(),f=Hs({port:h,...e});e.startUrl&&f.push(e.startUrl);let w=$r(n,f,{stdio:"ignore",detached:!0});w.unref();try{let g=await new Promise((I,S)=>{w.on("error",k=>{S(new Error(`Failed to launch Chrome: ${k.message}. Is Chrome installed at ${n}?`))}),w.on("close",k=>{k!==null&&k!==0&&S(new _e(`Chrome exited during startup with code ${k}`))}),Gs(h,o).then(I,S)});return{process:w,port:h,cdpEndpoint:g,kill(){Nr(w,s)}}}catch(g){if(i=g,!(g instanceof _e))throw g;Nr(w,s),ot()?.log("warn","CHROME_CDP_LAUNCH_RETRY",`Chrome CDP launch attempt ${l}/${u} failed`,{attempt:l,max_attempts:u,port:h,timeout_ms:o,headless:e.headless??!1,error:g.message}),l<u&&await new Promise(I=>setTimeout(I,Js(l)))}}throw i??new Error("Chrome launch failed after retries")}async function Vr(e){if(e.cft)return{instance:null,tempDir:null};if(e.wsEndpoint)return{wsEndpoint:e.wsEndpoint,instance:null,tempDir:null};if(e.cdpEndpoint){let n=await D(`${e.cdpEndpoint}/json/version`);if(!n.ok)throw new Error(`CDP endpoint not reachable: ${e.cdpEndpoint} (${n.status})`);return{cdpEndpoint:e.cdpEndpoint,instance:null,tempDir:null}}let t,r=null;if(e.config.chrome_profile_path)t=e.config.chrome_profile_path.replace("~",process.env.HOME??"~");else{r=Qs(Zs(Xs(),"kane-clean-")),t=r;let n=r;je("tempDir",()=>{try{Ys(n,{recursive:!0,force:!0})}catch{}})}let s=await Br({userDataDir:t,width:e.config.window_size.width,height:e.config.window_size.height,startUrl:e.startUrl,headless:e.headless});return{cdpEndpoint:s.cdpEndpoint,instance:s,tempDir:r}}function Hr(e){let t={objective:e.objective,model:e.model,width:e.windowSize.width,height:e.windowSize.height,session_id:e.sessionId,run_index:e.runIndex,stream:!0,max_steps:e.maxSteps??30,headless:e.headless??!1};return e.url&&(t.url=e.url),e.requireStartUrl&&(t.require_start_url=!0),e.chrome.wsEndpoint?t.ws_endpoint=e.chrome.wsEndpoint:e.chrome.cdpEndpoint&&(t.cdp_endpoint=e.chrome.cdpEndpoint),e.auth.basicAuth?(t.username=e.auth.basicAuth.username,t.access_key=e.auth.basicAuth.access_key):e.auth.token&&(t.auth={type:"bearer",token:e.auth.token}),e.disableAskUser&&(t.disable_ask_user=!0),e.enableTaskSkills&&(t.enable_task_skills=!0),e.networkWs&&(t.network_ws=!0),e.networkSse&&(t.network_sse=!0),e.variables&&Object.keys(e.variables).length>0&&(t.variables=e.variables),e.globalContext&&(t.global_context=e.globalContext),e.localContext&&(t.local_context=e.localContext),e.sessionContext&&(t.session_context=e.sessionContext),t}import{readdirSync as en,readFileSync as qr,existsSync as Gr}from"fs";import{join as tn}from"path";function Kr(e,t){if(!Gr(e))return{};let r={},s;try{s=en(e).filter(n=>n.endsWith(".json")).sort()}catch{return{}}for(let n of s)try{let o=qr(tn(e,n),"utf-8"),a=JSON.parse(o);if(a&&typeof a=="object"){for(let[u,i]of Object.entries(a))if(i&&typeof i=="object"&&"value"in i){let l=i;r[u]={value:l.value,secret:l.secret??!1,syntax:l.syntax??`{{${u}}}`}}}}catch{t?t("warn","VARIABLE_PARSE_FAILED","Skipping invalid variables file",{file:n}):process.stderr.write(`[variables] Warning: skipping invalid variables file: ${n}
18
18
  `)}return r}function zr(e){if(!Gr(e))throw new Error(`Variables file not found: ${e}`);let t=qr(e,"utf-8"),r=JSON.parse(t),s={};if(r&&typeof r=="object"){for(let[n,o]of Object.entries(r))if(o&&typeof o=="object"&&"value"in o){let a=o;s[n]={value:a.value,secret:a.secret??!1,syntax:a.syntax??`{{${n}}}`}}}return s}function Wr(e){let t;try{t=JSON.parse(e)}catch{throw new Error("Invalid --variables JSON")}let r={};if(t&&typeof t=="object"){for(let[s,n]of Object.entries(t))if(n&&typeof n=="object"&&"value"in n){let o=n;r[s]={value:o.value,secret:o.secret??!1,syntax:o.syntax??`{{${s}}}`}}}return r}function Jr(e,t,r){let s=Kr(e,r),n=Kr(t,r);return{...s,...n}}var fe=class{constructor(t){this.baseUrl=t}async pushSecret(t){let r=De(t.username,t.accessKey),s=await D(`${this.baseUrl}/logistics/v1.0/secrets/create`,{method:"PUT",headers:{Authorization:r,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({secretKey:t.secretKey,secretValue:t.secretValue,orgId:t.orgId,username:t.username,scope:"user",type:"user",accessKey:t.accessKey})});if(!s.ok)throw new Error(`Push secret failed: ${s.status} ${await s.text()}`)}static extractVariableKeys(t){let r=t.matchAll(/\{\{([a-zA-Z_][a-zA-Z0-9_]*)\}\}/g),s=new Set;for(let n of r)s.add(n[1]);return[...s]}};var pe=class extends Gt{constructor(t,r,s){super(t,{username:r,accessKey:s})}async upsertVariable(t){let r=t.environmentId??0,s=await D(`${this.baseUrl}/v1/variables`,{method:"POST",headers:this.headers(),body:JSON.stringify({name:t.name,value:String(t.value),type:"variable",value_type:"string",is_persist:t.isPersist??!1,environment_id:r})});if(s.ok)return{id:(await s.json()).id??0};if(s.status!==409&&s.status!==422)return{id:0};if(!(await D(`${this.baseUrl}/v1/variables/name/${encodeURIComponent(t.name)}`,{method:"PUT",headers:this.headers(),body:JSON.stringify({value:String(t.value),value_type:"string",type:"variable",environment_id:r})})).ok)return{id:0};let o=await D(`${this.baseUrl}/v1/variables/${encodeURIComponent(t.name)}?environment_id=${r}`,{method:"GET",headers:this.headers()});return o.ok?{id:(await o.json()).data?.id??0}:{id:0}}};function Qr(e,t){if(Object.keys(e).length===0)return{};let r={};for(let[s,n]of Object.entries(e)){let o=n.syntax??`{{${s}}}`;t.includes(o)&&(r[s]=n)}return r}function Yr(e){let t=Jr(e.globalDir,e.localDir,e.onLoadError),r=e.file?zr(e.file):{},s=e.inline?Wr(e.inline):{},n={...t,...r,...s},o=Object.keys(n).length>0,{variables:a,objective:u}=o?ue(n,e.objective):{variables:{},objective:e.objective},i=Object.entries(n).filter(([,h])=>h.secret),l=Object.entries(n).filter(([,h])=>!h.secret);return{raw:n,auteur:a,auteurObjective:u,secretEntries:i,nonSecretEntries:l}}async function Zr(e){if(e.localMode)return{};let t=W(e.env);if(e.variables.secretEntries.length>0){let s=new fe(t.secretsBaseUrl);for(let[n,o]of e.variables.secretEntries)s.pushSecret({secretKey:n,secretValue:o.value,username:e.auth.username,accessKey:e.auth.access_key,orgId:e.orgId}).then(()=>e.log("info","SECRET_PUSH_OK","Secret pushed",{key:n})).catch(a=>e.log("error","SECRET_PUSH_FAILED","Secret push failed",{key:n,error:String(a)}))}let r={};if(e.variables.nonSecretEntries.length>0){let s=new pe(t.tmsBaseUrl,e.auth.username,e.auth.access_key);for(let[n,o]of e.variables.nonSecretEntries)try{let a=await s.upsertVariable({name:n,value:o.value});r[n]=a.id,e.log("info","VAR_PUSH_OK","Variable pushed",{name:n,id:a.id})}catch(a){e.log("error","VAR_PUSH_FAILED","Variable push failed",{name:n,error:String(a)})}}return r}import{readFileSync as rn,existsSync as sn}from"fs";function It(e){if(!sn(e))return null;try{return rn(e,"utf-8").trim()||null}catch{return null}}import{writeFileSync as nn,mkdirSync as on}from"fs";import{dirname as Xr}from"path";function Ct(e){let t=le(e.sourcePath);try{on(Xr(t),{recursive:!0})}catch(s){return process.stderr.write(`
19
19
  \u26A0 Failed to create output directory.
20
20
  ${s.message}
@@ -45,7 +45,7 @@ import{a as Se,b as nr}from"./chunk-C5UNZ6ZY.js";import{a as ar}from"./chunk-BH6
45
45
  `),!1;let m=c.sessionId,v=o.onLockConflict??i.rootGlobal.on_lock_conflict??"readonly",y=await fs({tmsBaseUrl:w.tmsBaseUrl,testId:p.testId,fromCommitId:p.fromCommitId,newCommitId:m,basicAuth:d,onLockConflict:v});return y==="ok"?(_=!0,p.newCommitId=m,c.log("info","MID_RUN_LOCK_ACQUIRED","Mid-run lock acquired",{test_id:p.testId}),a&&t.onLockState({phase:"acquired",scope:"mid_run"}),vt({baseUrl:ze(w.tmsBaseUrl),testId:p.testId,auth:We(d),lifecycle:r}),!0):(c.log("error","MID_RUN_LOCK_CONFLICT","Mid-run lock acquisition failed",{reason:y}),a&&t.onLockState({phase:"conflict",scope:"mid_run",reason:y}),process.stderr.write(`error: mid-run lock acquisition failed (${y})
46
46
  `),!1)};if(a){let d=o.author===!0;d&&(pt(),c.log("info","FORCE_AUTHOR_RUN","--author flag set; walker bypassed"));let{authorBoundary:m,cancelledInPhase:v,shrinkCount:y}=await yr({decisions:p.decisions,forceAuthor:d,hasRetry:o.retry===!0||o.retryCount!==void 0,maxShrinks:o.retryCount!==void 0?parseInt(o.retryCount,10):Se.maxShrinks,runReplayPhase:Rs,session:c,accumulator:te,acquireLockIfNeeded:$t});if(N=y>0,y>0&&(c.log("info","RETRY_TRIGGERED","Retry loop triggered",{shrink_count:y,final_author_boundary:m}),t.onRetryAttempt({shrink_count:y,final_author_boundary:m,complete_reauthor:m===0})),m===0&&y>0&&c.log("info","COMPLETE_REAUTHOR_TRIGGERED","Complete reauthor fallback",{shrink_count:y}),!v&&m>=0)for(let b=m;b<i.steps.length;b++){let R=i.steps[b];if(!te.shouldRunFlatStep(R))continue;Nt(b),L=!0;let C=c.nextRunIndex();ne=C,await Ze(he(oe.raw,R.config.variables,R.objective).raw);let A=Mt(b,C),J=Date.now(),z=null,U=null,K=null,B=!1,Y=0;try{let E=at(A,{environment:f,assertionMode:Lt});r.register("runner",()=>{it()&&(P=!0);try{E.cancel()}catch{}}),F?.setRunActive(!0);try{for await(let T of E.events){if(t.onAgentEvent(T),T.type==="bifurcation"){let x=T.count??T.flows?.length??0;(T.is_single_flow??x<=1)||(K=T.flows??null,B=!0,Y=0)}else if(T.type==="run_start"&&B)Y++;else if(T.type==="step_event"&&T.event==="reasoning")F?.setStepText(T.detail);else if(T.type==="step_end"&&(T.status==="passed"&&F?.setStepComplete(),be)){let x=B?Math.max(0,Y-1):0;be(T.index,x,T.child_id)}if(T.type==="run_end"){z=T;break}if(T.type==="error"){U=T.message??"runner error";break}}try{E.cancel()}catch{}}finally{F?.setRunActive(!1),r.cleanup("runner","Step complete")}}catch(E){U=E.message}let Z=Math.round((Date.now()-J)/1e3),O=et(b,C,z,K,U,Z);if(c.recordStepRun({testmdStepIndex:i.steps[b].flatIndex,runIndex:C,totalRunDirs:z?.total_runs??1}),!O||P)break}}else{let{effectiveDecisions:d}=await import("./effective-decisions-DRM3JSR4.js"),{decideRetry:m}=await import("./replay-policy-6USQBT3E.js"),v=o.retry===!0||o.retryCount!==void 0,y=o.retryCount!==void 0?parseInt(o.retryCount,10):Se.maxShrinks,b=o.author===!0;b&&(pt(),c.log("info","FORCE_AUTHOR_RUN","--author flag set; walker bypassed"));let R=b?0:Me(p.decisions),C=0,A=null,J=p.decisions.filter(B=>B.kind==="replay").length,z=p.decisions.length-J,U=[];o.push&&U.push("--push"),v&&U.push("--retry"),o.retryCount!==void 0&&U.push(`--retry-count=${o.retryCount}`),b&&U.push("--author");let K={source:s,steps:{total:p.decisions.length,replay:J,author:z},model:I,viewport:{width:$.window_size.width,height:$.window_size.height},chrome:Q.cdpEndpoint??Q.wsEndpoint??"managed",session:c.sessionName??"ephemeral",variables:{count:Object.keys(H.raw).length,secrets:Object.values(H.raw).filter(B=>B.secret).length,names:Object.keys(H.raw)},flags:U,mode:h.mode??"testing"};for(;;){let B=c.snapshot(),Y=te.snapshot(),Z=d(p.decisions,R,b);if(C>=1){let x=R===0?`\u21BB Complete re-author \u2014 retry budget exhausted (${C}/${y})`:`\u21BB Retry ${C}/${y} \u2014 replay 0..${R-1}, author ${R}..${p.decisions.length-1}
47
47
  reason: replay miss at step ${(A??0)+1}`;process.stderr.write(x+`
48
- `)}let O=C>=1&&R>0&&A!==null?{startIdx:0,endIdx:A,count:A}:void 0;F?.setRunActive(!0);let E=await jn({decisions:Z,resolved:i,session:c,accumulator:te,tuiConfig:$,globalConfig:K,buildStepConfigAt:Mt,buildReplayConfig:x=>{let X=p.decisions[x];if(X.kind!=="replay")throw new Error("expected replay decision at index "+x);let re=i.steps[x];return ht({step:re,decision:X,chrome:Q,auth:l,sessionId:c.sessionId,runIndex:c.nextRunIndex(),sessionDir:c.sessionDir,windowSize:{width:$.window_size.width,height:$.window_size.height},forceNavigateUrl:x===0?ye??void 0:void 0,sessionContext:c.getContext(),variables:Pn(oe.raw,re.config.variables,re.objective)})},onAnyAuthorStep:()=>{L=!0},onCancel:()=>{V=!0},topBannerModel:I,topBannerAuth:`${S.getActiveProfile()??"no profile"}/${f}`,spawnOpts:{environment:f,mode:h.mode??"testing",assertionMode:Lt,log:(x,X,re,tt)=>c.log(x,X,re,tt)},priorAttemptRollup:O,pushStepLevelDelta:(x,X)=>Ze(he(oe.raw,x,X).raw),onSequencerStepEnd:(x,X,re,tt)=>{let Is=Math.round((Date.now()-tt)/1e3),Cs=x.hadError?x.reason??"runner error":null,ks=et(X,re,x.runEnd,x.bifurcationFlows??null,Cs,Is);return c.recordStepRun({testmdStepIndex:i.steps[X].flatIndex,runIndex:re,totalRunDirs:x.runEnd?.total_runs??x.bifurcationFlows?.length??1}),ks},screenshotDispatcher:be,onReasoning:x=>F?.setStepText(x),onStepComplete:()=>F?.setStepComplete(),onSpawnStart:x=>{ne=x},host:t});if(F?.setRunActive(!1),E.cancelled){r.cleanup("marker-overlay","user cancelled run"),r.cleanup("chrome","user cancelled run");break}if(E.failedAt===null)break;let T=m({failedAt:E.failedAt,shrinkCount:C,hasRetry:v,maxShrinks:y});if(T.kind==="fail"||!_&&!await $t())break;c.rollback(B),te.rollback(Y),T.kind==="complete-reauthor"?R=0:R=T.newAuthorBoundary,C++,N=!0,c.log("info","RETRY_TRIGGERED","Retry loop triggered (TTY)",{shrink_count:C,failed_at:A}),R===0&&c.log("info","COMPLETE_REAUTHOR_TRIGGERED","Complete reauthor fallback (TTY)",{shrink_count:C}),A=E.failedAt}}let M=te.finalize(),ie=Math.round((Date.now()-vs)/1e3),ws={session:c,resolvedAuth:l,chromeResult:Q,chromeInstance:xe??null,testId:c.testId??null,preparedVariables:H,variableIds:Pe,globalContext:jt,localContext:Ut,tuiConfig:$,env:f,localMode:!!o.local},ae=await es(ws,{performUpload:async()=>{if(!l.basicAuth)return null;let d=W(f),m=(L||o.push===!0)&&!V,v=(_||p.isFirstRun)&&!V&&M.overallStatus==="passed",y=ge&&(_||p.isFirstRun);c.log("info","PIPELINE_GATE_STATE","Derived gate state (finalize)",{phase:"finalize",shouldUploadArtifacts:ge,shouldUploadPipeline:y,shouldReplaceLocalOutput:m,shouldCommit:v,lockHeld:_,anyAuthorStepRan:L,cancelled:V,overallStatus:M.overallStatus});let b=os({session:c,env:f,auth:l,variables:H,variableIds:Pe,projectId:G,folderId:Ae,totalSteps:M.outcomes.length,totalDuration:ie,screenshotExtMap:Ee?.getExtMap(),codeExport:as({codeExport:o.codeExport,codeLanguage:o.codeLanguage,skipCodeValidation:o.skipCodeValidation},$.code_export),onProgress:()=>{},log:(C,A,J,z)=>c.log(C,A,J,z),shouldUploadArtifacts:y,shouldReplaceLocalOutput:m,shouldCommit:v,isFirstRun:p.isFirstRun,resolvedTest:i,sourcePath:s,stepRunRecords:c.getStepRunRecords(),outcomes:M.outcomes,overallStatus:M.overallStatus,fromCommitId:p.fromCommitId,startedISO:Xe,durationS:ie,tmsIds:{testId:p.testId??c.testId??void 0,testcaseId:p.testcaseId??c.testcaseId??void 0,projectId:G??void 0,folderId:Ae??void 0,orgId:c.orgId??void 0,sessionName:c.sessionName??Ue(s)},tmsBaseUrl:w.tmsBaseUrl,testId:p.testId??void 0,newCommitId:p.newCommitId??void 0,basicAuth:l.basicAuth??void 0,decisions:p.decisions,wantsPush:o.push===!0,retryTriggered:N,forceAuthor:o.author===!0});p.newCommitId!=null&&(b.skipTmsFinalize=!0);let R=new ar(b);return a?await R.execute():await t.runUpload(R,C=>{if(C.testcaseId&&C.shareId&&G)return wt(d.testManagerUiUrl,G,C.testcaseId,C.shareId)})},runCleanup:()=>{r.cleanup("chrome","test.md run complete")},log:(d,m,v,y)=>c.log(d,m,v,y)},{overallStatus:M.overallStatus,outcomes:M.outcomes,sourcePath:s,title:i.rootTitle,rootSteps:i.rootSteps,startedISO:Xe,durationS:ie,localMode:!!o.local,skipLocalWrites:!0});await Ln(s,p,c,M.outcomes,M.overallStatus,Xe,ie,ae.uploadResult,$,o,{resolvedAuth:l,tmsBaseUrl:w.tmsBaseUrl},_,V);let Bt=W(f),Te=ae.uploadResult?.testcaseId,Oe=Te&&ae.uploadResult?.shareId&&G?wt(Bt.testManagerUiUrl,G,Te,ae.uploadResult.shareId):void 0,Vt={overallStatus:M.overallStatus,durationS:ie,decisions:p.decisions,outcomes:M.outcomes,cancelled:V,retryTriggered:N,lockHeld:_,anyAuthorStepRan:L,isFirstRun:p.isFirstRun,wantsPush:o.push===!0,uploadResult:ae.uploadResult,shouldUploadArtifacts:ge,shouldReplaceLocalOutput:L&&!V,shouldCommit:(_||p.isFirstRun)&&!V&&M.overallStatus==="passed",shareUrl:Oe},{buildSummaryEvent:_s}=await import("./SummaryBox-AAXB55TE.js");if(a?t.onAgentEvent(_s(Vt)):await t.onSummary(Vt),!a){let d=Te&&G?Fr(Bt.testManagerUiUrl,G,Te):void 0;await t.onLinks({recordedTestPath:s,outputDir:se(s),shareableLink:Oe,testCaseLink:d,codeExportDir:ae.uploadResult?.codeExportDir})}return t.onAgentEvent({type:"test_md_done",overall_status:M.overallStatus,duration_s:ie,session_id:c.sessionId,...Oe?{share_url:Oe}:{}}),{overallStatus:M.overallStatus,exitCode:M.overallStatus==="passed"?0:1,outputDir:se(s),durationS:ie,uploadResult:ae.uploadResult}}function xn(e,t){let r={...e,...t},s=Object.keys(r).length>0?ue(r,""):{variables:{},objective:"",keyMap:{}};return{raw:r,auteur:s.variables,auteurObjective:"",secretEntries:Object.entries(r).filter(([,n])=>n.secret),nonSecretEntries:Object.entries(r).filter(([,n])=>!n.secret)}}function he(e,t,r){let s={...e,...t??{}};if(Object.keys(s).length===0)return{raw:s,variables:{},objective:r};let n=ue(s,r);return{raw:s,variables:Qr(n.variables,n.objective),objective:n.objective}}function Pn(e,t,r){let s=he(e,t,r).variables;return Object.keys(s).length>0?s:void 0}function ms(e,t){let r=new Set(Ge),s={...e};for(let[n,o]of Object.entries(t))r.has(n)||n!=="variables"&&o!==void 0&&e[n]===void 0&&(s[n]=o);return s}function Tn(e,t){return e.length<=t?e:e.slice(0,t-1)+"\u2026"}async function On(e,t,r,s,n,o){let a=tr(e),u=cr(t,ds(a)?a:null);mr(t,u);let i=le(e),l=ds(i)?JSON.parse(An(i,"utf8")):null,h=l?.testcase_id,f=l?.test_id,w=l?.commit_id,g=r.push===!0,I=r.retry===!0||r.retryCount!==void 0,S=r.author===!0;g&&!h&&process.stderr.write(`[--push] no meta.json yet \u2014 flag is a no-op on first run
48
+ `)}let O=C>=1&&R>0&&A!==null?{startIdx:0,endIdx:A,count:A}:void 0;F?.setRunActive(!0);let E=await jn({decisions:Z,resolved:i,session:c,accumulator:te,tuiConfig:$,globalConfig:K,buildStepConfigAt:Mt,buildReplayConfig:x=>{let X=p.decisions[x];if(X.kind!=="replay")throw new Error("expected replay decision at index "+x);let re=i.steps[x];return ht({step:re,decision:X,chrome:Q,auth:l,sessionId:c.sessionId,runIndex:c.nextRunIndex(),sessionDir:c.sessionDir,windowSize:{width:$.window_size.width,height:$.window_size.height},forceNavigateUrl:x===0?ye??void 0:void 0,sessionContext:c.getContext(),variables:Pn(oe.raw,re.config.variables,re.objective)})},onAnyAuthorStep:()=>{L=!0},onCancel:()=>{V=!0},topBannerModel:I,topBannerAuth:`${S.getActiveProfile()??"no profile"}/${f}`,spawnOpts:{environment:f,mode:h.mode??"testing",assertionMode:Lt,log:(x,X,re,tt)=>c.log(x,X,re,tt)},priorAttemptRollup:O,pushStepLevelDelta:(x,X)=>Ze(he(oe.raw,x,X).raw),onSequencerStepEnd:(x,X,re,tt)=>{let Is=Math.round((Date.now()-tt)/1e3),Cs=x.hadError?x.reason??"runner error":null,ks=et(X,re,x.runEnd,x.bifurcationFlows??null,Cs,Is);return c.recordStepRun({testmdStepIndex:i.steps[X].flatIndex,runIndex:re,totalRunDirs:x.runEnd?.total_runs??x.bifurcationFlows?.length??1}),ks},screenshotDispatcher:be,onReasoning:x=>F?.setStepText(x),onStepComplete:()=>F?.setStepComplete(),onSpawnStart:x=>{ne=x},host:t});if(F?.setRunActive(!1),E.cancelled){r.cleanup("marker-overlay","user cancelled run"),r.cleanup("chrome","user cancelled run");break}if(E.failedAt===null)break;let T=m({failedAt:E.failedAt,shrinkCount:C,hasRetry:v,maxShrinks:y});if(T.kind==="fail"||!_&&!await $t())break;c.rollback(B),te.rollback(Y),T.kind==="complete-reauthor"?R=0:R=T.newAuthorBoundary,C++,N=!0,c.log("info","RETRY_TRIGGERED","Retry loop triggered (TTY)",{shrink_count:C,failed_at:A}),R===0&&c.log("info","COMPLETE_REAUTHOR_TRIGGERED","Complete reauthor fallback (TTY)",{shrink_count:C}),A=E.failedAt}}let M=te.finalize(),ie=Math.round((Date.now()-vs)/1e3),ws={session:c,resolvedAuth:l,chromeResult:Q,chromeInstance:xe??null,testId:c.testId??null,preparedVariables:H,variableIds:Pe,globalContext:jt,localContext:Ut,tuiConfig:$,env:f,localMode:!!o.local},ae=await es(ws,{performUpload:async()=>{if(!l.basicAuth)return null;let d=W(f),m=(L||o.push===!0)&&!V,v=(_||p.isFirstRun)&&!V&&M.overallStatus==="passed",y=ge&&(_||p.isFirstRun);c.log("info","PIPELINE_GATE_STATE","Derived gate state (finalize)",{phase:"finalize",shouldUploadArtifacts:ge,shouldUploadPipeline:y,shouldReplaceLocalOutput:m,shouldCommit:v,lockHeld:_,anyAuthorStepRan:L,cancelled:V,overallStatus:M.overallStatus});let b=os({session:c,env:f,auth:l,variables:H,variableIds:Pe,projectId:G,folderId:Ae,totalSteps:M.outcomes.length,totalDuration:ie,screenshotExtMap:Ee?.getExtMap(),codeExport:as({codeExport:o.codeExport,codeLanguage:o.codeLanguage,skipCodeValidation:o.skipCodeValidation},$.code_export),onProgress:()=>{},log:(C,A,J,z)=>c.log(C,A,J,z),shouldUploadArtifacts:y,shouldReplaceLocalOutput:m,shouldCommit:v,isFirstRun:p.isFirstRun,resolvedTest:i,sourcePath:s,stepRunRecords:c.getStepRunRecords(),outcomes:M.outcomes,overallStatus:M.overallStatus,fromCommitId:p.fromCommitId,startedISO:Xe,durationS:ie,tmsIds:{testId:p.testId??c.testId??void 0,testcaseId:p.testcaseId??c.testcaseId??void 0,projectId:G??void 0,folderId:Ae??void 0,orgId:c.orgId??void 0,sessionName:c.sessionName??Ue(s)},tmsBaseUrl:w.tmsBaseUrl,testId:p.testId??void 0,newCommitId:p.newCommitId??void 0,basicAuth:l.basicAuth??void 0,decisions:p.decisions,wantsPush:o.push===!0,retryTriggered:N,forceAuthor:o.author===!0});p.newCommitId!=null&&(b.skipTmsFinalize=!0);let R=new ar(b);return a?await R.execute():await t.runUpload(R,C=>{if(C.testcaseId&&C.shareId&&G)return wt(d.testManagerUiUrl,G,C.testcaseId,C.shareId)})},runCleanup:()=>{r.cleanup("chrome","test.md run complete")},log:(d,m,v,y)=>c.log(d,m,v,y)},{overallStatus:M.overallStatus,outcomes:M.outcomes,sourcePath:s,title:i.rootTitle,rootSteps:i.rootSteps,startedISO:Xe,durationS:ie,localMode:!!o.local,skipLocalWrites:!0});await Ln(s,p,c,M.outcomes,M.overallStatus,Xe,ie,ae.uploadResult,$,o,{resolvedAuth:l,tmsBaseUrl:w.tmsBaseUrl},_,V);let Bt=W(f),Te=ae.uploadResult?.testcaseId,Oe=Te&&ae.uploadResult?.shareId&&G?wt(Bt.testManagerUiUrl,G,Te,ae.uploadResult.shareId):void 0,Vt={overallStatus:M.overallStatus,durationS:ie,decisions:p.decisions,outcomes:M.outcomes,cancelled:V,retryTriggered:N,lockHeld:_,anyAuthorStepRan:L,isFirstRun:p.isFirstRun,wantsPush:o.push===!0,uploadResult:ae.uploadResult,shouldUploadArtifacts:ge,shouldReplaceLocalOutput:L&&!V,shouldCommit:(_||p.isFirstRun)&&!V&&M.overallStatus==="passed",shareUrl:Oe},{buildSummaryEvent:_s}=await import("./SummaryBox-47MHU37V.js");if(a?t.onAgentEvent(_s(Vt)):await t.onSummary(Vt),!a){let d=Te&&G?Fr(Bt.testManagerUiUrl,G,Te):void 0;await t.onLinks({recordedTestPath:s,outputDir:se(s),shareableLink:Oe,testCaseLink:d,codeExportDir:ae.uploadResult?.codeExportDir})}return t.onAgentEvent({type:"test_md_done",overall_status:M.overallStatus,duration_s:ie,session_id:c.sessionId,...Oe?{share_url:Oe}:{}}),{overallStatus:M.overallStatus,exitCode:M.overallStatus==="passed"?0:1,outputDir:se(s),durationS:ie,uploadResult:ae.uploadResult}}function xn(e,t){let r={...e,...t},s=Object.keys(r).length>0?ue(r,""):{variables:{},objective:"",keyMap:{}};return{raw:r,auteur:s.variables,auteurObjective:"",secretEntries:Object.entries(r).filter(([,n])=>n.secret),nonSecretEntries:Object.entries(r).filter(([,n])=>!n.secret)}}function he(e,t,r){let s={...e,...t??{}};if(Object.keys(s).length===0)return{raw:s,variables:{},objective:r};let n=ue(s,r);return{raw:s,variables:Qr(n.variables,n.objective),objective:n.objective}}function Pn(e,t,r){let s=he(e,t,r).variables;return Object.keys(s).length>0?s:void 0}function ms(e,t){let r=new Set(Ge),s={...e};for(let[n,o]of Object.entries(t))r.has(n)||n!=="variables"&&o!==void 0&&e[n]===void 0&&(s[n]=o);return s}function Tn(e,t){return e.length<=t?e:e.slice(0,t-1)+"\u2026"}async function On(e,t,r,s,n,o){let a=tr(e),u=cr(t,ds(a)?a:null);mr(t,u);let i=le(e),l=ds(i)?JSON.parse(An(i,"utf8")):null,h=l?.testcase_id,f=l?.test_id,w=l?.commit_id,g=r.push===!0,I=r.retry===!0||r.retryCount!==void 0,S=r.author===!0;g&&!h&&process.stderr.write(`[--push] no meta.json yet \u2014 flag is a no-op on first run
49
49
  `),S&&(h=void 0,f=void 0,w=void 0);let k=s.resolvedAuth.basicAuth;if(!k){let N=await s.resolvedAuth.resolver.resolve(!0);N?.username&&N?.access_key&&(k={username:N.username,access_key:N.access_key},s.resolvedAuth.basicAuth=k)}let c=!!k,P=!r.local&&c&&f!=null&&w!=null&&h!=null,p=P&&(ur(u)||g);if(g&&!P)return process.stderr.write(`error: --push requires authenticated credentials for the lock API. Run 'kane-cli login' (OAuth) or pass --username/--access-key inline.
50
50
  `),{resolved:t,decisions:u,testId:f,testcaseId:h,fromCommitId:w,newCommitId:null,isFirstRun:!1,hasAuth:c,canLock:P,lockAcquired:!1,abort:{exitCode:2}};if(I&&!P)return process.stderr.write(`error: --retry requires authenticated credentials for the lock API. Run 'kane-cli login' (OAuth) or pass --username/--access-key inline.
51
51
  `),{resolved:t,decisions:u,testId:f,testcaseId:h,fromCommitId:w,newCommitId:null,isFirstRun:!1,hasAuth:c,canLock:P,lockAcquired:!1,abort:{exitCode:2}};if(S&&!c)return process.stderr.write(`error: --author requires authenticated credentials for the TMS API. Run 'kane-cli login' (OAuth) or pass --username/--access-key inline.
@@ -0,0 +1,5 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as g}from"./chunk-KKIFXAJY.js";import{spawn as N,execSync as O}from"child_process";import{existsSync as v}from"fs";import{resolve as t,dirname as T}from"path";import{fileURLToPath as b}from"url";import{createInterface as A}from"readline";async function*E(s){let e=A({input:s,crlfDelay:1/0});for await(let c of e){let r=c.trim();if(r)try{let d=JSON.parse(r);d&&typeof d.type=="string"&&(yield d)}catch{}}}function S(s){return s==="action"?{set:{V16_AGENT_ENABLE_ALL_BLOCKERS:"true",V16_AGENT_SKIP_CP_FINAL:"true",V16_BIFURCATION_PHASES:"1"},unset:["V16_NETWORK_WS","V16_NETWORK_SSE"]}:{set:{V16_BIFURCATION_PHASES:"1"},unset:["V16_AGENT_ENABLE_ALL_BLOCKERS","V16_AGENT_SKIP_CP_FINAL","V16_NETWORK_WS","V16_NETWORK_SSE"]}}function R(s){return s==="dom"?{set:{V16_AGENT_ENABLE_TEXTUAL_VISUAL:"true"},unset:[]}:{set:{},unset:["V16_AGENT_ENABLE_TEXTUAL_VISUAL"]}}var a=T(b(import.meta.url));function C(){for(let s of["python3","python"])try{return O(`${s} --version`,{stdio:"ignore"}),s}catch{}return null}function h(){let e=process.platform==="win32"?"v16-runner.exe":"v16-runner",c={"darwin-arm64":["@testmuai/kane-cli-darwin-arm64","@lambdatestincprivate/kane-cli-darwin-arm64"],"darwin-x64":["@testmuai/kane-cli-darwin-x64","@lambdatestincprivate/kane-cli-darwin-x64"],"linux-x64":["@testmuai/kane-cli-linux-x64","@lambdatestincprivate/kane-cli-linux-x64"],"linux-arm64":["@testmuai/kane-cli-linux-arm64","@lambdatestincprivate/kane-cli-linux-arm64"],"win32-x64":["@testmuai/kane-cli-win-x64","@lambdatestincprivate/kane-cli-win-x64"]},r=`${process.platform}-${process.arch}`,d=c[r];if(d)for(let n of d){let l=[t(a,"..","node_modules",n,"bin",e),t(a,"..","..","node_modules",n,"bin",e),t(a,"..","..","..","node_modules",n,"bin",e),t(a,"..","..","..","..","node_modules",n,"bin",e)];for(let o of l)if(v(o))return{cmd:o,args:[]}}let m=[t(a,"bin",e),t(a,"..","bin",e),t(a,"..","..","..","..","v16-runner","dist",e),t(a,"..","..","..","v16-runner","dist",e),t(process.cwd(),"v16-runner","dist",e),t(process.cwd(),"..","v16-runner","dist",e)];for(let n of m)if(v(n))return{cmd:n,args:[]};let p=[t(a,"..","..","v16-runner"),t(a,"..","..","..","..","v16-runner"),t(a,"..","..","..","v16-runner"),t(process.cwd(),"v16-runner"),t(process.cwd(),"..","v16-runner")];for(let n of p)if(v(t(n,"main.py"))){for(let o of[t(n,".venv","bin","python"),t(n,"..","browser-agent",".venv","bin","python")])if(v(o))return{cmd:o,args:["main.py"],cwd:n};let l=C();if(l)return{cmd:l,args:["main.py"],cwd:n}}return null}function W(s,e){let c=h();if(!c)throw new Error("v16-runner not found. Build the binary with `cd v16-runner && python build.py` or ensure Python is available.");let r={...process.env};e?.environment&&(r.TESTMUAI_ENV=e.environment),r.TESTMUAI_SOURCE="kane-cli",process.platform==="win32"&&(r.PYTHONIOENCODING="utf-8");let d=g(e?.environment);r.V16_SERVER_API_HOST=d.v16ServerHost,r.ATMS_URL=d.tmsBaseUrl.replace(/\/api\/?$/,""),s.username&&s.access_key&&(r.LT_USERNAME=s.username,r.LT_ACCESS_KEY=s.access_key),s.session_id&&(r.TESTMUAI_SESSION_ID=s.session_id);let m=S(e?.mode??"testing");Object.assign(r,m.set);for(let i of m.unset)delete r[i];let p=R(e?.assertionMode??"visual");Object.assign(r,p.set);for(let i of p.unset)delete r[i];let n=N(c.cmd,c.args,{stdio:["pipe","pipe","pipe"],env:r,cwd:c.cwd});n.stdin.on("error",()=>{}),n.stdin.write(JSON.stringify(s)+`
3
+ `);let l=1e5,o="";n.stderr.on("data",i=>{o+=i.toString(),o.length>l&&(o=o.slice(-l))}),n.on("error",i=>{e?.log?.("error","RUNNER_SPAWN_ERROR","Runner spawn error",{error:i.message})});let _=null,f=null,x=new Promise(i=>{n.on("close",(u,y)=>{_=u,f=y?String(y):null,e?.log?.("info","RUNNER_EXIT","Runner exited",{code:u,signal:f??"none"}),i({code:u,signal:f})})}),w=E(n.stdout);return{child:n,events:w,sendUserResponse(i){let u=JSON.stringify({type:"user_response",answer:i});try{n.stdin.write(u+`
4
+ `)}catch{}},sendCancel(i){let u=JSON.stringify({type:"cancel",reason:i});try{n.stdin.write(u+`
5
+ `)}catch{}},cancel(){n.kill("SIGTERM")},get stderr(){return o},get exitCode(){return _},get exitSignal(){return f},exited:x}}export{h as a,W as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{x as a}from"./chunk-BGXAW2B5.js";import{a as c}from"./chunk-HCBYKLMW.js";import{b as u}from"./chunk-C44QQJR4.js";import{a as l}from"./chunk-6YGTRKDT.js";import{e as n}from"./chunk-UR6MHSHU.js";var s=n(l(),1);var o=n(l(),1);function f(r,e){let t=(0,o.useRef)(r);t.current=r,(0,o.useEffect)(()=>{if(e===null)return;let i=setInterval(()=>t.current(),e);return()=>clearInterval(i)},[e])}var p=n(c(),1),m=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function I({active:r=!0}){let[e,t]=(0,s.useState)(0);return f(()=>{t(i=>(i+1)%m.length)},r?80:null),(0,p.jsx)(u,{color:a.orange,children:r?m[e]:"\u25CF"})}export{f as a,I as b};
2
+ import{x as a}from"./chunk-LRKWPAGK.js";import{a as c}from"./chunk-HCBYKLMW.js";import{b as u}from"./chunk-C44QQJR4.js";import{a as l}from"./chunk-6YGTRKDT.js";import{e as n}from"./chunk-UR6MHSHU.js";var s=n(l(),1);var o=n(l(),1);function f(r,e){let t=(0,o.useRef)(r);t.current=r,(0,o.useEffect)(()=>{if(e===null)return;let i=setInterval(()=>t.current(),e);return()=>clearInterval(i)},[e])}var p=n(c(),1),m=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function I({active:r=!0}){let[e,t]=(0,s.useState)(0);return f(()=>{t(i=>(i+1)%m.length)},r?80:null),(0,p.jsx)(u,{color:a.orange,children:r?m[e]:"\u25CF"})}export{f as a,I as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as m}from"./chunk-EAUU5F4P.js";import{x as t}from"./chunk-BGXAW2B5.js";import{a as p}from"./chunk-HCBYKLMW.js";import{a,b as r,i as u}from"./chunk-C44QQJR4.js";import{a as b}from"./chunk-6YGTRKDT.js";import{e as n}from"./chunk-UR6MHSHU.js";var c=n(b(),1);var e=n(p(),1);function R({onSubmit:l}){let[o,f]=(0,c.useState)(0),s=(0,c.useRef)(!1);return u((x,i)=>{s.current||(i.leftArrow||i.rightArrow?f(d=>d===0?1:0):i.return?(s.current=!0,l(o===0?"positive":"negative")):i.escape&&(s.current=!0,l(null)))}),(0,e.jsxs)(a,{flexDirection:"column",marginTop:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(r,{color:t.secondary,children:"Rate this session: "}),(0,e.jsx)(r,{color:o===0?t.orange:t.dim,children:o===0?"[ \u{1F44D} ]":" \u{1F44D} "}),(0,e.jsx)(r,{children:" "}),(0,e.jsx)(r,{color:o===1?t.orange:t.dim,children:o===1?"[ \u{1F44E} ]":" \u{1F44E} "})]}),(0,e.jsx)(m,{bindings:[{keys:"\u2190/\u2192",label:"select"},{keys:"\u21B5",label:"submit"}],escBackLabel:"skip"})]})}export{R as a};
2
+ import{a as m}from"./chunk-IT66S24L.js";import{x as t}from"./chunk-LRKWPAGK.js";import{a as p}from"./chunk-HCBYKLMW.js";import{a,b as r,i as u}from"./chunk-C44QQJR4.js";import{a as b}from"./chunk-6YGTRKDT.js";import{e as n}from"./chunk-UR6MHSHU.js";var c=n(b(),1);var e=n(p(),1);function R({onSubmit:l}){let[o,f]=(0,c.useState)(0),s=(0,c.useRef)(!1);return u((x,i)=>{s.current||(i.leftArrow||i.rightArrow?f(d=>d===0?1:0):i.return?(s.current=!0,l(o===0?"positive":"negative")):i.escape&&(s.current=!0,l(null)))}),(0,e.jsxs)(a,{flexDirection:"column",marginTop:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(r,{color:t.secondary,children:"Rate this session: "}),(0,e.jsx)(r,{color:o===0?t.orange:t.dim,children:o===0?"[ \u{1F44D} ]":" \u{1F44D} "}),(0,e.jsx)(r,{children:" "}),(0,e.jsx)(r,{color:o===1?t.orange:t.dim,children:o===1?"[ \u{1F44E} ]":" \u{1F44E} "})]}),(0,e.jsx)(m,{bindings:[{keys:"\u2190/\u2192",label:"select"},{keys:"\u21B5",label:"submit"}],escBackLabel:"skip"})]})}export{R as a};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as l}from"./chunk-YYSABHRE.js";import{a as f}from"./chunk-HZUTFC3G.js";import{a as m}from"./chunk-3PISMPFM.js";import{a as p}from"./chunk-RZ4F3BHX.js";import{a as c,c as s,h as a,w as u}from"./chunk-BGXAW2B5.js";var v="/public/skills/kane-cli";function C(){try{let n=new f().getDefaultEnv();if(n in u)return n}catch{}return"prod"}function k(){return`${m(C()).controllerBaseUrl}${v}`}import{readFileSync as S,writeFileSync as E,mkdirSync as g}from"fs";import{join as d}from"path";var h=d(s,"skill-check.json"),y=3600*1e3;function V(){try{let n=JSON.parse(S(h,"utf-8"));if(Date.now()-n.checkedAt<y)return n}catch{}return null}function A(n){try{g(s,{recursive:!0}),E(h,JSON.stringify({map:n,checkedAt:Date.now()}))}catch{}}function I(){for(let{dir:n}of a)try{let t=S(d(n,"VERSION"),"utf-8").trim();if(t)return t}catch{}return null}function M(n,t){let i=Object.keys(n.versions??{});if(i.length===0)return null;let o=i.slice().sort((r,e)=>l(r,e));for(let r of o){let e=n.versions[r]?.kaneCliMinVersion;if(!e||l(t,e)<=0)return r}return null}async function U(){try{let n=V()?.map;if(!n){let o=new AbortController,r=setTimeout(()=>o.abort(),5e3),e=await p(k(),{headers:{Accept:"application/json"},signal:o.signal});if(clearTimeout(r),!e.ok)return null;n=await e.json(),A(n)}let t=M(n,c);if(!t)return null;let i=I();return i===null?{current:null,latestCompatible:t}:l(i,t)>0?{current:i,latestCompatible:t}:null}catch{return null}}export{k as a,M as b,U as c};
2
+ import{b as l}from"./chunk-HUAOH2JK.js";import{a as f}from"./chunk-RB2YKN77.js";import{a as m}from"./chunk-KKIFXAJY.js";import{a as p}from"./chunk-RZ4F3BHX.js";import{a as c,c as s,h as a,w as u}from"./chunk-LRKWPAGK.js";var v="/public/skills/kane-cli";function C(){try{let n=new f().getDefaultEnv();if(n in u)return n}catch{}return"prod"}function k(){return`${m(C()).controllerBaseUrl}${v}`}import{readFileSync as S,writeFileSync as E,mkdirSync as g}from"fs";import{join as d}from"path";var h=d(s,"skill-check.json"),y=3600*1e3;function V(){try{let n=JSON.parse(S(h,"utf-8"));if(Date.now()-n.checkedAt<y)return n}catch{}return null}function A(n){try{g(s,{recursive:!0}),E(h,JSON.stringify({map:n,checkedAt:Date.now()}))}catch{}}function I(){for(let{dir:n}of a)try{let t=S(d(n,"VERSION"),"utf-8").trim();if(t)return t}catch{}return null}function M(n,t){let i=Object.keys(n.versions??{});if(i.length===0)return null;let o=i.slice().sort((r,e)=>l(r,e));for(let r of o){let e=n.versions[r]?.kaneCliMinVersion;if(!e||l(t,e)<=0)return r}return null}async function U(){try{let n=V()?.map;if(!n){let o=new AbortController,r=setTimeout(()=>o.abort(),5e3),e=await p(k(),{headers:{Accept:"application/json"},signal:o.signal});if(clearTimeout(r),!e.ok)return null;n=await e.json(),A(n)}let t=M(n,c);if(!t)return null;let i=I();return i===null?{current:null,latestCompatible:t}:l(i,t)>0?{current:i,latestCompatible:t}:null}catch{return null}}export{k as a,M as b,U as c};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as $e}from"./chunk-XCMNFMSO.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-ALF5ETLD.js";import{a as Oe}from"./chunk-3PISMPFM.js";import{a as de}from"./chunk-EAUU5F4P.js";import{c as Re,x as u}from"./chunk-BGXAW2B5.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)+`
2
+ import{a as $e}from"./chunk-53O3GMZR.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-IGZPQQFP.js";import{a as Oe}from"./chunk-KKIFXAJY.js";import{a as de}from"./chunk-IT66S24L.js";import{c as Re,x as u}from"./chunk-LRKWPAGK.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
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
4
  `;)e--;return e<0||r[e]!=="@"||e>0&&r[e-1]!==" "&&r[e-1]!==`
5
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,`
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as k}from"./chunk-FPFOW6BS.js";import{g as a}from"./chunk-LOIRZFV3.js";import{a as m}from"./chunk-LPUQ4HWQ.js";import{a as h}from"./chunk-HZUTFC3G.js";import{a as y}from"./chunk-3PISMPFM.js";var $=10,u=200,N=1e4,S=1e6;function T(t,e,r="streaming"){let n=r==="full-fetch"?S:N,o=$,i=0;if(t!==void 0){let s=Number(t);if(!Number.isInteger(s)||s<1||s>u)return{error:`--limit must be an integer in [1, ${u}] (got "${t}")`};o=s}if(e!==void 0){let s=Number(e);if(!Number.isInteger(s)||s<0||s>n)return{error:`--offset must be an integer in [0, ${n}] (got "${e}")`};i=s}return{limit:o,offset:i}}function C(t,e){if(!e)return t;let r=e.toLowerCase();return t.filter(n=>n.name.toLowerCase().includes(r))}function j(t,{limit:e,offset:r}){let n=t.slice(r,r+e),o=t.length>r+e;return{slice:n,hasMore:o}}function v(t,e,r=n=>process.stdout.write(`${n}
2
+ import{a as k}from"./chunk-FPFOW6BS.js";import{g as a}from"./chunk-LOIRZFV3.js";import{a as m}from"./chunk-LPUQ4HWQ.js";import{a as h}from"./chunk-RB2YKN77.js";import{a as y}from"./chunk-KKIFXAJY.js";var $=10,u=200,N=1e4,S=1e6;function T(t,e,r="streaming"){let n=r==="full-fetch"?S:N,o=$,i=0;if(t!==void 0){let s=Number(t);if(!Number.isInteger(s)||s<1||s>u)return{error:`--limit must be an integer in [1, ${u}] (got "${t}")`};o=s}if(e!==void 0){let s=Number(e);if(!Number.isInteger(s)||s<0||s>n)return{error:`--offset must be an integer in [0, ${n}] (got "${e}")`};i=s}return{limit:o,offset:i}}function C(t,e){if(!e)return t;let r=e.toLowerCase();return t.filter(n=>n.name.toLowerCase().includes(r))}function j(t,{limit:e,offset:r}){let n=t.slice(r,r+e),o=t.length>r+e;return{slice:n,hasMore:o}}function v(t,e,r=n=>process.stdout.write(`${n}
3
3
  `)){for(let n of t)r(JSON.stringify(n));r(JSON.stringify({_meta:"page",limit:e.limit,offset:e.offset,returned:t.length,has_more:e.has_more}))}function b(t,e,r=n=>process.stdout.write(`${n}
4
- `)){if(t.length===0){r("(no results)");return}let n=Math.max(2,...t.map(s=>s.id.length)),o=`${"ID".padEnd(n)} NAME`;r(o),r(`${"-".repeat(n)} ----`);for(let s of t)r(`${s.id.padEnd(n)} ${s.name}`);r("");let i=e.offset+t.length;if(e.hasMore){let s=e.totalIsLowerBound?`${e.total}+`:`${e.total}`;r(`${i} of ${s} \u2014 next: --offset ${e.offset+e.limit}`)}else r(`${t.length} shown (${e.total} total)`)}async function B(t,e,r){if(r.username&&r.accessKey)return{ok:!0,creds:{username:r.username,access_key:r.accessKey}};let n=new h,o=n.loadBasicAuth(t,e);if(o)return{ok:!0,creds:{username:o.username,access_key:o.access_key}};let i=n.loadCredentials(t,e);if(!i)return{ok:!1,reason:"no_credentials"};let s=i.access_token;try{let{refreshOAuthToken:d}=await import("./token-refresh-XM3DXY2A.js"),w=await d({creds:n,profile:t,env:e,credentials:i});w&&(s=w.accessToken)}catch(d){return{ok:!1,reason:"refresh_failed",detail:d instanceof Error?d.message:String(d)}}let c=y(e),f=await new k(c.controllerBaseUrl,async()=>s,null).resolve();return f?{ok:!0,creds:{username:f.username,access_key:f.access_key}}:{ok:!1,reason:"exchange_failed"}}function E(t,e,r){switch(r.reason){case"no_credentials":return{message:`error: no credentials for profile "${t}" [${e}]. Run \`kane-cli login\` or pass --username/--access-key.
4
+ `)){if(t.length===0){r("(no results)");return}let n=Math.max(2,...t.map(s=>s.id.length)),o=`${"ID".padEnd(n)} NAME`;r(o),r(`${"-".repeat(n)} ----`);for(let s of t)r(`${s.id.padEnd(n)} ${s.name}`);r("");let i=e.offset+t.length;if(e.hasMore){let s=e.totalIsLowerBound?`${e.total}+`:`${e.total}`;r(`${i} of ${s} \u2014 next: --offset ${e.offset+e.limit}`)}else r(`${t.length} shown (${e.total} total)`)}async function B(t,e,r){if(r.username&&r.accessKey)return{ok:!0,creds:{username:r.username,access_key:r.accessKey}};let n=new h,o=n.loadBasicAuth(t,e);if(o)return{ok:!0,creds:{username:o.username,access_key:o.access_key}};let i=n.loadCredentials(t,e);if(!i)return{ok:!1,reason:"no_credentials"};let s=i.access_token;try{let{refreshOAuthToken:d}=await import("./token-refresh-QCHKMPCM.js"),w=await d({creds:n,profile:t,env:e,credentials:i});w&&(s=w.accessToken)}catch(d){return{ok:!1,reason:"refresh_failed",detail:d instanceof Error?d.message:String(d)}}let c=y(e),f=await new k(c.controllerBaseUrl,async()=>s,null).resolve();return f?{ok:!0,creds:{username:f.username,access_key:f.access_key}}:{ok:!1,reason:"exchange_failed"}}function E(t,e,r){switch(r.reason){case"no_credentials":return{message:`error: no credentials for profile "${t}" [${e}]. Run \`kane-cli login\` or pass --username/--access-key.
5
5
  `,exitCode:2};case"refresh_failed":return{message:`error: OAuth token refresh failed for profile "${t}" [${e}]${r.detail?`: ${r.detail}`:""}. Run \`kane-cli login\` to re-auth.
6
6
  `,exitCode:2};case"exchange_failed":return{message:`error: TMS credential exchange failed for profile "${t}" [${e}]. Token may be revoked \u2014 try \`kane-cli login\`; if the problem persists, TMS may be down.
7
7
  `,exitCode:2}}}function O(t){return{id:t.project_id,name:t.name}}function M(t){return{id:t.id,name:t.name}}async function P(t,e,r,n){let o=r+n+1,i=[],s=!0;for await(let c of t.listProjectsStream({name:e})){if(i.push(...c.projects),c.done){s=!0;break}if(i.length>=o){s=!1;break}}return{items:i,doneStreaming:s}}function g(t){return!!t.agent||!process.stdin.isTTY||!process.stdout.isTTY}function _(t,e=r=>process.stdout.write(`${r}
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as h}from"./chunk-EAUU5F4P.js";import{x as l}from"./chunk-BGXAW2B5.js";import{a as A}from"./chunk-HCBYKLMW.js";import{a as c,b as f,i as P}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as x}from"./chunk-UR6MHSHU.js";var L=x(B(),1);var n=x(A(),1);function S(r,d,s,u,m){let p=s==="basic"&&u?`basic (${u})`:s,i=20,a=`${r} [${d}]`,g="\xB7".repeat(Math.max(2,i-a.length+3));return{label:`${a} ${g} ${p}`,profile:r,env:d,isActive:m}}function M({creds:r,onSwitch:d,onCancel:s}){let u=r.listProfiles(),m=r.getActiveProfile(),p=r.getDefaultEnv(),i=u.map(e=>{let o=r.loadBasicAuth(e.profile,e.env),t=r.loadCredentials(e.profile,e.env)!==null,v=o?"basic":t?"oauth":"none",b=o?o.username:null,w=e.profile===m&&e.env===p;return S(e.profile,e.env,v,b,w)}),[a,g]=(0,L.useState)(()=>{let e=i.findIndex(o=>o.isActive);return e>=0?e:0});return P((e,o)=>{if(o.escape){s();return}if(o.upArrow){g(t=>Math.max(0,t-1));return}if(o.downArrow){g(t=>Math.min(i.length-1,t+1));return}if(o.return&&i[a]){let t=i[a];t.isActive||d(t.profile,t.env),s();return}}),i.length===0?(0,n.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:l.orange,paddingX:2,paddingY:1,children:[(0,n.jsx)(f,{color:l.orange,bold:!0,children:"Profiles"}),(0,n.jsx)(c,{marginTop:1,children:(0,n.jsx)(f,{color:l.dim,children:"No profiles \u2014 use Login to create one"})}),(0,n.jsx)(h,{bindings:[],escBackLabel:"back"})]}):(0,n.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:l.orange,paddingX:2,paddingY:1,children:[(0,n.jsx)(f,{color:l.orange,bold:!0,children:"Profiles"}),(0,n.jsx)(c,{flexDirection:"column",marginTop:1,children:i.map((e,o)=>{let t=o===a,v=t?"\u276F ":" ",b=e.isActive?l.green:t?l.orange:void 0;return(0,n.jsxs)(f,{color:b,children:[v,e.label,e.isActive?" \u25CF active":""]},`${e.profile}-${e.env}`)})}),(0,n.jsx)(h,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"switch"}],escBackLabel:"back"})]})}export{S as a,M as b};
2
+ import{a as h}from"./chunk-IT66S24L.js";import{x as l}from"./chunk-LRKWPAGK.js";import{a as A}from"./chunk-HCBYKLMW.js";import{a as c,b as f,i as P}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as x}from"./chunk-UR6MHSHU.js";var L=x(B(),1);var n=x(A(),1);function S(r,d,s,u,m){let p=s==="basic"&&u?`basic (${u})`:s,i=20,a=`${r} [${d}]`,g="\xB7".repeat(Math.max(2,i-a.length+3));return{label:`${a} ${g} ${p}`,profile:r,env:d,isActive:m}}function M({creds:r,onSwitch:d,onCancel:s}){let u=r.listProfiles(),m=r.getActiveProfile(),p=r.getDefaultEnv(),i=u.map(e=>{let o=r.loadBasicAuth(e.profile,e.env),t=r.loadCredentials(e.profile,e.env)!==null,v=o?"basic":t?"oauth":"none",b=o?o.username:null,w=e.profile===m&&e.env===p;return S(e.profile,e.env,v,b,w)}),[a,g]=(0,L.useState)(()=>{let e=i.findIndex(o=>o.isActive);return e>=0?e:0});return P((e,o)=>{if(o.escape){s();return}if(o.upArrow){g(t=>Math.max(0,t-1));return}if(o.downArrow){g(t=>Math.min(i.length-1,t+1));return}if(o.return&&i[a]){let t=i[a];t.isActive||d(t.profile,t.env),s();return}}),i.length===0?(0,n.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:l.orange,paddingX:2,paddingY:1,children:[(0,n.jsx)(f,{color:l.orange,bold:!0,children:"Profiles"}),(0,n.jsx)(c,{marginTop:1,children:(0,n.jsx)(f,{color:l.dim,children:"No profiles \u2014 use Login to create one"})}),(0,n.jsx)(h,{bindings:[],escBackLabel:"back"})]}):(0,n.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:l.orange,paddingX:2,paddingY:1,children:[(0,n.jsx)(f,{color:l.orange,bold:!0,children:"Profiles"}),(0,n.jsx)(c,{flexDirection:"column",marginTop:1,children:i.map((e,o)=>{let t=o===a,v=t?"\u276F ":" ",b=e.isActive?l.green:t?l.orange:void 0;return(0,n.jsxs)(f,{color:b,children:[v,e.label,e.isActive?" \u25CF active":""]},`${e.profile}-${e.env}`)})}),(0,n.jsx)(h,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"switch"}],escBackLabel:"back"})]})}export{S as a,M as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{x as m}from"./chunk-BGXAW2B5.js";import{a as x}from"./chunk-HCBYKLMW.js";import{a as u,b as a,j as g}from"./chunk-C44QQJR4.js";import{a as b}from"./chunk-6YGTRKDT.js";import{e as f}from"./chunk-UR6MHSHU.js";var T=f(b(),1);function k(i,n){if(!n)return i;let l=i.trim()||n;return`\x1B]8;;${n}\x07${l}\x1B]8;;\x07`}var r=f(x(),1);function $({shareableLink:i,testCaseLink:n,codeExportDir:l,recordedTestPath:s,outputDir:o,autoExit:p=!0}){let{exit:c}=g();(0,T.useEffect)(()=>{if(!p)return;let t=setTimeout(()=>c(),100);return()=>clearTimeout(t)},[c,p]);let e=[];return s&&e.push({label:"Test",url:s,linkUrl:`file://${s}`}),o&&e.push({label:"Output",url:o,linkUrl:`file://${o}`}),i&&e.push({label:"ShareLink",url:i}),n&&e.push({label:"TestCase",url:n}),l&&!o&&e.push({label:"CodeExport",url:l,linkUrl:`file://${l}`}),e.length===0?(0,r.jsx)(r.Fragment,{}):(0,r.jsx)(u,{flexDirection:"column",marginTop:1,marginLeft:1,children:e.map(t=>(0,r.jsxs)(u,{flexDirection:"column",marginBottom:1,children:[(0,r.jsxs)(a,{color:m.orange,children:[t.label,":"]}),(0,r.jsx)(a,{color:m.dim,children:k(t.url,t.linkUrl??t.url)})]},t.label))})}export{$ as a};
2
+ import{x as m}from"./chunk-LRKWPAGK.js";import{a as x}from"./chunk-HCBYKLMW.js";import{a as u,b as a,j as g}from"./chunk-C44QQJR4.js";import{a as b}from"./chunk-6YGTRKDT.js";import{e as f}from"./chunk-UR6MHSHU.js";var T=f(b(),1);function k(i,n){if(!n)return i;let l=i.trim()||n;return`\x1B]8;;${n}\x07${l}\x1B]8;;\x07`}var r=f(x(),1);function $({shareableLink:i,testCaseLink:n,codeExportDir:l,recordedTestPath:s,outputDir:o,autoExit:p=!0}){let{exit:c}=g();(0,T.useEffect)(()=>{if(!p)return;let t=setTimeout(()=>c(),100);return()=>clearTimeout(t)},[c,p]);let e=[];return s&&e.push({label:"Test",url:s,linkUrl:`file://${s}`}),o&&e.push({label:"Output",url:o,linkUrl:`file://${o}`}),i&&e.push({label:"ShareLink",url:i}),n&&e.push({label:"TestCase",url:n}),l&&!o&&e.push({label:"CodeExport",url:l,linkUrl:`file://${l}`}),e.length===0?(0,r.jsx)(r.Fragment,{}):(0,r.jsx)(u,{flexDirection:"column",marginTop:1,marginLeft:1,children:e.map(t=>(0,r.jsxs)(u,{flexDirection:"column",marginBottom:1,children:[(0,r.jsxs)(a,{color:m.orange,children:[t.label,":"]}),(0,r.jsx)(a,{color:m.dim,children:k(t.url,t.linkUrl??t.url)})]},t.label))})}export{$ as a};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as K,c as V,d as z,e as ee,f as te}from"./chunk-25YRWDQ7.js";import{c as J}from"./chunk-K266M5ZM.js";import{a as Q}from"./chunk-XCMNFMSO.js";import{a as Z}from"./chunk-FPFOW6BS.js";import{b as H}from"./chunk-CL5SB2I7.js";import{b as W}from"./chunk-SRQ7P3WI.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-HZUTFC3G.js";import{a as _}from"./chunk-3PISMPFM.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-W7UJ5D25.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-R5IGUIPA.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-G2GQ67DP.js";import{c as J}from"./chunk-NAAPNSZD.js";import{a as Q}from"./chunk-53O3GMZR.js";import{a as Z}from"./chunk-FPFOW6BS.js";import{b as H}from"./chunk-OHT5RY5E.js";import{b as W}from"./chunk-VLWWDXBN.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-RB2YKN77.js";import{a as _}from"./chunk-KKIFXAJY.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-4YMRWYLS.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-FIYH6K4A.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,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as l}from"./chunk-RZ4F3BHX.js";import{a,c,e as o}from"./chunk-BGXAW2B5.js";import{readFileSync as f,writeFileSync as d,mkdirSync as h,realpathSync as g}from"fs";import{join as y}from"path";var C="npm install -g @testmuai/kane-cli@latest",b="brew upgrade lambdatest/kane/kane-cli";function w(){try{let t=process.argv[1];if(t&&g(t).includes("/Cellar/"))return b}catch{}return C}var m=y(c,"version-check.json"),S=1440*60*1e3;function k(){try{let t=JSON.parse(f(m,"utf-8"));if(Date.now()-t.checkedAt<S)return t}catch{}return null}function A(t){try{h(c,{recursive:!0}),d(m,JSON.stringify({latest:t,checkedAt:Date.now()}))}catch{}}function u(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);for(let s=0;s<3;s++){let e=(n[s]??0)-(i[s]??0);if(e!==0)return e}return 0}function p(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);return(n[0]??0)!==(i[0]??0)?"major":(n[1]??0)!==(i[1]??0)?"minor":"patch"}async function j(){try{let t=k();if(t)return u(a,t.latest)>0?{current:a,latest:t.latest,severity:p(a,t.latest)}:null;let r=new AbortController,i=setTimeout(()=>r.abort(),5e3),n=await l(o,{headers:{Accept:"application/json"},signal:r.signal});if(clearTimeout(i),!n.ok)return null;let e=(await n.json())["dist-tags"]?.latest;return e?(A(e),u(a,e)>0?{current:a,latest:e,severity:p(a,e)}:null):null}catch{return null}}export{w as a,u as b,p as c,j as d};
2
+ import{a as l}from"./chunk-RZ4F3BHX.js";import{a,c,e as o}from"./chunk-LRKWPAGK.js";import{readFileSync as f,writeFileSync as d,mkdirSync as h,realpathSync as g}from"fs";import{join as y}from"path";var C="npm install -g @testmuai/kane-cli@latest",b="brew upgrade lambdatest/kane/kane-cli";function w(){try{let t=process.argv[1];if(t&&g(t).includes("/Cellar/"))return b}catch{}return C}var m=y(c,"version-check.json"),S=1440*60*1e3;function k(){try{let t=JSON.parse(f(m,"utf-8"));if(Date.now()-t.checkedAt<S)return t}catch{}return null}function A(t){try{h(c,{recursive:!0}),d(m,JSON.stringify({latest:t,checkedAt:Date.now()}))}catch{}}function u(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);for(let s=0;s<3;s++){let e=(n[s]??0)-(i[s]??0);if(e!==0)return e}return 0}function p(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);return(n[0]??0)!==(i[0]??0)?"major":(n[1]??0)!==(i[1]??0)?"minor":"patch"}async function j(){try{let t=k();if(t)return u(a,t.latest)>0?{current:a,latest:t.latest,severity:p(a,t.latest)}:null;let r=new AbortController,i=setTimeout(()=>r.abort(),5e3),n=await l(o,{headers:{Accept:"application/json"},signal:r.signal});if(clearTimeout(i),!n.ok)return null;let e=(await n.json())["dist-tags"]?.latest;return e?(A(e),u(a,e)>0?{current:a,latest:e,severity:p(a,e)}:null):null}catch{return null}}export{w as a,u as b,p as c,j as d};