@capagents/forgeqe 2.7.5 → 2.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/HOW_TO_USE.md +23 -0
  2. package/dist/docs-site/docs/index.html +17 -0
  3. package/dist/docs-site/docs/search.js +1 -1
  4. package/dist/forgeqe.js +1562 -1555
  5. package/dist/web/assets/Agent-BfZX7pM9.js +4 -0
  6. package/dist/web/assets/ApiTests-l_CkazdD.js +10 -0
  7. package/dist/web/assets/{Chat-DzcXQtRU.js → Chat-BSUVZdh2.js} +3 -3
  8. package/dist/web/assets/{CommandPalette-BPUcuL1R.js → CommandPalette-Ckz1AQJT.js} +1 -1
  9. package/dist/web/assets/{Data-ZQmWEw-T.js → Data-Ig_7x4WD.js} +3 -3
  10. package/dist/web/assets/Evidence-DsllYNNx.js +1 -0
  11. package/dist/web/assets/Features-IqPqXkST.js +1 -0
  12. package/dist/web/assets/{ForceGraph-oAsEGwQc.js → ForceGraph-CiIze1T6.js} +1 -1
  13. package/dist/web/assets/Impact-CLjFt7ih.js +1 -0
  14. package/dist/web/assets/Jobs-F4TIPvJk.js +5 -0
  15. package/dist/web/assets/KindPage-Dq6eGmG4.js +6 -0
  16. package/dist/web/assets/Migration-Cg6Cm_Gu.js +2 -0
  17. package/dist/web/assets/{Product-DE2i4GjQ.js → Product-osDkLGGT.js} +2 -2
  18. package/dist/web/assets/{Quality-BPS1A75g.js → Quality-BaX3Y0fL.js} +1 -1
  19. package/dist/web/assets/Record-CkGdISSf.js +2 -0
  20. package/dist/web/assets/{Regression-krYLUFdO.js → Regression-CpQr6snz.js} +3 -3
  21. package/dist/web/assets/{Reports-Bl3L0zPe.js → Reports-W8H8OB95.js} +2 -2
  22. package/dist/web/assets/{Response-C66KATyo.js → Response-B4iQEi_e.js} +2 -2
  23. package/dist/web/assets/Runs-Cl9PEJRv.js +2 -0
  24. package/dist/web/assets/Shell-8Y6stc_6.js +4 -0
  25. package/dist/web/assets/TestCases-th8t2FcZ.js +1 -0
  26. package/dist/web/assets/TestData-B3UImTlO.js +2 -0
  27. package/dist/web/assets/Tosca-Cu9NyPOL.js +2 -0
  28. package/dist/web/assets/{WhatsNew-Cix_kO-M.js → WhatsNew-CpysE5Dt.js} +1 -1
  29. package/dist/web/assets/{dataParts-DGQaavWq.js → dataParts-D_SP2_Pw.js} +2 -2
  30. package/dist/web/assets/{families-DWe5Tf6V.js → families-BGEp9m2k.js} +1 -1
  31. package/dist/web/assets/index-DuWTO5cE.js +45 -0
  32. package/dist/web/assets/index-X6LBvWis.css +2 -0
  33. package/dist/web/assets/{logos-UHk_LNd_.js → logos-C0_O1u21.js} +1 -1
  34. package/dist/web/assets/{parts-6yv4V1GV.js → parts-ByBgA7Hv.js} +1 -1
  35. package/dist/web/assets/{productParts-DlC0tpuk.js → productParts-BFrJx-M5.js} +1 -1
  36. package/dist/web/assets/{qualityParts-BSTx-oHr.js → qualityParts-BNNpjvm6.js} +1 -1
  37. package/dist/web/assets/{segmented-7nur8ck_.js → segmented-CD8WWurO.js} +1 -1
  38. package/dist/web/assets/{thread-RtF8vcSJ.js → thread-Dy_QsQDd.js} +1 -1
  39. package/dist/web/assets/{usePageChat-Btkpy-DG.js → usePageChat-DhO0cBVa.js} +1 -1
  40. package/dist/web/index.html +3 -3
  41. package/docs/user-guide.html +17 -0
  42. package/package.json +1 -1
  43. package/py/forgeqe_engine/cli.py +3 -0
  44. package/py/forgeqe_engine/logins.py +74 -0
  45. package/py/forgeqe_engine/neutral_log.py +61 -0
  46. package/py/forgeqe_engine/service.py +3 -1
  47. package/py/forgeqe_mobile/appium_driver.py +5 -0
  48. package/py/forgeqe_mobile/explore.py +23 -2
  49. package/dist/web/assets/Agent-DX2q9LmG.js +0 -4
  50. package/dist/web/assets/ApiTests-Cup02reL.js +0 -10
  51. package/dist/web/assets/Evidence-B6VB0N8L.js +0 -1
  52. package/dist/web/assets/Features-jvyThbaa.js +0 -1
  53. package/dist/web/assets/Impact-BWERCZIN.js +0 -1
  54. package/dist/web/assets/Jobs-bbs9Yh-0.js +0 -5
  55. package/dist/web/assets/KindPage-E4XiuZKL.js +0 -6
  56. package/dist/web/assets/Migration-CQmzKn1a.js +0 -2
  57. package/dist/web/assets/Record-Ch5qKyuS.js +0 -2
  58. package/dist/web/assets/Runs-Bq23Zfkc.js +0 -2
  59. package/dist/web/assets/Shell-2xDxqPtD.js +0 -4
  60. package/dist/web/assets/TestCases-DvusfxET.js +0 -1
  61. package/dist/web/assets/TestData-Y9MWzPfm.js +0 -2
  62. package/dist/web/assets/Tosca-DPI6ewM-.js +0 -2
  63. package/dist/web/assets/index-CAbuIKyt.js +0 -45
  64. package/dist/web/assets/index-Dj77NVTf.css +0 -2
