@capagents/forgeqe 2.4.7 → 2.4.9

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 (70) hide show
  1. package/HOW_TO_USE.md +5 -5
  2. package/dist/docs-site/docs/search.js +1 -1
  3. package/dist/docs-site/docs/web-app/index.html +23 -5
  4. package/dist/forgeqe.js +951 -951
  5. package/dist/web/assets/Agent-DJMzvP5e.js +1 -0
  6. package/dist/web/assets/ApiTests-CatQogdX.js +2 -0
  7. package/dist/web/assets/Chat-BnMf86ti.js +3 -0
  8. package/dist/web/assets/Data-Dv1J1F3q.js +4 -0
  9. package/dist/web/assets/Features-BoUfO669.js +1 -0
  10. package/dist/web/assets/Jobs-DHLGBQQg.js +3 -0
  11. package/dist/web/assets/Quality-D0xYMvar.js +1 -0
  12. package/dist/web/assets/Record-Dnt4y9hn.js +1 -0
  13. package/dist/web/assets/Regression-icTMw-63.js +2 -0
  14. package/dist/web/assets/Reports-C_IwjymA.js +2 -0
  15. package/dist/web/assets/Response-DhcE4o_e.js +8 -0
  16. package/dist/web/assets/Runs-5qNwwohN.js +2 -0
  17. package/dist/web/assets/accessibility-BSaq_4Me.svg +1 -0
  18. package/dist/web/assets/architecture-CIPs2iKH.svg +1 -0
  19. package/dist/web/assets/board-De4ZOyTx.svg +1 -0
  20. package/dist/web/assets/bug-B7pnPQ6u.svg +1 -0
  21. package/dist/web/assets/chat-ByKQUaZd.svg +1 -0
  22. package/dist/web/assets/{circle-dashed-CQKCycSk.js → circle-dashed-DJoDKq93.js} +1 -1
  23. package/dist/web/assets/code-DP_IMakF.svg +1 -0
  24. package/dist/web/assets/columns-Cdba5l8P.svg +1 -0
  25. package/dist/web/assets/container-BlSeU5Ng.svg +1 -0
  26. package/dist/web/assets/database-BSuo036d.svg +1 -0
  27. package/dist/web/assets/desktop-D9wpHyJe.svg +1 -0
  28. package/dist/web/assets/download-DnYUCinL.svg +1 -0
  29. package/dist/web/assets/{external-link-B45wnQ3R.js → external-link-Cu8-HMUj.js} +1 -1
  30. package/dist/web/assets/file-BvaF4lYn.svg +1 -0
  31. package/dist/web/assets/folder-DoGRAApH.svg +1 -0
  32. package/dist/web/assets/frame-3JV5tjBP.js +3 -0
  33. package/dist/web/assets/index-C65qlV-q.css +2 -0
  34. package/dist/web/assets/index-XRjCGJfG.js +26 -0
  35. package/dist/web/assets/mail-BHhJmEvJ.svg +1 -0
  36. package/dist/web/assets/{markdown-BPBR6Fva.js → markdown-Bca_tHZ5.js} +8 -8
  37. package/dist/web/assets/mobile-CRD8AKgU.svg +1 -0
  38. package/dist/web/assets/plug-CWV9WI7K.svg +1 -0
  39. package/dist/web/assets/screenshot-DgZ3n28O.svg +1 -0
  40. package/dist/web/assets/scroll-DLy6uwQV.svg +1 -0
  41. package/dist/web/assets/server-CEXgEMcl.svg +1 -0
  42. package/dist/web/assets/shield-DrGhJtUn.svg +1 -0
  43. package/dist/web/assets/{sticky-note-D_lJfPYH.js → sticky-note-BHLEsD2N.js} +1 -1
  44. package/dist/web/assets/stories-qti4IEm9.svg +1 -0
  45. package/dist/web/assets/table-DhoLKkVp.svg +1 -0
  46. package/dist/web/assets/terminal-Dpps2Gv8.svg +1 -0
  47. package/dist/web/assets/ticket-BkD0O1SC.svg +1 -0
  48. package/dist/web/assets/{trending-up-Bypj2D7Z.js → trending-up-DWgCJxJf.js} +1 -1
  49. package/dist/web/assets/visual-F39z3SE0.svg +1 -0
  50. package/dist/web/assets/wikis-B3RB0wBj.svg +1 -0
  51. package/dist/web/index.html +3 -3
  52. package/docs/WEB_APP.md +25 -5
  53. package/forgeqe.example.yaml +2 -0
  54. package/package.json +1 -1
  55. package/dist/web/assets/ApiTests-D5YLst-t.js +0 -2
  56. package/dist/web/assets/Chat-DUZawyA0.js +0 -3
  57. package/dist/web/assets/Data-BOu8BrmB.js +0 -4
  58. package/dist/web/assets/Features-BCBzUoB7.js +0 -1
  59. package/dist/web/assets/Jobs-C-Tqj504.js +0 -3
  60. package/dist/web/assets/Quality-CzCArgrj.js +0 -1
  61. package/dist/web/assets/Record-CcHMCfs6.js +0 -1
  62. package/dist/web/assets/Regression-CgiNh2hj.js +0 -2
  63. package/dist/web/assets/Reports-CXRY0udx.js +0 -2
  64. package/dist/web/assets/Response-VUbDhVeF.js +0 -8
  65. package/dist/web/assets/Runs-kghxBY8X.js +0 -2
  66. package/dist/web/assets/file-chart-column-increasing-9rCBQxTk.js +0 -1
  67. package/dist/web/assets/frame-CHQgOaj6.js +0 -3
  68. package/dist/web/assets/index-CwX6YH3i.css +0 -2
  69. package/dist/web/assets/index-Hd8gmpz5.js +0 -26
  70. package/dist/web/assets/terminal-BZSHVR9y.js +0 -1
