@capagents/forgeqe 2.6.6 → 2.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/forgeqe.js +1336 -1336
- package/dist/web/assets/{Agent-DEt3EWA_.js → Agent-CwOEhl3M.js} +2 -2
- package/dist/web/assets/{ApiTests-DYdaFLNz.js → ApiTests-ebwSDQ5F.js} +2 -2
- package/dist/web/assets/{Chat-CKxzWgEC.js → Chat-fc4s0KBG.js} +1 -1
- package/dist/web/assets/Data-BBSVyXif.js +3 -0
- package/dist/web/assets/Evidence-xQn-8UJ5.js +1 -0
- package/dist/web/assets/{Features-DCT-cbJc.js → Features-DMprjJBi.js} +1 -1
- package/dist/web/assets/{Jobs-DeTQrrks.js → Jobs-C5JjDoQC.js} +2 -2
- package/dist/web/assets/{KindPage-_X13FTTE.js → KindPage-Gf-RWsx6.js} +1 -1
- package/dist/web/assets/{Migration-fmIj_G3z.js → Migration-Cbc7TAP9.js} +1 -1
- package/dist/web/assets/Product-B6SRmrz4.js +1 -0
- package/dist/web/assets/Quality-DfcLg8mD.js +1 -0
- package/dist/web/assets/{Record-BxvtM3w6.js → Record-BDZoXfKO.js} +1 -1
- package/dist/web/assets/{Regression-DMzaMaHl.js → Regression-F1U3vWLw.js} +2 -2
- package/dist/web/assets/{Reports-DcOPRMjx.js → Reports-C2r9-5sZ.js} +1 -1
- package/dist/web/assets/Response-BGXyV_fV.js +4 -0
- package/dist/web/assets/Runs--yZ27eAW.js +2 -0
- package/dist/web/assets/Shell-DFE3OHxz.js +3 -0
- package/dist/web/assets/{TestCases-COdZhCPY.js → TestCases-BE_KAXkn.js} +1 -1
- package/dist/web/assets/{TestData-BorHzvQT.js → TestData-BY-Uy6yE.js} +1 -1
- package/dist/web/assets/{WhatsNew-Bc9JhLJC.js → WhatsNew-CDUGGomx.js} +1 -1
- package/dist/web/assets/{arrow-down-OOnlMKAE.js → arrow-down-DNipP8bN.js} +1 -1
- package/dist/web/assets/{arrow-right-B3tcUlkA.js → arrow-right-3diDdbrG.js} +1 -1
- package/dist/web/assets/circle-2Nb63Bbk.js +1 -0
- package/dist/web/assets/{circle-dashed-kZh6s667.js → circle-dashed-KlSRxdRt.js} +1 -1
- package/dist/web/assets/{circle-dot-B5NyEMK3.js → circle-dot-CyXWfSFI.js} +1 -1
- package/dist/web/assets/{dataParts-C9gI1SAK.js → dataParts-CqEfwqh-.js} +1 -1
- package/dist/web/assets/{index-BxNs3KZC.js → index-j5ulUL9f.js} +4 -4
- package/dist/web/assets/index-tEriRdXB.css +2 -0
- package/dist/web/assets/{keyboard-Chpodklu.js → keyboard-DLO6H_RC.js} +1 -1
- package/dist/web/assets/{pencil-BKPpdCqf.js → pencil-q2eQBct0.js} +1 -1
- package/dist/web/assets/{productParts-RYNeN2sM.js → productParts-CCIZ-xzs.js} +1 -1
- package/dist/web/assets/{qualityParts-BtCR-0Bc.js → qualityParts-Bhq6Zhdf.js} +1 -1
- package/dist/web/assets/thread-DJKWZFQL.js +5 -0
- package/dist/web/assets/{upload-A3zIIPtY.js → upload-OfrEvr0l.js} +1 -1
- package/dist/web/assets/{usePageChat-D-iqArIy.js → usePageChat-BaearoXT.js} +1 -1
- package/dist/web/index.html +3 -3
- package/package.json +1 -1
- package/dist/web/assets/Data-DityccKX.js +0 -3
- package/dist/web/assets/Evidence-B-LwSbo6.js +0 -1
- package/dist/web/assets/Product-D-WBRE7V.js +0 -1
- package/dist/web/assets/Quality-CGVs0dP9.js +0 -1
- package/dist/web/assets/Response-C6MFROng.js +0 -4
- package/dist/web/assets/Runs-Bzt7oS2o.js +0 -2
- package/dist/web/assets/Shell-C-_iUijV.js +0 -3
- package/dist/web/assets/circle-8GDOF-jD.js +0 -1
- package/dist/web/assets/index-o-gUBlx9.css +0 -2
- package/dist/web/assets/thread-BVeiwKSf.js +0 -5
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{Bt as e,Di as t,Ei as n,En as r,Gt as i,Ht as a,Lr as o,Or as s,Si as c,U as l,Vt as u,Wt as d,Xn as f,Xr as p,_r as m,at as h,bn as g,bt as _,cr as v,ct as y,dn as b,et as x,ir as S,mn as C,mr as w,n as T,nn as E,nt as D,ot as O,qr as k,tt as A,vt as j,w as M,wi as N,yn as P}from"./Shell-C-_iUijV.js";import{a as F,c as I,d as L,f as ee,l as R,n as z,p as B,r as V,s as te,t as ne}from"./dataParts-C9gI1SAK.js";import{H,t as re}from"./index-BxNs3KZC.js";import{t as ie}from"./when-CHnpLdYw.js";var U={name:`waypoints`,size:24,node:[[`path`,{d:`m10.586 5.414-5.172 5.172`,key:`4mc350`}],[`path`,{d:`m18.586 13.414-5.172 5.172`,key:`8c96vv`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`circle`,{cx:`12`,cy:`20`,r:`2`,key:`144qzu`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}],[`circle`,{cx:`20`,cy:`12`,r:`2`,key:`1xzzfp`}],[`circle`,{cx:`4`,cy:`12`,r:`2`,key:`1hvhnz`}]]};U.node;var W=o(U),ae=n({Ask:()=>$,Data:()=>me}),G=t(N(),1),K=c(),q=[`databases`,`ask`,`flows`],oe={test:`databases`,tables:`databases`,query:`databases`,ask:`ask`,checks:`ask`,request:`ask`,check:`flows`,trace:`flows`},J=e=>(e?.keys||[]).map(e=>typeof e==`object`&&e?`${e.key}×${e.times}`:String(e)).join(`, `);function Y({id:e,icon:t,children:n,aside:r}){return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsxs)(`h3`,{id:e,className:`m-0 flex flex-1 items-center gap-2 text-base font-semibold`,children:[(0,K.jsx)(a,{icon:t,size:18,className:`text-accent-fg`}),n]}),r]})}function se(e){let t=e.filter(e=>!/^args |^token /.test(e)&&e.trim()),n=t.slice(1).map(e=>/^([\w$#.\-]+): (.*)$/.exec(e.trim())).filter(Boolean);return n.length&&n.length>=t.length-2?n.map(e=>({name:e[1],about:e[2]})):null}function ce({db:t,job:n,busy:r,act:o}){let[c,f]=(0,G.useState)(``),[p,m]=(0,G.useState)(``),[_,v]=(0,G.useState)(`200`),S=n&&!n.running&&n.target===t.name?n:null,C=S?.kind===`query`?S.result:void 0,w=S?.kind===`test`?S.lines.filter(e=>/^[✓✗]/.test(e.trim())).join(` `)||S.lines.filter(e=>!/^args |^token /.test(e)).slice(-1)[0]:``,T=S?.kind===`tables`?S.lines:null,O=T?se(T):null,k=e=>/^[a-z_][a-z0-9_.]*$/.test(e)?e:`"${e.replace(/"/g,`""`)}"`;return(0,K.jsxs)(`section`,{"aria-labelledby":`db-h`,className:`flex min-w-0 flex-[999_1_560px] flex-col gap-7`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-1`,children:[(0,K.jsx)(`h2`,{id:`db-h`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:t.name}),(0,K.jsx)(`span`,{className:`text-sm text-muted [overflow-wrap:anywhere]`,children:[t.engine||`from its connection string`,t.where,t.auth===`password`?``:t.auth].filter(Boolean).join(` · `)}),t.description&&(0,K.jsx)(`span`,{className:`text-sm text-ink-2`,children:t.description})]}),(0,K.jsx)(h,{tone:t.writable?`warn`:`neutral`,icon:t.writable,children:t.writable?`Writable, after asking`:`Read only`})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsxs)(e,{disabled:r,onClick:()=>o(`test`,{db:t.name}),children:[(0,K.jsx)(a,{icon:P,size:16}),`Test the connection`]}),(0,K.jsxs)(`a`,{href:y(`data`,`ask`,encodeURIComponent(t.name)),className:d(u(),`no-underline`),children:[(0,K.jsx)(s,{size:16,"aria-hidden":`true`}),`Ask in words`]})]}),w&&(0,K.jsx)(`p`,{className:d(`m-0 rounded-[12px] px-3 py-2 text-sm [overflow-wrap:anywhere]`,S?.exitCode===0?`bg-pass-soft text-pass`:`bg-fail-soft text-fail`),children:w.replace(/^[✓✗]\s*/,``)})]}),(0,K.jsxs)(`section`,{"aria-labelledby":`tables-h`,className:`flex flex-col gap-3`,children:[(0,K.jsx)(Y,{id:`tables-h`,icon:E,children:`Tables`}),(0,K.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),o(`tables`,{db:t.name,...c.trim()?{search:c.trim()}:{}})},children:[(0,K.jsx)(x,{"aria-label":`Tables whose names, comments or columns hold`,value:c,placeholder:`Words in a table's name, comment or columns`,onChange:e=>f(e.target.value),className:`min-w-0 w-full max-w-[320px] flex-[0_1_320px]`}),(0,K.jsxs)(e,{type:`submit`,disabled:r,children:[(0,K.jsx)(a,{icon:E,size:16}),c.trim()?`Find tables`:`Show tables`]})]}),T&&O&&(0,K.jsx)(l,{label:`Tables`,search:!1,size:15,resetKey:T,head:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`th`,{className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`Table`}),(0,K.jsx)(`th`,{className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`What it holds`}),(0,K.jsx)(`th`,{className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:(0,K.jsx)(`span`,{className:`sr-only`,children:`Query it`})})]}),children:O.map(t=>(0,K.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,K.jsx)(`td`,{className:d(`px-3 py-2`,`font-mono text-[12.5px]`),children:t.name}),(0,K.jsx)(`td`,{className:d(`px-3 py-2`,`text-muted`),children:t.about}),(0,K.jsx)(`td`,{className:d(`px-3 py-2`,`text-right`),children:(0,K.jsx)(e,{size:`sm`,variant:`ghost`,onClick:()=>m(`select * from ${k(t.name)} limit 50`),children:`Query it`})})]},t.name))}),T&&!O&&(0,K.jsx)(z,{label:`Tables`,children:T.filter(e=>!/^args |^token /.test(e)).join(`
|
|
2
|
-
`)})]}),(0,K.jsxs)(`section`,{"aria-labelledby":`query-h`,className:`flex flex-col gap-3`,children:[(0,K.jsx)(Y,{id:`query-h`,icon:b,children:`Query`}),(0,K.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`One read, in the database's own dialect. To write the SQL from a question, use Ask in words.`}),(0,K.jsx)(`label`,{className:`sr-only`,htmlFor:`sql`,children:`SQL`}),(0,K.jsx)(D,{id:`sql`,rows:5,value:p,spellCheck:!1,placeholder:t.engine===`mongodb`?`{"find": "orders", "filter": {"status": "open"}}`:`select * from orders where created_at > now() - interval '1 day'`,onChange:e=>m(e.target.value),className:`font-mono text-[13px]`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsxs)(e,{variant:`primary`,disabled:r||!p.trim(),onClick:()=>o(`query`,{db:t.name,sql:p,maxRows:Number(_)}),children:[(0,K.jsx)(a,{icon:g,size:16}),`Run`]}),(0,K.jsxs)(e,{disabled:r||!p.trim(),onClick:()=>o(`query`,{db:t.name,sql:p,dryRun:!0}),children:[(0,K.jsx)(H,{size:16,"aria-hidden":`true`}),`Check only`]}),(0,K.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-muted`,children:[`Rows`,(0,K.jsx)(A,{value:_,onChange:e=>v(e.target.value),className:`w-[96px]`,children:[`50`,`200`,`1000`].map(e=>(0,K.jsx)(`option`,{children:e},e))})]})]}),C&&!C.ok&&(0,K.jsx)(I,{text:C.needs_confirmation?`Only reads run here. Ask in a chat to change data: it shows the statement and asks first.`:C.error||`The query failed.`}),C?.ok&&C.dry_run&&(0,K.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-pass-soft px-3 py-2 text-sm text-pass`,children:[C.note||`The database accepts it.`,C.columns?.length?` Columns: ${C.columns.join(`, `)}`:``]}),C?.ok&&!C.dry_run&&C.columns&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(R,{columns:C.columns,rows:C.rows||[]}),(0,K.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[i(C.row_count??C.rows?.length??0,`row`),C.truncated?` (more not shown)`:``,C.ms===void 0?``:` in ${C.ms} ms`]})]})]})]})}function le({view:e,job:t,busy:n,act:r,sub:i}){let o=e.databases.find(e=>e.name===i)||e.databases[0];return e.databases.length?(0,K.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-8 gap-y-6`,children:[(0,K.jsxs)(`nav`,{"aria-label":`Databases`,className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1 @2xl:sticky @2xl:top-6 @2xl:max-w-[280px]`,children:[(0,K.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.databases.map(e=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(`a`,{href:y(`data`,`databases/${encodeURIComponent(e.name)}`),"aria-current":o?.name===e.name?`page`:void 0,className:d(`flex min-h-[52px] items-center gap-3 rounded-[12px] px-3 py-2 text-ink no-underline`,o?.name===e.name?`bg-surface-strong hover:text-ink`:`hover:bg-surface-muted hover:text-ink`),children:[(0,K.jsx)(a,{icon:v,size:18,className:`flex-none text-muted`}),(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,K.jsx)(`span`,{className:`truncate text-[14px] font-medium`,children:e.name}),(0,K.jsx)(`span`,{className:`truncate text-[12px] text-muted`,children:[e.engine||`connection string`,e.writable?`writable`:`read only`].join(` · `)})]})]})},e.name))}),(0,K.jsx)(`a`,{href:y(`settings`,`databases`),className:`px-3 pt-1 text-[13px]`,children:`Add or change in Settings`})]}),o&&(0,K.jsx)(ce,{db:o,job:t,busy:n,act:r},o.name)]}):(0,K.jsx)(X,{})}function X(){return(0,K.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,K.jsx)(a,{icon:v,size:24,className:`text-muted`}),(0,K.jsx)(`p`,{className:`m-0 max-w-[62ch] leading-relaxed text-ink-2`,children:`No databases yet. Add one in Settings: a connection string, or its host, user and password, kept in your credential store.`}),(0,K.jsx)(`a`,{href:y(`settings`,`databases`),className:`text-sm font-medium`,children:`Settings, Databases`})]})}var Z=[{id:`query`,label:`Query and rows`,icon:b,about:`A read-only SQL query, run, with its rows. Kept in test-data/queries.`,example:`Which titles have more than 100 votes, highest first?`},{id:`testdata`,label:`Test data`,icon:f,about:`Existing rows found with a query, or new rows from a spec with their INSERT script. Logged on the Test data page.`,example:`Two queued watchlist entries for a new viewer`},{id:`script`,label:`Test script`,icon:w,about:`A database test for pytest or Playwright that checks what you ask. Kept in test-data/scripts, never run here.`,example:`Every rating belongs to a title, and votes are never negative`},{id:`checks`,label:`Data checks`,icon:m,about:`SQL checks that each find the rows breaking one rule, run now and kept to run again.`,example:`Check the watchlist: no unknown titles, no empty handles, no duplicate entries`}],Q={query:`Query`,checks:`Checks`,script:`Test script`};function ue({r:e,onNote:t}){return e.ok?(0,K.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.why&&(0,K.jsx)(`p`,{className:`m-0 text-sm text-ink-2`,children:e.why}),e.as===`query`&&(0,K.jsxs)(K.Fragment,{children:[e.sql&&(0,K.jsx)(z,{label:`SQL`,children:e.sql}),e.columns&&(0,K.jsx)(R,{columns:e.columns,rows:e.rows||[]}),(0,K.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[i(e.row_count??e.rows?.length??0,`row`),e.truncated?` (more not shown)`:``]})]}),e.as===`checks`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{className:`m-0 text-sm tabular-nums`,children:[(0,K.jsxs)(`span`,{className:`text-pass`,children:[e.passed,` passed`]}),` · `,(0,K.jsxs)(`span`,{className:e.failed?`text-fail`:`text-muted`,children:[e.failed,` failed`]})]}),(0,K.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:(e.checks||[]).map((e,t)=>(0,K.jsxs)(`li`,{className:`flex flex-col gap-2 border-t border-line-soft py-2.5 text-sm first:border-t-0`,children:[(0,K.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(h,{tone:e.ok?`pass`:`fail`,children:e.ok?`Passed`:`Failed`}),(0,K.jsx)(`span`,{className:`min-w-0 font-medium [overflow-wrap:anywhere]`,children:e.name}),e.error?(0,K.jsx)(`span`,{className:`text-fail [overflow-wrap:anywhere]`,children:e.error}):e.failing?(0,K.jsxs)(`span`,{className:`text-muted`,children:[i(e.failing,`row`),` break it`]}):null]}),(0,K.jsxs)(`details`,{children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-[13px] text-muted`,children:e.failing?`The rows and the query`:`The query`}),(0,K.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2`,children:[e.columns&&e.rows?.length?(0,K.jsx)(R,{columns:e.columns,rows:e.rows}):null,(0,K.jsx)(z,{label:`Query of ${e.name}`,children:e.sql})]})]})]},t))})]}),e.as===`script`&&e.code&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{className:`text-sm`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:e.framework===`playwright`?`Playwright Test`:`pytest`}),(0,K.jsx)(`span`,{className:`text-muted`,children:` · not run here; it reads its connection string from the environment`})]}),(0,K.jsx)(z,{label:`Test script`,children:e.code})]}),(0,K.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-sm`,children:[`Kept`,e.file&&(0,K.jsx)(V,{file:e.file,onNote:t})]}),e.again&&(0,K.jsxs)(`p`,{className:`m-0 text-[13px] text-muted [overflow-wrap:anywhere]`,children:[`Again, without a model: `,(0,K.jsx)(`code`,{className:`font-mono text-[12px] text-ink-2`,children:e.again})]})]}):(0,K.jsx)(I,{text:e.error||`The DB agent could not answer.`})}function $({view:t,job:n,busy:r,act:i,preset:o}){let c=t.databases.find(e=>e.name===o)?.name,[l,u]=(0,G.useState)(o===`test-data`?`testdata`:`query`),[f,p]=(0,G.useState)(``),[m,h]=(0,G.useState)(c??t.databases[0]?.name??``),[g,_]=(0,G.useState)(`auto`),[v,b]=(0,G.useState)(`5`),[S,C]=(0,G.useState)(`pytest`),[w,T]=(0,G.useState)(``),[E,O]=(0,G.useState)(``);(0,G.useEffect)(()=>{c&&h(c),o===`test-data`&&u(`testdata`)},[o,c]);let k=n&&!n.running&&(n.kind===`ask`||n.kind===`checks`||n.kind===`request`)?n:null,j=Z.find(e=>e.id===l),M=e=>d(`inline-flex min-h-7 cursor-pointer items-center gap-1 rounded-[6px] border-0 px-2.5 text-[12.5px]`,e?`bg-bg font-medium text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`);if(!t.databases.length)return(0,K.jsx)(X,{});let N=()=>{f.trim()&&m&&(l===`testdata`?i(`request`,{need:f.trim(),db:m,kind:g,rows:Number(v),...w?{name:w}:{}}):i(`ask`,{question:f.trim(),db:m,as:l,...l===`script`?{framework:S}:{},...w?{name:w}:{}}))};return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-8 gap-y-8`,children:[(0,K.jsxs)(`section`,{"aria-labelledby":`ask-h`,className:`flex min-w-0 flex-[999_1_560px] flex-col gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsxs)(`h2`,{id:`ask-h`,className:`m-0 flex items-center gap-2 text-lg font-semibold`,children:[(0,K.jsx)(a,{icon:s,size:18,className:`text-accent-fg`}),`Ask the DB agent`]}),(0,K.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-muted`,children:`Ask about a database in your words. The DB agent reads the schema and writes what you pick; every query is checked and runs read-only. The agents ask it the same way before they run.`})]}),(0,K.jsxs)(`form`,{className:`flex flex-col gap-4 rounded-[14px] card border p-4`,onSubmit:e=>{e.preventDefault(),N()},children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsx)(`span`,{id:`mode-l`,className:`text-sm font-medium`,children:`Turn it into`}),(0,K.jsx)(`div`,{role:`tablist`,"aria-labelledby":`mode-l`,className:`flex flex-wrap gap-0.5 self-start rounded-[8px] bg-surface-strong p-0.5`,children:Z.map(e=>(0,K.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":l===e.id,onClick:()=>u(e.id),className:M(l===e.id),children:[(0,K.jsx)(e.icon,{size:14,"aria-hidden":`true`}),e.label]},e.id))}),(0,K.jsx)(`span`,{className:`text-[13px] text-muted`,children:j.about})]}),(0,K.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm font-medium`,children:[l===`testdata`?`What the test needs`:`Your question`,(0,K.jsx)(D,{id:`ask-question`,rows:3,value:f,maxLength:500,placeholder:j.example,onChange:e=>p(e.target.value.replace(/[\r\n]+/g,` `)),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),N())}})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,K.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_180px] flex-col gap-1.5 text-sm font-medium`,children:[`Database`,(0,K.jsx)(A,{id:`ask-db`,value:m,onChange:e=>h(e.target.value),children:t.databases.map(e=>(0,K.jsx)(`option`,{value:e.name,children:e.name},e.name))})]}),l===`testdata`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_180px] flex-col gap-1.5 text-sm font-medium`,children:[`Rows`,(0,K.jsxs)(A,{id:`ask-kind`,value:g,onChange:e=>_(e.target.value),children:[(0,K.jsx)(`option`,{value:`auto`,children:`The DB agent picks`}),(0,K.jsx)(`option`,{value:`existing`,children:`Existing rows`}),(0,K.jsx)(`option`,{value:`new`,children:`New rows`})]})]}),(0,K.jsxs)(`label`,{className:`flex w-[110px] flex-col gap-1.5 text-sm font-medium`,children:[`How many`,(0,K.jsx)(x,{id:`ask-rows`,value:v,inputMode:`numeric`,onChange:e=>b(e.target.value.replace(/\D/g,``).slice(0,3))})]})]}),l===`script`&&(0,K.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_180px] flex-col gap-1.5 text-sm font-medium`,children:[`Framework`,(0,K.jsxs)(A,{id:`ask-framework`,value:S,onChange:e=>C(e.target.value),children:[(0,K.jsx)(`option`,{value:`pytest`,children:`pytest`}),(0,K.jsx)(`option`,{value:`playwright`,children:`Playwright Test`})]})]}),(0,K.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_180px] flex-col gap-1.5 text-sm font-medium`,children:[`Keep as`,(0,K.jsx)(x,{id:`ask-name`,value:w,spellCheck:!1,placeholder:`From your words`,onChange:e=>T(e.target.value.toLowerCase().replace(/[^a-z0-9-]/g,`-`).slice(0,63)),className:`font-mono text-[13px]`})]})]}),(0,K.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,K.jsxs)(e,{type:`submit`,variant:`primary`,disabled:r||!f.trim()||!m||l===`testdata`&&!v,children:[(0,K.jsx)(a,{icon:s,size:16}),`Ask the DB agent`]})})]}),E&&(0,K.jsx)(I,{text:E}),k&&(0,K.jsxs)(`section`,{"aria-label":`The answer`,className:`flex flex-col gap-3`,children:[(0,K.jsx)(`h3`,{className:`m-0 text-base font-semibold [overflow-wrap:anywhere]`,children:k.kind===`request`?`Test data`:k.kind===`checks`?`Checks ${k.target}`:`The answer`}),k.kind===`request`?k.result?.ok?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(ne,{r:k.result,onNote:O}),(0,K.jsx)(`a`,{href:y(`test-data`),className:`text-sm`,children:`See every request on Test data`})]}):(0,K.jsx)(I,{text:k.result?.error||`The DB agent could not get the data.`}):k.result?(0,K.jsx)(ue,{r:k.result,onNote:O}):(0,K.jsx)(I,{text:`The DB agent did not answer; see its output above.`})]})]}),(0,K.jsx)(de,{view:t,busy:r,act:i,onNote:O})]})}function de({view:t,busy:n,act:r,onNote:i}){return(0,K.jsxs)(`aside`,{"aria-labelledby":`kept-h`,className:`flex min-w-0 flex-[1_1_260px] flex-col gap-2`,children:[(0,K.jsxs)(`h2`,{id:`kept-h`,className:`m-0 flex items-center gap-2 text-base font-semibold`,children:[(0,K.jsx)(a,{icon:B,size:16,className:`text-accent-fg`}),`Kept from Ask`]}),t.asks.length===0?(0,K.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Nothing kept yet. Ask a question: the queries, checks and test scripts the DB agent writes are kept in test-data, to run again without a model.`}):(0,K.jsx)(te,{items:t.asks,text:e=>`${e.question||``} ${e.name} ${e.database||``} ${Q[e.as]}`,label:`Kept from Ask`,size:8,children:t=>(0,K.jsxs)(`li`,{className:`flex flex-col gap-1.5 border-t border-line-soft py-2.5 first:border-t-0`,children:[(0,K.jsx)(`span`,{className:`min-w-0 text-[14px] font-medium [overflow-wrap:anywhere]`,children:t.question||t.name}),(0,K.jsxs)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:[Q[t.as],t.as===`checks`&&t.checks?` (${t.checks})`:``,t.as===`script`?` · ${t.framework===`playwright`?`Playwright`:`pytest`}`:``,t.database?` · ${t.database}`:``,` · `,(0,K.jsx)(`span`,{"data-tip":new Date(t.modified).toLocaleString(),children:ie(t.modified)})]}),(0,K.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[t.as===`query`&&t.sql&&t.database&&(0,K.jsxs)(e,{size:`sm`,disabled:n,onClick:()=>{r(`query`,{db:t.database,sql:t.sql,maxRows:200}),location.hash=y(`data`,`databases/${encodeURIComponent(t.database)}`)},children:[(0,K.jsx)(B,{size:14,"aria-hidden":`true`}),`Run again`]}),t.as===`checks`&&(0,K.jsxs)(e,{size:`sm`,disabled:n,onClick:()=>r(`checks`,{name:t.name}),children:[(0,K.jsx)(B,{size:14,"aria-hidden":`true`}),`Run again`]}),(0,K.jsx)(V,{file:t.file,onNote:i})]})]},`${t.as}/${t.name}`)})]})}function fe({c:e}){let t=e=>e?.count??0;return(0,K.jsxs)(`li`,{className:`flex flex-col gap-1 border-t border-line-soft py-3 text-sm first:border-t-0`,children:[(0,K.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(h,{tone:e.ok?`pass`:`fail`,children:e.ok?`Holds`:`Broken`}),(0,K.jsx)(`span`,{className:`font-medium`,children:e.flow}),(0,K.jsxs)(`span`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:[e.from,` → `,e.to]})]}),e.error?(0,K.jsx)(`span`,{className:`text-fail [overflow-wrap:anywhere]`,children:e.error}):(0,K.jsxs)(`span`,{className:`text-ink-2`,children:[e.matched??0,` of `,e.source_rows??0,` arrived · `,e.late?`${t(e.late)} late (${t(e.in_flight)} in flight)`:`${t(e.missing)} missing`,` · `,e.wrong?.rows??0,` wrong · `,t(e.duplicates),` duplicated`,e.extra?` · ${t(e.extra)} with no source`:``]}),e.note&&(0,K.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.note}),J(e.late??e.missing)&&(0,K.jsxs)(`span`,{className:`text-[13px] text-fail [overflow-wrap:anywhere]`,children:[`Missing: `,J(e.late??e.missing)]}),(e.wrong?.examples||[]).map((e,t)=>(0,K.jsxs)(`span`,{className:`font-mono text-[12px] text-fail [overflow-wrap:anywhere]`,children:[String(e.key),`: `,e.column,` expected `,L(e.expected),`, found `,L(e.target)]},t))]})}function pe({view:t,job:n,busy:o,act:s}){let[c,l]=(0,G.useState)([]),u=(0,G.useMemo)(()=>[...new Set(t.flows.map(e=>e.from).filter(e=>!e.startsWith(`api:`)))],[t.flows]),[d,f]=(0,G.useState)(u[0]??t.flows[0]?.name??``),[m,g]=(0,G.useState)(``),[v,w]=(0,G.useState)(``),[T,E]=(0,G.useState)(``),[D,O]=(0,G.useState)(null),[j,M]=(0,G.useState)(``),N=n&&!n.running?n:null,P=N?.kind===`check`?N.result??null:null,F=N?.kind===`trace`?N.result??null:null;return t.flowsError?(0,K.jsx)(I,{text:`${t.flowsFile} does not read: ${t.flowsError}`}):t.flows.length?(0,K.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,K.jsxs)(`section`,{"aria-labelledby":`flows-h`,className:`flex flex-col gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsxs)(`h2`,{id:`flows-h`,className:`m-0 flex items-center gap-2 text-lg font-semibold flex-1`,children:[(0,K.jsx)(a,{icon:W,size:18,className:`text-accent-fg`}),`Flows `,(0,K.jsxs)(`span`,{className:`text-sm font-normal text-muted`,children:[`(`,t.flowsFile,`)`]})]}),(0,K.jsxs)(e,{variant:`primary`,disabled:o,onClick:()=>s(`check`,{flows:c}),children:[(0,K.jsx)(H,{size:16,"aria-hidden":`true`}),c.length?`Check ${i(c.length,`flow`)}`:`Check all`]}),N?.report&&(N.kind===`check`||N.kind===`trace`)&&(0,K.jsxs)(e,{onClick:async()=>M(await _(N.report)),children:[(0,K.jsx)(a,{icon:S,size:16}),`Report`]})]}),(0,K.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Each hop: did every record arrive, complete, correct, on time.`}),j&&(0,K.jsx)(I,{text:j}),(0,K.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.flows.map(e=>(0,K.jsxs)(`li`,{className:`flex items-start gap-3 border-t border-line-soft py-2.5 first:border-t-0`,children:[(0,K.jsx)(`input`,{type:`checkbox`,"aria-label":`Check ${e.name}`,checked:c.includes(e.name),onChange:t=>l(t.target.checked?[...c,e.name]:c.filter(t=>t!==e.name)),className:`mt-1 size-5 flex-none accent-accent`}),(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5 text-sm`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,K.jsxs)(`span`,{className:`font-mono text-[12px] text-ink-2 [overflow-wrap:anywhere]`,children:[e.from,` → `,e.to]}),(0,K.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[[e.mode,e.sla?`SLA ${e.sla}`:``,i(e.columns,`column`)].filter(Boolean).join(` · `),e.description?` · ${e.description}`:``]})]})]},e.name))}),P?.error&&(0,K.jsx)(I,{text:P.error}),P?.flows&&(0,K.jsx)(`ul`,{"aria-label":`Check results`,className:`m-0 flex list-none flex-col rounded-[14px] card border px-4 py-1`,children:P.flows.map(e=>(0,K.jsx)(fe,{c:e},e.flow))})]}),(0,K.jsxs)(`section`,{"aria-labelledby":`trace-h`,className:`flex flex-col gap-3`,children:[(0,K.jsxs)(`h2`,{id:`trace-h`,className:`m-0 flex items-center gap-2 text-lg font-semibold`,children:[(0,K.jsx)(a,{icon:C,size:18,className:`text-accent-fg`}),`Follow one record`]}),(0,K.jsxs)(`form`,{className:`flex flex-wrap items-end gap-3`,onSubmit:e=>{e.preventDefault(),d&&m.trim()&&s(`trace`,{start:d,key:m.trim(),...v?{wait:Number(v)}:{}})},children:[(0,K.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_220px] flex-col gap-1.5 text-sm font-medium`,children:[`From`,(0,K.jsxs)(A,{value:d,onChange:e=>f(e.target.value),children:[(0,K.jsx)(`optgroup`,{label:`A table`,children:u.map(e=>(0,K.jsx)(`option`,{children:e},e))}),(0,K.jsx)(`optgroup`,{label:`A flow`,children:t.flows.map(e=>(0,K.jsx)(`option`,{children:e.name},e.name))})]})]}),(0,K.jsxs)(`label`,{className:`flex w-[160px] flex-col gap-1.5 text-sm font-medium`,children:[`Its key`,(0,K.jsx)(x,{value:m,maxLength:200,placeholder:`1042`,onChange:e=>g(e.target.value)})]}),(0,K.jsxs)(`label`,{className:`flex w-[130px] flex-col gap-1.5 text-sm font-medium`,children:[`Wait up to (s)`,(0,K.jsx)(x,{value:v,inputMode:`numeric`,placeholder:`0`,onChange:e=>w(e.target.value.replace(/\D/g,``).slice(0,3))})]}),(0,K.jsxs)(e,{type:`submit`,disabled:o||!d||!m.trim(),children:[(0,K.jsx)(a,{icon:C,size:16}),`Follow it`]})]}),F?.error&&(0,K.jsx)(I,{text:F.error}),F?.hops&&(0,K.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-2 border-l border-line pl-4`,children:F.hops.map((e,t)=>(0,K.jsxs)(`li`,{className:`flex flex-col gap-0.5 text-sm`,children:[(0,K.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(h,{tone:e.ok?`pass`:`fail`,children:e.ok?`Arrived`:e.found_in_source===!1?`Not in the source`:e.arrived===!1?`Did not arrive`:`Differs`}),(0,K.jsx)(`span`,{className:`font-medium`,children:e.flow}),(0,K.jsxs)(`span`,{className:`font-mono text-[12px] text-muted`,children:[e.from,` → `,e.to,` · key `,L(e.key)]})]}),(e.differences||[]).map((e,t)=>(0,K.jsxs)(`span`,{className:`font-mono text-[12px] text-fail [overflow-wrap:anywhere]`,children:[e.column,`: expected `,L(e.expected),`, found `,L(e.target)]},t)),Number(e.copies)>1&&(0,K.jsxs)(`span`,{className:`text-[13px] text-warn`,children:[e.copies,` copies`]})]},t))})]}),(0,K.jsxs)(`section`,{"aria-labelledby":`impact-h`,className:`flex flex-col gap-3`,children:[(0,K.jsxs)(`h2`,{id:`impact-h`,className:`m-0 flex items-center gap-2 text-lg font-semibold`,children:[(0,K.jsx)(a,{icon:b,size:18,className:`text-accent-fg`}),`What a change reaches`]}),(0,K.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:async e=>{e.preventDefault();try{O(await p.impact(T.trim())),M(``)}catch(e){M(e.message)}},children:[(0,K.jsx)(x,{"aria-label":`A table or column`,value:T,spellCheck:!1,placeholder:`shop.orders.total`,onChange:e=>E(e.target.value),className:`min-w-0 flex-[1_1_260px] font-mono text-[13px]`}),(0,K.jsxs)(e,{type:`submit`,disabled:!T.trim(),children:[(0,K.jsx)(b,{size:16,"aria-hidden":`true`}),`Show what reads it`]})]}),D&&D.length===0&&(0,K.jsxs)(`p`,{className:`m-0 text-sm text-muted`,children:[`Nothing in the flows reads `,T,`.`]}),D&&D.length>0&&(0,K.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:D.map((e,t)=>(0,K.jsxs)(`li`,{className:`font-mono text-[12px] text-ink-2 [overflow-wrap:anywhere]`,style:{paddingLeft:`${(e.depth-1)*16}px`},children:[e.from,` → `,e.to,e.columns.length?` (${e.columns.join(`, `)})`:``,` `,(0,K.jsxs)(`span`,{className:`text-muted`,children:[`[`,e.flow,`]`]})]},t))}),t.map.length>0&&(0,K.jsxs)(`details`,{children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm text-muted`,children:`The whole map`}),(0,K.jsx)(`pre`,{className:`mt-2 overflow-auto rounded-[12px] bg-surface-muted p-3 font-mono text-[12px] leading-relaxed text-ink-2`,children:t.map.join(`
|
|
3
|
-
`)})]})]})]}):(0,K.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,K.jsx)(W,{size:24,"aria-hidden":`true`,className:`text-muted`}),(0,K.jsxs)(`p`,{className:`m-0 max-w-[62ch] leading-relaxed text-ink-2`,children:[`No data flows yet. A flow says how records move from one system to another (a table, a topic or an API), by which key, and what each column becomes; `,(0,K.jsx)(`span`,{className:`font-mono text-[13px]`,children:t.flowsFile}),` holds them. ForgeQE can write them from your mapping documents.`]}),(0,K.jsxs)(e,{onClick:async()=>{try{let{id:e}=await k.start(`Write the data flows of this project into flows.yaml from our mapping documents and the databases' schemas. Show me each flow before you save it.`,{});location.hash=y(`chats`,e)}catch(e){M(e.message)}},children:[(0,K.jsx)(a,{icon:r,size:16}),`Write flows in a chat`]}),j&&(0,K.jsx)(I,{text:j})]})}function me({sub:e}){let{view:t,error:n,busy:r,act:i,stop:a,job:o}=ee(),[s,...c]=(e||``).split(`/`);(0,G.useEffect)(()=>{(s===`testdata`||s===`agent`)&&location.replace(y(`test-data`,s===`agent`?`kept`:`specs`))},[s]);let l=q.includes(s)?s:`databases`,p={databases:`Databases${t?` (${t.databases.length})`:``}`,ask:`Ask${t?` (${t.asks.length})`:``}`,flows:`Data flows${t?` (${t.flows.length})`:``}`};return(0,K.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,K.jsx)(T,{}),(0,K.jsxs)(`main`,{className:d(re,`@container flex-auto gap-4`),children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,K.jsx)(j,{pixel:O.data,size:`lg`}),(0,K.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`Data`}),(0,K.jsxs)(`a`,{href:y(`test-data`),className:d(u(),`no-underline`),children:[(0,K.jsx)(f,{size:16,"aria-hidden":`true`}),`Test data`]})]}),(0,K.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:`The databases the agents may read, the DB agent that answers questions about them in your words, and the data flows between systems: did every record arrive, complete and correct.`}),n&&(0,K.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:n}),!t&&!n&&(0,K.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(M,{label:`Data`,current:l,onPick:e=>location.hash=y(`data`,e),tabs:q.map(e=>({id:e,label:p[e]}))}),o&&(o.running||oe[o.kind]===l)&&(0,K.jsx)(F,{job:o,onStop:a}),(0,K.jsxs)(`div`,{role:`tabpanel`,id:`panel-${l}`,"aria-labelledby":`tab-${l}`,children:[l===`databases`&&(0,K.jsx)(le,{view:t,job:o,busy:r,act:i,sub:c[0]?decodeURIComponent(c[0]):void 0}),l===`ask`&&(0,K.jsx)($,{view:t,job:o,busy:r,act:i,preset:c[0]?decodeURIComponent(c[0]):void 0}),l===`flows`&&(0,K.jsx)(pe,{view:t,job:o,busy:r,act:i})]})]})]})]})}export{ae as n,W as r,$ as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$r as e,Bt as t,Cr as n,Di as r,En as i,G as a,Gt as o,Ht as s,In as c,J as l,K as u,Kn as d,Lr as f,Mn as p,Qn as m,Si as h,U as g,W as _,Wt as v,Xn as y,Zt as b,_r as x,an as S,at as C,br as ee,cn as w,ct as T,dn as te,et as ne,mn as E,n as D,nt as O,ot as k,q as re,qt as A,tt as j,vr as M,vt as ie,wi as ae,yr as oe}from"./Shell-C-_iUijV.js";import{G as se,H as ce,s as le,t as ue}from"./index-BxNs3KZC.js";import{n as de,t as N}from"./when-CHnpLdYw.js";import{a as P,i as F}from"./productParts-RYNeN2sM.js";var fe={name:`boxes`,size:24,node:[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]};fe.node;var pe=f(fe),me={name:`file-check`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m9 15 2 2 4-4`,key:`1grp1n`}]]};me.node;var he=f(me),ge={name:`scale`,size:24,node:[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`m19 8 3 8a5 5 0 0 1-6 0zV7`,key:`zcdpyk`}],[`path`,{d:`M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1`,key:`1yorad`}],[`path`,{d:`m5 8 3 8a5 5 0 0 1-6 0zV7`,key:`eua70x`}],[`path`,{d:`M7 21h10`,key:`1b0cd5`}]]};ge.node;var I=f(ge),L=r(ae(),1),R=h(),z={"forgeqe-session":`ForgeQE session`,otlp:`OpenTelemetry trace`,jsonl:`the agent's own log`,langfuse:`Langfuse`,langsmith:`LangSmith`},_e={tool:A,model:S,say:i,plan:p,handoff:E,ask:i,policy:w,error:b},ve={request:`the request`,tool_result:`a tool's result`,file:`a file`,document:`a document`,memory:`memory`,agent:`another agent's answer`,person:`a person`},B=e=>e.replace(/[\u0000-\u0008\u000b-\u001f\u007f-\u009f\u2028\u2029]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`),V=e=>{if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString([],{month:`short`,day:`numeric`,...t.getFullYear()===new Date().getFullYear()?{}:{year:`numeric`},hour:`numeric`,minute:`2-digit`,second:`2-digit`})},H=25,U={PASS:{tone:`pass`,label:`Pass`},WARN:{tone:`warn`,label:`Warning`},FAIL:{tone:`fail`,label:`Fail`},UNKNOWN:{tone:`neutral`,label:`Not known`}},W={required_steps:`Required steps`,allowed_actions:`Allowed actions`,tool_inputs:`Tool inputs`,limits:`Limits`,handover:`Hand-over`,statements:`What it said`,grounded_decisions:`Grounded decisions`,data_allowed:`Data allowed`,data_used:`Facts from its data`,stated_reasons:`Stated reasons`,instructions_in_data:`Instructions in data`,business_rules:`Business rules`,architecture:`Architecture`,dependencies:`Dependencies`,regression:`Regression`,security:`Security`,acceptance:`Acceptance criteria`,build_and_test:`Build and test`,content_rules:`Answer rules`,grounded:`Grounded in its inputs`,rubric:`Owner's rubric`},ye={build:{title:`Does the change work?`,icon:y},behaviour:{title:`Did it work the agreed way?`,icon:x},decisions:{title:`Did it decide on the right grounds, with data it may use?`,icon:I},content:{title:`Was its answer right: on topic, grounded, complete?`,icon:he},domain:{title:`Was its change right for the product?`,icon:pe}},G=200;function K({id:e,children:t}){return(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(ie,{pixel:k[e],size:`lg`}),(0,R.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:t})]})}function q(){return(0,R.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`})}function J(){return(0,R.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,R.jsx)(s,{icon:y,size:22,className:`text-muted`}),(0,R.jsxs)(`p`,{className:`m-0 max-w-[62ch] leading-relaxed text-ink-2`,children:[`No agent run is recorded here yet. Receive an agent's OpenTelemetry traces while it runs with `,(0,R.jsx)(`code`,{children:`forgeqe evidence receive`}),`; record a file with `,(0,R.jsx)(`code`,{children:`forgeqe evidence record`}),`: an OpenTelemetry export, a Langfuse or LangSmith export, an agent's own JSON log with `,(0,R.jsx)(`code`,{children:`--mapping mapping.yaml`}),`, or ForgeQE's own last session with `,(0,R.jsx)(`code`,{children:`--latest`}),`.`]})]})}function be({refused:e}){return e.length?(0,R.jsxs)(`section`,{"aria-label":`Files that are not run records`,className:`flex flex-col gap-1 rounded-[12px] bg-warn-soft px-3 py-2 text-sm text-ink-2`,children:[(0,R.jsxs)(`span`,{className:`font-medium`,children:[o(e.length,`file`),` in the runs folder `,e.length===1?`is`:`are`,` not a run record and `,e.length===1?`is`:`are`,` not shown:`]}),e.slice(0,10).map(e=>(0,R.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e},e))]}):null}function xe(){let[t,n]=(0,L.useState)(null),[r,i]=(0,L.useState)(``);return(0,L.useEffect)(()=>{e.overview().then(n,e=>i(e.message))},[]),(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(K,{id:`evidence`,children:`Evidence`}),(0,R.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:`What AI agents did, how, what they decided and why, and what data they used, from the records of their runs. What an agent says about its own work is kept as a claim, to be checked against what it did; what a record cannot say is listed, never guessed.`}),r&&(0,R.jsx)(F,{text:r}),!t&&!r&&(0,R.jsx)(q,{}),t&&(0,R.jsx)(be,{refused:t.refused}),t&&!t.runs&&(0,R.jsx)(J,{}),t&&t.runs>0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1 text-[13px] text-muted`,children:[(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`b`,{className:`text-ink tabular-nums`,children:t.runs}),` `,t.runs===1?`run`:`runs`,` recorded`]}),(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`b`,{className:`text-ink tabular-nums`,children:t.agents.length}),` `,t.agents.length===1?`agent`:`agents`]})]}),(0,R.jsx)(`h2`,{className:`sr-only`,children:`What is recorded`}),(0,R.jsx)(P,{id:`agents`,title:`Agents`,icon:S,n:t.agents.length,children:(0,R.jsx)(`ul`,{"aria-label":`Agents`,className:`m-0 list-none rounded-[14px] card border p-1.5`,children:t.agents.map(e=>(0,R.jsx)(`li`,{children:(0,R.jsxs)(`a`,{href:T(`evidence`,encodeURIComponent(e.name)),className:`flex min-h-12 flex-wrap items-center gap-x-4 gap-y-0.5 rounded-[10px] px-3 py-2 text-ink no-underline hover:bg-surface-muted hover:text-ink`,children:[(0,R.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_320px] flex-col`,children:[(0,R.jsx)(`span`,{className:`truncate text-[14px] font-medium`,children:B(e.name)}),(0,R.jsxs)(`span`,{className:`truncate text-[12px] text-muted`,children:[e.versions.length?`versions ${e.versions.slice(0,4).join(`, `)}${e.versions.length>4?`, …`:``} · `:``,`from `,e.sources.map(e=>z[e]||e).join(`, `)]})]}),(0,R.jsx)(`span`,{className:`text-[13px] text-ink-2 tabular-nums`,children:o(e.runs,`run`)}),(0,R.jsx)(`span`,{className:`text-[13px] text-ink-2 tabular-nums`,children:o(e.decisions,`decision`)}),(0,R.jsxs)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:[o(e.gaps,`thing`,`things`),` not known`]}),(0,R.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:e.contract?`${e.contract.approved?`Contract approved`:`Contract not approved`}: ${[`FAIL`,`WARN`,`UNKNOWN`,`PASS`].filter(t=>e.verdicts[t]).map(t=>o(e.verdicts[t],{FAIL:`failed run`,WARN:`warning`,UNKNOWN:`not known`,PASS:`passed run`}[t],{FAIL:`failed runs`,WARN:`warnings`,UNKNOWN:`not known`,PASS:`passed runs`}[t])).join(`, `)}`:`No contract`}),(0,R.jsx)(`span`,{className:`text-[12.5px] text-muted tabular-nums`,"data-tip":V(e.last),children:e.last?N(e.last):``})]})},e.name))})})]})]})}var Y={PASS:`Passed`,WARN:`Warned`,FAIL:`Failed`,UNKNOWN:`Not known`,NONE:`Not judged`};function Se({t:e,label:t,on:n,onToggle:r,fail:i}){return e.n?(0,R.jsx)(`button`,{type:`button`,"aria-pressed":n,"aria-label":`${e.n}: ${t}. Show the runs`,onClick:r,className:v(`inline-flex min-h-7 min-w-7 cursor-pointer items-center justify-end rounded-[8px] border-0 px-1.5 tabular-nums hover:underline`,n?`bg-accent-soft text-accent-fg`:`bg-transparent text-accent-fg`,i&&!n&&`text-fail`),children:e.n}):(0,R.jsx)(`span`,{className:`inline-flex min-h-7 items-center justify-end px-1.5 text-muted tabular-nums`,children:`0`})}function Ce({pick:e,d:n,onClose:r}){let[i,a]=(0,L.useState)(!1),s=i?e.runs:e.runs.slice(0,25);return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5 rounded-[12px] bg-surface-muted p-3`,children:[(0,R.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,R.jsxs)(`span`,{className:`text-[13px] font-medium text-ink [overflow-wrap:anywhere]`,children:[o(e.runs.length,`run`),` behind `,B(e.label)]}),(0,R.jsx)(t,{size:`sm`,variant:`ghost`,onClick:r,children:`Close`})]}),(0,R.jsx)(`ul`,{"aria-label":`Runs behind ${e.label}`,className:`m-0 list-none rounded-[10px] border border-line-soft bg-bg p-1`,children:s.map(e=>{let t=n.brief[e];return(0,R.jsx)(`li`,{children:(0,R.jsxs)(`a`,{href:T(`evidence-runs`,encodeURIComponent(e)),className:`grid min-h-10 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-3 rounded-[8px] px-2.5 py-1 text-ink no-underline hover:bg-surface-muted hover:text-ink`,children:[t&&t.status!==`NONE`?(0,R.jsx)(C,{tone:U[t.status].tone,children:U[t.status].label}):(0,R.jsx)(`span`,{className:`text-[12px] text-muted`,children:`Not judged`}),(0,R.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,R.jsx)(`span`,{className:`truncate text-[13px]`,children:B(t?.request||e)}),(0,R.jsxs)(`span`,{className:`truncate font-mono text-[11.5px] text-muted`,children:[e,t?.version?` · ${B(t.version)}`:``]})]}),(0,R.jsx)(`span`,{className:`text-right text-[12px] text-muted tabular-nums`,"data-tip":V(t?.started),children:t?.started?N(t.started):``})]})},e)})}),e.runs.length>s.length&&(0,R.jsxs)(t,{size:`sm`,variant:`ghost`,onClick:()=>a(!0),children:[`Show all `,e.runs.length]})]})}function we({agent:t}){let[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)(``),[c,l]=(0,L.useState)(null),[u,f]=(0,L.useState)(null);(0,L.useEffect)(()=>{e.dashboard(t).then(i,e=>o(e.message))},[t]);let m=e=>e?B(e):`no version`,h=r?r.versions.find(e=>e.version===c)||r.versions[0]:void 0,_=e=>u&&r&&u.key.startsWith(`${e}|`)?(0,R.jsx)(Ce,{pick:u,d:r,onClose:()=>f(null)},u.key):null,y=(e,t,n,r)=>{let i=`${e}|${n}`;return(0,R.jsx)(Se,{t,label:n,on:u?.key===i,onToggle:()=>f(u?.key===i?null:{key:i,label:n,runs:t.runs}),fail:r})};return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`a`,{href:T(`evidence`),className:`inline-flex min-h-8 w-fit items-center gap-1.5 text-[13px] text-accent-fg no-underline hover:underline`,children:[(0,R.jsx)(s,{icon:se,size:14}),` Evidence`]}),(0,R.jsx)(K,{id:`evidence`,children:B(t)}),(0,R.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:`How this agent's runs were judged, version by version and week by week. Every number opens the runs it counts; not known and not judged are never counted as passed. Worked out now from the runs and their verdicts, with people's overrules applied.`}),a&&(0,R.jsx)(F,{text:a}),!r&&!a&&(0,R.jsx)(q,{}),r?.problems.map(e=>(0,R.jsx)(F,{text:e},e)),r&&h&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1 text-[13px] text-muted`,children:[(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`b`,{className:`text-ink tabular-nums`,children:r.runs.n}),` `,r.runs.n===1?`run`:`runs`]}),(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`b`,{className:`text-ink tabular-nums`,children:r.versions.length}),` `,r.versions.length===1?`version`:`versions`]}),(0,R.jsx)(`a`,{href:T(`evidence-runs`,`agent`,encodeURIComponent(t)),children:`All its runs`}),(0,R.jsx)(`a`,{href:T(`evidence-learn`,encodeURIComponent(t)),children:`What to change`})]}),(0,R.jsx)(`h2`,{className:`sr-only`,children:`Its numbers`}),(0,R.jsxs)(P,{id:`versions`,title:`Versions`,icon:d,n:r.versions.length,children:[(0,R.jsx)(g,{label:`Versions of ${t}`,search:!1,minWidth:640,head:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`Version`}),[`Runs`,`Passed`,`Warned`,`Failed`,`Not known`,`Not judged`].map(e=>(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-right text-[11.5px] font-medium whitespace-nowrap text-muted`,children:e},e)),(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`Last run`})]}),children:r.versions.map(e=>(0,R.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,R.jsx)(`th`,{scope:`row`,className:v(`px-3 py-2`,`text-left font-medium`),children:m(e.version)}),(0,R.jsx)(`td`,{className:`px-3 py-2 text-right whitespace-nowrap tabular-nums`,children:y(`versions`,e.runs,`${m(e.version)}: runs`)}),[`PASS`,`WARN`,`FAIL`,`UNKNOWN`,`NONE`].map(t=>(0,R.jsx)(`td`,{className:`px-3 py-2 text-right whitespace-nowrap tabular-nums`,children:y(`versions`,e.outcome[t],`${m(e.version)}: ${Y[t].toLowerCase()}`,t===`FAIL`)},t)),(0,R.jsx)(`td`,{className:v(`px-3 py-2`,`text-muted`),"data-tip":V(e.last),children:e.last?N(e.last):``})]},e.version))}),_(`versions`)]}),r.versions.length>1&&r.benchmark.length>0&&(0,R.jsxs)(P,{id:`benchmark`,title:`Versions side by side`,icon:I,children:[(0,R.jsx)(`p`,{className:`m-0 max-w-[74ch] text-[13px] text-muted`,children:`Each check: the share of a version's runs that passed it, of the runs it judged. The number after it opens the runs that did not pass.`}),(0,R.jsx)(g,{label:`Versions side by side`,search:!1,minWidth:480,head:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`Check`}),r.versions.map(e=>(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-right text-[11.5px] font-medium whitespace-nowrap text-muted`,children:m(e.version)},e.version))]}),children:r.benchmark.map(e=>(0,R.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,R.jsx)(`th`,{scope:`row`,className:v(`px-3 py-2`,`text-left font-medium`),children:W[e.check]}),e.versions.map(t=>{let n={n:t.judged.n-t.pass.n,runs:t.judged.runs.filter(e=>!t.pass.runs.includes(e))};return(0,R.jsx)(`td`,{className:`px-3 py-2 text-right whitespace-nowrap tabular-nums`,children:t.rate===null?(0,R.jsx)(`span`,{className:`text-muted`,children:`not judged`}):(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,R.jsxs)(`span`,{className:v(t.rate<1&&`text-ink`),children:[Math.round(t.rate*100),`% of `,t.judged.n]}),n.n>0&&(0,R.jsx)(`span`,{className:`text-muted`,children:`·`}),n.n>0&&y(`benchmark`,n,`${W[e.check]} on ${m(t.version)}: not passed`,!0)]})},t.version)})]},`${e.lens}-${e.check}`))}),_(`benchmark`)]}),(0,R.jsxs)(P,{id:`checks`,title:`Checks`,icon:p,n:h.checks.length,children:[r.versions.length>1&&(0,R.jsxs)(`label`,{className:`flex w-fit items-center gap-2 text-[13px] text-ink-2`,children:[`Version`,(0,R.jsx)(j,{value:h.version,onChange:e=>{l(e.target.value),f(null)},children:r.versions.map(e=>(0,R.jsx)(`option`,{value:e.version,children:e.version||`no version`},e.version))})]}),h.checks.length?(0,R.jsx)(g,{label:`Checks of ${m(h.version)}`,search:!1,minWidth:600,head:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`Check`}),(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`Lens`}),[`Passed`,`Warned`,`Failed`,`Not known`,`Overruled`].map(e=>(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-right text-[11.5px] font-medium whitespace-nowrap text-muted`,children:e},e))]}),children:h.checks.map(e=>(0,R.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,R.jsx)(`th`,{scope:`row`,className:v(`px-3 py-2`,`text-left font-medium`),children:W[e.check]}),(0,R.jsx)(`td`,{className:v(`px-3 py-2`,`text-muted`),children:Z[e.lens]}),[`PASS`,`WARN`,`FAIL`,`UNKNOWN`].map(t=>(0,R.jsx)(`td`,{className:`px-3 py-2 text-right whitespace-nowrap tabular-nums`,children:y(`checks`,e.outcome[t],`${W[e.check]}: ${Y[t].toLowerCase()}`,t===`FAIL`)},t)),(0,R.jsx)(`td`,{className:`px-3 py-2 text-right whitespace-nowrap tabular-nums`,children:y(`checks`,e.overruled,`${W[e.check]}: overruled`)})]},`${e.lens}-${e.check}`))}):(0,R.jsxs)(`p`,{className:`m-0 text-sm text-muted`,children:[`No contract judged these runs: `,(0,R.jsx)(`a`,{href:T(`evidence-contracts`),children:`Contracts`}),` says what one agrees.`]}),_(`checks`)]}),h.rules.length>0&&(0,R.jsxs)(P,{id:`recurring`,title:`What keeps going wrong`,icon:b,n:h.rules.length,children:[(0,R.jsx)(`ul`,{"aria-label":`What keeps going wrong`,className:`m-0 list-none rounded-[14px] card border p-1.5`,children:h.rules.slice(0,20).map(e=>(0,R.jsxs)(`li`,{className:`flex flex-col gap-0.5 border-b border-line-soft px-3 py-2 last:border-b-0`,children:[(0,R.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,R.jsx)(C,{tone:U[e.status].tone,children:U[e.status].label}),(0,R.jsxs)(`span`,{className:`text-[13.5px] font-medium`,children:[W[e.check],`: `,B(e.rule)]}),(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[12.5px] text-muted`,children:[`in `,y(`recurring`,e.runs,`${W[e.check]}: ${e.rule}`),` `,e.runs.n===1?`run`:`runs`]})]}),(0,R.jsxs)(`span`,{className:`text-[12.5px] text-ink-2 [overflow-wrap:anywhere]`,children:[`For example: `,B(e.example)]})]},`${e.check}-${e.rule}`))}),_(`recurring`)]}),(0,R.jsxs)(P,{id:`weeks`,title:`Week by week`,icon:n,n:r.weeks.length,children:[(0,R.jsx)(g,{label:`Week by week`,search:!1,minWidth:520,head:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`Week`}),[`PASS`,`WARN`,`FAIL`,`UNKNOWN`,`NONE`].map(e=>(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-right text-[11.5px] font-medium whitespace-nowrap text-muted`,children:Y[e]},e))]}),children:[...r.weeks].reverse().map(e=>(0,R.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,R.jsx)(`th`,{scope:`row`,className:v(`px-3 py-2`,`text-left font-medium tabular-nums`),children:e.week===`undated`?`No date`:e.week}),[`PASS`,`WARN`,`FAIL`,`UNKNOWN`,`NONE`].map(t=>(0,R.jsx)(`td`,{className:`px-3 py-2 text-right whitespace-nowrap tabular-nums`,children:y(`weeks`,e.outcome[t],`${e.week}: ${Y[t].toLowerCase()}`,t===`FAIL`)},t))]},e.week))}),_(`weeks`)]})]})]})}function Te({agent:n}){let[r,i]=(0,L.useState)(null),[a,s]=(0,L.useState)([]),[c,l]=(0,L.useState)(``),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(n),[m,h]=(0,L.useState)(`all`),[g,_]=(0,L.useState)(0);(0,L.useEffect)(()=>{e.runs().then(e=>{i(e.runs),s(e.refused)},e=>l(e.message))},[]),(0,L.useEffect)(()=>p(n),[n]);let y=(0,L.useMemo)(()=>[...new Set((r||[]).map(e=>e.agent))].sort(),[r]),b=u.toLowerCase().split(/\s+/).filter(Boolean),x=(r||[]).filter(e=>(!f||e.agent===f)&&b.every(t=>`${e.agent} ${e.request||``} ${e.id} ${e.source.name}`.toLowerCase().includes(t))),S=m===`failed`?x.filter(e=>e.failed):x,C={all:x.length,failed:x.filter(e=>e.failed).length},w=Math.max(1,Math.ceil(S.length/H)),E=Math.min(g,w-1),D=S.slice(E*H,E*H+H);(0,L.useEffect)(()=>_(0),[u,f,m]);let O=r||[],k=O.filter(e=>e.failed).length;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(K,{id:`evidence-runs`,children:`Agent runs`}),(0,R.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:`Every agent run recorded here, newest first. Open one for its timeline: each step, the data it took in, what it decided and the reason it gave, and what the record cannot say.`}),c&&(0,R.jsx)(F,{text:c}),!r&&!c&&(0,R.jsx)(q,{}),(0,R.jsx)(be,{refused:a}),r&&!r.length&&(0,R.jsx)(J,{}),r&&r.length>0&&(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1 text-[13px] text-muted`,children:[(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`b`,{className:`text-ink tabular-nums`,children:O.length}),` `,O.length===1?`run`:`runs`]}),(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`b`,{className:v(`tabular-nums`,k?`text-fail`:`text-ink`),children:k}),` with a failed step (`,Math.round(k/O.length*100),`%)`]}),(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`b`,{className:`text-ink tabular-nums`,children:O.reduce((e,t)=>e+t.decisions,0)}),` `,O.reduce((e,t)=>e+t.decisions,0)===1?`decision`:`decisions`]}),(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`b`,{className:`text-ink tabular-nums`,children:new Set(O.map(e=>e.agent)).size}),` `,new Set(O.map(e=>e.agent)).size===1?`agent`:`agents`]})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsxs)(`div`,{className:`relative w-full max-w-[320px] min-w-0 flex-[0_1_320px]`,children:[(0,R.jsx)(te,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted`}),(0,R.jsx)(`label`,{htmlFor:`evidence-search`,className:`sr-only`,children:`Find a run`}),(0,R.jsx)(ne,{id:`evidence-search`,type:`search`,value:u,onChange:e=>d(e.target.value),placeholder:`Find a run by what was asked`,className:`h-9 pl-9`})]}),[[`all`,`All`],[`failed`,`Failed`]].map(([e,t])=>(0,R.jsxs)(`button`,{type:`button`,"aria-pressed":m===e,onClick:()=>h(e),className:v(`inline-flex min-h-8 cursor-pointer items-center gap-1 rounded-[8px] border px-3 text-[13px] font-medium`,m===e?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:bg-line hover:text-ink`),children:[t,(0,R.jsx)(`span`,{className:v(`tabular-nums`,e===`failed`&&C.failed?`text-fail`:``),children:C[e]})]},e)),y.length>1&&(0,R.jsxs)(j,{"aria-label":`Agent`,value:f,onChange:e=>p(e.target.value),className:`h-8 w-auto py-0 pr-7 pl-3 text-[13px]`,children:[(0,R.jsx)(`option`,{value:``,children:`Every agent`}),y.map(e=>(0,R.jsx)(`option`,{value:e,children:B(e)},e))]})]}),(0,R.jsxs)(`div`,{className:`rounded-[14px] card border`,children:[(0,R.jsxs)(`ul`,{"aria-label":`Agent runs`,className:`m-0 list-none p-1.5`,children:[!D.length&&(0,R.jsx)(`li`,{className:`px-3 py-4 text-sm text-muted`,children:`Nothing matches.`}),D.map((e,t)=>(0,R.jsxs)(`li`,{className:`contents`,children:[(t===0||de(D[t-1].started)!==de(e.started))&&(0,R.jsx)(`span`,{className:`block px-3 pt-3 pb-1 text-[12px] font-semibold text-muted`,children:de(e.started)}),(0,R.jsxs)(`a`,{href:T(`evidence-runs`,encodeURIComponent(e.id)),className:`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-3 rounded-[10px] px-3 py-1.5 text-ink no-underline hover:bg-surface-muted hover:text-ink`,children:[e.failed?(0,R.jsx)(M,{size:16,"aria-label":`${e.failed} failed ${e.failed===1?`step`:`steps`}`,className:`flex-none text-fail`}):(0,R.jsx)(ce,{size:16,"aria-label":`No failed step`,className:`flex-none text-muted`}),(0,R.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,R.jsx)(`span`,{className:`truncate text-[14px] font-medium`,"data-tip":e.request||e.agent,children:B(e.request||`${e.agent}: request not recorded`)}),(0,R.jsx)(`span`,{className:`truncate text-[12px] text-muted`,children:[B(`${e.agent}${e.version?` ${e.version}`:``}`),o(e.steps,`step`),o(e.decisions,`decision`),`${o(e.gaps,`thing`,`things`)} not known`,z[e.source.kind],e.content?`content kept`:`inputs as fingerprints`,e.verdict?`verdict: ${U[e.verdict].label.toLowerCase()}`:`no contract`].join(` · `)})]}),(0,R.jsx)(`span`,{className:`text-right text-[12.5px] text-muted tabular-nums`,"data-tip":V(e.started),children:e.started?N(e.started):``})]})]},e.id))]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-t border-line-soft px-4 py-2.5 text-[13px] text-muted`,children:[(0,R.jsx)(`span`,{className:`flex-1`,children:S.length?`${E*H+1}–${Math.min(S.length,E*H+H)} of ${S.length}`:`0 runs`}),w>1&&(0,R.jsxs)(`nav`,{"aria-label":`Pages of agent runs`,className:`flex items-center gap-1`,children:[(0,R.jsx)(t,{size:`sm`,variant:`ghost`,disabled:E===0,onClick:()=>_(E-1),"aria-label":`Newer runs`,children:(0,R.jsx)(ee,{size:16,"aria-hidden":`true`})}),(0,R.jsxs)(`span`,{className:`px-1 tabular-nums`,children:[`Page `,E+1,` of `,w]}),(0,R.jsx)(t,{size:`sm`,variant:`ghost`,disabled:E>=w-1,onClick:()=>_(E+1),"aria-label":`Older runs`,children:(0,R.jsx)(oe,{size:16,"aria-hidden":`true`})})]})]})]})]})]})}function X({t:e,label:t}){let[n,r]=(0,L.useState)(!1);if(e.text===void 0)return(0,R.jsxs)(`span`,{className:`font-mono text-[12px] text-muted`,children:[t,`: fingerprint only, `,e.chars.toLocaleString(),` characters, sha256 `,e.sha256.slice(0,12),`…`]});let i=e.text.length>600;return(0,R.jsxs)(`span`,{className:`flex flex-col items-start gap-1`,children:[(0,R.jsx)(`span`,{className:`text-[13px] whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:B(i&&!n?`${e.text.slice(0,600)}…`:e.text)}),i&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>r(!n),className:`cursor-pointer border-0 bg-transparent p-0 text-[12px] text-accent-fg hover:underline`,children:n?`Show less`:`Show all ${e.text.length.toLocaleString()} characters`})]})}function Ee({d:e}){return(0,R.jsxs)(`div`,{className:`flex flex-col gap-0.5 border-l-2 border-accent-line pl-3`,children:[(0,R.jsxs)(`span`,{className:`text-[12px] font-medium text-muted`,children:[`Decided`,e.by?` · by ${B(e.by)}`:``]}),(0,R.jsxs)(`span`,{className:`text-[13px] text-ink [overflow-wrap:anywhere]`,children:[B(e.what),`: `,(0,R.jsx)(`b`,{className:`font-semibold`,children:B(e.chose)})]}),e.options&&e.options.length>0&&(0,R.jsxs)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:[`Options: `,B(e.options.join(`, `))]}),e.reason?(0,R.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,R.jsx)(`span`,{className:`text-[12px] text-muted`,children:`The reason given (a claim, not checked yet):`}),(0,R.jsx)(X,{t:e.reason,label:`reason`})]}):(0,R.jsx)(`span`,{className:`text-[12px] text-muted`,children:`No reason given.`})]})}function De({s:e,r:t}){let n=(e.inputs||[]).map(e=>t.inputs.find(t=>t.id===e)).filter(e=>!!e),r=t.decisions.filter(t=>t.step===e.seq),i=t.statements.filter(t=>t.step===e.seq),a=Object.entries(e.facts||{});return(0,R.jsxs)(`li`,{id:`evidence-step-${e.seq}`,tabIndex:-1,className:`grid scroll-mt-4 grid-cols-[36px_minmax(0,1fr)] gap-x-2 border-b border-line-soft py-2.5 outline-none last:border-b-0 focus-visible:bg-accent-soft`,children:[(0,R.jsx)(`span`,{className:`pt-0.5 text-right text-[12px] text-muted tabular-nums`,children:e.seq}),(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,R.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5`,children:[(0,R.jsx)(s,{icon:_e[e.kind]||A,size:14,className:`flex-none`}),(0,R.jsx)(`span`,{className:`text-[14px] font-medium [overflow-wrap:anywhere]`,children:B(e.name)}),(0,R.jsx)(`span`,{className:`text-[12px] text-muted`,children:e.kind}),e.agent&&(0,R.jsxs)(`span`,{className:`text-[12px] text-muted`,children:[`· by `,B(e.agent)]}),e.ok===!1&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[12px] text-fail`,children:[(0,R.jsx)(M,{size:13,"aria-hidden":`true`}),`failed`]}),e.ms!==void 0&&(0,R.jsxs)(`span`,{className:`text-[12px] text-muted tabular-nums`,children:[`· `,e.ms.toLocaleString(),` ms`]})]}),a.length>0&&(0,R.jsx)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:B(a.map(([e,t])=>`${e}: ${String(t)}`).join(` · `))}),e.detail&&(0,R.jsx)(X,{t:e.detail,label:`details`}),n.map(e=>(0,R.jsxs)(`div`,{className:`flex flex-col gap-0.5 border-l-2 border-line pl-3`,children:[(0,R.jsxs)(`span`,{className:`text-[12px] font-medium text-muted [overflow-wrap:anywhere]`,children:[`Took in `,ve[e.kind]||e.kind,` from `,B(e.source)]}),(0,R.jsx)(X,{t:e.kind===`request`&&e.data.text===void 0&&t.request?.text?.text!==void 0&&t.request.text.sha256===e.data.sha256?t.request.text:e.data,label:`content`})]},e.id)),r.map(e=>(0,R.jsx)(Ee,{d:e},e.seq)),i.map(e=>(0,R.jsxs)(`div`,{className:`flex flex-col gap-0.5 border-l-2 border-line pl-3`,children:[(0,R.jsx)(`span`,{className:`text-[12px] font-medium text-muted`,children:`Said (a claim about its own work, not checked yet)`}),(0,R.jsx)(X,{t:e.text,label:`statement`})]},e.seq))]})]})}function Oe({id:n}){let[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)(``),[s,l]=(0,L.useState)(G);(0,L.useEffect)(()=>{e.run(n).then(i,e=>o(e.message))},[n]);let u=(0,R.jsxs)(`a`,{href:T(`evidence-runs`),className:`inline-flex items-center gap-1.5 self-start text-sm`,children:[(0,R.jsx)(se,{size:16,"aria-hidden":`true`}),`All agent runs`]});if(!r)return(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[u,a?(0,R.jsx)(F,{text:a}):(0,R.jsx)(q,{})]});let d=r.decisions.filter(e=>!e.step),f=r.steps.filter(e=>e.ok===!1).length,p=e=>{e>s&&l(Math.ceil(e/G)*G),requestAnimationFrame(()=>{let t=document.getElementById(`evidence-step-${e}`);t?.scrollIntoView({block:`start`}),t?.focus({preventScroll:!0})})},h=[...r.gaps,...r.truncated?[r.truncated]:[]];return(0,R.jsxs)(`section`,{"aria-labelledby":`evidence-run-h`,className:`flex flex-col gap-5`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[u,(0,R.jsx)(`h2`,{id:`evidence-run-h`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:B(r.request?.text?.text?r.request.text.text.slice(0,200):`${r.agent.name}: request not recorded`)}),(0,R.jsxs)(`p`,{className:`m-0 text-sm text-ink-2 [overflow-wrap:anywhere]`,children:[B(`${r.agent.name}${r.agent.version?` ${r.agent.version}`:``}${r.agent.model?` · ${r.agent.model}`:``}${r.agent.provider?` (${r.agent.provider})`:``}`),` · from `,z[r.source.kind],`, `,B(r.source.name),r.started?` · ${V(r.started)}`:``,r.ended&&r.ended!==r.started?` to ${V(r.ended)}`:``]}),(0,R.jsx)(`p`,{className:`m-0 font-mono text-[12px] text-muted`,children:r.id})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1 text-[13px] text-muted`,children:[(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`b`,{className:`text-ink tabular-nums`,children:r.steps.length}),` `,r.steps.length===1?`step`:`steps`]}),(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`b`,{className:v(`tabular-nums`,f?`text-fail`:`text-ink`),children:f}),` failed`]}),(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`b`,{className:`text-ink tabular-nums`,children:r.inputs.length}),` `,r.inputs.length===1?`input`:`inputs`]}),(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`b`,{className:`text-ink tabular-nums`,children:r.decisions.length}),` `,r.decisions.length===1?`decision`:`decisions`]}),(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`b`,{className:`text-ink tabular-nums`,children:r.statements.length}),` `,r.statements.length===1?`claim`:`claims`]}),(0,R.jsx)(`span`,{children:r.content?`Content kept, with secrets cut out`:`Inputs kept as fingerprints only`})]}),(0,R.jsx)(ke,{id:r.id,goTo:p}),(0,R.jsx)(P,{id:`evidence-gaps`,title:`What the record cannot say`,icon:c,n:h.length,children:h.length?(0,R.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:h.map(e=>(0,R.jsx)(`li`,{className:`border-b border-line-soft py-2 text-[13px] text-ink-2 last:border-b-0 [overflow-wrap:anywhere]`,children:B(e)},e))}):(0,R.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing: the source said everything the record holds.`})}),(0,R.jsxs)(P,{id:`evidence-timeline`,title:`Timeline`,icon:E,n:r.steps.length,children:[(0,R.jsx)(`ol`,{"aria-label":`Steps`,className:`m-0 flex list-none flex-col p-0`,children:r.steps.slice(0,s).map(e=>(0,R.jsx)(De,{s:e,r},e.seq))}),r.steps.length>s&&(0,R.jsxs)(t,{size:`sm`,variant:`ghost`,className:`self-start`,onClick:()=>l(s+G),children:[`Show `,Math.min(G,r.steps.length-s),` more of `,r.steps.length-s]})]}),d.length>0&&(0,R.jsx)(P,{id:`evidence-loose`,title:`Decisions not tied to a step`,icon:I,n:d.length,children:(0,R.jsx)(`div`,{className:`flex flex-col gap-3`,children:d.map(e=>(0,R.jsx)(Ee,{d:e},e.seq))})}),(0,R.jsx)(P,{id:`evidence-inputs`,title:`Data it took in`,icon:m,n:r.inputs.length,children:r.inputs.length?(0,R.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:r.inputs.map(e=>(0,R.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-0.5 border-b border-line-soft py-2 last:border-b-0`,children:[(0,R.jsxs)(`span`,{className:`min-w-0 flex-[1_1_320px] text-[13px] [overflow-wrap:anywhere]`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:ve[e.kind]||e.kind}),` `,(0,R.jsx)(`span`,{className:`text-muted`,children:`from`}),` `,B(e.source)]}),(0,R.jsxs)(`span`,{className:`text-[12px] text-muted tabular-nums`,children:[`step `,e.step]}),(0,R.jsx)(`span`,{className:`font-mono text-[12px] text-muted`,children:e.data.text===void 0?`${e.data.chars.toLocaleString()} chars · ${e.data.sha256.slice(0,12)}`:`kept`})]},e.id))}):(0,R.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`The record holds no input.`})})]})}function ke({id:t,goTo:n}){let[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)(``),[s,c]=(0,L.useState)(0),l=()=>c(e=>e+1);if((0,L.useEffect)(()=>{e.verdict(t).then(i,e=>o(e.message))},[t,s]),a)return(0,R.jsx)(F,{text:a});if(!r)return(0,R.jsx)(q,{});let u=r.why||!r.verdicts.length?(0,R.jsx)(P,{id:`evidence-behaviour`,title:ye.behaviour.title,icon:x,children:(0,R.jsxs)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:[`Not judged: `,B(r.why||`no contract judges this agent.`),` A contract says what was agreed for an agent; `,(0,R.jsx)(`a`,{href:T(`evidence-contracts`),children:`Contracts`}),` lists them.`]})}):null;return(0,R.jsxs)(R.Fragment,{children:[r.work&&(0,R.jsxs)(`p`,{className:v(`m-0 rounded-[12px] px-3 py-2 text-sm`,r.work.personTakesOver?`bg-warn-soft text-ink`:`bg-surface-muted text-ink-2`),children:[r.work.attempt?`Fix attempt ${r.work.attempt} of 2 at `:`The first run of work tried again in `,r.work.attempt?(0,R.jsx)(`a`,{href:T(`evidence-runs`,encodeURIComponent(r.work.first)),children:r.work.first}):`${r.work.runs.length-1} ${r.work.runs.length===2?`fix attempt`:`fix attempts`}`,r.work.personTakesOver?`: findings are still open after the last attempt, so a person takes over.`:`.`]}),u,r.verdicts.map(e=>(0,R.jsx)(P,{id:`evidence-${e.lens}`,title:ye[e.lens].title,icon:ye[e.lens].icon,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,R.jsx)(C,{tone:U[e.status].tone,children:U[e.status].label}),(0,R.jsx)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:e.contract?(0,R.jsxs)(R.Fragment,{children:[`By contract `,B(e.contract.name),`, version `,B(e.contract.version),`, `,e.contract.approved?`approved`:`not approved: it can only warn`]}):`Against the product graph: advisory, it can only warn`})]}),e.notes.map(e=>(0,R.jsx)(`p`,{className:`m-0 text-[13px] text-muted [overflow-wrap:anywhere]`,children:B(e)},e)),(0,R.jsx)(`ul`,{"aria-label":`Checks`,className:`m-0 flex list-none flex-col rounded-[14px] card border p-1.5`,children:e.checks.map(t=>(0,R.jsxs)(`li`,{className:`flex flex-col gap-1.5 border-b border-line-soft px-3 py-2.5 last:border-b-0`,children:[(0,R.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,R.jsx)(`span`,{className:`min-w-[152px] text-[14px] font-medium`,children:W[t.check]}),(0,R.jsx)(C,{tone:U[t.status].tone,children:U[t.status].label}),(0,R.jsxs)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:[B(t.checked),t.gating?` · can fail a run`:t.advisory&&e.contract?.approved?` · ${t.advisory}`:``]})]}),t.findings.map(t=>(0,R.jsx)(je,{f:t,run:e.run,goTo:n,onOverruled:l},t.id))]},t.check))}),e.lens===`content`&&r.rubric&&(0,R.jsx)(Ae,{run:e.run,rubric:r.rubric,onGraded:l})]})},e.lens))]})}function Ae({run:n,rubric:r,onGraded:i}){let[a,o]=(0,L.useState)(null),[s,c]=(0,L.useState)(``),[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)(``),p=s.trim().length>=10&&s.trim().length<=500,m=async()=>{if(a){u(!0),f(``);try{await e.grade(n,a.id,a.grade,s.trim()),o(null),c(``),i()}catch(e){f(e.message)}finally{u(!1)}}};return(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(`h4`,{className:`m-0 text-sm font-semibold`,children:`Grade the answer`}),(0,R.jsxs)(`p`,{className:`m-0 max-w-[74ch] text-[13px] text-muted`,children:[r.criteria.some(e=>e.id===`scenario`)?`Its scenario is graded by a person: the release gate counts it only once you have graded it. `:``,r.criteria.some(e=>e.id!==`scenario`)?`The judge's misses count only once it agrees with people's grades. `:``,`Read the answer, then say whether it meets each criterion; your grade is kept with your name.`]}),r.answer!==void 0&&(0,R.jsx)(`p`,{className:`m-0 max-w-[74ch] whitespace-pre-wrap rounded-[12px] bg-surface-muted px-3 py-2 text-[13px] text-ink [overflow-wrap:anywhere]`,children:B(r.answer)}),(0,R.jsx)(`ul`,{"aria-label":`Rubric criteria`,className:`m-0 flex list-none flex-col rounded-[14px] card border p-1.5`,children:r.criteria.map(e=>(0,R.jsxs)(`li`,{className:`flex flex-col gap-1.5 border-b border-line-soft px-3 py-2.5 last:border-b-0`,children:[(0,R.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,R.jsxs)(`span`,{className:`text-[13px] text-ink [overflow-wrap:anywhere]`,children:[(0,R.jsx)(`span`,{className:`font-mono text-muted`,children:e.id}),` `,B(e.text)]}),e.grade&&(0,R.jsx)(C,{tone:e.grade.grade===`meets`?`pass`:`warn`,children:e.grade.grade===`meets`?`Meets`:`Misses`}),(0,R.jsx)(`span`,{className:`text-[12px] text-muted`,children:e.grade?`Grade again:`:`Grade:`}),[`meets`,`misses`].map(t=>(0,R.jsx)(`button`,{type:`button`,"aria-label":`${e.id} ${t===`meets`?`meets`:`misses`}`,onClick:()=>o({id:e.id,grade:t}),className:`inline-flex min-h-7 cursor-pointer items-center rounded-[8px] border-0 bg-transparent px-2 text-[12px] text-accent-fg hover:underline`,children:t===`meets`?`Meets`:`Misses`},t))]}),e.grade&&(0,R.jsxs)(`span`,{className:`text-[12.5px] text-ink-2 [overflow-wrap:anywhere]`,children:[`Graded by `,B(e.grade.by),` `,V(e.grade.at),`: `,B(e.grade.reason)]}),a?.id===e.id&&(0,R.jsxs)(`div`,{className:`flex max-w-[640px] flex-col gap-2 rounded-[12px] bg-surface-muted p-3`,children:[(0,R.jsxs)(`label`,{htmlFor:`grade-${e.id}`,className:`text-[12.5px] font-medium text-ink-2`,children:[`Why does the answer `,a.grade===`meets`?`meet`:`miss`,` it?`]}),(0,R.jsx)(O,{id:`grade-${e.id}`,value:s,onChange:e=>c(e.target.value),rows:2,maxLength:500,placeholder:`For example: it says the customer must send a photo by Friday.`}),d&&(0,R.jsx)(F,{text:d}),(0,R.jsxs)(`span`,{className:`flex gap-2`,children:[(0,R.jsx)(t,{size:`sm`,disabled:!p||l,onClick:m,children:l?`Keeping…`:a.grade===`meets`?`Keep: meets`:`Keep: misses`}),(0,R.jsx)(t,{size:`sm`,variant:`ghost`,onClick:()=>o(null),children:`Cancel`})]})]})]},e.id))})]})}function je({f:n,run:r,goTo:i,onOverruled:a}){let[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(``),[u,d]=(0,L.useState)(!1),[f,p]=(0,L.useState)(``),m=c.trim().length>=10&&c.trim().length<=500,h=async()=>{d(!0),p(``);try{await e.overrule(r,n.id,c.trim()),s(!1),a()}catch(e){p(e.message)}finally{d(!1)}};return(0,R.jsxs)(`div`,{className:v(`flex flex-col gap-1 border-l-2 pl-3`,n.overruled?`border-line opacity-80`:n.status===`FAIL`?`border-fail`:n.status===`WARN`?`border-warn`:`border-line`),children:[(0,R.jsx)(`span`,{className:v(`text-[13px] [overflow-wrap:anywhere]`,n.overruled?`text-ink-2`:`text-ink`),children:B(n.what)}),n.fix&&!n.overruled&&(0,R.jsxs)(`span`,{className:`text-[12.5px] text-ink-2 [overflow-wrap:anywhere]`,children:[`Fix: `,B(n.fix)]}),n.overruled&&(0,R.jsxs)(`span`,{className:`text-[12.5px] text-ink-2 [overflow-wrap:anywhere]`,children:[`Overruled by `,B(n.overruled.by),` `,V(n.overruled.at),` (`,n.overruled.via===`web`?`on this page`:`at a terminal`,`): `,B(n.overruled.reason)]}),(0,R.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-[12px] text-muted`,children:[(0,R.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:B(n.source)}),n.location&&(0,R.jsx)(`span`,{className:`font-mono [overflow-wrap:anywhere]`,children:B(`${n.location.repo?`${n.location.repo}/`:``}${n.location.file}${n.location.line?`:${n.location.line}`:``}`)}),[...new Set(n.steps)].slice(0,12).map(e=>(0,R.jsxs)(`button`,{type:`button`,onClick:()=>i(e),className:`inline-flex min-h-7 cursor-pointer items-center rounded-[8px] border-0 bg-surface-strong px-2 text-[12px] text-accent-fg tabular-nums hover:underline`,children:[`step `,e]},e)),!n.overruled&&n.status!==`UNKNOWN`&&!o&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>s(!0),className:`inline-flex min-h-7 cursor-pointer items-center rounded-[8px] border-0 bg-transparent px-2 text-[12px] text-accent-fg hover:underline`,children:`Overrule`})]}),o&&(0,R.jsxs)(`div`,{className:`flex max-w-[640px] flex-col gap-2 rounded-[12px] bg-surface-muted p-3`,children:[(0,R.jsx)(`label`,{htmlFor:`overrule-${n.id}`,className:`text-[12.5px] font-medium text-ink-2`,children:`Why is this finding wrong, or right to accept? It is kept with your name, and the finding stops counting.`}),(0,R.jsx)(O,{id:`overrule-${n.id}`,value:c,onChange:e=>l(e.target.value),rows:2,maxLength:500,placeholder:`For example: the owner agreed this removal in the change's review.`}),f&&(0,R.jsx)(F,{text:f}),(0,R.jsxs)(`span`,{className:`flex gap-2`,children:[(0,R.jsx)(t,{size:`sm`,disabled:!m||u,onClick:h,children:u?`Overruling…`:`Overrule`}),(0,R.jsx)(t,{size:`sm`,variant:`ghost`,onClick:()=>s(!1),children:`Cancel`})]})]})]})}function Me(){let[t,n]=(0,L.useState)(null),[r,i]=(0,L.useState)(``);return(0,L.useEffect)(()=>{e.review().then(n,e=>i(e.message))},[]),(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(K,{id:`evidence-review`,children:`Review queue`}),(0,R.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:`Runs whose findings are still open, the failed first, then work whose two fix attempts are used, where a person takes over. Open a run to read its findings, and overrule one with a reason where it is wrong or right to accept. Then the answers the rubric's judge could not settle, for a person to grade, and every finding people overruled, and why.`}),r&&(0,R.jsx)(F,{text:r}),!t&&!r&&(0,R.jsx)(q,{}),t?.problems.map(e=>(0,R.jsx)(F,{text:e},e)),t&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`h2`,{className:`sr-only`,children:`What waits, what to grade, and what was overruled`}),(0,R.jsx)(P,{id:`waiting`,title:`Waiting for a person`,icon:x,n:t.waiting.length,children:t.waiting.length?(0,R.jsx)(`ul`,{"aria-label":`Waiting for a person`,className:`m-0 list-none rounded-[14px] card border p-1.5`,children:t.waiting.map(e=>(0,R.jsx)(`li`,{children:(0,R.jsxs)(`a`,{href:T(`evidence-runs`,encodeURIComponent(e.run)),className:`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-3 rounded-[10px] px-3 py-1.5 text-ink no-underline hover:bg-surface-muted hover:text-ink`,children:[(0,R.jsx)(C,{tone:U[e.status].tone,children:U[e.status].label}),(0,R.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,R.jsx)(`span`,{className:`truncate text-[14px] font-medium`,children:B(e.request||`${e.agent}: request not recorded`)}),(0,R.jsx)(`span`,{className:`truncate text-[12px] text-muted`,children:[B(e.agent),o(e.open,`open finding`),e.failed?`${e.failed} failing`:``,e.attempt?`fix attempt ${e.attempt} of 2`:``,e.personTakesOver?`a person takes over`:``].filter(Boolean).join(` · `)})]}),(0,R.jsx)(`span`,{className:`text-right text-[12.5px] text-muted tabular-nums`,"data-tip":V(e.started),children:e.started?N(e.started):``})]})},e.run))}):(0,R.jsx)(`p`,{className:`m-0 rounded-[14px] bg-surface-muted px-5 py-4 text-sm leading-relaxed text-ink-2`,children:`Nothing waits: no run has an open finding.`})}),t.grade.length>0&&(0,R.jsxs)(P,{id:`grade`,title:`Answers to grade`,icon:p,n:t.grade.length,children:[(0,R.jsx)(`p`,{className:`m-0 max-w-[74ch] text-[13px] text-muted`,children:`The rubric's judge could not settle these answers: it is not yet calibrated against people's grades, or it disagreed with itself. Grading them settles each one and calibrates the judge.`}),(0,R.jsx)(`ul`,{"aria-label":`Answers to grade`,className:`m-0 list-none rounded-[14px] card border p-1.5`,children:t.grade.map(e=>(0,R.jsx)(`li`,{children:(0,R.jsxs)(`a`,{href:T(`evidence-runs`,encodeURIComponent(e.run)),className:`grid min-h-12 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 rounded-[10px] px-3 py-1.5 text-ink no-underline hover:bg-surface-muted hover:text-ink`,children:[(0,R.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,R.jsx)(`span`,{className:`truncate text-[14px] font-medium`,children:B(e.request||`${e.agent}: request not recorded`)}),(0,R.jsx)(`span`,{className:`truncate text-[12px] text-muted`,children:[B(e.agent),`${e.ungraded} of ${e.criteria} ${e.criteria===1?`criterion`:`criteria`} not graded`].join(` · `)})]}),(0,R.jsx)(`span`,{className:`text-right text-[12.5px] text-muted tabular-nums`,"data-tip":V(e.started),children:e.started?N(e.started):``})]})},e.run))})]}),(0,R.jsx)(P,{id:`overruled`,title:`Overruled by people`,icon:I,n:t.overruled.length,children:t.overruled.length?(0,R.jsx)(`ul`,{"aria-label":`Overruled findings`,className:`m-0 list-none rounded-[14px] card border p-1.5`,children:t.overruled.map(e=>(0,R.jsxs)(`li`,{className:`flex flex-col gap-0.5 border-b border-line-soft px-3 py-2 last:border-b-0`,children:[(0,R.jsxs)(`span`,{className:`text-[13px] [overflow-wrap:anywhere]`,children:[(0,R.jsx)(`a`,{href:T(`evidence-runs`,encodeURIComponent(e.run)),children:B(e.agent||e.run)}),` · `,B(`${e.check}/${e.rule}`),e.what?`: ${B(e.what)}`:``]}),(0,R.jsxs)(`span`,{className:`text-[12.5px] text-ink-2 [overflow-wrap:anywhere]`,children:[B(e.by),` `,V(e.at),` (`,e.via===`web`?`on the page`:`at a terminal`,`): `,B(e.reason)]})]},`${e.run}-${e.finding}-${e.at}`))}):(0,R.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No finding has been overruled.`})})]})]})}var Z={build:`Build and test`,behaviour:`Behaviour`,decisions:`Decisions and data`,content:`Content`,domain:`Domain`};function Ne({s:t}){let[n,r]=(0,L.useState)(t.versions[0]||``),[i,a]=(0,L.useState)(t.versions[1]||``),[s,c]=(0,L.useState)(null),[l,u]=(0,L.useState)(``);(0,L.useEffect)(()=>{t.agent&&n&&(u(``),e.release(t.agent,n,i===n?``:i).then(c,e=>u(e.message)))},[t.agent,n,i]);let d=e=>{if(e===void 0)return``;if(e===null)return`Not run`;let t=e.runs.filter(e=>e.pass).length;return e.short?`Too few runs (${e.runs.length})`:e.pass?e.runs.length===1?`Pass`:t===e.runs.length?`Pass ×${e.runs.length}`:`Pass (${t} of ${e.runs.length})`:e.runs.length>1?`Fail (${e.runs.length-t} of ${e.runs.length} failed)`:`Fail`},f=s?[...new Set([...Object.keys(s.candidate.lensPass),...Object.keys(s.live?.lensPass||{})])]:[];return(0,R.jsxs)(`li`,{className:`flex flex-col gap-3 rounded-[14px] card border px-4 py-3`,children:[(0,R.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,R.jsx)(`span`,{className:`text-[15px] font-medium [overflow-wrap:anywhere]`,children:B(t.agent||t.name)}),(0,R.jsxs)(`span`,{className:`text-[12px] text-muted`,children:[B(`${t.name}.yaml`),` · `,o(t.scenarios.length,`scenario`)]})]}),t.problem&&(0,R.jsx)(F,{text:t.problem}),t.agent&&!t.versions.length&&(0,R.jsxs)(`p`,{className:`m-0 text-sm text-muted`,children:[`No run of `,B(t.agent),` is recorded yet: run each scenario's request through a version and record it (forgeqe evidence scenarios lists them).`]}),t.versions.length>0&&(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-[13px]`,children:[(0,R.jsx)(`label`,{htmlFor:`cand-${t.name}`,children:`Candidate`}),(0,R.jsx)(j,{id:`cand-${t.name}`,value:n,onChange:e=>r(e.target.value),className:`h-8 w-auto py-0 pr-7 pl-3 text-[13px]`,children:t.versions.map(e=>(0,R.jsx)(`option`,{value:e,children:B(e)},e))}),(0,R.jsx)(`label`,{htmlFor:`live-${t.name}`,children:`against live`}),(0,R.jsxs)(j,{id:`live-${t.name}`,value:i,onChange:e=>a(e.target.value),className:`h-8 w-auto py-0 pr-7 pl-3 text-[13px]`,children:[(0,R.jsx)(`option`,{value:``,children:`No live version`}),t.versions.filter(e=>e!==n).map(e=>(0,R.jsx)(`option`,{value:e,children:B(e)},e))]})]}),l&&(0,R.jsx)(F,{text:l}),s&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,R.jsx)(C,{tone:s.status===`ready`?`pass`:`fail`,children:s.status===`ready`?`Ready`:`Held`}),(0,R.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:s.status===`ready`?`Not worse on any lens, and every misuse and injection test passed. A person releases it.`:`Held: a person decides, with what follows.`})]}),s.reasons.length>0&&(0,R.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-0.5 pl-5 text-[13px] text-ink-2`,children:s.reasons.map(e=>(0,R.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:B(e)},e))}),(0,R.jsxs)(g,{label:`Scenarios of ${t.agent}`,search:!1,minWidth:520,head:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`Scenario`}),(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`Kind`}),s.live&&(0,R.jsxs)(`th`,{scope:`col`,className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:[B(s.live.version),` (live)`]}),(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:B(s.candidate.version)})]}),children:[t.scenarios.map(e=>(0,R.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,R.jsx)(`th`,{scope:`row`,className:v(`px-3 py-2`,`text-left font-medium`),"data-tip":e.request,children:B(e.id)}),(0,R.jsx)(`td`,{className:`px-3 py-2`,children:e.kind}),s.live&&(0,R.jsx)(`td`,{className:v(`px-3 py-2`,s.live.cells[e.id]&&!s.live.cells[e.id].pass&&`text-fail`),children:d(s.live.cells[e.id])}),(0,R.jsx)(`td`,{className:v(`px-3 py-2`,(s.candidate.cells[e.id]===null||s.candidate.cells[e.id]&&!s.candidate.cells[e.id].pass)&&`text-fail`),children:d(s.candidate.cells[e.id])})]},e.id)),f.map(e=>(0,R.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,R.jsxs)(`th`,{scope:`row`,className:v(`px-3 py-2`,`text-left text-muted`),children:[Z[e],`: scenarios passed`]}),(0,R.jsx)(`td`,{className:`px-3 py-2`}),s.live&&(0,R.jsx)(`td`,{className:v(`px-3 py-2`,`tabular-nums`),children:s.live.lensPass[e]??0}),(0,R.jsx)(`td`,{className:v(`px-3 py-2`,`tabular-nums`,s.live&&(s.candidate.lensPass[e]??0)<(s.live.lensPass[e]??0)&&`text-fail`),children:s.candidate.lensPass[e]??0})]},e)),(0,R.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,R.jsx)(`th`,{scope:`row`,className:v(`px-3 py-2`,`text-left text-muted`),children:`The owners' expectations met`}),(0,R.jsx)(`td`,{className:`px-3 py-2`}),s.live&&(0,R.jsx)(`td`,{className:v(`px-3 py-2`,`tabular-nums`),children:s.live.golden}),(0,R.jsx)(`td`,{className:v(`px-3 py-2`,`tabular-nums`,s.live&&s.candidate.golden<s.live.golden&&`text-fail`),children:s.candidate.golden})]})]}),(0,R.jsx)(Re,{g:s}),(0,R.jsx)(Pe,{g:s}),(0,R.jsx)(ze,{g:s,ids:t.scenarios.map(e=>e.id)})]}),t.history.length>0&&(0,R.jsxs)(`details`,{className:`text-[13px]`,children:[(0,R.jsxs)(`summary`,{className:`cursor-pointer text-ink-2`,children:[`Gates kept (`,t.history.length,`)`]}),(0,R.jsx)(`ul`,{className:`m-0 mt-1 flex list-none flex-col gap-1 p-0`,children:t.history.map(e=>(0,R.jsxs)(`li`,{className:`text-[12.5px] text-ink-2 [overflow-wrap:anywhere]`,children:[V(e.at),` · `,B(e.by),` · `,B(e.candidate),e.live?` against ${B(e.live)}`:``,`: `,e.status===`ready`?`ready`:`held`,e.reasons.length?` (${B(e.reasons[0])}${e.reasons.length>1?`, and ${e.reasons.length-1} more`:``})`:``]},e.at))})]})]})}function Pe({g:e}){let t=Object.entries(e.candidate.cells).flatMap(([e,t])=>(t?.runs??[]).filter(e=>e.awaitingGrade).map(t=>({sid:e,run:t.run})));return t.length?(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`h4`,{className:`m-0 text-sm font-semibold`,children:[`Answers waiting for your grade (`,t.length,`)`]}),(0,R.jsx)(`p`,{className:`m-0 max-w-[74ch] text-[13px] text-muted`,children:`These scenarios are graded by a person: until an answer is graded, it is not known, and the scenario does not pass.`}),(0,R.jsx)(`ul`,{"aria-label":`Answers waiting for a grade`,className:`m-0 flex list-none flex-col gap-0.5 p-0 text-[13px]`,children:t.map(e=>(0,R.jsx)(`li`,{children:(0,R.jsxs)(`a`,{href:T(`evidence-runs`,encodeURIComponent(e.run)),className:`text-accent-fg hover:underline`,children:[B(e.sid),`: `,e.run]})},e.run))})]}):null}function Fe({f:e}){return(0,R.jsxs)(`li`,{className:`flex flex-col gap-1.5 rounded-[14px] card border px-4 py-3`,children:[(0,R.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,R.jsx)(C,{tone:e.applied||e.proven?`pass`:`fail`,children:e.applied?`Applied`:e.proven?`Proven`:`Not proven`}),(0,R.jsx)(`span`,{className:`text-[14px] font-medium [overflow-wrap:anywhere]`,children:B(e.instruction)}),(0,R.jsx)(`span`,{className:`font-mono text-[11.5px] text-muted`,children:e.id})]}),(0,R.jsxs)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[`Adds it to `,B(e.file),`, for `,B(e.cause),` of `,(0,R.jsx)(`a`,{href:T(`evidence-runs`,encodeURIComponent(e.run)),className:`font-mono`,children:e.run}),` (scenario `,B(e.scenario),`, `,B(e.version),`).`]}),(0,R.jsxs)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[`The cause: `,e.proof.replace(`-`,` `),` (`,B(e.why),`)`,e.replays.length?(0,R.jsxs)(R.Fragment,{children:[`; replays `,Ze(e.replays)]}):null,`.`]}),(0,R.jsxs)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[`The suite, run from the patched copy against `,B(e.version),`: `,e.gate.status===`ready`?`no worse`:`held: ${B(e.gate.reasons.join(` `))}`]}),e.applied&&(0,R.jsxs)(`span`,{className:`text-[12.5px] text-ink-2 [overflow-wrap:anywhere]`,children:[`Applied by `,B(e.applied.by),` `,V(e.applied.at),`: `,B(e.applied.reason)]}),(0,R.jsxs)(`details`,{className:`text-[13px]`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer text-ink-2`,children:`The patch`}),(0,R.jsx)(`pre`,{className:`m-0 mt-1 overflow-x-auto rounded-[12px] bg-surface-muted px-3 py-2 font-mono text-[12px] text-ink`,children:B(e.patch)})]})]})}function Ie({d:t,onDecided:n}){let r=t.scenario,i=r.expect||{},a=t.source.kind===`run`?`a run that failed`:t.source.kind===`story`?`an acceptance criterion`:t.source.kind===`rule`?`a business rule of the product, at`:`a defect`,o=e=>(e||[]).map(e=>B(e)).join(`, `);return(0,R.jsxs)(`li`,{className:`flex flex-col gap-1.5 border-b border-line-soft px-3 py-3 last:border-b-0`,children:[(0,R.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[12.5px] text-muted`,children:t.id}),(0,R.jsxs)(`span`,{className:`text-[14px] font-medium [overflow-wrap:anywhere]`,children:[B(r.id),` for `,B(t.agent)]}),(0,R.jsx)(C,{tone:`neutral`,children:r.kind}),r.held_out&&(0,R.jsx)(C,{tone:`neutral`,children:`Held out`}),t.decided&&(0,R.jsx)(C,{tone:t.decided.decision===`accepted`?`pass`:`warn`,children:t.decided.decision===`accepted`?`Accepted`:`Rejected`})]}),(0,R.jsxs)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:[`Drafted by `,t.by===`code`?`code`:`a model`,` from `,a,` `,t.source.url&&le(t.source.url)===`web`?(0,R.jsx)(`a`,{href:t.source.url,target:`_blank`,rel:`noreferrer noopener`,className:`text-accent-fg hover:underline`,children:B(t.source.ref)}):B(t.source.ref),t.source.criterion?` ${B(t.source.criterion)}`:``,t.source.quote?(0,R.jsxs)(R.Fragment,{children:[`: “`,B(t.source.quote),`”`]}):t.source.why?(0,R.jsxs)(R.Fragment,{children:[`: `,B(t.source.why)]}):null]}),(0,R.jsx)(`p`,{className:`m-0 max-w-[74ch] whitespace-pre-wrap rounded-[12px] bg-surface-muted px-3 py-2 text-[13px] text-ink [overflow-wrap:anywhere]`,children:B(r.request)}),(0,R.jsxs)(`ul`,{className:`m-0 flex list-disc flex-col gap-0.5 pl-5 text-[12.5px] text-ink-2`,children:[i.chose&&(0,R.jsxs)(`li`,{children:[`Expects it to choose `,o(i.chose)]}),i.not_chose&&(0,R.jsxs)(`li`,{children:[`Expects it never to choose `,o(i.not_chose)]}),i.says&&(0,R.jsxs)(`li`,{children:[`Expects it to say: `,o(i.says)]}),i.not_says&&(0,R.jsxs)(`li`,{children:[`Expects it never to say: `,o(i.not_says)]}),i.graded&&(0,R.jsx)(`li`,{children:`A person grades each answer`}),(0,R.jsx)(`li`,{children:i.clean?`Every lens must find nothing`:`The lenses are counted lens by lens`})]}),t.decided?(0,R.jsxs)(`span`,{className:`text-[12.5px] text-ink-2 [overflow-wrap:anywhere]`,children:[t.decided.decision===`accepted`?`Accepted`:`Rejected`,` by `,B(t.decided.by),` `,V(t.decided.at),t.decided.scenario?` as ${B(t.decided.scenario)}`:``,`: `,B(t.decided.reason)]}):(0,R.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[(0,R.jsx)($,{agent:t.id,uid:`${t.id}-accept`,label:`Add to the suite`,action:(n,r)=>e.decideDraft(t.id,`accepted`,n,r),onDone:n}),(0,R.jsx)($,{agent:t.id,uid:`${t.id}-reject`,label:`Reject`,action:(n,r)=>e.decideDraft(t.id,`rejected`,n,r),onDone:n})]})]})}function Le({onDecided:t}){let[n,r]=(0,L.useState)(null),[i,a]=(0,L.useState)(``),o=()=>e.drafts().then(r,e=>a(e.message));(0,L.useEffect)(()=>{o()},[]);let s=n?.drafts.filter(e=>!e.decided).length??0;return(0,R.jsxs)(P,{id:`drafts`,title:`Drafted scenarios`,icon:p,n:s,children:[(0,R.jsxs)(`p`,{className:`m-0 max-w-[74ch] text-[13px] text-muted`,children:[`Drafted from work items' acceptance criteria and defects (`,(0,R.jsx)(`code`,{children:`forgeqe evidence draft <agent> --from ado:N`}),`) or the product graph's business rules (`,(0,R.jsx)(`code`,{children:`--from-product`}),`), each resting on a quote of its source, or from a run that failed (`,(0,R.jsx)(`code`,{children:`--run <id>`}),`). Nothing is added by itself: add each to the suite, or reject it. About one in five is held out by ForgeQE, so the team tuning the agent does not choose what it is measured on.`]}),i&&(0,R.jsx)(F,{text:i}),n?.problems.map(e=>(0,R.jsx)(F,{text:e},e)),n&&!n.drafts.length&&(0,R.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No draft yet.`}),n&&n.drafts.length>0&&(0,R.jsx)(`ul`,{"aria-label":`Drafted scenarios`,className:`m-0 flex list-none flex-col rounded-[14px] card border p-1.5`,children:n.drafts.map(e=>(0,R.jsx)(Ie,{d:e,onDecided:()=>{o(),t()}},e.id))})]})}function Re({g:e}){let t=[...e.live?[e.live]:[],e.candidate],n=e=>e&&e.n?`${Math.round(e.pass/e.n*100)}% of ${e.n}`:`-`,r=[...[...new Set(t.flatMap(e=>Object.keys(e.pooled.lens)))].map(e=>[Z[e],t=>n(t.pooled.lens[e])]),[`The owners' expectations`,e=>n(e.pooled.golden)],[`Weakest lens (the summary)`,e=>e.pooled.weakest?`${Math.round(e.pooled.weakest.score*100)}% (${Z[e.pooled.weakest.lens]})`:`-`],...t.some(e=>e.pooled.heldOut.n)?[[`Held-out scenarios`,e=>n(e.pooled.heldOut)]]:[],[`Steps per run`,e=>e.pooled.effort.runs?e.pooled.effort.steps.toFixed(1):`-`],[`Tool calls per run`,e=>e.pooled.effort.runs?e.pooled.effort.tools.toFixed(1):`-`],[`Time per run`,e=>e.pooled.effort.ms===null?`-`:`${(e.pooled.effort.ms/1e3).toFixed(1)} s`]];return(0,R.jsxs)(`details`,{className:`text-[13px]`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer text-ink-2`,children:`Scores: runs passed, lens by lens`}),(0,R.jsx)(`p`,{className:`m-0 mt-1 max-w-[74ch] text-[12.5px] text-muted`,children:`A lens's score is its runs passed of the runs it judged. The summary is the weakest lens, never an average: one lens cannot make up for another. Effort is shown, never held against a version on its own.`}),(0,R.jsx)(g,{label:`Scores`,search:!1,minWidth:420,head:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`th`,{scope:`col`,className:u,children:`Score`}),t.map(t=>(0,R.jsxs)(`th`,{scope:`col`,className:re,children:[B(t.version),e.live&&t===e.live?` (live)`:``]},t.version))]}),children:r.map(([e,n])=>(0,R.jsxs)(`tr`,{className:l,children:[(0,R.jsx)(`th`,{scope:`row`,className:v(_,`text-left font-medium`),children:e}),t.map(e=>(0,R.jsx)(`td`,{className:a,children:n(e)},e.version))]},e))})]})}function ze({g:e,ids:t}){let n=e=>e?e.runs.find(e=>e.path?.unmet.length)??e.runs.find(e=>e.path):void 0,r=t.flatMap(t=>{let r=n(e.candidate.cells[t]),i=e.live?n(e.live.cells[t]):void 0;return r?.path||i?.path?[{id:t,cand:r,live:i}]:[]});if(!r.length)return null;let i={same:``,missing:`expected, not done`,extra:`done, not expected`},a=(e,t)=>t?.path?(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,R.jsxs)(`span`,{className:`text-[12px] text-muted`,children:[e,`: `,(0,R.jsx)(`a`,{href:T(`evidence-runs`,encodeURIComponent(t.run)),className:`font-mono`,children:t.run}),t.path.match===null?``:` · match ${Math.round(t.path.match*100)}%, efficiency ${Math.round((t.path.efficiency??0)*100)}%`]}),(0,R.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-0.5 p-0 font-mono text-[12.5px]`,children:(t.path.alignment.length?t.path.alignment:t.path.actual.map(e=>({kind:`same`,step:e}))).map((e,t)=>(0,R.jsxs)(`li`,{className:v(`[overflow-wrap:anywhere]`,e.kind===`missing`&&`text-fail`,e.kind===`extra`&&`text-warn`),children:[e.kind===`missing`?`− `:e.kind===`extra`?`+ `:` `,B(e.step),e.kind!==`same`&&(0,R.jsxs)(`span`,{className:`font-sans text-[11.5px] text-muted`,children:[` (`,i[e.kind],`)`]})]},`${t}-${e.step}`))}),t.path.unmet.map(e=>(0,R.jsx)(`span`,{className:`text-[12.5px] text-fail [overflow-wrap:anywhere]`,children:B(e)},e))]}):(0,R.jsxs)(`span`,{className:`text-[12.5px] text-muted`,children:[e,`: not run`]});return(0,R.jsxs)(`details`,{className:`text-[13px]`,children:[(0,R.jsxs)(`summary`,{className:`cursor-pointer text-ink-2`,children:[`Paths: expected against actual (`,r.length,`)`]}),(0,R.jsx)(`ul`,{className:`m-0 mt-2 flex list-none flex-col gap-3 p-0`,children:r.map(t=>(0,R.jsxs)(`li`,{className:`flex flex-col gap-1.5 rounded-[12px] card border px-3 py-2.5`,children:[(0,R.jsx)(`span`,{className:`text-[13px] font-medium`,children:B(t.id)}),(0,R.jsxs)(`div`,{className:`grid gap-4 @[640px]:grid-cols-2`,children:[e.live&&a(`${e.live.version} (live)`,t.live),a(e.candidate.version,t.cand)]})]},t.id))})]})}function Be(){let[t,n]=(0,L.useState)(null),[r,i]=(0,L.useState)(``),a=()=>e.releases().then(n,e=>i(e.message));return(0,L.useEffect)(()=>{a()},[]),(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(K,{id:`evidence-releases`,children:`Releases`}),(0,R.jsxs)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:[`Before a version is released: its runs of the agent's scenario suite (stories, past defects, misuse and injection tests, each with what its owners expect) against the live version's. It is held when it is worse on any lens, meets fewer expectations, or fails a misuse or injection test; not run, or not known, is never a pass. A person releases; `,(0,R.jsx)(`code`,{children:`forgeqe evidence release`}),` keeps each gate.`]}),r&&(0,R.jsx)(F,{text:r}),!t&&!r&&(0,R.jsx)(q,{}),t&&!t.suites.length&&(0,R.jsx)(`p`,{className:`m-0 rounded-[14px] bg-surface-muted px-5 py-4 text-sm leading-relaxed text-ink-2`,children:`No scenario suite yet: write one in .forgeqe/evidence/scenarios/<agent>.yaml (docs/EVIDENCE.md has its form), or add drafted scenarios below.`}),t&&t.suites.length>0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`h2`,{className:`sr-only`,children:`Each agent's scenario suite and release gate`}),(0,R.jsx)(P,{id:`suites`,title:`Scenario suites`,icon:p,n:t.suites.length,children:(0,R.jsx)(`ul`,{"aria-label":`Scenario suites`,className:`m-0 flex list-none flex-col gap-3 p-0`,children:t.suites.map(e=>(0,R.jsx)(Ne,{s:e},e.name))})})]}),t&&(0,R.jsx)(Le,{onDecided:a})]})}var Ve={approved:{tone:`pass`,label:`Approved`},changed:{tone:`warn`,label:`Changed since approved`},draft:{tone:`neutral`,label:`Not approved`},invalid:{tone:`fail`,label:`Cannot be read`}};function He(){let[t,n]=(0,L.useState)(null),[r,i]=(0,L.useState)(``);(0,L.useEffect)(()=>{e.contracts().then(n,e=>i(e.message))},[]);let a=e=>e===null?`–`:`${Math.round(e*100)}%`;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(K,{id:`evidence-contracts`,children:`Contracts`}),(0,R.jsxs)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:[`What each agent's owner agreed for it: the steps it must take, what it may and may never do, its limits, what a person decides, and what its statements need behind them. Each run is checked against its agent's approved contract. A contract nobody approved, or a check not yet measured well enough on labelled runs, only warns. Start one with `,(0,R.jsx)(`code`,{children:`forgeqe evidence contract new "<agent>"`}),`; a person approves it at a terminal with `,(0,R.jsx)(`code`,{children:`forgeqe evidence contract approve <name>`}),`.`]}),r&&(0,R.jsx)(F,{text:r}),!t&&!r&&(0,R.jsx)(q,{}),t&&!t.contracts.length&&(0,R.jsx)(`p`,{className:`m-0 rounded-[14px] bg-surface-muted px-5 py-4 text-sm leading-relaxed text-ink-2`,children:`No contract yet. Without one, a run's record is kept, but nothing checks it against what was agreed.`}),t&&(0,R.jsx)(`h2`,{className:`sr-only`,children:`The contracts and how each check is measured`}),t&&t.contracts.length>0&&(0,R.jsx)(P,{id:`contracts`,title:`Contracts`,icon:m,n:t.contracts.length,children:(0,R.jsx)(`ul`,{"aria-label":`Contracts`,className:`m-0 flex list-none flex-col gap-3 p-0`,children:t.contracts.map(e=>(0,R.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-[14px] card border px-4 py-3`,children:[(0,R.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,R.jsx)(`span`,{className:`text-[15px] font-medium [overflow-wrap:anywhere]`,children:B(e.agent||e.name)}),(0,R.jsx)(C,{tone:Ve[e.state].tone,children:Ve[e.state].label}),(0,R.jsxs)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:[B(`${e.name}.yaml`),e.version?` · version ${B(e.version)}`:``,e.approved?` · approved ${V(e.approved.at)} by ${B(e.approved.by)}`:``]})]}),e.problem&&(0,R.jsx)(F,{text:e.problem}),e.says.length>0&&(0,R.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0`,children:e.says.map(e=>(0,R.jsx)(`li`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:B(e)},e))}),(0,R.jsx)(`span`,{className:`text-[12px] text-muted`,children:e.gates.length?`Can fail a run: ${e.gates.map(e=>W[e]).join(`, `)}.`:`No check can fail a run under it yet: what they find is a warning.`})]},e.name))})}),t&&(0,R.jsxs)(P,{id:`measured`,title:`How well each check is measured`,icon:d,children:[(0,R.jsxs)(`p`,{className:`m-0 max-w-[74ch] text-[13px] leading-relaxed text-muted`,children:[`On `,o(t.measured.records,`labelled run`),`: runs whose right findings a person wrote down (ForgeQE's own, and the project's in .forgeqe/evidence/labelled). A check may fail a run only when its owner's bar is met on at least `,t.measured.min,` labelled findings.`]}),t.measured.problems.map(e=>(0,R.jsx)(F,{text:`Not measured: ${e}`},e)),(0,R.jsx)(g,{label:`How well each check is measured`,search:!1,minWidth:560,head:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`Check`}),[`Labelled`,`Found right`,`Found wrong`,`Missed`,`Precision`,`Recall`].map(e=>(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-right text-[11.5px] font-medium whitespace-nowrap text-muted`,children:e},e))]}),children:Object.keys(W).filter(e=>t.measured.checks[e]).map(e=>{let n=t.measured.checks[e];return(0,R.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,R.jsx)(`th`,{scope:`row`,className:v(`px-3 py-2`,`text-left font-medium`),children:W[e]}),(0,R.jsx)(`td`,{className:v(`px-3 py-2 text-right whitespace-nowrap tabular-nums`,n.labelled<t.measured.min&&`text-muted`),children:n.labelled}),(0,R.jsx)(`td`,{className:`px-3 py-2 text-right whitespace-nowrap tabular-nums`,children:n.tp}),(0,R.jsx)(`td`,{className:v(`px-3 py-2 text-right whitespace-nowrap tabular-nums`,n.fp>0&&`text-fail`),children:n.fp}),(0,R.jsx)(`td`,{className:v(`px-3 py-2 text-right whitespace-nowrap tabular-nums`,n.fn>0&&`text-fail`),children:n.fn}),(0,R.jsx)(`td`,{className:`px-3 py-2 text-right whitespace-nowrap tabular-nums`,children:a(n.precision)}),(0,R.jsx)(`td`,{className:`px-3 py-2 text-right whitespace-nowrap tabular-nums`,children:a(n.recall)})]},e)})})]})]})}var Ue={proven:{tone:`pass`,label:`Proven`},promising:{tone:`neutral`,label:`Promising`},"not-replayed":{tone:`neutral`,label:`Not replayed`},refuted:{tone:`fail`,label:`Refuted`},"side-effects":{tone:`warn`,label:`Side effects`}},We={instruction:`Its instructions`,tool:`A tool`,data:`Its data`};function Ge({p:n,onDecided:r}){let[i,a]=(0,L.useState)(null),[s,c]=(0,L.useState)(``),[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)(``),p=s.trim().length>=10&&s.trim().length<=500,m=async()=>{if(i){u(!0),f(``);try{await e.decide(n.agent,n.id,i,s.trim()),a(null),r()}catch(e){f(e.message)}finally{u(!1)}}};return(0,R.jsxs)(`li`,{className:`flex flex-col gap-1 border-b border-line-soft px-3 py-2.5 last:border-b-0`,children:[(0,R.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,R.jsx)(C,{tone:n.state===`approved`?`pass`:n.state===`declined`?`neutral`:`warn`,children:n.state===`approved`?`Approved`:n.state===`declined`?`Declined`:`Open`}),(0,R.jsx)(`span`,{className:`text-[12.5px] font-medium text-ink-2`,children:n.kind===`fix`?`Fix, proven by replay`:`Guidance for its instructions`}),(0,R.jsx)(`span`,{className:`font-mono text-[11.5px] text-muted`,children:n.id})]}),(0,R.jsx)(`span`,{className:`text-[14px] text-ink [overflow-wrap:anywhere]`,children:B(n.text)}),(0,R.jsxs)(`span`,{className:`text-[12.5px] text-muted [overflow-wrap:anywhere]`,children:[`Because `,B(n.because),`. `,o(n.runs.length,`run`),n.replays?`, ${o(n.replays.length,`replay`)}`:``,`:`,` `,[...n.runs,...n.replays??[]].slice(0,8).map((e,t)=>(0,R.jsxs)(`span`,{children:[t?`, `:``,(0,R.jsx)(`a`,{href:T(`evidence-runs`,encodeURIComponent(e)),className:`font-mono`,children:e})]},e))]}),n.decision&&(0,R.jsxs)(`span`,{className:`text-[12.5px] text-ink-2 [overflow-wrap:anywhere]`,children:[n.state===`approved`?`Approved`:`Declined`,` by `,B(n.decision.by),` `,V(n.decision.at),` (`,n.decision.via===`web`?`on this page`:`at a terminal`,`): `,B(n.decision.reason)]}),n.state===`open`&&!i&&(0,R.jsxs)(`span`,{className:`flex gap-2`,children:[(0,R.jsx)(t,{size:`sm`,onClick:()=>a(`approved`),children:`Approve`}),(0,R.jsx)(t,{size:`sm`,variant:`ghost`,onClick:()=>a(`declined`),children:`Decline`})]}),i&&(0,R.jsxs)(`div`,{className:`flex max-w-[640px] flex-col gap-2 rounded-[12px] bg-surface-muted p-3`,children:[(0,R.jsx)(`label`,{htmlFor:`decide-${n.id}`,className:`text-[12.5px] font-medium text-ink-2`,children:i===`approved`?`Why approve it? It is kept with your name; the team then puts it into the agent: Evidence changes nothing itself.`:`Why decline it? It is kept with your name.`}),(0,R.jsx)(O,{id:`decide-${n.id}`,value:s,onChange:e=>c(e.target.value),rows:2,maxLength:500,placeholder:`For example: the replays show the claim data is the cause.`}),d&&(0,R.jsx)(F,{text:d}),(0,R.jsxs)(`span`,{className:`flex gap-2`,children:[(0,R.jsx)(t,{size:`sm`,disabled:!p||l,onClick:m,children:l?`Keeping…`:i===`approved`?`Approve`:`Decline`}),(0,R.jsx)(t,{size:`sm`,variant:`ghost`,onClick:()=>a(null),children:`Cancel`})]})]})]})}function Ke({agent:n,run:r,c:i,candidates:a,onLinked:o}){let s=a,[c,l]=(0,L.useState)(!1),[u,d]=(0,L.useState)([]),[f,p]=(0,L.useState)(!1),[m,h]=(0,L.useState)(``);return(0,R.jsxs)(`div`,{className:v(`flex flex-col gap-1 border-l-2 pl-3`,i.status===`proven`?`border-pass`:i.status===`refuted`?`border-fail`:i.status===`side-effects`?`border-warn`:`border-line`),children:[(0,R.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,R.jsx)(C,{tone:Ue[i.status].tone,children:Ue[i.status].label}),(0,R.jsxs)(`span`,{className:`text-[13px] font-medium`,children:[i.id,` · `,We[i.kind],`: `,B(i.where)]}),(0,R.jsxs)(`span`,{className:`text-[12px] text-muted`,children:[`of `,W[i.finding.check],`: `,B(i.finding.rule)]})]}),(0,R.jsxs)(`span`,{className:`text-[13px] text-ink [overflow-wrap:anywhere]`,children:[`Change: `,B(i.change)]}),(0,R.jsxs)(`span`,{className:`text-[12.5px] text-muted [overflow-wrap:anywhere]`,children:[B(i.why),`.`]}),i.replays.map(e=>(0,R.jsxs)(`span`,{className:`text-[12.5px] text-ink-2 [overflow-wrap:anywhere]`,children:[`Replay `,(0,R.jsx)(`a`,{href:T(`evidence-runs`,encodeURIComponent(e.run)),className:`font-mono`,children:e.run}),`: `,e.gone&&!e.broke.length&&e.changeSeen!==!1?`the finding is gone`:B(e.why.join(`; `))]},e.run)),!c&&s.length>0&&i.status!==`proven`&&(0,R.jsx)(`span`,{children:(0,R.jsx)(`button`,{type:`button`,onClick:()=>l(!0),className:`inline-flex min-h-7 cursor-pointer items-center rounded-[8px] border-0 bg-transparent px-0 text-[12.5px] text-accent-fg hover:underline`,children:`Link replays`})}),c&&(0,R.jsxs)(`fieldset`,{className:`m-0 flex max-w-[640px] flex-col gap-1.5 rounded-[12px] border-0 bg-surface-muted p-3`,children:[(0,R.jsxs)(`legend`,{className:`sr-only`,children:[`Replays of `,i.id]}),(0,R.jsx)(`span`,{className:`text-[12.5px] font-medium text-ink-2`,children:`Which runs are this request run again with this change? Only runs of the same agent and request, after this one, are listed.`}),s.map(e=>(0,R.jsxs)(`label`,{className:`flex min-h-8 items-center gap-2 text-[12.5px]`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:u.includes(e),onChange:t=>d(n=>t.target.checked?[...n,e]:n.filter(t=>t!==e))}),(0,R.jsx)(`span`,{className:`font-mono`,children:e})]},e)),m&&(0,R.jsx)(F,{text:m}),(0,R.jsxs)(`span`,{className:`flex gap-2`,children:[(0,R.jsx)(t,{size:`sm`,disabled:!u.length||f,onClick:async()=>{p(!0),h(``);try{await e.replay(n,r,i.id,u),l(!1),d([]),o()}catch(e){h(e.message)}finally{p(!1)}},children:f?`Linking…`:`Link ${u.length||``}`.trim()}),(0,R.jsx)(t,{size:`sm`,variant:`ghost`,onClick:()=>l(!1),children:`Cancel`})]})]})]})}function qe({sub:t}){let[n,r]=(0,L.useState)(null),[i,a]=(0,L.useState)(t?decodeURIComponent(t):``),[o,s]=(0,L.useState)(null),[c,l]=(0,L.useState)(``),[u,d]=(0,L.useState)(0);(0,L.useEffect)(()=>{e.overview().then(e=>{let t=e.agents.map(e=>e.name);r(t),a(e=>e||t[0]||``)},e=>l(e.message))},[]),(0,L.useEffect)(()=>{i&&(s(null),e.learn(i).then(s,e=>l(e.message)))},[i,u]);let f=()=>d(e=>e+1);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(K,{id:`evidence-learn`,children:`Learn`}),(0,R.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:`What to change in an agent, from what its runs got wrong. Each open finding has its possible causes (its instructions, a tool, the data it took in); a cause is proven when the same request, run again three times with that one change, no longer gives the finding and breaks nothing else. Proven causes and rules broken again and again are proposed; a person approves or declines each, and the team puts what is approved into the agent. Evidence changes nothing itself.`}),c&&(0,R.jsx)(F,{text:c}),n&&!n.length&&(0,R.jsx)(J,{}),n&&n.length>1&&(0,R.jsxs)(`label`,{className:`flex w-fit items-center gap-2 text-[13px] text-ink-2`,children:[`Agent`,(0,R.jsx)(j,{value:i,onChange:e=>a(e.target.value),children:n.map(e=>(0,R.jsx)(`option`,{value:e,children:B(e)},e))})]}),i&&!o&&!c&&(0,R.jsx)(q,{}),o?.problems.map(e=>(0,R.jsx)(F,{text:e},e)),o&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`h2`,{className:`sr-only`,children:[`Proposals and causes of `,B(o.agent)]}),(0,R.jsxs)(P,{id:`proposals`,title:`Proposals`,icon:S,n:o.proposals.length,children:[o.proposals.length?(0,R.jsx)(`ul`,{"aria-label":`Proposals`,className:`m-0 list-none rounded-[14px] card border p-1.5`,children:o.proposals.map(e=>(0,R.jsx)(Ge,{p:e,onDecided:f},e.id))}):(0,R.jsx)(`p`,{className:`m-0 rounded-[14px] bg-surface-muted px-5 py-4 text-sm leading-relaxed text-ink-2`,children:`Nothing to propose yet. A rule broken in three runs of the agent's latest version is proposed as guidance; a cause proven by replay, as a fix.`}),o.proposals.some(e=>e.state===`approved`)&&(0,R.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[(0,R.jsxs)(`code`,{children:[`forgeqe evidence guidance `,B(o.agent)]}),` writes what was approved as Markdown, to put into the agent.`]})]}),(0,R.jsxs)(P,{id:`fixes`,title:`Fixes proven by the harness`,icon:A,n:o.fixes.length,children:[(0,R.jsxs)(`p`,{className:`m-0 max-w-[74ch] text-[13px] text-muted`,children:[`A cause in the agent's instructions, added to a copy of them and run by ForgeQE's harness: proven on 3 clean replays and a suite that is no worse. The project is not changed: a person applies a proven fix at a terminal (`,(0,R.jsx)(`code`,{children:`forgeqe evidence fix apply <fix>`}),`), or puts its patch on a branch for a pull request.`]}),o.fixes.length?(0,R.jsx)(`ul`,{"aria-label":`Fixes`,className:`m-0 flex list-none flex-col gap-2 p-0`,children:o.fixes.map(e=>(0,R.jsx)(Fe,{f:e},`${e.id}-${e.at}`))}):(0,R.jsxs)(`p`,{className:`m-0 text-sm text-muted`,children:[`No fix proven yet: `,(0,R.jsx)(`code`,{children:`forgeqe evidence fix <run> H1`}),` proves one of a cause below.`]})]}),(0,R.jsx)(P,{id:`causes`,title:`Causes of its findings`,icon:E,n:o.runs.length,children:o.runs.length?(0,R.jsx)(`ul`,{"aria-label":`Runs and their causes`,className:`m-0 flex list-none flex-col gap-2 p-0`,children:o.runs.map(e=>(0,R.jsxs)(`li`,{className:`flex flex-col gap-2.5 rounded-[14px] card border px-4 py-3`,children:[(0,R.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-3 gap-y-0.5`,children:[(0,R.jsx)(`a`,{href:T(`evidence-runs`,encodeURIComponent(e.run)),className:`text-[14px] font-medium [overflow-wrap:anywhere]`,children:B(e.request||e.run)}),(0,R.jsxs)(`span`,{className:`font-mono text-[11.5px] text-muted`,children:[e.run,e.version?` · ${B(e.version)}`:``]})]}),e.causes.map(t=>(0,R.jsx)(Ke,{agent:o.agent,run:e.run,c:t,candidates:e.candidates,onLinked:f},t.key)),!e.candidates.length&&(0,R.jsxs)(`span`,{className:`text-[12.5px] text-muted`,children:[`No run of the same request is recorded after it yet: `,(0,R.jsxs)(`code`,{children:[`forgeqe evidence replay-kit `,e.run,` H1`]}),` says what to change for a replay.`]})]},e.run))}):(0,R.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No run of this agent has an open finding.`})})]})]})}var Q={observe:`Observe`,assist:`Assist`,act:`Act`,autonomous:`Autonomous`},Je={observe:`a person reviews everything it does`,assist:`a person approves each change it makes`,act:`it acts alone within its contract; people review its findings`,autonomous:`it acts alone; only alerts reach people`},Ye={model:`Model`,tool:`Tool`,knowledge:`Knowledge`,check:`Check`,judge:`Judge`,trust:`Trust`},Xe=[`observe`,`assist`,`act`,`autonomous`];function $({agent:e,label:n,action:r,children:i,onDone:a,uid:o}){let[s,c]=(0,L.useState)(!1),[l,u]=(0,L.useState)(``),[d,f]=(0,L.useState)(``),[p,m]=(0,L.useState)(!1),[h,g]=(0,L.useState)(``),_=l.trim().length>=10&&l.trim().length<=500&&d===e,v=async()=>{m(!0),g(``);try{await r(d,l.trim()),c(!1),u(``),f(``),a()}catch(e){g(e.message)}finally{m(!1)}};if(!s)return(0,R.jsx)(`span`,{children:(0,R.jsx)(t,{size:`sm`,onClick:()=>c(!0),children:n})});let y=`${n}${o?`-${o}`:``}`.toLowerCase().replace(/[^a-z0-9]+/g,`-`);return(0,R.jsxs)(`div`,{className:`flex max-w-[640px] flex-col gap-2 rounded-[12px] bg-surface-muted p-3`,children:[i,(0,R.jsx)(`label`,{htmlFor:`${y}-reason`,className:`text-[12.5px] font-medium text-ink-2`,children:`Why? It is kept with your name and in the audit.`}),(0,R.jsx)(O,{id:`${y}-reason`,value:l,onChange:e=>u(e.target.value),rows:2,maxLength:500}),(0,R.jsxs)(`label`,{htmlFor:`${y}-confirm`,className:`text-[12.5px] font-medium text-ink-2`,children:[`Type `,B(e),` to confirm`]}),(0,R.jsx)(ne,{id:`${y}-confirm`,value:d,onChange:e=>f(e.target.value),autoComplete:`off`}),h&&(0,R.jsx)(F,{text:h}),(0,R.jsxs)(`span`,{className:`flex gap-2`,children:[(0,R.jsx)(t,{size:`sm`,disabled:!_||p,onClick:v,children:p?`Keeping…`:n}),(0,R.jsx)(t,{size:`sm`,variant:`ghost`,onClick:()=>c(!1),children:`Cancel`})]})]})}function Ze(e){return(0,R.jsxs)(R.Fragment,{children:[e.slice(0,8).map((e,t)=>(0,R.jsxs)(`span`,{children:[t?`, `:``,(0,R.jsx)(`a`,{href:T(`evidence-runs`,encodeURIComponent(e)),className:`font-mono`,children:e})]},e)),e.length>8?`, and ${e.length-8} more`:``]})}function Qe({sub:n}){let r=n?decodeURIComponent(n):``,[i,a]=(0,L.useState)(null),[c,l]=(0,L.useState)(``),[u,f]=(0,L.useState)(0),[p,h]=(0,L.useState)(`observe`),_=()=>f(e=>e+1);(0,L.useEffect)(()=>{l(``),e.monitor(r||void 0).then(a,e=>l(e.message))},[r,u]);let y=async()=>{try{let t=await e.audit(r),n=URL.createObjectURL(new Blob([`${JSON.stringify(t,null,2)}\n`],{type:`application/json`})),i=document.createElement(`a`);i.href=n,i.download=`${r.replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^[-.]+/,``).slice(0,60)||`agent`}.audit.json`,i.click(),URL.revokeObjectURL(n)}catch(e){l(e.message)}},b=i?.agent;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(K,{id:`evidence-monitor`,children:`Monitor`}),(0,R.jsxs)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:[`Every agent evaluated, and for each: what changed since its baseline (a model, a tool, the documents it reads, a check doing worse, its contract or judge), how much autonomy its evidence supports and what a person granted it, and every decision people made about it, to export. The nightly job is `,(0,R.jsx)(`code`,{children:`forgeqe evidence drift --all`}),`.`]}),c&&(0,R.jsx)(F,{text:c}),!i&&!c&&(0,R.jsx)(q,{}),i?.problems.map(e=>(0,R.jsx)(F,{text:e},e)),i&&!i.inventory.length&&(0,R.jsx)(J,{}),i&&i.inventory.length>0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`h2`,{className:`sr-only`,children:`Agents and their governance`}),(0,R.jsxs)(P,{id:`inventory`,title:`Inventory`,icon:pe,n:i.inventory.length,children:[(0,R.jsx)(g,{label:`Agents evaluated`,search:!1,minWidth:760,head:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`Agent`}),(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`Versions`}),(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`Models`}),(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-right text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`Tools`}),(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`Contract`}),(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-left text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`Trust`}),(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-1.5 text-right text-[11.5px] font-medium whitespace-nowrap text-muted`,children:`Alerts`})]}),children:i.inventory.map(e=>(0,R.jsxs)(`tr`,{className:`border-t border-line-soft align-top`,children:[(0,R.jsx)(`th`,{scope:`row`,className:v(`px-3 py-2`,`text-left font-medium`),children:(0,R.jsx)(`a`,{href:T(`evidence-monitor`,encodeURIComponent(e.agent)),"aria-current":e.agent===r?`page`:void 0,children:B(e.agent)})}),(0,R.jsx)(`td`,{className:v(`px-3 py-2`,`text-muted`),children:e.versions.slice(0,3).map(B).join(`, `)||`none named`}),(0,R.jsx)(`td`,{className:v(`px-3 py-2`,`text-muted [overflow-wrap:anywhere]`),children:e.models.slice(0,3).map(B).join(`, `)||`none named`}),(0,R.jsx)(`td`,{className:`px-3 py-2 text-right whitespace-nowrap tabular-nums`,children:e.tools.length}),(0,R.jsx)(`td`,{className:v(`px-3 py-2`,`text-muted`),children:e.contract?e.contract.approved?`Approved`:`Not approved`:`None`}),(0,R.jsx)(`td`,{className:`px-3 py-2`,children:e.granted?`${Q[e.granted]} (supports ${Q[e.supported].toLowerCase()})`:`Not granted (supports ${Q[e.supported].toLowerCase()})`}),(0,R.jsx)(`td`,{className:v(`px-3 py-2 text-right whitespace-nowrap tabular-nums`,e.alerts>0&&`text-fail`),children:e.baseline||e.alerts?e.alerts:(0,R.jsx)(`span`,{className:`text-muted`,children:`no baseline`})})]},e.agent))}),!r&&(0,R.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Open an agent to see its drift, its trust and its audit.`})]}),b&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(P,{id:`drift`,title:`Drift of ${b.name}`,icon:d,n:b.drift.alerts.length,children:[b.drift.baseline?(0,R.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Since its baseline (`,b.drift.baseline.version?B(b.drift.baseline.version):`no version`,`, `,o(b.drift.baseline.runs,`run`),`, set by `,B(b.drift.baseline.by),` `,V(b.drift.baseline.at),`): `,o(b.drift.since.length,`run`),`.`]}):(0,R.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`No baseline is set: what changed cannot be said. Set one when a version is released.`}),b.drift.alerts.length>0&&(0,R.jsx)(`ul`,{"aria-label":`Drift alerts`,className:`m-0 list-none rounded-[14px] card border p-1.5`,children:b.drift.alerts.map(e=>(0,R.jsxs)(`li`,{className:`flex flex-col gap-0.5 border-b border-line-soft px-3 py-2 last:border-b-0`,children:[(0,R.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,R.jsx)(C,{tone:`warn`,children:Ye[e.kind]}),(0,R.jsx)(`span`,{className:`text-[13.5px] [overflow-wrap:anywhere]`,children:B(e.what)})]}),e.runs.length>0&&(0,R.jsxs)(`span`,{className:`text-[12.5px] text-muted [overflow-wrap:anywhere]`,children:[`In `,Ze(e.runs)]})]},`${e.kind}-${e.subject}`))}),b.drift.baseline&&!b.drift.alerts.length&&(0,R.jsx)(`p`,{className:`m-0 rounded-[14px] bg-surface-muted px-5 py-4 text-sm text-ink-2`,children:`Nothing changed since the baseline.`}),(0,R.jsx)($,{agent:b.name,label:b.drift.baseline?`Set a new baseline`:`Set the baseline`,action:(t,n)=>e.baseline(b.name,t,n),onDone:_,children:(0,R.jsx)(`span`,{className:`text-[12.5px] text-ink-2`,children:`The baseline becomes its latest version's runs as they are judged now: their models, tools, documents and each check's pass rate.`})})]}),(0,R.jsxs)(P,{id:`trust`,title:`Trust in ${b.name}`,icon:w,children:[(0,R.jsxs)(`p`,{className:`m-0 text-[13.5px]`,children:[`Its evidence supports `,(0,R.jsx)(`b`,{children:Q[b.trust.supported]}),`: `,Je[b.trust.supported],`.`,` `,b.trust.granted?(0,R.jsxs)(R.Fragment,{children:[`Granted: `,(0,R.jsx)(`b`,{children:Q[b.trust.granted.level]}),`, by `,B(b.trust.granted.by),` `,V(b.trust.granted.at),`: `,B(b.trust.granted.reason)]}):`No level is granted.`]}),(0,R.jsx)(`ul`,{"aria-label":`What each level needs`,className:`m-0 list-none rounded-[14px] card border p-1.5`,children:b.trust.criteria.filter(e=>e.level!==`observe`).map(e=>(0,R.jsxs)(`li`,{className:`flex items-start gap-2.5 border-b border-line-soft px-3 py-2 text-[13px] last:border-b-0`,children:[(0,R.jsx)(s,{icon:e.met?ce:M,size:15,className:e.met?`mt-0.5 text-pass`:`mt-0.5 text-muted`}),(0,R.jsx)(`span`,{className:`w-[96px] shrink-0 font-medium`,children:Q[e.level]}),(0,R.jsxs)(`span`,{className:`text-ink-2 [overflow-wrap:anywhere]`,children:[(0,R.jsx)(`span`,{className:`sr-only`,children:e.met?`Met: `:`Not met: `}),B(e.what)]})]},`${e.level}-${e.what}`))}),(0,R.jsx)($,{agent:b.name,label:`Grant a level`,action:(t,n)=>e.trust(b.name,p,t,n),onDone:_,children:(0,R.jsxs)(`label`,{className:`flex w-fit items-center gap-2 text-[12.5px] font-medium text-ink-2`,children:[`Level`,(0,R.jsx)(j,{value:p,onChange:e=>h(e.target.value),children:Xe.slice(0,Xe.indexOf(b.trust.supported)+1).map(e=>(0,R.jsxs)(`option`,{value:e,children:[Q[e],`: `,Je[e]]},e))})]})})]}),(0,R.jsxs)(P,{id:`audit`,title:`Audit`,icon:m,children:[(0,R.jsxs)(`p`,{className:`m-0 max-w-[74ch] text-[13px] text-muted`,children:[`Every decision people made about `,B(b.name),` (its contract's approval, overrules, grades, replays, proposals, release gates, baselines and trust), each with who made it, when, why, and the runs it rested on as they are recorded now.`]}),(0,R.jsx)(`span`,{children:(0,R.jsx)(t,{size:`sm`,onClick:y,children:`Download the audit`})})]})]})]})]})}function $e({page:e,sub:t}){let n=(t||``).split(`/`),r=n[0]===`agent`&&n[1]?decodeURIComponent(n[1]):``,i=e===`evidence-runs`&&n[0]&&n[0]!==`agent`?decodeURIComponent(n[0]):``;return(0,R.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,R.jsx)(D,{}),(0,R.jsx)(`main`,{className:v(ue,`@container flex-auto gap-4`),children:e===`evidence`?t?(0,R.jsx)(we,{agent:decodeURIComponent(t)},t):(0,R.jsx)(xe,{}):e===`evidence-contracts`?(0,R.jsx)(He,{}):e===`evidence-review`?(0,R.jsx)(Me,{}):e===`evidence-releases`?(0,R.jsx)(Be,{}):e===`evidence-learn`?(0,R.jsx)(qe,{sub:t}):e===`evidence-monitor`?(0,R.jsx)(Qe,{sub:t},t||``):i?(0,R.jsx)(Oe,{id:i},i):(0,R.jsx)(Te,{agent:r})})]})}export{$e as Evidence};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Bn as e,Bt as t,Cn as n,Di as r,Dr as i,En as a,Ht as o,In as s,Lr as c,Mn as l,Mr as u,Pn as d,Si as f,Un as p,Wt as m,Yt as h,Zr as g,Zt as _,an as v,at as y,cn as b,cr as x,ct as S,et as C,kn as w,kr as T,ln as E,mn as D,n as ee,nn as O,oi as te,ot as ne,pn as k,ri as A,st as j,ui as re,vn as M,vr as N,vt as P,w as F,wi as ie,xt as ae,yt as I}from"./Shell-C-_iUijV.js";import{t as L}from"./arrow-right-B3tcUlkA.js";import{t as oe}from"./circle-dashed-kZh6s667.js";import{t as R}from"./circle-dot-B5NyEMK3.js";import{G as z,H as B,t as V,z as H}from"./index-BxNs3KZC.js";import{t as se}from"./when-CHnpLdYw.js";import{a as U,i as W,n as ce,o as le,r as G,t as ue}from"./productParts-RYNeN2sM.js";var de={name:`corner-down-right`,size:24,node:[[`path`,{d:`m15 10 5 5-5 5`,key:`qqa56n`}],[`path`,{d:`M4 4v7a4 4 0 0 0 4 4h12`,key:`z08zvw`}]]};de.node;var fe=c(de),K=r(ie(),1),q={w:196,h:60},J=56,pe=24,me=36,Y=18,he=30,X=8,Z=12,ge=14,_e=6;function ve(e,t=8){let n=e=>Math.round(e*10)/10,r=`M${n(e[0][0])} ${n(e[0][1])}`;for(let i=1;i<e.length-1;i++){let[a,o]=e[i-1],[s,c]=e[i],[l,u]=e[i+1],d=Math.min(t,Math.hypot(s-a,c-o)/2),f=Math.min(t,Math.hypot(l-s,u-c)/2),p=s-Math.sign(s-a)*d,m=c-Math.sign(c-o)*d,h=s+Math.sign(l-s)*f,g=c+Math.sign(u-c)*f;r+=` L${n(p)} ${n(m)} Q${n(s)} ${n(c)} ${n(h)} ${n(g)}`}let[i,a]=e[e.length-1];return`${r} L${n(i)} ${n(a)}`}function ye(e){let t=[];for(let n of e){let e=t[t.length-1];e&&Math.abs(e[0]-n[0])<.01&&Math.abs(e[1]-n[1])<.01||t.push(n)}return t.filter((e,n)=>{if(n===0||n===t.length-1)return!0;let[r,i]=[t[n-1],t[n+1]];return!(Math.abs(r[0]-e[0])<.01&&Math.abs(i[0]-e[0])<.01||Math.abs(r[1]-e[1])<.01&&Math.abs(i[1]-e[1])<.01)})}function be(e,t,n,r){let i=r?e.filter(e=>e.band===r):[],a=n.filter(t=>e.some(e=>e.band===t)),o=new Set([...e.filter(e=>a.includes(e.band)).map(e=>e.id),...i.map(e=>e.id)]),s=t.filter(e=>o.has(e.from)&&o.has(e.to)&&e.from!==e.to),c=new Set(i.map(e=>e.id)),l=new Map;for(let e of s)l.set(e.from,[...l.get(e.from)||[],e.to]),l.set(e.to,[...l.get(e.to)||[],e.from]);let u=new Map(a.map(t=>[t,e.filter(e=>e.band===t).map(e=>e.id)])),d=new Map,f=e=>u.get(e).forEach((e,t,n)=>d.set(e,n.length>1?t/(n.length-1):.5)),p=(e,t)=>{let n=u.get(e),r=(e,r)=>{let i=(l.get(e)||[]).filter(e=>t(e)&&d.has(e)).map(e=>d.get(e));return i.length?i.reduce((e,t)=>e+t,0)/i.length:n.length>1?r/(n.length-1):.5},i=n.map((e,t)=>({id:e,k:r(e,t),i:t}));i.sort((e,t)=>e.k-t.k||e.i-t.i),u.set(e,i.map(e=>e.id)),f(e)};a.forEach(f);let m=new Map(e.map(e=>[e.id,e.band])),h=e=>t=>a.indexOf(m.get(t))<a.indexOf(e),g=e=>t=>a.indexOf(m.get(t))>a.indexOf(e);a.slice(1).forEach(e=>p(e,h(e))),a.slice(0,-1).reverse().forEach(e=>p(e,g(e)));let _=Math.max(1,...a.map(e=>u.get(e).length)),v=Math.min(_,_e),y=[];for(let e of a){let t=u.get(e);for(let n=0;n<t.length;n+=v)y.push({band:e,ids:t.slice(n,n+v)})}let b=new Map;y.forEach((e,t)=>e.ids.forEach(e=>b.set(e,t)));let x=v*q.w+(v-1)*J,S=new Map,C=y.map(e=>{let t=e.ids.length*q.w+(e.ids.length-1)*J,n=(x-t)/2;return e.ids.forEach((e,t)=>S.set(e,n+t*(q.w+J))),{left:n,right:n+t}}),w=e=>S.get(e)+q.w/2,T=[],E=(e,t,n)=>{for(let r=t;r<=n;r++)for(let t of y[r].ids)if(e>S.get(t)-6&&e<S.get(t)+q.w+6)return!1;return!0};s.forEach((e,t)=>{let n=c.has(e.to)&&!c.has(e.from),r=c.has(e.from)&&!c.has(e.to);if(c.has(e.from)&&c.has(e.to))return;let i=r?{from:e.to,to:e.from}:e,a=b.get(i.from);if(n||r){T.push({e,i:t,reverse:r,out:{side:`bottom`,node:i.from,edge:t},inn:{side:`left`,node:i.to,edge:t},c1:a+1,c2:a+1,toSide:!0});return}let o=b.get(i.to),s=a<=o,l={side:a<o||a===o?`bottom`:`top`,node:i.from,edge:t},u={side:a<o?`top`:`bottom`,node:i.to,edge:t},d=s?a+1:a,f=a<o?o:o+1,p;if(d!==f){let[e,t]=d<f?[d,f-1]:[f,d-1],n=(w(i.from)+w(i.to))/2,r=new Set;for(let n=e;n<=t;n++)y[n].ids.forEach((e,t)=>t>0&&r.add(S.get(e)-J/2)),r.add(C[n].left-J/2),r.add(C[n].right+J/2);let a=[...r].filter(n=>n>-29&&n<x+J/2+1&&E(n,e,t)).sort((e,t)=>Math.abs(e-n)-Math.abs(t-n));p=a.length?a[0]:`gutter`}T.push({e,i:t,reverse:!1,out:l,inn:u,c1:d,c2:f,corridor:p,toSide:!1})});let D=e=>{let t=new Map;for(let n of T)for(let r of e(n))t.set(r,[...t.get(r)||[],n]);return t},ee=e=>w(e.toSide&&e.reverse?e.e.to:e.e.from),O=D(e=>e.c1===e.c2?[e.c1]:[e.c1,e.c2]);for(let[,e]of O)e.sort((e,t)=>ee(e)-ee(t));let te=D(e=>typeof e.corridor==`number`?[e.corridor]:[]),ne=T.filter(e=>e.corridor===`gutter`),k=T.filter(e=>e.toSide),A=(e,t)=>{if(!e)return 0;let n=e.length;return(e.indexOf(t)-(n-1)/2)*X},j=y.length,re=e=>{let t=16+(O.get(e)?.length||0)*X;return e===j?Math.max(28,t):y[e-1].band===y[e].band?Math.max(he,t):Math.max(72,t+24)},M=[],N=[],P=48;for(let e=0;e<j;e++){M.push(P),P+=q.h;let t=re(e+1);e+1<j&&y[e].band!==y[e+1].band?N[e+1]=P+Y+(t-Y-me)/2:N[e+1]=P+t/2,P+=t}let F=M[j-1]+q.h+re(j),ie=ne.length?16+ne.length*X:0,ae=Z+ie+pe,I=Z+ie,L=x+48,oe=k.length?20+k.length*X:0,R=I+L+Math.max(oe,24),z=new Map;y.forEach((e,t)=>e.ids.forEach(n=>z.set(n,{id:n,band:e.band,x:ae+S.get(n),y:M[t],w:q.w,h:q.h})));let B=[];for(let e of a){let t=y.map((e,t)=>({r:e,i:t})).filter(t=>t.r.band===e),n=M[t[0].i]-me,r=M[t[t.length-1].i]+q.h+Y;B.push({id:e,x:I,y:n,w:L,h:r-n})}let V=0;if(r&&i.length){let e=e=>{let t=(l.get(e)||[]).filter(e=>z.has(e)).map(e=>z.get(e).y);return t.length?t.reduce((e,t)=>e+t,0)/t.length:1/0},t=i.map((t,n)=>({id:t.id,k:e(t.id),i:n})).sort((e,t)=>e.k-t.k||e.i-t.i),n=Z,a=48;for(let e of t){let t=Math.max(a,Number.isFinite(e.k)?e.k:a);z.set(e.id,{id:e.id,band:r,x:R+pe,y:t,w:q.w,h:q.h}),a=t+q.h+ge}V=a-ge+Y;let o=Math.max(V,F-10)-n;B.push({id:r,x:R,y:n,w:q.w+48,h:o}),V=n+o}let H=new Map;for(let e of T)for(let t of[e.out,e.inn])H.set(`${t.node}|${t.side}`,[...H.get(`${t.node}|${t.side}`)||[],t]);let se=e=>{let t=T.find(t=>t.i===e.edge),n=t.reverse?{from:t.e.to,to:t.e.from}:t.e,r=e.node===n.from?n.to:n.from,i=z.get(r);return e.side===`left`?i.y:i.x};for(let[,e]of H)e.sort((e,t)=>se(e)-se(t));let U=e=>{let t=z.get(e.node),n=H.get(`${e.node}|${e.side}`),r=n.indexOf(e),i=n.length;if(e.side===`left`)return[t.x,t.y+t.h*(r+1)/(i+1)];let a=Math.min(t.w*.7,i*22);return[t.x+t.w/2-a/2+(i===1?a/2:a*r/(i-1)),e.side===`top`?t.y:t.y+t.h]},W=[];for(let e of T){let t=U(e.out),n=U(e.inn),r=N[e.c1]+A(O.get(e.c1),e),i;if(e.toSide){let a=I+L+12+k.indexOf(e)*X;i=[t,[t[0],r],[a,r],[a,n[1]],n]}else if(e.c1===e.c2)i=[t,[t[0],r],[n[0],r],n];else{let a=N[e.c2]+A(O.get(e.c2),e),o=e.corridor===`gutter`?20+ne.indexOf(e)*X:ae+e.corridor+A(te.get(e.corridor),e);i=[t,[t[0],r],[o,r],[o,a],[n[0],a],n]}i=ye(i),e.reverse&&i.reverse(),W.push({index:e.i,from:e.e.from,to:e.e.to,points:i,d:ve(i)})}return{w:r&&i.length?R+q.w+48+Z:I+L+Math.max(oe,0)+Z,h:Math.max(F,V)+Z,boxes:z,bands:B,wires:W}}var Q=f(),xe=[{id:`front`,label:`Front ends`,icon:p,hue:`#0B6E4F`},{id:`gateway`,label:`Gateways`,icon:D,hue:`#C86A0A`},{id:`service`,label:`Services`,icon:E,hue:`#2563EB`},{id:`data`,label:`Data and messages`,icon:x,hue:`#0B8A8A`},{id:`outside`,label:`Outside`,icon:i,hue:`#5B4BC9`}],Se=e=>e.repo&&e.column!==`data`?`select it to see it from the inside`:e.part?`select it for how it is known`:``,Ce=.72;function we(e){return e.known===`seen`?`stroke-pass`:e.known===`differs`?`stroke-warn`:`stroke-muted`}var Te=[`seen`,`differs`,`read`,`inferred`];function Ee(e){let t=new Map;for(let n of e){let e=`${n.from}\u0000${n.to}`,r=t.get(e);(!r||Te.indexOf(n.known)<Te.indexOf(r.known))&&t.set(e,{from:n.from,to:n.to,known:n.known})}return t}function De({view:e,onOpen:t,words:n={}}){let r=e=>({...xe.find(t=>t.id===e),...n.bands?.[e]}),i=(0,K.useMemo)(()=>Ee(e.links),[e]),a=(0,K.useMemo)(()=>be(e.nodes.map(e=>({id:e.id,band:e.column})),[...i.values()].map(e=>({from:e.from,to:e.to})),[`front`,`gateway`,`service`,`data`],`outside`),[e,i]),s=(0,K.useRef)(null),[c,l]=(0,K.useState)(1),[u,d]=(0,K.useState)(null),[f,p]=(0,K.useState)(null),h=u||f;(0,K.useLayoutEffect)(()=>{let e=()=>{let e=s.current;if(!e)return;let t=window.innerHeight-e.getBoundingClientRect().top-24,n=Math.min(e.clientWidth/a.w,Math.max(t,360)/a.h,1);l(Math.max(Ce,n))};e();let t=typeof ResizeObserver>`u`?null:new ResizeObserver(e);return s.current&&t?.observe(s.current),window.addEventListener(`resize`,e),()=>{t?.disconnect(),window.removeEventListener(`resize`,e)}},[a]);let g=new Map(e.nodes.map(e=>[e.id,e])),_=e=>!h||e.from===h||e.to===h,v=new Set(h?e.links.filter(e=>e.from===h||e.to===h).flatMap(e=>[e.from,e.to]):[]),y=c<=Ce&&(s.current?.clientWidth||1/0)<a.w*c,b=(e,t)=>i.get(`${e}\u0000${t}`);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Q.jsx)(`div`,{ref:s,className:`w-full overflow-x-auto`,onMouseLeave:()=>d(null),children:(0,Q.jsx)(`div`,{className:`relative mx-auto`,style:{width:a.w*c,height:a.h*c},children:(0,Q.jsxs)(`div`,{className:`absolute top-0 left-0`,style:{width:a.w,height:a.h,transform:`scale(${c})`,transformOrigin:`0 0`},children:[(0,Q.jsxs)(`svg`,{"aria-hidden":`true`,width:a.w,height:a.h,viewBox:`0 0 ${a.w} ${a.h}`,className:`absolute inset-0 overflow-visible`,children:[(0,Q.jsx)(`defs`,{children:[`pass`,`warn`,`muted`].map(e=>(0,Q.jsx)(`marker`,{id:`map-${e}`,viewBox:`0 0 8 8`,refX:7,refY:4,markerWidth:8,markerHeight:8,markerUnits:`userSpaceOnUse`,orient:`auto`,children:(0,Q.jsx)(`path`,{d:`M0 0 L8 4 L0 8 Z`,className:e===`pass`?`fill-pass`:e===`warn`?`fill-warn`:`fill-muted`})},e))}),a.bands.map(e=>(0,Q.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:e.h,rx:16,fill:r(e.id).hue,fillOpacity:.055,stroke:r(e.id).hue,strokeOpacity:.24},e.id)),a.wires.map(e=>(0,Q.jsx)(`path`,{d:e.d,fill:`none`,strokeWidth:5,className:`stroke-bg`,opacity:_(e)?1:.15},`h${e.index}`)),a.wires.map(e=>{let t=b(e.from,e.to),n=g.get(e.from)?.column===`outside`||g.get(e.to)?.column===`outside`,r=t.known===`seen`?`pass`:t.known===`differs`?`warn`:`muted`;return(0,Q.jsx)(`path`,{d:e.d,fill:`none`,strokeWidth:h&&_(e)?2.25:t.known===`seen`?1.75:1.4,strokeDasharray:n?`5 4`:t.known===`differs`?`2 3`:void 0,markerEnd:`url(#map-${r})`,className:m(we(t),`transition-opacity duration-150`),opacity:_(e)?1:.15},e.index)})]}),a.bands.map(e=>(0,Q.jsxs)(`span`,{className:`absolute z-[1] flex items-center gap-1.5 rounded-[6px] bg-bg/90 px-1.5 py-0.5 text-[12px] font-semibold text-ink-2`,style:{left:e.x+10,top:e.y+7},children:[(0,Q.jsx)(`span`,{className:`size-2 rounded-full`,style:{background:r(e.id).hue},"aria-hidden":`true`}),r(e.id).label]},e.id)),[...a.boxes.values()].map(n=>{let i=g.get(n.id),a=h&&h!==i.id&&!v.has(i.id),s=e.links.filter(e=>e.from===i.id).length,c=e.links.filter(e=>e.to===i.id).length;return(0,Q.jsxs)(`button`,{type:`button`,onMouseEnter:()=>d(i.id),onFocus:()=>p(i.id),onBlur:()=>p(e=>e===i.id?null:e),onClick:()=>t(i),"aria-label":`${i.name}, ${r(i.column).label.toLowerCase()}: ${i.detail}. ${ce[i.known].label}. Sends to ${s}, receives from ${c}.`,className:m(`absolute flex cursor-pointer flex-col justify-center gap-0.5 rounded-[10px] border bg-bg px-3 text-left transition-opacity duration-150 hover:bg-surface-muted`,i.column===`outside`&&`border-dashed`,a&&`opacity-40`,h===i.id&&`shadow-md`),style:{left:n.x,top:n.y,width:n.w,height:n.h,borderColor:`color-mix(in srgb, ${r(i.column).hue} 55%, transparent)`},children:[(0,Q.jsxs)(`span`,{className:`flex w-full min-w-0 items-center gap-1.5 text-[13.5px] font-semibold text-ink`,children:[(0,Q.jsx)(o,{icon:r(i.column).icon,size:14,className:`flex-none`}),(0,Q.jsx)(`span`,{className:`truncate`,children:i.name}),i.known===`seen`&&(0,Q.jsx)(B,{size:13,"aria-hidden":`true`,className:`ml-auto flex-none text-pass`})]}),(0,Q.jsx)(`span`,{className:`truncate font-mono text-[11px] text-muted`,children:i.detail})]},i.id)})]})})}),y&&(0,Q.jsx)(`p`,{className:`m-0 text-[12px] text-muted`,children:`Scroll sideways to see the whole map.`}),(0,Q.jsx)(Oe,{}),(0,Q.jsx)(ke,{view:e,id:h,words:n,band:r})]})}function Oe(){let e=(e,t,n)=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Q.jsx)(`svg`,{width:`28`,height:`8`,"aria-hidden":`true`,children:(0,Q.jsx)(`path`,{d:`M1 4 H27`,fill:`none`,strokeWidth:1.75,strokeDasharray:e,className:t})}),n]});return(0,Q.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-x-5 gap-y-1 text-[12px] text-muted`,children:[e(void 0,`stroke-muted`,`Inside the product, read in the code`),e(`5 4`,`stroke-muted`,`To or from an outside system`),e(void 0,`stroke-pass`,`Seen in a run`),e(`2 3`,`stroke-warn`,`A run called it differently`)]})}function ke({view:e,id:t,words:n,band:r}){let i=t?e.nodes.find(e=>e.id===t):void 0,a=i?(n.hint||Se)(i):``,o=t=>e.nodes.find(e=>e.id===t)?.name||t,s=(e,t)=>{let n=new Map;for(let r of e){let e=r[t],i=n.get(e);i?n.set(e,{other:e,label:i.label.split(`, `).includes(r.label)?i.label:`${i.label}, ${r.label}`,known:i.known===`seen`||r.known===`seen`?`seen`:i.known}):n.set(e,{other:e,label:r.label,known:r.known})}return[...n.values()]},c=(e,t)=>e.length?(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0 text-[13px]`,children:e.map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex justify-between gap-3 border-t border-line-soft py-1.5 first:border-t-0 first:pt-0`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-medium text-ink`,children:o(e.other)}),(0,Q.jsxs)(`span`,{className:`flex-none text-muted`,children:[e.label,e.known===`seen`?` · seen in a run`:``]})]},t))}):(0,Q.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:t});return(0,Q.jsx)(`div`,{"aria-live":`polite`,className:`grid min-h-[120px] gap-x-10 gap-y-4 rounded-[14px] card border px-5 py-4 @3xl:[grid-template-columns:minmax(220px,1.1fr)_1fr_1fr]`,children:i?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Q.jsxs)(`h3`,{className:`m-0 flex items-center gap-2 text-base font-semibold`,children:[(0,Q.jsx)(`span`,{className:`size-2.5 flex-none rounded-full`,style:{background:r(i.column).hue},"aria-hidden":`true`}),i.name]}),(0,Q.jsx)(`p`,{className:`m-0 text-[13px] text-muted [overflow-wrap:anywhere]`,children:i.detail}),(0,Q.jsxs)(`p`,{className:`m-0 text-[12px] text-muted`,children:[r(i.column).label,` · `,ce[i.known].label,a?` · ${a}`:``]})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Q.jsx)(`h4`,{className:`m-0 text-[13px] font-semibold`,children:n.sends||`Sends to`}),c(s(e.links.filter(e=>e.from===i.id),`to`),`Nothing.`)]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Q.jsx)(`h4`,{className:`m-0 text-[13px] font-semibold`,children:n.receives||`Receives from`}),c(s(e.links.filter(e=>e.to===i.id),`from`),`Nothing.`)]})]}):(0,Q.jsx)(`p`,{className:`m-0 self-center text-[13px] text-muted @3xl:col-span-3`,children:n.idle||`Hover over or tab to a part to trace what it sends and receives. Select a service to see it from the inside; the How they talk tab lists every link in words.`})})}var Ae={bands:{front:{label:`Channels`,icon:p},gateway:{label:`Edge`,icon:D},service:{label:`Business systems`,icon:E},data:{label:`Data`,icon:x},outside:{label:`Outside and SaaS`,icon:i}},hint:e=>e.column===`outside`?`select it for how it is known`:`select it to see its services`,idle:`Hover over or tab to a system to trace what it sends and receives, and how. Select one to see its services.`},je=e=>e.modes.map(e=>`${e.mode} (${e.count})`).join(`, `);function Me(e){return{nodes:e.nodes.map(e=>({id:e.id,name:e.name,column:e.column,detail:e.detail,known:e.known,...e.column===`outside`?{part:e.id}:{}})),links:e.links.map(e=>({from:e.from,to:e.to,label:je(e),count:e.count,known:e.known,example:e.examples[0]||``}))}}function Ne({onPart:e}){let[t,n]=(0,K.useState)(null),[r,i]=(0,K.useState)(``);(0,K.useEffect)(()=>{te.view().then(n,e=>i(e.message))},[]);let a=(0,K.useMemo)(()=>t?Me(t):null,[t]);if(r)return(0,Q.jsx)(W,{text:r});if(!t||!a)return(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`});let o=e=>t.nodes.find(t=>t.id===e)?.name||e;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[t.grouping===`names`&&(0,Q.jsxs)(`p`,{className:`m-0 flex max-w-[74ch] items-start gap-2 text-sm text-ink-2`,children:[(0,Q.jsx)(s,{size:16,"aria-hidden":`true`,className:`mt-0.5 flex-none text-muted`}),(0,Q.jsxs)(`span`,{children:[`Repositories without a system are grouped by the first word of their names, or stand alone (`,t.guessed.slice(0,6).join(`, `),t.guessed.length>6?`, and ${t.guessed.length-6} more`:``,`). Give each repository its system, as your teams name them, in `,(0,Q.jsx)(`a`,{href:S(`settings`,`agents`),children:`Settings, Agents, Repositories`}),t.proposal?`.`:(0,Q.jsxs)(Q.Fragment,{children:[`, or let the model propose them: `,(0,Q.jsx)(`code`,{children:`forgeqe knowledge systems --propose`}),`.`]})]})]}),(0,Q.jsxs)(`section`,{"aria-labelledby":`landscape-h`,className:`flex flex-col gap-3`,children:[(0,Q.jsx)(`h2`,{id:`landscape-h`,className:`sr-only`,children:`Systems map`}),(0,Q.jsx)(De,{view:a,onOpen:t=>{t.column===`outside`?e(t.id):location.hash=S(`product`,`systems`,encodeURIComponent(t.name))},words:Ae})]}),t.proposal&&(0,Q.jsx)(Pe,{view:t,onView:n}),(0,Q.jsx)(U,{id:`systems-talk`,title:`How the systems talk`,icon:M,n:t.links.length,children:t.links.length?(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[...t.links].sort((e,t)=>t.count-e.count).map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 border-b border-line-soft py-2.5 last:border-b-0`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 flex-[1_1_320px] text-[14px] [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:o(e.from)}),` `,(0,Q.jsx)(`span`,{className:`text-muted`,children:`to`}),` `,(0,Q.jsx)(`span`,{className:`font-medium`,children:o(e.to)}),(0,Q.jsxs)(`span`,{className:`text-muted`,children:[` · `,je(e)]}),e.via.length>0&&(0,Q.jsxs)(`span`,{className:`text-muted`,children:[` · on `,e.via.slice(0,4).join(`, `)]}),e.examples.slice(0,3).map((e,t)=>(0,Q.jsx)(`span`,{className:`block text-[12px] text-muted`,children:e},t))]}),(0,Q.jsx)(G,{known:e.known})]},`${e.from}>${e.to}`))}):(0,Q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No link between systems was found: each system's code talks only to itself, or calls no route read.`})}),t.loose.length>0&&(0,Q.jsxs)(U,{id:`loose`,title:`Messages with one end here`,icon:u,n:t.loose.length,children:[(0,Q.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm text-muted`,children:`A topic or queue a system here publishes that nothing here consumes, or the other way round: the other end is in a repository not read yet, or nobody.`}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.loose.map(e=>(0,Q.jsxs)(`li`,{className:`border-b border-line-soft py-2 text-[14px] last:border-b-0 [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.topic}),(0,Q.jsxs)(`span`,{className:`text-muted`,children:[e.publishers.length?` · published by ${e.publishers.join(`, `)}`:``,e.consumers.length?` · consumed by ${e.consumers.join(`, `)}`:``]})]},e.topic))})]})]})}function Pe({view:e,onView:n}){let[r,i]=(0,K.useState)(null),[a,o]=(0,K.useState)(``),[s,c]=(0,K.useState)(``),[l,u]=(0,K.useState)(!1),d=e.assigned.filter(e=>e.by!==`settings`&&(e.why||e.by===`person`||e.rejected)),f=d.filter(e=>e.by===`model`),p=async t=>{u(!0),c(``);try{let r=e;for(let[e,n,i]of t)r=await te.decide(e,n,i);n(r),i(null)}catch(e){c(e.message)}finally{u(!1)}};if(!d.length)return null;let m=e.proposal;return(0,Q.jsxs)(U,{id:`proposal`,title:`Systems proposed by the model`,icon:v,n:f.length||void 0,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`p`,{className:`m-0 max-w-[74ch] text-sm text-muted`,children:[`Proposed by `,m?.model||`the model`,m?.at?` on ${m.at.slice(0,10)}`:``,`, from what the graph knows of each repository. Accept each, rename it, or reject it; a system set in Settings always wins. `,f.length?`${f.length} wait for a person.`:`All are decided.`]}),f.length>1&&(0,Q.jsxs)(t,{size:`sm`,variant:`ghost`,disabled:l,onClick:()=>void p(f.map(e=>[e.repo,`accepted`])),children:[(0,Q.jsx)(B,{size:15,"aria-hidden":`true`}),`Accept all `,f.length]})]}),s&&(0,Q.jsx)(W,{text:s}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:d.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2 border-b border-line-soft py-2.5 last:border-b-0`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 flex-[1_1_320px] text-[14px] [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:e.repo}),` `,(0,Q.jsx)(`span`,{className:`text-muted`,children:`in`}),` `,(0,Q.jsx)(`span`,{className:`font-medium`,children:e.rejected?`its own name`:e.system}),(0,Q.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.rejected?`rejected`:e.by===`person`?`accepted`:`proposed`]}),e.why&&(0,Q.jsx)(`span`,{className:`block text-[12px] text-muted`,children:e.why})]}),r===e.repo?(0,Q.jsxs)(`form`,{className:`flex w-full max-w-[420px] gap-1.5`,onSubmit:t=>{t.preventDefault(),a.trim()&&p([[e.repo,`accepted`,a.trim()]])},children:[(0,Q.jsx)(C,{"aria-label":`System for ${e.repo}`,placeholder:`CRM`,value:a,maxLength:60,onChange:e=>o(e.target.value),className:`flex-1`}),(0,Q.jsx)(t,{type:`submit`,size:`sm`,disabled:l||!a.trim(),children:`Save`}),(0,Q.jsx)(t,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>i(null),children:`Cancel`})]}):(0,Q.jsx)(`div`,{role:`group`,"aria-label":`The system for ${e.repo}`,className:`flex gap-1.5`,children:e.by===`model`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,disabled:l,onClick:()=>void p([[e.repo,`accepted`]]),className:Fe,children:[(0,Q.jsx)(B,{size:14,"aria-hidden":`true`}),`Accept`]}),(0,Q.jsx)(`button`,{type:`button`,disabled:l,onClick:()=>{o(e.system),i(e.repo)},className:Fe,children:`Rename`}),(0,Q.jsxs)(`button`,{type:`button`,disabled:l,onClick:()=>void p([[e.repo,`rejected`]]),className:Fe,children:[(0,Q.jsx)(N,{size:14,"aria-hidden":`true`}),`Reject`]})]}):(0,Q.jsx)(`button`,{type:`button`,disabled:l,onClick:()=>void p([[e.repo,null]]),className:Fe,children:`Undo`})})]},e.repo))})]})}var Fe=m(`inline-flex min-h-8 cursor-pointer items-center gap-1 rounded-[8px] border border-transparent bg-surface-strong px-3 text-[13px] font-medium text-ink-2 hover:bg-line hover:text-ink disabled:cursor-not-allowed`);function Ie({eng:e,name:t,onOpen:n}){let[r,i]=(0,K.useState)(null),[a,o]=(0,K.useState)(``);(0,K.useEffect)(()=>{te.view().then(i,e=>o(e.message))},[]);let s=(0,K.useMemo)(()=>{let n=r?.nodes.find(e=>e.name===t&&e.column!==`outside`);if(!r||!n)return null;let i=new Set(n.parts),a=e.links.filter(e=>i.has(e.from)||i.has(e.to)),o=new Set(a.flatMap(e=>[e.from,e.to])),s=e=>r.nodes.find(t=>t.parts.includes(e))?.name,c=e.nodes.filter(e=>i.has(e.id)||o.has(e.id)).map(e=>i.has(e.id)||e.column===`outside`||!s(e.id)?e:{...e,detail:`in ${s(e.id)} · ${e.detail}`});return{nodes:c,links:a,other:c.filter(e=>!i.has(e.id)).length}},[r,e,t]),c=r?.nodes.find(e=>e.name===t&&e.column!==`outside`);return(0,Q.jsxs)(`section`,{"aria-labelledby":`system-h`,className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`a`,{href:S(`product`),className:`inline-flex items-center gap-1.5 self-start text-sm`,children:[(0,Q.jsx)(z,{size:16,"aria-hidden":`true`}),`All systems`]}),(0,Q.jsx)(`h2`,{id:`system-h`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:t}),c&&(0,Q.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[c.detail,c.repos.length?` · repositories: ${c.repos.join(`, `)}`:``,c.inside?` · ${c.inside} links among its own parts`:``,s?.other?` · ${s.other} parts of other systems it talks to, named with their system`:``]})]}),a&&(0,Q.jsx)(W,{text:a}),!r&&!a&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),r&&!c&&(0,Q.jsxs)(`p`,{className:`m-0 text-sm text-muted`,children:[`No system is named `,t,`; it may have been renamed in Settings. See `,(0,Q.jsx)(`a`,{href:S(`product`),children:`all systems`}),`.`]}),s&&(0,Q.jsx)(De,{view:s,onOpen:n,words:{idle:`Hover over or tab to a part to trace what it sends and receives. Select a service to see it from the inside.`}}),c&&(0,Q.jsx)(`p`,{className:`m-0 text-[12px] text-muted`,children:`The system's services and the parts of other systems they reach, from the same graph as the services map.`})]})}function Le({id:e,verdict:n,note:r,onChanged:i}){let[a,o]=(0,K.useState)(r||``),[s,c]=(0,K.useState)(``),[l,u]=(0,K.useState)(!1),d=async(t,n)=>{u(!0),c(``);try{await re.feedback(e,t,n),i()}catch(e){c(e.message)}finally{u(!1)}};return(0,Q.jsxs)(`div`,{className:`flex flex-col items-start gap-1.5`,children:[(0,Q.jsx)(`div`,{role:`group`,"aria-label":`Is this right?`,className:`flex gap-1.5`,children:[`right`,`wrong`].map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":n===e,disabled:l,onClick:()=>void d(n===e?null:e,e===`wrong`&&a.trim()||void 0),className:m(`inline-flex min-h-8 cursor-pointer items-center gap-1 rounded-[8px] border px-3 text-[13px] font-medium disabled:cursor-not-allowed`,n===e?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:bg-line hover:text-ink`),children:[e===`right`?(0,Q.jsx)(B,{size:14,"aria-hidden":`true`}):(0,Q.jsx)(N,{size:14,"aria-hidden":`true`}),e===`right`?`Right`:`Wrong`]},e))}),n===`wrong`&&(0,Q.jsxs)(`form`,{className:`flex w-full max-w-[420px] gap-1.5`,onSubmit:e=>{e.preventDefault(),d(`wrong`,a.trim()||void 0)},children:[(0,Q.jsx)(C,{"aria-label":`What is right instead`,placeholder:`What is right instead`,value:a,maxLength:500,onChange:e=>o(e.target.value),className:`flex-1`}),(0,Q.jsx)(t,{type:`submit`,size:`sm`,disabled:l,children:`Save`})]}),s&&(0,Q.jsx)(W,{text:s})]})}function $({icon:e,children:t}){return(0,Q.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,Q.jsx)(o,{icon:e,size:22,className:`text-muted`}),(0,Q.jsx)(`p`,{className:`m-0 max-w-[62ch] leading-relaxed text-ink-2`,children:t})]})}var Re=190,ze=46,Be=64,Ve=(e,t)=>{let n=Math.max(6,Math.floor(t/6.6));return e.length<=n?e:`${e.slice(0,n-1)}…`};function He({j:e}){let t=[{id:`browser`,label:`Browser`,kind:`browser`}],n=(e,n,r)=>(t.some(t=>t.id===e)||t.push({id:e,label:n,kind:r}),t.findIndex(t=>t.id===e)),r=[];e.steps.forEach((e,t)=>{let i=n(`s:${e.service||`?`}`,e.service||`service`,`service`);r.push({from:0,to:i,label:e.endpoint||e.name,solid:e.known===`seen`,n:t+1});for(let t of e.effects)r.push({from:i,to:n(`${t.lane}:${t.target}`,t.target,t.lane===`service`?`service`:t.lane),label:t.kind,solid:t.known===`seen`})});let i=t.length*Re,a=Be+r.length*ze+24,o=e=>e*Re+Re/2,s=`${e.name}: ${e.steps.length} ${e.steps.length===1?`step`:`steps`} across ${t.slice(1).map(e=>e.label).join(`, `)}.`;return(0,Q.jsxs)(`div`,{className:`overflow-x-auto`,children:[(0,Q.jsxs)(`svg`,{role:`img`,"aria-label":s,width:i,height:a,viewBox:`0 0 ${i} ${a}`,className:`block`,children:[t.map((t,n)=>(0,Q.jsxs)(`g`,{children:[(0,Q.jsx)(`line`,{x1:o(n),y1:56,x2:o(n),y2:a-8,strokeDasharray:`3 4`,className:`stroke-line-strong`}),(0,Q.jsx)(`rect`,{x:o(n)-Re/2+8,y:6,width:174,height:40,rx:10,className:m(`stroke-line`,t.kind===`outside`?`fill-surface-muted`:`fill-bg`)}),(0,Q.jsx)(`text`,{x:o(n),y:24,textAnchor:`middle`,className:`fill-ink text-[13px] font-medium`,children:Ve(t.label,162)}),(0,Q.jsx)(`text`,{x:o(n),y:39,textAnchor:`middle`,className:`fill-muted text-[11px]`,children:t.kind===`browser`?Ve(e.steps[0]?.page||``,162):t.kind===`data`?`table`:t.kind===`message`?`message`:t.kind===`outside`?`outside`:`service`})]},t.id)),r.map((e,t)=>{let n=Be+t*ze+ze/2,r=Math.min(o(e.from),o(e.to)),i=Math.max(o(e.from),o(e.to)),a=o(e.to)>o(e.from)?1:-1,s=o(e.to)-a*4;return(0,Q.jsxs)(`g`,{children:[(0,Q.jsx)(`line`,{x1:o(e.from),y1:n,x2:s,y2:n,strokeWidth:e.solid?2:1.5,strokeDasharray:e.solid?void 0:`5 4`,className:e.solid?`stroke-pass`:`stroke-ink-2`}),(0,Q.jsx)(`path`,{d:`M ${s} ${n} l ${-a*7} -4 l 0 8 z`,className:e.solid?`fill-pass`:`fill-ink-2`}),(0,Q.jsxs)(`text`,{x:r+8,y:n-7,className:m(`text-[12px]`,e.n?`fill-ink`:`fill-muted`),children:[e.n?`${e.n} `:``,Ve(e.label,i-r-16)]})]},t)})]}),(0,Q.jsx)(`ol`,{className:`sr-only`,children:e.steps.map((e,t)=>(0,Q.jsxs)(`li`,{children:[e.endpoint||e.name,` on `,e.service||`a service`,e.effects.length?`, which ${e.effects.map(e=>`${e.kind} ${e.target}`).join(`, `)}`:``,`. `,Ue(e.known),`.`]},t))})]})}var Ue=e=>({seen:`Seen in a run`,read:`From the code`,inferred:`Worked out`,differs:`A run differs`,confirmed:`Confirmed by a person`,rejected:`Marked wrong`})[e];function We({d:e}){let t=[...e.writtenBy.map(e=>({id:`w:${e}`,column:`writes`,title:e,known:`read`})),{id:e.id,column:`table`,title:e.name,detail:e.columns.length?e.columns.join(`, `):e.where,known:`read`,personal:e.personal.length>0},...e.readBy.map(e=>({id:`r:${e}`,column:`reads`,title:e,known:`read`})),...e.sentOn.map(e=>({id:`s:${e}`,column:`onward`,title:e,detail:`message`,known:`inferred`})),...e.leavesTo.map(e=>({id:`o:${e}`,column:`onward`,title:e,detail:`outside service`,known:`inferred`}))],n=[...e.writtenBy.map(t=>({from:`w:${t}`,to:e.id,known:`read`})),...e.readBy.map(t=>({from:e.id,to:`r:${t}`,known:`read`})),...e.sentOn.map(t=>({from:e.id,to:`s:${t}`,known:`inferred`})),...e.leavesTo.map(t=>({from:e.id,to:`o:${t}`,known:`inferred`}))];return(0,Q.jsx)(ue,{label:`What happens to the data of ${e.name}`,columns:[{id:`writes`,label:`Written by`,icon:h},{id:`table`,label:`Kept in`,icon:x},{id:`reads`,label:`Read by`,icon:h},{id:`onward`,label:`Sent on, and leaves to`,icon:u}],nodes:t,links:n})}var Ge=({known:e})=>e===`seen`?(0,Q.jsx)(B,{size:15,role:`img`,"aria-label":`Seen in a run`,className:`mt-0.5 flex-none text-pass`}):(0,Q.jsx)(R,{size:15,"aria-hidden":`true`,className:`mt-0.5 flex-none text-muted`});function Ke({items:e}){let t=e.filter(e=>e.value);return t.length?(0,Q.jsx)(`span`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-[13px] text-muted`,children:t.map(e=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Q.jsx)(o,{icon:e.icon,size:14}),(0,Q.jsxs)(`span`,{children:[e.label,`: `,(0,Q.jsx)(`span`,{className:`text-ink-2`,children:e.value})]})]},e.label))}):null}function qe({d:e}){let t=e.states.filter(e=>e.first),n=e.states.filter(e=>!e.first&&e.setBy.length),r=e.states.filter(e=>!e.first&&!e.setBy.length);if(!e.states.length)return(0,Q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`The code names no state for it (a status the record moves through).`});let i=({s:e,dashed:t})=>(0,Q.jsx)(`span`,{className:m(`inline-flex min-h-9 items-center rounded-[10px] border px-3 text-[14px] font-medium`,t?`border-dashed border-muted text-ink-2`:`border-line bg-bg text-ink`),children:e});return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Q.jsxs)(`ol`,{"aria-label":`The life of ${e.record.toLowerCase()}`,className:`m-0 flex list-none flex-wrap items-center gap-2 p-0`,children:[t.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-[12px] text-muted`,children:`Starts`}),(0,Q.jsx)(i,{s:e.state})]},e.state)),n.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[12px] text-ink-2`,children:[(0,Q.jsx)(L,{size:14,"aria-hidden":`true`,className:`text-muted`}),e.setBy.join(`, `),(0,Q.jsx)(L,{size:14,"aria-hidden":`true`,className:`text-muted`})]}),(0,Q.jsx)(i,{s:e.state})]},e.state))]}),r.length>0&&(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[13px] text-muted`,children:[`Also checked:`,r.map(e=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Q.jsx)(i,{s:e.state,dashed:!0}),e.checkedBy.length>0&&(0,Q.jsxs)(`span`,{className:`text-ink-2`,children:[`(`,e.checkedBy.join(`; `),`)`]})]},e.state))]})]})}function Je({label:e,rows:t,current:n,name:r,icon:i,to:a}){return(0,Q.jsx)(`nav`,{"aria-label":e,className:`flex min-w-0 flex-col gap-1 @2xl:sticky @2xl:top-6 @2xl:w-[260px] @2xl:flex-none`,children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`a`,{href:S(`product`,`business`,a,encodeURIComponent(e.id)),"aria-current":n===e.id?`page`:void 0,className:m(`flex min-h-11 items-center gap-2.5 rounded-[10px] px-3 py-1.5 text-ink no-underline`,n===e.id?`bg-surface-strong hover:text-ink`:`hover:bg-surface-muted hover:text-ink`),children:[i(e),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[14px] font-medium`,"data-tip":r(e),children:r(e)})]})},e.id))})})}function Ye({view:e,tab:t,item:n,onChanged:r}){let[i,a]=(0,K.useState)(!1),[s,c]=(0,K.useState)(null),f=[{id:`capabilities`,label:`What it does`},{id:`journeys`,label:`Journeys (${e.journeys.length})`},{id:`rules`,label:`Rules (${e.rules.length})`},{id:`data`,label:`Records (${e.data.length})`},...e.terms.length?[{id:`glossary`,label:`Glossary (${e.terms.length})`}]:[],{id:`team`,label:e.team?`Team questions (${e.team.passed} of ${e.team.questions})`:`Team questions`}],m=e.journeys.find(e=>e.id===n)||e.journeys[0],g=e.data.find(e=>e.id===n)||e.data[0],v=(...e)=>location.hash=S(`product`,`business`,...e),C=new Map;for(let t of e.rules)C.set(t.capability||`Other`,[...C.get(t.capability||`Other`)||[],t]);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[!e.modelRead&&(0,Q.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:`These words come from the code itself: the action from each request, the rule from the message the product answers with, the record from each table. Build the graph with the model to have capabilities, journeys and rules named and phrased by it, each citing what shows it.`}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-x-6 @3xl:flex-row @3xl:items-end`,children:[(0,Q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Q.jsx)(F,{label:`Product view`,current:t,onPick:e=>v(e),tabs:f})}),(0,Q.jsxs)(`span`,{className:`mb-5 flex items-center gap-2 text-sm text-ink-2`,children:[(0,Q.jsx)(j,{checked:i,onChange:a,label:`Show how it is built`}),`Show how it is built`]})]}),t===`capabilities`&&(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`panel-capabilities`,"aria-labelledby":`tab-capabilities`,className:`flex flex-col gap-6`,children:[!e.capabilities.length&&(0,Q.jsx)($,{icon:d,children:`Nothing the product does was found yet: the product serves no request the patterns read. Build the graph with the model to find what it does from the code and documents.`}),(0,Q.jsx)(`ul`,{className:`m-0 grid list-none gap-4 p-0 @2xl:grid-cols-2`,children:e.capabilities.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-col gap-3 rounded-[14px] card border p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,Q.jsxs)(`h3`,{className:`m-0 flex items-center gap-2 text-lg font-semibold`,children:[(0,Q.jsx)(o,{icon:d,size:18}),e.name]}),e.by===`model`&&(0,Q.jsx)(G,{known:e.known})]}),e.by===`model`&&(0,Q.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2 [overflow-wrap:anywhere]`,children:e.summary}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1.5 p-0`,children:e.actions.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-start gap-2 text-[15px] text-ink`,children:[(0,Q.jsx)(Ge,{known:e.known}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[e.action,i&&(0,Q.jsx)(`span`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:e.endpoint})]})]},e.endpoint))}),(0,Q.jsx)(Ke,{items:[{icon:x,label:`Keeps`,value:e.records.join(`, `)},{icon:p,label:`Shares with`,value:e.outside.join(`, `)},{icon:b,label:`Rules`,value:e.rules?String(e.rules):``},{icon:w,label:`Personal data`,value:e.personal?`yes`:``}]}),e.by===`model`&&(0,Q.jsx)(Le,{id:e.id,verdict:e.verdict,note:e.note,onChanged:r})]},e.id))}),(0,Q.jsxs)(`p`,{className:`m-0 text-[12px] text-muted`,children:[(0,Q.jsx)(B,{size:12,"aria-hidden":`true`,className:`mr-1 inline align-[-1px] text-pass`}),`Seen in a run: ForgeQE's runs did it. The rest is read in the code.`]}),i&&e.map.nodes.length>0&&(0,Q.jsx)(U,{id:`capability-map`,title:`How it is built`,icon:h,children:(0,Q.jsx)(ue,{label:`Capability map`,columns:[{id:`capability`,label:`Capabilities`,icon:d},{id:`endpoint`,label:`Requests`,icon:h},{id:`rule`,label:`Rules it checks`,icon:b},{id:`data`,label:`Tables`,icon:x}],nodes:e.map.nodes,links:e.map.links,opens:e=>e.column===`data`||e.column===`rule`,onOpen:e=>e.column===`data`?v(`data`,encodeURIComponent(e.id)):v(`rules`)})})]}),t===`journeys`&&(0,Q.jsx)(`div`,{role:`tabpanel`,id:`panel-journeys`,"aria-labelledby":`tab-journeys`,children:m?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6 @2xl:flex-row @2xl:items-start @2xl:gap-8`,children:[(0,Q.jsx)(Je,{label:`Journeys`,rows:e.journeys,current:m.id,name:e=>e.name,to:`journeys`,icon:e=>e.known===`seen`?(0,Q.jsx)(B,{size:16,role:`img`,"aria-label":`Seen in a run`,className:`flex-none text-pass`}):(0,Q.jsx)(o,{icon:D,size:16,className:`flex-none`})}),(0,Q.jsxs)(`section`,{"aria-labelledby":`journey-h`,className:`flex min-w-0 flex-1 flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h2`,{id:`journey-h`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:m.name}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(y,{tone:`neutral`,icon:!1,children:m.by===`run`?`Walked by a run`:`Named by the model`}),(0,Q.jsx)(G,{known:m.known})]})]}),(0,Q.jsxs)(`ol`,{"aria-label":`Steps`,className:`m-0 flex list-none flex-col gap-2 p-0 @3xl:flex-row @3xl:flex-wrap @3xl:items-stretch`,children:[m.steps[0]?.page&&(0,Q.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(`span`,{className:`flex flex-col justify-center rounded-[14px] bg-surface-muted px-4 py-3 text-[13px] text-ink-2`,children:[`Starts on`,(0,Q.jsx)(`span`,{className:`font-mono text-[12px] text-muted`,children:m.steps[0].page})]}),(0,Q.jsx)(L,{size:18,"aria-hidden":`true`,className:`hidden flex-none text-muted @3xl:block`})]}),m.steps.map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex items-stretch gap-2 @3xl:items-center`,children:[(0,Q.jsxs)(`div`,{className:`flex w-full flex-col gap-2 self-stretch rounded-[14px] card border p-4 @3xl:w-[220px]`,children:[(0,Q.jsxs)(`span`,{className:`flex items-start gap-2 text-[15px] font-semibold text-ink`,children:[(0,Q.jsx)(`span`,{className:`flex size-6 flex-none items-center justify-center rounded-full bg-surface-strong text-[12px] tabular-nums`,children:t+1}),e.action]}),e.outcomes.map(e=>(0,Q.jsxs)(`span`,{className:`flex items-start gap-1.5 text-[13px] text-ink-2`,children:[(0,Q.jsx)(fe,{size:13,"aria-hidden":`true`,className:`mt-0.5 flex-none text-muted`}),e]},e)),e.guards.length>0&&(0,Q.jsxs)(`span`,{className:`flex items-start gap-1.5 rounded-[10px] bg-surface-muted px-2.5 py-1.5 text-[12px] text-ink-2`,children:[(0,Q.jsx)(o,{icon:b,size:13,className:`mt-0.5 flex-none`}),`Not allowed when: `,e.guards.join(`; `)]}),(0,Q.jsxs)(`span`,{className:`mt-auto flex items-center gap-1.5 text-[12px] text-muted`,children:[(0,Q.jsx)(Ge,{known:e.known}),e.known===`seen`?`Seen in a run`:Ue(e.known)]}),i&&e.endpoint&&(0,Q.jsxs)(`span`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:[e.endpoint,` · `,e.service]})]}),t<m.steps.length-1&&(0,Q.jsx)(L,{size:18,"aria-hidden":`true`,className:`hidden flex-none text-muted @3xl:block`})]},t))]}),(0,Q.jsx)(Le,{id:m.id,verdict:m.verdict,note:m.note,onChanged:r}),i&&(0,Q.jsxs)(U,{id:`journey-built`,title:`How it is built`,icon:h,children:[(0,Q.jsx)(He,{j:m}),(0,Q.jsx)(`p`,{className:`m-0 text-[12px] text-muted`,children:`Numbered arrows: the requests the browser made, in order; under each, what that request's code does. Solid green: seen in a run; dashed: from the code. A call made through a helper in another file is not drawn.`})]})]})]}):(0,Q.jsx)($,{icon:D,children:`No journey yet. Each browser run of ForgeQE becomes one here once the graph is built again; the model names more from the code.`})}),t===`rules`&&(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`panel-rules`,"aria-labelledby":`tab-rules`,className:`flex flex-col gap-6`,children:[!e.rules.length&&(0,Q.jsx)($,{icon:b,children:`No rule was found yet: nothing in the code refuses a request with a reason. Rules show here once one is read.`}),[...C].map(([e,t],n)=>(0,Q.jsx)(U,{id:`rules-${n}`,title:e,icon:d,n:t.length,children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-col gap-2 border-b border-line-soft py-3 last:border-b-0`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-2`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_380px] items-start gap-2 text-[15px] font-medium text-ink [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(o,{icon:b,size:16,className:`mt-0.5 flex-none`}),e.plain]}),(0,Q.jsx)(G,{known:e.known})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col items-start gap-1 pl-6`,children:[!i&&(0,Q.jsx)(`button`,{type:`button`,"aria-expanded":s===e.id,onClick:()=>c(s===e.id?null:e.id),className:`inline-flex min-h-11 cursor-pointer items-center border-0 bg-transparent p-0 text-[12px] text-accent-fg hover:text-accent-fg-hover`,children:s===e.id?`Hide how it is checked`:`Show how it is checked`}),(0,Q.jsx)(Le,{id:e.id,verdict:e.verdict,note:e.note,onChanged:r})]}),(0,Q.jsx)(I,{open:i||s===e.id,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 pb-1 pl-6`,children:[e.quote&&(0,Q.jsx)(`code`,{className:`font-mono text-[12px] text-ink-2 [overflow-wrap:anywhere]`,children:e.quote}),(0,Q.jsxs)(`span`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:[e.endpoint?`${e.endpoint} · `:``,e.where]})]})})]},e.id))})},e))]}),t===`data`&&(0,Q.jsx)(`div`,{role:`tabpanel`,id:`panel-data`,"aria-labelledby":`tab-data`,children:g?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6 @2xl:flex-row @2xl:items-start @2xl:gap-8`,children:[(0,Q.jsx)(Je,{label:`Records`,rows:e.data,current:g.id,name:e=>e.record,to:`data`,icon:e=>e.personal.length?(0,Q.jsx)(o,{icon:w,size:16,label:`Holds personal data`,className:`flex-none`}):(0,Q.jsx)(O,{size:16,"aria-hidden":`true`,className:`flex-none text-muted`})}),(0,Q.jsxs)(`section`,{"aria-labelledby":`table-h`,className:`flex min-w-0 flex-1 flex-col gap-4`,children:[(0,Q.jsx)(`h2`,{id:`table-h`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:g.record}),(0,Q.jsx)(U,{id:`life`,title:`Its life`,icon:D,children:(0,Q.jsx)(qe,{d:g})}),(0,Q.jsx)(Ke,{items:[{icon:h,label:`Changed by`,value:g.keptBy.join(`, `)},{icon:u,label:`Announced as`,value:g.sentOn.map(e=>e.replace(/^Announces /,``)).join(`, `)},{icon:p,label:`Shared with`,value:g.leavesTo.join(`, `)},{icon:w,label:`Personal data`,value:g.personal.join(`, `)}]}),i&&(0,Q.jsxs)(U,{id:`record-built`,title:`How it is built`,icon:h,children:[(0,Q.jsxs)(`span`,{className:`font-mono text-[12px] text-muted`,children:[`table `,g.name,` · `,g.where,g.columns.length?` · ${g.columns.join(`, `)}`:``]}),(0,Q.jsx)(We,{d:g})]})]})]}):(0,Q.jsx)($,{icon:x,children:`No record yet: no migration or model of the repositories defines a table. Records show here once a schema is read.`})}),t===`glossary`&&(0,Q.jsx)(`div`,{role:`tabpanel`,id:`panel-glossary`,"aria-labelledby":`tab-glossary`,children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.terms.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-start gap-x-4 gap-y-2 border-b border-line-soft py-3 last:border-b-0`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_380px] flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-2 text-[14px] font-medium`,children:[(0,Q.jsx)(o,{icon:T,size:15}),e.term]}),(0,Q.jsx)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:e.meaning})]}),(0,Q.jsx)(Le,{id:e.id,verdict:e.verdict,note:e.note,onChanged:r})]},e.id))})}),t===`team`&&(0,Q.jsx)(`div`,{role:`tabpanel`,id:`panel-team`,"aria-labelledby":`tab-team`,className:`flex flex-col gap-3`,children:e.team?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[e.team.passed,` of `,e.team.questions,` answered right, `,e.team.grounded,` with every quote found in its file`,e.team.model?`, by ${e.team.model}`:``,`, `,se(e.team.at),`.`]}),(0,Q.jsx)(U,{id:`team-scores`,title:`Questions`,icon:l,n:e.team.scores.length,children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.team.scores.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-start gap-2 border-b border-line-soft py-3 last:border-b-0`,children:[e.pass?(0,Q.jsx)(B,{size:16,role:`img`,"aria-label":`Answered right`,className:`mt-0.5 flex-none text-pass`}):(0,Q.jsx)(_,{size:16,role:`img`,"aria-label":`Not answered right`,className:`mt-0.5 flex-none text-warn`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsx)(`span`,{className:`text-[14px] font-medium [overflow-wrap:anywhere]`,children:e.question}),!e.pass&&(0,Q.jsx)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.why.join(`; `)})]})]},e.id))})})]}):(0,Q.jsx)($,{icon:l,children:`No team questions yet. Write questions whose answers your team knows (evals/knowledge/shop/questions.yaml shows how), then run forgeqe knowledge eval with the file: each answer is scored, and the last result shows here.`})})]})}var Xe=e=>/^https:\/\/[^/\s]/i.test(e)&&!/[\u0000-\u0020\u007f-\u009f]/.test(e);function Ze({id:e,onClose:n}){let[r,i]=(0,K.useState)(null),[a,o]=(0,K.useState)(``);return(0,K.useEffect)(()=>{if(!e)return;let t=!1;return i(null),o(``),A.part(e).then(e=>!t&&i(e),e=>!t&&o(e.message)),()=>{t=!0}},[e]),(0,Q.jsxs)(ae,{open:!!e,onClose:n,title:r?.part.name||`Part`,description:r?.part.where,footer:(0,Q.jsx)(t,{onClick:n,children:`Close`}),wide:!0,children:[a&&(0,Q.jsx)(W,{text:a}),!r&&!a&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),r&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[r.part.summary&&(0,Q.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2 [overflow-wrap:anywhere]`,children:r.part.summary}),(0,Q.jsxs)(`section`,{"aria-labelledby":`evidence-h`,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{id:`evidence-h`,className:`m-0 text-base font-semibold`,children:`How it is known`}),r.part.evidence?.length?(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:r.part.evidence.map((e,t)=>(0,Q.jsx)(`li`,{className:`border-b border-line-soft py-2 font-mono text-[12.5px] leading-relaxed text-ink-2 [overflow-wrap:anywhere] last:border-b-0`,children:e},t))}):(0,Q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No evidence kept for it: build the graph again.`}),r.links?.some(e=>Xe(e.url))&&(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:r.links.filter(e=>Xe(e.url)).map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 text-[13px] [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(H,{size:13,"aria-hidden":`true`,className:`flex-none`}),e.label]})},e.url))})]}),r.groups.map(e=>(0,Q.jsxs)(`section`,{"aria-label":e.label,className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`h3`,{className:`m-0 text-sm font-semibold`,children:[e.label,` (`,e.rows.length+e.more,`)`]}),(0,Q.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[e.rows.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-col py-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-[14px] font-medium [overflow-wrap:anywhere]`,children:e.name}),(0,Q.jsx)(`span`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:e.where})]},e.id)),e.more>0&&(0,Q.jsxs)(`li`,{className:`py-1 text-[12px] text-muted`,children:[`… and `,e.more,` more`]})]})]},e.label))]})]})}function Qe({view:e}){let t=t=>e.nodes.find(e=>e.id===t)?.name||t;if(!e.links.length)return(0,Q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No link between the parts was found.`});let n=[`differs`,`seen`,`read`,`inferred`];return(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[...e.links].sort((e,t)=>n.indexOf(e.known)-n.indexOf(t.known)).map((e,n)=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 border-b border-line-soft py-2.5 last:border-b-0`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 flex-[1_1_320px] text-[14px] [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:t(e.from)}),` `,(0,Q.jsx)(`span`,{className:`text-muted`,children:e.label}),` `,(0,Q.jsx)(`span`,{className:`font-medium`,children:t(e.to)}),e.count>1&&(0,Q.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.count,` places in the code`]}),e.example&&(0,Q.jsx)(`span`,{className:`block text-[12px] text-muted`,children:e.example})]}),(0,Q.jsx)(G,{known:e.known})]},n))})}function $e({id:e}){let[t,n]=(0,K.useState)(null),[r,i]=(0,K.useState)(``);return(0,K.useEffect)(()=>{let t=!1;return g.impact(e).then(e=>!t&&n(e),e=>!t&&i(e.message)),()=>{t=!0}},[e]),r?(0,Q.jsx)(W,{text:r}):t?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 py-2 pl-3 text-[13px]`,children:[(0,Q.jsxs)(`span`,{className:`text-muted`,children:[t.reached.length?`A change here reaches ${t.reached.length} ${t.reached.length===1?`part`:`parts`}`:`Nothing else depends on it in the graph`,t.tests.length?`; ${t.tests.length} ${t.tests.length===1?`test covers`:`tests cover`} them.`:`; no test covers it.`]}),t.reached.length>0&&(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.reached.slice(0,15).map(e=>(0,Q.jsxs)(`li`,{className:`py-0.5 [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:e.name}),` `,(0,Q.jsxs)(`span`,{className:`text-muted`,children:[`(`,e.type,`, `,(0,Q.jsx)(`span`,{className:`font-mono`,children:e.where}),`)`]})]},e.id))}),t.tests.length>0&&(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.tests.slice(0,10).map(e=>(0,Q.jsxs)(`li`,{className:`py-0.5 text-muted [overflow-wrap:anywhere]`,children:[`Test: `,e.name,` (`,(0,Q.jsx)(`span`,{className:`font-mono`,children:e.where}),`)`]},e.id))})]}):(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`})}function et({p:e,extra:n,onEvidence:r,children:i}){return(0,Q.jsxs)(`li`,{className:`border-b border-line-soft py-2.5 last:border-b-0`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_320px] flex-col`,children:[(0,Q.jsxs)(`span`,{className:`text-[14px] font-medium [overflow-wrap:anywhere]`,children:[e.name,n]}),(0,Q.jsxs)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:[e.note,e.note&&e.where?` · `:``,e.where&&(0,Q.jsx)(`span`,{className:`font-mono`,children:e.where})]})]}),(0,Q.jsx)(G,{known:e.known}),(0,Q.jsxs)(t,{size:`sm`,variant:`ghost`,onClick:()=>r(e.id),children:[(0,Q.jsx)(o,{icon:k,size:15}),`Evidence`]})]}),i]})}function tt({gaps:e,onError:n}){return(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.map((e,r)=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 border-b border-line-soft py-2.5 last:border-b-0`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_360px] flex-col`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[14px] font-medium [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(_,{size:14,"aria-hidden":`true`,className:`flex-none text-warn`}),e.what]}),(0,Q.jsxs)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{className:`font-mono`,children:e.where}),e.quote?` · ${e.quote}`:``]}),(0,Q.jsx)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:e.next})]}),(0,Q.jsxs)(t,{size:`sm`,variant:`ghost`,onClick:()=>void le(e.what,`${e.where}. ${e.next}`,n),children:[(0,Q.jsx)(o,{icon:v,size:15}),`Investigate`]})]},r))})}function nt({repo:e,onEvidence:r}){let[s,c]=(0,K.useState)(null),[l,d]=(0,K.useState)(``),[f,p]=(0,K.useState)(null),[m,h]=(0,K.useState)(``);return(0,K.useEffect)(()=>{let t=!1;return c(null),d(``),g.service(e).then(e=>!t&&c(e),e=>!t&&d(e.message)),()=>{t=!0}},[e]),l?(0,Q.jsx)(W,{text:l}):s?(0,Q.jsxs)(`section`,{"aria-labelledby":`service-h`,className:`flex min-w-0 flex-col gap-6`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`a`,{href:S(`product`,`services`),className:`inline-flex items-center gap-1.5 self-start text-sm`,children:[(0,Q.jsx)(z,{size:16,"aria-hidden":`true`}),`All services`]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,Q.jsx)(`h2`,{id:`service-h`,className:`m-0 flex-[1_1_260px] text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:s.repo}),(0,Q.jsxs)(t,{size:`sm`,variant:`ghost`,onClick:()=>void le(`How does ${s.repo} work, and what does it depend on?`,s.summary,h),children:[(0,Q.jsx)(o,{icon:a,size:15}),`Ask in a chat`]})]}),(0,Q.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-ink-2 [overflow-wrap:anywhere]`,children:s.summary}),(0,Q.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[s.counts.files,` files, `,s.counts.classes,` classes, `,s.counts.tests,` test files`,s.deployedAs.length?` · deployed as ${s.deployedAs.join(`; `)}`:``]}),m&&(0,Q.jsx)(W,{text:m})]}),(0,Q.jsx)(U,{id:`endpoints`,title:`Endpoints`,icon:n,n:s.endpoints.length,children:s.endpoints.length?(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:s.endpoints.map(e=>(0,Q.jsxs)(et,{p:e,onEvidence:r,extra:e.auth?(0,Q.jsxs)(`span`,{className:`font-normal text-muted`,children:[` · requires `,e.auth]}):null,children:[e.differs&&(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 text-[12px] text-warn`,children:[(0,Q.jsx)(_,{size:12,"aria-hidden":`true`}),`A run called a route near it: Runs against the code.`]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 text-[12px] text-muted`,children:[(0,Q.jsx)(`span`,{children:e.callers.length?`Called by ${e.callers.join(`, `)}`:`No caller found in the other repositories`}),(0,Q.jsx)(`button`,{type:`button`,"aria-expanded":f===e.id,onClick:()=>p(f===e.id?null:e.id),className:`inline-flex min-h-11 cursor-pointer items-center border-0 bg-transparent p-0 text-[12px] text-accent-fg hover:text-accent-fg-hover`,children:f===e.id?`Hide what a change reaches`:`What a change reaches`})]}),(0,Q.jsx)(I,{open:f===e.id,children:f===e.id&&(0,Q.jsx)($e,{id:e.id})})]},e.id))}):(0,Q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`It serves no endpoint the patterns read.`})}),[{id:`calls`,title:`Calls out`,icon:M,rows:s.calls.map(e=>({p:e,extra:(0,Q.jsxs)(`span`,{className:`font-normal text-muted`,children:[` · `,e.to]})}))},{id:`data`,title:`Data`,icon:x,rows:s.data.map(e=>({p:e,extra:(0,Q.jsxs)(`span`,{className:`font-normal text-muted`,children:[` · `,e.use]})}))},{id:`messages`,title:`Messages`,icon:u,rows:s.messages.map(e=>({p:e,extra:(0,Q.jsxs)(`span`,{className:`font-normal text-muted`,children:[` · `,e.use]})}))},{id:`outside`,title:`Outside services`,icon:i,rows:s.outside.map(e=>({p:e,extra:null}))},{id:`cloud`,title:`Cloud resources`,icon:E,rows:s.cloud.map(e=>({p:e,extra:null}))}].filter(e=>e.rows.length).map(e=>(0,Q.jsx)(U,{id:e.id,title:e.title,icon:e.icon,n:e.rows.length,children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.rows.map((e,t)=>(0,Q.jsx)(et,{p:e.p,extra:e.extra,onEvidence:r},`${e.p.id}-${t}`))})},e.id)),s.gaps.length>0&&(0,Q.jsx)(U,{id:`service-gaps`,title:`Open questions`,icon:_,n:s.gaps.length,children:(0,Q.jsx)(tt,{gaps:s.gaps,onError:h})})]}):(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`})}function rt({view:t,onEvidence:n,onError:r}){let i=t.runtime;return i?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Q.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[i.runs,` runs made `,i.calls,` API calls; `,i.matched,` reached a route the code declares. `,i.seen,` of `,i.endpoints,` endpoints were seen in a run.`]}),(0,Q.jsx)(U,{id:`differs`,title:`Differ from the code`,icon:_,n:i.differs.length,children:i.differs.length?(0,Q.jsx)(tt,{gaps:i.differs,onError:r}):(0,Q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No call differs from the code.`})}),(0,Q.jsx)(U,{id:`only`,title:`Only the runs show`,icon:k,n:i.only.length,children:i.only.length?(0,Q.jsx)(tt,{gaps:i.only,onError:r}):(0,Q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Every call reached a route the code declares.`})}),(0,Q.jsx)(U,{id:`unseen`,title:`Never seen in a run`,icon:oe,n:i.endpoints-i.seen,children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:i.notSeen.map(e=>(0,Q.jsx)(et,{p:{...e,known:`read`,note:``},onEvidence:n},e.id))})})]}):(0,Q.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,Q.jsx)(o,{icon:e,size:22,className:`text-muted`}),(0,Q.jsx)(`p`,{className:`m-0 max-w-[62ch] leading-relaxed text-ink-2`,children:`No run of ForgeQE has recorded API calls yet. Every browser run records them; after a run, build the product graph again and what the runs did shows here against the code.`})]})}function it({sub:e}){let[t,r]=(0,K.useState)(null),[i,a]=(0,K.useState)(``),[s,c]=(0,K.useState)(``),[l,u]=(0,K.useState)(null),d=(e||``).split(`/`),f=d[0]===`business`,[p,h]=(0,K.useState)(null),_=(0,K.useCallback)(()=>{re.view().then(h,e=>a(e.message))},[]);(0,K.useEffect)(()=>{f&&!p&&_()},[f,p,_]);let v=[`capabilities`,`journeys`,`rules`,`data`,`glossary`,`team`].find(e=>e===d[1]&&(e!==`glossary`||!!p?.terms.length))||`capabilities`,y=[`links`,`runtime`,`questions`].find(e=>e===d[0])||(d[0]===`services`?`services`:`landscape`),b=d[0]===`services`&&d[1]?decodeURIComponent(d[1]):``,x=d[0]===`systems`&&d[1]?decodeURIComponent(d[1]):``,C=!f&&(y===`landscape`||y===`services`&&!b);(0,K.useEffect)(()=>{g.view().then(e=>{r(e),a(``)},e=>a(e.message))},[]);let w=e=>{e.repo&&e.column!==`data`?location.hash=S(`product`,`services`,encodeURIComponent(e.repo)):e.part&&u(e.part)};return(0,Q.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,Q.jsx)(ee,{}),(0,Q.jsxs)(`main`,{className:m(V,`@container flex-auto gap-4`,C&&t?.built&&`max-w-none`),children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Q.jsx)(P,{pixel:ne.product,size:`lg`}),(0,Q.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`Product`})]}),(0,Q.jsxs)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:[`How `,t?.product||`the product`,` is built and how it works for the business, read from its repositories, documents and ForgeQE's runs. Each part says how it is known, and you can mark what the business view says right or wrong.`]}),i&&(0,Q.jsx)(W,{text:i}),s&&(0,Q.jsx)(W,{text:s}),!t&&!i&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&!t.built&&(0,Q.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,Q.jsx)(o,{icon:n,size:22,className:`text-muted`}),(0,Q.jsx)(`p`,{className:`m-0 max-w-[62ch] leading-relaxed text-ink-2`,children:`The product graph is not built yet. Add the product's repositories under Settings, Agents, then run forgeqe knowledge build, or ask in a chat to build it.`})]}),t?.built&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{role:`radiogroup`,"aria-label":`View`,className:`flex gap-1 self-start rounded-[10px] bg-surface-strong p-1`,children:[[`engineering`,`Engineering`,S(`product`)],[`business`,`Product`,S(`product`,`business`)]].map(([e,t,n])=>(0,Q.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e===`business`===f,onClick:()=>location.hash=n,className:m(`inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-[7px] border-0 px-3 text-sm font-medium`,e===`business`===f?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),children:t},e))}),f&&!p&&!i&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),f&&p&&(0,Q.jsx)(Ye,{view:p,tab:v,item:d[2]?decodeURIComponent(d[2]):void 0,onChanged:_}),!f&&t.summary.length>0&&(0,Q.jsx)(`p`,{className:`m-0 text-sm text-ink-2`,children:t.summary.join(` `)}),!f&&(0,Q.jsx)(F,{label:`Product`,current:y,onPick:e=>location.hash=e===`landscape`?S(`product`):S(`product`,e),tabs:[{id:`landscape`,label:`Landscape`},{id:`services`,label:`Services`},{id:`links`,label:`How they talk (${t.links.length})`},{id:`runtime`,label:`Runs against the code`},{id:`questions`,label:`Open questions (${t.gapsTotal})`}]}),!f&&y===`services`&&(0,Q.jsx)(`div`,{role:`tabpanel`,id:`panel-services`,"aria-labelledby":`tab-services`,className:`flex flex-col gap-8`,children:b?(0,Q.jsx)(nt,{repo:b,onEvidence:u}):(0,Q.jsxs)(`section`,{"aria-labelledby":`map-h`,className:`flex flex-col gap-3`,children:[(0,Q.jsx)(`h2`,{id:`map-h`,className:`sr-only`,children:`Services map`}),(0,Q.jsx)(De,{view:t,onOpen:w})]})}),!f&&y===`landscape`&&(0,Q.jsx)(`div`,{role:`tabpanel`,id:`panel-landscape`,"aria-labelledby":`tab-landscape`,children:x?(0,Q.jsx)(Ie,{eng:t,name:x,onOpen:w}):(0,Q.jsx)(Ne,{onPart:u})}),!f&&y===`links`&&(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`panel-links`,"aria-labelledby":`tab-links`,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm text-muted`,children:`Every link between the parts, how often it is in the code, and how it is known: the map's wires in words.`}),(0,Q.jsx)(Qe,{view:t})]}),!f&&y===`runtime`&&(0,Q.jsx)(`div`,{role:`tabpanel`,id:`panel-runtime`,"aria-labelledby":`tab-runtime`,children:(0,Q.jsx)(rt,{view:t,onEvidence:u,onError:c})}),!f&&y===`questions`&&(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`panel-questions`,"aria-labelledby":`tab-questions`,className:`flex flex-col gap-3`,children:[(0,Q.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm text-muted`,children:`What the build could not settle. Investigate one: ForgeQE's agent asks the investigator in a chat, which reads the code, documents and runs and answers with the lines it rests on.`}),t.gaps.length?(0,Q.jsx)(tt,{gaps:t.gaps,onError:c}):(0,Q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No open question.`}),t.gapsTotal>t.gaps.length&&(0,Q.jsxs)(`p`,{className:`m-0 text-[12px] text-muted`,children:[`… and `,t.gapsTotal-t.gaps.length,` more: forgeqe knowledge gaps.`]})]})]})]}),(0,Q.jsx)(Ze,{id:l,onClose:()=>u(null)})]})}export{it as Product};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Bt as e,Di as t,En as n,Ht as r,Ir as i,Kn as a,Ln as o,Si as s,U as c,Wt as l,X as u,Zt as d,ct as f,di as p,n as m,ot as h,qr as g,vr as _,vt as v,wi as y,xr as b}from"./Shell-C-_iUijV.js";import{H as x,r as S,t as C}from"./index-BxNs3KZC.js";import{t as w}from"./when-CHnpLdYw.js";import{d as T,f as E,g as D,l as O,o as k,p as A,s as j,t as M}from"./qualityParts-BtCR-0Bc.js";var N=t(y(),1),P=s();function F({id:t,view:s,onChanged:c}){let[u,d]=(0,N.useState)(null),[m,h]=(0,N.useState)(``),[_,v]=(0,N.useState)(`accessibility`),[y,x]=(0,N.useState)(``);(0,N.useEffect)(()=>{let e=!1;return d(null),p.run(t).then(t=>{if(e)return;d(t),h(``);let n=t.visual?.pages.some(e=>e.status===`changed`)||!t.visual&&t.captured;v(t.report?.accessibility.failed.length?`accessibility`:t.report?.breaches.some(e=>e.kind===`performance`)?`performance`:n?`visual`:t.report?.accessibility.pages?`accessibility`:t.report?.performance.pages.length?`performance`:`visual`)},t=>!e&&h(t.message)),()=>{e=!0}},[t]);let C=(0,P.jsxs)(`a`,{href:f(`quality`),className:`inline-flex items-center gap-1 self-start text-[13px] no-underline`,children:[(0,P.jsx)(b,{size:14,"aria-hidden":`true`,className:`rotate-90`}),`All runs`]});if(m)return(0,P.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[C,(0,P.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail`,children:m})]});if(!u)return(0,P.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[C,(0,P.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Loading…`})]});let w=async()=>{try{let{id:e}=await g.start(`Explain the accessibility, performance and visual results of the run in ${u.dir}: call quality_report and visual_compare with run_dir ${u.dir}. Say what matters most to fix first, and why.`,{});location.hash=f(`chats`,e)}catch(e){x(e.message)}},O=u.report,A=O?.accessibility,F=O?.performance.pages??[],I=F.filter(e=>e.over.length).length,L=F.map(e=>e.lcp).filter(e=>typeof e==`number`),R=L.length?Math.max(...L):void 0,z=u.visual?.pages.filter(e=>e.status===`changed`).length??0,B=O?.breaches.length??0,V=[{id:`accessibility`,label:`Accessibility`,icon:i,n:A?.pages?`${A.failed.length} failed`:`not measured`,tone:A?.failed.length?`text-fail`:void 0},{id:`performance`,label:`Performance`,icon:a,n:F.length?I?`${I} over budget`:`${F.length} pages`:`not measured`,tone:I?`text-fail`:void 0},{id:`visual`,label:`Visual`,icon:o,n:u.visual?`${z} changed`:u.captured?`not compared`:`not captured`,tone:z?`text-warn`:void 0}];return(0,P.jsxs)(`section`,{"aria-labelledby":`run-h`,className:`flex min-w-0 flex-col gap-3`,children:[C,(0,P.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-0.5`,children:[(0,P.jsx)(`h2`,{id:`run-h`,"data-tip":u.goal,className:`m-0 truncate text-[16px] leading-snug font-semibold`,children:u.goal}),(0,P.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 text-[12.5px] text-muted`,children:[D(u.at),` · `,s.standard,` · `,(0,P.jsx)(S,{path:u.dir})]})]}),(0,P.jsxs)(e,{size:`sm`,variant:`ghost`,onClick:()=>void w(),children:[(0,P.jsx)(r,{icon:n,size:14}),`Ask in a chat`]})]}),y&&(0,P.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:y}),(0,P.jsxs)(`div`,{className:`grid grid-cols-2 overflow-hidden rounded-[10px] border border-line-soft @xl:grid-cols-4 @4xl:grid-cols-8 @4xl:divide-x @4xl:divide-line-soft`,children:[(0,P.jsx)(k,{label:`Budgets exceeded`,value:B,tone:B?`text-fail`:`text-pass`,sub:B?`fails the run`:`within budgets`}),(0,P.jsx)(k,{label:`Rules failed`,value:A?.pages?A.failed.length:`–`,tone:A?.failed.length?`text-fail`:void 0,sub:A?.pages?`${A.passed.length} passed`:`not measured`}),(0,P.jsx)(k,{label:`Critical · serious`,value:A?.pages?`${A.byImpact.critical} · ${A.byImpact.serious}`:`–`,tone:A&&A.byImpact.critical+A.byImpact.serious?`text-fail`:void 0,sub:`violations`}),(0,P.jsx)(k,{label:`Moderate · minor`,value:A?.pages?`${A.byImpact.moderate} · ${A.byImpact.minor}`:`–`,sub:`violations`}),(0,P.jsx)(k,{label:`Pages timed`,value:F.length||`–`,sub:I?`${I} over budget`:`none over budget`,tone:I?`text-fail`:void 0}),(0,P.jsx)(k,{label:`Slowest LCP`,value:R===void 0?`–`:E(R,`ms`),tone:R===void 0?void 0:R>4e3?`text-fail`:R>2500?`text-warn`:`text-pass`,sub:`good up to 2.5s`}),(0,P.jsx)(k,{label:`Pages compared`,value:u.visual?u.visual.pages.length:u.captured?`${u.captured} captured`:`–`,sub:u.visual?`against baselines`:`not compared`}),(0,P.jsx)(k,{label:`Visual changes`,value:u.visual?z:`–`,tone:z?`text-warn`:void 0,sub:u.visual?.pages.some(e=>e.over)?`over budget`:`pages changed`})]}),(0,P.jsx)(`div`,{role:`tablist`,"aria-label":`Results`,className:`flex gap-1 overflow-x-auto border-b border-line-soft whitespace-nowrap`,children:V.map(e=>(0,P.jsxs)(`button`,{type:`button`,role:`tab`,id:`tab-${e.id}`,"aria-selected":_===e.id,"aria-controls":`panel-${e.id}`,onClick:()=>v(e.id),className:l(`-mb-px inline-flex min-h-9 flex-none cursor-pointer items-center gap-1.5 border-0 border-b-2 bg-transparent px-3 text-[13px] font-medium`,_===e.id?`border-accent text-ink`:`border-transparent text-muted hover:text-ink`),children:[(0,P.jsx)(r,{icon:e.icon,size:14}),e.label,(0,P.jsx)(`span`,{className:l(`font-normal`,e.tone||`text-muted`),children:e.n})]},e.id))}),(0,P.jsxs)(`div`,{role:`tabpanel`,id:`panel-${_}`,"aria-labelledby":`tab-${_}`,className:`flex min-w-0 flex-col`,children:[_===`accessibility`&&(0,P.jsx)(M,{run:u,standard:s.standard,disclaimer:s.disclaimer}),_===`performance`&&(0,P.jsx)(j,{run:u}),_===`visual`&&(0,P.jsx)(T,{run:u,budget:s.budgets.visual,onChange:e=>{d(e),c()}})]})]})}function I({runs:e}){let[t,n]=(0,N.useState)(`all`),r=e,i=t===`attention`?r.filter(A):r,a=e=>location.hash=f(`quality`,encodeURIComponent(e)),o=`py-2 pr-3 text-right tabular-nums`;return(0,P.jsx)(`div`,{className:`flex flex-col gap-2`,children:(0,P.jsx)(c,{label:`Runs`,placeholder:`Find a run by what it did`,resetKey:t,empty:`Nothing matches.`,tools:(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,P.jsx)(u,{items:[{id:`all`,label:`All`,n:r.length},{id:`attention`,label:`Needs a look`,n:r.filter(A).length,alert:!0}],value:t,onChange:n})}),head:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`th`,{className:`w-[46%] py-1.5 pr-3 pl-3 font-medium`,children:`Run`}),(0,P.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Rules failed`}),(0,P.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @2xl:table-cell`,children:`Critical · serious`}),(0,P.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @xl:table-cell`,children:`Slow pages`}),(0,P.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Visual`}),(0,P.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @3xl:table-cell`,children:`Budgets`}),(0,P.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`When`})]}),children:i.map(e=>{let t=e.breaches?_:A(e)?d:x,n=e.a11y?e.a11y.critical+e.a11y.serious:void 0;return(0,P.jsxs)(`tr`,{onClick:()=>a(e.id),className:`cursor-pointer border-t border-line-soft hover:bg-surface-muted`,children:[(0,P.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,P.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(t,{size:15,"aria-label":e.breaches?`Over a budget`:A(e)?`Needs a look`:`Within budgets`,className:l(`flex-none`,e.breaches?`text-fail`:A(e)?`text-warn`:`text-pass`)}),(0,P.jsx)(`a`,{href:f(`quality`,encodeURIComponent(e.id)),onClick:e=>e.stopPropagation(),"data-tip":e.goal,className:`truncate text-ink no-underline hover:underline`,children:e.goal})]})}),(0,P.jsx)(`td`,{className:l(o,e.a11y?.failed?`text-fail`:`text-muted`),children:e.a11y?e.a11y.failed:`–`}),(0,P.jsx)(`td`,{className:l(o,`hidden @2xl:table-cell`,n?`text-fail`:`text-muted`),children:e.a11y?`${e.a11y.critical} · ${e.a11y.serious}`:`–`}),(0,P.jsx)(`td`,{className:l(o,`hidden @xl:table-cell`,e.perf.over?`text-fail`:`text-muted`),children:e.perf.pages?`${e.perf.over} / ${e.perf.pages}`:`–`}),(0,P.jsx)(`td`,{className:l(o,e.visual?.changed?`text-warn`:`text-muted`),children:e.visual?`${e.visual.changed} changed`:e.captured?`not compared`:`–`}),(0,P.jsx)(`td`,{className:l(o,`hidden @3xl:table-cell`,e.breaches?`text-fail`:`text-muted`),children:e.breaches?`${e.breaches} over`:`ok`}),(0,P.jsx)(`td`,{className:`hidden py-2 pr-3 whitespace-nowrap text-[12.5px] text-muted @xl:table-cell`,"data-tip":D(e.at),children:w(e.at)})]},e.id)})})})}function L({sub:e}){let[t,n]=(0,N.useState)(null),[a,o]=(0,N.useState)(``),s=(0,N.useCallback)(()=>{p.view().then(e=>{n(e),o(``)},e=>o(e.message))},[]);(0,N.useEffect)(s,[s]);let c=e===`trends`,u=e&&!c?decodeURIComponent(e):``,d=t?.trends.filter(e=>e.perf.worse.length||e.a11y.newRules.length).length??0;return(0,P.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,P.jsx)(m,{}),(0,P.jsxs)(`main`,{className:l(C,`@container max-w-[1320px] flex-auto gap-4`),children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,P.jsx)(v,{pixel:h.quality,size:`lg`}),(0,P.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Quality`}),!u&&(0,P.jsx)(`div`,{role:`tablist`,"aria-label":`Show`,className:`flex gap-1 rounded-[10px] bg-surface-strong p-1`,children:[[`runs`,t?`Runs (${t.runs.length})`:`Runs`],[`trends`,`Trends${d?` (${d} worse)`:``}`]].map(([e,t])=>{let n=e===`trends`?c:!c;return(0,P.jsx)(`a`,{role:`tab`,"aria-selected":n,href:e===`runs`?f(`quality`):f(`quality`,e),className:l(`inline-flex min-h-8 items-center gap-1.5 rounded-[7px] px-3 text-sm font-medium no-underline`,n?`bg-bg text-ink shadow-sm hover:text-ink`:`text-muted hover:text-ink`),children:t},e)})})]}),!u&&(0,P.jsxs)(`p`,{className:`m-0 max-w-[80ch] text-[13px] leading-relaxed text-muted`,children:[`What each browser run measured on the pages it visited: accessibility (`,t?.standard||`WCAG`,`), Core Web Vitals, and visual changes against approved baselines. Budgets (quality.budgets) decide what fails a run. Open a run for all its details, or one kind with its agent: `,(0,P.jsx)(`a`,{href:f(`accessibility`),children:`Accessibility`}),`, `,(0,P.jsx)(`a`,{href:f(`performance`),children:`Performance`}),` or `,(0,P.jsx)(`a`,{href:f(`visual`),children:`Visual`}),`.`]}),a&&(0,P.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:a}),!t&&!a&&(0,P.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),t&&u&&(0,P.jsx)(F,{id:u,view:t,onChanged:s}),t&&!u&&c&&(0,P.jsx)(`div`,{role:`tabpanel`,"aria-label":`Trends`,children:(0,P.jsx)(O,{trends:t.trends})}),t&&!u&&!c&&(t.runs.length?(0,P.jsx)(I,{runs:t.runs}):(0,P.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[14px] border border-dashed border-line p-5`,children:[(0,P.jsx)(r,{icon:i,size:22,className:`text-muted`}),(0,P.jsx)(`p`,{className:`m-0 max-w-[62ch] text-[13.5px] leading-relaxed text-ink-2`,children:`No run has measured anything yet. Every browser run checks accessibility, timings and visual changes of the pages it visits; run a flow from a chat or the Record page, and its results show here.`})]}))]})]})}export{L as Quality};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{An as e,Bt as t,Cn as n,Ct as r,Di as i,Et as a,Gt as o,Ht as s,Jn as c,Kt as l,Lr as u,Lt as d,Mt as f,Qn as p,Si as m,Sr as h,St as g,Un as _,Ut as ee,Wt as v,Xn as y,at as te,cn as ne,dn as re,er as ie,fn as ae,gr as oe,jn as se,ln as ce,ot as le,qt as b,rn as x,sr as S,tn as ue,un as de,wi as fe,xr as C,yt as w}from"./Shell-C-_iUijV.js";import{B as T,F as pe,U as me,a as he,i as E,r as D}from"./index-BxNs3KZC.js";import{i as ge,o as _e,r as ve,s as O,t as k}from"./thread-BVeiwKSf.js";var A={name:`crosshair`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`22`,x2:`18`,y1:`12`,y2:`12`,key:`l9bcsi`}],[`line`,{x1:`6`,x2:`2`,y1:`12`,y2:`12`,key:`13hhkx`}],[`line`,{x1:`12`,x2:`12`,y1:`6`,y2:`2`,key:`10w3f3`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`18`,key:`15g9kq`}]]};A.node;var j=u(A),M={name:`file-pen`,size:24,node:[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]],aliases:[`file-edit`]};M.node;var N=u(M),P={name:`file-search`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`11.5`,cy:`14.5`,r:`2.5`,key:`1bq0ko`}],[`path`,{d:`M13.3 16.3 15 18`,key:`2quom7`}]]};P.node;var F=u(P),I={name:`forward`,size:24,node:[[`path`,{d:`m15 17 5-5-5-5`,key:`nf172w`}],[`path`,{d:`M4 18v-2a4 4 0 0 1 4-4h12`,key:`jmiej9`}]]};I.node;var ye=u(I),L={name:`git-fork`,size:24,node:[[`circle`,{cx:`12`,cy:`18`,r:`3`,key:`1mpf1b`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`path`,{d:`M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9`,key:`1uq4wg`}],[`path`,{d:`M12 12v3`,key:`158kv8`}]]};L.node;var be=u(L),R={name:`message-circle-question-mark`,size:24,node:[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`message-circle-question`]};R.node;var z=u(R),B=i(fe(),1),V=m();function H({diff:e,className:t}){let n=0,r=0,i=e.split(`
|
|
2
|
-
`).flatMap((e,t)=>{if(/^(diff |index |--- |\+\+\+ )/.test(e))return[];let i=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(e);return i?(n=Number(i[1]),r=Number(i[2]),[{key:t,kind:`hunk`,text:e,a:``,b:``}]):e.startsWith(`+`)?[{key:t,kind:`add`,text:e.slice(1),a:``,b:String(r++)}]:e.startsWith(`-`)?[{key:t,kind:`del`,text:e.slice(1),a:String(n++),b:``}]:e.startsWith(`\\`)?[{key:t,kind:`hunk`,text:e,a:``,b:``}]:[{key:t,kind:`same`,text:e.startsWith(` `)?e.slice(1):e,a:String(n++),b:String(r++)}]});return(0,V.jsx)(`div`,{className:v(`max-h-[420px] overflow-auto rounded-[10px] border border-line-soft bg-bg font-mono text-[12px] leading-[1.6]`,t),children:(0,V.jsx)(`table`,{className:`w-full border-collapse`,children:(0,V.jsx)(`tbody`,{children:i.map(e=>(0,V.jsxs)(`tr`,{className:e.kind===`add`?`bg-pass-soft`:e.kind===`del`?`bg-fail-soft`:e.kind===`hunk`?`bg-surface-muted`:void 0,children:[(0,V.jsx)(`td`,{className:`w-10 px-2 text-right align-top text-muted tabular-nums select-none`,children:e.a}),(0,V.jsx)(`td`,{className:`w-10 px-2 text-right align-top text-muted tabular-nums select-none`,children:e.b}),(0,V.jsx)(`td`,{"aria-hidden":`true`,className:v(`w-4 align-top select-none`,e.kind===`add`?`text-pass`:e.kind===`del`?`text-fail`:`text-muted`),children:e.kind===`add`?`+`:e.kind===`del`?`−`:``}),(0,V.jsxs)(`td`,{className:v(`pr-3 align-top whitespace-pre`,e.kind===`hunk`?`text-muted`:`text-ink`),children:[(0,V.jsx)(`span`,{className:`sr-only`,children:e.kind===`add`?`added: `:e.kind===`del`?`removed: `:``}),e.text||` `]})]},e.key))})})})}var xe={done:`bg-pass/30`,active:`bg-accent/25`,pending:`bg-line`,failed:`bg-fail/30`,skipped:`bg-line`,note:`bg-line`};function U({status:t,orb:n,px:r=20,spin:i=!1}){let a={width:r,height:r};return t===`active`&&i?(0,V.jsx)(`span`,{role:`img`,"aria-label":`At work`,className:`flex flex-none items-center justify-center`,style:a,children:(0,V.jsx)(e,{size:r-2,strokeWidth:2.5,"aria-hidden":`true`,className:`animate-spin text-accent-fg motion-reduce:animate-none`})}):t===`active`?(0,V.jsx)(g,{state:n,px:r,label:`At work`}):t===`done`?(0,V.jsx)(`span`,{role:`img`,"aria-label":`Done`,className:`flex flex-none items-center justify-center rounded-full bg-pass`,style:a,children:(0,V.jsx)(h,{size:r*.6,strokeWidth:3,"aria-hidden":`true`,className:`text-bg`})}):t===`failed`?(0,V.jsx)(`span`,{role:`img`,"aria-label":`Failed`,className:`flex flex-none items-center justify-center rounded-full bg-fail`,style:a,children:(0,V.jsx)(l,{size:r*.6,strokeWidth:3,"aria-hidden":`true`,className:`text-bg`})}):t===`note`?(0,V.jsx)(`span`,{role:`img`,"aria-label":`Note`,className:`flex flex-none items-center justify-center`,style:a,children:(0,V.jsx)(`span`,{className:`size-1.5 rounded-full bg-line-strong`})}):(0,V.jsx)(`span`,{role:`img`,"aria-label":t===`skipped`?`Skipped`:`To come`,className:v(`box-border block flex-none rounded-full border-2 border-line-strong`,t===`skipped`&&`border-dashed`),style:a})}var Se=(e,t)=>e.status===`running`?t?`active`:`done`:e.status===`ok`?`done`:e.status===`fail`?`failed`:`note`,Ce={read:p,search:re,list:c,edit:N,run:ue,element:j,outline:se,references:be,impact:n,find:F,testfile:y,web:_,environment:ce,cases:oe,browser:_,post:de,test:y,retry:pe,review:ne,task:ye,work:b};function we({kind:e}){if(e===`skill`)return(0,V.jsx)(ee,{name:le.skills,px:16,className:`flex-none`});let t=Ce[e];return(0,V.jsx)(t,{size:15,strokeWidth:1.9,"aria-hidden":`true`,className:`mt-px flex-none text-muted`})}var Te=e=>/[/\\]|\.\w{1,5}$|^\$ /.test(e)&&!/\s{2,}/.test(e);function W({text:e}){return(0,V.jsx)(`span`,{className:v(`min-w-0 max-w-full truncate rounded-md bg-surface-strong px-1.5 py-0.5 text-[12.5px] text-ink-2`,Te(e)&&`font-mono text-[12px]`),children:e})}function Ee({step:e}){return(0,V.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] leading-relaxed`,children:e.lines.map((e,t)=>(0,V.jsxs)(`li`,{className:v(`flex gap-1.5 [overflow-wrap:anywhere]`,e.ok===!0?`text-pass`:e.ok===!1?`text-fail`:`text-ink-2`),children:[e.ok!==void 0&&(0,V.jsx)(`span`,{"aria-hidden":`true`,children:e.ok?`✓`:`✗`}),(0,V.jsx)(E,{text:e.text,className:`min-w-0 text-[13px] leading-relaxed text-inherit [&_p]:my-0`})]},t))})}function G({agent:e,named:t=!0,working:n=!1}){let i=f(e);return(0,V.jsxs)(`span`,{className:`inline-flex flex-none items-center gap-1.5`,"data-tip":i.name,children:[(0,V.jsx)(r,{agent:e,px:18,decorative:t,working:n}),t&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`font-medium`,style:{color:i.hue},children:i.name}),(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted`,children:`·`})]})]})}function K({step:e,from:t,live:n}){let i=e.handoff.agent,a=f(i);return(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5`,children:[(0,V.jsx)(r,{agent:t,px:18}),(0,V.jsxs)(`span`,{role:`img`,"aria-label":`hands off to`,className:v(`handoff-flow flex-none`,n&&`is-live`),style:{color:a.hue},children:[(0,V.jsx)(`span`,{}),(0,V.jsx)(`span`,{}),(0,V.jsx)(`span`,{})]}),(0,V.jsx)(r,{agent:i,px:20,decorative:!0,working:n,className:`handoff-in`}),(0,V.jsx)(`span`,{className:`font-medium`,style:{color:a.hue},children:a.name}),e.arg&&(0,V.jsx)(W,{text:e.arg})]})}function q({step:e,working:t,from:n=a}){let r=e.agent||n,i=J(e),o=Se(e,t),[s,c]=(0,B.useState)(null),l=s??((!!e.handoff||!!e.agent||e.key.startsWith(`try:`))&&o===`active`),u=(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(U,{status:o,orb:e.orb,px:16,spin:!0}),e.handoff?(0,V.jsx)(K,{step:e,from:n,live:o===`active`}):(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5`,children:[r!==n||!e.icon?(0,V.jsx)(G,{agent:r,named:r!==n,working:o===`active`}):(0,V.jsx)(we,{kind:e.icon}),(0,V.jsx)(`span`,{className:v(`[overflow-wrap:anywhere]`,o===`active`?`text-ink`:`text-ink-2`),children:e.label}),e.arg&&(0,V.jsx)(W,{text:e.arg}),e.change&&(0,V.jsxs)(`span`,{className:`font-mono text-[12px] tabular-nums`,children:[(0,V.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.change.added]}),` `,(0,V.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.change.removed]})]})]}),i&&(0,V.jsx)(C,{size:14,"aria-hidden":`true`,className:v(`mt-0.5 ml-auto flex-none text-muted transition-transform`,l&&`rotate-180`)})]});return(0,V.jsxs)(`li`,{className:`flex flex-col`,children:[i?(0,V.jsx)(`button`,{type:`button`,"aria-expanded":l,onClick:()=>c(!l),className:`flex min-h-8 w-full cursor-pointer items-start gap-2 rounded-lg border-0 bg-transparent px-1.5 py-1.5 text-left text-[13.5px] hover:bg-surface-muted`,children:u}):(0,V.jsx)(`div`,{className:`flex min-h-8 items-start gap-2 px-1.5 py-1.5 text-[13.5px]`,children:u}),i&&(0,V.jsx)(w,{open:l,children:(0,V.jsx)(Y,{step:e,working:t,from:n,className:`mb-1 ml-[13px]`})})]})}var J=e=>e.lines.length>0||(e.children?.length??0)>0||!!e.handoff?.result||!!e.change;function Y({step:e,working:t,from:n,className:r}){let i=e.children||[],a=e.handoff?.agent||e.agent;return(0,V.jsxs)(`div`,{className:v(`flex flex-col gap-1.5 border-l-2 py-1 pl-3`,r),style:{borderColor:a?`${f(a).hue}66`:`var(--color-line)`},children:[e.lines.length>0&&(0,V.jsx)(Ee,{step:e}),e.change&&(0,V.jsx)(H,{diff:e.change.diff}),i.length>0&&(0,V.jsx)(`ul`,{"aria-label":a?`What ${d(f(a).name)} did`:`Steps`,className:`m-0 flex list-none flex-col p-0`,children:i.map(e=>(0,V.jsx)(q,{step:e,working:t,from:a||n},e.key))}),e.handoff?.result&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-0.5 text-[13px]`,children:[(0,V.jsxs)(`span`,{className:`text-muted`,children:[d(f(e.handoff.agent).name,!0),` answered`]}),(0,V.jsx)(E,{text:e.handoff.result.length>1200?`${e.handoff.result.slice(0,1199)}…`:e.handoff.result,className:`text-[13px] text-ink-2 [&_p]:my-0`})]})]})}function De({node:e,last:t,working:n,now:r,orbed:i}){let a=e.step?[]:e.steps,o=e.step,s=a.length>0||!!r||!!o&&J(o),[c,l]=(0,B.useState)(null),u=c??(e.status===`active`||e.status===`failed`),d=o?.orb??[...a].reverse().find(e=>e.status===`running`)?.orb??r?.orb??`thinking`;return(0,V.jsxs)(`li`,{className:`flex gap-3`,children:[(0,V.jsxs)(`div`,{className:`flex flex-none flex-col items-center`,children:[(0,V.jsx)(`span`,{className:`mt-[3px]`,children:(0,V.jsx)(U,{status:e.status,orb:d,spin:!i})}),!t&&(0,V.jsx)(`span`,{"aria-hidden":`true`,className:v(`mt-1.5 min-h-4 w-0.5 flex-1 rounded-sm`,xe[e.status])})]}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col pb-2`,children:[s?(0,V.jsxs)(`button`,{type:`button`,"aria-expanded":u,onClick:()=>l(!u),className:`flex min-h-7 w-full cursor-pointer items-start gap-1.5 border-0 bg-transparent p-0 text-left`,children:[(0,V.jsx)(X,{node:e}),(0,V.jsx)(C,{size:14,"aria-hidden":`true`,className:v(`mt-1 flex-none text-muted transition-transform`,u&&`rotate-180`)}),e.status===`active`&&(0,V.jsx)(`span`,{className:`mt-0.5 ml-1 flex-none rounded-full border border-accent-line bg-accent-soft px-2 py-px text-[11.5px] font-medium text-accent-fg`,children:`In progress`})]}):(0,V.jsx)(`div`,{className:`min-h-7`,children:(0,V.jsx)(X,{node:e})}),s&&(0,V.jsx)(w,{open:u,className:`mt-0.5`,children:o?(0,V.jsx)(Y,{step:o,working:n,from:`forgeqe`,className:`mt-1`}):(0,V.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[a.map(e=>(0,V.jsx)(q,{step:e,working:n},e.key)),r&&(0,V.jsx)(`li`,{children:(0,V.jsx)(Z,{live:r,className:`px-1.5`})})]})})]})]})}function X({node:e}){let t=e.status===`active`?`text-ink`:e.status===`pending`||e.status===`skipped`?`text-muted`:e.status===`failed`?`text-fail`:`text-ink-2`,n=e.step;return n?.handoff?(0,V.jsx)(K,{step:n,from:a,live:e.status===`active`}):(0,V.jsxs)(`span`,{className:v(`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5 text-sm font-medium`,t,e.status===`skipped`&&`line-through`),children:[n&&(0,V.jsx)(G,{agent:n.agent||`forgeqe`,named:!!n.agent&&n.agent!==`forgeqe`,working:e.status===`active`}),e.status===`active`?(0,V.jsx)(`span`,{className:`shimmer [overflow-wrap:anywhere]`,children:(0,V.jsx)(`span`,{children:e.label})}):(0,V.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.label}),n?.arg&&(0,V.jsx)(W,{text:n.arg})]})}var Oe={info:`text-ink-2`,ok:`text-pass`,fail:`text-fail`,warn:`text-warn`,dim:`text-muted`,say:`text-ink-2`,you:`text-accent-fg`,think:`text-muted italic`};function ke(e){let[t,n]=(0,B.useState)(()=>Date.now());(0,B.useEffect)(()=>{let e=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(e)},[]);let r=e?Date.parse(e):NaN;if(Number.isNaN(r))return``;let i=Math.max(0,Math.round((t-r)/1e3));return i<2?`just now`:i<60?`${i}s ago`:`${Math.floor(i/60)} min ago`}function Z({live:e,orb:t=!1,className:n}){let r=ke(e.latest?.at);return(0,V.jsxs)(`div`,{className:v(`flex min-h-8 items-start gap-2 py-1`,n),children:[(0,V.jsx)(`span`,{className:`mt-0.5 flex size-4 flex-none items-center justify-center`,children:t?(0,V.jsx)(g,{state:e.orb,px:20,label:`At work`}):(0,V.jsxs)(`span`,{"aria-hidden":`true`,className:`relative flex size-2`,children:[(0,V.jsx)(`span`,{className:`absolute inline-flex size-full animate-ping rounded-full bg-accent opacity-60 motion-reduce:animate-none`}),(0,V.jsx)(`span`,{className:`relative inline-flex size-2 rounded-full bg-accent`})]})}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,V.jsx)(`span`,{className:`shimmer text-[13.5px] font-medium text-muted`,children:(0,V.jsx)(`span`,{"aria-live":`polite`,children:e.text})}),e.latest&&(0,V.jsxs)(`button`,{type:`button`,onClick:e.onLog,"data-tip":`Open the activity log`,className:`flex w-full min-w-0 cursor-pointer items-baseline gap-2 border-0 bg-transparent p-0 text-left hover:underline`,children:[(0,V.jsx)(`span`,{className:v(`min-w-0 truncate font-mono text-[12px]`,Oe[e.latest.tone]),children:e.latest.plain}),(0,V.jsxs)(`span`,{className:`flex-none text-[11.5px] whitespace-nowrap text-muted tabular-nums`,children:[r,r&&` · `,e.events,` `,e.events===1?`event`:`events`]})]})]})]})}function Ae({turn:e,working:t,live:n,folded:r=!1}){if(r)return(0,V.jsx)(Z,{live:n,orb:!0});let i=ve(e,t),a=e.plan.length>0&&t?i.find(e=>e.status===`active`)??null:null,o=t&&!a?[{key:`now`,label:n.text,status:`active`,steps:[]}]:[],s=[...i,...o],c=[...i].reverse().find(e=>e.status===`active`);return(0,V.jsx)(`ol`,{"aria-label":`What ForgeQE did`,className:`m-0 flex list-none flex-col p-0 pt-1`,children:s.map((e,r)=>e.key===`now`?(0,V.jsx)(`li`,{className:`flex gap-3`,children:(0,V.jsx)(Z,{live:n,orb:!c,className:`-mt-1 min-w-0 flex-1 py-0`})},`now`):(0,V.jsx)(De,{node:e,last:r===s.length-1,working:t,now:a===e?n:void 0,orbed:c===e},e.key))})}var je={passed:`Passed`,failed:`Failed`,stopped:`Stopped`,blocked:`Blocked`};function Q({label:e,children:t}){return(0,V.jsxs)(`div`,{className:`grid grid-cols-[110px_minmax(0,1fr)] items-baseline gap-3 py-1.5 text-sm`,children:[(0,V.jsx)(`span`,{className:`text-muted`,children:e}),(0,V.jsx)(`div`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:t})]})}function Me({text:e}){let[t,n]=(0,B.useState)(!1);return(0,V.jsxs)(`div`,{className:`flex items-start gap-2 rounded-[10px] bg-surface-muted px-3 py-2`,children:[(0,V.jsx)(s,{icon:x,size:14,className:`mt-0.5 flex-none text-muted`}),(0,V.jsx)(`code`,{className:`min-w-0 flex-1 font-mono text-[12.5px] break-all whitespace-pre-wrap text-ink`,children:e}),(0,V.jsx)(`button`,{type:`button`,"aria-label":t?`Copied`:`Copy the command`,onClick:async()=>{await he(e)&&(n(!0),setTimeout(()=>n(!1),1500))},className:`inline-flex size-7 flex-none cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted hover:bg-surface-strong hover:text-ink`,children:t?(0,V.jsx)(h,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,V.jsx)(T,{size:14,"aria-hidden":`true`})})]})}function Ne({t:e}){return(0,V.jsxs)(`div`,{className:`flex flex-col`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pb-1`,children:[(0,V.jsx)(s,{icon:y,size:16,className:`text-accent-fg`}),(0,V.jsx)(`span`,{className:`font-medium`,children:`Test written`}),(0,V.jsx)(te,{tone:e.ok?`pass`:e.status===`stopped`?`neutral`:`fail`,children:je[e.status]||e.status||`Not written`}),e.attempts!==void 0&&(0,V.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.maxAttempts?`attempt ${e.attempts} of ${e.maxAttempts}`:o(e.attempts,`attempt`)})]}),e.testFile&&(0,V.jsx)(Q,{label:`Test file`,children:(0,V.jsx)(D,{path:e.testFile})}),e.testName&&(0,V.jsx)(Q,{label:`Test`,children:(0,V.jsx)(`code`,{className:`font-mono text-[12.5px]`,children:e.testName})}),e.command&&(0,V.jsx)(Q,{label:`Run it`,children:(0,V.jsx)(Me,{text:e.command})}),e.runDir&&(0,V.jsx)(Q,{label:`From the run`,children:(0,V.jsx)(D,{path:e.runDir})}),e.reused.length>0&&(0,V.jsx)(Q,{label:`Reused`,children:(0,V.jsx)(`span`,{className:`flex flex-wrap gap-x-2 gap-y-1`,children:e.reused.map(e=>(0,V.jsx)(D,{path:e},e))})}),e.error&&(0,V.jsx)(`p`,{className:`m-0 mt-1 rounded-[10px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e.error})]})}function Pe({c:e}){let[t,n]=(0,B.useState)(!1);return(0,V.jsxs)(`li`,{className:`flex flex-col`,children:[(0,V.jsxs)(`div`,{className:`flex min-h-9 items-center gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,"aria-expanded":t,"aria-label":`${t?`Hide`:`Show`} the changes to ${e.path}`,onClick:()=>n(!t),className:`inline-flex size-7 flex-none cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted hover:bg-surface-strong hover:text-ink`,children:(0,V.jsx)(C,{size:15,"aria-hidden":`true`,className:v(`transition-transform`,!t&&`-rotate-90`)})}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,V.jsx)(D,{path:e.path})}),(0,V.jsxs)(`span`,{className:`flex-none font-mono text-[12px] tabular-nums`,children:[(0,V.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.added]}),` `,(0,V.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.removed]})]})]}),(0,V.jsx)(w,{open:t,children:(0,V.jsx)(H,{diff:e.diff,className:`mb-2 ml-9`})})]})}function Fe({turn:e}){let t=e.reports.filter((e,t,n)=>n.findIndex(t=>t.path===e.path)===t),n=new Set(e.changes.map(e=>e.path)),r=[...new Set(e.tests.flatMap(e=>e.changed))].filter(e=>!n.has(e)&&![...n].some(t=>t.endsWith(e)||e.endsWith(t)));return!e.tests.length&&!t.length&&!e.changes.length&&!r.length?null:(0,V.jsxs)(`section`,{"aria-label":`Result`,className:`flex flex-col gap-4 rounded-[14px] card border px-4 py-3`,children:[e.tests.map((e,t)=>(0,V.jsx)(Ne,{t:e},t)),t.length>0&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,V.jsx)(`span`,{className:`text-sm font-medium`,children:`Reports`}),(0,V.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-sm`,children:t.map(e=>(0,V.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,V.jsx)(`span`,{className:`text-ink-2`,children:e.label}),(0,V.jsx)(D,{path:e.path})]},e.path))})]}),(e.changes.length>0||r.length>0)&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,V.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm font-medium`,children:[(0,V.jsx)(ie,{size:15,"aria-hidden":`true`,className:`text-muted`}),`Files changed`,(0,V.jsxs)(`span`,{className:`font-normal text-muted`,children:[o(e.changes.length+r.length,`file`),` · `,(0,V.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.changes.reduce((e,t)=>e+t.added,0)]}),` `,(0,V.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.changes.reduce((e,t)=>e+t.removed,0)]})]})]}),(0,V.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[e.changes.map(e=>(0,V.jsx)(Pe,{c:e},e.path)),r.map(e=>(0,V.jsx)(`li`,{className:`flex min-h-9 items-center gap-2 pl-9`,children:(0,V.jsx)(D,{path:e})},e))]})]})]})}function $({lines:e,start:t,live:n,name:r}){let i=(0,B.useRef)(null),a=(0,B.useRef)(!0),[o,c]=(0,B.useState)(!1),l=(0,B.useMemo)(()=>_e(e,t),[e,t]);(0,B.useEffect)(()=>{a.current&&i.current&&(i.current.scrollTop=i.current.scrollHeight)},[l]);let u=`inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-lg border-0 bg-transparent px-2 text-[12px] font-medium text-muted hover:bg-surface-strong hover:text-ink`;return(0,V.jsxs)(`div`,{className:`overflow-hidden rounded-[12px] card border`,children:[(0,V.jsxs)(`div`,{className:`flex min-h-9 items-center gap-1 border-b border-line-soft pr-1 pl-3 text-[12px] text-muted`,children:[(0,V.jsxs)(`span`,{className:`flex-1`,children:[`Markdown · `,e.length,` event`,e.length===1?``:`s`,n&&` · live`]}),(0,V.jsxs)(`button`,{type:`button`,"aria-label":o?`Copied`:`Copy the activity log as Markdown`,onClick:async()=>{try{await navigator.clipboard.writeText(l),c(!0),setTimeout(()=>c(!1),1500)}catch{}},className:u,children:[o?(0,V.jsx)(h,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,V.jsx)(T,{size:14,"aria-hidden":`true`}),o?`Copied`:`Copy`]}),(0,V.jsxs)(`button`,{type:`button`,"aria-label":`Download the activity log as a Markdown file`,onClick:()=>{let e=URL.createObjectURL(new Blob([l],{type:`text/markdown;charset=utf-8`})),t=document.createElement(`a`);t.href=e,t.download=r,t.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3)},className:u,children:[(0,V.jsx)(s,{icon:S,size:14}),`.md`]})]}),(0,V.jsx)(`div`,{ref:i,role:`log`,"aria-label":`Activity log`,onScroll:e=>{let t=e.currentTarget;a.current=t.scrollTop+t.clientHeight>=t.scrollHeight-24},className:`max-h-[360px] overflow-y-auto px-4 py-2`,children:(0,V.jsx)(E,{text:l,className:`text-[13px] leading-[1.6] [&_code]:text-[12px] [&_h4]:mt-3 [&_h4]:mb-1 [&_li]:my-0.5 [&_pre]:text-[12px] [&_ul]:my-1`})})]})}function Ie({ask:e,live:n,onAnswer:r}){let i=n&&e.answer===void 0;return(0,V.jsxs)(`div`,{className:v(`flex flex-col gap-3 rounded-[14px] border px-4 py-3`,i?`border-accent-line bg-accent-soft`:`card`),children:[(0,V.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,V.jsx)(z,{size:18,"aria-hidden":`true`,className:`mt-0.5 flex-none text-accent-fg`}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:e.title}),e.detail&&(0,V.jsx)(`span`,{className:`text-sm text-ink-2`,children:e.detail}),e.lines.map((e,t)=>(0,V.jsx)(`span`,{className:`text-sm text-ink-2 [overflow-wrap:anywhere]`,children:e},t))]})]}),i?(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.options.map(e=>(0,V.jsx)(t,{size:`sm`,onClick:()=>r(e.id),children:e.label},e.id)),!e.options.some(e=>e.id===`cancel`||e.label.trim().toLowerCase()===`cancel`)&&(0,V.jsx)(t,{size:`sm`,variant:`ghost`,onClick:()=>r(null),children:`Cancel`})]}):(0,V.jsx)(`span`,{className:`text-sm text-muted`,children:e.answer===void 0?`Not answered`:`You chose: ${e.answer}`})]})}function Le({wait:e,live:n,onProceed:r}){let i=n&&e.answer===void 0;return(0,V.jsxs)(`div`,{className:v(`flex flex-col gap-3 rounded-[14px] border px-4 py-3`,i?`border-accent-line bg-accent-soft`:`card`),children:[(0,V.jsxs)(`span`,{className:`flex items-start gap-2`,children:[(0,V.jsx)(me,{size:18,"aria-hidden":`true`,className:`mt-0.5 flex-none text-accent-fg`}),(0,V.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.prompt})]}),i?(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,V.jsx)(t,{size:`sm`,variant:`primary`,onClick:()=>r(!0),children:`Done, continue`}),(0,V.jsx)(t,{size:`sm`,onClick:()=>r(!1),children:`Cancel`})]}):(0,V.jsx)(`span`,{className:`text-sm text-muted`,children:e.answer===void 0?`Not done`:e.answer?`You continued`:`You cancelled`})]})}function Re({turn:e,live:t,onAnswer:n,onProceed:i}){let a=t&&!e.outcome,[o,c]=(0,B.useState)(null),l=o??a,u=k(e),d=a?u.text:ge(e),f=e.parts.map(e=>O(e.text)).filter(Boolean),[p,m]=(0,B.useState)(!1),h=[...e.log].reverse().find(e=>e.tone!==`you`&&e.tone!==`say`);return(0,V.jsxs)(`div`,{className:`flex gap-3`,children:[(0,V.jsx)(`div`,{className:`size-9 flex-none`,"aria-hidden":`true`,children:(0,V.jsx)(r,{agent:`forgeqe`,px:34,working:a,className:`mt-0.5`})}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3 pt-1.5`,children:[(e.steps.length>0||a||e.log.length>0)&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,V.jsxs)(`button`,{type:`button`,"aria-expanded":l,disabled:!e.steps.length&&!e.plan.length,onClick:()=>c(!l),className:v(`flex cursor-pointer items-center gap-1.5 border-0 bg-transparent p-0 text-sm font-medium text-muted hover:text-ink disabled:cursor-default`,a&&`shimmer`),children:[(0,V.jsx)(`span`,{"aria-live":`polite`,children:d}),(e.steps.length>0||e.plan.length>0)&&(0,V.jsx)(C,{size:16,"aria-hidden":`true`,className:v(`transition-transform`,l&&`rotate-180`)})]}),e.log.length>0&&(0,V.jsxs)(`button`,{type:`button`,"aria-expanded":p,onClick:()=>m(!p),className:`ml-auto inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-lg border-0 bg-transparent px-2 text-[13px] font-medium text-muted hover:bg-surface-muted hover:text-ink`,children:[(0,V.jsx)(s,{icon:ae,size:14}),`Activity log`,(0,V.jsx)(`span`,{className:`tabular-nums`,children:e.log.length})]})]}),(0,V.jsx)(w,{open:(l||a)&&(e.steps.length>0||e.plan.length>0||a),children:(0,V.jsx)(Ae,{turn:e,working:a,folded:!l,live:{...u,latest:h,events:e.log.length,onLog:()=>m(!0)}})}),(0,V.jsx)(w,{open:p,children:(0,V.jsx)($,{lines:e.log,start:e.started||e.log[0]?.at,live:a,name:`forgeqe-activity-${e.id}.md`})})]}),e.asks.map(e=>(0,V.jsx)(Ie,{ask:e,live:a,onAnswer:t=>n(e.id,t)},e.id)),e.waits.map(e=>(0,V.jsx)(Le,{wait:e,live:a,onProceed:t=>i(e.id,t)},e.id)),e.outcome&&e.reply?(0,V.jsx)(E,{text:e.reply}):f.length>0&&(0,V.jsx)(E,{text:f.join(`
|
|
3
|
-
|
|
4
|
-
`)}),(0,V.jsx)(Fe,{turn:e}),e.error&&(0,V.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e.error}),e.outcome===`stopped`&&!e.reply&&(0,V.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Stopped.`})]})]})}export{Re as n,H as r,$ as t};
|