@capagents/forgeqe 2.4.5 → 2.4.7

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 (52) hide show
  1. package/HOW_TO_USE.md +21 -1
  2. package/dist/docs-site/docs/index.html +24 -3
  3. package/dist/docs-site/docs/search.js +1 -1
  4. package/dist/docs-site/docs/web-app/index.html +19 -3
  5. package/dist/forgeqe.js +1006 -1044
  6. package/dist/template.html +4 -4
  7. package/dist/web/assets/ApiTests-D5YLst-t.js +2 -0
  8. package/dist/web/assets/Chat-DUZawyA0.js +3 -0
  9. package/dist/web/assets/{Data-M-G4Y2k9.js → Data-BOu8BrmB.js} +4 -4
  10. package/dist/web/assets/Features-BCBzUoB7.js +1 -0
  11. package/dist/web/assets/Jobs-C-Tqj504.js +3 -0
  12. package/dist/web/assets/Quality-CzCArgrj.js +1 -0
  13. package/dist/web/assets/Record-CcHMCfs6.js +1 -0
  14. package/dist/web/assets/Regression-CgiNh2hj.js +2 -0
  15. package/dist/web/assets/Reports-CXRY0udx.js +2 -0
  16. package/dist/web/assets/Response-VUbDhVeF.js +8 -0
  17. package/dist/web/assets/Runs-kghxBY8X.js +2 -0
  18. package/dist/web/assets/capgemini-BO8ajcbd.svg +21 -0
  19. package/dist/web/assets/{circle-dashed-ODPnEo8f.js → circle-dashed-CQKCycSk.js} +1 -1
  20. package/dist/web/assets/{external-link-S8aL0KIN.js → external-link-B45wnQ3R.js} +1 -1
  21. package/dist/web/assets/{file-chart-column-increasing-D6q2iZ64.js → file-chart-column-increasing-9rCBQxTk.js} +1 -1
  22. package/dist/web/assets/frame-CHQgOaj6.js +3 -0
  23. package/dist/web/assets/index-CwX6YH3i.css +2 -0
  24. package/dist/web/assets/index-Hd8gmpz5.js +26 -0
  25. package/dist/web/assets/{markdown-4IJa7wkI.js → markdown-BPBR6Fva.js} +7 -7
  26. package/dist/web/assets/{sticky-note-i4oBl2S1.js → sticky-note-D_lJfPYH.js} +1 -1
  27. package/dist/web/assets/{terminal-Cb_EtWVl.js → terminal-BZSHVR9y.js} +1 -1
  28. package/dist/web/assets/{trending-up-Cxt0Wl0_.js → trending-up-Bypj2D7Z.js} +1 -1
  29. package/dist/web/index.html +3 -3
  30. package/docs/WEB_APP.md +20 -3
  31. package/docs/user-guide.html +24 -3
  32. package/docs/walkthrough/hotfix-narration.md +606 -0
  33. package/docs/walkthrough/index.html +238 -39
  34. package/forgeqe.example.yaml +13 -0
  35. package/package.json +1 -1
  36. package/prompts/brain.md +1 -0
  37. package/py/forgeqe_mobile/hyperexecute.py +1 -0
  38. package/dist/web/assets/ApiTests-BKeFkLyV.js +0 -2
  39. package/dist/web/assets/Chat-dwxejH0o.js +0 -3
  40. package/dist/web/assets/Features-EJv_T9B8.js +0 -1
  41. package/dist/web/assets/Jobs-5A8NDMou.js +0 -3
  42. package/dist/web/assets/Quality-DIhsU907.js +0 -1
  43. package/dist/web/assets/Record-D7BkDgkZ.js +0 -1
  44. package/dist/web/assets/Regression-CbnOqFND.js +0 -2
  45. package/dist/web/assets/Reports-Duxt7oC1.js +0 -2
  46. package/dist/web/assets/Response-B2lhSJ1u.js +0 -8
  47. package/dist/web/assets/Runs-6M-obw2F.js +0 -2
  48. package/dist/web/assets/frame-pVqMQRrR.js +0 -3
  49. package/dist/web/assets/index-BAI8SJTX.css +0 -2
  50. package/dist/web/assets/index-Cu314_Zs.js +0 -26
  51. package/dist/web/assets/rotate-ccw-BgnQpY8R.js +0 -1
  52. package/dist/web/assets/trash-zYYpxA_X.js +0 -1