@@ -1 +0,0 @@
1
- import{A as e,At as t,Cn as n,En as r,Gn as i,H as a,Hn as o,S as s,U as c,at as l,ct as u,lt as d,mn as f,nt as p,q as m,r as h,rn as g,st as _,t as v}from"./frame-CHQgOaj6.js";import{t as y}from"./circle-dashed-CQKCycSk.js";import{n as b}from"./markdown-BPBR6Fva.js";import{C as x,s as S,w as C}from"./index-Hd8gmpz5.js";var w=i(o(),1),T=_(),E={ready:{label:`Ready`,tone:`pass`},partial:{label:`Ready, some parts need setup`,tone:`warn`},needs_setup:{label:`Needs setup`,tone:`neutral`}},D={models:`Models`,integrations:`Integrations`,monitor:`Monitor`,notifications:`Notifications`,agents:`Agents`,environments:`Environments`,containers:`Containers`,databases:`Databases`};async function O(e,t){try{let{id:t}=await n.start(e,{});location.hash=m(`chats`,t)}catch(e){t(e.message)}}function k({f:e,onScope:n,busy:i}){let[a,o]=(0,w.useState)(null),[s,f]=(0,w.useState)(``),[p,h]=(0,w.useState)(``);(0,w.useEffect)(()=>{r.detail(e.id).then(o,e=>f(e.message))},[e.id]);let g=e.gaps.filter(e=>!e.optional),_=e.gaps.filter(e=>e.optional);return(0,T.jsxs)(`div`,{className:`flex flex-col gap-4 py-4`,children:[[[g,`Needs`],[_,`Would do more with`]].map(([e,t])=>e.length?(0,T.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,T.jsx)(`span`,{className:`text-sm font-medium`,children:t}),(0,T.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:e.map((e,n)=>(0,T.jsxs)(`li`,{className:`flex flex-col gap-0.5 rounded-[10px] bg-bg px-3 py-2 text-sm`,children:[(0,T.jsx)(`span`,{className:u(t===`Needs`?`text-ink`:`text-ink-2`),children:e.missing}),(0,T.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.fix}),e.settings&&(0,T.jsxs)(`a`,{href:m(`settings`,e.settings),className:`inline-flex items-center gap-1 self-start text-[13px] font-medium`,children:[(0,T.jsx)(x,{size:13,"aria-hidden":`true`}),`Set it up in Settings, `,D[e.settings]||e.settings]})]},n))})]},t):null),e.inputs.length>0&&(0,T.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[`From your request: `,e.inputs.join(`; `),`.`]}),s&&(0,T.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:s}),a&&(0,T.jsxs)(T.Fragment,{children:[a.examples.length>0&&(0,T.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,T.jsx)(`span`,{className:`text-sm font-medium`,children:`Ask for it like this`}),(0,T.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:a.examples.slice(0,4).map(n=>(0,T.jsxs)(l,{size:`sm`,disabled:e.state===`needs_setup`,title:e.state===`needs_setup`?`Set it up first`:`Start a chat with this request`,onClick:()=>void O(n,h),className:`h-auto min-h-8 max-w-full py-1.5 text-left whitespace-normal`,children:[(0,T.jsx)(t,{size:14,"aria-hidden":`true`,className:`flex-none`}),n]},n))}),p&&(0,T.jsx)(`span`,{className:`text-[13px] text-fail`,children:p})]}),a.limits.length>0&&(0,T.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,T.jsx)(`span`,{className:`text-sm font-medium`,children:`What it does not do`}),(0,T.jsx)(`ul`,{className:`m-0 list-disc pl-5 text-sm text-ink-2`,children:a.limits.map(e=>(0,T.jsx)(`li`,{children:e},e))})]}),a.docs.length>0&&(0,T.jsxs)(`details`,{children:[(0,T.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:[`How it works (`,d(a.docs.length,`section`),`)`]}),(0,T.jsx)(`div`,{className:`mt-2 flex flex-col gap-4`,children:a.docs.map(e=>(0,T.jsxs)(`section`,{className:`rounded-[12px] bg-bg px-4 py-3`,children:[(0,T.jsx)(`h4`,{className:`m-0 mb-1 text-sm font-semibold`,children:e.heading}),(0,T.jsx)(b,{text:e.text,className:`text-sm`})]},e.heading))})]}),(0,T.jsxs)(`span`,{className:`font-mono text-[11.5px] text-muted [overflow-wrap:anywhere]`,children:[`Tools: `,a.tools.join(`, `)]})]}),(0,T.jsxs)(`label`,{className:`flex flex-wrap items-center gap-3 border-t border-line-soft pt-3 text-sm`,children:[(0,T.jsxs)(`span`,{className:`flex-[1_1_240px]`,children:[`The agent gets its tools`,(0,T.jsx)(`span`,{className:`block text-[13px] text-muted`,children:`agent.capabilities in forgeqe.yaml`})]}),(0,T.jsxs)(c,{value:e.scope,disabled:i,onChange:e=>n(e.target.value),className:`w-[240px]`,children:[(0,T.jsx)(`option`,{value:`auto`,children:`When a request is about it`}),(0,T.jsx)(`option`,{value:`always`,children:`Always`}),(0,T.jsx)(`option`,{value:`off`,children:`Never, in this project`})]})]})]})}function A(){let[t,n]=(0,w.useState)(null),[i,o]=(0,w.useState)(``),[c,l]=(0,w.useState)(``),[d,m]=(0,w.useState)(`all`),[_,b]=(0,w.useState)(``),[x,D]=(0,w.useState)(!1),O=(0,w.useCallback)(()=>r.view().then(n,e=>o(e.message)),[]);(0,w.useEffect)(()=>void O(),[O]);let A=(0,w.useMemo)(()=>{let e=_.toLowerCase().split(/\s+/).filter(Boolean);return(t?.areas||[]).map(t=>({...t,features:t.features.filter(n=>(d===`all`||(d===`ready`?n.state!==`needs_setup`:n.state!==`ready`))&&e.every(e=>`${n.title} ${n.summary} ${t.area}`.toLowerCase().includes(e)))})).filter(e=>e.features.length)},[t,d,_]),j=async(e,t)=>{D(!0);try{n(await r.scope(e,t)),o(``)}catch(e){o(e.message)}finally{D(!1)}},M=t?.counts;return(0,T.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,T.jsx)(h,{}),(0,T.jsxs)(`main`,{className:u(v,`flex-auto gap-5`),children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,T.jsx)(p,{icon:f,size:`lg`}),(0,T.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`What's ready`})]}),(0,T.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-muted`,children:`Everything ForgeQE can do, and whether it works here: in this project, with these settings, on this machine. Each one says what it still needs and where to set it up, and how to ask for it.`}),i&&(0,T.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}),!t&&!i&&(0,T.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&M&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,T.jsx)(s,{icon:f,label:`Ready`,value:String(M.ready)}),(0,T.jsx)(s,{icon:g,label:`Some parts need setup`,value:String(M.partial)}),(0,T.jsx)(s,{icon:y,label:`Need setup`,value:String(M.needs_setup)})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsx)(`div`,{role:`radiogroup`,"aria-label":`Show`,className:`flex gap-1 rounded-[10px] bg-surface-strong p-1`,children:[[`all`,`All`],[`needs`,`Needs setup`],[`ready`,`Ready`]].map(([e,t])=>(0,T.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":d===e,onClick:()=>m(e),className:u(`min-h-8 cursor-pointer rounded-[7px] border-0 px-3.5 text-sm font-medium`,d===e?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),children:t},e))}),(0,T.jsxs)(`div`,{className:`relative min-w-0 flex-[1_1_220px]`,children:[(0,T.jsx)(C,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted`}),(0,T.jsx)(a,{type:`search`,"aria-label":`Find a feature`,value:_,placeholder:`Find a feature`,onChange:e=>b(e.target.value),className:`pl-9`})]})]}),A.length===0&&(0,T.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing matches.`}),A.map(t=>(0,T.jsxs)(`section`,{"aria-labelledby":`area-${t.area}`,children:[(0,T.jsx)(`h2`,{id:`area-${t.area}`,className:`m-0 mb-1 text-base font-semibold`,children:t.area}),t.features.map(t=>(0,T.jsx)(e,{title:t.title,meta:(0,T.jsx)(`span`,{className:u(c!==t.id&&`line-clamp-2`),children:t.summary}),open:c===t.id,onToggle:()=>l(c===t.id?``:t.id),state:(0,T.jsxs)(`span`,{className:`flex flex-wrap items-center justify-end gap-1.5`,children:[t.scope!==`auto`&&(0,T.jsx)(S,{tone:`neutral`,icon:!1,children:t.scope===`always`?`Always given`:`Off here`}),(0,T.jsx)(S,{tone:E[t.state].tone,icon:t.state!==`needs_setup`,children:E[t.state].label})]}),children:(0,T.jsx)(k,{f:t,busy:x,onScope:e=>void j(t.id,e)})},t.id))]},t.area)),t.outOfScope.length>0&&(0,T.jsxs)(`section`,{"aria-labelledby":`oos-h`,className:`flex flex-col gap-2 rounded-[14px] border border-line-soft px-4 py-3`,children:[(0,T.jsx)(`h2`,{id:`oos-h`,className:`m-0 text-base font-semibold`,children:`Not what ForgeQE does`}),(0,T.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-sm`,children:t.outOfScope.map(e=>(0,T.jsxs)(`li`,{children:[e.what,e.instead?(0,T.jsxs)(`span`,{className:`text-muted`,children:[`; instead: `,e.instead]}):null]},e.what))})]})]})]})]})}export{A as Features};
@@ -1,3 +0,0 @@
1
- import{Dt as e,Et as t,Fn as n,G as r,Gn as i,H as a,Hn as o,K as s,Nt as c,S as l,U as u,Vt as d,_n as f,at as p,ct as m,fn as h,ht as g,it as _,kn as v,nt as y,pn as b,q as x,r as S,rt as C,sn as w,st as T,t as E,tt as D,wt as O,xt as k}from"./frame-CHQgOaj6.js";import{n as A,t as j}from"./markdown-BPBR6Fva.js";import{t as M}from"./external-link-B45wnQ3R.js";import{t as ee}from"./terminal-BZSHVR9y.js";import{D as N,j as P,k as F,s as I,y as L}from"./index-Hd8gmpz5.js";var R={name:`calendar-plus`,size:24,node:[[`path`,{d:`M16 18h6`,key:`987eiv`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`path`,{d:`M19 15v6`,key:`10aioa`}],[`path`,{d:`M21 11.5V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h8.3`,key:`jgwkxf`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M8 2v3`,key:`1ioesn`}]]};R.node;var z=f(R),B={name:`power`,size:24,node:[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]};B.node;var V=f(B),H={name:`search-check`,size:24,node:[[`path`,{d:`m8 11 2 2 4-4`,key:`1sed1v`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]};H.node;var U=f(H),W={name:`timer-off`,size:24,node:[[`path`,{d:`M10 2h4`,key:`n1abiw`}],[`path`,{d:`M4.6 11a8 8 0 0 0 1.7 8.7 8 8 0 0 0 8.7 1.7`,key:`10he05`}],[`path`,{d:`M7.4 7.4a8 8 0 0 1 10.3 1 8 8 0 0 1 .9 10.2`,key:`15f7sh`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M12 12v-2`,key:`fwoke6`}]]};W.node;var G=f(W),K=i(o(),1),q=T(),J={monitor:`Monitor`,suite:`Suite`,run:`Browser run`,heal:`Heal`,"pr-tests":`PR tests`,pack:`Pack`,pipeline:`Pipeline watch`},Y={running:{label:`Running`,tone:`running`},passed:{label:`Passed`,tone:`pass`},failed:{label:`Failed`,tone:`fail`},stopped:{label:`Stopped`,tone:`neutral`},timed_out:{label:`Timed out`,tone:`fail`},interrupted:{label:`Interrupted`,tone:`warn`}},X=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`})},Z=e=>{if(!e.endedAt)return``;let t=Math.max(0,Math.round((Date.parse(e.endedAt)-Date.parse(e.startedAt))/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`};function Q(e){return e.running?Y.running:e.enabled?e.last?Y[e.last.status]:{label:`Not run yet`,tone:`neutral`}:{label:`Disabled`,tone:`neutral`}}var te={pass:`bg-pass`,fail:`bg-fail`,warn:`bg-warn`,running:`bg-accent`,neutral:`bg-line`};function $({label:e,icon:t,children:n}){return(0,q.jsxs)(`div`,{className:`flex min-h-[48px] flex-wrap items-baseline gap-x-4 gap-y-1 border-t border-line-soft py-2.5`,children:[(0,q.jsxs)(`span`,{className:`flex w-[170px] flex-none items-center gap-2 text-sm text-muted`,children:[t&&(0,q.jsx)(t,{size:16,"aria-hidden":`true`,className:`flex-none`}),e]}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 text-sm [overflow-wrap:anywhere]`,children:n})]})}function ne({m:e,rounds:n}){let[r,i]=(0,K.useState)(``);return(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsxs)(`h3`,{className:`m-0 mb-1 flex items-center gap-2 text-base font-semibold`,children:[(0,q.jsx)(F,{size:18,"aria-hidden":`true`,className:`text-accent-fg`}),`Monitor`]}),(0,q.jsx)($,{icon:c,label:`Checks`,children:e.checks.length?(0,q.jsx)(A,{text:e.checks.map(e=>`\`${e.replace(/`/g,``)}\``).join(`, `),className:`text-sm [&_p]:my-0`}):`The checks in forgeqe.yaml (monitor.checks)`}),(0,q.jsxs)($,{icon:b,label:`Alerts after`,children:[e.failAfter,` failing round`,e.failAfter===1?``:`s`,` in a row`,e.remind?`, again every ${e.remind} while it keeps failing`:``]}),(0,q.jsx)($,{icon:k,label:`Alerts go to`,children:e.alerts.length?e.alerts.join(` and `):`Nowhere yet: add Teams or email in Settings, Monitor`}),(0,q.jsxs)($,{icon:t,label:`Each round`,children:[e.parallel,` check`,e.parallel===1?``:`s`,` at once; a recorded run `,e.replay===`trust`?`is trusted`:e.replay===`off`?`is not replayed`:`is verified with one model call`]}),(0,q.jsx)($,{icon:d,label:`Rounds kept in`,children:(0,q.jsx)(j,{path:e.outDir})}),(0,q.jsx)(`p`,{className:`m-0 border-t border-line-soft py-2.5 text-sm`,children:(0,q.jsx)(`a`,{href:x(`settings`,`monitor`),children:`Change the monitor in Settings`})}),(0,q.jsx)(`h4`,{className:`m-0 mt-3 mb-1 text-sm font-semibold`,children:`Latest rounds`}),r&&(0,q.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:r}),n.length===0?(0,q.jsx)(`p`,{className:`m-0 border-t border-line-soft py-3 text-sm text-muted`,children:`No rounds yet.`}):(0,q.jsx)(`ul`,{className:`m-0 list-none p-0`,children:n.slice(0,8).map(e=>(0,q.jsxs)(`li`,{className:`flex min-h-[48px] items-center gap-3 border-t border-line-soft py-2`,children:[(0,q.jsxs)(I,{tone:e.counts.failed?`fail`:`pass`,children:[e.counts.passed,`/`,e.counts.total,` passed`]}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:X(e.startedAt)}),e.report?(0,q.jsxs)(p,{size:`sm`,"aria-label":`Open the report of the round of ${X(e.startedAt)} in a new tab`,onClick:async()=>i(await s(e.report)),children:[(0,q.jsx)(M,{size:14,"aria-hidden":`true`}),`Open report`]}):(0,q.jsx)(j,{path:e.folder})]},e.key))})]})}function re({jobId:e,run:t}){let[n,r]=(0,K.useState)(null),[i,a]=(0,K.useState)(``);(0,K.useEffect)(()=>{let n=!1;r(null);let i=()=>v.log(e,t.id).then(e=>!n&&r(e.lines),e=>!n&&a(e.message));i();let o=t.status===`running`?setInterval(i,2e3):void 0;return()=>{n=!0,o&&clearInterval(o)}},[e,t.id,t.status]);let o=Math.max(2,...(n||[]).map(e=>Math.max(0,...(e.match(/`+/g)||[]).map(e=>e.length)))),s="`".repeat(o+1),c=[`**${Y[t.status].label}**${t.endedAt?` after ${Z(t)}`:``}${t.exitCode!==void 0&&t.exitCode!==null?`, exit ${t.exitCode}`:``}. Started ${X(t.startedAt)}, ${t.reason===`asked`?`asked for`:`on schedule`}.`,...t.investigating?[``,`_Its failures are being investigated._`]:[],...t.findings?.length?[``,`**Investigated:**`,...t.findings.map(e=>`- ${e.verdict}: ${e.tests.map(e=>`\`${e.replace(/`/g,``)}\``).join(`, `)}${e.branch?` on branch \`${e.branch.replace(/`/g,``)}\``:``}`)]:[],...t.investigationNote?[``,t.investigationNote]:[],``,`${s}text`,...n||[],s].join(`
2
- `);return(0,q.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[12px] border border-line-soft bg-surface-muted px-4 py-3`,children:[i&&(0,q.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:i}),!n&&!i?(0,q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Reading its output…`}):(0,q.jsx)(A,{text:c,className:`text-sm [&_pre]:max-h-[320px] [&_pre]:overflow-auto`})]})}function ie({job:t,rounds:n,busy:r,act:i}){let[a,o]=(0,K.useState)(null),[s,c]=(0,K.useState)(null),[u,d]=(0,K.useState)(!1),f=`${t.running?.id}|${t.last?.id}|${t.last?.status}`;(0,K.useEffect)(()=>{let e=!1;return v.detail(t.id).then(t=>{e||(o(t.runs),c(e=>e??t.runs[0]?.id??null))},()=>{}),()=>{e=!0}},[t.id,f]),(0,K.useEffect)(()=>{c(null),d(!1)},[t.id]);let m=Q(t),_=a?.filter(e=>e.status===`passed`).length??0,y=a?.filter(e=>e.status!==`running`).length??0;return(0,q.jsxs)(`section`,{"aria-labelledby":`job-h`,className:`flex min-w-0 flex-1 flex-col gap-5`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-3`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,q.jsx)(`h2`,{id:`job-h`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:t.name}),(0,q.jsxs)(`span`,{className:`text-sm text-muted`,children:[J[t.kind]||t.kind,` · `,t.schedule]})]}),(0,q.jsx)(I,{tone:m.tone,children:m.label}),t.running?(0,q.jsxs)(p,{disabled:r,onClick:()=>i(`stop`),children:[(0,q.jsx)(g,{size:14,fill:`currentColor`,"aria-hidden":`true`}),`Stop`]}):(0,q.jsxs)(p,{variant:`primary`,disabled:r,onClick:()=>i(`run`),children:[(0,q.jsx)(e,{size:16,"aria-hidden":`true`}),`Run now`]})]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,q.jsx)(l,{icon:O,label:`Runs kept`,value:String(a?.length??`–`)}),(0,q.jsx)(l,{icon:P,label:`Passed`,value:y?`${Math.round(_/y*100)}%`:`–`,note:y?`${_} of ${y}`:void 0}),(0,q.jsx)(l,{icon:w,label:`Next run`,value:t.nextAt?new Date(t.nextAt).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`}):`–`,note:t.nextAt?X(t.nextAt):t.enabled?void 0:`Disabled`})]}),(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)($,{icon:ee,label:`Runs`,children:(0,q.jsx)(A,{text:`\`${t.command.replace(/`/g,``)}\``,className:`text-sm [&_p]:my-0`})}),(0,q.jsx)($,{icon:w,label:`When`,children:t.schedule}),(0,q.jsx)($,{icon:V,label:`Enabled`,children:(0,q.jsx)(D,{checked:t.enabled,disabled:r,onChange:e=>i(e?`enable`:`disable`),label:`${t.name} enabled`})}),(0,q.jsxs)($,{icon:G,label:`Stopped after`,children:[t.timeoutMs?t.timeoutMs%36e5==0?`${t.timeoutMs/36e5} hour${t.timeoutMs===36e5?``:`s`}`:`${Math.round(t.timeoutMs/6e4)} minutes`:`the service's default`,` of running`]}),(0,q.jsx)($,{icon:h,label:`Tells the team`,children:t.notify?`When it fails, recovers or ends (the notify channels that take job events)`:t.kind===`monitor`?`The monitor sends its own alerts`:`No`}),(0,q.jsx)($,{icon:U,label:`Investigates failures`,children:t.investigate?`Yes, on branches of their own`:`No`}),(0,q.jsxs)($,{icon:z,label:`Added`,children:[X(t.createdAt),` `,t.by===`agent`?`by ForgeQE's agent, after you agreed`:`from the command line or here`]})]}),t.monitor&&(0,q.jsx)(ne,{m:t.monitor,rounds:n}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`h3`,{className:`m-0 mb-1 text-base font-semibold`,children:`Runs`}),a?a.length===0?(0,q.jsx)(`p`,{className:`m-0 border-t border-line-soft py-3 text-sm text-muted`,children:`No runs yet. Run now starts one.`}):(0,q.jsx)(`ul`,{className:`m-0 list-none p-0`,children:a.map(e=>(0,q.jsxs)(`li`,{className:`border-t border-line-soft`,children:[(0,q.jsxs)(`button`,{type:`button`,"aria-expanded":s===e.id,onClick:()=>c(s===e.id?null:e.id),className:`flex min-h-[52px] w-full cursor-pointer items-center gap-3 border-0 bg-transparent px-1 py-2 text-left text-ink hover:bg-surface-muted`,children:[(0,q.jsx)(I,{tone:Y[e.status].tone,children:Y[e.status].label}),(0,q.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:[X(e.startedAt),(0,q.jsxs)(`span`,{className:`text-muted`,children:[` `,`· `,e.reason===`asked`?`asked for`:`scheduled`,Z(e)?` · ${Z(e)}`:``]})]}),e.summary?.length?(0,q.jsx)(`span`,{className:`hidden max-w-[40%] truncate text-[13px] text-muted sm:inline`,children:e.summary.at(-1)}):null]}),(0,q.jsx)(C,{open:s===e.id,children:(0,q.jsx)(`div`,{className:`pb-3`,children:(0,q.jsx)(re,{jobId:t.id,run:e})})})]},e.id))}):(0,q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading…`})]}),(0,q.jsx)(`div`,{className:`flex flex-wrap items-center gap-2 border-t border-line-soft pt-4`,children:u?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`span`,{className:`text-sm text-ink-2`,children:[`Remove `,t.name,`? Its runs and logs go with it.`]}),(0,q.jsx)(p,{disabled:r,onClick:()=>i(`remove`),className:`border-fail text-fail hover:bg-fail-soft`,children:`Remove`}),(0,q.jsx)(p,{onClick:()=>d(!1),children:`Keep it`})]}):(0,q.jsxs)(p,{variant:`ghost`,onClick:()=>d(!0),className:`text-fail`,children:[(0,q.jsx)(L,{size:16,"aria-hidden":`true`}),`Remove this job`]})})]})}function ae({open:e,onClose:t,commands:n,initial:i,onAdded:o}){let[s,c]=(0,K.useState)(``),[l,d]=(0,K.useState)(`suite`),[f,m]=(0,K.useState)(``),[h,g]=(0,K.useState)(`every`),[_,y]=(0,K.useState)(`30m`),[b,x]=(0,K.useState)(`0 2 * * 1-5`),[S,C]=(0,K.useState)(!0),[w,T]=(0,K.useState)(``),[E,O]=(0,K.useState)(!1);(0,K.useEffect)(()=>{e&&(c(i?.name??``),d(i?.command??`suite`),m(i?.args??``),g(`every`),y(i?.every??`30m`),C(i?.command!==`monitor`),T(``))},[e,i]);let k=async()=>{O(!0),T(``);try{o(await v.add({name:s.trim(),command:l,args:f,...h===`every`?{every:_}:h===`cron`?{cron:b}:{now:!0},notify:S}),s.trim())}catch(e){T(e.message)}finally{O(!1)}},A=`flex flex-col gap-1.5 py-3`;return(0,q.jsx)(r,{open:e,onClose:t,title:`Add a job`,description:`A ForgeQE command the jobs service runs on a schedule, or once now, in a process of its own; it keeps going with this page closed.`,footer:(0,q.jsxs)(q.Fragment,{children:[w&&(0,q.jsx)(`span`,{role:`alert`,className:`mr-auto self-center text-sm text-fail [overflow-wrap:anywhere]`,children:w}),(0,q.jsx)(p,{onClick:t,children:`Cancel`}),(0,q.jsx)(p,{variant:`primary`,disabled:E||!s.trim(),onClick:()=>void k(),children:E?`Adding…`:`Add job`})]}),children:(0,q.jsxs)(`div`,{className:`flex flex-col pt-3`,children:[(0,q.jsxs)(`div`,{className:A,children:[(0,q.jsx)(`label`,{htmlFor:`job-name`,className:`font-medium`,children:`Name`}),(0,q.jsx)(a,{id:`job-name`,value:s,spellCheck:!1,placeholder:`nightly-smoke`,onChange:e=>c(e.target.value)}),(0,q.jsx)(`span`,{className:`text-sm text-muted`,children:`Letters, digits and dashes.`})]}),(0,q.jsxs)(`div`,{className:A,children:[(0,q.jsx)(`label`,{htmlFor:`job-command`,className:`font-medium`,children:`Runs`}),(0,q.jsx)(u,{id:`job-command`,value:l,onChange:e=>d(e.target.value),children:n.map(e=>(0,q.jsxs)(`option`,{value:e,children:[`forgeqe `,e]},e))})]}),(0,q.jsxs)(`div`,{className:A,children:[(0,q.jsx)(`label`,{htmlFor:`job-args`,className:`font-medium`,children:`With`}),(0,q.jsx)(a,{id:`job-args`,value:f,spellCheck:!1,placeholder:l===`monitor`?`Empty: the checks in forgeqe.yaml`:`checks/smoke.yaml --parallel 2`,onChange:e=>m(e.target.value),className:`font-mono text-[13px]`}),(0,q.jsx)(`span`,{className:`text-sm text-muted`,children:`Test case sources and flags, as you would type them after the command. "…" keeps spaces in one. Nothing goes through a shell.`})]}),(0,q.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0 py-3`,children:[(0,q.jsx)(`legend`,{className:`mb-1 font-medium`,children:`When`}),[[`every`,`Every`],[`cron`,`On a schedule (cron, this machine's time)`],[`once`,`Once, now`]].map(([e,t])=>(0,q.jsxs)(`label`,{className:`flex min-h-10 cursor-pointer items-center gap-3`,children:[(0,q.jsx)(`input`,{type:`radio`,name:`job-when`,checked:h===e,onChange:()=>g(e),className:`size-4 accent-accent`}),(0,q.jsx)(`span`,{className:`flex-none`,children:t}),e===`every`&&h===`every`&&(0,q.jsx)(a,{"aria-label":`Every`,value:_,onChange:e=>y(e.target.value),placeholder:`30m`,className:`max-w-[120px] font-mono text-[13px]`}),e===`cron`&&h===`cron`&&(0,q.jsx)(a,{"aria-label":`Cron schedule`,value:b,onChange:e=>x(e.target.value),className:`max-w-[180px] font-mono text-[13px]`})]},e))]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-4 py-3`,children:[(0,q.jsxs)(`span`,{className:`flex flex-1 flex-col gap-0.5`,children:[(0,q.jsx)(`span`,{className:`font-medium`,children:`Tell the team`}),(0,q.jsx)(`span`,{className:`text-sm text-muted`,children:`When it fails, recovers or ends, on the notify channels that take job events. A monitor sends its own alerts.`})]}),(0,q.jsx)(D,{checked:S,onChange:C,label:`Tell the team`})]})]})})}function oe({sub:e}){let[t,r]=(0,K.useState)(null),[i,a]=(0,K.useState)([]),[o,s]=(0,K.useState)(``),[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(null),f=(0,K.useCallback)(()=>{v.list().then(e=>{r(e),s(``)},e=>s(e.message))},[]);(0,K.useEffect)(f,[f]),(0,K.useEffect)(()=>{n.list().then(e=>a(e.rows.filter(e=>e.scope===`monitor`)),()=>{})},[t?.jobs.map(e=>e.last?.id).join()]);let h=t?.jobs.some(e=>e.running);(0,K.useEffect)(()=>{let e=setInterval(f,h?3e3:2e4);return()=>clearInterval(e)},[f,h]);let g=e?decodeURIComponent(e):``,b=t?.jobs.find(e=>e.id===g)||t?.jobs[0],C=(0,K.useMemo)(()=>t?.jobs.filter(e=>e.kind===`monitor`)??[],[t]),T=(0,K.useMemo)(()=>t?.jobs.filter(e=>e.kind!==`monitor`)??[],[t]),D=async e=>{if(b){l(!0),s(``);try{r(e===`remove`?await v.remove(b.id):await v.act(b.id,e)),e===`remove`&&(location.hash=x(`jobs`))}catch(e){s(e.message)}finally{l(!1)}}},O=e=>{let t=Q(e),n=b?.id===e.id;return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`a`,{href:x(`jobs`,encodeURIComponent(e.id)),"aria-current":n?`page`:void 0,className:m(`flex min-h-[60px] items-center gap-3 rounded-[12px] px-3 py-2 text-ink no-underline`,n?`bg-surface-strong hover:text-ink`:`hover:bg-surface-muted hover:text-ink`),children:[e.running?(0,q.jsx)(_,{label:t.label,px:16}):(0,q.jsx)(`span`,{"aria-label":t.label,className:m(`size-2.5 flex-none rounded-full`,te[t.tone])}),(0,q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,q.jsx)(`span`,{className:`truncate text-[15px] font-medium`,children:e.name}),(0,q.jsx)(`span`,{className:`truncate text-[13px] text-muted`,children:[t.label,e.schedule,e.nextAt&&e.enabled?`next ${X(e.nextAt)}`:``].filter(Boolean).join(` · `)})]})]})},e.id)};return(0,q.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,q.jsx)(S,{}),(0,q.jsxs)(`main`,{className:m(E,`@container flex-auto gap-4`),children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,q.jsx)(y,{icon:w,size:`lg`}),(0,q.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Jobs`}),t&&(0,q.jsx)(I,{tone:t.service.running?`pass`:`neutral`,children:t.service.running?`Service running since ${X(t.service.startedAt)}`:`Service stopped: jobs wait until it starts`}),(0,q.jsx)(`div`,{className:`flex-auto`}),(0,q.jsxs)(p,{variant:`primary`,disabled:!t,onClick:()=>d({}),children:[(0,q.jsx)(N,{size:16,"aria-hidden":`true`}),`Add a job`]})]}),(0,q.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-muted`,children:`ForgeQE commands that run on a schedule, or once, in a service of their own, so they keep going while you work on something else or with this page closed: monitors, suites, packs and pipeline watches.`}),o&&(0,q.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}),!t&&!o&&(0,q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t?.monitor&&!t.monitor.scheduled&&(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3 rounded-[14px] border border-accent-line bg-accent-soft px-4 py-3`,children:[(0,q.jsx)(F,{size:20,"aria-hidden":`true`,className:`flex-none text-accent-fg`}),(0,q.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-0.5 text-sm`,children:[(0,q.jsx)(`span`,{className:`font-medium`,children:`The monitor in forgeqe.yaml is not scheduled`}),(0,q.jsxs)(`span`,{className:`text-ink-2`,children:[t.monitor.checks.length,` check`,t.monitor.checks.length===1?``:`s`,`, every `,t.monitor.every,`. As a job it runs a round each time, with this page closed.`]})]}),(0,q.jsx)(p,{onClick:()=>d({name:`monitor`,command:`monitor`,args:``,every:t.monitor.every}),children:`Schedule it`})]}),t&&(0,q.jsxs)(`div`,{className:`flex flex-col gap-6 @2xl:flex-row @2xl:items-start @2xl:gap-8`,children:[(0,q.jsxs)(`nav`,{"aria-label":`Jobs`,className:`flex min-w-0 flex-col gap-4 @2xl:sticky @2xl:top-6 @2xl:w-[250px] @2xl:flex-none`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsxs)(`span`,{className:`flex items-center gap-2 px-3 text-[13px] font-medium text-muted`,children:[(0,q.jsx)(F,{size:14,"aria-hidden":`true`}),`Monitoring (`,C.length,`)`]}),C.length?(0,q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:C.map(O)}):(0,q.jsx)(`p`,{className:`m-0 px-3 py-2 text-sm text-muted`,children:`No monitor jobs.`})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsxs)(`span`,{className:`flex items-center gap-2 px-3 text-[13px] font-medium text-muted`,children:[(0,q.jsx)(w,{size:14,"aria-hidden":`true`}),`Other jobs (`,T.length,`)`]}),T.length?(0,q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:T.map(O)}):(0,q.jsx)(`p`,{className:`m-0 px-3 py-2 text-sm text-muted`,children:`None.`})]}),t.events.length>0&&(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`span`,{className:`px-3 text-[13px] font-medium text-muted`,children:`Recent activity`}),(0,q.jsx)(A,{text:t.events.slice(0,12).map(e=>`- \`${X(e.at)}\` ${e.text.replace(/([\\`*_[\]<>#|~!])/g,`\\$1`)}`).join(`
3
- `),className:`px-3 text-[13px] text-ink-2 [&_li]:my-1 [&_ul]:my-0 [&_ul]:pl-4`})]})]}),b?(0,q.jsx)(ie,{job:b,rounds:i,busy:c,act:D}):(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,q.jsx)(w,{size:24,"aria-hidden":`true`,className:`text-muted`}),(0,q.jsx)(`p`,{className:`m-0 max-w-[60ch] leading-relaxed text-ink-2`,children:`No jobs yet. Add one to run a suite every night, a monitor every 15 minutes, or watch a CI pipeline.`}),(0,q.jsx)(p,{onClick:()=>d({}),children:`Add a job`})]})]})]}),(0,q.jsx)(ae,{open:!!u,onClose:()=>d(null),commands:t?.commands??[],initial:u??void 0,onAdded:(e,t)=>{r(e),d(null);let n=e.jobs.find(e=>e.name===t);n&&(location.hash=x(`jobs`,encodeURIComponent(n.id)))}})]})}export{oe as Jobs};
@@ -1 +0,0 @@
1
- import{At as e,C as t,Cn as n,Gn as r,H as i,Hn as a,Mn as o,_n as s,at as c,ct as l,gn as u,nn as d,nt as f,pt as p,q as m,r as h,rt as g,st as _,t as v,zt as y}from"./frame-CHQgOaj6.js";import{t as b}from"./circle-dashed-CQKCycSk.js";import{i as x,t as S}from"./markdown-BPBR6Fva.js";import{t as C}from"./external-link-B45wnQ3R.js";import{n as w,t as T}from"./trending-up-Bypj2D7Z.js";import{j as E,n as D,r as O,s as k,t as A}from"./index-Hd8gmpz5.js";import{n as j,t as M}from"./when-CHnpLdYw.js";var N={name:`image-off`,size:24,node:[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]};N.node;var P=s(N),F={name:`images`,size:24,node:[[`path`,{d:`m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16`,key:`9kzy35`}],[`path`,{d:`M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2`,key:`1t0f0t`}],[`circle`,{cx:`13`,cy:`7`,r:`1`,fill:`currentColor`,key:`1obus6`}],[`rect`,{x:`8`,y:`2`,width:`14`,height:`14`,rx:`2`,key:`1gvhby`}]]};F.node;var I=s(F),L={name:`scan-eye`,size:24,node:[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`path`,{d:`M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0`,key:`11ak4c`}]]};L.node;var R=s(L),z=r(a(),1),B=_(),V=[`critical`,`serious`,`moderate`,`minor`],H={critical:`fail`,serious:`fail`,moderate:`warn`,minor:`neutral`},U=[{key:`lcp`,label:`LCP`,good:2500,poor:4e3,unit:`ms`},{key:`cls`,label:`CLS`,good:.1,poor:.25,unit:``},{key:`inp`,label:`INP`,good:200,poor:500,unit:`ms`},{key:`fcp`,label:`FCP`,good:1800,poor:3e3,unit:`ms`},{key:`ttfb`,label:`TTFB`,good:800,poor:1800,unit:`ms`},{key:`load`,label:`Load`,good:1/0,poor:1/0,unit:`ms`}],W={same:{label:`Same`,tone:`pass`},changed:{label:`Changed`,tone:`warn`},new:{label:`New baseline`,tone:`neutral`},no_baseline:{label:`No baseline`,tone:`neutral`}},G=e=>new Date(e).toLocaleString([],{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}),K=(e,t)=>t?e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`:e.toFixed(3).replace(/0+$/,``).replace(/\.$/,``),q=(e,t)=>`${e} ${t}${e===1?``:`s`}`,J=e=>{try{let t=new URL(e);return`${t.host}${t.pathname}${t.search}`}catch{return e}};function Y(e){let t=[];return e.a11y&&t.push(e.a11y.failed?`${q(e.a11y.failed,`rule`)} failed`:`WCAG clean`),e.perf.over&&t.push(`${q(e.perf.over,`page`)} slow`),e.visual?.changed&&t.push(`${e.visual.changed} changed`),e.captured&&t.push(`not compared`),t.join(` · `)||`measured`}var X=e=>!!(e.breaches||e.a11y?.failed||e.perf.over||e.visual?.changed),Z=25;function ee({run:e,standard:t}){let n=e.report,[r,i]=(0,z.useState)(null),[a,o]=(0,z.useState)(`all`);if(!n?.accessibility.pages)return(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`This run has no accessibility results: report.accessibility was off, or the run visited no page.`});let s=n.accessibility,c=n.breaches.filter(e=>e.kind===`accessibility`),l=a===`all`?s.failed:s.failed.filter(e=>e.impact===a),u=[{id:`all`,label:`All`,n:s.failed.length},...V.filter(e=>s.failed.some(t=>t.impact===e)).map(e=>({id:e,label:e.charAt(0).toUpperCase()+e.slice(1),n:s.failed.filter(t=>t.impact===e).length,alert:e===`critical`||e===`serious`}))];return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[t,` with `,n.engine||`axe`,`: `,q(s.passed.length,`rule`),` passed, `,s.failed.length,` failed, on `,q(s.pages,`page`),`. `,n.budgets.accessibility?c.length?`${q(c.length,`budget`)} exceeded.`:`Within the budget.`:`No budget set, so nothing here fails the run.`]}),c.map((e,t)=>(0,B.jsxs)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:[J(e.page),`: `,e.text]},t)),s.failed.length?(0,B.jsxs)(B.Fragment,{children:[u.length>2&&(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,B.jsx)(A,{items:u,value:a,onChange:o})}),(0,B.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:l.map(t=>(0,B.jsx)(te,{f:t,examples:e.examples[t.rule]??[],open:r===t.rule,onToggle:()=>i(r===t.rule?null:t.rule)},t.rule))})]}):(0,B.jsx)(`p`,{className:`m-0 text-sm text-pass`,children:`No rule failed on the pages this run visited.`})]})}function te({f:e,examples:t,open:n,onToggle:r}){return(0,B.jsxs)(`li`,{className:`border-t border-line-soft first:border-t-0`,children:[(0,B.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:r,className:`flex min-h-12 w-full cursor-pointer items-center gap-3 border-0 bg-transparent px-1 py-1.5 text-left text-ink hover:bg-surface-muted`,children:[(0,B.jsx)(k,{tone:H[e.impact],className:`w-[88px] flex-none justify-center`,children:e.impact}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,B.jsx)(`span`,{className:`text-sm [overflow-wrap:anywhere]`,children:e.help}),(0,B.jsxs)(`span`,{className:`truncate text-[12px] text-muted`,children:[e.rule,e.wcag?` · WCAG ${e.wcag}${e.level?` (${e.level})`:``}`:``,` · `,q(e.count,`element`),` on `,q(e.pages,`page`)]})]})]}),(0,B.jsx)(g,{open:n,children:(0,B.jsxs)(`div`,{className:`mb-3 ml-[104px] flex flex-col gap-2 text-sm max-sm:ml-2`,children:[t.length?t.map((e,t)=>(0,B.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-[10px] bg-surface-muted p-2.5`,children:[(0,B.jsxs)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:[J(e.page),e.target?` · ${e.target}`:``]}),e.html&&(0,B.jsx)(`code`,{className:`font-mono text-[12px] whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:e.html})]},t)):(0,B.jsx)(`span`,{className:`text-muted`,children:`No elements were kept for this rule.`}),e.helpUrl&&x(e.helpUrl)===`web`&&(0,B.jsxs)(`a`,{href:e.helpUrl,target:`_blank`,rel:`noreferrer noopener`,className:`inline-flex items-center gap-1 self-start text-[13px]`,children:[`How to fix it `,(0,B.jsx)(C,{size:13,"aria-hidden":`true`})]})]})})]})}function ne({run:e}){let t=e.report;if(!t?.performance.pages.length)return(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`This run has no timings: the run visited no page.`});let n=(e,t)=>e>t.poor?`poor`:e>t.good?`needs improvement`:`good`,r={poor:`text-fail`,"needs improvement":`text-warn`,good:`text-pass`};return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Core Web Vitals per page against Google's thresholds: `,(0,B.jsx)(`span`,{className:`text-pass`,children:`good`}),`, `,(0,B.jsx)(`span`,{className:`text-warn`,children:`needs improvement`}),`, `,(0,B.jsx)(`span`,{className:`text-fail`,children:`poor`}),`.`,` `,t.budgets.performance?`Pages over the budget in quality.budgets.performance are marked.`:`No performance budget set: nothing fails on timings (quality.budgets.performance).`]}),(0,B.jsx)(`div`,{className:`overflow-x-auto`,children:(0,B.jsxs)(`table`,{className:`w-full min-w-[640px] border-collapse text-sm`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{className:`text-left text-[12px] text-muted`,children:[(0,B.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:`Page`}),U.map(e=>(0,B.jsx)(`th`,{className:`px-2 py-2 text-right font-medium`,children:e.label},e.key)),(0,B.jsx)(`th`,{className:`py-2 pl-2 text-right font-medium`,children:`Requests`})]})}),(0,B.jsx)(`tbody`,{children:t.performance.pages.map((e,t)=>(0,B.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,B.jsxs)(`td`,{className:`py-2 pr-3`,children:[(0,B.jsx)(`span`,{className:`block font-mono text-[12px] [overflow-wrap:anywhere]`,children:J(e.url)}),e.over.length>0&&(0,B.jsx)(`span`,{className:`text-[12px] text-fail`,children:e.over.join(`, `)})]}),U.map(t=>{let i=e[t.key];return(0,B.jsxs)(`td`,{className:l(`px-2 py-2 text-right tabular-nums`,typeof i==`number`&&t.good!==1/0?r[n(i,t)]:typeof i==`number`?`text-ink-2`:`text-muted`),children:[typeof i==`number`?K(i,t.unit):`–`,typeof i==`number`&&t.good!==1/0&&(0,B.jsxs)(`span`,{className:`sr-only`,children:[` (`,n(i,t),`)`]})]},t.key)}),(0,B.jsx)(`td`,{className:`py-2 pl-2 text-right text-muted tabular-nums`,children:e.requests?`${e.requests} · ${e.kb} KB`:`–`})]},t))})]})})]})}function Q({run:e,index:t,which:n,label:r}){let[i,a]=(0,z.useState)(``),[s,c]=(0,z.useState)(!1);return(0,z.useEffect)(()=>{let r=!1;return a(``),c(!1),o.image(e,t,n).then(e=>!r&&a(e),()=>!r&&c(!0)),()=>{r=!0}},[e,t,n]),(0,B.jsxs)(`figure`,{className:`m-0 flex min-w-0 flex-col gap-1.5`,children:[(0,B.jsx)(`figcaption`,{className:`text-[12px] font-medium text-muted`,children:r}),i?(0,B.jsx)(`img`,{src:i,alt:`${r} of the page`,className:`block h-auto w-full rounded-[10px] border border-line-soft bg-surface-muted`}):(0,B.jsx)(`span`,{className:`flex h-[120px] items-center justify-center gap-2 rounded-[10px] border border-line-soft bg-surface-muted text-[12px] text-muted`,children:s?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(P,{size:14,"aria-hidden":`true`}),` Not available`]}):`Loading…`})]})}function re({run:e,budget:t,onChange:n}){let[r,a]=(0,z.useState)(null),[s,u]=(0,z.useState)(``),[d,f]=(0,z.useState)(!1),[p,m]=(0,z.useState)(``),[h,_]=(0,z.useState)(null),v=e.visual?.pages??[],y=v.find(e=>e.status===`changed`)?.index??null;(0,z.useEffect)(()=>_(y),[e.id,y]);let b=async e=>{f(!0),m(``);try{n(await e()),a(null),u(``)}catch(e){m(e.message)}finally{f(!1)}};if(!e.visual)return e.captured?(0,B.jsxs)(`div`,{className:`flex flex-col items-start gap-3`,children:[(0,B.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[`This run captured `,q(e.captured,`page`),` but they were not compared with the baselines yet.`]}),(0,B.jsxs)(c,{variant:`primary`,disabled:d,onClick:()=>b(()=>o.compare(e.id)),children:[(0,B.jsx)(R,{size:16,"aria-hidden":`true`}),`Compare with the baselines`]}),p&&(0,B.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:p})]}):(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`This run has no visual captures: quality.visual.enabled was off, or the run visited no page.`});let x=v.filter(e=>e.status===`changed`);return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsxs)(`p`,{className:`m-0 flex-1 text-[13px] text-muted`,children:[`Each page captured with animations frozen and masked regions hidden, against its approved baseline. `,t?`A page over quality.budgets.visual fails the run.`:`No visual budget set: a change does not fail the run (quality.budgets.visual).`]}),x.length>1&&(0,B.jsxs)(c,{disabled:d,onClick:()=>a(x.map(e=>e.url)),children:[`Approve all `,x.length,` changes`]})]}),r&&(0,B.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Approve as baseline`,className:`flex flex-col gap-3 rounded-[12px] border border-accent-line bg-accent-soft p-4`,children:[(0,B.jsxs)(`span`,{className:`font-medium`,children:[`Make this run's capture the baseline of `,r.length===1?J(r[0]):q(r.length,`page`),`?`]}),(0,B.jsx)(`span`,{className:`text-sm text-ink-2`,children:`Later runs are compared with it. Approve only a change that was intended; one that was not is a visual defect.`}),(0,B.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[`Why it changed (kept with the baseline)`,(0,B.jsx)(i,{value:s,maxLength:300,placeholder:`New checkout banner`,onChange:e=>u(e.target.value),className:`max-w-[480px] bg-bg`})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsxs)(c,{variant:`primary`,disabled:d,onClick:()=>b(()=>o.approve(e.id,r,s.trim()||void 0)),children:[(0,B.jsx)(E,{size:16,"aria-hidden":`true`}),`Approve`]}),(0,B.jsx)(c,{onClick:()=>a(null),children:`Cancel`})]})]}),p&&(0,B.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:p}),(0,B.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:v.map(t=>(0,B.jsxs)(`li`,{className:`border-t border-line-soft first:border-t-0`,children:[(0,B.jsxs)(`button`,{type:`button`,"aria-expanded":h===t.index,onClick:()=>_(h===t.index?null:t.index),className:`flex min-h-[52px] w-full cursor-pointer items-center gap-3 border-0 bg-transparent px-1 py-2 text-left text-ink hover:bg-surface-muted`,children:[(0,B.jsx)(I,{size:16,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,B.jsx)(`span`,{className:`text-sm [overflow-wrap:anywhere]`,children:t.title||J(t.url)}),(0,B.jsxs)(`span`,{className:`truncate text-[12px] text-muted`,children:[J(t.url),t.size?` · ${t.size}`:``,t.resized?` · resized ${t.resized}`:``]})]}),t.status===`changed`&&(0,B.jsxs)(`span`,{className:l(`text-sm tabular-nums`,t.over?`text-fail`:`text-warn`),children:[t.diffPercent,`%`,t.limit===void 0?``:` / ${t.limit}%`]}),(0,B.jsx)(k,{tone:t.over?`fail`:W[t.status].tone,children:t.over?`Over budget`:W[t.status].label})]}),(0,B.jsx)(g,{open:h===t.index,children:(0,B.jsxs)(`div`,{className:`mb-4 flex flex-col gap-3 px-1`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(160px,1fr))] gap-3`,children:[t.images.baseline&&(0,B.jsx)(Q,{run:e.id,index:t.index,which:`baseline`,label:`Baseline`}),t.images.current&&(0,B.jsx)(Q,{run:e.id,index:t.index,which:`current`,label:`This run`}),t.images.diff&&(0,B.jsx)(Q,{run:e.id,index:t.index,which:`diff`,label:`Difference (in red)`})]}),t.status===`changed`&&(0,B.jsxs)(c,{className:`self-start`,disabled:d,onClick:()=>a([t.url]),children:[(0,B.jsx)(E,{size:16,"aria-hidden":`true`}),`Approve as the new baseline`]})]})})]},t.index))})]})}function ie({values:e}){if(e.length<2)return null;let t=Math.max(1,...e),n=e.map((n,r)=>`${r/(e.length-1)*96+2},${22-n/t*20}`).join(` `);return(0,B.jsx)(`svg`,{width:`100`,height:`24`,viewBox:`0 0 100 24`,"aria-label":`Violations over the last ${e.length} runs: ${e.join(`, `)}`,role:`img`,className:`flex-none text-muted`,children:(0,B.jsx)(`polyline`,{points:n,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinejoin:`round`})})}function $({icon:e,className:t,lines:n}){return n.length?(0,B.jsxs)(`span`,{className:l(`flex items-start gap-1.5 text-[13px]`,t),children:[(0,B.jsx)(e,{size:14,"aria-hidden":`true`,className:`mt-0.5 flex-none`}),(0,B.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:n.join(` · `)})]}):null}function ae({trends:e}){return e.length?(0,B.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.map(e=>{let t=e.a11y.latest?V.reduce((t,n)=>t+(e.a11y.latest[n]||0),0):void 0;return(0,B.jsxs)(`li`,{className:`flex flex-col gap-1.5 border-t border-line-soft py-3 first:border-t-0`,children:[(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-3`,children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-[1_1_240px] font-mono text-[13px] [overflow-wrap:anywhere]`,children:e.page}),(0,B.jsx)(ie,{values:e.a11y.trail}),(0,B.jsxs)(`span`,{className:`text-[12px] text-muted`,children:[q(e.runs,`run`),t===void 0?``:` · ${q(t,`violation`)} now`]})]}),(0,B.jsx)($,{icon:T,className:`text-fail`,lines:[...e.perf.worse.map(e=>`slower: ${e}`),...e.a11y.newRules.map(e=>`newly failing: ${e}`)]}),(0,B.jsx)($,{icon:w,className:`text-pass`,lines:[...e.perf.better.map(e=>`faster: ${e}`),...e.a11y.fixedRules.map(e=>`fixed: ${e}`)]})]},e.page)})}):(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No history yet: every browser run adds each page's accessibility and timings to quality-history.json in the reports folder.`})}function oe({id:t,view:r,onChanged:i}){let[a,s]=(0,z.useState)(null),[f,h]=(0,z.useState)(``),[g,_]=(0,z.useState)(`accessibility`),[v,x]=(0,z.useState)(``);if((0,z.useEffect)(()=>{let e=!1;return s(null),o.run(t).then(t=>{if(e)return;s(t),h(``);let n=t.visual?.pages.some(e=>e.status===`changed`)||!t.visual&&t.captured;_(t.report?.breaches.some(e=>e.kind===`performance`)&&!t.report.accessibility.failed.length?`performance`:n&&!t.report?.accessibility.failed.length?`visual`:t.report?.accessibility.pages?`accessibility`:t.report?.performance.pages.length?`performance`:`visual`)},t=>!e&&h(t.message)),()=>{e=!0}},[t]),f)return(0,B.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:f});if(!a)return(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading…`});let C=async()=>{try{let{id:e}=await n.start(`Explain the accessibility, performance and visual results of the run in ${a.dir}: call quality_report and visual_compare with run_dir ${a.dir}. Say what matters most to fix first, and why.`,{});location.hash=m(`chats`,e)}catch(e){x(e.message)}},w=a.report,T=w?.accessibility.failed??[],D=V.find(e=>T.some(t=>t.impact===e)),O=w?.performance.pages.filter(e=>e.over.length).length??0,k=a.visual?.pages.filter(e=>e.status===`changed`).length??0,A=e=>!!w?.breaches.some(t=>t.kind===e),j=[{id:`accessibility`,label:`Accessibility`,icon:u,state:w?.accessibility.pages?A(`accessibility`)||D===`critical`?`fail`:T.length?`warn`:`pass`:`none`,headline:w?.accessibility.pages?T.length?`${q(T.length,`rule`)} failed`:`No rule failed`:`Not measured`,note:w?.accessibility.pages?V.filter(e=>w.accessibility.byImpact[e]).map(e=>`${w.accessibility.byImpact[e]} ${e}`).join(` · `)||`${q(w.accessibility.pages,`page`)} checked`:``},{id:`performance`,label:`Performance`,icon:y,state:w?.performance.pages.length?A(`performance`)?`fail`:O?`warn`:`pass`:`none`,headline:w?.performance.pages.length?O?`${q(O,`page`)} over budget`:`Within budget`:`Not measured`,note:w?.performance.pages.length?`${q(w.performance.pages.length,`page`)} timed`:``},{id:`visual`,label:`Visual`,icon:I,state:a.visual?A(`visual`)?`fail`:k?`warn`:`pass`:`none`,headline:a.visual?k?`${q(k,`page`)} changed`:`No change`:a.captured?`Not compared yet`:`Not captured`,note:a.visual?`${q(a.visual.pages.length,`page`)} against the baseline`:a.captured?`${q(a.captured,`page`)} captured`:``}],M={pass:E,warn:p,fail:d,none:b},N={pass:`text-pass`,warn:`text-warn`,fail:`text-fail`,none:`text-muted`};return(0,B.jsxs)(`section`,{"aria-labelledby":`run-h`,className:`flex min-w-0 flex-1 flex-col gap-4`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,B.jsx)(`h2`,{id:`run-h`,title:a.goal,className:`m-0 line-clamp-2 text-[20px] leading-snug font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:a.goal}),(0,B.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 text-[13px] text-muted`,children:[G(a.at),` · `,(0,B.jsx)(S,{path:a.dir})]})]}),(0,B.jsxs)(c,{size:`sm`,variant:`ghost`,onClick:()=>void C(),children:[(0,B.jsx)(e,{size:15,"aria-hidden":`true`}),`Ask in a chat`]})]}),v&&(0,B.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:v}),(0,B.jsx)(`div`,{role:`tablist`,"aria-label":`Results`,className:`grid gap-2 @xl:grid-cols-3`,children:j.map(e=>{let t=M[e.state];return(0,B.jsxs)(`button`,{type:`button`,role:`tab`,id:`tab-${e.id}`,"aria-selected":g===e.id,"aria-controls":`panel-${e.id}`,onClick:()=>_(e.id),className:l(`flex min-w-0 cursor-pointer flex-col gap-1 rounded-[14px] border px-4 py-3 text-left`,g===e.id?`border-accent bg-accent-soft`:`border-line-soft bg-bg hover:bg-surface-muted`),children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[13px] text-muted`,children:[(0,B.jsx)(e.icon,{size:14,"aria-hidden":`true`}),e.label]}),(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[16px] font-semibold text-ink`,children:[(0,B.jsx)(t,{size:16,"aria-hidden":`true`,className:l(`flex-none`,N[e.state])}),e.headline]}),e.note&&(0,B.jsx)(`span`,{className:`truncate text-[12.5px] text-muted`,children:e.note})]},e.id)})}),(0,B.jsxs)(`div`,{role:`tabpanel`,id:`panel-${g}`,"aria-labelledby":`tab-${g}`,className:`flex min-w-0 flex-col`,children:[g===`accessibility`&&(0,B.jsx)(ee,{run:a,standard:r.standard}),g===`performance`&&(0,B.jsx)(ne,{run:a}),g===`visual`&&(0,B.jsx)(re,{run:a,budget:r.budgets.visual,onChange:e=>{s(e),i()}})]}),g===`accessibility`&&a.report?.accessibility.pages?(0,B.jsx)(`p`,{className:`m-0 text-[12px] text-muted`,children:r.disclaimer}):null]})}function se({sub:e}){let[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(``),[s,c]=(0,z.useState)(e===`trends`?`trends`:`runs`),g=(0,z.useCallback)(()=>{o.view().then(e=>{r(e),a(``)},e=>a(e.message))},[]);(0,z.useEffect)(g,[g]);let _=e&&e!==`trends`?decodeURIComponent(e):``;(0,z.useEffect)(()=>{e===`trends`?c(`trends`):e&&c(`runs`)},[e]);let b=(0,z.useMemo)(()=>n?.runs.find(e=>e.id===_)||n?.runs[0],[n,_]),x=n?.trends.filter(e=>e.perf.worse.length||e.a11y.newRules.length).length??0,[S,C]=(0,z.useState)(``),[w,T]=(0,z.useState)(`all`),[k,N]=(0,z.useState)(0);(0,z.useEffect)(()=>N(0),[S,w]);let P=S.toLowerCase().split(/\s+/).filter(Boolean),F=(n?.runs??[]).filter(e=>P.every(t=>e.goal.toLowerCase().includes(t))),I=w===`attention`?F.filter(X):F;return(0,B.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,B.jsx)(h,{}),(0,B.jsxs)(`main`,{className:l(v,`@container flex-auto gap-4`),children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,B.jsx)(f,{icon:y,size:`lg`}),(0,B.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`Quality`})]}),(0,B.jsxs)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:[`What each browser run measured on the pages it visited: accessibility (`,n?.standard||`WCAG`,`), Core Web Vitals, and visual changes against approved baselines. Budgets (quality.budgets) decide what fails a run.`]}),i&&(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:i}),!n&&!i&&(0,B.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),n&&(0,B.jsx)(t,{label:`Quality`,current:s,onPick:e=>{c(e),e===`trends`?location.hash=m(`quality`,`trends`):location.hash=b?m(`quality`,encodeURIComponent(b.id)):m(`quality`)},tabs:[{id:`runs`,label:`Runs (${n.runs.length})`},{id:`trends`,label:`Trends${x?` (${x} worse)`:``}`}]}),n&&s===`trends`&&(0,B.jsx)(`div`,{role:`tabpanel`,id:`panel-trends`,"aria-labelledby":`tab-trends`,children:(0,B.jsx)(ae,{trends:n.trends})}),n&&s===`runs`&&(n.runs.length?(0,B.jsxs)(`div`,{role:`tabpanel`,id:`panel-runs`,"aria-labelledby":`tab-runs`,className:`flex flex-col gap-6 @2xl:flex-row @2xl:items-start @2xl:gap-8`,children:[(0,B.jsxs)(`nav`,{"aria-label":`Runs`,className:`flex min-w-0 flex-col gap-2 @2xl:sticky @2xl:top-6 @2xl:w-[290px] @2xl:flex-none`,children:[(0,B.jsx)(O,{id:`quality-search`,label:`Find a run`,value:S,onChange:C,className:`flex-none`}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,B.jsx)(A,{items:[{id:`all`,label:`All`,n:F.length},{id:`attention`,label:`Needs a look`,n:F.filter(X).length,alert:!0}],value:w,onChange:T})}),(0,B.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[I.length===0&&(0,B.jsx)(`li`,{className:`px-3 py-3 text-sm text-muted`,children:`Nothing matches.`}),I.slice(k*Z,k*Z+Z).map((e,t,n)=>{let r=j(e.at),i=e.breaches?d:X(e)?p:E;return(0,B.jsxs)(`li`,{className:`contents`,children:[(t===0||j(n[t-1].at)!==r)&&(0,B.jsx)(`span`,{className:`block px-3 pt-2 pb-1 text-[12px] font-semibold text-muted`,children:r}),(0,B.jsxs)(`a`,{href:m(`quality`,encodeURIComponent(e.id)),"aria-current":b?.id===e.id?`page`:void 0,className:l(`flex min-h-12 items-center gap-2.5 rounded-[10px] px-3 py-1.5 text-ink no-underline`,b?.id===e.id?`bg-surface-strong hover:text-ink`:`hover:bg-surface-muted hover:text-ink`),children:[(0,B.jsx)(i,{size:16,"aria-label":e.breaches?`Over a budget`:X(e)?`Needs a look`:`Within budgets`,className:l(`flex-none`,e.breaches?`text-fail`:X(e)?`text-warn`:`text-pass`)}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,B.jsx)(`span`,{className:`truncate text-[14px] font-medium`,title:e.goal,children:e.goal}),(0,B.jsx)(`span`,{className:`truncate text-[12px] text-muted`,children:Y(e)})]}),(0,B.jsx)(`span`,{className:`flex-none text-[12px] text-muted tabular-nums`,children:M(e.at)})]})]},e.id)})]}),I.length>Z&&(0,B.jsx)(D,{page:k,size:Z,total:I.length,onPage:N,label:`Pages of runs`})]}),b&&(0,B.jsx)(oe,{id:b.id,view:n,onChanged:g})]}):(0,B.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,B.jsx)(u,{size:24,"aria-hidden":`true`,className:`text-muted`}),(0,B.jsx)(`p`,{className:`m-0 max-w-[62ch] leading-relaxed text-ink-2`,children:`No run has measured anything yet. Every browser run checks accessibility, timings and visual changes of the pages it visits; run a flow from a chat or the Record page, and its results show here.`})]}))]})]})}export{se as Quality};
@@ -1 +0,0 @@
1
- import{Cn as e,Dt as t,Gn as n,Gt as r,H as i,Hn as a,It as o,K as s,Nn as c,Nt as l,U as u,Yt as d,_n as f,an as p,at as m,ct as h,ht as g,in as _,it as v,kt as y,lt as b,nn as x,nt as S,q as C,r as w,rt as ee,st as T,t as E,tt as te}from"./frame-CHQgOaj6.js";import{t as D}from"./markdown-BPBR6Fva.js";import{t as O}from"./file-chart-column-increasing-9rCBQxTk.js";import{t as k}from"./sticky-note-D_lJfPYH.js";import{F as A,T as j,_ as M,j as N,n as ne,r as re,s as P,t as ie,v as ae,y as oe}from"./index-Hd8gmpz5.js";import{n as F,t as se}from"./when-CHnpLdYw.js";var I={name:`crosshair`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`22`,x2:`18`,y1:`12`,y2:`12`,key:`l9bcsi`}],[`line`,{x1:`6`,x2:`2`,y1:`12`,y2:`12`,key:`13hhkx`}],[`line`,{x1:`12`,x2:`12`,y1:`6`,y2:`2`,key:`10w3f3`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`18`,key:`15g9kq`}]]};I.node;var ce=f(I),L={name:`dot`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]};L.node;var le=f(L),R={name:`hourglass`,size:24,node:[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]};R.node;var z=f(R),B={name:`keyboard`,size:24,node:[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]};B.node;var V=f(B),H={name:`mouse-pointer-click`,size:24,node:[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]};H.node;var U=f(H),W={name:`pause`,size:24,node:[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]};W.node;var ue=f(W),G={name:`upload`,size:24,node:[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]};G.node;var de=f(G),K={name:`variable`,size:24,node:[[`path`,{d:`M8 21s-4-3-4-9 4-9 4-9`,key:`uto9ud`}],[`path`,{d:`M16 3s4 3 4 9-4 9-4 9`,key:`4w2vsq`}],[`line`,{x1:`15`,x2:`9`,y1:`9`,y2:`15`,key:`f7djnv`}],[`line`,{x1:`9`,x2:`15`,y1:`9`,y2:`15`,key:`1shsy8`}]]};K.node;var q=f(K),J=n(a(),1),Y=T(),fe={navigate:o,back:A,click:U,dblclick:U,input:V,press:V,select:l,upload:de,expect:N,wait_for:z,capture:q,note:k,launch:t,double_click:U,type:V,keys:V},pe=e=>fe[e]||(e.startsWith(`expect`)?N:le),me=new Set([`starting`,`recording`,`paused`,`stopping`]);function X(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 Z(t){let{id:n}=await e.start(`Turn the recording in ${t} into a test: call write_test with run_dir ${t}. Show me the plan before you write.`,{});location.hash=C(`chats`,n)}async function Q(t){let{id:n}=await e.start(`Replay the desktop workflow ${t}: call desktop_replay with workflow ${t}, and tell me how each step went.`,{});location.hash=C(`chats`,n)}function he({s:e,live:t,onDelete:n}){let r=pe(e.op);return(0,Y.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,Y.jsx)(`span`,{className:`w-6 flex-none pt-0.5 text-right text-[13px] text-muted tabular-nums`,children:e.n}),(0,Y.jsx)(r,{size:16,"aria-hidden":`true`,className:h(`mt-0.5 flex-none`,e.op.startsWith(`expect`)?`text-pass`:`text-muted`)}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Y.jsx)(`span`,{className:`text-sm [overflow-wrap:anywhere]`,children:e.text}),(e.note||e.dynamic||e.inferred||e.case_step)&&(0,Y.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-[12px] text-muted`,children:[e.case_step?(0,Y.jsxs)(`span`,{children:[`case step `,e.case_step]}):null,e.dynamic&&(0,Y.jsx)(`span`,{children:`value changes between runs`}),e.inferred&&(0,Y.jsx)(`span`,{children:`added by ForgeQE`}),e.note&&(0,Y.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[`note: `,e.note]})]})]}),t&&e.n>1&&(0,Y.jsx)(m,{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,Y.jsx)(oe,{size:15,"aria-hidden":`true`})})]})}function ge({s:e,send:n,busy:r}){let[a,o]=(0,J.useState)(``),[,s]=(0,J.useState)(0);(0,J.useEffect)(()=>{let e=setInterval(()=>s(e=>e+1),1e3);return()=>clearInterval(e)},[]);let c=(0,J.useRef)(null);(0,J.useEffect)(()=>{c.current&&(c.current.scrollTop=c.current.scrollHeight)},[e.log.length]);let u=e.kind===`desktop`,f=e.state===`paused`,p=e.log.at(-1)?.level===`warn`&&/press Stop again/i.test(e.log.at(-1).text),_=Math.max(0,...e.steps.map(e=>e.case_step||0)),y=(t,i,a,o)=>(0,Y.jsxs)(m,{disabled:r||e.state===`starting`,onClick:()=>n({cmd:t}),title:o,children:[(0,Y.jsx)(a,{size:16,"aria-hidden":`true`}),i]},t);return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3 rounded-[14px] border border-line-soft px-4 py-3`,children:[f?(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 flex-none rounded-full bg-warn`}):(0,Y.jsx)(v,{state:e.state===`starting`?`waiting`:e.state===`stopping`?`working`:`recording`,px:20}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-0.5`,children:[(0,Y.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.name}),(0,Y.jsxs)(`span`,{className:`truncate text-[13px] text-muted`,children:[e.state===`starting`?u?`Starting ${e.app}…`:`Opening the browser…`:e.state===`stopping`?`Saving the workflow…`:f?`Paused: what you do now is not recorded`:`Recording`,` · `,X(e.startedAt),` ·`,` `,u?`${e.app}, a desktop app`:e.url]})]}),!u&&(0,Y.jsxs)(m,{disabled:r||e.state===`starting`,onClick:()=>n({cmd:`pause`}),children:[f?(0,Y.jsx)(t,{size:16,"aria-hidden":`true`}):(0,Y.jsx)(ue,{size:16,"aria-hidden":`true`}),f?`Resume`:`Pause`]}),(0,Y.jsxs)(m,{disabled:r||e.state===`stopping`,onClick:()=>n({cmd:`stop`,...p?{force:!0}:{}}),className:`border-fail bg-fail text-white hover:bg-fail hover:text-white hover:opacity-90`,children:[(0,Y.jsx)(g,{size:14,fill:`currentColor`,"aria-hidden":`true`}),p?`Stop anyway`:`Stop and save`]})]}),u?(0,Y.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,Y.jsx)(`strong`,{children:`Ctrl+Shift+F11`}),` over a control adds a check of what it shows, and `,(0,Y.jsx)(`strong`,{children:`Ctrl+Shift+F12`}),` or closing the app stops.`]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`details`,{className:`rounded-[12px] bg-accent-soft px-4 py-2.5 text-sm text-ink-2`,children:[(0,Y.jsx)(`summary`,{className:`cursor-pointer`,children:`Do the steps in the browser on this computer. Keys in the page…`}),(0,Y.jsxs)(`p`,{className:`m-0 mt-2 leading-relaxed`,children:[`The Recorder panel in the page does the same as these buttons; in the page, `,e.leader,` then a letter: `,(0,Y.jsx)(`strong`,{children:`A`}),` check, `,(0,Y.jsx)(`strong`,{children:`V`}),` keep a value, `,(0,Y.jsx)(`strong`,{children:`W`}),` wait for, `,(0,Y.jsx)(`strong`,{children:`D`}),` test data, `,(0,Y.jsx)(`strong`,{children:`N`}),` note,`,` `,(0,Y.jsx)(`strong`,{children:`P`}),` pause, `,(0,Y.jsx)(`strong`,{children:`Z`}),` undo, `,(0,Y.jsx)(`strong`,{children:`S`}),` stop.`]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,role:`toolbar`,"aria-label":`Recorder`,children:[y(`assert`,`Check an element`,ce,`Pick an element in the page to check`),y(`variable`,`Keep a value`,q,`Pick an element whose text later steps use`),y(`wait`,`Wait for`,z,`Pick an element the test waits for`),y(`data`,`Test data`,d,`The last value you typed becomes test data`),y(`note`,`Note`,k,`A note for the step, for whoever reads the test`),y(`undo`,`Undo`,ae,`Remove the last step`)]}),(0,Y.jsxs)(`form`,{className:`flex flex-wrap gap-2`,onSubmit:e=>{e.preventDefault(),a.trim()&&(n({cmd:`chat`,text:a.trim()}),o(``))},children:[(0,Y.jsx)(`label`,{htmlFor:`rec-check`,className:`sr-only`,children:`Describe a check`}),(0,Y.jsx)(i,{id:`rec-check`,value:a,maxLength:2e3,placeholder:`Describe a check: the total shows "$40.00", or note: …`,onChange:e=>o(e.target.value),className:`min-w-0 flex-[1_1_320px]`}),(0,Y.jsxs)(m,{type:`submit`,variant:`primary`,disabled:r||!a.trim()||e.state===`starting`,children:[(0,Y.jsx)(M,{size:16,"aria-hidden":`true`}),`Add`]})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-6 gap-y-5`,children:[(0,Y.jsxs)(`section`,{"aria-labelledby":`rec-steps`,className:`flex min-w-0 flex-[999_1_420px] flex-col gap-2 rounded-[14px] border border-line-soft px-4 py-3`,children:[(0,Y.jsxs)(`h2`,{id:`rec-steps`,className:`m-0 flex items-center gap-2 text-base font-semibold`,children:[(0,Y.jsx)(l,{size:18,"aria-hidden":`true`,className:`text-accent-fg`}),`Steps`,(0,Y.jsx)(`span`,{className:`text-sm font-normal text-muted`,children:e.summary})]}),e.steps.length?(0,Y.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,"aria-live":`polite`,children:e.steps.map(e=>(0,Y.jsx)(he,{s:e,live:!u,onDelete:()=>n({cmd:`delete`,n:e.n})},`${e.n}-${e.text}`))}):(0,Y.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:e.state===`starting`?u?`Starting ${e.app}…`:`Opening the browser…`:`Nothing yet: do the first step in ${u?e.app:`the browser`}.`})]}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-5`,children:[e.case&&(0,Y.jsxs)(`section`,{"aria-labelledby":`rec-case`,className:`flex flex-col gap-2 rounded-[14px] border border-line-soft px-4 py-3`,children:[(0,Y.jsxs)(`h2`,{id:`rec-case`,className:`m-0 flex items-center gap-2 text-base font-semibold`,children:[(0,Y.jsx)(l,{size:18,"aria-hidden":`true`,className:`text-accent-fg`}),e.case.id]}),(0,Y.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,Y.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,children:e.case.steps.map(t=>{let i=e.steps.some(e=>e.case_step===t.n);return(0,Y.jsx)(`li`,{className:`border-t border-line-soft first:border-t-0`,children:(0,Y.jsxs)(`button`,{type:`button`,disabled:r,"aria-current":t.n===_?`step`:void 0,onClick:()=>n({cmd:`case_step`,n:t.n}),className:h(`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===_&&`bg-accent-soft`),children:[i?(0,Y.jsx)(N,{size:16,"aria-hidden":`true`,className:`mt-0.5 flex-none text-pass`}):(0,Y.jsx)(`span`,{className:`mt-0.5 w-4 flex-none text-center text-[12px] text-muted`,children:t.n}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Y.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t.action}),t.expected&&(0,Y.jsxs)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:[`Expect: `,t.expected]})]})]})},t.n)})}),(0,Y.jsx)(m,{disabled:r,onClick:()=>n({cmd:`case_next`}),className:`self-start`,children:`Next case step`})]}),(0,Y.jsxs)(`section`,{"aria-labelledby":`rec-log`,className:`flex flex-col gap-2 rounded-[14px] border border-line-soft px-4 py-3`,children:[(0,Y.jsx)(`h2`,{id:`rec-log`,className:`m-0 text-base font-semibold`,children:`What the recorder says`}),(0,Y.jsx)(`div`,{ref:c,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,Y.jsx)(`p`,{className:h(`m-0 [overflow-wrap:anywhere]`,e.level===`warn`?`text-warn`:e.level===`error`?`text-fail`:`text-ink-2`),children:e.text},t)):(0,Y.jsxs)(`p`,{className:`m-0 text-muted`,children:[`Waiting for `,u?`the app`:`the browser`,`…`]})})]})]})]})]})}function _e({s:e}){let t=e.result,[n,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(!1);if(!t)return null;let c=e.kind===`desktop`;return(0,Y.jsxs)(`section`,{"aria-labelledby":`rec-result`,className:`flex flex-col gap-3 rounded-[14px] border border-line-soft p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`h2`,{id:`rec-result`,className:`m-0 flex-1 text-base font-semibold [overflow-wrap:anywhere]`,children:e.name}),(0,Y.jsx)(P,{tone:t.ok?`pass`:`fail`,children:t.ok?`Recorded`:`Not recorded`})]}),(0,Y.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,Y.jsxs)(`span`,{className:`text-muted`,children:[`· `,X(e.startedAt,e.endedAt)]})]}),t.ok&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-sm`,children:[(0,Y.jsx)(P,{tone:`neutral`,icon:!1,children:b(e.steps.length,`step`)}),(0,Y.jsxs)(P,{tone:t.checks?`pass`:`warn`,children:[t.checks,` check`,t.checks===1?``:`s`]}),t.variables.length>0&&(0,Y.jsxs)(P,{tone:`neutral`,icon:!1,children:[`kept: `,t.variables.join(`, `)]}),t.testData.length>0&&(0,Y.jsxs)(P,{tone:`neutral`,icon:!1,children:[`test data: `,t.testData.join(`, `)]})]}),!c&&t.secrets.length>0&&(0,Y.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[`The test reads`,` `,t.secrets.map((e,t)=>(0,Y.jsxs)(`span`,{children:[t?`, `:``,(0,Y.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,Y.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-sm text-warn`,children:t.caseGaps.map(e=>(0,Y.jsxs)(`li`,{children:[`No check for case step `,e.n,`: expects “`,e.expected,`”`]},e.n))}),(t.notes??[]).length>0&&(0,Y.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-sm text-ink-2`,children:t.notes.map((e,t)=>(0,Y.jsx)(`li`,{children:e},t))}),t.skipped.length>0&&(0,Y.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-sm text-muted`,children:t.skipped.map((e,t)=>(0,Y.jsxs)(`li`,{children:[`Not recorded: `,e.action,`: `,e.reason]},t))}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[c&&t.workflow&&(0,Y.jsxs)(m,{variant:`primary`,disabled:a,onClick:async()=>{o(!0);try{await Q(t.workflow)}catch(e){i(e.message),o(!1)}},children:[(0,Y.jsx)(j,{size:16,"aria-hidden":`true`}),`Replay it`]}),c&&t.report&&(0,Y.jsxs)(m,{onClick:async()=>i(await s(t.report)),children:[(0,Y.jsx)(O,{size:16,"aria-hidden":`true`}),`Open the report`]}),!c&&t.ok&&(0,Y.jsxs)(m,{variant:`primary`,disabled:a,onClick:async()=>{o(!0);try{await Z(e.runDir)}catch(e){i(e.message),o(!1)}},children:[(0,Y.jsx)(M,{size:16,"aria-hidden":`true`}),`Write a test from it`]}),!c&&t.ok&&(0,Y.jsxs)(m,{onClick:async()=>i(await s(`${e.runDir}/trace.md`)),children:[(0,Y.jsx)(r,{size:16,"aria-hidden":`true`}),`Read the steps`]}),(0,Y.jsx)(`span`,{className:`text-sm`,children:(0,Y.jsx)(D,{path:c&&t.workflow?t.workflow:e.runDir})}),n&&(0,Y.jsx)(`span`,{className:`text-[13px] text-fail`,children:n})]})]})}function ve({view:e,busy:t,onStart:n}){let[r,a]=(0,J.useState)(e.session?.kind===`desktop`&&e.desktop.available?`desktop`:`web`),[s,c]=(0,J.useState)(e.desktop.apps[0]??``),[l,d]=(0,J.useState)(e.apps[0]?.name??``),[f,g]=(0,J.useState)(``),[v,b]=(0,J.useState)(``),[x,S]=(0,J.useState)(``),[w,T]=(0,J.useState)(e.environment??``),[E,D]=(0,J.useState)(!1),[O,k]=(0,J.useState)(!1),A=r===`desktop`?e.desktop.available&&!!s:l?!0:/^https?:\/\/\S+$/i.test(f.trim()),j=r===`web`||e.environments.length>1;return(0,Y.jsxs)(`form`,{"aria-labelledby":`rec-new`,className:`flex flex-col gap-3 rounded-[14px] border border-line-soft bg-bg p-4`,onSubmit:t=>{if(t.preventDefault(),A){if(r===`desktop`)return n({kind:`desktop`,app:s,...v.trim()?{name:v.trim()}:{},...w&&w!==e.environment?{env:w}:{}});n({...l?{app:l}:{url:f.trim()},...v.trim()?{name:v.trim()}:{},...x.trim()?{case:x.trim()}:{},...w&&w!==e.environment?{env:w}:{},signedIn:E})}},children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Y.jsx)(`h2`,{id:`rec-new`,className:`m-0 flex-1 text-base font-semibold`,children:`New recording`}),(0,Y.jsx)(`div`,{role:`radiogroup`,"aria-label":`What to record`,className:`flex gap-1 rounded-[10px] bg-surface-strong p-1`,children:[[`web`,`Web page`,o,!0],[`desktop`,`Desktop app`,y,e.desktop.available]].map(([t,n,i,o])=>(0,Y.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":r===t,disabled:!o,title:o?void 0:e.desktop.reason||`Windows only.`,onClick:()=>a(t),className:h(`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`,r===t?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),children:[(0,Y.jsx)(i,{size:14,"aria-hidden":`true`}),n]},t))})]}),(0,Y.jsxs)(`div`,{className:`grid gap-2 @2xl:grid-cols-[minmax(0,1.2fr)_minmax(0,1fr)_auto]`,children:[r===`desktop`?e.desktop.apps.length?(0,Y.jsx)(u,{"aria-label":`App`,value:s,onChange:e=>c(e.target.value),children:e.desktop.apps.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))}):(0,Y.jsxs)(`p`,{className:`m-0 self-center text-sm text-muted`,children:[`No desktop apps yet: add one in `,(0,Y.jsx)(`a`,{href:C(`settings`,`environments`),children:`Settings, Environments`}),`.`]}):(0,Y.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[e.apps.length>0&&(0,Y.jsxs)(u,{"aria-label":`Start on`,value:l,onChange:e=>d(e.target.value),className:h(l?`min-w-0 flex-1`:`w-[150px] flex-none`),children:[e.apps.map(e=>(0,Y.jsxs)(`option`,{value:e.name,children:[e.name,` · `,e.url]},e.name)),(0,Y.jsx)(`option`,{value:``,children:`Another page…`})]}),!l&&(0,Y.jsx)(i,{"aria-label":`Page address`,type:`url`,value:f,spellCheck:!1,placeholder:`https://shop.example.com/`,onChange:e=>g(e.target.value),className:`min-w-0 flex-1`})]}),(0,Y.jsx)(i,{"aria-label":`What the test does`,value:v,maxLength:200,placeholder:`What the test does`,onChange:e=>b(e.target.value)}),(0,Y.jsxs)(m,{type:`submit`,variant:`primary`,disabled:t||!A,children:[(0,Y.jsx)(_,{size:16,"aria-hidden":`true`}),t?r===`desktop`?`Starting…`:`Opening…`:`Start recording`]})]}),j&&(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":O,onClick:()=>k(!O),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,Y.jsx)(p,{size:14,"aria-hidden":`true`,className:h(`transition-transform`,O&&`rotate-180`)}),`More options`,!O&&(x||E||w&&w!==e.environment)?(0,Y.jsx)(`span`,{className:`text-accent-fg`,children:`· set`}):null]}),(0,Y.jsx)(ee,{open:O,children:(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-[12px] bg-surface-muted p-3 @2xl:grid-cols-2`,children:[r===`web`&&(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm font-medium`,children:[`Test case `,(0,Y.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,Y.jsx)(i,{value:x,spellCheck:!1,placeholder:`SHOP-12, ado:1234 or a file`,onChange:e=>S(e.target.value),className:`bg-bg`})]}),e.environments.length>1&&(r===`desktop`||!!l)&&(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm font-medium`,children:[`Environment`,(0,Y.jsx)(u,{value:w,onChange:e=>T(e.target.value),children:e.environments.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))})]}),r===`web`&&e.logins.length>0&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 @2xl:col-span-2`,children:[(0,Y.jsx)(te,{checked:E,onChange:D,label:`Start signed in`}),(0,Y.jsxs)(`span`,{className:`flex flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium`,children:`Start signed in`}),(0,Y.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,Y.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:r===`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 with the Recorder panel in the page. A chat turns the recording into a test.`})]})}var $=20;function ye({rows:e}){let[t,n]=(0,J.useState)(``),[i,a]=(0,J.useState)(``),[c,l]=(0,J.useState)(`all`),[u,d]=(0,J.useState)(0);if((0,J.useEffect)(()=>d(0),[i,c]),!e.length)return null;let f=i.toLowerCase().split(/\s+/).filter(Boolean),p=e.filter(e=>f.every(t=>`${e.name} ${e.caseId||``} ${e.app||``} ${e.startUrl}`.toLowerCase().includes(t))),h=c===`all`?p:p.filter(e=>e.kind===c),g=h.slice(u*$,u*$+$),_=e.some(e=>e.kind===`desktop`)&&e.some(e=>e.kind===`web`);return(0,Y.jsxs)(`section`,{"aria-labelledby":`rec-list`,className:`flex min-w-0 flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`h2`,{id:`rec-list`,className:`m-0 mr-2 text-base font-semibold`,children:[`Recordings `,(0,Y.jsx)(`span`,{className:`font-normal text-muted tabular-nums`,children:e.length})]}),(0,Y.jsx)(re,{id:`rec-search`,label:`Find a recording`,value:i,onChange:a}),_&&(0,Y.jsx)(ie,{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:c,onChange:l})]}),t&&(0,Y.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:t}),(0,Y.jsxs)(`div`,{className:`rounded-[14px] border border-line-soft bg-bg`,children:[(0,Y.jsxs)(`ul`,{className:`m-0 list-none p-1.5`,children:[g.length===0&&(0,Y.jsx)(`li`,{className:`px-3 py-4 text-sm text-muted`,children:`Nothing matches.`}),g.map((e,t)=>{let i=F(e.startedAt);return(0,Y.jsxs)(`li`,{className:`contents`,children:[(t===0||F(g[t-1].startedAt)!==i)&&(0,Y.jsx)(`span`,{className:`block px-3 pt-3 pb-1 text-[12px] font-semibold text-muted`,children:i}),(0,Y.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,Y.jsx)(N,{size:16,"aria-label":`Recorded`,className:`text-pass`}):(0,Y.jsx)(x,{size:16,"aria-label":`Not recorded`,className:`text-fail`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[e.kind===`desktop`?(0,Y.jsx)(y,{size:13,"aria-label":`Desktop app`,className:`flex-none text-muted`}):(0,Y.jsx)(o,{size:13,"aria-label":`Web page`,className:`flex-none text-muted`}),(0,Y.jsx)(`span`,{className:`truncate text-[14px] font-medium`,title:e.name,children:e.name})]}),(0,Y.jsx)(`span`,{className:`truncate text-[12px] text-muted`,children:[b(e.steps,`step`),b(e.checks,`check`),e.caseId,e.app,se(e.startedAt)].filter(Boolean).join(` · `)})]}),(0,Y.jsxs)(`span`,{className:`flex flex-none items-center gap-1`,children:[e.trace&&(0,Y.jsx)(m,{size:`icon`,variant:`icon`,"aria-label":`Read the steps of ${e.name}`,title:`Read the steps`,onClick:async()=>n(await s(e.trace)),children:(0,Y.jsx)(r,{size:15,"aria-hidden":`true`})}),e.report&&(0,Y.jsx)(m,{size:`icon`,variant:`icon`,"aria-label":`Open the report of ${e.name}`,title:`Open the report`,onClick:async()=>n(await s(e.report)),children:(0,Y.jsx)(O,{size:15,"aria-hidden":`true`})}),e.kind===`desktop`&&e.workflow&&(0,Y.jsxs)(m,{size:`sm`,onClick:()=>Q(e.workflow).catch(e=>n(e.message)),children:[(0,Y.jsx)(j,{size:14,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`hidden @md:inline`,children:`Replay`})]}),e.kind===`web`&&e.ok&&(0,Y.jsxs)(m,{size:`sm`,onClick:()=>Z(e.runDir).catch(e=>n(e.message)),children:[(0,Y.jsx)(M,{size:14,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`hidden @md:inline`,children:`Write a test`})]})]})]})]},e.runDir)})]}),(0,Y.jsx)(ne,{page:u,size:$,total:h.length,onPage:d,label:`Pages of recordings`})]})]})}function be(){let[e,t]=(0,J.useState)(null),[n,r]=(0,J.useState)(``),[i,a]=(0,J.useState)(!1),o=(0,J.useCallback)(()=>{c.get().then(e=>{t(e),r(``)},e=>r(e.message))},[]);(0,J.useEffect)(o,[o]);let s=!!e?.session&&me.has(e.session.state);(0,J.useEffect)(()=>{if(!s)return;let e=setInterval(o,800);return()=>clearInterval(e)},[s,o]);let l=async e=>{a(!0),r(``);try{t(await e())}catch(e){r(e.message)}finally{a(!1)}},u=e?.session;return(0,Y.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,Y.jsx)(w,{}),(0,Y.jsxs)(`main`,{className:h(E,`@container flex-auto gap-4`),children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(S,{icon:_,size:`lg`}),(0,Y.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Record`})]}),(0,Y.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:`Do a test's steps yourself in a browser or a Windows app ForgeQE opens; each click, entry and check you add is recorded in order.`}),n&&(0,Y.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:n}),!e&&!n&&(0,Y.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),e&&u&&s&&(0,Y.jsx)(ge,{s:u,busy:i,send:e=>void l(()=>c.command(e))}),e&&!s&&(0,Y.jsxs)(Y.Fragment,{children:[u?.result&&(0,Y.jsx)(_e,{s:u}),(0,Y.jsx)(ve,{view:e,busy:i,onStart:e=>void l(()=>c.start(e))}),(0,Y.jsx)(ye,{rows:e.recordings})]})]})]})}export{be as Record};
@@ -1,2 +0,0 @@
1
- import{Dt as e,G as t,Gn as n,H as r,Hn as i,Lt as a,Ot as o,S as s,Wt as c,_n as l,at as u,ct as d,ht as f,it as p,jn as m,lt as h,nt as g,q as _,r as v,st as y,t as b,tt as x}from"./frame-CHQgOaj6.js";import{t as S}from"./external-link-B45wnQ3R.js";import{t as C}from"./sticky-note-D_lJfPYH.js";import{b as w,s as T}from"./index-Hd8gmpz5.js";var E={name:`bandage`,size:24,node:[[`path`,{d:`M10 10.01h.01`,key:`1e9xi7`}],[`path`,{d:`M10 14.01h.01`,key:`ac23bv`}],[`path`,{d:`M14 10.01h.01`,key:`2wfrvf`}],[`path`,{d:`M14 14.01h.01`,key:`8tw8yn`}],[`path`,{d:`M18 6v12`,key:`1bcixs`}],[`path`,{d:`M6 6v12`,key:`vkc79e`}],[`rect`,{x:`2`,y:`6`,width:`20`,height:`12`,rx:`2`,key:`1wpnh2`}]]};E.node;var D=l(E),O={name:`git-commit-horizontal`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]],aliases:[`git-commit`]};O.node;var k=l(O),A={name:`hammer`,size:24,node:[[`path`,{d:`m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9`,key:`1hayfq`}],[`path`,{d:`m18 15 4-4`,key:`16gjal`}],[`path`,{d:`m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5`,key:`15ts47`}]]};A.node;var j=l(A),M=n(i(),1),N=y(),P={linked:{label:`Linked test case`,tone:`pass`,help:`It automates a test case that tests a changed work item`},changed:{label:`Test code changed`,tone:`running`,help:`The change is in test code it uses`},covers:{label:`Matches a change`,tone:`neutral`,help:`The change's words name what it does`},risk:{label:`Risk area`,tone:`warn`,help:`The release touches an area with defects or failures before`},smoke:{label:`Smoke`,tone:`neutral`,help:`Tagged smoke: in every pack`}},F={heal:{label:`Heal`,tone:`warn`,does:`An element it uses is gone: the healing agent re-runs the flow and updates the test.`},check:{label:`AI re-run decides`,tone:`warn`,does:`The healing agent re-runs the flow: it heals the test when the flow works, and reports an app bug when it fails at the same step.`},flaky:{label:`Flaky`,tone:`neutral`,does:`Passed when run again: quarantine it, or fix the cause it flakes on. Not healed.`},environment:{label:`Environment`,tone:`neutral`,does:`Network, a server error, sign-in: run again once the environment works. No heal, no bug.`},test_code:{label:`Test code broken`,tone:`fail`,does:`A missing module, a compile error, a missing fixture: fix the test's code.`}},I={work_item:w,pr:a,commit:k,note:C},L=e=>new Date(e).toLocaleString([],{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}),R=e=>e?e.status===`passed`?`pass`:e.status===`failed`?`fail`:`warn`:`neutral`,z=e=>e<60?`${Math.round(e)}s`:`${Math.floor(e/60)}m ${Math.round(e%60)}s`,B=e=>e&&/^https?:\/\//i.test(e)?e:void 0;function V({job:e,onStop:t}){let n=(0,M.useRef)(null),[,r]=(0,M.useState)(0);(0,M.useEffect)(()=>{if(!e.running)return;let t=setInterval(()=>r(e=>e+1),1e3);return()=>clearInterval(t)},[e.running]),(0,M.useEffect)(()=>{n.current&&(n.current.scrollTop=n.current.scrollHeight)},[e.lines.length]);let i=e.running?e.kind===`build`?`Building the pack`:e.kind===`run`?`Running ${e.pack}`:`Healing ${e.pack}'s failures`:e.kind===`build`?`Built ${e.pack||`the pack`}`:e.kind===`run`?`Ran ${e.pack}`:`Healed ${e.pack}'s failures`,a=Math.round(((e.endedAt?Date.parse(e.endedAt):Date.now())-Date.parse(e.startedAt))/1e3);return(0,N.jsxs)(`section`,{"aria-label":i,className:`flex flex-col gap-2 rounded-[14px] border border-line-soft p-4`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,N.jsx)(`span`,{className:`flex-1 font-medium`,children:i}),(0,N.jsx)(T,{orb:e.kind===`build`?`handing`:e.kind===`heal`?`retrying`:`working`,tone:e.running?`running`:e.exitCode===0?`pass`:e.kind===`run`&&e.exitCode===1?`warn`:`fail`,children:e.running?`Working`:e.exitCode===0?`Done`:e.kind===`run`&&e.exitCode===1?`Tests failed`:`Did not finish`}),(0,N.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:z(a)}),e.running&&(0,N.jsxs)(u,{onClick:t,className:`border-fail text-fail hover:bg-fail-soft`,children:[(0,N.jsx)(f,{size:14,fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]}),(0,N.jsx)(`code`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:e.command}),(0,N.jsxs)(`details`,{open:e.running,children:[(0,N.jsxs)(`summary`,{className:`cursor-pointer text-sm text-muted`,children:[`Output (`,e.lines.length,` lines)`]}),(0,N.jsx)(`pre`,{ref:n,className:`mt-2 max-h-[300px] overflow-auto rounded-[10px] bg-surface-muted p-3 font-mono text-[12px] leading-relaxed whitespace-pre-wrap text-ink-2`,children:e.lines.join(`
2
- `)||`Starting…`})]})]})}function H({title:e,aside:t,children:n}){return(0,N.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,N.jsx)(`h3`,{className:`m-0 flex-1 text-base font-semibold`,children:e}),t]}),n]})}function U(e){let[t,n]=e.slice(-2).length===2?e.slice(-2):[void 0,e.at(-1)];return!n||!t?{fresh:[],fixed:[]}:{fresh:n.failed.filter(e=>!t.failed.includes(e)),fixed:t.failed.filter(e=>!n.failed.includes(e))}}function W({name:t,busy:n,act:r,version:i}){let[a,o]=(0,M.useState)(null),[l,f]=(0,M.useState)(``),[p,h]=(0,M.useState)(`all`),[g,_]=(0,M.useState)(null),[v,y]=(0,M.useState)(new Set);if((0,M.useEffect)(()=>{let e=!1;return m.detail(t).then(t=>!e&&(o(t),f(``)),t=>!e&&f(t.message)),()=>{e=!0}},[t,i]),(0,M.useEffect)(()=>{h(`all`),_(null),y(new Set)},[t]),l)return(0,N.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:l});if(!a)return(0,N.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading…`});let b=a.runs.at(-1),{fresh:x,fixed:w}=U(a.runs),E=a.tests.filter(e=>p===`all`||e.reasons.some(e=>e.kind===p)),O=(a.triage?.items??[]).filter(e=>e.route===`heal`||e.route===`check`),k=Object.keys(F).filter(e=>a.triage?.items.some(t=>t.route===e)),A=Object.keys(P).filter(e=>a.tests.some(t=>t.reasons.some(t=>t.kind===e)));return(0,N.jsxs)(`section`,{"aria-labelledby":`pack-h`,className:`flex min-w-0 flex-1 flex-col gap-6`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,N.jsx)(`h2`,{id:`pack-h`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:a.name}),(0,N.jsxs)(`span`,{className:`text-sm text-muted`,children:[`Built `,L(a.createdAt)]}),a.scope.length>0&&(0,N.jsx)(`span`,{className:`flex flex-wrap gap-1.5 pt-1`,children:a.scope.map(e=>(0,N.jsx)(`span`,{className:`rounded-full bg-surface-strong px-2.5 py-0.5 text-[12px] text-ink-2`,children:e},e))})]}),g?(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-[12px] bg-accent-soft px-3 py-2`,children:[(0,N.jsxs)(`span`,{className:`text-sm`,children:[`Run `,a.tests.length,` test`,a.tests.length===1?``:`s`,` `,g===`local`?`on this machine`:`on TestMu AI`,`?`]}),(0,N.jsx)(u,{variant:`primary`,disabled:n,onClick:()=>{_(null),r(()=>m.run(a.name,g))},children:`Run`}),(0,N.jsx)(u,{onClick:()=>_(null),children:`Don't run`})]}):(0,N.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,N.jsxs)(u,{variant:`primary`,disabled:n||!a.tests.length,onClick:()=>_(`local`),children:[(0,N.jsx)(e,{size:16,"aria-hidden":`true`}),`Run here`]}),(0,N.jsx)(u,{disabled:n||!a.tests.length,onClick:()=>_(`testmu`),children:`Run on TestMu AI`})]})]}),(0,N.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,N.jsx)(s,{label:`Tests`,value:String(a.tests.length),note:A.map(e=>`${a.tests.filter(t=>t.reasons.some(t=>t.kind===e)).length} ${P[e].label.toLowerCase()}`).join(` · `)}),(0,N.jsx)(s,{label:`Not covered`,value:String(a.uncovered.length),note:`changes no test is in for`}),(0,N.jsx)(s,{label:`Risk areas`,value:String(a.risk.length)}),(0,N.jsx)(s,{label:`Last run`,value:b?b.status===`passed`?`Passed`:`${b.counts.failed} failed`:`–`,note:b?`${L(b.at)} · ${b.on===`testmu`?`TestMu AI`:b.on===`pipeline`?`pipeline`:`this machine`}`:`Not run yet`})]}),a.triage&&(0,N.jsxs)(H,{title:`Triage of the last run`,aside:(0,N.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[a.triage.items.length,` failed or flaky`]}),children:[a.triage.environmentDown&&(0,N.jsx)(`p`,{className:`m-0 rounded-[12px] bg-warn-soft px-3 py-2 text-sm text-warn`,children:`Most failures were the environment: run the pack again before healing anything.`}),k.map(e=>(0,N.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-[12px] border border-line-soft px-4 py-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,N.jsx)(T,{tone:F[e].tone,children:F[e].label}),(0,N.jsx)(`span`,{className:`text-[13px] text-muted`,children:F[e].does})]}),(0,N.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:a.triage.items.filter(t=>t.route===e).map(t=>(0,N.jsxs)(`li`,{className:`flex items-start gap-3 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(e===`heal`||e===`check`)&&(0,N.jsx)(`input`,{type:`checkbox`,"aria-label":`Heal ${t.name}`,checked:v.has(t.name),onChange:e=>{let n=new Set(v);e.target.checked?n.add(t.name):n.delete(t.name),y(n)},className:`mt-1 size-5 accent-accent`}),(0,N.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,N.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t.name}),(0,N.jsxs)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:[t.why,` · `,t.confidence,` confidence`,t.file?` · ${t.file}`:``,t.history?` · ${t.history}`:``]})]})]},t.name))})]},e)),O.length>0&&(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,N.jsxs)(u,{disabled:n||!v.size,onClick:()=>r(()=>m.heal(a.name,[...v])),children:[(0,N.jsx)(D,{size:16,"aria-hidden":`true`}),`Heal `,v.size||``,` selected`]}),(0,N.jsxs)(u,{variant:`ghost`,disabled:n,onClick:()=>y(new Set(O.map(e=>e.name))),children:[`Select all `,O.length]}),(0,N.jsx)(`span`,{className:`text-[13px] text-muted`,children:`The healing agent re-runs each flow in the browser before it changes anything.`})]})]}),a.runs.length>0&&(0,N.jsxs)(H,{title:`Runs`,aside:x.length||w.length?(0,N.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[[x.length?`${x.length} newly failing`:``,w.length?`${w.length} fixed`:``].filter(Boolean).join(` · `),` since the run before`]}):void 0,children:[(0,N.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[...a.runs].reverse().map((e,t)=>(0,N.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,N.jsx)(T,{tone:R(e),children:e.status===`passed`?`Passed`:e.status===`failed`?`Failed`:e.status}),(0,N.jsxs)(`span`,{className:`flex-1`,children:[L(e.at),` · `,e.on===`testmu`?`TestMu AI`:e.on===`pipeline`?`pipeline`:`this machine`]}),(0,N.jsxs)(`span`,{className:`text-muted tabular-nums`,children:[e.counts.passed,` passed · `,e.counts.failed,` failed`,e.counts.skipped?` · ${e.counts.skipped} skipped`:``,` · `,z(e.seconds)]}),B(e.url)&&(0,N.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1`,children:[`Pipeline `,(0,N.jsx)(S,{size:13,"aria-hidden":`true`})]})]},`${e.at}-${t}`))}),x.length>0&&(0,N.jsxs)(`p`,{className:`m-0 text-[13px] text-fail`,children:[`Newly failing: `,x.join(`, `)]}),w.length>0&&(0,N.jsxs)(`p`,{className:`m-0 text-[13px] text-pass`,children:[`Fixed: `,w.join(`, `)]})]}),(0,N.jsxs)(H,{title:`Tests (${a.tests.length})`,aside:(0,N.jsx)(`div`,{role:`group`,"aria-label":`Why in`,className:`flex flex-wrap gap-1`,children:[`all`,...A].map(e=>(0,N.jsx)(`button`,{type:`button`,"aria-pressed":p===e,title:P[e]?.help,onClick:()=>h(e),className:d(`min-h-8 cursor-pointer rounded-[8px] border px-3 text-[13px]`,p===e?`border-ink bg-ink text-bg`:`border-transparent bg-surface-strong text-ink-2 hover:bg-line hover:text-ink`),children:e===`all`?`All`:P[e].label},e))}),children:[(0,N.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:E.slice(0,300).map(e=>(0,N.jsxs)(`li`,{className:`flex flex-col gap-1 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,N.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,N.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.test}),e.flaky&&(0,N.jsx)(T,{tone:`warn`,children:`Flaky`})]}),(0,N.jsxs)(`span`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:[e.file,e.line?`:${e.line}`:``]}),(0,N.jsx)(`span`,{className:`flex flex-wrap gap-1.5`,children:e.reasons.map((e,t)=>(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[13px] text-ink-2`,children:[(0,N.jsx)(T,{tone:P[e.kind]?.tone??`neutral`,icon:!1,children:P[e.kind]?.label??e.kind}),e.text]},t))})]},`${e.file}:${e.test}`))}),E.length>300&&(0,N.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`The first 300 of `,E.length,`.`]})]}),a.uncovered.length>0&&(0,N.jsx)(H,{title:`Not covered (${a.uncovered.length})`,aside:(0,N.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Extend the closest test rather than write a new one`}),children:(0,N.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:a.uncovered.map(e=>(0,N.jsxs)(`li`,{className:`flex flex-col gap-0.5 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,N.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[(0,N.jsx)(`span`,{className:`mr-1.5 font-mono text-[12px] text-muted`,children:e.item}),e.title]}),(0,N.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.why}),e.nearest&&(0,N.jsxs)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[`Closest: `,e.nearest.test,` `,(0,N.jsxs)(`span`,{className:`font-mono text-[12px] text-muted`,children:[`(`,e.nearest.file,`)`]}),e.nearest.lacks.length?`, lacks ${e.nearest.lacks.join(`, `)}`:``]})]},e.item))})}),a.risk.length>0&&(0,N.jsx)(H,{title:`Risk areas`,children:(0,N.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:a.risk.map(e=>(0,N.jsxs)(`li`,{className:`flex items-start gap-3 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,N.jsx)(c,{size:16,"aria-hidden":`true`,className:d(`mt-0.5 flex-none`,e.level===`high`?`text-fail`:`text-warn`)}),(0,N.jsxs)(`span`,{className:`flex flex-col`,children:[(0,N.jsxs)(`span`,{children:[e.area,` `,(0,N.jsxs)(`span`,{className:`text-muted`,children:[`· `,e.level]})]}),(0,N.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.reasons.join(`; `)})]})]},e.area))})}),(0,N.jsx)(H,{title:`Changes (${a.items.length})`,children:(0,N.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:a.items.slice(0,200).map(e=>{let t=I[e.kind]||C;return(0,N.jsxs)(`li`,{className:`flex items-start gap-3 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,N.jsx)(t,{size:16,"aria-hidden":`true`,className:`mt-0.5 flex-none text-muted`}),(0,N.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[(0,N.jsxs)(`span`,{className:`mr-1.5 font-mono text-[12px] text-muted`,children:[e.type?`${e.type} `:``,e.id]}),e.title]}),B(e.url)&&(0,N.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`Open ${e.id}`,className:`flex-none`,children:(0,N.jsx)(S,{size:14,"aria-hidden":`true`})})]},`${e.kind}-${e.id}`)})})}),a.notes.length>0&&(0,N.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-[13px] text-muted`,children:a.notes.map((e,t)=>(0,N.jsx)(`li`,{children:e},t))})]})}function G({open:e,onClose:n,view:i,onBuild:a,busy:o}){let[s,c]=(0,M.useState)({rangeRepo:`product`,prRepo:`product`,risk:!0,smoke:!0});(0,M.useEffect)(()=>{e&&c({rangeRepo:i.productRepo?`product`:`tests`,prRepo:i.productRepo?`product`:`tests`,risk:!0,smoke:!0})},[e,i.productRepo]);let l=(e,t)=>c({...s,[e]:t}),f=(e,t,n,i)=>(0,N.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,N.jsx)(`label`,{htmlFor:`pk-${e}`,className:`text-sm font-medium`,children:t}),(0,N.jsx)(r,{id:`pk-${e}`,value:String(s[e]??``),spellCheck:!1,maxLength:200,placeholder:n,onChange:t=>l(e,t.target.value)}),i&&(0,N.jsx)(`span`,{className:`text-[13px] text-muted`,children:i})]}),p=(e,t)=>(0,N.jsxs)(`fieldset`,{className:`m-0 flex flex-wrap items-center gap-x-4 gap-y-1 border-0 p-0`,children:[(0,N.jsx)(`legend`,{className:`mb-1 text-[13px] text-muted`,children:t}),(0,N.jsxs)(`label`,{className:`flex min-h-9 cursor-pointer items-center gap-2 text-sm`,children:[(0,N.jsx)(`input`,{type:`radio`,name:e,checked:s[e]===`product`,disabled:!i.productRepo,onChange:()=>l(e,`product`),className:`size-4 accent-accent`}),`The product's `,i.productRepo?(0,N.jsx)(`code`,{className:`font-mono text-[12px]`,children:i.productRepo}):(0,N.jsx)(`span`,{className:`text-muted`,children:`(set defects.product_repo)`})]}),(0,N.jsxs)(`label`,{className:`flex min-h-9 cursor-pointer items-center gap-2 text-sm`,children:[(0,N.jsx)(`input`,{type:`radio`,name:e,checked:s[e]===`tests`,onChange:()=>l(e,`tests`),className:`size-4 accent-accent`}),`The tests' `,i.repo===`.`?`(this project)`:(0,N.jsx)(`code`,{className:`font-mono text-[12px]`,children:i.repo})]})]}),m=`flex flex-col gap-3 rounded-[12px] border border-line-soft p-3`;return(0,N.jsx)(t,{open:e,onClose:n,wide:!0,title:`Build a regression pack`,description:`The tests a release's changes can break, from any mix of the changes below. Building runs nothing; it takes seconds.`,footer:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(u,{onClick:n,children:`Cancel`}),(0,N.jsxs)(u,{variant:`primary`,disabled:o,onClick:()=>a(s),children:[(0,N.jsx)(j,{size:16,"aria-hidden":`true`}),`Build the pack`]})]}),children:(0,N.jsxs)(`div`,{className:`flex flex-col gap-4 pt-3`,children:[f(`name`,`Name`,`release-1.5`,`Lower-case letters, digits, dots and dashes. Empty: release-<date>.`),(0,N.jsxs)(`div`,{className:m,children:[(0,N.jsxs)(`h3`,{className:`m-0 flex items-center gap-2 text-sm font-semibold`,children:[(0,N.jsx)(k,{size:16,"aria-hidden":`true`,className:`text-accent-fg`}),`Code changes`]}),(0,N.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-3`,children:[f(`from`,`Commits after`,`release/1.4, a tag or a commit`),f(`to`,`Up to`,`HEAD`)]}),p(`rangeRepo`,`In the repository`),(0,N.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-3`,children:[f(`prs`,`Pull requests`,`57, 58 or their links`),(0,N.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,N.jsx)(`label`,{htmlFor:`pk-days`,className:`text-sm font-medium`,children:`Or merged in the last`}),(0,N.jsxs)(`span`,{className:`flex items-center gap-2 text-sm`,children:[(0,N.jsx)(r,{id:`pk-days`,type:`number`,min:1,max:365,value:s.mergedDays??``,onChange:e=>l(`mergedDays`,e.target.value?Number(e.target.value):void 0),className:`w-24`}),` days`]})]})]}),(s.prs||s.mergedDays)&&p(`prRepo`,`Pull requests of`)]}),(0,N.jsxs)(`div`,{className:d(m,!i.azureDevops&&`opacity-70`),children:[(0,N.jsxs)(`h3`,{className:`m-0 flex items-center gap-2 text-sm font-semibold`,children:[(0,N.jsx)(w,{size:16,"aria-hidden":`true`,className:`text-accent-fg`}),`Azure DevOps work items and their linked test cases`]}),!i.azureDevops&&(0,N.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Not set up: `,(0,N.jsx)(`a`,{href:_(`settings`,`integrations`),children:`Settings, Integrations`}),`.`]}),(0,N.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-3`,children:[f(`sprint`,`Sprint`,`current, or Sprint 41`),f(`iteration`,`Iteration path`,`Shop\\Release 2026.09`),f(`area`,`Area path`,`Shop\\Checkout`),f(`parent`,`Epic or feature`,`1200`),f(`workItems`,`Work items`,`2211, 2212`)]}),(0,N.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Their stories and bugs, the test cases each is tested by, and the files their linked pull requests changed.`})]}),(0,N.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-2`,children:[(0,N.jsxs)(`span`,{className:`flex items-center gap-2 text-sm`,children:[(0,N.jsx)(x,{checked:s.risk!==!1,onChange:e=>l(`risk`,e),label:`Add tests for risk areas`}),`Add tests for risk areas the release touches`]}),(0,N.jsxs)(`span`,{className:`flex items-center gap-2 text-sm`,children:[(0,N.jsx)(x,{checked:s.smoke!==!1,onChange:e=>l(`smoke`,e),label:`Add smoke tests`}),`Add smoke-tagged tests`]})]})]})})}function K({sub:e}){let[t,n]=(0,M.useState)(null),[r,i]=(0,M.useState)(``),[a,s]=(0,M.useState)(!1),[c,l]=(0,M.useState)(!1),f=(0,M.useCallback)(()=>{m.list().then(e=>{n(e),i(``)},e=>i(e.message))},[]);(0,M.useEffect)(f,[f]);let y=!!t?.job?.running;(0,M.useEffect)(()=>{if(!y)return;let e=setInterval(f,1500);return()=>clearInterval(e)},[y,f]);let x=async e=>{s(!0),i(``);try{await e(),f()}catch(e){i(e.message)}finally{s(!1)}},S=e?decodeURIComponent(e):``,C=t?.packs.find(e=>e.name===S)||t?.packs[0],w=(0,M.useMemo)(()=>`${t?.job?.endedAt??``}|${C?.runs??0}|${C?.createdAt??``}`,[t,C]);return(0,N.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,N.jsx)(v,{}),(0,N.jsxs)(`main`,{className:d(b,`@container flex-auto gap-4`),children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,N.jsx)(g,{icon:o,size:`lg`}),(0,N.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`Regression`}),(0,N.jsxs)(u,{variant:`primary`,disabled:!t||y,onClick:()=>l(!0),children:[(0,N.jsx)(j,{size:16,"aria-hidden":`true`}),`Build a pack`]})]}),(0,N.jsxs)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:[`A regression pack is the set of tests in `,t&&t.repo!==`.`?(0,N.jsx)(`code`,{className:`font-mono text-[13px]`,children:t.repo}):`this project`,` that a release's changes can break: from the commits and pull requests of the product or development repositories, and the Azure DevOps sprint, epic or work items with their linked test cases. Each test says why it is in; the changes no test covers are listed. Run it here or on TestMu AI, and each run is triaged into what to heal, re-run or fix.`]}),r&&(0,N.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,N.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t?.job&&(0,N.jsx)(V,{job:t.job,onStop:()=>x(()=>m.stop())}),t&&(t.packs.length?(0,N.jsxs)(`div`,{className:`flex flex-col gap-6 @2xl:flex-row @2xl:items-start @2xl:gap-8`,children:[(0,N.jsxs)(`nav`,{"aria-label":`Packs`,className:`flex min-w-0 flex-col gap-1 @2xl:sticky @2xl:top-6 @2xl:w-[250px] @2xl:flex-none`,children:[(0,N.jsxs)(`span`,{className:`px-3 text-[13px] font-medium text-muted`,children:[`Packs (`,t.packs.length,`)`]}),(0,N.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.packs.map(e=>(0,N.jsx)(`li`,{children:(0,N.jsxs)(`a`,{href:_(`regression`,encodeURIComponent(e.name)),"aria-current":C?.name===e.name?`page`:void 0,className:d(`flex min-h-[60px] items-center gap-3 rounded-[12px] px-3 py-2 text-ink no-underline`,C?.name===e.name?`bg-surface-strong hover:text-ink`:`hover:bg-surface-muted hover:text-ink`),children:[t?.job?.running&&t.job.pack===e.name?(0,N.jsx)(p,{state:t.job.kind===`heal`?`retrying`:`working`,label:`Working on it`,px:16}):(0,N.jsx)(`span`,{className:d(`size-2.5 flex-none rounded-full`,e.lastRun?e.lastRun.status===`passed`?`bg-pass`:`bg-fail`:`bg-line`),"aria-label":e.lastRun?e.lastRun.status:`not run`}),(0,N.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,N.jsx)(`span`,{className:`truncate text-[15px] font-medium`,children:e.name}),(0,N.jsxs)(`span`,{className:`truncate text-[13px] text-muted`,children:[h(e.tests,`test`),` · `,e.uncovered,` not covered · `,L(e.createdAt)]})]})]})},e.name))})]}),C&&(0,N.jsx)(W,{name:C.name,busy:a||y,act:x,version:w})]}):(0,N.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,N.jsx)(o,{size:24,"aria-hidden":`true`,className:`text-muted`}),(0,N.jsx)(`p`,{className:`m-0 max-w-[62ch] leading-relaxed text-ink-2`,children:`No regression packs yet. Build one from a sprint, the commits since the last release, or the pull requests merged this week.`}),(0,N.jsx)(u,{onClick:()=>l(!0),children:`Build a pack`})]}))]}),t&&(0,N.jsx)(G,{open:c,onClose:()=>l(!1),view:t,busy:a||y,onBuild:e=>x(async()=>{await m.build(e),l(!1)})})]})}export{K as Regression};
@@ -1,2 +0,0 @@
1
- import{E as e,Fn as t,Gn as n,Gt as r,H as i,Hn as a,Jt as o,K as s,O as c,U as l,at as u,ct as d,it as f,lt as p,nn as m,nt as h,q as g,r as _,st as v,t as y}from"./frame-CHQgOaj6.js";import{t as b}from"./circle-dashed-CQKCycSk.js";import{t as x}from"./markdown-BPBR6Fva.js";import{t as S}from"./external-link-B45wnQ3R.js";import{n as C,t as w}from"./trending-up-Bypj2D7Z.js";import{E as T,j as E,w as D}from"./index-Hd8gmpz5.js";import{n as O,t as k}from"./when-CHnpLdYw.js";var A=n(a(),1),j=v(),M={suite:`Suite`,monitor:`Monitor round`,run:`Browser run`,explore:`Exploration`,api:`API run`,desktop:`Desktop run`,mobile:`Mobile run`,page:`Report page`},N=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`})},P=e=>{if(!e)return``;let t=Math.round(e/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m ${t%60}s`:`${Math.floor(t/3600)}h ${Math.floor(t%3600/60)}m`};function F(e){return e.scope===`page`?{tone:`neutral`,label:`Report`}:e.counts.total?e.counts.failed?{tone:`fail`,label:`${e.counts.failed} failed`}:e.stopped||e.counts.other?{tone:`warn`,label:e.stopped?`Stopped`:`${e.counts.other} not run`}:{tone:`pass`,label:`Passed`}:{tone:`neutral`,label:`No results`}}var I=50;function L({r:e}){let t=F(e),n=e.scope===`page`?r:t.tone===`pass`?E:t.tone===`fail`?m:b;return(0,j.jsx)(n,{size:16,"aria-label":t.label,className:d(`flex-none`,t.tone===`pass`?`text-pass`:t.tone===`fail`?`text-fail`:t.tone===`warn`?`text-warn`:`text-muted`)})}var R=e=>{let t=new Date(`${e}T12:00:00`);return Number.isNaN(t.getTime())?e:t.toLocaleDateString([],{day:`numeric`,month:`short`})},z=e=>{let t=e.reduce((e,t)=>e+t.cases,0);return t?Math.round(e.reduce((e,t)=>e+t.passed,0)/t*100):null};function B({title:e,note:t,children:n,className:r}){return(0,j.jsxs)(`section`,{className:d(`flex min-w-0 flex-col rounded-[14px] border border-line-soft bg-bg px-4 py-3.5`,r),children:[(0,j.jsx)(`h3`,{className:`m-0 text-[15px] font-semibold`,children:e}),t&&(0,j.jsx)(`p`,{className:`m-0 mt-0.5 text-[12.5px] text-muted`,children:t}),(0,j.jsx)(`div`,{className:`mt-3 flex min-w-0 flex-col`,children:n})]})}function V({part:e,whole:t,tone:n,label:r}){return(0,j.jsxs)(`span`,{className:`flex flex-none items-center gap-2`,children:[(0,j.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-16 flex-none overflow-hidden rounded-full bg-surface-strong`,children:(0,j.jsx)(`span`,{className:d(`block h-full rounded-full`,n===`pass`?`bg-pass`:n===`fail`?`bg-fail`:`bg-accent`),style:{width:`${t?Math.max(4,e/t*100):0}%`}})}),(0,j.jsx)(`span`,{className:`text-[12.5px] whitespace-nowrap text-ink-2 tabular-nums`,children:r})]})}function H({days:e}){let[t,n]=(0,A.useState)(null),r=e.slice(-30);if(!r.length)return(0,j.jsx)(`p`,{className:`m-0 py-6 text-sm text-muted`,children:`No runs with results yet.`});let i=Math.max(1,...r.map(e=>e.cases)),a=i<=4?1:Math.ceil(i/4/5)*5||1,o=Math.ceil(i/a)*a,s=[o,Math.round(o/2),0],c=Math.ceil(r.length/8),l=t===null?null:r[t];return(0,j.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,j.jsxs)(`div`,{"aria-hidden":`true`,className:`flex gap-4 text-[12.5px] text-ink-2`,children:[(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,j.jsx)(`span`,{className:`size-2.5 rounded-[3px] bg-pass`}),` Passed`]}),(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,j.jsx)(`span`,{className:`size-2.5 rounded-[3px] bg-fail`}),` Failed`]})]}),(0,j.jsxs)(`div`,{className:`relative grid grid-cols-[32px_minmax(0,1fr)] gap-x-2`,children:[(0,j.jsx)(`div`,{"aria-hidden":`true`,className:`flex h-[180px] flex-col justify-between text-right text-[11px] text-muted tabular-nums`,children:s.map(e=>(0,j.jsx)(`span`,{className:`-translate-y-1/2 first:translate-y-0 last:translate-y-0`,children:e},e))}),(0,j.jsxs)(`div`,{className:`relative h-[180px]`,onMouseLeave:()=>n(null),children:[s.map((e,t)=>(0,j.jsx)(`span`,{"aria-hidden":`true`,className:d(`absolute inset-x-0 border-t`,t===s.length-1?`border-line`:`border-line-soft`),style:{top:`${(1-e/o)*100}%`}},e)),(0,j.jsx)(`div`,{className:`absolute inset-0 flex items-end gap-[3px]`,children:r.map((e,r)=>{let i=e.cases-e.passed;return(0,j.jsx)(`div`,{className:`flex h-full min-w-0 flex-1 cursor-default flex-col justify-end`,onMouseEnter:()=>n(r),children:(0,j.jsxs)(`div`,{className:d(`flex w-full flex-col justify-end gap-[2px] transition-opacity`,t!==null&&t!==r&&`opacity-50`),style:{height:`${e.cases/o*100}%`},children:[i>0&&(0,j.jsx)(`span`,{className:`min-h-[2px] w-full rounded-t-[4px] bg-fail`,style:{flexGrow:i}}),e.passed>0&&(0,j.jsx)(`span`,{className:d(`min-h-[2px] w-full bg-pass`,!i&&`rounded-t-[4px]`),style:{flexGrow:e.passed}})]})},e.day)})}),l&&(0,j.jsxs)(`div`,{role:`status`,className:`pointer-events-none absolute z-[2] w-max max-w-[220px] -translate-x-1/2 -translate-y-[calc(100%+8px)] rounded-[10px] border border-line-soft bg-bg px-3 py-2 text-[12.5px] shadow-composer`,style:{left:`${Math.min(88,Math.max(12,(t+.5)/r.length*100))}%`,top:`${(1-l.cases/o)*100}%`},children:[(0,j.jsx)(`b`,{className:`block text-ink`,children:R(l.day)}),(0,j.jsxs)(`span`,{className:`block text-ink-2 tabular-nums`,children:[l.passed,` passed, `,l.cases-l.passed,` failed · `,z([l]),`%`]}),(0,j.jsx)(`span`,{className:`block text-muted`,children:p(l.runs,`run`)})]})]}),(0,j.jsx)(`span`,{}),(0,j.jsx)(`div`,{"aria-hidden":`true`,className:`mt-1 flex gap-[3px] text-[11px] text-muted`,children:r.map((e,t)=>(0,j.jsx)(`span`,{className:`min-w-0 flex-1 text-center whitespace-nowrap`,children:t%c===0&&(0,j.jsx)(`span`,{className:d(t/c%2==1&&`hidden @2xl:inline`),children:R(e.day)})},e.day))})]}),(0,j.jsxs)(`table`,{className:`sr-only`,children:[(0,j.jsx)(`caption`,{children:`Cases by day`}),(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`th`,{children:`Day`}),(0,j.jsx)(`th`,{children:`Runs`}),(0,j.jsx)(`th`,{children:`Passed`}),(0,j.jsx)(`th`,{children:`Failed`})]})}),(0,j.jsx)(`tbody`,{children:r.map(e=>(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`td`,{children:e.day}),(0,j.jsx)(`td`,{children:e.runs}),(0,j.jsx)(`td`,{children:e.passed}),(0,j.jsx)(`td`,{children:e.cases-e.passed})]},e.day))})]})]})}function U({project:n,build:r,onBuilt:i}){let[a,o]=(0,A.useState)(r),[l,h]=(0,A.useState)(``),g=!!a?.running;(0,A.useEffect)(()=>{if(!g)return;let e=setInterval(async()=>{try{let e=await t.buildStatus();o(e),e&&!e.running&&i()}catch{}},1200);return()=>clearInterval(e)},[g,i]);let _=n.cases?Math.round(n.passed/n.cases*100):null,v=z(n.days.slice(-7)),y=z(n.days.slice(-14,-7)),b=v!==null&&y!==null?v-y:null,x=[{label:`Runs`,value:String(n.runs),sub:n.runs?`${R(String(n.from).slice(0,10))} – ${R(String(n.to).slice(0,10))}`:void 0},{label:`Cases run`,value:String(n.cases),sub:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`span`,{className:`text-pass`,children:[n.passed,` passed`]}),` · `,(0,j.jsxs)(`span`,{className:d(n.failed&&`text-fail`),children:[n.failed,` failed`]})]})},{label:`Tokens`,value:c(n.tokens),sub:n.cost?e(n.cost.amount,n.cost.currency):void 0}];return(0,j.jsxs)(`section`,{"aria-labelledby":`project-h`,className:`flex min-w-0 flex-col gap-4`,children:[(0,j.jsx)(`h2`,{id:`project-h`,className:`sr-only`,children:`Project report`}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`min-w-0 flex-[1_1_240px] text-[13px] text-muted`,children:n.page?`The HTML report was built ${N(n.page.builtAt)}.`:`Every run, taken together. The HTML report has not been built yet.`}),n.page&&(0,j.jsxs)(u,{size:`sm`,onClick:async()=>h(await s(n.page.file)),children:[(0,j.jsx)(S,{size:14,"aria-hidden":`true`}),`Open HTML report`]}),(0,j.jsx)(u,{size:`sm`,variant:`outline`,disabled:g,onClick:async()=>{h(``);try{o(await t.build())}catch(e){h(e.message)}},children:g?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(f,{state:`working`,px:14}),`Building…`]}):n.page?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(T,{size:14,"aria-hidden":`true`}),`Rebuild`]}):`Build HTML report`})]}),l&&(0,j.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:l}),a&&(a.running||a.ok===!1)&&(0,j.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[!a.running&&(0,j.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:`forgeqe bi build stopped with a problem; its output is below.`}),(0,j.jsx)(`pre`,{"aria-label":`forgeqe bi build output`,"aria-live":`polite`,className:`m-0 max-h-[200px] overflow-auto rounded-[12px] bg-surface-muted px-4 py-3 font-mono text-[12px] leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:a.lines.length?a.lines.join(`
2
- `):`Starting…`})]}),n.runs?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-px overflow-hidden rounded-[14px] border border-line-soft bg-line-soft @2xl:grid-cols-[1.4fr_1fr_1fr_1fr]`,children:[(0,j.jsxs)(`div`,{className:`col-span-2 flex flex-col gap-1 bg-bg px-5 py-4 @2xl:col-span-1`,children:[(0,j.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Pass rate`}),(0,j.jsx)(`span`,{className:d(`text-[34px] leading-none font-semibold tracking-[-0.02em] tabular-nums`,_!==null&&_<80?`text-fail`:`text-ink`),children:_===null?`–`:`${_}%`}),b!==null&&(0,j.jsxs)(`span`,{className:d(`inline-flex items-center gap-1 text-[12.5px]`,b>0?`text-pass`:b<0?`text-fail`:`text-muted`),children:[b>0?(0,j.jsx)(w,{size:14,"aria-hidden":`true`}):b<0?(0,j.jsx)(C,{size:14,"aria-hidden":`true`}):null,b===0?`Same as the week before`:`${b>0?`Up`:`Down`} ${Math.abs(b)} ${Math.abs(b)===1?`point`:`points`} on the week before`]})]}),x.map(e=>(0,j.jsxs)(`div`,{className:`flex flex-col gap-1 bg-bg px-5 py-4 last:col-span-2 @2xl:last:col-span-1`,children:[(0,j.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.label}),(0,j.jsx)(`span`,{className:`text-[22px] leading-tight font-semibold tabular-nums`,children:e.value}),e.sub&&(0,j.jsx)(`span`,{className:`text-[12.5px] text-muted tabular-nums`,children:e.sub})]},e.label))]}),(0,j.jsx)(B,{title:`Cases by day`,note:`The last ${p(Math.min(30,n.days.length),`day`)} with runs. Hover a day for its pass rate.`,children:(0,j.jsx)(H,{days:n.days})}),(0,j.jsxs)(`div`,{className:`grid gap-4 @3xl:grid-cols-2`,children:[(0,j.jsx)(B,{title:`Fails most`,note:`Cases that failed in the most runs.`,children:n.failing.length===0?(0,j.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:`No case has failed.`}):(0,j.jsx)(`ul`,{className:`m-0 list-none p-0`,children:n.failing.slice(0,8).map(e=>(0,j.jsxs)(`li`,{className:`flex flex-col gap-1 border-t border-line-soft py-2 first:border-t-0 first:pt-0`,children:[(0,j.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,j.jsx)(m,{size:14,"aria-hidden":`true`,className:`flex-none text-fail`}),(0,j.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-[14px]`,title:e.title,children:[e.id&&(0,j.jsx)(`span`,{className:`font-mono text-[12.5px] text-ink-2`,children:e.id}),` `,e.title]}),(0,j.jsx)(`span`,{className:`flex-none text-[12px] text-muted`,children:k(e.lastFailed)})]}),(0,j.jsxs)(`span`,{className:`flex min-w-0 items-center gap-3 pl-[22px]`,children:[(0,j.jsx)(V,{part:e.failed,whole:e.runs,tone:`fail`,label:`failed ${e.failed} of ${e.runs}`}),e.summary&&(0,j.jsx)(`span`,{className:`min-w-0 truncate text-[12.5px] text-muted`,children:e.summary.replace(/[*_`#>[\]]/g,``)})]})]},e.id||e.title))})}),(0,j.jsx)(B,{title:`Defects`,note:`Failures grouped by their cause.`,children:n.defects.length===0?(0,j.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:`None found.`}):(0,j.jsx)(`ul`,{className:`m-0 list-none p-0`,children:n.defects.slice(0,8).map(e=>(0,j.jsxs)(`li`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 border-t border-line-soft py-2 first:border-t-0 first:pt-0`,children:[(0,j.jsx)(`span`,{className:`min-w-0 truncate text-[14px]`,title:e.title,children:e.title}),(0,j.jsxs)(`span`,{className:`text-[12.5px] whitespace-nowrap text-muted tabular-nums`,children:[p(e.cases,`case`),` · `,p(e.runs,`run`),e.lastSeen?` · ${k(e.lastSeen)}`:``]})]},e.title))})}),(0,j.jsx)(B,{title:`Flaky`,note:`Cases that both passed and failed.`,children:n.flaky.length===0?(0,j.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:`None.`}):(0,j.jsx)(`ul`,{className:`m-0 list-none p-0`,children:n.flaky.slice(0,8).map(e=>(0,j.jsxs)(`li`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 border-t border-line-soft py-2 first:border-t-0 first:pt-0`,children:[(0,j.jsxs)(`span`,{className:`min-w-0 truncate text-[14px]`,title:e.title,children:[e.id&&(0,j.jsx)(`span`,{className:`font-mono text-[12.5px] text-ink-2`,children:e.id}),` `,e.title]}),(0,j.jsx)(V,{part:e.failed,whole:e.runs,tone:`fail`,label:`${e.failed}/${e.runs} failed`})]},e.id||e.title))})}),(0,j.jsx)(B,{title:`By kind`,note:`Each kind of run and how often its cases passed.`,children:n.kinds.length===0?(0,j.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:`No runs with results yet.`}):(0,j.jsx)(`ul`,{className:`m-0 list-none p-0`,children:n.kinds.map(e=>(0,j.jsxs)(`li`,{className:`grid grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-x-4 border-t border-line-soft py-2 first:border-t-0 first:pt-0`,children:[(0,j.jsx)(`span`,{className:`min-w-0 truncate text-[14px]`,children:M[e.scope]||e.scope}),(0,j.jsx)(`span`,{className:`text-[12.5px] text-muted tabular-nums`,children:p(e.runs,`run`)}),(0,j.jsx)(V,{part:e.passed,whole:e.cases,tone:`pass`,label:e.cases?`${Math.round(e.passed/e.cases*100)}% passed`:`no cases`})]},e.scope))})})]})]}):(0,j.jsxs)(`div`,{className:`flex flex-col items-start gap-2 rounded-[14px] border border-dashed border-line px-5 py-6`,children:[(0,j.jsx)(`span`,{className:`font-medium`,children:`No runs yet`}),(0,j.jsx)(`span`,{className:`max-w-[60ch] text-sm text-muted`,children:`Runs, suites and monitor rounds are taken together here once there are some: pass rate by day, the cases that fail most, flaky cases and defects.`})]})]})}function W({sub:e}){let[n,r]=(0,A.useState)(null),[a,c]=(0,A.useState)(``),[f,p]=(0,A.useState)(``),[m,v]=(0,A.useState)(``),[b,C]=(0,A.useState)(`all`),[w,T]=(0,A.useState)(I),[E,R]=(0,A.useState)(``),z=(0,A.useCallback)(()=>{t.list().then(r,e=>c(e.message))},[]);(0,A.useEffect)(z,[z]);let B=e===`project`?`project`:`execution`,V=n?.rows??null,H=m.toLowerCase().split(/\s+/).filter(Boolean),W=(0,A.useMemo)(()=>(V||[]).filter(e=>(!f||e.scope===f)&&H.every(t=>`${e.title} ${e.id} ${M[e.scope]}`.toLowerCase().includes(t))),[V,f,m]),G=W.filter(e=>F(e).tone===`fail`).length,K=b===`failed`?W.filter(e=>F(e).tone===`fail`):W;(0,A.useEffect)(()=>T(I),[f,m,b]);let q=[...new Set((V||[]).map(e=>e.scope))];return(0,j.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,j.jsx)(_,{}),(0,j.jsxs)(`main`,{className:d(y,`@container flex-auto gap-4`),children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-6 gap-y-2`,children:[(0,j.jsx)(h,{icon:o,size:`lg`}),(0,j.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Reports`}),(0,j.jsx)(`nav`,{"aria-label":`Reports`,className:`flex gap-1 rounded-[10px] bg-surface-strong p-1`,children:[[`execution`,`Execution reports`,g(`reports`)],[`project`,`Project report`,g(`reports`,`project`)]].map(([e,t,n])=>(0,j.jsx)(`a`,{href:n,"aria-current":B===e?`page`:void 0,className:d(`inline-flex min-h-9 items-center rounded-[7px] px-4 text-sm font-medium no-underline`,B===e?`bg-bg text-ink shadow-composer hover:text-ink`:`text-ink-2 hover:text-ink`),children:t},e))})]}),a&&(0,j.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:a}),!n&&!a&&(0,j.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),n&&B===`project`&&(0,j.jsx)(U,{project:n.project,build:n.build,onBuilt:z}),n&&B===`execution`&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Every report ForgeQE generated, newest first. Open one to see it in full in a new tab.`}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,j.jsxs)(`div`,{className:`relative min-w-0 flex-[1_1_240px]`,children:[(0,j.jsx)(D,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted`}),(0,j.jsx)(`label`,{htmlFor:`report-search`,className:`sr-only`,children:`Find a report`}),(0,j.jsx)(i,{id:`report-search`,type:`search`,value:m,onChange:e=>v(e.target.value),placeholder:`Find a report`,className:`h-9 pl-9`})]}),[[`all`,`All`,W.length],[`failed`,`Failed`,G]].map(([e,t,n])=>(0,j.jsxs)(`button`,{type:`button`,"aria-pressed":b===e,onClick:()=>C(e),className:d(`inline-flex min-h-8 cursor-pointer items-center gap-1 rounded-[8px] border px-3 text-[13px] font-medium`,b===e?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:bg-line hover:text-ink`),children:[t,(0,j.jsx)(`span`,{className:d(`tabular-nums`,e===`failed`&&n?`text-fail`:``),children:n})]},e)),q.length>1&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`label`,{htmlFor:`report-kind`,className:`sr-only`,children:`Kind`}),(0,j.jsxs)(l,{id:`report-kind`,value:f,onChange:e=>p(e.target.value),className:`h-8 w-auto py-0 pr-7 pl-3 text-[13px]`,children:[(0,j.jsx)(`option`,{value:``,children:`Every kind`}),q.map(e=>(0,j.jsx)(`option`,{value:e,children:M[e]},e))]})]})]}),E&&(0,j.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:E}),(0,j.jsxs)(`div`,{className:`rounded-[14px] border border-line-soft bg-bg`,children:[(0,j.jsxs)(`div`,{"aria-hidden":`true`,className:`hidden grid-cols-[minmax(0,1fr)_110px_150px_100px_128px] items-center gap-x-4 border-b border-line-soft px-4 py-2 text-[12px] font-semibold text-muted @3xl:grid`,children:[(0,j.jsx)(`span`,{children:`Report`}),(0,j.jsx)(`span`,{children:`Kind`}),(0,j.jsx)(`span`,{children:`Result`}),(0,j.jsx)(`span`,{className:`text-right`,children:`When`}),(0,j.jsx)(`span`,{})]}),(0,j.jsxs)(`ul`,{"aria-label":`Execution reports`,className:`m-0 list-none p-1.5`,children:[K.length===0&&(0,j.jsx)(`li`,{className:`px-3 py-4 text-sm text-muted`,children:n.rows.length?`Nothing matches.`:`No reports yet. Runs, suites and monitor rounds show here once they have run.`}),K.slice(0,w).map((e,t,n)=>{let r=O(e.startedAt),i=F(e);return(0,j.jsxs)(`li`,{className:`contents`,children:[(t===0||O(n[t-1].startedAt)!==r)&&(0,j.jsx)(`span`,{className:`block px-3 pt-3 pb-1 text-[12px] font-semibold text-muted`,children:r}),(0,j.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 @3xl:grid-cols-[auto_minmax(0,1fr)_110px_150px_100px_128px] @3xl:gap-x-4`,children:[(0,j.jsx)(L,{r:e}),(0,j.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,j.jsx)(`span`,{className:`truncate text-[14px] font-medium`,title:e.title,children:e.title}),(0,j.jsx)(`span`,{className:`truncate text-[12px] text-muted @3xl:hidden`,children:[M[e.scope],e.scope===`page`||!e.counts.total?``:`${e.counts.passed}/${e.counts.total} passed`,k(e.startedAt)].filter(Boolean).join(` · `)})]}),(0,j.jsx)(`span`,{className:`hidden truncate text-[13px] text-muted @3xl:block`,children:M[e.scope]}),(0,j.jsxs)(`span`,{className:`hidden truncate text-[13px] text-muted tabular-nums @3xl:block`,children:[(0,j.jsx)(`span`,{className:d(i.tone===`fail`&&`text-fail`),children:e.scope===`page`?`Report`:e.counts.total?`${e.counts.passed}/${e.counts.total} passed`:i.label}),P(e.ms)?` · ${P(e.ms)}`:``]}),(0,j.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,title:N(e.startedAt),children:k(e.startedAt)}),(0,j.jsx)(`span`,{className:`flex min-w-0 justify-end`,children:e.report?(0,j.jsxs)(u,{size:`sm`,"aria-label":`Open the report of ${e.title} in a new tab`,onClick:async()=>R(await s(e.report)),children:[(0,j.jsx)(S,{size:14,"aria-hidden":`true`}),(0,j.jsx)(`span`,{className:`hidden @md:inline`,children:`Open report`})]}):(0,j.jsx)(x,{path:e.folder,children:`Folder`})})]})]},e.key)})]}),(K.length>w||n.total>n.rows.length)&&(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-t border-line-soft px-4 py-2.5 text-[13px] text-muted`,children:[(0,j.jsxs)(`span`,{children:[`Showing `,Math.min(w,K.length),` of `,K.length,n.total>n.rows.length?` (the newest ${n.rows.length} of ${n.total})`:``]}),K.length>w&&(0,j.jsxs)(u,{size:`sm`,onClick:()=>T(w+I),children:[`Show `,Math.min(I,K.length-w),` more`]})]})]})]})]})]})}export{W as Reports};
@@ -1,8 +0,0 @@
1
- import{Gn as e,Hn as t,Kt as n,Mt as r,St as i,Ut as a,_n as o,an as s,at as c,ct as l,it as u,lt as d,on as f,rt as p,st as m,ut as h}from"./frame-CHQgOaj6.js";import{a as g,n as _,r as v,t as y}from"./markdown-BPBR6Fva.js";import{A as ee,M as te,a as b,i as x,o as S,s as ne}from"./index-Hd8gmpz5.js";var C={name:`message-circle-question-mark`,size:24,node:[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`message-circle-question`]};C.node;var re=o(C),w={name:`square-terminal`,size:24,node:[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]],aliases:[`terminal-square`]};w.node;var ie=o(w),T=e(t(),1),E=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{},D=e=>typeof e==`string`?e:e==null?``:String(e),ae=(e,t=400)=>e.length>t?`${e.slice(0,t-1)}…`:e,O=e=>typeof e==`number`?` in ${Math.round(e/1e3)}s`:``;function k(e,t=400){return ae(e.replace(/\s+/g,` `).trim(),t).replace(/([\\`*_[\]<>#|~!])/g,`\\$1`)}function A(e){let t=e.replace(/\s+/g,` `).trim();if(!t)return``;let n=t.includes("`")?"``":"`";return`${n}${n==="``"?` `:``}${t}${n==="``"?` `:``}${n}`}function j(e,t){return/^https?:\/\/[^\s)]+$/i.test(t)?`[${k(e||t,120)}](${t})`:k(e)}var M=e=>[A(D(E(e).id)),k(D(E(e).title),200)].filter(Boolean).join(` `);function N(e){return e.replace(/<!--[\s\S]*?(?:-->|$)/g,``).trim()}function oe(e){return e.replace(/\[((?:\\.|[^\]\\])*)\]\(https?:\/\/[^\s)]+\)/g,`$1`).replace(/\\(.)/g,`$1`).replace(/[*`]/g,``)}var P=(e,t)=>({tone:e,kind:`item`,md:t}),F=(e,t)=>({tone:e,kind:`sub`,md:t});function I(e,t=``){let n=t||(e.agent&&e.agent!==`forgeqe`?`**${k(D(e.agent))}:** `:``);switch(e.kind){case`info`:return P(`info`,`${n}${k(D(e.text))}`);case`start`:return P(`dim`,`${n}→ ${A(D(e.tool))}${e.text&&e.text!==e.tool?` ${k(D(e.text),200)}`:``}`);case`tool`:{let t=E(e.file);return P(e.ok===!1?`warn`:`dim`,`${n}${e.ok===!1?`⚠`:`✓`} ${k(D(e.text)||D(e.tool),240)}${t.path?` (${k(D(t.action))} ${A(D(t.path))})`:``}`)}case`say`:{let t=N(D(e.text));return t?P(`say`,`${n}*${k(t)}*`):null}case`test`:return Number(e.attempt)>0?P(e.ok?`ok`:`fail`,`${n}${e.ok?`✓`:`✗`} **Test, attempt ${k(D(e.attempt))}:** ${k(D(e.text),240)}`):P(e.ok?`ok`:`fail`,`${n}${e.ok?`✓`:`✗`} ${k(D(e.text),240)}`);case`plan`:{let t=Array.isArray(e.items)?e.items.map(E):[],r=t.find(e=>e.status===`in_progress`);return P(`info`,`${n}**Plan:** ${t.filter(e=>e.status===`completed`).length} of ${t.length} done${r?`; now: ${k(D(r.text))}`:``}`)}case`review`:return P(e.approved?`ok`:`warn`,`${n}**Review, attempt ${k(D(e.attempt))}:** ${e.approved?`approved`:`changes asked`}. ${k(D(e.summary),240)}`);case`attempt`:return P(`warn`,`${n}**Attempt ${k(D(e.attempt))} of ${k(D(e.max))}:** ${k(D(e.why),240)}`);case`answer`:return P(`dim`,`${n}Attempt ${k(D(e.attempt))}: ${k(D(e.notes)||`changed ${(Array.isArray(e.changed)?e.changed:[]).map(D).join(`, `)}`,240)}`);case`context`:return e.compacted?P(`info`,`${n}Context compacted: the conversation was summarised to make room.`):null;default:return null}}function se(e,t=``){switch(e.type){case`log`:return P(e.level===`error`?`fail`:e.level===`warn`?`warn`:`dim`,`${t}${e.level===`warn`||e.level===`error`?`⚠ `:``}${k(D(e.text))}`);case`step`:return P(`dim`,`${t}**Step ${k(D(e.step))}** · ${e.source===`memory`?`from memory`:k(D(e.category))} · ${j(D(e.title)||`untitled`,D(e.url))}`);case`memory`:return P(`info`,`${t}↻ ${k(D(e.text))}`);case`thought`:return F(`think`,`*${k(D(e.text))}*`);case`outcome`:return F(e.ok?`ok`:`fail`,`${e.ok?`✓`:`✗`} ${k(D(e.text),300)}`);case`done`:{let n=E(e.result);return P(n.status===`complete`?`ok`:`fail`,`${t}**${k(D(n.status))}:** ${k(D(n.summary))}`)}case`code`:return I(e,t);default:return null}}function ce(e){switch(e.type){case`run-start`:return{tone:`info`,kind:`head`,md:`Browser run: ${k(D(e.goal),200)}${e.url?` · ${j(D(e.url).replace(/^https?:\/\//,``),D(e.url))}`:``}`};case`run-event`:return se(E(e.event));case`run-done`:{let t=E(e.result),n=!e.error&&(t.outcome===`passed`||!t.outcome&&t.status===`complete`);return P(n?`ok`:`fail`,`${n?`✓`:`✗`} **Run ${n?`passed`:`failed`}**${O(e.ms)}: ${k(D(e.error)||D(t.summary))}${e.runDir?` · ${A(D(e.runDir))}`:``}`)}case`suite-start`:return{tone:`info`,kind:`head`,md:`Suite: ${(Array.isArray(e.cases)?e.cases:[]).length} cases, ${k(D(e.parallel))} at once`};case`suite-event`:{let t=E(e.event);if(t.type===`case-start`)return P(`info`,`**Case ${Number(t.index)+1} of ${k(D(t.total))}:** ${M(t.case)}`);if(t.type===`case-event`)return se(E(t.event),`${A(D(E(t.case).id))} `);if(t.type===`case-done`){let e=E(t.result);return P(e.status===`passed`?`ok`:`fail`,`${e.status===`passed`?`✓`:`✗`} ${M(e.case)}: **${k(D(e.status))}**${O(e.ms)}${e.summary?`. ${k(D(e.summary),240)}`:``}`)}return t.type===`code-start`?P(`info`,`${A(D(E(t.case).id))} writing its test`):t.type===`writeback`?P(`dim`,`Posted the result back: ${k(JSON.stringify(t.item),240)}`):null}case`suite-done`:{let t=(Array.isArray(E(e.suite).results)?E(e.suite).results:[]).map(E),n=t.filter(e=>e.status===`passed`).length;return P(n===t.length?`ok`:`fail`,`**Suite: ${n} of ${t.length} passed**${O(E(e.suite).ms)}`)}case`info`:return P(e.ok===!1?`fail`:e.ok===!0?`ok`:`info`,k(D(e.text)));case`agent`:return I(E(E(e.event)),`**Coding agent:** `);case`code-start`:return{tone:`info`,kind:`head`,md:`Writing a test: ${k(D(e.goal),200)}`};case`code-done`:return P(e.error?`fail`:`ok`,`${e.error?`✗`:`✓`} **Test ${e.error?`not written`:`written`}**${O(e.ms)}${e.error?`: ${k(D(e.error),240)}`:``}`);case`card`:{let t=E(e.card),n=(Array.isArray(t.body)?t.body:[]).map(D).filter(Boolean);return P(t.status===`ok`?`ok`:t.status===`fail`?`fail`:`info`,`**${k(D(t.title))}**${t.stats?` · ${k(D(t.stats))}`:``}${n.length?`: ${k(n.join(`; `),300)}`:``}`)}case`report`:return P(`ok`,`✓ Report saved: ${k(D(e.title))}`);case`call-start`:return P(`dim`,`→ ${k(D(e.text),240)}`);case`call`:return P(e.ok===!1?`warn`:`dim`,`${e.ok===!1?`⚠`:`✓`} ${k(D(e.text),240)}`);default:return null}}function le(e){let t=D(e.at)||D(e.t),n=null;switch(e.type){case`user`:n=P(`you`,`**You:** ${k(D(e.text),240)}`);break;case`agent`:n=I(E(e.event));break;case`tool`:n=ce(E(e.event));break;case`ask`:n=P(`you`,`**Asked:** ${k(D(E(e.question).title))}`);break;case`wait`:n=P(`you`,`**Waiting for you:** ${k(D(e.prompt))}`);break;case`answered`:n=P(`you`,`**You:** ${e.label===void 0?e.ok?`done, continue`:`cancel`:k(D(e.label))}`);break;case`turn_done`:n=P(e.outcome===`done`?`ok`:e.outcome===`stopped`?`warn`:`fail`,`**${e.outcome===`done`?`Done`:e.outcome===`stopped`?`Stopped`:e.outcome===`needs_input`?`Needs your input`:`Failed`}**${e.error?`: ${k(D(e.error),300)}`:``}`);break;case`settings`:n=P(`you`,`**Settings:** browser ${e.headed?`shown`:`headless`}, ${e.writeTests?`passed runs become tests`:`no tests written`}`);break;case`stderr`:n={tone:`dim`,kind:`out`,md:D(e.text)};break;case`error`:n=P(`warn`,`⚠ ${k(D(e.message))}`);break;case`fatal`:n=P(`fail`,`✗ **ForgeQE cannot go on:** ${k(D(e.message))}`);break;case`exit`:n=P(e.code===0?`dim`:`fail`,`ForgeQE stopped${e.code!==null&&e.code!==void 0?` (exit ${k(D(e.code))})`:``}${e.message?`: ${k(D(e.message))}`:``}`)}return n?{at:t,...n,plain:n.kind===`out`?n.md:oe(n.md)}:null}function ue(e,t){let n=e?Math.max(0,Math.round((Date.parse(t)-Date.parse(e))/1e3)):0;return Number.isFinite(n)?`+${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`:``}function de(e,t,n){let r=n?[`## ${k(n,200)}`,``]:[],i=[],a=()=>{if(!i.length)return;let e=Math.max(2,...i.map(e=>Math.max(0,...(e.match(/`+/g)||[]).map(e=>e.length)))),t="`".repeat(e+1);r.push(``,`${t}text`,...i,t,``),i=[]};for(let n of e){let e=`\`${ue(t,n.at)}\``;n.kind===`out`?i.push(`${ue(t,n.at)} ${n.md}`):(a(),n.kind===`head`?r.push(``,`#### ${n.md} ${e}`,``):n.kind===`sub`?r.push(` - ${n.md}`):r.push(`- ${e} ${n.md}`))}return a(),r.join(`
2
- `).replace(/\n{3,}/g,`
3
-
4
- `).trim()+`
5
- `}var L=m();function R({diff:e,className:t}){let n=0,r=0,i=e.split(`
6
- `).flatMap((e,t)=>{if(/^(diff |index |--- |\+\+\+ )/.test(e))return[];let i=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(e);return i?(n=Number(i[1]),r=Number(i[2]),[{key:t,kind:`hunk`,text:e,a:``,b:``}]):e.startsWith(`+`)?[{key:t,kind:`add`,text:e.slice(1),a:``,b:String(r++)}]:e.startsWith(`-`)?[{key:t,kind:`del`,text:e.slice(1),a:String(n++),b:``}]:e.startsWith(`\\`)?[{key:t,kind:`hunk`,text:e,a:``,b:``}]:[{key:t,kind:`same`,text:e.startsWith(` `)?e.slice(1):e,a:String(n++),b:String(r++)}]});return(0,L.jsx)(`div`,{className:l(`max-h-[420px] overflow-auto rounded-[10px] border border-line-soft bg-bg font-mono text-[12px] leading-[1.6]`,t),children:(0,L.jsx)(`table`,{className:`w-full border-collapse`,children:(0,L.jsx)(`tbody`,{children:i.map(e=>(0,L.jsxs)(`tr`,{className:e.kind===`add`?`bg-pass-soft`:e.kind===`del`?`bg-fail-soft`:e.kind===`hunk`?`bg-surface-muted`:void 0,children:[(0,L.jsx)(`td`,{className:`w-10 px-2 text-right align-top text-muted tabular-nums select-none`,children:e.a}),(0,L.jsx)(`td`,{className:`w-10 px-2 text-right align-top text-muted tabular-nums select-none`,children:e.b}),(0,L.jsx)(`td`,{"aria-hidden":`true`,className:l(`w-4 align-top select-none`,e.kind===`add`?`text-pass`:e.kind===`del`?`text-fail`:`text-muted`),children:e.kind===`add`?`+`:e.kind===`del`?`−`:``}),(0,L.jsxs)(`td`,{className:l(`pr-3 align-top whitespace-pre`,e.kind===`hunk`?`text-muted`:`text-ink`),children:[(0,L.jsx)(`span`,{className:`sr-only`,children:e.kind===`add`?`added: `:e.kind===`del`?`removed: `:``}),e.text||` `]})]},e.key))})})})}var z=e=>{let t=B(e);return typeof t.input==`number`&&typeof t.output==`number`?{input:t.input,output:t.output,cached:typeof t.cached==`number`?t.cached:void 0}:void 0},B=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{},V=e=>typeof e==`string`?e:e==null?``:String(e),fe=[[/find_test_cases|story_test_cases|check_test_cases|list_sprints/,`Finding test cases`,`searching`],[/environment|logins/,`Preparing the environment`,`handing`],[/run_test_cases|browser_run|suite|run_goal|run_direct/,`Running in the browser`,`browsing`],[/comment_on_pr/,`Commenting on the pull request`,`working`],[/write_back|post_result|post_results|file_bugs|create_bugs/,`Posting the result`,`working`],[/write_test|heal/,`Writing the test`,`writing`],[/run_tests|bash|shell/,`Running the tests`,`working`],[/read_confluence|read|grep|glob|list|webfetch/,`Reading`,`reading`],[/edit|write|patch/,`Changing the code`,`writing`],[/task/,`Handing work to another agent`,`handing`]],pe=/run_test_cases|browser_run|run_suite|write_test/,me=[[/find_test_cases|story_test_cases|check_test_cases/,`forgeqe-find`],[/run_test_cases|browser_run|run_goal|run_direct|suite|explore_run/,`engine`],[/write_test/,`forgeqe-test`],[/heal/,`forgeqe-heal`],[/review_pr|pr_review/,`forgeqe-pr-review`],[/api_plan/,`forgeqe-api-plan`],[/write_api|api_test/,`forgeqe-api`],[/explore_plan|plan_charters/,`forgeqe-explore-plan`],[/defect_rca|root_cause/,`forgeqe-defect-rca`],[/insights|forgeqe_bi|defect_intelligence/,`forgeqe-bi`],[/refine/,`forgeqe-refine`]];function H(e){let t=e.toLowerCase();if(!U(t))return me.find(([e])=>e.test(t))?.[1]}var he=[[/^(azure_devops|ado|azuredevops)_/,`Azure DevOps`],[/^(jira|atlassian)_/,`Jira`],[/^confluence_/,`Confluence`],[/^github_/,`GitHub`],[/^xray_/,`Xray`],[/^testrail_/,`TestRail`],[/^zephyr_/,`Zephyr Scale`],[/^qtest_/,`qTest`]],ge=/(^|_)(create|update|add|delete|remove|post|comment|link|unlink|upload|set|assign|transition|edit|merge|close|reopen|queue|trigger|run|push|move|copy|import|write|publish|approve|vote|lock|unlock)(_|$)/;function U(e){let t=e.toLowerCase();if(!t.startsWith(`forgeqe_`))return he.find(([e])=>e.test(t))?.[1]}var _e=e=>{let t=B(e);return typeof t.diff==`string`&&t.diff?{diff:t.diff,added:Number(t.added)||0,removed:Number(t.removed)||0}:void 0},W=e=>Array.isArray(e)?e.map(V).filter(Boolean):[];function ve(e,t,n){let r=V(e.status)||(t?`failed`:``);return{status:r,ok:!t&&/^(passed|pass|written|ok|known_defect)$/i.test(r),...V(e.testFile)?{testFile:V(e.testFile)}:{},...V(e.testName)?{testName:V(e.testName)}:{},...V(e.command)?{command:V(e.command)}:{},...typeof e.attempts==`number`?{attempts:e.attempts}:{},...typeof e.maxAttempts==`number`?{maxAttempts:e.maxAttempts}:{},changed:W(e.changed),reused:W(e.reused),...n?{runDir:n}:{},...t?{error:t}:{},...V(e.notes)?{notes:V(e.notes)}:{}}}function ye(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){let e=B(n),r=(typeof n==`string`?n:V(e.label)||V(e.request)).replace(/\s+/g,` `).trim(),i=(typeof n==`string`?n:V(e.request)||V(e.label)).trim();r&&i&&!t.some(e=>e.label.toLowerCase()===r.toLowerCase())&&t.push({label:r.length>60?`${r.slice(0,59)}…`:r,request:i})}return t.slice(0,4)}function G(e){let t=e.toLowerCase(),n=U(t);if(n)return ge.test(t.replace(/^[a-z]+_/,``))?{label:`Updating ${n}`,orb:`working`}:{label:`Reading ${n}`,orb:`reading`};for(let[e,n,r]of fe)if(e.test(t))return{label:n,orb:r};let r=t.replace(/^forgeqe_/,``).replace(/[_-]+/g,` `).trim();return{label:r?r[0].toUpperCase()+r.slice(1):`Working`,orb:`working`}}function be(e,t){return{id:e,user:t,steps:[],parts:[],next:[],asks:[],waits:[],log:[],plan:[],changes:[],tests:[],reports:[]}}function xe(e){let t=B(e);return[V(t.id),V(t.title)].filter(Boolean).join(`: `)}function Se(e){let t={turns:[],notes:[]},n=new Map,r=e=>(typeof e==`string`?n.get(e):void 0)??t.turns.at(-1),i=(e,t)=>{let n=e=>{for(let r of e){if(r.key===t)return r;let e=r.children&&n(r.children);if(e)return e}};return n(e.steps)},a=(e,t,n)=>{let r={lines:[],...t};if(n)n.push(r);else{let t=e.plan.find(e=>e.status===`active`)??e.plan.find(e=>e.status===`pending`)??e.plan.at(-1);t&&(r.phase=t.text),e.steps.push(r)}return r},o=(e,t,n)=>{let r=t.parent?i(e,`c:${V(t.parent)}`):void 0;if(r)return r.children??=[];let o=V(t.agent);if(!n||!o||o===`forgeqe`)return;let s=[...e.steps].reverse().find(e=>e.status===`running`);return s||=a(e,{key:`ag:${o}:${e.steps.length}`,label:S(o).name,status:`running`,orb:`handing`,agent:o}),s.agent??=o,s.children??=[]},s=(e,n,r)=>{let s=V(n.kind),c=V(n.id);if((s===`start`||s===`tool`)&&pe.test(V(n.tool))&&!U(V(n.tool)))return;let l=o(e,n,r),u=B(n.delegate),d=V(u.agent)?{agent:V(u.agent),task:V(u.task)}:void 0;if(s===`start`){if(d)a(e,{key:`c:${c}`,label:`Hands off to ${S(d.agent).name}`,arg:d.task||void 0,status:`running`,orb:`handing`,agent:d.agent,handoff:d,children:[]},l);else{let{label:t,orb:r}=G(V(n.tool)||V(n.text)),i=l?void 0:H(V(n.tool));a(e,{key:`c:${c}`,label:t,arg:V(n.text)&&V(n.text)!==V(n.tool)?V(n.text):void 0,status:`running`,orb:r,...i?{agent:i}:{}},l)}}else if(s===`tool`){let t=c?i(e,`c:${c}`):void 0,r=B(n.file),o=_e(n.change);if(o&&V(r.path)){let t=e.changes.find(e=>e.path===V(r.path));t?Object.assign(t,{diff:`${t.diff}\n${o.diff}`,added:t.added+o.added,removed:t.removed+o.removed}):e.changes.push({path:V(r.path),...o,...V(n.agent)?{agent:V(n.agent)}:{}})}if(t)t.status=n.ok===!1?`fail`:`ok`,t.handoff&&V(u.result)&&(t.handoff.result=V(u.result));else if(d)a(e,{key:`c:${c||e.steps.length}`,label:`Hands off to ${S(d.agent).name}`,arg:d.task||void 0,status:n.ok===!1?`fail`:`ok`,orb:`handing`,agent:d.agent,handoff:{...d,...V(u.result)?{result:V(u.result)}:{}},children:[]},l);else{let{label:t,orb:i}=G(V(n.tool)||V(n.text)),s=l?void 0:H(V(n.tool));a(e,{key:`c:${c||e.steps.length}`,label:t,arg:V(r.path)||V(n.text)||void 0,status:n.ok===!1?`fail`:`ok`,orb:i,...s?{agent:s}:{},...o?{change:o}:{}},l)}t&&o&&(t.change=o)}else if(s===`stream`||s===`say`){if(r)return;let t=e.parts.find(e=>e.id===c);t?t.text=s===`say`?V(n.text):t.text+V(n.text):e.parts.push({id:c||`p${e.parts.length}`,text:V(n.text)})}else if(s===`plan`){if(l||n.agent&&n.agent!==`forgeqe`)return;let t=Array.isArray(n.items)?n.items.map(B):[],r=e=>e===`completed`?`done`:e===`in_progress`?`active`:e===`cancelled`?`skipped`:`pending`;e.plan=t.map(e=>({text:V(e.text),status:r(e.status)})).filter(e=>e.text)}else if(s===`test`){let t=Number(n.attempt)||0;if(t>0)a(e,{key:`t:${e.steps.length}`,label:`Test, attempt ${t}`,arg:V(n.text),status:n.ok?`ok`:`fail`,orb:`retrying`},l);else if(n.ok&&/\bconnected$/i.test(V(n.text)))return;else a(e,{key:`t:${e.steps.length}`,label:V(n.text)||(n.ok?`Checked`:`Check failed`),status:n.ok?`ok`:`fail`,orb:/connect|mcp/i.test(V(n.text))?`waiting`:`working`},l)}else if(s===`review`)a(e,{key:`r:${e.steps.length}`,label:n.approved?`Review approved`:`Review asked for changes`,status:n.approved?`ok`:`info`,orb:`thinking`,agent:`forgeqe-review`,lines:[{text:V(n.summary)}]});else if((s===`context`||s===`usage`)&&!r)s===`context`&&typeof n.tokens==`number`&&typeof n.limit==`number`&&(t.context={tokens:n.tokens,limit:n.limit,compactsAt:typeof n.compactsAt==`number`?n.compactsAt:void 0}),s===`usage`&&(t.usage=z(n.usage)??t.usage);else if(s===`info`){let t=(l??e.steps).at(-1);t&&t.lines.push({text:V(n.text)})}},c,l=(e,t)=>{let n=V(t.type);if(n===`run-start`)a(e,{key:`run:${e.steps.length}`,label:`Running in the browser`,arg:V(t.goal),status:`running`,orb:`browsing`,agent:`engine`});else if(n===`run-event`){let n=[...e.steps].reverse().find(e=>e.key.startsWith(`run:`)),r=B(t.event);if(!n)return;r.type===`outcome`?n.lines.push({text:`Step ${V(r.step)}: ${V(r.action)||V(r.text)}`,ok:r.ok===!0||r.ok!==!1&&void 0}):r.type===`log`&&(r.level!==`info`||r.progress)&&n.lines.push({text:V(r.text),ok:r.level!==`error`&&void 0})}else if(n===`run-done`){let n=[...e.steps].reverse().find(e=>e.key.startsWith(`run:`)&&e.status===`running`),r=B(t.result),i=!t.error&&(r.outcome===`passed`||!r.outcome&&r.status===`complete`);if(n){n.status=i?`ok`:`fail`;let e=V(t.error)||V(r.summary);e&&n.lines.push({text:e,ok:!!i})}V(t.runDir)&&e.reports.push({label:i?`Browser run report`:`Browser run report (failed)`,path:V(t.runDir)})}else if(n===`suite-start`){let n=Array.isArray(t.cases)?t.cases:[];a(e,{key:`suite:${e.steps.length}`,label:`Running ${n.length} test case${n.length===1?``:`s`}`,status:`running`,orb:`working`,agent:`engine`})}else if(n===`suite-event`){let n=[...e.steps].reverse().find(e=>e.key.startsWith(`suite:`)),r=B(t.event);if(n&&r.type===`case-done`){let e=B(r.result);n.lines.push({text:`${xe(e.case)}: ${V(e.status)}`,ok:e.status===`passed`})}}else if(n===`suite-done`){let n=[...e.steps].reverse().find(e=>e.key.startsWith(`suite:`)),r=Array.isArray(B(t.suite).results)?B(t.suite).results.map(B):[];if(n){let e=r.filter(e=>e.status!==`passed`).length;n.status=e?`fail`:`ok`,n.arg=`${r.length-e} of ${r.length} passed`}}else if(n===`card`){let n=B(t.card);a(e,{key:`card:${e.steps.length}`,label:V(n.title),arg:V(n.stats)||void 0,status:n.status===`ok`?`ok`:n.status===`fail`?`fail`:`info`,orb:`working`,lines:(Array.isArray(n.body)?n.body:[]).map(e=>({text:V(e)}))})}else if(n===`call-start`&&!t.quiet)a(e,{key:`call:${V(t.id)}`,label:V(t.text),status:`running`,orb:`working`});else if(n===`call`&&!t.quiet){let n=t.id?i(e,`call:${V(t.id)}`):void 0;n?n.status=t.ok===!1?`fail`:`ok`:a(e,{key:`call:${e.steps.length}`,label:V(t.text),status:t.ok===!1?`fail`:`ok`,orb:`working`})}else if(n===`code-start`)c=V(t.runDir)||void 0,a(e,{key:`code:${e.steps.length}`,label:`Writing the test`,arg:V(t.goal),status:`running`,orb:`writing`,agent:`forgeqe-test`});else if(n===`code-done`){let n=[...e.steps].reverse().find(e=>e.key.startsWith(`code:`)&&e.status===`running`);n&&(n.status=t.error?`fail`:`ok`,t.error&&n.lines.push({text:V(t.error),ok:!1})),e.tests.push(ve(B(t.result),V(t.error),c)),c=void 0}else if(n===`agent`)s(e,B(t.event),!0);else if(n===`info`){let n=e.steps.at(-1);n?n.lines.push({text:V(t.text),ok:t.ok===!0||t.ok!==!1&&void 0}):a(e,{key:`info:${e.steps.length}`,label:V(t.text),status:t.ok===!1?`fail`:`info`,orb:`working`})}else n===`report`&&(a(e,{key:`report:${e.steps.length}`,label:`Report saved`,arg:V(t.title),status:`ok`,orb:`working`}),V(t.html)&&e.reports.push({label:V(t.title)||`Report`,path:V(t.html)}))};for(let r of e){u(r);let e=le(r);e&&(typeof r.id==`string`&&n.get(r.id)||typeof r.turn==`string`&&n.get(r.turn)||t.turns.at(-1))?.log.push(e)}return t;function u(e){switch(e.type){case`user`:{let r=be(V(e.id),V(e.text));t.turns.push(r),n.set(r.id,r);break}case`ready`:{let n=B(e.profile);n.name&&(t.model={name:V(n.name),provider:V(n.provider)}),t.writeTests=e.writeTests!==!1,t.headed=e.headed===!0;break}case`settings`:typeof e.writeTests==`boolean`&&(t.writeTests=e.writeTests),typeof e.headed==`boolean`&&(t.headed=e.headed);break;case`turn_start`:{let t=r(e.id);t&&(t.started=V(e.t)||V(e.at));break}case`agent`:{let t=r(e.id);t&&s(t,B(e.event),!1);break}case`tool`:{let t=r(e.id);t&&l(t,B(e.event));break}case`ask`:{let t=r(e.turn),n=B(e.question);t?.asks.push({id:V(e.id),title:V(n.title),detail:V(n.detail)||void 0,lines:Array.isArray(n.lines)?n.lines.map(V):[],options:(Array.isArray(n.options)?n.options:[]).map(e=>({id:V(B(e).id),label:V(B(e).label)}))});break}case`wait`:r(e.turn)?.waits.push({id:V(e.id),prompt:V(e.prompt)});break;case`answered`:for(let n of t.turns){let t=n.asks.find(t=>t.id===e.ask);t&&(t.answer=V(e.label));let r=n.waits.find(t=>t.id===e.ask);r&&(r.answer=e.ok===!0)}break;case`turn_done`:{let n=r(e.id);if(!n)break;n.outcome=e.outcome,n.reply=V(e.reply),n.next=ye(e.next),n.error=V(e.error)||void 0,n.ended=V(e.t)||V(e.at),t.usage=z(e.usage)??t.usage;let i=e=>{for(let t of e)t.status===`running`&&(t.status=n.outcome===`done`?`ok`:`info`),t.children&&i(t.children)};if(i(n.steps),n.outcome===`done`)for(let e of n.plan)e.status===`active`&&(e.status=`done`);break}case`error`:e.code!==`busy`&&t.notes.push(V(e.message));break;case`fatal`:t.fatal=V(e.message);break;case`exit`:t.ended={code:typeof e.code==`number`?e.code:null,stderr:Array.isArray(e.stderr)?e.stderr.map(V):void 0,message:V(e.message)||void 0}}}}function Ce(e){let t=e.asks.find(e=>e.answer===void 0),n=e.waits.find(e=>e.answer===void 0);if(t||n)return{text:`Waiting for you…`,orb:`waiting`};let r=[...e.steps].reverse().find(e=>e.status===`running`);return r?{text:`${r.label}…`,orb:r.orb}:e.parts.some(e=>e.text.trim())&&e.steps.length?{text:`Writing a reply…`,orb:`writing`}:{text:`Thinking…`,orb:`thinking`}}function we(e){if(!e.started||!e.ended)return`Done`;let t=Math.max(1,Math.round((Date.parse(e.ended)-Date.parse(e.started))/1e3)),n=e.outcome===`stopped`?`Stopped after`:`Worked for`;return t<60?`${n} ${t} second${t===1?``:`s`}`:`${n} ${Math.floor(t/60)} min ${t%60} s`}var Te={running:`active`,ok:`done`,fail:`failed`,info:`note`};function Ee(e,t){let n=e=>e===`active`&&!t?`done`:e;if(!e.plan.length)return e.steps.map(e=>({key:e.key,label:e.label,status:n(Te[e.status]),steps:[],step:e}));let r=new Set(e.plan.map(e=>e.text)),i=new Map,a=``;for(let t of e.steps)t.phase&&r.has(t.phase)&&(a=t.phase),i.set(a,[...i.get(a)||[],t]);let o=e=>e.some(e=>e.status===`running`),s=[],c=i.get(``)||[];c.length&&s.push({key:`plan:start`,label:`Getting started`,status:n(o(c)?`active`:`done`),steps:c});let l=e.plan.map((e,n)=>{let r=i.get(e.text)||[],a=e.status===`done`?`done`:e.status===`skipped`?`skipped`:e.status===`active`||o(r)?`active`:`pending`;return{key:`plan:${n}`,label:e.text,status:a===`active`&&!t?`pending`:a,steps:r}});return[...s,...De(l)]}function De(e){let t=e.findIndex(e=>e.status===`active`);return t<0?e:e.map((e,n)=>e.status===`skipped`||e.status===`failed`||n===t?e:{...e,status:n<t?`done`:`pending`})}var Oe={done:`bg-pass/30`,active:`bg-accent/25`,pending:`bg-line`,failed:`bg-fail/30`,skipped:`bg-line`,note:`bg-line`};function K({status:e,orb:t,px:n=20,spin:i=!1}){let a={width:n,height:n};return e===`active`&&i?(0,L.jsx)(`span`,{role:`img`,"aria-label":`At work`,className:`flex flex-none items-center justify-center`,style:a,children:(0,L.jsx)(r,{size:n-2,strokeWidth:2.5,"aria-hidden":`true`,className:`animate-spin text-accent-fg motion-reduce:animate-none`})}):e===`active`?(0,L.jsx)(u,{state:t,px:n,label:`At work`}):e===`done`?(0,L.jsx)(`span`,{role:`img`,"aria-label":`Done`,className:`flex flex-none items-center justify-center rounded-full bg-pass`,style:a,children:(0,L.jsx)(f,{size:n*.6,strokeWidth:3,"aria-hidden":`true`,className:`text-white`})}):e===`failed`?(0,L.jsx)(`span`,{role:`img`,"aria-label":`Failed`,className:`flex flex-none items-center justify-center rounded-full bg-fail`,style:a,children:(0,L.jsx)(h,{size:n*.6,strokeWidth:3,"aria-hidden":`true`,className:`text-white`})}):e===`note`?(0,L.jsx)(`span`,{role:`img`,"aria-label":`Note`,className:`flex flex-none items-center justify-center`,style:a,children:(0,L.jsx)(`span`,{className:`size-1.5 rounded-full bg-line-strong`})}):(0,L.jsx)(`span`,{role:`img`,"aria-label":e===`skipped`?`Skipped`:`To come`,className:l(`box-border block flex-none rounded-full border-2 border-line-strong`,e===`skipped`&&`border-dashed`),style:a})}var ke=(e,t)=>e.status===`running`?t?`active`:`done`:e.status===`ok`?`done`:e.status===`fail`?`failed`:`note`,Ae=e=>/[/\\]|\.\w{1,5}$|^\$ /.test(e)&&!/\s{2,}/.test(e);function q({text:e}){return(0,L.jsx)(`span`,{className:l(`min-w-0 max-w-full truncate rounded-md bg-surface-strong px-1.5 py-0.5 text-[12.5px] text-ink-2`,Ae(e)&&`font-mono text-[12px]`),children:e})}function je({step:e}){return(0,L.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] leading-relaxed`,children:e.lines.map((e,t)=>(0,L.jsxs)(`li`,{className:l(`flex gap-1.5 [overflow-wrap:anywhere]`,e.ok===!0?`text-pass`:e.ok===!1?`text-fail`:`text-ink-2`),children:[e.ok!==void 0&&(0,L.jsx)(`span`,{"aria-hidden":`true`,children:e.ok?`✓`:`✗`}),(0,L.jsx)(_,{text:e.text,className:`min-w-0 text-[13px] leading-relaxed text-inherit [&_p]:my-0`})]},t))})}function J({agent:e,named:t=!0,working:n=!1}){let r=S(e);return(0,L.jsxs)(`span`,{className:`inline-flex flex-none items-center gap-1.5`,title:r.name,children:[(0,L.jsx)(x,{agent:e,px:18,decorative:t,working:n}),t&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`font-medium`,style:{color:r.hue},children:r.name}),(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted`,children:`·`})]})]})}function Y({step:e,from:t,live:n}){let r=e.handoff.agent,i=S(r);return(0,L.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5`,children:[(0,L.jsx)(x,{agent:t,px:18}),(0,L.jsxs)(`span`,{role:`img`,"aria-label":`hands off to`,className:l(`handoff-flow flex-none`,n&&`is-live`),style:{color:i.hue},children:[(0,L.jsx)(`span`,{}),(0,L.jsx)(`span`,{}),(0,L.jsx)(`span`,{})]}),(0,L.jsx)(x,{agent:r,px:20,decorative:!0,working:n,className:`handoff-in`}),(0,L.jsx)(`span`,{className:`font-medium`,style:{color:i.hue},children:i.name}),e.arg&&(0,L.jsx)(q,{text:e.arg})]})}function X({step:e,working:t,from:n=b}){let r=e.agent||n,i=Z(e),a=ke(e,t),[o,c]=(0,T.useState)(null),u=o??((!!e.handoff||!!e.agent)&&a===`active`),d=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(K,{status:a,orb:e.orb,px:16,spin:!0}),e.handoff?(0,L.jsx)(Y,{step:e,from:n,live:a===`active`}):(0,L.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5`,children:[(0,L.jsx)(J,{agent:r,named:r!==n,working:a===`active`}),(0,L.jsx)(`span`,{className:l(`[overflow-wrap:anywhere]`,a===`active`?`text-ink`:`text-ink-2`),children:e.label}),e.arg&&(0,L.jsx)(q,{text:e.arg}),e.change&&(0,L.jsxs)(`span`,{className:`font-mono text-[12px] tabular-nums`,children:[(0,L.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.change.added]}),` `,(0,L.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.change.removed]})]})]}),i&&(0,L.jsx)(s,{size:14,"aria-hidden":`true`,className:l(`mt-0.5 ml-auto flex-none text-muted transition-transform`,u&&`rotate-180`)})]});return(0,L.jsxs)(`li`,{className:`flex flex-col`,children:[i?(0,L.jsx)(`button`,{type:`button`,"aria-expanded":u,onClick:()=>c(!u),className:`flex min-h-8 w-full cursor-pointer items-start gap-2 rounded-lg border-0 bg-transparent px-1.5 py-1.5 text-left text-[13.5px] hover:bg-surface-muted`,children:d}):(0,L.jsx)(`div`,{className:`flex min-h-8 items-start gap-2 px-1.5 py-1.5 text-[13.5px]`,children:d}),i&&(0,L.jsx)(p,{open:u,children:(0,L.jsx)(Me,{step:e,working:t,from:n,className:`mb-1 ml-[13px]`})})]})}var Z=e=>e.lines.length>0||(e.children?.length??0)>0||!!e.handoff?.result||!!e.change;function Me({step:e,working:t,from:n,className:r}){let i=e.children||[],a=e.handoff?.agent||e.agent;return(0,L.jsxs)(`div`,{className:l(`flex flex-col gap-1.5 border-l-2 py-1 pl-3`,r),style:{borderColor:a?`${S(a).hue}66`:`var(--color-line)`},children:[e.lines.length>0&&(0,L.jsx)(je,{step:e}),e.change&&(0,L.jsx)(R,{diff:e.change.diff}),i.length>0&&(0,L.jsx)(`ul`,{"aria-label":a?`What ${S(a).name} did`:`Steps`,className:`m-0 flex list-none flex-col p-0`,children:i.map(e=>(0,L.jsx)(X,{step:e,working:t,from:a||n},e.key))}),e.handoff?.result&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-0.5 text-[13px]`,children:[(0,L.jsxs)(`span`,{className:`text-muted`,children:[S(e.handoff.agent).name,` answered`]}),(0,L.jsx)(_,{text:e.handoff.result.length>1200?`${e.handoff.result.slice(0,1199)}…`:e.handoff.result,className:`text-[13px] text-ink-2 [&_p]:my-0`})]})]})}function Ne({node:e,last:t,working:n,now:r,orbed:i}){let a=e.step?[]:e.steps,o=e.step,c=a.length>0||!!r||!!o&&Z(o),[u,d]=(0,T.useState)(null),f=u??(e.status===`active`||e.status===`failed`),m=o?.orb??[...a].reverse().find(e=>e.status===`running`)?.orb??r?.orb??`thinking`;return(0,L.jsxs)(`li`,{className:`flex gap-3`,children:[(0,L.jsxs)(`div`,{className:`flex flex-none flex-col items-center`,children:[(0,L.jsx)(`span`,{className:`mt-[3px]`,children:(0,L.jsx)(K,{status:e.status,orb:m,spin:!i})}),!t&&(0,L.jsx)(`span`,{"aria-hidden":`true`,className:l(`mt-1.5 min-h-4 w-0.5 flex-1 rounded-sm`,Oe[e.status])})]}),(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col pb-2`,children:[c?(0,L.jsxs)(`button`,{type:`button`,"aria-expanded":f,onClick:()=>d(!f),className:`flex min-h-7 w-full cursor-pointer items-start gap-1.5 border-0 bg-transparent p-0 text-left`,children:[(0,L.jsx)(Pe,{node:e}),(0,L.jsx)(s,{size:14,"aria-hidden":`true`,className:l(`mt-1 flex-none text-muted transition-transform`,f&&`rotate-180`)}),e.status===`active`&&(0,L.jsx)(`span`,{className:`mt-0.5 ml-1 flex-none rounded-full border border-accent-line bg-accent-soft px-2 py-px text-[11.5px] font-medium text-accent-fg`,children:`In progress`})]}):(0,L.jsx)(`div`,{className:`min-h-7`,children:(0,L.jsx)(Pe,{node:e})}),c&&(0,L.jsx)(p,{open:f,className:`mt-0.5`,children:o?(0,L.jsx)(Me,{step:o,working:n,from:`forgeqe`,className:`mt-1`}):(0,L.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[a.map(e=>(0,L.jsx)(X,{step:e,working:n},e.key)),r&&(0,L.jsx)(`li`,{children:(0,L.jsx)(Q,{live:r,className:`px-1.5`})})]})})]})]})}function Pe({node:e}){let t=e.status===`active`?`text-ink`:e.status===`pending`||e.status===`skipped`?`text-muted`:e.status===`failed`?`text-fail`:`text-ink-2`,n=e.step;return n?.handoff?(0,L.jsx)(Y,{step:n,from:b,live:e.status===`active`}):(0,L.jsxs)(`span`,{className:l(`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5 text-sm font-medium`,t,e.status===`skipped`&&`line-through`),children:[n&&(0,L.jsx)(J,{agent:n.agent||`forgeqe`,named:!!n.agent&&n.agent!==`forgeqe`,working:e.status===`active`}),e.status===`active`?(0,L.jsx)(`span`,{className:`shimmer [overflow-wrap:anywhere]`,children:(0,L.jsx)(`span`,{children:e.label})}):(0,L.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.label}),n?.arg&&(0,L.jsx)(q,{text:n.arg})]})}var Fe={info:`text-ink-2`,ok:`text-pass`,fail:`text-fail`,warn:`text-warn`,dim:`text-muted`,say:`text-ink-2`,you:`text-accent-fg`,think:`text-muted italic`};function Ie(e){let[t,n]=(0,T.useState)(()=>Date.now());(0,T.useEffect)(()=>{let e=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(e)},[]);let r=e?Date.parse(e):NaN;if(Number.isNaN(r))return``;let i=Math.max(0,Math.round((t-r)/1e3));return i<2?`just now`:i<60?`${i}s ago`:`${Math.floor(i/60)} min ago`}function Q({live:e,orb:t=!1,className:n}){let r=Ie(e.latest?.at);return(0,L.jsxs)(`div`,{className:l(`flex min-h-8 items-start gap-2 py-1`,n),children:[(0,L.jsx)(`span`,{className:`mt-0.5 flex size-4 flex-none items-center justify-center`,children:t?(0,L.jsx)(u,{state:e.orb,px:20,label:`At work`}):(0,L.jsxs)(`span`,{"aria-hidden":`true`,className:`relative flex size-2`,children:[(0,L.jsx)(`span`,{className:`absolute inline-flex size-full animate-ping rounded-full bg-accent opacity-60 motion-reduce:animate-none`}),(0,L.jsx)(`span`,{className:`relative inline-flex size-2 rounded-full bg-accent`})]})}),(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,L.jsx)(`span`,{className:`shimmer text-[13.5px] font-medium text-muted`,children:(0,L.jsx)(`span`,{"aria-live":`polite`,children:e.text})}),e.latest&&(0,L.jsxs)(`button`,{type:`button`,onClick:e.onLog,title:`Open the activity log`,className:`flex w-full min-w-0 cursor-pointer items-baseline gap-2 border-0 bg-transparent p-0 text-left hover:underline`,children:[(0,L.jsx)(`span`,{className:l(`min-w-0 truncate font-mono text-[12px]`,Fe[e.latest.tone]),children:e.latest.plain}),(0,L.jsxs)(`span`,{className:`flex-none text-[11.5px] whitespace-nowrap text-muted tabular-nums`,children:[r,r&&` · `,e.events,` `,e.events===1?`event`:`events`]})]})]})]})}function Le({turn:e,working:t,live:n,folded:r=!1}){if(r)return(0,L.jsx)(Q,{live:n,orb:!0});let i=Ee(e,t),a=e.plan.length>0&&t?i.find(e=>e.status===`active`)??null:null,o=t&&!a?[{key:`now`,label:n.text,status:`active`,steps:[]}]:[],s=[...i,...o],c=[...i].reverse().find(e=>e.status===`active`);return(0,L.jsx)(`ol`,{"aria-label":`What ForgeQE did`,className:`m-0 flex list-none flex-col p-0 pt-1`,children:s.map((e,r)=>e.key===`now`?(0,L.jsx)(`li`,{className:`flex gap-3`,children:(0,L.jsx)(Q,{live:n,orb:!c,className:`-mt-1 min-w-0 flex-1 py-0`})},`now`):(0,L.jsx)(Ne,{node:e,last:r===s.length-1,working:t,now:a===e?n:void 0,orbed:c===e},e.key))})}var Re={passed:`Passed`,failed:`Failed`,stopped:`Stopped`,blocked:`Blocked`};function $({label:e,children:t}){return(0,L.jsxs)(`div`,{className:`grid grid-cols-[110px_minmax(0,1fr)] items-baseline gap-3 py-1.5 text-sm`,children:[(0,L.jsx)(`span`,{className:`text-muted`,children:e}),(0,L.jsx)(`div`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:t})]})}function ze({text:e}){let[t,n]=(0,T.useState)(!1);return(0,L.jsxs)(`div`,{className:`flex items-start gap-2 rounded-[10px] bg-surface-muted px-3 py-2`,children:[(0,L.jsx)(ie,{size:14,"aria-hidden":`true`,className:`mt-0.5 flex-none text-muted`}),(0,L.jsx)(`code`,{className:`min-w-0 flex-1 font-mono text-[12.5px] break-all whitespace-pre-wrap text-ink`,children:e}),(0,L.jsx)(`button`,{type:`button`,"aria-label":t?`Copied`:`Copy the command`,onClick:async()=>{await v(e)&&(n(!0),setTimeout(()=>n(!1),1500))},className:`inline-flex size-7 flex-none cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted hover:bg-surface-strong hover:text-ink`,children:t?(0,L.jsx)(f,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,L.jsx)(g,{size:14,"aria-hidden":`true`})})]})}function Be({t:e}){return(0,L.jsxs)(`div`,{className:`flex flex-col`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pb-1`,children:[(0,L.jsx)(a,{size:16,"aria-hidden":`true`,className:`text-accent-fg`}),(0,L.jsx)(`span`,{className:`font-medium`,children:`Test written`}),(0,L.jsx)(ne,{tone:e.ok?`pass`:e.status===`stopped`?`neutral`:`fail`,children:Re[e.status]||e.status||`Not written`}),e.attempts!==void 0&&(0,L.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.maxAttempts?`attempt ${e.attempts} of ${e.maxAttempts}`:d(e.attempts,`attempt`)})]}),e.testFile&&(0,L.jsx)($,{label:`Test file`,children:(0,L.jsx)(y,{path:e.testFile})}),e.testName&&(0,L.jsx)($,{label:`Test`,children:(0,L.jsx)(`code`,{className:`font-mono text-[12.5px]`,children:e.testName})}),e.command&&(0,L.jsx)($,{label:`Run it`,children:(0,L.jsx)(ze,{text:e.command})}),e.runDir&&(0,L.jsx)($,{label:`From the run`,children:(0,L.jsx)(y,{path:e.runDir})}),e.reused.length>0&&(0,L.jsx)($,{label:`Reused`,children:(0,L.jsx)(`span`,{className:`flex flex-wrap gap-x-2 gap-y-1`,children:e.reused.map(e=>(0,L.jsx)(y,{path:e},e))})}),e.error&&(0,L.jsx)(`p`,{className:`m-0 mt-1 rounded-[10px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e.error})]})}function Ve({c:e}){let[t,n]=(0,T.useState)(!1);return(0,L.jsxs)(`li`,{className:`flex flex-col`,children:[(0,L.jsxs)(`div`,{className:`flex min-h-9 items-center gap-2`,children:[(0,L.jsx)(`button`,{type:`button`,"aria-expanded":t,"aria-label":`${t?`Hide`:`Show`} the changes to ${e.path}`,onClick:()=>n(!t),className:`inline-flex size-7 flex-none cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted hover:bg-surface-strong hover:text-ink`,children:(0,L.jsx)(s,{size:15,"aria-hidden":`true`,className:l(`transition-transform`,!t&&`-rotate-90`)})}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,L.jsx)(y,{path:e.path})}),(0,L.jsxs)(`span`,{className:`flex-none font-mono text-[12px] tabular-nums`,children:[(0,L.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.added]}),` `,(0,L.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.removed]})]})]}),(0,L.jsx)(p,{open:t,children:(0,L.jsx)(R,{diff:e.diff,className:`mb-2 ml-9`})})]})}function He({turn:e}){let t=e.reports.filter((e,t,n)=>n.findIndex(t=>t.path===e.path)===t),r=new Set(e.changes.map(e=>e.path)),i=[...new Set(e.tests.flatMap(e=>e.changed))].filter(e=>!r.has(e)&&![...r].some(t=>t.endsWith(e)||e.endsWith(t)));return!e.tests.length&&!t.length&&!e.changes.length&&!i.length?null:(0,L.jsxs)(`section`,{"aria-label":`Result`,className:`flex flex-col gap-4 rounded-[14px] border border-line-soft px-4 py-3`,children:[e.tests.map((e,t)=>(0,L.jsx)(Be,{t:e},t)),t.length>0&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,L.jsx)(`span`,{className:`text-sm font-medium`,children:`Reports`}),(0,L.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-sm`,children:t.map(e=>(0,L.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,L.jsx)(`span`,{className:`text-ink-2`,children:e.label}),(0,L.jsx)(y,{path:e.path})]},e.path))})]}),(e.changes.length>0||i.length>0)&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,L.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm font-medium`,children:[(0,L.jsx)(n,{size:15,"aria-hidden":`true`,className:`text-muted`}),`Files changed`,(0,L.jsxs)(`span`,{className:`font-normal text-muted`,children:[d(e.changes.length+i.length,`file`),` · `,(0,L.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.changes.reduce((e,t)=>e+t.added,0)]}),` `,(0,L.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.changes.reduce((e,t)=>e+t.removed,0)]})]})]}),(0,L.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[e.changes.map(e=>(0,L.jsx)(Ve,{c:e},e.path)),i.map(e=>(0,L.jsx)(`li`,{className:`flex min-h-9 items-center gap-2 pl-9`,children:(0,L.jsx)(y,{path:e})},e))]})]})]})}function Ue({lines:e,start:t,live:n,name:r}){let i=(0,T.useRef)(null),a=(0,T.useRef)(!0),[o,s]=(0,T.useState)(!1),c=(0,T.useMemo)(()=>de(e,t),[e,t]);(0,T.useEffect)(()=>{a.current&&i.current&&(i.current.scrollTop=i.current.scrollHeight)},[c]);let l=`inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-lg border-0 bg-transparent px-2 text-[12px] font-medium text-muted hover:bg-surface-strong hover:text-ink`;return(0,L.jsxs)(`div`,{className:`overflow-hidden rounded-[12px] border border-line-soft bg-surface-muted`,children:[(0,L.jsxs)(`div`,{className:`flex min-h-9 items-center gap-1 border-b border-line-soft pr-1 pl-3 text-[12px] text-muted`,children:[(0,L.jsxs)(`span`,{className:`flex-1`,children:[`Markdown · `,e.length,` event`,e.length===1?``:`s`,n&&` · live`]}),(0,L.jsxs)(`button`,{type:`button`,"aria-label":o?`Copied`:`Copy the activity log as Markdown`,onClick:async()=>{try{await navigator.clipboard.writeText(c),s(!0),setTimeout(()=>s(!1),1500)}catch{}},className:l,children:[o?(0,L.jsx)(f,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,L.jsx)(g,{size:14,"aria-hidden":`true`}),o?`Copied`:`Copy`]}),(0,L.jsxs)(`button`,{type:`button`,"aria-label":`Download the activity log as a Markdown file`,onClick:()=>{let e=URL.createObjectURL(new Blob([c],{type:`text/markdown;charset=utf-8`})),t=document.createElement(`a`);t.href=e,t.download=r,t.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3)},className:l,children:[(0,L.jsx)(ee,{size:14,"aria-hidden":`true`}),`.md`]})]}),(0,L.jsx)(`div`,{ref:i,role:`log`,"aria-label":`Activity log`,onScroll:e=>{let t=e.currentTarget;a.current=t.scrollTop+t.clientHeight>=t.scrollHeight-24},className:`max-h-[360px] overflow-y-auto px-4 py-2`,children:(0,L.jsx)(_,{text:c,className:`text-[13px] leading-[1.6] [&_code]:text-[12px] [&_h4]:mt-3 [&_h4]:mb-1 [&_li]:my-0.5 [&_pre]:text-[12px] [&_ul]:my-1`})})]})}function We({ask:e,live:t,onAnswer:n}){let r=t&&e.answer===void 0;return(0,L.jsxs)(`div`,{className:l(`flex flex-col gap-3 rounded-[14px] border px-4 py-3`,r?`border-accent-line bg-accent-soft`:`border-line-soft`),children:[(0,L.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,L.jsx)(re,{size:18,"aria-hidden":`true`,className:`mt-0.5 flex-none text-accent-fg`}),(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,L.jsx)(`span`,{className:`font-medium`,children:e.title}),e.detail&&(0,L.jsx)(`span`,{className:`text-sm text-ink-2`,children:e.detail}),e.lines.map((e,t)=>(0,L.jsx)(`span`,{className:`text-sm text-ink-2 [overflow-wrap:anywhere]`,children:e},t))]})]}),r?(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.options.map(e=>(0,L.jsx)(c,{size:`sm`,onClick:()=>n(e.id),children:e.label},e.id)),(0,L.jsx)(c,{size:`sm`,variant:`ghost`,onClick:()=>n(null),children:`Cancel`})]}):(0,L.jsx)(`span`,{className:`text-sm text-muted`,children:e.answer===void 0?`Not answered`:`You chose: ${e.answer}`})]})}function Ge({wait:e,live:t,onProceed:n}){let r=t&&e.answer===void 0;return(0,L.jsxs)(`div`,{className:l(`flex flex-col gap-3 rounded-[14px] border px-4 py-3`,r?`border-accent-line bg-accent-soft`:`border-line-soft`),children:[(0,L.jsxs)(`span`,{className:`flex items-start gap-2`,children:[(0,L.jsx)(te,{size:18,"aria-hidden":`true`,className:`mt-0.5 flex-none text-accent-fg`}),(0,L.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.prompt})]}),r?(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsx)(c,{size:`sm`,variant:`primary`,onClick:()=>n(!0),children:`Done, continue`}),(0,L.jsx)(c,{size:`sm`,onClick:()=>n(!1),children:`Cancel`})]}):(0,L.jsx)(`span`,{className:`text-sm text-muted`,children:e.answer===void 0?`Not done`:e.answer?`You continued`:`You cancelled`})]})}function Ke({turn:e,live:t,onAnswer:n,onProceed:r}){let a=t&&!e.outcome,[o,c]=(0,T.useState)(null),u=o??a,d=Ce(e),f=a?d.text:we(e),m=e.parts.map(e=>N(e.text)).filter(Boolean),[h,g]=(0,T.useState)(!1),v=[...e.log].reverse().find(e=>e.tone!==`you`&&e.tone!==`say`);return(0,L.jsxs)(`div`,{className:`flex gap-3`,children:[(0,L.jsx)(`div`,{className:`size-9 flex-none`,"aria-hidden":`true`,children:(0,L.jsx)(x,{agent:`forgeqe`,px:34,working:a,className:`mt-0.5`})}),(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3 pt-1.5`,children:[(e.steps.length>0||a||e.log.length>0)&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,L.jsxs)(`button`,{type:`button`,"aria-expanded":u,disabled:!e.steps.length&&!e.plan.length,onClick:()=>c(!u),className:l(`flex cursor-pointer items-center gap-1.5 border-0 bg-transparent p-0 text-sm font-medium text-muted hover:text-ink disabled:cursor-default`,a&&`shimmer`),children:[(0,L.jsx)(`span`,{"aria-live":`polite`,children:f}),(e.steps.length>0||e.plan.length>0)&&(0,L.jsx)(s,{size:16,"aria-hidden":`true`,className:l(`transition-transform`,u&&`rotate-180`)})]}),e.log.length>0&&(0,L.jsxs)(`button`,{type:`button`,"aria-expanded":h,onClick:()=>g(!h),className:`ml-auto inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-lg border-0 bg-transparent px-2 text-[13px] font-medium text-muted hover:bg-surface-muted hover:text-ink`,children:[(0,L.jsx)(i,{size:14,"aria-hidden":`true`}),`Activity log`,(0,L.jsx)(`span`,{className:`tabular-nums`,children:e.log.length})]})]}),(u||a)&&(e.steps.length>0||e.plan.length>0||a)&&(0,L.jsx)(Le,{turn:e,working:a,folded:!u,live:{...d,latest:v,events:e.log.length,onLog:()=>g(!0)}}),(0,L.jsx)(p,{open:h,children:(0,L.jsx)(Ue,{lines:e.log,start:e.started||e.log[0]?.at,live:a,name:`forgeqe-activity-${e.id}.md`})})]}),e.asks.map(e=>(0,L.jsx)(We,{ask:e,live:a,onAnswer:t=>n(e.id,t)},e.id)),e.waits.map(e=>(0,L.jsx)(Ge,{wait:e,live:a,onProceed:t=>r(e.id,t)},e.id)),e.outcome&&e.reply?(0,L.jsx)(_,{text:e.reply}):m.length>0&&(0,L.jsx)(_,{text:m.join(`
7
-
8
- `)}),(0,L.jsx)(He,{turn:e}),e.error&&(0,L.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.error}),e.outcome===`stopped`&&!e.reply&&(0,L.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Stopped.`})]})]})}export{N as a,le as i,Ke as n,Se as r,Ue as t};
@@ -1,2 +0,0 @@
1
- import{At as e,Cn as t,Dt as n,Et as r,Ft as i,Gn as a,H as o,Hn as s,In as c,K as l,Mt as u,O as d,Rt as f,U as p,Ut as m,_n as h,_t as g,an as _,at as v,ct as y,dt as b,ht as x,ln as S,lt as C,nn as w,nt as T,q as E,r as D,sn as O,st as k,t as A}from"./frame-CHQgOaj6.js";import{t as ee}from"./circle-dashed-CQKCycSk.js";import{n as j,t as M}from"./markdown-BPBR6Fva.js";import{t as N}from"./external-link-B45wnQ3R.js";import{t as P}from"./file-chart-column-increasing-9rCBQxTk.js";import{a as te,i as ne,t as re}from"./Response-VUbDhVeF.js";import{t as ie}from"./terminal-BZSHVR9y.js";import{F as ae,N as oe,P as se,T as ce,_ as le,j as ue,s as F,w as de}from"./index-Hd8gmpz5.js";import{n as I,t as fe}from"./when-CHnpLdYw.js";var pe={name:`book-check`,size:24,node:[[`path`,{d:`M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20`,key:`k3hazp`}],[`path`,{d:`m9 9.5 2 2 4-4`,key:`1dth82`}]]};pe.node;var me=h(pe),L={name:`code-xml`,size:24,node:[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]],aliases:[`code-2`]};L.node;var R=h(L),z={name:`flag`,size:24,node:[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]};z.node;var he=h(z),ge={name:`lightbulb`,size:24,node:[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]};ge.node;var _e=h(ge),B=a(s(),1),V=k(),H={execution:`Execution`,report:`Report`,coding:`Coding`,chat:`Chat`},ve={execution:m,report:P,coding:R,chat:e};function ye({kind:e}){let t=ve[e];return(0,V.jsx)(t,{size:14,"aria-hidden":`true`,className:`flex-none text-muted`})}var be={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`}},U=e=>be[e]||{label:e?e.charAt(0).toUpperCase()+e.slice(1).replace(/_/g,` `):`–`,tone:`neutral`},xe={suite:`Suite`,monitor:`Monitor round`,run:`Browser run`,explore:`Exploration`,api:`API run`,desktop:`Desktop run`,mobile:`App run`},Se=e=>{if(!e)return``;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`};function W({title:e,icon:t,children:n,aside:r}){return(0,V.jsxs)(`section`,{className:`flex flex-col gap-3 rounded-[14px] border border-line-soft p-4`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsxs)(`h3`,{className:`m-0 flex flex-1 items-center gap-2 text-base font-semibold`,children:[(0,V.jsx)(`span`,{className:`text-accent-fg`,children:t}),e]}),r]}),n]})}function Ce({path:e,label:t=`Open report`}){let[n,r]=(0,B.useState)(``);return(0,V.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,V.jsxs)(v,{onClick:async()=>r(await l(e)),children:[(0,V.jsx)(N,{size:16,"aria-hidden":`true`}),t]}),n&&(0,V.jsx)(`span`,{className:`text-[13px] text-fail`,children:n})]})}function we({items:e,first:t,render:n}){let[r,i]=(0,B.useState)(!1);return(0,V.jsxs)(V.Fragment,{children:[(r?e:e.slice(0,t)).map(n),e.length>t&&(0,V.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 Te({c:e}){if(!e.total)return null;let t=t=>`${t/e.total*100}%`;return(0,V.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,V.jsx)(`div`,{className:`bg-pass`,style:{width:t(e.passed)}}),(0,V.jsx)(`div`,{className:`bg-fail`,style:{width:t(e.failed)}}),(0,V.jsx)(`div`,{className:`bg-warn`,style:{width:t(e.other)}})]})}function Ee({e}){let t=e.counts.total?Math.round(e.counts.passed/e.counts.total*100):0;return(0,V.jsxs)(`div`,{className:`flex flex-col gap-3 border-t border-line-soft pt-3 first:border-t-0 first:pt-0`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-0.5`,children:[(0,V.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,V.jsx)(`span`,{className:`text-[13px] text-muted`,children:[xe[e.scope]||e.scope,Se(e.ms),e.tokens?`${d(e.tokens)} tokens`:``,e.stopped?`stopped early`:``].filter(Boolean).join(` · `)})]}),e.report&&(0,V.jsx)(Ce,{path:e.report})]}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,V.jsxs)(`span`,{className:`text-[22px] font-semibold tabular-nums`,children:[t,`%`]}),(0,V.jsx)(`span`,{className:`text-muted`,children:`passed`}),(0,V.jsxs)(F,{tone:`pass`,children:[e.counts.passed,` passed`]}),e.counts.failed>0&&(0,V.jsxs)(F,{tone:`fail`,children:[e.counts.failed,` failed`]}),e.counts.other>0&&(0,V.jsxs)(F,{tone:`warn`,children:[e.counts.other,` other`]}),(0,V.jsxs)(`span`,{className:`text-muted`,children:[`of `,e.counts.total]})]}),(0,V.jsx)(Te,{c:e.counts}),e.cases.length>0&&(0,V.jsx)(`ul`,{"aria-label":`Cases of ${e.title}`,className:`m-0 flex list-none flex-col p-0`,children:(0,V.jsx)(we,{items:[...e.cases].sort((e,t)=>Number(U(t.status).tone===`fail`)-Number(U(e.status).tone===`fail`)),first:6,render:(e,t)=>(0,V.jsxs)(`li`,{className:`flex min-w-0 items-start gap-3 border-t border-line-soft py-2 text-sm`,children:[(0,V.jsx)(`span`,{className:`w-[76px] flex-none`,children:(0,V.jsx)(F,{tone:U(e.status).tone,children:U(e.status).label})}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,V.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[e.id&&(0,V.jsx)(`span`,{className:`mr-1.5 font-mono text-[12px] text-muted`,children:e.id}),e.title,e.device&&(0,V.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.device]})]}),e.summary&&(0,V.jsx)(`span`,{className:`line-clamp-2 text-[13px] text-muted`,children:e.summary})]}),(0,V.jsx)(`span`,{className:`flex-none text-[13px] text-muted tabular-nums`,children:Se(e.ms)})]},`${e.id}-${t}`)})}),e.folder&&!e.report&&(0,V.jsxs)(`span`,{className:`text-sm`,children:[`Kept in `,(0,V.jsx)(M,{path:e.folder})]})]})}function De({list:e}){let t=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,V.jsx)(W,{title:`Execution summary`,icon:(0,V.jsx)(m,{size:18,"aria-hidden":`true`}),aside:e.length>1?(0,V.jsxs)(`span`,{className:`text-sm text-muted`,children:[C(e.length,`run`),` · `,t.passed,` of `,t.total,` passed`]}):void 0,children:e.length?e.map((e,t)=>(0,V.jsx)(Ee,{e},`${e.folder||e.title}-${t}`)):(0,V.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 Oe({list:e}){return(0,V.jsxs)(W,{title:`Report summary`,icon:(0,V.jsx)(P,{size:18,"aria-hidden":`true`}),children:[e.length===0&&(0,V.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No report was written in this run.`}),e.map((e,t)=>(0,V.jsxs)(`div`,{className:`flex flex-col gap-3 border-t border-line-soft pt-3 first:border-t-0 first:pt-0`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-0.5`,children:[(0,V.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,V.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,V.jsx)(Ce,{path:e.path})]}),e.stats&&(0,V.jsx)(`dl`,{className:`m-0 grid grid-cols-[repeat(auto-fit,minmax(110px,1fr))] gap-2`,children:e.stats.map(e=>(0,V.jsxs)(`div`,{className:`rounded-[10px] bg-surface-muted px-3 py-2`,children:[(0,V.jsx)(`dt`,{className:`text-[12px] text-muted`,children:e.label}),(0,V.jsx)(`dd`,{className:`m-0 text-[18px] font-semibold tabular-nums`,children:e.value})]},e.label))}),e.markdown&&(0,V.jsx)(ke,{text:e.markdown})]},`${e.path||e.title}-${t}`))]})}function ke({text:e,height:t=220}){let[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(!0),o=(0,B.useRef)(null);return(0,B.useLayoutEffect)(()=>{o.current&&!n&&a(o.current.scrollHeight>t+8)},[e,t,n]),(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,V.jsxs)(`div`,{ref:o,style:n?void 0:{maxHeight:t},className:n?``:`relative overflow-hidden`,children:[(0,V.jsx)(j,{text:e,className:`text-sm`}),!n&&i&&(0,V.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,V.jsx)(`button`,{type:`button`,"aria-expanded":n,onClick:()=>r(!n),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 Ae(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 je({e}){let[t,n]=(0,B.useState)(!1),r=e.action===`write`?`New`:`Edited`;return(0,V.jsxs)(`li`,{className:`border-t border-line-soft`,children:[(0,V.jsxs)(`div`,{className:`flex min-h-[44px] min-w-0 items-center gap-2 py-1.5 text-sm`,children:[(0,V.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:t?(0,V.jsx)(_,{size:16,"aria-hidden":`true`}):(0,V.jsx)(oe,{size:16,"aria-hidden":`true`})}),(0,V.jsx)(`span`,{className:`w-[52px] flex-none text-[12px] text-muted`,children:r}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,V.jsx)(M,{path:e.path})}),(0,V.jsxs)(`span`,{className:`flex-none font-mono text-[12px] tabular-nums`,children:[(0,V.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.added]}),` `,(0,V.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.removed]})]})]}),t&&(0,V.jsx)(`div`,{className:`pb-3 pl-10 [&_pre]:max-h-[420px] [&_pre]:overflow-auto`,children:e.diffs.length?(0,V.jsx)(j,{text:Ae(e.diffs)}):null})]})}function Me({c:e}){let t=e.edits.reduce((e,t)=>e+t.added,0),n=e.edits.reduce((e,t)=>e+t.removed,0),r=e.tests.at(-1),i=e.reviews.at(-1);return(0,V.jsxs)(W,{title:`Code changes`,icon:(0,V.jsx)(R,{size:18,"aria-hidden":`true`}),aside:(0,V.jsxs)(`span`,{className:`font-mono text-[13px] tabular-nums`,children:[e.edits.length,` file`,e.edits.length===1?``:`s`,` · `,(0,V.jsxs)(`span`,{className:`text-pass`,children:[`+`,t]}),` `,(0,V.jsxs)(`span`,{className:`text-fail`,children:[`−`,n]})]}),children:[e.results.map((e,t)=>(0,V.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[12px] bg-surface-muted px-4 py-3 text-sm`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(F,{tone:e.status===`passed`||e.status===`done`?`pass`:e.status===`error`||e.status===`failed`?`fail`:`warn`,children:U(e.status).label}),e.testFile&&(0,V.jsx)(M,{path:e.testFile}),e.maxAttempts>0&&(0,V.jsxs)(`span`,{className:`text-muted`,children:[`attempt `,e.attempts,` of `,e.maxAttempts]}),e.review&&(0,V.jsx)(F,{tone:e.review.approved?`pass`:`warn`,children:e.review.approved?`Review approved`:`Review not approved`})]}),e.error&&(0,V.jsx)(`p`,{className:`m-0 text-fail`,children:e.error}),e.notes&&(0,V.jsx)(j,{text:e.notes,className:`text-sm [&_p]:my-1`}),e.command&&(0,V.jsx)(j,{text:`Run it with \`${e.command.replace(/`/g,``)}\``,className:`text-sm [&_p]:my-0`})]},t)),(r||i)&&(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-sm`,children:[r&&(0,V.jsxs)(F,{tone:r.ok?`pass`:`fail`,children:[`Last test run `,r.ok?`passed`:`failed`,e.tests.length>1?` (${e.tests.length} runs)`:``]}),i&&(0,V.jsxs)(F,{tone:i.approved?`pass`:`warn`,children:[`Review `,i.approved?`approved`:`asked for ${i.issues} fix${i.issues===1?``:`es`}`]})]}),e.edits.length?(0,V.jsx)(`ul`,{"aria-label":`Files changed`,className:`m-0 flex list-none flex-col p-0`,children:(0,V.jsx)(we,{items:e.edits,first:8,render:e=>(0,V.jsx)(je,{e},e.path)})}):(0,V.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No files changed.`}),e.edits.some(e=>!e.diffs.length)&&(0,V.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 Ne({final:e,answer:t}){let n=e.from===`agent`?t?.facts??[]:[],r=e.from===`agent`?t?.files??[]:[],i=e.from!==`agent`,a=Math.max(2,...(e.text.match(/`+/g)||[]).map(e=>e.length)),o="`".repeat(a+1);return(0,V.jsxs)(W,{title:`Final message`,icon:(0,V.jsx)(he,{size:18,"aria-hidden":`true`}),aside:(0,V.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:[n.length>0&&(0,V.jsx)(`dl`,{className:`m-0 grid grid-cols-[repeat(auto-fit,minmax(180px,1fr))] gap-2`,children:n.map((e,t)=>(0,V.jsxs)(`div`,{className:`min-w-0 rounded-[10px] bg-surface-muted px-3 py-2`,children:[(0,V.jsx)(`dt`,{className:`text-[12px] text-muted`,children:e.label}),(0,V.jsx)(`dd`,{className:`m-0 text-sm [overflow-wrap:anywhere]`,children:(0,V.jsx)(j,{text:e.value,className:`[&_p]:my-0`})})]},`${e.label}-${t}`))}),(0,V.jsx)(ke,{text:i?`${o}text\n${e.text}\n${o}`:te(e.text),height:360}),r.length>0&&(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,V.jsx)(`span`,{className:`text-muted`,children:`Files it names:`}),r.map(e=>(0,V.jsx)(M,{path:e},e))]})]})}var Pe={rule:{icon:me,label:`Rulebook`},decision:{icon:f,label:`Test decisions`},memory:{icon:S,label:`Page memory`},replay:{icon:r,label:`Replays`},model:{icon:g,label:`Model`},skill:{icon:i,label:`Skills`}};function Fe({list:e}){let t=Object.keys(Pe).filter(t=>e.some(e=>e.kind===t));return(0,V.jsx)(W,{title:`Learnings`,icon:(0,V.jsx)(_e,{size:18,"aria-hidden":`true`}),aside:e.length?(0,V.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[e.length,` from this session`]}):void 0,children:e.length===0?(0,V.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,V.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(280px,1fr))] gap-x-6 gap-y-3`,children:t.map(t=>{let{icon:n,label:r}=Pe[t];return(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,V.jsxs)(`h4`,{className:`m-0 flex items-center gap-1.5 text-[13px] font-medium text-muted`,children:[(0,V.jsx)(n,{size:14,"aria-hidden":`true`}),r]}),(0,V.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.filter(e=>e.kind===t).map((e,t)=>(0,V.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,V.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.text}),e.note&&(0,V.jsx)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.note})]},t))})]},t)})})})}function Ie({run:e}){let t=[];return(e.executions.length||e.kind===`execution`)&&t.push({kind:`execution`,node:(0,V.jsx)(De,{list:e.executions},`e`)}),(e.reports.length||e.kind===`report`)&&t.push({kind:`report`,node:(0,V.jsx)(Oe,{list:e.reports},`r`)}),e.coding&&(e.coding.edits.length||e.coding.results.length||e.kind===`coding`)&&t.push({kind:`coding`,node:(0,V.jsx)(Me,{c:e.coding},`c`)}),t.sort((t,n)=>Number(n.kind===e.kind)-Number(t.kind===e.kind)),(0,V.jsx)(V.Fragment,{children:t.map(e=>e.node)})}var Le={running:{label:`Running`,tone:`running`},done:{label:`Done`,tone:`pass`},failed:{label:`Failed`,tone:`fail`},stopped:{label:`Stopped`,tone:`neutral`}},Re={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`},ze=e=>Re[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 Be(e){let[t,n]=(0,B.useState)(Date.now());return(0,B.useEffect)(()=>{if(!e)return;let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),t}function Ve({r:t}){return t.origin.kind===`web`?(0,V.jsxs)(`a`,{href:E(`chats`,t.origin.chat),className:`inline-flex items-center gap-1.5`,children:[(0,V.jsx)(e,{size:14,"aria-hidden":`true`}),`Web chat`]}):t.origin.kind===`job`?(0,V.jsxs)(`a`,{href:E(`jobs`,encodeURIComponent(t.origin.job)),className:`inline-flex items-center gap-1.5`,children:[(0,V.jsx)(O,{size:14,"aria-hidden":`true`}),`Job`]}):(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-muted`,children:[(0,V.jsx)(ie,{size:14,"aria-hidden":`true`}),`Terminal`]})}function He({status:e}){let t=Le[e].label;return e===`running`?(0,V.jsx)(u,{size:16,"aria-label":t,className:`flex-none animate-spin text-accent-fg`}):e===`done`?(0,V.jsx)(ue,{size:16,"aria-label":t,className:`flex-none text-pass`}):e===`failed`?(0,V.jsx)(w,{size:16,"aria-label":t,className:`flex-none text-fail`}):(0,V.jsx)(ee,{size:16,"aria-label":t,className:`flex-none text-muted`})}var Y=e=>e.status!==`running`&&!e.tools&&!e.turns&&!J(e)&&!e.files.length&&!e.outputs.length&&K(e,0)<2;function X({label:e,children:t}){return(0,V.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,V.jsx)(`span`,{className:`text-[13px] text-muted`,children:e}),(0,V.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:t})]})}function Z({title:e,children:t}){return(0,V.jsxs)(`section`,{className:`flex min-w-0 flex-col rounded-[14px] border border-line-soft px-4 py-3`,children:[(0,V.jsx)(`h3`,{className:`m-0 mb-1 text-[14px] font-semibold`,children:e}),t]})}var Ue={rerun:ce,write_test:le,investigate:de,fix_test:b};function We({actions:e}){let[n,r]=(0,B.useState)(``),[i,a]=(0,B.useState)(``);if(!e.length)return null;let o=async e=>{r(e.prompt),a(``);try{let{id:n}=await t.start(e.prompt,{});location.hash=E(`chats`,n)}catch(e){a(e.message),r(``)}};return(0,V.jsxs)(`section`,{"aria-label":`Next steps`,className:`flex flex-col gap-2`,children:[(0,V.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map((e,t)=>{let r=Ue[e.kind];return(0,V.jsxs)(`button`,{type:`button`,disabled:!!n,onClick:()=>void o(e),className:y(`flex min-h-[52px] max-w-full cursor-pointer items-center gap-3 rounded-[14px] border px-3 py-2 text-left disabled:cursor-default disabled:opacity-60`,t===0?`border-accent bg-accent-soft hover:bg-accent-soft/70`:`border-line-soft bg-bg hover:bg-surface-muted`),children:[(0,V.jsx)(r,{size:18,"aria-hidden":`true`,className:`flex-none text-accent-fg`}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,V.jsx)(`span`,{className:`text-sm font-medium text-ink`,children:n===e.prompt?`Opening a chat…`:e.label}),(0,V.jsx)(`span`,{className:`max-w-[320px] truncate text-[12px] text-muted`,children:e.note})]})]},t)})}),(0,V.jsx)(`span`,{className:`text-[12px] text-muted`,children:`Each opens a chat with the request; it asks before it changes anything.`}),i&&(0,V.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:i})]})}var Q=e=>`\`${e.replace(/`/g,``)}\``;function Ge({name:e}){let[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(``),[a,o]=(0,B.useState)(!1),[s,l]=(0,B.useState)(`summary`),u=(0,B.useCallback)(()=>{c.detail(e).then(e=>{n(e),i(``)},e=>i(e.message))},[e]);(0,B.useEffect)(u,[u]);let f=t?.status===`running`;(0,B.useEffect)(()=>{if(!f)return;let e=setInterval(u,2e3);return()=>clearInterval(e)},[u,f]);let p=Be(f),m=(0,B.useMemo)(()=>(t?.events??[]).map(ne).filter(e=>!!e),[t?.events]),h=async()=>{o(!0),i(``);try{await c.cancel(e),u()}catch(e){i(e.message)}finally{o(!1)}},g=(0,V.jsxs)(`a`,{href:E(`runs`),className:`inline-flex items-center gap-1.5 text-sm`,children:[(0,V.jsx)(ae,{size:16,"aria-hidden":`true`}),`All runs`]});if(!t)return(0,V.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[g,r?(0,V.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:r}):(0,V.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`})]});let _=Le[t.status],b=!t.replies.length,S=!!t.final||t.executions.length>0||t.reports.length>0||!!(t.coding&&(t.coding.edits.length||t.coding.results.length))||t.learnings.length>0||t.outputs.length>0,w=[{id:`summary`,label:`Summary`},{id:`conversation`,label:b?`Command`:`Conversation`,n:t.replies.length||void 0},{id:`activity`,label:`Activity`,n:m.length||void 0},{id:`details`,label:`Details`}],T=new Set([...t.reports.map(e=>e.path),...t.executions.flatMap(e=>[e.report,e.folder])].filter(Boolean)),D=t.outputs.filter(e=>!T.has(e.path)),O=t.context?.limit?Math.round(t.context.tokens/t.context.limit*100):null;return(0,V.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[g,(0,V.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1.5`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,V.jsx)(`h2`,{className:`m-0 min-w-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:t.title}),(0,V.jsx)(F,{tone:_.tone,children:_.label})]}),(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-[13px] text-muted`,children:[(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,V.jsx)(ye,{kind:t.kind}),H[t.kind]]}),`· `,(0,V.jsx)(Ve,{r:t}),`· `,G(t.startedAt),` · `,f?`running for `:`took `,q(K(t,p)),` · `,d(J(t)),` tokens`,t.profile?.model?` · ${t.profile.model}`:``]})]}),t.cancel&&(0,V.jsxs)(v,{disabled:a,onClick:()=>void h(),className:`border-fail text-fail hover:bg-fail-soft`,children:[(0,V.jsx)(x,{size:14,fill:`currentColor`,"aria-hidden":`true`}),a?`Stopping…`:t.cancel===`chat`?`Stop this chat's work`:`Cancel this job's run`]})]}),r&&(0,V.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.error&&(0,V.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:[(0,V.jsx)(`strong`,{children:`What went wrong:`}),` `,t.error]}),!f&&(0,V.jsx)(We,{actions:t.actions??[]}),(0,V.jsx)(`div`,{role:`tablist`,"aria-label":`This run`,className:`flex gap-1 overflow-x-auto border-b border-line-soft`,children:w.map(e=>(0,V.jsxs)(`button`,{type:`button`,role:`tab`,id:`run-tab-${e.id}`,"aria-selected":s===e.id,"aria-controls":`run-panel-${e.id}`,onClick:()=>l(e.id),className:y(`-mb-px inline-flex min-h-10 cursor-pointer items-center gap-1.5 border-0 border-b-2 bg-transparent px-3 text-sm font-medium whitespace-nowrap`,s===e.id?`border-accent text-ink`:`border-transparent text-muted hover:text-ink`),children:[e.label,e.n!==void 0&&(0,V.jsx)(`span`,{className:`text-[12px] text-muted tabular-nums`,children:e.n})]},e.id))}),(0,V.jsxs)(`div`,{role:`tabpanel`,id:`run-panel-${s}`,"aria-labelledby":`run-tab-${s}`,className:`flex min-w-0 flex-col gap-4`,children:[s===`summary`&&(0,V.jsxs)(V.Fragment,{children:[t.final&&(0,V.jsx)(Ne,{final:t.final,answer:t.answer}),(0,V.jsx)(Ie,{run:t}),D.length>0&&(0,V.jsx)(Z,{title:`What it produced (${D.length})`,children:D.map(e=>(0,V.jsx)(X,{label:e.label,children:(0,V.jsx)(M,{path:e.path})},e.path))}),t.learnings.length>0&&(0,V.jsx)(Fe,{list:t.learnings}),!S&&(0,V.jsx)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-3 text-sm text-ink-2`,children:f?`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.`})]}),s===`conversation`&&(b?(0,V.jsx)(j,{text:Q(t.prompt),className:`text-sm [&_p]:my-0`}):(0,V.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-4 p-0`,children:t.replies.map((e,t)=>(0,V.jsxs)(`li`,{className:`flex flex-col gap-2`,children:[(0,V.jsx)(`div`,{className:`self-end rounded-[14px] bg-surface-strong px-4 py-2.5 text-sm max-w-[85%]`,children:(0,V.jsx)(j,{text:e.ask,className:`[&_p]:my-0.5`})}),e.text&&(0,V.jsx)(j,{text:te(e.text),className:`text-sm`}),e.error&&(0,V.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))})),s===`activity`&&(t.archived?(0,V.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,V.jsx)(`code`,{className:`font-mono text-[13px]`,children:`.forgeqe/runs`}),`; its step-by-step activity was not.`]}):m.length?(0,V.jsx)(re,{lines:m,start:t.startedAt,live:f,name:`forgeqe-run-${t.name.replace(/\.log$/,``)}.md`}):(0,V.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing logged yet.`})),s===`details`&&(0,V.jsxs)(`div`,{className:`grid items-start gap-3 @3xl:grid-cols-2`,children:[(0,V.jsxs)(Z,{title:`Numbers`,children:[(0,V.jsx)(X,{label:f?`Running for`:`Took`,children:q(K(t,p))}),(0,V.jsxs)(X,{label:`Tokens`,children:[d(J(t)),` `,(0,V.jsxs)(`span`,{className:`text-muted`,children:[`(`,d(t.usage.input),` in · `,d(t.usage.output),` out`,t.usage.cached?` · ${d(t.usage.cached)} cached`:``,`)`]})]}),(0,V.jsxs)(X,{label:`Context`,children:[t.context?d(t.context.tokens):`–`,O!==null&&(0,V.jsxs)(`span`,{className:`text-muted`,children:[` of `,d(t.context.limit),` (`,O,`%)`]})]}),(0,V.jsxs)(X,{label:`Tool calls`,children:[t.tools,` `,(0,V.jsxs)(`span`,{className:`text-muted`,children:[`in `,C(t.turns,`turn`)]})]})]}),(0,V.jsxs)(Z,{title:`Session`,children:[(0,V.jsx)(X,{label:`Started by`,children:(0,V.jsx)(Ve,{r:t})}),(0,V.jsx)(X,{label:`Command`,children:ze(t.command)}),(0,V.jsx)(X,{label:`Model`,children:t.profile?[t.profile.name,t.profile.model].filter(Boolean).join(` · `):`–`}),(0,V.jsx)(X,{label:`Agents`,children:t.agents.length?t.agents.map(e=>`${e.name} (${C(e.calls,`call`)})`).join(`, `):(0,V.jsx)(`span`,{className:`text-muted`,children:`None`})}),(0,V.jsxs)(X,{label:`Log`,children:[t.archived?(0,V.jsx)(`span`,{className:`text-muted`,children:`No longer kept: ForgeQE keeps the newest logs only`}):(0,V.jsx)(M,{path:`.forgeqe/logs/${t.name}`}),t.truncated&&(0,V.jsx)(`span`,{className:`block text-[13px] text-muted`,children:`Very long: only its start is shown.`})]})]}),t.job&&(0,V.jsxs)(Z,{title:`Job`,children:[(0,V.jsx)(X,{label:`Job`,children:(0,V.jsx)(`a`,{href:E(`jobs`,encodeURIComponent(t.origin.kind===`job`?t.origin.job:t.job.name)),children:t.job.name})}),(0,V.jsx)(X,{label:`Runs`,children:(0,V.jsx)(j,{text:Q(t.job.command),className:`text-sm [&_p]:my-0`})}),(0,V.jsxs)(X,{label:`Schedule`,children:[t.job.schedule,!t.job.enabled&&` (disabled)`,t.job.nextAt&&t.job.enabled?` · next ${G(t.job.nextAt)}`:``]}),t.job.run&&(0,V.jsxs)(X,{label:`This run`,children:[t.job.run.reason===`asked`?`Asked for`:`On schedule`,`, `,t.job.run.status.replace(`_`,` `),t.job.run.exitCode!==void 0&&t.job.run.exitCode!==null?`, exit ${t.job.run.exitCode}`:``]})]}),(0,V.jsx)(Z,{title:`Files worked on (${t.files.length})`,children:t.files.length?t.files.map(e=>(0,V.jsx)(X,{label:e.action===`write`?`Written`:e.action===`edit`?`Edited`:e.action===`delete`?`Deleted`:e.action||`Changed`,children:e.action===`delete`?(0,V.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.path}):(0,V.jsx)(M,{path:e.path})},e.path)):(0,V.jsx)(`p`,{className:`m-0 py-1 text-sm text-muted`,children:`No files changed.`})}),(0,V.jsx)(Z,{title:`Notifications`,children:t.notifications.length?t.notifications.map(e=>(0,V.jsx)(X,{label:e.event.replace(/_/g,` `),children:e.channels.length?e.channels.join(`, `):(0,V.jsx)(`span`,{className:`text-muted`,children:`No channel takes it`})},e.event)):(0,V.jsx)(`p`,{className:`m-0 py-1 text-sm text-muted`,children:t.origin.kind===`terminal`||t.origin.kind===`web`?`None: notify channels go with jobs, suites and the monitor.`:`No notify channels are set up (Settings, Notify).`})})]})]})]})}var $=25;function Ke({runs:e}){let t=Be(e.some(e=>e.status===`running`)),[n,r]=(0,B.useState)(``),[i,a]=(0,B.useState)(`all`),[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(``),[f,m]=(0,B.useState)(!1),[h,g]=(0,B.useState)(0);(0,B.useEffect)(()=>g(0),[n,i,s,l,f]);let _=e.filter(Y).length,b=n.toLowerCase().split(/\s+/).filter(Boolean),x=e.filter(e=>(f||!Y(e))&&(!s||e.kind===s)&&(!l||e.origin.kind===l)&&b.every(t=>`${e.title} ${e.command} ${e.error||``}`.toLowerCase().includes(t))),S={all:x.length,running:x.filter(e=>e.status===`running`).length,failed:x.filter(e=>e.status===`failed`).length},w=i===`all`?x:x.filter(e=>e.status===i),T=Math.max(1,Math.ceil(w.length/$)),D=Math.min(h,T-1),O=w.slice(D*$,D*$+$),k=e.filter(e=>e.status!==`running`&&!Y(e)),A=k.filter(e=>e.status===`failed`).length,ee=k.length?k.reduce((e,n)=>e+K(n,t),0)/k.length:NaN,j=e.reduce((e,t)=>e+J(t),0),M=[...new Set(e.map(e=>e.kind))],N=[...new Set(e.map(e=>e.origin.kind))],P={web:`Web chat`,job:`Job`,terminal:`Terminal`};return e.length===0?(0,V.jsx)(`p`,{className:`m-0 rounded-[14px] bg-surface-muted px-5 py-4 text-sm leading-relaxed text-ink-2`,children:`No runs yet. A chat here, a job, or a ForgeQE command in this project adds one.`}):(0,V.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1 text-[13px] text-muted`,children:[(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`b`,{className:`text-ink tabular-nums`,children:e.length-_}),` runs`]}),e.some(e=>e.status===`running`)&&(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`b`,{className:`text-accent-fg tabular-nums`,children:e.filter(e=>e.status===`running`).length}),` running now`]}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`b`,{className:y(`tabular-nums`,A?`text-fail`:`text-ink`),children:A}),` failed`,k.length?` (${Math.round(A/k.length*100)}%)`:``]}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`b`,{className:`text-ink tabular-nums`,children:d(j)}),` tokens`]}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`b`,{className:`text-ink tabular-nums`,children:q(Math.round(ee))}),` on average`]})]}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsxs)(`div`,{className:`relative min-w-0 flex-[1_1_240px]`,children:[(0,V.jsx)(de,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted`}),(0,V.jsx)(`label`,{htmlFor:`run-search`,className:`sr-only`,children:`Find a run`}),(0,V.jsx)(o,{id:`run-search`,type:`search`,value:n,onChange:e=>r(e.target.value),placeholder:`Find a run by what was asked`,className:`h-9 pl-9`})]}),[[`all`,`All`],[`running`,`Running`],[`failed`,`Failed`]].map(([e,t])=>(0,V.jsxs)(`button`,{type:`button`,"aria-pressed":i===e,onClick:()=>a(e),className:y(`inline-flex min-h-8 cursor-pointer items-center gap-1 rounded-[8px] border px-3 text-[13px] font-medium`,i===e?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:bg-line hover:text-ink`),children:[t,(0,V.jsx)(`span`,{className:y(`tabular-nums`,e===`failed`&&S.failed?`text-fail`:``),children:S[e]})]},e)),M.length>1&&(0,V.jsxs)(p,{"aria-label":`What it did`,value:s,onChange:e=>c(e.target.value),className:`h-8 w-auto py-0 pr-7 pl-3 text-[13px]`,children:[(0,V.jsx)(`option`,{value:``,children:`Any kind`}),M.map(e=>(0,V.jsx)(`option`,{value:e,children:H[e]},e))]}),N.length>1&&(0,V.jsxs)(p,{"aria-label":`Started by`,value:l,onChange:e=>u(e.target.value),className:`h-8 w-auto py-0 pr-7 pl-3 text-[13px]`,children:[(0,V.jsx)(`option`,{value:``,children:`Started anywhere`}),N.map(e=>(0,V.jsx)(`option`,{value:e,children:P[e]||e},e))]})]}),(0,V.jsxs)(`div`,{className:`rounded-[14px] border border-line-soft bg-bg`,children:[(0,V.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,V.jsx)(`span`,{className:`w-4`}),(0,V.jsx)(`span`,{children:`Run`}),(0,V.jsx)(`span`,{children:`Kind`}),(0,V.jsx)(`span`,{children:`Started by`}),(0,V.jsx)(`span`,{className:`text-right`,children:`Took`}),(0,V.jsx)(`span`,{className:`text-right`,children:`Tokens`}),(0,V.jsx)(`span`,{className:`text-right`,children:`When`})]}),(0,V.jsxs)(`ul`,{"aria-label":`Runs`,className:`m-0 list-none p-1.5`,children:[O.length===0&&(0,V.jsx)(`li`,{className:`px-3 py-4 text-sm text-muted`,children:`Nothing matches.`}),O.map((e,n)=>{let r=I(e.startedAt);return(0,V.jsxs)(`li`,{className:`contents`,children:[(n===0||I(O[n-1].startedAt)!==r)&&(0,V.jsx)(`span`,{className:`block px-3 pt-3 pb-1 text-[12px] font-semibold text-muted`,children:r}),(0,V.jsxs)(`a`,{href:E(`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,V.jsx)(He,{status:e.status}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,V.jsx)(`span`,{className:`truncate text-[14px] font-medium`,title:e.title,children:e.title}),e.error?(0,V.jsx)(`span`,{className:`truncate text-[12px] text-fail`,children:e.error}):(0,V.jsx)(`span`,{className:`truncate text-[12px] text-muted @3xl:hidden`,children:[H[e.kind],P[e.origin.kind],q(K(e,t)),`${d(J(e))} tokens`].join(` · `)})]}),(0,V.jsxs)(`span`,{className:`hidden min-w-0 items-center gap-1.5 text-[13px] text-ink-2 @3xl:inline-flex`,children:[(0,V.jsx)(ye,{kind:e.kind}),H[e.kind]]}),(0,V.jsx)(`span`,{className:`hidden text-[13px] text-ink-2 @3xl:block`,children:P[e.origin.kind]||e.origin.kind}),(0,V.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:q(K(e,t))}),(0,V.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:d(J(e))}),(0,V.jsx)(`span`,{className:`text-right text-[12.5px] text-muted tabular-nums`,title:G(e.startedAt),children:fe(e.startedAt)})]})]},e.name)})]}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-t border-line-soft px-4 py-2.5 text-[13px] text-muted`,children:[(0,V.jsxs)(`span`,{className:`flex-1`,children:[w.length?`${D*$+1}–${Math.min(w.length,D*$+$)} of ${w.length}`:`0 runs`,_>0&&(0,V.jsxs)(V.Fragment,{children:[` · `,(0,V.jsx)(`button`,{type:`button`,onClick:()=>m(!f),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:f?`Hide the ${C(_,`empty session`)}`:`${C(_,`empty session`)} hidden`})]})]}),T>1&&(0,V.jsxs)(`nav`,{"aria-label":`Pages of runs`,className:`flex items-center gap-1`,children:[(0,V.jsx)(v,{size:`sm`,variant:`ghost`,disabled:D===0,onClick:()=>g(D-1),"aria-label":`Newer runs`,children:(0,V.jsx)(se,{size:16,"aria-hidden":`true`})}),(0,V.jsxs)(`span`,{className:`px-1 tabular-nums`,children:[`Page `,D+1,` of `,T]}),(0,V.jsx)(v,{size:`sm`,variant:`ghost`,disabled:D>=T-1,onClick:()=>g(D+1),"aria-label":`Older runs`,children:(0,V.jsx)(oe,{size:16,"aria-hidden":`true`})})]})]})]})]})}function qe({sub:e}){let[t,r]=(0,B.useState)(null),[i,a]=(0,B.useState)(``),o=(0,B.useCallback)(()=>{c.list().then(e=>{r(e.runs),a(``)},e=>a(e.message))},[]);(0,B.useEffect)(o,[o]);let s=t?.some(e=>e.status===`running`);(0,B.useEffect)(()=>{if(e)return;let t=setInterval(o,s?3e3:2e4);return()=>clearInterval(t)},[o,s,e]);let l=e?decodeURIComponent(e):``;return(0,V.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,V.jsx)(D,{}),(0,V.jsx)(`main`,{className:y(A,`@container flex-auto gap-4`),children:l?(0,V.jsx)(Ge,{name:l},l):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(T,{icon:n,size:`lg`}),(0,V.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Runs`})]}),(0,V.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-muted`,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.`}),i&&(0,V.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}),!t&&!i&&(0,V.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&(0,V.jsx)(Ke,{runs:t})]})})]})}export{qe as Runs};
@@ -1 +0,0 @@
1
- import{_n as e}from"./frame-CHQgOaj6.js";var t={name:`file-chart-column-increasing`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`path`,{d:`M12 18v-4`,key:`q1q25u`}],[`path`,{d:`M16 18v-6`,key:`15y0np`}]],aliases:[`file-bar-chart`]};t.node;var n=e(t);export{n as t};