@capagents/forgeqe 2.4.6 → 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.
- package/dist/docs-site/docs/search.js +1 -1
- package/dist/docs-site/docs/web-app/index.html +9 -5
- package/dist/forgeqe.js +829 -829
- package/dist/web/assets/ApiTests-D5YLst-t.js +2 -0
- package/dist/web/assets/{Chat-DU2a1lg2.js → Chat-DUZawyA0.js} +3 -3
- package/dist/web/assets/{Data-BMmaUggv.js → Data-BOu8BrmB.js} +4 -4
- package/dist/web/assets/{Features-Ciy-CcIJ.js → Features-BCBzUoB7.js} +1 -1
- package/dist/web/assets/Jobs-C-Tqj504.js +3 -0
- package/dist/web/assets/Quality-CzCArgrj.js +1 -0
- package/dist/web/assets/Record-CcHMCfs6.js +1 -0
- package/dist/web/assets/{Regression-DpRx7yLr.js → Regression-CgiNh2hj.js} +2 -2
- package/dist/web/assets/{Reports-BE4Jg3Pa.js → Reports-CXRY0udx.js} +2 -2
- package/dist/web/assets/Response-VUbDhVeF.js +8 -0
- package/dist/web/assets/Runs-kghxBY8X.js +2 -0
- package/dist/web/assets/capgemini-BO8ajcbd.svg +21 -0
- package/dist/web/assets/{circle-dashed-CEZcCi0T.js → circle-dashed-CQKCycSk.js} +1 -1
- package/dist/web/assets/{external-link-NCKfigiH.js → external-link-B45wnQ3R.js} +1 -1
- package/dist/web/assets/{file-chart-column-increasing-tV7y_ABu.js → file-chart-column-increasing-9rCBQxTk.js} +1 -1
- package/dist/web/assets/frame-CHQgOaj6.js +3 -0
- package/dist/web/assets/index-CwX6YH3i.css +2 -0
- package/dist/web/assets/index-Hd8gmpz5.js +26 -0
- package/dist/web/assets/{markdown-BmsRBxB-.js → markdown-BPBR6Fva.js} +8 -8
- package/dist/web/assets/{sticky-note-CinvvKBc.js → sticky-note-D_lJfPYH.js} +1 -1
- package/dist/web/assets/{terminal-EkGTrfG9.js → terminal-BZSHVR9y.js} +1 -1
- package/dist/web/assets/{trending-up-BLA071mC.js → trending-up-Bypj2D7Z.js} +1 -1
- package/dist/web/index.html +3 -3
- package/docs/WEB_APP.md +9 -5
- package/docs/walkthrough/hotfix-narration.md +297 -443
- package/forgeqe.example.yaml +1 -0
- package/package.json +1 -1
- package/dist/web/assets/ApiTests-CNUbGOAY.js +0 -2
- package/dist/web/assets/Jobs-D6siJpbm.js +0 -3
- package/dist/web/assets/Quality-BrEGVxJH.js +0 -1
- package/dist/web/assets/Record-DrlDedsV.js +0 -1
- package/dist/web/assets/Response-pcvzCf4S.js +0 -8
- package/dist/web/assets/Runs-DemSYbtq.js +0 -2
- package/dist/web/assets/frame-Dq1wC8eF.js +0 -3
- package/dist/web/assets/index-C_8DS1Wt.js +0 -26
- package/dist/web/assets/index-E1pAbXe5.css +0 -2
package/forgeqe.example.yaml
CHANGED
|
@@ -148,6 +148,7 @@ prompts:
|
|
|
148
148
|
# theme:
|
|
149
149
|
# name: Contoso QA # beside the logo in the sidebar; without a logo, in its place
|
|
150
150
|
# logo: ./brand/logo.svg # PNG, JPEG, WebP or SVG in the project, at most 512 KB
|
|
151
|
+
# logo_mark: ./brand/mark.svg # a square or round logo for the narrow sidebar; else a square logo, or the first letter
|
|
151
152
|
# logo_frame: plain # plain (as it is) | rounded | circle | tile (on a white tile, for a dark logo)
|
|
152
153
|
# logo_size: standard # standard | large (a wide logo across the sidebar's top, for one with small words)
|
|
153
154
|
# primary: "#0b1f3a" # the sidebar; its text turns white on a dark colour
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capagents/forgeqe",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.7",
|
|
4
4
|
"description": "ForgeQE: a browser agent CLI that runs goals and test cases in local Chrome or Chromium, or BrowserStack and TestMu AI/LambdaTest when configured, and turns passing runs into tests in your repo",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"repository": {
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{G as e,H as t,Hn as n,K as r,Tt as i,V as a,W as o,at as s,bn as c,en as l,et as u,nt as d,ot as f,pt as p,r as m,rt as h,st as g,t as _,tt as v,ut as y,xn as b,zn as x}from"./frame-Dq1wC8eF.js";import{t as S}from"./circle-dashed-CEZcCi0T.js";import"./markdown-BmsRBxB-.js";import{D as C,O as w,_ as T,g as E,j as D,n as O,r as ee,s as k,t as A}from"./index-C_8DS1Wt.js";import{t as j}from"./when-CHnpLdYw.js";var M=n(x(),1),N=s(),P={passed:`pass`,failed:`fail`,error:`fail`,skipped:`neutral`},F={GET:`text-pass`,POST:`text-accent-fg`,PUT:`text-warn`,PATCH:`text-warn`,DELETE:`text-fail`},te={run:`a browser run's calls`,openapi:`OpenAPI`,swagger:`Swagger`,wsdl:`WSDL`,graphql:`GraphQL`,proto:`.proto`,case:`a test case`,text:`a description`},I=e=>new Date(e).toLocaleString([],{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`});function L({job:e,onStop:t}){let n=(0,M.useRef)(null);(0,M.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,N.jsxs)(`section`,{"aria-label":e.running?r: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:e.running?r:i}),(0,N.jsx)(k,{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,N.jsxs)(h,{onClick:t,className:`border-fail text-fail hover:bg-fail-soft`,children:[(0,N.jsx)(p,{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…`})]})]})}var R=({m:e})=>(0,N.jsx)(`span`,{className:f(`w-[58px] flex-none font-mono text-[12px] font-semibold`,F[e.toUpperCase()]||`text-ink-2`),children:e.toUpperCase()});function ne({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,N.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,N.jsx)(R,{m:e.method}),(0,N.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,N.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,N.jsx)(`span`,{className:f(`truncate text-[12px]`,t?.status===`skipped`?`text-muted`:`text-fail`),title:r,children:r}):(e.writes||e.needsData?.length)&&(0,N.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,N.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,N.jsx)(`span`,{className:`flex justify-end`,children:t?(0,N.jsx)(k,{tone:P[t.status],children:t.status===`skipped`?`Skipped`:t.httpStatus?`${t.httpStatus}`:t.status}):(0,N.jsx)(`span`,{className:`text-[12px] text-muted`,children:`Not run`})})]})}function re({s:e,r:t}){let[n,r]=(0,M.useState)(!1);return(0,N.jsxs)(`li`,{className:`border-t border-line-soft first:border-t-0`,children:[(0,N.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,N.jsx)(E,{size:16,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,N.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,N.jsx)(`span`,{className:`text-sm [overflow-wrap:anywhere]`,children:e.name}),(0,N.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,N.jsx)(k,{tone:`warn`,children:`Changes data`}),t&&(0,N.jsx)(k,{tone:P[t.status],children:t.status.charAt(0).toUpperCase()+t.status.slice(1)})]}),n&&(0,N.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,N.jsxs)(`li`,{className:`flex flex-col`,children:[(0,N.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,N.jsx)(R,{m:e.method}),(0,N.jsx)(`span`,{className:`min-w-0 flex-1 font-mono text-[12px] [overflow-wrap:anywhere]`,children:e.path}),r&&(0,N.jsx)(k,{tone:P[r.status],children:r.httpStatus?String(r.httpStatus):r.status})]}),(0,N.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,N.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,N.jsxs)(`li`,{className:`flex items-center gap-2 text-muted`,children:[(0,N.jsx)(R,{m:e.method}),(0,N.jsx)(`span`,{className:`font-mono text-[12px]`,children:e.path}),(0,N.jsx)(`span`,{className:`text-[12px]`,children:`cleanup`})]},`c${t}`)),t?.reason&&(0,N.jsx)(`li`,{className:`text-[12px] text-fail [overflow-wrap:anywhere]`,children:t.reason})]})]})}function z({what:e,writes:t,defaultUrl:n,onRun:r,onCancel:o,needsData:s}){let[c,l]=(0,M.useState)(n),[d,f]=(0,M.useState)(!1),[p,m]=(0,M.useState)(!1);return(0,N.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-[12px] border border-accent-line bg-accent-soft p-4`,children:[(0,N.jsx)(`span`,{className:`font-medium`,children:e}),(0,N.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[`Against`,(0,N.jsx)(a,{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,N.jsxs)(`span`,{className:`flex items-start gap-3 text-sm`,children:[(0,N.jsx)(u,{checked:d,onChange:f,label:`Also run the calls that change data`}),(0,N.jsxs)(`span`,{className:`flex flex-col`,children:[`Also run the `,t,` call`,t===1?``:`s`,` that change data`,(0,N.jsx)(`span`,{className:`text-[13px] text-warn`,children:`Only on a test environment: they create, change or delete data there.`})]})]}),s?(0,N.jsxs)(`span`,{className:`flex items-center gap-3 text-sm`,children:[(0,N.jsx)(u,{checked:p,onChange:m,label:`Also run calls with made-up values`}),`Also run the `,s,` call`,s===1?``:`s`,` whose values were made up`]}):null,(0,N.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,N.jsxs)(h,{variant:`primary`,onClick:()=>r({...c.trim()?{baseUrl:c.trim()}:{},allowWrites:d,includeNeedsData:p}),children:[(0,N.jsx)(i,{size:16,"aria-hidden":`true`}),`Run`]}),(0,N.jsx)(h,{onClick:o,children:`Don't run`})]})]})}function ie({open:e,onClose:n,view:r,set:i,onMake:s,busy:c}){let[l,d]=(0,M.useState)(`spec`),[p,m]=(0,M.useState)(``),[_,v]=(0,M.useState)(``),[y,b]=(0,M.useState)(``),[x,S]=(0,M.useState)(!0);(0,M.useEffect)(()=>{e&&(d(i.source.kind===`run`?`run`:`spec`),m(i.source.kind===`run`?``:r.runs[0]?.id??``))},[e,i.source.kind,r.runs]);let C=(e,t,n)=>(0,N.jsxs)(`label`,{className:f(`flex cursor-pointer items-start gap-3 rounded-[12px] border px-3 py-2.5`,l===e?`border-accent bg-accent-soft`:`border-line-soft hover:bg-surface-muted`),children:[(0,N.jsx)(`input`,{type:`radio`,name:`sc-from`,checked:l===e,onChange:()=>d(e),className:`mt-1 size-4 accent-accent`}),(0,N.jsxs)(`span`,{className:`flex flex-col`,children:[(0,N.jsx)(`span`,{className:`text-sm font-medium`,children:t}),(0,N.jsx)(`span`,{className:`text-[13px] text-muted`,children:n})]})]});return(0,N.jsx)(o,{open:e,onClose:n,title:`Make scenarios`,description:`API calls in order, where later calls use values earlier answers gave, added to ${i.name}. Nothing runs until you run them.`,footer:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(h,{onClick:n,children:`Cancel`}),(0,N.jsx)(h,{variant:`primary`,disabled:c||l===`cases`&&!_.trim()||l===`text`&&!y.trim(),onClick:()=>s({from:l,...l===`run`&&p?{run:p}:{},...l===`cases`?{cases:_}:{},...l===`text`?{text:y}:{},...l===`spec`?{negative:x}:{}}),children:`Make scenarios`})]}),children:(0,N.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)`),l===`spec`&&(0,N.jsxs)(`span`,{className:`flex items-center gap-2 pl-10 text-sm`,children:[(0,N.jsx)(u,{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)`),l===`run`&&(0,N.jsxs)(t,{"aria-label":`Browser run`,value:p,onChange:e=>m(e.target.value),className:`ml-10 max-w-[440px]`,children:[(0,N.jsx)(`option`,{value:``,children:`The latest run`}),r.runs.map(e=>(0,N.jsxs)(`option`,{value:e.id,children:[e.goal,` · `,g(e.calls,`call`),` · `,I(e.at)]},e.id))]}),C(`cases`,`From test cases`,`One scenario per case, planned by the model against the set's operations`),l===`cases`&&(0,N.jsx)(a,{"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`),l===`text`&&(0,N.jsx)(a,{"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 B({open:e,onClose:n,view:r,onMake:i,busy:s}){let[c,l]=(0,M.useState)(`spec`),[u,d]=(0,M.useState)(``),[f,p]=(0,M.useState)(``),[m,_]=(0,M.useState)(``),[v,y]=(0,M.useState)(``);return(0,M.useEffect)(()=>{e&&(d(r.specs[0]??``),p(``),_(``),y(r.baseUrl??``),l(r.specs.length||!r.runs.length?`spec`:`run`))},[e,r]),(0,N.jsx)(o,{open:e,onClose:n,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,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(h,{onClick:n,children:`Cancel`}),(0,N.jsx)(h,{variant:`primary`,disabled:s||c===`spec`&&!u.trim(),onClick:()=>i({from:c,...c===`spec`?{spec:u.trim()}:f?{run:f}:{},...m.trim()?{name:m.trim()}:{},...v.trim()?{baseUrl:v.trim()}:{}}),children:`Make contracts`})]}),children:(0,N.jsxs)(`div`,{className:`flex flex-col gap-4 pt-3`,children:[(0,N.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,N.jsx)(`legend`,{className:`mb-1.5 text-sm font-medium`,children:`From`}),(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:`set-from`,checked:c===`spec`,onChange:()=>l(`spec`),className:`size-4 accent-accent`}),`An API description: OpenAPI or Swagger, WSDL, GraphQL, .proto, or grpc://`]}),c===`spec`&&(0,N.jsxs)(`div`,{className:`flex flex-col gap-1.5 pl-6`,children:[(0,N.jsx)(a,{"aria-label":`API description`,value:u,spellCheck:!1,list:`spec-files`,placeholder:`https://shop.test/openapi.json, or a file in the project`,onChange:e=>d(e.target.value)}),(0,N.jsx)(`datalist`,{id:`spec-files`,children:r.specs.map(e=>(0,N.jsx)(`option`,{value:e},e))}),r.specs.length>0&&(0,N.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`In this project: `,r.specs.slice(0,6).join(`, `)]})]}),(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:`set-from`,checked:c===`run`,onChange:()=>l(`run`),className:`size-4 accent-accent`}),`The calls a browser run saw the application make`]}),c===`run`&&(0,N.jsxs)(t,{"aria-label":`Browser run`,value:f,onChange:e=>p(e.target.value),className:`ml-6 max-w-[440px]`,children:[(0,N.jsx)(`option`,{value:``,children:`The latest run`}),r.runs.map(e=>(0,N.jsxs)(`option`,{value:e.id,children:[e.goal,` · `,g(e.calls,`call`),` · `,I(e.at)]},e.id))]})]}),(0,N.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm font-medium`,children:[`Name`,(0,N.jsx)(a,{value:m,maxLength:120,placeholder:`Petstore`,onChange:e=>_(e.target.value)})]}),(0,N.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm font-medium`,children:[`Base URL`,(0,N.jsx)(a,{value:v,spellCheck:!1,placeholder:`https://qa.shop.test/api`,onChange:e=>y(e.target.value)}),(0,N.jsxs)(`span`,{className:`text-[13px] font-normal text-muted`,children:[`Where the contracts run when not where they were recorded or described.`,r.headers.length?` Each call sends ${r.headers.join(`, `)} from api.headers in forgeqe.yaml.`:` Credentials go in api.headers in forgeqe.yaml, as references to environment variables.`]})]})]})})}var V=50,ae=e=>e.length>48?`…/${e.split(/[\\/]/).filter(Boolean).slice(-2).join(`/`)}`:e;function H({label:e,last:t,onOpen:n}){if(!t)return(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[13px] text-muted`,children:[(0,N.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,N.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-x-1.5 text-[13px] text-ink-2`,children:[r?(0,N.jsx)(l,{size:14,"aria-label":`Failures`,className:`text-fail`}):(0,N.jsx)(D,{size:14,"aria-label":`Passed`,className:`text-pass`}),e,`:`,` `,(0,N.jsxs)(`b`,{className:f(`tabular-nums`,r?`text-fail`:`text-ink`),children:[t.counts.passed,`/`,i,` passed`]}),t.counts.skipped?(0,N.jsxs)(`span`,{className:`text-muted`,children:[`· `,t.counts.skipped,` skipped`]}):null,(0,N.jsxs)(`span`,{className:`text-muted`,children:[`· `,j(t.at)]}),t.report&&(0,N.jsx)(`button`,{type:`button`,onClick:()=>n(t.report),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:`· Report`})]})}function U({id:t,view:n,busy:a,act:o,version:s}){let[l,u]=(0,M.useState)(null),[d,p]=(0,M.useState)(``),[m,_]=(0,M.useState)(null),[v,y]=(0,M.useState)(!1),[x,S]=(0,M.useState)(``),[w,E]=(0,M.useState)(`contracts`),[D,k]=(0,M.useState)(``),[j,P]=(0,M.useState)(`all`),[F,L]=(0,M.useState)(0);(0,M.useEffect)(()=>{let e=!1;return c.set(t).then(t=>!e&&(u(t),p(``)),t=>!e&&p(t.message)),()=>{e=!0}},[t,s]),(0,M.useEffect)(()=>{_(null),E(`contracts`),k(``),P(`all`)},[t]),(0,M.useEffect)(()=>L(0),[t,w,D,j]);let R=(0,M.useMemo)(()=>new Map((l?.last.contracts?.results??[]).map(e=>[e.id,e])),[l]),B=(0,M.useMemo)(()=>new Map((l?.last.scenarios?.results??[]).map(e=>[e.id,e])),[l]);if(d)return(0,N.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:d});if(!l)return(0,N.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading…`});let U=l.contracts.filter(e=>e.writes).length,W=l.contracts.filter(e=>e.needsData?.length).length,G=l.scenarios??[],K=l.last.contracts,oe=l.last.scenarios,q=n.baseUrl||l.baseUrl||``,J=async t=>S(await e(t)),se=async e=>{try{let{id:t}=await b.start(`Write the API contracts${e?` and scenarios`:``} of set ${l.id} as tests in the repository: call write_api_tests with set_id ${l.id}${e?` and scenarios ["all"]`:``}. Show me the plan before you write.`,{});location.hash=r(`chats`,t)}catch(e){S(e.message)}},Y=e=>{let t=R.get(e.id);return!!t&&(t.status===`failed`||t.status===`error`)},X=D.toLowerCase().split(/\s+/).filter(Boolean),Z=l.contracts.filter(e=>X.every(t=>`${e.method} ${e.path} ${e.name}`.toLowerCase().includes(t))),Q=[{id:`all`,label:`All`,n:Z.length},{id:`failed`,label:`Failed`,n:Z.filter(Y).length,alert:!0},...U?[{id:`writes`,label:`Changes data`,n:Z.filter(e=>e.writes).length}]:[],...K?[{id:`unrun`,label:`Not run`,n:Z.filter(e=>!R.has(e.id)).length}]:[]],$=[...Z.filter(e=>j===`failed`?Y(e):j===`writes`?e.writes:j!==`unrun`||!R.has(e.id))].sort((e,t)=>Number(Y(t))-Number(Y(e))),ce=G.filter(e=>X.every(t=>e.name.toLowerCase().includes(t)));return(0,N.jsxs)(`section`,{"aria-labelledby":`set-h`,className:`flex min-w-0 flex-1 flex-col gap-4`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,N.jsx)(`h2`,{id:`set-h`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:l.name}),(0,N.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 text-[13px] text-muted`,children:[(0,N.jsxs)(`span`,{children:[`From `,te[l.source.kind]||l.source.kind,` `,(0,N.jsx)(`span`,{className:`font-mono text-[12px]`,title:l.source.ref,children:ae(l.source.ref)})]}),`· `,(0,N.jsx)(`span`,{children:I(l.createdAt)}),l.baseUrl&&(0,N.jsxs)(N.Fragment,{children:[`· `,(0,N.jsx)(`span`,{className:`font-mono text-[12px] [overflow-wrap:anywhere]`,children:l.baseUrl})]})]})]}),(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,N.jsxs)(h,{variant:`primary`,size:`sm`,disabled:a||!l.contracts.length,onClick:()=>_(`contracts`),children:[(0,N.jsx)(i,{size:15,"aria-hidden":`true`}),`Run contracts`]}),(0,N.jsxs)(h,{size:`sm`,disabled:a||!G.length,onClick:()=>_(`scenarios`),children:[(0,N.jsx)(i,{size:15,"aria-hidden":`true`}),`Run scenarios`]}),(0,N.jsxs)(h,{size:`sm`,disabled:a,onClick:()=>y(!0),children:[(0,N.jsx)(C,{size:15,"aria-hidden":`true`}),`Make scenarios`]}),(0,N.jsxs)(h,{size:`sm`,variant:`ghost`,onClick:()=>void se(G.length>0),children:[(0,N.jsx)(T,{size:15,"aria-hidden":`true`}),`Write them as tests`]})]}),x&&(0,N.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:x}),m===`contracts`&&(0,N.jsx)(z,{what:`Run ${l.contracts.length} contract${l.contracts.length===1?``:`s`}`,writes:U,needsData:W,defaultUrl:q,onCancel:()=>_(null),onRun:e=>{_(null),o(()=>c.run(l.id,e))}}),m===`scenarios`&&(0,N.jsx)(z,{what:`Run ${G.length} scenario${G.length===1?``:`s`}`,writes:G.filter(e=>e.writes).length,defaultUrl:q,onCancel:()=>_(null),onRun:e=>{_(null),o(()=>c.runScenarios(l.id,{...e.baseUrl?{baseUrl:e.baseUrl}:{},allowWrites:e.allowWrites}))}}),(0,N.jsxs)(`div`,{className:`flex flex-col gap-1.5 rounded-[12px] bg-surface-muted px-4 py-2.5`,children:[(0,N.jsx)(H,{label:`Contracts`,last:K,onOpen:e=>void J(e)}),G.length>0&&(0,N.jsx)(H,{label:`Scenarios`,last:oe,onOpen:e=>void J(e)})]}),(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-col rounded-[14px] border border-line-soft bg-bg`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-line-soft px-3 py-2.5`,children:[(0,N.jsx)(`div`,{role:`tablist`,"aria-label":`In this set`,className:`flex gap-1 rounded-[10px] bg-surface-strong p-1`,children:[[`contracts`,`Contracts`,l.contracts.length],[`scenarios`,`Scenarios`,G.length]].map(([e,t,n])=>(0,N.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":w===e,onClick:()=>E(e),className:f(`inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-[7px] border-0 px-3 text-sm font-medium`,w===e?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),children:[t,(0,N.jsx)(`span`,{className:`text-[12px] text-muted tabular-nums`,children:n})]},e))}),(0,N.jsx)(ee,{id:`api-search`,label:w===`contracts`?`Find a call`:`Find a scenario`,placeholder:w===`contracts`?`Find a call by its path`:`Find a scenario`,value:D,onChange:k})]}),w===`contracts`?(0,N.jsxs)(N.Fragment,{children:[Q.length>1&&(0,N.jsx)(`div`,{className:`flex flex-wrap gap-1.5 px-3 pt-2.5`,children:(0,N.jsx)(A,{items:Q,value:j,onChange:P})}),(0,N.jsxs)(`ul`,{"aria-label":`Contracts`,className:`@container m-0 flex list-none flex-col p-1.5`,children:[$.length===0&&(0,N.jsx)(`li`,{className:`px-3 py-4 text-sm text-muted`,children:l.contracts.length?`Nothing matches.`:`This set has no contracts.`}),$.slice(F*V,F*V+V).map(e=>(0,N.jsx)(ne,{c:e,r:R.get(e.id)},e.id))]}),(0,N.jsx)(O,{page:F,size:V,total:$.length,onPage:L,label:`Pages of contracts`,children:l.skipped?.length?(0,N.jsxs)(`span`,{title:l.skipped.join(`; `),children:[` · `,g(l.skipped.length,`operation`),` left out`]}):null})]}):G.length?(0,N.jsxs)(`ul`,{"aria-label":`Scenarios`,className:`m-0 flex list-none flex-col px-3 py-1.5`,children:[ce.length===0&&(0,N.jsx)(`li`,{className:`py-4 text-sm text-muted`,children:`Nothing matches.`}),ce.map(e=>(0,N.jsx)(re,{s:e,r:B.get(e.id)},e.id))]}):(0,N.jsxs)(`div`,{className:`flex flex-col items-start gap-2 px-4 py-5`,children:[(0,N.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,N.jsxs)(h,{size:`sm`,disabled:a,onClick:()=>y(!0),children:[(0,N.jsx)(C,{size:15,"aria-hidden":`true`}),`Make scenarios`]})]})]}),(0,N.jsx)(ie,{open:v,onClose:()=>y(!1),view:n,set:l,busy:a,onMake:e=>{y(!1),o(()=>c.scenarios(l.id,e))}})]})}function W({sub:e}){let[t,n]=(0,M.useState)(null),[i,a]=(0,M.useState)(``),[o,s]=(0,M.useState)(!1),[u,p]=(0,M.useState)(!1),b=(0,M.useCallback)(()=>{c.view().then(e=>{n(e),a(``)},e=>a(e.message))},[]);(0,M.useEffect)(b,[b]);let x=!!t?.job?.running;(0,M.useEffect)(()=>{if(!x)return;let e=setInterval(b,1500);return()=>clearInterval(e)},[x,b]);let T=async e=>{s(!0),a(``);try{await e(),b()}catch(e){a(e.message)}finally{s(!1)}},E=e?decodeURIComponent(e):``,O=t?.sets.find(e=>e.id===E)||t?.sets[0],k=`${t?.job?.endedAt??``}|${O?.at??``}`,[A,P]=(0,M.useState)(``),F=(t?.sets??[]).filter(e=>A.toLowerCase().split(/\s+/).filter(Boolean).every(t=>e.name.toLowerCase().includes(t)));return(0,N.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,N.jsx)(m,{}),(0,N.jsxs)(`main`,{className:f(_,`@container flex-auto gap-4`),children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,N.jsx)(v,{icon:y,size:`lg`}),(0,N.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`API tests`}),(0,N.jsxs)(h,{variant:`primary`,disabled:!t||x,onClick:()=>p(!0),children:[(0,N.jsx)(C,{size:16,"aria-hidden":`true`}),`New contract set`]})]}),(0,N.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.`}),i&&(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:i}),!t&&!i&&(0,N.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t?.job&&(0,N.jsx)(L,{job:t.job,onStop:()=>T(()=>c.stop())}),t&&(t.sets.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":`Contract sets`,className:`flex min-w-0 flex-col gap-2 @2xl:sticky @2xl:top-6 @2xl:w-[280px] @2xl:flex-none`,children:[(0,N.jsxs)(`span`,{className:`px-1 text-[13px] font-medium text-muted`,children:[`Contract sets (`,t.sets.length,`)`]}),t.sets.length>6&&(0,N.jsx)(ee,{id:`set-search`,label:`Find a set`,value:A,onChange:P,className:`flex-none`}),(0,N.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:[F.length===0&&(0,N.jsx)(`li`,{className:`px-3 py-3 text-sm text-muted`,children:`Nothing matches.`}),F.map(e=>{let n=e.last?.contracts,i=!!n&&n.counts.failed+n.counts.error>0;return(0,N.jsx)(`li`,{children:(0,N.jsxs)(`a`,{href:r(`api-tests`,encodeURIComponent(e.id)),"aria-current":O?.id===e.id?`page`:void 0,className:f(`flex min-h-12 items-center gap-2.5 rounded-[10px] px-3 py-1.5 text-ink no-underline`,O?.id===e.id?`bg-surface-strong hover:text-ink`:`hover:bg-surface-muted hover:text-ink`),children:[t?.job?.running&&t.job.target===e.id?(0,N.jsx)(d,{state:`working`,label:`Working on it`,px:16}):n?i?(0,N.jsx)(l,{size:16,"aria-label":`Failures`,className:`flex-none text-fail`}):(0,N.jsx)(D,{size:16,"aria-label":`Passed`,className:`flex-none text-pass`}):(0,N.jsx)(S,{size:16,"aria-label":`Not run`,className:`flex-none text-muted`}),(0,N.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,N.jsx)(`span`,{className:`truncate text-[14px] font-medium`,children:e.name}),(0,N.jsxs)(`span`,{className:`truncate text-[12px] text-muted`,children:[g(e.contracts,`contract`),e.scenarios?` · ${g(e.scenarios,`scenario`)}`:``,n?` · ${n.counts.passed}/${n.counts.passed+n.counts.failed+n.counts.error} passed`:``]})]}),(0,N.jsx)(`span`,{className:`flex-none text-[12px] text-muted tabular-nums`,children:j(e.at)})]})},e.id)})]})]}),O&&(0,N.jsx)(U,{id:O.id,view:t,busy:o||x,act:T,version:k})]}):(0,N.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,N.jsx)(w,{size:24,"aria-hidden":`true`,className:`text-muted`}),(0,N.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`,t.runs.length?`, or from the ${g(t.runs[0].calls,`call`)} the run "${t.runs[0].goal}" saw`:``,`.`]}),(0,N.jsx)(h,{onClick:()=>p(!0),children:`New contract set`})]}))]}),t&&(0,N.jsx)(B,{open:u,onClose:()=>p(!1),view:t,busy:o||x,onMake:e=>T(async()=>{await c.contracts(e),p(!1)})})]})}export{W as ApiTests};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{Dn as e,G as t,H as n,Hn as r,K as i,Nn as a,St as o,Tt as s,V as c,W as l,an as u,at as d,dn as f,et as p,hn as m,jt as h,nt as g,ot as _,pt as v,r as y,rt as b,t as x,tt as S,un as C,wt as w,x as T,yt as E,zn as D,zt as O}from"./frame-Dq1wC8eF.js";import{n as k,t as A}from"./markdown-BmsRBxB-.js";import{t as j}from"./external-link-NCKfigiH.js";import{t as M}from"./terminal-EkGTrfG9.js";import{D as N,j as P,k as F,s as I,y as L}from"./index-C_8DS1Wt.js";var R={name:`calendar-plus`,size:24,node:[[`path`,{d:`M16 18h6`,key:`987eiv`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`path`,{d:`M19 15v6`,key:`10aioa`}],[`path`,{d:`M21 11.5V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h8.3`,key:`jgwkxf`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M8 2v3`,key:`1ioesn`}]]};R.node;var z=m(R),B={name:`power`,size:24,node:[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]};B.node;var V=m(B),H={name:`search-check`,size:24,node:[[`path`,{d:`m8 11 2 2 4-4`,key:`1sed1v`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]};H.node;var U=m(H),W={name:`timer-off`,size:24,node:[[`path`,{d:`M10 2h4`,key:`n1abiw`}],[`path`,{d:`M4.6 11a8 8 0 0 0 1.7 8.7 8 8 0 0 0 8.7 1.7`,key:`10he05`}],[`path`,{d:`M7.4 7.4a8 8 0 0 1 10.3 1 8 8 0 0 1 .9 10.2`,key:`15f7sh`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M12 12v-2`,key:`fwoke6`}]]};W.node;var G=m(W),K=r(D(),1),q=d(),J={monitor:`Monitor`,suite:`Suite`,run:`Browser run`,heal:`Heal`,"pr-tests":`PR tests`,pack:`Pack`,pipeline:`Pipeline watch`},Y={running:{label:`Running`,tone:`running`},passed:{label:`Passed`,tone:`pass`},failed:{label:`Failed`,tone:`fail`},stopped:{label:`Stopped`,tone:`neutral`},timed_out:{label:`Timed out`,tone:`fail`},interrupted:{label:`Interrupted`,tone:`warn`}},X=e=>{if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString([],{month:`short`,day:`numeric`,...t.getFullYear()===new Date().getFullYear()?{}:{year:`numeric`},hour:`numeric`,minute:`2-digit`})},Z=e=>{if(!e.endedAt)return``;let t=Math.max(0,Math.round((Date.parse(e.endedAt)-Date.parse(e.startedAt))/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`};function Q(e){return e.running?Y.running:e.enabled?e.last?Y[e.last.status]:{label:`Not run yet`,tone:`neutral`}:{label:`Disabled`,tone:`neutral`}}var ee={pass:`bg-pass`,fail:`bg-fail`,warn:`bg-warn`,running:`bg-accent`,neutral:`bg-line`};function $({label:e,icon:t,children:n}){return(0,q.jsxs)(`div`,{className:`flex min-h-[48px] flex-wrap items-baseline gap-x-4 gap-y-1 border-t border-line-soft py-2.5`,children:[(0,q.jsxs)(`span`,{className:`flex w-[170px] flex-none items-center gap-2 text-sm text-muted`,children:[t&&(0,q.jsx)(t,{size:16,"aria-hidden":`true`,className:`flex-none`}),e]}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 text-sm [overflow-wrap:anywhere]`,children:n})]})}function te({m:e,rounds:n}){let[r,a]=(0,K.useState)(``);return(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsxs)(`h3`,{className:`m-0 mb-1 flex items-center gap-2 text-base font-semibold`,children:[(0,q.jsx)(F,{size:18,"aria-hidden":`true`,className:`text-accent-fg`}),`Monitor`]}),(0,q.jsx)($,{icon:h,label:`Checks`,children:e.checks.length?(0,q.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,q.jsxs)($,{icon:f,label:`Alerts after`,children:[e.failAfter,` failing round`,e.failAfter===1?``:`s`,` in a row`,e.remind?`, again every ${e.remind} while it keeps failing`:``]}),(0,q.jsx)($,{icon:E,label:`Alerts go to`,children:e.alerts.length?e.alerts.join(` and `):`Nowhere yet: add Teams or email in Settings, Monitor`}),(0,q.jsxs)($,{icon:w,label:`Each round`,children:[e.parallel,` check`,e.parallel===1?``:`s`,` at once; a recorded run `,e.replay===`trust`?`is trusted`:e.replay===`off`?`is not replayed`:`is verified with one model call`]}),(0,q.jsx)($,{icon:O,label:`Rounds kept in`,children:(0,q.jsx)(A,{path:e.outDir})}),(0,q.jsx)(`p`,{className:`m-0 border-t border-line-soft py-2.5 text-sm`,children:(0,q.jsx)(`a`,{href:i(`settings`,`monitor`),children:`Change the monitor in Settings`})}),(0,q.jsx)(`h4`,{className:`m-0 mt-3 mb-1 text-sm font-semibold`,children:`Latest rounds`}),r&&(0,q.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:r}),n.length===0?(0,q.jsx)(`p`,{className:`m-0 border-t border-line-soft py-3 text-sm text-muted`,children:`No rounds yet.`}):(0,q.jsx)(`ul`,{className:`m-0 list-none p-0`,children:n.slice(0,8).map(e=>(0,q.jsxs)(`li`,{className:`flex min-h-[48px] items-center gap-3 border-t border-line-soft py-2`,children:[(0,q.jsxs)(I,{tone:e.counts.failed?`fail`:`pass`,children:[e.counts.passed,`/`,e.counts.total,` passed`]}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:X(e.startedAt)}),e.report?(0,q.jsxs)(b,{size:`sm`,"aria-label":`Open the report of the round of ${X(e.startedAt)} in a new tab`,onClick:async()=>a(await t(e.report)),children:[(0,q.jsx)(j,{size:14,"aria-hidden":`true`}),`Open report`]}):(0,q.jsx)(A,{path:e.folder})]},e.key))})]})}function ne({jobId:t,run:n}){let[r,i]=(0,K.useState)(null),[a,o]=(0,K.useState)(``);(0,K.useEffect)(()=>{let r=!1;i(null);let a=()=>e.log(t,n.id).then(e=>!r&&i(e.lines),e=>!r&&o(e.message));a();let s=n.status===`running`?setInterval(a,2e3):void 0;return()=>{r=!0,s&&clearInterval(s)}},[t,n.id,n.status]);let s=Math.max(2,...(r||[]).map(e=>Math.max(0,...(e.match(/`+/g)||[]).map(e=>e.length)))),c="`".repeat(s+1),l=[`**${Y[n.status].label}**${n.endedAt?` after ${Z(n)}`:``}${n.exitCode!==void 0&&n.exitCode!==null?`, exit ${n.exitCode}`:``}. Started ${X(n.startedAt)}, ${n.reason===`asked`?`asked for`:`on schedule`}.`,...n.investigating?[``,`_Its failures are being investigated._`]:[],...n.findings?.length?[``,`**Investigated:**`,...n.findings.map(e=>`- ${e.verdict}: ${e.tests.map(e=>`\`${e.replace(/`/g,``)}\``).join(`, `)}${e.branch?` on branch \`${e.branch.replace(/`/g,``)}\``:``}`)]:[],...n.investigationNote?[``,n.investigationNote]:[],``,`${c}text`,...r||[],c].join(`
|
|
2
|
-
`);return(0,q.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[12px] border border-line-soft bg-surface-muted px-4 py-3`,children:[a&&(0,q.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:a}),!r&&!a?(0,q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Reading its output…`}):(0,q.jsx)(k,{text:l,className:`text-sm [&_pre]:max-h-[320px] [&_pre]:overflow-auto`})]})}function re({job:t,rounds:n,busy:r,act:i}){let[a,c]=(0,K.useState)(null),[l,d]=(0,K.useState)(null),[f,m]=(0,K.useState)(!1),h=`${t.running?.id}|${t.last?.id}|${t.last?.status}`;(0,K.useEffect)(()=>{let n=!1;return e.detail(t.id).then(e=>{n||(c(e.runs),d(t=>t??e.runs[0]?.id??null))},()=>{}),()=>{n=!0}},[t.id,h]),(0,K.useEffect)(()=>{d(null),m(!1)},[t.id]);let g=Q(t),_=a?.filter(e=>e.status===`passed`).length??0,y=a?.filter(e=>e.status!==`running`).length??0;return(0,q.jsxs)(`section`,{"aria-labelledby":`job-h`,className:`flex min-w-0 flex-1 flex-col gap-5`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-3`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,q.jsx)(`h2`,{id:`job-h`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:t.name}),(0,q.jsxs)(`span`,{className:`text-sm text-muted`,children:[J[t.kind]||t.kind,` · `,t.schedule]})]}),(0,q.jsx)(I,{tone:g.tone,children:g.label}),t.running?(0,q.jsxs)(b,{disabled:r,onClick:()=>i(`stop`),children:[(0,q.jsx)(v,{size:14,fill:`currentColor`,"aria-hidden":`true`}),`Stop`]}):(0,q.jsxs)(b,{variant:`primary`,disabled:r,onClick:()=>i(`run`),children:[(0,q.jsx)(s,{size:16,"aria-hidden":`true`}),`Run now`]})]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,q.jsx)(T,{icon:o,label:`Runs kept`,value:String(a?.length??`–`)}),(0,q.jsx)(T,{icon:P,label:`Passed`,value:y?`${Math.round(_/y*100)}%`:`–`,note:y?`${_} of ${y}`:void 0}),(0,q.jsx)(T,{icon:u,label:`Next run`,value:t.nextAt?new Date(t.nextAt).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`}):`–`,note:t.nextAt?X(t.nextAt):t.enabled?void 0:`Disabled`})]}),(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)($,{icon:M,label:`Runs`,children:(0,q.jsx)(k,{text:`\`${t.command.replace(/`/g,``)}\``,className:`text-sm [&_p]:my-0`})}),(0,q.jsx)($,{icon:u,label:`When`,children:t.schedule}),(0,q.jsx)($,{icon:V,label:`Enabled`,children:(0,q.jsx)(p,{checked:t.enabled,disabled:r,onChange:e=>i(e?`enable`:`disable`),label:`${t.name} enabled`})}),(0,q.jsxs)($,{icon:G,label:`Stopped after`,children:[t.timeoutMs?t.timeoutMs%36e5==0?`${t.timeoutMs/36e5} hour${t.timeoutMs===36e5?``:`s`}`:`${Math.round(t.timeoutMs/6e4)} minutes`:`the service's default`,` of running`]}),(0,q.jsx)($,{icon:C,label:`Tells the team`,children:t.notify?`When it fails, recovers or ends (the notify channels that take job events)`:t.kind===`monitor`?`The monitor sends its own alerts`:`No`}),(0,q.jsx)($,{icon:U,label:`Investigates failures`,children:t.investigate?`Yes, on branches of their own`:`No`}),(0,q.jsxs)($,{icon:z,label:`Added`,children:[X(t.createdAt),` `,t.by===`agent`?`by ForgeQE's agent, after you agreed`:`from the command line or here`]})]}),t.monitor&&(0,q.jsx)(te,{m:t.monitor,rounds:n}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`h3`,{className:`m-0 mb-1 text-base font-semibold`,children:`Runs`}),a?a.length===0?(0,q.jsx)(`p`,{className:`m-0 border-t border-line-soft py-3 text-sm text-muted`,children:`No runs yet. Run now starts one.`}):(0,q.jsx)(`ul`,{className:`m-0 list-none p-0`,children:a.map(e=>(0,q.jsxs)(`li`,{className:`border-t border-line-soft`,children:[(0,q.jsxs)(`button`,{type:`button`,"aria-expanded":l===e.id,onClick:()=>d(l===e.id?null:e.id),className:`flex min-h-[52px] w-full cursor-pointer items-center gap-3 border-0 bg-transparent px-1 py-2 text-left text-ink hover:bg-surface-muted`,children:[(0,q.jsx)(I,{tone:Y[e.status].tone,children:Y[e.status].label}),(0,q.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:[X(e.startedAt),(0,q.jsxs)(`span`,{className:`text-muted`,children:[` `,`· `,e.reason===`asked`?`asked for`:`scheduled`,Z(e)?` · ${Z(e)}`:``]})]}),e.summary?.length?(0,q.jsx)(`span`,{className:`hidden max-w-[40%] truncate text-[13px] text-muted sm:inline`,children:e.summary.at(-1)}):null]}),l===e.id&&(0,q.jsx)(`div`,{className:`pb-3`,children:(0,q.jsx)(ne,{jobId:t.id,run:e})})]},e.id))}):(0,q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading…`})]}),(0,q.jsx)(`div`,{className:`flex flex-wrap items-center gap-2 border-t border-line-soft pt-4`,children:f?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`span`,{className:`text-sm text-ink-2`,children:[`Remove `,t.name,`? Its runs and logs go with it.`]}),(0,q.jsx)(b,{disabled:r,onClick:()=>i(`remove`),className:`border-fail text-fail hover:bg-fail-soft`,children:`Remove`}),(0,q.jsx)(b,{onClick:()=>m(!1),children:`Keep it`})]}):(0,q.jsxs)(b,{variant:`ghost`,onClick:()=>m(!0),className:`text-fail`,children:[(0,q.jsx)(L,{size:16,"aria-hidden":`true`}),`Remove this job`]})})]})}function ie({open:t,onClose:r,commands:i,initial:a,onAdded:o}){let[s,u]=(0,K.useState)(``),[d,f]=(0,K.useState)(`suite`),[m,h]=(0,K.useState)(``),[g,_]=(0,K.useState)(`every`),[v,y]=(0,K.useState)(`30m`),[x,S]=(0,K.useState)(`0 2 * * 1-5`),[C,w]=(0,K.useState)(!0),[T,E]=(0,K.useState)(``),[D,O]=(0,K.useState)(!1);(0,K.useEffect)(()=>{t&&(u(a?.name??``),f(a?.command??`suite`),h(a?.args??``),_(`every`),y(a?.every??`30m`),w(a?.command!==`monitor`),E(``))},[t,a]);let k=async()=>{O(!0),E(``);try{o(await e.add({name:s.trim(),command:d,args:m,...g===`every`?{every:v}:g===`cron`?{cron:x}:{now:!0},notify:C}),s.trim())}catch(e){E(e.message)}finally{O(!1)}},A=`flex flex-col gap-1.5 py-3`;return(0,q.jsx)(l,{open:t,onClose:r,title:`Add a job`,description:`A ForgeQE command the jobs service runs on a schedule, or once now, in a process of its own; it keeps going with this page closed.`,footer:(0,q.jsxs)(q.Fragment,{children:[T&&(0,q.jsx)(`span`,{role:`alert`,className:`mr-auto self-center text-sm text-fail [overflow-wrap:anywhere]`,children:T}),(0,q.jsx)(b,{onClick:r,children:`Cancel`}),(0,q.jsx)(b,{variant:`primary`,disabled:D||!s.trim(),onClick:()=>void k(),children:D?`Adding…`:`Add job`})]}),children:(0,q.jsxs)(`div`,{className:`flex flex-col pt-3`,children:[(0,q.jsxs)(`div`,{className:A,children:[(0,q.jsx)(`label`,{htmlFor:`job-name`,className:`font-medium`,children:`Name`}),(0,q.jsx)(c,{id:`job-name`,value:s,spellCheck:!1,placeholder:`nightly-smoke`,onChange:e=>u(e.target.value)}),(0,q.jsx)(`span`,{className:`text-sm text-muted`,children:`Letters, digits and dashes.`})]}),(0,q.jsxs)(`div`,{className:A,children:[(0,q.jsx)(`label`,{htmlFor:`job-command`,className:`font-medium`,children:`Runs`}),(0,q.jsx)(n,{id:`job-command`,value:d,onChange:e=>f(e.target.value),children:i.map(e=>(0,q.jsxs)(`option`,{value:e,children:[`forgeqe `,e]},e))})]}),(0,q.jsxs)(`div`,{className:A,children:[(0,q.jsx)(`label`,{htmlFor:`job-args`,className:`font-medium`,children:`With`}),(0,q.jsx)(c,{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,q.jsx)(`span`,{className:`text-sm text-muted`,children:`Test case sources and flags, as you would type them after the command. "…" keeps spaces in one. Nothing goes through a shell.`})]}),(0,q.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0 py-3`,children:[(0,q.jsx)(`legend`,{className:`mb-1 font-medium`,children:`When`}),[[`every`,`Every`],[`cron`,`On a schedule (cron, this machine's time)`],[`once`,`Once, now`]].map(([e,t])=>(0,q.jsxs)(`label`,{className:`flex min-h-10 cursor-pointer items-center gap-3`,children:[(0,q.jsx)(`input`,{type:`radio`,name:`job-when`,checked:g===e,onChange:()=>_(e),className:`size-4 accent-accent`}),(0,q.jsx)(`span`,{className:`flex-none`,children:t}),e===`every`&&g===`every`&&(0,q.jsx)(c,{"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,q.jsx)(c,{"aria-label":`Cron schedule`,value:x,onChange:e=>S(e.target.value),className:`max-w-[180px] font-mono text-[13px]`})]},e))]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-4 py-3`,children:[(0,q.jsxs)(`span`,{className:`flex flex-1 flex-col gap-0.5`,children:[(0,q.jsx)(`span`,{className:`font-medium`,children:`Tell the team`}),(0,q.jsx)(`span`,{className:`text-sm text-muted`,children:`When it fails, recovers or ends, on the notify channels that take job events. A monitor sends its own alerts.`})]}),(0,q.jsx)(p,{checked:C,onChange:w,label:`Tell the team`})]})]})})}function ae({sub:t}){let[n,r]=(0,K.useState)(null),[o,s]=(0,K.useState)([]),[c,l]=(0,K.useState)(``),[d,f]=(0,K.useState)(!1),[p,m]=(0,K.useState)(null),h=(0,K.useCallback)(()=>{e.list().then(e=>{r(e),l(``)},e=>l(e.message))},[]);(0,K.useEffect)(h,[h]),(0,K.useEffect)(()=>{a.list().then(e=>s(e.rows.filter(e=>e.scope===`monitor`)),()=>{})},[n?.jobs.map(e=>e.last?.id).join()]);let v=n?.jobs.some(e=>e.running);(0,K.useEffect)(()=>{let e=setInterval(h,v?3e3:2e4);return()=>clearInterval(e)},[h,v]);let C=t?decodeURIComponent(t):``,w=n?.jobs.find(e=>e.id===C)||n?.jobs[0],T=(0,K.useMemo)(()=>n?.jobs.filter(e=>e.kind===`monitor`)??[],[n]),E=(0,K.useMemo)(()=>n?.jobs.filter(e=>e.kind!==`monitor`)??[],[n]),D=async t=>{if(w){f(!0),l(``);try{r(t===`remove`?await e.remove(w.id):await e.act(w.id,t)),t===`remove`&&(location.hash=i(`jobs`))}catch(e){l(e.message)}finally{f(!1)}}},O=e=>{let t=Q(e),n=w?.id===e.id;return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`a`,{href:i(`jobs`,encodeURIComponent(e.id)),"aria-current":n?`page`:void 0,className:_(`flex min-h-[60px] items-center gap-3 rounded-[12px] px-3 py-2 text-ink no-underline`,n?`bg-surface-strong hover:text-ink`:`hover:bg-surface-muted hover:text-ink`),children:[e.running?(0,q.jsx)(g,{label:t.label,px:16}):(0,q.jsx)(`span`,{"aria-label":t.label,className:_(`size-2.5 flex-none rounded-full`,ee[t.tone])}),(0,q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,q.jsx)(`span`,{className:`truncate text-[15px] font-medium`,children:e.name}),(0,q.jsx)(`span`,{className:`truncate text-[13px] text-muted`,children:[t.label,e.schedule,e.nextAt&&e.enabled?`next ${X(e.nextAt)}`:``].filter(Boolean).join(` · `)})]})]})},e.id)};return(0,q.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,q.jsx)(y,{}),(0,q.jsxs)(`main`,{className:_(x,`@container flex-auto gap-4`),children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,q.jsx)(S,{icon:u,size:`lg`}),(0,q.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Jobs`}),n&&(0,q.jsx)(I,{tone:n.service.running?`pass`:`neutral`,children:n.service.running?`Service running since ${X(n.service.startedAt)}`:`Service stopped: jobs wait until it starts`}),(0,q.jsx)(`div`,{className:`flex-auto`}),(0,q.jsxs)(b,{variant:`primary`,disabled:!n,onClick:()=>m({}),children:[(0,q.jsx)(N,{size:16,"aria-hidden":`true`}),`Add a job`]})]}),(0,q.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-muted`,children:`ForgeQE commands that run on a schedule, or once, in a service of their own, so they keep going while you work on something else or with this page closed: monitors, suites, packs and pipeline watches.`}),c&&(0,q.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:c}),!n&&!c&&(0,q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),n?.monitor&&!n.monitor.scheduled&&(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3 rounded-[14px] border border-accent-line bg-accent-soft px-4 py-3`,children:[(0,q.jsx)(F,{size:20,"aria-hidden":`true`,className:`flex-none text-accent-fg`}),(0,q.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-0.5 text-sm`,children:[(0,q.jsx)(`span`,{className:`font-medium`,children:`The monitor in forgeqe.yaml is not scheduled`}),(0,q.jsxs)(`span`,{className:`text-ink-2`,children:[n.monitor.checks.length,` check`,n.monitor.checks.length===1?``:`s`,`, every `,n.monitor.every,`. As a job it runs a round each time, with this page closed.`]})]}),(0,q.jsx)(b,{onClick:()=>m({name:`monitor`,command:`monitor`,args:``,every:n.monitor.every}),children:`Schedule it`})]}),n&&(0,q.jsxs)(`div`,{className:`flex flex-col gap-6 @2xl:flex-row @2xl:items-start @2xl:gap-8`,children:[(0,q.jsxs)(`nav`,{"aria-label":`Jobs`,className:`flex min-w-0 flex-col gap-4 @2xl:sticky @2xl:top-6 @2xl:w-[250px] @2xl:flex-none`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsxs)(`span`,{className:`flex items-center gap-2 px-3 text-[13px] font-medium text-muted`,children:[(0,q.jsx)(F,{size:14,"aria-hidden":`true`}),`Monitoring (`,T.length,`)`]}),T.length?(0,q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:T.map(O)}):(0,q.jsx)(`p`,{className:`m-0 px-3 py-2 text-sm text-muted`,children:`No monitor jobs.`})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsxs)(`span`,{className:`flex items-center gap-2 px-3 text-[13px] font-medium text-muted`,children:[(0,q.jsx)(u,{size:14,"aria-hidden":`true`}),`Other jobs (`,E.length,`)`]}),E.length?(0,q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:E.map(O)}):(0,q.jsx)(`p`,{className:`m-0 px-3 py-2 text-sm text-muted`,children:`None.`})]}),n.events.length>0&&(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`span`,{className:`px-3 text-[13px] font-medium text-muted`,children:`Recent activity`}),(0,q.jsx)(k,{text:n.events.slice(0,12).map(e=>`- \`${X(e.at)}\` ${e.text.replace(/([\\`*_[\]<>#|~!])/g,`\\$1`)}`).join(`
|
|
3
|
-
`),className:`px-3 text-[13px] text-ink-2 [&_li]:my-1 [&_ul]:my-0 [&_ul]:pl-4`})]})]}),w?(0,q.jsx)(re,{job:w,rounds:o,busy:d,act:D}):(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,q.jsx)(u,{size:24,"aria-hidden":`true`,className:`text-muted`}),(0,q.jsx)(`p`,{className:`m-0 max-w-[60ch] leading-relaxed text-ink-2`,children:`No jobs yet. Add one to run a suite every night, a monitor every 15 minutes, or watch a CI pipeline.`}),(0,q.jsx)(b,{onClick:()=>m({}),children:`Add a job`})]})]})]}),(0,q.jsx)(ie,{open:!!p,onClose:()=>m(null),commands:n?.commands??[],initial:p??void 0,onAdded:(e,t)=>{r(e),m(null);let n=e.jobs.find(e=>e.name===t);n&&(location.hash=i(`jobs`,encodeURIComponent(n.id)))}})]})}export{ae as Jobs};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{An as e,Hn as t,K as n,Lt as r,Ot as i,S as a,V as o,at as s,dt as c,en as l,hn as u,mn as d,ot as f,r as p,rt as m,t as h,tt as g,xn as _,zn as v}from"./frame-Dq1wC8eF.js";import{t as y}from"./circle-dashed-CEZcCi0T.js";import{i as b,t as x}from"./markdown-BmsRBxB-.js";import{t as S}from"./external-link-NCKfigiH.js";import{n as C,t as w}from"./trending-up-BLA071mC.js";import{j as T,n as E,r as D,s as O,t as k}from"./index-C_8DS1Wt.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=u(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=u(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 ee=u(I),L=t(v(),1),R=s(),z=[`critical`,`serious`,`moderate`,`minor`],te={critical:`fail`,serious:`fail`,moderate:`warn`,minor:`neutral`},B=[{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`}],V={same:{label:`Same`,tone:`pass`},changed:{label:`Changed`,tone:`warn`},new:{label:`New baseline`,tone:`neutral`},no_baseline:{label:`No baseline`,tone:`neutral`}},H=e=>new Date(e).toLocaleString([],{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}),U=(e,t)=>t?e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`:e.toFixed(3).replace(/0+$/,``).replace(/\.$/,``),W=(e,t)=>`${e} ${t}${e===1?``:`s`}`,G=e=>{try{let t=new URL(e);return`${t.host}${t.pathname}${t.search}`}catch{return e}};function ne(e){let t=[];return e.a11y&&t.push(e.a11y.failed?`${W(e.a11y.failed,`rule`)} failed`:`WCAG clean`),e.perf.over&&t.push(`${W(e.perf.over,`page`)} slow`),e.visual?.changed&&t.push(`${e.visual.changed} changed`),e.captured&&t.push(`not compared`),t.join(` · `)||`measured`}var K=e=>!!(e.breaches||e.a11y?.failed||e.perf.over||e.visual?.changed),q=25;function J({run:e,standard:t}){let n=e.report,[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)(`all`);if(!n?.accessibility.pages)return(0,R.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},...z.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,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,R.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[t,` with `,n.engine||`axe`,`: `,W(s.passed.length,`rule`),` passed, `,s.failed.length,` failed, on `,W(s.pages,`page`),`. `,n.budgets.accessibility?c.length?`${W(c.length,`budget`)} exceeded.`:`Within the budget.`:`No budget set, so nothing here fails the run.`]}),c.map((e,t)=>(0,R.jsxs)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:[G(e.page),`: `,e.text]},t)),s.failed.length?(0,R.jsxs)(R.Fragment,{children:[u.length>2&&(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,R.jsx)(k,{items:u,value:a,onChange:o})}),(0,R.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:l.map(t=>(0,R.jsx)(Y,{f:t,examples:e.examples[t.rule]??[],open:r===t.rule,onToggle:()=>i(r===t.rule?null:t.rule)},t.rule))})]}):(0,R.jsx)(`p`,{className:`m-0 text-sm text-pass`,children:`No rule failed on the pages this run visited.`})]})}function Y({f:e,examples:t,open:n,onToggle:r}){return(0,R.jsxs)(`li`,{className:`border-t border-line-soft first:border-t-0`,children:[(0,R.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,R.jsx)(O,{tone:te[e.impact],className:`w-[88px] flex-none justify-center`,children:e.impact}),(0,R.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,R.jsx)(`span`,{className:`text-sm [overflow-wrap:anywhere]`,children:e.help}),(0,R.jsxs)(`span`,{className:`truncate text-[12px] text-muted`,children:[e.rule,e.wcag?` · WCAG ${e.wcag}${e.level?` (${e.level})`:``}`:``,` · `,W(e.count,`element`),` on `,W(e.pages,`page`)]})]})]}),n&&(0,R.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,R.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-[10px] bg-surface-muted p-2.5`,children:[(0,R.jsxs)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:[G(e.page),e.target?` · ${e.target}`:``]}),e.html&&(0,R.jsx)(`code`,{className:`font-mono text-[12px] whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:e.html})]},t)):(0,R.jsx)(`span`,{className:`text-muted`,children:`No elements were kept for this rule.`}),e.helpUrl&&b(e.helpUrl)===`web`&&(0,R.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,R.jsx)(S,{size:13,"aria-hidden":`true`})]})]})]})}function X({run:e}){let t=e.report;if(!t?.performance.pages.length)return(0,R.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,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,R.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Core Web Vitals per page against Google's thresholds: `,(0,R.jsx)(`span`,{className:`text-pass`,children:`good`}),`, `,(0,R.jsx)(`span`,{className:`text-warn`,children:`needs improvement`}),`, `,(0,R.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,R.jsx)(`div`,{className:`overflow-x-auto`,children:(0,R.jsxs)(`table`,{className:`w-full min-w-[640px] border-collapse text-sm`,children:[(0,R.jsx)(`thead`,{children:(0,R.jsxs)(`tr`,{className:`text-left text-[12px] text-muted`,children:[(0,R.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:`Page`}),B.map(e=>(0,R.jsx)(`th`,{className:`px-2 py-2 text-right font-medium`,children:e.label},e.key)),(0,R.jsx)(`th`,{className:`py-2 pl-2 text-right font-medium`,children:`Requests`})]})}),(0,R.jsx)(`tbody`,{children:t.performance.pages.map((e,t)=>(0,R.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,R.jsxs)(`td`,{className:`py-2 pr-3`,children:[(0,R.jsx)(`span`,{className:`block font-mono text-[12px] [overflow-wrap:anywhere]`,children:G(e.url)}),e.over.length>0&&(0,R.jsx)(`span`,{className:`text-[12px] text-fail`,children:e.over.join(`, `)})]}),B.map(t=>{let i=e[t.key];return(0,R.jsxs)(`td`,{className:f(`px-2 py-2 text-right tabular-nums`,typeof i==`number`&&t.good!==1/0?r[n(i,t)]:typeof i==`number`?`text-ink-2`:`text-muted`),children:[typeof i==`number`?U(i,t.unit):`–`,typeof i==`number`&&t.good!==1/0&&(0,R.jsxs)(`span`,{className:`sr-only`,children:[` (`,n(i,t),`)`]})]},t.key)}),(0,R.jsx)(`td`,{className:`py-2 pl-2 text-right text-muted tabular-nums`,children:e.requests?`${e.requests} · ${e.kb} KB`:`–`})]},t))})]})})]})}function Z({run:t,index:n,which:r,label:i}){let[a,o]=(0,L.useState)(``),[s,c]=(0,L.useState)(!1);return(0,L.useEffect)(()=>{let i=!1;return o(``),c(!1),e.image(t,n,r).then(e=>!i&&o(e),()=>!i&&c(!0)),()=>{i=!0}},[t,n,r]),(0,R.jsxs)(`figure`,{className:`m-0 flex min-w-0 flex-col gap-1.5`,children:[(0,R.jsx)(`figcaption`,{className:`text-[12px] font-medium text-muted`,children:i}),a?(0,R.jsx)(`img`,{src:a,alt:`${i} of the page`,className:`block h-auto w-full rounded-[10px] border border-line-soft bg-surface-muted`}):(0,R.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,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(N,{size:14,"aria-hidden":`true`}),` Not available`]}):`Loading…`})]})}function re({run:t,budget:n,onChange:r}){let[i,a]=(0,L.useState)(null),[s,c]=(0,L.useState)(``),[l,u]=(0,L.useState)(!1),[d,p]=(0,L.useState)(``),[h,g]=(0,L.useState)(null),_=t.visual?.pages??[],v=_.find(e=>e.status===`changed`)?.index??null;(0,L.useEffect)(()=>g(v),[t.id,v]);let y=async e=>{u(!0),p(``);try{r(await e()),a(null),c(``)}catch(e){p(e.message)}finally{u(!1)}};if(!t.visual)return t.captured?(0,R.jsxs)(`div`,{className:`flex flex-col items-start gap-3`,children:[(0,R.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[`This run captured `,W(t.captured,`page`),` but they were not compared with the baselines yet.`]}),(0,R.jsxs)(m,{variant:`primary`,disabled:l,onClick:()=>y(()=>e.compare(t.id)),children:[(0,R.jsx)(ee,{size:16,"aria-hidden":`true`}),`Compare with the baselines`]}),d&&(0,R.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:d})]}):(0,R.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,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.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. `,n?`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,R.jsxs)(m,{disabled:l,onClick:()=>a(b.map(e=>e.url)),children:[`Approve all `,b.length,` changes`]})]}),i&&(0,R.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,R.jsxs)(`span`,{className:`font-medium`,children:[`Make this run's capture the baseline of `,i.length===1?G(i[0]):W(i.length,`page`),`?`]}),(0,R.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,R.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[`Why it changed (kept with the baseline)`,(0,R.jsx)(o,{value:s,maxLength:300,placeholder:`New checkout banner`,onChange:e=>c(e.target.value),className:`max-w-[480px] bg-bg`})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,R.jsxs)(m,{variant:`primary`,disabled:l,onClick:()=>y(()=>e.approve(t.id,i,s.trim()||void 0)),children:[(0,R.jsx)(T,{size:16,"aria-hidden":`true`}),`Approve`]}),(0,R.jsx)(m,{onClick:()=>a(null),children:`Cancel`})]})]}),d&&(0,R.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:d}),(0,R.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:_.map(e=>(0,R.jsxs)(`li`,{className:`border-t border-line-soft first:border-t-0`,children:[(0,R.jsxs)(`button`,{type:`button`,"aria-expanded":h===e.index,onClick:()=>g(h===e.index?null:e.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,R.jsx)(F,{size:16,"aria-hidden":`true`,className:`flex-none text-muted`}),(0,R.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,R.jsx)(`span`,{className:`text-sm [overflow-wrap:anywhere]`,children:e.title||G(e.url)}),(0,R.jsxs)(`span`,{className:`truncate text-[12px] text-muted`,children:[G(e.url),e.size?` · ${e.size}`:``,e.resized?` · resized ${e.resized}`:``]})]}),e.status===`changed`&&(0,R.jsxs)(`span`,{className:f(`text-sm tabular-nums`,e.over?`text-fail`:`text-warn`),children:[e.diffPercent,`%`,e.limit===void 0?``:` / ${e.limit}%`]}),(0,R.jsx)(O,{tone:e.over?`fail`:V[e.status].tone,children:e.over?`Over budget`:V[e.status].label})]}),h===e.index&&(0,R.jsxs)(`div`,{className:`mb-4 flex flex-col gap-3 px-1`,children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(160px,1fr))] gap-3`,children:[e.images.baseline&&(0,R.jsx)(Z,{run:t.id,index:e.index,which:`baseline`,label:`Baseline`}),e.images.current&&(0,R.jsx)(Z,{run:t.id,index:e.index,which:`current`,label:`This run`}),e.images.diff&&(0,R.jsx)(Z,{run:t.id,index:e.index,which:`diff`,label:`Difference (in red)`})]}),e.status===`changed`&&(0,R.jsxs)(m,{className:`self-start`,disabled:l,onClick:()=>a([e.url]),children:[(0,R.jsx)(T,{size:16,"aria-hidden":`true`}),`Approve as the new baseline`]})]})]},e.index))})]})}function Q({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,R.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,R.jsx)(`polyline`,{points:n,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinejoin:`round`})})}function $({icon:e,className:t,lines:n}){return n.length?(0,R.jsxs)(`span`,{className:f(`flex items-start gap-1.5 text-[13px]`,t),children:[(0,R.jsx)(e,{size:14,"aria-hidden":`true`,className:`mt-0.5 flex-none`}),(0,R.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:n.join(` · `)})]}):null}function ie({trends:e}){return e.length?(0,R.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.map(e=>{let t=e.a11y.latest?z.reduce((t,n)=>t+(e.a11y.latest[n]||0),0):void 0;return(0,R.jsxs)(`li`,{className:`flex flex-col gap-1.5 border-t border-line-soft py-3 first:border-t-0`,children:[(0,R.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-3`,children:[(0,R.jsx)(`span`,{className:`min-w-0 flex-[1_1_240px] font-mono text-[13px] [overflow-wrap:anywhere]`,children:e.page}),(0,R.jsx)(Q,{values:e.a11y.trail}),(0,R.jsxs)(`span`,{className:`text-[12px] text-muted`,children:[W(e.runs,`run`),t===void 0?``:` · ${W(t,`violation`)} now`]})]}),(0,R.jsx)($,{icon:w,className:`text-fail`,lines:[...e.perf.worse.map(e=>`slower: ${e}`),...e.a11y.newRules.map(e=>`newly failing: ${e}`)]}),(0,R.jsx)($,{icon:C,className:`text-pass`,lines:[...e.perf.better.map(e=>`faster: ${e}`),...e.a11y.fixedRules.map(e=>`fixed: ${e}`)]})]},e.page)})}):(0,R.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:t,view:a,onChanged:o}){let[s,u]=(0,L.useState)(null),[p,h]=(0,L.useState)(``),[g,v]=(0,L.useState)(`accessibility`),[b,S]=(0,L.useState)(``);if((0,L.useEffect)(()=>{let n=!1;return u(null),e.run(t).then(e=>{if(n)return;u(e),h(``);let t=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`:t&&!e.report?.accessibility.failed.length?`visual`:e.report?.accessibility.pages?`accessibility`:e.report?.performance.pages.length?`performance`:`visual`)},e=>!n&&h(e.message)),()=>{n=!0}},[t]),p)return(0,R.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:p});if(!s)return(0,R.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Loading…`});let C=async()=>{try{let{id:e}=await _.start(`Explain the accessibility, performance and visual results of the run in ${s.dir}: call quality_report and visual_compare with run_dir ${s.dir}. Say what matters most to fix first, and why.`,{});location.hash=n(`chats`,e)}catch(e){S(e.message)}},w=s.report,E=w?.accessibility.failed??[],D=z.find(e=>E.some(t=>t.impact===e)),O=w?.performance.pages.filter(e=>e.over.length).length??0,k=s.visual?.pages.filter(e=>e.status===`changed`).length??0,A=e=>!!w?.breaches.some(t=>t.kind===e),j=[{id:`accessibility`,label:`Accessibility`,icon:d,state:w?.accessibility.pages?A(`accessibility`)||D===`critical`?`fail`:E.length?`warn`:`pass`:`none`,headline:w?.accessibility.pages?E.length?`${W(E.length,`rule`)} failed`:`No rule failed`:`Not measured`,note:w?.accessibility.pages?z.filter(e=>w.accessibility.byImpact[e]).map(e=>`${w.accessibility.byImpact[e]} ${e}`).join(` · `)||`${W(w.accessibility.pages,`page`)} checked`:``},{id:`performance`,label:`Performance`,icon:r,state:w?.performance.pages.length?A(`performance`)?`fail`:O?`warn`:`pass`:`none`,headline:w?.performance.pages.length?O?`${W(O,`page`)} over budget`:`Within budget`:`Not measured`,note:w?.performance.pages.length?`${W(w.performance.pages.length,`page`)} timed`:``},{id:`visual`,label:`Visual`,icon:F,state:s.visual?A(`visual`)?`fail`:k?`warn`:`pass`:`none`,headline:s.visual?k?`${W(k,`page`)} changed`:`No change`:s.captured?`Not compared yet`:`Not captured`,note:s.visual?`${W(s.visual.pages.length,`page`)} against the baseline`:s.captured?`${W(s.captured,`page`)} captured`:``}],M={pass:T,warn:c,fail:l,none:y},N={pass:`text-pass`,warn:`text-warn`,fail:`text-fail`,none:`text-muted`};return(0,R.jsxs)(`section`,{"aria-labelledby":`run-h`,className:`flex min-w-0 flex-1 flex-col gap-4`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,R.jsx)(`h2`,{id:`run-h`,title:s.goal,className:`m-0 line-clamp-2 text-[20px] leading-snug font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:s.goal}),(0,R.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 text-[13px] text-muted`,children:[H(s.at),` · `,(0,R.jsx)(x,{path:s.dir})]})]}),(0,R.jsxs)(m,{size:`sm`,variant:`ghost`,onClick:()=>void C(),children:[(0,R.jsx)(i,{size:15,"aria-hidden":`true`}),`Ask in a chat`]})]}),b&&(0,R.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:b}),(0,R.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,R.jsxs)(`button`,{type:`button`,role:`tab`,id:`tab-${e.id}`,"aria-selected":g===e.id,"aria-controls":`panel-${e.id}`,onClick:()=>v(e.id),className:f(`flex min-w-0 cursor-pointer flex-col gap-1 rounded-[14px] border px-4 py-3 text-left`,g===e.id?`border-accent bg-accent-soft`:`border-line-soft bg-bg hover:bg-surface-muted`),children:[(0,R.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[13px] text-muted`,children:[(0,R.jsx)(e.icon,{size:14,"aria-hidden":`true`}),e.label]}),(0,R.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[16px] font-semibold text-ink`,children:[(0,R.jsx)(t,{size:16,"aria-hidden":`true`,className:f(`flex-none`,N[e.state])}),e.headline]}),e.note&&(0,R.jsx)(`span`,{className:`truncate text-[12.5px] text-muted`,children:e.note})]},e.id)})}),(0,R.jsxs)(`div`,{role:`tabpanel`,id:`panel-${g}`,"aria-labelledby":`tab-${g}`,className:`flex min-w-0 flex-col`,children:[g===`accessibility`&&(0,R.jsx)(J,{run:s,standard:a.standard}),g===`performance`&&(0,R.jsx)(X,{run:s}),g===`visual`&&(0,R.jsx)(re,{run:s,budget:a.budgets.visual,onChange:e=>{u(e),o()}})]}),g===`accessibility`&&s.report?.accessibility.pages?(0,R.jsx)(`p`,{className:`m-0 text-[12px] text-muted`,children:a.disclaimer}):null]})}function oe({sub:t}){let[i,o]=(0,L.useState)(null),[s,u]=(0,L.useState)(``),[m,_]=(0,L.useState)(t===`trends`?`trends`:`runs`),v=(0,L.useCallback)(()=>{e.view().then(e=>{o(e),u(``)},e=>u(e.message))},[]);(0,L.useEffect)(v,[v]);let y=t&&t!==`trends`?decodeURIComponent(t):``;(0,L.useEffect)(()=>{t===`trends`?_(`trends`):t&&_(`runs`)},[t]);let b=(0,L.useMemo)(()=>i?.runs.find(e=>e.id===y)||i?.runs[0],[i,y]),x=i?.trends.filter(e=>e.perf.worse.length||e.a11y.newRules.length).length??0,[S,C]=(0,L.useState)(``),[w,O]=(0,L.useState)(`all`),[M,N]=(0,L.useState)(0);(0,L.useEffect)(()=>N(0),[S,w]);let P=S.toLowerCase().split(/\s+/).filter(Boolean),F=(i?.runs??[]).filter(e=>P.every(t=>e.goal.toLowerCase().includes(t))),I=w===`attention`?F.filter(K):F;return(0,R.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,R.jsx)(p,{}),(0,R.jsxs)(`main`,{className:f(h,`@container flex-auto gap-4`),children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,R.jsx)(g,{icon:r,size:`lg`}),(0,R.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`Quality`})]}),(0,R.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 (`,i?.standard||`WCAG`,`), Core Web Vitals, and visual changes against approved baselines. Budgets (quality.budgets) decide what fails a run.`]}),s&&(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:s}),!i&&!s&&(0,R.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),i&&(0,R.jsx)(a,{label:`Quality`,current:m,onPick:e=>{_(e),e===`trends`?location.hash=n(`quality`,`trends`):location.hash=b?n(`quality`,encodeURIComponent(b.id)):n(`quality`)},tabs:[{id:`runs`,label:`Runs (${i.runs.length})`},{id:`trends`,label:`Trends${x?` (${x} worse)`:``}`}]}),i&&m===`trends`&&(0,R.jsx)(`div`,{role:`tabpanel`,id:`panel-trends`,"aria-labelledby":`tab-trends`,children:(0,R.jsx)(ie,{trends:i.trends})}),i&&m===`runs`&&(i.runs.length?(0,R.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,R.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,R.jsx)(D,{id:`quality-search`,label:`Find a run`,value:S,onChange:C,className:`flex-none`}),(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,R.jsx)(k,{items:[{id:`all`,label:`All`,n:F.length},{id:`attention`,label:`Needs a look`,n:F.filter(K).length,alert:!0}],value:w,onChange:O})}),(0,R.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[I.length===0&&(0,R.jsx)(`li`,{className:`px-3 py-3 text-sm text-muted`,children:`Nothing matches.`}),I.slice(M*q,M*q+q).map((e,t,r)=>{let i=A(e.at),a=e.breaches?l:K(e)?c:T;return(0,R.jsxs)(`li`,{className:`contents`,children:[(t===0||A(r[t-1].at)!==i)&&(0,R.jsx)(`span`,{className:`block px-3 pt-2 pb-1 text-[12px] font-semibold text-muted`,children:i}),(0,R.jsxs)(`a`,{href:n(`quality`,encodeURIComponent(e.id)),"aria-current":b?.id===e.id?`page`:void 0,className:f(`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,R.jsx)(a,{size:16,"aria-label":e.breaches?`Over a budget`:K(e)?`Needs a look`:`Within budgets`,className:f(`flex-none`,e.breaches?`text-fail`:K(e)?`text-warn`:`text-pass`)}),(0,R.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,R.jsx)(`span`,{className:`truncate text-[14px] font-medium`,title:e.goal,children:e.goal}),(0,R.jsx)(`span`,{className:`truncate text-[12px] text-muted`,children:ne(e)})]}),(0,R.jsx)(`span`,{className:`flex-none text-[12px] text-muted tabular-nums`,children:j(e.at)})]})]},e.id)})]}),I.length>q&&(0,R.jsx)(E,{page:M,size:q,total:I.length,onPage:N,label:`Pages of runs`})]}),b&&(0,R.jsx)(ae,{id:b.id,view:i,onChanged:v})]}):(0,R.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,R.jsx)(d,{size:24,"aria-hidden":`true`,className:`text-muted`}),(0,R.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{Dt as e,G as t,H as n,Hn as r,K as i,Pt as a,Tt as o,Ut as s,V as c,at as l,en as u,et as d,hn as f,jn as p,jt as m,nn as h,nt as g,ot as _,pt as v,qt as y,r as b,rn as ee,rt as x,st as S,t as C,tt as w,xn as T,zn as E}from"./frame-Dq1wC8eF.js";import{t as D}from"./markdown-BmsRBxB-.js";import{t as O}from"./file-chart-column-increasing-tV7y_ABu.js";import{t as k}from"./sticky-note-CinvvKBc.js";import{F as A,T as j,_ as M,j as N,n as te,r as ne,s as P,t as re,v as ie,y as ae}from"./index-C_8DS1Wt.js";import{n as F,t as oe}from"./when-CHnpLdYw.js";var I={name:`crosshair`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`22`,x2:`18`,y1:`12`,y2:`12`,key:`l9bcsi`}],[`line`,{x1:`6`,x2:`2`,y1:`12`,y2:`12`,key:`13hhkx`}],[`line`,{x1:`12`,x2:`12`,y1:`6`,y2:`2`,key:`10w3f3`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`18`,key:`15g9kq`}]]};I.node;var se=f(I),L={name:`dot`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]};L.node;var ce=f(L),R={name:`hourglass`,size:24,node:[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]};R.node;var z=f(R),B={name:`keyboard`,size:24,node:[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]};B.node;var V=f(B),H={name:`mouse-pointer-click`,size:24,node:[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]};H.node;var U=f(H),W={name:`pause`,size:24,node:[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]};W.node;var le=f(W),G={name:`upload`,size:24,node:[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]};G.node;var ue=f(G),K={name:`variable`,size:24,node:[[`path`,{d:`M8 21s-4-3-4-9 4-9 4-9`,key:`uto9ud`}],[`path`,{d:`M16 3s4 3 4 9-4 9-4 9`,key:`4w2vsq`}],[`line`,{x1:`15`,x2:`9`,y1:`9`,y2:`15`,key:`f7djnv`}],[`line`,{x1:`9`,x2:`15`,y1:`9`,y2:`15`,key:`1shsy8`}]]};K.node;var q=f(K),J=r(E(),1),Y=l(),de={navigate:a,back:A,click:U,dblclick:U,input:V,press:V,select:m,upload:ue,expect:N,wait_for:z,capture:q,note:k,launch:o,double_click:U,type:V,keys:V},fe=e=>de[e]||(e.startsWith(`expect`)?N: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 T.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=i(`chats`,t)}async function Q(e){let{id:t}=await T.start(`Replay the desktop workflow ${e}: call desktop_replay with workflow ${e}, and tell me how each step went.`,{});location.hash=i(`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:_(`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)(x,{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)(ae,{size:15,"aria-hidden":`true`})})]})}function he({s:e,send:t,busy:n}){let[r,i]=(0,J.useState)(``),[,a]=(0,J.useState)(0);(0,J.useEffect)(()=>{let e=setInterval(()=>a(e=>e+1),1e3);return()=>clearInterval(e)},[]);let s=(0,J.useRef)(null);(0,J.useEffect)(()=>{s.current&&(s.current.scrollTop=s.current.scrollHeight)},[e.log.length]);let l=e.kind===`desktop`,u=e.state===`paused`,d=e.log.at(-1)?.level===`warn`&&/press Stop again/i.test(e.log.at(-1).text),f=Math.max(0,...e.steps.map(e=>e.case_step||0)),p=(r,i,a,o)=>(0,Y.jsxs)(x,{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)(g,{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)(x,{disabled:n||e.state===`starting`,onClick:()=>t({cmd:`pause`}),children:[u?(0,Y.jsx)(o,{size:16,"aria-hidden":`true`}):(0,Y.jsx)(le,{size:16,"aria-hidden":`true`}),u?`Resume`:`Pause`]}),(0,Y.jsxs)(x,{disabled:n||e.state===`stopping`,onClick:()=>t({cmd:`stop`,...d?{force:!0}:{}}),className:`border-fail bg-fail text-white hover:bg-fail hover:text-white hover:opacity-90`,children:[(0,Y.jsx)(v,{size:14,fill:`currentColor`,"aria-hidden":`true`}),d?`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:[p(`assert`,`Check an element`,se,`Pick an element in the page to check`),p(`variable`,`Keep a value`,q,`Pick an element whose text later steps use`),p(`wait`,`Wait for`,z,`Pick an element the test waits for`),p(`data`,`Test data`,y,`The last value you typed becomes test data`),p(`note`,`Note`,k,`A note for the step, for whoever reads the test`),p(`undo`,`Undo`,ie,`Remove the last step`)]}),(0,Y.jsxs)(`form`,{className:`flex flex-wrap gap-2`,onSubmit:e=>{e.preventDefault(),r.trim()&&(t({cmd:`chat`,text:r.trim()}),i(``))},children:[(0,Y.jsx)(`label`,{htmlFor:`rec-check`,className:`sr-only`,children:`Describe a check`}),(0,Y.jsx)(c,{id:`rec-check`,value:r,maxLength:2e3,placeholder:`Describe a check: the total shows "$40.00", or note: …`,onChange:e=>i(e.target.value),className:`min-w-0 flex-[1_1_320px]`}),(0,Y.jsxs)(x,{type:`submit`,variant:`primary`,disabled:n||!r.trim()||e.state===`starting`,children:[(0,Y.jsx)(M,{size:16,"aria-hidden":`true`}),`Add`]})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-6 gap-y-5`,children:[(0,Y.jsxs)(`section`,{"aria-labelledby":`rec-steps`,className:`flex min-w-0 flex-[999_1_420px] flex-col gap-2 rounded-[14px] border border-line-soft px-4 py-3`,children:[(0,Y.jsxs)(`h2`,{id:`rec-steps`,className:`m-0 flex items-center gap-2 text-base font-semibold`,children:[(0,Y.jsx)(m,{size:18,"aria-hidden":`true`,className:`text-accent-fg`}),`Steps`,(0,Y.jsx)(`span`,{className:`text-sm font-normal text-muted`,children:e.summary})]}),e.steps.length?(0,Y.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,"aria-live":`polite`,children:e.steps.map(e=>(0,Y.jsx)(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)(m,{size:18,"aria-hidden":`true`,className:`text-accent-fg`}),e.case.id]}),(0,Y.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[e.case.title,`. Each step you record belongs to the case step you are on: pick one to record it.`]}),(0,Y.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,children:e.case.steps.map(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===f?`step`:void 0,onClick:()=>t({cmd:`case_step`,n:r.n}),className:_(`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===f&&`bg-accent-soft`),children:[i?(0,Y.jsx)(N,{size:16,"aria-hidden":`true`,className:`mt-0.5 flex-none text-pass`}):(0,Y.jsx)(`span`,{className:`mt-0.5 w-4 flex-none text-center text-[12px] text-muted`,children: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)(x,{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:s,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-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:e}){let n=e.result,[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(!1);if(!n)return null;let c=e.kind===`desktop`;return(0,Y.jsxs)(`section`,{"aria-labelledby":`rec-result`,className:`flex flex-col gap-3 rounded-[14px] border border-line-soft p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`h2`,{id:`rec-result`,className:`m-0 flex-1 text-base font-semibold [overflow-wrap:anywhere]`,children:e.name}),(0,Y.jsx)(P,{tone: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||e.summary:n.error||`Nothing was recorded.`,` `,e.endedAt&&(0,Y.jsxs)(`span`,{className:`text-muted`,children:[`· `,X(e.startedAt,e.endedAt)]})]}),n.ok&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-sm`,children:[(0,Y.jsx)(P,{tone:`neutral`,icon:!1,children:S(e.steps.length,`step`)}),(0,Y.jsxs)(P,{tone:n.checks?`pass`:`warn`,children:[n.checks,` check`,n.checks===1?``:`s`]}),n.variables.length>0&&(0,Y.jsxs)(P,{tone:`neutral`,icon:!1,children:[`kept: `,n.variables.join(`, `)]}),n.testData.length>0&&(0,Y.jsxs)(P,{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)(x,{variant:`primary`,disabled:a,onClick:async()=>{o(!0);try{await Q(n.workflow)}catch(e){i(e.message),o(!1)}},children:[(0,Y.jsx)(j,{size:16,"aria-hidden":`true`}),`Replay it`]}),c&&n.report&&(0,Y.jsxs)(x,{onClick:async()=>i(await t(n.report)),children:[(0,Y.jsx)(O,{size:16,"aria-hidden":`true`}),`Open the report`]}),!c&&n.ok&&(0,Y.jsxs)(x,{variant:`primary`,disabled:a,onClick:async()=>{o(!0);try{await Z(e.runDir)}catch(e){i(e.message),o(!1)}},children:[(0,Y.jsx)(M,{size:16,"aria-hidden":`true`}),`Write a test from it`]}),!c&&n.ok&&(0,Y.jsxs)(x,{onClick:async()=>i(await t(`${e.runDir}/trace.md`)),children:[(0,Y.jsx)(s,{size:16,"aria-hidden":`true`}),`Read the steps`]}),(0,Y.jsx)(`span`,{className:`text-sm`,children:(0,Y.jsx)(D,{path:c&&n.workflow?n.workflow:e.runDir})}),r&&(0,Y.jsx)(`span`,{className:`text-[13px] text-fail`,children:r})]})]})}function _e({view:t,busy:r,onStart:o}){let[s,l]=(0,J.useState)(t.session?.kind===`desktop`&&t.desktop.available?`desktop`:`web`),[u,f]=(0,J.useState)(t.desktop.apps[0]??``),[p,m]=(0,J.useState)(t.apps[0]?.name??``),[g,v]=(0,J.useState)(``),[y,b]=(0,J.useState)(``),[S,C]=(0,J.useState)(``),[w,T]=(0,J.useState)(t.environment??``),[E,D]=(0,J.useState)(!1),[O,k]=(0,J.useState)(!1),A=s===`desktop`?t.desktop.available&&!!u:p?!0:/^https?:\/\/\S+$/i.test(g.trim()),j=s===`web`||t.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:e=>{if(e.preventDefault(),A){if(s===`desktop`)return o({kind:`desktop`,app:u,...y.trim()?{name:y.trim()}:{},...w&&w!==t.environment?{env:w}:{}});o({...p?{app:p}:{url:g.trim()},...y.trim()?{name:y.trim()}:{},...S.trim()?{case:S.trim()}:{},...w&&w!==t.environment?{env:w}:{},signedIn:E})}},children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Y.jsx)(`h2`,{id:`rec-new`,className:`m-0 flex-1 text-base font-semibold`,children:`New recording`}),(0,Y.jsx)(`div`,{role:`radiogroup`,"aria-label":`What to record`,className:`flex gap-1 rounded-[10px] bg-surface-strong p-1`,children:[[`web`,`Web page`,a,!0],[`desktop`,`Desktop app`,e,t.desktop.available]].map(([e,n,r,i])=>(0,Y.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":s===e,disabled:!i,title:i?void 0:t.desktop.reason||`Windows only.`,onClick:()=>l(e),className:_(`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`,s===e?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),children:[(0,Y.jsx)(r,{size:14,"aria-hidden":`true`}),n]},e))})]}),(0,Y.jsxs)(`div`,{className:`grid gap-2 @2xl:grid-cols-[minmax(0,1.2fr)_minmax(0,1fr)_auto]`,children:[s===`desktop`?t.desktop.apps.length?(0,Y.jsx)(n,{"aria-label":`App`,value:u,onChange:e=>f(e.target.value),children:t.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:i(`settings`,`environments`),children:`Settings, Environments`}),`.`]}):(0,Y.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[t.apps.length>0&&(0,Y.jsxs)(n,{"aria-label":`Start on`,value:p,onChange:e=>m(e.target.value),className:_(p?`min-w-0 flex-1`:`w-[150px] flex-none`),children:[t.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…`})]}),!p&&(0,Y.jsx)(c,{"aria-label":`Page address`,type:`url`,value:g,spellCheck:!1,placeholder:`https://shop.example.com/`,onChange:e=>v(e.target.value),className:`min-w-0 flex-1`})]}),(0,Y.jsx)(c,{"aria-label":`What the test does`,value:y,maxLength:200,placeholder:`What the test does`,onChange:e=>b(e.target.value)}),(0,Y.jsxs)(x,{type:`submit`,variant:`primary`,disabled:r||!A,children:[(0,Y.jsx)(h,{size:16,"aria-hidden":`true`}),r?s===`desktop`?`Starting…`:`Opening…`:`Start recording`]})]}),j&&(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":O,onClick:()=>k(!O),className:`inline-flex cursor-pointer items-center gap-1 self-start border-0 bg-transparent p-0 text-[13px] text-muted hover:text-ink`,children:[(0,Y.jsx)(ee,{size:14,"aria-hidden":`true`,className:_(`transition-transform`,O&&`rotate-180`)}),`More options`,!O&&(S||E||w&&w!==t.environment)?(0,Y.jsx)(`span`,{className:`text-accent-fg`,children:`· set`}):null]}),O&&(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-[12px] bg-surface-muted p-3 @2xl:grid-cols-2`,children:[s===`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)(c,{value:S,spellCheck:!1,placeholder:`SHOP-12, ado:1234 or a file`,onChange:e=>C(e.target.value),className:`bg-bg`})]}),t.environments.length>1&&(s===`desktop`||!!p)&&(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm font-medium`,children:[`Environment`,(0,Y.jsx)(n,{value:w,onChange:e=>T(e.target.value),children:t.environments.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))})]}),s===`web`&&t.logins.length>0&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 @2xl:col-span-2`,children:[(0,Y.jsx)(d,{checked:E,onChange:D,label:`Start signed in`}),(0,Y.jsxs)(`span`,{className:`flex flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium`,children:`Start signed in`}),(0,Y.jsxs)(`span`,{className:`text-[12.5px] text-muted`,children:[`With the saved sign-ins (`,t.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:s===`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:n}){let[r,i]=(0,J.useState)(``),[o,c]=(0,J.useState)(``),[l,d]=(0,J.useState)(`all`),[f,p]=(0,J.useState)(0);if((0,J.useEffect)(()=>p(0),[o,l]),!n.length)return null;let m=o.toLowerCase().split(/\s+/).filter(Boolean),h=n.filter(e=>m.every(t=>`${e.name} ${e.caseId||``} ${e.app||``} ${e.startUrl}`.toLowerCase().includes(t))),g=l===`all`?h:h.filter(e=>e.kind===l),_=g.slice(f*$,f*$+$),v=n.some(e=>e.kind===`desktop`)&&n.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:n.length})]}),(0,Y.jsx)(ne,{id:`rec-search`,label:`Find a recording`,value:o,onChange:c}),v&&(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:l,onChange:d})]}),r&&(0,Y.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:r}),(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:[_.length===0&&(0,Y.jsx)(`li`,{className:`px-3 py-4 text-sm text-muted`,children:`Nothing matches.`}),_.map((n,r)=>{let o=F(n.startedAt);return(0,Y.jsxs)(`li`,{className:`contents`,children:[(r===0||F(_[r-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:[n.ok?(0,Y.jsx)(N,{size:16,"aria-label":`Recorded`,className:`text-pass`}):(0,Y.jsx)(u,{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:[n.kind===`desktop`?(0,Y.jsx)(e,{size:13,"aria-label":`Desktop app`,className:`flex-none text-muted`}):(0,Y.jsx)(a,{size:13,"aria-label":`Web page`,className:`flex-none text-muted`}),(0,Y.jsx)(`span`,{className:`truncate text-[14px] font-medium`,title:n.name,children:n.name})]}),(0,Y.jsx)(`span`,{className:`truncate text-[12px] text-muted`,children:[S(n.steps,`step`),S(n.checks,`check`),n.caseId,n.app,oe(n.startedAt)].filter(Boolean).join(` · `)})]}),(0,Y.jsxs)(`span`,{className:`flex flex-none items-center gap-1`,children:[n.trace&&(0,Y.jsx)(x,{size:`icon`,variant:`icon`,"aria-label":`Read the steps of ${n.name}`,title:`Read the steps`,onClick:async()=>i(await t(n.trace)),children:(0,Y.jsx)(s,{size:15,"aria-hidden":`true`})}),n.report&&(0,Y.jsx)(x,{size:`icon`,variant:`icon`,"aria-label":`Open the report of ${n.name}`,title:`Open the report`,onClick:async()=>i(await t(n.report)),children:(0,Y.jsx)(O,{size:15,"aria-hidden":`true`})}),n.kind===`desktop`&&n.workflow&&(0,Y.jsxs)(x,{size:`sm`,onClick:()=>Q(n.workflow).catch(e=>i(e.message)),children:[(0,Y.jsx)(j,{size:14,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`hidden @md:inline`,children:`Replay`})]}),n.kind===`web`&&n.ok&&(0,Y.jsxs)(x,{size:`sm`,onClick:()=>Z(n.runDir).catch(e=>i(e.message)),children:[(0,Y.jsx)(M,{size:14,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`hidden @md:inline`,children:`Write a test`})]})]})]})]},n.runDir)})]}),(0,Y.jsx)(te,{page:f,size:$,total:g.length,onPage:p,label:`Pages of recordings`})]})]})}function ye(){let[e,t]=(0,J.useState)(null),[n,r]=(0,J.useState)(``),[i,a]=(0,J.useState)(!1),o=(0,J.useCallback)(()=>{p.get().then(e=>{t(e),r(``)},e=>r(e.message))},[]);(0,J.useEffect)(o,[o]);let s=!!e?.session&&pe.has(e.session.state);(0,J.useEffect)(()=>{if(!s)return;let e=setInterval(o,800);return()=>clearInterval(e)},[s,o]);let c=async e=>{a(!0),r(``);try{t(await e())}catch(e){r(e.message)}finally{a(!1)}},l=e?.session;return(0,Y.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,Y.jsx)(b,{}),(0,Y.jsxs)(`main`,{className:_(C,`@container flex-auto gap-4`),children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(w,{icon:h,size:`lg`}),(0,Y.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Record`})]}),(0,Y.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:`Do a test's steps yourself in a browser or a Windows app ForgeQE opens; each click, entry and check you add is recorded in order.`}),n&&(0,Y.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:n}),!e&&!n&&(0,Y.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),e&&l&&s&&(0,Y.jsx)(he,{s:l,busy:i,send:e=>void c(()=>p.command(e))}),e&&!s&&(0,Y.jsxs)(Y.Fragment,{children:[l?.result&&(0,Y.jsx)(ge,{s:l}),(0,Y.jsx)(_e,{view:e,busy:i,onStart:e=>void c(()=>p.start(e))}),(0,Y.jsx)(ve,{rows:e.recordings})]})]})]})}export{ye as Record};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{At as e,Hn as t,Vt as n,Wt as r,at as i,bt as a,ct as o,hn as s,in as c,nt as l,ot as u,rn as d,rt as f,st as p,zn as m}from"./frame-Dq1wC8eF.js";import{a as h,n as g,r as ee,t as _}from"./markdown-BmsRBxB-.js";import{A as te,M as ne,a as v,i as y,o as b,s as re}from"./index-C_8DS1Wt.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=s(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=s(S),C=t(m(),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=i();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:u(`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:u(`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:u(`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:t,orb:n,px:r=20,spin:i=!1}){let a={width:r,height:r};return t===`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)(e,{size:r-2,strokeWidth:2.5,"aria-hidden":`true`,className:`animate-spin text-accent-fg motion-reduce:animate-none`})}):t===`active`?(0,R.jsx)(l,{state:n,px:r,label:`At work`}):t===`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:r*.6,strokeWidth:3,"aria-hidden":`true`,className:`text-white`})}):t===`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)(o,{size:r*.6,strokeWidth:3,"aria-hidden":`true`,className:`text-white`})}):t===`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":t===`skipped`?`Skipped`:`To come`,className:u(`box-border block flex-none rounded-full border-2 border-line-strong`,t===`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:u(`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:u(`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:u(`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=v}){let r=e.agent||n,i=je(e),a=De(e,t),[o,s]=(0,C.useState)(null),c=o??((!!e.handoff||!!e.agent)&&a===`active`),l=(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:u(`[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)(d,{size:14,"aria-hidden":`true`,className:u(`mt-0.5 ml-auto flex-none text-muted transition-transform`,c&&`rotate-180`)})]});return(0,R.jsxs)(`li`,{className:`flex flex-col`,children:[i?(0,R.jsx)(`button`,{type:`button`,"aria-expanded":c,onClick:()=>s(!c),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:l}):(0,R.jsx)(`div`,{className:`flex min-h-8 items-start gap-2 px-1.5 py-1.5 text-[13.5px]`,children:l}),c&&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:u(`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,o=e.step,s=a.length>0||!!r||!!o&&je(o),[c,l]=(0,C.useState)(null),f=c??(e.status===`active`||e.status===`failed`),p=o?.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:u(`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:[s?(0,R.jsxs)(`button`,{type:`button`,"aria-expanded":f,onClick:()=>l(!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)(d,{size:14,"aria-hidden":`true`,className:u(`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-fg`,children:`In progress`})]}):(0,R.jsx)(`div`,{className:`min-h-7`,children:(0,R.jsx)(Pe,{node:e})}),f&&s&&(0,R.jsx)(`div`,{className:`chain-in mt-0.5`,children:o?(0,R.jsx)(Me,{step:o,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:v,live:e.status===`active`}):(0,R.jsxs)(`span`,{className:u(`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-fg`,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 r=Ie(e.latest?.at);return(0,R.jsxs)(`div`,{className:u(`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)(l,{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:u(`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:[r,r&&` · `,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 ee(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:e}){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)(n,{size:16,"aria-hidden":`true`,className:`text-accent-fg`}),(0,R.jsx)(`span`,{className:`font-medium`,children:`Test written`}),(0,R.jsx)(re,{tone:e.ok?`pass`:e.status===`stopped`?`neutral`:`fail`,children:Re[e.status]||e.status||`Not written`}),e.attempts!==void 0&&(0,R.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.maxAttempts?`attempt ${e.attempts} of ${e.maxAttempts}`:p(e.attempts,`attempt`)})]}),e.testFile&&(0,R.jsx)(Q,{label:`Test file`,children:(0,R.jsx)(_,{path:e.testFile})}),e.testName&&(0,R.jsx)(Q,{label:`Test`,children:(0,R.jsx)(`code`,{className:`font-mono text-[12.5px]`,children:e.testName})}),e.command&&(0,R.jsx)(Q,{label:`Run it`,children:(0,R.jsx)(ze,{text:e.command})}),e.runDir&&(0,R.jsx)(Q,{label:`From the run`,children:(0,R.jsx)(_,{path:e.runDir})}),e.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:e.reused.map(e=>(0,R.jsx)(_,{path:e},e))})}),e.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:e.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)(d,{size:15,"aria-hidden":`true`,className:u(`transition-transform`,!t&&`-rotate-90`)})}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,R.jsx)(_,{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:e}){let t=e.reports.filter((e,t,n)=>n.findIndex(t=>t.path===e.path)===t),n=new Set(e.changes.map(e=>e.path)),i=[...new Set(e.tests.flatMap(e=>e.changed))].filter(e=>!n.has(e)&&![...n].some(t=>t.endsWith(e)||e.endsWith(t)));return!e.tests.length&&!t.length&&!e.changes.length&&!i.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:[e.tests.map((e,t)=>(0,R.jsx)(Be,{t:e},t)),t.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:t.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)(_,{path:e.path})]},e.path))})]}),(e.changes.length>0||i.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)(r,{size:15,"aria-hidden":`true`,className:`text-muted`}),`Files changed`,(0,R.jsxs)(`span`,{className:`font-normal text-muted`,children:[p(e.changes.length+i.length,`file`),` · `,(0,R.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.changes.reduce((e,t)=>e+t.added,0)]}),` `,(0,R.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.changes.reduce((e,t)=>e+t.removed,0)]})]})]}),(0,R.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[e.changes.map(e=>(0,R.jsx)(Ve,{c:e},e.path)),i.map(e=>(0,R.jsx)(`li`,{className:`flex min-h-9 items-center gap-2 pl-9`,children:(0,R.jsx)(_,{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:u(`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-fg`}),(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)(f,{size:`sm`,onClick:()=>n(e.id),children:e.label},e.id)),(0,R.jsx)(f,{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:u(`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)(ne,{size:18,"aria-hidden":`true`,className:`mt-0.5 flex-none text-accent-fg`}),(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)(f,{size:`sm`,variant:`primary`,onClick:()=>n(!0),children:`Done, continue`}),(0,R.jsx)(f,{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,[o,s]=(0,C.useState)(null),c=o??i,l=xe(e),f=i?l.text:Se(e),p=e.parts.map(e=>j(e.text)).filter(Boolean),[m,h]=(0,C.useState)(!1),ee=[...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:u(`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:f}),(e.steps.length>0||e.plan.length>0)&&(0,R.jsx)(d,{size:16,"aria-hidden":`true`,className:u(`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)(a,{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:ee,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}):p.length>0&&(0,R.jsx)(g,{text:p.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};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{At as e,D as t,G as n,H as r,Hn as i,It as a,K as o,Nt as s,Ot as c,Pn as l,Tt as u,V as ee,Vt as d,an as f,at as p,en as m,hn as h,ht as g,lt as _,ot as v,pt as te,r as y,rn as b,rt as x,sn as S,st as C,t as w,tt as T,wt as E,xn as D,zn as O}from"./frame-Dq1wC8eF.js";import{t as ne}from"./circle-dashed-CEZcCi0T.js";import{n as k,t as A}from"./markdown-BmsRBxB-.js";import{t as j}from"./external-link-NCKfigiH.js";import{t as M}from"./file-chart-column-increasing-tV7y_ABu.js";import{a as re,i as ie,t as ae}from"./Response-pcvzCf4S.js";import{t as oe}from"./terminal-EkGTrfG9.js";import{F as se,N as ce,P as le,T as ue,_ as de,j as fe,s as N,w as P}from"./index-C_8DS1Wt.js";import{n as F,t as pe}from"./when-CHnpLdYw.js";var I={name:`book-check`,size:24,node:[[`path`,{d:`M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20`,key:`k3hazp`}],[`path`,{d:`m9 9.5 2 2 4-4`,key:`1dth82`}]]};I.node;var me=h(I),L={name:`code-xml`,size:24,node:[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]],aliases:[`code-2`]};L.node;var R=h(L),z={name:`flag`,size:24,node:[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]};z.node;var he=h(z),B={name:`lightbulb`,size:24,node:[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]};B.node;var ge=h(B),V=i(O(),1),H=p(),U={execution:`Execution`,report:`Report`,coding:`Coding`,chat:`Chat`},_e={execution:d,report:M,coding:R,chat:c};function ve({kind:e}){let t=_e[e];return(0,H.jsx)(t,{size:14,"aria-hidden":`true`,className:`flex-none text-muted`})}var ye={passed:{label:`Passed`,tone:`pass`},failed:{label:`Failed`,tone:`fail`},error:{label:`Error`,tone:`fail`},skipped:{label:`Skipped`,tone:`neutral`},stopped:{label:`Stopped`,tone:`neutral`},blocked:{label:`Blocked`,tone:`warn`}},W=e=>ye[e]||{label:e?e.charAt(0).toUpperCase()+e.slice(1).replace(/_/g,` `):`–`,tone:`neutral`},be={suite:`Suite`,monitor:`Monitor round`,run:`Browser run`,explore:`Exploration`,api:`API run`,desktop:`Desktop run`,mobile:`App run`},xe=e=>{if(!e)return``;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`};function G({title:e,icon:t,children:n,aside:r}){return(0,H.jsxs)(`section`,{className:`flex flex-col gap-3 rounded-[14px] border border-line-soft p-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsxs)(`h3`,{className:`m-0 flex flex-1 items-center gap-2 text-base font-semibold`,children:[(0,H.jsx)(`span`,{className:`text-accent-fg`,children:t}),e]}),r]}),n]})}function Se({path:e,label:t=`Open report`}){let[r,i]=(0,V.useState)(``);return(0,H.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,H.jsxs)(x,{onClick:async()=>i(await n(e)),children:[(0,H.jsx)(j,{size:16,"aria-hidden":`true`}),t]}),r&&(0,H.jsx)(`span`,{className:`text-[13px] text-fail`,children:r})]})}function Ce({items:e,first:t,render:n}){let[r,i]=(0,V.useState)(!1);return(0,H.jsxs)(H.Fragment,{children:[(r?e:e.slice(0,t)).map(n),e.length>t&&(0,H.jsx)(`button`,{type:`button`,"aria-expanded":r,onClick:()=>i(!r),className:`min-h-8 cursor-pointer self-start border-0 bg-transparent px-0 text-[13px] font-medium text-accent-fg hover:underline`,children:r?`Show fewer`:`Show all ${e.length}`})]})}function we({c:e}){if(!e.total)return null;let t=t=>`${t/e.total*100}%`;return(0,H.jsxs)(`div`,{role:`img`,"aria-label":`${e.passed} passed, ${e.failed} failed, ${e.other} other, of ${e.total}`,className:`flex h-2 overflow-hidden rounded-full bg-surface-strong`,children:[(0,H.jsx)(`div`,{className:`bg-pass`,style:{width:t(e.passed)}}),(0,H.jsx)(`div`,{className:`bg-fail`,style:{width:t(e.failed)}}),(0,H.jsx)(`div`,{className:`bg-warn`,style:{width:t(e.other)}})]})}function Te({e}){let n=e.counts.total?Math.round(e.counts.passed/e.counts.total*100):0;return(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 border-t border-line-soft pt-3 first:border-t-0 first:pt-0`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-0.5`,children:[(0,H.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,H.jsx)(`span`,{className:`text-[13px] text-muted`,children:[be[e.scope]||e.scope,xe(e.ms),e.tokens?`${t(e.tokens)} tokens`:``,e.stopped?`stopped early`:``].filter(Boolean).join(` · `)})]}),e.report&&(0,H.jsx)(Se,{path:e.report})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,H.jsxs)(`span`,{className:`text-[22px] font-semibold tabular-nums`,children:[n,`%`]}),(0,H.jsx)(`span`,{className:`text-muted`,children:`passed`}),(0,H.jsxs)(N,{tone:`pass`,children:[e.counts.passed,` passed`]}),e.counts.failed>0&&(0,H.jsxs)(N,{tone:`fail`,children:[e.counts.failed,` failed`]}),e.counts.other>0&&(0,H.jsxs)(N,{tone:`warn`,children:[e.counts.other,` other`]}),(0,H.jsxs)(`span`,{className:`text-muted`,children:[`of `,e.counts.total]})]}),(0,H.jsx)(we,{c:e.counts}),e.cases.length>0&&(0,H.jsx)(`ul`,{"aria-label":`Cases of ${e.title}`,className:`m-0 flex list-none flex-col p-0`,children:(0,H.jsx)(Ce,{items:[...e.cases].sort((e,t)=>Number(W(t.status).tone===`fail`)-Number(W(e.status).tone===`fail`)),first:6,render:(e,t)=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-start gap-3 border-t border-line-soft py-2 text-sm`,children:[(0,H.jsx)(`span`,{className:`w-[76px] flex-none`,children:(0,H.jsx)(N,{tone:W(e.status).tone,children:W(e.status).label})}),(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,H.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[e.id&&(0,H.jsx)(`span`,{className:`mr-1.5 font-mono text-[12px] text-muted`,children:e.id}),e.title,e.device&&(0,H.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.device]})]}),e.summary&&(0,H.jsx)(`span`,{className:`line-clamp-2 text-[13px] text-muted`,children:e.summary})]}),(0,H.jsx)(`span`,{className:`flex-none text-[13px] text-muted tabular-nums`,children:xe(e.ms)})]},`${e.id}-${t}`)})}),e.folder&&!e.report&&(0,H.jsxs)(`span`,{className:`text-sm`,children:[`Kept in `,(0,H.jsx)(A,{path:e.folder})]})]})}function Ee({list:e}){let t=e.reduce((e,t)=>({total:e.total+t.counts.total,passed:e.passed+t.counts.passed,failed:e.failed+t.counts.failed}),{total:0,passed:0,failed:0});return(0,H.jsx)(G,{title:`Execution summary`,icon:(0,H.jsx)(d,{size:18,"aria-hidden":`true`}),aside:e.length>1?(0,H.jsxs)(`span`,{className:`text-sm text-muted`,children:[C(e.length,`run`),` · `,t.passed,` of `,t.total,` passed`]}):void 0,children:e.length?e.map((e,t)=>(0,H.jsx)(Te,{e},`${e.folder||e.title}-${t}`)):(0,H.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No results found for this run yet: they appear once its report is written.`})})}function De({list:e}){return(0,H.jsxs)(G,{title:`Report summary`,icon:(0,H.jsx)(M,{size:18,"aria-hidden":`true`}),children:[e.length===0&&(0,H.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No report was written in this run.`}),e.map((e,t)=>(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 border-t border-line-soft pt-3 first:border-t-0 first:pt-0`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-0.5`,children:[(0,H.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,H.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.builtAt?`Written ${new Date(e.builtAt).toLocaleString([],{dateStyle:`medium`,timeStyle:`short`})}`:e.path?``:`Its page is not there any more`})]}),e.path&&(0,H.jsx)(Se,{path:e.path})]}),e.stats&&(0,H.jsx)(`dl`,{className:`m-0 grid grid-cols-[repeat(auto-fit,minmax(110px,1fr))] gap-2`,children:e.stats.map(e=>(0,H.jsxs)(`div`,{className:`rounded-[10px] bg-surface-muted px-3 py-2`,children:[(0,H.jsx)(`dt`,{className:`text-[12px] text-muted`,children:e.label}),(0,H.jsx)(`dd`,{className:`m-0 text-[18px] font-semibold tabular-nums`,children:e.value})]},e.label))}),e.markdown&&(0,H.jsx)(Oe,{text:e.markdown})]},`${e.path||e.title}-${t}`))]})}function Oe({text:e,height:t=220}){let[n,r]=(0,V.useState)(!1),[i,a]=(0,V.useState)(!0),o=(0,V.useRef)(null);return(0,V.useLayoutEffect)(()=>{o.current&&!n&&a(o.current.scrollHeight>t+8)},[e,t,n]),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsxs)(`div`,{ref:o,style:n?void 0:{maxHeight:t},className:n?``:`relative overflow-hidden`,children:[(0,H.jsx)(k,{text:e,className:`text-sm`}),!n&&i&&(0,H.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-bg to-transparent`})]}),(n||i)&&(0,H.jsx)(`button`,{type:`button`,"aria-expanded":n,onClick:()=>r(!n),className:`min-h-8 cursor-pointer self-start border-0 bg-transparent px-0 text-[13px] font-medium text-accent-fg hover:underline`,children:n?`Show less`:`Show all of it`})]})}function ke(e){let t=e.join(`
|
|
2
|
-
`),n=Math.max(2,...(t.match(/`+/g)||[]).map(e=>e.length)),r="`".repeat(n+1);return`${r}diff\n${t}\n${r}`}function Ae({e}){let[t,n]=(0,V.useState)(!1),r=e.action===`write`?`New`:`Edited`;return(0,H.jsxs)(`li`,{className:`border-t border-line-soft`,children:[(0,H.jsxs)(`div`,{className:`flex min-h-[44px] min-w-0 items-center gap-2 py-1.5 text-sm`,children:[(0,H.jsx)(`button`,{type:`button`,"aria-expanded":t,"aria-label":`${t?`Hide`:`Show`} the diff of ${e.path}`,disabled:!e.diffs.length,onClick:()=>n(!t),className:`inline-flex size-8 flex-none cursor-pointer items-center justify-center rounded-lg border-0 bg-transparent text-muted hover:bg-surface-strong disabled:cursor-default disabled:opacity-40`,children:t?(0,H.jsx)(b,{size:16,"aria-hidden":`true`}):(0,H.jsx)(ce,{size:16,"aria-hidden":`true`})}),(0,H.jsx)(`span`,{className:`w-[52px] flex-none text-[12px] text-muted`,children:r}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,H.jsx)(A,{path:e.path})}),(0,H.jsxs)(`span`,{className:`flex-none font-mono text-[12px] tabular-nums`,children:[(0,H.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.added]}),` `,(0,H.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.removed]})]})]}),t&&(0,H.jsx)(`div`,{className:`pb-3 pl-10 [&_pre]:max-h-[420px] [&_pre]:overflow-auto`,children:e.diffs.length?(0,H.jsx)(k,{text:ke(e.diffs)}):null})]})}function je({c:e}){let t=e.edits.reduce((e,t)=>e+t.added,0),n=e.edits.reduce((e,t)=>e+t.removed,0),r=e.tests.at(-1),i=e.reviews.at(-1);return(0,H.jsxs)(G,{title:`Code changes`,icon:(0,H.jsx)(R,{size:18,"aria-hidden":`true`}),aside:(0,H.jsxs)(`span`,{className:`font-mono text-[13px] tabular-nums`,children:[e.edits.length,` file`,e.edits.length===1?``:`s`,` · `,(0,H.jsxs)(`span`,{className:`text-pass`,children:[`+`,t]}),` `,(0,H.jsxs)(`span`,{className:`text-fail`,children:[`−`,n]})]}),children:[e.results.map((e,t)=>(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[12px] bg-surface-muted px-4 py-3 text-sm`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(N,{tone:e.status===`passed`||e.status===`done`?`pass`:e.status===`error`||e.status===`failed`?`fail`:`warn`,children:W(e.status).label}),e.testFile&&(0,H.jsx)(A,{path:e.testFile}),e.maxAttempts>0&&(0,H.jsxs)(`span`,{className:`text-muted`,children:[`attempt `,e.attempts,` of `,e.maxAttempts]}),e.review&&(0,H.jsx)(N,{tone:e.review.approved?`pass`:`warn`,children:e.review.approved?`Review approved`:`Review not approved`})]}),e.error&&(0,H.jsx)(`p`,{className:`m-0 text-fail`,children:e.error}),e.notes&&(0,H.jsx)(k,{text:e.notes,className:`text-sm [&_p]:my-1`}),e.command&&(0,H.jsx)(k,{text:`Run it with \`${e.command.replace(/`/g,``)}\``,className:`text-sm [&_p]:my-0`})]},t)),(r||i)&&(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-sm`,children:[r&&(0,H.jsxs)(N,{tone:r.ok?`pass`:`fail`,children:[`Last test run `,r.ok?`passed`:`failed`,e.tests.length>1?` (${e.tests.length} runs)`:``]}),i&&(0,H.jsxs)(N,{tone:i.approved?`pass`:`warn`,children:[`Review `,i.approved?`approved`:`asked for ${i.issues} fix${i.issues===1?``:`es`}`]})]}),e.edits.length?(0,H.jsx)(`ul`,{"aria-label":`Files changed`,className:`m-0 flex list-none flex-col p-0`,children:(0,H.jsx)(Ce,{items:e.edits,first:8,render:e=>(0,H.jsx)(Ae,{e},e.path)})}):(0,H.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No files changed.`}),e.edits.some(e=>!e.diffs.length)&&(0,H.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`A file without a diff was changed before ForgeQE kept diffs, or is a hidden or credential file, whose text is not kept.`})]})}function Me({final:e,answer:t}){let n=e.from===`agent`?t?.facts??[]:[],r=e.from===`agent`?t?.files??[]:[],i=e.from!==`agent`,a=Math.max(2,...(e.text.match(/`+/g)||[]).map(e=>e.length)),o="`".repeat(a+1);return(0,H.jsxs)(G,{title:`Final message`,icon:(0,H.jsx)(he,{size:18,"aria-hidden":`true`}),aside:(0,H.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.from===`agent`?`The agent's last reply`:e.from===`job`?`The end of the job's output`:`What the command said at the end`}),children:[n.length>0&&(0,H.jsx)(`dl`,{className:`m-0 grid grid-cols-[repeat(auto-fit,minmax(180px,1fr))] gap-2`,children:n.map((e,t)=>(0,H.jsxs)(`div`,{className:`min-w-0 rounded-[10px] bg-surface-muted px-3 py-2`,children:[(0,H.jsx)(`dt`,{className:`text-[12px] text-muted`,children:e.label}),(0,H.jsx)(`dd`,{className:`m-0 text-sm [overflow-wrap:anywhere]`,children:(0,H.jsx)(k,{text:e.value,className:`[&_p]:my-0`})})]},`${e.label}-${t}`))}),(0,H.jsx)(Oe,{text:i?`${o}text\n${e.text}\n${o}`:re(e.text),height:360}),r.length>0&&(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,H.jsx)(`span`,{className:`text-muted`,children:`Files it names:`}),r.map(e=>(0,H.jsx)(A,{path:e},e))]})]})}var Ne={rule:{icon:me,label:`Rulebook`},decision:{icon:a,label:`Test decisions`},memory:{icon:S,label:`Page memory`},replay:{icon:E,label:`Replays`},model:{icon:g,label:`Model`},skill:{icon:s,label:`Skills`}};function Pe({list:e}){let t=Object.keys(Ne).filter(t=>e.some(e=>e.kind===t));return(0,H.jsx)(G,{title:`Learnings`,icon:(0,H.jsx)(ge,{size:18,"aria-hidden":`true`}),aside:e.length?(0,H.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[e.length,` from this session`]}):void 0,children:e.length===0?(0,H.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing learned or decided in this session: no rules, test decisions, page memory or model switches in its log.`}):(0,H.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(280px,1fr))] gap-x-6 gap-y-3`,children:t.map(t=>{let{icon:n,label:r}=Ne[t];return(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,H.jsxs)(`h4`,{className:`m-0 flex items-center gap-1.5 text-[13px] font-medium text-muted`,children:[(0,H.jsx)(n,{size:14,"aria-hidden":`true`}),r]}),(0,H.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.filter(e=>e.kind===t).map((e,t)=>(0,H.jsxs)(`li`,{className:`flex flex-col gap-0.5 border-t border-line-soft py-1.5 text-sm first:border-t-0`,children:[(0,H.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.text}),e.note&&(0,H.jsx)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.note})]},t))})]},t)})})})}function Fe({run:e}){let t=[];return(e.executions.length||e.kind===`execution`)&&t.push({kind:`execution`,node:(0,H.jsx)(Ee,{list:e.executions},`e`)}),(e.reports.length||e.kind===`report`)&&t.push({kind:`report`,node:(0,H.jsx)(De,{list:e.reports},`r`)}),e.coding&&(e.coding.edits.length||e.coding.results.length||e.kind===`coding`)&&t.push({kind:`coding`,node:(0,H.jsx)(je,{c:e.coding},`c`)}),t.sort((t,n)=>Number(n.kind===e.kind)-Number(t.kind===e.kind)),(0,H.jsx)(H.Fragment,{children:t.map(e=>e.node)})}var Ie={running:{label:`Running`,tone:`running`},done:{label:`Done`,tone:`pass`},failed:{label:`Failed`,tone:`fail`},stopped:{label:`Stopped`,tone:`neutral`}},Le={chat:`Chat`,suite:`Suite`,monitor:`Monitor`,run:`Browser run`,start:`Chat`,heal:`Heal`,"pr-tests":`PR tests`,pack:`Pack`,pipeline:`Pipeline watch`,explore:`Explore`,api:`API tests`,generate:`Generate`,jobs:`Jobs service`},Re=e=>Le[e]||e.charAt(0).toUpperCase()+e.slice(1),K=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`})},q=(e,t)=>Math.max(0,Math.round(((e.status===`running`?t:Date.parse(e.lastAt))-Date.parse(e.startedAt))/1e3)),J=e=>Number.isFinite(e)?e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m ${e%60}s`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`:`–`,Y=e=>e.usage.input+e.usage.output;function ze(e){let[t,n]=(0,V.useState)(Date.now());return(0,V.useEffect)(()=>{if(!e)return;let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),t}function Be({r:e}){return e.origin.kind===`web`?(0,H.jsxs)(`a`,{href:o(`chats`,e.origin.chat),className:`inline-flex items-center gap-1.5`,children:[(0,H.jsx)(c,{size:14,"aria-hidden":`true`}),`Web chat`]}):e.origin.kind===`job`?(0,H.jsxs)(`a`,{href:o(`jobs`,encodeURIComponent(e.origin.job)),className:`inline-flex items-center gap-1.5`,children:[(0,H.jsx)(f,{size:14,"aria-hidden":`true`}),`Job`]}):(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-muted`,children:[(0,H.jsx)(oe,{size:14,"aria-hidden":`true`}),`Terminal`]})}function Ve({status:t}){let n=Ie[t].label;return t===`running`?(0,H.jsx)(e,{size:16,"aria-label":n,className:`flex-none animate-spin text-accent-fg`}):t===`done`?(0,H.jsx)(fe,{size:16,"aria-label":n,className:`flex-none text-pass`}):t===`failed`?(0,H.jsx)(m,{size:16,"aria-label":n,className:`flex-none text-fail`}):(0,H.jsx)(ne,{size:16,"aria-label":n,className:`flex-none text-muted`})}var X=e=>e.status!==`running`&&!e.tools&&!e.turns&&!Y(e)&&!e.files.length&&!e.outputs.length&&q(e,0)<2;function Z({label:e,children:t}){return(0,H.jsxs)(`div`,{className:`grid grid-cols-[120px_minmax(0,1fr)] items-baseline gap-3 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,H.jsx)(`span`,{className:`text-[13px] text-muted`,children:e}),(0,H.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:t})]})}function Q({title:e,children:t}){return(0,H.jsxs)(`section`,{className:`flex min-w-0 flex-col rounded-[14px] border border-line-soft px-4 py-3`,children:[(0,H.jsx)(`h3`,{className:`m-0 mb-1 text-[14px] font-semibold`,children:e}),t]})}var He={rerun:ue,write_test:de,investigate:P,fix_test:_};function Ue({actions:e}){let[t,n]=(0,V.useState)(``),[r,i]=(0,V.useState)(``);if(!e.length)return null;let a=async e=>{n(e.prompt),i(``);try{let{id:t}=await D.start(e.prompt,{});location.hash=o(`chats`,t)}catch(e){i(e.message),n(``)}};return(0,H.jsxs)(`section`,{"aria-label":`Next steps`,className:`flex flex-col gap-2`,children:[(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map((e,n)=>{let r=He[e.kind];return(0,H.jsxs)(`button`,{type:`button`,disabled:!!t,onClick:()=>void a(e),className:v(`flex min-h-[52px] max-w-full cursor-pointer items-center gap-3 rounded-[14px] border px-3 py-2 text-left disabled:cursor-default disabled:opacity-60`,n===0?`border-accent bg-accent-soft hover:bg-accent-soft/70`:`border-line-soft bg-bg hover:bg-surface-muted`),children:[(0,H.jsx)(r,{size:18,"aria-hidden":`true`,className:`flex-none text-accent-fg`}),(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium text-ink`,children:t===e.prompt?`Opening a chat…`:e.label}),(0,H.jsx)(`span`,{className:`max-w-[320px] truncate text-[12px] text-muted`,children:e.note})]})]},n)})}),(0,H.jsx)(`span`,{className:`text-[12px] text-muted`,children:`Each opens a chat with the request; it asks before it changes anything.`}),r&&(0,H.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:r})]})}var We=e=>`\`${e.replace(/`/g,``)}\``;function Ge({name:e}){let[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(``),[s,c]=(0,V.useState)(!1),[u,ee]=(0,V.useState)(`summary`),d=(0,V.useCallback)(()=>{l.detail(e).then(e=>{r(e),a(``)},e=>a(e.message))},[e]);(0,V.useEffect)(d,[d]);let f=n?.status===`running`;(0,V.useEffect)(()=>{if(!f)return;let e=setInterval(d,2e3);return()=>clearInterval(e)},[d,f]);let p=ze(f),m=(0,V.useMemo)(()=>(n?.events??[]).map(ie).filter(e=>!!e),[n?.events]),h=async()=>{c(!0),a(``);try{await l.cancel(e),d()}catch(e){a(e.message)}finally{c(!1)}},g=(0,H.jsxs)(`a`,{href:o(`runs`),className:`inline-flex items-center gap-1.5 text-sm`,children:[(0,H.jsx)(se,{size:16,"aria-hidden":`true`}),`All runs`]});if(!n)return(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[g,i?(0,H.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:i}):(0,H.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`})]});let _=Ie[n.status],y=!n.replies.length,b=!!n.final||n.executions.length>0||n.reports.length>0||!!(n.coding&&(n.coding.edits.length||n.coding.results.length))||n.learnings.length>0||n.outputs.length>0,S=[{id:`summary`,label:`Summary`},{id:`conversation`,label:y?`Command`:`Conversation`,n:n.replies.length||void 0},{id:`activity`,label:`Activity`,n:m.length||void 0},{id:`details`,label:`Details`}],w=new Set([...n.reports.map(e=>e.path),...n.executions.flatMap(e=>[e.report,e.folder])].filter(Boolean)),T=n.outputs.filter(e=>!w.has(e.path)),E=n.context?.limit?Math.round(n.context.tokens/n.context.limit*100):null;return(0,H.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[g,(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1.5`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,H.jsx)(`h2`,{className:`m-0 min-w-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:n.title}),(0,H.jsx)(N,{tone:_.tone,children:_.label})]}),(0,H.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-[13px] text-muted`,children:[(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,H.jsx)(ve,{kind:n.kind}),U[n.kind]]}),`· `,(0,H.jsx)(Be,{r:n}),`· `,K(n.startedAt),` · `,f?`running for `:`took `,J(q(n,p)),` · `,t(Y(n)),` tokens`,n.profile?.model?` · ${n.profile.model}`:``]})]}),n.cancel&&(0,H.jsxs)(x,{disabled:s,onClick:()=>void h(),className:`border-fail text-fail hover:bg-fail-soft`,children:[(0,H.jsx)(te,{size:14,fill:`currentColor`,"aria-hidden":`true`}),s?`Stopping…`:n.cancel===`chat`?`Stop this chat's work`:`Cancel this job's run`]})]}),i&&(0,H.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:i}),n.error&&(0,H.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:[(0,H.jsx)(`strong`,{children:`What went wrong:`}),` `,n.error]}),!f&&(0,H.jsx)(Ue,{actions:n.actions??[]}),(0,H.jsx)(`div`,{role:`tablist`,"aria-label":`This run`,className:`flex gap-1 overflow-x-auto border-b border-line-soft`,children:S.map(e=>(0,H.jsxs)(`button`,{type:`button`,role:`tab`,id:`run-tab-${e.id}`,"aria-selected":u===e.id,"aria-controls":`run-panel-${e.id}`,onClick:()=>ee(e.id),className:v(`-mb-px inline-flex min-h-10 cursor-pointer items-center gap-1.5 border-0 border-b-2 bg-transparent px-3 text-sm font-medium whitespace-nowrap`,u===e.id?`border-accent text-ink`:`border-transparent text-muted hover:text-ink`),children:[e.label,e.n!==void 0&&(0,H.jsx)(`span`,{className:`text-[12px] text-muted tabular-nums`,children:e.n})]},e.id))}),(0,H.jsxs)(`div`,{role:`tabpanel`,id:`run-panel-${u}`,"aria-labelledby":`run-tab-${u}`,className:`flex min-w-0 flex-col gap-4`,children:[u===`summary`&&(0,H.jsxs)(H.Fragment,{children:[n.final&&(0,H.jsx)(Me,{final:n.final,answer:n.answer}),(0,H.jsx)(Fe,{run:n}),T.length>0&&(0,H.jsx)(Q,{title:`What it produced (${T.length})`,children:T.map(e=>(0,H.jsx)(Z,{label:e.label,children:(0,H.jsx)(A,{path:e.path})},e.path))}),n.learnings.length>0&&(0,H.jsx)(Pe,{list:n.learnings}),!b&&(0,H.jsx)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-3 text-sm text-ink-2`,children:f?`Still working: its answer and what it produces show here when it ends.`:`This run left no answer, results or files. Its Activity shows what it did.`})]}),u===`conversation`&&(y?(0,H.jsx)(k,{text:We(n.prompt),className:`text-sm [&_p]:my-0`}):(0,H.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-4 p-0`,children:n.replies.map((e,t)=>(0,H.jsxs)(`li`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`div`,{className:`self-end rounded-[14px] bg-surface-strong px-4 py-2.5 text-sm max-w-[85%]`,children:(0,H.jsx)(k,{text:e.ask,className:`[&_p]:my-0.5`})}),e.text&&(0,H.jsx)(k,{text:re(e.text),className:`text-sm`}),e.error&&(0,H.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e.error})]},t))})),u===`activity`&&(n.archived?(0,H.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-3 text-sm text-ink-2`,children:[`ForgeQE keeps the newest session logs only, and this run's is gone. Its summary, final message and learnings were kept in `,(0,H.jsx)(`code`,{className:`font-mono text-[13px]`,children:`.forgeqe/runs`}),`; its step-by-step activity was not.`]}):m.length?(0,H.jsx)(ae,{lines:m,start:n.startedAt,live:f,name:`forgeqe-run-${n.name.replace(/\.log$/,``)}.md`}):(0,H.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing logged yet.`})),u===`details`&&(0,H.jsxs)(`div`,{className:`grid items-start gap-3 @3xl:grid-cols-2`,children:[(0,H.jsxs)(Q,{title:`Numbers`,children:[(0,H.jsx)(Z,{label:f?`Running for`:`Took`,children:J(q(n,p))}),(0,H.jsxs)(Z,{label:`Tokens`,children:[t(Y(n)),` `,(0,H.jsxs)(`span`,{className:`text-muted`,children:[`(`,t(n.usage.input),` in · `,t(n.usage.output),` out`,n.usage.cached?` · ${t(n.usage.cached)} cached`:``,`)`]})]}),(0,H.jsxs)(Z,{label:`Context`,children:[n.context?t(n.context.tokens):`–`,E!==null&&(0,H.jsxs)(`span`,{className:`text-muted`,children:[` of `,t(n.context.limit),` (`,E,`%)`]})]}),(0,H.jsxs)(Z,{label:`Tool calls`,children:[n.tools,` `,(0,H.jsxs)(`span`,{className:`text-muted`,children:[`in `,C(n.turns,`turn`)]})]})]}),(0,H.jsxs)(Q,{title:`Session`,children:[(0,H.jsx)(Z,{label:`Started by`,children:(0,H.jsx)(Be,{r:n})}),(0,H.jsx)(Z,{label:`Command`,children:Re(n.command)}),(0,H.jsx)(Z,{label:`Model`,children:n.profile?[n.profile.name,n.profile.model].filter(Boolean).join(` · `):`–`}),(0,H.jsx)(Z,{label:`Agents`,children:n.agents.length?n.agents.map(e=>`${e.name} (${C(e.calls,`call`)})`).join(`, `):(0,H.jsx)(`span`,{className:`text-muted`,children:`None`})}),(0,H.jsxs)(Z,{label:`Log`,children:[n.archived?(0,H.jsx)(`span`,{className:`text-muted`,children:`No longer kept: ForgeQE keeps the newest logs only`}):(0,H.jsx)(A,{path:`.forgeqe/logs/${n.name}`}),n.truncated&&(0,H.jsx)(`span`,{className:`block text-[13px] text-muted`,children:`Very long: only its start is shown.`})]})]}),n.job&&(0,H.jsxs)(Q,{title:`Job`,children:[(0,H.jsx)(Z,{label:`Job`,children:(0,H.jsx)(`a`,{href:o(`jobs`,encodeURIComponent(n.origin.kind===`job`?n.origin.job:n.job.name)),children:n.job.name})}),(0,H.jsx)(Z,{label:`Runs`,children:(0,H.jsx)(k,{text:We(n.job.command),className:`text-sm [&_p]:my-0`})}),(0,H.jsxs)(Z,{label:`Schedule`,children:[n.job.schedule,!n.job.enabled&&` (disabled)`,n.job.nextAt&&n.job.enabled?` · next ${K(n.job.nextAt)}`:``]}),n.job.run&&(0,H.jsxs)(Z,{label:`This run`,children:[n.job.run.reason===`asked`?`Asked for`:`On schedule`,`, `,n.job.run.status.replace(`_`,` `),n.job.run.exitCode!==void 0&&n.job.run.exitCode!==null?`, exit ${n.job.run.exitCode}`:``]})]}),(0,H.jsx)(Q,{title:`Files worked on (${n.files.length})`,children:n.files.length?n.files.map(e=>(0,H.jsx)(Z,{label:e.action===`write`?`Written`:e.action===`edit`?`Edited`:e.action===`delete`?`Deleted`:e.action||`Changed`,children:e.action===`delete`?(0,H.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.path}):(0,H.jsx)(A,{path:e.path})},e.path)):(0,H.jsx)(`p`,{className:`m-0 py-1 text-sm text-muted`,children:`No files changed.`})}),(0,H.jsx)(Q,{title:`Notifications`,children:n.notifications.length?n.notifications.map(e=>(0,H.jsx)(Z,{label:e.event.replace(/_/g,` `),children:e.channels.length?e.channels.join(`, `):(0,H.jsx)(`span`,{className:`text-muted`,children:`No channel takes it`})},e.event)):(0,H.jsx)(`p`,{className:`m-0 py-1 text-sm text-muted`,children:n.origin.kind===`terminal`||n.origin.kind===`web`?`None: notify channels go with jobs, suites and the monitor.`:`No notify channels are set up (Settings, Notify).`})})]})]})]})}var $=25;function Ke({runs:e}){let n=ze(e.some(e=>e.status===`running`)),[i,a]=(0,V.useState)(``),[s,c]=(0,V.useState)(`all`),[l,u]=(0,V.useState)(``),[d,f]=(0,V.useState)(``),[p,m]=(0,V.useState)(!1),[h,g]=(0,V.useState)(0);(0,V.useEffect)(()=>g(0),[i,s,l,d,p]);let _=e.filter(X).length,te=i.toLowerCase().split(/\s+/).filter(Boolean),y=e.filter(e=>(p||!X(e))&&(!l||e.kind===l)&&(!d||e.origin.kind===d)&&te.every(t=>`${e.title} ${e.command} ${e.error||``}`.toLowerCase().includes(t))),b={all:y.length,running:y.filter(e=>e.status===`running`).length,failed:y.filter(e=>e.status===`failed`).length},S=s===`all`?y:y.filter(e=>e.status===s),w=Math.max(1,Math.ceil(S.length/$)),T=Math.min(h,w-1),E=S.slice(T*$,T*$+$),D=e.filter(e=>e.status!==`running`&&!X(e)),O=D.filter(e=>e.status===`failed`).length,ne=D.length?D.reduce((e,t)=>e+q(t,n),0)/D.length:NaN,k=e.reduce((e,t)=>e+Y(t),0),A=[...new Set(e.map(e=>e.kind))],j=[...new Set(e.map(e=>e.origin.kind))],M={web:`Web chat`,job:`Job`,terminal:`Terminal`};return e.length===0?(0,H.jsx)(`p`,{className:`m-0 rounded-[14px] bg-surface-muted px-5 py-4 text-sm leading-relaxed text-ink-2`,children:`No runs yet. A chat here, a job, or a ForgeQE command in this project adds one.`}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1 text-[13px] text-muted`,children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`b`,{className:`text-ink tabular-nums`,children:e.length-_}),` runs`]}),e.some(e=>e.status===`running`)&&(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`b`,{className:`text-accent-fg tabular-nums`,children:e.filter(e=>e.status===`running`).length}),` running now`]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`b`,{className:v(`tabular-nums`,O?`text-fail`:`text-ink`),children:O}),` failed`,D.length?` (${Math.round(O/D.length*100)}%)`:``]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`b`,{className:`text-ink tabular-nums`,children:t(k)}),` tokens`]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`b`,{className:`text-ink tabular-nums`,children:J(Math.round(ne))}),` on average`]})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsxs)(`div`,{className:`relative min-w-0 flex-[1_1_240px]`,children:[(0,H.jsx)(P,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted`}),(0,H.jsx)(`label`,{htmlFor:`run-search`,className:`sr-only`,children:`Find a run`}),(0,H.jsx)(ee,{id:`run-search`,type:`search`,value:i,onChange:e=>a(e.target.value),placeholder:`Find a run by what was asked`,className:`h-9 pl-9`})]}),[[`all`,`All`],[`running`,`Running`],[`failed`,`Failed`]].map(([e,t])=>(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":s===e,onClick:()=>c(e),className:v(`inline-flex min-h-8 cursor-pointer items-center gap-1 rounded-[8px] border px-3 text-[13px] font-medium`,s===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,H.jsx)(`span`,{className:v(`tabular-nums`,e===`failed`&&b.failed?`text-fail`:``),children:b[e]})]},e)),A.length>1&&(0,H.jsxs)(r,{"aria-label":`What it did`,value:l,onChange:e=>u(e.target.value),className:`h-8 w-auto py-0 pr-7 pl-3 text-[13px]`,children:[(0,H.jsx)(`option`,{value:``,children:`Any kind`}),A.map(e=>(0,H.jsx)(`option`,{value:e,children:U[e]},e))]}),j.length>1&&(0,H.jsxs)(r,{"aria-label":`Started by`,value:d,onChange:e=>f(e.target.value),className:`h-8 w-auto py-0 pr-7 pl-3 text-[13px]`,children:[(0,H.jsx)(`option`,{value:``,children:`Started anywhere`}),j.map(e=>(0,H.jsx)(`option`,{value:e,children:M[e]||e},e))]})]}),(0,H.jsxs)(`div`,{className:`rounded-[14px] border border-line-soft bg-bg`,children:[(0,H.jsxs)(`div`,{"aria-hidden":`true`,className:`hidden grid-cols-[auto_minmax(0,1fr)_104px_104px_72px_64px_92px] items-center gap-x-4 border-b border-line-soft px-4 py-2 text-[12px] font-semibold text-muted @3xl:grid`,children:[(0,H.jsx)(`span`,{className:`w-4`}),(0,H.jsx)(`span`,{children:`Run`}),(0,H.jsx)(`span`,{children:`Kind`}),(0,H.jsx)(`span`,{children:`Started by`}),(0,H.jsx)(`span`,{className:`text-right`,children:`Took`}),(0,H.jsx)(`span`,{className:`text-right`,children:`Tokens`}),(0,H.jsx)(`span`,{className:`text-right`,children:`When`})]}),(0,H.jsxs)(`ul`,{"aria-label":`Runs`,className:`m-0 list-none p-1.5`,children:[E.length===0&&(0,H.jsx)(`li`,{className:`px-3 py-4 text-sm text-muted`,children:`Nothing matches.`}),E.map((e,r)=>{let i=F(e.startedAt);return(0,H.jsxs)(`li`,{className:`contents`,children:[(r===0||F(E[r-1].startedAt)!==i)&&(0,H.jsx)(`span`,{className:`block px-3 pt-3 pb-1 text-[12px] font-semibold text-muted`,children:i}),(0,H.jsxs)(`a`,{href:o(`runs`,encodeURIComponent(e.name)),className:`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-3 rounded-[10px] px-3 py-1.5 text-ink no-underline hover:bg-surface-muted hover:text-ink @3xl:grid-cols-[auto_minmax(0,1fr)_104px_104px_72px_64px_92px] @3xl:gap-x-4`,children:[(0,H.jsx)(Ve,{status:e.status}),(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,H.jsx)(`span`,{className:`truncate text-[14px] font-medium`,title:e.title,children:e.title}),e.error?(0,H.jsx)(`span`,{className:`truncate text-[12px] text-fail`,children:e.error}):(0,H.jsx)(`span`,{className:`truncate text-[12px] text-muted @3xl:hidden`,children:[U[e.kind],M[e.origin.kind],J(q(e,n)),`${t(Y(e))} tokens`].join(` · `)})]}),(0,H.jsxs)(`span`,{className:`hidden min-w-0 items-center gap-1.5 text-[13px] text-ink-2 @3xl:inline-flex`,children:[(0,H.jsx)(ve,{kind:e.kind}),U[e.kind]]}),(0,H.jsx)(`span`,{className:`hidden text-[13px] text-ink-2 @3xl:block`,children:M[e.origin.kind]||e.origin.kind}),(0,H.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:J(q(e,n))}),(0,H.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:t(Y(e))}),(0,H.jsx)(`span`,{className:`text-right text-[12.5px] text-muted tabular-nums`,title:K(e.startedAt),children:pe(e.startedAt)})]})]},e.name)})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-t border-line-soft px-4 py-2.5 text-[13px] text-muted`,children:[(0,H.jsxs)(`span`,{className:`flex-1`,children:[S.length?`${T*$+1}–${Math.min(S.length,T*$+$)} of ${S.length}`:`0 runs`,_>0&&(0,H.jsxs)(H.Fragment,{children:[` · `,(0,H.jsx)(`button`,{type:`button`,onClick:()=>m(!p),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:p?`Hide the ${C(_,`empty session`)}`:`${C(_,`empty session`)} hidden`})]})]}),w>1&&(0,H.jsxs)(`nav`,{"aria-label":`Pages of runs`,className:`flex items-center gap-1`,children:[(0,H.jsx)(x,{size:`sm`,variant:`ghost`,disabled:T===0,onClick:()=>g(T-1),"aria-label":`Newer runs`,children:(0,H.jsx)(le,{size:16,"aria-hidden":`true`})}),(0,H.jsxs)(`span`,{className:`px-1 tabular-nums`,children:[`Page `,T+1,` of `,w]}),(0,H.jsx)(x,{size:`sm`,variant:`ghost`,disabled:T>=w-1,onClick:()=>g(T+1),"aria-label":`Older runs`,children:(0,H.jsx)(ce,{size:16,"aria-hidden":`true`})})]})]})]})]})}function qe({sub:e}){let[t,n]=(0,V.useState)(null),[r,i]=(0,V.useState)(``),a=(0,V.useCallback)(()=>{l.list().then(e=>{n(e.runs),i(``)},e=>i(e.message))},[]);(0,V.useEffect)(a,[a]);let o=t?.some(e=>e.status===`running`);(0,V.useEffect)(()=>{if(e)return;let t=setInterval(a,o?3e3:2e4);return()=>clearInterval(t)},[a,o,e]);let s=e?decodeURIComponent(e):``;return(0,H.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,H.jsx)(y,{}),(0,H.jsx)(`main`,{className:v(w,`@container flex-auto gap-4`),children:s?(0,H.jsx)(Ge,{name:s},s):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(T,{icon:u,size:`lg`}),(0,H.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Runs`})]}),(0,H.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-muted`,children:`Every ForgeQE session in this project: chats here, jobs' runs, and commands typed in a terminal, newest first. Open one for how it went and what it produced.`}),r&&(0,H.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:r}),!t&&!r&&(0,H.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&(0,H.jsx)(Ke,{runs:t})]})})]})}export{qe as Runs};
|