@@ -1,2 +0,0 @@
1
- import{$ as e,An as t,I as n,J as r,K as i,Kt as a,L as o,N as s,Nn as c,P as l,Q as u,R as d,Y as f,Z as p,_t as m,at as h,fn as g,nt as _,pn as v,q as y,r as b,t as x}from"./frame-pVqMQRrR.js";import{t as S}from"./circle-dashed-ODPnEo8f.js";import"./markdown-4IJa7wkI.js";import{E as C,T as w,_ as T,g as E,k as D,n as O,r as k,s as A,t as j}from"./index-Cu314_Zs.js";import{t as M}from"./when-CHnpLdYw.js";var N=c(t(),1),P=p(),F={passed:`pass`,failed:`fail`,error:`fail`,skipped:`neutral`},I={GET:`text-pass`,POST:`text-accent`,PUT:`text-warn`,PATCH:`text-warn`,DELETE:`text-fail`},ee={run:`a browser run's calls`,openapi:`OpenAPI`,swagger:`Swagger`,wsdl:`WSDL`,graphql:`GraphQL`,proto:`.proto`,case:`a test case`,text:`a description`},L=e=>new Date(e).toLocaleString([],{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`});function R({job:e,onStop:t}){let n=(0,N.useRef)(null);(0,N.useEffect)(()=>{n.current&&(n.current.scrollTop=n.current.scrollHeight)},[e.lines.length]);let[r,i]={contracts:[`Making contracts`,`Made contracts`],run:[`Running the contracts`,`Ran the contracts`],scenarios:[`Making scenarios`,`Made scenarios`],"run-scenarios":[`Running the scenarios`,`Ran the scenarios`]}[e.kind]??[`Working`,`Done`],a=(e.kind===`run`||e.kind===`run-scenarios`)&&e.exitCode===1;return(0,P.jsxs)(`section`,{"aria-label":e.running?r:i,className:`flex flex-col gap-2 rounded-[14px] border border-line-soft p-4`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,P.jsx)(`span`,{className:`flex-1 font-medium`,children:e.running?r:i}),(0,P.jsx)(A,{orb:e.kind===`contracts`?`handing`:e.kind===`scenarios`?`writing`:`working`,tone:e.running?`running`:e.exitCode===0?`pass`:a?`warn`:`fail`,children:e.running?`Working`:e.exitCode===0?`Done`:a?`Some failed`:`Did not finish`}),e.running&&(0,P.jsxs)(f,{onClick:t,className:`border-fail text-fail hover:bg-fail-soft`,children:[(0,P.jsx)(h,{size:14,fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]}),(0,P.jsx)(`code`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:e.command}),(0,P.jsxs)(`details`,{open:e.running,children:[(0,P.jsxs)(`summary`,{className:`cursor-pointer text-sm text-muted`,children:[`Output (`,e.lines.length,` lines)`]}),(0,P.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…`})]})]})}var z=({m:e})=>(0,P.jsx)(`span`,{className:u(`w-[58px] flex-none font-mono text-[12px] font-semibold`,I[e.toUpperCase()]||`text-ink-2`),children:e.toUpperCase()});function te({c:e,r:t}){let n=Array.isArray(e.expect.status)?e.expect.status.join(` or `):e.expect.status,r=t&&t.status!==`passed`?[t.reason,...t.checks.filter(e=>!e.ok).map(e=>`${e.name}${e.detail?`: ${e.detail}`:``}`)].filter(Boolean).join(` · `):``;return(0,P.jsxs)(`li`,{className:`grid min-h-11 grid-cols-[58px_minmax(0,1fr)_auto] items-center gap-x-3 rounded-[10px] px-3 py-1.5 hover:bg-surface-muted @3xl:grid-cols-[58px_minmax(0,1fr)_200px_auto]`,children:[(0,P.jsx)(z,{m:e.method}),(0,P.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,P.jsx)(`span`,{className:`truncate font-mono text-[13px]`,title:e.protocol===`rest`?e.path:e.name,children:e.protocol===`rest`?e.path:e.name}),r?(0,P.jsx)(`span`,{className:u(`truncate text-[12px]`,t?.status===`skipped`?`text-muted`:`text-fail`),title:r,children:r}):(e.writes||e.needsData?.length)&&(0,P.jsx)(`span`,{className:`truncate text-[12px] text-warn`,children:[e.writes?`Changes data`:``,e.needsData?.length?`Needs real ${e.needsData.join(`, `)}`:``].filter(Boolean).join(` · `)})]}),(0,P.jsx)(`span`,{className:`hidden truncate text-[12px] text-muted @3xl:block`,children:[n?`expects ${n}`:``,e.expect.contentType,e.auth?`${e.auth.type} auth`:``].filter(Boolean).join(` · `)}),(0,P.jsx)(`span`,{className:`flex justify-end`,children:t?(0,P.jsx)(A,{tone:F[t.status],children:t.status===`skipped`?`Skipped`:t.httpStatus?`${t.httpStatus}`:t.status}):(0,P.jsx)(`span`,{className:`text-[12px] text-muted`,children:`Not run`})})]})}function ne({s:e,r:t}){let[n,r]=(0,N.useState)(!1);return(0,P.jsxs)(`li`,{className:`border-t border-line-soft first:border-t-0`,children:[(0,P.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:()=>r(!n),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,P.jsx)(E,{size:16,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,P.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,P.jsx)(`span`,{className:`text-sm [overflow-wrap:anywhere]`,children:e.name}),(0,P.jsxs)(`span`,{className:`truncate text-[12px] text-muted`,children:[e.kind,` · `,e.steps.length,` step`,e.steps.length===1?``:`s`,e.cleanup?.length?` · ${e.cleanup.length} cleanup`:``,e.caseId?` · ${e.caseId}`:``]})]}),e.writes&&(0,P.jsx)(A,{tone:`warn`,children:`Changes data`}),t&&(0,P.jsx)(A,{tone:F[t.status],children:t.status.charAt(0).toUpperCase()+t.status.slice(1)})]}),n&&(0,P.jsxs)(`ol`,{className:`m-0 mb-3 ml-8 flex list-none flex-col gap-1 border-l border-line pl-3 text-sm`,children:[e.steps.map((e,n)=>{let r=t?.steps[n];return(0,P.jsxs)(`li`,{className:`flex flex-col`,children:[(0,P.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,P.jsx)(z,{m:e.method}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 font-mono text-[12px] [overflow-wrap:anywhere]`,children:e.path}),r&&(0,P.jsx)(A,{tone:F[r.status],children:r.httpStatus?String(r.httpStatus):r.status})]}),(0,P.jsxs)(`span`,{className:`pl-[66px] text-[12px] text-muted`,children:[e.name,e.save&&Object.keys(e.save).length?` · keeps ${Object.keys(e.save).join(`, `)}`:``,e.noAuth?` · without credentials`:``]}),r&&r.checks.some(e=>!e.ok)&&(0,P.jsx)(`span`,{className:`pl-[66px] text-[12px] text-fail`,children:r.checks.filter(e=>!e.ok).map(e=>`${e.name}${e.detail?`: ${e.detail}`:``}`).join(` · `)})]},n)}),e.cleanup?.map((e,t)=>(0,P.jsxs)(`li`,{className:`flex items-center gap-2 text-muted`,children:[(0,P.jsx)(z,{m:e.method}),(0,P.jsx)(`span`,{className:`font-mono text-[12px]`,children:e.path}),(0,P.jsx)(`span`,{className:`text-[12px]`,children:`cleanup`})]},`c${t}`)),t?.reason&&(0,P.jsx)(`li`,{className:`text-[12px] text-fail [overflow-wrap:anywhere]`,children:t.reason})]})]})}function B({what:e,writes:t,defaultUrl:n,onRun:r,onCancel:a,needsData:o}){let[c,l]=(0,N.useState)(n),[u,d]=(0,N.useState)(!1),[p,h]=(0,N.useState)(!1);return(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-[12px] border border-accent-line bg-accent-soft p-4`,children:[(0,P.jsx)(`span`,{className:`font-medium`,children:e}),(0,P.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[`Against`,(0,P.jsx)(s,{value:c,spellCheck:!1,placeholder:`https://qa.example.com/api`,onChange:e=>l(e.target.value),className:`max-w-[480px] bg-bg`})]}),t>0&&(0,P.jsxs)(`span`,{className:`flex items-start gap-3 text-sm`,children:[(0,P.jsx)(i,{checked:u,onChange:d,label:`Also run the calls that change data`}),(0,P.jsxs)(`span`,{className:`flex flex-col`,children:[`Also run the `,t,` call`,t===1?``:`s`,` that change data`,(0,P.jsx)(`span`,{className:`text-[13px] text-warn`,children:`Only on a test environment: they create, change or delete data there.`})]})]}),o?(0,P.jsxs)(`span`,{className:`flex items-center gap-3 text-sm`,children:[(0,P.jsx)(i,{checked:p,onChange:h,label:`Also run calls with made-up values`}),`Also run the `,o,` call`,o===1?``:`s`,` whose values were made up`]}):null,(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,P.jsxs)(f,{variant:`primary`,onClick:()=>r({...c.trim()?{baseUrl:c.trim()}:{},allowWrites:u,includeNeedsData:p}),children:[(0,P.jsx)(m,{size:16,"aria-hidden":`true`}),`Run`]}),(0,P.jsx)(f,{onClick:a,children:`Don't run`})]})]})}function re({open:t,onClose:r,view:a,set:o,onMake:c,busy:d}){let[p,m]=(0,N.useState)(`spec`),[h,g]=(0,N.useState)(``),[_,v]=(0,N.useState)(``),[y,b]=(0,N.useState)(``),[x,S]=(0,N.useState)(!0);(0,N.useEffect)(()=>{t&&(m(o.source.kind===`run`?`run`:`spec`),g(o.source.kind===`run`?``:a.runs[0]?.id??``))},[t,o.source.kind,a.runs]);let C=(e,t,n)=>(0,P.jsxs)(`label`,{className:u(`flex cursor-pointer items-start gap-3 rounded-[12px] border px-3 py-2.5`,p===e?`border-accent bg-accent-soft`:`border-line-soft hover:bg-surface-muted`),children:[(0,P.jsx)(`input`,{type:`radio`,name:`sc-from`,checked:p===e,onChange:()=>m(e),className:`mt-1 size-4 accent-accent`}),(0,P.jsxs)(`span`,{className:`flex flex-col`,children:[(0,P.jsx)(`span`,{className:`text-sm font-medium`,children:t}),(0,P.jsx)(`span`,{className:`text-[13px] text-muted`,children:n})]})]});return(0,P.jsx)(n,{open:t,onClose:r,title:`Make scenarios`,description:`API calls in order, where later calls use values earlier answers gave, added to ${o.name}. Nothing runs until you run them.`,footer:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(f,{onClick:r,children:`Cancel`}),(0,P.jsx)(f,{variant:`primary`,disabled:d||p===`cases`&&!_.trim()||p===`text`&&!y.trim(),onClick:()=>c({from:p,...p===`run`&&h?{run:h}:{},...p===`cases`?{cases:_}:{},...p===`text`?{text:y}:{},...p===`spec`?{negative:x}:{}}),children:`Make scenarios`})]}),children:(0,P.jsxs)(`div`,{className:`flex flex-col gap-2 pt-3`,children:[C(`spec`,`From the API description`,`Each resource's lifecycle, browsing, the description's links, and negative cases (no model)`),p===`spec`&&(0,P.jsxs)(`span`,{className:`flex items-center gap-2 pl-10 text-sm`,children:[(0,P.jsx)(i,{checked:x,onChange:S,label:`Negative cases`}),` Negative cases: an id that does not exist, no credentials, an empty body`]}),C(`run`,`From a browser run`,`The calls the application made, in order, with the values passed on (no model)`),p===`run`&&(0,P.jsxs)(l,{"aria-label":`Browser run`,value:h,onChange:e=>g(e.target.value),className:`ml-10 max-w-[440px]`,children:[(0,P.jsx)(`option`,{value:``,children:`The latest run`}),a.runs.map(t=>(0,P.jsxs)(`option`,{value:t.id,children:[t.goal,` · `,e(t.calls,`call`),` · `,L(t.at)]},t.id))]}),C(`cases`,`From test cases`,`One scenario per case, planned by the model against the set's operations`),p===`cases`&&(0,P.jsx)(s,{"aria-label":`Test cases`,value:_,spellCheck:!1,placeholder:`ado:2238, jira:SHOP-12`,onChange:e=>v(e.target.value),className:`ml-10 max-w-[440px]`}),C(`text`,`From a description`,`In plain words, planned by the model; a step no operation does is listed, never invented`),p===`text`&&(0,P.jsx)(s,{"aria-label":`The scenario`,value:y,maxLength:1e3,placeholder:`Create a user, log in, add two items, check out, the total is the sum`,onChange:e=>b(e.target.value),className:`ml-10`})]})})}function V({open:t,onClose:r,view:i,onMake:a,busy:o}){let[c,u]=(0,N.useState)(`spec`),[d,p]=(0,N.useState)(``),[m,h]=(0,N.useState)(``),[g,_]=(0,N.useState)(``),[v,y]=(0,N.useState)(``);return(0,N.useEffect)(()=>{t&&(p(i.specs[0]??``),h(``),_(``),y(i.baseUrl??``),u(i.specs.length||!i.runs.length?`spec`:`run`))},[t,i]),(0,P.jsx)(n,{open:t,onClose:r,title:`New contract set`,description:`One contract per operation: an example call and what its answer must have (status, content type, schema, key fields). Making them runs nothing.`,footer:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(f,{onClick:r,children:`Cancel`}),(0,P.jsx)(f,{variant:`primary`,disabled:o||c===`spec`&&!d.trim(),onClick:()=>a({from:c,...c===`spec`?{spec:d.trim()}:m?{run:m}:{},...g.trim()?{name:g.trim()}:{},...v.trim()?{baseUrl:v.trim()}:{}}),children:`Make contracts`})]}),children:(0,P.jsxs)(`div`,{className:`flex flex-col gap-4 pt-3`,children:[(0,P.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,P.jsx)(`legend`,{className:`mb-1.5 text-sm font-medium`,children:`From`}),(0,P.jsxs)(`label`,{className:`flex min-h-9 cursor-pointer items-center gap-2 text-sm`,children:[(0,P.jsx)(`input`,{type:`radio`,name:`set-from`,checked:c===`spec`,onChange:()=>u(`spec`),className:`size-4 accent-accent`}),`An API description: OpenAPI or Swagger, WSDL, GraphQL, .proto, or grpc://`]}),c===`spec`&&(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5 pl-6`,children:[(0,P.jsx)(s,{"aria-label":`API description`,value:d,spellCheck:!1,list:`spec-files`,placeholder:`https://shop.test/openapi.json, or a file in the project`,onChange:e=>p(e.target.value)}),(0,P.jsx)(`datalist`,{id:`spec-files`,children:i.specs.map(e=>(0,P.jsx)(`option`,{value:e},e))}),i.specs.length>0&&(0,P.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`In this project: `,i.specs.slice(0,6).join(`, `)]})]}),(0,P.jsxs)(`label`,{className:`flex min-h-9 cursor-pointer items-center gap-2 text-sm`,children:[(0,P.jsx)(`input`,{type:`radio`,name:`set-from`,checked:c===`run`,onChange:()=>u(`run`),className:`size-4 accent-accent`}),`The calls a browser run saw the application make`]}),c===`run`&&(0,P.jsxs)(l,{"aria-label":`Browser run`,value:m,onChange:e=>h(e.target.value),className:`ml-6 max-w-[440px]`,children:[(0,P.jsx)(`option`,{value:``,children:`The latest run`}),i.runs.map(t=>(0,P.jsxs)(`option`,{value:t.id,children:[t.goal,` · `,e(t.calls,`call`),` · `,L(t.at)]},t.id))]})]}),(0,P.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm font-medium`,children:[`Name`,(0,P.jsx)(s,{value:g,maxLength:120,placeholder:`Petstore`,onChange:e=>_(e.target.value)})]}),(0,P.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm font-medium`,children:[`Base URL`,(0,P.jsx)(s,{value:v,spellCheck:!1,placeholder:`https://qa.shop.test/api`,onChange:e=>y(e.target.value)}),(0,P.jsxs)(`span`,{className:`text-[13px] font-normal text-muted`,children:[`Where the contracts run when not where they were recorded or described.`,i.headers.length?` Each call sends ${i.headers.join(`, `)} from api.headers in forgeqe.yaml.`:` Credentials go in api.headers in forgeqe.yaml, as references to environment variables.`]})]})]})})}var H=50,ie=e=>e.length>48?`…/${e.split(/[\\/]/).filter(Boolean).slice(-2).join(`/`)}`:e;function U({label:e,last:t,onOpen:n}){if(!t)return(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[13px] text-muted`,children:[(0,P.jsx)(S,{size:14,"aria-hidden":`true`}),e,`: not run yet`]});let r=t.counts.failed+t.counts.error,i=t.counts.passed+r;return(0,P.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-x-1.5 text-[13px] text-ink-2`,children:[r?(0,P.jsx)(a,{size:14,"aria-label":`Failures`,className:`text-fail`}):(0,P.jsx)(D,{size:14,"aria-label":`Passed`,className:`text-pass`}),e,`:`,` `,(0,P.jsxs)(`b`,{className:u(`tabular-nums`,r?`text-fail`:`text-ink`),children:[t.counts.passed,`/`,i,` passed`]}),t.counts.skipped?(0,P.jsxs)(`span`,{className:`text-muted`,children:[`· `,t.counts.skipped,` skipped`]}):null,(0,P.jsxs)(`span`,{className:`text-muted`,children:[`· `,M(t.at)]}),t.report&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>n(t.report),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent hover:underline`,children:`· Report`})]})}function W({id:t,view:n,busy:r,act:i,version:a}){let[s,c]=(0,N.useState)(null),[l,p]=(0,N.useState)(``),[h,_]=(0,N.useState)(null),[y,b]=(0,N.useState)(!1),[x,S]=(0,N.useState)(``),[C,E]=(0,N.useState)(`contracts`),[D,A]=(0,N.useState)(``),[M,F]=(0,N.useState)(`all`),[I,R]=(0,N.useState)(0);(0,N.useEffect)(()=>{let e=!1;return g.set(t).then(t=>!e&&(c(t),p(``)),t=>!e&&p(t.message)),()=>{e=!0}},[t,a]),(0,N.useEffect)(()=>{_(null),E(`contracts`),A(``),F(`all`)},[t]),(0,N.useEffect)(()=>R(0),[t,C,D,M]);let z=(0,N.useMemo)(()=>new Map((s?.last.contracts?.results??[]).map(e=>[e.id,e])),[s]),V=(0,N.useMemo)(()=>new Map((s?.last.scenarios?.results??[]).map(e=>[e.id,e])),[s]);if(l)return(0,P.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:l});if(!s)return(0,P.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading…`});let W=s.contracts.filter(e=>e.writes).length,G=s.contracts.filter(e=>e.needsData?.length).length,K=s.scenarios??[],q=s.last.contracts,ae=s.last.scenarios,J=n.baseUrl||s.baseUrl||``,Y=async e=>S(await o(e)),oe=async e=>{try{let{id:t}=await v.start(`Write the API contracts${e?` and scenarios`:``} of set ${s.id} as tests in the repository: call write_api_tests with set_id ${s.id}${e?` and scenarios ["all"]`:``}. Show me the plan before you write.`,{});location.hash=d(`chats`,t)}catch(e){S(e.message)}},X=e=>{let t=z.get(e.id);return!!t&&(t.status===`failed`||t.status===`error`)},Z=D.toLowerCase().split(/\s+/).filter(Boolean),Q=s.contracts.filter(e=>Z.every(t=>`${e.method} ${e.path} ${e.name}`.toLowerCase().includes(t))),se=[{id:`all`,label:`All`,n:Q.length},{id:`failed`,label:`Failed`,n:Q.filter(X).length,alert:!0},...W?[{id:`writes`,label:`Changes data`,n:Q.filter(e=>e.writes).length}]:[],...q?[{id:`unrun`,label:`Not run`,n:Q.filter(e=>!z.has(e.id)).length}]:[]],$=[...Q.filter(e=>M===`failed`?X(e):M===`writes`?e.writes:M!==`unrun`||!z.has(e.id))].sort((e,t)=>Number(X(t))-Number(X(e))),ce=K.filter(e=>Z.every(t=>e.name.toLowerCase().includes(t)));return(0,P.jsxs)(`section`,{"aria-labelledby":`set-h`,className:`flex min-w-0 flex-1 flex-col gap-4`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(`h2`,{id:`set-h`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:s.name}),(0,P.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 text-[13px] text-muted`,children:[(0,P.jsxs)(`span`,{children:[`From `,ee[s.source.kind]||s.source.kind,` `,(0,P.jsx)(`span`,{className:`font-mono text-[12px]`,title:s.source.ref,children:ie(s.source.ref)})]}),`· `,(0,P.jsx)(`span`,{children:L(s.createdAt)}),s.baseUrl&&(0,P.jsxs)(P.Fragment,{children:[`· `,(0,P.jsx)(`span`,{className:`font-mono text-[12px] [overflow-wrap:anywhere]`,children:s.baseUrl})]})]})]}),(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsxs)(f,{variant:`primary`,size:`sm`,disabled:r||!s.contracts.length,onClick:()=>_(`contracts`),children:[(0,P.jsx)(m,{size:15,"aria-hidden":`true`}),`Run contracts`]}),(0,P.jsxs)(f,{size:`sm`,disabled:r||!K.length,onClick:()=>_(`scenarios`),children:[(0,P.jsx)(m,{size:15,"aria-hidden":`true`}),`Run scenarios`]}),(0,P.jsxs)(f,{size:`sm`,disabled:r,onClick:()=>b(!0),children:[(0,P.jsx)(w,{size:15,"aria-hidden":`true`}),`Make scenarios`]}),(0,P.jsxs)(f,{size:`sm`,variant:`ghost`,onClick:()=>void oe(K.length>0),children:[(0,P.jsx)(T,{size:15,"aria-hidden":`true`}),`Write them as tests`]})]}),x&&(0,P.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:x}),h===`contracts`&&(0,P.jsx)(B,{what:`Run ${s.contracts.length} contract${s.contracts.length===1?``:`s`}`,writes:W,needsData:G,defaultUrl:J,onCancel:()=>_(null),onRun:e=>{_(null),i(()=>g.run(s.id,e))}}),h===`scenarios`&&(0,P.jsx)(B,{what:`Run ${K.length} scenario${K.length===1?``:`s`}`,writes:K.filter(e=>e.writes).length,defaultUrl:J,onCancel:()=>_(null),onRun:e=>{_(null),i(()=>g.runScenarios(s.id,{...e.baseUrl?{baseUrl:e.baseUrl}:{},allowWrites:e.allowWrites}))}}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5 rounded-[12px] bg-surface-muted px-4 py-2.5`,children:[(0,P.jsx)(U,{label:`Contracts`,last:q,onOpen:e=>void Y(e)}),K.length>0&&(0,P.jsx)(U,{label:`Scenarios`,last:ae,onOpen:e=>void Y(e)})]}),(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-col rounded-[14px] border border-line-soft bg-bg`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-line-soft px-3 py-2.5`,children:[(0,P.jsx)(`div`,{role:`tablist`,"aria-label":`In this set`,className:`flex gap-1 rounded-[10px] bg-surface-strong p-1`,children:[[`contracts`,`Contracts`,s.contracts.length],[`scenarios`,`Scenarios`,K.length]].map(([e,t,n])=>(0,P.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":C===e,onClick:()=>E(e),className:u(`inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-[7px] border-0 px-3 text-sm font-medium`,C===e?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),children:[t,(0,P.jsx)(`span`,{className:`text-[12px] text-muted tabular-nums`,children:n})]},e))}),(0,P.jsx)(k,{id:`api-search`,label:C===`contracts`?`Find a call`:`Find a scenario`,placeholder:C===`contracts`?`Find a call by its path`:`Find a scenario`,value:D,onChange:A})]}),C===`contracts`?(0,P.jsxs)(P.Fragment,{children:[se.length>1&&(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1.5 px-3 pt-2.5`,children:(0,P.jsx)(j,{items:se,value:M,onChange:F})}),(0,P.jsxs)(`ul`,{"aria-label":`Contracts`,className:`@container m-0 flex list-none flex-col p-1.5`,children:[$.length===0&&(0,P.jsx)(`li`,{className:`px-3 py-4 text-sm text-muted`,children:s.contracts.length?`Nothing matches.`:`This set has no contracts.`}),$.slice(I*H,I*H+H).map(e=>(0,P.jsx)(te,{c:e,r:z.get(e.id)},e.id))]}),(0,P.jsx)(O,{page:I,size:H,total:$.length,onPage:R,label:`Pages of contracts`,children:s.skipped?.length?(0,P.jsxs)(`span`,{title:s.skipped.join(`; `),children:[` · `,e(s.skipped.length,`operation`),` left out`]}):null})]}):K.length?(0,P.jsxs)(`ul`,{"aria-label":`Scenarios`,className:`m-0 flex list-none flex-col px-3 py-1.5`,children:[ce.length===0&&(0,P.jsx)(`li`,{className:`py-4 text-sm text-muted`,children:`Nothing matches.`}),ce.map(e=>(0,P.jsx)(ne,{s:e,r:V.get(e.id)},e.id))]}):(0,P.jsxs)(`div`,{className:`flex flex-col items-start gap-2 px-4 py-5`,children:[(0,P.jsx)(`span`,{className:`text-sm text-muted`,children:`No scenarios yet. A scenario chains calls end to end, each using what the one before answered.`}),(0,P.jsxs)(f,{size:`sm`,disabled:r,onClick:()=>b(!0),children:[(0,P.jsx)(w,{size:15,"aria-hidden":`true`}),`Make scenarios`]})]})]}),(0,P.jsx)(re,{open:y,onClose:()=>b(!1),view:n,set:s,busy:r,onMake:e=>{b(!1),i(()=>g.scenarios(s.id,e))}})]})}function G({sub:t}){let[n,i]=(0,N.useState)(null),[o,s]=(0,N.useState)(``),[c,l]=(0,N.useState)(!1),[p,m]=(0,N.useState)(!1),h=(0,N.useCallback)(()=>{g.view().then(e=>{i(e),s(``)},e=>s(e.message))},[]);(0,N.useEffect)(h,[h]);let v=!!n?.job?.running;(0,N.useEffect)(()=>{if(!v)return;let e=setInterval(h,1500);return()=>clearInterval(e)},[v,h]);let T=async e=>{l(!0),s(``);try{await e(),h()}catch(e){s(e.message)}finally{l(!1)}},E=t?decodeURIComponent(t):``,O=n?.sets.find(e=>e.id===E)||n?.sets[0],A=`${n?.job?.endedAt??``}|${O?.at??``}`,[j,F]=(0,N.useState)(``),I=(n?.sets??[]).filter(e=>j.toLowerCase().split(/\s+/).filter(Boolean).every(t=>e.name.toLowerCase().includes(t)));return(0,P.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,P.jsx)(b,{}),(0,P.jsxs)(`main`,{className:u(x,`@container flex-auto gap-4`),children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,P.jsx)(y,{icon:_,size:`lg`}),(0,P.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`API tests`}),(0,P.jsxs)(f,{variant:`primary`,disabled:!n||v,onClick:()=>m(!0),children:[(0,P.jsx)(w,{size:16,"aria-hidden":`true`}),`New contract set`]})]}),(0,P.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:`REST, GraphQL, SOAP and gRPC, tested straight against the API with no browser and no model. A contract is one call and what its answer must have; a scenario chains calls end to end.`}),o&&(0,P.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}),!n&&!o&&(0,P.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),n?.job&&(0,P.jsx)(R,{job:n.job,onStop:()=>T(()=>g.stop())}),n&&(n.sets.length?(0,P.jsxs)(`div`,{className:`flex flex-col gap-6 @2xl:flex-row @2xl:items-start @2xl:gap-8`,children:[(0,P.jsxs)(`nav`,{"aria-label":`Contract sets`,className:`flex min-w-0 flex-col gap-2 @2xl:sticky @2xl:top-6 @2xl:w-[280px] @2xl:flex-none`,children:[(0,P.jsxs)(`span`,{className:`px-1 text-[13px] font-medium text-muted`,children:[`Contract sets (`,n.sets.length,`)`]}),n.sets.length>6&&(0,P.jsx)(k,{id:`set-search`,label:`Find a set`,value:j,onChange:F,className:`flex-none`}),(0,P.jsxs)(`ul`,{className:`m-0 flex max-h-[60vh] list-none flex-col overflow-y-auto p-0 @2xl:max-h-[calc(100vh-240px)]`,children:[I.length===0&&(0,P.jsx)(`li`,{className:`px-3 py-3 text-sm text-muted`,children:`Nothing matches.`}),I.map(t=>{let i=t.last?.contracts,o=!!i&&i.counts.failed+i.counts.error>0;return(0,P.jsx)(`li`,{children:(0,P.jsxs)(`a`,{href:d(`api-tests`,encodeURIComponent(t.id)),"aria-current":O?.id===t.id?`page`:void 0,className:u(`flex min-h-12 items-center gap-2.5 rounded-[10px] px-3 py-1.5 text-ink no-underline`,O?.id===t.id?`bg-surface-strong hover:text-ink`:`hover:bg-surface-muted hover:text-ink`),children:[n?.job?.running&&n.job.target===t.id?(0,P.jsx)(r,{state:`working`,label:`Working on it`,px:16}):i?o?(0,P.jsx)(a,{size:16,"aria-label":`Failures`,className:`flex-none text-fail`}):(0,P.jsx)(D,{size:16,"aria-label":`Passed`,className:`flex-none text-pass`}):(0,P.jsx)(S,{size:16,"aria-label":`Not run`,className:`flex-none text-muted`}),(0,P.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,P.jsx)(`span`,{className:`truncate text-[14px] font-medium`,children:t.name}),(0,P.jsxs)(`span`,{className:`truncate text-[12px] text-muted`,children:[e(t.contracts,`contract`),t.scenarios?` · ${e(t.scenarios,`scenario`)}`:``,i?` · ${i.counts.passed}/${i.counts.passed+i.counts.failed+i.counts.error} passed`:``]})]}),(0,P.jsx)(`span`,{className:`flex-none text-[12px] text-muted tabular-nums`,children:M(t.at)})]})},t.id)})]})]}),O&&(0,P.jsx)(W,{id:O.id,view:n,busy:c||v,act:T,version:A})]}):(0,P.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,P.jsx)(C,{size:24,"aria-hidden":`true`,className:`text-muted`}),(0,P.jsxs)(`p`,{className:`m-0 max-w-[62ch] leading-relaxed text-ink-2`,children:[`No API contracts yet. Make a set from your OpenAPI, Swagger, WSDL, GraphQL or .proto description`,n.runs.length?`, or from the ${e(n.runs[0].calls,`call`)} the run "${n.runs[0].goal}" saw`:``,`.`]}),(0,P.jsx)(f,{onClick:()=>m(!0),children:`New contract set`})]}))]}),n&&(0,P.jsx)(V,{open:p,onClose:()=>m(!1),view:n,busy:c||v,onMake:e=>T(async()=>{await g.contracts(e),m(!1)})})]})}export{G as ApiTests};
@@ -1,3 +0,0 @@
1
- import{$ as e,An as t,N as n,Nn as r,Q as i,R as a,X as o,Y as s,Z as c,a as l,bt as u,dn as d,n as f,ot as p,pn as m,q as h,r as g,sn as _,t as v}from"./frame-pVqMQRrR.js";import{n as y,r as b}from"./Response-B2lhSJ1u.js";import{C as x,b as S,c as C,d as w,f as ee,h as T,l as E,m as D,p as te,s as O,u as ne,x as k}from"./index-Cu314_Zs.js";import{n as A,t as j}from"./when-CHnpLdYw.js";var M={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};M.node;var re=_(M),N=r(t(),1),P=c();function F({id:e}){let[t,n]=(0,N.useState)([]),[r,c]=(0,N.useState)(null),[u,p]=(0,N.useState)(``),[h,g]=(0,N.useState)(``),[_,v]=(0,N.useState)(!1),x=(0,N.useRef)(null),O=(0,N.useRef)(null),A=(0,N.useRef)(!0),[j,M]=(0,N.useState)(!0);(0,N.useEffect)(()=>{let t=!1,r=0;return n([]),c(null),p(``),(async()=>{for(;!t;)try{let i=await m.events(e,r,r>0);if(t||(p(``),c({title:i.title,state:i.state,profile:i.profile}),i.events.length&&(r=i.events[i.events.length-1].n,n(e=>[...e,...i.events])),(i.state===`closed`||i.state===`failed`)&&!i.events.length))return}catch(e){if(t||(p(e.message),e.status===404))return;await new Promise(e=>setTimeout(e,2e3))}})(),()=>{t=!0}},[e]);let F=(0,N.useMemo)(()=>b(t),[t]),I=(0,N.useMemo)(()=>{let e=new Map;for(let t of F.turns.flatMap(e=>e.changes)){let n=e.get(t.path);e.set(t.path,n?{...n,added:n.added+t.added,removed:n.removed+t.removed}:{path:t.path,added:t.added,removed:t.removed})}return[...e.values()]},[F]),L=(0,N.useMemo)(()=>{let e=[];for(let t of F.turns){for(let n of t.tests)n.testFile&&e.push({label:n.ok?`Test`:`Test (failed)`,path:n.testFile,kind:`test`});for(let n of t.reports)e.push({label:/\.html?$/i.test(n.path)?`Report`:`Run report`,path:n.path,kind:`report`})}return e.filter((t,n)=>e.findIndex(e=>e.path===t.path)===n)},[F]),R=(0,N.useRef)(()=>{});l(F.context||F.usage||I.length||L.length?{context:F.context,usage:F.usage,model:F.model?.name,changes:I,outputs:L,busy:r?.state===`busy`||r?.state===`starting`,...I.length?{onCreatePr:()=>R.current()}:{}}:null);let z=r?.state,B=z===`busy`||z===`starting`,V=z===`closed`||z===`failed`,H=F.turns.at(-1),U=!!H&&!H.outcome&&(H.asks.some(e=>e.answer===void 0)||H.waits.some(e=>e.answer===void 0));(0,N.useEffect)(()=>{let e=document.documentElement,t=()=>window.innerHeight+window.scrollY>=e.scrollHeight-48,n=e=>{A.current=e,M(e)},r=window.scrollY,i=()=>{t()?n(!0):window.scrollY<r-2&&n(!1),r=window.scrollY},a=new ResizeObserver(()=>{A.current&&!t()&&window.scrollTo({top:e.scrollHeight})});return x.current&&a.observe(x.current),O.current&&a.observe(O.current),window.addEventListener(`scroll`,i,{passive:!0}),()=>{a.disconnect(),window.removeEventListener(`scroll`,i)}},[]);let ie=()=>{A.current=!0,M(!0),window.scrollTo({top:document.documentElement.scrollHeight,behavior:`smooth`})},[W,G]=(0,N.useState)(null);(0,N.useEffect)(()=>void d.settings().then(G,()=>{}),[]);let[K,q]=(0,N.useState)(!1),[J,Y]=(0,N.useState)({});(0,N.useEffect)(()=>Y({}),[F.headed,F.writeTests]);let X={...E(W),headed:J.headed??F.headed??!1,code:J.code??F.writeTests??!0},Z=(0,N.useCallback)(async e=>{try{await e()}catch(e){p(e.message)}},[]),Q=te(`chat-${e}`.replace(/[^\w-]/g,``).slice(0,80),e=>{g(e),ee(`reply`)}),$=async t=>{if(t.trim()&&!_){v(!0),A.current=!0,M(!0);try{await m.send(e,t.trim()),g(``),p(``),Q.close()}catch(e){p(e.message)}finally{v(!1)}}};return R.current=()=>{if(r?.state===`busy`||r?.state===`starting`||_)return;let e=I.map(e=>`- ${e.path}`).join(`
2
- `);$(`Open a pull request with the changes you made in this chat:\n${e}\n\nUse a new branch, a clear title and description, and tell me its link.`)},(0,P.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,P.jsxs)(`header`,{className:`sticky top-0 z-20 flex items-center gap-1 border-b border-line-soft bg-bg py-3 pr-16 pl-5`,children:[(0,P.jsx)(f,{}),(0,P.jsx)(`h1`,{className:`m-0 ml-2 min-w-0 flex-1 truncate text-base font-semibold`,children:r?.title||`Chat`}),F.model&&(0,P.jsxs)(`span`,{className:`hidden min-h-9 items-center gap-1.5 rounded-lg px-2 text-sm text-ink-2 sm:inline-flex`,title:`The model this chat uses`,children:[(0,P.jsx)(S,{size:14,fill:`currentColor`,"aria-hidden":`true`,className:`text-accent`}),F.model.name]})]}),(0,P.jsxs)(`main`,{ref:x,className:`mx-auto box-border flex w-full max-w-[960px] flex-auto flex-col gap-8 px-6 pt-8 pb-6`,children:[!r&&!u&&(0,P.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Opening the chat…`}),F.turns.map((t,n)=>(0,P.jsxs)(`section`,{"aria-label":`Message ${n+1}`,className:`flex flex-col gap-5`,children:[(0,P.jsx)(`div`,{className:`ml-auto max-w-[min(85%,640px)] rounded-[18px] bg-surface-strong px-4 py-2.5 text-[15px] leading-relaxed whitespace-pre-wrap text-ink [overflow-wrap:anywhere]`,children:t.user}),(0,P.jsx)(y,{turn:t,live:n===F.turns.length-1&&!V,onAnswer:(t,n)=>Z(()=>m.answer(e,t,n)),onProceed:(t,n)=>Z(()=>m.proceed(e,t,n))})]},t.id)),H?.outcome===`done`&&H.next.length>0&&!B&&!V&&(0,P.jsx)(`div`,{className:`flex flex-wrap gap-2 pl-12`,children:H.next.map(e=>(0,P.jsx)(`button`,{type:`button`,title:e.request===e.label?void 0:e.request,onClick:()=>void $(e.request),className:`inline-flex min-h-10 cursor-pointer items-center rounded-[8px] border-0 bg-surface-strong px-4 text-sm font-medium text-ink-2 hover:bg-line hover:text-ink`,children:e.label},e.label))}),(F.fatal||V&&F.ended)&&(0,P.jsxs)(`div`,{role:`alert`,className:i(`flex flex-col gap-2 rounded-[14px] px-4 py-3 text-sm leading-relaxed`,F.fatal||z===`failed`?`bg-fail-soft text-fail`:`bg-surface-muted text-ink-2`),children:[(0,P.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:F.fatal||F.ended?.message||(z===`failed`?`ForgeQE stopped unexpectedly.`:`This chat has ended.`)}),F.ended?.stderr&&(0,P.jsx)(`pre`,{className:`m-0 max-h-[200px] overflow-auto rounded-lg bg-bg/60 px-3 py-2 font-mono text-[12px] whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:F.ended.stderr.join(`
3
- `)}),(0,P.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[(0,P.jsx)(`a`,{className:o({size:`sm`}),href:a(),children:`Start a new chat`}),F.fatal&&/model|key|sign/i.test(F.fatal)&&(0,P.jsx)(`a`,{className:o({size:`sm`}),href:a(`settings`,`models`),children:`Models`}),F.fatal&&/runtime|engine|setup/i.test(F.fatal)&&(0,P.jsx)(`a`,{className:o({size:`sm`}),href:a(`settings`,`setup`),children:`Set up`})]})]}),F.notes.map((e,t)=>(0,P.jsx)(`p`,{className:`m-0 text-sm text-muted [overflow-wrap:anywhere]`,children:e},t))]}),(0,P.jsx)(`div`,{ref:O,className:`sticky bottom-0 z-10 bg-gradient-to-t from-bg from-70% to-transparent px-6 pt-4 pb-5`,children:(0,P.jsxs)(`div`,{className:`relative mx-auto flex w-full max-w-[880px] flex-col gap-2`,children:[!j&&B&&(0,P.jsxs)(`button`,{type:`button`,onClick:ie,className:`absolute -top-11 left-1/2 inline-flex min-h-8 -translate-x-1/2 cursor-pointer items-center gap-1.5 rounded-[8px] border-0 bg-surface-strong px-3 text-[13px] font-medium text-ink-2 shadow-sm hover:bg-line hover:text-ink`,children:[(0,P.jsx)(re,{size:14,"aria-hidden":`true`}),`Latest activity`]}),(0,P.jsx)(`div`,{"aria-live":`polite`,children:u&&(0,P.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:u})}),(0,P.jsx)(D,{id:`reply`,label:`Reply to ForgeQE`,rows:1,value:h,onChange:g,onSend:()=>void $(h),onStop:()=>Z(()=>m.stop(e)),busy:B&&!U,disabled:V||_||U||Q.running,top:Q.state&&(0,P.jsx)(w,{state:Q.state,onStop:()=>void Q.stop(),onUndo:Q.undo,onClose:Q.close}),left:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`relative`,children:[(0,P.jsxs)(s,{variant:`ghost`,className:`px-2.5 text-[15px]`,disabled:V,"aria-expanded":K,"aria-haspopup":`dialog`,onClick:()=>q(!K),children:[(0,P.jsx)(k,{size:18,strokeWidth:1.8,"aria-hidden":`true`}),`Tools`,(X.headed||!X.code)&&(0,P.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full bg-accent`})]}),(0,P.jsx)(T,{open:K,onClose:()=>q(!1),label:`Tools for this chat`,role:`dialog`,side:`auto`,className:`left-0 w-[min(380px,calc(100vw-48px))]`,children:(0,P.jsx)(C,{tools:X,chat:{model:F.model?.name,provider:F.model?.provider},onChange:t=>{let n={};t.headed!==X.headed&&(n.headed=t.headed),t.code!==X.code&&(n.writeTests=t.code),Object.keys(n).length&&(Y({headed:t.headed,code:t.code}),Z(()=>m.settings(e,n)))}})})]}),(0,P.jsx)(ne,{running:Q.running,disabled:!h.trim()||V||_||U,onClick:()=>void Q.start(h)})]}),placeholder:V?`This chat has ended`:U?`Answer above to go on`:B?`ForgeQE is working…`:`Reply to ForgeQE…`})]})})]})}function I(e){return e.waiting||e.state===`ready`&&e.outcome===`needs_input`?`waiting`:e.state===`busy`||e.state===`starting`?`working`:e.state===`closed`||e.state===`failed`?`ended`:`done`}var L={working:{label:`Working`,tone:`running`},waiting:{label:`Needs you`,tone:`warn`},done:{label:`Your turn`,tone:`pass`},ended:{label:`Ended`,tone:`neutral`}},R=[{id:`all`,label:`All`},{id:`working`,label:`Working`},{id:`waiting`,label:`Needs you`},{id:`done`,label:`Your turn`},{id:`ended`,label:`Ended`}];function z({c:t}){let n=I(t),r=L[n];return(0,P.jsxs)(`a`,{href:a(`chats`,t.id),className:`group grid min-h-14 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-4 rounded-[10px] px-3 py-2 text-ink no-underline hover:bg-surface-muted hover:text-ink @3xl:grid-cols-[minmax(0,1fr)_120px_90px_150px_96px]`,children:[(0,P.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,P.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[n===`waiting`&&(0,P.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-warn`}),(0,P.jsx)(`span`,{className:`truncate text-[14px] font-medium`,children:t.title})]}),(0,P.jsx)(`span`,{className:i(`truncate text-[12.5px]`,t.lastReply?`text-muted`:`text-muted italic`),children:t.lastReply||(n===`working`?`Working on the first answer…`:`No answer yet`)})]}),(0,P.jsx)(`span`,{className:`justify-self-end @3xl:justify-self-start`,children:(0,P.jsx)(O,{tone:r.tone,orb:t.state===`starting`?`waiting`:`working`,children:r.label})}),(0,P.jsx)(`span`,{className:`hidden text-[13px] text-muted tabular-nums @3xl:block`,children:t.turns?e(t.turns,`message`):`—`}),(0,P.jsx)(`span`,{className:`hidden min-w-0 items-center gap-1 truncate text-[13px] text-muted @3xl:flex`,children:t.profile?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(S,{size:11,fill:`currentColor`,"aria-hidden":`true`,className:`flex-none text-accent`}),(0,P.jsx)(`span`,{className:`truncate`,children:t.profile})]}):`Default model`}),(0,P.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:j(t.lastAt||t.started)})]})}var B=50;function V(){let[e,t]=(0,N.useState)(null),[r,c]=(0,N.useState)(``),[l,d]=(0,N.useState)(`all`),[f,_]=(0,N.useState)(``),[y,b]=(0,N.useState)(B);(0,N.useEffect)(()=>b(B),[l,f]),(0,N.useEffect)(()=>{let e=!1,n=()=>m.list().then(n=>!e&&t(n.chats),t=>!e&&c(t.message));n();let r=setInterval(n,5e3);return()=>{e=!0,clearInterval(r)}},[]);let S=(0,N.useMemo)(()=>{let t={all:0,working:0,waiting:0,done:0,ended:0};for(let n of e||[])t.all++,t[I(n)]++;return t},[e]),C=(0,N.useMemo)(()=>{let t=f.toLowerCase().split(/\s+/).filter(Boolean),n=e=>Date.parse(e.lastAt||e.started)||0;return(e||[]).filter(e=>(l===`all`||I(e)===l)&&t.every(t=>`${e.title} ${e.lastReply||``} ${e.profile||``}`.toLowerCase().includes(t))).sort((e,t)=>n(t)-n(e))},[e,l,f]),w=(0,N.useMemo)(()=>{let e=[];for(let t of C.slice(0,y)){let n=A(t.lastAt||t.started),r=e.find(e=>e.day===n);r?r.chats.push(t):e.push({day:n,chats:[t]})}return e},[C,y]);return(0,P.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,P.jsx)(g,{}),(0,P.jsxs)(`main`,{className:i(v,`gap-5`),children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,P.jsx)(h,{icon:u,size:`lg`}),(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,P.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Chats`}),(0,P.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Each one is its own ForgeQE agent in your project folder, for as long as forgeqe web runs.`})]}),(0,P.jsxs)(`a`,{className:i(o({variant:`primary`}),`gap-2`),href:a(),children:[(0,P.jsx)(p,{size:16,"aria-hidden":`true`}),`New chat`]})]}),e&&e.length>0&&(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`div`,{role:`radiogroup`,"aria-label":`Show`,className:`flex flex-wrap gap-1 rounded-[10px] bg-surface-strong p-1`,children:R.map(e=>(0,P.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":l===e.id,onClick:()=>d(e.id),className:i(`inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-[7px] border-0 px-3 text-sm font-medium`,l===e.id?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),children:[e.label,(0,P.jsx)(`span`,{className:i(`tabular-nums text-[12px]`,e.id===`waiting`&&S.waiting?`text-warn`:`text-muted`),children:S[e.id]})]},e.id))}),(0,P.jsxs)(`div`,{className:`relative min-w-0 flex-[1_1_240px]`,children:[(0,P.jsx)(x,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted`}),(0,P.jsx)(n,{type:`search`,"aria-label":`Find a chat`,value:f,placeholder:`Find a chat`,onChange:e=>_(e.target.value),className:`pl-9`})]})]}),r&&(0,P.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:r}),!e&&!r&&(0,P.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading…`}),e&&e.length===0&&(0,P.jsxs)(`div`,{className:`flex flex-col items-center gap-4 rounded-[18px] border border-dashed border-line px-6 py-14 text-center`,children:[(0,P.jsx)(h,{icon:u,size:`lg`}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(`span`,{className:`text-lg font-semibold`,children:`No chats yet`}),(0,P.jsx)(`span`,{className:`max-w-[48ch] text-sm text-muted`,children:`Ask ForgeQE to run test cases, explore a journey, write a test or review requirements. Each chat shows up here while forgeqe web runs.`})]}),(0,P.jsx)(`a`,{className:o({variant:`primary`}),href:a(),children:`Start a chat`})]}),e&&e.length>0&&C.length===0&&(0,P.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No chat matches.`}),C.length>0&&(0,P.jsxs)(`div`,{className:`@container rounded-[14px] border border-line-soft bg-bg`,children:[(0,P.jsxs)(`div`,{"aria-hidden":`true`,className:`hidden grid-cols-[minmax(0,1fr)_120px_90px_150px_96px] gap-x-4 border-b border-line-soft px-6 py-2 text-[12px] font-medium text-muted @3xl:grid`,children:[(0,P.jsx)(`span`,{children:`Chat`}),(0,P.jsx)(`span`,{children:`Status`}),(0,P.jsx)(`span`,{children:`Messages`}),(0,P.jsx)(`span`,{children:`Model`}),(0,P.jsx)(`span`,{className:`text-right`,children:`Last activity`})]}),w.map(e=>(0,P.jsxs)(`section`,{"aria-labelledby":`day-${e.day}`,children:[(0,P.jsxs)(`h2`,{id:`day-${e.day}`,className:`sticky top-0 z-[1] m-0 border-b border-line-soft bg-surface-muted/95 px-6 py-1.5 text-[12px] font-semibold tracking-wide text-muted uppercase backdrop-blur`,children:[e.day,` `,(0,P.jsxs)(`span`,{className:`font-normal tabular-nums`,children:[`· `,e.chats.length]})]}),(0,P.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-1.5`,children:e.chats.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsx)(z,{c:e})},e.id))})]},e.day)),C.length>y&&(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-line-soft px-6 py-3 text-[13px] text-muted`,children:[(0,P.jsxs)(`span`,{children:[`Showing `,y,` of `,C.length]}),(0,P.jsxs)(s,{size:`sm`,onClick:()=>b(y+B),children:[`Show `,Math.min(B,C.length-y),` more`]})]})]})]})]})}export{F as Chat,V as Chats};
@@ -1 +0,0 @@
1
- import{$ as e,An as t,N as n,Nn as r,P as i,Q as a,R as o,Y as s,Z as c,bt as l,gn as u,in as d,p as f,pn as p,q as m,qt as h,r as g,t as _,x as v}from"./frame-pVqMQRrR.js";import{t as y}from"./circle-dashed-ODPnEo8f.js";import{n as b}from"./markdown-4IJa7wkI.js";import{C as x,S,s as C}from"./index-Cu314_Zs.js";var w=r(t(),1),T=c(),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 p.start(e,{});location.hash=o(`chats`,t)}catch(e){t(e.message)}}function k({f:t,onScope:n,busy:r}){let[c,d]=(0,w.useState)(null),[f,p]=(0,w.useState)(``),[m,h]=(0,w.useState)(``);(0,w.useEffect)(()=>{u.detail(t.id).then(d,e=>p(e.message))},[t.id]);let g=t.gaps.filter(e=>!e.optional),_=t.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:a(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:o(`settings`,e.settings),className:`inline-flex items-center gap-1 self-start text-[13px] font-medium`,children:[(0,T.jsx)(S,{size:13,"aria-hidden":`true`}),`Set it up in Settings, `,D[e.settings]||e.settings]})]},n))})]},t):null),t.inputs.length>0&&(0,T.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[`From your request: `,t.inputs.join(`; `),`.`]}),f&&(0,T.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:f}),c&&(0,T.jsxs)(T.Fragment,{children:[c.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:c.examples.slice(0,4).map(e=>(0,T.jsxs)(s,{size:`sm`,disabled:t.state===`needs_setup`,title:t.state===`needs_setup`?`Set it up first`:`Start a chat with this request`,onClick:()=>void O(e,h),className:`h-auto min-h-8 max-w-full py-1.5 text-left whitespace-normal`,children:[(0,T.jsx)(l,{size:14,"aria-hidden":`true`,className:`flex-none`}),e]},e))}),m&&(0,T.jsx)(`span`,{className:`text-[13px] text-fail`,children:m})]}),c.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:c.limits.map(e=>(0,T.jsx)(`li`,{children:e},e))})]}),c.docs.length>0&&(0,T.jsxs)(`details`,{children:[(0,T.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:[`How it works (`,e(c.docs.length,`section`),`)`]}),(0,T.jsx)(`div`,{className:`mt-2 flex flex-col gap-4`,children:c.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: `,c.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)(i,{value:t.scope,disabled:r,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[e,t]=(0,w.useState)(null),[r,i]=(0,w.useState)(``),[o,s]=(0,w.useState)(``),[c,l]=(0,w.useState)(`all`),[p,b]=(0,w.useState)(``),[S,D]=(0,w.useState)(!1),O=(0,w.useCallback)(()=>u.view().then(t,e=>i(e.message)),[]);(0,w.useEffect)(()=>void O(),[O]);let A=(0,w.useMemo)(()=>{let t=p.toLowerCase().split(/\s+/).filter(Boolean);return(e?.areas||[]).map(e=>({...e,features:e.features.filter(n=>(c===`all`||(c===`ready`?n.state!==`needs_setup`:n.state!==`ready`))&&t.every(t=>`${n.title} ${n.summary} ${e.area}`.toLowerCase().includes(t)))})).filter(e=>e.features.length)},[e,c,p]),j=async(e,n)=>{D(!0);try{t(await u.scope(e,n)),i(``)}catch(e){i(e.message)}finally{D(!1)}},M=e?.counts;return(0,T.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,T.jsx)(g,{}),(0,T.jsxs)(`main`,{className:a(_,`flex-auto gap-5`),children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,T.jsx)(m,{icon:d,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.`}),r&&(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:r}),!e&&!r&&(0,T.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),e&&M&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,T.jsx)(f,{icon:d,label:`Ready`,value:String(M.ready)}),(0,T.jsx)(f,{icon:h,label:`Some parts need setup`,value:String(M.partial)}),(0,T.jsx)(f,{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":c===e,onClick:()=>l(e),className:a(`min-h-8 cursor-pointer rounded-[7px] border-0 px-3.5 text-sm font-medium`,c===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)(x,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted`}),(0,T.jsx)(n,{type:`search`,"aria-label":`Find a feature`,value:p,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(e=>(0,T.jsxs)(`section`,{"aria-labelledby":`area-${e.area}`,children:[(0,T.jsx)(`h2`,{id:`area-${e.area}`,className:`m-0 mb-1 text-base font-semibold`,children:e.area}),e.features.map(e=>(0,T.jsx)(v,{title:e.title,meta:(0,T.jsx)(`span`,{className:a(o!==e.id&&`line-clamp-2`),children:e.summary}),open:o===e.id,onToggle:()=>s(o===e.id?``:e.id),state:(0,T.jsxs)(`span`,{className:`flex flex-wrap items-center justify-end gap-1.5`,children:[e.scope!==`auto`&&(0,T.jsx)(C,{tone:`neutral`,icon:!1,children:e.scope===`always`?`Always given`:`Off here`}),(0,T.jsx)(C,{tone:E[e.state].tone,icon:e.state!==`needs_setup`,children:E[e.state].label})]}),children:(0,T.jsx)(k,{f:e,busy:S,onScope:t=>void j(e.id,t)})},e.id))]},e.area)),e.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:e.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{An as e,Ct as t,I as n,J as r,K as i,L as a,N as o,Nn as s,P as c,Q as l,R as u,Tn as d,Y as f,Z as p,Zt as m,_t as h,at as g,dt as _,gt as v,jt as y,mt as b,nn as x,p as S,q as C,r as w,rn as T,sn as E,t as D,yn as O}from"./frame-pVqMQRrR.js";import{n as k,t as A}from"./markdown-4IJa7wkI.js";import{t as j}from"./external-link-S8aL0KIN.js";import{t as M}from"./terminal-Cb_EtWVl.js";import{t as N}from"./trash-zYYpxA_X.js";import{D as P,T as F,k as I,s as L}from"./index-Cu314_Zs.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 ee=E(R),z={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`}]]};z.node;var B=E(z),V={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`}]]};V.node;var H=E(V),U={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`}]]};U.node;var W=E(U),G=s(e(),1),K=p(),q={monitor:`Monitor`,suite:`Suite`,run:`Browser run`,heal:`Heal`,"pr-tests":`PR tests`,pack:`Pack`,pipeline:`Pipeline watch`},J={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`}},Y=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`})},X=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 Z(e){return e.running?J.running:e.enabled?e.last?J[e.last.status]:{label:`Not run yet`,tone:`neutral`}:{label:`Disabled`,tone:`neutral`}}var Q={pass:`bg-pass`,fail:`bg-fail`,warn:`bg-warn`,running:`bg-accent`,neutral:`bg-line`};function $({label:e,icon:t,children:n}){return(0,K.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,K.jsxs)(`span`,{className:`flex w-[170px] flex-none items-center gap-2 text-sm text-muted`,children:[t&&(0,K.jsx)(t,{size:16,"aria-hidden":`true`,className:`flex-none`}),e]}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 text-sm [overflow-wrap:anywhere]`,children:n})]})}function te({m:e,rounds:n}){let[r,i]=(0,G.useState)(``);return(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsxs)(`h3`,{className:`m-0 mb-1 flex items-center gap-2 text-base font-semibold`,children:[(0,K.jsx)(P,{size:18,"aria-hidden":`true`,className:`text-accent`}),`Monitor`]}),(0,K.jsx)($,{icon:t,label:`Checks`,children:e.checks.length?(0,K.jsx)(k,{text:e.checks.map(e=>`\`${e.replace(/`/g,``)}\``).join(`, `),className:`text-sm [&_p]:my-0`}):`The checks in forgeqe.yaml (monitor.checks)`}),(0,K.jsxs)($,{icon:T,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,K.jsx)($,{icon:_,label:`Alerts go to`,children:e.alerts.length?e.alerts.join(` and `):`Nowhere yet: add Teams or email in Settings, Monitor`}),(0,K.jsxs)($,{icon:v,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,K.jsx)($,{icon:y,label:`Rounds kept in`,children:(0,K.jsx)(A,{path:e.outDir})}),(0,K.jsx)(`p`,{className:`m-0 border-t border-line-soft py-2.5 text-sm`,children:(0,K.jsx)(`a`,{href:u(`settings`,`monitor`),children:`Change the monitor in Settings`})}),(0,K.jsx)(`h4`,{className:`m-0 mt-3 mb-1 text-sm font-semibold`,children:`Latest rounds`}),r&&(0,K.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:r}),n.length===0?(0,K.jsx)(`p`,{className:`m-0 border-t border-line-soft py-3 text-sm text-muted`,children:`No rounds yet.`}):(0,K.jsx)(`ul`,{className:`m-0 list-none p-0`,children:n.slice(0,8).map(e=>(0,K.jsxs)(`li`,{className:`flex min-h-[48px] items-center gap-3 border-t border-line-soft py-2`,children:[(0,K.jsxs)(L,{tone:e.counts.failed?`fail`:`pass`,children:[e.counts.passed,`/`,e.counts.total,` passed`]}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:Y(e.startedAt)}),e.report?(0,K.jsxs)(f,{size:`sm`,"aria-label":`Open the report of the round of ${Y(e.startedAt)} in a new tab`,onClick:async()=>i(await a(e.report)),children:[(0,K.jsx)(j,{size:14,"aria-hidden":`true`}),`Open report`]}):(0,K.jsx)(A,{path:e.folder})]},e.key))})]})}function ne({jobId:e,run:t}){let[n,r]=(0,G.useState)(null),[i,a]=(0,G.useState)(``);(0,G.useEffect)(()=>{let n=!1;r(null);let i=()=>O.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=[`**${J[t.status].label}**${t.endedAt?` after ${X(t)}`:``}${t.exitCode!==void 0&&t.exitCode!==null?`, exit ${t.exitCode}`:``}. Started ${Y(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,K.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[12px] border border-line-soft bg-surface-muted px-4 py-3`,children:[i&&(0,K.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:i}),!n&&!i?(0,K.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Reading its output…`}):(0,K.jsx)(k,{text:c,className:`text-sm [&_pre]:max-h-[320px] [&_pre]:overflow-auto`})]})}function re({job:e,rounds:t,busy:n,act:r}){let[a,o]=(0,G.useState)(null),[s,c]=(0,G.useState)(null),[l,u]=(0,G.useState)(!1),d=`${e.running?.id}|${e.last?.id}|${e.last?.status}`;(0,G.useEffect)(()=>{let t=!1;return O.detail(e.id).then(e=>{t||(o(e.runs),c(t=>t??e.runs[0]?.id??null))},()=>{}),()=>{t=!0}},[e.id,d]),(0,G.useEffect)(()=>{c(null),u(!1)},[e.id]);let p=Z(e),_=a?.filter(e=>e.status===`passed`).length??0,v=a?.filter(e=>e.status!==`running`).length??0;return(0,K.jsxs)(`section`,{"aria-labelledby":`job-h`,className:`flex min-w-0 flex-1 flex-col gap-5`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-3`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,K.jsx)(`h2`,{id:`job-h`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:e.name}),(0,K.jsxs)(`span`,{className:`text-sm text-muted`,children:[q[e.kind]||e.kind,` · `,e.schedule]})]}),(0,K.jsx)(L,{tone:p.tone,children:p.label}),e.running?(0,K.jsxs)(f,{disabled:n,onClick:()=>r(`stop`),children:[(0,K.jsx)(g,{size:14,fill:`currentColor`,"aria-hidden":`true`}),`Stop`]}):(0,K.jsxs)(f,{variant:`primary`,disabled:n,onClick:()=>r(`run`),children:[(0,K.jsx)(h,{size:16,"aria-hidden":`true`}),`Run now`]})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,K.jsx)(S,{icon:b,label:`Runs kept`,value:String(a?.length??`–`)}),(0,K.jsx)(S,{icon:I,label:`Passed`,value:v?`${Math.round(_/v*100)}%`:`–`,note:v?`${_} of ${v}`:void 0}),(0,K.jsx)(S,{icon:m,label:`Next run`,value:e.nextAt?new Date(e.nextAt).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`}):`–`,note:e.nextAt?Y(e.nextAt):e.enabled?void 0:`Disabled`})]}),(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsx)($,{icon:M,label:`Runs`,children:(0,K.jsx)(k,{text:`\`${e.command.replace(/`/g,``)}\``,className:`text-sm [&_p]:my-0`})}),(0,K.jsx)($,{icon:m,label:`When`,children:e.schedule}),(0,K.jsx)($,{icon:B,label:`Enabled`,children:(0,K.jsx)(i,{checked:e.enabled,disabled:n,onChange:e=>r(e?`enable`:`disable`),label:`${e.name} enabled`})}),(0,K.jsxs)($,{icon:W,label:`Stopped after`,children:[e.timeoutMs?e.timeoutMs%36e5==0?`${e.timeoutMs/36e5} hour${e.timeoutMs===36e5?``:`s`}`:`${Math.round(e.timeoutMs/6e4)} minutes`:`the service's default`,` of running`]}),(0,K.jsx)($,{icon:x,label:`Tells the team`,children:e.notify?`When it fails, recovers or ends (the notify channels that take job events)`:e.kind===`monitor`?`The monitor sends its own alerts`:`No`}),(0,K.jsx)($,{icon:H,label:`Investigates failures`,children:e.investigate?`Yes, on branches of their own`:`No`}),(0,K.jsxs)($,{icon:ee,label:`Added`,children:[Y(e.createdAt),` `,e.by===`agent`?`by ForgeQE's agent, after you agreed`:`from the command line or here`]})]}),e.monitor&&(0,K.jsx)(te,{m:e.monitor,rounds:t}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`h3`,{className:`m-0 mb-1 text-base font-semibold`,children:`Runs`}),a?a.length===0?(0,K.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,K.jsx)(`ul`,{className:`m-0 list-none p-0`,children:a.map(t=>(0,K.jsxs)(`li`,{className:`border-t border-line-soft`,children:[(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":s===t.id,onClick:()=>c(s===t.id?null:t.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,K.jsx)(L,{tone:J[t.status].tone,children:J[t.status].label}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:[Y(t.startedAt),(0,K.jsxs)(`span`,{className:`text-muted`,children:[` `,`· `,t.reason===`asked`?`asked for`:`scheduled`,X(t)?` · ${X(t)}`:``]})]}),t.summary?.length?(0,K.jsx)(`span`,{className:`hidden max-w-[40%] truncate text-[13px] text-muted sm:inline`,children:t.summary.at(-1)}):null]}),s===t.id&&(0,K.jsx)(`div`,{className:`pb-3`,children:(0,K.jsx)(ne,{jobId:e.id,run:t})})]},t.id))}):(0,K.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading…`})]}),(0,K.jsx)(`div`,{className:`flex flex-wrap items-center gap-2 border-t border-line-soft pt-4`,children:l?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{className:`text-sm text-ink-2`,children:[`Remove `,e.name,`? Its runs and logs go with it.`]}),(0,K.jsx)(f,{disabled:n,onClick:()=>r(`remove`),className:`border-fail text-fail hover:bg-fail-soft`,children:`Remove`}),(0,K.jsx)(f,{onClick:()=>u(!1),children:`Keep it`})]}):(0,K.jsxs)(f,{variant:`ghost`,onClick:()=>u(!0),className:`text-fail`,children:[(0,K.jsx)(N,{size:16,"aria-hidden":`true`}),`Remove this job`]})})]})}function ie({open:e,onClose:t,commands:r,initial:a,onAdded:s}){let[l,u]=(0,G.useState)(``),[d,p]=(0,G.useState)(`suite`),[m,h]=(0,G.useState)(``),[g,_]=(0,G.useState)(`every`),[v,y]=(0,G.useState)(`30m`),[b,x]=(0,G.useState)(`0 2 * * 1-5`),[S,C]=(0,G.useState)(!0),[w,T]=(0,G.useState)(``),[E,D]=(0,G.useState)(!1);(0,G.useEffect)(()=>{e&&(u(a?.name??``),p(a?.command??`suite`),h(a?.args??``),_(`every`),y(a?.every??`30m`),C(a?.command!==`monitor`),T(``))},[e,a]);let k=async()=>{D(!0),T(``);try{s(await O.add({name:l.trim(),command:d,args:m,...g===`every`?{every:v}:g===`cron`?{cron:b}:{now:!0},notify:S}),l.trim())}catch(e){T(e.message)}finally{D(!1)}},A=`flex flex-col gap-1.5 py-3`;return(0,K.jsx)(n,{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,K.jsxs)(K.Fragment,{children:[w&&(0,K.jsx)(`span`,{role:`alert`,className:`mr-auto self-center text-sm text-fail [overflow-wrap:anywhere]`,children:w}),(0,K.jsx)(f,{onClick:t,children:`Cancel`}),(0,K.jsx)(f,{variant:`primary`,disabled:E||!l.trim(),onClick:()=>void k(),children:E?`Adding…`:`Add job`})]}),children:(0,K.jsxs)(`div`,{className:`flex flex-col pt-3`,children:[(0,K.jsxs)(`div`,{className:A,children:[(0,K.jsx)(`label`,{htmlFor:`job-name`,className:`font-medium`,children:`Name`}),(0,K.jsx)(o,{id:`job-name`,value:l,spellCheck:!1,placeholder:`nightly-smoke`,onChange:e=>u(e.target.value)}),(0,K.jsx)(`span`,{className:`text-sm text-muted`,children:`Letters, digits and dashes.`})]}),(0,K.jsxs)(`div`,{className:A,children:[(0,K.jsx)(`label`,{htmlFor:`job-command`,className:`font-medium`,children:`Runs`}),(0,K.jsx)(c,{id:`job-command`,value:d,onChange:e=>p(e.target.value),children:r.map(e=>(0,K.jsxs)(`option`,{value:e,children:[`forgeqe `,e]},e))})]}),(0,K.jsxs)(`div`,{className:A,children:[(0,K.jsx)(`label`,{htmlFor:`job-args`,className:`font-medium`,children:`With`}),(0,K.jsx)(o,{id:`job-args`,value:m,spellCheck:!1,placeholder:d===`monitor`?`Empty: the checks in forgeqe.yaml`:`checks/smoke.yaml --parallel 2`,onChange:e=>h(e.target.value),className:`font-mono text-[13px]`}),(0,K.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,K.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0 py-3`,children:[(0,K.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,K.jsxs)(`label`,{className:`flex min-h-10 cursor-pointer items-center gap-3`,children:[(0,K.jsx)(`input`,{type:`radio`,name:`job-when`,checked:g===e,onChange:()=>_(e),className:`size-4 accent-accent`}),(0,K.jsx)(`span`,{className:`flex-none`,children:t}),e===`every`&&g===`every`&&(0,K.jsx)(o,{"aria-label":`Every`,value:v,onChange:e=>y(e.target.value),placeholder:`30m`,className:`max-w-[120px] font-mono text-[13px]`}),e===`cron`&&g===`cron`&&(0,K.jsx)(o,{"aria-label":`Cron schedule`,value:b,onChange:e=>x(e.target.value),className:`max-w-[180px] font-mono text-[13px]`})]},e))]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-4 py-3`,children:[(0,K.jsxs)(`span`,{className:`flex flex-1 flex-col gap-0.5`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:`Tell the team`}),(0,K.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,K.jsx)(i,{checked:S,onChange:C,label:`Tell the team`})]})]})})}function ae({sub:e}){let[t,n]=(0,G.useState)(null),[i,a]=(0,G.useState)([]),[o,s]=(0,G.useState)(``),[c,p]=(0,G.useState)(!1),[h,g]=(0,G.useState)(null),_=(0,G.useCallback)(()=>{O.list().then(e=>{n(e),s(``)},e=>s(e.message))},[]);(0,G.useEffect)(_,[_]),(0,G.useEffect)(()=>{d.list().then(e=>a(e.rows.filter(e=>e.scope===`monitor`)),()=>{})},[t?.jobs.map(e=>e.last?.id).join()]);let v=t?.jobs.some(e=>e.running);(0,G.useEffect)(()=>{let e=setInterval(_,v?3e3:2e4);return()=>clearInterval(e)},[_,v]);let y=e?decodeURIComponent(e):``,b=t?.jobs.find(e=>e.id===y)||t?.jobs[0],x=(0,G.useMemo)(()=>t?.jobs.filter(e=>e.kind===`monitor`)??[],[t]),S=(0,G.useMemo)(()=>t?.jobs.filter(e=>e.kind!==`monitor`)??[],[t]),T=async e=>{if(b){p(!0),s(``);try{n(e===`remove`?await O.remove(b.id):await O.act(b.id,e)),e===`remove`&&(location.hash=u(`jobs`))}catch(e){s(e.message)}finally{p(!1)}}},E=e=>{let t=Z(e),n=b?.id===e.id;return(0,K.jsx)(`li`,{children:(0,K.jsxs)(`a`,{href:u(`jobs`,encodeURIComponent(e.id)),"aria-current":n?`page`:void 0,className:l(`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,K.jsx)(r,{label:t.label,px:16}):(0,K.jsx)(`span`,{"aria-label":t.label,className:l(`size-2.5 flex-none rounded-full`,Q[t.tone])}),(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,K.jsx)(`span`,{className:`truncate text-[15px] font-medium`,children:e.name}),(0,K.jsx)(`span`,{className:`truncate text-[13px] text-muted`,children:[t.label,e.schedule,e.nextAt&&e.enabled?`next ${Y(e.nextAt)}`:``].filter(Boolean).join(` · `)})]})]})},e.id)};return(0,K.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,K.jsx)(w,{}),(0,K.jsxs)(`main`,{className:l(D,`@container flex-auto gap-4`),children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,K.jsx)(C,{icon:m,size:`lg`}),(0,K.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Jobs`}),t&&(0,K.jsx)(L,{tone:t.service.running?`pass`:`neutral`,children:t.service.running?`Service running since ${Y(t.service.startedAt)}`:`Service stopped: jobs wait until it starts`}),(0,K.jsx)(`div`,{className:`flex-auto`}),(0,K.jsxs)(f,{variant:`primary`,disabled:!t,onClick:()=>g({}),children:[(0,K.jsx)(F,{size:16,"aria-hidden":`true`}),`Add a job`]})]}),(0,K.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,K.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,K.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t?.monitor&&!t.monitor.scheduled&&(0,K.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,K.jsx)(P,{size:20,"aria-hidden":`true`,className:`flex-none text-accent`}),(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-0.5 text-sm`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:`The monitor in forgeqe.yaml is not scheduled`}),(0,K.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,K.jsx)(f,{onClick:()=>g({name:`monitor`,command:`monitor`,args:``,every:t.monitor.every}),children:`Schedule it`})]}),t&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-6 @2xl:flex-row @2xl:items-start @2xl:gap-8`,children:[(0,K.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,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-2 px-3 text-[13px] font-medium text-muted`,children:[(0,K.jsx)(P,{size:14,"aria-hidden":`true`}),`Monitoring (`,x.length,`)`]}),x.length?(0,K.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:x.map(E)}):(0,K.jsx)(`p`,{className:`m-0 px-3 py-2 text-sm text-muted`,children:`No monitor jobs.`})]}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-2 px-3 text-[13px] font-medium text-muted`,children:[(0,K.jsx)(m,{size:14,"aria-hidden":`true`}),`Other jobs (`,S.length,`)`]}),S.length?(0,K.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:S.map(E)}):(0,K.jsx)(`p`,{className:`m-0 px-3 py-2 text-sm text-muted`,children:`None.`})]}),t.events.length>0&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`span`,{className:`px-3 text-[13px] font-medium text-muted`,children:`Recent activity`}),(0,K.jsx)(k,{text:t.events.slice(0,12).map(e=>`- \`${Y(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,K.jsx)(re,{job:b,rounds:i,busy:c,act:T}):(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,K.jsx)(m,{size:24,"aria-hidden":`true`,className:`text-muted`}),(0,K.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,K.jsx)(f,{onClick:()=>g({}),children:`Add a job`})]})]})]}),(0,K.jsx)(ie,{open:!!h,onClose:()=>g(null),commands:t?.commands??[],initial:h??void 0,onAdded:(e,t)=>{n(e),g(null);let r=e.jobs.find(e=>e.name===t);r&&(location.hash=u(`jobs`,encodeURIComponent(r.id)))}})]})}export{ae as Jobs};
@@ -1 +0,0 @@
1
- import{An as e,Kt as t,N as n,Nn as r,Q as i,R as a,Sn as o,Y as s,Z as c,bt as l,kt as u,m as d,on as f,pn as p,q as m,r as h,rt as g,sn as _,t as v}from"./frame-pVqMQRrR.js";import{t as y}from"./circle-dashed-ODPnEo8f.js";import{i as b,t as x}from"./markdown-4IJa7wkI.js";import{t as S}from"./external-link-S8aL0KIN.js";import{n as C,t as w}from"./trending-up-Cxt0Wl0_.js";import{k as T,n as E,r as D,s as O,t as k}from"./index-Cu314_Zs.js";import{n as A,t as j}from"./when-CHnpLdYw.js";var M={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`}]]};M.node;var N=_(M),P={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`}]]};P.node;var F=_(P),I={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`}]]};I.node;var L=_(I),R=r(e(),1),z=c(),B=[`critical`,`serious`,`moderate`,`minor`],V={critical:`fail`,serious:`fail`,moderate:`warn`,minor:`neutral`},H=[{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`}],U={same:{label:`Same`,tone:`pass`},changed:{label:`Changed`,tone:`warn`},new:{label:`New baseline`,tone:`neutral`},no_baseline:{label:`No baseline`,tone:`neutral`}},W=e=>new Date(e).toLocaleString([],{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}),G=(e,t)=>t?e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`:e.toFixed(3).replace(/0+$/,``).replace(/\.$/,``),K=(e,t)=>`${e} ${t}${e===1?``:`s`}`,q=e=>{try{let t=new URL(e);return`${t.host}${t.pathname}${t.search}`}catch{return e}};function J(e){let t=[];return e.a11y&&t.push(e.a11y.failed?`${K(e.a11y.failed,`rule`)} failed`:`WCAG clean`),e.perf.over&&t.push(`${K(e.perf.over,`page`)} slow`),e.visual?.changed&&t.push(`${e.visual.changed} changed`),e.captured&&t.push(`not compared`),t.join(` · `)||`measured`}var Y=e=>!!(e.breaches||e.a11y?.failed||e.perf.over||e.visual?.changed),X=25;function Z({run:e,standard:t}){let n=e.report,[r,i]=(0,R.useState)(null),[a,o]=(0,R.useState)(`all`);if(!n?.accessibility.pages)return(0,z.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},...B.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,z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,z.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[t,` with `,n.engine||`axe`,`: `,K(s.passed.length,`rule`),` passed, `,s.failed.length,` failed, on `,K(s.pages,`page`),`. `,n.budgets.accessibility?c.length?`${K(c.length,`budget`)} exceeded.`:`Within the budget.`:`No budget set, so nothing here fails the run.`]}),c.map((e,t)=>(0,z.jsxs)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:[q(e.page),`: `,e.text]},t)),s.failed.length?(0,z.jsxs)(z.Fragment,{children:[u.length>2&&(0,z.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,z.jsx)(k,{items:u,value:a,onChange:o})}),(0,z.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:l.map(t=>(0,z.jsx)(ee,{f:t,examples:e.examples[t.rule]??[],open:r===t.rule,onToggle:()=>i(r===t.rule?null:t.rule)},t.rule))})]}):(0,z.jsx)(`p`,{className:`m-0 text-sm text-pass`,children:`No rule failed on the pages this run visited.`})]})}function ee({f:e,examples:t,open:n,onToggle:r}){return(0,z.jsxs)(`li`,{className:`border-t border-line-soft first:border-t-0`,children:[(0,z.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,z.jsx)(O,{tone:V[e.impact],className:`w-[88px] flex-none justify-center`,children:e.impact}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,z.jsx)(`span`,{className:`text-sm [overflow-wrap:anywhere]`,children:e.help}),(0,z.jsxs)(`span`,{className:`truncate text-[12px] text-muted`,children:[e.rule,e.wcag?` · WCAG ${e.wcag}${e.level?` (${e.level})`:``}`:``,` · `,K(e.count,`element`),` on `,K(e.pages,`page`)]})]})]}),n&&(0,z.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,z.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-[10px] bg-surface-muted p-2.5`,children:[(0,z.jsxs)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:[q(e.page),e.target?` · ${e.target}`:``]}),e.html&&(0,z.jsx)(`code`,{className:`font-mono text-[12px] whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:e.html})]},t)):(0,z.jsx)(`span`,{className:`text-muted`,children:`No elements were kept for this rule.`}),e.helpUrl&&b(e.helpUrl)===`web`&&(0,z.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,z.jsx)(S,{size:13,"aria-hidden":`true`})]})]})]})}function te({run:e}){let t=e.report;if(!t?.performance.pages.length)return(0,z.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,z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,z.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Core Web Vitals per page against Google's thresholds: `,(0,z.jsx)(`span`,{className:`text-pass`,children:`good`}),`, `,(0,z.jsx)(`span`,{className:`text-warn`,children:`needs improvement`}),`, `,(0,z.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,z.jsx)(`div`,{className:`overflow-x-auto`,children:(0,z.jsxs)(`table`,{className:`w-full min-w-[640px] border-collapse text-sm`,children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{className:`text-left text-[12px] text-muted`,children:[(0,z.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:`Page`}),H.map(e=>(0,z.jsx)(`th`,{className:`px-2 py-2 text-right font-medium`,children:e.label},e.key)),(0,z.jsx)(`th`,{className:`py-2 pl-2 text-right font-medium`,children:`Requests`})]})}),(0,z.jsx)(`tbody`,{children:t.performance.pages.map((e,t)=>(0,z.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,z.jsxs)(`td`,{className:`py-2 pr-3`,children:[(0,z.jsx)(`span`,{className:`block font-mono text-[12px] [overflow-wrap:anywhere]`,children:q(e.url)}),e.over.length>0&&(0,z.jsx)(`span`,{className:`text-[12px] text-fail`,children:e.over.join(`, `)})]}),H.map(t=>{let a=e[t.key];return(0,z.jsxs)(`td`,{className:i(`px-2 py-2 text-right tabular-nums`,typeof a==`number`&&t.good!==1/0?r[n(a,t)]:typeof a==`number`?`text-ink-2`:`text-muted`),children:[typeof a==`number`?G(a,t.unit):`–`,typeof a==`number`&&t.good!==1/0&&(0,z.jsxs)(`span`,{className:`sr-only`,children:[` (`,n(a,t),`)`]})]},t.key)}),(0,z.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,R.useState)(``),[s,c]=(0,R.useState)(!1);return(0,R.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,z.jsxs)(`figure`,{className:`m-0 flex min-w-0 flex-col gap-1.5`,children:[(0,z.jsx)(`figcaption`,{className:`text-[12px] font-medium text-muted`,children:r}),i?(0,z.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,z.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,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(N,{size:14,"aria-hidden":`true`}),` Not available`]}):`Loading…`})]})}function ne({run:e,budget:t,onChange:r}){let[a,c]=(0,R.useState)(null),[l,u]=(0,R.useState)(``),[d,f]=(0,R.useState)(!1),[p,m]=(0,R.useState)(``),[h,g]=(0,R.useState)(null),_=e.visual?.pages??[],v=_.find(e=>e.status===`changed`)?.index??null;(0,R.useEffect)(()=>g(v),[e.id,v]);let y=async e=>{f(!0),m(``);try{r(await e()),c(null),u(``)}catch(e){m(e.message)}finally{f(!1)}};if(!e.visual)return e.captured?(0,z.jsxs)(`div`,{className:`flex flex-col items-start gap-3`,children:[(0,z.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[`This run captured `,K(e.captured,`page`),` but they were not compared with the baselines yet.`]}),(0,z.jsxs)(s,{variant:`primary`,disabled:d,onClick:()=>y(()=>o.compare(e.id)),children:[(0,z.jsx)(L,{size:16,"aria-hidden":`true`}),`Compare with the baselines`]}),p&&(0,z.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:p})]}):(0,z.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 b=_.filter(e=>e.status===`changed`);return(0,z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.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).`]}),b.length>1&&(0,z.jsxs)(s,{disabled:d,onClick:()=>c(b.map(e=>e.url)),children:[`Approve all `,b.length,` changes`]})]}),a&&(0,z.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,z.jsxs)(`span`,{className:`font-medium`,children:[`Make this run's capture the baseline of `,a.length===1?q(a[0]):K(a.length,`page`),`?`]}),(0,z.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,z.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[`Why it changed (kept with the baseline)`,(0,z.jsx)(n,{value:l,maxLength:300,placeholder:`New checkout banner`,onChange:e=>u(e.target.value),className:`max-w-[480px] bg-bg`})]}),(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,z.jsxs)(s,{variant:`primary`,disabled:d,onClick:()=>y(()=>o.approve(e.id,a,l.trim()||void 0)),children:[(0,z.jsx)(T,{size:16,"aria-hidden":`true`}),`Approve`]}),(0,z.jsx)(s,{onClick:()=>c(null),children:`Cancel`})]})]}),p&&(0,z.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:p}),(0,z.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:_.map(t=>(0,z.jsxs)(`li`,{className:`border-t border-line-soft first:border-t-0`,children:[(0,z.jsxs)(`button`,{type:`button`,"aria-expanded":h===t.index,onClick:()=>g(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,z.jsx)(F,{size:16,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,z.jsx)(`span`,{className:`text-sm [overflow-wrap:anywhere]`,children:t.title||q(t.url)}),(0,z.jsxs)(`span`,{className:`truncate text-[12px] text-muted`,children:[q(t.url),t.size?` · ${t.size}`:``,t.resized?` · resized ${t.resized}`:``]})]}),t.status===`changed`&&(0,z.jsxs)(`span`,{className:i(`text-sm tabular-nums`,t.over?`text-fail`:`text-warn`),children:[t.diffPercent,`%`,t.limit===void 0?``:` / ${t.limit}%`]}),(0,z.jsx)(O,{tone:t.over?`fail`:U[t.status].tone,children:t.over?`Over budget`:U[t.status].label})]}),h===t.index&&(0,z.jsxs)(`div`,{className:`mb-4 flex flex-col gap-3 px-1`,children:[(0,z.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(160px,1fr))] gap-3`,children:[t.images.baseline&&(0,z.jsx)(Q,{run:e.id,index:t.index,which:`baseline`,label:`Baseline`}),t.images.current&&(0,z.jsx)(Q,{run:e.id,index:t.index,which:`current`,label:`This run`}),t.images.diff&&(0,z.jsx)(Q,{run:e.id,index:t.index,which:`diff`,label:`Difference (in red)`})]}),t.status===`changed`&&(0,z.jsxs)(s,{className:`self-start`,disabled:d,onClick:()=>c([t.url]),children:[(0,z.jsx)(T,{size:16,"aria-hidden":`true`}),`Approve as the new baseline`]})]})]},t.index))})]})}function re({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,z.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,z.jsx)(`polyline`,{points:n,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinejoin:`round`})})}function $({icon:e,className:t,lines:n}){return n.length?(0,z.jsxs)(`span`,{className:i(`flex items-start gap-1.5 text-[13px]`,t),children:[(0,z.jsx)(e,{size:14,"aria-hidden":`true`,className:`mt-0.5 flex-none`}),(0,z.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:n.join(` · `)})]}):null}function ie({trends:e}){return e.length?(0,z.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.map(e=>{let t=e.a11y.latest?B.reduce((t,n)=>t+(e.a11y.latest[n]||0),0):void 0;return(0,z.jsxs)(`li`,{className:`flex flex-col gap-1.5 border-t border-line-soft py-3 first:border-t-0`,children:[(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-3`,children:[(0,z.jsx)(`span`,{className:`min-w-0 flex-[1_1_240px] font-mono text-[13px] [overflow-wrap:anywhere]`,children:e.page}),(0,z.jsx)(re,{values:e.a11y.trail}),(0,z.jsxs)(`span`,{className:`text-[12px] text-muted`,children:[K(e.runs,`run`),t===void 0?``:` · ${K(t,`violation`)} now`]})]}),(0,z.jsx)($,{icon:w,className:`text-fail`,lines:[...e.perf.worse.map(e=>`slower: ${e}`),...e.a11y.newRules.map(e=>`newly failing: ${e}`)]}),(0,z.jsx)($,{icon:C,className:`text-pass`,lines:[...e.perf.better.map(e=>`faster: ${e}`),...e.a11y.fixedRules.map(e=>`fixed: ${e}`)]})]},e.page)})}):(0,z.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 ae({id:e,view:n,onChanged:r}){let[c,d]=(0,R.useState)(null),[m,h]=(0,R.useState)(``),[_,v]=(0,R.useState)(`accessibility`),[b,S]=(0,R.useState)(``);if((0,R.useEffect)(()=>{let t=!1;return d(null),o.run(e).then(e=>{if(t)return;d(e),h(``);let n=e.visual?.pages.some(e=>e.status===`changed`)||!e.visual&&e.captured;v(e.report?.breaches.some(e=>e.kind===`performance`)&&!e.report.accessibility.failed.length?`performance`:n&&!e.report?.accessibility.failed.length?`visual`:e.report?.accessibility.pages?`accessibility`:e.report?.performance.pages.length?`performance`:`visual`)},e=>!t&&h(e.message)),()=>{t=!0}},[e]),m)return(0,z.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:m});if(!c)return(0,z.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading…`});let C=async()=>{try{let{id:e}=await p.start(`Explain the accessibility, performance and visual results of the run in ${c.dir}: call quality_report and visual_compare with run_dir ${c.dir}. Say what matters most to fix first, and why.`,{});location.hash=a(`chats`,e)}catch(e){S(e.message)}},w=c.report,E=w?.accessibility.failed??[],D=B.find(e=>E.some(t=>t.impact===e)),O=w?.performance.pages.filter(e=>e.over.length).length??0,k=c.visual?.pages.filter(e=>e.status===`changed`).length??0,A=e=>!!w?.breaches.some(t=>t.kind===e),j=[{id:`accessibility`,label:`Accessibility`,icon:f,state:w?.accessibility.pages?A(`accessibility`)||D===`critical`?`fail`:E.length?`warn`:`pass`:`none`,headline:w?.accessibility.pages?E.length?`${K(E.length,`rule`)} failed`:`No rule failed`:`Not measured`,note:w?.accessibility.pages?B.filter(e=>w.accessibility.byImpact[e]).map(e=>`${w.accessibility.byImpact[e]} ${e}`).join(` · `)||`${K(w.accessibility.pages,`page`)} checked`:``},{id:`performance`,label:`Performance`,icon:u,state:w?.performance.pages.length?A(`performance`)?`fail`:O?`warn`:`pass`:`none`,headline:w?.performance.pages.length?O?`${K(O,`page`)} over budget`:`Within budget`:`Not measured`,note:w?.performance.pages.length?`${K(w.performance.pages.length,`page`)} timed`:``},{id:`visual`,label:`Visual`,icon:F,state:c.visual?A(`visual`)?`fail`:k?`warn`:`pass`:`none`,headline:c.visual?k?`${K(k,`page`)} changed`:`No change`:c.captured?`Not compared yet`:`Not captured`,note:c.visual?`${K(c.visual.pages.length,`page`)} against the baseline`:c.captured?`${K(c.captured,`page`)} captured`:``}],M={pass:T,warn:g,fail:t,none:y},N={pass:`text-pass`,warn:`text-warn`,fail:`text-fail`,none:`text-muted`};return(0,z.jsxs)(`section`,{"aria-labelledby":`run-h`,className:`flex min-w-0 flex-1 flex-col gap-4`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,z.jsx)(`h2`,{id:`run-h`,title:c.goal,className:`m-0 line-clamp-2 text-[20px] leading-snug font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:c.goal}),(0,z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 text-[13px] text-muted`,children:[W(c.at),` · `,(0,z.jsx)(x,{path:c.dir})]})]}),(0,z.jsxs)(s,{size:`sm`,variant:`ghost`,onClick:()=>void C(),children:[(0,z.jsx)(l,{size:15,"aria-hidden":`true`}),`Ask in a chat`]})]}),b&&(0,z.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:b}),(0,z.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,z.jsxs)(`button`,{type:`button`,role:`tab`,id:`tab-${e.id}`,"aria-selected":_===e.id,"aria-controls":`panel-${e.id}`,onClick:()=>v(e.id),className:i(`flex min-w-0 cursor-pointer flex-col gap-1 rounded-[14px] border px-4 py-3 text-left`,_===e.id?`border-accent bg-accent-soft`:`border-line-soft bg-bg hover:bg-surface-muted`),children:[(0,z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[13px] text-muted`,children:[(0,z.jsx)(e.icon,{size:14,"aria-hidden":`true`}),e.label]}),(0,z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[16px] font-semibold text-ink`,children:[(0,z.jsx)(t,{size:16,"aria-hidden":`true`,className:i(`flex-none`,N[e.state])}),e.headline]}),e.note&&(0,z.jsx)(`span`,{className:`truncate text-[12.5px] text-muted`,children:e.note})]},e.id)})}),(0,z.jsxs)(`div`,{role:`tabpanel`,id:`panel-${_}`,"aria-labelledby":`tab-${_}`,className:`flex min-w-0 flex-col`,children:[_===`accessibility`&&(0,z.jsx)(Z,{run:c,standard:n.standard}),_===`performance`&&(0,z.jsx)(te,{run:c}),_===`visual`&&(0,z.jsx)(ne,{run:c,budget:n.budgets.visual,onChange:e=>{d(e),r()}})]}),_===`accessibility`&&c.report?.accessibility.pages?(0,z.jsx)(`p`,{className:`m-0 text-[12px] text-muted`,children:n.disclaimer}):null]})}function oe({sub:e}){let[n,r]=(0,R.useState)(null),[s,c]=(0,R.useState)(``),[l,p]=(0,R.useState)(e===`trends`?`trends`:`runs`),_=(0,R.useCallback)(()=>{o.view().then(e=>{r(e),c(``)},e=>c(e.message))},[]);(0,R.useEffect)(_,[_]);let y=e&&e!==`trends`?decodeURIComponent(e):``;(0,R.useEffect)(()=>{e===`trends`?p(`trends`):e&&p(`runs`)},[e]);let b=(0,R.useMemo)(()=>n?.runs.find(e=>e.id===y)||n?.runs[0],[n,y]),x=n?.trends.filter(e=>e.perf.worse.length||e.a11y.newRules.length).length??0,[S,C]=(0,R.useState)(``),[w,O]=(0,R.useState)(`all`),[M,N]=(0,R.useState)(0);(0,R.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(Y):F;return(0,z.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,z.jsx)(h,{}),(0,z.jsxs)(`main`,{className:i(v,`@container flex-auto gap-4`),children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,z.jsx)(m,{icon:u,size:`lg`}),(0,z.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`Quality`})]}),(0,z.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.`]}),s&&(0,z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:s}),!n&&!s&&(0,z.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),n&&(0,z.jsx)(d,{label:`Quality`,current:l,onPick:e=>{p(e),e===`trends`?location.hash=a(`quality`,`trends`):location.hash=b?a(`quality`,encodeURIComponent(b.id)):a(`quality`)},tabs:[{id:`runs`,label:`Runs (${n.runs.length})`},{id:`trends`,label:`Trends${x?` (${x} worse)`:``}`}]}),n&&l===`trends`&&(0,z.jsx)(`div`,{role:`tabpanel`,id:`panel-trends`,"aria-labelledby":`tab-trends`,children:(0,z.jsx)(ie,{trends:n.trends})}),n&&l===`runs`&&(n.runs.length?(0,z.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,z.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,z.jsx)(D,{id:`quality-search`,label:`Find a run`,value:S,onChange:C,className:`flex-none`}),(0,z.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,z.jsx)(k,{items:[{id:`all`,label:`All`,n:F.length},{id:`attention`,label:`Needs a look`,n:F.filter(Y).length,alert:!0}],value:w,onChange:O})}),(0,z.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[I.length===0&&(0,z.jsx)(`li`,{className:`px-3 py-3 text-sm text-muted`,children:`Nothing matches.`}),I.slice(M*X,M*X+X).map((e,n,r)=>{let o=A(e.at),s=e.breaches?t:Y(e)?g:T;return(0,z.jsxs)(`li`,{className:`contents`,children:[(n===0||A(r[n-1].at)!==o)&&(0,z.jsx)(`span`,{className:`block px-3 pt-2 pb-1 text-[12px] font-semibold text-muted`,children:o}),(0,z.jsxs)(`a`,{href:a(`quality`,encodeURIComponent(e.id)),"aria-current":b?.id===e.id?`page`:void 0,className:i(`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,z.jsx)(s,{size:16,"aria-label":e.breaches?`Over a budget`:Y(e)?`Needs a look`:`Within budgets`,className:i(`flex-none`,e.breaches?`text-fail`:Y(e)?`text-warn`:`text-pass`)}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,z.jsx)(`span`,{className:`truncate text-[14px] font-medium`,title:e.goal,children:e.goal}),(0,z.jsx)(`span`,{className:`truncate text-[12px] text-muted`,children:J(e)})]}),(0,z.jsx)(`span`,{className:`flex-none text-[12px] text-muted tabular-nums`,children:j(e.at)})]})]},e.id)})]}),I.length>X&&(0,z.jsx)(E,{page:M,size:X,total:I.length,onPage:N,label:`Pages of runs`})]}),b&&(0,z.jsx)(ae,{id:b.id,view:n,onChanged:_})]}):(0,z.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,z.jsx)(f,{size:24,"aria-hidden":`true`,className:`text-muted`}),(0,z.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{oe as Quality};
@@ -1 +0,0 @@
1
- import{$ as e,An as t,Cn as n,Ct as r,Et as i,Ft as a,J as o,Jt as s,K as c,Kt as l,L as u,N as d,Nn as f,P as p,Q as m,R as h,Y as g,Yt as _,Z as v,_t as y,at as b,pn as x,q as S,r as C,sn as w,t as T,yt as E,zt as D}from"./frame-pVqMQRrR.js";import{t as O}from"./markdown-4IJa7wkI.js";import{t as k}from"./file-chart-column-increasing-D6q2iZ64.js";import{t as A}from"./rotate-ccw-BgnQpY8R.js";import{t as j}from"./sticky-note-i4oBl2S1.js";import{t as M}from"./trash-zYYpxA_X.js";import{N as ee,_ as N,k as P,n as te,r as ne,s as F,t as re,v as ie}from"./index-Cu314_Zs.js";import{n as I,t as ae}from"./when-CHnpLdYw.js";var oe={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`}]]};oe.node;var se=w(oe),L={name:`dot`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]};L.node;var ce=w(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=w(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=w(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=w(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 le=w(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 ue=w(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=w(K),J=f(t(),1),Y=v(),de={navigate:i,back:ee,click:U,dblclick:U,input:V,press:V,select:r,upload:ue,expect:P,wait_for:z,capture:q,note:j,launch:y,double_click:U,type:V,keys:V},fe=e=>de[e]||(e.startsWith(`expect`)?P:ce),pe=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(e){let{id:t}=await x.start(`Turn the recording in ${e} into a test: call write_test with run_dir ${e}. Show me the plan before you write.`,{});location.hash=h(`chats`,t)}async function Q(e){let{id:t}=await x.start(`Replay the desktop workflow ${e}: call desktop_replay with workflow ${e}, and tell me how each step went.`,{});location.hash=h(`chats`,t)}function me({s:e,live:t,onDelete:n}){let r=fe(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:m(`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)(g,{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)(M,{size:15,"aria-hidden":`true`})})]})}function he({s:e,send:t,busy:n}){let[i,a]=(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 l=e.kind===`desktop`,u=e.state===`paused`,f=e.log.at(-1)?.level===`warn`&&/press Stop again/i.test(e.log.at(-1).text),p=Math.max(0,...e.steps.map(e=>e.case_step||0)),h=(r,i,a,o)=>(0,Y.jsxs)(g,{disabled:n||e.state===`starting`,onClick:()=>t({cmd:r}),title:o,children:[(0,Y.jsx)(a,{size:16,"aria-hidden":`true`}),i]},r);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:[u?(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 flex-none rounded-full bg-warn`}):(0,Y.jsx)(o,{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`?l?`Starting ${e.app}…`:`Opening the browser…`:e.state===`stopping`?`Saving the workflow…`:u?`Paused: what you do now is not recorded`:`Recording`,` · `,X(e.startedAt),` ·`,` `,l?`${e.app}, a desktop app`:e.url]})]}),!l&&(0,Y.jsxs)(g,{disabled:n||e.state===`starting`,onClick:()=>t({cmd:`pause`}),children:[u?(0,Y.jsx)(y,{size:16,"aria-hidden":`true`}):(0,Y.jsx)(le,{size:16,"aria-hidden":`true`}),u?`Resume`:`Pause`]}),(0,Y.jsxs)(g,{disabled:n||e.state===`stopping`,onClick:()=>t({cmd:`stop`,...f?{force:!0}:{}}),className:`border-fail bg-fail text-white hover:bg-fail hover:text-white hover:opacity-90`,children:[(0,Y.jsx)(b,{size:14,fill:`currentColor`,"aria-hidden":`true`}),f?`Stop anyway`:`Stop and save`]})]}),l?(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:[h(`assert`,`Check an element`,se,`Pick an element in the page to check`),h(`variable`,`Keep a value`,q,`Pick an element whose text later steps use`),h(`wait`,`Wait for`,z,`Pick an element the test waits for`),h(`data`,`Test data`,D,`The last value you typed becomes test data`),h(`note`,`Note`,j,`A note for the step, for whoever reads the test`),h(`undo`,`Undo`,ie,`Remove the last step`)]}),(0,Y.jsxs)(`form`,{className:`flex flex-wrap gap-2`,onSubmit:e=>{e.preventDefault(),i.trim()&&(t({cmd:`chat`,text:i.trim()}),a(``))},children:[(0,Y.jsx)(`label`,{htmlFor:`rec-check`,className:`sr-only`,children:`Describe a check`}),(0,Y.jsx)(d,{id:`rec-check`,value:i,maxLength:2e3,placeholder:`Describe a check: the total shows "$40.00", or note: …`,onChange:e=>a(e.target.value),className:`min-w-0 flex-[1_1_320px]`}),(0,Y.jsxs)(g,{type:`submit`,variant:`primary`,disabled:n||!i.trim()||e.state===`starting`,children:[(0,Y.jsx)(N,{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)(r,{size:18,"aria-hidden":`true`,className:`text-accent`}),`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)(me,{s:e,live:!l,onDelete:()=>t({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`?l?`Starting ${e.app}…`:`Opening the browser…`:`Nothing yet: do the first step in ${l?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)(r,{size:18,"aria-hidden":`true`,className:`text-accent`}),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(r=>{let i=e.steps.some(e=>e.case_step===r.n);return(0,Y.jsx)(`li`,{className:`border-t border-line-soft first:border-t-0`,children:(0,Y.jsxs)(`button`,{type:`button`,disabled:n,"aria-current":r.n===p?`step`:void 0,onClick:()=>t({cmd:`case_step`,n:r.n}),className:m(`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`,r.n===p&&`bg-accent-soft`),children:[i?(0,Y.jsx)(P,{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:r.n}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Y.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:r.action}),r.expected&&(0,Y.jsxs)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:[`Expect: `,r.expected]})]})]})},r.n)})}),(0,Y.jsx)(g,{disabled:n,onClick:()=>t({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:m(`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 `,l?`the app`:`the browser`,`…`]})})]})]})]})]})}function ge({s:t}){let n=t.result,[r,i]=(0,J.useState)(``),[o,s]=(0,J.useState)(!1);if(!n)return null;let c=t.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:t.name}),(0,Y.jsx)(F,{tone:n.ok?`pass`:`fail`,children:n.ok?`Recorded`:`Not recorded`})]}),(0,Y.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[n.ok?n.summary||t.summary:n.error||`Nothing was recorded.`,` `,t.endedAt&&(0,Y.jsxs)(`span`,{className:`text-muted`,children:[`· `,X(t.startedAt,t.endedAt)]})]}),n.ok&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-sm`,children:[(0,Y.jsx)(F,{tone:`neutral`,icon:!1,children:e(t.steps.length,`step`)}),(0,Y.jsxs)(F,{tone:n.checks?`pass`:`warn`,children:[n.checks,` check`,n.checks===1?``:`s`]}),n.variables.length>0&&(0,Y.jsxs)(F,{tone:`neutral`,icon:!1,children:[`kept: `,n.variables.join(`, `)]}),n.testData.length>0&&(0,Y.jsxs)(F,{tone:`neutral`,icon:!1,children:[`test data: `,n.testData.join(`, `)]})]}),!c&&n.secrets.length>0&&(0,Y.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[`The test reads`,` `,n.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 `,n.secrets.length===1?`it`:`them`,` before the test runs.`]}),n.caseGaps.length>0&&(0,Y.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-sm text-warn`,children:n.caseGaps.map(e=>(0,Y.jsxs)(`li`,{children:[`No check for case step `,e.n,`: expects “`,e.expected,`”`]},e.n))}),(n.notes??[]).length>0&&(0,Y.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-sm text-ink-2`,children:n.notes.map((e,t)=>(0,Y.jsx)(`li`,{children:e},t))}),n.skipped.length>0&&(0,Y.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-sm text-muted`,children:n.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&&n.workflow&&(0,Y.jsxs)(g,{variant:`primary`,disabled:o,onClick:async()=>{s(!0);try{await Q(n.workflow)}catch(e){i(e.message),s(!1)}},children:[(0,Y.jsx)(A,{size:16,"aria-hidden":`true`}),`Replay it`]}),c&&n.report&&(0,Y.jsxs)(g,{onClick:async()=>i(await u(n.report)),children:[(0,Y.jsx)(k,{size:16,"aria-hidden":`true`}),`Open the report`]}),!c&&n.ok&&(0,Y.jsxs)(g,{variant:`primary`,disabled:o,onClick:async()=>{s(!0);try{await Z(t.runDir)}catch(e){i(e.message),s(!1)}},children:[(0,Y.jsx)(N,{size:16,"aria-hidden":`true`}),`Write a test from it`]}),!c&&n.ok&&(0,Y.jsxs)(g,{onClick:async()=>i(await u(`${t.runDir}/trace.md`)),children:[(0,Y.jsx)(a,{size:16,"aria-hidden":`true`}),`Read the steps`]}),(0,Y.jsx)(`span`,{className:`text-sm`,children:(0,Y.jsx)(O,{path:c&&n.workflow?n.workflow:t.runDir})}),r&&(0,Y.jsx)(`span`,{className:`text-[13px] text-fail`,children:r})]})]})}function _e({view:e,busy:t,onStart:n}){let[r,a]=(0,J.useState)(e.session?.kind===`desktop`&&e.desktop.available?`desktop`:`web`),[o,l]=(0,J.useState)(e.desktop.apps[0]??``),[u,f]=(0,J.useState)(e.apps[0]?.name??``),[v,y]=(0,J.useState)(``),[b,x]=(0,J.useState)(``),[S,C]=(0,J.useState)(``),[w,T]=(0,J.useState)(e.environment??``),[D,O]=(0,J.useState)(!1),[k,A]=(0,J.useState)(!1),j=r===`desktop`?e.desktop.available&&!!o:u?!0:/^https?:\/\/\S+$/i.test(v.trim()),M=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(),j){if(r===`desktop`)return n({kind:`desktop`,app:o,...b.trim()?{name:b.trim()}:{},...w&&w!==e.environment?{env:w}:{}});n({...u?{app:u}:{url:v.trim()},...b.trim()?{name:b.trim()}:{},...S.trim()?{case:S.trim()}:{},...w&&w!==e.environment?{env:w}:{},signedIn:D})}},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`,i,!0],[`desktop`,`Desktop app`,E,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:m(`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)(p,{"aria-label":`App`,value:o,onChange:e=>l(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:h(`settings`,`environments`),children:`Settings, Environments`}),`.`]}):(0,Y.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[e.apps.length>0&&(0,Y.jsxs)(p,{"aria-label":`Start on`,value:u,onChange:e=>f(e.target.value),className:m(u?`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…`})]}),!u&&(0,Y.jsx)(d,{"aria-label":`Page address`,type:`url`,value:v,spellCheck:!1,placeholder:`https://shop.example.com/`,onChange:e=>y(e.target.value),className:`min-w-0 flex-1`})]}),(0,Y.jsx)(d,{"aria-label":`What the test does`,value:b,maxLength:200,placeholder:`What the test does`,onChange:e=>x(e.target.value)}),(0,Y.jsxs)(g,{type:`submit`,variant:`primary`,disabled:t||!j,children:[(0,Y.jsx)(s,{size:16,"aria-hidden":`true`}),t?r===`desktop`?`Starting…`:`Opening…`:`Start recording`]})]}),M&&(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":k,onClick:()=>A(!k),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)(_,{size:14,"aria-hidden":`true`,className:m(`transition-transform`,k&&`rotate-180`)}),`More options`,!k&&(S||D||w&&w!==e.environment)?(0,Y.jsx)(`span`,{className:`text-accent`,children:`· set`}):null]}),k&&(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)(d,{value:S,spellCheck:!1,placeholder:`SHOP-12, ado:1234 or a file`,onChange:e=>C(e.target.value),className:`bg-bg`})]}),e.environments.length>1&&(r===`desktop`||!!u)&&(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm font-medium`,children:[`Environment`,(0,Y.jsx)(p,{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)(c,{checked:D,onChange:O,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 ve({rows:t}){let[n,r]=(0,J.useState)(``),[o,s]=(0,J.useState)(``),[c,d]=(0,J.useState)(`all`),[f,p]=(0,J.useState)(0);if((0,J.useEffect)(()=>p(0),[o,c]),!t.length)return null;let m=o.toLowerCase().split(/\s+/).filter(Boolean),h=t.filter(e=>m.every(t=>`${e.name} ${e.caseId||``} ${e.app||``} ${e.startUrl}`.toLowerCase().includes(t))),_=c===`all`?h:h.filter(e=>e.kind===c),v=_.slice(f*$,f*$+$),y=t.some(e=>e.kind===`desktop`)&&t.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:t.length})]}),(0,Y.jsx)(ne,{id:`rec-search`,label:`Find a recording`,value:o,onChange:s}),y&&(0,Y.jsx)(re,{items:[{id:`all`,label:`All`,n:h.length},{id:`web`,label:`Web`,n:h.filter(e=>e.kind===`web`).length},{id:`desktop`,label:`Desktop`,n:h.filter(e=>e.kind===`desktop`).length}],value:c,onChange:d})]}),n&&(0,Y.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:n}),(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:[v.length===0&&(0,Y.jsx)(`li`,{className:`px-3 py-4 text-sm text-muted`,children:`Nothing matches.`}),v.map((t,n)=>{let o=I(t.startedAt);return(0,Y.jsxs)(`li`,{className:`contents`,children:[(n===0||I(v[n-1].startedAt)!==o)&&(0,Y.jsx)(`span`,{className:`block px-3 pt-3 pb-1 text-[12px] font-semibold text-muted`,children:o}),(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:[t.ok?(0,Y.jsx)(P,{size:16,"aria-label":`Recorded`,className:`text-pass`}):(0,Y.jsx)(l,{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:[t.kind===`desktop`?(0,Y.jsx)(E,{size:13,"aria-label":`Desktop app`,className:`flex-none text-muted`}):(0,Y.jsx)(i,{size:13,"aria-label":`Web page`,className:`flex-none text-muted`}),(0,Y.jsx)(`span`,{className:`truncate text-[14px] font-medium`,title:t.name,children:t.name})]}),(0,Y.jsx)(`span`,{className:`truncate text-[12px] text-muted`,children:[e(t.steps,`step`),e(t.checks,`check`),t.caseId,t.app,ae(t.startedAt)].filter(Boolean).join(` · `)})]}),(0,Y.jsxs)(`span`,{className:`flex flex-none items-center gap-1`,children:[t.trace&&(0,Y.jsx)(g,{size:`icon`,variant:`icon`,"aria-label":`Read the steps of ${t.name}`,title:`Read the steps`,onClick:async()=>r(await u(t.trace)),children:(0,Y.jsx)(a,{size:15,"aria-hidden":`true`})}),t.report&&(0,Y.jsx)(g,{size:`icon`,variant:`icon`,"aria-label":`Open the report of ${t.name}`,title:`Open the report`,onClick:async()=>r(await u(t.report)),children:(0,Y.jsx)(k,{size:15,"aria-hidden":`true`})}),t.kind===`desktop`&&t.workflow&&(0,Y.jsxs)(g,{size:`sm`,onClick:()=>Q(t.workflow).catch(e=>r(e.message)),children:[(0,Y.jsx)(A,{size:14,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`hidden @md:inline`,children:`Replay`})]}),t.kind===`web`&&t.ok&&(0,Y.jsxs)(g,{size:`sm`,onClick:()=>Z(t.runDir).catch(e=>r(e.message)),children:[(0,Y.jsx)(N,{size:14,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`hidden @md:inline`,children:`Write a test`})]})]})]})]},t.runDir)})]}),(0,Y.jsx)(te,{page:f,size:$,total:_.length,onPage:p,label:`Pages of recordings`})]})]})}function ye(){let[e,t]=(0,J.useState)(null),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(!1),c=(0,J.useCallback)(()=>{n.get().then(e=>{t(e),i(``)},e=>i(e.message))},[]);(0,J.useEffect)(c,[c]);let l=!!e?.session&&pe.has(e.session.state);(0,J.useEffect)(()=>{if(!l)return;let e=setInterval(c,800);return()=>clearInterval(e)},[l,c]);let u=async e=>{o(!0),i(``);try{t(await e())}catch(e){i(e.message)}finally{o(!1)}},d=e?.session;return(0,Y.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,Y.jsx)(C,{}),(0,Y.jsxs)(`main`,{className:m(T,`@container flex-auto gap-4`),children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(S,{icon:s,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.`}),r&&(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:r}),!e&&!r&&(0,Y.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),e&&d&&l&&(0,Y.jsx)(he,{s:d,busy:a,send:e=>void u(()=>n.command(e))}),e&&!l&&(0,Y.jsxs)(Y.Fragment,{children:[d?.result&&(0,Y.jsx)(ge,{s:d}),(0,Y.jsx)(_e,{view:e,busy:a,onStart:e=>void u(()=>n.start(e))}),(0,Y.jsx)(ve,{rows:e.recordings})]})]})]})}export{ye as Record};
@@ -1,2 +0,0 @@
1
- import{$ as e,An as t,Dt as n,I as r,J as i,K as a,N as o,Nn as s,Pt as c,Q as l,R as u,Y as d,Z as f,_t as p,at as m,p as h,q as g,r as _,sn as v,t as y,vt as b,xn as x}from"./frame-pVqMQRrR.js";import{t as S}from"./external-link-S8aL0KIN.js";import{t as C}from"./sticky-note-i4oBl2S1.js";import{s as w,y as T}from"./index-Cu314_Zs.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=v(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=v(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=v(A),M=s(t(),1),N=f(),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:T,pr:n,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)(w,{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)(d,{onClick:t,className:`border-fail text-fail hover:bg-fail-soft`,children:[(0,N.jsx)(m,{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:e,busy:t,act:n,version:r}){let[i,a]=(0,M.useState)(null),[o,s]=(0,M.useState)(``),[u,f]=(0,M.useState)(`all`),[m,g]=(0,M.useState)(null),[_,v]=(0,M.useState)(new Set);if((0,M.useEffect)(()=>{let t=!1;return x.detail(e).then(e=>!t&&(a(e),s(``)),e=>!t&&s(e.message)),()=>{t=!0}},[e,r]),(0,M.useEffect)(()=>{f(`all`),g(null),v(new Set)},[e]),o)return(0,N.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:o});if(!i)return(0,N.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading…`});let y=i.runs.at(-1),{fresh:b,fixed:T}=U(i.runs),E=i.tests.filter(e=>u===`all`||e.reasons.some(e=>e.kind===u)),O=(i.triage?.items??[]).filter(e=>e.route===`heal`||e.route===`check`),k=Object.keys(F).filter(e=>i.triage?.items.some(t=>t.route===e)),A=Object.keys(P).filter(e=>i.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:i.name}),(0,N.jsxs)(`span`,{className:`text-sm text-muted`,children:[`Built `,L(i.createdAt)]}),i.scope.length>0&&(0,N.jsx)(`span`,{className:`flex flex-wrap gap-1.5 pt-1`,children:i.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))})]}),m?(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 `,i.tests.length,` test`,i.tests.length===1?``:`s`,` `,m===`local`?`on this machine`:`on TestMu AI`,`?`]}),(0,N.jsx)(d,{variant:`primary`,disabled:t,onClick:()=>{g(null),n(()=>x.run(i.name,m))},children:`Run`}),(0,N.jsx)(d,{onClick:()=>g(null),children:`Don't run`})]}):(0,N.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,N.jsxs)(d,{variant:`primary`,disabled:t||!i.tests.length,onClick:()=>g(`local`),children:[(0,N.jsx)(p,{size:16,"aria-hidden":`true`}),`Run here`]}),(0,N.jsx)(d,{disabled:t||!i.tests.length,onClick:()=>g(`testmu`),children:`Run on TestMu AI`})]})]}),(0,N.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,N.jsx)(h,{label:`Tests`,value:String(i.tests.length),note:A.map(e=>`${i.tests.filter(t=>t.reasons.some(t=>t.kind===e)).length} ${P[e].label.toLowerCase()}`).join(` · `)}),(0,N.jsx)(h,{label:`Not covered`,value:String(i.uncovered.length),note:`changes no test is in for`}),(0,N.jsx)(h,{label:`Risk areas`,value:String(i.risk.length)}),(0,N.jsx)(h,{label:`Last run`,value:y?y.status===`passed`?`Passed`:`${y.counts.failed} failed`:`–`,note:y?`${L(y.at)} · ${y.on===`testmu`?`TestMu AI`:y.on===`pipeline`?`pipeline`:`this machine`}`:`Not run yet`})]}),i.triage&&(0,N.jsxs)(H,{title:`Triage of the last run`,aside:(0,N.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[i.triage.items.length,` failed or flaky`]}),children:[i.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)(w,{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:i.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:_.has(t.name),onChange:e=>{let n=new Set(_);e.target.checked?n.add(t.name):n.delete(t.name),v(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)(d,{disabled:t||!_.size,onClick:()=>n(()=>x.heal(i.name,[..._])),children:[(0,N.jsx)(D,{size:16,"aria-hidden":`true`}),`Heal `,_.size||``,` selected`]}),(0,N.jsxs)(d,{variant:`ghost`,disabled:t,onClick:()=>v(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.`})]})]}),i.runs.length>0&&(0,N.jsxs)(H,{title:`Runs`,aside:b.length||T.length?(0,N.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[[b.length?`${b.length} newly failing`:``,T.length?`${T.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:[...i.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)(w,{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}`))}),b.length>0&&(0,N.jsxs)(`p`,{className:`m-0 text-[13px] text-fail`,children:[`Newly failing: `,b.join(`, `)]}),T.length>0&&(0,N.jsxs)(`p`,{className:`m-0 text-[13px] text-pass`,children:[`Fixed: `,T.join(`, `)]})]}),(0,N.jsxs)(H,{title:`Tests (${i.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":u===e,title:P[e]?.help,onClick:()=>f(e),className:l(`min-h-8 cursor-pointer rounded-[8px] border px-3 text-[13px]`,u===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)(w,{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)(w,{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,`.`]})]}),i.uncovered.length>0&&(0,N.jsx)(H,{title:`Not covered (${i.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:i.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))})}),i.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:i.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:l(`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 (${i.items.length})`,children:(0,N.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:i.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}`)})})}),i.notes.length>0&&(0,N.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-[13px] text-muted`,children:i.notes.map((e,t)=>(0,N.jsx)(`li`,{children:e},t))})]})}function G({open:e,onClose:t,view:n,onBuild:i,busy:s}){let[c,f]=(0,M.useState)({rangeRepo:`product`,prRepo:`product`,risk:!0,smoke:!0});(0,M.useEffect)(()=>{e&&f({rangeRepo:n.productRepo?`product`:`tests`,prRepo:n.productRepo?`product`:`tests`,risk:!0,smoke:!0})},[e,n.productRepo]);let p=(e,t)=>f({...c,[e]:t}),m=(e,t,n,r)=>(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)(o,{id:`pk-${e}`,value:String(c[e]??``),spellCheck:!1,maxLength:200,placeholder:n,onChange:t=>p(e,t.target.value)}),r&&(0,N.jsx)(`span`,{className:`text-[13px] text-muted`,children:r})]}),h=(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:c[e]===`product`,disabled:!n.productRepo,onChange:()=>p(e,`product`),className:`size-4 accent-accent`}),`The product's `,n.productRepo?(0,N.jsx)(`code`,{className:`font-mono text-[12px]`,children:n.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:c[e]===`tests`,onChange:()=>p(e,`tests`),className:`size-4 accent-accent`}),`The tests' `,n.repo===`.`?`(this project)`:(0,N.jsx)(`code`,{className:`font-mono text-[12px]`,children:n.repo})]})]}),g=`flex flex-col gap-3 rounded-[12px] border border-line-soft p-3`;return(0,N.jsx)(r,{open:e,onClose:t,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)(d,{onClick:t,children:`Cancel`}),(0,N.jsxs)(d,{variant:`primary`,disabled:s,onClick:()=>i(c),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:[m(`name`,`Name`,`release-1.5`,`Lower-case letters, digits, dots and dashes. Empty: release-<date>.`),(0,N.jsxs)(`div`,{className:g,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`}),`Code changes`]}),(0,N.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-3`,children:[m(`from`,`Commits after`,`release/1.4, a tag or a commit`),m(`to`,`Up to`,`HEAD`)]}),h(`rangeRepo`,`In the repository`),(0,N.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-3`,children:[m(`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)(o,{id:`pk-days`,type:`number`,min:1,max:365,value:c.mergedDays??``,onChange:e=>p(`mergedDays`,e.target.value?Number(e.target.value):void 0),className:`w-24`}),` days`]})]})]}),(c.prs||c.mergedDays)&&h(`prRepo`,`Pull requests of`)]}),(0,N.jsxs)(`div`,{className:l(g,!n.azureDevops&&`opacity-70`),children:[(0,N.jsxs)(`h3`,{className:`m-0 flex items-center gap-2 text-sm font-semibold`,children:[(0,N.jsx)(T,{size:16,"aria-hidden":`true`,className:`text-accent`}),`Azure DevOps work items and their linked test cases`]}),!n.azureDevops&&(0,N.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Not set up: `,(0,N.jsx)(`a`,{href:u(`settings`,`integrations`),children:`Settings, Integrations`}),`.`]}),(0,N.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-3`,children:[m(`sprint`,`Sprint`,`current, or Sprint 41`),m(`iteration`,`Iteration path`,`Shop\\Release 2026.09`),m(`area`,`Area path`,`Shop\\Checkout`),m(`parent`,`Epic or feature`,`1200`),m(`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)(a,{checked:c.risk!==!1,onChange:e=>p(`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)(a,{checked:c.smoke!==!1,onChange:e=>p(`smoke`,e),label:`Add smoke tests`}),`Add smoke-tagged tests`]})]})]})})}function K({sub:t}){let[n,r]=(0,M.useState)(null),[a,o]=(0,M.useState)(``),[s,c]=(0,M.useState)(!1),[f,p]=(0,M.useState)(!1),m=(0,M.useCallback)(()=>{x.list().then(e=>{r(e),o(``)},e=>o(e.message))},[]);(0,M.useEffect)(m,[m]);let h=!!n?.job?.running;(0,M.useEffect)(()=>{if(!h)return;let e=setInterval(m,1500);return()=>clearInterval(e)},[h,m]);let v=async e=>{c(!0),o(``);try{await e(),m()}catch(e){o(e.message)}finally{c(!1)}},S=t?decodeURIComponent(t):``,C=n?.packs.find(e=>e.name===S)||n?.packs[0],w=(0,M.useMemo)(()=>`${n?.job?.endedAt??``}|${C?.runs??0}|${C?.createdAt??``}`,[n,C]);return(0,N.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,N.jsx)(_,{}),(0,N.jsxs)(`main`,{className:l(y,`@container flex-auto gap-4`),children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,N.jsx)(g,{icon:b,size:`lg`}),(0,N.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`Regression`}),(0,N.jsxs)(d,{variant:`primary`,disabled:!n||h,onClick:()=>p(!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 `,n&&n.repo!==`.`?(0,N.jsx)(`code`,{className:`font-mono text-[13px]`,children:n.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.`]}),a&&(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:a}),!n&&!a&&(0,N.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),n?.job&&(0,N.jsx)(V,{job:n.job,onStop:()=>v(()=>x.stop())}),n&&(n.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 (`,n.packs.length,`)`]}),(0,N.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:n.packs.map(t=>(0,N.jsx)(`li`,{children:(0,N.jsxs)(`a`,{href:u(`regression`,encodeURIComponent(t.name)),"aria-current":C?.name===t.name?`page`:void 0,className:l(`flex min-h-[60px] items-center gap-3 rounded-[12px] px-3 py-2 text-ink no-underline`,C?.name===t.name?`bg-surface-strong hover:text-ink`:`hover:bg-surface-muted hover:text-ink`),children:[n?.job?.running&&n.job.pack===t.name?(0,N.jsx)(i,{state:n.job.kind===`heal`?`retrying`:`working`,label:`Working on it`,px:16}):(0,N.jsx)(`span`,{className:l(`size-2.5 flex-none rounded-full`,t.lastRun?t.lastRun.status===`passed`?`bg-pass`:`bg-fail`:`bg-line`),"aria-label":t.lastRun?t.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:t.name}),(0,N.jsxs)(`span`,{className:`truncate text-[13px] text-muted`,children:[e(t.tests,`test`),` · `,t.uncovered,` not covered · `,L(t.createdAt)]})]})]})},t.name))})]}),C&&(0,N.jsx)(W,{name:C.name,busy:s||h,act:v,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)(b,{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)(d,{onClick:()=>p(!0),children:`Build a pack`})]}))]}),n&&(0,N.jsx)(G,{open:f,onClose:()=>p(!1),view:n,busy:s||h,onBuild:e=>v(async()=>{await x.build(e),p(!1)})})]})}export{K as Regression};
@@ -1,2 +0,0 @@
1
- import{$ as e,An as t,Ft as n,J as r,Kt as i,L as a,N as o,Nn as s,P as c,Q as l,R as u,Rt as d,Tn as f,Y as p,Z as m,_ as h,q as g,r as _,t as v,y}from"./frame-pVqMQRrR.js";import{t as b}from"./circle-dashed-ODPnEo8f.js";import{t as x}from"./markdown-4IJa7wkI.js";import{t as S}from"./external-link-S8aL0KIN.js";import{n as C,t as w}from"./trending-up-Cxt0Wl0_.js";import{C as T,k as E,w as D}from"./index-Cu314_Zs.js";import{n as O,t as k}from"./when-CHnpLdYw.js";var A=s(t(),1),j=m(),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),r=e.scope===`page`?n:t.tone===`pass`?E:t.tone===`fail`?i:b;return(0,j.jsx)(r,{size:16,"aria-label":t.label,className:l(`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:l(`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:l(`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:t}){let[n,r]=(0,A.useState)(null),i=t.slice(-30);if(!i.length)return(0,j.jsx)(`p`,{className:`m-0 py-6 text-sm text-muted`,children:`No runs with results yet.`});let a=Math.max(1,...i.map(e=>e.cases)),o=a<=4?1:Math.ceil(a/4/5)*5||1,s=Math.ceil(a/o)*o,c=[s,Math.round(s/2),0],u=Math.ceil(i.length/8),d=n===null?null:i[n];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:c.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:()=>r(null),children:[c.map((e,t)=>(0,j.jsx)(`span`,{"aria-hidden":`true`,className:l(`absolute inset-x-0 border-t`,t===c.length-1?`border-line`:`border-line-soft`),style:{top:`${(1-e/s)*100}%`}},e)),(0,j.jsx)(`div`,{className:`absolute inset-0 flex items-end gap-[3px]`,children:i.map((e,t)=>{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:()=>r(t),children:(0,j.jsxs)(`div`,{className:l(`flex w-full flex-col justify-end gap-[2px] transition-opacity`,n!==null&&n!==t&&`opacity-50`),style:{height:`${e.cases/s*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:l(`min-h-[2px] w-full bg-pass`,!i&&`rounded-t-[4px]`),style:{flexGrow:e.passed}})]})},e.day)})}),d&&(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,(n+.5)/i.length*100))}%`,top:`${(1-d.cases/s)*100}%`},children:[(0,j.jsx)(`b`,{className:`block text-ink`,children:R(d.day)}),(0,j.jsxs)(`span`,{className:`block text-ink-2 tabular-nums`,children:[d.passed,` passed, `,d.cases-d.passed,` failed · `,z([d]),`%`]}),(0,j.jsx)(`span`,{className:`block text-muted`,children:e(d.runs,`run`)})]})]}),(0,j.jsx)(`span`,{}),(0,j.jsx)(`div`,{"aria-hidden":`true`,className:`mt-1 flex gap-[3px] text-[11px] text-muted`,children:i.map((e,t)=>(0,j.jsx)(`span`,{className:`min-w-0 flex-1 text-center whitespace-nowrap`,children:t%u===0&&(0,j.jsx)(`span`,{className:l(t/u%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:i.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:t,build:n,onBuilt:o}){let[s,c]=(0,A.useState)(n),[u,d]=(0,A.useState)(``),m=!!s?.running;(0,A.useEffect)(()=>{if(!m)return;let e=setInterval(async()=>{try{let e=await f.buildStatus();c(e),e&&!e.running&&o()}catch{}},1200);return()=>clearInterval(e)},[m,o]);let g=t.cases?Math.round(t.passed/t.cases*100):null,_=z(t.days.slice(-7)),v=z(t.days.slice(-14,-7)),b=_!==null&&v!==null?_-v:null,x=[{label:`Runs`,value:String(t.runs),sub:t.runs?`${R(String(t.from).slice(0,10))} – ${R(String(t.to).slice(0,10))}`:void 0},{label:`Cases run`,value:String(t.cases),sub:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`span`,{className:`text-pass`,children:[t.passed,` passed`]}),` · `,(0,j.jsxs)(`span`,{className:l(t.failed&&`text-fail`),children:[t.failed,` failed`]})]})},{label:`Tokens`,value:y(t.tokens),sub:t.cost?h(t.cost.amount,t.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:t.page?`The HTML report was built ${N(t.page.builtAt)}.`:`Every run, taken together. The HTML report has not been built yet.`}),t.page&&(0,j.jsxs)(p,{size:`sm`,onClick:async()=>d(await a(t.page.file)),children:[(0,j.jsx)(S,{size:14,"aria-hidden":`true`}),`Open HTML report`]}),(0,j.jsx)(p,{size:`sm`,variant:`outline`,disabled:m,onClick:async()=>{d(``);try{c(await f.build())}catch(e){d(e.message)}},children:m?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r,{state:`working`,px:14}),`Building…`]}):t.page?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(D,{size:14,"aria-hidden":`true`}),`Rebuild`]}):`Build HTML report`})]}),u&&(0,j.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:u}),s&&(s.running||s.ok===!1)&&(0,j.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[!s.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:s.lines.length?s.lines.join(`
2
- `):`Starting…`})]}),t.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:l(`text-[34px] leading-none font-semibold tracking-[-0.02em] tabular-nums`,g!==null&&g<80?`text-fail`:`text-ink`),children:g===null?`–`:`${g}%`}),b!==null&&(0,j.jsxs)(`span`,{className:l(`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 ${e(Math.min(30,t.days.length),`day`)} with runs. Hover a day for its pass rate.`,children:(0,j.jsx)(H,{days:t.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:t.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:t.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)(i,{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:t.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:t.defects.slice(0,8).map(t=>(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:t.title,children:t.title}),(0,j.jsxs)(`span`,{className:`text-[12.5px] whitespace-nowrap text-muted tabular-nums`,children:[e(t.cases,`case`),` · `,e(t.runs,`run`),t.lastSeen?` · ${k(t.lastSeen)}`:``]})]},t.title))})}),(0,j.jsx)(B,{title:`Flaky`,note:`Cases that both passed and failed.`,children:t.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:t.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:t.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:t.kinds.map(t=>(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[t.scope]||t.scope}),(0,j.jsx)(`span`,{className:`text-[12.5px] text-muted tabular-nums`,children:e(t.runs,`run`)}),(0,j.jsx)(V,{part:t.passed,whole:t.cases,tone:`pass`,label:t.cases?`${Math.round(t.passed/t.cases*100)}% passed`:`no cases`})]},t.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[t,n]=(0,A.useState)(null),[r,i]=(0,A.useState)(``),[s,m]=(0,A.useState)(``),[h,y]=(0,A.useState)(``),[b,C]=(0,A.useState)(`all`),[w,E]=(0,A.useState)(I),[D,R]=(0,A.useState)(``),z=(0,A.useCallback)(()=>{f.list().then(n,e=>i(e.message))},[]);(0,A.useEffect)(z,[z]);let B=e===`project`?`project`:`execution`,V=t?.rows??null,H=h.toLowerCase().split(/\s+/).filter(Boolean),W=(0,A.useMemo)(()=>(V||[]).filter(e=>(!s||e.scope===s)&&H.every(t=>`${e.title} ${e.id} ${M[e.scope]}`.toLowerCase().includes(t))),[V,s,h]),G=W.filter(e=>F(e).tone===`fail`).length,K=b===`failed`?W.filter(e=>F(e).tone===`fail`):W;(0,A.useEffect)(()=>E(I),[s,h,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:l(v,`@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)(g,{icon:d,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`,u(`reports`)],[`project`,`Project report`,u(`reports`,`project`)]].map(([e,t,n])=>(0,j.jsx)(`a`,{href:n,"aria-current":B===e?`page`:void 0,className:l(`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))})]}),r&&(0,j.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:r}),!t&&!r&&(0,j.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&B===`project`&&(0,j.jsx)(U,{project:t.project,build:t.build,onBuilt:z}),t&&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)(T,{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)(o,{id:`report-search`,type:`search`,value:h,onChange:e=>y(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:l(`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:l(`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)(c,{id:`report-kind`,value:s,onChange:e=>m(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))]})]})]}),D&&(0,j.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:D}),(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:t.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:l(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)(p,{size:`sm`,"aria-label":`Open the report of ${e.title} in a new tab`,onClick:async()=>R(await a(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||t.total>t.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,t.total>t.rows.length?` (the newest ${t.rows.length} of ${t.total})`:``]}),K.length>w&&(0,j.jsxs)(p,{size:`sm`,onClick:()=>E(w+I),children:[`Show `,Math.min(I,K.length-w),` more`]})]})]})]})]})]})}export{W as Reports};
@@ -1,8 +0,0 @@
1
- import{$ as e,An as t,It as n,J as r,Nn as i,Nt as a,Q as o,St as s,Xt as c,Y as l,Yt as u,Z as d,et as f,ft as p,sn as m}from"./frame-pVqMQRrR.js";import{a as h,n as g,r as _,t as v}from"./markdown-4IJa7wkI.js";import{A as ee,O as te,a as ne,i as y,o as b,s as re}from"./index-Cu314_Zs.js";var x={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`]};x.node;var ie=m(x),S={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`]};S.node;var ae=m(S),C=i(t(),1),w=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{},T=e=>typeof e==`string`?e:e==null?``:String(e),oe=(e,t=400)=>e.length>t?`${e.slice(0,t-1)}…`:e,E=e=>typeof e==`number`?` in ${Math.round(e/1e3)}s`:``;function D(e,t=400){return oe(e.replace(/\s+/g,` `).trim(),t).replace(/([\\`*_[\]<>#|~!])/g,`\\$1`)}function O(e){let t=e.replace(/\s+/g,` `).trim();if(!t)return``;let n=t.includes("`")?"``":"`";return`${n}${n==="``"?` `:``}${t}${n==="``"?` `:``}${n}`}function k(e,t){return/^https?:\/\/[^\s)]+$/i.test(t)?`[${D(e||t,120)}](${t})`:D(e)}var A=e=>[O(T(w(e).id)),D(T(w(e).title),200)].filter(Boolean).join(` `);function j(e){return e.replace(/<!--[\s\S]*?(?:-->|$)/g,``).trim()}function se(e){return e.replace(/\[((?:\\.|[^\]\\])*)\]\(https?:\/\/[^\s)]+\)/g,`$1`).replace(/\\(.)/g,`$1`).replace(/[*`]/g,``)}var M=(e,t)=>({tone:e,kind:`item`,md:t}),N=(e,t)=>({tone:e,kind:`sub`,md:t});function P(e,t=``){let n=t||(e.agent&&e.agent!==`forgeqe`?`**${D(T(e.agent))}:** `:``);switch(e.kind){case`info`:return M(`info`,`${n}${D(T(e.text))}`);case`start`:return M(`dim`,`${n}→ ${O(T(e.tool))}${e.text&&e.text!==e.tool?` ${D(T(e.text),200)}`:``}`);case`tool`:{let t=w(e.file);return M(e.ok===!1?`warn`:`dim`,`${n}${e.ok===!1?`⚠`:`✓`} ${D(T(e.text)||T(e.tool),240)}${t.path?` (${D(T(t.action))} ${O(T(t.path))})`:``}`)}case`say`:{let t=j(T(e.text));return t?M(`say`,`${n}*${D(t)}*`):null}case`test`:return Number(e.attempt)>0?M(e.ok?`ok`:`fail`,`${n}${e.ok?`✓`:`✗`} **Test, attempt ${D(T(e.attempt))}:** ${D(T(e.text),240)}`):M(e.ok?`ok`:`fail`,`${n}${e.ok?`✓`:`✗`} ${D(T(e.text),240)}`);case`plan`:{let t=Array.isArray(e.items)?e.items.map(w):[],r=t.find(e=>e.status===`in_progress`);return M(`info`,`${n}**Plan:** ${t.filter(e=>e.status===`completed`).length} of ${t.length} done${r?`; now: ${D(T(r.text))}`:``}`)}case`review`:return M(e.approved?`ok`:`warn`,`${n}**Review, attempt ${D(T(e.attempt))}:** ${e.approved?`approved`:`changes asked`}. ${D(T(e.summary),240)}`);case`attempt`:return M(`warn`,`${n}**Attempt ${D(T(e.attempt))} of ${D(T(e.max))}:** ${D(T(e.why),240)}`);case`answer`:return M(`dim`,`${n}Attempt ${D(T(e.attempt))}: ${D(T(e.notes)||`changed ${(Array.isArray(e.changed)?e.changed:[]).map(T).join(`, `)}`,240)}`);case`context`:return e.compacted?M(`info`,`${n}Context compacted: the conversation was summarised to make room.`):null;default:return null}}function F(e,t=``){switch(e.type){case`log`:return M(e.level===`error`?`fail`:e.level===`warn`?`warn`:`dim`,`${t}${e.level===`warn`||e.level===`error`?`⚠ `:``}${D(T(e.text))}`);case`step`:return M(`dim`,`${t}**Step ${D(T(e.step))}** · ${e.source===`memory`?`from memory`:D(T(e.category))} · ${k(T(e.title)||`untitled`,T(e.url))}`);case`memory`:return M(`info`,`${t}↻ ${D(T(e.text))}`);case`thought`:return N(`think`,`*${D(T(e.text))}*`);case`outcome`:return N(e.ok?`ok`:`fail`,`${e.ok?`✓`:`✗`} ${D(T(e.text),300)}`);case`done`:{let n=w(e.result);return M(n.status===`complete`?`ok`:`fail`,`${t}**${D(T(n.status))}:** ${D(T(n.summary))}`)}case`code`:return P(e,t);default:return null}}function ce(e){switch(e.type){case`run-start`:return{tone:`info`,kind:`head`,md:`Browser run: ${D(T(e.goal),200)}${e.url?` · ${k(T(e.url).replace(/^https?:\/\//,``),T(e.url))}`:``}`};case`run-event`:return F(w(e.event));case`run-done`:{let t=w(e.result),n=!e.error&&(t.outcome===`passed`||!t.outcome&&t.status===`complete`);return M(n?`ok`:`fail`,`${n?`✓`:`✗`} **Run ${n?`passed`:`failed`}**${E(e.ms)}: ${D(T(e.error)||T(t.summary))}${e.runDir?` · ${O(T(e.runDir))}`:``}`)}case`suite-start`:return{tone:`info`,kind:`head`,md:`Suite: ${(Array.isArray(e.cases)?e.cases:[]).length} cases, ${D(T(e.parallel))} at once`};case`suite-event`:{let t=w(e.event);if(t.type===`case-start`)return M(`info`,`**Case ${Number(t.index)+1} of ${D(T(t.total))}:** ${A(t.case)}`);if(t.type===`case-event`)return F(w(t.event),`${O(T(w(t.case).id))} `);if(t.type===`case-done`){let e=w(t.result);return M(e.status===`passed`?`ok`:`fail`,`${e.status===`passed`?`✓`:`✗`} ${A(e.case)}: **${D(T(e.status))}**${E(e.ms)}${e.summary?`. ${D(T(e.summary),240)}`:``}`)}return t.type===`code-start`?M(`info`,`${O(T(w(t.case).id))} writing its test`):t.type===`writeback`?M(`dim`,`Posted the result back: ${D(JSON.stringify(t.item),240)}`):null}case`suite-done`:{let t=(Array.isArray(w(e.suite).results)?w(e.suite).results:[]).map(w),n=t.filter(e=>e.status===`passed`).length;return M(n===t.length?`ok`:`fail`,`**Suite: ${n} of ${t.length} passed**${E(w(e.suite).ms)}`)}case`info`:return M(e.ok===!1?`fail`:e.ok===!0?`ok`:`info`,D(T(e.text)));case`agent`:return P(w(w(e.event)),`**Coding agent:** `);case`code-start`:return{tone:`info`,kind:`head`,md:`Writing a test: ${D(T(e.goal),200)}`};case`code-done`:return M(e.error?`fail`:`ok`,`${e.error?`✗`:`✓`} **Test ${e.error?`not written`:`written`}**${E(e.ms)}${e.error?`: ${D(T(e.error),240)}`:``}`);case`card`:{let t=w(e.card),n=(Array.isArray(t.body)?t.body:[]).map(T).filter(Boolean);return M(t.status===`ok`?`ok`:t.status===`fail`?`fail`:`info`,`**${D(T(t.title))}**${t.stats?` · ${D(T(t.stats))}`:``}${n.length?`: ${D(n.join(`; `),300)}`:``}`)}case`report`:return M(`ok`,`✓ Report saved: ${D(T(e.title))}`);case`call-start`:return M(`dim`,`→ ${D(T(e.text),240)}`);case`call`:return M(e.ok===!1?`warn`:`dim`,`${e.ok===!1?`⚠`:`✓`} ${D(T(e.text),240)}`);default:return null}}function I(e){let t=T(e.at)||T(e.t),n=null;switch(e.type){case`user`:n=M(`you`,`**You:** ${D(T(e.text),240)}`);break;case`agent`:n=P(w(e.event));break;case`tool`:n=ce(w(e.event));break;case`ask`:n=M(`you`,`**Asked:** ${D(T(w(e.question).title))}`);break;case`wait`:n=M(`you`,`**Waiting for you:** ${D(T(e.prompt))}`);break;case`answered`:n=M(`you`,`**You:** ${e.label===void 0?e.ok?`done, continue`:`cancel`:D(T(e.label))}`);break;case`turn_done`:n=M(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?`: ${D(T(e.error),300)}`:``}`);break;case`settings`:n=M(`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:T(e.text)};break;case`error`:n=M(`warn`,`⚠ ${D(T(e.message))}`);break;case`fatal`:n=M(`fail`,`✗ **ForgeQE cannot go on:** ${D(T(e.message))}`);break;case`exit`:n=M(e.code===0?`dim`:`fail`,`ForgeQE stopped${e.code!==null&&e.code!==void 0?` (exit ${D(T(e.code))})`:``}${e.message?`: ${D(T(e.message))}`:``}`)}return n?{at:t,...n,plain:n.kind===`out`?n.md:se(n.md)}:null}function L(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 le(e,t,n){let r=n?[`## ${D(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=`\`${L(t,n.at)}\``;n.kind===`out`?i.push(`${L(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 R=d();function z({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,R.jsx)(`div`,{className:o(`max-h-[420px] overflow-auto rounded-[10px] border border-line-soft bg-bg font-mono text-[12px] leading-[1.6]`,t),children:(0,R.jsx)(`table`,{className:`w-full border-collapse`,children:(0,R.jsx)(`tbody`,{children:i.map(e=>(0,R.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,R.jsx)(`td`,{className:`w-10 px-2 text-right align-top text-muted tabular-nums select-none`,children:e.a}),(0,R.jsx)(`td`,{className:`w-10 px-2 text-right align-top text-muted tabular-nums select-none`,children:e.b}),(0,R.jsx)(`td`,{"aria-hidden":`true`,className:o(`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,R.jsxs)(`td`,{className:o(`pr-3 align-top whitespace-pre`,e.kind===`hunk`?`text-muted`:`text-ink`),children:[(0,R.jsx)(`span`,{className:`sr-only`,children:e.kind===`add`?`added: `:e.kind===`del`?`removed: `:``}),e.text||` `]})]},e.key))})})})}var B=e=>{let t=V(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},V=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{},H=e=>typeof e==`string`?e:e==null?``:String(e),ue=[[/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`]],de=/run_test_cases|browser_run|run_suite|write_test/,fe=[[/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 U(e){let t=e.toLowerCase();if(!W(t))return fe.find(([e])=>e.test(t))?.[1]}var pe=[[/^(azure_devops|ado|azuredevops)_/,`Azure DevOps`],[/^(jira|atlassian)_/,`Jira`],[/^confluence_/,`Confluence`],[/^github_/,`GitHub`],[/^xray_/,`Xray`],[/^testrail_/,`TestRail`],[/^zephyr_/,`Zephyr Scale`],[/^qtest_/,`qTest`]],me=/(^|_)(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 W(e){let t=e.toLowerCase();if(!t.startsWith(`forgeqe_`))return pe.find(([e])=>e.test(t))?.[1]}var he=e=>{let t=V(e);return typeof t.diff==`string`&&t.diff?{diff:t.diff,added:Number(t.added)||0,removed:Number(t.removed)||0}:void 0},G=e=>Array.isArray(e)?e.map(H).filter(Boolean):[];function ge(e,t,n){let r=H(e.status)||(t?`failed`:``);return{status:r,ok:!t&&/^(passed|pass|written|ok|known_defect)$/i.test(r),...H(e.testFile)?{testFile:H(e.testFile)}:{},...H(e.testName)?{testName:H(e.testName)}:{},...H(e.command)?{command:H(e.command)}:{},...typeof e.attempts==`number`?{attempts:e.attempts}:{},...typeof e.maxAttempts==`number`?{maxAttempts:e.maxAttempts}:{},changed:G(e.changed),reused:G(e.reused),...n?{runDir:n}:{},...t?{error:t}:{},...H(e.notes)?{notes:H(e.notes)}:{}}}function _e(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){let e=V(n),r=(typeof n==`string`?n:H(e.label)||H(e.request)).replace(/\s+/g,` `).trim(),i=(typeof n==`string`?n:H(e.request)||H(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 K(e){let t=e.toLowerCase(),n=W(t);if(n)return me.test(t.replace(/^[a-z]+_/,``))?{label:`Updating ${n}`,orb:`working`}:{label:`Reading ${n}`,orb:`reading`};for(let[e,n,r]of ue)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 ve(e,t){return{id:e,user:t,steps:[],parts:[],next:[],asks:[],waits:[],log:[],plan:[],changes:[],tests:[],reports:[]}}function ye(e){let t=V(e);return[H(t.id),H(t.title)].filter(Boolean).join(`: `)}function be(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:${H(t.parent)}`):void 0;if(r)return r.children??=[];let o=H(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:b(o).name,status:`running`,orb:`handing`,agent:o}),s.agent??=o,s.children??=[]},s=(e,n,r)=>{let s=H(n.kind),c=H(n.id);if((s===`start`||s===`tool`)&&de.test(H(n.tool))&&!W(H(n.tool)))return;let l=o(e,n,r),u=V(n.delegate),d=H(u.agent)?{agent:H(u.agent),task:H(u.task)}:void 0;if(s===`start`){if(d)a(e,{key:`c:${c}`,label:`Hands off to ${b(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}=K(H(n.tool)||H(n.text)),i=l?void 0:U(H(n.tool));a(e,{key:`c:${c}`,label:t,arg:H(n.text)&&H(n.text)!==H(n.tool)?H(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=V(n.file),o=he(n.change);if(o&&H(r.path)){let t=e.changes.find(e=>e.path===H(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:H(r.path),...o,...H(n.agent)?{agent:H(n.agent)}:{}})}if(t)t.status=n.ok===!1?`fail`:`ok`,t.handoff&&H(u.result)&&(t.handoff.result=H(u.result));else if(d)a(e,{key:`c:${c||e.steps.length}`,label:`Hands off to ${b(d.agent).name}`,arg:d.task||void 0,status:n.ok===!1?`fail`:`ok`,orb:`handing`,agent:d.agent,handoff:{...d,...H(u.result)?{result:H(u.result)}:{}},children:[]},l);else{let{label:t,orb:i}=K(H(n.tool)||H(n.text)),s=l?void 0:U(H(n.tool));a(e,{key:`c:${c||e.steps.length}`,label:t,arg:H(r.path)||H(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`?H(n.text):t.text+H(n.text):e.parts.push({id:c||`p${e.parts.length}`,text:H(n.text)})}else if(s===`plan`){if(l||n.agent&&n.agent!==`forgeqe`)return;let t=Array.isArray(n.items)?n.items.map(V):[],r=e=>e===`completed`?`done`:e===`in_progress`?`active`:e===`cancelled`?`skipped`:`pending`;e.plan=t.map(e=>({text:H(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:H(n.text),status:n.ok?`ok`:`fail`,orb:`retrying`},l);else if(n.ok&&/\bconnected$/i.test(H(n.text)))return;else a(e,{key:`t:${e.steps.length}`,label:H(n.text)||(n.ok?`Checked`:`Check failed`),status:n.ok?`ok`:`fail`,orb:/connect|mcp/i.test(H(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:H(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=B(n.usage)??t.usage);else if(s===`info`){let t=(l??e.steps).at(-1);t&&t.lines.push({text:H(n.text)})}},c,l=(e,t)=>{let n=H(t.type);if(n===`run-start`)a(e,{key:`run:${e.steps.length}`,label:`Running in the browser`,arg:H(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=V(t.event);if(!n)return;r.type===`outcome`?n.lines.push({text:`Step ${H(r.step)}: ${H(r.action)||H(r.text)}`,ok:r.ok===!0||r.ok!==!1&&void 0}):r.type===`log`&&(r.level!==`info`||r.progress)&&n.lines.push({text:H(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=V(t.result),i=!t.error&&(r.outcome===`passed`||!r.outcome&&r.status===`complete`);if(n){n.status=i?`ok`:`fail`;let e=H(t.error)||H(r.summary);e&&n.lines.push({text:e,ok:!!i})}H(t.runDir)&&e.reports.push({label:i?`Browser run report`:`Browser run report (failed)`,path:H(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=V(t.event);if(n&&r.type===`case-done`){let e=V(r.result);n.lines.push({text:`${ye(e.case)}: ${H(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(V(t.suite).results)?V(t.suite).results.map(V):[];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=V(t.card);a(e,{key:`card:${e.steps.length}`,label:H(n.title),arg:H(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:H(e)}))})}else if(n===`call-start`&&!t.quiet)a(e,{key:`call:${H(t.id)}`,label:H(t.text),status:`running`,orb:`working`});else if(n===`call`&&!t.quiet){let n=t.id?i(e,`call:${H(t.id)}`):void 0;n?n.status=t.ok===!1?`fail`:`ok`:a(e,{key:`call:${e.steps.length}`,label:H(t.text),status:t.ok===!1?`fail`:`ok`,orb:`working`})}else if(n===`code-start`)c=H(t.runDir)||void 0,a(e,{key:`code:${e.steps.length}`,label:`Writing the test`,arg:H(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:H(t.error),ok:!1})),e.tests.push(ge(V(t.result),H(t.error),c)),c=void 0}else if(n===`agent`)s(e,V(t.event),!0);else if(n===`info`){let n=e.steps.at(-1);n?n.lines.push({text:H(t.text),ok:t.ok===!0||t.ok!==!1&&void 0}):a(e,{key:`info:${e.steps.length}`,label:H(t.text),status:t.ok===!1?`fail`:`info`,orb:`working`})}else n===`report`&&(a(e,{key:`report:${e.steps.length}`,label:`Report saved`,arg:H(t.title),status:`ok`,orb:`working`}),H(t.html)&&e.reports.push({label:H(t.title)||`Report`,path:H(t.html)}))};for(let r of e){u(r);let e=I(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=ve(H(e.id),H(e.text));t.turns.push(r),n.set(r.id,r);break}case`ready`:{let n=V(e.profile);n.name&&(t.model={name:H(n.name),provider:H(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=H(e.t)||H(e.at));break}case`agent`:{let t=r(e.id);t&&s(t,V(e.event),!1);break}case`tool`:{let t=r(e.id);t&&l(t,V(e.event));break}case`ask`:{let t=r(e.turn),n=V(e.question);t?.asks.push({id:H(e.id),title:H(n.title),detail:H(n.detail)||void 0,lines:Array.isArray(n.lines)?n.lines.map(H):[],options:(Array.isArray(n.options)?n.options:[]).map(e=>({id:H(V(e).id),label:H(V(e).label)}))});break}case`wait`:r(e.turn)?.waits.push({id:H(e.id),prompt:H(e.prompt)});break;case`answered`:for(let n of t.turns){let t=n.asks.find(t=>t.id===e.ask);t&&(t.answer=H(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=H(e.reply),n.next=_e(e.next),n.error=H(e.error)||void 0,n.ended=H(e.t)||H(e.at),t.usage=B(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(H(e.message));break;case`fatal`:t.fatal=H(e.message);break;case`exit`:t.ended={code:typeof e.code==`number`?e.code:null,stderr:Array.isArray(e.stderr)?e.stderr.map(H):void 0,message:H(e.message)||void 0}}}}function xe(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 Se(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 Ce={running:`active`,ok:`done`,fail:`failed`,info:`note`};function we(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(Ce[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,...Te(l)]}function Te(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 Ee={done:`bg-pass/30`,active:`bg-accent/25`,pending:`bg-line`,failed:`bg-fail/30`,skipped:`bg-line`,note:`bg-line`};function q({status:e,orb:t,px:n=20,spin:i=!1}){let a={width:n,height:n};return e===`active`&&i?(0,R.jsx)(`span`,{role:`img`,"aria-label":`At work`,className:`flex flex-none items-center justify-center`,style:a,children:(0,R.jsx)(s,{size:n-2,strokeWidth:2.5,"aria-hidden":`true`,className:`animate-spin text-accent motion-reduce:animate-none`})}):e===`active`?(0,R.jsx)(r,{state:t,px:n,label:`At work`}):e===`done`?(0,R.jsx)(`span`,{role:`img`,"aria-label":`Done`,className:`flex flex-none items-center justify-center rounded-full bg-pass`,style:a,children:(0,R.jsx)(c,{size:n*.6,strokeWidth:3,"aria-hidden":`true`,className:`text-white`})}):e===`failed`?(0,R.jsx)(`span`,{role:`img`,"aria-label":`Failed`,className:`flex flex-none items-center justify-center rounded-full bg-fail`,style:a,children:(0,R.jsx)(f,{size:n*.6,strokeWidth:3,"aria-hidden":`true`,className:`text-white`})}):e===`note`?(0,R.jsx)(`span`,{role:`img`,"aria-label":`Note`,className:`flex flex-none items-center justify-center`,style:a,children:(0,R.jsx)(`span`,{className:`size-1.5 rounded-full bg-line-strong`})}):(0,R.jsx)(`span`,{role:`img`,"aria-label":e===`skipped`?`Skipped`:`To come`,className:o(`box-border block flex-none rounded-full border-2 border-line-strong`,e===`skipped`&&`border-dashed`),style:a})}var De=(e,t)=>e.status===`running`?t?`active`:`done`:e.status===`ok`?`done`:e.status===`fail`?`failed`:`note`,Oe=e=>/[/\\]|\.\w{1,5}$|^\$ /.test(e)&&!/\s{2,}/.test(e);function J({text:e}){return(0,R.jsx)(`span`,{className:o(`min-w-0 max-w-full truncate rounded-md bg-surface-strong px-1.5 py-0.5 text-[12.5px] text-ink-2`,Oe(e)&&`font-mono text-[12px]`),children:e})}function ke({step:e}){return(0,R.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,R.jsxs)(`li`,{className:o(`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,R.jsx)(`span`,{"aria-hidden":`true`,children:e.ok?`✓`:`✗`}),(0,R.jsx)(g,{text:e.text,className:`min-w-0 text-[13px] leading-relaxed text-inherit [&_p]:my-0`})]},t))})}function Y({agent:e,named:t=!0,working:n=!1}){let r=b(e);return(0,R.jsxs)(`span`,{className:`inline-flex flex-none items-center gap-1.5`,title:r.name,children:[(0,R.jsx)(y,{agent:e,px:18,decorative:t,working:n}),t&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`font-medium`,style:{color:r.hue},children:r.name}),(0,R.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted`,children:`·`})]})]})}function X({step:e,from:t,live:n}){let r=e.handoff.agent,i=b(r);return(0,R.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5`,children:[(0,R.jsx)(y,{agent:t,px:18}),(0,R.jsxs)(`span`,{role:`img`,"aria-label":`hands off to`,className:o(`handoff-flow flex-none`,n&&`is-live`),style:{color:i.hue},children:[(0,R.jsx)(`span`,{}),(0,R.jsx)(`span`,{}),(0,R.jsx)(`span`,{})]}),(0,R.jsx)(y,{agent:r,px:20,decorative:!0,working:n,className:`handoff-in`}),(0,R.jsx)(`span`,{className:`font-medium`,style:{color:i.hue},children:i.name}),e.arg&&(0,R.jsx)(J,{text:e.arg})]})}function Ae({step:e,working:t,from:n=ne}){let r=e.agent||n,i=je(e),a=De(e,t),[s,c]=(0,C.useState)(null),l=s??((!!e.handoff||!!e.agent)&&a===`active`),d=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(q,{status:a,orb:e.orb,px:16,spin:!0}),e.handoff?(0,R.jsx)(X,{step:e,from:n,live:a===`active`}):(0,R.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5`,children:[(0,R.jsx)(Y,{agent:r,named:r!==n,working:a===`active`}),(0,R.jsx)(`span`,{className:o(`[overflow-wrap:anywhere]`,a===`active`?`text-ink`:`text-ink-2`),children:e.label}),e.arg&&(0,R.jsx)(J,{text:e.arg}),e.change&&(0,R.jsxs)(`span`,{className:`font-mono text-[12px] tabular-nums`,children:[(0,R.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.change.added]}),` `,(0,R.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.change.removed]})]})]}),i&&(0,R.jsx)(u,{size:14,"aria-hidden":`true`,className:o(`mt-0.5 ml-auto flex-none text-muted transition-transform`,l&&`rotate-180`)})]});return(0,R.jsxs)(`li`,{className:`flex flex-col`,children:[i?(0,R.jsx)(`button`,{type:`button`,"aria-expanded":l,onClick:()=>c(!l),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,R.jsx)(`div`,{className:`flex min-h-8 items-start gap-2 px-1.5 py-1.5 text-[13.5px]`,children:d}),l&&i&&(0,R.jsx)(Me,{step:e,working:t,from:n,className:`mb-1 ml-[13px]`})]})}var je=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,R.jsxs)(`div`,{className:o(`chain-in flex flex-col gap-1.5 border-l-2 py-1 pl-3`,r),style:{borderColor:a?`${b(a).hue}66`:`var(--color-line)`},children:[e.lines.length>0&&(0,R.jsx)(ke,{step:e}),e.change&&(0,R.jsx)(z,{diff:e.change.diff}),i.length>0&&(0,R.jsx)(`ul`,{"aria-label":a?`What ${b(a).name} did`:`Steps`,className:`m-0 flex list-none flex-col p-0`,children:i.map(e=>(0,R.jsx)(Ae,{step:e,working:t,from:a||n},e.key))}),e.handoff?.result&&(0,R.jsxs)(`div`,{className:`flex flex-col gap-0.5 text-[13px]`,children:[(0,R.jsxs)(`span`,{className:`text-muted`,children:[b(e.handoff.agent).name,` answered`]}),(0,R.jsx)(g,{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,s=e.step,c=a.length>0||!!r||!!s&&je(s),[l,d]=(0,C.useState)(null),f=l??(e.status===`active`||e.status===`failed`),p=s?.orb??[...a].reverse().find(e=>e.status===`running`)?.orb??r?.orb??`thinking`;return(0,R.jsxs)(`li`,{className:`flex gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-none flex-col items-center`,children:[(0,R.jsx)(`span`,{className:`mt-[3px]`,children:(0,R.jsx)(q,{status:e.status,orb:p,spin:!i})}),!t&&(0,R.jsx)(`span`,{"aria-hidden":`true`,className:o(`mt-1.5 min-h-4 w-0.5 flex-1 rounded-sm`,Ee[e.status])})]}),(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col pb-2`,children:[c?(0,R.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,R.jsx)(Pe,{node:e}),(0,R.jsx)(u,{size:14,"aria-hidden":`true`,className:o(`mt-1 flex-none text-muted transition-transform`,f&&`rotate-180`)}),e.status===`active`&&(0,R.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`,children:`In progress`})]}):(0,R.jsx)(`div`,{className:`min-h-7`,children:(0,R.jsx)(Pe,{node:e})}),f&&c&&(0,R.jsx)(`div`,{className:`chain-in mt-0.5`,children:s?(0,R.jsx)(Me,{step:s,working:n,from:`forgeqe`,className:`mt-1`}):(0,R.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[a.map(e=>(0,R.jsx)(Ae,{step:e,working:n},e.key)),r&&(0,R.jsx)(`li`,{children:(0,R.jsx)(Z,{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,R.jsx)(X,{step:n,from:ne,live:e.status===`active`}):(0,R.jsxs)(`span`,{className:o(`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,R.jsx)(Y,{agent:n.agent||`forgeqe`,named:!!n.agent&&n.agent!==`forgeqe`,working:e.status===`active`}),e.status===`active`?(0,R.jsx)(`span`,{className:`shimmer [overflow-wrap:anywhere]`,children:(0,R.jsx)(`span`,{children:e.label})}):(0,R.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.label}),n?.arg&&(0,R.jsx)(J,{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`,think:`text-muted italic`};function Ie(e){let[t,n]=(0,C.useState)(()=>Date.now());(0,C.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 Z({live:e,orb:t=!1,className:n}){let i=Ie(e.latest?.at);return(0,R.jsxs)(`div`,{className:o(`flex min-h-8 items-start gap-2 py-1`,n),children:[(0,R.jsx)(`span`,{className:`mt-0.5 flex size-4 flex-none items-center justify-center`,children:t?(0,R.jsx)(r,{state:e.orb,px:20,label:`At work`}):(0,R.jsxs)(`span`,{"aria-hidden":`true`,className:`relative flex size-2`,children:[(0,R.jsx)(`span`,{className:`absolute inline-flex size-full animate-ping rounded-full bg-accent opacity-60 motion-reduce:animate-none`}),(0,R.jsx)(`span`,{className:`relative inline-flex size-2 rounded-full bg-accent`})]})}),(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,R.jsx)(`span`,{className:`shimmer text-[13.5px] font-medium text-muted`,children:(0,R.jsx)(`span`,{"aria-live":`polite`,children:e.text})}),e.latest&&(0,R.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,R.jsx)(`span`,{className:o(`min-w-0 truncate font-mono text-[12px]`,Fe[e.latest.tone]),children:e.latest.plain}),(0,R.jsxs)(`span`,{className:`flex-none text-[11.5px] whitespace-nowrap text-muted tabular-nums`,children:[i,i&&` · `,e.events,` `,e.events===1?`event`:`events`]})]})]})]})}function Le({turn:e,working:t,live:n,folded:r=!1}){if(r)return(0,R.jsx)(Z,{live:n,orb:!0});let i=we(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,R.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,R.jsx)(`li`,{className:`flex gap-3`,children:(0,R.jsx)(Z,{live:n,orb:!c,className:`-mt-1 min-w-0 flex-1 py-0`})},`now`):(0,R.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 Q({label:e,children:t}){return(0,R.jsxs)(`div`,{className:`grid grid-cols-[110px_minmax(0,1fr)] items-baseline gap-3 py-1.5 text-sm`,children:[(0,R.jsx)(`span`,{className:`text-muted`,children:e}),(0,R.jsx)(`div`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:t})]})}function ze({text:e}){let[t,n]=(0,C.useState)(!1);return(0,R.jsxs)(`div`,{className:`flex items-start gap-2 rounded-[10px] bg-surface-muted px-3 py-2`,children:[(0,R.jsx)(ae,{size:14,"aria-hidden":`true`,className:`mt-0.5 flex-none text-muted`}),(0,R.jsx)(`code`,{className:`min-w-0 flex-1 font-mono text-[12.5px] break-all whitespace-pre-wrap text-ink`,children:e}),(0,R.jsx)(`button`,{type:`button`,"aria-label":t?`Copied`:`Copy the command`,onClick:async()=>{await _(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,R.jsx)(c,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,R.jsx)(h,{size:14,"aria-hidden":`true`})})]})}function Be({t}){return(0,R.jsxs)(`div`,{className:`flex flex-col`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pb-1`,children:[(0,R.jsx)(a,{size:16,"aria-hidden":`true`,className:`text-accent`}),(0,R.jsx)(`span`,{className:`font-medium`,children:`Test written`}),(0,R.jsx)(re,{tone:t.ok?`pass`:t.status===`stopped`?`neutral`:`fail`,children:Re[t.status]||t.status||`Not written`}),t.attempts!==void 0&&(0,R.jsx)(`span`,{className:`text-[13px] text-muted`,children:t.maxAttempts?`attempt ${t.attempts} of ${t.maxAttempts}`:e(t.attempts,`attempt`)})]}),t.testFile&&(0,R.jsx)(Q,{label:`Test file`,children:(0,R.jsx)(v,{path:t.testFile})}),t.testName&&(0,R.jsx)(Q,{label:`Test`,children:(0,R.jsx)(`code`,{className:`font-mono text-[12.5px]`,children:t.testName})}),t.command&&(0,R.jsx)(Q,{label:`Run it`,children:(0,R.jsx)(ze,{text:t.command})}),t.runDir&&(0,R.jsx)(Q,{label:`From the run`,children:(0,R.jsx)(v,{path:t.runDir})}),t.reused.length>0&&(0,R.jsx)(Q,{label:`Reused`,children:(0,R.jsx)(`span`,{className:`flex flex-wrap gap-x-2 gap-y-1`,children:t.reused.map(e=>(0,R.jsx)(v,{path:e},e))})}),t.error&&(0,R.jsx)(`p`,{className:`m-0 mt-1 rounded-[10px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:t.error})]})}function Ve({c:e}){let[t,n]=(0,C.useState)(!1);return(0,R.jsxs)(`li`,{className:`flex flex-col`,children:[(0,R.jsxs)(`div`,{className:`flex min-h-9 items-center gap-2`,children:[(0,R.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,R.jsx)(u,{size:15,"aria-hidden":`true`,className:o(`transition-transform`,!t&&`-rotate-90`)})}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,R.jsx)(v,{path:e.path})}),(0,R.jsxs)(`span`,{className:`flex-none font-mono text-[12px] tabular-nums`,children:[(0,R.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.added]}),` `,(0,R.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.removed]})]})]}),t&&(0,R.jsx)(z,{diff:e.diff,className:`chain-in mb-2 ml-9`})]})}function He({turn:t}){let r=t.reports.filter((e,t,n)=>n.findIndex(t=>t.path===e.path)===t),i=new Set(t.changes.map(e=>e.path)),a=[...new Set(t.tests.flatMap(e=>e.changed))].filter(e=>!i.has(e)&&![...i].some(t=>t.endsWith(e)||e.endsWith(t)));return!t.tests.length&&!r.length&&!t.changes.length&&!a.length?null:(0,R.jsxs)(`section`,{"aria-label":`Result`,className:`flex flex-col gap-4 rounded-[14px] border border-line-soft px-4 py-3`,children:[t.tests.map((e,t)=>(0,R.jsx)(Be,{t:e},t)),r.length>0&&(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium`,children:`Reports`}),(0,R.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-sm`,children:r.map(e=>(0,R.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,R.jsx)(`span`,{className:`text-ink-2`,children:e.label}),(0,R.jsx)(v,{path:e.path})]},e.path))})]}),(t.changes.length>0||a.length>0)&&(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm font-medium`,children:[(0,R.jsx)(n,{size:15,"aria-hidden":`true`,className:`text-muted`}),`Files changed`,(0,R.jsxs)(`span`,{className:`font-normal text-muted`,children:[e(t.changes.length+a.length,`file`),` · `,(0,R.jsxs)(`span`,{className:`text-pass`,children:[`+`,t.changes.reduce((e,t)=>e+t.added,0)]}),` `,(0,R.jsxs)(`span`,{className:`text-fail`,children:[`−`,t.changes.reduce((e,t)=>e+t.removed,0)]})]})]}),(0,R.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[t.changes.map(e=>(0,R.jsx)(Ve,{c:e},e.path)),a.map(e=>(0,R.jsx)(`li`,{className:`flex min-h-9 items-center gap-2 pl-9`,children:(0,R.jsx)(v,{path:e})},e))]})]})]})}function $({lines:e,start:t,live:n,name:r}){let i=(0,C.useRef)(null),a=(0,C.useRef)(!0),[o,s]=(0,C.useState)(!1),l=(0,C.useMemo)(()=>le(e,t),[e,t]);(0,C.useEffect)(()=>{a.current&&i.current&&(i.current.scrollTop=i.current.scrollHeight)},[l]);let u=`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,R.jsxs)(`div`,{className:`overflow-hidden rounded-[12px] border border-line-soft bg-surface-muted`,children:[(0,R.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,R.jsxs)(`span`,{className:`flex-1`,children:[`Markdown · `,e.length,` event`,e.length===1?``:`s`,n&&` · live`]}),(0,R.jsxs)(`button`,{type:`button`,"aria-label":o?`Copied`:`Copy the activity log as Markdown`,onClick:async()=>{try{await navigator.clipboard.writeText(l),s(!0),setTimeout(()=>s(!1),1500)}catch{}},className:u,children:[o?(0,R.jsx)(c,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,R.jsx)(h,{size:14,"aria-hidden":`true`}),o?`Copied`:`Copy`]}),(0,R.jsxs)(`button`,{type:`button`,"aria-label":`Download the activity log as a Markdown file`,onClick:()=>{let e=URL.createObjectURL(new Blob([l],{type:`text/markdown;charset=utf-8`})),t=document.createElement(`a`);t.href=e,t.download=r,t.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3)},className:u,children:[(0,R.jsx)(te,{size:14,"aria-hidden":`true`}),`.md`]})]}),(0,R.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,R.jsx)(g,{text:l,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 Ue({ask:e,live:t,onAnswer:n}){let r=t&&e.answer===void 0;return(0,R.jsxs)(`div`,{className:o(`flex flex-col gap-3 rounded-[14px] border px-4 py-3`,r?`border-accent-line bg-accent-soft`:`border-line-soft`),children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,R.jsx)(ie,{size:18,"aria-hidden":`true`,className:`mt-0.5 flex-none text-accent`}),(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:e.title}),e.detail&&(0,R.jsx)(`span`,{className:`text-sm text-ink-2`,children:e.detail}),e.lines.map((e,t)=>(0,R.jsx)(`span`,{className:`text-sm text-ink-2 [overflow-wrap:anywhere]`,children:e},t))]})]}),r?(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.options.map(e=>(0,R.jsx)(l,{size:`sm`,onClick:()=>n(e.id),children:e.label},e.id)),(0,R.jsx)(l,{size:`sm`,variant:`ghost`,onClick:()=>n(null),children:`Cancel`})]}):(0,R.jsx)(`span`,{className:`text-sm text-muted`,children:e.answer===void 0?`Not answered`:`You chose: ${e.answer}`})]})}function We({wait:e,live:t,onProceed:n}){let r=t&&e.answer===void 0;return(0,R.jsxs)(`div`,{className:o(`flex flex-col gap-3 rounded-[14px] border px-4 py-3`,r?`border-accent-line bg-accent-soft`:`border-line-soft`),children:[(0,R.jsxs)(`span`,{className:`flex items-start gap-2`,children:[(0,R.jsx)(ee,{size:18,"aria-hidden":`true`,className:`mt-0.5 flex-none text-accent`}),(0,R.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.prompt})]}),r?(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,R.jsx)(l,{size:`sm`,variant:`primary`,onClick:()=>n(!0),children:`Done, continue`}),(0,R.jsx)(l,{size:`sm`,onClick:()=>n(!1),children:`Cancel`})]}):(0,R.jsx)(`span`,{className:`text-sm text-muted`,children:e.answer===void 0?`Not done`:e.answer?`You continued`:`You cancelled`})]})}function Ge({turn:e,live:t,onAnswer:n,onProceed:r}){let i=t&&!e.outcome,[a,s]=(0,C.useState)(null),c=a??i,l=xe(e),d=i?l.text:Se(e),f=e.parts.map(e=>j(e.text)).filter(Boolean),[m,h]=(0,C.useState)(!1),_=[...e.log].reverse().find(e=>e.tone!==`you`&&e.tone!==`say`);return(0,R.jsxs)(`div`,{className:`flex gap-3`,children:[(0,R.jsx)(`div`,{className:`size-9 flex-none`,"aria-hidden":`true`,children:(0,R.jsx)(y,{agent:`forgeqe`,px:34,working:i,className:`mt-0.5`})}),(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3 pt-1.5`,children:[(e.steps.length>0||i||e.log.length>0)&&(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,R.jsxs)(`button`,{type:`button`,"aria-expanded":c,disabled:!e.steps.length&&!e.plan.length,onClick:()=>s(!c),className:o(`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`,i&&`shimmer`),children:[(0,R.jsx)(`span`,{"aria-live":`polite`,children:d}),(e.steps.length>0||e.plan.length>0)&&(0,R.jsx)(u,{size:16,"aria-hidden":`true`,className:o(`transition-transform`,c&&`rotate-180`)})]}),e.log.length>0&&(0,R.jsxs)(`button`,{type:`button`,"aria-expanded":m,onClick:()=>h(!m),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,R.jsx)(p,{size:14,"aria-hidden":`true`}),`Activity log`,(0,R.jsx)(`span`,{className:`tabular-nums`,children:e.log.length})]})]}),(c||i)&&(e.steps.length>0||e.plan.length>0||i)&&(0,R.jsx)(Le,{turn:e,working:i,folded:!c,live:{...l,latest:_,events:e.log.length,onLog:()=>h(!0)}}),m&&(0,R.jsx)($,{lines:e.log,start:e.started||e.log[0]?.at,live:i,name:`forgeqe-activity-${e.id}.md`})]}),e.asks.map(e=>(0,R.jsx)(Ue,{ask:e,live:i,onAnswer:t=>n(e.id,t)},e.id)),e.waits.map(e=>(0,R.jsx)(We,{wait:e,live:i,onProceed:t=>r(e.id,t)},e.id)),e.outcome&&e.reply?(0,R.jsx)(g,{text:e.reply}):f.length>0&&(0,R.jsx)(g,{text:f.join(`
7
-
8
- `)}),(0,R.jsx)(He,{turn:e}),e.error&&(0,R.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,R.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Stopped.`})]})]})}export{j as a,I as i,Ge as n,be as r,$ as t};