@capagents/forgeqe 2.7.5 → 2.7.6
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 +23 -0
- package/dist/docs-site/docs/index.html +17 -0
- package/dist/docs-site/docs/search.js +1 -1
- package/dist/forgeqe.js +1562 -1555
- package/dist/web/assets/Agent-BfZX7pM9.js +4 -0
- package/dist/web/assets/ApiTests-l_CkazdD.js +10 -0
- package/dist/web/assets/{Chat-DzcXQtRU.js → Chat-BSUVZdh2.js} +3 -3
- package/dist/web/assets/{CommandPalette-BPUcuL1R.js → CommandPalette-Ckz1AQJT.js} +1 -1
- package/dist/web/assets/{Data-ZQmWEw-T.js → Data-Ig_7x4WD.js} +3 -3
- package/dist/web/assets/Evidence-DsllYNNx.js +1 -0
- package/dist/web/assets/Features-IqPqXkST.js +1 -0
- package/dist/web/assets/{ForceGraph-oAsEGwQc.js → ForceGraph-CiIze1T6.js} +1 -1
- package/dist/web/assets/Impact-CLjFt7ih.js +1 -0
- package/dist/web/assets/Jobs-F4TIPvJk.js +5 -0
- package/dist/web/assets/KindPage-Dq6eGmG4.js +6 -0
- package/dist/web/assets/Migration-Cg6Cm_Gu.js +2 -0
- package/dist/web/assets/{Product-DE2i4GjQ.js → Product-osDkLGGT.js} +2 -2
- package/dist/web/assets/{Quality-BPS1A75g.js → Quality-BaX3Y0fL.js} +1 -1
- package/dist/web/assets/Record-CkGdISSf.js +2 -0
- package/dist/web/assets/{Regression-krYLUFdO.js → Regression-CpQr6snz.js} +3 -3
- package/dist/web/assets/{Reports-Bl3L0zPe.js → Reports-W8H8OB95.js} +2 -2
- package/dist/web/assets/{Response-C66KATyo.js → Response-B4iQEi_e.js} +2 -2
- package/dist/web/assets/Runs-Cl9PEJRv.js +2 -0
- package/dist/web/assets/Shell-8Y6stc_6.js +4 -0
- package/dist/web/assets/TestCases-th8t2FcZ.js +1 -0
- package/dist/web/assets/TestData-B3UImTlO.js +2 -0
- package/dist/web/assets/Tosca-Cu9NyPOL.js +2 -0
- package/dist/web/assets/{WhatsNew-Cix_kO-M.js → WhatsNew-CpysE5Dt.js} +1 -1
- package/dist/web/assets/{dataParts-DGQaavWq.js → dataParts-D_SP2_Pw.js} +2 -2
- package/dist/web/assets/{families-DWe5Tf6V.js → families-BGEp9m2k.js} +1 -1
- package/dist/web/assets/index-DuWTO5cE.js +45 -0
- package/dist/web/assets/index-X6LBvWis.css +2 -0
- package/dist/web/assets/{logos-UHk_LNd_.js → logos-C0_O1u21.js} +1 -1
- package/dist/web/assets/{parts-6yv4V1GV.js → parts-ByBgA7Hv.js} +1 -1
- package/dist/web/assets/{productParts-DlC0tpuk.js → productParts-BFrJx-M5.js} +1 -1
- package/dist/web/assets/{qualityParts-BSTx-oHr.js → qualityParts-BNNpjvm6.js} +1 -1
- package/dist/web/assets/{segmented-7nur8ck_.js → segmented-CD8WWurO.js} +1 -1
- package/dist/web/assets/{thread-RtF8vcSJ.js → thread-Dy_QsQDd.js} +1 -1
- package/dist/web/assets/{usePageChat-Btkpy-DG.js → usePageChat-DhO0cBVa.js} +1 -1
- package/dist/web/index.html +3 -3
- package/docs/user-guide.html +17 -0
- package/package.json +1 -1
- package/py/forgeqe_engine/cli.py +3 -0
- package/py/forgeqe_engine/logins.py +74 -0
- package/py/forgeqe_engine/neutral_log.py +61 -0
- package/py/forgeqe_engine/service.py +3 -1
- package/py/forgeqe_mobile/appium_driver.py +5 -0
- package/py/forgeqe_mobile/explore.py +23 -2
- package/dist/web/assets/Agent-DX2q9LmG.js +0 -4
- package/dist/web/assets/ApiTests-Cup02reL.js +0 -10
- package/dist/web/assets/Evidence-B6VB0N8L.js +0 -1
- package/dist/web/assets/Features-jvyThbaa.js +0 -1
- package/dist/web/assets/Impact-BWERCZIN.js +0 -1
- package/dist/web/assets/Jobs-bbs9Yh-0.js +0 -5
- package/dist/web/assets/KindPage-E4XiuZKL.js +0 -6
- package/dist/web/assets/Migration-CQmzKn1a.js +0 -2
- package/dist/web/assets/Record-Ch5qKyuS.js +0 -2
- package/dist/web/assets/Runs-Bq23Zfkc.js +0 -2
- package/dist/web/assets/Shell-2xDxqPtD.js +0 -4
- package/dist/web/assets/TestCases-DvusfxET.js +0 -1
- package/dist/web/assets/TestData-Y9MWzPfm.js +0 -2
- package/dist/web/assets/Tosca-DPI6ewM-.js +0 -2
- package/dist/web/assets/index-CAbuIKyt.js +0 -45
- package/dist/web/assets/index-Dj77NVTf.css +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$i as e,$t as t,At as n,Ga as r,Hr as i,Ln as a,Oi as o,Q as s,Qi as c,Tn as l,Zt as u,ao as d,at as f,co as p,ea as m,jn as h,lt as g,mt as _,ro as v,rr as y,tn as b}from"./Shell-2xDxqPtD.js";import{c as x,f as S,r as C}from"./index-CAbuIKyt.js";var w=p(d(),1),T=v(),E=[`critical`,`serious`,`moderate`,`minor`],D={critical:`fail`,serious:`fail`,moderate:`warn`,minor:`neutral`},O=[{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`}],k={same:{label:`Same`,tone:`pass`},changed:{label:`Changed`,tone:`warn`},new:{label:`New baseline`,tone:`neutral`},no_baseline:{label:`No baseline`,tone:`neutral`}},A=e=>new Date(e).toLocaleString([],{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}),j=(e,t)=>t?e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`:e.toFixed(3).replace(/0+$/,``).replace(/\.$/,``),M=(e,t)=>`${e} ${t}${e===1?``:`s`}`,N=e=>e.replace(/(data:[\w/+.-]+;base64,)[A-Za-z0-9+/=]{24,}/g,`$1…`),P=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}},F=e=>!!(e.breaches||e.a11y?.failed||e.perf.over||e.visual?.changed);function I({run:e,standard:t,disclaimer:n}){let r=e.report,[i,a]=(0,w.useState)(new Set),[o,c]=(0,w.useState)(`all`),[u,d]=(0,w.useState)(!1);if(!r?.accessibility.pages)return(0,T.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 f=r.accessibility,p=r.breaches.filter(e=>e.kind===`accessibility`),m=f.failed.filter(e=>o===`all`||e.impact===o).sort((e,t)=>E.indexOf(e.impact)-E.indexOf(t.impact)||t.count-e.count),h=e=>{let t=new Set(i);t.has(e)?t.delete(e):t.add(e),a(t)};return(0,T.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,T.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[t,` with `,r.engine||`axe`,` on `,M(f.pages,`page`),`: `,(0,T.jsxs)(`span`,{className:`text-pass`,children:[M(f.passed.length,`rule`),` passed`]}),`, `,(0,T.jsxs)(`span`,{className:f.failed.length?`text-fail`:``,children:[f.failed.length,` failed`]}),`.`,` `,r.budgets.accessibility?p.length?`${M(p.length,`budget`)} exceeded.`:`Within the budget.`:`No budget set, so nothing here fails the run.`]}),p.map((e,t)=>(0,T.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 · `,P(e.page),`: `,e.text]},t)),f.failed.length>0&&(0,T.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,T.jsx)(`div`,{role:`group`,"aria-label":`Impact`,className:`flex flex-wrap gap-1`,children:[`all`,...E].map(e=>{let t=e===`all`?f.failed.length:f.failed.filter(t=>t.impact===e).length;return e!==`all`&&!t?null:(0,T.jsxs)(`button`,{type:`button`,"aria-pressed":o===e,onClick:()=>c(e),className:b(`inline-flex min-h-7 cursor-pointer items-center gap-1 rounded-[6px] border px-2 text-[12px] capitalize`,o===e?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:text-ink`),children:[e,` `,(0,T.jsx)(`span`,{className:`tabular-nums opacity-75`,children:t})]},e)})})}),f.failed.length?(0,T.jsx)(s,{label:`Failed rules`,placeholder:`Find a rule, WCAG criterion, page or element`,resetKey:o,empty:`Nothing matches.`,head:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`w-[96px] py-1.5 pl-3 font-medium`,children:`Impact`}),(0,T.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Rule`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @2xl:table-cell`,children:`WCAG`}),(0,T.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Elements`}),(0,T.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,T.jsxs)(w.Fragment,{children:[(0,T.jsxs)(`tr`,{onClick:()=>h(t.rule),"aria-expanded":n,className:b(`cursor-pointer border-t border-line-soft align-top hover:bg-surface-muted`,n&&`bg-surface-muted`),children:[(0,T.jsx)(`td`,{className:`py-1.5 pl-3`,children:(0,T.jsx)(_,{tone:D[t.impact],className:`min-h-5 px-2 text-[11px] capitalize`,children:t.impact})}),(0,T.jsx)(`td`,{className:`py-1.5 pr-3`,children:(0,T.jsxs)(`span`,{className:`flex items-start gap-1`,children:[(0,T.jsx)(l,{size:13,"aria-hidden":`true`,className:b(`mt-0.5 flex-none text-muted transition-transform`,!n&&`-rotate-90`)}),(0,T.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,T.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t.help}),(0,T.jsx)(`span`,{className:`font-mono text-[11.5px] text-muted`,children:t.rule})]})]})}),(0,T.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,T.jsx)(`td`,{className:`py-1.5 pr-3 text-right tabular-nums`,children:t.count}),(0,T.jsx)(`td`,{className:`py-1.5 pr-3 text-right tabular-nums`,children:t.pages})]}),n&&(0,T.jsxs)(`tr`,{className:`bg-surface-muted`,children:[(0,T.jsx)(`td`,{}),(0,T.jsx)(`td`,{colSpan:4,className:`pr-3 pb-3`,children:(0,T.jsxs)(`div`,{className:`flex flex-col gap-1.5 pl-[17px]`,children:[r.length?r.map((e,t)=>(0,T.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,T.jsxs)(`span`,{className:`flex min-w-0 gap-1.5 text-[12px] text-muted`,children:[(0,T.jsx)(`span`,{className:`flex-none`,"data-tip":e.page,children:P(e.page)}),e.target&&(0,T.jsxs)(`span`,{className:`min-w-0 truncate font-mono text-[11.5px]`,"data-tip":e.target,children:[`· `,e.target]})]}),e.html&&(0,T.jsx)(`code`,{className:`line-clamp-3 font-mono text-[12px] break-all text-ink-2`,children:N(e.html)})]},t)):(0,T.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:`No elements were kept for this rule.`}),t.helpUrl&&S(t.helpUrl)===`web`&&(0,T.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,T.jsx)(y,{size:12,"aria-hidden":`true`})]})]})})]})]},t.rule)})}):(0,T.jsx)(`p`,{className:`m-0 text-[13px] text-pass`,children:`No rule failed on the pages this run visited.`}),f.passed.length>0&&(0,T.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,T.jsxs)(`button`,{type:`button`,"aria-expanded":u,onClick:()=>d(!u),className:`flex cursor-pointer items-center gap-1 self-start border-0 bg-transparent p-0 text-[13px] font-medium text-ink`,children:[(0,T.jsx)(l,{size:13,"aria-hidden":`true`,className:b(`text-muted transition-transform`,!u&&`-rotate-90`)}),`Rules that passed `,(0,T.jsx)(`span`,{className:`font-normal text-muted tabular-nums`,children:f.passed.length})]}),u&&(0,T.jsx)(`ul`,{className:`m-0 flex list-none flex-wrap gap-1 p-0`,children:f.passed.map(e=>(0,T.jsx)(`li`,{className:`rounded-[6px] bg-pass-soft px-2 py-0.5 font-mono text-[11.5px] text-pass`,children:e},e))})]}),(0,T.jsx)(`p`,{className:`m-0 text-[12px] text-muted`,children:n})]})}function L({run:e}){let t=e.report;if(!t?.performance.pages.length)return(0,T.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,T.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,T.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,T.jsx)(`span`,{className:`text-pass`,children:`good`}),`, `,(0,T.jsx)(`span`,{className:`text-warn`,children:`needs improvement`}),`, `,(0,T.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,T.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 · `,P(e.page),`: `,e.text]},t)),(0,T.jsx)(s,{label:`Timings`,minWidth:720,head:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 font-medium`,children:`Page`}),O.map(e=>(0,T.jsx)(`th`,{className:`px-2 py-1.5 text-right font-medium`,"data-tip":e.label,children:e.label},e.key)),(0,T.jsx)(`th`,{className:`px-2 py-1.5 text-right font-medium`,children:`Requests`}),(0,T.jsx)(`th`,{className:`py-1.5 pr-3 pl-2 text-right font-medium`,children:`Size`})]}),children:t.performance.pages.map((e,t)=>(0,T.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,T.jsxs)(`td`,{className:`py-1.5 pr-3 pl-3`,children:[(0,T.jsx)(`span`,{className:`block max-w-[340px] truncate font-mono text-[12px]`,"data-tip":e.url,children:P(e.url)}),e.over.length>0&&(0,T.jsxs)(`span`,{className:`text-[11.5px] text-fail`,children:[`over: `,e.over.join(`, `)]})]}),O.map(t=>{let i=e[t.key];return(0,T.jsxs)(`td`,{className:b(`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`?j(i,t.unit):`–`,typeof i==`number`&&t.good!==1/0&&(0,T.jsxs)(`span`,{className:`sr-only`,children:[` (`,n(i,t),`)`]})]},t.key)}),(0,T.jsx)(`td`,{className:`px-2 py-1.5 text-right whitespace-nowrap text-muted tabular-nums`,children:e.requests??`–`}),(0,T.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,T.jsxs)(`p`,{className:`m-0 text-[12px] text-muted`,children:[O.filter(e=>e.good!==1/0).map(e=>`${e.label}: good up to ${j(e.good,e.unit)}, poor over ${j(e.poor,e.unit)}`).join(` · `),`. Lab values from one visit, not data from real users.`]})]})}function R({run:e,index:n,which:a,label:o}){let[s,c]=(0,w.useState)(``),[l,u]=(0,w.useState)(!1);return(0,w.useEffect)(()=>{let t=!1;return c(``),u(!1),r.image(e,n,a).then(e=>!t&&c(e),()=>!t&&u(!0)),()=>{t=!0}},[e,n,a]),(0,T.jsxs)(`figure`,{className:`m-0 flex min-w-0 flex-col gap-1.5`,children:[(0,T.jsx)(`figcaption`,{className:`text-[12px] font-medium text-muted`,children:o}),s?(0,T.jsx)(`img`,{src:s,alt:`${o} of the page`,className:`block h-auto w-full rounded-[10px] border border-line-soft bg-surface-muted`}):(0,T.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:l?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(t,{icon:i,size:14}),` Not available`]}):`Loading…`})]})}function z({run:e,budget:t,onChange:n}){let[i,a]=(0,w.useState)(null),[c,d]=(0,w.useState)(``),[f,p]=(0,w.useState)(!1),[m,v]=(0,w.useState)(``),[y,x]=(0,w.useState)(new Set),[S,C]=(0,w.useState)(`all`),E=e.visual?.pages??[],D=E.find(e=>e.status===`changed`)?.index;(0,w.useEffect)(()=>x(D===void 0?new Set:new Set([D])),[e.id,D]);let O=async e=>{p(!0),v(``);try{n(await e()),a(null),d(``)}catch(e){v(e.message)}finally{p(!1)}};if(!e.visual)return e.captured?(0,T.jsxs)(`div`,{className:`flex flex-col items-start gap-2`,children:[(0,T.jsxs)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:[`This run captured `,M(e.captured,`page`),` but they were not compared with the baselines yet.`]}),(0,T.jsxs)(u,{size:`sm`,variant:`primary`,disabled:f,onClick:()=>O(()=>r.compare(e.id)),children:[(0,T.jsx)(o,{"aria-hidden":`true`}),`Compare with the baselines`]}),m&&(0,T.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:m})]}):(0,T.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=E.filter(e=>e.status===`changed`),j=(S===`changed`?A:E).slice().sort((e,t)=>Number(t.status===`changed`)-Number(e.status===`changed`)||(t.diffPercent??0)-(e.diffPercent??0)),N=e=>{let t=new Set(y);t.has(e)?t.delete(e):t.add(e),x(t)};return(0,T.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,T.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Each page captured with animations frozen and masked regions hidden, against its approved baseline. `,t?`A page over quality.budgets.visual fails the run.`:`No visual budget set: a change does not fail the run.`]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsx)(`div`,{role:`group`,"aria-label":`Show`,className:`flex gap-1`,children:[[`all`,`All pages`,E.length],[`changed`,`Changed`,A.length]].map(([e,t,n])=>(0,T.jsxs)(`button`,{type:`button`,"aria-pressed":S===e,onClick:()=>C(e),className:b(`inline-flex min-h-7 cursor-pointer items-center gap-1 rounded-[6px] border px-2 text-[12px]`,S===e?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:text-ink`),children:[t,` `,(0,T.jsx)(`span`,{className:`tabular-nums opacity-75`,children:n})]},e))}),(0,T.jsx)(`span`,{className:`flex-1`}),A.length>1&&(0,T.jsxs)(u,{size:`sm`,disabled:f,onClick:()=>a(A.map(e=>e.url)),children:[`Approve all `,A.length,` changes`]})]}),i&&(0,T.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,T.jsxs)(`span`,{className:`font-medium`,children:[`Make this run's capture the baseline of `,i.length===1?P(i[0]):M(i.length,`page`),`?`]}),(0,T.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,T.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[`Why it changed (kept with the baseline)`,(0,T.jsx)(g,{size:`sm`,value:c,maxLength:300,placeholder:`New checkout banner`,onChange:e=>d(e.target.value),className:`max-w-[480px] bg-bg`})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,T.jsxs)(u,{size:`sm`,variant:`primary`,disabled:f,onClick:()=>O(()=>r.approve(e.id,i,c.trim()||void 0)),children:[(0,T.jsx)(h,{"aria-hidden":`true`}),`Approve`]}),(0,T.jsx)(u,{size:`sm`,onClick:()=>a(null),children:`Cancel`})]})]}),m&&(0,T.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:m}),(0,T.jsx)(s,{label:`Pages against their baselines`,fixed:!0,resetKey:S,empty:`No page changed.`,head:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 font-medium`,children:`Page`}),(0,T.jsx)(`th`,{className:`hidden w-[110px] py-1.5 pr-3 font-medium @2xl:table-cell`,children:`Size`}),(0,T.jsx)(`th`,{className:`w-[90px] py-1.5 pr-3 text-right font-medium`,children:`Changed`}),(0,T.jsx)(`th`,{className:`w-[120px] py-1.5 pr-3 font-medium`,children:`Result`}),(0,T.jsx)(`th`,{className:`w-[96px] py-1.5 pr-3`,children:(0,T.jsx)(`span`,{className:`sr-only`,children:`Approve`})})]}),children:j.map(t=>{let n=y.has(t.index);return(0,T.jsxs)(w.Fragment,{children:[(0,T.jsxs)(`tr`,{onClick:()=>N(t.index),"aria-expanded":n,className:b(`cursor-pointer border-t border-line-soft align-top hover:bg-surface-muted`,n&&`bg-surface-muted`),children:[(0,T.jsx)(`td`,{className:`py-1.5 pr-3 pl-3`,children:(0,T.jsxs)(`span`,{className:`flex items-start gap-1`,children:[(0,T.jsx)(l,{size:13,"aria-hidden":`true`,className:b(`mt-0.5 flex-none text-muted transition-transform`,!n&&`-rotate-90`)}),(0,T.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,T.jsx)(`span`,{className:`truncate`,"data-tip":t.title||t.url,children:t.title||P(t.url)}),(0,T.jsx)(`span`,{className:`truncate font-mono text-[11.5px] text-muted`,"data-tip":t.url,children:P(t.url)})]})]})}),(0,T.jsxs)(`td`,{className:`hidden py-1.5 pr-3 whitespace-nowrap text-muted @2xl:table-cell`,children:[t.size||`–`,t.resized?` · resized ${t.resized}`:``]}),(0,T.jsx)(`td`,{className:b(`py-1.5 pr-3 text-right whitespace-nowrap tabular-nums`,t.over?`text-fail`:t.status===`changed`?`text-warn`:`text-muted`),children:t.status===`changed`?`${t.diffPercent}%${t.limit===void 0?``:` / ${t.limit}%`}`:`–`}),(0,T.jsx)(`td`,{className:`py-1.5 pr-3`,children:(0,T.jsx)(_,{tone:t.over?`fail`:k[t.status].tone,className:`min-h-5 px-2 text-[11px]`,children:t.over?`Over budget`:k[t.status].label})}),(0,T.jsx)(`td`,{className:`py-1 pr-3 text-right`,onClick:e=>e.stopPropagation(),children:t.status===`changed`&&(0,T.jsx)(u,{size:`sm`,variant:`ghost`,disabled:f,onClick:()=>a([t.url]),className:`min-h-7`,children:`Approve`})})]}),n&&(0,T.jsx)(`tr`,{className:`bg-surface-muted`,children:(0,T.jsx)(`td`,{colSpan:5,className:`px-3 pb-3`,children:(0,T.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(180px,1fr))] gap-3`,children:[t.images.baseline&&(0,T.jsx)(R,{run:e.id,index:t.index,which:`baseline`,label:`Baseline`}),t.images.current&&(0,T.jsx)(R,{run:e.id,index:t.index,which:`current`,label:`This run`}),t.images.diff&&(0,T.jsx)(R,{run:e.id,index:t.index,which:`diff`,label:`Difference (in red)`})]})})})]},t.index)})})]})}function B({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,T.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,T.jsx)(`polyline`,{points:n,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinejoin:`round`})})}function V({icon:e,className:n,lines:r}){return r.length?(0,T.jsxs)(`span`,{className:b(`flex items-start gap-1.5 text-[13px]`,n),children:[(0,T.jsx)(t,{icon:e,size:14,className:`mt-0.5 flex-none`}),(0,T.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:r.join(` · `)})]}):null}function H({trends:t}){return t.length?(0,T.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.map(t=>{let n=t.a11y.latest?E.reduce((e,n)=>e+(t.a11y.latest[n]||0),0):void 0;return(0,T.jsxs)(`li`,{className:`flex flex-col gap-1.5 border-t border-line-soft py-3 first:border-t-0`,children:[(0,T.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-3`,children:[(0,T.jsx)(`span`,{className:`min-w-0 flex-[1_1_240px] truncate font-mono text-[13px]`,"data-tip":t.page,children:/^https?:/.test(t.page)?P(t.page):t.page}),(0,T.jsx)(B,{values:t.a11y.trail}),(0,T.jsxs)(`span`,{className:`text-[12px] text-muted`,children:[M(t.runs,`run`),n===void 0?``:` · ${M(n,`violation`)} now`]})]}),(0,T.jsx)(V,{icon:e,className:`text-fail`,lines:[...t.perf.worse.map(e=>`slower: ${e}`),...t.a11y.newRules.map(e=>`newly failing: ${e}`)]}),(0,T.jsx)(V,{icon:c,className:`text-pass`,lines:[...t.perf.better.map(e=>`faster: ${e}`),...t.a11y.fixedRules.map(e=>`fixed: ${e}`)]})]},t.page)})}):(0,T.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 U={accessibility:e=>!!e.a11y?.pages,performance:e=>e.perf.pages>0,visual:e=>!!e.visual||e.captured>0},W={accessibility:e=>!!e.a11y?.failed,performance:e=>e.perf.over>0,visual:e=>!!(e.visual?.changed||e.visual?.over)},G=(e,t)=>t.filter(U[e]);function K({kind:e,runs:t}){let[r,i]=(0,w.useState)(`all`),o=G(e,t),c=r===`attention`?o.filter(W[e]):o,l=t=>location.hash=n(e,encodeURIComponent(t)),u=`py-2 pr-3 text-right tabular-nums`;return(0,T.jsx)(s,{label:`Runs`,placeholder:`Find a run by what it did`,resetKey:r,empty:`Nothing matches.`,tools:(0,T.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,T.jsx)(f,{items:[{id:`all`,label:`All`,n:o.length},{id:`attention`,label:`Needs a look`,n:o.filter(W[e]).length,alert:!0}],value:r,onChange:i})}),head:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`w-[46%] py-1.5 pr-3 pl-3 font-medium`,children:`Run`}),e===`accessibility`&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Rules failed`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @2xl:table-cell`,children:`Critical · serious`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @3xl:table-cell`,children:`Moderate · minor`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @xl:table-cell`,children:`Pages`})]}),e===`performance`&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Over budget`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @xl:table-cell`,children:`Pages timed`})]}),e===`visual`&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Changed`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @2xl:table-cell`,children:`New`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @xl:table-cell`,children:`Same`})]}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`When`})]}),children:c.map(t=>{let r=W[e](t),i=(t.over?.[e]??0)>0;return(0,T.jsxs)(`tr`,{onClick:()=>l(t.id),className:`cursor-pointer border-t border-line-soft hover:bg-surface-muted`,children:[(0,T.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,T.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(i?a:r?m:h,{size:15,"aria-label":i?`Over a budget`:r?`Needs a look`:`Within budgets`,className:b(`flex-none`,i?`text-fail`:r?`text-warn`:`text-pass`)}),(0,T.jsx)(`a`,{href:n(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,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`td`,{className:b(u,t.a11y.failed?`text-fail`:`text-muted`),children:t.a11y.failed}),(0,T.jsx)(`td`,{className:b(u,`hidden @2xl:table-cell`,t.a11y.critical+t.a11y.serious?`text-fail`:`text-muted`),children:`${t.a11y.critical} · ${t.a11y.serious}`}),(0,T.jsx)(`td`,{className:b(u,`hidden text-muted @3xl:table-cell`),children:`${t.a11y.moderate} · ${t.a11y.minor}`}),(0,T.jsx)(`td`,{className:b(u,`hidden text-muted @xl:table-cell`),children:t.a11y.pages})]}),e===`performance`&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`td`,{className:b(u,t.perf.over?`text-fail`:`text-muted`),children:t.perf.over}),(0,T.jsx)(`td`,{className:b(u,`hidden text-muted @xl:table-cell`),children:t.perf.pages})]}),e===`visual`&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`td`,{className:b(u,t.visual?.changed?`text-warn`:`text-muted`),children:t.visual?t.visual.changed:`not compared`}),(0,T.jsx)(`td`,{className:b(u,`hidden text-muted @2xl:table-cell`),children:t.visual?t.visual.new+t.visual.no_baseline:`–`}),(0,T.jsx)(`td`,{className:b(u,`hidden text-muted @xl:table-cell`),children:t.visual?t.visual.same:`–`})]}),(0,T.jsx)(`td`,{className:`hidden py-2 pr-3 whitespace-nowrap text-[12.5px] text-muted @xl:table-cell`,"data-tip":A(t.at),children:C(t.at)})]},t.id)})})}function q({kind:e,id:t,view:i,onChanged:a}){let[o,s]=(0,w.useState)(null),[c,u]=(0,w.useState)(``);(0,w.useEffect)(()=>{let e=!1;return s(null),r.run(t).then(t=>{e||(s(t),u(``))},t=>!e&&u(t.message)),()=>{e=!0}},[t]);let d=(0,T.jsxs)(`a`,{href:n(e),className:`inline-flex items-center gap-1 self-start text-[13px] no-underline`,children:[(0,T.jsx)(l,{size:14,"aria-hidden":`true`,className:`rotate-90`}),`All runs`]});return c||!o?(0,T.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[d,c?(0,T.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail`,children:c}):(0,T.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Loading…`})]}):(0,T.jsxs)(`section`,{"aria-labelledby":`run-h`,className:`flex min-w-0 flex-col gap-3`,children:[d,(0,T.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,T.jsx)(`h2`,{id:`run-h`,"data-tip":o.goal,className:`m-0 truncate text-[16px] leading-snug font-semibold`,children:o.goal}),(0,T.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 text-[12.5px] text-muted`,children:[A(o.at),` · `,(0,T.jsx)(x,{path:o.dir}),` · `,(0,T.jsx)(`a`,{href:n(`quality`,encodeURIComponent(o.id)),children:`Everything it measured`})]})]}),e===`accessibility`&&(0,T.jsx)(I,{run:o,standard:i.standard,disclaimer:i.disclaimer}),e===`performance`&&(0,T.jsx)(L,{run:o}),e===`visual`&&(0,T.jsx)(z,{run:o,budget:i.budgets.visual,onChange:e=>{s(e),a()}})]})}function J({r:e,to:t,line:n}){return(0,T.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,T.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col`,children:[(0,T.jsx)(`span`,{className:`text-[14.5px] font-medium [overflow-wrap:anywhere]`,children:e.goal}),(0,T.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:n})]}),(0,T.jsx)(u,{size:`sm`,variant:`primary`,onClick:()=>location.hash=t,children:`Open the run`})]})}function Y({label:e,value:t,sub:n,tone:r}){return(0,T.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5 px-3 py-2`,children:[(0,T.jsx)(`span`,{className:`text-[11.5px] text-muted`,children:e}),(0,T.jsx)(`span`,{className:b(`text-[16px] leading-tight font-semibold tabular-nums`,r),children:t}),n&&(0,T.jsx)(`span`,{className:`truncate text-[11.5px] text-muted`,children:n})]})}export{K as a,J as c,z as d,j as f,A as g,P as h,q as i,H as l,G as m,E as n,Y as o,F as p,D as r,L as s,I as t,O as u};
|
|
1
|
+
import{$i as e,$t as t,At as n,Ga as r,Hr as i,Ln as a,Oi as o,Q as s,Qi as c,Tn as l,Zt as u,at as d,ea as f,io as p,jn as m,lo as h,lt as g,mt as _,oo as v,rr as y,tn as b}from"./Shell-8Y6stc_6.js";import{c as x,f as S,r as C}from"./index-DuWTO5cE.js";var w=h(v(),1),T=p(),E=[`critical`,`serious`,`moderate`,`minor`],D={critical:`fail`,serious:`fail`,moderate:`warn`,minor:`neutral`},O=[{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`}],k={same:{label:`Same`,tone:`pass`},changed:{label:`Changed`,tone:`warn`},new:{label:`New baseline`,tone:`neutral`},no_baseline:{label:`No baseline`,tone:`neutral`}},A=e=>new Date(e).toLocaleString([],{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}),j=(e,t)=>t?e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`:e.toFixed(3).replace(/0+$/,``).replace(/\.$/,``),M=(e,t)=>`${e} ${t}${e===1?``:`s`}`,N=e=>e.replace(/(data:[\w/+.-]+;base64,)[A-Za-z0-9+/=]{24,}/g,`$1…`),P=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}},F=e=>!!(e.breaches||e.a11y?.failed||e.perf.over||e.visual?.changed);function I({run:e,standard:t,disclaimer:n}){let r=e.report,[i,a]=(0,w.useState)(new Set),[o,c]=(0,w.useState)(`all`),[u,d]=(0,w.useState)(!1);if(!r?.accessibility.pages)return(0,T.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 f=r.accessibility,p=r.breaches.filter(e=>e.kind===`accessibility`),m=f.failed.filter(e=>o===`all`||e.impact===o).sort((e,t)=>E.indexOf(e.impact)-E.indexOf(t.impact)||t.count-e.count),h=e=>{let t=new Set(i);t.has(e)?t.delete(e):t.add(e),a(t)};return(0,T.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,T.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[t,` with `,r.engine||`axe`,` on `,M(f.pages,`page`),`: `,(0,T.jsxs)(`span`,{className:`text-pass`,children:[M(f.passed.length,`rule`),` passed`]}),`, `,(0,T.jsxs)(`span`,{className:f.failed.length?`text-fail`:``,children:[f.failed.length,` failed`]}),`.`,` `,r.budgets.accessibility?p.length?`${M(p.length,`budget`)} exceeded.`:`Within the budget.`:`No budget set, so nothing here fails the run.`]}),p.map((e,t)=>(0,T.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 · `,P(e.page),`: `,e.text]},t)),f.failed.length>0&&(0,T.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,T.jsx)(`div`,{role:`group`,"aria-label":`Impact`,className:`flex flex-wrap gap-1`,children:[`all`,...E].map(e=>{let t=e===`all`?f.failed.length:f.failed.filter(t=>t.impact===e).length;return e!==`all`&&!t?null:(0,T.jsxs)(`button`,{type:`button`,"aria-pressed":o===e,onClick:()=>c(e),className:b(`inline-flex min-h-7 cursor-pointer items-center gap-1 rounded-[6px] border px-2 text-[12px] capitalize`,o===e?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:text-ink`),children:[e,` `,(0,T.jsx)(`span`,{className:`tabular-nums opacity-75`,children:t})]},e)})})}),f.failed.length?(0,T.jsx)(s,{label:`Failed rules`,placeholder:`Find a rule, WCAG criterion, page or element`,resetKey:o,empty:`Nothing matches.`,head:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`w-[96px] py-1.5 pl-3 font-medium`,children:`Impact`}),(0,T.jsx)(`th`,{className:`py-1.5 pr-3 font-medium`,children:`Rule`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @2xl:table-cell`,children:`WCAG`}),(0,T.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Elements`}),(0,T.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,T.jsxs)(w.Fragment,{children:[(0,T.jsxs)(`tr`,{onClick:()=>h(t.rule),"aria-expanded":n,className:b(`cursor-pointer border-t border-line-soft align-top hover:bg-surface-muted`,n&&`bg-surface-muted`),children:[(0,T.jsx)(`td`,{className:`py-1.5 pl-3`,children:(0,T.jsx)(_,{tone:D[t.impact],className:`min-h-5 px-2 text-[11px] capitalize`,children:t.impact})}),(0,T.jsx)(`td`,{className:`py-1.5 pr-3`,children:(0,T.jsxs)(`span`,{className:`flex items-start gap-1`,children:[(0,T.jsx)(l,{size:13,"aria-hidden":`true`,className:b(`mt-0.5 flex-none text-muted transition-transform`,!n&&`-rotate-90`)}),(0,T.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,T.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t.help}),(0,T.jsx)(`span`,{className:`font-mono text-[11.5px] text-muted`,children:t.rule})]})]})}),(0,T.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,T.jsx)(`td`,{className:`py-1.5 pr-3 text-right tabular-nums`,children:t.count}),(0,T.jsx)(`td`,{className:`py-1.5 pr-3 text-right tabular-nums`,children:t.pages})]}),n&&(0,T.jsxs)(`tr`,{className:`bg-surface-muted`,children:[(0,T.jsx)(`td`,{}),(0,T.jsx)(`td`,{colSpan:4,className:`pr-3 pb-3`,children:(0,T.jsxs)(`div`,{className:`flex flex-col gap-1.5 pl-[17px]`,children:[r.length?r.map((e,t)=>(0,T.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,T.jsxs)(`span`,{className:`flex min-w-0 gap-1.5 text-[12px] text-muted`,children:[(0,T.jsx)(`span`,{className:`flex-none`,"data-tip":e.page,children:P(e.page)}),e.target&&(0,T.jsxs)(`span`,{className:`min-w-0 truncate font-mono text-[11.5px]`,"data-tip":e.target,children:[`· `,e.target]})]}),e.html&&(0,T.jsx)(`code`,{className:`line-clamp-3 font-mono text-[12px] break-all text-ink-2`,children:N(e.html)})]},t)):(0,T.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:`No elements were kept for this rule.`}),t.helpUrl&&S(t.helpUrl)===`web`&&(0,T.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,T.jsx)(y,{size:12,"aria-hidden":`true`})]})]})})]})]},t.rule)})}):(0,T.jsx)(`p`,{className:`m-0 text-[13px] text-pass`,children:`No rule failed on the pages this run visited.`}),f.passed.length>0&&(0,T.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,T.jsxs)(`button`,{type:`button`,"aria-expanded":u,onClick:()=>d(!u),className:`flex cursor-pointer items-center gap-1 self-start border-0 bg-transparent p-0 text-[13px] font-medium text-ink`,children:[(0,T.jsx)(l,{size:13,"aria-hidden":`true`,className:b(`text-muted transition-transform`,!u&&`-rotate-90`)}),`Rules that passed `,(0,T.jsx)(`span`,{className:`font-normal text-muted tabular-nums`,children:f.passed.length})]}),u&&(0,T.jsx)(`ul`,{className:`m-0 flex list-none flex-wrap gap-1 p-0`,children:f.passed.map(e=>(0,T.jsx)(`li`,{className:`rounded-[6px] bg-pass-soft px-2 py-0.5 font-mono text-[11.5px] text-pass`,children:e},e))})]}),(0,T.jsx)(`p`,{className:`m-0 text-[12px] text-muted`,children:n})]})}function L({run:e}){let t=e.report;if(!t?.performance.pages.length)return(0,T.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,T.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,T.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,T.jsx)(`span`,{className:`text-pass`,children:`good`}),`, `,(0,T.jsx)(`span`,{className:`text-warn`,children:`needs improvement`}),`, `,(0,T.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,T.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 · `,P(e.page),`: `,e.text]},t)),(0,T.jsx)(s,{label:`Timings`,minWidth:720,head:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 font-medium`,children:`Page`}),O.map(e=>(0,T.jsx)(`th`,{className:`px-2 py-1.5 text-right font-medium`,"data-tip":e.label,children:e.label},e.key)),(0,T.jsx)(`th`,{className:`px-2 py-1.5 text-right font-medium`,children:`Requests`}),(0,T.jsx)(`th`,{className:`py-1.5 pr-3 pl-2 text-right font-medium`,children:`Size`})]}),children:t.performance.pages.map((e,t)=>(0,T.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,T.jsxs)(`td`,{className:`py-1.5 pr-3 pl-3`,children:[(0,T.jsx)(`span`,{className:`block max-w-[340px] truncate font-mono text-[12px]`,"data-tip":e.url,children:P(e.url)}),e.over.length>0&&(0,T.jsxs)(`span`,{className:`text-[11.5px] text-fail`,children:[`over: `,e.over.join(`, `)]})]}),O.map(t=>{let i=e[t.key];return(0,T.jsxs)(`td`,{className:b(`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`?j(i,t.unit):`–`,typeof i==`number`&&t.good!==1/0&&(0,T.jsxs)(`span`,{className:`sr-only`,children:[` (`,n(i,t),`)`]})]},t.key)}),(0,T.jsx)(`td`,{className:`px-2 py-1.5 text-right whitespace-nowrap text-muted tabular-nums`,children:e.requests??`–`}),(0,T.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,T.jsxs)(`p`,{className:`m-0 text-[12px] text-muted`,children:[O.filter(e=>e.good!==1/0).map(e=>`${e.label}: good up to ${j(e.good,e.unit)}, poor over ${j(e.poor,e.unit)}`).join(` · `),`. Lab values from one visit, not data from real users.`]})]})}function R({run:e,index:n,which:a,label:o}){let[s,c]=(0,w.useState)(``),[l,u]=(0,w.useState)(!1);return(0,w.useEffect)(()=>{let t=!1;return c(``),u(!1),r.image(e,n,a).then(e=>!t&&c(e),()=>!t&&u(!0)),()=>{t=!0}},[e,n,a]),(0,T.jsxs)(`figure`,{className:`m-0 flex min-w-0 flex-col gap-1.5`,children:[(0,T.jsx)(`figcaption`,{className:`text-[12px] font-medium text-muted`,children:o}),s?(0,T.jsx)(`img`,{src:s,alt:`${o} of the page`,className:`block h-auto w-full rounded-[10px] border border-line-soft bg-surface-muted`}):(0,T.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:l?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(t,{icon:i,size:14}),` Not available`]}):`Loading…`})]})}function z({run:e,budget:t,onChange:n}){let[i,a]=(0,w.useState)(null),[c,d]=(0,w.useState)(``),[f,p]=(0,w.useState)(!1),[h,v]=(0,w.useState)(``),[y,x]=(0,w.useState)(new Set),[S,C]=(0,w.useState)(`all`),E=e.visual?.pages??[],D=E.find(e=>e.status===`changed`)?.index;(0,w.useEffect)(()=>x(D===void 0?new Set:new Set([D])),[e.id,D]);let O=async e=>{p(!0),v(``);try{n(await e()),a(null),d(``)}catch(e){v(e.message)}finally{p(!1)}};if(!e.visual)return e.captured?(0,T.jsxs)(`div`,{className:`flex flex-col items-start gap-2`,children:[(0,T.jsxs)(`p`,{className:`m-0 text-[13px] text-ink-2`,children:[`This run captured `,M(e.captured,`page`),` but they were not compared with the baselines yet.`]}),(0,T.jsxs)(u,{size:`sm`,variant:`primary`,disabled:f,onClick:()=>O(()=>r.compare(e.id)),children:[(0,T.jsx)(o,{"aria-hidden":`true`}),`Compare with the baselines`]}),h&&(0,T.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:h})]}):(0,T.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=E.filter(e=>e.status===`changed`),j=(S===`changed`?A:E).slice().sort((e,t)=>Number(t.status===`changed`)-Number(e.status===`changed`)||(t.diffPercent??0)-(e.diffPercent??0)),N=e=>{let t=new Set(y);t.has(e)?t.delete(e):t.add(e),x(t)};return(0,T.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,T.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Each page captured with animations frozen and masked regions hidden, against its approved baseline. `,t?`A page over quality.budgets.visual fails the run.`:`No visual budget set: a change does not fail the run.`]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsx)(`div`,{role:`group`,"aria-label":`Show`,className:`flex gap-1`,children:[[`all`,`All pages`,E.length],[`changed`,`Changed`,A.length]].map(([e,t,n])=>(0,T.jsxs)(`button`,{type:`button`,"aria-pressed":S===e,onClick:()=>C(e),className:b(`inline-flex min-h-7 cursor-pointer items-center gap-1 rounded-[6px] border px-2 text-[12px]`,S===e?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:text-ink`),children:[t,` `,(0,T.jsx)(`span`,{className:`tabular-nums opacity-75`,children:n})]},e))}),(0,T.jsx)(`span`,{className:`flex-1`}),A.length>1&&(0,T.jsxs)(u,{size:`sm`,disabled:f,onClick:()=>a(A.map(e=>e.url)),children:[`Approve all `,A.length,` changes`]})]}),i&&(0,T.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,T.jsxs)(`span`,{className:`font-medium`,children:[`Make this run's capture the baseline of `,i.length===1?P(i[0]):M(i.length,`page`),`?`]}),(0,T.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,T.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[`Why it changed (kept with the baseline)`,(0,T.jsx)(g,{size:`sm`,value:c,maxLength:300,placeholder:`New checkout banner`,onChange:e=>d(e.target.value),className:`max-w-[480px] bg-bg`})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,T.jsxs)(u,{size:`sm`,variant:`primary`,disabled:f,onClick:()=>O(()=>r.approve(e.id,i,c.trim()||void 0)),children:[(0,T.jsx)(m,{"aria-hidden":`true`}),`Approve`]}),(0,T.jsx)(u,{size:`sm`,onClick:()=>a(null),children:`Cancel`})]})]}),h&&(0,T.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:h}),(0,T.jsx)(s,{label:`Pages against their baselines`,fixed:!0,resetKey:S,empty:`No page changed.`,head:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`py-1.5 pr-3 pl-3 font-medium`,children:`Page`}),(0,T.jsx)(`th`,{className:`hidden w-[110px] py-1.5 pr-3 font-medium @2xl:table-cell`,children:`Size`}),(0,T.jsx)(`th`,{className:`w-[90px] py-1.5 pr-3 text-right font-medium`,children:`Changed`}),(0,T.jsx)(`th`,{className:`w-[120px] py-1.5 pr-3 font-medium`,children:`Result`}),(0,T.jsx)(`th`,{className:`w-[96px] py-1.5 pr-3`,children:(0,T.jsx)(`span`,{className:`sr-only`,children:`Approve`})})]}),children:j.map(t=>{let n=y.has(t.index);return(0,T.jsxs)(w.Fragment,{children:[(0,T.jsxs)(`tr`,{onClick:()=>N(t.index),"aria-expanded":n,className:b(`cursor-pointer border-t border-line-soft align-top hover:bg-surface-muted`,n&&`bg-surface-muted`),children:[(0,T.jsx)(`td`,{className:`py-1.5 pr-3 pl-3`,children:(0,T.jsxs)(`span`,{className:`flex items-start gap-1`,children:[(0,T.jsx)(l,{size:13,"aria-hidden":`true`,className:b(`mt-0.5 flex-none text-muted transition-transform`,!n&&`-rotate-90`)}),(0,T.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,T.jsx)(`span`,{className:`truncate`,"data-tip":t.title||t.url,children:t.title||P(t.url)}),(0,T.jsx)(`span`,{className:`truncate font-mono text-[11.5px] text-muted`,"data-tip":t.url,children:P(t.url)})]})]})}),(0,T.jsxs)(`td`,{className:`hidden py-1.5 pr-3 whitespace-nowrap text-muted @2xl:table-cell`,children:[t.size||`–`,t.resized?` · resized ${t.resized}`:``]}),(0,T.jsx)(`td`,{className:b(`py-1.5 pr-3 text-right whitespace-nowrap tabular-nums`,t.over?`text-fail`:t.status===`changed`?`text-warn`:`text-muted`),children:t.status===`changed`?`${t.diffPercent}%${t.limit===void 0?``:` / ${t.limit}%`}`:`–`}),(0,T.jsx)(`td`,{className:`py-1.5 pr-3`,children:(0,T.jsx)(_,{tone:t.over?`fail`:k[t.status].tone,className:`min-h-5 px-2 text-[11px]`,children:t.over?`Over budget`:k[t.status].label})}),(0,T.jsx)(`td`,{className:`py-1 pr-3 text-right`,onClick:e=>e.stopPropagation(),children:t.status===`changed`&&(0,T.jsx)(u,{size:`sm`,variant:`ghost`,disabled:f,onClick:()=>a([t.url]),className:`min-h-7`,children:`Approve`})})]}),n&&(0,T.jsx)(`tr`,{className:`bg-surface-muted`,children:(0,T.jsx)(`td`,{colSpan:5,className:`px-3 pb-3`,children:(0,T.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(180px,1fr))] gap-3`,children:[t.images.baseline&&(0,T.jsx)(R,{run:e.id,index:t.index,which:`baseline`,label:`Baseline`}),t.images.current&&(0,T.jsx)(R,{run:e.id,index:t.index,which:`current`,label:`This run`}),t.images.diff&&(0,T.jsx)(R,{run:e.id,index:t.index,which:`diff`,label:`Difference (in red)`})]})})})]},t.index)})})]})}function B({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,T.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,T.jsx)(`polyline`,{points:n,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinejoin:`round`})})}function V({icon:e,className:n,lines:r}){return r.length?(0,T.jsxs)(`span`,{className:b(`flex items-start gap-1.5 text-[13px]`,n),children:[(0,T.jsx)(t,{icon:e,size:14,className:`mt-0.5 flex-none`}),(0,T.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:r.join(` · `)})]}):null}function H({trends:t}){return t.length?(0,T.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.map(t=>{let n=t.a11y.latest?E.reduce((e,n)=>e+(t.a11y.latest[n]||0),0):void 0;return(0,T.jsxs)(`li`,{className:`flex flex-col gap-1.5 border-t border-line-soft py-3 first:border-t-0`,children:[(0,T.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-3`,children:[(0,T.jsx)(`span`,{className:`min-w-0 flex-[1_1_240px] truncate font-mono text-[13px]`,"data-tip":t.page,children:/^https?:/.test(t.page)?P(t.page):t.page}),(0,T.jsx)(B,{values:t.a11y.trail}),(0,T.jsxs)(`span`,{className:`text-[12px] text-muted`,children:[M(t.runs,`run`),n===void 0?``:` · ${M(n,`violation`)} now`]})]}),(0,T.jsx)(V,{icon:e,className:`text-fail`,lines:[...t.perf.worse.map(e=>`slower: ${e}`),...t.a11y.newRules.map(e=>`newly failing: ${e}`)]}),(0,T.jsx)(V,{icon:c,className:`text-pass`,lines:[...t.perf.better.map(e=>`faster: ${e}`),...t.a11y.fixedRules.map(e=>`fixed: ${e}`)]})]},t.page)})}):(0,T.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 U={accessibility:e=>!!e.a11y?.pages,performance:e=>e.perf.pages>0,visual:e=>!!e.visual||e.captured>0},W={accessibility:e=>!!e.a11y?.failed,performance:e=>e.perf.over>0,visual:e=>!!(e.visual?.changed||e.visual?.over)},G=(e,t)=>t.filter(U[e]);function K({kind:e,runs:t}){let[r,i]=(0,w.useState)(`all`),o=G(e,t),c=r===`attention`?o.filter(W[e]):o,l=t=>location.hash=n(e,encodeURIComponent(t)),u=`py-2 pr-3 text-right tabular-nums`;return(0,T.jsx)(s,{label:`Runs`,placeholder:`Find a run by what it did`,resetKey:r,empty:`Nothing matches.`,tools:(0,T.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,T.jsx)(d,{items:[{id:`all`,label:`All`,n:o.length},{id:`attention`,label:`Needs a look`,n:o.filter(W[e]).length,alert:!0}],value:r,onChange:i})}),head:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`w-[46%] py-1.5 pr-3 pl-3 font-medium`,children:`Run`}),e===`accessibility`&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Rules failed`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @2xl:table-cell`,children:`Critical · serious`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @3xl:table-cell`,children:`Moderate · minor`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @xl:table-cell`,children:`Pages`})]}),e===`performance`&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Over budget`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @xl:table-cell`,children:`Pages timed`})]}),e===`visual`&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Changed`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @2xl:table-cell`,children:`New`}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @xl:table-cell`,children:`Same`})]}),(0,T.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`When`})]}),children:c.map(t=>{let r=W[e](t),i=(t.over?.[e]??0)>0;return(0,T.jsxs)(`tr`,{onClick:()=>l(t.id),className:`cursor-pointer border-t border-line-soft hover:bg-surface-muted`,children:[(0,T.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,T.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(i?a:r?f:m,{size:15,"aria-label":i?`Over a budget`:r?`Needs a look`:`Within budgets`,className:b(`flex-none`,i?`text-fail`:r?`text-warn`:`text-pass`)}),(0,T.jsx)(`a`,{href:n(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,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`td`,{className:b(u,t.a11y.failed?`text-fail`:`text-muted`),children:t.a11y.failed}),(0,T.jsx)(`td`,{className:b(u,`hidden @2xl:table-cell`,t.a11y.critical+t.a11y.serious?`text-fail`:`text-muted`),children:`${t.a11y.critical} · ${t.a11y.serious}`}),(0,T.jsx)(`td`,{className:b(u,`hidden text-muted @3xl:table-cell`),children:`${t.a11y.moderate} · ${t.a11y.minor}`}),(0,T.jsx)(`td`,{className:b(u,`hidden text-muted @xl:table-cell`),children:t.a11y.pages})]}),e===`performance`&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`td`,{className:b(u,t.perf.over?`text-fail`:`text-muted`),children:t.perf.over}),(0,T.jsx)(`td`,{className:b(u,`hidden text-muted @xl:table-cell`),children:t.perf.pages})]}),e===`visual`&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`td`,{className:b(u,t.visual?.changed?`text-warn`:`text-muted`),children:t.visual?t.visual.changed:`not compared`}),(0,T.jsx)(`td`,{className:b(u,`hidden text-muted @2xl:table-cell`),children:t.visual?t.visual.new+t.visual.no_baseline:`–`}),(0,T.jsx)(`td`,{className:b(u,`hidden text-muted @xl:table-cell`),children:t.visual?t.visual.same:`–`})]}),(0,T.jsx)(`td`,{className:`hidden py-2 pr-3 whitespace-nowrap text-[12.5px] text-muted @xl:table-cell`,"data-tip":A(t.at),children:C(t.at)})]},t.id)})})}function q({kind:e,id:t,view:i,onChanged:a}){let[o,s]=(0,w.useState)(null),[c,u]=(0,w.useState)(``);(0,w.useEffect)(()=>{let e=!1;return s(null),r.run(t).then(t=>{e||(s(t),u(``))},t=>!e&&u(t.message)),()=>{e=!0}},[t]);let d=(0,T.jsxs)(`a`,{href:n(e),className:`inline-flex items-center gap-1 self-start text-[13px] no-underline`,children:[(0,T.jsx)(l,{size:14,"aria-hidden":`true`,className:`rotate-90`}),`All runs`]});return c||!o?(0,T.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[d,c?(0,T.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail`,children:c}):(0,T.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Loading…`})]}):(0,T.jsxs)(`section`,{"aria-labelledby":`run-h`,className:`flex min-w-0 flex-col gap-3`,children:[d,(0,T.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,T.jsx)(`h2`,{id:`run-h`,"data-tip":o.goal,className:`m-0 truncate text-[16px] leading-snug font-semibold`,children:o.goal}),(0,T.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 text-[12.5px] text-muted`,children:[A(o.at),` · `,(0,T.jsx)(x,{path:o.dir}),` · `,(0,T.jsx)(`a`,{href:n(`quality`,encodeURIComponent(o.id)),children:`Everything it measured`})]})]}),e===`accessibility`&&(0,T.jsx)(I,{run:o,standard:i.standard,disclaimer:i.disclaimer}),e===`performance`&&(0,T.jsx)(L,{run:o}),e===`visual`&&(0,T.jsx)(z,{run:o,budget:i.budgets.visual,onChange:e=>{s(e),a()}})]})}function J({r:e,to:t,line:n}){return(0,T.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,T.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col`,children:[(0,T.jsx)(`span`,{className:`text-[14.5px] font-medium [overflow-wrap:anywhere]`,children:e.goal}),(0,T.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:n})]}),(0,T.jsx)(u,{size:`sm`,variant:`primary`,onClick:()=>location.hash=t,children:`Open the run`})]})}function Y({label:e,value:t,sub:n,tone:r}){return(0,T.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5 px-3 py-2`,children:[(0,T.jsx)(`span`,{className:`text-[11.5px] text-muted`,children:e}),(0,T.jsx)(`span`,{className:b(`text-[16px] leading-tight font-semibold tabular-nums`,r),children:t}),n&&(0,T.jsx)(`span`,{className:`truncate text-[11.5px] text-muted`,children:n})]})}export{K as a,J as c,z as d,j as f,A as g,P as h,q as i,H as l,G as m,E as n,Y as o,F as p,D as r,L as s,I as t,O as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{io as e,tn as t}from"./Shell-8Y6stc_6.js";var n=e(),r=`flex w-fit max-w-full flex-wrap gap-1 rounded-[10px] bg-surface-strong p-1`,i=e=>t(`inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-[7px] border-0 px-3 text-sm font-medium whitespace-nowrap`,e?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`);function a({tabs:e,current:a,onPick:o,label:s,className:c}){return(0,n.jsx)(`div`,{role:`tablist`,"aria-label":s,className:t(`mb-5`,r,c),children:e.map((t,r)=>(0,n.jsxs)(`button`,{id:`tab-${t.id}`,type:`button`,role:`tab`,"aria-selected":a===t.id,"aria-controls":`panel-${t.id}`,tabIndex:a===t.id?0:-1,onClick:()=>o(t.id),onKeyDown:t=>{let n=t.key===`ArrowRight`?e[(r+1)%e.length]:t.key===`ArrowLeft`?e[(r-1+e.length)%e.length]:void 0;n&&(o(n.id),document.getElementById(`tab-${n.id}`)?.focus())},className:i(a===t.id),children:[t.label,t.n!==void 0&&(0,n.jsx)(`span`,{className:`text-[12px] text-muted tabular-nums`,children:t.n})]},t.id))})}function o({links:e,current:a,label:o,className:s}){return(0,n.jsx)(`nav`,{"aria-label":o,className:t(r,s),children:e.map(e=>(0,n.jsx)(`a`,{href:e.href,"aria-current":a===e.id?`page`:void 0,className:t(i(a===e.id),`no-underline hover:no-underline`,a===e.id&&`hover:text-ink`),children:e.label},e.id))})}export{i,a as n,r,o as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Ht as e,qt as t}from"./Shell-
|
|
1
|
+
import{Ht as e,qt as t}from"./Shell-8Y6stc_6.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`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{
|
|
1
|
+
import{lo as e,oo as t,wa as n}from"./Shell-8Y6stc_6.js";import{n as r}from"./thread-Dy_QsQDd.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,9 +5,9 @@
|
|
|
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-
|
|
9
|
-
<link rel="modulepreload" crossorigin href="/assets/Shell-
|
|
10
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-DuWTO5cE.js"></script>
|
|
9
|
+
<link rel="modulepreload" crossorigin href="/assets/Shell-8Y6stc_6.js">
|
|
10
|
+
<link rel="stylesheet" crossorigin href="/assets/index-X6LBvWis.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
|
13
13
|
<div id="root"></div>
|
package/docs/user-guide.html
CHANGED
|
@@ -1837,8 +1837,25 @@ environment ("run the checkout tests in UAT"): each test tool takes an
|
|
|
1837
1837
|
<tr><td>Scribe, the healer, the reviewer</td><td>Write tests that read <code>FORGEQE_APP_<APP>_URL</code> (or the repository's own settings), never a fixed environment URL; the reviewer flags one</td></tr>
|
|
1838
1838
|
<tr><td>Tests ForgeQE runs, pack pipelines</td><td><code>FORGEQE_ACTIVE_ENV</code>, <code>FORGEQE_APP_<APP>_URL</code> / <code>_PATH</code> / <code>_ID</code>, <code>FORGEQE_VAR_<NAME></code>, <code>FORGEQE_DATA_<NAME></code> (pipelines written by <code>forgeqe pack pipeline init</code> take them as the <code>env_vars</code> input)</td></tr>
|
|
1839
1839
|
<tr><td>Reports</td><td>Every run's report names the test environment</td></tr>
|
|
1840
|
+
<tr><td>Test cases (<code>run_test_cases</code>, <code>forgeqe suite</code>)</td><td><code>{{var.NAME}}</code> and <code>{{app.NAME}}</code> in a case's title, steps and expected results become the environment's variable and the app's URL (below); a case with no address of its own starts at the web app its first step, preconditions or title names first, else at <code>start_app</code>; <code>run_test_cases</code> takes <code>app</code> to start every case at one</td></tr>
|
|
1840
1841
|
</tbody>
|
|
1841
1842
|
</table></div>
|
|
1843
|
+
<p>A test case can name the active environment's values, so one case runs in every environment:</p>
|
|
1844
|
+
<pre><code class="language-yaml">- title: Book an appointment for {{var.employer_name}}
|
|
1845
|
+
steps:
|
|
1846
|
+
- action: Open {{app.CorporatePortal}} and sign in
|
|
1847
|
+
expected: The dashboard shows {{var.employer_name}}
|
|
1848
|
+
</code></pre>
|
|
1849
|
+
<p><code>{{var.NAME}}</code> takes a value of <code>variables:</code> and <code>{{app.NAME}}</code> (or <code>{{app.NAME.url}}</code>) a web or API app's URL, the name
|
|
1850
|
+
written any way ("Corporate Portal" for <code>CorporatePortal</code>). A name the environment does not have, a desktop app, or a
|
|
1851
|
+
secret's name is left as written and listed in the run's log: secrets are never put into a case.</p>
|
|
1852
|
+
<p>Before a browser run or a suite starts, ForgeQE checks what the request and its test cases name against env.yaml and
|
|
1853
|
+
forgeqe.yaml: <code>{{var.…}}</code> and <code>{{app.…}}</code>, test users named like <code>withdocs_user</code>, saved logins (their variables set, and
|
|
1854
|
+
their <code>domains</code> covering where the run opens) and <code><secret>…</secret></code> placeholders. Anything missing is listed, with its
|
|
1855
|
+
fix, before the browser opens: stop and give the values (credentials become a login for the session, never part of a
|
|
1856
|
+
goal), or run anyway. With nobody to ask, nothing runs until the agent has asked you.</p>
|
|
1857
|
+
<p>Edit env.yaml or forgeqe.yaml during a chat (the web app's or the terminal's) and the next message reads them again, with
|
|
1858
|
+
the conversation kept; a file that no longer loads keeps the chat on what it read before, and says why.</p>
|
|
1842
1859
|
<p>There is no scenario file to write: ask in plain language ("place an order in the shop, then check its invoice in
|
|
1843
1860
|
Billing, in UAT") and ForgeQE's agent picks the apps from their descriptions, shows the plan, runs each step with the
|
|
1844
1861
|
right engine, and carries values from one app to the next.</p>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capagents/forgeqe",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.6",
|
|
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/py/forgeqe_engine/cli.py
CHANGED
|
@@ -54,6 +54,9 @@ def _engine_settings() -> None:
|
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
def _configure_env() -> None:
|
|
57
|
+
from .neutral_log import install as neutral_logs
|
|
58
|
+
|
|
59
|
+
neutral_logs()
|
|
57
60
|
_engine_settings()
|
|
58
61
|
os.environ.update(NO_TELEMETRY)
|
|
59
62
|
os.environ.setdefault("BROWSER_USE_LOGGING_LEVEL", "info")
|
|
@@ -266,3 +266,77 @@ async def save_sessions(browser: Any, logins: List[Login], written: Dict[str, st
|
|
|
266
266
|
except Exception as ex:
|
|
267
267
|
logger.warning("login %s: could not save the session: %s", name, ex)
|
|
268
268
|
return saved
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
_ANY_TAG = re.compile(r"<secret>\s*(.*?)\s*</secret>", re.S)
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
def _tags(value: Any) -> List[str]:
|
|
275
|
+
"""Every <secret>NAME</secret> in an action's parameters, at any depth."""
|
|
276
|
+
if isinstance(value, str):
|
|
277
|
+
return _ANY_TAG.findall(value)
|
|
278
|
+
if isinstance(value, dict):
|
|
279
|
+
return [t for v in value.values() for t in _tags(v)]
|
|
280
|
+
if isinstance(value, (list, tuple)):
|
|
281
|
+
return [t for v in value for t in _tags(v)]
|
|
282
|
+
return []
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
def unfilled_secrets(params: Any, sensitive: Dict[str, Dict[str, str]], url: str) -> List[str]:
|
|
286
|
+
"""
|
|
287
|
+
The <secret> placeholders in `params` the library would not fill on `url`: none of the run's logins has the name, or
|
|
288
|
+
its login's domains do not match this page. The library types those as they are written, tags and all.
|
|
289
|
+
"""
|
|
290
|
+
from browser_use.utils import match_url_with_domain_pattern
|
|
291
|
+
|
|
292
|
+
names = _tags(params)
|
|
293
|
+
if not names:
|
|
294
|
+
return []
|
|
295
|
+
here: Dict[str, str] = {}
|
|
296
|
+
for pattern, values in (sensitive or {}).items():
|
|
297
|
+
if isinstance(values, dict) and url and match_url_with_domain_pattern(url, pattern):
|
|
298
|
+
here.update({k: v for k, v in values.items() if v})
|
|
299
|
+
return sorted({n for n in names if n not in here})
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
def _dump(action: Any) -> Any:
|
|
303
|
+
try:
|
|
304
|
+
return action.model_dump(exclude_unset=True)
|
|
305
|
+
except Exception:
|
|
306
|
+
return {}
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
def guard_secrets(tools: Any, sensitive: Dict[str, Dict[str, str]]) -> None:
|
|
310
|
+
"""
|
|
311
|
+
Wrap tools.act so an action whose <secret> placeholder would not be filled on the current page is refused, with why,
|
|
312
|
+
instead of the tag being typed into the page: a login missing, its values not set, or the sign-in page on a host its
|
|
313
|
+
domains do not list.
|
|
314
|
+
"""
|
|
315
|
+
original = tools.act
|
|
316
|
+
|
|
317
|
+
async def act(action: Any, browser_session: Any = None, *args: Any, **kwargs: Any):
|
|
318
|
+
session = browser_session if browser_session is not None else kwargs.get("browser_session")
|
|
319
|
+
params = _dump(action)
|
|
320
|
+
if _tags(params):
|
|
321
|
+
url = ""
|
|
322
|
+
try:
|
|
323
|
+
url = await session.get_current_page_url() if session is not None else ""
|
|
324
|
+
except Exception:
|
|
325
|
+
url = ""
|
|
326
|
+
missing = unfilled_secrets(params, sensitive, url)
|
|
327
|
+
if missing:
|
|
328
|
+
from browser_use.agent.views import ActionResult
|
|
329
|
+
|
|
330
|
+
host = urlparse(url).hostname or "this page"
|
|
331
|
+
known = sorted({k for values in (sensitive or {}).values() if isinstance(values, dict) for k in values})
|
|
332
|
+
logger.warning("Refused an action with unfilled secret placeholders %s on %s", ", ".join(missing), host)
|
|
333
|
+
why = (
|
|
334
|
+
f"Not typed: {', '.join(f'<secret>{m}</secret>' for m in missing)} has no value on {host}. "
|
|
335
|
+
+ (f"The saved login placeholders are {', '.join(known)}; each is filled only on its login's sites. " if known else "This run has no saved login with values. ")
|
|
336
|
+
+ "Never type a <secret> tag you were not given for this site. Type a value the task itself gives, "
|
|
337
|
+
"or stop and report that the login is not set up for this site (logins: in forgeqe.yaml, with this host in its domains)."
|
|
338
|
+
)
|
|
339
|
+
return ActionResult(error=why)
|
|
340
|
+
return await original(action, browser_session, *args, **kwargs)
|
|
341
|
+
|
|
342
|
+
tools.act = act
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Log records in ForgeQE's own words: the engine's browser library names itself in its logger names ("browser_use.Agent")
|
|
3
|
+
and in some messages ("Starting a browser-use agent", links to its project). The engine's log reaches people (the
|
|
4
|
+
terminal, a failed run's error, the session log), so each record is reworded as it is made: the library's logger
|
|
5
|
+
names become "engine...", its name in a message becomes "engine", and a message that only points at its project
|
|
6
|
+
(an issue tracker, its docs, its cloud) loses that link.
|
|
7
|
+
"""
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import logging
|
|
11
|
+
import re
|
|
12
|
+
from typing import Any
|
|
13
|
+
|
|
14
|
+
_LIBRARY = "browser_use"
|
|
15
|
+
_PROJECT_LINK = re.compile(r"\s*\(?\bhttps?://(?:[\w.-]*\.)?(?:github\.com/browser-use|browser-use\.com)\S*\)?", re.IGNORECASE)
|
|
16
|
+
_NAME = re.compile(r"\bbrowser[-_ ]?use\b", re.IGNORECASE)
|
|
17
|
+
|
|
18
|
+
_installed = False
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def neutral_name(name: str) -> str:
|
|
22
|
+
"""The library's logger names, shortened as its own formatter shortens them at info level, under "engine"."""
|
|
23
|
+
if name == _LIBRARY:
|
|
24
|
+
return "engine"
|
|
25
|
+
if not name.startswith(_LIBRARY + "."):
|
|
26
|
+
return name
|
|
27
|
+
rest = name[len(_LIBRARY) + 1:]
|
|
28
|
+
for part in ("Agent", "BrowserSession", "tools", "dom"):
|
|
29
|
+
if part in rest:
|
|
30
|
+
return "engine." + part
|
|
31
|
+
return "engine." + rest.split(".")[-1]
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def neutral_text(text: str) -> str:
|
|
35
|
+
return _NAME.sub("engine", _PROJECT_LINK.sub("", text))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _neutral_arg(value: Any) -> Any:
|
|
39
|
+
return neutral_text(value) if isinstance(value, str) else value
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def install() -> None:
|
|
43
|
+
"""Reword every log record from now on (once per process)."""
|
|
44
|
+
global _installed
|
|
45
|
+
if _installed:
|
|
46
|
+
return
|
|
47
|
+
_installed = True
|
|
48
|
+
make = logging.getLogRecordFactory()
|
|
49
|
+
|
|
50
|
+
def factory(*args: Any, **kwargs: Any) -> logging.LogRecord:
|
|
51
|
+
record = make(*args, **kwargs)
|
|
52
|
+
record.name = neutral_name(record.name)
|
|
53
|
+
if isinstance(record.msg, str):
|
|
54
|
+
record.msg = neutral_text(record.msg)
|
|
55
|
+
if isinstance(record.args, tuple):
|
|
56
|
+
record.args = tuple(_neutral_arg(a) for a in record.args)
|
|
57
|
+
elif isinstance(record.args, dict):
|
|
58
|
+
record.args = {k: _neutral_arg(v) for k, v in record.args.items()}
|
|
59
|
+
return record
|
|
60
|
+
|
|
61
|
+
logging.setLogRecordFactory(factory)
|
|
@@ -22,7 +22,7 @@ from typing import Any, Callable, Dict, List, Optional, Set, Tuple
|
|
|
22
22
|
|
|
23
23
|
from . import brand, userlike
|
|
24
24
|
from .diagnostics import Diagnostics, box_for
|
|
25
|
-
from .logins import _host_matches, can_sign_in, load_sessions, parse_logins, prompt_block, save_sessions, use_logins
|
|
25
|
+
from .logins import _host_matches, can_sign_in, guard_secrets, load_sessions, parse_logins, prompt_block, save_sessions, use_logins
|
|
26
26
|
from .memory import READ_ONLY_ACTIONS, MemoryStore, compact_step, flow_step, page_id
|
|
27
27
|
from .prompts import CONVENTIONS, text as prompt_text, use_prompts
|
|
28
28
|
from .report import CASE_REPORT_INSTRUCTION, CaseReport, build_timeline, case_report_from_history
|
|
@@ -1427,6 +1427,8 @@ async def run_browser_task(req: RunRequest, emit: Emit, cancel_event: asyncio.Ev
|
|
|
1427
1427
|
register_click_selector(agent_tools, captured)
|
|
1428
1428
|
register_api_request(agent_tools, captured)
|
|
1429
1429
|
install_effects(agent_tools, action_effects, captured)
|
|
1430
|
+
# Outermost: a <secret> tag that would not be filled here is refused before anything is typed or recorded.
|
|
1431
|
+
guard_secrets(agent_tools, sensitive or {})
|
|
1430
1432
|
agent_kw["tools"] = agent_tools
|
|
1431
1433
|
agent_kw.update(_browser_use_agent_tuning_kwargs())
|
|
1432
1434
|
if extend_msg:
|
|
@@ -187,6 +187,11 @@ class AppiumDriver:
|
|
|
187
187
|
self._script("mobile: activateApp", {"appId": app.app_id} if app.platform == "android" else {"bundleId": app.app_id})
|
|
188
188
|
return
|
|
189
189
|
caps = {**app.capabilities(), **self.extra_caps}
|
|
190
|
+
# A native app session must not send browserName: device clouds (TestMu, BrowserStack) reject a session that
|
|
191
|
+
# has both an app package and a browser. The app's own capabilities never set it, but extra_caps may carry one
|
|
192
|
+
# from the workspace config; drop it so the native session starts cleanly.
|
|
193
|
+
if "appium:appPackage" in caps or "appium:bundleId" in caps:
|
|
194
|
+
caps.pop("browserName", None)
|
|
190
195
|
# TestMu AI (LambdaTest) reads the app from LT:Options: the app's own build, unless the config names one there.
|
|
191
196
|
lt = caps.get("LT:Options")
|
|
192
197
|
if isinstance(lt, dict) and app.app and "app" not in lt:
|
|
@@ -20,6 +20,7 @@ from forgeqe_desktop.checks import read_outcome
|
|
|
20
20
|
from forgeqe_desktop.memory import CHECK_OPS, action_steps, memory_note, replay_known, target_key
|
|
21
21
|
from forgeqe_desktop.record import target_of
|
|
22
22
|
from forgeqe_desktop.workflow import MOBILE_FORMAT, SWIPE_DIRECTIONS, fill, secret_names, validate
|
|
23
|
+
from forgeqe_engine.loops import STEP_EXTENSIONS, making_progress
|
|
23
24
|
|
|
24
25
|
MAX_STEPS = 40
|
|
25
26
|
MAX_CONTROLS = 120
|
|
@@ -151,10 +152,23 @@ def explore(
|
|
|
151
152
|
note = memory_note(known)
|
|
152
153
|
worked = memory.worked(spec.name) if memory is not None else {}
|
|
153
154
|
outcome: Dict[str, Any] = {"done": False, "reason": "", "checks": 0, "values": {}, "replayed": len(known["done"]), "memory": known["kind"]}
|
|
154
|
-
|
|
155
|
+
# max_steps is a checkpoint: a run still making progress carries on, up to (1 + STEP_EXTENSIONS) x max_steps.
|
|
156
|
+
step_cap = max_steps * (1 + STEP_EXTENSIONS)
|
|
157
|
+
turn_outcomes: List[bool] = []
|
|
158
|
+
model_turns = 0
|
|
159
|
+
exhausted = False
|
|
160
|
+
start = len(history)
|
|
161
|
+
for turn in range(start, start + step_cap):
|
|
155
162
|
if should_stop():
|
|
156
163
|
outcome["reason"] = "stopped"
|
|
157
164
|
break
|
|
165
|
+
# At each max_steps checkpoint, carry on only while the run is making progress.
|
|
166
|
+
if max_steps > 0 and model_turns > 0 and model_turns % max_steps == 0:
|
|
167
|
+
if making_progress(turn_outcomes):
|
|
168
|
+
log(f"Reached {model_turns} steps and still making progress: carrying on, up to {step_cap}")
|
|
169
|
+
else:
|
|
170
|
+
exhausted = True
|
|
171
|
+
break
|
|
158
172
|
sleep(settle)
|
|
159
173
|
options = controls_now(driver)
|
|
160
174
|
marked = [_worked_before(o, worked) for o in options]
|
|
@@ -173,8 +187,10 @@ def explore(
|
|
|
173
187
|
if png:
|
|
174
188
|
content.append({"type": "image_url", "image_url": {"url": "data:image/png;base64," + base64.b64encode(png).decode(), "detail": "low"}})
|
|
175
189
|
reply = model.complete([{"role": "system", "content": SYSTEM}, {"role": "user", "content": content}], max_tokens=300, json_mode=True)
|
|
190
|
+
model_turns += 1
|
|
176
191
|
act = parse_action(reply, len(options), secret_list)
|
|
177
192
|
if act is None:
|
|
193
|
+
turn_outcomes.append(False)
|
|
178
194
|
history.append(f"{turn + 1}. (an answer that was not a valid action was ignored)")
|
|
179
195
|
continue
|
|
180
196
|
a = act["action"]
|
|
@@ -192,6 +208,7 @@ def explore(
|
|
|
192
208
|
if target not in dismiss:
|
|
193
209
|
dismiss.append(target)
|
|
194
210
|
on_step({"index": len(steps), "op": "dismiss", "target": target})
|
|
211
|
+
turn_outcomes.append(True)
|
|
195
212
|
history.append(f"{turn + 1}. closed a system dialog with {target.get('name') or target.get('automation_id')}")
|
|
196
213
|
continue
|
|
197
214
|
if a == "tap":
|
|
@@ -213,14 +230,18 @@ def explore(
|
|
|
213
230
|
driver.back()
|
|
214
231
|
step = {"op": "back"}
|
|
215
232
|
except Exception as e:
|
|
233
|
+
turn_outcomes.append(False)
|
|
216
234
|
history.append(f"{turn + 1}. {a} failed: {str(e)[:200]}")
|
|
217
235
|
continue
|
|
236
|
+
turn_outcomes.append(True)
|
|
218
237
|
steps.append(step)
|
|
219
238
|
on_step({"index": len(steps), **step})
|
|
220
239
|
label = step.get("target", {}).get("name") or step.get("target", {}).get("automation_id") or step.get("direction") or ""
|
|
221
240
|
history.append(f"{turn + 1}. {step['op']} {label}" + (f" text={step['text']!r}" if "text" in step else ""))
|
|
222
241
|
else:
|
|
223
|
-
|
|
242
|
+
exhausted = True
|
|
243
|
+
if exhausted:
|
|
244
|
+
outcome["reason"] = f"no answer that the goal is done after {model_turns} steps"
|
|
224
245
|
if len(steps) > 1 and outcome["done"]:
|
|
225
246
|
try:
|
|
226
247
|
checks, values = read_outcome(model, driver, goal, secrets=secrets, log=log)
|