@capagents/forgeqe 2.9.1 → 2.9.3
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/HOW_TO_USE.md +1 -1
- package/dist/docs-site/docs/architecture/index.html +6 -0
- package/dist/docs-site/docs/index.html +1 -1
- package/dist/docs-site/docs/search.js +1 -1
- package/dist/docs-site/docs/web-app/index.html +12 -1
- package/dist/forgeqe.js +1722 -1676
- package/dist/web/assets/Agent-B6xfobJ9.js +4 -0
- package/dist/web/assets/ApiTests-BwgezlYi.js +10 -0
- package/dist/web/assets/Browse-DDzk_KTh.js +2 -0
- package/dist/web/assets/Chat-BdlfK2ra.js +3 -0
- package/dist/web/assets/{CommandPalette-VSEzjRS1.js → CommandPalette-Cla7m818.js} +1 -1
- package/dist/web/assets/{Compare-Bjh-qB8C.js → Compare-BxUfo0rI.js} +1 -1
- package/dist/web/assets/Cost-Dpa8aWQG.js +1 -0
- package/dist/web/assets/Data-D_7m2GL6.js +6 -0
- package/dist/web/assets/Desktop-CgslBkAr.js +1 -0
- package/dist/web/assets/DesktopReview-CsW65QZz.js +1 -0
- package/dist/web/assets/Evidence-SYt-mbDx.js +1 -0
- package/dist/web/assets/Explore--B18Jvg9.js +2 -0
- package/dist/web/assets/{Features-DFwuL5cN.js → Features-BerYifH7.js} +1 -1
- package/dist/web/assets/Flags-ABMq---p.js +2 -0
- package/dist/web/assets/Flaky-DKeceXsa.js +1 -0
- package/dist/web/assets/{ForceGraph-DC7NzeR4.js → ForceGraph-C9HFjZX3.js} +1 -1
- package/dist/web/assets/{Impact-CfnvrPzq.js → Impact-DQ2c0dTT.js} +3 -3
- package/dist/web/assets/Jobs-Dy_C2x36.js +5 -0
- package/dist/web/assets/KindPage-DQzstMyM.js +6 -0
- package/dist/web/assets/Migration-B4GWsCLR.js +2 -0
- package/dist/web/assets/Product-CgVhHMMY.js +7 -0
- package/dist/web/assets/Production-OdB4gZ3T.js +1 -0
- package/dist/web/assets/Quality-DOV4suvD.js +1 -0
- package/dist/web/assets/Readiness-DawfUUHc.js +1 -0
- package/dist/web/assets/Record-C9uAKGYM.js +2 -0
- package/dist/web/assets/Regression-DZdddPfI.js +5 -0
- package/dist/web/assets/{Reports-BWtgbiVp.js → Reports-BHOS6af1.js} +2 -2
- package/dist/web/assets/{Response-DyvlQXek.js → Response-qfMk4Nrh.js} +2 -2
- package/dist/web/assets/RunDiff-BNywFV7t.js +1 -0
- package/dist/web/assets/Runs-BJPYXRiB.js +2 -0
- package/dist/web/assets/{Steps-DUG1BKJb.js → Steps-Cdzyueit.js} +2 -2
- package/dist/web/assets/TestCases-DcYY2l9q.js +1 -0
- package/dist/web/assets/TestData-CrzKA3xh.js +2 -0
- package/dist/web/assets/TestDebt-CVDJT511.js +1 -0
- package/dist/web/assets/Tosca-CBwGCrbL.js +3 -0
- package/dist/web/assets/{WhatsNew-B3xewvk5.js → WhatsNew-CIOTidx-.js} +1 -1
- package/dist/web/assets/dataParts-CUb0Q0IZ.js +3 -0
- package/dist/web/assets/{families-DWrv-fcS.js → families-C9MndVzT.js} +1 -1
- package/dist/web/assets/filters-Bk7ovF3M.js +1 -0
- package/dist/web/assets/{fold-BgITvJex.js → fold-97yBCSav.js} +1 -1
- package/dist/web/assets/frame-CqWJMIHh.js +4 -0
- package/dist/web/assets/index-ASvNRLI7.js +73 -0
- package/dist/web/assets/index-B5o9vY-v.css +2 -0
- package/dist/web/assets/{logos-C067hMmF.js → logos-CbNeXLAM.js} +1 -1
- package/dist/web/assets/{palette-Br50dJuQ.js → palette-Dg3RS-ff.js} +1 -1
- package/dist/web/assets/{parts-CbA0h_uO.js → parts-CPAyV15O.js} +1 -1
- package/dist/web/assets/{productParts-BxQnjrHo.js → productParts-BpXw1jMa.js} +1 -1
- package/dist/web/assets/{qualityParts-Cn74cNyX.js → qualityParts-8TPKphgl.js} +1 -1
- package/dist/web/assets/recordTest-DvnpHsd2.js +1 -0
- package/dist/web/assets/{rows-X8lfgK8j.js → rows-BdYJLCRD.js} +1 -1
- package/dist/web/assets/segmented-DlF5rvSR.js +1 -0
- package/dist/web/assets/{thread-Bamx8xqR.js → thread-DlyX7xQt.js} +1 -1
- package/dist/web/assets/{usePageChat-B-vpiXQ6.js → usePageChat-Dhu3upXA.js} +1 -1
- package/dist/web/index.html +4 -4
- package/docs/ARCHITECTURE.md +5 -0
- package/docs/WEB_APP.md +17 -1
- package/docs/user-guide.html +1 -1
- package/forgeqe.example.yaml +1 -0
- package/package.json +1 -1
- package/prompts/brain.md +4 -3
- package/py/forgeqe_desktop/agentdesktop_driver.py +69 -0
- package/py/forgeqe_desktop/boxes.py +32 -0
- package/py/forgeqe_desktop/handhooks.py +55 -5
- package/py/forgeqe_desktop/pywinauto_driver.py +25 -0
- package/py/forgeqe_desktop/service.py +85 -3
- package/py/forgeqe_engine/brand.py +3 -0
- package/py/forgeqe_engine/browser.py +46 -6
- package/py/forgeqe_engine/cli.py +10 -1
- package/py/forgeqe_engine/recordsession.py +92 -2
- package/py/forgeqe_engine/video.py +423 -0
- package/py/forgeqe_mobile/hyperexecute.py +1 -1
- package/py/forgeqe_mobile/maestro.py +1 -1
- package/py/forgeqe_tosca/vendored.py +3 -2
- package/dist/web/assets/Agent-BNWcLTrm.js +0 -4
- package/dist/web/assets/ApiTests-CZFzjMKc.js +0 -10
- package/dist/web/assets/Browse-CeiK4X_V.js +0 -2
- package/dist/web/assets/Chat-BqXSNxV2.js +0 -3
- package/dist/web/assets/Cost-BRtni21m.js +0 -1
- package/dist/web/assets/Data-Bzn351xU.js +0 -6
- package/dist/web/assets/Evidence-eM1ZsFF-.js +0 -1
- package/dist/web/assets/Explore-D07Qbzyq.js +0 -2
- package/dist/web/assets/Flags-pxSAu21R.js +0 -2
- package/dist/web/assets/Flaky-BdfqCR6j.js +0 -1
- package/dist/web/assets/Jobs-CIKpgvcv.js +0 -5
- package/dist/web/assets/KindPage-OyYE9NU7.js +0 -6
- package/dist/web/assets/Migration-BQA6MOPN.js +0 -2
- package/dist/web/assets/Product-DNe8RV_H.js +0 -7
- package/dist/web/assets/Production-ClEiFS1u.js +0 -1
- package/dist/web/assets/Quality-BZnQcbb2.js +0 -1
- package/dist/web/assets/Readiness-Dk2KZZm4.js +0 -1
- package/dist/web/assets/Record-CSapdwkr.js +0 -2
- package/dist/web/assets/Regression-C7bZ5sSE.js +0 -5
- package/dist/web/assets/RunDiff-DWV5qdHx.js +0 -1
- package/dist/web/assets/Runs-CET6zwQu.js +0 -2
- package/dist/web/assets/TestCases-DyicRSqL.js +0 -1
- package/dist/web/assets/TestData-D2aWG3dq.js +0 -2
- package/dist/web/assets/TestDebt-DobUiGTz.js +0 -1
- package/dist/web/assets/Tosca-DvTni6va.js +0 -3
- package/dist/web/assets/dataParts-rU9wRwfo.js +0 -3
- package/dist/web/assets/filters-BDJYWuRV.js +0 -1
- package/dist/web/assets/frame-Dn34zQXO.js +0 -4
- package/dist/web/assets/index-BiMUTOBo.js +0 -45
- package/dist/web/assets/index-CGfii-zv.css +0 -2
- package/dist/web/assets/segmented-mcjXGwLg.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Ar as e,Bt as t,Ir as n,L as r,Nr as i,T as a,dt as o,gr as s,hr as c,j as l,mr as u,o as d,rt as f}from"./line-icons-CQ-3V8ax.js";import{Ht as p,L as m,a as h,c as g,d as _,m as v,t as y,wt as b,z as x}from"./filters-BDJYWuRV.js";import{et as S}from"./frame-Dn34zQXO.js";import{l as C,p as w,r as T}from"./index-BiMUTOBo.js";var E=n(i(),1),D=p(),O=[`critical`,`serious`,`moderate`,`minor`],k={critical:`fail`,serious:`fail`,moderate:`warn`,minor:`neutral`},A=[{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`}],j={same:{label:`Same`,tone:`pass`},changed:{label:`Changed`,tone:`warn`},new:{label:`New baseline`,tone:`neutral`},no_baseline:{label:`No baseline`,tone:`neutral`}},M=e=>new Date(e).toLocaleString([],{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}),N=(e,t)=>t?e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`:e.toFixed(3).replace(/0+$/,``).replace(/\.$/,``),P=(e,t)=>`${e} ${t}${e===1?``:`s`}`,F=e=>e.replace(/(data:[\w/+.-]+;base64,)[A-Za-z0-9+/=]{24,}/g,`$1…`),I=e=>{try{let t=new URL(e),n=t.pathname===`/`?``:t.pathname.length>44?`${t.pathname.slice(0,20)}…${t.pathname.slice(-20)}`:t.pathname;return`${t.host}${n}${t.search?`?…`:``}`}catch{return e.length>70?`${e.slice(0,68)}…`:e}},L=e=>!!(e.breaches||e.a11y?.failed||e.perf.over||e.visual?.changed);function R({run:e,standard:t,disclaimer:n}){let r=e.report,[i,o]=(0,E.useState)(new Set),[s,c]=(0,E.useState)(`all`),[l,u]=(0,E.useState)(!1);if(!r?.accessibility.pages)return(0,D.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`This run has no accessibility results: report.accessibility was off, or the run visited no page.`});let d=r.accessibility,p=r.breaches.filter(e=>e.kind===`accessibility`),m=d.failed.filter(e=>s===`all`||e.impact===s).sort((e,t)=>O.indexOf(e.impact)-O.indexOf(t.impact)||t.count-e.count),h=e=>{let t=new Set(i);t.has(e)?t.delete(e):t.add(e),o(t)};return(0,D.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,D.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[t,` with `,r.engine||`axe`,` on `,P(d.pages,`page`),`: `,(0,D.jsxs)(`span`,{className:`text-pass`,children:[P(d.passed.length,`rule`),` passed`]}),`, `,(0,D.jsxs)(`span`,{className:d.failed.length?`text-fail`:``,children:[d.failed.length,` failed`]}),`.`,` `,r.budgets.accessibility?p.length?`${P(p.length,`budget`)} exceeded.`:`Within the budget.`:`No budget set, so nothing here fails the run.`]}),p.map((e,t)=>(0,D.jsxs)(`p`,{className:`m-0 rounded-[8px] bg-fail-soft px-3 py-1.5 text-[13px] text-fail [overflow-wrap:anywhere]`,children:[`Over budget · `,I(e.page),`: `,e.text]},t)),d.failed.length>0&&(0,D.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,D.jsx)(`div`,{role:`group`,"aria-label":`Impact`,className:`flex flex-wrap gap-1`,children:[`all`,...O].map(e=>{let t=e===`all`?d.failed.length:d.failed.filter(t=>t.impact===e).length;return e!==`all`&&!t?null:(0,D.jsxs)(`button`,{type:`button`,"aria-pressed":s===e,onClick:()=>c(e),className:x(`inline-flex min-h-7 cursor-pointer items-center gap-1 rounded-[6px] border px-2 text-[12px] capitalize`,s===e?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:text-ink`),children:[e,` `,(0,D.jsx)(`span`,{className:`tabular-nums opacity-75`,children:t})]},e)})})}),d.failed.length?(0,D.jsx)(S,{label:`Failed rules`,placeholder:`Find a rule, WCAG criterion, page or element`,resetKey:s,empty:`Nothing matches.`,head:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`th`,{className:`w-[96px] py-1.5 pl-3 font-medium`,children:`Impact`}),(0,D.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Rule`}),(0,D.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @2xl:table-cell`,children:`WCAG`}),(0,D.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Elements`}),(0,D.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Pages`})]}),children:m.map(t=>{let n=i.has(t.rule),r=e.examples[t.rule]??[];return(0,D.jsxs)(E.Fragment,{children:[(0,D.jsxs)(`tr`,{onClick:()=>h(t.rule),"aria-expanded":n,className:x(`cursor-pointer border-t border-line-soft align-top hover:bg-surface-muted`,n&&`bg-surface-muted`),children:[(0,D.jsx)(`td`,{className:`py-1.5 pl-3`,children:(0,D.jsx)(g,{tone:k[t.impact],className:`min-h-5 px-2 text-[11px] capitalize`,children:t.impact})}),(0,D.jsx)(`td`,{className:`py-1.5 pr-3`,children:(0,D.jsxs)(`span`,{className:`flex items-start gap-1`,children:[(0,D.jsx)(a,{size:13,"aria-hidden":`true`,className:x(`mt-0.5 flex-none text-muted transition-transform`,!n&&`-rotate-90`)}),(0,D.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,D.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t.help}),(0,D.jsx)(`span`,{className:`font-mono text-[11.5px] text-muted`,children:t.rule})]})]})}),(0,D.jsx)(`td`,{className:`hidden py-1.5 pr-3 whitespace-nowrap text-ink-2 @2xl:table-cell`,children:t.wcag?`${t.wcag}${t.level?` · ${t.level}`:``}`:`–`}),(0,D.jsx)(`td`,{className:`py-1.5 pr-3 text-right tabular-nums`,children:t.count}),(0,D.jsx)(`td`,{className:`py-1.5 pr-3 text-right tabular-nums`,children:t.pages})]}),n&&(0,D.jsxs)(`tr`,{className:`bg-surface-muted`,children:[(0,D.jsx)(`td`,{}),(0,D.jsx)(`td`,{colSpan:4,className:`pr-3 pb-3`,children:(0,D.jsxs)(`div`,{className:`flex flex-col gap-1.5 pl-[17px]`,children:[r.length?r.map((e,t)=>(0,D.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-[8px] border border-line-soft bg-bg px-2.5 py-1.5`,children:[(0,D.jsxs)(`span`,{className:`flex min-w-0 gap-1.5 text-[12px] text-muted`,children:[(0,D.jsx)(`span`,{className:`flex-none`,"data-tip":e.page,children:I(e.page)}),e.target&&(0,D.jsxs)(`span`,{className:`min-w-0 truncate font-mono text-[11.5px]`,"data-tip":e.target,children:[`· `,e.target]})]}),e.html&&(0,D.jsx)(`code`,{className:`line-clamp-3 font-mono text-[12px] break-all text-ink-2`,children:F(e.html)})]},t)):(0,D.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:`No elements were kept for this rule.`}),t.helpUrl&&w(t.helpUrl)===`web`&&(0,D.jsxs)(`a`,{href:t.helpUrl,target:`_blank`,rel:`noreferrer noopener`,className:`inline-flex items-center gap-1 self-start text-[12.5px]`,children:[`How to fix it `,(0,D.jsx)(f,{size:12,"aria-hidden":`true`})]})]})})]})]},t.rule)})}):(0,D.jsx)(`p`,{className:`m-0 text-[13px] text-pass`,children:`No rule failed on the pages this run visited.`}),d.passed.length>0&&(0,D.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,D.jsxs)(`button`,{type:`button`,"aria-expanded":l,onClick:()=>u(!l),className:`flex cursor-pointer items-center gap-1 self-start border-0 bg-transparent p-0 text-[13px] font-medium text-ink`,children:[(0,D.jsx)(a,{size:13,"aria-hidden":`true`,className:x(`text-muted transition-transform`,!l&&`-rotate-90`)}),`Rules that passed `,(0,D.jsx)(`span`,{className:`font-normal text-muted tabular-nums`,children:d.passed.length})]}),l&&(0,D.jsx)(`ul`,{className:`m-0 flex list-none flex-wrap gap-1 p-0`,children:d.passed.map(e=>(0,D.jsx)(`li`,{className:`rounded-[6px] bg-pass-soft px-2 py-0.5 font-mono text-[11.5px] text-pass`,children:e},e))})]}),(0,D.jsx)(`p`,{className:`m-0 text-[12px] text-muted`,children:n})]})}function z({run:e}){let t=e.report;if(!t?.performance.pages.length)return(0,D.jsx)(`p`,{className:`m-0 text-[13px] 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`},i=t.breaches.filter(e=>e.kind===`performance`);return(0,D.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,D.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Core Web Vitals of each page, from one visit in the browser the agent drove, against Google's thresholds: `,(0,D.jsx)(`span`,{className:`text-pass`,children:`good`}),`, `,(0,D.jsx)(`span`,{className:`text-warn`,children:`needs improvement`}),`, `,(0,D.jsx)(`span`,{className:`text-fail`,children:`poor`}),`.`,` `,t.budgets.performance?`Pages over quality.budgets.performance are marked.`:`No performance budget set: nothing fails on timings.`]}),i.map((e,t)=>(0,D.jsxs)(`p`,{className:`m-0 rounded-[8px] bg-fail-soft px-3 py-1.5 text-[13px] text-fail [overflow-wrap:anywhere]`,children:[`Over budget · `,I(e.page),`: `,e.text]},t)),(0,D.jsx)(S,{label:`Timings`,minWidth:720,head:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 font-medium`,children:`Page`}),A.map(e=>(0,D.jsx)(`th`,{className:`px-2 py-1.5 text-right font-medium`,"data-tip":e.label,children:e.label},e.key)),(0,D.jsx)(`th`,{className:`px-2 py-1.5 text-right font-medium`,children:`Requests`}),(0,D.jsx)(`th`,{className:`py-1.5 pr-3 pl-2 text-right font-medium`,children:`Size`})]}),children:t.performance.pages.map((e,t)=>(0,D.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,D.jsxs)(`td`,{className:`py-1.5 pr-3 pl-3`,children:[(0,D.jsx)(`span`,{className:`block max-w-[340px] truncate font-mono text-[12px]`,"data-tip":e.url,children:I(e.url)}),e.over.length>0&&(0,D.jsxs)(`span`,{className:`text-[11.5px] text-fail`,children:[`over: `,e.over.join(`, `)]})]}),A.map(t=>{let i=e[t.key];return(0,D.jsxs)(`td`,{className:x(`px-2 py-1.5 text-right whitespace-nowrap 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`?N(i,t.unit):`–`,typeof i==`number`&&t.good!==1/0&&(0,D.jsxs)(`span`,{className:`sr-only`,children:[` (`,n(i,t),`)`]})]},t.key)}),(0,D.jsx)(`td`,{className:`px-2 py-1.5 text-right whitespace-nowrap text-muted tabular-nums`,children:e.requests??`–`}),(0,D.jsx)(`td`,{className:`py-1.5 pr-3 pl-2 text-right whitespace-nowrap text-muted tabular-nums`,children:e.kb===void 0?`–`:`${e.kb} KB`})]},t))}),(0,D.jsxs)(`p`,{className:`m-0 text-[12px] text-muted`,children:[A.filter(e=>e.good!==1/0).map(e=>`${e.label}: good up to ${N(e.good,e.unit)}, poor over ${N(e.poor,e.unit)}`).join(` · `),`. Lab values from one visit, not data from real users.`]})]})}function B({run:e,index:n,which:r,label:i}){let[a,o]=(0,E.useState)(``),[s,c]=(0,E.useState)(!1);return(0,E.useEffect)(()=>{let t=!1;return o(``),c(!1),b.image(e,n,r).then(e=>!t&&o(e),()=>!t&&c(!0)),()=>{t=!0}},[e,n,r]),(0,D.jsxs)(`figure`,{className:`m-0 flex min-w-0 flex-col gap-1.5`,children:[(0,D.jsx)(`figcaption`,{className:`text-[12px] font-medium text-muted`,children:i}),a?(0,D.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,D.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,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(v,{icon:t,size:14}),` Not available`]}):`Loading…`})]})}function V({run:t,budget:n,onChange:r}){let[i,s]=(0,E.useState)(null),[c,u]=(0,E.useState)(``),[d,f]=(0,E.useState)(!1),[p,_]=(0,E.useState)(``),[v,y]=(0,E.useState)(new Set),[C,w]=(0,E.useState)(`all`),T=t.visual?.pages??[],O=T.find(e=>e.status===`changed`)?.index;(0,E.useEffect)(()=>y(O===void 0?new Set:new Set([O])),[t.id,O]);let k=async e=>{f(!0),_(``);try{r(await e()),s(null),u(``)}catch(e){_(e.message)}finally{f(!1)}};if(!t.visual)return t.captured?(0,D.jsxs)(`div`,{className:`flex flex-col items-start gap-2`,children:[(0,D.jsxs)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:[`This run captured `,P(t.captured,`page`),` but they were not compared with the baselines yet.`]}),(0,D.jsxs)(m,{size:`sm`,variant:`primary`,disabled:d,"data-tip":`Compare with the baselines`,onClick:()=>k(()=>b.compare(t.id)),children:[(0,D.jsx)(o,{"aria-hidden":`true`}),`Compare`]}),p&&(0,D.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:p})]}):(0,D.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`This run has no visual captures: quality.visual.enabled was off, or the run visited no page.`});let A=T.filter(e=>e.status===`changed`),M=(C===`changed`?A:T).slice().sort((e,t)=>Number(t.status===`changed`)-Number(e.status===`changed`)||(t.diffPercent??0)-(e.diffPercent??0)),N=e=>{let t=new Set(v);t.has(e)?t.delete(e):t.add(e),y(t)};return(0,D.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,D.jsxs)(`p`,{className:`m-0 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.`]}),(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,D.jsx)(`div`,{role:`group`,"aria-label":`Show`,className:`flex gap-1`,children:[[`all`,`All pages`,T.length],[`changed`,`Changed`,A.length]].map(([e,t,n])=>(0,D.jsxs)(`button`,{type:`button`,"aria-pressed":C===e,onClick:()=>w(e),className:x(`inline-flex min-h-7 cursor-pointer items-center gap-1 rounded-[6px] border px-2 text-[12px]`,C===e?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:text-ink`),children:[t,` `,(0,D.jsx)(`span`,{className:`tabular-nums opacity-75`,children:n})]},e))}),(0,D.jsx)(`span`,{className:`flex-1`}),A.length>1&&(0,D.jsxs)(m,{size:`sm`,disabled:d,"data-tip":`Approve all ${A.length} changes`,onClick:()=>s(A.map(e=>e.url)),children:[(0,D.jsx)(l,{"aria-hidden":`true`}),`Approve (`,A.length,`)`]})]}),i&&(0,D.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Approve as baseline`,className:`flex flex-col gap-2 rounded-[10px] border border-accent-line bg-accent-soft p-3 text-[13px]`,children:[(0,D.jsxs)(`span`,{className:`font-medium`,children:[`Make this run's capture the baseline of `,i.length===1?I(i[0]):P(i.length,`page`),`?`]}),(0,D.jsx)(`span`,{className:`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,D.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[`Why it changed (kept with the baseline)`,(0,D.jsx)(h,{size:`sm`,value:c,maxLength:300,placeholder:`New checkout banner`,onChange:e=>u(e.target.value),className:`max-w-[480px] bg-bg`})]}),(0,D.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,D.jsxs)(m,{size:`sm`,variant:`primary`,disabled:d,onClick:()=>k(()=>b.approve(t.id,i,c.trim()||void 0)),children:[(0,D.jsx)(l,{"aria-hidden":`true`}),`Approve`]}),(0,D.jsxs)(m,{size:`sm`,onClick:()=>s(null),children:[(0,D.jsx)(e,{"aria-hidden":`true`}),`Cancel`]})]})]}),p&&(0,D.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:p}),(0,D.jsx)(S,{label:`Pages against their baselines`,fixed:!0,resetKey:C,empty:`No page changed.`,head:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 font-medium`,children:`Page`}),(0,D.jsx)(`th`,{className:`hidden w-[110px] py-1.5 pr-3 font-medium @2xl:table-cell`,children:`Size`}),(0,D.jsx)(`th`,{className:`w-[90px] py-1.5 pr-3 text-right font-medium`,children:`Changed`}),(0,D.jsx)(`th`,{className:`w-[120px] py-1.5 pr-3 font-medium`,children:`Result`}),(0,D.jsx)(`th`,{className:`w-[96px] py-1.5 pr-3`,children:(0,D.jsx)(`span`,{className:`sr-only`,children:`Approve`})})]}),children:M.map(e=>{let n=v.has(e.index);return(0,D.jsxs)(E.Fragment,{children:[(0,D.jsxs)(`tr`,{onClick:()=>N(e.index),"aria-expanded":n,className:x(`cursor-pointer border-t border-line-soft align-top hover:bg-surface-muted`,n&&`bg-surface-muted`),children:[(0,D.jsx)(`td`,{className:`py-1.5 pr-3 pl-3`,children:(0,D.jsxs)(`span`,{className:`flex items-start gap-1`,children:[(0,D.jsx)(a,{size:13,"aria-hidden":`true`,className:x(`mt-0.5 flex-none text-muted transition-transform`,!n&&`-rotate-90`)}),(0,D.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,D.jsx)(`span`,{className:`truncate`,"data-tip":e.title||e.url,children:e.title||I(e.url)}),(0,D.jsx)(`span`,{className:`truncate font-mono text-[11.5px] text-muted`,"data-tip":e.url,children:I(e.url)})]})]})}),(0,D.jsxs)(`td`,{className:`hidden py-1.5 pr-3 whitespace-nowrap text-muted @2xl:table-cell`,children:[e.size||`–`,e.resized?` · resized ${e.resized}`:``]}),(0,D.jsx)(`td`,{className:x(`py-1.5 pr-3 text-right whitespace-nowrap tabular-nums`,e.over?`text-fail`:e.status===`changed`?`text-warn`:`text-muted`),children:e.status===`changed`?`${e.diffPercent}%${e.limit===void 0?``:` / ${e.limit}%`}`:`–`}),(0,D.jsx)(`td`,{className:`py-1.5 pr-3`,children:(0,D.jsx)(g,{tone:e.over?`fail`:j[e.status].tone,className:`min-h-5 px-2 text-[11px]`,children:e.over?`Over budget`:j[e.status].label})}),(0,D.jsx)(`td`,{className:`py-1 pr-3 text-right`,onClick:e=>e.stopPropagation(),children:e.status===`changed`&&(0,D.jsx)(m,{variant:`icon`,size:`icon-sm`,disabled:d,"aria-label":`Approve ${I(e.url)}`,"data-tip":`Approve ${I(e.url)}`,onClick:()=>s([e.url]),children:(0,D.jsx)(l,{"aria-hidden":`true`})})})]}),n&&(0,D.jsx)(`tr`,{className:`bg-surface-muted`,children:(0,D.jsx)(`td`,{colSpan:5,className:`px-3 pb-3`,children:(0,D.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(180px,1fr))] gap-3`,children:[e.images.baseline&&(0,D.jsx)(B,{run:t.id,index:e.index,which:`baseline`,label:`Baseline`}),e.images.current&&(0,D.jsx)(B,{run:t.id,index:e.index,which:`current`,label:`This run`}),e.images.diff&&(0,D.jsx)(B,{run:t.id,index:e.index,which:`diff`,label:`Difference (in red)`})]})})})]},e.index)})})]})}function H({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,D.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,D.jsx)(`polyline`,{points:n,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinejoin:`round`})})}function U({icon:e,className:t,lines:n}){return n.length?(0,D.jsxs)(`span`,{className:x(`flex items-start gap-1.5 text-[13px]`,t),children:[(0,D.jsx)(v,{icon:e,size:14,className:`mt-0.5 flex-none`}),(0,D.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:n.join(` · `)})]}):null}function W({trends:e}){return e.length?(0,D.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.map(e=>{let t=e.a11y.latest?O.reduce((t,n)=>t+(e.a11y.latest[n]||0),0):void 0;return(0,D.jsxs)(`li`,{className:`flex flex-col gap-1.5 border-t border-line-soft py-3 first:border-t-0`,children:[(0,D.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-3`,children:[(0,D.jsx)(`span`,{className:`min-w-0 flex-[1_1_240px] truncate font-mono text-[13px]`,"data-tip":e.page,children:/^https?:/.test(e.page)?I(e.page):e.page}),(0,D.jsx)(H,{values:e.a11y.trail}),(0,D.jsxs)(`span`,{className:`text-[12px] text-muted`,children:[P(e.runs,`run`),t===void 0?``:` · ${P(t,`violation`)} now`]})]}),(0,D.jsx)(U,{icon:c,className:`text-fail`,lines:[...e.perf.worse.map(e=>`slower: ${e}`),...e.a11y.newRules.map(e=>`newly failing: ${e}`)]}),(0,D.jsx)(U,{icon:u,className:`text-pass`,lines:[...e.perf.better.map(e=>`faster: ${e}`),...e.a11y.fixedRules.map(e=>`fixed: ${e}`)]})]},e.page)})}):(0,D.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.`})}var G={accessibility:e=>!!e.a11y?.pages,performance:e=>e.perf.pages>0,visual:e=>!!e.visual||e.captured>0},K={accessibility:e=>!!e.a11y?.failed,performance:e=>e.perf.over>0,visual:e=>!!(e.visual?.changed||e.visual?.over)},q=(e,t)=>t.filter(G[e]);function J({kind:e,runs:t}){let[n,i]=(0,E.useState)(`all`),a=q(e,t),o=n===`attention`?a.filter(K[e]):a,c=t=>location.hash=_(e,encodeURIComponent(t)),u=`py-2 pr-3 text-right tabular-nums`;return(0,D.jsx)(S,{label:`Runs`,placeholder:`Find a run by what it did`,resetKey:n,empty:`Nothing matches.`,tools:(0,D.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,D.jsx)(y,{items:[{id:`all`,label:`All`,n:a.length},{id:`attention`,label:`Needs a look`,n:a.filter(K[e]).length,alert:!0}],value:n,onChange:i})}),head:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`th`,{className:`w-[46%] py-1.5 pr-3 pl-3 font-medium`,children:`Run`}),e===`accessibility`&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Rules failed`}),(0,D.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @2xl:table-cell`,children:`Critical · serious`}),(0,D.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @3xl:table-cell`,children:`Moderate · minor`}),(0,D.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @xl:table-cell`,children:`Pages`})]}),e===`performance`&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Over budget`}),(0,D.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @xl:table-cell`,children:`Pages timed`})]}),e===`visual`&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Changed`}),(0,D.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @2xl:table-cell`,children:`New`}),(0,D.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @xl:table-cell`,children:`Same`})]}),(0,D.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`When`})]}),children:o.map(t=>{let n=K[e](t),i=(t.over?.[e]??0)>0;return(0,D.jsxs)(`tr`,{onClick:()=>c(t.id),className:`cursor-pointer border-t border-line-soft hover:bg-surface-muted`,children:[(0,D.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,D.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(i?r:n?s:l,{size:15,"aria-label":i?`Over a budget`:n?`Needs a look`:`Within budgets`,className:x(`flex-none`,i?`text-fail`:n?`text-warn`:`text-pass`)}),(0,D.jsx)(`a`,{href:_(e,encodeURIComponent(t.id)),onClick:e=>e.stopPropagation(),"data-tip":t.goal,className:`truncate text-ink no-underline hover:underline`,children:t.goal})]})}),e===`accessibility`&&t.a11y&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`td`,{className:x(u,t.a11y.failed?`text-fail`:`text-muted`),children:t.a11y.failed}),(0,D.jsx)(`td`,{className:x(u,`hidden @2xl:table-cell`,t.a11y.critical+t.a11y.serious?`text-fail`:`text-muted`),children:`${t.a11y.critical} · ${t.a11y.serious}`}),(0,D.jsx)(`td`,{className:x(u,`hidden text-muted @3xl:table-cell`),children:`${t.a11y.moderate} · ${t.a11y.minor}`}),(0,D.jsx)(`td`,{className:x(u,`hidden text-muted @xl:table-cell`),children:t.a11y.pages})]}),e===`performance`&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`td`,{className:x(u,t.perf.over?`text-fail`:`text-muted`),children:t.perf.over}),(0,D.jsx)(`td`,{className:x(u,`hidden text-muted @xl:table-cell`),children:t.perf.pages})]}),e===`visual`&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`td`,{className:x(u,t.visual?.changed?`text-warn`:`text-muted`),children:t.visual?t.visual.changed:`not compared`}),(0,D.jsx)(`td`,{className:x(u,`hidden text-muted @2xl:table-cell`),children:t.visual?t.visual.new+t.visual.no_baseline:`–`}),(0,D.jsx)(`td`,{className:x(u,`hidden text-muted @xl:table-cell`),children:t.visual?t.visual.same:`–`})]}),(0,D.jsx)(`td`,{className:`hidden py-2 pr-3 whitespace-nowrap text-[12.5px] text-muted @xl:table-cell`,"data-tip":M(t.at),children:T(t.at)})]},t.id)})})}function Y({kind:e,id:t,view:n,onChanged:r}){let[i,o]=(0,E.useState)(null),[s,c]=(0,E.useState)(``);(0,E.useEffect)(()=>{let e=!1;return o(null),b.run(t).then(t=>{e||(o(t),c(``))},t=>!e&&c(t.message)),()=>{e=!0}},[t]);let l=(0,D.jsxs)(`a`,{href:_(e),className:`inline-flex items-center gap-1 self-start text-[13px] no-underline`,children:[(0,D.jsx)(a,{size:14,"aria-hidden":`true`,className:`rotate-90`}),`All runs`]});return s||!i?(0,D.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[l,s?(0,D.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail`,children:s}):(0,D.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Loading…`})]}):(0,D.jsxs)(`section`,{"aria-labelledby":`run-h`,className:`flex min-w-0 flex-col gap-3`,children:[l,(0,D.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,D.jsx)(`h2`,{id:`run-h`,"data-tip":i.goal,className:`m-0 truncate text-[16px] leading-snug font-semibold`,children:i.goal}),(0,D.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 text-[12.5px] text-muted`,children:[M(i.at),` · `,(0,D.jsx)(C,{path:i.dir}),` · `,(0,D.jsx)(`a`,{href:_(`quality`,encodeURIComponent(i.id)),children:`Everything it measured`})]})]}),e===`accessibility`&&(0,D.jsx)(R,{run:i,standard:n.standard,disclaimer:n.disclaimer}),e===`performance`&&(0,D.jsx)(z,{run:i}),e===`visual`&&(0,D.jsx)(V,{run:i,budget:n.budgets.visual,onChange:e=>{o(e),r()}})]})}function X({r:e,to:t,line:n}){return(0,D.jsxs)(`div`,{className:`ml-12 flex flex-wrap items-center gap-x-4 gap-y-2 rounded-[14px] card border px-4 py-3`,children:[(0,D.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col`,children:[(0,D.jsx)(`span`,{className:`text-[14.5px] font-medium [overflow-wrap:anywhere]`,children:e.goal}),(0,D.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:n})]}),(0,D.jsxs)(m,{size:`sm`,variant:`primary`,"data-tip":`Open the run`,onClick:()=>location.hash=t,children:[(0,D.jsx)(d,{"aria-hidden":`true`}),`Open`]})]})}function Z({label:e,value:t,sub:n,tone:r}){return(0,D.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5 px-3 py-2`,children:[(0,D.jsx)(`span`,{className:`text-[11.5px] text-muted`,children:e}),(0,D.jsx)(`span`,{className:x(`text-[16px] leading-tight font-semibold tabular-nums`,r),children:t}),n&&(0,D.jsx)(`span`,{className:`truncate text-[11.5px] text-muted`,children:n})]})}export{M as _,J as a,X as c,V as d,N as f,I as g,q as h,Y as i,W as l,P as m,O as n,Z as o,L as p,k as r,z as s,R as t,A as u};
|
|
1
|
+
import{Ar as e,Bt as t,Ir as n,L as r,Nr as i,T as a,dt as o,gr as s,hr as c,j as l,mr as u,o as d,rt as f}from"./line-icons-CQ-3V8ax.js";import{B as p,Et as m,R as h,Wt as g,a as _,c as v,f as y,h as b,t as x}from"./filters-Bk7ovF3M.js";import{et as S}from"./frame-CqWJMIHh.js";import{l as C,p as w,r as T}from"./index-ASvNRLI7.js";var E=n(i(),1),D=g(),O=[`critical`,`serious`,`moderate`,`minor`],k={critical:`fail`,serious:`fail`,moderate:`warn`,minor:`neutral`},A=[{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`}],j={same:{label:`Same`,tone:`pass`},changed:{label:`Changed`,tone:`warn`},new:{label:`New baseline`,tone:`neutral`},no_baseline:{label:`No baseline`,tone:`neutral`}},M=e=>new Date(e).toLocaleString([],{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}),N=(e,t)=>t?e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`:e.toFixed(3).replace(/0+$/,``).replace(/\.$/,``),P=(e,t)=>`${e} ${t}${e===1?``:`s`}`,F=e=>e.replace(/(data:[\w/+.-]+;base64,)[A-Za-z0-9+/=]{24,}/g,`$1…`),I=e=>{try{let t=new URL(e),n=t.pathname===`/`?``:t.pathname.length>44?`${t.pathname.slice(0,20)}…${t.pathname.slice(-20)}`:t.pathname;return`${t.host}${n}${t.search?`?…`:``}`}catch{return e.length>70?`${e.slice(0,68)}…`:e}},L=e=>!!(e.breaches||e.a11y?.failed||e.perf.over||e.visual?.changed);function R({run:e,standard:t,disclaimer:n}){let r=e.report,[i,o]=(0,E.useState)(new Set),[s,c]=(0,E.useState)(`all`),[l,u]=(0,E.useState)(!1);if(!r?.accessibility.pages)return(0,D.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`This run has no accessibility results: report.accessibility was off, or the run visited no page.`});let d=r.accessibility,m=r.breaches.filter(e=>e.kind===`accessibility`),h=d.failed.filter(e=>s===`all`||e.impact===s).sort((e,t)=>O.indexOf(e.impact)-O.indexOf(t.impact)||t.count-e.count),g=e=>{let t=new Set(i);t.has(e)?t.delete(e):t.add(e),o(t)};return(0,D.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,D.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[t,` with `,r.engine||`axe`,` on `,P(d.pages,`page`),`: `,(0,D.jsxs)(`span`,{className:`text-pass`,children:[P(d.passed.length,`rule`),` passed`]}),`, `,(0,D.jsxs)(`span`,{className:d.failed.length?`text-fail`:``,children:[d.failed.length,` failed`]}),`.`,` `,r.budgets.accessibility?m.length?`${P(m.length,`budget`)} exceeded.`:`Within the budget.`:`No budget set, so nothing here fails the run.`]}),m.map((e,t)=>(0,D.jsxs)(`p`,{className:`m-0 rounded-[8px] bg-fail-soft px-3 py-1.5 text-[13px] text-fail [overflow-wrap:anywhere]`,children:[`Over budget · `,I(e.page),`: `,e.text]},t)),d.failed.length>0&&(0,D.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,D.jsx)(`div`,{role:`group`,"aria-label":`Impact`,className:`flex flex-wrap gap-1`,children:[`all`,...O].map(e=>{let t=e===`all`?d.failed.length:d.failed.filter(t=>t.impact===e).length;return e!==`all`&&!t?null:(0,D.jsxs)(`button`,{type:`button`,"aria-pressed":s===e,onClick:()=>c(e),className:p(`inline-flex min-h-7 cursor-pointer items-center gap-1 rounded-[6px] border px-2 text-[12px] capitalize`,s===e?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:text-ink`),children:[e,` `,(0,D.jsx)(`span`,{className:`tabular-nums opacity-75`,children:t})]},e)})})}),d.failed.length?(0,D.jsx)(S,{label:`Failed rules`,placeholder:`Find a rule, WCAG criterion, page or element`,resetKey:s,empty:`Nothing matches.`,head:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`th`,{className:`w-[96px] py-1.5 pl-3 font-medium`,children:`Impact`}),(0,D.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Rule`}),(0,D.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @2xl:table-cell`,children:`WCAG`}),(0,D.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Elements`}),(0,D.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Pages`})]}),children:h.map(t=>{let n=i.has(t.rule),r=e.examples[t.rule]??[];return(0,D.jsxs)(E.Fragment,{children:[(0,D.jsxs)(`tr`,{onClick:()=>g(t.rule),"aria-expanded":n,className:p(`cursor-pointer border-t border-line-soft align-top hover:bg-surface-muted`,n&&`bg-surface-muted`),children:[(0,D.jsx)(`td`,{className:`py-1.5 pl-3`,children:(0,D.jsx)(v,{tone:k[t.impact],className:`min-h-5 px-2 text-[11px] capitalize`,children:t.impact})}),(0,D.jsx)(`td`,{className:`py-1.5 pr-3`,children:(0,D.jsxs)(`span`,{className:`flex items-start gap-1`,children:[(0,D.jsx)(a,{size:13,"aria-hidden":`true`,className:p(`mt-0.5 flex-none text-muted transition-transform`,!n&&`-rotate-90`)}),(0,D.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,D.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t.help}),(0,D.jsx)(`span`,{className:`font-mono text-[11.5px] text-muted`,children:t.rule})]})]})}),(0,D.jsx)(`td`,{className:`hidden py-1.5 pr-3 whitespace-nowrap text-ink-2 @2xl:table-cell`,children:t.wcag?`${t.wcag}${t.level?` · ${t.level}`:``}`:`–`}),(0,D.jsx)(`td`,{className:`py-1.5 pr-3 text-right tabular-nums`,children:t.count}),(0,D.jsx)(`td`,{className:`py-1.5 pr-3 text-right tabular-nums`,children:t.pages})]}),n&&(0,D.jsxs)(`tr`,{className:`bg-surface-muted`,children:[(0,D.jsx)(`td`,{}),(0,D.jsx)(`td`,{colSpan:4,className:`pr-3 pb-3`,children:(0,D.jsxs)(`div`,{className:`flex flex-col gap-1.5 pl-[17px]`,children:[r.length?r.map((e,t)=>(0,D.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-[8px] border border-line-soft bg-bg px-2.5 py-1.5`,children:[(0,D.jsxs)(`span`,{className:`flex min-w-0 gap-1.5 text-[12px] text-muted`,children:[(0,D.jsx)(`span`,{className:`flex-none`,"data-tip":e.page,children:I(e.page)}),e.target&&(0,D.jsxs)(`span`,{className:`min-w-0 truncate font-mono text-[11.5px]`,"data-tip":e.target,children:[`· `,e.target]})]}),e.html&&(0,D.jsx)(`code`,{className:`line-clamp-3 font-mono text-[12px] break-all text-ink-2`,children:F(e.html)})]},t)):(0,D.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:`No elements were kept for this rule.`}),t.helpUrl&&w(t.helpUrl)===`web`&&(0,D.jsxs)(`a`,{href:t.helpUrl,target:`_blank`,rel:`noreferrer noopener`,className:`inline-flex items-center gap-1 self-start text-[12.5px]`,children:[`How to fix it `,(0,D.jsx)(f,{size:12,"aria-hidden":`true`})]})]})})]})]},t.rule)})}):(0,D.jsx)(`p`,{className:`m-0 text-[13px] text-pass`,children:`No rule failed on the pages this run visited.`}),d.passed.length>0&&(0,D.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,D.jsxs)(`button`,{type:`button`,"aria-expanded":l,onClick:()=>u(!l),className:`flex cursor-pointer items-center gap-1 self-start border-0 bg-transparent p-0 text-[13px] font-medium text-ink`,children:[(0,D.jsx)(a,{size:13,"aria-hidden":`true`,className:p(`text-muted transition-transform`,!l&&`-rotate-90`)}),`Rules that passed `,(0,D.jsx)(`span`,{className:`font-normal text-muted tabular-nums`,children:d.passed.length})]}),l&&(0,D.jsx)(`ul`,{className:`m-0 flex list-none flex-wrap gap-1 p-0`,children:d.passed.map(e=>(0,D.jsx)(`li`,{className:`rounded-[6px] bg-pass-soft px-2 py-0.5 font-mono text-[11.5px] text-pass`,children:e},e))})]}),(0,D.jsx)(`p`,{className:`m-0 text-[12px] text-muted`,children:n})]})}function z({run:e}){let t=e.report;if(!t?.performance.pages.length)return(0,D.jsx)(`p`,{className:`m-0 text-[13px] 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`},i=t.breaches.filter(e=>e.kind===`performance`);return(0,D.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,D.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Core Web Vitals of each page, from one visit in the browser the agent drove, against Google's thresholds: `,(0,D.jsx)(`span`,{className:`text-pass`,children:`good`}),`, `,(0,D.jsx)(`span`,{className:`text-warn`,children:`needs improvement`}),`, `,(0,D.jsx)(`span`,{className:`text-fail`,children:`poor`}),`.`,` `,t.budgets.performance?`Pages over quality.budgets.performance are marked.`:`No performance budget set: nothing fails on timings.`]}),i.map((e,t)=>(0,D.jsxs)(`p`,{className:`m-0 rounded-[8px] bg-fail-soft px-3 py-1.5 text-[13px] text-fail [overflow-wrap:anywhere]`,children:[`Over budget · `,I(e.page),`: `,e.text]},t)),(0,D.jsx)(S,{label:`Timings`,minWidth:720,head:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 font-medium`,children:`Page`}),A.map(e=>(0,D.jsx)(`th`,{className:`px-2 py-1.5 text-right font-medium`,"data-tip":e.label,children:e.label},e.key)),(0,D.jsx)(`th`,{className:`px-2 py-1.5 text-right font-medium`,children:`Requests`}),(0,D.jsx)(`th`,{className:`py-1.5 pr-3 pl-2 text-right font-medium`,children:`Size`})]}),children:t.performance.pages.map((e,t)=>(0,D.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,D.jsxs)(`td`,{className:`py-1.5 pr-3 pl-3`,children:[(0,D.jsx)(`span`,{className:`block max-w-[340px] truncate font-mono text-[12px]`,"data-tip":e.url,children:I(e.url)}),e.over.length>0&&(0,D.jsxs)(`span`,{className:`text-[11.5px] text-fail`,children:[`over: `,e.over.join(`, `)]})]}),A.map(t=>{let i=e[t.key];return(0,D.jsxs)(`td`,{className:p(`px-2 py-1.5 text-right whitespace-nowrap 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`?N(i,t.unit):`–`,typeof i==`number`&&t.good!==1/0&&(0,D.jsxs)(`span`,{className:`sr-only`,children:[` (`,n(i,t),`)`]})]},t.key)}),(0,D.jsx)(`td`,{className:`px-2 py-1.5 text-right whitespace-nowrap text-muted tabular-nums`,children:e.requests??`–`}),(0,D.jsx)(`td`,{className:`py-1.5 pr-3 pl-2 text-right whitespace-nowrap text-muted tabular-nums`,children:e.kb===void 0?`–`:`${e.kb} KB`})]},t))}),(0,D.jsxs)(`p`,{className:`m-0 text-[12px] text-muted`,children:[A.filter(e=>e.good!==1/0).map(e=>`${e.label}: good up to ${N(e.good,e.unit)}, poor over ${N(e.poor,e.unit)}`).join(` · `),`. Lab values from one visit, not data from real users.`]})]})}function B({run:e,index:n,which:r,label:i}){let[a,o]=(0,E.useState)(``),[s,c]=(0,E.useState)(!1);return(0,E.useEffect)(()=>{let t=!1;return o(``),c(!1),m.image(e,n,r).then(e=>!t&&o(e),()=>!t&&c(!0)),()=>{t=!0}},[e,n,r]),(0,D.jsxs)(`figure`,{className:`m-0 flex min-w-0 flex-col gap-1.5`,children:[(0,D.jsx)(`figcaption`,{className:`text-[12px] font-medium text-muted`,children:i}),a?(0,D.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,D.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,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(b,{icon:t,size:14}),` Not available`]}):`Loading…`})]})}function V({run:t,budget:n,onChange:r}){let[i,s]=(0,E.useState)(null),[c,u]=(0,E.useState)(``),[d,f]=(0,E.useState)(!1),[g,y]=(0,E.useState)(``),[b,x]=(0,E.useState)(new Set),[C,w]=(0,E.useState)(`all`),T=t.visual?.pages??[],O=T.find(e=>e.status===`changed`)?.index;(0,E.useEffect)(()=>x(O===void 0?new Set:new Set([O])),[t.id,O]);let k=async e=>{f(!0),y(``);try{r(await e()),s(null),u(``)}catch(e){y(e.message)}finally{f(!1)}};if(!t.visual)return t.captured?(0,D.jsxs)(`div`,{className:`flex flex-col items-start gap-2`,children:[(0,D.jsxs)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:[`This run captured `,P(t.captured,`page`),` but they were not compared with the baselines yet.`]}),(0,D.jsxs)(h,{size:`sm`,variant:`primary`,disabled:d,"data-tip":`Compare with the baselines`,onClick:()=>k(()=>m.compare(t.id)),children:[(0,D.jsx)(o,{"aria-hidden":`true`}),`Compare`]}),g&&(0,D.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:g})]}):(0,D.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`This run has no visual captures: quality.visual.enabled was off, or the run visited no page.`});let A=T.filter(e=>e.status===`changed`),M=(C===`changed`?A:T).slice().sort((e,t)=>Number(t.status===`changed`)-Number(e.status===`changed`)||(t.diffPercent??0)-(e.diffPercent??0)),N=e=>{let t=new Set(b);t.has(e)?t.delete(e):t.add(e),x(t)};return(0,D.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,D.jsxs)(`p`,{className:`m-0 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.`]}),(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,D.jsx)(`div`,{role:`group`,"aria-label":`Show`,className:`flex gap-1`,children:[[`all`,`All pages`,T.length],[`changed`,`Changed`,A.length]].map(([e,t,n])=>(0,D.jsxs)(`button`,{type:`button`,"aria-pressed":C===e,onClick:()=>w(e),className:p(`inline-flex min-h-7 cursor-pointer items-center gap-1 rounded-[6px] border px-2 text-[12px]`,C===e?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:text-ink`),children:[t,` `,(0,D.jsx)(`span`,{className:`tabular-nums opacity-75`,children:n})]},e))}),(0,D.jsx)(`span`,{className:`flex-1`}),A.length>1&&(0,D.jsxs)(h,{size:`sm`,disabled:d,"data-tip":`Approve all ${A.length} changes`,onClick:()=>s(A.map(e=>e.url)),children:[(0,D.jsx)(l,{"aria-hidden":`true`}),`Approve (`,A.length,`)`]})]}),i&&(0,D.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Approve as baseline`,className:`flex flex-col gap-2 rounded-[10px] border border-accent-line bg-accent-soft p-3 text-[13px]`,children:[(0,D.jsxs)(`span`,{className:`font-medium`,children:[`Make this run's capture the baseline of `,i.length===1?I(i[0]):P(i.length,`page`),`?`]}),(0,D.jsx)(`span`,{className:`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,D.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[`Why it changed (kept with the baseline)`,(0,D.jsx)(_,{size:`sm`,value:c,maxLength:300,placeholder:`New checkout banner`,onChange:e=>u(e.target.value),className:`max-w-[480px] bg-bg`})]}),(0,D.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,D.jsxs)(h,{size:`sm`,variant:`primary`,disabled:d,onClick:()=>k(()=>m.approve(t.id,i,c.trim()||void 0)),children:[(0,D.jsx)(l,{"aria-hidden":`true`}),`Approve`]}),(0,D.jsxs)(h,{size:`sm`,onClick:()=>s(null),children:[(0,D.jsx)(e,{"aria-hidden":`true`}),`Cancel`]})]})]}),g&&(0,D.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:g}),(0,D.jsx)(S,{label:`Pages against their baselines`,fixed:!0,resetKey:C,empty:`No page changed.`,head:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 font-medium`,children:`Page`}),(0,D.jsx)(`th`,{className:`hidden w-[110px] py-1.5 pr-3 font-medium @2xl:table-cell`,children:`Size`}),(0,D.jsx)(`th`,{className:`w-[90px] py-1.5 pr-3 text-right font-medium`,children:`Changed`}),(0,D.jsx)(`th`,{className:`w-[120px] py-1.5 pr-3 font-medium`,children:`Result`}),(0,D.jsx)(`th`,{className:`w-[96px] py-1.5 pr-3`,children:(0,D.jsx)(`span`,{className:`sr-only`,children:`Approve`})})]}),children:M.map(e=>{let n=b.has(e.index);return(0,D.jsxs)(E.Fragment,{children:[(0,D.jsxs)(`tr`,{onClick:()=>N(e.index),"aria-expanded":n,className:p(`cursor-pointer border-t border-line-soft align-top hover:bg-surface-muted`,n&&`bg-surface-muted`),children:[(0,D.jsx)(`td`,{className:`py-1.5 pr-3 pl-3`,children:(0,D.jsxs)(`span`,{className:`flex items-start gap-1`,children:[(0,D.jsx)(a,{size:13,"aria-hidden":`true`,className:p(`mt-0.5 flex-none text-muted transition-transform`,!n&&`-rotate-90`)}),(0,D.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,D.jsx)(`span`,{className:`truncate`,"data-tip":e.title||e.url,children:e.title||I(e.url)}),(0,D.jsx)(`span`,{className:`truncate font-mono text-[11.5px] text-muted`,"data-tip":e.url,children:I(e.url)})]})]})}),(0,D.jsxs)(`td`,{className:`hidden py-1.5 pr-3 whitespace-nowrap text-muted @2xl:table-cell`,children:[e.size||`–`,e.resized?` · resized ${e.resized}`:``]}),(0,D.jsx)(`td`,{className:p(`py-1.5 pr-3 text-right whitespace-nowrap tabular-nums`,e.over?`text-fail`:e.status===`changed`?`text-warn`:`text-muted`),children:e.status===`changed`?`${e.diffPercent}%${e.limit===void 0?``:` / ${e.limit}%`}`:`–`}),(0,D.jsx)(`td`,{className:`py-1.5 pr-3`,children:(0,D.jsx)(v,{tone:e.over?`fail`:j[e.status].tone,className:`min-h-5 px-2 text-[11px]`,children:e.over?`Over budget`:j[e.status].label})}),(0,D.jsx)(`td`,{className:`py-1 pr-3 text-right`,onClick:e=>e.stopPropagation(),children:e.status===`changed`&&(0,D.jsx)(h,{variant:`icon`,size:`icon-sm`,disabled:d,"aria-label":`Approve ${I(e.url)}`,"data-tip":`Approve ${I(e.url)}`,onClick:()=>s([e.url]),children:(0,D.jsx)(l,{"aria-hidden":`true`})})})]}),n&&(0,D.jsx)(`tr`,{className:`bg-surface-muted`,children:(0,D.jsx)(`td`,{colSpan:5,className:`px-3 pb-3`,children:(0,D.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(180px,1fr))] gap-3`,children:[e.images.baseline&&(0,D.jsx)(B,{run:t.id,index:e.index,which:`baseline`,label:`Baseline`}),e.images.current&&(0,D.jsx)(B,{run:t.id,index:e.index,which:`current`,label:`This run`}),e.images.diff&&(0,D.jsx)(B,{run:t.id,index:e.index,which:`diff`,label:`Difference (in red)`})]})})})]},e.index)})})]})}function H({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,D.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,D.jsx)(`polyline`,{points:n,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinejoin:`round`})})}function U({icon:e,className:t,lines:n}){return n.length?(0,D.jsxs)(`span`,{className:p(`flex items-start gap-1.5 text-[13px]`,t),children:[(0,D.jsx)(b,{icon:e,size:14,className:`mt-0.5 flex-none`}),(0,D.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:n.join(` · `)})]}):null}function W({trends:e}){return e.length?(0,D.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.map(e=>{let t=e.a11y.latest?O.reduce((t,n)=>t+(e.a11y.latest[n]||0),0):void 0;return(0,D.jsxs)(`li`,{className:`flex flex-col gap-1.5 border-t border-line-soft py-3 first:border-t-0`,children:[(0,D.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-3`,children:[(0,D.jsx)(`span`,{className:`min-w-0 flex-[1_1_240px] truncate font-mono text-[13px]`,"data-tip":e.page,children:/^https?:/.test(e.page)?I(e.page):e.page}),(0,D.jsx)(H,{values:e.a11y.trail}),(0,D.jsxs)(`span`,{className:`text-[12px] text-muted`,children:[P(e.runs,`run`),t===void 0?``:` · ${P(t,`violation`)} now`]})]}),(0,D.jsx)(U,{icon:c,className:`text-fail`,lines:[...e.perf.worse.map(e=>`slower: ${e}`),...e.a11y.newRules.map(e=>`newly failing: ${e}`)]}),(0,D.jsx)(U,{icon:u,className:`text-pass`,lines:[...e.perf.better.map(e=>`faster: ${e}`),...e.a11y.fixedRules.map(e=>`fixed: ${e}`)]})]},e.page)})}):(0,D.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.`})}var G={accessibility:e=>!!e.a11y?.pages,performance:e=>e.perf.pages>0,visual:e=>!!e.visual||e.captured>0},K={accessibility:e=>!!e.a11y?.failed,performance:e=>e.perf.over>0,visual:e=>!!(e.visual?.changed||e.visual?.over)},q=(e,t)=>t.filter(G[e]);function J({kind:e,runs:t}){let[n,i]=(0,E.useState)(`all`),a=q(e,t),o=n===`attention`?a.filter(K[e]):a,c=t=>location.hash=y(e,encodeURIComponent(t)),u=`py-2 pr-3 text-right tabular-nums`;return(0,D.jsx)(S,{label:`Runs`,placeholder:`Find a run by what it did`,resetKey:n,empty:`Nothing matches.`,tools:(0,D.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,D.jsx)(x,{items:[{id:`all`,label:`All`,n:a.length},{id:`attention`,label:`Needs a look`,n:a.filter(K[e]).length,alert:!0}],value:n,onChange:i})}),head:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`th`,{className:`w-[46%] py-1.5 pr-3 pl-3 font-medium`,children:`Run`}),e===`accessibility`&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Rules failed`}),(0,D.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @2xl:table-cell`,children:`Critical · serious`}),(0,D.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @3xl:table-cell`,children:`Moderate · minor`}),(0,D.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @xl:table-cell`,children:`Pages`})]}),e===`performance`&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Over budget`}),(0,D.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @xl:table-cell`,children:`Pages timed`})]}),e===`visual`&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Changed`}),(0,D.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @2xl:table-cell`,children:`New`}),(0,D.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @xl:table-cell`,children:`Same`})]}),(0,D.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`When`})]}),children:o.map(t=>{let n=K[e](t),i=(t.over?.[e]??0)>0;return(0,D.jsxs)(`tr`,{onClick:()=>c(t.id),className:`cursor-pointer border-t border-line-soft hover:bg-surface-muted`,children:[(0,D.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,D.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(i?r:n?s:l,{size:15,"aria-label":i?`Over a budget`:n?`Needs a look`:`Within budgets`,className:p(`flex-none`,i?`text-fail`:n?`text-warn`:`text-pass`)}),(0,D.jsx)(`a`,{href:y(e,encodeURIComponent(t.id)),onClick:e=>e.stopPropagation(),"data-tip":t.goal,className:`truncate text-ink no-underline hover:underline`,children:t.goal})]})}),e===`accessibility`&&t.a11y&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`td`,{className:p(u,t.a11y.failed?`text-fail`:`text-muted`),children:t.a11y.failed}),(0,D.jsx)(`td`,{className:p(u,`hidden @2xl:table-cell`,t.a11y.critical+t.a11y.serious?`text-fail`:`text-muted`),children:`${t.a11y.critical} · ${t.a11y.serious}`}),(0,D.jsx)(`td`,{className:p(u,`hidden text-muted @3xl:table-cell`),children:`${t.a11y.moderate} · ${t.a11y.minor}`}),(0,D.jsx)(`td`,{className:p(u,`hidden text-muted @xl:table-cell`),children:t.a11y.pages})]}),e===`performance`&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`td`,{className:p(u,t.perf.over?`text-fail`:`text-muted`),children:t.perf.over}),(0,D.jsx)(`td`,{className:p(u,`hidden text-muted @xl:table-cell`),children:t.perf.pages})]}),e===`visual`&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`td`,{className:p(u,t.visual?.changed?`text-warn`:`text-muted`),children:t.visual?t.visual.changed:`not compared`}),(0,D.jsx)(`td`,{className:p(u,`hidden text-muted @2xl:table-cell`),children:t.visual?t.visual.new+t.visual.no_baseline:`–`}),(0,D.jsx)(`td`,{className:p(u,`hidden text-muted @xl:table-cell`),children:t.visual?t.visual.same:`–`})]}),(0,D.jsx)(`td`,{className:`hidden py-2 pr-3 whitespace-nowrap text-[12.5px] text-muted @xl:table-cell`,"data-tip":M(t.at),children:T(t.at)})]},t.id)})})}function Y({kind:e,id:t,view:n,onChanged:r}){let[i,o]=(0,E.useState)(null),[s,c]=(0,E.useState)(``);(0,E.useEffect)(()=>{let e=!1;return o(null),m.run(t).then(t=>{e||(o(t),c(``))},t=>!e&&c(t.message)),()=>{e=!0}},[t]);let l=(0,D.jsxs)(`a`,{href:y(e),className:`inline-flex items-center gap-1 self-start text-[13px] no-underline`,children:[(0,D.jsx)(a,{size:14,"aria-hidden":`true`,className:`rotate-90`}),`All runs`]});return s||!i?(0,D.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[l,s?(0,D.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail`,children:s}):(0,D.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Loading…`})]}):(0,D.jsxs)(`section`,{"aria-labelledby":`run-h`,className:`flex min-w-0 flex-col gap-3`,children:[l,(0,D.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,D.jsx)(`h2`,{id:`run-h`,"data-tip":i.goal,className:`m-0 truncate text-[16px] leading-snug font-semibold`,children:i.goal}),(0,D.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 text-[12.5px] text-muted`,children:[M(i.at),` · `,(0,D.jsx)(C,{path:i.dir}),` · `,(0,D.jsx)(`a`,{href:y(`quality`,encodeURIComponent(i.id)),children:`Everything it measured`})]})]}),e===`accessibility`&&(0,D.jsx)(R,{run:i,standard:n.standard,disclaimer:n.disclaimer}),e===`performance`&&(0,D.jsx)(z,{run:i}),e===`visual`&&(0,D.jsx)(V,{run:i,budget:n.budgets.visual,onChange:e=>{o(e),r()}})]})}function X({r:e,to:t,line:n}){return(0,D.jsxs)(`div`,{className:`ml-12 flex flex-wrap items-center gap-x-4 gap-y-2 rounded-[14px] card border px-4 py-3`,children:[(0,D.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col`,children:[(0,D.jsx)(`span`,{className:`text-[14.5px] font-medium [overflow-wrap:anywhere]`,children:e.goal}),(0,D.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:n})]}),(0,D.jsxs)(h,{size:`sm`,variant:`primary`,"data-tip":`Open the run`,onClick:()=>location.hash=t,children:[(0,D.jsx)(d,{"aria-hidden":`true`}),`Open`]})]})}function Z({label:e,value:t,sub:n,tone:r}){return(0,D.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5 px-3 py-2`,children:[(0,D.jsx)(`span`,{className:`text-[11.5px] text-muted`,children:e}),(0,D.jsx)(`span`,{className:p(`text-[16px] leading-tight font-semibold tabular-nums`,r),children:t}),n&&(0,D.jsx)(`span`,{className:`truncate text-[11.5px] text-muted`,children:n})]})}export{M as _,J as a,X as c,V as d,N as f,I as g,q as h,Y as i,W as l,P as m,O as n,Z as o,L as p,k as r,z as s,R as t,A as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as e,tt as t,u as n}from"./filters-Bk7ovF3M.js";var r=t=>e(`record`,`recording`,encodeURIComponent(t)),i=e=>e.split(`/`).pop()||e;function a(e){let t=!!e?.testFile&&e.exists!==!1,n=e?.testFile?i(e.testFile):``,r=e=>e;if(!e)return{tone:`neutral`,label:`No test yet`,detail:`No test has been written from this recording. Write turns it into a test in your repository.`,hasTest:!1,writing:!1};if(e.state===`checking`)return{tone:`running`,label:`Checking the steps…`,detail:`The steps are played in a new browser first; when they work, the Coding agent ${t?`updates ${n}`:`writes the test`}. You can leave this page.`,hasTest:t,writing:!0};if(e.state===`check_failed`)return{tone:`fail`,label:t?`Steps failed, test not updated`:`Steps failed, no test written`,detail:`${e.error||`The steps did not work when played.`} Fix the step (Show, Record or Remove), or write the test anyway.`,hasTest:t,writing:!1};if(e.state===`writing`&&e.waiting&&e.resumeUntil){let n=new Date(e.resumeUntil).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`});return{tone:`warn`,label:`Waiting for the model…`,detail:`${e.waiting} ForgeQE checks every 30 seconds and carries on from where it stopped as soon as the model answers, until ${n}. Stop writing to give up now.`,hasTest:t,writing:!0}}if(e.state===`writing`&&e.waiting)return{tone:`warn`,label:`Waiting for the model…`,detail:`${e.waiting} The agent keeps retrying; if the model stays away ForgeQE stops it after 10 minutes and carries on by itself once the model answers. Stop writing to give up now.`,hasTest:t,writing:!0};if(e.state===`writing`)return r({tone:`running`,label:e.resumes?`Carrying on…`:t?`Updating the test…`:`Writing the test…`,detail:`${e.resumes?`The model answered again: the Coding agent carries on from where it stopped. `:``}The Coding agent is ${t?`updating ${n}`:`writing the test`} from this recording. It goes on if you leave or refresh this page; it shows here when it is done.`,hasTest:t,writing:!0});if(e.testFile&&e.exists===!1)return{tone:`warn`,label:`Test file not found`,detail:`${e.testFile} was written from this recording but is no longer in the repository. Write makes a new one.`,hasTest:!1,writing:!1};if(t){if(e.state===`passed`||e.state===`stopped`||e.state===`interrupted`){let r=e.error?` (${e.error})`:``,i=e.state===`stopped`?` The last update was stopped; what it changed so far is kept, and Update carries on from there.${r}`:e.state===`interrupted`?` The last update did not finish; what it changed so far is kept, and Update carries on from there.${r}`:``;return e.changedSince?{tone:`warn`,label:`Test out of date`,detail:`${n} was written before you changed the recording. Update the test to bring it in line.${i}`,hasTest:t,writing:!1}:{tone:`pass`,label:`Test written`,detail:`${n} was written from this recording and passed.${i} Update the test only if the recording changes.`,hasTest:t,writing:!1}}return{tone:`warn`,label:`Test not passing`,detail:`${n} was written, but it did not pass ForgeQE's run${e.state===`blocked`?` (something blocked it)`:``}.${e.error?` ${e.error}`:``} Update the test to try again.`,hasTest:t,writing:!1}}if(e.state===`stopped`)return{tone:`neutral`,label:`Writing stopped`,detail:`${e.error||`Writing the test was stopped before a test was written.`} Write starts again.`,hasTest:!1,writing:!1};if(e.state===`interrupted`)return{tone:`warn`,label:`Writing did not finish`,detail:`${e.error||`The writing ended before a test was written.`} Write starts again.`,hasTest:!1,writing:!1};let a=!!e.error&&/^(Couldn't reach the model|The model refused|The model is busy|Stopped after)/.test(e.error);return{tone:`fail`,label:a?`Model not reachable`:`Writing failed`,detail:`${e.error||`The Coding agent could not write a passing test from this recording.`} ${a?`Write tries again once it is fixed.`:`Open the chat to see more, or Write to try again.`}`,hasTest:!1,writing:!1}}function o(e){return n(e,e=>t.openFile(e,{}))}export{r as n,a as r,o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Xn as e}from"./line-icons-CQ-3V8ax.js";import{B as t,
|
|
1
|
+
import{Xn as e}from"./line-icons-CQ-3V8ax.js";import{B as t,V as n,Wt as r,c as i,f as a,h as o}from"./filters-Bk7ovF3M.js";import{r as s}from"./index-ASvNRLI7.js";var c=r();function l(e){return e.waiting||e.state===`ready`&&e.outcome===`needs_input`?`waiting`:e.state===`busy`||e.state===`starting`?`working`:e.state===`closed`||e.state===`failed`?`ended`:`done`}var u={working:{label:`Working`,tone:`running`},waiting:{label:`Needs you`,tone:`warn`},done:{label:`Your turn`,tone:`pass`},ended:{label:`Ended`,tone:`neutral`}};function d(e){let t=e=>Date.parse(e.lastAt||e.started)||0;return[...e].sort((e,n)=>t(n)-t(e))}function f(e,t){let n=t.toLowerCase().split(/\s+/).filter(Boolean),r=`${e.title} ${e.lastReply||``} ${e.profile||``}`.toLowerCase();return n.every(e=>r.includes(e))}function p(e,t,n=3,r=50){return!Number.isFinite(e)||!Number.isFinite(t)||t<=0?n:Math.min(r,Math.max(n,Math.floor(e/t)))}function m({c:r}){let d=l(r),f=u[d];return(0,c.jsxs)(`a`,{href:a(`chats`,r.id),className:`group grid min-h-14 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-4 rounded-[10px] px-3 py-2 text-ink no-underline hover:bg-surface-muted hover:text-ink @3xl:grid-cols-[minmax(0,1fr)_120px_90px_150px_96px]`,children:[(0,c.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,c.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[d===`waiting`&&(0,c.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-warn`}),(0,c.jsx)(`span`,{className:`truncate text-[14px] font-medium`,children:r.title})]}),(0,c.jsx)(`span`,{className:t(`truncate text-[12.5px]`,r.lastReply?`text-muted`:`text-muted italic`),children:r.lastReply||(d===`working`?`Working on the first answer…`:`No answer yet`)})]}),(0,c.jsx)(`span`,{className:`justify-self-end @3xl:justify-self-start`,children:(0,c.jsx)(i,{tone:f.tone,orb:r.state===`starting`?`waiting`:`working`,children:f.label})}),(0,c.jsx)(`span`,{className:`hidden text-[13px] text-muted tabular-nums @3xl:block`,children:r.turns?n(r.turns,`message`):`—`}),(0,c.jsx)(`span`,{className:`hidden min-w-0 items-center gap-1 truncate text-[13px] text-muted @3xl:flex`,children:r.profile?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(o,{icon:e,size:11,className:`flex-none text-accent-fg`}),(0,c.jsx)(`span`,{className:`truncate`,children:r.profile})]}):`Default model`}),(0,c.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:s(r.lastAt||r.started)})]})}export{p as a,d as i,f as n,l as r,m as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{B as e,Wt as t}from"./filters-Bk7ovF3M.js";var n=t(),r=`flex w-fit max-w-full flex-wrap gap-1 rounded-[10px] bg-surface-strong p-1`,i=t=>e(`inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-[7px] border-0 px-3 text-sm font-medium whitespace-nowrap`,t?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`);function a({tabs:t,current:a,onPick:o,label:s,className:c}){return(0,n.jsx)(`div`,{role:`tablist`,"aria-label":s,className:e(`mb-5`,r,c),children:t.map((e,r)=>(0,n.jsxs)(`button`,{id:`tab-${e.id}`,type:`button`,role:`tab`,"aria-selected":a===e.id,"aria-controls":`panel-${e.id}`,tabIndex:a===e.id?0:-1,onClick:()=>o(e.id),onKeyDown:e=>{let n=e.key===`ArrowRight`?t[(r+1)%t.length]:e.key===`ArrowLeft`?t[(r-1+t.length)%t.length]:void 0;n&&(o(n.id),document.getElementById(`tab-${n.id}`)?.focus())},className:i(a===e.id),children:[e.label,e.n!==void 0&&(0,n.jsx)(`span`,{className:`text-[12px] text-muted tabular-nums`,children:e.n})]},e.id))})}function o({links:t,current:a,label:o,className:s}){return(0,n.jsx)(`nav`,{"aria-label":o,className:e(r,s),children:t.map(t=>(0,n.jsx)(`a`,{href:t.href,"aria-current":a===t.id?`page`:void 0,className:e(i(a===t.id),`no-underline hover:no-underline`,a===t.id&&`hover:text-ink`),children:t.label},t.id))})}export{i,a as n,r,o as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Ut as e,Yt as t}from"./frame-
|
|
1
|
+
import{Ut as e,Yt as t}from"./frame-CqWJMIHh.js";var n=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{},r=e=>typeof e==`string`?e:e==null?``:String(e),i=(e,t=400)=>e.length>t?`${e.slice(0,t-1)}…`:e,a=e=>typeof e==`number`?` in ${Math.round(e/1e3)}s`:``;function o(e,t=400){return i(e.replace(/\s+/g,` `).trim(),t).replace(/([\\`*_[\]<>#|~!])/g,`\\$1`)}function s(e){let t=e.replace(/\s+/g,` `).trim();if(!t)return``;let n=t.includes("`")?"``":"`";return`${n}${n==="``"?` `:``}${t}${n==="``"?` `:``}${n}`}function c(e,t){return/^https?:\/\/[^\s)]+$/i.test(t)?`[${o(e||t,120)}](${t})`:o(e)}var l=e=>[s(r(n(e).id)),o(r(n(e).title),200)].filter(Boolean).join(` `);function u(e){return e.replace(/<!--[\s\S]*?(?:-->|$)/g,``).trim()}function d(e){return e.replace(/\[((?:\\.|[^\]\\])*)\]\(https?:\/\/[^\s)]+\)/g,`$1`).replace(/\\(.)/g,`$1`).replace(/[*`]/g,``)}var f=(e,t)=>({tone:e,kind:`item`,md:t}),p=(e,t)=>({tone:e,kind:`sub`,md:t});function m(e,t=``){let i=t||(e.agent&&e.agent!==`forgeqe`?`**${o(r(e.agent))}:** `:``);switch(e.kind){case`info`:return f(`info`,`${i}${o(r(e.text))}`);case`start`:return f(`dim`,`${i}→ ${s(r(e.tool))}${e.text&&e.text!==e.tool?` ${o(r(e.text),200)}`:``}`);case`tool`:{let t=n(e.file);return f(e.ok===!1?`warn`:`dim`,`${i}${e.ok===!1?`⚠`:`✓`} ${o(r(e.text)||r(e.tool),240)}${t.path?` (${o(r(t.action))} ${s(r(t.path))})`:``}`)}case`say`:{let t=u(r(e.text));return t?f(`say`,`${i}*${o(t)}*`):null}case`test`:return Number(e.attempt)>0?f(e.ok?`ok`:`fail`,`${i}${e.ok?`✓`:`✗`} **Test, attempt ${o(r(e.attempt))}:** ${o(r(e.text),240)}`):f(e.ok?`ok`:`fail`,`${i}${e.ok?`✓`:`✗`} ${o(r(e.text),240)}`);case`plan`:{let t=Array.isArray(e.items)?e.items.map(n):[],a=t.find(e=>e.status===`in_progress`);return f(`info`,`${i}**Plan:** ${t.filter(e=>e.status===`completed`).length} of ${t.length} done${a?`; now: ${o(r(a.text))}`:``}`)}case`review`:return f(e.approved?`ok`:`warn`,`${i}**Review, attempt ${o(r(e.attempt))}:** ${e.approved?`approved`:`changes asked`}. ${o(r(e.summary),240)}`);case`attempt`:return f(`warn`,`${i}**Attempt ${o(r(e.attempt))} of ${o(r(e.max))}:** ${o(r(e.why),240)}`);case`answer`:return f(`dim`,`${i}Attempt ${o(r(e.attempt))}: ${o(r(e.notes)||`changed ${(Array.isArray(e.changed)?e.changed:[]).map(r).join(`, `)}`,240)}`);case`context`:return e.compacted?f(`info`,`${i}Context compacted: the conversation was summarised to make room.`):null;default:return null}}function h(e,t=``){switch(e.type){case`log`:return f(e.level===`error`?`fail`:e.level===`warn`?`warn`:`dim`,`${t}${e.level===`warn`||e.level===`error`?`⚠ `:``}${o(r(e.text))}`);case`step`:return f(`dim`,`${t}**Step ${o(r(e.step))}** · ${e.source===`memory`?`from memory`:o(r(e.category))} · ${c(r(e.title)||`untitled`,r(e.url))}`);case`memory`:return f(`info`,`${t}↻ ${o(r(e.text))}`);case`thought`:return p(`think`,`*${o(r(e.text))}*`);case`outcome`:return p(e.ok?`ok`:`fail`,`${e.ok?`✓`:`✗`} ${o(r(e.text),300)}`);case`done`:{let i=n(e.result);return f(i.status===`complete`?`ok`:`fail`,`${t}**${o(r(i.status))}:** ${o(r(i.summary))}`)}case`code`:return m(e,t);default:return null}}function g(e){switch(e.type){case`run-start`:return{tone:`info`,kind:`head`,md:`Browser run: ${o(r(e.goal),200)}${e.url?` · ${c(r(e.url).replace(/^https?:\/\//,``),r(e.url))}`:``}`};case`run-event`:return h(n(e.event));case`run-done`:{let t=n(e.result),i=!e.error&&(t.outcome===`passed`||!t.outcome&&t.status===`complete`);return f(i?`ok`:`fail`,`${i?`✓`:`✗`} **Run ${i?`passed`:`failed`}**${a(e.ms)}: ${o(r(e.error)||r(t.summary))}${e.runDir?` · ${s(r(e.runDir))}`:``}`)}case`suite-start`:return{tone:`info`,kind:`head`,md:`Suite: ${(Array.isArray(e.cases)?e.cases:[]).length} cases, ${o(r(e.parallel))} at once`};case`suite-event`:{let t=n(e.event);if(t.type===`case-start`)return f(`info`,`**Case ${Number(t.index)+1} of ${o(r(t.total))}:** ${l(t.case)}`);if(t.type===`case-event`)return h(n(t.event),`${s(r(n(t.case).id))} `);if(t.type===`case-done`){let e=n(t.result);return f(e.status===`passed`?`ok`:`fail`,`${e.status===`passed`?`✓`:`✗`} ${l(e.case)}: **${o(r(e.status))}**${a(e.ms)}${e.summary?`. ${o(r(e.summary),240)}`:``}`)}return t.type===`code-start`?f(`info`,`${s(r(n(t.case).id))} writing its test`):t.type===`writeback`?f(`dim`,`Posted the result back: ${o(JSON.stringify(t.item),240)}`):null}case`suite-done`:{let t=(Array.isArray(n(e.suite).results)?n(e.suite).results:[]).map(n),r=t.filter(e=>e.status===`passed`).length;return f(r===t.length?`ok`:`fail`,`**Suite: ${r} of ${t.length} passed**${a(n(e.suite).ms)}`)}case`info`:return f(e.ok===!1?`fail`:e.ok===!0?`ok`:`info`,o(r(e.text)));case`agent`:return m(n(n(e.event)),`**Coding agent:** `);case`code-start`:return{tone:`info`,kind:`head`,md:`Writing a test: ${o(r(e.goal),200)}`};case`code-done`:return f(e.error?`fail`:`ok`,`${e.error?`✗`:`✓`} **Test ${e.error?`not written`:`written`}**${a(e.ms)}${e.error?`: ${o(r(e.error),240)}`:``}`);case`card`:{let t=n(e.card),i=(Array.isArray(t.body)?t.body:[]).map(r).filter(Boolean);return f(t.status===`ok`?`ok`:t.status===`fail`?`fail`:`info`,`**${o(r(t.title))}**${t.stats?` · ${o(r(t.stats))}`:``}${i.length?`: ${o(i.join(`; `),300)}`:``}`)}case`report`:return f(`ok`,`✓ Report saved: ${o(r(e.title))}`);case`call-start`:return f(`dim`,`→ ${o(r(e.text),240)}`);case`call`:return f(e.ok===!1?`warn`:`dim`,`${e.ok===!1?`⚠`:`✓`} ${o(r(e.text),240)}`);default:return null}}function _(e){let t=r(e.at)||r(e.t),i=null;switch(e.type){case`user`:i=f(`you`,`**You:** ${o(r(e.text),240)}`);break;case`agent`:i=m(n(e.event));break;case`tool`:i=g(n(e.event));break;case`ask`:i=f(`you`,`**Asked:** ${o(r(n(e.question).title))}`);break;case`wait`:i=f(`you`,`**Waiting for you:** ${o(r(e.prompt))}`);break;case`answered`:i=f(`you`,`**You:** ${e.label===void 0?e.ok?`done, continue`:`cancel`:o(r(e.label))}`);break;case`turn_done`:i=f(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?`: ${o(r(e.error),300)}`:``}`);break;case`settings`:i=f(`you`,`**Settings:** browser ${e.headed?`shown`:`headless`}, ${e.writeTests?`passed runs become tests`:`no tests written`}`);break;case`model`:i=f(`you`,`**Model:** ${o(r(n(e.profile).name),80)}`);break;case`settings_applied`:i=f(`you`,`**Settings:** carried on with the settings as they are on disk now`);break;case`stderr`:i={tone:`dim`,kind:`out`,md:r(e.text)};break;case`error`:i=f(`warn`,`⚠ ${o(r(e.message))}`);break;case`fatal`:i=f(`fail`,`✗ **ForgeQE cannot go on:** ${o(r(e.message))}`);break;case`exit`:i=f(e.code===0?`dim`:`fail`,`ForgeQE stopped${e.code!==null&&e.code!==void 0?` (exit ${o(r(e.code))})`:``}${e.message?`: ${o(r(e.message))}`:``}`)}return i?{at:t,...i,plain:i.kind===`out`?i.md:d(i.md)}:null}function v(e,t){if(!e||!t)return``;let n=Math.max(0,Math.round((Date.parse(t)-Date.parse(e))/1e3));return Number.isFinite(n)?`+${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`:``}function y(e,t,n){let r=n?[`## ${o(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=v(t,n.at),o=e?`\`${e}\``:``;n.kind===`out`?i.push(e?`${e} ${n.md}`:n.md):(a(),n.kind===`head`?r.push(``,`#### ${n.md}${o?` ${o}`:``}`,``):n.kind===`sub`?r.push(` - ${n.md}`):r.push(`- ${o?`${o} `:``}${n.md}`))}return a(),r.join(`
|
|
2
2
|
`).replace(/\n{3,}/g,`
|
|
3
3
|
|
|
4
4
|
`).trim()+`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Ir as e,Nr as t}from"./line-icons-CQ-3V8ax.js";import{
|
|
1
|
+
import{Ir as e,Nr as t}from"./line-icons-CQ-3V8ax.js";import{tt as n}from"./filters-Bk7ovF3M.js";import{n as r}from"./thread-DlyX7xQt.js";var i=e(t(),1),a=e=>e&&/^No model in llms\.json/.test(e)?`No model is set up for the agent yet: add one in Settings, Models (or sign in to GitHub Copilot there), then send this again.`:e;function o(e){let t=()=>{try{return localStorage.getItem(e)}catch{return null}},a=t=>{try{t?localStorage.setItem(e,t):localStorage.removeItem(e)}catch{}},[o,s]=(0,i.useState)(t),[c,l]=(0,i.useState)([]),[u,d]=(0,i.useState)(null);(0,i.useEffect)(()=>{if(!o){l([]),d(null);return}let e=!1,t=0;return l([]),(async()=>{for(;!e;)try{let r=await n.events(o,t,t>0);if(e||(d(r.state),r.events.length&&(t=r.events.at(-1).n,l(e=>[...e,...r.events])),(r.state===`closed`||r.state===`failed`)&&!r.events.length))return}catch(t){if(e)return;if(t.status===404){a(null),s(null);return}await new Promise(e=>setTimeout(e,2e3))}})(),()=>{e=!0}},[o]);let f=(0,i.useMemo)(()=>r(c),[c]),p=f.turns.at(-1),m=u===`closed`||u===`failed`;return{chat:o,thread:f,last:p,busy:u===`busy`||u===`starting`||!!p&&!p.outcome&&!m,ended:m,send:async(e,t,r={})=>{if(o&&!m)await n.send(o,e);else{let{id:i}=await n.start(`${t}\n${e}`,r);a(i),s(i)}},reset:()=>{a(null),s(null)}}}export{o as n,a as t};
|
package/dist/web/index.html
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<meta name="referrer" content="no-referrer" />
|
|
7
7
|
<title>ForgeQE</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-ASvNRLI7.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/line-icons-CQ-3V8ax.js">
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/filters-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/frame-
|
|
12
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/filters-Bk7ovF3M.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/frame-CqWJMIHh.js">
|
|
12
|
+
<link rel="stylesheet" crossorigin href="/assets/index-B5o9vY-v.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
15
15
|
<div id="root"></div>
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -69,6 +69,11 @@ Copied from test-agent-nexus and trimmed to what a CLI run needs:
|
|
|
69
69
|
|
|
70
70
|
**Window and video.** `window_launch_kwargs` sizes a local browser from `browser.viewport`: the page when headless, the window with `browser.window: viewport`. Otherwise a visible window opens screen-sized (the engine library's default) and, before the first page, `maximize_window` sets `windowState: maximized` over CDP. With `browser.video` on (the default), the browser is started before the replay or the agent, and `start_video` starts the library's recording watchdog on `<run>/video.mp4`; `stop_video` finishes it before the browser closes, and `run_with_events` adds it to the run's files. The watchdog encodes Chrome's screencast frames at 30 fps as they arrive, so the video's timing follows how often the page repaints, not the clock. The encoder (`browser-use[video]`: imageio with ffmpeg, numpy) is installed with the engine, and added to an engine set up before it. The report lists `video.mp4` among the run's files and plays it on the Artifacts tab.
|
|
71
71
|
|
|
72
|
+
**Videos of recordings, replays and desktop runs.** These have no browser-use agent, so `py/forgeqe_engine/video.py` makes their videos itself, with the ffmpeg that the pinned `imageio-ffmpeg` ships inside the package. It finds that binary in the package's own `binaries` folder, never on PATH or through `IMAGEIO_FFMPEG_EXE`, and starts it with an argument list and system settings only. Frames reach ffmpeg on stdin as raw RGB of a fixed size, letterboxed when a picture's size changes, so nothing a page shows reaches its command line. `FrameVideo` writes in real time at 5 fps, repeating the latest picture while nothing changes, and stops after an hour. A video that could not be finished is removed.
|
|
73
|
+
- *Recording by hand* (`browser.video`): `recordsession.py` runs the page's screencast over its own DevTools connection, follows the tester from tab to tab, and holds the video while the recording is paused. The file is `<run>/video.mp4`. Making a typed value a secret in the review removes the recording's videos, since a value cannot be taken out of a video's pictures.
|
|
74
|
+
- *Replays* (the `forgeqe code` replay check, and a recording's re-runs on the Record page): the Playwright runner keeps screencast frames as `<ms>.jpg`, at most one per tenth of a second, plus a closing screenshot so the video lasts as long as the replay. `python -m forgeqe_engine video` turns them into `replay/<setup>.mp4` (`src/engine/video.ts`) and the frames are removed. A re-run keeps only its last pass's video, as `tries/video.mp4`. Steps played in a person's own tab (a block) are never filmed; the recording's own video already shows them.
|
|
75
|
+
- *Desktop runs* (`desktop.video`, default on): `serve` films the main screen with Pillow's `ImageGrab` while a replay, explore or recording runs, and finishes `<run>/video.mp4` before `run.json` is written, so the desktop report plays it. A computer whose screen cannot be read (no display, or macOS without Screen Recording permission) runs without a video and says so.
|
|
76
|
+
|
|
72
77
|
**Browser profile.** At the end of the first step (or before writing a trust-mode replay), `browser_profile` reads how the browser was set up: the engine's driver, channel and executable, headless, the default switches removed, extra HTTP headers (none), `Browser.getVersion`, and from the page `navigator.userAgent`, `navigator.webdriver`, language, time zone, and viewport. It goes into `run.json` as `browser`, and the handoff shows it so the coding agent can compare its test's browser with it.
|
|
73
78
|
|
|
74
79
|
**Timeline.** `build_timeline` writes `steps.json` from the history (and the replayed steps): URL, title, the model's evaluation, memory and next goal, each action with its error, start time (`t0`) and duration, the part of it spent waiting for the model (`model_ms`, from wrapping `llm.ainvoke` and overlapping the calls with the step's `step_start_time`/`step_end_time`), and a JPEG of the page (max 1280 wide) under `steps/`, subject to `report.screenshots`. Each action on an element carries `box`: the element's `absolute_position` from the DOM snapshot the model saw, minus the page's scroll, as fractions of the viewport, so the report can outline it on that step's screenshot. Timeouts, stops, and crashes still write it from the partial history.
|
package/docs/WEB_APP.md
CHANGED
|
@@ -23,6 +23,7 @@ address again. Ctrl+C in the terminal stops it.
|
|
|
23
23
|
| `--config forgeqe.yaml` | Work on the folder of that file. |
|
|
24
24
|
| `--no-open` | Print the address without opening the browser. |
|
|
25
25
|
| `--url https://NAME.localhost` | Its name through a local proxy such as [portless](https://github.com/vercel-labs/portless), instead of a port number. Only a name under `.localhost`. |
|
|
26
|
+
| `--public-url https://NAME` | Hosted mode, with `--port`: the https name of a TLS proxy in front of it (see below). |
|
|
26
27
|
|
|
27
28
|
### A name instead of a port (portless)
|
|
28
29
|
|
|
@@ -44,6 +45,21 @@ The name is only one under `.localhost`, which browsers and resolvers always kee
|
|
|
44
45
|
(`forgeq.ai`) is refused: on your computer it would hide the real site, and it could point anywhere. Do not use
|
|
45
46
|
portless's sharing modes (`--lan`, `--tailscale`, `--ngrok`, `--cloudflare`): they put the app on the network.
|
|
46
47
|
|
|
48
|
+
### On a server (hosted mode)
|
|
49
|
+
|
|
50
|
+
For a demo or a security test on a server, put a TLS proxy in front of forgeqe web (a CDN or load balancer) that lets
|
|
51
|
+
in only the people you mean, for example by IP address, and give forgeqe web that proxy's https name:
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
forgeqe web --port 8080 --public-url https://forgeqe.example.com --no-open
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
forgeqe web still listens on `127.0.0.1` only and still needs its token: the proxy forwards to it on that computer.
|
|
58
|
+
It answers to that one name as well as `127.0.0.1`, takes calls from pages of exactly that origin, and tells the
|
|
59
|
+
browser to keep to https. The name is https, a DNS name (not an IP address, localhost or a `.localhost` name), on the
|
|
60
|
+
default port, with nothing after it. Anyone who has the printed link and gets through the proxy can use ForgeQE
|
|
61
|
+
there, with its credentials: keep the proxy limited, and give that server test credentials only.
|
|
62
|
+
|
|
47
63
|
## The first time: Set up
|
|
48
64
|
|
|
49
65
|
The first page is **Settings › Set up**, in four steps. Until the folder has a `forgeqe.yaml`, the other sections of
|
|
@@ -203,7 +219,7 @@ and Ended as filters, a search, and 50 at a time.
|
|
|
203
219
|
|
|
204
220
|
| Page | What it is for |
|
|
205
221
|
|---|---|
|
|
206
|
-
| **Record** | Do a test's steps yourself in a browser or a Windows app ForgeQE opens; each click, entry and choice is recorded, with nothing to describe first: no panel in the page, only a small badge, with Pause, Undo and Stop on the Record page. A web recording is then reviewed with clicks: its name (written from what you did), steps to drop or add (in your words, a page to open, go back), notes on steps, instructions for the Coding agent, checks suggested from what each step brought to the page or picked on its picture (a text, a field's value, the page it leads to, or in your words), and where each typed value comes from (as typed, test data, new on each run, or a secret read from the environment, its typed text removed from the recording). Every change is a version to go back to. Steps used in many tests are kept as a **block**, put into another recording, or played first when one starts (**Start from a block**). **Record more from here** plays the steps up to one and records what comes next. Checks of the page's own server calls, and **Suggest with the model** (one call). ForgeQE makes the usual choices first, and finds saved blocks in the steps. **
|
|
222
|
+
| **Record** | Do a test's steps yourself in a browser or a Windows app ForgeQE opens; each click, entry and choice is recorded, with nothing to describe first: no panel in the page, only a small badge, with Pause, Undo and Stop on the Record page. A web recording is then reviewed with clicks: its name (written from what you did), steps to drop or add (in your words, a page to open, go back), notes on steps, instructions for the Coding agent, checks suggested from what each step brought to the page or picked on its picture (a text, a field's value, the page it leads to, or in your words), and where each typed value comes from (as typed, test data, new on each run, or a secret read from the environment, its typed text removed from the recording). Every change is a version to go back to. Steps used in many tests are kept as a **block**, put into another recording, or played first when one starts (**Start from a block**). **Record more from here** plays the steps up to one and records what comes next. Checks of the page's own server calls, and **Suggest with the model** (one call). ForgeQE makes the usual choices first, and finds saved blocks in the steps. **Re-run** replays the steps with Playwright, on another environment or with other test data if you like, or once for each row of a data file or kept request; **Stop** ends it, keeping the steps done. **Write the test** tries the steps first, then the Coding agent writes it in the review, asking nothing: the plan and where the test goes follow the repository, and a block becomes one helper. Every web recording says what came of its test (**No test yet**, **Writing the test…**, **Test written** with its file to open, **Test out of date** after you change the recording, **Test not passing**, **Writing failed**); once a test is written, the button is **Update the test**, which asks first and changes that test instead of adding a second one. Writing is kept by forgeqe web, not the page: it plays the steps first (**Checking the steps…**), then a chat writes the test; you can leave and come back from the menu, and the recording still says where it is (**Steps failed, no test written** with the step that failed, or **Writing the test…** with the agent's work and **Open the chat**). The chat says which recording it writes, with **Back to the recording**. A refresh changes nothing. When something goes wrong the recording says why in words to act on: **Waiting for the model…** while the model is not answering and its calls are retried, **Model not reachable** (no internet, a proxy, the provider down), a refused sign-in (check the key in Settings › Models) or a busy model; a site that cannot be opened stops at the steps, before any model call. A writing that has only waited on the model for 10 minutes is stopped, and **Stop writing** stops it at once. When the model was not reachable or busy, ForgeQE checks every 30 seconds whether it answers again and then carries on by itself from where it stopped (**Carrying on…**), for up to 15 minutes after the first failure; a refused sign-in waits for you; either way what the agent changed so far is kept, and the next **Write** reopens its session and carries on from there instead of starting over. Closing forgeqe web stops the writing, and the recording says so. A desktop recording replays with no model. The recordings, searched and paged and filtered by **Test written** or **No test yet**, each with **Review**. |
|
|
207
223
|
| **Regression** | Regression packs for a release, in two tabs. **Agent**: a conversation where the agent reads the connected sources, says what is missing, asks for the details it needs (ticked off above the message box), and builds the pack. **Packs**: a table of the packs; a row opens the pack's page, with its numbers in one strip, the plan as a table (automated, manual, new automation, exploratory; filters, search, 50 rows a page, each row's evidence) and the release's changes, risk areas, runs and triage, history and a comparison beside it; save it, run it now or schedule it, refresh it, reuse it for the next release. |
|
|
208
224
|
| **API tests** | Two tabs. **Agent**: a conversation where you paste links, cURL or details (or attach a Postman collection or an API description) and the agent makes the API's calls in folders, sends them and says what it found, each API as a card to open. **Workbench**: like Postman, with an agent: APIs (from a description, a Postman collection, or the calls a recorded run saw) with their calls in folders and flows on the left, exported as a Postman collection; a call open to edit and **Send**, its answer, and what it must answer; an environment from env.yaml and one **Run**. Calls that change data ask first (once, or always on a test environment). Sign in once per API, the value kept as a secret. Flows built from the API's calls, passing values on. **Ask the agent** writes the tests or explains a failure, on the page. |
|
|
209
225
|
| **Quality** | What each browser run measured, as a table of runs (rules failed, critical and serious violations, slow pages, visual changes, budgets exceeded), with Trends beside it. A row opens the run's page: its numbers in one strip and three tabs, **Accessibility** (every failed WCAG rule with its criterion, level, elements and pages, each opening on the elements and how to fix it; the rules that passed), **Performance** (every page's Core Web Vitals, requests and size against the thresholds and budgets) and **Visual** (every page against its baseline, with the baseline, this run and the difference, and **Approve as the new baseline**). |
|
package/docs/user-guide.html
CHANGED
|
@@ -2643,7 +2643,7 @@ other agents, and those are routed.</li>
|
|
|
2643
2643
|
<div class="fact"><span class="mono">Ask it</span><ul class="asks"><li>Create an invoice for Contoso in the Billing app and save it as a test</li><li>I'll show you the steps in Billing: record them</li><li>Replay the billing workflow with customer Fabrikam</li><li>Step 4 timed out while the list loaded: fix the workflow</li></ul></div>
|
|
2644
2644
|
<div class="fact"><span class="mono">What it needs</span><ul class="needs"><li><span class="need opt">Optional</span><span>A live model profile in llms.json (an API key or Microsoft Entra ID sign-in)</span></li><li><span class="need req">Required</span><span>Windows desktop apps: env.yaml (kind: desktop) or desktop.apps in forgeqe.yaml</span></li><li><span class="need input">You give</span><span>a Windows machine, and the app in forgeqe.yaml desktop.apps</span></li></ul></div>
|
|
2645
2645
|
<div class="fact"><span class="mono">Limits</span><ul class="plainlist"><li>Windows only, one run at a time per desktop</li><li>Apps whose controls UI Automation cannot see (Citrix, some Java and custom-drawn apps) are not supported yet</li></ul></div>
|
|
2646
|
-
<div class="fact"><span class="mono">Tools</span><p class="tools"><code>desktop_explore</code> <code>desktop_record</code> <code>desktop_replay</code> <code>desktop_edit_workflow</code></p></div>
|
|
2646
|
+
<div class="fact"><span class="mono">Tools</span><p class="tools"><code>desktop_explore</code> <code>desktop_record</code> <code>desktop_replay</code> <code>desktop_edit_workflow</code> <code>desktop_manage</code></p></div>
|
|
2647
2647
|
</div>
|
|
2648
2648
|
<div class="detail"><span class="mono">In detail</span>
|
|
2649
2649
|
<section class="doc" id="doc-how_to_use-desktop-apps-windows">
|
package/forgeqe.example.yaml
CHANGED
|
@@ -70,6 +70,7 @@ environments:
|
|
|
70
70
|
# driver: auto # what workflows replay on: pywinauto (Windows) or agent-desktop (macOS, Linux,
|
|
71
71
|
# # Windows; headless). auto: pywinauto on Windows, agent-desktop elsewhere
|
|
72
72
|
# headed: false # agent-desktop: allow the mouse and keyboard (a double-click needs it)
|
|
73
|
+
# video: true # video.mp4 of the screen for each run, shown in its report
|
|
73
74
|
|
|
74
75
|
# Services for test runs in Docker or Podman (a database, a queue, the API under test), and the mocks' image. ForgeQE
|
|
75
76
|
# starts only what is declared here, with ports on 127.0.0.1 and read-only mounts. See docs/CONTAINERS.md.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capagents/forgeqe",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.3",
|
|
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": {
|
package/prompts/brain.md
CHANGED
|
@@ -247,10 +247,11 @@ For "an end-to-end test for story 1234", "combine these cases into one flow", or
|
|
|
247
247
|
- desktop_explore carries out the goal and saves a workflow; desktop_replay runs a saved one with no model. Both take over the desktop's mouse and keyboard, and ForgeQE asks the user first: never pass confirmed: true unless the user has agreed in this conversation.
|
|
248
248
|
- When the user wants to show the steps themselves ("I'll do it, record it"), use desktop_record: it needs no model. Tell them the hotkeys first (Ctrl+Shift+F11 adds a check of the control under the mouse, Ctrl+Shift+F12 finishes); afterwards show the steps, pass on its notes, and offer desktop_replay.
|
|
249
249
|
- After an explore, report the workflow file, its steps and checks, and offer desktop_replay. A workflow with no checks only proves the steps ran: say so.
|
|
250
|
-
-
|
|
250
|
+
- desktop_manage list gives the workflows (with their variables), the recent runs (failures, heals) and the data files and kept requests desktop_replay's rows take: call it when the user names a workflow or run loosely, or asks what there is. Replay once per row with rows; take new image baselines only when asked (update_baselines).
|
|
251
|
+
- Heals from desktop_replay are not written into the workflow by the replay itself: after a replay that passed, offer desktop_manage accept_heals with its run; it asks the user first. Never offer heals from a replay that failed.
|
|
252
|
+
- desktop_manage validate checks a workflow without running it; status says whether replay, explore and recording can run here; setup installs the desktop engine (it asks first).
|
|
251
253
|
- When a replayed step fails because the app was slow or a dialog was in the way, fix the workflow with desktop_edit_workflow: a longer timeout or retries on that step, a wait_for step before it (a control appears, shows a text, or is gone), or the dialog's button added with add_dismiss. Take the step numbers and the controls from the replay's steps and errors; never invent a control. Do not add fixed wait steps for this. It shows the user the diff and asks before writing; then offer desktop_replay to check the fix.
|
|
252
|
-
-
|
|
253
|
-
- On anything other than Windows these tools answer that they cannot run here: pass that on, do not retry.
|
|
254
|
+
- Explore and record need Windows; replay, validate, status and setup run on macOS and Linux too. When a tool answers that it cannot run here, pass that on, do not retry.
|
|
254
255
|
|
|
255
256
|
### Mobile apps
|
|
256
257
|
- For a goal in an Android or iOS app: call test_apps first. If the app is not one of its mobile apps, say how to add it to env.yaml (kind: mobile) and stop.
|
|
@@ -41,6 +41,7 @@ from dataclasses import dataclass, field
|
|
|
41
41
|
from typing import Any, Callable, Dict, Iterator, List, Mapping, Optional, Sequence, Set, Tuple
|
|
42
42
|
|
|
43
43
|
from .apps import AppSpec
|
|
44
|
+
from .boxes import SNAPSHOT_LIMIT, snapshot_boxes
|
|
44
45
|
from .replay import ControlNotFound
|
|
45
46
|
from .workflow import MODIFIERS, WorkflowError, parse_chord
|
|
46
47
|
|
|
@@ -209,6 +210,27 @@ def _text(node: Mapping[str, Any], key: str) -> str:
|
|
|
209
210
|
return v if isinstance(v, str) else ""
|
|
210
211
|
|
|
211
212
|
|
|
213
|
+
def _rect(b: Any) -> Optional[Tuple[int, int, int, int]]:
|
|
214
|
+
"""agent-desktop's bounds ({x, y, width, height}) as left, top, right, bottom; None unless all four are numbers."""
|
|
215
|
+
if not isinstance(b, dict):
|
|
216
|
+
return None
|
|
217
|
+
try:
|
|
218
|
+
x, y, w, h = (b[k] for k in ("x", "y", "width", "height"))
|
|
219
|
+
except KeyError:
|
|
220
|
+
return None
|
|
221
|
+
if not all(isinstance(v, (int, float)) and not isinstance(v, bool) for v in (x, y, w, h)) or w <= 0 or h <= 0:
|
|
222
|
+
return None
|
|
223
|
+
return int(round(x)), int(round(y)), int(round(x + w)), int(round(y + h))
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
def _secret_field(node: Mapping[str, Any]) -> bool:
|
|
227
|
+
"""A field whose text is not kept: one marked secure or protected, or one named or identified like a password."""
|
|
228
|
+
role = _text(node, "role").lower()
|
|
229
|
+
if "secure" in role or "password" in role or node.get("is_password") is True or node.get("protected") is True:
|
|
230
|
+
return True
|
|
231
|
+
return bool(re.search(r"pass(word|wd)?|pin|secret", f"{_text(node, 'name')} {_native_id(node)}", re.I))
|
|
232
|
+
|
|
233
|
+
|
|
212
234
|
def _walk(node: Any, ancestors: Tuple[Mapping[str, Any], ...] = (), depth: int = 0) -> Iterator[Tuple[Mapping[str, Any], Tuple[Mapping[str, Any], ...]]]:
|
|
213
235
|
if not isinstance(node, dict) or depth > 200:
|
|
214
236
|
return
|
|
@@ -591,6 +613,53 @@ class AgentDesktopDriver:
|
|
|
591
613
|
return out
|
|
592
614
|
return out
|
|
593
615
|
|
|
616
|
+
# Most controls asked for their bounds when a snapshot does not give them, and how long that may take.
|
|
617
|
+
BOUNDS_CALLS = 80
|
|
618
|
+
BOUNDS_SECONDS = 3.0
|
|
619
|
+
|
|
620
|
+
def controls_snapshot(self) -> Optional[Dict[str, Any]]:
|
|
621
|
+
"""
|
|
622
|
+
The first window's controls as its picture shows them (snapshot_boxes): from one snapshot, each control's bounds
|
|
623
|
+
from the snapshot when it gives them, else asked of its ref (at most BOUNDS_CALLS, within BOUNDS_SECONDS); a
|
|
624
|
+
control with neither is left out, and a password field's text is never kept. None when nothing can be read.
|
|
625
|
+
"""
|
|
626
|
+
if not self.pids:
|
|
627
|
+
return None
|
|
628
|
+
try:
|
|
629
|
+
windows = self._windows()
|
|
630
|
+
if not windows:
|
|
631
|
+
return None
|
|
632
|
+
win = _rect(windows[0].get("bounds"))
|
|
633
|
+
if win is None:
|
|
634
|
+
return None
|
|
635
|
+
snap = self._snapshot(windows[0]["id"])
|
|
636
|
+
items: List[Tuple[Tuple[int, int, int, int], Dict[str, str], str, bool]] = []
|
|
637
|
+
calls, started = 0, time.monotonic()
|
|
638
|
+
for node, _ in _walk(snap.get("tree")):
|
|
639
|
+
props = {"automation_id": _native_id(node), "name": plain(_text(node, "name"), 300), "control_type": control_type_of(_text(node, "role"))}
|
|
640
|
+
if not props["automation_id"] and not props["name"]:
|
|
641
|
+
continue
|
|
642
|
+
rect = _rect(node.get("bounds"))
|
|
643
|
+
ref = node.get("ref_id")
|
|
644
|
+
if rect is None and isinstance(ref, str) and REF.match(ref) and calls < self.BOUNDS_CALLS and time.monotonic() - started < self.BOUNDS_SECONDS:
|
|
645
|
+
calls += 1
|
|
646
|
+
try:
|
|
647
|
+
got = self._call("get", ref, "--property", "bounds")
|
|
648
|
+
rect = _rect(got.get("value") if isinstance(got, dict) else None)
|
|
649
|
+
except AgentDesktopError as e:
|
|
650
|
+
if not e.safe:
|
|
651
|
+
raise
|
|
652
|
+
if rect is None:
|
|
653
|
+
continue
|
|
654
|
+
password = _secret_field(node)
|
|
655
|
+
text = "" if password else plain(_text(node, "value") or _text(node, "name"), 300)
|
|
656
|
+
items.append((rect, props, text, password))
|
|
657
|
+
if len(items) >= SNAPSHOT_LIMIT:
|
|
658
|
+
break
|
|
659
|
+
return snapshot_boxes(win, items)
|
|
660
|
+
except Exception:
|
|
661
|
+
return None
|
|
662
|
+
|
|
594
663
|
def _capture(self, window: str) -> Optional[bytes]:
|
|
595
664
|
make_private(self.home)
|
|
596
665
|
fd, path = tempfile.mkstemp(suffix=".png", dir=self.home)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""The controls a step's picture shows, for choosing a check by clicking it: the same shape from either driver."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, Dict, List, Tuple
|
|
6
|
+
|
|
7
|
+
# Most controls a picture's list holds, and the longest text kept of one.
|
|
8
|
+
SNAPSHOT_LIMIT = 300
|
|
9
|
+
SNAPSHOT_TEXT = 300
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def snapshot_boxes(window: Tuple[int, int, int, int], items: List[Tuple[Tuple[int, int, int, int], Dict[str, str], str, bool]]) -> Dict[str, Any]:
|
|
13
|
+
"""
|
|
14
|
+
The controls a window's picture shows, for choosing a check by clicking it: each one's box relative to the window
|
|
15
|
+
(as the picture is), its plain properties, and the text it shows (never a password field's), only those inside
|
|
16
|
+
the window with a size.
|
|
17
|
+
"""
|
|
18
|
+
left, top, right, bottom = window
|
|
19
|
+
w, h = max(0, right - left), max(0, bottom - top)
|
|
20
|
+
out: List[Dict[str, Any]] = []
|
|
21
|
+
for (l, t, r, b), props, text, password in items:
|
|
22
|
+
x, y, bw, bh = l - left, t - top, r - l, b - t
|
|
23
|
+
if bw <= 0 or bh <= 0 or x < 0 or y < 0 or x + bw > w or y + bh > h:
|
|
24
|
+
continue
|
|
25
|
+
keep = {k: v[:SNAPSHOT_TEXT] for k, v in props.items() if k in ("automation_id", "name", "control_type") and isinstance(v, str) and v}
|
|
26
|
+
if not keep.get("automation_id") and not keep.get("name"):
|
|
27
|
+
continue
|
|
28
|
+
shown = "" if password else " ".join(str(text or "").split())[:SNAPSHOT_TEXT]
|
|
29
|
+
out.append({"x": x, "y": y, "w": bw, "h": bh, **keep, **({"text": shown} if shown else {})})
|
|
30
|
+
if len(out) >= SNAPSHOT_LIMIT:
|
|
31
|
+
break
|
|
32
|
+
return {"w": w, "h": h, "controls": out}
|
|
@@ -284,6 +284,43 @@ def handle_event(ev: tuple, uia: Any, recorder: HandRecorder, events: "queue.Que
|
|
|
284
284
|
return None
|
|
285
285
|
|
|
286
286
|
|
|
287
|
+
def shown_step(step: Dict[str, Any]) -> Dict[str, Any]:
|
|
288
|
+
"""A recorded step as the page shows it: what was done, to which control, and the text typed, chosen or checked."""
|
|
289
|
+
out = {k: v for k, v in step.items() if k in ("op", "target", "keys", "value")}
|
|
290
|
+
if "value" not in out and isinstance(step.get("text"), str):
|
|
291
|
+
out["value"] = step["text"]
|
|
292
|
+
return out
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
def changed_steps(steps: List[Dict[str, Any]], sent: Dict[int, Dict[str, Any]]) -> List[Dict[str, Any]]:
|
|
296
|
+
"""The steps after the launch that are new or changed since they were last sent (typing goes on in one step), each
|
|
297
|
+
with its 1-based index; ``sent`` is updated."""
|
|
298
|
+
out = []
|
|
299
|
+
for i in range(1, len(steps)):
|
|
300
|
+
shown = shown_step(steps[i])
|
|
301
|
+
if sent.get(i) != shown:
|
|
302
|
+
sent[i] = shown
|
|
303
|
+
out.append({"index": i + 1, **shown})
|
|
304
|
+
return out
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
class ShotQueue:
|
|
308
|
+
"""When to take each step's picture: a moment after the step is done or changes, so the app has drawn its result."""
|
|
309
|
+
|
|
310
|
+
def __init__(self, settle: float = 0.6) -> None:
|
|
311
|
+
self.settle = settle
|
|
312
|
+
self.due: Dict[int, float] = {}
|
|
313
|
+
|
|
314
|
+
def add(self, index: int, now: float) -> None:
|
|
315
|
+
self.due[index] = now + self.settle
|
|
316
|
+
|
|
317
|
+
def ready(self, now: float, all_of_them: bool = False) -> List[int]:
|
|
318
|
+
out = sorted(i for i, t in self.due.items() if all_of_them or t <= now)
|
|
319
|
+
for i in out:
|
|
320
|
+
del self.due[i]
|
|
321
|
+
return out
|
|
322
|
+
|
|
323
|
+
|
|
287
324
|
def record_by_hand(
|
|
288
325
|
driver: Any,
|
|
289
326
|
spec: Any,
|
|
@@ -292,6 +329,7 @@ def record_by_hand(
|
|
|
292
329
|
log: Callable[[str], None] = lambda s: None,
|
|
293
330
|
on_change: Callable[[Dict[str, Any]], None] = lambda e: None,
|
|
294
331
|
max_seconds: float = 3 * 3600,
|
|
332
|
+
on_shot: Optional[Callable[[int], None]] = None,
|
|
295
333
|
) -> str:
|
|
296
334
|
"""Start the app, record until the hotkey, the app closing, ``stop``, or ``max_seconds``; why it stopped."""
|
|
297
335
|
if sys.platform != "win32":
|
|
@@ -305,7 +343,13 @@ def record_by_hand(
|
|
|
305
343
|
hooks.start()
|
|
306
344
|
log(f"Recording {spec.name}: do the steps in the app. {CHECK_HINT} adds a check of the control under the mouse; {STOP_HINT} or closing the app stops.")
|
|
307
345
|
started = time.time()
|
|
308
|
-
|
|
346
|
+
# Each step as last sent to the page: one is sent again when it changes, not only when a step is added.
|
|
347
|
+
sent: Dict[int, Dict[str, Any]] = {}
|
|
348
|
+
changed_steps(recorder.steps, sent)
|
|
349
|
+
# Each step's picture a moment after it (the app started is step 1), when asked for.
|
|
350
|
+
shots = ShotQueue()
|
|
351
|
+
if on_shot is not None:
|
|
352
|
+
shots.add(1, time.time())
|
|
309
353
|
reason = "stopped"
|
|
310
354
|
last_alive = 0.0
|
|
311
355
|
try:
|
|
@@ -324,10 +368,12 @@ def record_by_hand(
|
|
|
324
368
|
if handle_event(ev, uia, recorder, events, log) == "stop":
|
|
325
369
|
reason = "hotkey"
|
|
326
370
|
break
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
371
|
+
for change in changed_steps(recorder.steps, sent):
|
|
372
|
+
on_change(change)
|
|
373
|
+
shots.add(change["index"], time.time())
|
|
374
|
+
if on_shot is not None:
|
|
375
|
+
for i in shots.ready(time.time()):
|
|
376
|
+
on_shot(i)
|
|
331
377
|
if time.time() - last_alive > 1.0:
|
|
332
378
|
last_alive = time.time()
|
|
333
379
|
try:
|
|
@@ -339,4 +385,8 @@ def record_by_hand(
|
|
|
339
385
|
break
|
|
340
386
|
finally:
|
|
341
387
|
hooks.stop()
|
|
388
|
+
# The last steps' pictures, before the app is closed (an app already closed has none to give).
|
|
389
|
+
if on_shot is not None and reason != "app closed":
|
|
390
|
+
for i in shots.ready(time.time(), all_of_them=True):
|
|
391
|
+
on_shot(i)
|
|
342
392
|
return reason
|
|
@@ -65,6 +65,9 @@ def _is_password(control: Any) -> bool:
|
|
|
65
65
|
return False
|
|
66
66
|
|
|
67
67
|
|
|
68
|
+
from .boxes import SNAPSHOT_LIMIT, snapshot_boxes # noqa: F401 (the picture's controls, shared with agent-desktop)
|
|
69
|
+
|
|
70
|
+
|
|
68
71
|
def foreground_owner() -> Optional[int]:
|
|
69
72
|
"""The process id owning the window in front, or None when it cannot be told."""
|
|
70
73
|
try:
|
|
@@ -399,6 +402,28 @@ class PywinautoDriver:
|
|
|
399
402
|
except Exception:
|
|
400
403
|
return None
|
|
401
404
|
|
|
405
|
+
def controls_snapshot(self) -> Optional[Dict[str, Any]]:
|
|
406
|
+
"""The top window's controls as its picture shows them (snapshot_boxes), or None when they cannot be read."""
|
|
407
|
+
if self.app is None:
|
|
408
|
+
return None
|
|
409
|
+
try:
|
|
410
|
+
win = self.app.top_window().wrapper_object()
|
|
411
|
+
r = win.rectangle()
|
|
412
|
+
items = []
|
|
413
|
+
for c in win.descendants()[: SNAPSHOT_LIMIT * 3]:
|
|
414
|
+
info = c.element_info
|
|
415
|
+
rc = info.rectangle
|
|
416
|
+
props = {"automation_id": info.automation_id or "", "name": info.name or "", "control_type": info.control_type or ""}
|
|
417
|
+
password = _is_password(c)
|
|
418
|
+
try:
|
|
419
|
+
text = "" if password else self.text_of(c)
|
|
420
|
+
except Exception:
|
|
421
|
+
text = ""
|
|
422
|
+
items.append(((rc.left, rc.top, rc.right, rc.bottom), props, text, password))
|
|
423
|
+
return snapshot_boxes((r.left, r.top, r.right, r.bottom), items)
|
|
424
|
+
except Exception:
|
|
425
|
+
return None
|
|
426
|
+
|
|
402
427
|
def close(self) -> None:
|
|
403
428
|
"""Close the app this driver started, and only that one: a polite close first, then terminate."""
|
|
404
429
|
if self.app is not None:
|