@testmuai/kane-cli 0.6.11 → 0.7.0

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 (110) hide show
  1. package/dist/{ChatSurface-TZ554O4U.js → ChatSurface-PMEOJBZG.js} +1 -1
  2. package/dist/{ChromeProfilePicker-54CAJDUF.js → ChromeProfilePicker-DK2A3NYY.js} +1 -1
  3. package/dist/{CliFeedbackPrompt-TCAH4AHL.js → CliFeedbackPrompt-D5QDOBE2.js} +1 -1
  4. package/dist/{CliUploadProgress-UURZ63VQ.js → CliUploadProgress-AIZL7N6Z.js} +1 -1
  5. package/dist/{ConfigView-5QGB7MUS.js → ConfigView-SDBCTYUU.js} +1 -1
  6. package/dist/{EvidenceViewOffer-SSAM4RRP.js → EvidenceViewOffer-EOKJE2B6.js} +1 -1
  7. package/dist/{FolderPicker-Y5MAYFIJ.js → FolderPicker-IVBHPPMW.js} +1 -1
  8. package/dist/{HelpView-S3GJGSCE.js → HelpView-YYYX4RKI.js} +1 -1
  9. package/dist/{InfoBox-LYTNNMVJ.js → InfoBox-MQV3XBT4.js} +1 -1
  10. package/dist/{LinksBox-5MSEKNSV.js → LinksBox-NCFNBUMW.js} +1 -1
  11. package/dist/{ProfilesView-LTHE5UIO.js → ProfilesView-6GXF6CP2.js} +1 -1
  12. package/dist/{ProjectPicker-XMXIGHSE.js → ProjectPicker-W6XDGNDJ.js} +1 -1
  13. package/dist/{SaveSessionPrompt-VQDEA4WA.js → SaveSessionPrompt-QF3P7ERS.js} +1 -1
  14. package/dist/SingleShotApp-T673X7BS.js +2 -0
  15. package/dist/{SummaryBox-WWF3G263.js → SummaryBox-4SZI4XSO.js} +1 -1
  16. package/dist/TestMdRunView-SNYEO6CS.js +2 -0
  17. package/dist/{WhoamiView-PDURYP7E.js → WhoamiView-N3HAJ3TN.js} +1 -1
  18. package/dist/{auth-I4RB4KO3.js → auth-RXNBQZI2.js} +1 -1
  19. package/dist/{bind-QJT726NE.js → bind-NSGW5BBZ.js} +2 -2
  20. package/dist/{bootstrap-566PPFCC.js → bootstrap-RPT3JOGD.js} +1 -1
  21. package/dist/{bridge-QCMEOQDD.js → bridge-BTSWCJ3B.js} +1 -1
  22. package/dist/{changelog-OKYH4F7I.js → changelog-MI3IPBJS.js} +1 -1
  23. package/dist/{chunk-54VQ46U2.js → chunk-3CJIMPQK.js} +2 -2
  24. package/dist/{chunk-RFJAYURU.js → chunk-44IWSV6L.js} +1 -1
  25. package/dist/{chunk-SURF5Z7Y.js → chunk-4BAMZSFU.js} +1 -1
  26. package/dist/{chunk-KXUSG5ZI.js → chunk-4GLYNAK7.js} +1 -1
  27. package/dist/{chunk-ZNHXIRCM.js → chunk-4SJC64KQ.js} +2 -2
  28. package/dist/{chunk-54IB6CXK.js → chunk-4XSW6WZD.js} +1 -1
  29. package/dist/{chunk-QJIJC3KC.js → chunk-5WE4DHXL.js} +1 -1
  30. package/dist/chunk-5YHVK2EO.js +6 -0
  31. package/dist/{chunk-H2W2UNTN.js → chunk-67SSEGDO.js} +1 -1
  32. package/dist/{chunk-MFOH7EYR.js → chunk-77WMTCUQ.js} +1 -1
  33. package/dist/{chunk-KHJXOFDM.js → chunk-A2IQRVPR.js} +1 -1
  34. package/dist/{chunk-XXMNUJX4.js → chunk-AIMINJVP.js} +1 -1
  35. package/dist/{chunk-XWSAKVEY.js → chunk-AV6E6WLY.js} +2 -2
  36. package/dist/{chunk-POYZ6SAI.js → chunk-AYY7RYMK.js} +1 -1
  37. package/dist/chunk-B4LLKQTK.js +2 -0
  38. package/dist/{chunk-2WKX3RMA.js → chunk-BCH3JCND.js} +1 -1
  39. package/dist/{chunk-GLA6QL3T.js → chunk-CH3VWCRZ.js} +1 -1
  40. package/dist/{chunk-DSOA6L73.js → chunk-CSGQIY7X.js} +3 -3
  41. package/dist/{chunk-MJBCBQC2.js → chunk-DFDDUMG5.js} +1 -1
  42. package/dist/{chunk-MTNUZEO7.js → chunk-DGIPQINV.js} +1 -1
  43. package/dist/chunk-E5PWL3BG.js +7 -0
  44. package/dist/{chunk-XZRIQ3GF.js → chunk-EN7NW7DU.js} +1 -1
  45. package/dist/{chunk-NUQ423YE.js → chunk-GQ3NCBYR.js} +1 -1
  46. package/dist/{chunk-NJAHRITS.js → chunk-HOOXUO3X.js} +1 -1
  47. package/dist/{chunk-7MRBMDZ5.js → chunk-J3EMJ7US.js} +1 -1
  48. package/dist/{chunk-MR7CX5VT.js → chunk-JSF5JYZC.js} +1 -1
  49. package/dist/{chunk-XSKLH2MC.js → chunk-K4VIM4RM.js} +2 -2
  50. package/dist/{chunk-ICGHBZFZ.js → chunk-KCBS57IF.js} +1 -1
  51. package/dist/{chunk-NTNAHN25.js → chunk-LGVHW4ZA.js} +1 -1
  52. package/dist/{chunk-55Y65VPA.js → chunk-MAO5BAQI.js} +1 -1
  53. package/dist/{chunk-EAUUULJQ.js → chunk-MTHCUBDF.js} +1 -1
  54. package/dist/{chunk-ZPCU6546.js → chunk-MV4UYTZT.js} +1 -1
  55. package/dist/{chunk-M5PJQ5Y3.js → chunk-N4LMQR7C.js} +1 -1
  56. package/dist/{chunk-4CJ55EUY.js → chunk-NR23HZU4.js} +1 -1
  57. package/dist/chunk-QBCS57EO.js +62 -0
  58. package/dist/{chunk-MRP54NCJ.js → chunk-QQUZF2DZ.js} +1 -1
  59. package/dist/{chunk-HLRLP6TQ.js → chunk-RCTM7NGT.js} +1 -1
  60. package/dist/{chunk-7NLQ3QQD.js → chunk-RODHDQU3.js} +1 -1
  61. package/dist/{chunk-GIMTSDNC.js → chunk-RQYS3KGU.js} +1 -1
  62. package/dist/{chunk-ZP4S5WGW.js → chunk-SBZWFULF.js} +2 -2
  63. package/dist/{chunk-3AZTXJY4.js → chunk-T7ZPMTGS.js} +1 -1
  64. package/dist/{chunk-JXKRO2ZJ.js → chunk-UXPQRALY.js} +2 -2
  65. package/dist/{chunk-RGJIRS3B.js → chunk-VJFFMOUA.js} +1 -1
  66. package/dist/{chunk-HOQEMPMQ.js → chunk-VYMCE7UR.js} +2 -2
  67. package/dist/{chunk-LHDNJJGE.js → chunk-WREVEATJ.js} +1 -1
  68. package/dist/{chunk-73OQDAXF.js → chunk-WTXHOWUP.js} +1 -1
  69. package/dist/{chunk-FSB3FTIQ.js → chunk-X5P2T7MA.js} +1 -1
  70. package/dist/{chunk-HMM5FJJO.js → chunk-XIXR63FI.js} +1 -1
  71. package/dist/{chunk-KSZ72BSC.js → chunk-XLKRV2JH.js} +1 -1
  72. package/dist/{chunk-NTGYFYBP.js → chunk-YHQFYZJ5.js} +1 -1
  73. package/dist/{config-QISRENF5.js → config-5GOFF5F4.js} +1 -1
  74. package/dist/{credentials-OGLK7MPV.js → credentials-GXDXVMXW.js} +1 -1
  75. package/dist/{evidence-HDD7T7DX.js → evidence-VDNZ3K23.js} +1 -1
  76. package/dist/{evolve-cmd-UE2BIMXK.js → evolve-cmd-BLSVVW4I.js} +1 -1
  77. package/dist/{extract-bind-6MQYKN3G.js → extract-bind-3SWPBZX6.js} +2 -2
  78. package/dist/{extract-cmd-2RUIWFZG.js → extract-cmd-HEX7F4IS.js} +1 -1
  79. package/dist/{generate-headless-TUA3HGRX.js → generate-headless-LZ4HRSQ4.js} +2 -2
  80. package/dist/index.js +52 -52
  81. package/dist/{ingest-cmd-CRMY46YC.js → ingest-cmd-KRPZVB7W.js} +2 -2
  82. package/dist/{interactive-bind-53FCRK34.js → interactive-bind-PTAZVCE7.js} +2 -2
  83. package/dist/{list-commands-F53ZNYOZ.js → list-commands-WIVODSEL.js} +1 -1
  84. package/dist/login-flow-GX7CTVWN.js +2 -0
  85. package/dist/{persist-recorded-session-5ZFS5SMZ.js → persist-recorded-session-J6Z2SCTT.js} +1 -1
  86. package/dist/{pipeline-MX3ZR5B3.js → pipeline-HT7FCEXA.js} +1 -1
  87. package/dist/{reconcile-cmd-4377PWF5.js → reconcile-cmd-2VHBKFA5.js} +1 -1
  88. package/dist/{recording-banner-ZZUF2MGT.js → recording-banner-IRFMIZSJ.js} +1 -1
  89. package/dist/{require-project-folder-NQBZFUPF.js → require-project-folder-XSBJGIVF.js} +1 -1
  90. package/dist/{run-2AIQUJ55.js → run-4LTYFTF2.js} +1 -1
  91. package/dist/{run-YH5SCBYD.js → run-YGJZ2SXX.js} +1 -1
  92. package/dist/{run-test-md-XOSCYVSS.js → run-test-md-QCERS7FQ.js} +2 -2
  93. package/dist/{skill-installer-VYIIWAK7.js → skill-installer-WAVEVCSG.js} +1 -1
  94. package/dist/{spawner-7KXVKAD5.js → spawner-YNYB4Z7K.js} +1 -1
  95. package/dist/tcg-generate-D35EMRMQ.js +2 -0
  96. package/dist/{testmd-actions-RPALXRZK.js → testmd-actions-NB5Z6QJ3.js} +1 -1
  97. package/dist/token-refresh-OY3WLAKD.js +2 -0
  98. package/dist/{validate-basic-LP3S5PK7.js → validate-basic-IJKKRQRU.js} +1 -1
  99. package/dist/{version-check-XP62HWLJ.js → version-check-O5GYZYTP.js} +1 -1
  100. package/dist/{walk-session-YIKHE6PT.js → walk-session-OPAEV4WR.js} +1 -1
  101. package/package.json +6 -6
  102. package/dist/SingleShotApp-A6PCNPLM.js +0 -2
  103. package/dist/TestMdRunView-MQ7ZPFN2.js +0 -2
  104. package/dist/chunk-MMPFU2YC.js +0 -2
  105. package/dist/chunk-OGWC3J3C.js +0 -4
  106. package/dist/chunk-RZJVQUBA.js +0 -61
  107. package/dist/chunk-YSSTGJ7O.js +0 -7
  108. package/dist/login-flow-D7KBR7XR.js +0 -2
  109. package/dist/tcg-generate-U6OCCS2E.js +0 -2
  110. package/dist/token-refresh-S7CYBZTE.js +0 -2
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as P}from"./chunk-YCCUBQY4.js";import{y as a}from"./chunk-MMPFU2YC.js";import{a as S}from"./chunk-HCBYKLMW.js";import{a as M,b as n,i as $,k as B}from"./chunk-C44QQJR4.js";import{a as N}from"./chunk-6YGTRKDT.js";import{e as b}from"./chunk-UR6MHSHU.js";var o=b(S(),1);function Q(m){let e=m.findIndex(c=>c.free);return e>=0?e:null}var _=60,I=100;function X({headline:m,ask:e=!1,rows:c,sel:r,focused:T,legend:u,freeText:l=null,freeTextNote:x,sublines:i=[]}){let{stdout:t}=B(),f=t?.columns??80,A=f<_,s=Math.min(f-1,I),g=d=>T&&r===d?(0,o.jsx)(n,{color:a.assuranceAccent,children:"\u276F"}):" ",p=e?`? ${m}`:m,w=Math.max(4,s-3),h=i.map((d,v)=>(0,o.jsx)(n,{color:a.dim,children:` ${d.length>w?`${d.slice(0,w-1)}\u2026`:d}`},`sub-${v}`)),C=0,E=c.map((d,v)=>d.free?l?(0,o.jsxs)(M,{flexDirection:"column",children:[(0,o.jsxs)(M,{children:[(0,o.jsxs)(n,{children:[(0,o.jsx)(n,{color:a.assuranceAccent,children:"\u276F"})," ",(0,o.jsx)(n,{color:a.dim,children:"\u270E "})]}),(0,o.jsx)(P,{value:l.value,onChange:l.onChange,onSubmit:l.onSubmit,onCancel:l.onCancel,placeholder:d.label})]}),x?(0,o.jsx)(n,{color:a.muted,children:` ${x}`}):null]},d.key):(0,o.jsxs)(n,{children:[g(v)," ",(0,o.jsx)(n,{color:a.dim,children:`\u270E ${d.label}`})]},d.key):(C+=1,(0,o.jsxs)(n,{bold:T&&r===v,children:[g(v),` ${C}. ${d.label}`,d.detail?(0,o.jsx)(n,{color:a.dim,bold:!1,children:` \u2014 ${d.detail}`}):null]},d.key)));if(A)return(0,o.jsxs)(M,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,o.jsx)(n,{bold:!0,color:a.assuranceAccent,children:p}),h,E,(0,o.jsx)(n,{color:a.muted,children:u})]});let L=Math.max(2,s-(3+p.length+1)),F=Math.max(2,s-(3+u.length+1));return(0,o.jsxs)(M,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,o.jsxs)(n,{color:a.assuranceAccent,children:["\u2500\u2500 ",(0,o.jsx)(n,{bold:!0,children:p}),` ${"\u2500".repeat(L)}`]}),h,(0,o.jsx)(n,{children:" "}),E,(0,o.jsx)(n,{children:" "}),(0,o.jsxs)(n,{color:a.assuranceAccent,children:["\u2500\u2500 ",(0,o.jsx)(n,{color:a.muted,children:u}),` ${"\u2500".repeat(F)}`]})]})}var R=b(S(),1),K="ctrl+t thinking \xB7 ctrl+c exit";function D(m,e){if(m.length<=e)return m;if(e<=1)return"\u2026";let c=Math.ceil((e-1)/2),r=Math.floor((e-1)/2);return`${m.slice(0,c)}\u2026${r>0?m.slice(-r):""}`}function J({verb:m,subject:e,pendingCount:c,creditsTotal:r,state:T,hints:u=K}){let{stdout:l}=B(),x=l?.columns??80,i=[];i.push(m),T&&i.push(T),r!==void 0&&i.push(`${r.toFixed(1)} credits`);let t=c?`[${c} pending]`:null,f=" \xB7 ",s=[...i,...t?[t]:[]].join(f).length,g,p=[...i,...e?[e]:[],...t?[t]:[],u].join(f);if(p.length<=x)g=p;else{let w=x-s-(e?f.length:0)-f.length-u.length;if(e&&w>=8)g=[...i,D(e,w),...t?[t]:[],u].join(f);else{let h=x-s-(e?f.length:0);g=[...i,...e&&h>=4?[D(e,h)]:[],...t?[t]:[]].join(f)}}if(T){let w=` \xB7 ${T}`,h=g.indexOf(w);if(h>=0)return(0,R.jsxs)(n,{color:a.dim,children:[g.slice(0,h+3),(0,R.jsx)(n,{color:a.assuranceAccent,children:T}),g.slice(h+w.length)]})}return(0,R.jsx)(n,{color:a.dim,children:g})}var O=b(N(),1);function Z({onToggleThinking:m,onCtrlC:e,explorer:c,panel:r}){let u=(0,O.useRef)(null),l=(0,O.useRef)(""),x=()=>{u.current&&clearTimeout(u.current),u.current=null,l.current=""};return(0,O.useEffect)(()=>x,[]),$((i,t)=>{if(t.ctrl&&i==="t"){m();return}if(t.ctrl&&i==="c"){e();return}if(!t.ctrl&&i.includes("")){e();return}if(!t.ctrl&&i.includes("")){m();return}if(c&&c.isOpen()){let f=()=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{x(),c.onBack()},150)};if(u.current){if(t.upArrow||t.downArrow||t.return){x(),t.return?c.onEnter():c.onMove(t.upArrow?-1:1);return}if(l.current+=i,l.current==="["){f();return}let A=l.current;x();let s=/^\[([ABCD])/.exec(A);if(s){(s[1]==="A"||s[1]==="B")&&c.onMove(s[1]==="A"?-1:1);return}c.onBack();return}if(t.upArrow){c.onMove(-1);return}if(t.downArrow){c.onMove(1);return}if(t.return){c.onEnter();return}if(t.escape){l.current="",f();return}return}if(r&&r.isFocused()){let f=()=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{x(),r.onBack()},150)};if(u.current){if(t.upArrow||t.downArrow||t.return||t.leftArrow||t.rightArrow){x(),t.return?r.onSelect():t.leftArrow?r.onLeft?.():t.rightArrow?r.onRight?.():r.onMove(t.upArrow?-1:1);return}if(l.current+=i,l.current==="["){f();return}let A=l.current;x();let s=/^\[([ABCD])/.exec(A);if(s){s[1]==="A"||s[1]==="B"?r.onMove(s[1]==="A"?-1:1):s[1]==="C"?r.onRight?.():r.onLeft?.();return}r.onBack();return}if(t.upArrow){r.onMove(-1);return}if(t.downArrow){r.onMove(1);return}if(t.leftArrow){r.onLeft?.();return}if(t.rightArrow){r.onRight?.();return}if(t.return){r.onSelect();return}if(t.escape){l.current="",f();return}if(/^[1-9]$/.test(i)){r.onDigit(Number(i));return}if(t.tab){r.onTab?.();return}if(i===" "&&r.isMulti()){r.onSpace();return}if(i&&!t.ctrl&&!t.meta){r.onType(i);return}return}}),null}export{Q as a,X as b,J as c,Z as d};
2
+ import{a as P}from"./chunk-YCCUBQY4.js";import{y as a}from"./chunk-B4LLKQTK.js";import{a as S}from"./chunk-HCBYKLMW.js";import{a as M,b as n,i as $,k as B}from"./chunk-C44QQJR4.js";import{a as N}from"./chunk-6YGTRKDT.js";import{e as b}from"./chunk-UR6MHSHU.js";var o=b(S(),1);function Q(m){let e=m.findIndex(c=>c.free);return e>=0?e:null}var _=60,I=100;function X({headline:m,ask:e=!1,rows:c,sel:r,focused:T,legend:u,freeText:l=null,freeTextNote:x,sublines:i=[]}){let{stdout:t}=B(),f=t?.columns??80,A=f<_,s=Math.min(f-1,I),g=d=>T&&r===d?(0,o.jsx)(n,{color:a.assuranceAccent,children:"\u276F"}):" ",p=e?`? ${m}`:m,w=Math.max(4,s-3),h=i.map((d,v)=>(0,o.jsx)(n,{color:a.dim,children:` ${d.length>w?`${d.slice(0,w-1)}\u2026`:d}`},`sub-${v}`)),C=0,E=c.map((d,v)=>d.free?l?(0,o.jsxs)(M,{flexDirection:"column",children:[(0,o.jsxs)(M,{children:[(0,o.jsxs)(n,{children:[(0,o.jsx)(n,{color:a.assuranceAccent,children:"\u276F"})," ",(0,o.jsx)(n,{color:a.dim,children:"\u270E "})]}),(0,o.jsx)(P,{value:l.value,onChange:l.onChange,onSubmit:l.onSubmit,onCancel:l.onCancel,placeholder:d.label})]}),x?(0,o.jsx)(n,{color:a.muted,children:` ${x}`}):null]},d.key):(0,o.jsxs)(n,{children:[g(v)," ",(0,o.jsx)(n,{color:a.dim,children:`\u270E ${d.label}`})]},d.key):(C+=1,(0,o.jsxs)(n,{bold:T&&r===v,children:[g(v),` ${C}. ${d.label}`,d.detail?(0,o.jsx)(n,{color:a.dim,bold:!1,children:` \u2014 ${d.detail}`}):null]},d.key)));if(A)return(0,o.jsxs)(M,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,o.jsx)(n,{bold:!0,color:a.assuranceAccent,children:p}),h,E,(0,o.jsx)(n,{color:a.muted,children:u})]});let L=Math.max(2,s-(3+p.length+1)),F=Math.max(2,s-(3+u.length+1));return(0,o.jsxs)(M,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,o.jsxs)(n,{color:a.assuranceAccent,children:["\u2500\u2500 ",(0,o.jsx)(n,{bold:!0,children:p}),` ${"\u2500".repeat(L)}`]}),h,(0,o.jsx)(n,{children:" "}),E,(0,o.jsx)(n,{children:" "}),(0,o.jsxs)(n,{color:a.assuranceAccent,children:["\u2500\u2500 ",(0,o.jsx)(n,{color:a.muted,children:u}),` ${"\u2500".repeat(F)}`]})]})}var R=b(S(),1),K="ctrl+t thinking \xB7 ctrl+c exit";function D(m,e){if(m.length<=e)return m;if(e<=1)return"\u2026";let c=Math.ceil((e-1)/2),r=Math.floor((e-1)/2);return`${m.slice(0,c)}\u2026${r>0?m.slice(-r):""}`}function J({verb:m,subject:e,pendingCount:c,creditsTotal:r,state:T,hints:u=K}){let{stdout:l}=B(),x=l?.columns??80,i=[];i.push(m),T&&i.push(T),r!==void 0&&i.push(`${r.toFixed(1)} credits`);let t=c?`[${c} pending]`:null,f=" \xB7 ",s=[...i,...t?[t]:[]].join(f).length,g,p=[...i,...e?[e]:[],...t?[t]:[],u].join(f);if(p.length<=x)g=p;else{let w=x-s-(e?f.length:0)-f.length-u.length;if(e&&w>=8)g=[...i,D(e,w),...t?[t]:[],u].join(f);else{let h=x-s-(e?f.length:0);g=[...i,...e&&h>=4?[D(e,h)]:[],...t?[t]:[]].join(f)}}if(T){let w=` \xB7 ${T}`,h=g.indexOf(w);if(h>=0)return(0,R.jsxs)(n,{color:a.dim,children:[g.slice(0,h+3),(0,R.jsx)(n,{color:a.assuranceAccent,children:T}),g.slice(h+w.length)]})}return(0,R.jsx)(n,{color:a.dim,children:g})}var O=b(N(),1);function Z({onToggleThinking:m,onCtrlC:e,explorer:c,panel:r}){let u=(0,O.useRef)(null),l=(0,O.useRef)(""),x=()=>{u.current&&clearTimeout(u.current),u.current=null,l.current=""};return(0,O.useEffect)(()=>x,[]),$((i,t)=>{if(t.ctrl&&i==="t"){m();return}if(t.ctrl&&i==="c"){e();return}if(!t.ctrl&&i.includes("")){e();return}if(!t.ctrl&&i.includes("")){m();return}if(c&&c.isOpen()){let f=()=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{x(),c.onBack()},150)};if(u.current){if(t.upArrow||t.downArrow||t.return){x(),t.return?c.onEnter():c.onMove(t.upArrow?-1:1);return}if(l.current+=i,l.current==="["){f();return}let A=l.current;x();let s=/^\[([ABCD])/.exec(A);if(s){(s[1]==="A"||s[1]==="B")&&c.onMove(s[1]==="A"?-1:1);return}c.onBack();return}if(t.upArrow){c.onMove(-1);return}if(t.downArrow){c.onMove(1);return}if(t.return){c.onEnter();return}if(t.escape){l.current="",f();return}return}if(r&&r.isFocused()){let f=()=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{x(),r.onBack()},150)};if(u.current){if(t.upArrow||t.downArrow||t.return||t.leftArrow||t.rightArrow){x(),t.return?r.onSelect():t.leftArrow?r.onLeft?.():t.rightArrow?r.onRight?.():r.onMove(t.upArrow?-1:1);return}if(l.current+=i,l.current==="["){f();return}let A=l.current;x();let s=/^\[([ABCD])/.exec(A);if(s){s[1]==="A"||s[1]==="B"?r.onMove(s[1]==="A"?-1:1):s[1]==="C"?r.onRight?.():r.onLeft?.();return}r.onBack();return}if(t.upArrow){r.onMove(-1);return}if(t.downArrow){r.onMove(1);return}if(t.leftArrow){r.onLeft?.();return}if(t.rightArrow){r.onRight?.();return}if(t.return){r.onSelect();return}if(t.escape){l.current="",f();return}if(/^[1-9]$/.test(i)){r.onDigit(Number(i));return}if(t.tab){r.onTab?.();return}if(i===" "&&r.isMulti()){r.onSpace();return}if(i&&!t.ctrl&&!t.meta){r.onType(i);return}return}}),null}export{Q as a,X as b,J as c,Z as d};
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as H,d as z}from"./chunk-2YQ6TW77.js";import{b as p,c as E,d as j,e as y,f as M,g as C,i as A,l as D,m as F,p as T,r as $,s as O}from"./chunk-RKWJG3WW.js";import{a as B}from"./chunk-3AZTXJY4.js";import{p as R,q as k}from"./chunk-Y5RNCJAN.js";import{a as P}from"./chunk-MMPFU2YC.js";import{e as q}from"./chunk-UR6MHSHU.js";import{existsSync as f,mkdirSync as V,readFileSync as Z,renameSync as N,writeFileSync as K}from"fs";import{join as Q}from"path";function fe(e){D(p(e));let t=p(e);if(!f(t))return;let n=Q(t,"meta.json"),r=y(e);if(f(n)&&!f(r))try{V(j(e),{recursive:!0}),N(n,r)}catch(o){process.stderr.write(`warn: meta.json migration failed: ${o.message}
2
+ import{c as H,d as z}from"./chunk-2YQ6TW77.js";import{b as p,c as E,d as j,e as y,f as M,g as C,i as A,l as D,m as F,p as T,r as $,s as O}from"./chunk-RKWJG3WW.js";import{a as B}from"./chunk-T7ZPMTGS.js";import{p as R,q as k}from"./chunk-Y5RNCJAN.js";import{a as P}from"./chunk-B4LLKQTK.js";import{e as q}from"./chunk-UR6MHSHU.js";import{existsSync as f,mkdirSync as V,readFileSync as Z,renameSync as N,writeFileSync as K}from"fs";import{join as Q}from"path";function fe(e){D(p(e));let t=p(e);if(!f(t))return;let n=Q(t,"meta.json"),r=y(e);if(f(n)&&!f(r))try{V(j(e),{recursive:!0}),N(n,r)}catch(o){process.stderr.write(`warn: meta.json migration failed: ${o.message}
3
3
  `)}let i=C(e);if(f(i)){let o="python";try{let c=new B().load();c.code_export?.language&&(o=c.code_export.language)}catch{}let a=M(e,"playwright",o);if(!f(a))try{N(i,a)}catch(c){process.stderr.write(`warn: generated-code migration failed: ${c.message}
4
4
  `)}}if(f(r))try{let o=JSON.parse(Z(r,"utf8"));"md5sum"in o&&(delete o.md5sum,K(r,JSON.stringify(o,null,2)+`
5
5
  `,"utf8"))}catch(o){process.stderr.write(`warn: meta.json md5sum strip failed: ${o.message}
6
- `)}}async function ye(e){if(!e.isInteractive)return{recovered:!1};if(W(e.creds))return{recovered:!1};let{SingleShotApp:t}=await import("./SingleShotApp-A6PCNPLM.js"),{ScrollbackProvider:n}=await import("./scrollback-JLPJR25X.js"),{render:r}=await import("./build-JIKYOZUH.js"),i=await import("./react-QWOAB3TB.js"),o={current:null},a={current:!1},{waitUntilExit:c,unmount:l}=r(i.default.createElement(n,null,i.default.createElement(t,{resultRef:o,mode:"login",loginCompleteRef:a})),{exitOnCtrlC:!1});k(()=>l()),await c();try{process.stdin.setRawMode?.(!1)}catch{}return process.stdout.write("\x1B[?25h"),a.current?{recovered:!0}:(R(0,"Startup gate cancelled"),{recovered:!1})}function W(e){let t=e.getActiveProfile(),n=e.getDefaultEnv();if(!t||!!!(e.loadBasicAuth(t,n)||e.loadCredentials(t,n)))return!1;let i=e.loadProfileConfig(t,n)??{};return!!i.project_id&&!!i.folder_id}var J=q(H(),1);import{existsSync as v,readFileSync as U,readdirSync as X,statSync as Y}from"fs";import{dirname as ee,isAbsolute as te,join as g,relative as x,resolve as re,sep as h}from"path";import{createHash as ne}from"crypto";var S="testmd-bundle.json",d=class extends Error{constructor(t){super(t),this.name="BundleUsageError"}},_=e=>e.split(h).join("/");function I(e){if(!v(e))return[];let t=[];for(let n of X(e).sort()){let r=g(e,n);Y(r).isDirectory()?t.push(...I(r)):t.push(r)}return t}function se(e){let t=e.map(r=>ee(r).split(h)),n=t[0];for(let r of t.slice(1)){let i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;n=n.slice(0,i)}return n.join(h)||h}function ie(e){for(let t of e){let n=F(t,U(t,"utf8"));for(let r of n.steps)if(r.body.kind==="import_ref"&&te(r.body.path))throw new d(`bundle sync: absolute @import is not portable after unzip: ${t} step ${r.index} (@import ${r.body.path})`)}}function G(e){let t=re(e),n=T(t);if(!n?.commit_id||!n?.test_id)throw new d(`bundle sync: ${t} is not authored \u2014 run \`kane-cli testmd run\` first (output-<stem>/.internal/meta.json needs commit_id + test_id)`);let r;try{r=O(t)}catch(s){throw s instanceof $?new d(`bundle sync: ${s.message}`):s}let i=[t];for(let s of r.steps)for(let u of s.trace.slice(1))i.includes(u.file)||i.push(u.file);ie(i);let o=[];for(let s of r.unitFiles){if(s.file===t)continue;let u=p(s.file);o.includes(u)||o.push(u)}let a=[...i],c=s=>{v(s)&&a.push(s)};c(E(t)),a.push(y(t)),c(g(p(t),".internal","execution.json")),a.push(...I(A(t)));for(let s of o)c(g(s,"Result.md")),a.push(...I(g(s,".internal","steps")));let l=se(a);if(v(g(l,S)))throw new d(`bundle sync: a real file named ${S} exists at the zip root (${l}) \u2014 it would collide with the generated manifest`);let b=a.map(s=>{let u=U(s);return{abs:s,rel:_(x(l,s)),sha256:ne("sha256").update(u).digest("hex"),bytes:u.length}}).sort((s,u)=>s.rel<u.rel?-1:1),m=_(x(l,t)),L={schema_version:2,entry:m,commit_id:n.commit_id,test_id:n.test_id,testcase_id:n.testcase_id??null,project_id:n.project_id??null,folder_id:n.folder_id??null,org_id:n.org_id??null,created_at:new Date().toISOString(),producer:{name:"kane-cli",version:P},files:b.map(s=>({path:s.rel,sha256:s.sha256,bytes:s.bytes})),units:r.unitFiles.filter(s=>s.file!==t).map(s=>({path:_(x(l,s.file)),kind:s.kind}))};return{zipRoot:l,entry:m,files:b,manifest:L}}var w=e=>e instanceof Error?e.message:String(e);function oe(e){return new Promise((t,n)=>{let r=(0,J.default)("zip",{zlib:{level:6}}),i=[];r.on("data",o=>i.push(o)),r.on("error",n),r.on("end",()=>t(Buffer.concat(i))),r.append(JSON.stringify(e.manifest,null,2)+`
6
+ `)}}async function ye(e){if(!e.isInteractive)return{recovered:!1};if(W(e.creds))return{recovered:!1};let{SingleShotApp:t}=await import("./SingleShotApp-T673X7BS.js"),{ScrollbackProvider:n}=await import("./scrollback-JLPJR25X.js"),{render:r}=await import("./build-JIKYOZUH.js"),i=await import("./react-QWOAB3TB.js"),o={current:null},a={current:!1},{waitUntilExit:c,unmount:l}=r(i.default.createElement(n,null,i.default.createElement(t,{resultRef:o,mode:"login",loginCompleteRef:a})),{exitOnCtrlC:!1});k(()=>l()),await c();try{process.stdin.setRawMode?.(!1)}catch{}return process.stdout.write("\x1B[?25h"),a.current?{recovered:!0}:(R(0,"Startup gate cancelled"),{recovered:!1})}function W(e){let t=e.getActiveProfile(),n=e.getDefaultEnv();if(!t||!!!(e.loadBasicAuth(t,n)||e.loadCredentials(t,n)))return!1;let i=e.loadProfileConfig(t,n)??{};return!!i.project_id&&!!i.folder_id}var J=q(H(),1);import{existsSync as v,readFileSync as U,readdirSync as X,statSync as Y}from"fs";import{dirname as ee,isAbsolute as te,join as g,relative as x,resolve as re,sep as h}from"path";import{createHash as ne}from"crypto";var S="testmd-bundle.json",d=class extends Error{constructor(t){super(t),this.name="BundleUsageError"}},_=e=>e.split(h).join("/");function I(e){if(!v(e))return[];let t=[];for(let n of X(e).sort()){let r=g(e,n);Y(r).isDirectory()?t.push(...I(r)):t.push(r)}return t}function se(e){let t=e.map(r=>ee(r).split(h)),n=t[0];for(let r of t.slice(1)){let i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;n=n.slice(0,i)}return n.join(h)||h}function ie(e){for(let t of e){let n=F(t,U(t,"utf8"));for(let r of n.steps)if(r.body.kind==="import_ref"&&te(r.body.path))throw new d(`bundle sync: absolute @import is not portable after unzip: ${t} step ${r.index} (@import ${r.body.path})`)}}function G(e){let t=re(e),n=T(t);if(!n?.commit_id||!n?.test_id)throw new d(`bundle sync: ${t} is not authored \u2014 run \`kane-cli testmd run\` first (output-<stem>/.internal/meta.json needs commit_id + test_id)`);let r;try{r=O(t)}catch(s){throw s instanceof $?new d(`bundle sync: ${s.message}`):s}let i=[t];for(let s of r.steps)for(let u of s.trace.slice(1))i.includes(u.file)||i.push(u.file);ie(i);let o=[];for(let s of r.unitFiles){if(s.file===t)continue;let u=p(s.file);o.includes(u)||o.push(u)}let a=[...i],c=s=>{v(s)&&a.push(s)};c(E(t)),a.push(y(t)),c(g(p(t),".internal","execution.json")),a.push(...I(A(t)));for(let s of o)c(g(s,"Result.md")),a.push(...I(g(s,".internal","steps")));let l=se(a);if(v(g(l,S)))throw new d(`bundle sync: a real file named ${S} exists at the zip root (${l}) \u2014 it would collide with the generated manifest`);let b=a.map(s=>{let u=U(s);return{abs:s,rel:_(x(l,s)),sha256:ne("sha256").update(u).digest("hex"),bytes:u.length}}).sort((s,u)=>s.rel<u.rel?-1:1),m=_(x(l,t)),L={schema_version:2,entry:m,commit_id:n.commit_id,test_id:n.test_id,testcase_id:n.testcase_id??null,project_id:n.project_id??null,folder_id:n.folder_id??null,org_id:n.org_id??null,created_at:new Date().toISOString(),producer:{name:"kane-cli",version:P},files:b.map(s=>({path:s.rel,sha256:s.sha256,bytes:s.bytes})),units:r.unitFiles.filter(s=>s.file!==t).map(s=>({path:_(x(l,s.file)),kind:s.kind}))};return{zipRoot:l,entry:m,files:b,manifest:L}}var w=e=>e instanceof Error?e.message:String(e);function oe(e){return new Promise((t,n)=>{let r=(0,J.default)("zip",{zlib:{level:6}}),i=[];r.on("data",o=>i.push(o)),r.on("error",n),r.on("end",()=>t(Buffer.concat(i))),r.append(JSON.stringify(e.manifest,null,2)+`
7
7
  `,{name:S});for(let o of e.files)r.file(o.abs,{name:o.rel});r.finalize()})}async function ae(e){let{plan:t,controller:n,testId:r,sessionId:i,commitId:o}=e,a;try{a=await oe(t)}catch(l){return{ok:!1,stage:"zip",error:w(l)}}let c;try{let l={key:"testmd",content_type:"application/zip",filename:`${o}-testmd.zip`},m=(await n.getPresignedUrls(r,i,[l])).urls?.testmd?.upload_url;if(!m)return{ok:!1,stage:"presign",error:"presign response missing testmd upload_url"};c=m}catch(l){return{ok:!1,stage:"presign",error:w(l)}}try{await z(c,a,"application/zip")}catch(l){return{ok:!1,stage:"upload",error:w(l)}}return{ok:!0,bytes:a.length}}async function Ee(e){let t;try{t=G(e.sourcePath)}catch(n){return n instanceof d?{ok:!1,stage:"collect",error:n.message}:{ok:!1,stage:"collect",error:w(n)}}return ae({...e,plan:t})}function je(e){return e.shouldUploadPipeline&&e.uploadSucceeded&&!!e.metaCommitId&&!!e.metaTestId}export{fe as a,ye as b,Ee as c,je as d};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as g}from"./chunk-MMPFU2YC.js";import{readFileSync as o,writeFileSync as h,mkdirSync as u,readdirSync as a,unlinkSync as s,existsSync as l,chmodSync as f}from"fs";import{join as n,dirname as P}from"path";var d=class{baseDir;profilesDir;configFile;constructor(t=g){this.baseDir=t,this.profilesDir=n(t,"profiles"),this.configFile=n(t,"config.json")}readConfig(){try{return JSON.parse(o(this.configFile,"utf-8"))}catch{return{}}}writeConfig(t){u(this.baseDir,{recursive:!0,mode:448}),h(this.configFile,JSON.stringify(t,null,2)+`
2
+ import{c as g}from"./chunk-B4LLKQTK.js";import{readFileSync as o,writeFileSync as h,mkdirSync as u,readdirSync as a,unlinkSync as s,existsSync as l,chmodSync as f}from"fs";import{join as n,dirname as P}from"path";var d=class{baseDir;profilesDir;configFile;constructor(t=g){this.baseDir=t,this.profilesDir=n(t,"profiles"),this.configFile=n(t,"config.json")}readConfig(){try{return JSON.parse(o(this.configFile,"utf-8"))}catch{return{}}}writeConfig(t){u(this.baseDir,{recursive:!0,mode:448}),h(this.configFile,JSON.stringify(t,null,2)+`
3
3
  `),f(this.configFile,384)}getActiveProfile(){return this.readConfig().active_profile??null}setActiveProfile(t){let i=this.readConfig();i.active_profile=t,this.writeConfig(i)}getDefaultEnv(){return this.readConfig().default_env??"prod"}setDefaultEnv(t){let i=this.readConfig();i.default_env=t,this.writeConfig(i)}credentialsPath(t,i){return n(this.profilesDir,t,i,"credentials")}clientPath(t,i){return n(this.profilesDir,t,i,"client.json")}basicAuthPath(t,i){return n(this.profilesDir,t,i,"basic-auth")}profileConfigPath(t,i){return n(this.profilesDir,t,i,"profile-config.json")}saveProfileConfig(t,i,r){let e=this.loadProfileConfig(t,i)??{};this.writeSecure(this.profileConfigPath(t,i),{...e,...r})}loadProfileConfig(t,i){try{return JSON.parse(o(this.profileConfigPath(t,i),"utf-8"))}catch{return null}}writeSecure(t,i){try{u(P(t),{recursive:!0,mode:448}),h(t,JSON.stringify(i,null,2)+`
4
4
  `),f(t,384)}catch(r){let e=r instanceof Error?r.message:String(r);process.stderr.write(`[auth] Failed to save credentials: ${e}
5
5
  `)}}saveCredentials(t,i,r){this.writeSecure(this.credentialsPath(t,i),r)}loadCredentials(t,i){try{return JSON.parse(o(this.credentialsPath(t,i),"utf-8"))}catch{return null}}saveClient(t,i,r){this.writeSecure(this.clientPath(t,i),r)}loadClient(t,i){try{return JSON.parse(o(this.clientPath(t,i),"utf-8"))}catch{return null}}getActiveCredentials(){let t=this.getActiveProfile();if(!t)return{credentials:null,profile:null,env:null};let i=this.getDefaultEnv();return{credentials:this.loadCredentials(t,i),profile:t,env:i}}saveBasicAuth(t,i,r){this.writeSecure(this.basicAuthPath(t,i),r)}loadBasicAuth(t,i){try{return JSON.parse(o(this.basicAuthPath(t,i),"utf-8"))}catch{return null}}deleteBasicAuth(t,i){try{s(this.basicAuthPath(t,i))}catch{}}resolveAuth(){let t=this.getActiveProfile();if(!t)return null;let i=this.getDefaultEnv(),r=this.loadBasicAuth(t,i);return r?{method:"basic",...r,profile:t,env:i}:this.loadCredentials(t,i)?{method:"oauth",profile:t,env:i}:null}listProfiles(){let t=[];try{for(let i of a(this.profilesDir)){let r=n(this.profilesDir,i);try{for(let e of a(r)){let c=n(r,e),v=l(n(c,"credentials")),p=l(n(c,"client.json")),y=l(n(c,"basic-auth"));(v||p||y)&&t.push({profile:i,env:e})}}catch{}}}catch{}return t}deleteProfile(t,i){try{s(this.credentialsPath(t,i))}catch{}if(this.getActiveProfile()===t){let r=this.readConfig();delete r.active_profile,this.writeConfig(r)}}deleteProfileFull(t,i){if(i){try{s(this.credentialsPath(t,i))}catch{}try{s(this.clientPath(t,i))}catch{}try{s(this.basicAuthPath(t,i))}catch{}try{s(this.profileConfigPath(t,i))}catch{}}else try{let r=n(this.profilesDir,t);for(let e of a(r)){try{s(n(r,e,"credentials"))}catch{}try{s(n(r,e,"client.json"))}catch{}try{s(n(r,e,"basic-auth"))}catch{}try{s(n(r,e,"profile-config.json"))}catch{}}}catch{}}};export{d as a};
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{d as N}from"./chunk-FHKDTM5L.js";import{a as b,b as O,c as k}from"./chunk-2XMJ6YAE.js";import{a as L,b as M}from"./chunk-BKM2LWU2.js";import{a as y,b as R,c as T,d as m,e as I,f as w,g as r}from"./chunk-Y5RNCJAN.js";import{b as x,d as A}from"./chunk-5EOX4MEY.js";import{a as E}from"./chunk-RZ4F3BHX.js";import{a as g,j as v}from"./chunk-MMPFU2YC.js";import{platform as X,arch as $}from"os";import D from"fs";import V from"fs";import q from"path";var Y=new Set(["org_id","user_id","plan"]);function C(t){let e={machine_id:k(),env:t};try{let n=JSON.parse(V.readFileSync(A(t),"utf8"));for(let[i,s]of Object.entries(n))Y.has(i)&&typeof s=="string"&&s.length>0&&s.length<=128&&(e[i]=s)}catch{}return e}import P from"fs";import B from"path";var F=1e3,d=0,a=class t{ids;logger;opts;ended=!1;constructor(e){this.ids=e.envelope,this.logger=e.logger,this.opts=e}get enabled(){return this.logger!==null}event(e,n={}){if(!this.logger)return;let i=m(this.ids,e,n);this.logger.log(y[e],e,e,U(i))}error(e,n={}){this.logger&&(this.logger.escalate(d),this.event("ASR_ERROR",{...n,error_code:e}))}child(e,n){return new t({...this.opts,envelope:{...this.ids,operation_id:n,parent_operation_id:this.ids.operation_id,verb:"design"}})}async lateBindContext(e){if(!(!this.logger||this.ids.context_instance_id))try{let{ensureStoreIds:n}=await import("./store-id-EOSGEKVK.js"),{ids:i,cloned:s}=n(e);this.ids.context_lineage_id=i.context_lineage_id,this.ids.context_instance_id=i.context_instance_id,s&&this.event("ASR_CONTEXT_CLONED")}catch{}}agentSession(e){this.ids.agent_session_id=e}spawnEnv(){if(!this.opts.telemetryEnabled)return{};let e={TESTMUAI_USER_SESSION_ID:this.ids.session_id,TESTMUAI_OPERATION_ID:this.ids.operation_id,TESTMUAI_CLIENT_VERSION:this.opts.clientVersion,TESTMUAI_TELEMETRY_PROXY_URL:this.opts.proxyUrl};return this.ids.context_instance_id&&(e.TESTMUAI_CONTEXT_INSTANCE_ID=this.ids.context_instance_id),e}traceTee(){return e=>{if(!this.logger)return;let n=typeof e.kind=="string"?e.kind.slice(0,64):"trace",i={...U(m(this.ids,"ASR_CMD_START",{})),trace_kind:n};typeof e.code=="string"&&(i.trace_code=e.code.slice(0,64)),delete i.event,this.logger.logStep(d,`trace_${n}`,n,i)}}wireTrace(e,n,i){if(!this.logger)return;i&&this.agentSession(i);let s=n&&typeof n=="object"?n:{};switch(e){case"spawn":this.event("ASR_AGENT_SPAWN",{tier:s.tier});break;case"session_paused":this.event("ASR_SESSION_PAUSED",s);break;case"commit":this.event("ASR_COMMIT",s);break;default:this.traceTee()({kind:e,code:typeof s.code=="string"?s.code:void 0})}}banner(){return`session: ${this.ids.session_id}`}supportFooter(){return`if this keeps failing, share this id with support: ${this.ids.session_id}`}async end(e){if(!this.ended){if(this.ended=!0,this.logger)if(e.exit_code===0?this.logger.discardSteps(d):this.logger.escalate(d),this.event("ASR_CMD_END",e),this.opts.longSession)await this.logger.shutdown();else{let n=await this.logger.flushOnce(F);(n==="failed"||n==="timeout")&&I(this.logger.drainBuffer())}this.logger&&this.writeManifestLine(e.exit_code),r(null)}}writeManifestLine(e){try{let n=x(this.ids.context_instance_id??null);P.mkdirSync(B.dirname(n),{recursive:!0});let i={ts:new Date().toISOString(),session_id:this.ids.session_id,operation_id:this.ids.operation_id,agent_session_id:this.ids.agent_session_id,verb:this.ids.verb,mode:this.ids.mode,exit_code:e};P.appendFileSync(n,JSON.stringify(i)+`
2
+ import{d as N}from"./chunk-FHKDTM5L.js";import{a as b,b as O,c as k}from"./chunk-2XMJ6YAE.js";import{a as L,b as M}from"./chunk-BKM2LWU2.js";import{a as y,b as R,c as T,d as m,e as I,f as w,g as r}from"./chunk-Y5RNCJAN.js";import{b as x,d as A}from"./chunk-5EOX4MEY.js";import{a as E}from"./chunk-RZ4F3BHX.js";import{a as g,j as v}from"./chunk-B4LLKQTK.js";import{platform as X,arch as $}from"os";import D from"fs";import V from"fs";import q from"path";var Y=new Set(["org_id","user_id","plan"]);function C(t){let e={machine_id:k(),env:t};try{let n=JSON.parse(V.readFileSync(A(t),"utf8"));for(let[i,s]of Object.entries(n))Y.has(i)&&typeof s=="string"&&s.length>0&&s.length<=128&&(e[i]=s)}catch{}return e}import P from"fs";import B from"path";var F=1e3,d=0,a=class t{ids;logger;opts;ended=!1;constructor(e){this.ids=e.envelope,this.logger=e.logger,this.opts=e}get enabled(){return this.logger!==null}event(e,n={}){if(!this.logger)return;let i=m(this.ids,e,n);this.logger.log(y[e],e,e,U(i))}error(e,n={}){this.logger&&(this.logger.escalate(d),this.event("ASR_ERROR",{...n,error_code:e}))}child(e,n){return new t({...this.opts,envelope:{...this.ids,operation_id:n,parent_operation_id:this.ids.operation_id,verb:"design"}})}async lateBindContext(e){if(!(!this.logger||this.ids.context_instance_id))try{let{ensureStoreIds:n}=await import("./store-id-EOSGEKVK.js"),{ids:i,cloned:s}=n(e);this.ids.context_lineage_id=i.context_lineage_id,this.ids.context_instance_id=i.context_instance_id,s&&this.event("ASR_CONTEXT_CLONED")}catch{}}agentSession(e){this.ids.agent_session_id=e}spawnEnv(){if(!this.opts.telemetryEnabled)return{};let e={TESTMUAI_USER_SESSION_ID:this.ids.session_id,TESTMUAI_OPERATION_ID:this.ids.operation_id,TESTMUAI_CLIENT_VERSION:this.opts.clientVersion,TESTMUAI_TELEMETRY_PROXY_URL:this.opts.proxyUrl};return this.ids.context_instance_id&&(e.TESTMUAI_CONTEXT_INSTANCE_ID=this.ids.context_instance_id),e}traceTee(){return e=>{if(!this.logger)return;let n=typeof e.kind=="string"?e.kind.slice(0,64):"trace",i={...U(m(this.ids,"ASR_CMD_START",{})),trace_kind:n};typeof e.code=="string"&&(i.trace_code=e.code.slice(0,64)),delete i.event,this.logger.logStep(d,`trace_${n}`,n,i)}}wireTrace(e,n,i){if(!this.logger)return;i&&this.agentSession(i);let s=n&&typeof n=="object"?n:{};switch(e){case"spawn":this.event("ASR_AGENT_SPAWN",{tier:s.tier});break;case"session_paused":this.event("ASR_SESSION_PAUSED",s);break;case"commit":this.event("ASR_COMMIT",s);break;default:this.traceTee()({kind:e,code:typeof s.code=="string"?s.code:void 0})}}banner(){return`session: ${this.ids.session_id}`}supportFooter(){return`if this keeps failing, share this id with support: ${this.ids.session_id}`}async end(e){if(!this.ended){if(this.ended=!0,this.logger)if(e.exit_code===0?this.logger.discardSteps(d):this.logger.escalate(d),this.event("ASR_CMD_END",e),this.opts.longSession)await this.logger.shutdown();else{let n=await this.logger.flushOnce(F);(n==="failed"||n==="timeout")&&I(this.logger.drainBuffer())}this.logger&&this.writeManifestLine(e.exit_code),r(null)}}writeManifestLine(e){try{let n=x(this.ids.context_instance_id??null);P.mkdirSync(B.dirname(n),{recursive:!0});let i={ts:new Date().toISOString(),session_id:this.ids.session_id,operation_id:this.ids.operation_id,agent_session_id:this.ids.agent_session_id,verb:this.ids.verb,mode:this.ids.mode,exit_code:e};P.appendFileSync(n,JSON.stringify(i)+`
3
3
  `,{flag:"a",mode:384})}catch{}}};function U(t){let e={event:t.event,session_id:t.session_id,operation_id:t.operation_id,verb:t.verb,mode:t.mode,component:t.component,seq:t.seq,context_lineage_id:t.context_lineage_id,context_instance_id:t.context_instance_id};t.parent_operation_id&&(e.parent_operation_id=t.parent_operation_id),t.agent_session_id&&(e.agent_session_id=t.agent_session_id);for(let[n,i]of Object.entries(t.context))e[n]=i;return e}var u=process.env.KANE_TELEMETRY_URL||v;function ve(){return process.env.TESTMUAI_BASE_URL?"custom":process.env.TESTMUAI_ENV==="stage"?"stage":"prod"}function Ee(t){let e=process.env.KANE_TELEMETRY!=="0"&&(!process.env.VITEST||process.env.KANE_TELEMETRY==="1"),n=t.env??"prod",i=null;if(t.resumeSid&&t.contextRoot)try{let o=N(t.contextRoot,t.resumeSid);o?.user_session_id&&(i=o.user_session_id)}catch{}if(!i&&t.applyPlanPath)try{let o=JSON.parse(D.readFileSync(t.applyPlanPath,"utf8"));o.telemetry?.user_session_id&&(i=o.telemetry.user_session_id)}catch{}let s=i!==null;i||(i=R());let l=null,c=null,f=!1;if(t.contextRoot&&D.existsSync(t.contextRoot))if(t.write&&e){let o=M(t.contextRoot);l=o.ids.context_lineage_id,c=o.ids.context_instance_id,f=o.cloned}else{let o=L(t.contextRoot);l=o?.context_lineage_id??null,c=o?.context_instance_id??null}let h={session_id:i,operation_id:T(),context_lineage_id:l,context_instance_id:c,verb:t.verb,mode:t.mode,component:"kane-cli"},_=null;if(e){let o=C(n),S={org_id:o.org_id??"",user_id:o.user_id??"",machine_id:o.machine_id,email:null,email_domain:"",user_type:"unknown",env:o.env,plan:o.plan??"unknown"},j=t.mode==="interactive"||t.mode==="cli"?"cli":"agent";_=new b({proxyUrl:u,sessionId:i,identity:S,device:{cli_version:g,platform:X(),arch:$(),host_agent:O(),invocation_mode:j},getToken:async()=>null}),t.longSession&&_.start()}let p=new a({envelope:h,logger:_,longSession:!!t.longSession,proxyUrl:u,clientVersion:`kane-cli/${g}`,telemetryEnabled:e});return e&&(r(h),p.event("ASR_CMD_START",{resumed:s,applied_plan:!!t.applyPlanPath}),f&&p.event("ASR_CONTEXT_CLONED"),w(async o=>{try{return(await E(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)})).ok}catch{return!1}}).catch(()=>{})),p}export{ve as a,Ee 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-KXUSG5ZI.js";import{y as t}from"./chunk-MMPFU2YC.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-4GLYNAK7.js";import{y as t}from"./chunk-B4LLKQTK.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,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as b}from"./chunk-4CJ55EUY.js";import{c as k}from"./chunk-RFHMDQXZ.js";import{a as C}from"./chunk-LHDNJJGE.js";import{q as m,r as u,s as f,t as x,u as y}from"./chunk-MMPFU2YC.js";import{createServer as S}from"http";import{randomBytes as A}from"crypto";import{URL as L}from"url";var P=class{profile;environment;creds;oauth;constructor(r="default",o="prod",e){this.profile=r,this.environment=o,this.creds=e??new C,this.oauth=new b(o)}async login(){let{server:r,port:o}=await this.startCallbackServer(),e=y(o);try{let t=this.creds.loadClient(this.profile,this.environment),i=t?.redirect_uris;(!t||!i?.includes(e))&&(t=await this.oauth.registerClient(e),this.creds.saveClient(this.profile,this.environment,t));let c=t.client_id,[h,d]=b.generatePkce(),a=A(32).toString("hex"),n=this.oauth.buildAuthorizationUrl(c,d,a,e),l=await this.waitForCallback(r,o,n,a);if(!l)throw new Error("Login cancelled or timed out");let p=await this.oauth.exchangeCode(l,c,h,e),g={access_token:p.access_token,refresh_token:p.refresh_token,expires_at:Math.floor(Date.now()/1e3)+p.expires_in,scope:p.scope??"*"};return this.creds.saveCredentials(this.profile,this.environment,g),this.creds.setActiveProfile(this.profile),g}catch(t){throw r.close(),t}}startCallbackServer(){return new Promise((r,o)=>{let e=u,t=()=>{let i=S();i.on("error",c=>{c.code==="EADDRINUSE"&&e<f?(e++,t()):o(new Error(`Failed to start callback server: ${c.message}. Ports ${u}-${f} are all in use.`))}),i.listen(e,m,()=>{r({server:i,port:e})})};t()})}waitForCallback(r,o,e,t){return new Promise(i=>{let c=!1,h=setTimeout(()=>d(null),12e4),d=a=>{c||(c=!0,clearTimeout(h),r.close(),i(a))};r.on("request",(a,n)=>{let l=new L(a.url??"/",`http://${m}:${o}`);if(l.pathname!==x){n.writeHead(404),n.end();return}let p=l.searchParams.get("state"),g=l.searchParams.get("code");if(l.searchParams.get("error")){n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Login failed",message:"We couldn't complete the sign-in. You can close this tab and try again from your terminal."})),d(null);return}if(p!==t){n.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Invalid state",message:"The sign-in response didn't match this session. Please return to your terminal and try again."})),d(null);return}n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"success",title:"You're signed in",message:"Head back to your terminal \u2014 KaneAI is ready when you are.",autoClose:!0})),d(g)}),k(e).catch(a=>{let n=a instanceof Error?a.message:String(a);process.stderr.write(`[auth] Could not open browser: ${n}
2
+ import{a as b}from"./chunk-NR23HZU4.js";import{c as k}from"./chunk-RFHMDQXZ.js";import{a as C}from"./chunk-WREVEATJ.js";import{q as m,r as u,s as f,t as x,u as y}from"./chunk-B4LLKQTK.js";import{createServer as S}from"http";import{randomBytes as A}from"crypto";import{URL as L}from"url";var P=class{profile;environment;creds;oauth;constructor(r="default",o="prod",e){this.profile=r,this.environment=o,this.creds=e??new C,this.oauth=new b(o)}async login(){let{server:r,port:o}=await this.startCallbackServer(),e=y(o);try{let t=this.creds.loadClient(this.profile,this.environment),i=t?.redirect_uris;(!t||!i?.includes(e))&&(t=await this.oauth.registerClient(e),this.creds.saveClient(this.profile,this.environment,t));let c=t.client_id,[h,d]=b.generatePkce(),a=A(32).toString("hex"),n=this.oauth.buildAuthorizationUrl(c,d,a,e),l=await this.waitForCallback(r,o,n,a);if(!l)throw new Error("Login cancelled or timed out");let p=await this.oauth.exchangeCode(l,c,h,e),g={access_token:p.access_token,refresh_token:p.refresh_token,expires_at:Math.floor(Date.now()/1e3)+p.expires_in,scope:p.scope??"*"};return this.creds.saveCredentials(this.profile,this.environment,g),this.creds.setActiveProfile(this.profile),g}catch(t){throw r.close(),t}}startCallbackServer(){return new Promise((r,o)=>{let e=u,t=()=>{let i=S();i.on("error",c=>{c.code==="EADDRINUSE"&&e<f?(e++,t()):o(new Error(`Failed to start callback server: ${c.message}. Ports ${u}-${f} are all in use.`))}),i.listen(e,m,()=>{r({server:i,port:e})})};t()})}waitForCallback(r,o,e,t){return new Promise(i=>{let c=!1,h=setTimeout(()=>d(null),12e4),d=a=>{c||(c=!0,clearTimeout(h),r.close(),i(a))};r.on("request",(a,n)=>{let l=new L(a.url??"/",`http://${m}:${o}`);if(l.pathname!==x){n.writeHead(404),n.end();return}let p=l.searchParams.get("state"),g=l.searchParams.get("code");if(l.searchParams.get("error")){n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Login failed",message:"We couldn't complete the sign-in. You can close this tab and try again from your terminal."})),d(null);return}if(p!==t){n.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Invalid state",message:"The sign-in response didn't match this session. Please return to your terminal and try again."})),d(null);return}n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"success",title:"You're signed in",message:"Head back to your terminal \u2014 KaneAI is ready when you are.",autoClose:!0})),d(g)}),k(e).catch(a=>{let n=a instanceof Error?a.message:String(a);process.stderr.write(`[auth] Could not open browser: ${n}
3
3
  Please open this URL manually: ${e}
4
4
  `)})})}};function v(s){let r=s.state==="success",o=r?"#22c55e":"#ef4444",e=r?"rgba(34, 197, 94, 0.12)":"rgba(239, 68, 68, 0.12)",t=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=s.autoClose?"<script>setTimeout(function(){try{window.close();}catch(e){}}, 1500);</script>":"";return`<!doctype html>
5
5
  <html lang="en">
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{y as m}from"./chunk-MMPFU2YC.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{y as m}from"./chunk-B4LLKQTK.js";import{a as x}from"./chunk-HCBYKLMW.js";import{a as u,b as a,j as g}from"./chunk-C44QQJR4.js";import{a as b}from"./chunk-6YGTRKDT.js";import{e as f}from"./chunk-UR6MHSHU.js";var T=f(b(),1);function k(i,n){if(!n)return i;let l=i.trim()||n;return`\x1B]8;;${n}\x07${l}\x1B]8;;\x07`}var r=f(x(),1);function $({shareableLink:i,testCaseLink:n,codeExportDir:l,recordedTestPath:s,outputDir:o,autoExit:p=!0}){let{exit:c}=g();(0,T.useEffect)(()=>{if(!p)return;let t=setTimeout(()=>c(),100);return()=>clearTimeout(t)},[c,p]);let e=[];return s&&e.push({label:"Test",url:s,linkUrl:`file://${s}`}),o&&e.push({label:"Output",url:o,linkUrl:`file://${o}`}),i&&e.push({label:"ShareLink",url:i}),n&&e.push({label:"TestCase",url:n}),l&&!o&&e.push({label:"CodeExport",url:l,linkUrl:`file://${l}`}),e.length===0?(0,r.jsx)(r.Fragment,{}):(0,r.jsx)(u,{flexDirection:"column",marginTop:1,marginLeft:1,children:e.map(t=>(0,r.jsxs)(u,{flexDirection:"column",marginBottom:1,children:[(0,r.jsxs)(a,{color:m.orange,children:[t.label,":"]}),(0,r.jsx)(a,{color:m.dim,children:k(t.url,t.linkUrl??t.url)})]},t.label))})}export{$ as a};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as h}from"./chunk-KXUSG5ZI.js";import{y as l}from"./chunk-MMPFU2YC.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-4GLYNAK7.js";import{y as l}from"./chunk-B4LLKQTK.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{a}from"./chunk-KHJXOFDM.js";import"./chunk-MMPFU2YC.js";import"./chunk-UR6MHSHU.js";export{a as getEnvironment};
2
+ import{a}from"./chunk-A2IQRVPR.js";import"./chunk-B4LLKQTK.js";import"./chunk-UR6MHSHU.js";export{a as getEnvironment};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-LHDNJJGE.js";import"./chunk-MMPFU2YC.js";import"./chunk-UR6MHSHU.js";export{a as CredentialsManager};
2
+ import{a}from"./chunk-WREVEATJ.js";import"./chunk-B4LLKQTK.js";import"./chunk-UR6MHSHU.js";export{a as CredentialsManager};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{$ as fa,A as J,B as K,C as L,D as M,E as N,F as O,G as P,H as Q,L as R,M as S,N as T,O as U,P as V,Q as W,R as X,S as Y,T as Z,U as _,V as $,W as aa,X as ba,Y as ca,Z as da,_ as ea,a,aa as ga,b,ba as ha,c,ca as ia,d,e,f,g,h,i,j,k as t,l as u,m as v,n as w,o as x,p as y,q as z,r as A,s as B,t as C,u as D,v as E,w as F,x as G,y as H,z as I}from"./chunk-JXKRO2ZJ.js";import"./chunk-FCMLIK7P.js";import{a as n,b as o,c as p,e as q,f as r,g as s}from"./chunk-CJJXT5DO.js";import"./chunk-QM4S2APK.js";import"./chunk-ZPDM6FO7.js";import"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import{a as k,b as l,c as m}from"./chunk-EHN5HTUD.js";import"./chunk-L5LI2JF4.js";import"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-KHJXOFDM.js";import"./chunk-MMPFU2YC.js";import"./chunk-UR6MHSHU.js";export{P as EvidenceSession,C as appendExecutionPointer,M as assembleExecutionEnv,i as buildEnvironment,j as buildEvidenceRunConfig,g as buildExternalId,z as buildLogsMetaYaml,y as buildResultYaml,t as buildRunYaml,O as createCdpBrowserCapture,u as createRunningPack,v as createRunningPackRoot,H as declareLogsFromDir,J as diagnostics,x as discardPack,ba as ensureAuteurExecution,N as fetchCdpBrowserString,L as finalizeEvidencePack,U as finalizeInlineEvidence,K as finalizeMemberTestLogs,da as flattenAuteurLeafIds,ca as flattenAuteurLeaves,T as inlineEvidenceBlock,q as listPacks,p as newExecutionId,h as normalizeOs,S as noteInlineSpawn,$ as offerEvidenceView,o as packPath,I as packTestLogsDir,V as parseRange,D as readExecutionPointers,ia as readPackLeafIds,ha as readPackLeaves,s as recoverStore,fa as remapReplayActionIds,r as resolvePack,ga as resolveReplayResultSteps,F as rollupTestStatus,aa as runEvidenceMerge,_ as runEvidenceServe,E as runEvidenceValidate,Q as runStartupRecovery,l as sealPack,w as sealPackById,Z as serveHint,d as shortHash,c as slugify,W as startEvidenceLocalServer,R as startInlineEvidence,n as storeDir,m as sweepStore,ea as synthesizeSkippedTail,f as testIdForInline,e as testIdForTestmd,k as validatePack,a as verdictFromResultCode,X as viewerBaseFor,Y as viewerUrlFor,b as worstOf,G as worstResultCode,B as writeLogsMeta,A as writeResult};
2
+ import{$ as fa,A as J,B as K,C as L,D as M,E as N,F as O,G as P,H as Q,L as R,M as S,N as T,O as U,P as V,Q as W,R as X,S as Y,T as Z,U as _,V as $,W as aa,X as ba,Y as ca,Z as da,_ as ea,a,aa as ga,b,ba as ha,c,ca as ia,d,e,f,g,h,i,j,k as t,l as u,m as v,n as w,o as x,p as y,q as z,r as A,s as B,t as C,u as D,v as E,w as F,x as G,y as H,z as I}from"./chunk-UXPQRALY.js";import"./chunk-FCMLIK7P.js";import{a as n,b as o,c as p,e as q,f as r,g as s}from"./chunk-CJJXT5DO.js";import"./chunk-QM4S2APK.js";import"./chunk-ZPDM6FO7.js";import"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import{a as k,b as l,c as m}from"./chunk-EHN5HTUD.js";import"./chunk-L5LI2JF4.js";import"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-A2IQRVPR.js";import"./chunk-B4LLKQTK.js";import"./chunk-UR6MHSHU.js";export{P as EvidenceSession,C as appendExecutionPointer,M as assembleExecutionEnv,i as buildEnvironment,j as buildEvidenceRunConfig,g as buildExternalId,z as buildLogsMetaYaml,y as buildResultYaml,t as buildRunYaml,O as createCdpBrowserCapture,u as createRunningPack,v as createRunningPackRoot,H as declareLogsFromDir,J as diagnostics,x as discardPack,ba as ensureAuteurExecution,N as fetchCdpBrowserString,L as finalizeEvidencePack,U as finalizeInlineEvidence,K as finalizeMemberTestLogs,da as flattenAuteurLeafIds,ca as flattenAuteurLeaves,T as inlineEvidenceBlock,q as listPacks,p as newExecutionId,h as normalizeOs,S as noteInlineSpawn,$ as offerEvidenceView,o as packPath,I as packTestLogsDir,V as parseRange,D as readExecutionPointers,ia as readPackLeafIds,ha as readPackLeaves,s as recoverStore,fa as remapReplayActionIds,r as resolvePack,ga as resolveReplayResultSteps,F as rollupTestStatus,aa as runEvidenceMerge,_ as runEvidenceServe,E as runEvidenceValidate,Q as runStartupRecovery,l as sealPack,w as sealPackById,Z as serveHint,d as shortHash,c as slugify,W as startEvidenceLocalServer,R as startInlineEvidence,n as storeDir,m as sweepStore,ea as synthesizeSkippedTail,f as testIdForInline,e as testIdForTestmd,k as validatePack,a as verdictFromResultCode,X as viewerBaseFor,Y as viewerUrlFor,b as worstOf,G as worstResultCode,B as writeLogsMeta,A as writeResult};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d,e,f,g}from"./chunk-54IB6CXK.js";import"./chunk-GRB66C5S.js";import"./chunk-JFAFKHDX.js";import"./chunk-3C5GMAM4.js";import"./chunk-RN4OSVTG.js";import"./chunk-DNNZ353O.js";import"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-UR6MHSHU.js";export{b as designStateOf,g as evolveCommand,c as evolveOneUc,f as liveRunDesignForUc,a as resolveParentUc,e as runEvolveCommand,d as staleTargets};
2
+ import{a,b,c,d,e,f,g}from"./chunk-4XSW6WZD.js";import"./chunk-GRB66C5S.js";import"./chunk-JFAFKHDX.js";import"./chunk-3C5GMAM4.js";import"./chunk-RN4OSVTG.js";import"./chunk-DNNZ353O.js";import"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-UR6MHSHU.js";export{b as designStateOf,g as evolveCommand,c as evolveOneUc,f as liveRunDesignForUc,a as resolveParentUc,e as runEvolveCommand,d as staleTargets};
@@ -1,8 +1,8 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{e as Y,f as E}from"./chunk-MTNUZEO7.js";import"./chunk-K7USHLVZ.js";import"./chunk-MR7CX5VT.js";import"./chunk-J44RN3FB.js";import"./chunk-JFAFKHDX.js";import{c as V}from"./chunk-YKTYVJBN.js";import"./chunk-CVOGP253.js";import"./chunk-427OQS2N.js";import{a as x}from"./chunk-M5PJQ5Y3.js";import{a as z}from"./chunk-3C5GMAM4.js";import"./chunk-GG43HSU2.js";import"./chunk-FMR2KPSK.js";import{d as N}from"./chunk-HLRLP6TQ.js";import{c as I}from"./chunk-RN4OSVTG.js";import"./chunk-V3UE6RJP.js";import"./chunk-DNNZ353O.js";import{a as M,b as R}from"./chunk-73OQDAXF.js";import"./chunk-FHKDTM5L.js";import"./chunk-2XMJ6YAE.js";import"./chunk-BKM2LWU2.js";import{a as P}from"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-Y5RNCJAN.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-MMPFU2YC.js";import"./chunk-UR6MHSHU.js";async function W(o){let[{render:e},t,{QuestionBatchPrompt:m}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),p=t.default??t;return new Promise(f=>{let n=e(p.createElement(m,{questions:o,onSubmit:h=>{n.unmount(),f(h)}}))})}async function J(o,e){let[{render:t},m,{ReviewChecklist:p}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),f=m.default??m;return new Promise(n=>{let h=t(f.createElement(p,{items:o.map(a=>{let g=e.get(a.temp_ref);return{uc:a,dedupWith:g&&!g.archived?g.cid:void 0,archivedMatch:g?.archived?{cid:g.cid,reason:g.reason}:void 0}}),onSubmit:a=>{h.unmount(),n(a)}}))})}async function K(o){let{createInterface:e}=await import("readline/promises"),t=e({input:process.stdin,output:process.stdout});try{let m=await t.question(`${o} [y/N] `);return/^y(es)?$/i.test(m.trim())}finally{t.close()}}async function ie(o){let e=P(process.cwd()),t=R({verb:"extract",mode:o.plan?"cli":"interactive",contextRoot:e,env:M(),resumeSid:o.resume,write:!0,longSession:!0}),p={...await N(),...t.spawnEnv()},f=await V(p);if(!f.ok)return process.stderr.write((f.message??"error: turn-endpoint preflight failed")+`
2
+ import{e as Y,f as E}from"./chunk-DGIPQINV.js";import"./chunk-K7USHLVZ.js";import"./chunk-JSF5JYZC.js";import"./chunk-J44RN3FB.js";import"./chunk-JFAFKHDX.js";import{c as V}from"./chunk-YKTYVJBN.js";import"./chunk-CVOGP253.js";import"./chunk-427OQS2N.js";import{a as x}from"./chunk-N4LMQR7C.js";import{a as z}from"./chunk-3C5GMAM4.js";import"./chunk-GG43HSU2.js";import"./chunk-FMR2KPSK.js";import{d as N}from"./chunk-RCTM7NGT.js";import{c as I}from"./chunk-RN4OSVTG.js";import"./chunk-V3UE6RJP.js";import"./chunk-DNNZ353O.js";import{a as M,b as R}from"./chunk-WTXHOWUP.js";import"./chunk-FHKDTM5L.js";import"./chunk-2XMJ6YAE.js";import"./chunk-BKM2LWU2.js";import{a as P}from"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-Y5RNCJAN.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-B4LLKQTK.js";import"./chunk-UR6MHSHU.js";async function W(o){let[{render:e},t,{QuestionBatchPrompt:m}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),p=t.default??t;return new Promise(f=>{let n=e(p.createElement(m,{questions:o,onSubmit:h=>{n.unmount(),f(h)}}))})}async function J(o,e){let[{render:t},m,{ReviewChecklist:p}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),f=m.default??m;return new Promise(n=>{let h=t(f.createElement(p,{items:o.map(a=>{let g=e.get(a.temp_ref);return{uc:a,dedupWith:g&&!g.archived?g.cid:void 0,archivedMatch:g?.archived?{cid:g.cid,reason:g.reason}:void 0}}),onSubmit:a=>{h.unmount(),n(a)}}))})}async function K(o){let{createInterface:e}=await import("readline/promises"),t=e({input:process.stdin,output:process.stdout});try{let m=await t.question(`${o} [y/N] `);return/^y(es)?$/i.test(m.trim())}finally{t.close()}}async function ie(o){let e=P(process.cwd()),t=R({verb:"extract",mode:o.plan?"cli":"interactive",contextRoot:e,env:M(),resumeSid:o.resume,write:!0,longSession:!0}),p={...await N(),...t.spawnEnv()},f=await V(p);if(!f.ok)return process.stderr.write((f.message??"error: turn-endpoint preflight failed")+`
3
3
  `),process.stderr.write(t.supportFooter()+`
4
4
  `),t.error("preflight_auth"),await t.end({exit_code:2}),2;let n=async()=>f;if(o.plan){let s=await E(o,{contextDir:e,agent:x,preflightTurn:n,ask:W,review:J,confirmStale:K,out:u=>process.stdout.write(u+`
5
5
  `),progress:u=>process.stderr.write(u+`
6
6
  `),isTTY:I(),auth:p,telemetry:t});return s===1&&process.stderr.write(t.supportFooter()+`
7
- `),await t.end({exit_code:s}),s}let[{render:h},a,{ScrollbackProvider:g},{ChatSurface:k},{ScrollbackTap:i},{makeChatController:S},{setInkExit:C},H]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./scrollback-JLPJR25X.js"),import("./ChatSurface-TZ554O4U.js"),import("./ScrollbackTap-Q3IOKNMS.js"),import("./chat-controller-QLORQWJZ.js"),import("./exit-manager-MXUD7GQ7.js"),Promise.all([import("./chat-committer-OS7ULZMH.js"),import("./descriptor-KXDJ4XYD.js"),import("./explain-EBVIUS2X.js"),import("./readmodel-S5RAQH3F.js")])]),[{commitChatTurn:$},{topologyDescriptor:L},{explain:O},{openGraph:y}]=H,A=a.default??a,c=S({commitChatTurn:$,descriptor:L(),contextDir:e,refreshGraph:()=>y(e),graph:y(e),explain:O,by:{kind:"human",id:"owner"},dedupFlags:s=>Y(s,y(e))}),D={current:null},j=0,_=null,v=!1,Q=()=>{if(j+=1,j>=2){try{b.unmount()}catch{}process.exit(130)}c.requestPause(),_=setTimeout(()=>{v||(v=!0,(async()=>{c.ledger({kind:"interrupted",detail:"the agent did not confirm the pause within 5s"}),await D.current?.flush();try{b.unmount()}catch{}process.exit(130)})())},5e3)},U=await import("./dossier-KJSJPWOW.js"),q=s=>{try{return U.buildDossier(y(e),s)}catch{return null}},B={listUcs:()=>{let s=y(e),u=new Set(c.state.turns.flatMap(r=>(r.items??[]).map(l=>l.title.toLowerCase()))),d={high:0,med:1,low:2};return s.byLabel("usecase").filter(r=>!s.superseded.has(r.cid)).map((r,l)=>{let w=r.content,T=String(w.title??r.cid.slice(0,12)),G=z(s,r.cid),F=G?G.designed_at_cid===r.cid?"current":"stale":void 0;return{key:r.cid,title:T,badge:F==="current"?"designed":F==="stale"?"designed \xB7 stale":u.has(T.toLowerCase())?"drafted this session":"existing",designed:F,risk:w.risk,i:l}}).sort((r,l)=>(d[r.risk??"zz"]??3)-(d[l.risk??"zz"]??3)||r.i-l.i).map(({key:r,title:l,badge:w,designed:T})=>({key:r,title:l,badge:w,designed:T}))},runDesignChild:async(s,u=!1)=>{let[{runDesign:d}]=await Promise.all([import("./run-2AIQUJ55.js")]),r="",l=await d({useCase:s,force:u,mode:"interactive"},{contextDir:e,agent:x,preflightTurn:n,ask:w=>c.ask(w),chat:c,nested:!0,out:w=>{r=w},progress:()=>{},isTTY:!0,auth:p});return l!==0&&r&&c.note(r),l}},b=h(A.createElement(g,null,A.createElement(i,{into:D}),A.createElement(k,{controller:c,verb:"extract",onCtrlC:Q,chain:B,inspect:q})),{exitOnCtrlC:!1});C(()=>b.unmount()),c.ledger({kind:"banner",text:"kane-cli context \xB7 extract \xB7 interactive"});try{let s=E(o,{contextDir:e,agent:x,preflightTurn:n,ask:d=>c.ask(d),review:async d=>new Map(d.map(r=>[r.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!0,out:d=>c.note(d),progress:()=>{},isTTY:I(),auth:p,chat:c,telemetry:t});s.finally(()=>{v=!0});let u=await s;return u===1&&process.stderr.write(t.supportFooter()+`
7
+ `),await t.end({exit_code:s}),s}let[{render:h},a,{ScrollbackProvider:g},{ChatSurface:k},{ScrollbackTap:i},{makeChatController:S},{setInkExit:C},H]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./scrollback-JLPJR25X.js"),import("./ChatSurface-PMEOJBZG.js"),import("./ScrollbackTap-Q3IOKNMS.js"),import("./chat-controller-QLORQWJZ.js"),import("./exit-manager-MXUD7GQ7.js"),Promise.all([import("./chat-committer-OS7ULZMH.js"),import("./descriptor-KXDJ4XYD.js"),import("./explain-EBVIUS2X.js"),import("./readmodel-S5RAQH3F.js")])]),[{commitChatTurn:$},{topologyDescriptor:L},{explain:O},{openGraph:y}]=H,A=a.default??a,c=S({commitChatTurn:$,descriptor:L(),contextDir:e,refreshGraph:()=>y(e),graph:y(e),explain:O,by:{kind:"human",id:"owner"},dedupFlags:s=>Y(s,y(e))}),D={current:null},j=0,_=null,v=!1,Q=()=>{if(j+=1,j>=2){try{b.unmount()}catch{}process.exit(130)}c.requestPause(),_=setTimeout(()=>{v||(v=!0,(async()=>{c.ledger({kind:"interrupted",detail:"the agent did not confirm the pause within 5s"}),await D.current?.flush();try{b.unmount()}catch{}process.exit(130)})())},5e3)},U=await import("./dossier-KJSJPWOW.js"),q=s=>{try{return U.buildDossier(y(e),s)}catch{return null}},B={listUcs:()=>{let s=y(e),u=new Set(c.state.turns.flatMap(r=>(r.items??[]).map(l=>l.title.toLowerCase()))),d={high:0,med:1,low:2};return s.byLabel("usecase").filter(r=>!s.superseded.has(r.cid)).map((r,l)=>{let w=r.content,T=String(w.title??r.cid.slice(0,12)),G=z(s,r.cid),F=G?G.designed_at_cid===r.cid?"current":"stale":void 0;return{key:r.cid,title:T,badge:F==="current"?"designed":F==="stale"?"designed \xB7 stale":u.has(T.toLowerCase())?"drafted this session":"existing",designed:F,risk:w.risk,i:l}}).sort((r,l)=>(d[r.risk??"zz"]??3)-(d[l.risk??"zz"]??3)||r.i-l.i).map(({key:r,title:l,badge:w,designed:T})=>({key:r,title:l,badge:w,designed:T}))},runDesignChild:async(s,u=!1)=>{let[{runDesign:d}]=await Promise.all([import("./run-4LTYFTF2.js")]),r="",l=await d({useCase:s,force:u,mode:"interactive"},{contextDir:e,agent:x,preflightTurn:n,ask:w=>c.ask(w),chat:c,nested:!0,out:w=>{r=w},progress:()=>{},isTTY:!0,auth:p});return l!==0&&r&&c.note(r),l}},b=h(A.createElement(g,null,A.createElement(i,{into:D}),A.createElement(k,{controller:c,verb:"extract",onCtrlC:Q,chain:B,inspect:q})),{exitOnCtrlC:!1});C(()=>b.unmount()),c.ledger({kind:"banner",text:"kane-cli context \xB7 extract \xB7 interactive"});try{let s=E(o,{contextDir:e,agent:x,preflightTurn:n,ask:d=>c.ask(d),review:async d=>new Map(d.map(r=>[r.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!0,out:d=>c.note(d),progress:()=>{},isTTY:I(),auth:p,chat:c,telemetry:t});s.finally(()=>{v=!0});let u=await s;return u===1&&process.stderr.write(t.supportFooter()+`
8
8
  `),await t.end({exit_code:u}),u}finally{v=!0,_&&clearTimeout(_),await D.current?.flush();try{b.unmount()}catch{}}}async function ae(o){let e=R({verb:"extract",mode:o.mode,contextRoot:P(process.cwd()),env:M(),resumeSid:o.resume,write:!0,longSession:!0}),t={...await N(),...e.spawnEnv()},{makeHeadlessIO:m,resolveEncoding:p,guardedChannels:f}=await import("./headless-io-PWW6YKH2.js"),n=m(p(o.mode),"extract"),{makeInterruptGuard:h}=await import("./interrupt-guard-UREUWNRL.js"),a=h(x,i=>n.out(i)),k=f(n,()=>a.interrupted(),/^error: (agent failed|repair run failed|agent ended)/);try{let i=await E(o,{contextDir:P(process.cwd()),agent:a.agent,preflightTurn:()=>V(t),ask:async()=>[],review:async S=>new Map(S.map(C=>[C.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!1,out:k.out,emit:k.emit,progress:n.progress,isTTY:!1,auth:t,telemetry:e});return a.interrupted()&&i!==3?(n.out("interrupted \u2014 no session saved"),await e.end({exit_code:130}),n.done(130)):(i===1&&n.out(e.supportFooter()),await e.end({exit_code:i}),n.done(i))}catch(i){return n.event({type:"error",message:`error: extract failed: ${i instanceof Error?i.message:String(i)}`}),n.out(`error: extract failed: ${i instanceof Error?i.message:String(i)}`),n.out("hint: per-run trace logs live under .context/logs/ (extract-*.log)"),n.done(1)}finally{a.dispose()}}export{ae as bindExtractHeadless,ie as bindExtractInteractive};
@@ -3,4 +3,4 @@ import{a as s}from"./chunk-BC7UVJJB.js";import"./chunk-UR6MHSHU.js";import{exist
3
3
  `),2;let n=async(r,t)=>{if(process.stderr.write(r+`
4
4
  `),e.mode!=="agent")return 2;let{makeHeadlessIO:a,agentRefusal:c}=await import("./headless-io-PWW6YKH2.js");return c(a("ndjson","extract"),r,t)};if(e.apply)return n("extract: --apply is not implemented yet \u2014 coming with the plan\u2192apply workflow (run without --apply, or use --plan to preview)");{let{validateResumeMessage:r}=await import("./headless-io-PWW6YKH2.js"),t=r(e,"extract");if(t)return n(t)}if(!d(s(process.cwd())))return n("error: no context store here (run `kane-cli context ingest <files>` first)","NO_STORE");if(!e.mode&&!process.stdin.isTTY)return process.stderr.write(`extract: no TTY \u2014 pass an explicit --mode agent|ci|override to run headless
5
5
  `),2;let i=e.mode??"interactive";if(i==="interactive"){if(!process.stdin.isTTY||!process.stdout.isTTY)return process.stderr.write(`extract: --mode interactive needs a TTY on stdin and stdout (use --mode agent|ci|override headless)
6
- `),2;let{bindExtractInteractive:r}=await import("./extract-bind-6MQYKN3G.js");return r(e)}let{bindExtractHeadless:o}=await import("./extract-bind-6MQYKN3G.js");return o({...e,mode:i})}export{l as extractCommand};
6
+ `),2;let{bindExtractInteractive:r}=await import("./extract-bind-3SWPBZX6.js");return r(e)}let{bindExtractHeadless:o}=await import("./extract-bind-3SWPBZX6.js");return o({...e,mode:i})}export{l as extractCommand};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as T,f as P,g as $,h as G,j as N,k as M,l as B,m as I,n as L,o as U,p as F,r as z,s as C,t as _,u as O,v as K}from"./chunk-ZP4S5WGW.js";import{b as k}from"./chunk-NJAHRITS.js";import{d as J}from"./chunk-MJBCBQC2.js";import{c as E}from"./chunk-ZNHXIRCM.js";import"./chunk-YSSTGJ7O.js";import"./chunk-TDPWFYTJ.js";import{a as q}from"./chunk-3AZTXJY4.js";import"./chunk-XZRIQ3GF.js";import"./chunk-4CJ55EUY.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-L5LI2JF4.js";import{m as x,n as A}from"./chunk-Y5RNCJAN.js";import"./chunk-5EOX4MEY.js";import{h as H}from"./chunk-POYZ6SAI.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import{a as R}from"./chunk-KHJXOFDM.js";import"./chunk-VE3SUJMA.js";import{a as j}from"./chunk-LHDNJJGE.js";import"./chunk-MMPFU2YC.js";import"./chunk-UR6MHSHU.js";import{join as se}from"path";async function V(t){let e=t.projectId,n=t.folderId,r=null;if(!e&&t.autoResolve){let l=await t.resolver.resolve();if(!l)throw new $("unauthorized; run `kane-cli login`");let u=await H({creds:t.autoResolve.creds,config:t.autoResolve.config,profile:t.autoResolve.profile,env:t.autoResolve.envName,tmsCreds:{username:l.username,access_key:l.access_key},isLocal:!1,log:t.log});u.status==="ok"&&(e=u.projectId,n=n??u.folderId,u.autoDefaulted&&(r={projectId:u.autoDefaulted.projectId,projectName:u.autoDefaulted.projectName,folderId:u.autoDefaulted.folderId,folderName:u.autoDefaulted.folderName}))}return{baseUrl:`${t.env.testGeneratorBaseUrl}/test-generator/api/v2`,tmsBaseUrl:t.env.tmsBaseUrl,authResolver:t.resolver,projectId:e,folderId:n,suiteName:t.suiteName,autoDefaulted:r,log:t.log}}function Z(t){return t.reduce((e,n)=>e+(n.test_cases?.length??0),0)}var y=class{constructor(e=n=>process.stdout.write(n)){this.write=e}emit(e){this.write(JSON.stringify(e)+`
2
+ import{a as T,f as P,g as $,h as G,j as N,k as M,l as B,m as I,n as L,o as U,p as F,r as z,s as C,t as _,u as O,v as K}from"./chunk-SBZWFULF.js";import{b as k}from"./chunk-HOOXUO3X.js";import{d as J}from"./chunk-DFDDUMG5.js";import{c as E}from"./chunk-4SJC64KQ.js";import"./chunk-E5PWL3BG.js";import"./chunk-TDPWFYTJ.js";import{a as q}from"./chunk-T7ZPMTGS.js";import"./chunk-EN7NW7DU.js";import"./chunk-NR23HZU4.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-L5LI2JF4.js";import{m as x,n as A}from"./chunk-Y5RNCJAN.js";import"./chunk-5EOX4MEY.js";import{h as H}from"./chunk-AYY7RYMK.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import{a as R}from"./chunk-A2IQRVPR.js";import"./chunk-VE3SUJMA.js";import{a as j}from"./chunk-WREVEATJ.js";import"./chunk-B4LLKQTK.js";import"./chunk-UR6MHSHU.js";import{join as se}from"path";async function V(t){let e=t.projectId,n=t.folderId,r=null;if(!e&&t.autoResolve){let l=await t.resolver.resolve();if(!l)throw new $("unauthorized; run `kane-cli login`");let u=await H({creds:t.autoResolve.creds,config:t.autoResolve.config,profile:t.autoResolve.profile,env:t.autoResolve.envName,tmsCreds:{username:l.username,access_key:l.access_key},isLocal:!1,log:t.log});u.status==="ok"&&(e=u.projectId,n=n??u.folderId,u.autoDefaulted&&(r={projectId:u.autoDefaulted.projectId,projectName:u.autoDefaulted.projectName,folderId:u.autoDefaulted.folderId,folderName:u.autoDefaulted.folderName}))}return{baseUrl:`${t.env.testGeneratorBaseUrl}/test-generator/api/v2`,tmsBaseUrl:t.env.tmsBaseUrl,authResolver:t.resolver,projectId:e,folderId:n,suiteName:t.suiteName,autoDefaulted:r,log:t.log}}function Z(t){return t.reduce((e,n)=>e+(n.test_cases?.length??0),0)}var y=class{constructor(e=n=>process.stdout.write(n)){this.write=e}emit(e){this.write(JSON.stringify(e)+`
3
3
  `)}onStart(e){this.emit({type:"generate_start",request_id:e.requestId,objective_chars:e.objectiveChars,scenario_limit:e.scenarioLimit,per_scenario_limit:e.perScenarioLimit,is_refine:e.isRefine})}onUpload(e){this.emit({type:"generate_upload",file:e.file,index:e.index,total:e.total,status:e.status})}onThinking(e){this.emit({type:"generate_thinking",took_ms:e.tookMs})}onProgress(e){this.emit({type:"generate_progress",pct:e})}onSnapshot(e){this.emit({type:"generate_snapshot",scenario_count:e.scenarios.length,case_count:Z(e.scenarios),scenarios:e.scenarios})}onClarification(e){this.emit({type:"generate_clarification",text:e})}onChat(e){this.emit({type:"generate_chat",text:e})}onError(e){this.emit({type:"error",message:e})}onSaveResult(e){this.emit({type:"generate_save_result",suite_dir:e.suiteDir,saved:e.saved,fell_back:e.fellBack,...e.warning?{warning:e.warning}:{}})}onDone(e){this.emit({type:"generate_done",request_id:e.requestId,status:e.status,scenario_count:e.scenarioCount,case_count:e.caseCount,refine_hint:e.refineHint,save_hint:e.saveHint,...e.suiteDir?{suite_dir:e.suiteDir}:{}})}onUpdateAvailable(e){this.emit({type:"update_available",current:e.current,latest:e.latest,severity:e.severity})}},S=class{constructor(e=n=>process.stdout.write(n)){this.write=e}onStart(e){let n=e.isRefine?"Refining":"Generating";this.write(`${n} (request ${e.requestId})\u2026
4
4
  `)}onUpload(e){e.status==="uploading"&&this.write(` uploading ${e.file} (${e.index}/${e.total})
5
5
  `)}onThinking(e){let n=e.tookMs?` (${Math.round(e.tookMs/1e3)}s)`:"";this.write(` thinking${n}
@@ -16,6 +16,6 @@ import{a as T,f as P,g as $,h as G,j as N,k as M,l as B,m as I,n as L,o as U,p a
16
16
  `),this.write(` Save: ${e.saveHint}
17
17
  `),e.suiteDir&&this.write(` Saved: ${e.suiteDir}
18
18
  `)}onUpdateAvailable(e){this.write(`(update available: ${e.current} \u2192 ${e.latest})
19
- `)}};import{createHash as ee}from"crypto";function te(t){return ee("sha1").update(JSON.stringify({t:t.title,p:t.preconditions,m:t.manual_steps})).digest("hex")}function re(t){let e=[];for(let n of t.scenarios)for(let r of n.test_cases??[])I(r)&&r.manual_steps!=null&&e.push(r);return e}async function ne(t,e,n){let r=new Array(t.length),l=0,u=Array.from({length:Math.min(e,t.length)},async()=>{for(;;){let d=l++;if(d>=t.length)return;try{r[d]={ok:!0,value:await n(t[d])}}catch{r[d]={ok:!1}}}});return await Promise.all(u),r}async function Y(t,e,n){let r=re(t),l=n.run??(async(c,s)=>{let m=await n.resolveAuth(),o=U({objective:c,model:n.model,sessionId:n.sessionId,auth:m});return F(o,n.spawnOpts,s)}),u=r.map(te),d=[...new Set(u)],g=new Map;d.forEach(c=>{g.set(c,r[u.indexOf(c)])});let p=d.map(c=>g.get(c)),v=await ne(p,n.concurrency??3,c=>l(L(c))),i=new Map;d.forEach((c,s)=>{let m=v[s];m.ok&&i.set(c,m.value)});let f=new Map;r.forEach((c,s)=>{f.set(c.id,i.get(u[s]))});let a=0;for(let c of t.scenarios)for(let s of c.test_cases??[])I(s)&&!f.get(s.id)&&a++;let w=c=>{let s=f.get(c.id);return s?N(s,c):M(c)};return{...await B(t,e,{suiteName:n.suiteName,redirectBareCwd:!1},w),fellBack:a}}function Pe(t,e){let n=!!t.agent||!!t.refine||!!t.save||!e,r=t.agent?"agent":"plain";return{headless:n,mode:r}}function $e(t){return t.refine&&t.save?{error:"use --refine or --save, not both"}:t.save?t.objective?{error:"--save takes no objective; use --refine to add to a request"}:t.req?{op:"save"}:{error:"--save requires --req <id>"}:t.refine?t.req?t.objective?t.out?{error:"--out is only valid with --save"}:{op:"refine"}:{error:"--refine needs a refinement objective"}:{error:"--refine requires --req <id>"}:t.req?{error:"--req requires --refine or --save"}:t.out?{error:"--out is only valid with --save"}:t.objective?{op:"new"}:{error:"provide an objective, or use --refine/--save with --req"}}function ie(){return se(process.cwd(),".testmuai","tests")}function Ge(t){if(typeof t!="string")return;let e=t.split(",").map(n=>n.trim()).filter(Boolean);return e.length?e:void 0}var X="tcg-generate-headless";function Q(t){return{refineHint:`kane-cli generate "<refinement>" --refine --req ${t}`,saveHint:`kane-cli generate --save --req ${t}`}}function W(t){return t.scenarios.reduce((e,n)=>e+(n.test_cases?.length??0),0)}function oe(t){return t==="completed"?0:t==="stopped"?3:1}async function Ne(t,e){let n=e.write??(i=>process.stdout.write(i)),r=e.sink??(e.mode==="agent"?new y(n):new S(n)),l,u,d=null;try{let i=await e.makeClient();l=i.client,u=i.conn,d=i.autoDefaulted}catch(i){return r.onError(i.message),2}if(e.mode==="agent"&&d){let{buildAutoDefaultedNdjson:i}=await import("./require-project-folder-NQBZFUPF.js");n(i(d))}try{let i=await(e.checkUpdate??J)();i&&r.onUpdateAvailable(i)}catch{}let g=t.reqId??null;x(X,()=>{g&&l.cancel(g).catch(()=>{})});let p=process.cwd(),v={validate:e.validate??z,upload:e.upload??O,buildMappings:K,onUpload:i=>r.onUpload(i)};try{if(t.op==="save"){let s;try{s=(await l.attach(t.reqId)).state}catch(D){return r.onError(D.message),2}g=s.requestId,r.onSnapshot(s);let m=t.outDir??ie(),o=await e.materialize(s,m,t.suiteName);r.onSaveResult({suiteDir:o.suiteDir,saved:o.paths.length,fellBack:o.fellBack,warning:o.warning});let h=Q(s.requestId);return r.onDone({requestId:s.requestId,status:"completed",scenarioCount:s.scenarios.length,caseCount:W(s),refineHint:h.refineHint,saveHint:h.saveHint,suiteDir:o.suiteDir}),0}let i=t.op==="refine",f,a;if(i){let s;try{s=await l.attach(t.reqId)}catch(o){return r.onError(o.message),2}if(a=s.state,g=a.requestId,a.error)return r.onError(a.error),2;let m;try{m=await _({promptText:t.objective,filePaths:t.files??[],cwd:p,scenarios:a.scenarios,isRefine:!0,conn:u,deps:v})}catch(o){if(o instanceof C){for(let h of o.errors)r.onError(h);return 2}return r.onError(o.message),2}for(let o of m.warnings)process.stderr.write(`warning: ${o}
19
+ `)}};import{createHash as ee}from"crypto";function te(t){return ee("sha1").update(JSON.stringify({t:t.title,p:t.preconditions,m:t.manual_steps})).digest("hex")}function re(t){let e=[];for(let n of t.scenarios)for(let r of n.test_cases??[])I(r)&&r.manual_steps!=null&&e.push(r);return e}async function ne(t,e,n){let r=new Array(t.length),l=0,u=Array.from({length:Math.min(e,t.length)},async()=>{for(;;){let d=l++;if(d>=t.length)return;try{r[d]={ok:!0,value:await n(t[d])}}catch{r[d]={ok:!1}}}});return await Promise.all(u),r}async function Y(t,e,n){let r=re(t),l=n.run??(async(c,s)=>{let m=await n.resolveAuth(),o=U({objective:c,model:n.model,sessionId:n.sessionId,auth:m});return F(o,n.spawnOpts,s)}),u=r.map(te),d=[...new Set(u)],g=new Map;d.forEach(c=>{g.set(c,r[u.indexOf(c)])});let p=d.map(c=>g.get(c)),v=await ne(p,n.concurrency??3,c=>l(L(c))),i=new Map;d.forEach((c,s)=>{let m=v[s];m.ok&&i.set(c,m.value)});let f=new Map;r.forEach((c,s)=>{f.set(c.id,i.get(u[s]))});let a=0;for(let c of t.scenarios)for(let s of c.test_cases??[])I(s)&&!f.get(s.id)&&a++;let w=c=>{let s=f.get(c.id);return s?N(s,c):M(c)};return{...await B(t,e,{suiteName:n.suiteName,redirectBareCwd:!1},w),fellBack:a}}function Pe(t,e){let n=!!t.agent||!!t.refine||!!t.save||!e,r=t.agent?"agent":"plain";return{headless:n,mode:r}}function $e(t){return t.refine&&t.save?{error:"use --refine or --save, not both"}:t.save?t.objective?{error:"--save takes no objective; use --refine to add to a request"}:t.req?{op:"save"}:{error:"--save requires --req <id>"}:t.refine?t.req?t.objective?t.out?{error:"--out is only valid with --save"}:{op:"refine"}:{error:"--refine needs a refinement objective"}:{error:"--refine requires --req <id>"}:t.req?{error:"--req requires --refine or --save"}:t.out?{error:"--out is only valid with --save"}:t.objective?{op:"new"}:{error:"provide an objective, or use --refine/--save with --req"}}function ie(){return se(process.cwd(),".testmuai","tests")}function Ge(t){if(typeof t!="string")return;let e=t.split(",").map(n=>n.trim()).filter(Boolean);return e.length?e:void 0}var X="tcg-generate-headless";function Q(t){return{refineHint:`kane-cli generate "<refinement>" --refine --req ${t}`,saveHint:`kane-cli generate --save --req ${t}`}}function W(t){return t.scenarios.reduce((e,n)=>e+(n.test_cases?.length??0),0)}function oe(t){return t==="completed"?0:t==="stopped"?3:1}async function Ne(t,e){let n=e.write??(i=>process.stdout.write(i)),r=e.sink??(e.mode==="agent"?new y(n):new S(n)),l,u,d=null;try{let i=await e.makeClient();l=i.client,u=i.conn,d=i.autoDefaulted}catch(i){return r.onError(i.message),2}if(e.mode==="agent"&&d){let{buildAutoDefaultedNdjson:i}=await import("./require-project-folder-XSBJGIVF.js");n(i(d))}try{let i=await(e.checkUpdate??J)();i&&r.onUpdateAvailable(i)}catch{}let g=t.reqId??null;x(X,()=>{g&&l.cancel(g).catch(()=>{})});let p=process.cwd(),v={validate:e.validate??z,upload:e.upload??O,buildMappings:K,onUpload:i=>r.onUpload(i)};try{if(t.op==="save"){let s;try{s=(await l.attach(t.reqId)).state}catch(D){return r.onError(D.message),2}g=s.requestId,r.onSnapshot(s);let m=t.outDir??ie(),o=await e.materialize(s,m,t.suiteName);r.onSaveResult({suiteDir:o.suiteDir,saved:o.paths.length,fellBack:o.fellBack,warning:o.warning});let h=Q(s.requestId);return r.onDone({requestId:s.requestId,status:"completed",scenarioCount:s.scenarios.length,caseCount:W(s),refineHint:h.refineHint,saveHint:h.saveHint,suiteDir:o.suiteDir}),0}let i=t.op==="refine",f,a;if(i){let s;try{s=await l.attach(t.reqId)}catch(o){return r.onError(o.message),2}if(a=s.state,g=a.requestId,a.error)return r.onError(a.error),2;let m;try{m=await _({promptText:t.objective,filePaths:t.files??[],cwd:p,scenarios:a.scenarios,isRefine:!0,conn:u,deps:v})}catch(o){if(o instanceof C){for(let h of o.errors)r.onError(h);return 2}return r.onError(o.message),2}for(let o of m.warnings)process.stderr.write(`warning: ${o}
20
20
  `);r.onStart({requestId:a.requestId,objectiveChars:m.promptText.length,scenarioLimit:t.scenarioLimit,perScenarioLimit:t.perScenarioLimit,isRefine:!0});try{await l.chat(t.reqId,m.promptText,{mappings:m.mappings,attachments:m.attachments})}catch(o){return r.onError(o.message),2}f=s.events}else{let s;try{s=await _({promptText:t.objective,filePaths:t.files??[],cwd:p,scenarios:[],isRefine:!1,conn:u,deps:v})}catch(o){if(o instanceof C){for(let h of o.errors)r.onError(h);return 2}return r.onError(o.message),2}for(let o of s.warnings)process.stderr.write(`warning: ${o}
21
21
  `);let m;try{m=await l.start({prompt:s.promptText,attachments:s.attachments,scenarioLimit:t.scenarioLimit,perScenarioLimit:t.perScenarioLimit,memoryEnhancement:t.memory})}catch(o){return r.onError(o.message),2}a=m.state,g=a.requestId,r.onStart({requestId:a.requestId,objectiveChars:s.promptText.length,scenarioLimit:t.scenarioLimit,perScenarioLimit:t.perScenarioLimit,isRefine:!1}),f=m.events}let w="";for await(let s of f){switch(a=P(a,s),s.type){case"thinking_done":r.onThinking({tookMs:s.tookMs});break;case"progress":r.onProgress(s.pct);break;case"clarification":r.onClarification(s.text);break;case"chat":r.onChat(s.text);break;case"error":r.onError(s.message);break;case"done":w=s.status;break;default:break}if(s.type==="done"||s.type!=="thinking"&&a.status&&T(a.status))break}r.onSnapshot(a);let b=w||a.status||"completed",c=Q(a.requestId);return r.onDone({requestId:a.requestId,status:b,scenarioCount:a.scenarios.length,caseCount:W(a),refineHint:c.refineHint,saveHint:c.saveHint,suiteDir:void 0}),oe(b)}finally{A(X)}}var ae=()=>{};async function Me(t){let e=new j,n=new q,r=e.getActiveProfile()??"default",l=t.env??e.getDefaultEnv()??"prod",u=R(l),d=new E;t.name&&d.setSessionName(t.name);let g=n.load().model,p=async()=>{let i=await k({creds:e,env:l,usernameFlag:t.username,accessKeyFlag:t.accessKey,log:()=>{}}),f=await V({resolver:i.resolver,env:u,log:ae,projectId:t.projectId,folderId:t.folderId,autoResolve:t.projectId?void 0:{creds:e,config:n,profile:r,envName:l}});return{client:G(f),conn:f,autoDefaulted:f.autoDefaulted??null}},v=async()=>{let i=await k({creds:e,env:l,usernameFlag:t.username,accessKeyFlag:t.accessKey,log:()=>{}});return i.basicAuth?{username:i.basicAuth.username,access_key:i.basicAuth.access_key}:i.token?{auth:{type:"bearer",token:i.token}}:{}};return{mode:t.mode,makeClient:p,materialize:(i,f,a)=>Y(i,f,{model:g,sessionId:d.sessionId,resolveAuth:v,spawnOpts:{environment:l},suiteName:a})}}export{Me as buildHeadlessDeps,Pe as decideGenerateMode,ie as defaultOutDir,Ge as parseFilesFlag,$e as resolveGenerateOp,Ne as runGenerateHeadless};