@@ -1,2 +0,0 @@
1
- import{$ as e,$t as t,At as n,Bi as r,Cn as i,Dn as a,Dt as o,Et as s,Gn as c,Ha as l,Mi as u,Nt as d,Q as f,Si as p,Tn as m,Zi as h,Zt as g,ao as _,ba as v,br as y,co as b,ct as x,dt as S,ea as C,fa as w,gi as T,gt as E,hr as D,ht as O,it as k,kt as A,lr as ee,lt as j,mt as M,n as N,on as P,ro as F,rt as I,sn as L,tn as R,ut as z,wr as te,xi as B,yi as ne}from"./Shell-2xDxqPtD.js";import{d as V,l as H,o as re,r as U,s as W}from"./index-CAbuIKyt.js";import{t as G}from"./segmented-7nur8ck_.js";import{n as ie}from"./families-DWe5Tf6V.js";import{a as ae,c as oe,i as se,n as ce,o as K,r as le,s as q,t as ue}from"./logos-UHk_LNd_.js";import{a as de,c as fe,d as pe,f as J,i as me,l as he,n as ge,o as _e,p as ve,r as Y,s as ye,t as be,u as xe}from"./parts-6yv4V1GV.js";var X=b(_(),1),Z=F(),Se={py:`python`,ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,java:`java`,cs:`csharp`,rb:`ruby`};function Ce({path:e}){let t=le[Se[e.split(`.`).pop()?.toLowerCase()||``]||``];return t?(0,Z.jsx)(t,{"aria-hidden":`true`,width:15,height:15,className:`flex-none`}):(0,Z.jsx)(D,{size:15,"aria-hidden":`true`,className:`flex-none text-muted`})}function we(e){let t={name:``,path:``,dirs:new Map,files:[]};for(let n of e){let e=n.path.split(`/`),r=t;for(let t of e.slice(0,-1))r.dirs.has(t)||r.dirs.set(t,{name:t,path:r.path?`${r.path}/${t}`:t,dirs:new Map,files:[]}),r=r.dirs.get(t);r.files.push(n)}let n=e=>{for(let[t,r]of[...e.dirs]){let i=n(r);for(;i.files.length===0&&i.dirs.size===1;){let e=[...i.dirs.values()][0];i={...e,name:`${i.name}/${e.name}`}}e.dirs.set(t,i)}return e};return n(t)}function Te({files:e,selected:t,onSelect:n,label:r}){let i=(0,X.useMemo)(()=>we(e),[e]),[o,s]=(0,X.useState)(new Set),c=e=>s(t=>t.has(e)?new Set([...t].filter(t=>t!==e)):new Set([...t,e])),l=(e,r)=>(0,Z.jsxs)(Z.Fragment,{children:[[...e.dirs.values()].sort((e,t)=>e.name.localeCompare(t.name)).map(e=>{let t=!o.has(e.path);return(0,Z.jsxs)(`li`,{role:`treeitem`,"aria-expanded":t,"aria-selected":!1,className:`list-none`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>c(e.path),className:`flex h-8 w-full cursor-pointer items-center gap-1.5 rounded-[6px] border-0 bg-transparent px-1.5 text-left text-[13px] text-ink hover:bg-surface-strong`,children:[(0,Z.jsx)(a,{size:14,"aria-hidden":`true`,className:R(`flex-none text-muted transition-transform duration-150`,t&&`rotate-90`)}),t?(0,Z.jsx)(te,{size:15,"aria-hidden":`true`,className:`flex-none text-accent-fg`}):(0,Z.jsx)(y,{size:15,"aria-hidden":`true`,className:`flex-none text-accent-fg`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.name})]}),t&&(0,Z.jsx)(`ul`,{role:`group`,className:`m-0 ml-[13px] border-l border-line-soft p-0 pl-2`,children:l(e,r+1)})]},e.path)}),[...e.files].sort((e,t)=>e.path.localeCompare(t.path)).map(e=>{let r=t===e.id;return(0,Z.jsx)(`li`,{role:`treeitem`,"aria-selected":r,className:`list-none`,children:(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>n?.(e.id),"data-tip":e.title,className:R(`flex h-8 w-full items-center gap-2 rounded-[6px] border-0 px-1.5 text-left text-[13px]`,n?`cursor-pointer`:`cursor-default`,r?`bg-accent-soft font-medium text-ink`:`bg-transparent text-ink-2 hover:bg-surface-strong hover:text-ink`),children:[(0,Z.jsx)(`span`,{className:`w-[14px] flex-none`,"aria-hidden":`true`}),(0,Z.jsx)(Ce,{path:e.path}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.path.slice(e.path.lastIndexOf(`/`)+1)}),e.tail]})},e.id)})]});return(0,Z.jsx)(`ul`,{role:`tree`,"aria-label":r,className:`m-0 flex flex-col p-0`,children:l(i,0)})}function Ee({title:e,side:t,file:n,lang:r,text:i,missing:a}){let o=(i??``).split(`
2
- `),s=(0,X.useMemo)(()=>i?V(i,r):null,[i,r]);return(0,Z.jsxs)(`figure`,{className:`m-0 flex min-h-0 min-w-0 flex-col overflow-hidden rounded-[12px] card border`,children:[(0,Z.jsxs)(`figcaption`,{className:`flex min-h-10 items-center gap-2 border-b border-line-soft pr-1 pl-3`,children:[(0,Z.jsx)(`span`,{className:`text-[11px] font-semibold tracking-[0.04em] text-muted uppercase`,children:t}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12px] text-ink-2`,"data-tip":n,children:n||e}),i&&(0,Z.jsx)(W,{text:i,label:`Copy ${n||t}`})]}),i?(0,Z.jsxs)(`div`,{className:`flex min-h-[260px] flex-1 overflow-auto font-mono text-[12.5px] leading-[1.6]`,children:[(0,Z.jsx)(`pre`,{"aria-hidden":`true`,className:`m-0 min-h-full flex-none self-stretch border-r border-line-soft px-3 py-3 text-right text-muted select-none`,children:o.map((e,t)=>`${t+1}\n`).join(``)}),(0,Z.jsx)(`pre`,{className:`m-0 min-w-0 flex-1 px-3 py-3`,children:(0,Z.jsx)(`code`,{className:`hljs`,children:s})})]}):(0,Z.jsx)(`p`,{className:`m-0 flex min-h-[260px] flex-1 items-center justify-center px-4 text-center text-sm text-muted`,children:a||`Nothing to show.`})]})}function De({id:e,plan:t,result:n,initial:r}){let i=new Map((n?.units||[]).map(e=>[e.id,e.status])),a=[...t.units.filter(e=>e.kind!==`setup`).map(e=>({unit:e.id,kind:ge[e.kind],source:e.source,target:e.target,status:i.get(e.id)})),...t.copies.map((e,t)=>({unit:`c${t}`,kind:`Data`,source:e.source,target:e.target,data:!0}))],[o,s]=(0,X.useState)(``),[c,u]=(0,X.useState)(r||a.find(e=>e.kind===`Test`)?.unit||a[0]?.unit||``),[d,f]=(0,X.useState)(null),[p,m]=(0,X.useState)(``);(0,X.useEffect)(()=>{c&&(m(``),l.pair(e,c).then(f,e=>m(e.message)))},[e,c,n?.units.length,n?.endedAt]);let h=a.filter(e=>!o||`${e.source} ${e.target}`.toLowerCase().includes(o.toLowerCase())),g=a.filter(e=>e.status===`migrated`).length,_=a.filter(e=>e.status===`failed`||e.status===`blocked`).length;return(0,Z.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] gap-4 @4xl:h-[calc(100vh-320px)] @4xl:min-h-[540px] @4xl:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`nav`,{"aria-label":`Files`,className:`flex max-h-[360px] min-h-0 min-w-0 flex-col gap-2 overflow-hidden rounded-[14px] card border p-3 @4xl:max-h-none`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5 px-1`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-semibold`,children:`Files`}),(0,Z.jsxs)(`span`,{className:`text-[12px] text-muted`,children:[g,` migrated · `,_,` failed · `,a.length,` files`]})]}),(0,Z.jsx)(x,{id:`find-a-file`,label:`Find a file`,value:o,onChange:s,className:`max-w-none flex-none`}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:h.length?(0,Z.jsx)(Te,{label:`Files`,selected:c,onSelect:u,files:h.map(e=>({id:e.unit,path:e.target,title:e.source?`from ${e.source}`:void 0,tail:(0,Z.jsx)(`span`,{role:`img`,"aria-label":e.status?fe[e.status].label:e.data?`Copied`:`Waiting`,className:R(`size-2 flex-none rounded-full`,e.status===`migrated`?`bg-pass`:e.status===`failed`?`bg-fail`:e.status===`blocked`?`bg-warn`:e.status===`written`?`bg-line-strong`:`bg-line`)})}))}):(0,Z.jsx)(`p`,{className:`m-0 px-2 py-3 text-[13px] text-muted`,children:`No file matches.`})})]}),(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col gap-3`,children:[p&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:p}),(0,Z.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[minmax(0,1fr)] gap-3 @3xl:grid-cols-2`,children:[(0,Z.jsx)(Ee,{title:`Source`,side:`Source`,file:d?.source?.path,lang:d?.source?.lang||`plaintext`,text:d?.source?.text,missing:d&&!d.source?`This file is made new for the target.`:void 0}),(0,Z.jsx)(Ee,{title:`Target`,side:`Migrated`,file:d?.target.path,lang:d?.target.lang||`plaintext`,text:d?.target.text,missing:d&&!d.target.exists?`Not written yet.`:void 0})]})]})]})}var Oe=[`prepare`,`setup`,`migrate`,`validate`,`fix`,`review`];function ke(e){if(e.job?.running)return{label:e.job.kind===`verify`?`Validating`:e.job.kind===`fix`?`Fixing`:`Running`,tone:`running`};let t=e.result;return t?.status===`running`?{label:t.stage===`validate`?`Validating`:t.stage===`fix`?`Fixing`:`Running`,tone:`running`}:t?me[t.status]:e.job?.last?{label:`Did not start`,tone:`fail`}:e.confirmed?{label:`Confirmed`,tone:`neutral`}:he[e.plan.feasibility.verdict]}var Q=e=>e.slice(e.lastIndexOf(`/`)+1);function Ae({d:t,planView:n}){let r=t.result;if(!r)return(0,Z.jsx)(Z.Fragment,{children:n});let i=new Map(r.units.map(e=>[e.id,e])),a=t.plan.units.filter(e=>e.kind===`test`),o=r.units.filter(e=>e.kind===`test`&&e.status===`migrated`).length,s=t.plan.units.filter(e=>e.kind!==`setup`),c=r.units.filter(e=>e.kind!==`setup`&&(e.status===`migrated`||e.status===`written`)).length,l=r.units.filter(e=>e.status===`failed`||e.status===`blocked`).length,u=t.plan.source.stack,[d,...p]=t.plan.target.id.split(`-`);return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Z.jsxs)(_e,{children:[(0,Z.jsx)(Y,{label:`Tests passing`,value:`${o} / ${a.length}`,tone:o===a.length&&a.length?`text-pass`:void 0}),(0,Z.jsx)(Y,{label:`Files migrated`,value:`${c} / ${s.length}`}),(0,Z.jsx)(Y,{label:`Need attention`,value:l,tone:l?`text-fail`:void 0}),(0,Z.jsx)(Y,{label:r.status===`running`?`Running for`:`Took`,value:pe(r.status===`running`?Date.now()-Date.parse(r.startedAt):r.ms)})]}),r.notes&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:r.notes}),(0,Z.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-5 @5xl:grid-cols-[minmax(0,1fr)_320px]`,children:[(0,Z.jsx)(f,{label:`Files`,placeholder:`Find a file`,empty:`No files.`,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:`py-2 pr-3 pl-3 font-medium`,children:`File`}),(0,Z.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:`Status`}),(0,Z.jsx)(`th`,{className:`hidden py-2 pr-3 font-medium @3xl:table-cell`,children:`Note`})]}),children:t.plan.units.map(t=>{let n=i.get(t.id),r=n?fe[n.status]:null;return(0,Z.jsxs)(`tr`,{className:I,children:[(0,Z.jsxs)(`td`,{className:e,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:t.kind===`setup`?`Project set-up`:Q(t.target)}),(0,Z.jsx)(`span`,{className:`block text-[12px] text-muted`,children:t.source?`from ${Q(t.source)}`:t.target})]}),(0,Z.jsx)(`td`,{className:R(e,`whitespace-nowrap`),children:r?(0,Z.jsx)(M,{tone:r.tone,children:r.label}):(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Waiting`})}),(0,Z.jsx)(`td`,{className:R(e,`hidden text-[13px] text-ink-2 @3xl:table-cell`),children:(0,Z.jsx)(`span`,{className:`line-clamp-2`,children:n?.problems?.[0]||n?.reason||``})})]},t.id)})}),(0,Z.jsxs)(`aside`,{"aria-label":`Details`,className:`flex flex-col gap-4 rounded-[14px] card border p-5 text-sm`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:`From`}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[u&&(0,Z.jsx)(q,{framework:u.framework,language:u.language}),t.plan.source.title]}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-ink-2`,children:[(0,Z.jsx)(K,{kind:t.origin.kind,label:t.origin.label,size:15}),(0,Z.jsxs)(`span`,{className:`truncate`,"data-tip":t.origin.label,children:[J(t.origin.label),t.origin.branch?` · ${t.origin.branch}`:``]})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-line-soft pt-4`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:`To`}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,Z.jsx)(q,{framework:d,language:p.join(`-`)}),t.plan.target.title]}),(0,Z.jsx)(`span`,{className:`font-mono text-[12px] text-ink-2 [overflow-wrap:anywhere]`,children:t.targetPath})]}),(0,Z.jsxs)(`dl`,{className:`m-0 grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 border-t border-line-soft pt-4`,children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Started`}),(0,Z.jsx)(`dd`,{className:`m-0 text-right`,children:ve(r.startedAt)}),r.model&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Agent`}),(0,Z.jsx)(`dd`,{className:`m-0 truncate text-right`,"data-tip":r.model,children:r.model})]}),r.reverted.length>0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Put back`}),(0,Z.jsxs)(`dd`,{className:`m-0 text-right`,children:[r.reverted.length,` edits outside the target`]})]})]})]})]})]})}function je({d:e,events:t,picked:n,setPicked:r,busy:i,working:a,onFix:o,onCheck:s}){let[c,l]=(0,X.useState)(``),f=(0,X.useRef)(null),p=e.result?.validation?.tests||[],m=p.filter(e=>!e.ok),h=[];for(let t of e.result?.fixes||[])t.auto||h.push({who:`you`,text:t.note?`${t.note}`:`Fix ${Q(t.target)}`,at:t.at,detail:t.note?`for ${Q(t.target)}`:void 0}),h.push({who:`agent`,tone:t.ok?`ok`:`fail`,at:t.at,text:t.ok?`${Q(t.target)} passes now${t.attempts>1?` (${t.attempts} tries)`:``}. ${t.reason||``}`.trim():`I could not make ${Q(t.target)} pass. ${t.problems?.[0]||t.reason||``}`.trim(),detail:t.auto?`after the first check`:void 0});let _=a?t.filter(e=>e.stage===`fix`&&(e.kind===`agent`||e.kind===`ok`||e.kind===`fail`||e.kind===`info`)).slice(-6):[];(0,X.useEffect)(()=>{f.current&&(f.current.scrollTop=f.current.scrollHeight)},[h.length,_.length]);let v=()=>{let e=[...n];e.length&&(o(e,c.trim()),l(``))},y=e=>{let t=new Set(n);t.has(e)?t.delete(e):t.add(e),r(t)};return(0,Z.jsxs)(`section`,{"aria-label":`Migration agent`,className:`flex h-[560px] min-h-0 min-w-0 flex-col overflow-hidden rounded-[14px] card border @5xl:h-full`,children:[(0,Z.jsxs)(`header`,{className:`flex items-center gap-3 border-b border-line-soft px-4 py-3`,children:[(0,Z.jsx)(d,{agent:`forgeqe-migrate`,px:28,working:a,decorative:!0}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-semibold`,children:`Migration agent`}),(0,Z.jsx)(`span`,{className:`text-[12px] text-muted`,children:a?`Working on it…`:m.length?`${m.length} test${m.length===1?``:`s`} to fix`:`Every test passes`})]}),(0,Z.jsxs)(g,{size:`sm`,variant:`ghost`,disabled:i,onClick:s,"data-tip":`Run every migrated test again`,children:[(0,Z.jsx)(B,{"aria-hidden":`true`}),`Run tests`]})]}),(0,Z.jsxs)(`ol`,{ref:f,"aria-live":`polite`,className:`m-0 flex min-h-0 flex-1 list-none flex-col gap-3 overflow-y-auto bg-surface-muted p-4`,children:[!h.length&&!_.length&&(0,Z.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-[12px] bg-bg p-3 text-[13px] text-ink-2`,children:[(0,Z.jsx)(`span`,{children:`I fix migrated tests that fail. Pick the tests below and tell me what you know, or just send.`}),m.length>0&&(0,Z.jsx)(`button`,{type:`button`,disabled:i,onClick:()=>o(m.map(e=>e.id),``),className:`self-start rounded-[8px] border-0 bg-surface-strong px-2.5 py-1.5 text-[13px] font-medium text-ink hover:bg-line disabled:opacity-50`,children:`Fix all failing tests`})]}),h.map((e,t)=>(0,Z.jsxs)(`li`,{className:R(`flex max-w-[92%] flex-col gap-1`,e.who===`you`?`self-end items-end`:`self-start`),children:[(0,Z.jsxs)(`span`,{className:R(`rounded-[12px] px-3 py-2 text-[13px] leading-relaxed [overflow-wrap:anywhere]`,e.who===`you`?`bg-accent text-accent-ink`:e.tone===`fail`?`border border-fail-soft bg-bg text-ink`:`bg-bg text-ink`),children:[e.who===`agent`&&(0,Z.jsx)(`span`,{className:R(`mr-1 font-semibold`,e.tone===`ok`?`text-pass`:`text-fail`),children:e.tone===`ok`?`✓`:`✗`}),e.text]}),(0,Z.jsxs)(`span`,{className:`text-[11px] text-muted`,children:[e.detail?`${e.detail} · `:``,U(e.at)]})]},t)),_.map((e,t)=>(0,Z.jsxs)(`li`,{className:`flex max-w-[92%] items-start gap-2 self-start rounded-[12px] bg-bg px-3 py-2 text-[13px] text-ink-2`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:R(`flex-none`,e.kind===`ok`?`text-pass`:e.kind===`fail`?`text-fail`:`text-muted`),children:e.kind===`ok`?`✓`:e.kind===`fail`?`✗`:`•`}),(0,Z.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.text})]},`live-${t}`))]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2.5 border-t border-line-soft p-3`,children:[p.length>0&&(0,Z.jsx)(`div`,{role:`group`,"aria-label":`Tests to fix`,className:`flex flex-wrap gap-1.5`,children:p.map(e=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":n.has(e.id),onClick:()=>y(e.id),className:R(`inline-flex min-h-7 items-center gap-1.5 rounded-full border px-2.5 text-[12px]`,n.has(e.id)?`border-accent bg-accent-soft text-ink`:`border-line-soft bg-bg text-ink-2 hover:bg-surface-muted`),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:R(`size-1.5 rounded-full`,e.ok?`bg-pass`:`bg-fail`)}),Q(e.target)]},e.id))}),(0,Z.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,Z.jsx)(S,{"aria-label":`Message to the agent`,value:c,rows:2,maxLength:2e3,placeholder:n.size?`What should change? (optional)`:`Pick a test above first`,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!i&&n.size&&(e.preventDefault(),v())},className:`min-h-[44px] flex-1 resize-none`}),(0,Z.jsx)(g,{variant:`primary`,size:`icon`,"aria-label":`Send to the agent`,disabled:i||!n.size,onClick:v,children:(0,Z.jsx)(u,{"aria-hidden":`true`})})]})]})]})}var Me=`@5xl:h-[calc(100vh-320px)] @5xl:min-h-[540px]`;function Ne({d:e,events:t,busy:n,working:r,onFix:i,onCheck:a,onCompare:o}){let s=e.result?.validation?.tests||[],l=e.result?.fixes||[],u=s.filter(e=>!e.ok).map(e=>e.id).join(`,`),[d,f]=(0,X.useState)(()=>s.find(e=>!e.ok)?.id||s[0]?.id||``),[p,m]=(0,X.useState)(()=>new Set(s.filter(e=>!e.ok).map(e=>e.id)));(0,X.useEffect)(()=>m(new Set(u?u.split(`,`):[])),[u]);let h=s.find(e=>e.id===d),_=h&&[...l].reverse().find(e=>e.id===h.id);return s.length?(0,Z.jsxs)(`div`,{className:R(`grid grid-cols-[minmax(0,1fr)] gap-5 @5xl:grid-cols-[minmax(0,1fr)_380px]`,Me),children:[(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col gap-4`,children:[(0,Z.jsx)(`div`,{className:`relative flex-none overflow-x-auto rounded-[12px] card border`,children:(0,Z.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,Z.jsx)(`thead`,{className:`bg-surface-strong text-left text-[12px] text-muted`,children:(0,Z.jsxs)(`tr`,{children:[(0,Z.jsxs)(`th`,{className:`px-4 py-2.5 font-medium`,children:[`Test `,(0,Z.jsxs)(`span`,{className:`font-normal`,children:[`· `,s.filter(e=>e.ok).length,` of `,s.length,` pass`]})]}),(0,Z.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:`Result`}),(0,Z.jsx)(`th`,{className:`hidden px-3 py-2.5 font-medium @2xl:table-cell`,children:`Kept from the source`}),(0,Z.jsx)(`th`,{className:`hidden px-3 py-2.5 text-right font-medium @3xl:table-cell`,children:`Time`})]})}),(0,Z.jsx)(`tbody`,{children:s.map(e=>{let t=[...l].reverse().find(t=>t.id===e.id);return(0,Z.jsxs)(`tr`,{onClick:()=>f(e.id),"aria-selected":d===e.id,className:R(`cursor-pointer border-t border-line-soft`,d===e.id?`bg-accent-soft`:`hover:bg-surface-muted`),children:[(0,Z.jsxs)(`td`,{className:`px-4 py-2.5`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>f(e.id),className:`cursor-pointer border-0 bg-transparent p-0 text-left font-medium text-ink`,children:Q(e.target)}),t&&(0,Z.jsx)(`span`,{className:R(`block text-[12px]`,t.ok?`text-pass`:`text-muted`),children:t.ok?`Fixed by the agent`:`The agent could not fix it`})]}),(0,Z.jsx)(`td`,{className:`px-3 py-2.5 whitespace-nowrap`,children:(0,Z.jsx)(M,{tone:e.ok?`pass`:`fail`,children:e.ok?`Passes`:`Fails`})}),(0,Z.jsxs)(`td`,{className:`hidden px-3 py-2.5 text-[13px] whitespace-nowrap text-ink-2 @2xl:table-cell`,children:[(0,Z.jsxs)(`span`,{className:e.after.tests<e.before.tests?`text-fail`:void 0,children:[e.after.tests,`/`,e.before.tests,` tests`]}),` · `,(0,Z.jsxs)(`span`,{className:e.after.assertions<e.before.assertions?`text-warn`:void 0,children:[e.after.assertions,`/`,e.before.assertions,` checks`]})]}),(0,Z.jsx)(`td`,{className:`hidden px-3 py-2.5 text-right text-[13px] text-muted tabular-nums @3xl:table-cell`,children:e.ms?pe(e.ms):`–`})]},e.id)})})]})}),h&&(0,Z.jsxs)(`section`,{"aria-label":`${Q(h.target)} details`,className:`flex min-h-[260px] flex-1 flex-col overflow-hidden rounded-[12px] card border`,children:[(0,Z.jsxs)(`header`,{className:`flex flex-wrap items-center gap-2 border-b border-line-soft px-4 py-2.5`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:Q(h.target)}),(0,Z.jsx)(M,{tone:h.ok?`pass`:`fail`,children:h.ok?`Passes`:h.exitCode===null&&h.ms?`Timed out`:`Fails`}),h.source&&(0,Z.jsxs)(`span`,{className:`text-[12.5px] text-muted`,children:[`from `,Q(h.source)]}),(0,Z.jsx)(`span`,{className:`flex-1`}),(0,Z.jsxs)(g,{size:`sm`,variant:`ghost`,onClick:()=>o(h.id),children:[(0,Z.jsx)(c,{"aria-hidden":`true`}),`Compare`]}),!h.ok&&(0,Z.jsxs)(g,{size:`sm`,disabled:n,onClick:()=>m(new Set([h.id])),children:[(0,Z.jsx)(w,{"aria-hidden":`true`}),`Fix`]})]}),(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto bg-surface-muted px-4 py-3`,children:[h.problems.length>0&&(0,Z.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:h.problems.join(` `)}),_&&(0,Z.jsxs)(`p`,{className:R(`m-0 text-[13px]`,_.ok?`text-pass`:`text-ink-2`),children:[_.ok?`Fixed by the agent`:`The agent could not fix it`,_.reason?`: ${_.reason}`:`.`]}),h.command&&(0,Z.jsxs)(`code`,{className:`block font-mono text-[12px] text-muted`,children:[`$ `,h.command]}),(0,Z.jsx)(`pre`,{className:`m-0 flex-1 font-mono text-[12.5px] leading-relaxed whitespace-pre-wrap text-ink-2`,children:h.output||(h.ok?`${h.after.tests} test${h.after.tests===1?``:`s`} passed in ${pe(h.ms)}.`:`No output.`)})]})]})]}),(0,Z.jsx)(je,{d:e,events:t,picked:p,setPicked:m,busy:n,working:r,onFix:i,onCheck:a})]}):(0,Z.jsx)(O,{center:!0,className:`py-6`,children:e.result?`The tests are checked once every file is migrated.`:`Start the migration first.`})}var Pe={ok:{mark:`✓`,cls:`text-pass`},fail:{mark:`✗`,cls:`text-fail`},info:{mark:`•`,cls:`text-muted`},agent:{mark:`•`,cls:`text-accent-fg`},tool:{mark:`·`,cls:`text-muted`}};function Fe({events:e,running:t}){let n=(0,X.useRef)(null);(0,X.useEffect)(()=>{t&&n.current&&(n.current.scrollTop=n.current.scrollHeight)},[e.length,t]);let r=e.filter(e=>e.kind!==`tool`);return(0,Z.jsxs)(`ol`,{ref:n,"aria-live":t?`polite`:void 0,"aria-label":`Activity`,className:`m-0 flex max-h-[60vh] list-none flex-col overflow-y-auto rounded-[12px] card border p-0`,children:[r.map((e,t)=>(0,Z.jsxs)(`li`,{className:`flex gap-3 border-b border-line-soft px-4 py-2 text-[13px] last:border-b-0`,children:[(0,Z.jsx)(`span`,{className:`w-[64px] flex-none text-[12px] text-muted tabular-nums`,children:new Date(e.ts).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:R(`w-3 flex-none text-center`,Pe[e.kind].cls),children:Pe[e.kind].mark}),(0,Z.jsx)(`span`,{className:R(`min-w-0 flex-1 [overflow-wrap:anywhere]`,e.kind===`fail`?`text-fail`:e.kind===`ok`?`text-ink`:`text-ink-2`),children:e.text})]},t)),!r.length&&(0,Z.jsx)(`li`,{className:`px-4 py-8 text-center text-sm text-muted`,children:`Nothing yet.`})]})}function Ie({id:e,plan:t}){let[i,a]=(0,X.useState)(null),[o,s]=(0,X.useState)(``),[c,u]=(0,X.useState)(`overview`),[d,f]=(0,X.useState)(),[p,m]=(0,X.useState)([]),[h,_]=(0,X.useState)(null),[v,y]=(0,X.useState)(!1),b=(0,X.useRef)(0),x=(0,X.useCallback)(()=>{l.detail(e).then(e=>{a(e),s(``)},e=>s(e.message)),l.events(e,b.current).then(e=>{e.next<b.current?(b.current=0,m([])):(b.current=e.next,e.events.length&&m(t=>[...t,...e.events].slice(-2e3)))},()=>{})},[e]);(0,X.useEffect)(x,[x]);let S=!!(i?.job?.running||i?.result?.status===`running`);(0,X.useEffect)(()=>{if(!S)return;let e=setInterval(x,1500);return()=>clearInterval(e)},[S,x]);let C=async e=>{y(!0),s(``);try{a(await e()),setTimeout(x,800)}catch(e){s(e.message)}finally{y(!1)}};if(!i)return o?(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}):(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`});let w=ke(i),T=xe(i.plan,i.result),E=i.result,D=(E?.validation?.tests||[]).filter(e=>!e.ok).length,O=[{id:`overview`,label:`Overview`},{id:`tests`,label:`Tests`,n:E?.validation?`${E.validation.tests.length-D}/${E.validation.tests.length}`:void 0,tone:D?`text-fail`:void 0},{id:`compare`,label:`Compare`},{id:`activity`,label:`Activity`}];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`a`,{href:n(`migration`),className:`inline-flex items-center gap-1.5 self-start text-sm`,children:[(0,Z.jsx)(P,{size:16,"aria-hidden":`true`}),`Migration`]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 @3xl:flex-row @3xl:items-start`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsxs)(`h2`,{className:`m-0 flex flex-wrap items-center gap-x-2.5 gap-y-1 text-[20px] leading-snug font-semibold tracking-[-0.01em]`,children:[(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[i.plan.source.stack&&(0,Z.jsx)(q,{framework:i.plan.source.stack.framework,language:i.plan.source.stack.language,size:22}),i.plan.source.title]}),(0,Z.jsx)(L,{size:18,"aria-hidden":`true`,className:`text-muted`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`to`}),(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Z.jsx)(q,{framework:i.plan.target.id.split(`-`)[0],language:i.plan.target.id.split(`-`).slice(1).join(`-`),size:20}),i.plan.target.title]})]}),(0,Z.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-1.5 text-sm text-muted`,children:[(0,Z.jsx)(K,{kind:i.origin.kind,label:i.origin.label,size:15}),(0,Z.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:J(i.origin.label)}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Z.jsxs)(`span`,{children:[`into `,(0,Z.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:i.plan.target.dir})]})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(M,{tone:w.tone,children:w.label}),S?(0,Z.jsxs)(g,{variant:`danger`,disabled:v,onClick:()=>void C(()=>l.stop(e)),children:[(0,Z.jsx)(r,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]}):E?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(g,{variant:`ghost`,onClick:()=>l.report(e).then(e=>_(e.text),()=>_(``)),children:`Report`}),(0,Z.jsxs)(g,{disabled:v,onClick:()=>void C(()=>l.verify(e)),children:[(0,Z.jsx)(B,{"aria-hidden":`true`}),`Check again`]})]}):null]})]}),E&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 rounded-[12px] card border px-3 py-2.5 @xl:gap-4 @xl:px-4`,children:[(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Z.jsx)(de,{ids:Oe,states:E.stages})}),S&&(0,Z.jsxs)(`span`,{className:`flex-none text-[13px] font-semibold tabular-nums text-accent-fg`,"aria-label":`${Math.round(T)}% done`,children:[Math.round(T),`%`]})]}),o&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}),(0,Z.jsx)(ye,{tabs:O,tab:c,onTab:u,label:`Migration`}),(0,Z.jsxs)(`div`,{role:`tabpanel`,id:`mpanel-${c}`,"aria-labelledby":`mtab-${c}`,className:`flex min-w-0 flex-col gap-4`,children:[c===`overview`&&(0,Z.jsx)(Ae,{d:i,planView:t(i)}),c===`tests`&&(0,Z.jsx)(Ne,{d:i,events:p,busy:v||S,working:S,onFix:(t,n)=>void C(()=>l.fix(e,t,n)),onCheck:()=>void C(()=>l.verify(e)),onCompare:e=>(f(e),u(`compare`))}),c===`compare`&&(0,Z.jsx)(De,{id:e,plan:i.plan,result:E,initial:d}),c===`activity`&&(0,Z.jsx)(Fe,{events:p,running:S})]}),(0,Z.jsx)(A,{open:h!==null,onClose:()=>_(null),wide:!0,title:`Report`,description:`migrate.md for ${i.plan.id}`,footer:(0,Z.jsx)(g,{onClick:()=>_(null),children:`Close`}),children:h?(0,Z.jsx)(H,{text:h}):(0,Z.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No report yet.`})})]})}var Le=[{id:`git`,label:`Git`},{id:`folder`,label:`Folder`},{id:`upload`,label:`Upload`},{id:`paste`,label:`Paste`},{id:`project`,label:`This project`}],Re=[`Source`,`Target`,`Instructions`,`Review`],ze=[`Keep one page object per page, in pages/.`,`Read the base URL from BASE_URL.`,`Keep test names as they are.`],Be=[`Where the tests are`,`Framework and language`,`Your rules, optional`,`Check and start`];function Ve({at:e,reached:t,onGo:n}){return(0,Z.jsx)(`nav`,{"aria-label":`Steps`,children:(0,Z.jsx)(`ol`,{className:`m-0 flex list-none items-center gap-2 p-0`,children:Re.map((r,a)=>{let o=a<=t,s=a===e,c=a<t&&!s;return(0,Z.jsxs)(`li`,{className:R(`flex items-center gap-2`,a<Re.length-1&&`flex-1`),children:[(0,Z.jsxs)(`button`,{type:`button`,disabled:!o,"aria-current":s?`step`:void 0,onClick:()=>n(a),"aria-label":r,"data-tip":Be[a],className:R(`inline-flex min-h-8 flex-none items-center gap-2 rounded-[8px] border-0 bg-transparent px-1 text-[13px] whitespace-nowrap`,o&&!s?`cursor-pointer hover:bg-surface-strong`:``),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:R(`inline-flex size-6 flex-none items-center justify-center rounded-full text-[11px] font-semibold tabular-nums`,c?`bg-pass text-white`:s?`bg-accent text-accent-ink`:`border border-line bg-bg text-muted`),children:c?(0,Z.jsx)(i,{size:13,strokeWidth:3}):a+1}),(0,Z.jsx)(`span`,{className:R(s?`font-medium text-ink`:o?`text-ink-2`:`text-muted`,!s&&`hidden @xl:inline`),children:r})]}),a<Re.length-1&&(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-0.5 min-w-4 flex-1 overflow-hidden rounded-full bg-line @xl:min-w-8`,children:(0,Z.jsx)(`span`,{className:R(`block h-full rounded-full bg-pass transition-[width] duration-500`,a<t?`w-full`:`w-0`)})})]},r)})})})}function $({id:e,label:t,help:n,children:r}){return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`label`,{htmlFor:e,className:`text-sm font-medium`,children:t}),r,n&&(0,Z.jsx)(`span`,{className:`text-[13px] text-muted`,children:n})]})}function He({busy:e,onBack:t,next:n,onNext:r,disabled:i,aside:a}){return(0,Z.jsxs)(`div`,{className:`sticky bottom-0 flex flex-wrap items-center gap-3 border-t border-line-soft bg-bg py-3`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 text-[13px]`,children:a}),t&&(0,Z.jsx)(g,{variant:`ghost`,disabled:e,onClick:t,children:`Back`}),(0,Z.jsx)(g,{variant:`primary`,disabled:e||i,onClick:r,children:n})]})}function Ue({d:e}){let t=e.counts,n=[`${t.tests} test file${t.tests===1?``:`s`}`,`${t.support} support file${t.support===1?``:`s`}`,...t.features?[`${t.features} feature file${t.features===1?``:`s`}`]:[],...t.data?[`${t.data} data file${t.data===1?``:`s`}`]:[]];return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-[12px] bg-surface-muted px-4 py-3 text-sm`,children:[e.stack?(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-2 font-medium`,children:[(0,Z.jsx)(q,{framework:e.stack.framework,language:e.stack.language}),e.title]}):(0,Z.jsx)(M,{tone:`warn`,children:`Framework not detected`}),(0,Z.jsx)(`span`,{className:`text-ink-2`,children:n.join(` · `)}),t.skipped>0&&(0,Z.jsxs)(`span`,{className:`text-muted`,children:[`· `,t.skipped,` left out (links, large files)`]})]})}async function We(e,t,n){let r=[],i=0,a=null,o=0,s=async()=>{r.length&&(a=await l.files(e,r),o+=r.length,n(o),r=[],i=0)};for(let e of t){let t=e.webkitRelativePath||``,n=t&&t.split(`/`).slice(1).join(`/`)||e.name,a=new Uint8Array(await e.arrayBuffer()),o=``;for(let e=0;e<a.length;e+=32768)o+=String.fromCharCode(...a.subarray(e,e+32768));let c=btoa(o);i+c.length>8388608&&await s(),r.push({path:n,data:c}),i+=c.length}return await s(),a}var Ge=e=>(e.webkitRelativePath||e.name).split(`/`).some(e=>e.startsWith(`.`)||e===`node_modules`);function Ke({view:e,kind:t,setKind:n,src:r,setSrc:i,from:a,setFrom:o,stack:s,setStack:c,found:u,setFound:d}){let[f,p]=(0,X.useState)(``),[m,_]=(0,X.useState)(``),[y,b]=(0,X.useState)(null),[x,C]=(0,X.useState)(``),[w,T]=(0,X.useState)(e.credentials),[E,D]=(0,X.useState)(null),[O,k]=(0,X.useState)(``),[A,N]=(0,X.useState)([{path:``,text:``}]),[P,F]=(0,X.useState)(``),[I,L]=(0,X.useState)(``),[B,V]=(0,X.useState)(``),H=(0,X.useRef)(null),re=(0,X.useRef)(null);(0,X.useEffect)(()=>{H.current?.setAttribute(`webkitdirectory`,``)},[t,r]);let U=r?.workspace,W=async(e,t)=>{F(e),L(``),V(``);try{await t()}catch(e){L(e.message)}finally{F(``)}},G=e=>{i(e),o(`.`),d(e.discovery)};(0,X.useEffect)(()=>{if(t!==`project`)return;let e=setTimeout(()=>l.discover(void 0,a||`.`).then(d,()=>d(null)),300);return()=>clearTimeout(e)},[t,a,d]);let ie=e=>{let t=e.filter(e=>!Ge(e));if(!t.length)return L(`Nothing to send: every file is hidden or a dependency.`);W(`upload`,async()=>{let n=e[0],r=await l.source({kind:`upload`,label:n?.webkitRelativePath?n.webkitRelativePath.split(`/`)[0]:`${t.length} files`});await We(r.workspace.id,t,e=>V(`Sending ${e} of ${t.length} files…`)),G(await l.finish(r.workspace.id))})},le=t===`project`||!!U?.ready;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Z.jsx)(`div`,{role:`radiogroup`,"aria-label":`Where the tests come from`,className:`flex w-fit max-w-full gap-1 overflow-x-auto rounded-[10px] bg-surface-strong p-1`,children:Le.map(e=>(0,Z.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t===e.id,onClick:()=>{e.id!==t&&(n(e.id),i(null),d(null),L(``),o(e.id===`project`?``:`.`))},className:R(`inline-flex min-h-9 flex-none cursor-pointer items-center gap-2 rounded-[7px] border-0 px-3 text-sm font-medium`,t===e.id?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),children:[(0,Z.jsx)(se,{logo:ae[e.id].Logo,icon:ae[e.id].Icon,size:16}),e.label]},e.id))}),I&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:I}),U?.ready?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 rounded-[12px] card border px-4 py-3`,children:[(0,Z.jsx)(K,{kind:U.kind,label:U.label,size:22}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1 text-sm`,children:[(0,Z.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:J(U.label)}),U.branch&&(0,Z.jsxs)(`span`,{className:`text-muted`,children:[` · `,U.branch]}),(0,Z.jsxs)(`span`,{className:`text-muted`,children:[` · `,U.files,` files`]})]}),(0,Z.jsx)(M,{tone:`pass`,children:`Ready`}),(0,Z.jsx)(g,{variant:`ghost`,size:`sm`,onClick:()=>(i(null),d(null)),children:`Change`})]}):t===`git`?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)($,{id:`mig-url`,label:`Repository URL`,help:(0,Z.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-x-3 gap-y-1`,children:[`Works with `,ce.map(e=>(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Z.jsx)(se,{logo:e.Logo,size:14}),e.name]},e.name)),` and any git server over https or ssh.`]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsxs)(`span`,{className:`relative min-w-0 flex-[1_1_300px]`,children:[(0,Z.jsx)(`span`,{className:`pointer-events-none absolute top-1/2 left-3 -translate-y-1/2`,children:(0,Z.jsx)(se,{logo:oe(f).Logo,size:18})}),(0,Z.jsx)(j,{id:`mig-url`,value:f,spellCheck:!1,maxLength:500,placeholder:`https://github.com/org/ui-tests.git`,onChange:e=>(p(e.target.value),b(null)),className:`w-full pl-10`})]}),(0,Z.jsx)(g,{disabled:!!P||!f.trim(),onClick:()=>void W(`test`,async()=>{let e=await l.testRepository(f.trim(),x||void 0);b(e.branches),!m&&e.head&&_(e.head),V(`Connected · ${e.branches.length} branch${e.branches.length===1?``:`es`}`)}),children:P===`test`?`Testing…`:`Test connection`})]})}),(0,Z.jsxs)(`div`,{className:`grid gap-4 @xl:grid-cols-2`,children:[(0,Z.jsx)($,{id:`mig-branch`,label:`Branch`,children:y?.length?(0,Z.jsx)(z,{id:`mig-branch`,value:m,onChange:e=>_(e.target.value),children:y.map(e=>(0,Z.jsx)(`option`,{value:e,children:e},e))}):(0,Z.jsx)(j,{id:`mig-branch`,value:m,spellCheck:!1,maxLength:200,placeholder:`Default branch`,onChange:e=>_(e.target.value)})}),(0,Z.jsx)($,{id:`mig-token`,label:`Access token`,help:E?void 0:(0,Z.jsx)(`button`,{type:`button`,onClick:()=>D({name:`GIT_TOKEN`,value:``}),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg underline`,children:`Add a token`}),children:(0,Z.jsxs)(z,{id:`mig-token`,value:x,onChange:e=>C(e.target.value),children:[(0,Z.jsx)(`option`,{value:``,children:`None (public, or ssh)`}),w.map(e=>(0,Z.jsx)(`option`,{value:e,children:e},e))]})})]}),E&&(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 rounded-[12px] bg-surface-muted p-3`,children:[(0,Z.jsx)($,{id:`mig-token-name`,label:`Name`,children:(0,Z.jsx)(j,{id:`mig-token-name`,value:E.name,spellCheck:!1,maxLength:64,onChange:e=>D({...E,name:e.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`)}),className:`w-[180px]`})}),(0,Z.jsx)($,{id:`mig-token-value`,label:`Token`,children:(0,Z.jsx)(j,{id:`mig-token-value`,type:`password`,autoComplete:`off`,value:E.value,onChange:e=>D({...E,value:e.target.value}),className:`w-[260px] max-w-full`})}),(0,Z.jsx)(g,{disabled:!!P||!E.name||!E.value,onClick:()=>void W(`token`,async()=>{await v.saveSecrets({[E.name]:E.value}),T([...new Set([...w,E.name])].sort()),C(E.name),D(null)}),children:`Save`}),(0,Z.jsx)(g,{variant:`ghost`,onClick:()=>D(null),children:`Cancel`}),(0,Z.jsx)(`span`,{className:`w-full text-[12.5px] text-muted`,children:`Kept in ForgeQE's credential store, never in the URL or on this page.`})]}),(0,Z.jsx)(`div`,{children:(0,Z.jsx)(g,{variant:`primary`,disabled:!!P||!f.trim(),onClick:()=>void W(`clone`,async()=>G(await l.source({kind:`git`,url:f.trim(),...m?{branch:m}:{},...x?{tokenVar:x}:{}}))),children:P===`clone`?`Cloning…`:`Clone`})})]}):t===`folder`?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)($,{id:`mig-folder`,label:`Folder path`,help:`Copied first; the folder itself is never changed.`,children:(0,Z.jsx)(j,{id:`mig-folder`,value:O,spellCheck:!1,maxLength:1e3,placeholder:`/home/me/projects/shop-ui-tests`,onChange:e=>k(e.target.value)})}),(0,Z.jsx)(`div`,{children:(0,Z.jsx)(g,{variant:`primary`,disabled:!!P||!O.trim(),onClick:()=>void W(`copy`,async()=>G(await l.source({kind:`folder`,folder:O.trim()}))),children:P===`copy`?`Copying…`:`Use this folder`})})]}):t===`upload`?(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-3 rounded-[14px] border border-dashed border-line px-6 py-10 text-center`,children:[(0,Z.jsx)(`p`,{className:`m-0 text-sm text-ink-2`,children:`Choose a folder of tests, or some files.`}),(0,Z.jsx)(`input`,{ref:H,type:`file`,multiple:!0,hidden:!0,onChange:e=>e.target.files&&ie([...e.target.files])}),(0,Z.jsx)(`input`,{ref:re,type:`file`,multiple:!0,hidden:!0,onChange:e=>e.target.files&&ie([...e.target.files])}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[(0,Z.jsxs)(g,{variant:`primary`,disabled:!!P,onClick:()=>H.current?.click(),children:[(0,Z.jsx)(te,{"aria-hidden":`true`}),`Choose a folder`]}),(0,Z.jsxs)(g,{disabled:!!P,onClick:()=>re.current?.click(),children:[(0,Z.jsx)(ee,{"aria-hidden":`true`}),`Choose files`]})]})]}):t===`paste`?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[A.map((e,t)=>(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(j,{"aria-label":`File ${t+1} name`,value:e.path,spellCheck:!1,maxLength:300,placeholder:t?`pages/LoginPage.java`:`tests/LoginTest.java`,onChange:e=>N(A.map((n,r)=>r===t?{...n,path:e.target.value}:n)),className:`max-w-[360px]`}),A.length>1&&(0,Z.jsx)(g,{variant:`icon`,size:`icon`,"aria-label":`Remove file ${t+1}`,onClick:()=>N(A.filter((e,n)=>n!==t)),children:(0,Z.jsx)(h,{"aria-hidden":`true`})})]}),(0,Z.jsx)(S,{"aria-label":`File ${t+1} code`,value:e.text,rows:7,spellCheck:!1,placeholder:`Paste the code`,onChange:e=>N(A.map((n,r)=>r===t?{...n,text:e.target.value}:n)),className:`font-mono`})]},t)),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsxs)(g,{variant:`ghost`,onClick:()=>N([...A,{path:``,text:``}]),children:[(0,Z.jsx)(ne,{"aria-hidden":`true`}),`Add a file`]}),(0,Z.jsx)(`span`,{className:`flex-1`}),(0,Z.jsx)(g,{variant:`primary`,disabled:!!P||A.some(e=>!e.path.trim()||!e.text.trim()),onClick:()=>void W(`paste`,async()=>{let e=await l.source({kind:`paste`});await l.files(e.workspace.id,A.map(e=>({path:e.path.trim(),text:e.text}))),G(await l.finish(e.workspace.id))}),children:P===`paste`?`Adding…`:`Use this code`})]})]}):null,B&&!I&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:B}),le&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`grid gap-4 @xl:grid-cols-2`,children:[(0,Z.jsx)($,{id:`mig-from`,label:`Tests folder`,children:t===`project`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(j,{id:`mig-from`,list:`mig-folders`,value:a,spellCheck:!1,maxLength:300,placeholder:`Whole project`,onChange:e=>o(e.target.value)}),(0,Z.jsx)(`datalist`,{id:`mig-folders`,children:e.folders.map(e=>(0,Z.jsx)(`option`,{value:e},e))})]}):(0,Z.jsxs)(z,{id:`mig-from`,value:a||`.`,onChange:e=>(o(e.target.value),U&&l.discover(U.id,e.target.value).then(d,()=>{})),children:[(0,Z.jsx)(`option`,{value:`.`,children:`All of it`}),(r?.folders||[]).map(e=>(0,Z.jsx)(`option`,{value:e,children:e},e))]})}),(0,Z.jsx)($,{id:`mig-stack`,label:`Framework`,children:(0,Z.jsxs)(z,{id:`mig-stack`,value:s,onChange:e=>c(e.target.value),children:[(0,Z.jsx)(`option`,{value:``,children:u?.stack?`${u.title} (detected)`:`Detect`}),e.sources.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.title},e.id))]})})]}),u&&(0,Z.jsx)(Ue,{d:u})]})]})}function qe({on:e,onPick:t,logo:n,title:r,sub:i,label:a}){return(0,Z.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":e,"aria-label":a,onClick:t,className:R(`flex min-h-[72px] min-w-0 cursor-pointer items-center gap-3 rounded-[12px] border px-3.5 py-3 text-left transition-colors`,e?`border-accent bg-accent-soft ring-1 ring-accent`:`border-line-soft bg-bg hover:border-line hover:bg-surface-muted`),children:[(0,Z.jsx)(`span`,{className:`inline-flex size-9 flex-none items-center justify-center rounded-[10px] bg-surface-muted`,children:n}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium text-ink`,children:r}),i&&(0,Z.jsx)(`span`,{className:`truncate text-[12px] text-muted`,children:i})]})]})}var Je={playwright:`Microsoft`,cypress:`JavaScript only`,webdriverio:`WebDriver and BiDi`,selenium:`WebDriver`};function Ye({view:e,to:t,setTo:n,other:r,setOther:i,into:a,setInto:o,only:s,setOnly:c}){let l=e=>e.split(`-`)[0],u=e=>e.split(`-`).slice(1).join(`-`),d=[...new Map(e.targets.map(e=>[l(e.id),e.framework])).entries()],f=r===null?l(t):``,p=e.targets.filter(e=>l(e.id)===f);return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Z.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2.5 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`mb-2.5 text-sm font-medium`,children:`Framework`}),(0,Z.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Framework`,className:`grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2.5`,children:[d.map(([r,a])=>{let o=ue[r];return(0,Z.jsx)(qe,{on:f===r,onPick:()=>(i(null),n((e.targets.find(e=>l(e.id)===r&&u(e.id)===u(t))||e.targets.find(e=>l(e.id)===r)).id)),logo:o?(0,Z.jsx)(o,{width:22,height:22,"aria-hidden":`true`}):null,title:a,sub:Je[r],label:a},r)}),(0,Z.jsx)(qe,{on:r!==null,onPick:()=>i(r??``),logo:(0,Z.jsx)(ne,{size:18,"aria-hidden":`true`,className:`text-ink-2`}),title:`Other`,sub:`Type the framework`,label:`Other framework`})]})]}),r===null?(0,Z.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2.5 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`mb-2.5 text-sm font-medium`,children:`Language`}),(0,Z.jsx)(`div`,{role:`radiogroup`,"aria-label":`Language`,className:`grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2.5`,children:p.map(e=>{let r=le[u(e.id)];return(0,Z.jsx)(qe,{on:t===e.id,onPick:()=>n(e.id),logo:r?(0,Z.jsx)(r,{width:22,height:22,"aria-hidden":`true`}):null,title:e.language,sub:e.title.includes(`(`)&&e.title.slice(e.title.indexOf(`(`)+1,-1).replace(e.language,``).replace(/^,\s*/,``)||void 0,label:e.language},e.id)})})]}):(0,Z.jsx)($,{id:`mig-other`,label:`Which framework and language?`,help:`ForgeQE checks it against what it can run, and says so before anything starts.`,children:(0,Z.jsx)(j,{id:`mig-other`,value:r,maxLength:120,autoFocus:!0,placeholder:`Playwright with Java, WebdriverIO TypeScript…`,onChange:e=>i(e.target.value)})}),(0,Z.jsxs)(`div`,{className:`grid gap-4 @2xl:grid-cols-2`,children:[(0,Z.jsx)($,{id:`mig-into`,label:`Output folder`,help:`A new folder. Empty: named after the source and the target.`,children:(0,Z.jsx)(j,{id:`mig-into`,value:a,spellCheck:!1,maxLength:300,placeholder:`tests-playwright`,onChange:e=>o(e.target.value)})}),(0,Z.jsx)($,{id:`mig-only`,label:`Only some tests (optional)`,help:`A pattern, such as checkout/** or **/*Login*.`,children:(0,Z.jsx)(j,{id:`mig-only`,value:s,spellCheck:!1,maxLength:200,placeholder:`All tests`,onChange:e=>c(e.target.value)})})]})]})}function Xe({view:e,kind:t,src:n,found:r,to:i,other:a,instructions:o}){let s=e.targets.find(e=>e.id===i),c=(e,t)=>(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-b border-line-soft py-3.5 first:pt-0 last:border-b-0 last:pb-0`,children:[(0,Z.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:e}),(0,Z.jsx)(`div`,{className:`text-sm`,children:t})]});return(0,Z.jsxs)(`aside`,{"aria-label":`Summary`,className:`flex flex-col rounded-[14px] card border p-5`,children:[c(`Source`,n?.workspace?.ready||t===`project`&&r?(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(K,{kind:n?.workspace?.kind||`project`,label:n?.workspace?.label,size:18}),(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:n?.workspace?J(n.workspace.label):`This project`})]}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`Not picked yet`})),c(`Tests found`,r?.stack?(0,Z.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,Z.jsx)(q,{framework:r.stack.framework,language:r.stack.language}),r.title]}),(0,Z.jsxs)(`span`,{className:`text-[13px] text-ink-2`,children:[r.counts.tests,` test files · `,r.counts.support,` support files`]})]}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`–`})),c(`Target`,a===null?s?(0,Z.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,Z.jsx)(q,{framework:s.id.split(`-`)[0],language:s.id.split(`-`).slice(1).join(`-`)}),s.title]}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`–`}):(0,Z.jsx)(`span`,{className:a.trim()?`font-medium`:`text-muted`,children:a.trim()||`Type it in`})),c(`Instructions`,o.trim()?(0,Z.jsx)(`span`,{className:`line-clamp-3 text-ink-2`,children:o.trim()}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`None`}))]})}function Ze({view:e,review:n,onStart:r}){let[i,a]=(0,X.useState)(0),[o,s]=(0,X.useState)(0),[c,u]=(0,X.useState)(`git`),[d,f]=(0,X.useState)(null),[p,m]=(0,X.useState)(`.`),[h,g]=(0,X.useState)(``),[_,v]=(0,X.useState)(null),[y,b]=(0,X.useState)(e.targets[0]?.id||``),[x,C]=(0,X.useState)(null),[w,E]=(0,X.useState)(``),[D,O]=(0,X.useState)(``),[k,A]=(0,X.useState)(``),[ee,j]=(0,X.useState)(null),[M,N]=(0,X.useState)(!1),[P,F]=(0,X.useState)(!1),[I,L]=(0,X.useState)(``);(0,X.useEffect)(()=>{j(null),N(!1),s(e=>Math.min(e,2))},[c,d,p,h,D,y,x,w,k]);let R=e=>{a(e),s(t=>Math.max(t,e)),L(``)},z=c===`project`||!!d?.workspace?.ready,te=async()=>{F(!0),L(``);try{let e=await l.plan({...c!==`project`&&d?.workspace?{workspace:d.workspace.id}:{},...p.trim()&&p!==`.`?{from:p.trim()}:{},...h?{stack:h}:{},...x===null?{to:y}:{to:``,toText:x.trim()},...w.trim()?{into:w.trim()}:{},...D.trim()?{only:D.trim()}:{},...k.trim()?{instructions:k.trim()}:{}});j(e),R(3)}catch(e){L(e.message)}finally{F(!1)}},B=ee?.plan,V=B?.feasibility.findings.some(e=>e.level===`limit`),H=B?.feasibility.verdict===`blocked`;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Z.jsx)(Ve,{at:i,reached:o,onGo:e=>!P&&(e<3||ee)&&a(e)}),(0,Z.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 @5xl:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,Z.jsxs)(`section`,{"aria-labelledby":`mig-step`,className:`flex min-w-0 flex-col gap-5`,children:[(0,Z.jsx)(`h2`,{id:`mig-step`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em]`,children:[`Where are the tests?`,`What should they become?`,`Anything the agent should know?`,`Review and start`][i]}),I&&(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:I}),i===0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ke,{view:e,kind:c,setKind:u,src:d,setSrc:f,from:p,setFrom:m,stack:h,setStack:g,found:_,setFound:v}),(0,Z.jsx)(He,{busy:P,next:`Continue`,onNext:()=>R(1),disabled:!z})]}),i===1&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ye,{view:e,to:y,setTo:b,other:x,setOther:C,into:w,setInto:E,only:D,setOnly:O}),(0,Z.jsx)(He,{busy:P,onBack:()=>a(0),next:`Continue`,onNext:()=>R(2),disabled:x===null?!y:!x.trim()})]}),i===2&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{id:`mig-instructions`,label:`Instructions (optional)`,help:`Style and structure for the new code. Every test and check is kept either way.`,children:(0,Z.jsx)(S,{id:`mig-instructions`,value:k,rows:6,maxLength:4e3,placeholder:`Page objects go in pages/, one class per page.`,onChange:e=>A(e.target.value)})}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:ze.map(e=>(0,Z.jsxs)(`button`,{type:`button`,disabled:k.includes(e),onClick:()=>A(k.trim()?`${k.trim()}\n${e}`:e),className:`inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-[8px] border-0 bg-surface-strong px-2.5 text-[13px] text-ink hover:bg-line disabled:cursor-default disabled:opacity-50`,children:[(0,Z.jsx)(ne,{size:13,"aria-hidden":`true`}),e]},e))}),(0,Z.jsx)(He,{busy:P,onBack:()=>a(1),next:P?`Checking…`:`Check the plan`,onNext:()=>void te(),aside:(0,Z.jsx)(`span`,{className:`text-muted`,children:`Nothing is changed yet.`})})]}),i===3&&B&&(0,Z.jsxs)(Z.Fragment,{children:[n(B,M,N),(0,Z.jsx)(He,{busy:P,onBack:()=>a(2),next:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(t,{icon:T,size:15}),`Start migration`]}),disabled:H||V&&!M,onNext:()=>r(ee,!!V&&M),aside:(0,Z.jsx)(`span`,{className:`text-muted`,children:H?`Change what is not possible first.`:V&&!M?`Accept the limits to start.`:`Runs in the background.`})})]})]}),(0,Z.jsx)(`div`,{className:`@5xl:sticky @5xl:top-6`,children:(0,Z.jsx)(Xe,{view:e,kind:c,src:d,found:_,to:y,other:x,instructions:k})})]})]})}function Qe({children:e,wide:t}){return(0,Z.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,Z.jsx)(N,{}),(0,Z.jsx)(`main`,{className:R(re,`@container flex-auto gap-5`,t?`max-w-[1480px]`:`max-w-[1180px]`),children:e})]})}function $e({action:e}){return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(s,{pixel:E.migration,size:`lg`}),(0,Z.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Migration`})]}),(0,Z.jsx)(G,{label:`Migration`,links:ie,current:`migration`}),(0,Z.jsx)(`span`,{className:`flex-1`}),e]})}function et({error:e}){return e?(0,Z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e}):null}function tt({title:e,children:t}){let[n,r]=(0,X.useState)(!1),i=(0,X.useId)();return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":n,"aria-controls":i,onClick:()=>r(!n),className:`inline-flex min-h-8 cursor-pointer items-center gap-1.5 self-start rounded-[8px] border-0 bg-transparent px-1 text-sm font-medium text-ink hover:bg-surface-strong`,children:[(0,Z.jsx)(m,{size:15,"aria-hidden":`true`,className:R(`transition-transform`,n&&`rotate-180`)}),e]}),(0,Z.jsx)(o,{open:n,id:i,children:t})]})}function nt({finding:e}){let t=e.hits||[],n=e.files?.length||0;if(!t.length)return n?(0,Z.jsxs)(`span`,{className:`text-muted`,children:[` (`,n,` file`,n===1?``:`s`,`)`]}):null;let r=n-new Set(t.map(e=>e.file)).size;return(0,Z.jsxs)(`details`,{className:`mt-1 text-[13px]`,children:[(0,Z.jsxs)(`summary`,{className:`cursor-pointer text-muted hover:text-ink`,children:[`Found in `,n||t.length,` file`,(n||t.length)===1?``:`s`]}),(0,Z.jsxs)(`ul`,{className:`m-0 mt-1.5 flex list-none flex-col gap-1.5 p-0`,children:[t.map(e=>(0,Z.jsxs)(`li`,{className:`min-w-0`,children:[(0,Z.jsxs)(`span`,{className:`font-mono text-[12px] text-ink-2 [overflow-wrap:anywhere]`,children:[e.file,`:`,e.line]}),(0,Z.jsx)(`code`,{className:`mt-0.5 block overflow-x-auto rounded-[8px] bg-bg px-2 py-1 font-mono text-[12px] whitespace-pre text-ink`,children:e.code})]},`${e.file}:${e.line}`)),r>0&&(0,Z.jsxs)(`li`,{className:`text-muted`,children:[`and `,r,` more file`,r===1?``:`s`]})]})]})}function rt({plan:e,accepted:t,onAccept:n}){let r=e.feasibility.findings.filter(e=>e.level===`blocker`),i=e.feasibility.findings.filter(e=>e.level===`limit`),a=e.units.filter(e=>e.kind===`test`).length,o=e.units.filter(e=>e.kind===`support`).length;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Z.jsxs)(`dl`,{className:`m-0 grid gap-x-6 gap-y-2.5 rounded-[14px] card border px-5 py-4 text-sm @xl:grid-cols-[auto_1fr]`,children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`From`}),(0,Z.jsxs)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:[e.source.title,(0,Z.jsxs)(`span`,{className:`text-muted`,children:[` `,`· `,e.workspace?J(e.workspace.label):`this project`,e.source.dir===`.`?``:`/${e.source.dir}`]})]}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`To`}),(0,Z.jsxs)(`dd`,{className:`m-0`,children:[e.target.title,(0,Z.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.target.dir]})]}),(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Files`}),(0,Z.jsxs)(`dd`,{className:`m-0`,children:[a,` test`,a===1?``:`s`,`, `,o,` support file`,o===1?``:`s`,e.copies.length?`, ${e.copies.length} data file${e.copies.length===1?``:`s`}`:``]}),e.instructions&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:`Instructions`}),(0,Z.jsx)(`dd`,{className:`m-0 whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.instructions})]})]}),r.length>0&&(0,Z.jsxs)(`section`,{"aria-labelledby":`mig-blockers`,className:`flex flex-col gap-2 rounded-[14px] bg-fail-soft px-5 py-4`,children:[(0,Z.jsxs)(`h3`,{id:`mig-blockers`,className:`m-0 flex items-center gap-2 text-sm font-semibold text-fail`,children:[(0,Z.jsx)(C,{size:16,"aria-hidden":`true`}),`Not possible`]}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-5 text-sm text-ink`,children:r.map(e=>(0,Z.jsx)(`li`,{children:e.text},e.code))})]}),i.length>0&&(0,Z.jsxs)(`section`,{"aria-labelledby":`mig-limits`,className:`flex flex-col gap-3 rounded-[14px] bg-warn-soft px-5 py-4`,children:[(0,Z.jsxs)(`h3`,{id:`mig-limits`,className:`m-0 flex items-center gap-2 text-sm font-semibold text-warn`,children:[(0,Z.jsx)(C,{size:16,"aria-hidden":`true`}),`Before you start`]}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1.5 pl-5 text-sm text-ink`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[e.text,(0,Z.jsx)(nt,{finding:e})]},e.code))}),n&&!r.length&&(0,Z.jsxs)(`label`,{className:`flex min-h-9 cursor-pointer items-center gap-2 text-sm font-medium`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:!!t,onChange:e=>n(e.target.checked)}),`I understand`]})]}),(0,Z.jsxs)(tt,{title:`Files, in order (${e.units.length})`,children:[(0,Z.jsx)(`ol`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0 text-[13px]`,children:e.units.map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap gap-x-3 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,Z.jsx)(`span`,{className:`w-16 flex-none text-muted`,children:ge[e.kind]}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[e.source?(0,Z.jsxs)(`span`,{className:`text-muted`,children:[e.source.slice(e.source.lastIndexOf(`/`)+1),` → `]}):null,e.target]})]},e.id))}),e.notMigrated.length>0&&(0,Z.jsxs)(`p`,{className:`m-0 mt-2 text-[12.5px] text-muted`,children:[`Not migrated: `,e.notMigrated.map(e=>e.rel.slice(e.rel.lastIndexOf(`/`)+1)).join(`, `)]})]})]})}function it({plan:e,acceptLimits:t,onClose:n,onStarted:r}){let[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(!1),[c,u]=(0,X.useState)(``),d=async()=>{s(!0),u(``);try{r((await l.start(e.id,i,t)).detail)}catch(e){u(e.message),s(!1)}};return(0,Z.jsx)(A,{open:!0,onClose:n,title:`Start the migration`,description:`The tests are rewritten in ${e.target.title} into ${e.target.dir}, and ForgeQE runs each one. It runs in the background; your source tests are not changed.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(g,{variant:`ghost`,onClick:n,children:`Cancel`}),(0,Z.jsx)(g,{variant:`primary`,disabled:o||i!==e.id,onClick:()=>void d(),children:`Start migration`})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,Z.jsxs)(`span`,{children:[`Type `,(0,Z.jsx)(`span`,{className:`font-mono`,children:e.id}),` to confirm`]}),(0,Z.jsx)(j,{value:i,onChange:e=>a(e.target.value),autoComplete:`off`,spellCheck:!1})]}),(0,Z.jsx)(et,{error:c})]})})}function at({d:e,onStarted:t}){let[n,r]=(0,X.useState)(!1),[i,a]=(0,X.useState)(!1),o=e.plan.feasibility.findings.some(e=>e.level===`limit`),s=e.plan.feasibility.verdict===`blocked`,c=!!e.job?.running;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[e.job?.last&&!c&&(0,Z.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:`The last start did not run. Its job's log on the Jobs page says why.`}),(0,Z.jsx)(rt,{plan:e.plan,accepted:e.confirmed||n,onAccept:e.confirmed?void 0:r}),!s&&!c&&(0,Z.jsx)(`div`,{children:(0,Z.jsxs)(g,{variant:`primary`,disabled:!e.confirmed&&o&&!n,onClick:()=>a(!0),children:[(0,Z.jsx)(T,{"aria-hidden":`true`}),`Start migration`]})}),i&&(0,Z.jsx)(it,{plan:e.plan,acceptLimits:o&&(e.confirmed||n),onClose:()=>a(!1),onStarted:e=>{a(!1),t(e)}})]})}function ot(e){return e.result?.status===`running`?`running`:e.result?.status===`migrated`?`done`:e.result?`review`:`planned`}function st(e){return e.result?me[e.result.status]:e.confirmed?{label:`Confirmed`,tone:`neutral`}:he[e.verdict]}function ct({view:t}){let[r,i]=(0,X.useState)(`all`),a=e=>e===`all`?t.plans.length:t.plans.filter(t=>ot(t)===e).length,o=t.plans.filter(e=>r===`all`||ot(e)===r),s=e=>location.hash=n(`migration`,e);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(_e,{children:[(0,Z.jsx)(Y,{label:`All`,value:a(`all`),onClick:()=>i(`all`),on:r===`all`}),(0,Z.jsx)(Y,{label:`Running`,value:a(`running`),onClick:()=>i(`running`),on:r===`running`}),(0,Z.jsx)(Y,{label:`Migrated`,value:a(`done`),tone:a(`done`)?`text-pass`:void 0,onClick:()=>i(`done`),on:r===`done`}),(0,Z.jsx)(Y,{label:`Needs review`,value:a(`review`),tone:a(`review`)?`text-warn`:void 0,onClick:()=>i(`review`),on:r===`review`})]}),(0,Z.jsx)(f,{label:`Migrations`,placeholder:`Find a migration`,empty:r===`all`?`No migrations.`:`None here.`,resetKey:r,head:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 font-medium`,children:`Migration`}),(0,Z.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @3xl:table-cell`,children:`Source`}),(0,Z.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Tests`}),(0,Z.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Status`}),(0,Z.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`Updated`})]}),children:o.map(t=>{let r=st(t),i=t.result?t.result.status===`migrated`||t.result.endedAt?100:Math.round(t.result.done/Math.max(1,t.files)*95):0;return(0,Z.jsxs)(`tr`,{onClick:()=>s(t.id),className:k,children:[(0,Z.jsx)(`td`,{className:e,children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,Z.jsxs)(`span`,{className:`hidden flex-none items-center gap-1 @xl:inline-flex`,"aria-hidden":`true`,children:[(0,Z.jsx)(q,{framework:t.stack?.framework,language:t.stack?.language,size:18}),(0,Z.jsx)(L,{size:13,className:`text-muted`}),(0,Z.jsx)(q,{framework:t.targetId.split(`-`)[0],language:t.targetId.split(`-`).slice(1).join(`-`),size:18})]}),(0,Z.jsxs)(`span`,{className:`min-w-0`,children:[(0,Z.jsxs)(`a`,{href:n(`migration`,t.id),onClick:e=>e.stopPropagation(),className:`font-medium text-ink no-underline hover:underline`,children:[t.source,` to `,t.target]}),(0,Z.jsx)(`span`,{className:`block text-[12px] text-muted`,children:t.to})]})]})}),(0,Z.jsx)(`td`,{className:R(e,`hidden max-w-[260px] @3xl:table-cell`),children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[13px] text-ink-2`,children:[(0,Z.jsx)(K,{kind:t.origin.kind,label:t.origin.label,size:15}),(0,Z.jsx)(`span`,{className:`truncate`,"data-tip":t.origin.label,children:t.origin.kind===`project`?t.from:J(t.origin.label)})]})}),(0,Z.jsx)(`td`,{className:R(e,`w-[180px] text-[13px]`),children:t.result?.status===`running`?(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(be,{value:i,label:`${t.source} to ${t.target}: progress`}),(0,Z.jsxs)(`span`,{className:`w-9 flex-none text-right text-[12px] text-muted tabular-nums`,children:[i,`%`]})]}):t.result?(0,Z.jsxs)(`span`,{className:t.result.migrated===t.tests?`text-pass`:`text-ink-2`,children:[t.result.migrated,` of `,t.tests,` pass`]}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`Not started`})}),(0,Z.jsx)(`td`,{className:R(e,`whitespace-nowrap`),children:(0,Z.jsx)(M,{tone:r.tone,children:r.label})}),(0,Z.jsx)(`td`,{className:R(e,`hidden text-[12.5px] whitespace-nowrap text-muted @xl:table-cell`),children:U(t.result?.endedAt||t.result?.at||t.createdAt)})]},t.id)})})]})}function lt({sub:e}){let[t,r]=(0,X.useState)(null),[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(null),c=(0,X.useCallback)(()=>{l.list().then(e=>{r(e),a(``)},e=>a(e.message))},[]);(0,X.useEffect)(c,[c,e]);let u=t?.plans.some(e=>e.result?.status===`running`);(0,X.useEffect)(()=>{if(!u||e)return;let t=setInterval(c,3e3);return()=>clearInterval(t)},[u,e,c]);let d=e&&/^mig-\d{8}-\d{6}-[0-9a-f]{4}$/.test(e)?e:``,f=()=>location.hash=n(`migration`,`new`),m=!t&&!i&&(0,Z.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`});return e===`new`?(0,Z.jsxs)(Qe,{children:[(0,Z.jsx)($e,{}),(0,Z.jsx)(et,{error:i}),m,t&&(0,Z.jsx)(Ze,{view:t,review:(e,t,n)=>(0,Z.jsx)(rt,{plan:e,accepted:t,onAccept:n}),onStart:(e,t)=>s({d:e,accept:t})}),o&&(0,Z.jsx)(it,{plan:o.d.plan,acceptLimits:o.accept,onClose:()=>s(null),onStarted:e=>location.hash=n(`migration`,e.plan.id)})]}):d?(0,Z.jsxs)(Qe,{wide:!0,children:[(0,Z.jsx)($e,{}),(0,Z.jsx)(et,{error:i}),m,t&&(0,Z.jsx)(Ie,{id:d,view:t,plan:e=>(0,Z.jsx)(at,{d:e,onStarted:()=>location.reload()})},d)]}):(0,Z.jsxs)(Qe,{children:[(0,Z.jsx)($e,{action:t&&!t.plans.length?void 0:(0,Z.jsx)(g,{variant:`primary`,disabled:!t,onClick:f,children:`New migration`})}),(0,Z.jsx)(et,{error:i}),m,t&&(t.plans.length?(0,Z.jsx)(ct,{view:t}):(0,Z.jsx)(O,{icon:p,title:`No migrations yet`,action:(0,Z.jsx)(g,{size:`sm`,onClick:f,children:`New migration`}),children:`Bring in tests from git, a folder, uploaded files or pasted code, and pick the framework they move to. Nothing starts until you confirm.`}))]})}export{lt as Migration};
@@ -1,2 +0,0 @@
1
- import{$n as e,$t as t,At as n,Bi as r,Cn as i,Dt as a,Et as o,Fn as s,Gr as c,Ir as l,Ka as u,Ki as d,Ln as f,Lr as p,Mr as m,Mt as h,Nn as g,Ot as _,Ri as v,Tn as y,Yr as b,Zi as x,Zt as S,_t as ee,ao as C,ar as w,at as te,co as T,ct as E,dt as ne,fn as re,gi as ie,gt as ae,hi as oe,hr as se,ht as ce,jn as D,lt as O,mi as k,mt as A,n as le,na as ue,nn as j,oa as de,oi as fe,on as pe,ot as me,pa as he,ro as ge,sa as _e,si as M,ta as ve,tn as N,ui as P,ut as F,wa as ye,wi as be,zr as xe}from"./Shell-2xDxqPtD.js";import{c as Se,i as Ce,k as we,l as Te,o as Ee,r as De}from"./index-CAbuIKyt.js";import{i as Oe,r as ke}from"./segmented-7nur8ck_.js";import{n as I,t as L}from"./thread-RtF8vcSJ.js";var R=T(C(),1),z=ge(),Ae=e=>new Promise(t=>setTimeout(t,e));function je({id:e,onEnd:t,label:r=`The agent at work`,done:a=`Done.`,failed:o=`It could not finish.`}){let[s,c]=(0,R.useState)([]),[l,u]=(0,R.useState)(`starting`);(0,R.useEffect)(()=>{let t=!1,n=0,r=[];return(async()=>{for(;!t;)try{let i=await ye.events(e,n,!0);if(t||(i.events.length&&(r.push(...i.events),n=i.events.at(-1).n,c([...r])),u(i.state),i.state===`closed`||i.state===`failed`))return}catch{await Ae(2e3)}})(),()=>{t=!0}},[e]);let d=I(s),f=d.turns.at(-1),p=!!f?.outcome||l===`failed`||l===`closed`,m=f&&!p?L(f):null,g=f?.outcome===`done`,_=p&&!g&&(f?.error||d.fatal||d.ended?.message)||``;return(0,R.useEffect)(()=>{p&&t?.()},[p]),(0,z.jsxs)(`section`,{"aria-label":r,className:`flex flex-col gap-2 border-t border-line-soft pt-3 text-sm`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[m||!p?(0,z.jsx)(h,{state:m?.orb??`thinking`,px:16}):g?(0,z.jsx)(i,{size:16,"aria-hidden":`true`,className:`text-pass`}):(0,z.jsx)(he,{size:16,"aria-hidden":`true`,className:`text-fail`}),(0,z.jsx)(`span`,{className:N(`min-w-0 flex-1 font-medium [overflow-wrap:anywhere]`,p&&!g&&`text-fail`),children:m?m.text:p?g?a:f?.outcome===`stopped`?`It was stopped.`:o:`Starting…`}),(0,z.jsx)(`a`,{href:n(`chats`,e),className:`text-[13px]`,children:`Open the chat`})]}),_&&(0,z.jsx)(`p`,{className:`m-0 text-[13px] text-fail [overflow-wrap:anywhere]`,children:_.split(`
2
- `).slice(0,3).join(` `)}),f&&f.steps.length>0&&(0,z.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-0.5 p-0 text-[13px] text-muted`,children:f.steps.slice(-6).map(e=>(0,z.jsxs)(`li`,{className:N(`[overflow-wrap:anywhere]`,e.status===`fail`&&`text-fail`),children:[e.status===`running`?`… `:e.status===`fail`?`✗ `:`✓ `,e.label,e.arg?`: ${e.arg}`:``]},e.key))}),f&&f.changes.length>0&&(0,z.jsxs)(`p`,{className:`m-0 text-[13px] [overflow-wrap:anywhere]`,children:[`Changed: `,f.changes.map(e=>`${e.path} (+${e.added} −${e.removed})`).join(`, `)]}),f&&f.asks.some(e=>e.answer===void 0)&&(0,z.jsxs)(`p`,{className:`m-0 text-[13px] text-warn`,children:[`It is asking something: `,(0,z.jsx)(`a`,{href:n(`chats`,e),children:`answer it in the chat`}),`.`]}),f?.reply&&p&&(0,z.jsx)(Te,{text:f.reply,className:`text-[14px]`})]})}var Me=[{id:`typed`,label:`As typed`,note:`The test types exactly this.`},{id:`data`,label:`Test data`,note:`A named value the test reads from its data, one per environment.`},{id:`unique`,label:`New on each run`,note:`A fresh value each time, like this one: for an email or a name that must not repeat.`},{id:`secret`,label:`Secret`,note:`Read from the environment when the test runs; what was typed is removed from the recording.`}];function Ne({runDir:e,onClose:n,onRecordMore:r,notices:a}){let[o,c]=(0,R.useState)(null),[d,f]=(0,R.useState)(``),[p,m]=(0,R.useState)(!1),[h,_]=(0,R.useState)(`steps`),[y,b]=(0,R.useState)(``),[ee,C]=(0,R.useState)(!1),[w,T]=(0,R.useState)(null),[ae,se]=(0,R.useState)(null),[k,le]=(0,R.useState)(null),[ue,de]=(0,R.useState)(``),[me,ge]=(0,R.useState)(`all`),[M,ve]=(0,R.useState)(null),[P,Se]=(0,R.useState)(!1),[Ce,Te]=(0,R.useState)(``),[Ee,I]=(0,R.useState)(``),[L,Ae]=(0,R.useState)([]),[Ne,Ie]=(0,R.useState)(void 0),[B,V]=(0,R.useState)({from:0,to:0,name:``}),[H,Le]=(0,R.useState)({block:``,after:0}),[Re,ze]=(0,R.useState)(``),[U,Be]=(0,R.useState)(null),[Ve,W]=(0,R.useState)(``),[He,Ue]=(0,R.useState)({}),[G,We]=(0,R.useState)(null),[K,Ge]=(0,R.useState)(null),[Ke,qe]=(0,R.useState)(null),[Je,Ye]=(0,R.useState)(!1);(0,R.useEffect)(()=>{let t=!1;return u.review(e).then(e=>{t||(c(e),b(e.name),I(e.instructions))},e=>!t&&f(e.message)),()=>{t=!0}},[e]),(0,R.useEffect)(()=>{u.blocks().then(e=>{Ae(e.blocks),Ie(e.shared)},()=>Ae([]))},[]),(0,R.useEffect)(()=>{let t=!1;return u.tryView(e).then(e=>{t||(Be(e),Ue(t=>Object.fromEntries(e.data.map(e=>[e.name,t[e.name]??e.value]))))},()=>{}),()=>{t=!0}},[e,o]);let q=U?.running===e;(0,R.useEffect)(()=>{if(!q)return;let t=setInterval(()=>{u.tryView(e).then(Be,()=>{})},1500);return()=>clearInterval(t)},[q,e]);let Xe=async()=>{f(``),Ye(!0);try{let{id:t}=await ye.start(`Turn the reviewed recording in ${e} into a test: call write_test with run_dir ${e} and unattended true.`,{});qe(t)}catch(e){f(e.message),Ye(!1)}};(0,R.useEffect)(()=>{K&&!q&&U&&(Ge(null),G===o&&U.result?.ok&&Xe())},[K,q,U,G,o]);let Ze=async t=>{f(``),qe(null);try{let n=await u.tryRun(e,Ve,He);We(o),Ge(t),Be(n)}catch(e){f(e.message)}},Qe=async()=>{m(!0),f(``),ze(``);try{let t=await u.saveBlock(e,B.name.trim(),B.from,B.to);Ae(t.blocks),ze(`Kept as the block "${t.block.name}": put it into other recordings, or start one from it on the Record page.`),V({...B,name:``})}catch(e){f(e.message)}finally{m(!1)}},J=async t=>{m(!0),f(``);try{let n=`restore`in t?await u.restoreReview(e,t.restore):`insert`in t?await u.insertBlock(e,t.insert.after,t.insert.block):`useBlock`in t?await u.useBlock(e,t.useBlock.block,t.useBlock.from):await u.saveReview(e,t);c(n),b(n.name),I(n.instructions)}catch(e){f(e.message)}finally{m(!1)}},$e=async()=>{Se(!0),Te(``);try{let t=await u.suggest(e);ve(t.picks),Te(t.error||(t.picks.length?``:`The model found nothing more to check.`))}catch(e){Te(e.message)}finally{Se(!1)}},et=e=>e.kind===`data`||e.kind===`unique`?{data:[{index:e.after,as:e.kind}]}:{checks:[{after:e.after,kind:e.kind,text:e.text}]},tt=async e=>{for(let t of e)await J(et(t));ve(t=>(t||[]).filter(t=>!e.includes(t)))};if(!o)return d?(0,z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:d}):(0,z.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Reading the recording…`});let nt=o.steps.filter(e=>e.value),rt=o.steps.filter(e=>e.op===`expect`).length,Y=q?void 0:U?.result,it=new Map((Y?.steps??[]).map(e=>[e.n-1,e])),X=Y?.steps.find(e=>!e.ok),Z=X?X.n-1:-1,Q=Z>=0?o.steps[Z]:void 0,at=!!Y&&!!G&&G!==o,ot=(Y?.steps??[]).filter(e=>!e.ok).length,st=ue.toLowerCase().split(/\s+/).filter(Boolean),ct=o.steps.filter(e=>st.every(t=>`${e.index+1} ${e.line} ${e.note||``}`.toLowerCase().includes(t))&&(me===`all`||(me===`checks`?e.op===`expect`:it.get(e.index)?.ok===!1))),lt=e=>{_(`steps`),ge(`all`),de(``),requestAnimationFrame(()=>document.getElementById(`step-${e}`)?.scrollIntoView({block:`center`,behavior:`smooth`}))},$=!!U?.running&&!q,ut=Je||K===`write`&&q,dt=[{id:`steps`,label:`Steps`,n:o.steps.length},{id:`data`,label:`Test data`,n:nt.length},{id:`run`,label:`Last run`},{id:`instructions`,label:`Instructions`},{id:`blocks`,label:`Blocks`},{id:`history`,label:`History`,n:o.history.length}];return(0,z.jsxs)(`section`,{"aria-labelledby":`review-title`,className:`flex min-w-0 flex-col gap-4`,children:[(0,z.jsxs)(`div`,{className:`sticky top-0 z-20 -mx-1 flex flex-col gap-3 border-b border-line bg-bg px-1 py-3`,children:[(0,z.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:n&&(0,z.jsxs)(S,{size:`sm`,variant:`ghost`,onClick:n,className:`-ml-2 text-ink-2`,children:[(0,z.jsx)(pe,{"aria-hidden":`true`}),`Recordings`]})}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1`,children:[ee?(0,z.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),C(!1),y.trim()&&y.trim()!==o.name&&J({name:y.trim()})},children:[(0,z.jsx)(O,{"aria-label":`Name of the recording`,value:y,maxLength:200,autoFocus:!0,onChange:e=>b(e.target.value),className:`min-w-0 flex-1`}),(0,z.jsx)(S,{type:`submit`,size:`sm`,variant:`primary`,children:`Save`}),(0,z.jsx)(S,{size:`sm`,variant:`ghost`,onClick:()=>{b(o.name),C(!1)},children:`Cancel`})]}):(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,z.jsx)(`h2`,{id:`review-title`,className:`m-0 min-w-0 truncate text-lg font-semibold`,"data-tip":o.name,children:o.name}),(0,z.jsx)(S,{size:`icon`,variant:`icon`,"aria-label":`Rename the recording`,"data-tip":`Rename`,onClick:()=>C(!0),className:`size-8 flex-none`,children:(0,z.jsx)(oe,{"aria-hidden":`true`})})]}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-[13px] text-muted`,children:[(0,z.jsxs)(`span`,{children:[j(o.steps.length,`step`),` · `,j(rt,`check`)]}),q?(0,z.jsx)(A,{tone:`running`,children:`Running the steps…`}):Y?(0,z.jsx)(A,{tone:Y.ok?`pass`:`fail`,children:Y.ok?`Last run passed${Y.env?` on ${Y.env}`:``}`:X?`Last run failed at step ${X.n}`:`Last run did not get through`}):(0,z.jsx)(A,{tone:`neutral`,icon:!1,children:`Not run yet`}),at&&(0,z.jsx)(`span`,{children:`· you changed it since`})]})]}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsxs)(S,{disabled:q||$||ut,onClick:()=>void Ze(null),"data-tip":`Play the steps in a new browser, as the test will`,children:[(0,z.jsx)(ie,{"aria-hidden":`true`}),q&&!K?`Running…`:$?`Another run is going`:`Re-run`]}),(0,z.jsxs)(S,{variant:`primary`,disabled:p||q||$||ut,onClick:()=>void(Y?.ok&&G===o?Xe():Ze(`write`)),"data-tip":`The steps are run first; when they work, the Coding agent writes the test in your repository's style`,children:[(0,z.jsx)(_e,{"aria-hidden":`true`}),K===`write`&&q?`Checking the steps…`:Je?`Writing…`:Ke?`Write the test again`:`Write the test`]})]})]})]}),a,d&&(0,z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:d}),Y&&!Y.ok&&(0,z.jsxs)(`div`,{role:`alert`,className:`flex flex-col gap-2 rounded-[12px] border border-fail/30 bg-fail-soft px-4 py-3 text-sm`,children:[(0,z.jsxs)(`p`,{className:`m-0 font-semibold text-fail [overflow-wrap:anywhere]`,children:[X?`Step ${X.n} failed${Y.env?` on ${Y.env}`:``}`:`The run did not get through${Y.env?` on ${Y.env}`:``}`,at&&(0,z.jsx)(`span`,{className:`font-normal text-ink-2`,children:` · before your last change`})]}),Q&&(0,z.jsx)(`p`,{className:`m-0 font-medium text-ink [overflow-wrap:anywhere]`,children:Q.line}),(0,z.jsx)(`p`,{className:`m-0 line-clamp-3 text-[13px] text-ink-2 [overflow-wrap:anywhere]`,"data-tip":(X?X.error:Y.error)||void 0,children:(X?X.error:Y.error)||(X?`It failed.`:`The last page was not the recorded one.`)}),(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[Q&&(0,z.jsx)(S,{size:`sm`,onClick:()=>lt(Z),children:`Show the step`}),Q&&r&&Z>0&&(0,z.jsxs)(S,{size:`sm`,onClick:()=>r(Z),"data-tip":`The browser does the steps before it; you do this step again, and what you record takes its place`,children:[(0,z.jsx)(g,{"aria-hidden":`true`}),`Record it again`]}),Q&&!Q.fixed&&(0,z.jsxs)(S,{size:`sm`,disabled:p,onClick:()=>void J({remove:[Z]}),children:[(0,z.jsx)(x,{"aria-hidden":`true`}),`Drop it`]}),(0,z.jsx)(S,{size:`sm`,variant:`ghost`,disabled:ut,onClick:()=>void Xe(),children:`Write the test anyway`})]})]}),Ke&&(0,z.jsx)(je,{id:Ke,onEnd:()=>Ye(!1),label:`The Coding agent writing the test`,done:`The test is written.`,failed:`The test could not be written.`},Ke),o.blocksFound?.map(e=>(0,z.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-x-3 gap-y-2 rounded-[12px] bg-accent-soft px-3 py-2.5 text-sm text-ink`,children:[(0,z.jsx)(t,{icon:re,size:16,className:`flex-none`}),(0,z.jsxs)(`span`,{className:`min-w-0 flex-[1_1_240px]`,children:[`Steps `,e.from+1,` to `,e.to+1,` are the block `,(0,z.jsx)(`strong`,{className:`font-semibold`,children:e.name}),`: the test can call its helper instead.`]}),(0,z.jsx)(S,{size:`sm`,disabled:p,onClick:()=>void J({useBlock:{block:e.block,from:e.from}}),children:`Use the block`})]},`${e.block}-${e.from}`)),(0,z.jsx)(`div`,{role:`tablist`,"aria-label":`This recording`,className:ke,children:dt.map(e=>(0,z.jsxs)(`button`,{type:`button`,role:`tab`,id:`rev-tab-${e.id}`,"aria-selected":h===e.id,"aria-controls":`rev-panel-${e.id}`,onClick:()=>_(e.id),className:Oe(h===e.id),children:[e.label,e.n!==void 0&&(0,z.jsx)(`span`,{className:`text-[12px] text-muted tabular-nums`,children:e.n}),e.id===`run`&&Y&&(0,z.jsx)(`span`,{"aria-label":Y.ok?`passed`:`failed`,className:N(`size-2 rounded-full`,Y.ok?`bg-pass`:`bg-fail`)})]},e.id))}),(0,z.jsxs)(`div`,{role:`tabpanel`,id:`rev-panel-${h}`,"aria-labelledby":`rev-tab-${h}`,className:`flex min-w-0 flex-col gap-4`,children:[h===`steps`&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(E,{id:`rev-step-search`,label:`Find a step`,value:ue,onChange:de}),(0,z.jsx)(te,{items:[{id:`all`,label:`All`,n:o.steps.length},{id:`checks`,label:`Checks`,n:rt},...ot?[{id:`failed`,label:`Failed`,n:ot,alert:!0}]:[]],value:me,onChange:ge}),(0,z.jsx)(`span`,{className:`flex-1`}),(0,z.jsxs)(S,{size:`sm`,variant:`ghost`,disabled:P||p,onClick:()=>void $e(),"data-tip":`One model call reads the pages after each step and suggests checks and test data`,children:[(0,z.jsx)(v,{"aria-hidden":`true`}),P?`Asking the model…`:`Suggest checks`]})]}),Ce&&(0,z.jsx)(`p`,{className:`m-0 text-[13px] text-muted [overflow-wrap:anywhere]`,children:Ce}),M&&M.length>0&&(0,z.jsxs)(`div`,{className:`flex flex-col gap-1.5 rounded-[12px] border border-accent-line bg-accent-soft px-3 py-2.5 text-ink`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,z.jsx)(t,{icon:v,size:14}),(0,z.jsx)(`span`,{className:`flex-1 font-medium`,children:`The model suggests`}),(0,z.jsx)(S,{size:`sm`,disabled:p,onClick:()=>void tt(M),children:`Add all`}),(0,z.jsx)(S,{size:`icon`,variant:`icon`,"aria-label":`Dismiss the suggestions`,onClick:()=>ve(null),className:`size-8`,children:(0,z.jsx)(he,{size:14,"aria-hidden":`true`})})]}),(0,z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:M.map(e=>(0,z.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-[13.5px]`,children:[(0,z.jsxs)(`span`,{className:`min-w-0 flex-[1_1_240px] [overflow-wrap:anywhere]`,children:[e.kind===`data`||e.kind===`unique`?e.label:`After step ${e.after+1}: ${e.label}`,e.why&&(0,z.jsxs)(`span`,{className:`text-ink-2`,children:[` · `,e.why]})]}),(0,z.jsx)(S,{size:`sm`,variant:`ghost`,disabled:p,onClick:()=>void tt([e]),children:`Add`})]},`${e.after}-${e.kind}-${e.text}`))})]}),ct.length===0?(0,z.jsx)(`p`,{className:`m-0 rounded-[12px] card border px-4 py-4 text-sm text-muted`,children:`No step matches.`}):(0,z.jsx)(`ol`,{className:`m-0 flex list-none flex-col overflow-hidden rounded-[12px] card border p-0`,children:ct.map((n,a)=>{let o=it.get(n.index),c=n.op===`expect`;return(0,z.jsxs)(`li`,{id:`step-${n.index}`,className:N(`flex scroll-mt-48 flex-col`,a>0&&`border-t border-line-soft`,o&&!o.ok&&`bg-fail-soft`),children:[(0,z.jsxs)(`div`,{className:`group flex min-h-11 items-start gap-3 px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`w-6 flex-none pt-0.5 text-right font-mono text-[12px] text-muted tabular-nums`,children:n.index+1}),(0,z.jsx)(`span`,{className:`flex w-4 flex-none justify-center pt-1`,children:o?o.skipped?(0,z.jsx)(fe,{size:14,"aria-label":`Not replayed`,className:`text-muted`}):o.ok?(0,z.jsx)(i,{size:14,strokeWidth:2.5,"aria-label":`Passed on the last run`,className:`text-pass`}):(0,z.jsx)(he,{size:14,strokeWidth:2.5,"aria-label":`Failed on the last run`,className:`text-fail`}):c?(0,z.jsx)(D,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`mt-1 size-1.5 rounded-full bg-line-strong`})}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[c&&(0,z.jsx)(A,{tone:`pass`,icon:!1,className:`min-h-5 px-2 text-[11px]`,children:`Check`}),(0,z.jsx)(`span`,{className:`min-w-0 text-[14px] text-ink [overflow-wrap:anywhere]`,children:n.line}),n.block&&(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-line px-2 py-px text-[11.5px] text-ink-2`,children:[(0,z.jsx)(t,{icon:re,size:11}),L.find(e=>e.id===n.block)?.name||n.block]})]}),n.note&&(0,z.jsxs)(`span`,{className:`text-[12.5px] text-ink-2`,children:[`Note: `,n.note]}),o&&!o.ok&&o.error&&(0,z.jsx)(`span`,{className:`line-clamp-2 text-[12.5px] text-fail [overflow-wrap:anywhere]`,"data-tip":o.error,children:o.error}),n.suggest&&n.suggest.length>0&&(0,z.jsxs)(`button`,{type:`button`,"aria-expanded":k===n.index,onClick:()=>le(k===n.index?null:n.index),className:`inline-flex cursor-pointer items-center gap-1 self-start border-0 bg-transparent p-0 text-[12.5px] font-medium text-accent-fg hover:text-accent-fg-hover`,children:[(0,z.jsx)(t,{icon:v,size:12}),k===n.index?`Hide the suggested checks`:`${j(n.suggest.length,`suggested check`)}`]})]}),(0,z.jsxs)(`span`,{className:`relative flex flex-none items-center gap-0.5`,children:[(0,z.jsx)(S,{size:`icon`,variant:`icon`,disabled:p,"aria-haspopup":`menu`,"aria-expanded":w===n.index,"aria-label":`Add after step ${n.index+1}`,"data-tip":`Add a check, a step or a note after this step`,onClick:()=>T(w===n.index?null:n.index),className:`size-8`,children:(0,z.jsx)(s,{"aria-hidden":`true`})}),(0,z.jsx)(we,{open:w===n.index,onClose:()=>T(null),label:`Add after step ${n.index+1}`,role:`dialog`,side:`auto`,className:`right-0 w-[min(360px,calc(100vw-48px))]`,children:(0,z.jsx)(Fe,{step:n,...r?{onRecordMore:()=>{T(null),r(n.index)}}:{},onAdd:e=>{T(null),J(e)}})}),n.shot&&(0,z.jsx)(S,{size:`icon`,variant:`icon`,"aria-label":`The page after step ${n.index+1}`,"aria-expanded":ae===n.index,"data-tip":`See the page after this step, and pick what to check`,onClick:()=>se(ae===n.index?null:n.index),className:`size-8`,children:(0,z.jsx)(xe,{"aria-hidden":`true`})}),!n.fixed&&(0,z.jsx)(S,{size:`icon`,variant:`icon`,disabled:p,"aria-label":`Drop step ${n.index+1}`,"data-tip":`Drop this step`,onClick:()=>void J({remove:[n.index]}),className:`size-8`,children:(0,z.jsx)(x,{"aria-hidden":`true`})})]})]}),k===n.index&&n.suggest&&n.suggest.length>0&&(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 pr-3 pb-2.5 pl-3 sm:pl-[76px]`,children:[(0,z.jsx)(`span`,{className:`text-[12.5px] text-ink-2`,children:`Add a check that`}),n.suggest.map(e=>(0,z.jsxs)(S,{size:`sm`,disabled:p,"data-tip":`Add this check after the step`,onClick:()=>void J({checks:[{after:n.index,kind:e.kind,text:e.text}]}),className:`h-7 min-h-7 max-w-full rounded-full px-2.5 text-[12.5px]`,children:[(0,z.jsx)(s,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{className:`truncate`,children:e.label})]},`${e.kind}-${e.text}`))]}),ae===n.index&&n.shot&&n.snap&&(0,z.jsx)(Pe,{runDir:e,step:n,busy:p,onPick:(e,t)=>void J({checks:[{after:n.index,kind:e,text:t}]})})]},`${n.index}-${n.line}`)})})]}),h===`data`&&(nt.length===0?(0,z.jsx)(ce,{className:`py-4`,children:`Nothing was typed or chosen in this recording, so it has no test data.`}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{className:`m-0 text-sm text-ink-2`,children:`Where each value you typed or chose comes from when the test runs.`}),(0,z.jsx)(`ul`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0`,children:nt.map((e,t)=>{let n=e.value,r=Me.filter(t=>e.op!==`select`||t.id===`typed`||t.id===`data`);return(0,z.jsxs)(`li`,{className:N(`flex flex-wrap items-center gap-x-4 gap-y-2 px-3 py-2.5`,t>0&&`border-t border-line-soft`),children:[(0,z.jsx)(`span`,{className:`w-6 flex-none text-right font-mono text-[12px] text-muted tabular-nums`,children:e.index+1}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col`,children:[(0,z.jsx)(`span`,{className:`text-[14px] text-ink [overflow-wrap:anywhere]`,children:e.line}),(0,z.jsx)(`span`,{className:`text-[12.5px] text-ink-2`,children:Me.find(e=>e.id===n.as)?.note})]}),(0,z.jsx)(F,{"aria-label":`Where the value of step ${e.index+1} comes from`,value:n.as,disabled:p,onChange:t=>void J({data:[{index:e.index,as:t.target.value}]}),className:`w-[200px] flex-none`,children:r.map(e=>(0,z.jsx)(`option`,{value:e.id,children:e.label},e.id))})]},e.index)})})]})),h===`run`&&U&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{className:`m-0 text-sm text-ink-2`,children:`Re-run plays the steps in a new browser, as the test will, so you know they work before the test is written. Choose where it runs and the values it types.`}),(0,z.jsxs)(`form`,{className:`flex flex-wrap items-end gap-3 rounded-[12px] card border p-3`,onSubmit:e=>{e.preventDefault(),Ze(null)},children:[U.environments.length>0&&(0,z.jsxs)(`label`,{className:`flex min-w-[180px] flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`Environment`,(0,z.jsxs)(F,{value:Ve,onChange:e=>W(e.target.value),children:[(0,z.jsx)(`option`,{value:``,children:`Where it was recorded`}),U.environments.map(e=>(0,z.jsxs)(`option`,{value:e,children:[e,e===U.environment?` (active)`:``]},e))]})]}),U.data.map(e=>(0,z.jsxs)(`label`,{className:`flex min-w-[160px] flex-1 flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[e.name,(0,z.jsx)(O,{value:He[e.name]??``,maxLength:300,onChange:t=>Ue({...He,[e.name]:t.target.value})})]},e.name)),(0,z.jsxs)(S,{type:`submit`,disabled:q||$||ut,children:[(0,z.jsx)(ie,{"aria-hidden":`true`}),q?`Running…`:$?`Another run is going`:`Re-run`]})]}),q&&(0,z.jsx)(A,{tone:`running`,children:`Playing the steps in a new browser…`}),!q&&!Y&&(0,z.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Not run yet.`}),Y&&(0,z.jsxs)(`div`,{role:`status`,className:`flex flex-col gap-2`,children:[(0,z.jsx)(`p`,{className:N(`m-0 text-sm font-semibold [overflow-wrap:anywhere]`,Y.ok?`text-pass`:`text-fail`),children:Y.ok?`All ${Y.steps.length} steps passed${Y.env?` on ${Y.env}`:``}${Y.ms?` in ${Math.round(Y.ms/1e3)}s`:``}.`:X?`Step ${X.n} failed${Y.env?` on ${Y.env}`:``}.`:`It did not get through${Y.env?` on ${Y.env}`:``}: ${Y.error||`the last page was not the recorded one`}`}),Y.steps.length>0&&(0,z.jsx)(`ol`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0 text-[13.5px]`,children:Y.steps.map((e,t)=>(0,z.jsxs)(`li`,{className:N(`flex items-start gap-2 px-3 py-1.5`,t>0&&`border-t border-line-soft`,!e.ok&&`bg-fail-soft`),children:[e.skipped?(0,z.jsx)(fe,{size:14,"aria-label":`Not replayed`,className:`mt-0.5 flex-none text-muted`}):e.ok?(0,z.jsx)(i,{size:14,strokeWidth:2.5,"aria-label":`Passed`,className:`mt-0.5 flex-none text-pass`}):(0,z.jsx)(he,{size:14,strokeWidth:2.5,"aria-label":`Failed`,className:`mt-0.5 flex-none text-fail`}),(0,z.jsx)(`span`,{className:`w-6 flex-none text-right font-mono text-[12px] text-muted tabular-nums`,children:e.n}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,z.jsxs)(`span`,{className:`text-ink [overflow-wrap:anywhere]`,children:[e.action,e.skipped?(0,z.jsx)(`span`,{className:`text-muted`,children:` (not replayed)`}):null]}),!e.ok&&e.error&&(0,z.jsx)(`span`,{className:`text-[12.5px] text-fail [overflow-wrap:anywhere]`,children:e.error})]})]},e.n))})]})]}),h===`instructions`&&(0,z.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm font-semibold text-ink`,children:[`Instructions for the Coding agent`,(0,z.jsx)(`span`,{className:`text-[13px] font-normal text-ink-2`,children:`Anything else about the test, in your words: where it goes, the page objects to use, its tags, what to leave out. Saved when you leave the box.`}),(0,z.jsx)(ne,{value:Ee,maxLength:4e3,rows:5,placeholder:`e.g. Put it in tests/checkout, use the CheckoutPage page object, and tag it @smoke.`,onChange:e=>I(e.target.value),onBlur:()=>Ee.trim()!==o.instructions&&void J({instructions:Ee.trim()}),className:`font-normal`})]}),h===`blocks`&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{className:`m-0 text-sm text-ink-2`,children:`Steps you do in many tests, like signing in, kept under a name: put them into other recordings, or start a new one from them. The Coding agent writes each block once, as a helper every test calls.`}),Ne===!0&&(0,z.jsx)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:`They are kept in .forgeqe/blocks/ and go into the repository with your next commit, so the team shares them.`}),Ne===!1&&(0,z.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-warn-soft px-3 py-2 text-[13px] text-ink`,children:[`Your .gitignore leaves .forgeqe/blocks/ out of the repository, so only you have these blocks. To share them with the team, ignore only `,(0,z.jsx)(`code`,{children:`.forgeqe/reports/`}),` (the run reports) there, not all of `,(0,z.jsx)(`code`,{children:`.forgeqe/`}),`.`]}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-[12px] card border p-3`,children:[(0,z.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2`,onSubmit:e=>{e.preventDefault(),B.name.trim()&&Qe()},children:[(0,z.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`Keep steps`,(0,z.jsx)(F,{"aria-label":`The first step of the block`,value:B.from,onChange:e=>V({...B,from:Number(e.target.value),to:Math.max(B.to,Number(e.target.value))}),className:`w-[84px]`,children:o.steps.map(e=>(0,z.jsx)(`option`,{value:e.index,children:e.index+1},e.index))})]}),(0,z.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`to`,(0,z.jsx)(F,{"aria-label":`The last step of the block`,value:B.to,onChange:e=>V({...B,to:Number(e.target.value)}),className:`w-[84px]`,children:o.steps.filter(e=>e.index>=B.from).map(e=>(0,z.jsx)(`option`,{value:e.index,children:e.index+1},e.index))})]}),(0,z.jsxs)(`label`,{className:`flex min-w-[180px] flex-1 flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`as the block`,(0,z.jsx)(O,{value:B.name,maxLength:80,placeholder:`Sign in`,onChange:e=>V({...B,name:e.target.value})})]}),(0,z.jsxs)(S,{type:`submit`,disabled:p||!B.name.trim(),children:[(0,z.jsx)(re,{"aria-hidden":`true`}),`Keep as a block`]})]}),Re&&(0,z.jsx)(`p`,{className:`m-0 text-[13px] text-pass`,children:Re}),L.length>0&&(0,z.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2 border-t border-line-soft pt-3`,onSubmit:e=>{e.preventDefault();let t=H.block||L[0].id;J({insert:{after:H.after,block:t}})},children:[(0,z.jsxs)(`label`,{className:`flex min-w-[180px] flex-1 flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`Put in the block`,(0,z.jsx)(F,{"aria-label":`The block to put in`,value:H.block||L[0].id,onChange:e=>Le({...H,block:e.target.value}),children:L.map(e=>(0,z.jsxs)(`option`,{value:e.id,children:[e.name,` · `,e.steps,` `,e.steps===1?`step`:`steps`]},e.id))})]}),(0,z.jsxs)(`label`,{className:`flex flex-col gap-1 text-[13px] font-medium text-ink-2`,children:[`after step`,(0,z.jsx)(F,{"aria-label":`The step the block goes after`,value:H.after,onChange:e=>Le({...H,after:Number(e.target.value)}),className:`w-[84px]`,children:o.steps.map(e=>(0,z.jsx)(`option`,{value:e.index,children:e.index+1},e.index))})]}),(0,z.jsx)(S,{type:`submit`,disabled:p,children:`Put it in`})]})]})]}),h===`history`&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{className:`m-0 flex items-center gap-1.5 text-sm text-ink-2`,children:[(0,z.jsx)(t,{icon:l,size:15}),`Every change is kept: go back to any version, and you can come back from it too.`]}),(0,z.jsx)(`ol`,{className:`m-0 flex list-none flex-col rounded-[12px] card border p-0`,children:[...o.history,{n:0,at:``,change:`The recording as recorded`,steps:0}].map((e,t)=>(0,z.jsxs)(`li`,{className:N(`flex flex-wrap items-center gap-x-3 gap-y-1 px-3 py-2`,t>0&&`border-t border-line-soft`),children:[(0,z.jsxs)(`span`,{className:`w-8 flex-none font-mono text-[12px] text-muted tabular-nums`,children:[`v`,e.n]}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_220px] flex-col`,children:[(0,z.jsx)(`span`,{className:`text-[14px] text-ink [overflow-wrap:anywhere]`,children:e.change}),e.at&&(0,z.jsxs)(`span`,{className:`text-[12.5px] text-muted`,children:[De(e.at),` · `,j(e.steps,`step`)]})]}),t===0?(0,z.jsx)(A,{tone:`neutral`,icon:!1,children:`Now`}):(0,z.jsxs)(S,{size:`sm`,variant:`ghost`,disabled:p,onClick:()=>void J({restore:e.n}),"data-tip":`Make this version the recording again; you can come back from it too`,children:[(0,z.jsx)(be,{"aria-hidden":`true`}),`Go back to this`]})]},e.n))})]})]})]})}function Pe({runDir:e,step:t,busy:n,onPick:r}){let[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(``);(0,R.useEffect)(()=>{let n=!1;return u.shot(e,t.shot).then(e=>!n&&a(e),e=>!n&&s(e.message)),()=>{n=!0}},[e,t.shot]);let c=t.snap,l=[...c.texts.map(e=>({...e,kind:`text`})),...c.fields.filter(e=>e.value).map(e=>({...e,kind:`value`}))].filter(e=>e.w>0&&e.h>0&&c.w>0&&c.h>0).sort((e,t)=>t.w*t.h-e.w*e.h),d=(e,t)=>`${Math.max(0,Math.min(100,e/t*100))}%`;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-2 pr-3 pb-3 pl-3 sm:pl-[76px]`,children:[(0,z.jsx)(`p`,{className:`m-0 text-[12.5px] text-muted`,children:`Click a text on the page to check that it shows; a field, to check its value.`}),o&&(0,z.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:o}),!i&&!o&&(0,z.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading the picture…`}),i&&(0,z.jsxs)(`div`,{className:`relative w-full max-w-[720px] overflow-hidden rounded-[10px] border border-line-soft`,style:{aspectRatio:`${c.w} / ${c.h}`},children:[(0,z.jsx)(`img`,{src:i,alt:`The page after step ${t.index+1}`,className:`absolute inset-0 size-full object-cover object-top`}),l.map((e,t)=>{let i=e.kind===`value`?`Check ${e.t} has the value "${e.value}"`:`Check the page shows "${e.t}"`;return(0,z.jsx)(`button`,{type:`button`,disabled:n,"aria-label":i,"data-tip":i,onClick:()=>r(e.kind,e.t),className:`absolute rounded-[3px] outline-none hover:bg-accent/15 hover:ring-2 hover:ring-accent focus-visible:bg-accent/15 focus-visible:ring-2 focus-visible:ring-accent`,style:{left:d(e.x,c.w),top:d(e.y,c.h),width:d(e.w,c.w),height:d(e.h,c.h)}},`${t}-${e.t}`)})]})]})}function Fe({step:e,onAdd:t,onRecordMore:n}){let[r,i]=(0,R.useState)(`check`),[a,o]=(0,R.useState)(``),[s,c]=(0,R.useState)(``),[l,u]=(0,R.useState)(e.note||``),d=e.index;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-2 p-2`,children:[(0,z.jsx)(`div`,{role:`tablist`,"aria-label":`What to add`,className:`flex gap-1 rounded-[9px] bg-surface-strong p-1`,children:[[`check`,`Check`],[`step`,`Step`],[`note`,`Note`]].map(([e,t])=>(0,z.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":r===e,onClick:()=>i(e),className:N(`flex-1 cursor-pointer rounded-[6px] border-0 px-2 py-1 text-[13px] font-medium`,r===e?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),children:t},e))}),r===`check`&&(0,z.jsxs)(z.Fragment,{children:[e.page&&(0,z.jsxs)(S,{size:`sm`,className:`justify-start`,onClick:()=>t({checks:[{after:d,kind:`url`}]}),children:[`The page is `,e.page]}),(0,z.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:e=>{e.preventDefault(),a.trim()&&t({checks:[{after:d,kind:`intent`,text:a.trim()}]})},children:[(0,z.jsx)(O,{value:a,maxLength:300,placeholder:`Or say what shows here, e.g. the order number`,onChange:e=>o(e.target.value)}),(0,z.jsx)(S,{type:`submit`,size:`sm`,variant:`primary`,disabled:!a.trim(),children:`Add the check`})]})]}),r===`step`&&(0,z.jsxs)(z.Fragment,{children:[n&&(0,z.jsxs)(`div`,{className:`flex flex-col gap-1 border-b border-line-soft pb-2`,children:[(0,z.jsxs)(S,{size:`sm`,onClick:n,children:[(0,z.jsx)(g,{"aria-hidden":`true`}),`Record more from here`]}),(0,z.jsx)(`span`,{className:`text-[12px] text-muted`,children:`The browser opens, does the steps up to here, and you record what comes next. A step that cannot be done, you redo by hand.`})]}),(0,z.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:e=>{e.preventDefault(),a.trim()&&t({steps:[{after:d,kind:`do`,text:a.trim()}]})},children:[(0,z.jsx)(O,{value:a,maxLength:300,placeholder:`In your words, e.g. choose the cheapest delivery`,onChange:e=>o(e.target.value)}),(0,z.jsx)(`span`,{className:`text-[12px] text-muted`,children:`The Coding agent finds the control on the page and does it here.`}),(0,z.jsx)(S,{type:`submit`,size:`sm`,variant:`primary`,disabled:!a.trim(),children:`Add the step`})]}),(0,z.jsxs)(`form`,{className:`flex gap-2 border-t border-line-soft pt-2`,onSubmit:e=>{e.preventDefault(),/^https?:\/\/\S+$/i.test(s.trim())&&t({steps:[{after:d,kind:`open`,url:s.trim()}]})},children:[(0,z.jsx)(O,{value:s,type:`url`,maxLength:2e3,placeholder:`Open a page: https://…`,onChange:e=>c(e.target.value),className:`min-w-0 flex-1`}),(0,z.jsx)(S,{type:`submit`,size:`sm`,disabled:!/^https?:\/\/\S+$/i.test(s.trim()),children:`Open`})]}),(0,z.jsx)(S,{size:`sm`,className:`justify-start`,onClick:()=>t({steps:[{after:d,kind:`back`}]}),children:`Go back a page`})]}),r===`note`&&(0,z.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:e=>{e.preventDefault(),t({notes:[{index:d,text:l.trim()}]})},children:[(0,z.jsx)(O,{value:l,maxLength:300,placeholder:`e.g. this is the cart page object`,onChange:e=>u(e.target.value)}),(0,z.jsx)(`span`,{className:`text-[12px] text-muted`,children:`For whoever writes the test; it is not a step.`}),(0,z.jsx)(S,{type:`submit`,size:`sm`,variant:`primary`,disabled:l.trim()===(e.note||``),children:l.trim()||!e.note?`Save the note`:`Remove the note`})]})]})}var Ie={navigate:m,back:pe,click:P,dblclick:P,input:c,press:c,select:b,upload:ue,expect:D,wait_for:p,capture:de,note:d,launch:ie,double_click:P,type:c,keys:c},B=t=>Ie[t]||(t.startsWith(`expect`)?D:e),V=new Set([`starting`,`recording`,`paused`,`stopping`]);function H(e,t){let n=Math.max(0,Math.round(((t?Date.parse(t):Date.now())-Date.parse(e))/1e3));return n<3600?`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`:`${Math.floor(n/3600)}h ${Math.floor(n%3600/60)}m`}async function Le(e){let{id:t}=await ye.start(`Turn the recording in ${e} into a test: call write_test with run_dir ${e} and unattended true.`,{});location.hash=n(`chats`,t)}async function Re(e){let{id:t}=await ye.start(`Replay the desktop workflow ${e}: call desktop_replay with workflow ${e}, and tell me how each step went.`,{});location.hash=n(`chats`,t)}function ze({s:e,live:t,onDelete:n}){let r=B(e.op);return(0,z.jsxs)(`li`,{className:`group flex min-h-[44px] items-start gap-3 border-t border-line-soft py-2 first:border-t-0`,children:[(0,z.jsx)(`span`,{className:`w-6 flex-none pt-0.5 text-right text-[13px] text-muted tabular-nums`,children:e.n}),(0,z.jsx)(r,{size:16,"aria-hidden":`true`,className:N(`mt-0.5 flex-none`,e.op.startsWith(`expect`)?`text-pass`:`text-muted`)}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,z.jsx)(`span`,{className:`text-sm [overflow-wrap:anywhere]`,children:e.text}),(e.note||e.dynamic||e.inferred||e.case_step)&&(0,z.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-[12px] text-muted`,children:[e.case_step?(0,z.jsxs)(`span`,{children:[`case step `,e.case_step]}):null,e.dynamic&&(0,z.jsx)(`span`,{children:`value changes between runs`}),e.inferred&&(0,z.jsx)(`span`,{children:`added by ForgeQE`}),e.note&&(0,z.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[`note: `,e.note]})]})]}),t&&e.n>1&&(0,z.jsx)(S,{variant:`icon`,size:`icon`,"aria-label":`Delete step ${e.n}`,onClick:n,className:`size-8 flex-none opacity-60 group-hover:opacity-100`,children:(0,z.jsx)(x,{"aria-hidden":`true`})})]})}function U({s:e,send:n,busy:i}){let[,a]=(0,R.useState)(0);(0,R.useEffect)(()=>{let e=setInterval(()=>a(e=>e+1),1e3);return()=>clearInterval(e)},[]);let o=(0,R.useRef)(null),s=(0,R.useRef)(null);(0,R.useEffect)(()=>{o.current&&(o.current.scrollTop=o.current.scrollHeight)},[e.log.length]),(0,R.useEffect)(()=>{s.current&&(s.current.scrollTop=s.current.scrollHeight)},[e.steps.length]);let c=e.kind===`desktop`,l=e.state===`paused`,u=e.log.at(-1)?.level===`warn`&&/press Stop again/i.test(e.log.at(-1).text),d=Math.max(0,...e.steps.map(e=>e.case_step||0));return(0,z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3 rounded-[14px] card border px-4 py-3`,children:[l?(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 flex-none rounded-full bg-warn`}):(0,z.jsx)(h,{state:e.state===`starting`?`waiting`:e.state===`stopping`?`working`:`recording`,px:20}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-0.5`,children:[(0,z.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.name}),(0,z.jsxs)(`span`,{className:`truncate text-[13px] text-muted`,children:[e.state===`starting`?c?`Starting ${e.app}…`:`Opening the browser…`:e.state===`stopping`?`Saving the workflow…`:l?`Paused: what you do now is not recorded`:`Recording`,` · `,H(e.startedAt),` ·`,` `,c?`${e.app}, a desktop app`:e.url]}),e.block&&(0,z.jsx)(`span`,{className:N(`text-[13px] [overflow-wrap:anywhere]`,e.block.state===`stopped`?`text-warn`:`text-muted`),children:e.block.kind===`recording`?e.block.state===`waiting`?`The recording's steps up to step ${e.block.total+1} play when the page is open.`:e.block.state===`playing`?`Doing the recording's steps up to step ${e.block.total+1}: wait for it.`:e.block.state===`done`?`At step ${e.block.total+1}: record what comes next, then Stop and save.`:`Step ${e.block.done+2} could not be done${e.block.note?` (${e.block.note})`:``}: do it and what follows by hand; it takes the place of steps ${e.block.done+2} to ${e.block.total+1}.`:e.block.state===`waiting`?`The block "${e.block.name}" plays when the page is open.`:e.block.state===`playing`?`Doing the block "${e.block.name}" (${e.block.total} steps): wait for it.`:e.block.state===`done`?`The block "${e.block.name}" is done: carry on.`:`The block "${e.block.name}" stopped after ${e.block.done} of ${e.block.total} steps${e.block.note?` (${e.block.note})`:``}: do the rest by hand.`})]}),!c&&(0,z.jsxs)(S,{disabled:i||e.state===`starting`,onClick:()=>n({cmd:`pause`}),children:[l?(0,z.jsx)(ie,{"aria-hidden":`true`}):(0,z.jsx)(k,{"aria-hidden":`true`}),l?`Resume`:`Pause`]}),!c&&(0,z.jsxs)(S,{disabled:i||e.state===`starting`||!e.steps.length,onClick:()=>n({cmd:`undo`}),"data-tip":`Remove the last step`,children:[(0,z.jsx)(ve,{"aria-hidden":`true`}),`Undo`]}),(0,z.jsxs)(S,{variant:`destructive`,disabled:i||e.state===`stopping`,onClick:()=>n({cmd:`stop`,...u?{force:!0}:{}}),children:[(0,z.jsx)(r,{fill:`currentColor`,"aria-hidden":`true`}),u?`Stop anyway`:`Stop and save`]})]}),c?(0,z.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-accent-soft px-4 py-3 text-sm leading-relaxed text-ink-2`,children:[e.app,` is open on this computer: do the steps in it. Only clicks and keys in its own windows are recorded; password fields are saved as secret names, never as what you type. In the app, `,(0,z.jsx)(`strong`,{children:`Ctrl+Shift+F11`}),` over a control adds a check of what it shows, and `,(0,z.jsx)(`strong`,{children:`Ctrl+Shift+F12`}),` or closing the app stops.`]}):(0,z.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-accent-soft px-4 py-3 text-sm leading-relaxed text-ink-2`,children:[`Do the steps in the browser on this computer: each click, entry and choice is recorded. When you stop, you choose the checks and the test data here. In the page, `,e.leader,` then `,(0,z.jsx)(`strong`,{children:`P`}),` pauses, `,(0,z.jsx)(`strong`,{children:`Z`}),` undoes the last step and `,(0,z.jsx)(`strong`,{children:`S`}),` stops.`]}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-6 gap-y-5`,children:[(0,z.jsxs)(`section`,{"aria-labelledby":`rec-steps`,className:`flex min-w-0 flex-[999_1_420px] flex-col gap-2 rounded-[14px] card border px-4 py-3`,children:[(0,z.jsxs)(`h2`,{id:`rec-steps`,className:`m-0 flex items-center gap-2 text-base font-semibold`,children:[(0,z.jsx)(t,{icon:b,size:18,className:`text-accent-fg`}),`Steps`,(0,z.jsx)(`span`,{className:`text-sm font-normal text-muted`,children:e.summary})]}),e.steps.length?(0,z.jsx)(`div`,{ref:s,className:`max-h-[60vh] overflow-y-auto`,children:(0,z.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,"aria-live":`polite`,children:e.steps.map(e=>(0,z.jsx)(ze,{s:e,live:!c,onDelete:()=>n({cmd:`delete`,n:e.n})},`${e.n}-${e.text}`))})}):(0,z.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:e.state===`starting`?c?`Starting ${e.app}…`:`Opening the browser…`:`Nothing yet: do the first step in ${c?e.app:`the browser`}.`})]}),(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-5`,children:[e.case&&(0,z.jsxs)(`section`,{"aria-labelledby":`rec-case`,className:`flex flex-col gap-2 rounded-[14px] card border px-4 py-3`,children:[(0,z.jsxs)(`h2`,{id:`rec-case`,className:`m-0 flex items-center gap-2 text-base font-semibold`,children:[(0,z.jsx)(t,{icon:b,size:18,className:`text-accent-fg`}),e.case.id]}),(0,z.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[e.case.title,`. Each step you record belongs to the case step you are on: pick one to record it.`]}),(0,z.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,children:e.case.steps.map(t=>{let r=e.steps.some(e=>e.case_step===t.n);return(0,z.jsx)(`li`,{className:`border-t border-line-soft first:border-t-0`,children:(0,z.jsxs)(`button`,{type:`button`,disabled:i,"aria-current":t.n===d?`step`:void 0,onClick:()=>n({cmd:`case_step`,n:t.n}),className:N(`flex w-full cursor-pointer items-start gap-2 rounded-[10px] border-0 bg-transparent px-2 py-2 text-left text-sm text-ink hover:bg-surface-muted`,t.n===d&&`bg-accent-soft`),children:[r?(0,z.jsx)(D,{size:16,"aria-hidden":`true`,className:`mt-0.5 flex-none text-pass`}):(0,z.jsx)(`span`,{className:`mt-0.5 w-4 flex-none text-center text-[12px] text-muted`,children:t.n}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,z.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t.action}),t.expected&&(0,z.jsxs)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:[`Expect: `,t.expected]})]})]})},t.n)})}),(0,z.jsx)(S,{disabled:i,onClick:()=>n({cmd:`case_next`}),className:`self-start`,children:`Next case step`})]}),(0,z.jsxs)(`section`,{"aria-labelledby":`rec-log`,className:`flex flex-col gap-2 rounded-[14px] card border px-4 py-3`,children:[(0,z.jsx)(`h2`,{id:`rec-log`,className:`m-0 text-base font-semibold`,children:`What the recorder says`}),(0,z.jsx)(`div`,{ref:o,className:`flex max-h-[280px] flex-col gap-1 overflow-auto text-[13px]`,"aria-live":`polite`,children:e.log.length?e.log.map((e,t)=>(0,z.jsx)(`p`,{className:N(`m-0 [overflow-wrap:anywhere]`,e.level===`warn`?`text-warn`:e.level===`error`?`text-fail`:`text-ink-2`),children:e.text},t)):(0,z.jsxs)(`p`,{className:`m-0 text-muted`,children:[`Waiting for `,c?`the app`:`the browser`,`…`]})})]})]})]})]})}function Be({s:e}){let t=e.result,[n,r]=(0,R.useState)(``),[i,a]=(0,R.useState)(!1);if(!t)return null;let o=e.kind===`desktop`;return(0,z.jsxs)(`section`,{"aria-labelledby":`rec-result`,className:`flex flex-col gap-3 rounded-[14px] card border p-4`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(`h2`,{id:`rec-result`,className:`m-0 flex-1 text-base font-semibold [overflow-wrap:anywhere]`,children:e.name}),(0,z.jsx)(A,{tone:t.ok?`pass`:`fail`,children:t.ok?`Recorded`:`Not recorded`})]}),(0,z.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[t.ok?t.summary||e.summary:t.error||`Nothing was recorded.`,` `,e.endedAt&&(0,z.jsxs)(`span`,{className:`text-muted`,children:[`· `,H(e.startedAt,e.endedAt)]})]}),t.ok&&(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-sm`,children:[(0,z.jsx)(A,{tone:`neutral`,icon:!1,children:j(e.steps.length,`step`)}),(0,z.jsxs)(A,{tone:t.checks?`pass`:`warn`,children:[t.checks,` check`,t.checks===1?``:`s`]}),t.variables.length>0&&(0,z.jsxs)(A,{tone:`neutral`,icon:!1,children:[`kept: `,t.variables.join(`, `)]}),t.testData.length>0&&(0,z.jsxs)(A,{tone:`neutral`,icon:!1,children:[`test data: `,t.testData.join(`, `)]})]}),!o&&t.secrets.length>0&&(0,z.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[`The test reads`,` `,t.secrets.map((e,t)=>(0,z.jsxs)(`span`,{children:[t?`, `:``,(0,z.jsx)(`code`,{className:`font-mono text-[13px]`,children:e})]},e)),` `,`from the environment: what you typed there was not saved. Set `,t.secrets.length===1?`it`:`them`,` before the test runs.`]}),t.caseGaps.length>0&&(0,z.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-sm text-warn`,children:t.caseGaps.map(e=>(0,z.jsxs)(`li`,{children:[`No check for case step `,e.n,`: expects “`,e.expected,`”`]},e.n))}),(t.notes??[]).length>0&&(0,z.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-sm text-ink-2`,children:t.notes.map((e,t)=>(0,z.jsx)(`li`,{children:e},t))}),t.skipped.length>0&&(0,z.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-sm text-muted`,children:t.skipped.map((e,t)=>(0,z.jsxs)(`li`,{children:[`Not recorded: `,e.action,`: `,e.reason]},t))}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[o&&t.workflow&&(0,z.jsxs)(S,{variant:`primary`,disabled:i,onClick:async()=>{a(!0);try{await Re(t.workflow)}catch(e){r(e.message),a(!1)}},children:[(0,z.jsx)(be,{"aria-hidden":`true`}),`Replay it`]}),o&&t.report&&(0,z.jsxs)(S,{onClick:async()=>r(await _(t.report)),children:[(0,z.jsx)(w,{"aria-hidden":`true`}),`Open the report`]}),!o&&t.ok&&(0,z.jsxs)(S,{onClick:async()=>r(await _(`${e.runDir}/trace.md`)),children:[(0,z.jsx)(se,{"aria-hidden":`true`}),`Read the steps`]}),(0,z.jsx)(`span`,{className:`text-sm`,children:(0,z.jsx)(Se,{path:o&&t.workflow?t.workflow:e.runDir})}),n&&(0,z.jsx)(`span`,{className:`text-[13px] text-fail`,children:n})]})]})}function Ve({view:e,busy:t,onStart:r}){let[i,o]=(0,R.useState)(e.session?.kind===`desktop`&&e.desktop.available?`desktop`:`web`),[s,c]=(0,R.useState)(e.desktop.apps[0]??``),[l,u]=(0,R.useState)(e.apps[0]?.name??``),[d,f]=(0,R.useState)(``),[p,h]=(0,R.useState)(``),[_,v]=(0,R.useState)(e.environment??``),[b,x]=(0,R.useState)(!1),[C,w]=(0,R.useState)(!1),[te,T]=(0,R.useState)(``),E=i===`web`?e.blocks.find(e=>e.id===te):void 0,ne=i===`desktop`?e.desktop.available&&!!s:E||l?!0:/^https?:\/\/\S+$/i.test(d.trim()),re=i===`web`||e.environments.length>1;return(0,z.jsxs)(`form`,{"aria-labelledby":`rec-new`,className:`flex flex-col gap-3 rounded-[14px] card border p-4`,onSubmit:t=>{if(t.preventDefault(),ne){if(i===`desktop`)return r({kind:`desktop`,app:s,..._&&_!==e.environment?{env:_}:{}});if(E)return r({block:E.id,..._&&_!==e.environment?{env:_}:{},signedIn:b});r({...l?{app:l}:{url:d.trim()},...p.trim()?{case:p.trim()}:{},..._&&_!==e.environment?{env:_}:{},signedIn:b})}},children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,z.jsx)(`h2`,{id:`rec-new`,className:`m-0 flex-1 text-base font-semibold`,children:`New recording`}),(0,z.jsx)(`div`,{role:`radiogroup`,"aria-label":`What to record`,className:`flex gap-1 rounded-[10px] bg-surface-strong p-1`,children:[[`web`,`Web page`,m,!0],[`desktop`,`Desktop app`,M,e.desktop.available]].map(([t,n,r,a])=>(0,z.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":i===t,disabled:!a,"data-tip":a?void 0:e.desktop.reason||`Windows only.`,onClick:()=>o(t),className:N(`inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-[7px] border-0 px-3 text-sm font-medium disabled:cursor-not-allowed disabled:opacity-50`,i===t?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),children:[(0,z.jsx)(r,{size:14,"aria-hidden":`true`}),n]},t))})]}),(0,z.jsxs)(`div`,{className:`grid gap-2 @2xl:grid-cols-[minmax(0,1fr)_auto]`,children:[i===`desktop`?e.desktop.apps.length?(0,z.jsx)(F,{"aria-label":`App`,value:s,onChange:e=>c(e.target.value),children:e.desktop.apps.map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))}):(0,z.jsxs)(`p`,{className:`m-0 self-center text-sm text-muted`,children:[`No desktop apps yet: add one in `,(0,z.jsx)(`a`,{href:n(`settings`,`environments`),children:`Settings, Environments`}),`.`]}):E?(0,z.jsxs)(`p`,{className:`m-0 self-center text-sm [overflow-wrap:anywhere]`,children:[`Opens `,E.startUrl,`, does the block `,(0,z.jsx)(`strong`,{className:`font-semibold`,children:E.name}),` (`,E.steps,` `,E.steps===1?`step`:`steps`,`), then you carry on.`]}):(0,z.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[e.apps.length>0&&(0,z.jsxs)(F,{"aria-label":`Start on`,value:l,onChange:e=>u(e.target.value),className:N(l?`min-w-0 flex-1`:`w-[150px] flex-none`),children:[e.apps.map(e=>(0,z.jsxs)(`option`,{value:e.name,children:[e.name,` · `,e.url]},e.name)),(0,z.jsx)(`option`,{value:``,children:`Another page…`})]}),!l&&(0,z.jsx)(O,{"aria-label":`Page address`,type:`url`,value:d,spellCheck:!1,placeholder:`https://shop.example.com/`,onChange:e=>f(e.target.value),className:`min-w-0 flex-1`})]}),(0,z.jsxs)(S,{type:`submit`,variant:`primary`,disabled:t||!ne,children:[(0,z.jsx)(g,{"aria-hidden":`true`}),t?i===`desktop`?`Starting…`:`Opening…`:`Start recording`]})]}),re&&(0,z.jsxs)(`button`,{type:`button`,"aria-expanded":C,onClick:()=>w(!C),className:`inline-flex cursor-pointer items-center gap-1 self-start border-0 bg-transparent p-0 text-[13px] text-muted hover:text-ink`,children:[(0,z.jsx)(y,{size:14,"aria-hidden":`true`,className:N(`transition-transform`,C&&`rotate-180`)}),`More options`,!C&&(p||b||E||_&&_!==e.environment)?(0,z.jsx)(`span`,{className:`text-accent-fg`,children:`· set`}):null]}),(0,z.jsx)(a,{open:C,children:(0,z.jsxs)(`div`,{className:`grid gap-3 rounded-[12px] bg-surface-muted p-3 @2xl:grid-cols-2`,children:[i===`web`&&e.blocks.length>0&&(0,z.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm font-medium`,children:[`Start from a block `,(0,z.jsx)(`span`,{className:`-mt-1 text-[12.5px] font-normal text-muted`,children:`Its steps are done for you first, then you record the rest.`}),(0,z.jsxs)(F,{value:te,onChange:e=>T(e.target.value),children:[(0,z.jsx)(`option`,{value:``,children:`No block: start on the page`}),e.blocks.map(e=>(0,z.jsxs)(`option`,{value:e.id,children:[e.name,` · `,e.steps,` `,e.steps===1?`step`:`steps`]},e.id))]})]}),i===`web`&&(0,z.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm font-medium`,children:[`Test case `,(0,z.jsx)(`span`,{className:`-mt-1 text-[12.5px] font-normal text-muted`,children:`Its steps are listed while you record; each one you do is tied to it.`}),(0,z.jsx)(O,{value:p,spellCheck:!1,placeholder:`SHOP-12, ado:1234 or a file`,onChange:e=>h(e.target.value),className:`bg-bg`})]}),e.environments.length>1&&(i===`desktop`||!!l)&&(0,z.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm font-medium`,children:[`Environment`,(0,z.jsx)(F,{value:_,onChange:e=>v(e.target.value),children:e.environments.map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))})]}),i===`web`&&e.logins.length>0&&(0,z.jsxs)(`div`,{className:`flex items-center gap-3 @2xl:col-span-2`,children:[(0,z.jsx)(ee,{checked:b,onChange:x,label:`Start signed in`}),(0,z.jsxs)(`span`,{className:`flex flex-col`,children:[(0,z.jsx)(`span`,{className:`text-sm font-medium`,children:`Start signed in`}),(0,z.jsxs)(`span`,{className:`text-[12.5px] text-muted`,children:[`With the saved sign-ins (`,e.logins.join(`, `),`). Off: the sign-in is recorded too, its password saved as a variable name, never as typed.`]})]})]})]})}),(0,z.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:i===`desktop`?`The app starts on this computer; do the steps in it. It is saved as a workflow that replays with no model.`:`A browser opens on this computer: do the steps, then choose the checks and the test data here, and the Coding agent writes the test.`})]})}var W=20;function He({rows:e,onReview:n}){let[r,i]=(0,R.useState)(``),[a,o]=(0,R.useState)(``),[s,c]=(0,R.useState)(`all`),[l,u]=(0,R.useState)(0);if((0,R.useEffect)(()=>u(0),[a,s]),!e.length)return null;let d=a.toLowerCase().split(/\s+/).filter(Boolean),p=e.filter(e=>d.every(t=>`${e.name} ${e.caseId||``} ${e.app||``} ${e.startUrl}`.toLowerCase().includes(t))),h=s===`all`?p:p.filter(e=>e.kind===s),g=h.slice(l*W,l*W+W),v=e.some(e=>e.kind===`desktop`)&&e.some(e=>e.kind===`web`);return(0,z.jsxs)(`section`,{"aria-labelledby":`rec-list`,className:`flex min-w-0 flex-col gap-2`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(`h2`,{id:`rec-list`,className:`sr-only`,children:`Recordings`}),(0,z.jsx)(E,{id:`rec-search`,label:`Find a recording`,value:a,onChange:o}),v&&(0,z.jsx)(te,{items:[{id:`all`,label:`All`,n:p.length},{id:`web`,label:`Web`,n:p.filter(e=>e.kind===`web`).length},{id:`desktop`,label:`Desktop`,n:p.filter(e=>e.kind===`desktop`).length}],value:s,onChange:c})]}),r&&(0,z.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:r}),(0,z.jsxs)(`div`,{className:`rounded-[14px] card border`,children:[(0,z.jsxs)(`ul`,{className:`m-0 list-none p-1.5`,children:[g.length===0&&(0,z.jsx)(`li`,{className:`px-3 py-4 text-sm text-muted`,children:`Nothing matches.`}),g.map((e,r)=>{let a=Ce(e.startedAt);return(0,z.jsxs)(`li`,{className:`contents`,children:[(r===0||Ce(g[r-1].startedAt)!==a)&&(0,z.jsx)(`span`,{className:`block px-3 pt-3 pb-1 text-[12px] font-semibold text-muted`,children:a}),(0,z.jsxs)(`div`,{className:`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-3 rounded-[10px] px-3 py-1.5 hover:bg-surface-muted`,children:[e.ok?(0,z.jsx)(D,{size:16,"aria-label":`Recorded`,className:`text-pass`}):(0,z.jsx)(f,{size:16,"aria-label":`Not recorded`,className:`text-fail`}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[e.kind===`desktop`?(0,z.jsx)(t,{icon:M,size:13,className:`flex-none text-muted`,label:`Desktop app`}):(0,z.jsx)(t,{icon:m,size:13,className:`flex-none text-muted`,label:`Web page`}),(0,z.jsx)(`span`,{className:`truncate text-[14px] font-medium`,"data-tip":e.name,children:e.name})]}),(0,z.jsx)(`span`,{className:`truncate text-[12px] text-muted`,children:[j(e.steps,`step`),j(e.checks,`check`),e.caseId,e.app,De(e.startedAt)].filter(Boolean).join(` · `)})]}),(0,z.jsxs)(`span`,{className:`flex flex-none items-center gap-1`,children:[e.trace&&e.kind===`desktop`&&(0,z.jsx)(S,{size:`sm`,variant:`ghost`,"aria-label":`Read the steps of ${e.name}`,"data-tip":`Read the steps`,onClick:async()=>i(await _(e.trace)),children:`Steps`}),e.report&&(0,z.jsx)(S,{size:`sm`,variant:`ghost`,"aria-label":`Open the report of ${e.name}`,"data-tip":`Open the report`,onClick:async()=>i(await _(e.report)),children:`Report`}),e.kind===`desktop`&&e.workflow&&(0,z.jsxs)(S,{size:`sm`,onClick:()=>Re(e.workflow).catch(e=>i(e.message)),children:[(0,z.jsx)(be,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{className:`hidden @md:inline`,children:`Replay`})]}),e.kind===`web`&&e.ok&&(0,z.jsxs)(S,{size:`sm`,"aria-label":`Open ${e.name}`,onClick:()=>n(e.runDir),children:[(0,z.jsx)(b,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{className:`hidden @md:inline`,children:`Open`})]}),e.kind===`web`&&e.ok&&(0,z.jsxs)(S,{size:`sm`,onClick:()=>Le(e.runDir).catch(e=>i(e.message)),children:[(0,z.jsx)(_e,{"aria-hidden":`true`}),(0,z.jsx)(`span`,{className:`hidden @md:inline`,children:`Write a test`})]})]})]})]},e.runDir)})]}),(0,z.jsx)(me,{page:l,size:W,total:h.length,onPage:u,label:`Pages of recordings`})]})]})}function Ue({s:e}){let t=e.result;return!t||!(t.secrets.length+t.caseGaps.length+(t.notes??[]).length+t.skipped.length)?null:(0,z.jsxs)(`div`,{role:`status`,className:`flex flex-col gap-2 rounded-[12px] card border px-4 py-3 text-sm text-ink`,children:[(0,z.jsx)(`p`,{className:`m-0 font-semibold`,children:`Just recorded: worth knowing`}),t.secrets.length>0&&(0,z.jsxs)(`p`,{className:`m-0 text-ink-2`,children:[`The test reads`,` `,t.secrets.map((e,t)=>(0,z.jsxs)(`span`,{children:[t?`, `:``,(0,z.jsx)(`code`,{className:`font-mono text-[13px]`,children:e})]},e)),` `,`from the environment: what you typed there was not saved. Set `,t.secrets.length===1?`it`:`them`,` before the test runs.`]}),t.caseGaps.length>0&&(0,z.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-ink-2`,children:t.caseGaps.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsxs)(`span`,{className:`font-medium text-warn`,children:[`No check for case step `,e.n]}),`: expects “`,e.expected,`”`]},e.n))}),(t.notes??[]).length>0&&(0,z.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-ink-2`,children:t.notes.map((e,t)=>(0,z.jsx)(`li`,{children:e},t))}),t.skipped.length>0&&(0,z.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-ink-2`,children:t.skipped.map((e,t)=>(0,z.jsxs)(`li`,{children:[`Not recorded: `,e.action,`: `,e.reason]},t))})]})}function G(){let[e,t]=(0,R.useState)(null),[n,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(`new`),[s,c]=(0,R.useState)(``),[l,d]=(0,R.useState)(!1),f=(0,R.useCallback)(()=>{u.get().then(e=>{t(e),c(``)},e=>c(e.message))},[]);(0,R.useEffect)(f,[f]);let p=!!e?.session&&V.has(e.session.state);(0,R.useEffect)(()=>{if(!p)return;let e=setInterval(f,800);return()=>clearInterval(e)},[p,f]);let m=(0,R.useRef)(!1),h=e?.session;(0,R.useEffect)(()=>{p?m.current=!0:m.current&&h&&(m.current=!1,h.result?.ok&&h.kind===`web`&&r(h.runDir))},[p,h]);let _=async e=>{d(!0),c(``);try{t(await e())}catch(e){c(e.message)}finally{d(!1)}},v=(e,t)=>{r(null),window.scrollTo({top:0,behavior:`smooth`}),_(()=>u.start({more:{run:e,after:t}}))},y=e=>{r(e),window.scrollTo({top:0})},x=!!h?.result&&(h.kind===`desktop`||!h.result.ok);return(0,z.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,z.jsx)(le,{}),(0,z.jsxs)(`main`,{className:N(Ee,`@container flex-auto gap-4`),children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,z.jsx)(o,{pixel:ae.record,size:`lg`}),(0,z.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`Record`}),e&&!p&&!n&&(0,z.jsx)(`div`,{role:`tablist`,"aria-label":`Record`,className:`flex gap-1 rounded-[10px] bg-surface-strong p-1`,children:[[`new`,`New recording`,g],[`recordings`,`Recordings${e.recordings.length?` (${e.recordings.length})`:``}`,b]].map(([e,t,n])=>(0,z.jsxs)(`button`,{type:`button`,role:`tab`,id:`rec-tab-${e}`,"aria-selected":i===e,"aria-controls":`rec-panel`,onClick:()=>a(e),className:N(`inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-[7px] border-0 px-3 text-sm font-medium`,i===e?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),children:[(0,z.jsx)(n,{size:14,"aria-hidden":`true`}),t]},e))})]}),!n&&(0,z.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-ink-2`,children:`Do a test's steps yourself in a browser or a Windows app ForgeQE opens; each click, entry and choice is recorded in order, and you choose the checks after.`}),s&&(0,z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:s}),!e&&!s&&(0,z.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),e&&h&&p&&(0,z.jsx)(U,{s:h,busy:l,send:e=>void _(()=>u.command(e))}),e&&!p&&n&&(0,z.jsx)(Ne,{runDir:n,notices:h&&h.runDir===n?(0,z.jsx)(Ue,{s:h}):void 0,onRecordMore:e=>v(n,e),onClose:()=>{r(null),a(`recordings`),f()}},n),e&&!p&&!n&&(0,z.jsxs)(`div`,{role:`tabpanel`,id:`rec-panel`,"aria-labelledby":`rec-tab-${i}`,className:`flex min-w-0 flex-col gap-4`,children:[i===`new`&&(0,z.jsxs)(z.Fragment,{children:[x&&(0,z.jsx)(Be,{s:h}),h?.result?.ok&&h.kind===`web`&&(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 rounded-[12px] card border px-4 py-3 text-sm`,children:[(0,z.jsx)(D,{size:16,"aria-hidden":`true`,className:`flex-none text-pass`}),(0,z.jsxs)(`span`,{className:`min-w-0 flex-[1_1_240px] [overflow-wrap:anywhere]`,children:[`Last recorded: `,(0,z.jsx)(`strong`,{className:`font-semibold`,children:h.name}),(0,z.jsxs)(`span`,{className:`text-muted`,children:[` · `,j(h.steps.length,`step`)]})]}),(0,z.jsx)(S,{size:`sm`,onClick:()=>y(h.runDir),children:`Open`})]}),(0,z.jsx)(Ve,{view:e,busy:l,onStart:e=>void _(()=>u.start(e))})]}),i===`recordings`&&(e.recordings.length?(0,z.jsx)(He,{rows:e.recordings,onReview:y}):(0,z.jsx)(ce,{className:`py-4`,action:(0,z.jsx)(S,{size:`sm`,onClick:()=>a(`new`),children:`New recording`}),children:`No recordings yet.`}))]})]})]})}export{G as Record};
@@ -1,2 +0,0 @@
1
- import{$r as e,$t as t,Ai as n,At as r,Bi as i,Dn as a,Dt as o,Et as s,Ht as c,Ji as l,L as u,Ln as d,Mn as f,Nr as p,Or as m,Ot as h,Qt as g,Ri as _,Si as v,Un as y,Wi as b,Ya as x,Zt as S,_r as C,ao as w,ar as T,at as E,bn as D,co as O,ct as ee,fa as te,gt as ne,ht as re,ii as k,jn as A,mt as j,n as ie,nn as M,on as ae,ot as oe,pn as se,qr as ce,ro as le,rr as ue,sa as de,tn as N,ut as fe,vn as pe,wa as me,wi as he,wt as ge,yr as P}from"./Shell-2xDxqPtD.js";import{c as F,i as I,l as L,o as _e,r as ve}from"./index-CAbuIKyt.js";import{r as ye,t as be}from"./Response-C66KATyo.js";import{i as xe,r as Se,t as Ce}from"./segmented-7nur8ck_.js";import{a as we,c as R}from"./thread-RtF8vcSJ.js";import{r as Te}from"./families-DWe5Tf6V.js";var z=O(w(),1),B=le(),V={execution:`Execution`,report:`Report`,coding:`Coding`,chat:`Chat`},Ee={execution:P,report:T,coding:y,chat:k};function De({kind:e}){let n=Ee[e];return(0,B.jsx)(t,{icon:n,size:14,className:`flex-none text-muted`})}var Oe={passed:{label:`Passed`,tone:`pass`},failed:{label:`Failed`,tone:`fail`},error:{label:`Error`,tone:`fail`},skipped:{label:`Skipped`,tone:`neutral`},stopped:{label:`Stopped`,tone:`neutral`},blocked:{label:`Blocked`,tone:`warn`}},H=e=>Oe[e]||{label:e?e.charAt(0).toUpperCase()+e.slice(1).replace(/_/g,` `):`–`,tone:`neutral`},ke={suite:`Suite`,monitor:`Monitor round`,run:`Browser run`,explore:`Exploration`,api:`API run`,desktop:`Desktop run`,mobile:`App run`},Ae=e=>{if(!e)return``;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`};function U({title:e,icon:t,children:n,aside:r}){return(0,B.jsxs)(`section`,{className:`flex flex-col gap-3 border-t border-line-soft pt-6 first:border-t-0 first:pt-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsxs)(`h3`,{className:`m-0 flex flex-1 items-center gap-2 text-base font-semibold`,children:[(0,B.jsx)(`span`,{className:`text-accent-fg`,children:t}),e]}),r]}),n]})}function je({path:e,label:t=`Open report`}){let[n,r]=(0,z.useState)(``);return(0,B.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,B.jsxs)(S,{onClick:async()=>r(await h(e)),children:[(0,B.jsx)(ue,{"aria-hidden":`true`}),t]}),n&&(0,B.jsx)(`span`,{className:`text-[13px] text-fail`,children:n})]})}function Me({items:e,first:t,render:n}){let[r,i]=(0,z.useState)(!1);return(0,B.jsxs)(B.Fragment,{children:[(r?e:e.slice(0,t)).map(n),e.length>t&&(0,B.jsx)(`button`,{type:`button`,"aria-expanded":r,onClick:()=>i(!r),className:`min-h-8 cursor-pointer self-start border-0 bg-transparent px-0 text-[13px] font-medium text-accent-fg hover:underline`,children:r?`Show fewer`:`Show all ${e.length}`})]})}function Ne({c:e}){if(!e.total)return null;let t=t=>`${t/e.total*100}%`;return(0,B.jsxs)(`div`,{role:`img`,"aria-label":`${e.passed} passed, ${e.failed} failed, ${e.other} other, of ${e.total}`,className:`flex h-2 overflow-hidden rounded-full bg-surface-strong`,children:[(0,B.jsx)(`div`,{className:`bg-pass transition-[width] duration-200 ease-out`,style:{width:t(e.passed)}}),(0,B.jsx)(`div`,{className:`bg-fail transition-[width] duration-200 ease-out`,style:{width:t(e.failed)}}),(0,B.jsx)(`div`,{className:`bg-warn transition-[width] duration-200 ease-out`,style:{width:t(e.other)}})]})}function Pe({e}){let t=e.counts.total?Math.round(e.counts.passed/e.counts.total*100):0;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 border-t border-line-soft pt-3 first:border-t-0 first:pt-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-0.5`,children:[(0,B.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:[ke[e.scope]||e.scope,Ae(e.ms),e.tokens?`${u(e.tokens)} tokens`:``,e.stopped?`stopped early`:``].filter(Boolean).join(` · `)})]}),e.report&&(0,B.jsx)(je,{path:e.report})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,B.jsxs)(`span`,{className:`text-[22px] font-semibold tabular-nums`,children:[t,`%`]}),(0,B.jsx)(`span`,{className:`text-muted`,children:`passed`}),(0,B.jsxs)(j,{tone:`pass`,children:[e.counts.passed,` passed`]}),e.counts.failed>0&&(0,B.jsxs)(j,{tone:`fail`,children:[e.counts.failed,` failed`]}),e.counts.other>0&&(0,B.jsxs)(j,{tone:`warn`,children:[e.counts.other,` other`]}),(0,B.jsxs)(`span`,{className:`text-muted`,children:[`of `,e.counts.total]})]}),(0,B.jsx)(Ne,{c:e.counts}),e.cases.length>0&&(0,B.jsx)(`ul`,{"aria-label":`Cases of ${e.title}`,className:`m-0 flex list-none flex-col p-0`,children:(0,B.jsx)(Me,{items:[...e.cases].sort((e,t)=>Number(H(t.status).tone===`fail`)-Number(H(e.status).tone===`fail`)),first:6,render:(e,t)=>(0,B.jsxs)(`li`,{className:`flex min-w-0 items-start gap-3 border-t border-line-soft py-2 text-sm`,children:[(0,B.jsx)(`span`,{className:`w-[76px] flex-none`,children:(0,B.jsx)(j,{tone:H(e.status).tone,children:H(e.status).label})}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,B.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[e.id&&(0,B.jsx)(`span`,{className:`mr-1.5 font-mono text-[12px] text-muted`,children:e.id}),e.title,e.device&&(0,B.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.device]})]}),e.summary&&(0,B.jsx)(`span`,{className:`line-clamp-2 text-[13px] text-muted`,children:e.summary})]}),(0,B.jsx)(`span`,{className:`flex-none text-[13px] text-muted tabular-nums`,children:Ae(e.ms)})]},`${e.id}-${t}`)})}),e.folder&&!e.report&&(0,B.jsxs)(`span`,{className:`text-sm`,children:[`Kept in `,(0,B.jsx)(F,{path:e.folder})]})]})}function Fe({list:e}){let n=e.reduce((e,t)=>({total:e.total+t.counts.total,passed:e.passed+t.counts.passed,failed:e.failed+t.counts.failed}),{total:0,passed:0,failed:0});return(0,B.jsx)(U,{title:`Execution summary`,icon:(0,B.jsx)(t,{icon:P,size:18}),aside:e.length>1?(0,B.jsxs)(`span`,{className:`text-sm text-muted`,children:[M(e.length,`run`),` · `,n.passed,` of `,n.total,` passed`]}):void 0,children:e.length?e.map((e,t)=>(0,B.jsx)(Pe,{e},`${e.folder||e.title}-${t}`)):(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No results found for this run yet: they appear once its report is written.`})})}function Ie({list:e}){return(0,B.jsxs)(U,{title:`Report summary`,icon:(0,B.jsx)(t,{icon:T,size:18}),children:[e.length===0&&(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No report was written in this run.`}),e.map((e,t)=>(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 border-t border-line-soft pt-3 first:border-t-0 first:pt-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-0.5`,children:[(0,B.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.builtAt?`Written ${new Date(e.builtAt).toLocaleString([],{dateStyle:`medium`,timeStyle:`short`})}`:e.path?``:`Its page is not there any more`})]}),e.path&&(0,B.jsx)(je,{path:e.path})]}),e.stats&&(0,B.jsx)(`dl`,{className:`m-0 grid grid-cols-[repeat(auto-fit,minmax(110px,1fr))] gap-2`,children:e.stats.map(e=>(0,B.jsxs)(`div`,{className:`rounded-[10px] bg-surface-muted px-3 py-2`,children:[(0,B.jsx)(`dt`,{className:`text-[12px] text-muted`,children:e.label}),(0,B.jsx)(`dd`,{className:`m-0 text-[18px] font-semibold tabular-nums`,children:e.value})]},e.label))}),e.markdown&&(0,B.jsx)(Le,{text:e.markdown})]},`${e.path||e.title}-${t}`))]})}function Le({text:e,height:t=220}){let[n,r]=(0,z.useState)(!1),[i,a]=(0,z.useState)(!0),[o,s]=(0,z.useState)(t),c=(0,z.useRef)(null);return(0,z.useLayoutEffect)(()=>{c.current&&!n&&a(c.current.scrollHeight>t+8)},[e,t,n]),(0,B.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,B.jsxs)(`div`,{ref:c,style:o===void 0?void 0:{maxHeight:o},onTransitionEnd:e=>e.target===e.currentTarget&&n&&s(void 0),className:N(`transition-[max-height] duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)]`,o!==void 0&&`relative overflow-hidden`),children:[(0,B.jsx)(L,{text:e,className:`text-sm`}),!n&&i&&(0,B.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-bg to-transparent`})]}),(n||i)&&(0,B.jsx)(`button`,{type:`button`,"aria-expanded":n,onClick:()=>{let e=c.current?.scrollHeight??t;if(r(!n),ge())return s(n?t:void 0);s(e),n&&requestAnimationFrame(()=>requestAnimationFrame(()=>s(t)))},className:`min-h-8 cursor-pointer self-start border-0 bg-transparent px-0 text-[13px] font-medium text-accent-fg hover:underline`,children:n?`Show less`:`Show all of it`})]})}function Re(e){let t=e.join(`
2
- `),n=Math.max(2,...(t.match(/`+/g)||[]).map(e=>e.length)),r="`".repeat(n+1);return`${r}diff\n${t}\n${r}`}function ze({e}){let[t,n]=(0,z.useState)(!1),r=e.action===`write`?`New`:`Edited`;return(0,B.jsxs)(`li`,{className:`border-t border-line-soft`,children:[(0,B.jsxs)(`div`,{className:`flex min-h-[44px] min-w-0 items-center gap-2 py-1.5 text-sm`,children:[(0,B.jsx)(`button`,{type:`button`,"aria-expanded":t,"aria-label":`${t?`Hide`:`Show`} the diff of ${e.path}`,disabled:!e.diffs.length,onClick:()=>n(!t),className:`inline-flex size-8 flex-none cursor-pointer items-center justify-center rounded-lg border-0 bg-transparent text-muted hover:bg-surface-strong disabled:cursor-default disabled:opacity-40`,children:(0,B.jsx)(a,{size:16,"aria-hidden":`true`,className:N(`transition-transform duration-200`,t&&`rotate-90`)})}),(0,B.jsx)(`span`,{className:`w-[52px] flex-none text-[12px] text-muted`,children:r}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,B.jsx)(F,{path:e.path})}),(0,B.jsxs)(`span`,{className:`flex-none font-mono text-[12px] tabular-nums`,children:[(0,B.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.added]}),` `,(0,B.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.removed]})]})]}),(0,B.jsx)(o,{open:t,className:`pb-3 pl-10 [&_pre]:max-h-[420px] [&_pre]:overflow-auto`,children:e.diffs.length?(0,B.jsx)(L,{text:Re(e.diffs)}):null})]})}var Be={write:`New`,edit:`Edited`,delete:`Deleted`,"test written":`Test`};function W({label:e,children:t}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{className:`pt-0.5 text-[13px] text-muted`,children:e}),(0,B.jsx)(`dd`,{className:`m-0 min-w-0 text-sm [overflow-wrap:anywhere]`,children:t})]})}function Ve({c:e,files:n}){let r=e.edits.reduce((e,t)=>e+t.added,0),i=e.edits.reduce((e,t)=>e+t.removed,0),a=e.tests.filter(e=>!e.ok).length,o=e.reviews.at(-1),s=e.edits.length?[]:n.filter(e=>e.action&&e.action!==`read`);return(0,B.jsxs)(U,{title:`Code changes`,icon:(0,B.jsx)(t,{icon:y,size:18}),aside:e.edits.length?(0,B.jsxs)(`span`,{className:`font-mono text-[13px] tabular-nums`,children:[M(e.edits.length,`file`),` · `,(0,B.jsxs)(`span`,{className:`text-pass`,children:[`+`,r]}),` `,(0,B.jsxs)(`span`,{className:`text-fail`,children:[`−`,i]})]}):s.length?(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:M(s.length,`file`)}):void 0,children:[e.results.map((t,n)=>{let r=t.status===`passed`||t.status===`done`,i=t.status===`error`||t.status===`failed`;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-line-soft pb-4 last:border-b-0 last:pb-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,B.jsx)(P,{size:17,strokeWidth:2,"aria-hidden":`true`,className:r?`text-pass`:i?`text-fail`:`text-warn`}),(0,B.jsx)(`span`,{className:`text-[15px] font-semibold`,children:r?`Test written`:i?`Test not finished`:H(t.status).label}),(0,B.jsx)(j,{tone:r?`pass`:i?`fail`:`warn`,children:H(t.status).label}),e.tests.length>0&&(0,B.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[M(e.tests.length,`test run`),a?` (${a} failed)`:``,e.reviews.length?` · ${M(e.reviews.length,`review`)}`:``]})]}),(0,B.jsxs)(`dl`,{className:`m-0 grid grid-cols-1 gap-x-5 gap-y-1 sm:grid-cols-[110px_minmax(0,1fr)] sm:gap-y-3`,children:[t.testFile&&(0,B.jsx)(W,{label:`Test`,children:(0,B.jsx)(F,{path:t.testFile})}),t.command&&(0,B.jsx)(W,{label:`Run it`,children:(0,B.jsx)(ye,{text:t.command})}),(t.review||o)&&(0,B.jsx)(W,{label:`Review`,children:(0,B.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,B.jsx)(`span`,{children:(0,B.jsx)(j,{tone:(t.review??o).approved?`pass`:`warn`,children:(t.review??o).approved?`Approved`:`Changes asked`})}),(t.review?.summary||o?.summary)&&(0,B.jsx)(`span`,{className:`text-ink-2`,children:t.review?.summary||o?.summary})]})}),t.notes&&(0,B.jsx)(W,{label:`Notes`,children:(0,B.jsx)(L,{text:t.notes,className:`text-sm text-ink-2 [&_p]:my-0 [&_p+p]:mt-2`})})]}),t.error&&(0,B.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:t.error})]},n)}),e.edits.length>0&&(0,B.jsxs)(`div`,{className:`flex flex-col`,children:[(0,B.jsx)(`h4`,{className:`m-0 text-[13px] font-medium text-muted`,children:`Files changed`}),(0,B.jsx)(`ul`,{"aria-label":`Files changed`,className:`m-0 flex list-none flex-col p-0`,children:(0,B.jsx)(Me,{items:e.edits,first:8,render:e=>(0,B.jsx)(ze,{e},e.path)})})]}),s.length>0&&(0,B.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,B.jsx)(`h4`,{className:`m-0 text-[13px] font-medium text-muted`,children:`Files changed`}),(0,B.jsx)(`ul`,{"aria-label":`Files changed`,className:`m-0 flex list-none flex-col p-0`,children:s.map(e=>(0,B.jsxs)(`li`,{className:`flex min-h-9 min-w-0 items-center gap-3 border-t border-line-soft text-sm first:border-t-0`,children:[(0,B.jsx)(`span`,{className:`w-[52px] flex-none text-[12px] text-muted`,children:Be[e.action]||e.action.charAt(0).toUpperCase()+e.action.slice(1)}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,B.jsx)(F,{path:e.path})})]},e.path))}),(0,B.jsx)(`p`,{className:`m-0 text-[12.5px] text-muted`,children:`Their diffs were not kept for this run.`})]}),!e.edits.length&&!s.length&&!e.results.length&&(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No files changed.`}),e.edits.some(e=>!e.diffs.length)&&(0,B.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`A file without a diff was changed before ForgeQE kept diffs, or is a hidden or credential file, whose text is not kept.`})]})}function He({final:e,answer:t}){let n=e.from===`agent`?t?.files??[]:[],r=e.from!==`agent`,i=Math.max(2,...(e.text.match(/`+/g)||[]).map(e=>e.length)),a="`".repeat(i+1);return(0,B.jsxs)(U,{title:`Final message`,icon:(0,B.jsx)(C,{size:18,"aria-hidden":`true`}),aside:(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.from===`agent`?`The agent's last reply`:e.from===`job`?`The end of the job's output`:`What the command said at the end`}),children:[(0,B.jsx)(Le,{text:r?`${a}text\n${e.text}\n${a}`:R(e.text),height:420}),n.length>0&&(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,B.jsx)(`span`,{className:`text-muted`,children:`Files it names:`}),n.map(e=>(0,B.jsx)(F,{path:e},e))]})]})}var Ue={rule:{icon:se,label:`Rulebook`},decision:{icon:m,label:`Test decisions`},memory:{icon:pe,label:`Page memory`},replay:{icon:v,label:`Replays`},model:{icon:_,label:`Model`},skill:{icon:p,label:`Skills`}};function We({list:e}){let n=Object.keys(Ue).filter(t=>e.some(e=>e.kind===t));return(0,B.jsx)(U,{title:`Learnings`,icon:(0,B.jsx)(t,{icon:ce,size:18}),aside:e.length?(0,B.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[e.length,` from this session`]}):void 0,children:e.length===0?(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing learned or decided in this session: no rules, test decisions, page memory or model switches in its log.`}):(0,B.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(280px,1fr))] gap-x-6 gap-y-3`,children:n.map(n=>{let{icon:r,label:i}=Ue[n];return(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,B.jsxs)(`h4`,{className:`m-0 flex items-center gap-1.5 text-[13px] font-medium text-muted`,children:[(0,B.jsx)(t,{icon:r,size:14}),i]}),(0,B.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.filter(e=>e.kind===n).map((e,t)=>(0,B.jsxs)(`li`,{className:`flex flex-col gap-0.5 border-t border-line-soft py-1.5 text-sm first:border-t-0`,children:[(0,B.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.text}),e.note&&(0,B.jsx)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.note})]},t))})]},n)})})})}function Ge({run:e}){let t=[];return(e.executions.length||e.kind===`execution`)&&t.push({kind:`execution`,node:(0,B.jsx)(Fe,{list:e.executions},`e`)}),(e.reports.length||e.kind===`report`)&&t.push({kind:`report`,node:(0,B.jsx)(Ie,{list:e.reports},`r`)}),e.coding&&(e.coding.edits.length||e.coding.results.length||e.kind===`coding`)&&t.push({kind:`coding`,node:(0,B.jsx)(Ve,{c:e.coding,files:e.files},`c`)}),t.sort((t,n)=>Number(n.kind===e.kind)-Number(t.kind===e.kind)),(0,B.jsx)(B.Fragment,{children:t.map(e=>e.node)})}var Ke={running:{label:`Running`,tone:`running`},done:{label:`Done`,tone:`pass`},failed:{label:`Failed`,tone:`fail`},stopped:{label:`Stopped`,tone:`neutral`}},qe={chat:`Chat`,suite:`Suite`,monitor:`Monitor`,run:`Browser run`,start:`Chat`,heal:`Heal`,"pr-tests":`PR tests`,pack:`Pack`,pipeline:`Pipeline watch`,explore:`Explore`,api:`API tests`,generate:`Generate`,jobs:`Jobs service`},Je=e=>qe[e]||e.charAt(0).toUpperCase()+e.slice(1),G=e=>{if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString([],{month:`short`,day:`numeric`,...t.getFullYear()===new Date().getFullYear()?{}:{year:`numeric`},hour:`numeric`,minute:`2-digit`})},K=(e,t)=>Math.max(0,Math.round(((e.status===`running`?t:Date.parse(e.lastAt))-Date.parse(e.startedAt))/1e3)),q=e=>Number.isFinite(e)?e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m ${e%60}s`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`:`–`,J=e=>e.usage.input+e.usage.output;function Y(e){let[t,n]=(0,z.useState)(Date.now());return(0,z.useEffect)(()=>{if(!e)return;let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),t}function Ye({r:e}){return e.origin.kind===`web`?(0,B.jsxs)(`a`,{href:r(`chats`,e.origin.chat),className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(t,{icon:k,size:14}),`Web chat`]}):e.origin.kind===`job`?(0,B.jsxs)(`a`,{href:r(`jobs`,encodeURIComponent(e.origin.job)),className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(t,{icon:D,size:14}),`Job`]}):(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-muted`,children:[(0,B.jsx)(t,{icon:l,size:14}),`Terminal`]})}function Xe({status:t}){let n=Ke[t].label;return t===`running`?(0,B.jsx)(e,{size:16,"aria-label":n,className:`flex-none animate-spin text-accent-fg`}):t===`done`?(0,B.jsx)(A,{size:16,"aria-label":n,className:`flex-none text-pass`}):t===`failed`?(0,B.jsx)(d,{size:16,"aria-label":n,className:`flex-none text-fail`}):(0,B.jsx)(f,{size:16,"aria-label":n,className:`flex-none text-muted`})}var X=e=>e.status!==`running`&&!e.tools&&!e.turns&&!J(e)&&!e.files.length&&!e.outputs.length&&K(e,0)<2;function Ze(e){return/^forgeqe(-|$)|^engine$/.test(e)?c(e).name:e&&e.charAt(0).toUpperCase()+e.slice(1)}function Z({label:e,children:t}){return(0,B.jsxs)(`div`,{className:`grid grid-cols-[120px_minmax(0,1fr)] items-baseline gap-3 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:e}),(0,B.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:t})]})}function Q({title:e,children:t}){return(0,B.jsxs)(`section`,{className:`flex min-w-0 flex-col`,children:[(0,B.jsx)(`h3`,{className:`m-0 mb-1 text-[14px] font-semibold`,children:e}),t]})}var Qe={rerun:he,write_test:de,investigate:n,fix_test:te};function $e({actions:e}){let[n,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(``);if(!e.length)return null;let s=async e=>{i(e.prompt),o(``);try{let{id:t}=await me.start(e.prompt,{});location.hash=r(`chats`,t)}catch(e){o(e.message),i(``)}};return(0,B.jsxs)(`section`,{"aria-label":`Next steps`,className:`flex flex-col gap-2`,children:[(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map((e,r)=>(0,B.jsxs)(S,{disabled:!!n,onClick:()=>void s(e),"data-tip":e.note||void 0,className:`max-w-full min-w-0`,children:[(0,B.jsx)(t,{icon:Qe[e.kind],size:16,className:`flex-none`}),(0,B.jsx)(`span`,{className:`min-w-0 truncate`,children:n===e.prompt?`Opening a chat…`:e.label}),e.note&&(0,B.jsx)(`span`,{className:`min-w-0 flex-[1_1_0] truncate font-normal text-ink-2`,children:e.note})]},r))}),(0,B.jsx)(`span`,{className:`text-[12px] text-muted`,children:`Each opens a chat with the request; it asks before it changes anything.`}),a&&(0,B.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:a})]})}var et=e=>`\`${e.replace(/`/g,``)}\``,tt=[`summary`,`conversation`,`activity`,`details`],nt=e=>tt.find(t=>t===e)??`summary`;function rt({name:e,tab:t}){let[n,a]=(0,z.useState)(null),[o,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(!1),d=nt(t),f=t=>location.hash=t===`summary`?r(`runs`,encodeURIComponent(e)):r(`runs`,encodeURIComponent(e),t),p=(0,z.useCallback)(()=>{x.detail(e).then(e=>{a(e),s(``)},e=>s(e.message))},[e]);(0,z.useEffect)(p,[p]);let m=n?.status===`running`;(0,z.useEffect)(()=>{if(!m)return;let e=setInterval(p,2e3);return()=>clearInterval(e)},[p,m]);let h=Y(m),g=(0,z.useMemo)(()=>(n?.events??[]).map(we).filter(e=>!!e),[n?.events]),_=async()=>{l(!0),s(``);try{await x.cancel(e),p()}catch(e){s(e.message)}finally{l(!1)}},v=(0,B.jsxs)(`a`,{href:r(`runs`),className:`inline-flex items-center gap-1.5 text-sm`,children:[(0,B.jsx)(ae,{size:16,"aria-hidden":`true`}),`All runs`]});if(!n)return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[v,o?(0,B.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:o}):(0,B.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`})]});let y=Ke[n.status],b=!n.replies.length,C=!!n.final||n.executions.length>0||n.reports.length>0||!!(n.coding&&(n.coding.edits.length||n.coding.results.length))||n.learnings.length>0||n.outputs.length>0,w=[{id:`summary`,label:`Summary`},{id:`conversation`,label:b?`Command`:`Conversation`,n:n.replies.length||void 0},{id:`activity`,label:`Activity`,n:g.length||void 0},{id:`details`,label:`Details`}],T=new Set([...n.reports.map(e=>e.path),...n.executions.flatMap(e=>[e.report,e.folder])].filter(Boolean)),E=n.outputs.filter(e=>!T.has(e.path)),D=n.context?.limit?Math.round(n.context.tokens/n.context.limit*100):null;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[v,(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1.5`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,B.jsx)(`h2`,{className:`m-0 min-w-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:n.title}),(0,B.jsx)(j,{tone:y.tone,children:y.label})]}),(0,B.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-[13px] text-muted`,children:[(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(De,{kind:n.kind}),V[n.kind]]}),`· `,(0,B.jsx)(Ye,{r:n}),`· `,G(n.startedAt),` · `,m?`running for `:`took `,q(K(n,h)),` · `,u(J(n)),` tokens`,n.profile?.model?` · ${n.profile.model}`:``]})]}),n.cancel&&(0,B.jsxs)(S,{variant:`danger`,disabled:c,onClick:()=>void _(),children:[(0,B.jsx)(i,{fill:`currentColor`,"aria-hidden":`true`}),c?`Stopping…`:n.cancel===`chat`?`Stop this chat's work`:`Cancel this job's run`]})]}),o&&(0,B.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}),n.error&&(0,B.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:[(0,B.jsx)(`strong`,{children:`What went wrong:`}),` `,n.error]}),!m&&(0,B.jsx)($e,{actions:n.actions??[]}),(0,B.jsx)(`div`,{role:`tablist`,"aria-label":`This run`,className:Se,children:w.map(e=>(0,B.jsxs)(`button`,{type:`button`,role:`tab`,id:`run-tab-${e.id}`,"aria-selected":d===e.id,"aria-controls":`run-panel-${e.id}`,onClick:()=>f(e.id),className:xe(d===e.id),children:[e.label,e.n!==void 0&&(0,B.jsx)(`span`,{className:`text-[12px] text-muted tabular-nums`,children:e.n})]},e.id))}),(0,B.jsxs)(`div`,{role:`tabpanel`,id:`run-panel-${d}`,"aria-labelledby":`run-tab-${d}`,className:`flex min-w-0 flex-col gap-6`,children:[d===`summary`&&(0,B.jsxs)(B.Fragment,{children:[n.final&&(0,B.jsx)(He,{final:n.final,answer:n.answer}),(0,B.jsx)(Ge,{run:n}),E.length>0&&(0,B.jsx)(Q,{title:`What it produced (${E.length})`,children:E.map(e=>(0,B.jsx)(Z,{label:e.label,children:(0,B.jsx)(F,{path:e.path})},e.path))}),n.learnings.length>0&&(0,B.jsx)(We,{list:n.learnings}),!C&&(0,B.jsx)(re,{className:`py-4`,children:m?`Still working: its answer and what it produces show here when it ends.`:`This run left no answer, results or files. Its Activity shows what it did.`})]}),d===`conversation`&&(b?(0,B.jsx)(L,{text:et(n.prompt),className:`text-sm [&_p]:my-0`}):(0,B.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-4 p-0`,children:n.replies.map((e,t)=>(0,B.jsxs)(`li`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(`div`,{className:`self-end rounded-[14px] bg-surface-strong px-4 py-2.5 text-sm max-w-[85%]`,children:(0,B.jsx)(L,{text:e.ask,className:`[&_p]:my-0.5`})}),e.text&&(0,B.jsx)(L,{text:R(e.text),className:`text-sm`}),e.error&&(0,B.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e.error})]},t))})),d===`activity`&&(n.archived?(0,B.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-3 text-sm text-ink-2`,children:[`ForgeQE keeps the newest session logs only, and this run's is gone. Its summary, final message and learnings were kept in `,(0,B.jsx)(`code`,{className:`font-mono text-[13px]`,children:`.forgeqe/runs`}),`; its step-by-step activity was not.`]}):g.length?(0,B.jsx)(be,{timeline:!0,lines:g,start:n.startedAt,live:m,name:`forgeqe-run-${n.name.replace(/\.log$/,``)}.md`}):(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing logged yet.`})),d===`details`&&(0,B.jsxs)(`div`,{className:`grid items-start gap-x-12 gap-y-8 @3xl:grid-cols-2`,children:[(0,B.jsxs)(Q,{title:`Numbers`,children:[(0,B.jsx)(Z,{label:m?`Running for`:`Took`,children:q(K(n,h))}),(0,B.jsx)(Z,{label:`Tokens`,children:(0,B.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,B.jsxs)(`span`,{children:[u(J(n)),` `,(0,B.jsxs)(`span`,{className:`text-muted`,children:[`· `,u(n.usage.input),` read · `,u(n.usage.output),` written`,n.usage.cached?` · ${u(n.usage.cached)} cached`:``]})]}),(n.byAgent?.length??0)>1&&(0,B.jsx)(`span`,{className:`flex flex-col gap-0.5 text-[13px]`,children:n.byAgent.map(e=>(0,B.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-ink-2`,children:Ze(e.agent)}),(0,B.jsx)(`span`,{className:`text-muted tabular-nums`,children:u(e.input+e.output)})]},e.agent))})]})}),(0,B.jsxs)(Z,{label:`Context`,children:[n.context?u(n.context.tokens):`–`,D!==null&&(0,B.jsxs)(`span`,{className:`text-muted`,children:[` of `,u(n.context.limit),` (`,D,`%)`]})]}),(0,B.jsxs)(Z,{label:`Tool calls`,children:[n.tools,` `,(0,B.jsxs)(`span`,{className:`text-muted`,children:[`in `,M(n.turns,`turn`)]})]})]}),(0,B.jsxs)(Q,{title:`Session`,children:[(0,B.jsx)(Z,{label:`Started by`,children:(0,B.jsx)(Ye,{r:n})}),(0,B.jsx)(Z,{label:`Command`,children:Je(n.command)}),(0,B.jsx)(Z,{label:`Model`,children:n.profile?[n.profile.name,n.profile.model].filter(Boolean).join(` · `):`–`}),(0,B.jsx)(Z,{label:`Agents`,children:n.agents.length?(0,B.jsx)(`span`,{className:`flex flex-col gap-0.5`,children:n.agents.map(e=>(0,B.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:Ze(e.name)}),(0,B.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:M(e.calls,`call`)})]},e.name))}):(0,B.jsx)(`span`,{className:`text-muted`,children:`None`})}),(0,B.jsxs)(Z,{label:`Log`,children:[n.archived?(0,B.jsx)(`span`,{className:`text-muted`,children:`No longer kept: ForgeQE keeps the newest logs only`}):(0,B.jsx)(F,{path:`.forgeqe/logs/${n.name}`}),n.truncated&&(0,B.jsx)(`span`,{className:`block text-[13px] text-muted`,children:`Very long: only its start is shown.`})]})]}),n.job&&(0,B.jsxs)(Q,{title:`Job`,children:[(0,B.jsx)(Z,{label:`Job`,children:(0,B.jsx)(`a`,{href:r(`jobs`,encodeURIComponent(n.origin.kind===`job`?n.origin.job:n.job.name)),children:n.job.name})}),(0,B.jsx)(Z,{label:`Runs`,children:(0,B.jsx)(L,{text:et(n.job.command),className:`text-sm [&_p]:my-0`})}),(0,B.jsxs)(Z,{label:`Schedule`,children:[n.job.schedule,!n.job.enabled&&` (disabled)`,n.job.nextAt&&n.job.enabled?` · next ${G(n.job.nextAt)}`:``]}),n.job.run&&(0,B.jsxs)(Z,{label:`This run`,children:[n.job.run.reason===`asked`?`Asked for`:`On schedule`,`, `,n.job.run.status.replace(`_`,` `),n.job.run.exitCode!==void 0&&n.job.run.exitCode!==null?`, exit ${n.job.run.exitCode}`:``]})]}),(0,B.jsx)(Q,{title:`Files worked on (${n.files.length})`,children:n.files.length?[...n.files].sort((e,t)=>Number(e.action===`read`)-Number(t.action===`read`)).map(e=>(0,B.jsx)(Z,{label:e.action===`write`?`Written`:e.action===`edit`?`Edited`:e.action===`delete`?`Deleted`:e.action?e.action.charAt(0).toUpperCase()+e.action.slice(1):`Changed`,children:e.action===`delete`?(0,B.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.path}):(0,B.jsx)(F,{path:e.path})},e.path)):(0,B.jsx)(`p`,{className:`m-0 py-1 text-sm text-muted`,children:`No files changed.`})}),(0,B.jsx)(Q,{title:`Notifications`,children:n.notifications.length?n.notifications.map(e=>(0,B.jsx)(Z,{label:e.event.replace(/_/g,` `),children:e.channels.length?e.channels.join(`, `):(0,B.jsx)(`span`,{className:`text-muted`,children:`No channel takes it`})},e.event)):(0,B.jsx)(`p`,{className:`m-0 py-1 text-sm text-muted`,children:n.origin.kind===`terminal`||n.origin.kind===`web`?`None: notify channels go with jobs, suites and the monitor.`:`No notify channels are set up (Settings, Notify).`})})]})]})]})}var $=25;function it({runs:e}){let t=Y(e.some(e=>e.status===`running`)),[n,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(`all`),[s,c]=(0,z.useState)(``),[l,d]=(0,z.useState)(``),[f,p]=(0,z.useState)(!1),[m,h]=(0,z.useState)(0);(0,z.useEffect)(()=>h(0),[n,a,s,l,f]);let _=e.filter(X).length,v=n.toLowerCase().split(/\s+/).filter(Boolean),y=e.filter(e=>(f||!X(e))&&(!s||e.kind===s)&&(!l||e.origin.kind===l)&&v.every(t=>`${e.title} ${e.command} ${e.error||``}`.toLowerCase().includes(t))),x={all:y.length,running:y.filter(e=>e.status===`running`).length,failed:y.filter(e=>e.status===`failed`).length},S=a===`all`?y:y.filter(e=>e.status===a),C=Math.max(1,Math.ceil(S.length/$)),w=Math.min(m,C-1),T=S.slice(w*$,w*$+$),D=e.filter(e=>e.status!==`running`&&!X(e)),O=D.filter(e=>e.status===`failed`).length,te=D.length?D.reduce((e,n)=>e+K(n,t),0)/D.length:NaN,ne=e.reduce((e,t)=>e+J(t),0),k=[...new Set(e.map(e=>e.kind))],A=[...new Set(e.map(e=>e.origin.kind))],j={web:`Web chat`,job:`Job`,terminal:`Terminal`};return e.length===0?(0,B.jsx)(re,{icon:b,title:`No runs yet`,action:(0,B.jsx)(`a`,{className:g({size:`sm`}),href:r(),children:`Start a chat`}),children:`A chat here, a job, or a ForgeQE command in this project adds one.`}):(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1 text-[13px] text-muted`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-ink tabular-nums`,children:e.length-_}),` runs`]}),e.some(e=>e.status===`running`)&&(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-accent-fg tabular-nums`,children:e.filter(e=>e.status===`running`).length}),` running now`]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:N(`tabular-nums`,O?`text-fail`:`text-ink`),children:O}),` failed`,D.length?` (${Math.round(O/D.length*100)}%)`:``]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-ink tabular-nums`,children:u(ne)}),` tokens`]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-ink tabular-nums`,children:q(Math.round(te))}),` on average`]})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(ee,{id:`run-search`,label:`Find a run`,value:n,onChange:i,placeholder:`Find a run by what was asked`}),(0,B.jsx)(E,{items:[{id:`all`,label:`All`,n:x.all},{id:`running`,label:`Running`,n:x.running},{id:`failed`,label:`Failed`,n:x.failed,alert:!0}],value:a,onChange:o}),k.length>1&&(0,B.jsxs)(fe,{size:`sm`,"aria-label":`What it did`,value:s,onChange:e=>c(e.target.value),className:`w-auto pr-7 pl-3`,children:[(0,B.jsx)(`option`,{value:``,children:`Any kind`}),k.map(e=>(0,B.jsx)(`option`,{value:e,children:V[e]},e))]}),A.length>1&&(0,B.jsxs)(fe,{size:`sm`,"aria-label":`Started by`,value:l,onChange:e=>d(e.target.value),className:`w-auto pr-7 pl-3`,children:[(0,B.jsx)(`option`,{value:``,children:`Started anywhere`}),A.map(e=>(0,B.jsx)(`option`,{value:e,children:j[e]||e},e))]})]}),(0,B.jsxs)(`div`,{className:`rounded-[14px] card border`,children:[(0,B.jsxs)(`div`,{"aria-hidden":`true`,className:`hidden grid-cols-[auto_minmax(0,1fr)_104px_104px_72px_64px_92px] items-center gap-x-4 border-b border-line-soft px-4 py-2 text-[12px] font-semibold text-muted @3xl:grid`,children:[(0,B.jsx)(`span`,{className:`w-4`}),(0,B.jsx)(`span`,{children:`Run`}),(0,B.jsx)(`span`,{children:`Kind`}),(0,B.jsx)(`span`,{children:`Started by`}),(0,B.jsx)(`span`,{className:`text-right`,children:`Took`}),(0,B.jsx)(`span`,{className:`text-right`,children:`Tokens`}),(0,B.jsx)(`span`,{className:`text-right`,children:`When`})]}),(0,B.jsxs)(`ul`,{"aria-label":`Runs`,className:`m-0 list-none p-1.5`,children:[T.length===0&&(0,B.jsx)(`li`,{className:`px-3 py-4 text-sm text-muted`,children:`Nothing matches.`}),T.map((e,n)=>{let i=I(e.startedAt);return(0,B.jsxs)(`li`,{className:`contents`,children:[(n===0||I(T[n-1].startedAt)!==i)&&(0,B.jsx)(`span`,{className:`block px-3 pt-3 pb-1 text-[12px] font-semibold text-muted`,children:i}),(0,B.jsxs)(`a`,{href:r(`runs`,encodeURIComponent(e.name)),className:`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-3 rounded-[10px] px-3 py-1.5 text-ink no-underline hover:bg-surface-muted hover:text-ink @3xl:grid-cols-[auto_minmax(0,1fr)_104px_104px_72px_64px_92px] @3xl:gap-x-4`,children:[(0,B.jsx)(Xe,{status:e.status}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,B.jsx)(`span`,{className:`truncate text-[14px] font-medium`,"data-tip":e.title,children:e.title}),e.error?(0,B.jsx)(`span`,{className:`truncate text-[12px] text-fail`,children:e.error}):(0,B.jsx)(`span`,{className:`truncate text-[12px] text-muted @3xl:hidden`,children:[V[e.kind],j[e.origin.kind],q(K(e,t)),`${u(J(e))} tokens`].join(` · `)})]}),(0,B.jsxs)(`span`,{className:`hidden min-w-0 items-center gap-1.5 text-[13px] text-ink-2 @3xl:inline-flex`,children:[(0,B.jsx)(De,{kind:e.kind}),V[e.kind]]}),(0,B.jsx)(`span`,{className:`hidden text-[13px] text-ink-2 @3xl:block`,children:j[e.origin.kind]||e.origin.kind}),(0,B.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:q(K(e,t))}),(0,B.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:u(J(e))}),(0,B.jsx)(`span`,{className:`text-right text-[12.5px] text-muted tabular-nums`,"data-tip":G(e.startedAt),children:ve(e.startedAt)})]})]},e.name)})]}),(0,B.jsx)(oe,{page:w,size:$,total:S.length,onPage:h,label:`Pages of runs`,children:_>0&&(0,B.jsxs)(B.Fragment,{children:[` · `,(0,B.jsx)(`button`,{type:`button`,onClick:()=>p(!f),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:f?`Hide the ${M(_,`empty session`)}`:`${M(_,`empty session`)} hidden`})]})})]})]})}function at({sub:e}){let[t,n]=(0,z.useState)(null),[r,i]=(0,z.useState)(``),a=(0,z.useCallback)(()=>{x.list().then(e=>{n(e.runs),i(``)},e=>i(e.message))},[]);(0,z.useEffect)(a,[a]);let o=t?.some(e=>e.status===`running`);(0,z.useEffect)(()=>{if(e)return;let t=setInterval(a,o?3e3:2e4);return()=>clearInterval(t)},[a,o,e]);let[c,l]=(e||``).split(`/`),u=c?decodeURIComponent(c):``;return(0,B.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,B.jsx)(ie,{}),(0,B.jsx)(`main`,{className:N(_e,`@container flex-auto gap-4`),children:u?(0,B.jsx)(rt,{name:u,tab:l},u):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(s,{pixel:ne.runs,size:`lg`}),(0,B.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Runs`})]}),(0,B.jsx)(Ce,{label:`Runs and reports`,links:Te,current:`runs`})]}),(0,B.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-ink-2`,children:`Every ForgeQE session in this project: chats here, jobs' runs, and commands typed in a terminal, newest first. Open one for how it went and what it produced.`}),r&&(0,B.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:r}),!t&&!r&&(0,B.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&(0,B.jsx)(it,{runs:t})]})})]})}export{at as Runs,Xe as StatusIcon,nt as runTab};