@capagents/forgeqe 2.10.2 → 2.10.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/dist/forgeqe.js +1670 -1664
- package/dist/web/assets/{Agent-CTa1NV2r.js → Agent-DyyAZPKr.js} +1 -1
- package/dist/web/assets/{ApiTests-myBc8YrX.js → ApiTests-p_cbulD4.js} +1 -1
- package/dist/web/assets/{Browse-DtPtOuC5.js → Browse-DOAlK-ox.js} +2 -2
- package/dist/web/assets/{Chat-CTM0o79z.js → Chat-BCV5OsEz.js} +1 -1
- package/dist/web/assets/{CommandPalette-Btn4nn-X.js → CommandPalette-o9PuLas2.js} +1 -1
- package/dist/web/assets/{Compare-CDUYhx9t.js → Compare-Bf1LhXmj.js} +1 -1
- package/dist/web/assets/{Cost-CNMDGRFw.js → Cost-r7D19VSG.js} +1 -1
- package/dist/web/assets/{Data-BMNUhONs.js → Data-CRttp4iM.js} +1 -1
- package/dist/web/assets/{Desktop-D--13188.js → Desktop-DcaKyfKA.js} +1 -1
- package/dist/web/assets/{DesktopReview-C2XKQ1ci.js → DesktopReview-BjplTYfH.js} +1 -1
- package/dist/web/assets/{Evidence-C52DZo6K.js → Evidence-BAAKcK0h.js} +1 -1
- package/dist/web/assets/{Explore-B8oOi-Y3.js → Explore-D_RZhVAc.js} +1 -1
- package/dist/web/assets/{Features-Cv7fC5_f.js → Features-B6azjGtN.js} +1 -1
- package/dist/web/assets/{Flags-_NaTDiaX.js → Flags-BQR4dRaK.js} +1 -1
- package/dist/web/assets/{Flaky-CWp3Mk2A.js → Flaky-Ci1bvglt.js} +1 -1
- package/dist/web/assets/{Impact-B3gXURFJ.js → Impact-CPB7NjQF.js} +1 -1
- package/dist/web/assets/{Jobs-CdPyMQOp.js → Jobs-CR8SxpWA.js} +1 -1
- package/dist/web/assets/{KindPage-3dMvQuEE.js → KindPage-Bl7q-2b8.js} +1 -1
- package/dist/web/assets/{Migration-CKBYH-pq.js → Migration-BecNlszU.js} +1 -1
- package/dist/web/assets/{Product-BD9yuHYw.js → Product-AMUC5arL.js} +1 -1
- package/dist/web/assets/{Production-DkNaydSw.js → Production-CZ-EG3t2.js} +1 -1
- package/dist/web/assets/{Quality-B6PbFqMj.js → Quality-k2U9v2Dn.js} +1 -1
- package/dist/web/assets/{Readiness-DB8pt7If.js → Readiness-D3_S6lDT.js} +1 -1
- package/dist/web/assets/Record-Ba6XRn7c.js +2 -0
- package/dist/web/assets/{Regression-CqQzw20T.js → Regression-jpkQRkt_.js} +1 -1
- package/dist/web/assets/{Reports-a_CffJt-.js → Reports-BHKtb9Oi.js} +1 -1
- package/dist/web/assets/{Response-DzfPu2JF.js → Response-CVNWGdun.js} +1 -1
- package/dist/web/assets/{RunDiff-D5gKeDXi.js → RunDiff-dbcFibiJ.js} +1 -1
- package/dist/web/assets/{Runs-Dm5ANo6L.js → Runs-ij-80l3A.js} +1 -1
- package/dist/web/assets/{TestCases-BerwP4i-.js → TestCases-BW8laQ_8.js} +1 -1
- package/dist/web/assets/{TestData-BsIjvM8N.js → TestData-0f1XzLdc.js} +1 -1
- package/dist/web/assets/{TestDebt-nOu8lr8e.js → TestDebt-C-2y3RTV.js} +1 -1
- package/dist/web/assets/{Tosca-fyYkjQXv.js → Tosca-DnfpS6Zf.js} +1 -1
- package/dist/web/assets/{WhatsNew-DhfMzlEe.js → WhatsNew-C1HUalPw.js} +1 -1
- package/dist/web/assets/{dataParts-C45wq7v3.js → dataParts-DWD2uUxL.js} +1 -1
- package/dist/web/assets/{fold-Dwt3UNdL.js → fold-o_l3hXTU.js} +1 -1
- package/dist/web/assets/{frame-ssoXyr9G.js → frame-CdUL-UeQ.js} +2 -2
- package/dist/web/assets/{index-LKB05P1m.js → index-BmJOj6t1.js} +4 -4
- package/dist/web/assets/index-DP3riJZe.css +2 -0
- package/dist/web/assets/{logos-DioTVxSG.js → logos-CMkTgBD8.js} +1 -1
- package/dist/web/assets/{palette-NCegHokQ.js → palette-D-wSuihi.js} +1 -1
- package/dist/web/assets/{qualityParts-Dz6WY4Dd.js → qualityParts-DS83Q0nG.js} +1 -1
- package/dist/web/assets/{rows-CEQ3pIjG.js → rows-DYYObxPx.js} +1 -1
- package/dist/web/assets/{thread-Bv6FCIE3.js → thread-Cnjdo5ve.js} +1 -1
- package/dist/web/assets/{usePageChat-DJh3XRM-.js → usePageChat-DWmmQrbC.js} +1 -1
- package/dist/web/index.html +3 -3
- package/package.json +1 -1
- package/py/forgeqe_engine/memory.py +10 -2
- package/py/forgeqe_engine/recordsession.py +33 -1
- package/py/forgeqe_engine/varying.py +120 -0
- package/py/forgeqe_engine/webrecord.py +19 -1
- package/py/forgeqe_engine/webrecord_page.py +7 -1
- package/py/forgeqe_engine/workflow_yaml.py +18 -1
- package/dist/web/assets/Record-CrdwIExv.js +0 -2
- package/dist/web/assets/index-CnfjkjcU.css +0 -2
|
@@ -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{B as p,Nt as m,R as h,Zt as g,a as _,c as v,f as y,h as b,t as x}from"./filters-CflRmNDz.js";import{nt as S}from"./frame-ssoXyr9G.js";import{n as C,o as w}from"./markdown-nTIj9lyp.js";import{r as T}from"./index-LKB05P1m.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};
|
|
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,Nt as m,R as h,Zt as g,a as _,c as v,f as y,h as b,t as x}from"./filters-CflRmNDz.js";import{nt as S}from"./frame-CdUL-UeQ.js";import{n as C,o as w}from"./markdown-nTIj9lyp.js";import{r as T}from"./index-BmJOj6t1.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Xn as e}from"./line-icons-CQ-3V8ax.js";import{B as t,V as n,Zt as r,c as i,f as a,h as o}from"./filters-CflRmNDz.js";import{r as s}from"./index-
|
|
1
|
+
import{Xn as e}from"./line-icons-CQ-3V8ax.js";import{B as t,V as n,Zt as r,c as i,f as a,h as o}from"./filters-CflRmNDz.js";import{r as s}from"./index-BmJOj6t1.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};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Gt as e,Zt as t}from"./frame-
|
|
1
|
+
import{Gt as e,Zt as t}from"./frame-CdUL-UeQ.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`:{let t=r(n(e.result).status);return e.error?f(`fail`,`✗ **Test not written**${a(e.ms)}: ${o(r(e.error),240)}`):!t||t===`passed`?f(`ok`,`✓ **Test written**${a(e.ms)}`):t===`stopped`?f(`warn`,`**Test writing stopped**${a(e.ms)}`):f(`fail`,`✗ **Test not finished**${a(e.ms)} (${o(t,40)})`)}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{st as n}from"./filters-CflRmNDz.js";import{n as r}from"./thread-
|
|
1
|
+
import{Ir as e,Nr as t}from"./line-icons-CQ-3V8ax.js";import{st as n}from"./filters-CflRmNDz.js";import{n as r}from"./thread-Cnjdo5ve.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,12 +5,12 @@
|
|
|
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-BmJOj6t1.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/line-icons-CQ-3V8ax.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/filters-CflRmNDz.js">
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/frame-
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/frame-CdUL-UeQ.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/markdown-nTIj9lyp.js">
|
|
13
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
13
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DP3riJZe.css">
|
|
14
14
|
</head>
|
|
15
15
|
<body>
|
|
16
16
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capagents/forgeqe",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.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": {
|
|
@@ -70,6 +70,10 @@ BASE = {
|
|
|
70
70
|
STRONG = ("test_id", "id", "name", "role", "label", "placeholder", "href")
|
|
71
71
|
INDEXED = (*STRONG, "xpath")
|
|
72
72
|
GENERATED_FACTOR = 0.4
|
|
73
|
+
# A value seen to be different on another load of the same page (varying.py): proof, where "generated" is a guess from
|
|
74
|
+
# what the value looks like, so it reads further down. Applied in confidence(), not folded into base, so a locator
|
|
75
|
+
# re-read on a later visit is read down once however often it is seen.
|
|
76
|
+
VARIES_FACTOR = 0.2
|
|
73
77
|
|
|
74
78
|
_GENERATED = (
|
|
75
79
|
re.compile(r"\d{4,}"),
|
|
@@ -441,7 +445,9 @@ def confidence(loc: Dict[str, Any]) -> int:
|
|
|
441
445
|
stability = (0.75 + 0.25 * min(seen, 4) / 4) * (seen / (seen + missed))
|
|
442
446
|
ok, bad = int(loc.get("success") or 0), int(loc.get("failure") or 0)
|
|
443
447
|
reliability = (ok + 1) / (ok + bad + 1)
|
|
444
|
-
|
|
448
|
+
# Seen holding another value on another load of this page: what it finds now says nothing about the next run.
|
|
449
|
+
fresh = VARIES_FACTOR if loc.get("varies") else 1.0
|
|
450
|
+
return max(1, min(99, round(100 * float(loc.get("base") or 0.3) * unique * stability * reliability * fresh)))
|
|
445
451
|
|
|
446
452
|
|
|
447
453
|
def rank(locs: Iterable[Dict[str, Any]]) -> List[Dict[str, Any]]:
|
|
@@ -454,7 +460,9 @@ def rank(locs: Iterable[Dict[str, Any]]) -> List[Dict[str, Any]]:
|
|
|
454
460
|
|
|
455
461
|
|
|
456
462
|
def _public_locator(loc: Dict[str, Any]) -> Dict[str, Any]:
|
|
457
|
-
|
|
463
|
+
# "generated" (a framework's id or hash) and "live_data" (a name holding a price, a date, an order number) say why
|
|
464
|
+
# a locator scored low: kept so the review can say so and the coding agent is not misled by a tick.
|
|
465
|
+
keep = ("type", "value", "playwright", "confidence", "verified", "role", "name", "css", "attr", "generated", "live_data", "varies")
|
|
458
466
|
return {k: loc[k] for k in keep if k in loc}
|
|
459
467
|
|
|
460
468
|
|
|
@@ -33,6 +33,7 @@ from typing import Any, Awaitable, Callable, Dict, List, Optional, Tuple
|
|
|
33
33
|
from .capture import capture_element, locate_check
|
|
34
34
|
from .memory import BASE, KEPT_ATTRS, candidate_locators, confidence, looks_generated, state_class, within_locator
|
|
35
35
|
from . import dynamic
|
|
36
|
+
from .varying import SeenElements, mark as mark_varying
|
|
36
37
|
from .webrecord import CAPTCHA_FRAMES, MAX_SCROLL_END, MAX_UPLOAD_FILES, Target, WebRecorder, auto_name, captcha_of, describe, download_name, keep_upload, secret_env_for, upload_path
|
|
37
38
|
from .webrecord_page import recorder_js
|
|
38
39
|
|
|
@@ -145,6 +146,10 @@ class RecordSession:
|
|
|
145
146
|
self.shadow_key = secrets.token_hex(12)
|
|
146
147
|
self.binding = f"__fqe_{tag}"
|
|
147
148
|
self.pages: Dict[str, Dict[str, Any]] = {}
|
|
149
|
+
# What each element of each page looked like the load before, so a value the page makes fresh is seen for what
|
|
150
|
+
# it is (varying.py), not guessed at from its shape. Counted up on every load of a tab's own page.
|
|
151
|
+
self.seen = SeenElements()
|
|
152
|
+
self._load = 0
|
|
148
153
|
# Cross-origin frames: each one Chrome runs as a target of its own (an out-of-process iframe), by its session,
|
|
149
154
|
# with the session it was found in (its parent) and the tab it belongs to.
|
|
150
155
|
self.frames: Dict[str, Dict[str, Any]] = {}
|
|
@@ -674,6 +679,10 @@ class RecordSession:
|
|
|
674
679
|
page["frame"] = frame.get("id") or page.get("frame")
|
|
675
680
|
page["ctx"] = None
|
|
676
681
|
url = str(frame.get("url") or "")
|
|
682
|
+
# A load of this tab's own page: an element read after it is read on a later load than one read before it,
|
|
683
|
+
# which is what tells a value the page made fresh from one that held (varying.py).
|
|
684
|
+
self._load += 1
|
|
685
|
+
page["load"] = self._load
|
|
677
686
|
# A page loaded in the tab the video follows: Chrome drops a screencast when the tab moves to another
|
|
678
687
|
# process (the first page of a site, often), so it is asked for again.
|
|
679
688
|
if self.video is not None and sid == self._video_sid:
|
|
@@ -975,7 +984,30 @@ class RecordSession:
|
|
|
975
984
|
elif anchored and not any(l.get("verified") and l.get("matches") == 1 and l.get("type") in STRONG_ALONE for l in target.locators):
|
|
976
985
|
locs = sorted(target.locators + [anchored], key=lambda l: (not l.get("verified"), -int(l.get("confidence") or 0)))
|
|
977
986
|
target = Target(target.url, target.facts, locs, target.frames, closed_shadow=target.closed_shadow)
|
|
978
|
-
|
|
987
|
+
target = await self._steady(sid, target, data.get("matches") if isinstance(data.get("matches"), dict) else {}, ctx=ctx)
|
|
988
|
+
return self._varying(sid, target)
|
|
989
|
+
|
|
990
|
+
def _varying(self, sid: str, t: Target) -> Target:
|
|
991
|
+
"""
|
|
992
|
+
Locators whose value this page made fresh. The same element was read on an earlier load of the same address
|
|
993
|
+
and held another id, another name, another message: that is not a guess about what the value looks like
|
|
994
|
+
(dynamic.py), it is the value seen being different, so the locator is marked and read down (memory.py
|
|
995
|
+
confidence). The first sight of an element marks nothing; nor does a page loaded only once.
|
|
996
|
+
"""
|
|
997
|
+
load = int((self.pages.get(sid) or {}).get("load") or 0)
|
|
998
|
+
try:
|
|
999
|
+
kinds = self.seen.compare(t.url, load, t.facts, t.locators, t.frames)
|
|
1000
|
+
except Exception as ex:
|
|
1001
|
+
logger.debug("record: elements of this page not compared with the load before: %s", ex)
|
|
1002
|
+
return t
|
|
1003
|
+
if not mark_varying(t.locators, kinds):
|
|
1004
|
+
return t
|
|
1005
|
+
logger.debug("record: %s made fresh on this load, for %s", ", ".join(sorted(kinds)), t.facts.get("name") or t.facts.get("tag"))
|
|
1006
|
+
for loc in t.locators:
|
|
1007
|
+
if loc.get("varies"):
|
|
1008
|
+
loc["confidence"] = confidence(loc)
|
|
1009
|
+
locs = sorted(t.locators, key=lambda l: (not l.get("verified"), bool(l.get("varies")), bool(l.get("live_data")), -int(l.get("confidence") or 0)))
|
|
1010
|
+
return Target(t.url, t.facts, locs, t.frames, closed_shadow=t.closed_shadow)
|
|
979
1011
|
|
|
980
1012
|
async def _shows(self, sid: str, backend: int) -> bool:
|
|
981
1013
|
"""Whether an element shows on the page now (it has a box); True when it cannot tell."""
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Values a page makes fresh on every load: an id a framework generates ("Challenging DOM"), a label that reads like an
|
|
3
|
+
ordinary name but is different each time, a message picked at random from a few ("Notification Message").
|
|
4
|
+
|
|
5
|
+
``dynamic.py`` reads one value and sees what *looks* like data: a price, a date, an order number. It cannot see a
|
|
6
|
+
random id that looks like a word, or a message that is a plain sentence. This reads the same element on two loads of
|
|
7
|
+
the same page and sees what *is* different, whatever it looks like. That is evidence, not a guess, so a locator it
|
|
8
|
+
marks is trusted less than one ``dynamic.py`` only suspects.
|
|
9
|
+
|
|
10
|
+
- ``identity(facts, frames)``: what names one element across loads, from the parts a page does not make fresh.
|
|
11
|
+
- ``SeenElements.compare(...)``: the kinds whose value differs from the load before, for one element.
|
|
12
|
+
|
|
13
|
+
Nothing here reaches a page or a browser: it is given the facts a load read and answers from what it was given before.
|
|
14
|
+
"""
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import hashlib
|
|
18
|
+
import json
|
|
19
|
+
from typing import Any, Dict, List, Optional, Sequence, Set, Tuple
|
|
20
|
+
|
|
21
|
+
# A kind that holds one value for one element on one load: a second value on another load of the same page is proof
|
|
22
|
+
# the page makes it fresh. "role" carries the element's accessible name after a "|", so a name that changes shows here.
|
|
23
|
+
VARYING_KINDS: Tuple[str, ...] = ("id", "test_id", "name", "href", "role", "label", "placeholder", "text", "title", "alt", "css")
|
|
24
|
+
# A pattern locator is cut from this load's name or text (recordsession.py _steady): when that varies, the stem it was
|
|
25
|
+
# cut from varies with it, so it is marked too.
|
|
26
|
+
FOLLOWS: Dict[str, str] = {"role": "role_pattern", "text": "text_pattern"}
|
|
27
|
+
# How many elements one recording keeps, and how long a value is kept for comparing.
|
|
28
|
+
MAX_SEEN = 500
|
|
29
|
+
MAX_VALUE = 300
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def page_key(url: str) -> str:
|
|
33
|
+
"""
|
|
34
|
+
The page an element was on, as this compares them: the exact address without its fragment. Not the page template
|
|
35
|
+
(memory.py page_id), which would put /item/1 and /item/2 together and read one item's own name as a name that
|
|
36
|
+
changes. Only the same address loaded again is compared.
|
|
37
|
+
"""
|
|
38
|
+
u = str(url or "").strip()
|
|
39
|
+
if not u:
|
|
40
|
+
return ""
|
|
41
|
+
return u.split("#", 1)[0][:1000]
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def identity(facts: Dict[str, Any], frames: Optional[Sequence[Dict[str, Any]]] = None) -> str:
|
|
45
|
+
"""
|
|
46
|
+
What names one element across loads of a page, built only from parts a page does not make fresh: where it sits
|
|
47
|
+
(its XPath), what it is (its tag) and what it does (its role). Its id, its name and its text are left out — those
|
|
48
|
+
are the values being judged. Empty when there is no XPath to place it by (inside a shadow root), so nothing is
|
|
49
|
+
compared and nothing is guessed.
|
|
50
|
+
"""
|
|
51
|
+
xpath = str(facts.get("xpath") or "")
|
|
52
|
+
if not xpath:
|
|
53
|
+
return ""
|
|
54
|
+
where = [str((f or {}).get("index", "")) + ":" + str((f or {}).get("name") or (f or {}).get("id") or "") for f in (frames or [])]
|
|
55
|
+
basis = json.dumps([xpath, str(facts.get("tag") or ""), str(facts.get("role") or ""), where], sort_keys=True)
|
|
56
|
+
return hashlib.sha256(basis.encode("utf-8")).hexdigest()[:16]
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def values_of(locators: Sequence[Dict[str, Any]]) -> Dict[str, str]:
|
|
60
|
+
"""The one value each varying kind has on this load, for the kinds this element has a locator of."""
|
|
61
|
+
out: Dict[str, str] = {}
|
|
62
|
+
for loc in locators or []:
|
|
63
|
+
kind, value = loc.get("type"), loc.get("value")
|
|
64
|
+
if kind in VARYING_KINDS and isinstance(value, str) and value and kind not in out:
|
|
65
|
+
out[kind] = value[:MAX_VALUE]
|
|
66
|
+
return out
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def mark(locators: List[Dict[str, Any]], kinds: Set[str]) -> bool:
|
|
70
|
+
"""
|
|
71
|
+
Marks every locator of a kind that varies, and the pattern locator cut from it. Returns whether anything changed.
|
|
72
|
+
The locator keeps its base: what the kind is worth is unchanged, and `varies` is what reads it down (memory.py
|
|
73
|
+
confidence), so marking twice says the same thing as marking once.
|
|
74
|
+
"""
|
|
75
|
+
if not kinds:
|
|
76
|
+
return False
|
|
77
|
+
follows = {FOLLOWS[k] for k in kinds if k in FOLLOWS}
|
|
78
|
+
changed = False
|
|
79
|
+
for loc in locators:
|
|
80
|
+
if loc.get("type") in kinds or loc.get("type") in follows:
|
|
81
|
+
if not loc.get("varies"):
|
|
82
|
+
loc["varies"] = True
|
|
83
|
+
changed = True
|
|
84
|
+
return changed
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class SeenElements:
|
|
88
|
+
"""
|
|
89
|
+
What each element of each page looked like the last time this recording loaded that page. One recording's own: it
|
|
90
|
+
is never written to disk and never read back, so nothing a person could edit reaches it.
|
|
91
|
+
"""
|
|
92
|
+
|
|
93
|
+
def __init__(self, limit: int = MAX_SEEN) -> None:
|
|
94
|
+
self._seen: Dict[Tuple[str, str], Dict[str, Any]] = {}
|
|
95
|
+
self._limit = limit
|
|
96
|
+
|
|
97
|
+
def compare(self, url: str, load: int, facts: Dict[str, Any], locators: Sequence[Dict[str, Any]], frames: Optional[Sequence[Dict[str, Any]]] = None) -> Set[str]:
|
|
98
|
+
"""
|
|
99
|
+
The kinds whose value differs from the last load of this page, and remembers this load's values. Empty on the
|
|
100
|
+
first sight of an element, when the page has not been loaded again since (the same load answers nothing), and
|
|
101
|
+
when the element cannot be placed across loads.
|
|
102
|
+
"""
|
|
103
|
+
page = page_key(url)
|
|
104
|
+
who = identity(facts or {}, frames)
|
|
105
|
+
if not page or not who:
|
|
106
|
+
return set()
|
|
107
|
+
key = (page, who)
|
|
108
|
+
now = values_of(locators)
|
|
109
|
+
was = self._seen.get(key)
|
|
110
|
+
self._seen[key] = {"load": load, "values": now}
|
|
111
|
+
if len(self._seen) > self._limit:
|
|
112
|
+
self._seen.pop(next(iter(self._seen)), None)
|
|
113
|
+
if not was or was.get("load") == load:
|
|
114
|
+
# The same load says nothing: one element read twice is the same read twice.
|
|
115
|
+
return set()
|
|
116
|
+
before = was.get("values") or {}
|
|
117
|
+
# Kinds the element had on both loads, with a different value on each.
|
|
118
|
+
varies = {k for k, v in now.items() if k in before and before[k] != v}
|
|
119
|
+
# A kind it had before and has no longer is not proof: the page may simply not write it this time.
|
|
120
|
+
return varies
|
|
@@ -236,7 +236,9 @@ def element_step(op: str, t: Target) -> Dict[str, Any]:
|
|
|
236
236
|
**({"position": dict(t.position)} if t.position else {}),
|
|
237
237
|
**({"shadow": "closed"} if t.closed_shadow else {}),
|
|
238
238
|
"locators": [
|
|
239
|
-
|
|
239
|
+
# generated/live_data: why this one scored low (a framework's id, a name holding data that changes). The
|
|
240
|
+
# review shows it on the step and the handoff never offers it to the coding agent as a safe one.
|
|
241
|
+
{"type": l["type"], "value": l["value"], "confidence": l.get("confidence"), **{k: l[k] for k in ("css", "attr", "verified", "within", "generated", "live_data", "varies") if l.get(k)}}
|
|
240
242
|
for l in locs
|
|
241
243
|
if l.get("type") and l.get("value")
|
|
242
244
|
],
|
|
@@ -247,6 +249,16 @@ def element_step(op: str, t: Target) -> Dict[str, Any]:
|
|
|
247
249
|
}
|
|
248
250
|
|
|
249
251
|
|
|
252
|
+
# Locator kinds that carry what an element says: when one of these was seen holding other words on another load of the
|
|
253
|
+
# same page, the words themselves are what changed, not only the way the element is found.
|
|
254
|
+
_SAYS = ("text", "text_pattern", "role", "role_pattern", "label", "title", "alt")
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
def _varies_text(t: Target) -> bool:
|
|
258
|
+
"""Whether this element said something else when the recording loaded the same page again (varying.py)."""
|
|
259
|
+
return any(l.get("varies") and l.get("type") in _SAYS for l in t.locators)
|
|
260
|
+
|
|
261
|
+
|
|
250
262
|
def auto_name(steps: List[Dict[str, Any]], start_url: str, limit: int = 4) -> str:
|
|
251
263
|
"""
|
|
252
264
|
A recording's name when the tester gave none: the site, then what was done, in the words of the controls used
|
|
@@ -740,6 +752,12 @@ class WebRecorder:
|
|
|
740
752
|
if made is not None:
|
|
741
753
|
step["text"] = made["text"]
|
|
742
754
|
elif kind in ("text", "value") and text:
|
|
755
|
+
# The page showed something else here when the recording loaded it again (varying.py): a message picked at
|
|
756
|
+
# random, a greeting that rotates. A check that spells out this load's words fails on the next, whatever
|
|
757
|
+
# the words look like, so it is live data even where dynamic.py finds nothing data-shaped in them.
|
|
758
|
+
if t is not None and _varies_text(t):
|
|
759
|
+
step["varies"] = True
|
|
760
|
+
dynamic = True
|
|
743
761
|
self._live(step, text, explicit=dynamic)
|
|
744
762
|
step["source"] = source
|
|
745
763
|
self._add(step)
|
|
@@ -767,8 +767,11 @@ RECORDER_JS = r"""(() => {
|
|
|
767
767
|
};
|
|
768
768
|
// A canvas has no elements in it: where in it the click landed is the step, as Playwright's recorder keeps it
|
|
769
769
|
// (locator.click({ position })), in the canvas's own pixels from its top left corner.
|
|
770
|
+
// Blank space of a box that holds controls (a click outside a menu to close it): the replay clicks the same place,
|
|
771
|
+
// never the box's middle, where a control may be.
|
|
772
|
+
const blankOf = (c) => !!c && c.nodeType === 1 && !actionable(c) && !!c.querySelector('a[href], button, input, select, textarea, [role=button], [role=link], [onclick]');
|
|
770
773
|
const where = (c, ev) => {
|
|
771
|
-
if (!c || c.tagName !== 'CANVAS') return {};
|
|
774
|
+
if (!c || (c.tagName !== 'CANVAS' && !blankOf(c))) return {};
|
|
772
775
|
const r = c.getBoundingClientRect();
|
|
773
776
|
return { position: { x: Math.round(ev.clientX - r.left), y: Math.round(ev.clientY - r.top) } };
|
|
774
777
|
};
|
|
@@ -791,6 +794,9 @@ RECORDER_JS = r"""(() => {
|
|
|
791
794
|
if (paused) return;
|
|
792
795
|
const c = control(deep(ev));
|
|
793
796
|
if (!c || c.tagName === 'OPTION' || c.tagName === 'SELECT') return;
|
|
797
|
+
// A click on the page itself (to leave a field, or the one Chrome sends when an option of a select list's own list
|
|
798
|
+
// is chosen): no step. A replay clicking the page would land on whatever is in its middle.
|
|
799
|
+
if (c === document.documentElement || c === document.body) return;
|
|
794
800
|
// A click on a label also clicks its control: one step.
|
|
795
801
|
if (lastLabel && lastLabel.control === c && Date.now() - lastLabel.at < 100) return;
|
|
796
802
|
if (c.tagName === 'LABEL') lastLabel = { control: c.control, at: Date.now() };
|
|
@@ -18,6 +18,23 @@ from typing import Any, Dict, List, Optional
|
|
|
18
18
|
|
|
19
19
|
import yaml
|
|
20
20
|
|
|
21
|
+
# A text a YAML 1.2 reader (ForgeQE's own, in TypeScript) would take for a number: written quoted. PyYAML quotes only what
|
|
22
|
+
# YAML 1.1 reads as one, so a step's picture "008" was written bare and read back as the number 8.
|
|
23
|
+
_NUMBER_12 = re.compile(r"[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?|0o[0-7]+|0x[0-9a-fA-F]+|[-+]?\.(inf|Inf|INF)|\.(nan|NaN|NAN)")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class _PlainTextDumper(yaml.Dumper):
|
|
27
|
+
pass
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _text(dumper: yaml.Dumper, value: str) -> yaml.Node:
|
|
31
|
+
if _NUMBER_12.fullmatch(value):
|
|
32
|
+
return dumper.represent_scalar("tag:yaml.org,2002:str", value, style="'")
|
|
33
|
+
return dumper.represent_str(value)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
_PlainTextDumper.add_representer(str, _text)
|
|
37
|
+
|
|
21
38
|
logger = logging.getLogger(__name__)
|
|
22
39
|
|
|
23
40
|
FORMAT_V2_COMPACT = "forgeqe-v2-compact"
|
|
@@ -682,7 +699,7 @@ def save_browser_use_run_yaml(
|
|
|
682
699
|
doc["history"] = serialize_browser_use_history(history)
|
|
683
700
|
try:
|
|
684
701
|
with open(path, "w", encoding="utf-8") as f:
|
|
685
|
-
yaml.dump(doc, f, default_flow_style=False, allow_unicode=True, sort_keys=False)
|
|
702
|
+
yaml.dump(doc, f, Dumper=_PlainTextDumper, default_flow_style=False, allow_unicode=True, sort_keys=False)
|
|
686
703
|
return str(path.resolve()), compact_steps
|
|
687
704
|
except Exception as e:
|
|
688
705
|
logger.warning("Could not save the workflow YAML: %s", e)
|