@capagents/forgeqe 3.4.4 → 3.4.5

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.
Files changed (64) hide show
  1. package/dist/forgeqe.js +1930 -1930
  2. package/dist/web/assets/{3d-force-graph-DwblDu4y.js → 3d-force-graph-Bv0L0GYY.js} +1 -1
  3. package/dist/web/assets/{Agent-C8WdS1HB.js → Agent-CxEcSdpb.js} +1 -1
  4. package/dist/web/assets/{AgentWork-C1Qa_Ftb.js → AgentWork-pz5zDHe7.js} +1 -1
  5. package/dist/web/assets/{ApiTests-u4tzlJaD.js → ApiTests-Cvuu_jpF.js} +1 -1
  6. package/dist/web/assets/{Browse-B0ZTvpo2.js → Browse-CugNbc8C.js} +1 -1
  7. package/dist/web/assets/{Chat-B73XMxdf.js → Chat-Tqqg4JUL.js} +1 -1
  8. package/dist/web/assets/{CommandPalette-D7ld-tbJ.js → CommandPalette-DvSYdMC_.js} +1 -1
  9. package/dist/web/assets/{Compare-CxGjAZW0.js → Compare-CVdloZNm.js} +1 -1
  10. package/dist/web/assets/{Cost-BeVu3Z6g.js → Cost-Bm4Dqpwr.js} +1 -1
  11. package/dist/web/assets/{Data-BPyCT0eP.js → Data-CGjaHLjI.js} +1 -1
  12. package/dist/web/assets/{Desktop-qPGc2OWb.js → Desktop-BbTWto2U.js} +1 -1
  13. package/dist/web/assets/{DesktopReview-CVoC6bQY.js → DesktopReview-Cw2ODskw.js} +1 -1
  14. package/dist/web/assets/{Evidence-CtUiUCa6.js → Evidence-DjY7OEs8.js} +1 -1
  15. package/dist/web/assets/{Explore-BvjAhqyo.js → Explore-BB-c2iyf.js} +1 -1
  16. package/dist/web/assets/{Features-CmQCxEJX.js → Features-DLJ0o5mQ.js} +1 -1
  17. package/dist/web/assets/{Flags-asj8tiKy.js → Flags-BF4LF0Sn.js} +1 -1
  18. package/dist/web/assets/{Flaky-ChYK151U.js → Flaky-DKEWWH_N.js} +1 -1
  19. package/dist/web/assets/{Impact-B1-B2oHr.js → Impact-BYfBT4ng.js} +1 -1
  20. package/dist/web/assets/{Jobs-CZ2k5hGk.js → Jobs-DwPYSmQp.js} +1 -1
  21. package/dist/web/assets/{KindPage-CDfvpDXP.js → KindPage-CNSIw8EU.js} +1 -1
  22. package/dist/web/assets/{LiveDevice-B33XU61P.js → LiveDevice-Bzz5k4my.js} +1 -1
  23. package/dist/web/assets/{Migration-BBM_Sce0.js → Migration-B8FRhxpQ.js} +1 -1
  24. package/dist/web/assets/{Mobile-BzufjlBb.js → Mobile-DDg3lrvO.js} +1 -1
  25. package/dist/web/assets/{Observability-qcx5vrNO.js → Observability-S_GxyR80.js} +1 -1
  26. package/dist/web/assets/{OwnItems-BkoHG_xw.js → OwnItems-CGD8lZsA.js} +1 -1
  27. package/dist/web/assets/{PageAgent-Do62EBze.js → PageAgent-CUicHm1M.js} +1 -1
  28. package/dist/web/assets/{Product-9ImZUA2B.js → Product-D0HVqFU9.js} +2 -2
  29. package/dist/web/assets/{Production-B6uigaYJ.js → Production-D4qoP1EY.js} +1 -1
  30. package/dist/web/assets/{Quality-Cw6qhXyl.js → Quality-BeNUMygb.js} +1 -1
  31. package/dist/web/assets/{Readiness-D8WMgQmd.js → Readiness-BKh3XR-d.js} +1 -1
  32. package/dist/web/assets/Record-CEY5wJ5f.js +1 -0
  33. package/dist/web/assets/{Regression-BLlXnCW2.js → Regression-DVQujWFy.js} +1 -1
  34. package/dist/web/assets/{RelationGraph-BxJgWpp6.js → RelationGraph-5GEqITmu.js} +1 -1
  35. package/dist/web/assets/{Reports-ZNS4Vjz8.js → Reports-C7R9gb02.js} +1 -1
  36. package/dist/web/assets/{Requirements-CtQLSXK2.js → Requirements-FCu-HkXc.js} +1 -1
  37. package/dist/web/assets/{Responsive-KaTTxiwX.js → Responsive-DwXdPKww.js} +1 -1
  38. package/dist/web/assets/{RunDiff-CpvrxBX1.js → RunDiff-UU3jCTyW.js} +1 -1
  39. package/dist/web/assets/{Settings-C5CTbhlT.js → Settings-BkjUlPMQ.js} +3 -3
  40. package/dist/web/assets/{SiteScan-CUMCTEY9.js → SiteScan-CNCGcPQX.js} +1 -1
  41. package/dist/web/assets/{Steps-C440M1Y_.js → Steps-CYDb_3OH.js} +1 -1
  42. package/dist/web/assets/{TestData-7rivojlz.js → TestData-CE5vC330.js} +1 -1
  43. package/dist/web/assets/{TestManagement-Dj5JHPIU.js → TestManagement-CxcJI04K.js} +1 -1
  44. package/dist/web/assets/{WhatsNew-xAi2Rzo3.js → WhatsNew-CIg0ienp.js} +1 -1
  45. package/dist/web/assets/{agentSettingsSheet-D12LwTAe.js → agentSettingsSheet-CLWVrbZy.js} +1 -1
  46. package/dist/web/assets/api-D1PU4zye.js +1 -0
  47. package/dist/web/assets/{dataParts-CVXmPBpU.js → dataParts-uqmYw8V2.js} +1 -1
  48. package/dist/web/assets/{desktopAppPath-D_PfQisd.js → desktopAppPath-DUEjQMmN.js} +1 -1
  49. package/dist/web/assets/{flowTheme-bdKXfQiL.js → flowTheme-ZJk8bNiH.js} +1 -1
  50. package/dist/web/assets/{frame-BC1vOowF.js → frame-D0MS2ZMz.js} +3 -3
  51. package/dist/web/assets/{index-BoFziUZw.js → index-F8zkXd19.js} +4 -4
  52. package/dist/web/assets/{nav--1SY7-OO.js → nav-CkrE6JFU.js} +1 -1
  53. package/dist/web/assets/{pageBack-DDAAmq4R.js → pageBack-DfGBh1Hs.js} +1 -1
  54. package/dist/web/assets/{palette-C8W4Fd5n.js → palette-dAh9kV3S.js} +1 -1
  55. package/dist/web/assets/{parts-uc6us_OU.js → parts-DqfD-6Qb.js} +1 -1
  56. package/dist/web/assets/{productParts-CAgJEF8_.js → productParts-CCceBbIo.js} +1 -1
  57. package/dist/web/assets/{qualityParts-BF3Yb7Zl.js → qualityParts-DcRvGy-_.js} +1 -1
  58. package/dist/web/assets/{recordTest-KjXCSP7c.js → recordTest-DN3Kl6PB.js} +1 -1
  59. package/dist/web/assets/{stepper-CZL9ueYn.js → stepper-DiPQQ2l6.js} +1 -1
  60. package/dist/web/assets/{wizardParts-Pzx0nTZ0.js → wizardParts-CnCYTsR0.js} +1 -1
  61. package/dist/web/index.html +6 -6
  62. package/package.json +1 -1
  63. package/dist/web/assets/Record-DCcHfH7u.js +0 -1
  64. package/dist/web/assets/api-CorvgyDj.js +0 -1
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{n,r}from"./route-9BkoTWUE.js";import{I as i,L as a,P as o,V as s,c,i as l,s as u}from"./surface-c1kG1KPS.js";import{n as d,t as f}from"./utils-DJRAScIl.js";import{t as p}from"./jsx-runtime-LKYXHABd.js";import{I as m}from"./palette-C8W4Fd5n.js";import{O as h}from"./api-CorvgyDj.js";import{A as g,F as _,I as v,L as y,O as b,P as x,T as ee,d as S,g as te,k as C,n as w,o as ne}from"./pageBack-DDAAmq4R.js";import{B as T,D as re,E,Er as D,Gr as O,Jn as k,N as A,Nt as ie,O as ae,R as j,Tt as oe,Vn as se,Wr as ce,Yn as M,Zt as le,_ as ue,cn as N,cr as de,ir as fe,it as pe,k as me,on as he,pt as ge,vn as _e,w as ve,x as ye,xt as be,yn as xe,z as Se}from"./line-icons-Cwj9OmCz.js";import{At as Ce,K as we,Q as Te,Z as P,ct as Ee,dt as De,lt as Oe,ot as ke,rt as F,s as Ae,t as je,ut as Me}from"./frame-BC1vOowF.js";import{B as I,K as Ne,L as Pe,V as L,Y as Fe,z as Ie}from"./index-BoFziUZw.js";import{i as R,r as z}from"./productParts-CAgJEF8_.js";var B=e(t(),1),V=p(),Le={"forgeqe-session":`ForgeQE session`,otlp:`OpenTelemetry trace`,jsonl:`the agent's own log`,langfuse:`Langfuse`,langsmith:`LangSmith`},Re={tool:ce,model:de,say:_e,plan:N,handoff:k,ask:_e,policy:fe,error:D},ze={text:`What it said`,file_change:`A file it changed`,report:`A report`,test_result:`A test result`,message:`A message it sent`},Be={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`},H=e=>e.replace(/[\u0000-\u0008\u000b-\u001f\u007f-\u009f\u2028\u2029]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`),U=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`})},W=25,G={PASS:{tone:`pass`,label:`Pass`},WARN:{tone:`warn`,label:`Warning`},FAIL:{tone:`fail`,label:`Fail`},UNKNOWN:{tone:`neutral`,label:`Not known`}},K={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`},Ve={build:{title:`Does the change work?`,icon:oe},behaviour:{title:`Did it work the agreed way?`,icon:T},decisions:{title:`Did it decide on the right grounds, with data it may use?`,icon:M},content:{title:`Was its answer right: on topic, grounded, complete?`,icon:ge},domain:{title:`Was its change right for the product?`,icon:ue}},q=200,He=`Agent governance`;function J({id:e,back:t=!0,children:n}){let r=Pe.some(t=>t.id===e);return(0,V.jsxs)(V.Fragment,{children:[t&&(0,V.jsx)(w,{}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,V.jsxs)(`span`,{className:`flex items-center gap-4`,children:[(0,V.jsx)(Ce,{pixel:m[r?Pe[0].id:e],size:`lg`,head:!0}),(0,V.jsx)(`h1`,{className:`m-0 text-headline-md`,children:r?He:n})]}),r&&(0,V.jsx)(we,{label:`Governance`,links:Pe,current:e})]})]})}function Y({shape:e=`rows`}){return(0,V.jsx)(te,{shape:e})}function X(){return(0,V.jsxs)(g,{page:!0,icon:oe,title:`No agent run recorded yet`,action:(0,V.jsx)(`a`,{href:`/help/guide`,target:`_blank`,rel:`noreferrer noopener`,className:v({size:`sm`}),children:`Read how to record a run`}),children:[`An agent's runs show here once they are recorded: while it runs, from its traces, or afterwards, from an export or its own log. At a terminal that is `,(0,V.jsx)(`code`,{children:`forgeqe evidence receive`}),` or `,(0,V.jsx)(`code`,{children:`forgeqe evidence record`}),`.`]})}var Ue=(0,V.jsxs)(V.Fragment,{children:[`Receive an agent's OpenTelemetry traces while it runs with `,(0,V.jsx)(`code`,{children:`forgeqe evidence receive`}),`; record a file with `,(0,V.jsx)(`code`,{children:`forgeqe evidence record`}),`: an OpenTelemetry export, a Langfuse or LangSmith export, an agent's own JSON log with `,(0,V.jsx)(`code`,{children:`--mapping mapping.yaml`}),`, or ForgeQE's own last session with `,(0,V.jsx)(`code`,{children:`--latest`}),`.`]});function We({refused:e}){return e.length?(0,V.jsxs)(`section`,{"aria-label":`Files that are not run records`,className:f(y.warn,`flex flex-col gap-1`),children:[(0,V.jsxs)(`span`,{className:`font-medium`,children:[d(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,V.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e},e))]}):null}function Ge(){let[e,t]=(0,B.useState)(null),[n,i]=(0,B.useState)(``);return(0,B.useEffect)(()=>{h.overview().then(t,e=>i(e.message))},[]),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(J,{id:`evidence`,children:`Evidence`}),(0,V.jsx)(L,{more:(0,V.jsxs)(V.Fragment,{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. `,Ue]}),children:`See what your AI agents did and decided, and whether it was what was agreed.`}),n&&(0,V.jsx)(z,{text:n}),!e&&!n&&(0,V.jsx)(Y,{shape:`detail`}),e&&(0,V.jsx)(We,{refused:e.refused}),e&&!e.runs&&(0,V.jsx)(X,{}),e&&e.runs>0&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(Ie,{label:`What is recorded`,children:[(0,V.jsx)(I,{dot:`neutral`,value:e.runs,label:e.runs===1?`run recorded`:`runs recorded`}),(0,V.jsx)(I,{dot:`neutral`,value:e.agents.length,label:e.agents.length===1?`agent`:`agents`})]}),(0,V.jsx)(`h2`,{className:`sr-only`,children:`What is recorded`}),(0,V.jsx)(R,{id:`agents`,title:`Agents`,icon:de,n:e.agents.length,children:(0,V.jsx)(`ul`,{"aria-label":`Agents`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 list-none`),children:e.agents.map(e=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(`a`,{href:r(`evidence`,encodeURIComponent(e.name)),className:f(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`min-h-12 flex-wrap gap-x-4 gap-y-1`),children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_320px] flex-col`,children:[(0,V.jsx)(`span`,{className:`truncate text-body-sm font-medium`,children:H(e.name)}),(0,V.jsxs)(`span`,{className:`truncate text-body-sm text-muted`,children:[e.versions.length?`versions ${e.versions.slice(0,4).join(`, `)}${e.versions.length>4?`, …`:``} · `:``,`from `,e.sources.map(e=>Le[e]||e).join(`, `)]})]}),(0,V.jsx)(`span`,{className:`text-body-sm text-ink-2 tabular-nums`,children:d(e.runs,`run`)}),(0,V.jsx)(`span`,{className:`text-body-sm text-ink-2 tabular-nums`,children:d(e.decisions,`decision`)}),(0,V.jsxs)(`span`,{className:`text-body-sm text-muted tabular-nums`,children:[d(e.gaps,`thing`,`things`),` not known`]}),(0,V.jsx)(`span`,{className:`text-body-sm 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=>d(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,V.jsx)(`span`,{className:`text-body-sm text-muted tabular-nums`,"data-tip":U(e.last),children:e.last?P(e.last):``})]})},e.name))})})]})]})}var Z={PASS:`Passed`,WARN:`Warned`,FAIL:`Failed`,UNKNOWN:`Not known`,NONE:`Not judged`};function Ke({t:e,label:t,on:n,onToggle:r,fail:i}){return e.n?(0,V.jsx)(_,{variant:`link`,size:`inline`,"aria-pressed":n,"aria-label":`${e.n}: ${t}. Show the runs`,onClick:r,className:f(`min-h-7 min-w-7 justify-end rounded-full px-2 tabular-nums aria-pressed:bg-accent-soft`,i&&!n&&`text-fail`),children:e.n}):(0,V.jsx)(`span`,{className:`inline-flex min-h-7 items-center justify-end px-2 text-muted tabular-nums`,children:`0`})}function qe({pick:e,d:t,onClose:n}){let[i,a]=(0,B.useState)(!1),o=i?e.runs:e.runs.slice(0,25);return(0,V.jsxs)(`div`,{className:f(u,`flex flex-col gap-2`),children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsxs)(`span`,{className:`text-body-sm font-medium text-ink [overflow-wrap:anywhere]`,children:[d(e.runs.length,`run`),` behind `,H(e.label)]}),(0,V.jsxs)(_,{size:`sm`,variant:`outline`,onClick:n,children:[(0,V.jsx)(O,{"aria-hidden":`true`}),`Close`]})]}),(0,V.jsx)(`ul`,{"aria-label":`Runs behind ${e.label}`,className:`m-0 list-none border-t border-line-soft py-1`,children:o.map(e=>{let n=t.brief[e];return(0,V.jsx)(`li`,{children:(0,V.jsxs)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e)),className:f(s,`grid min-h-10 grid-cols-[auto_minmax(0,1fr)_auto] gap-x-4`),children:[n&&n.status!==`NONE`?(0,V.jsx)(C,{tone:G[n.status].tone,children:G[n.status].label}):(0,V.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not judged`}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,V.jsx)(`span`,{className:`truncate text-body-sm`,children:H(n?.request||e)}),(0,V.jsxs)(`span`,{className:`truncate font-mono text-body-sm text-muted`,children:[e,n?.version?` · ${H(n.version)}`:``]})]}),(0,V.jsx)(`span`,{className:`text-right text-body-sm text-muted tabular-nums`,"data-tip":U(n?.started),children:n?.started?P(n.started):``})]})},e)})}),e.runs.length>o.length&&(0,V.jsxs)(_,{size:`sm`,variant:`ghost`,onClick:()=>a(!0),children:[(0,V.jsx)(E,{"aria-hidden":`true`}),`All (`,e.runs.length,`)`]})]})}function Je({agent:e}){let[t,n]=(0,B.useState)(null),[a,o]=(0,B.useState)(``),[s,c]=(0,B.useState)(null),[l,u]=(0,B.useState)(null);(0,B.useEffect)(()=>{h.dashboard(e).then(n,e=>o(e.message))},[e]);let d=e=>e?H(e):`no version`,p=t?t.versions.find(e=>e.version===s)||t.versions[0]:void 0,m=e=>l&&t&&l.key.startsWith(`${e}|`)?(0,V.jsx)(qe,{pick:l,d:t,onClose:()=>u(null)},l.key):null,g=(e,t,n,r)=>{let i=`${e}|${n}`;return(0,V.jsx)(Ke,{t,label:n,on:l?.key===i,onToggle:()=>u(l?.key===i?null:{key:i,label:n,runs:t.runs}),fail:r})};return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(w,{to:{href:r(`evidence`),label:`Evidence`}}),(0,V.jsx)(J,{id:`evidence`,back:!1,children:H(e)}),(0,V.jsx)(L,{more:(0,V.jsx)(V.Fragment,{children:`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.`}),children:`How this agent's runs were judged, version by version and week by week.`}),a&&(0,V.jsx)(z,{text:a}),!t&&!a&&(0,V.jsx)(Y,{shape:`detail`}),t?.problems.map(e=>(0,V.jsx)(z,{text:e},e)),t&&p&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-1 text-body-sm`,children:[(0,V.jsxs)(Ie,{label:`Its runs and versions`,children:[(0,V.jsx)(I,{dot:`neutral`,value:t.runs.n,label:t.runs.n===1?`run`:`runs`}),(0,V.jsx)(I,{dot:`neutral`,value:t.versions.length,label:t.versions.length===1?`version`:`versions`})]}),(0,V.jsx)(`a`,{href:r(`evidence-runs`,`agent`,encodeURIComponent(e)),children:`All its runs`}),(0,V.jsx)(`a`,{href:r(`evidence-learn`,encodeURIComponent(e)),children:`What to change`})]}),(0,V.jsx)(`h2`,{className:`sr-only`,children:`Its numbers`}),(0,V.jsxs)(R,{id:`versions`,title:`Versions`,icon:ie,n:t.versions.length,children:[(0,V.jsx)(F,{label:`Versions of ${e}`,search:!1,minWidth:640,head:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Version`}),[`Runs`,`Passed`,`Warned`,`Failed`,`Not known`,`Not judged`].map(e=>(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:e},e)),(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Last run`})]}),children:t.versions.map(e=>(0,V.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,V.jsx)(`th`,{scope:`row`,className:f(`px-4 py-2`,`text-left font-medium`),children:d(e.version)}),(0,V.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-sort":e.runs.n,children:g(`versions`,e.runs,`${d(e.version)}: runs`)}),[`PASS`,`WARN`,`FAIL`,`UNKNOWN`,`NONE`].map(t=>(0,V.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-sort":e.outcome[t].n,children:g(`versions`,e.outcome[t],`${d(e.version)}: ${Z[t].toLowerCase()}`,t===`FAIL`)},t)),(0,V.jsx)(`td`,{className:f(`px-4 py-2`,`text-muted`),"data-tip":U(e.last),"data-sort":e.last&&Date.parse(e.last)||0,children:e.last?P(e.last):``})]},e.version))}),m(`versions`)]}),t.versions.length>1&&t.benchmark.length>0&&(0,V.jsxs)(R,{id:`benchmark`,title:`Versions side by side`,icon:M,children:[(0,V.jsx)(`p`,{className:`m-0 text-body-sm 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,V.jsx)(F,{label:`Versions side by side`,search:!1,minWidth:480,head:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Check`}),t.versions.map(e=>(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:d(e.version)},e.version))]}),children:t.benchmark.map(e=>(0,V.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,V.jsx)(`th`,{scope:`row`,className:f(`px-4 py-2`,`text-left font-medium`),children:K[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,V.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-sort":t.rate??-1,children:t.rate===null?(0,V.jsx)(`span`,{className:`text-muted`,children:`not judged`}):(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,V.jsxs)(`span`,{className:f(t.rate<1&&`text-ink`),children:[Math.round(t.rate*100),`% of `,t.judged.n]}),n.n>0&&(0,V.jsx)(`span`,{className:`text-muted`,children:`·`}),n.n>0&&g(`benchmark`,n,`${K[e.check]} on ${d(t.version)}: not passed`,!0)]})},t.version)})]},`${e.lens}-${e.check}`))}),m(`benchmark`)]}),(0,V.jsxs)(R,{id:`checks`,title:`Checks`,icon:N,n:p.checks.length,children:[t.versions.length>1&&(0,V.jsxs)(`label`,{className:`flex w-fit items-center gap-2 text-body-sm text-ink-2`,children:[`Version`,(0,V.jsx)(i,{value:p.version,onChange:e=>{c(e.target.value),u(null)},children:t.versions.map(e=>(0,V.jsx)(`option`,{value:e.version,children:e.version||`no version`},e.version))})]}),p.checks.length?(0,V.jsx)(F,{label:`Checks of ${d(p.version)}`,search:!1,minWidth:600,head:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Check`}),(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Lens`}),[`Passed`,`Warned`,`Failed`,`Not known`,`Overruled`].map(e=>(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:e},e))]}),children:p.checks.map(e=>(0,V.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,V.jsx)(`th`,{scope:`row`,className:f(`px-4 py-2`,`text-left font-medium`),children:K[e.check]}),(0,V.jsx)(`td`,{className:f(`px-4 py-2`,`text-muted`),children:it[e.lens]}),[`PASS`,`WARN`,`FAIL`,`UNKNOWN`].map(t=>(0,V.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-sort":e.outcome[t].n,children:g(`checks`,e.outcome[t],`${K[e.check]}: ${Z[t].toLowerCase()}`,t===`FAIL`)},t)),(0,V.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-sort":e.overruled.n,children:g(`checks`,e.overruled,`${K[e.check]}: overruled`)})]},`${e.lens}-${e.check}`))}):(0,V.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`No contract judged these runs: `,(0,V.jsx)(`a`,{href:r(`evidence-contracts`),children:`Contracts`}),` says what one agrees.`]}),m(`checks`)]}),p.rules.length>0&&(0,V.jsxs)(R,{id:`recurring`,title:`What keeps going wrong`,icon:D,n:p.rules.length,children:[(0,V.jsx)(`ul`,{"aria-label":`What keeps going wrong`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 list-none`),children:p.rules.slice(0,20).map(e=>(0,V.jsxs)(`li`,{className:`flex flex-col gap-1 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsx)(C,{tone:G[e.status].tone,children:G[e.status].label}),(0,V.jsxs)(`span`,{className:`text-body-sm font-medium`,children:[K[e.check],`: `,H(e.rule)]}),(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-body-sm text-muted`,children:[`in `,g(`recurring`,e.runs,`${K[e.check]}: ${e.rule}`),` `,e.runs.n===1?`run`:`runs`]})]}),(0,V.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`For example: `,H(e.example)]})]},`${e.check}-${e.rule}`))}),m(`recurring`)]}),(0,V.jsxs)(R,{id:`weeks`,title:`Week by week`,icon:ye,n:t.weeks.length,children:[(0,V.jsx)(F,{label:`Week by week`,search:!1,minWidth:520,head:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Week`}),[`PASS`,`WARN`,`FAIL`,`UNKNOWN`,`NONE`].map(e=>(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:Z[e]},e))]}),children:t.weeks.toReversed().map(e=>(0,V.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,V.jsx)(`th`,{scope:`row`,className:f(`px-4 py-2`,`text-left font-medium tabular-nums`),children:e.week===`undated`?`No date`:e.week}),[`PASS`,`WARN`,`FAIL`,`UNKNOWN`,`NONE`].map(t=>(0,V.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-sort":e.outcome[t].n,children:g(`weeks`,e.outcome[t],`${e.week}: ${Z[t].toLowerCase()}`,t===`FAIL`)},t))]},e.week))}),m(`weeks`)]})]})]})}function Ye({agent:e}){let[t,n]=(0,B.useState)(null),[a,o]=(0,B.useState)([]),[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(``),[p,m]=(0,B.useState)(e),[g,v]=(0,B.useState)(`all`),[y,x]=(0,B.useState)(0);(0,B.useEffect)(()=>{h.runs().then(e=>{n(e.runs),o(e.refused)},e=>c(e.message))},[]),(0,B.useEffect)(()=>m(e),[e]);let S=(0,B.useMemo)(()=>[...new Set((t||[]).map(e=>e.agent))].sort(),[t]),te=l.toLowerCase().split(/\s+/).filter(Boolean),C=(t||[]).filter(e=>(!p||e.agent===p)&&te.every(t=>`${e.agent} ${e.request||``} ${e.id} ${e.source.name}`.toLowerCase().includes(t))),w=g===`failed`?C.filter(e=>e.failed):C,ne={all:C.length,failed:C.filter(e=>e.failed).length},T=Math.max(1,Math.ceil(w.length/W)),E=Math.min(y,T-1),D=w.slice(E*W,E*W+W);(0,B.useEffect)(()=>x(0),[l,p,g]);let O=t||[],k=O.filter(e=>e.failed).length;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(J,{id:`evidence-runs`,children:`Agent runs`}),(0,V.jsx)(L,{more:(0,V.jsxs)(V.Fragment,{children:[`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. `,Ue]}),children:`Every agent run recorded here, newest first.`}),s&&(0,V.jsx)(z,{text:s}),!t&&!s&&(0,V.jsx)(Y,{}),(0,V.jsx)(We,{refused:a}),t&&!t.length&&(0,V.jsx)(X,{}),t&&t.length>0&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsxs)(Ie,{label:`Runs recorded`,children:[(0,V.jsx)(I,{dot:`neutral`,value:O.length,label:O.length===1?`run`:`runs`}),(0,V.jsx)(I,{dot:k?`fail`:`pass`,value:k,label:`with a failed step (${Math.round(k/O.length*100)}%)`}),(0,V.jsx)(I,{dot:`neutral`,value:O.reduce((e,t)=>e+t.decisions,0),label:O.reduce((e,t)=>e+t.decisions,0)===1?`decision`:`decisions`}),(0,V.jsx)(I,{dot:`neutral`,value:new Set(O.map(e=>e.agent)).size,label:new Set(O.map(e=>e.agent)).size===1?`agent`:`agents`})]}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(b,{id:`evidence-search`,label:`Find a run`,value:l,onChange:u,placeholder:`Find a run by what was asked`}),(0,V.jsx)(ee,{items:[{id:`all`,label:`All`,n:ne.all},{id:`failed`,label:`Failed`,n:ne.failed,alert:!0}],value:g,onChange:v}),S.length>1&&(0,V.jsxs)(i,{size:`sm`,"aria-label":`Agent`,value:p,onChange:e=>m(e.target.value),className:`w-auto pr-8 pl-4`,children:[(0,V.jsx)(`option`,{value:``,children:`Every agent`}),S.map(e=>(0,V.jsx)(`option`,{value:e,children:H(e)},e))]})]}),(0,V.jsxs)(`div`,{className:`surface rounded-lg bg-bg p-6 shadow-sm`,children:[(0,V.jsxs)(`ul`,{"aria-label":`Agent runs`,className:`m-0 list-none p-2`,children:[!D.length&&(0,V.jsx)(`li`,{className:`px-4 py-4 text-body-sm text-muted`,children:`Nothing matches.`}),D.map((e,t)=>(0,V.jsxs)(`li`,{className:`contents`,children:[(t===0||Te(D[t-1].started)!==Te(e.started))&&(0,V.jsx)(`span`,{className:`block px-4 pt-4 pb-1 text-body-sm font-medium text-muted`,children:Te(e.started)}),(0,V.jsxs)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e.id)),className:f(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] gap-x-4`),children:[e.failed?(0,V.jsx)(Se,{size:16,"aria-label":`${e.failed} failed ${e.failed===1?`step`:`steps`}`,className:`flex-none text-fail`}):(0,V.jsx)(A,{size:16,"aria-label":`No failed step`,className:`flex-none text-muted`}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,V.jsx)(`span`,{className:`truncate text-body-sm font-medium`,"data-tip":e.request||e.agent,children:H(e.request||`${e.agent}: request not recorded`)}),(0,V.jsx)(`span`,{className:`truncate text-body-sm text-muted`,children:[H(`${e.agent}${e.version?` ${e.version}`:``}`),d(e.steps,`step`),d(e.decisions,`decision`),`${d(e.gaps,`thing`,`things`)} not known`,Le[e.source.kind],e.content?`content kept`:`inputs as fingerprints`,e.verdict?`verdict: ${G[e.verdict].label.toLowerCase()}`:`no contract`].join(` · `)})]}),(0,V.jsx)(`span`,{className:`text-right text-body-sm text-muted tabular-nums`,"data-tip":U(e.started),children:e.started?P(e.started):``})]})]},e.id))]}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 border-t border-line-soft px-4 py-2 text-body-sm text-muted`,children:[(0,V.jsx)(`span`,{className:`flex-1`,children:w.length?`${E*W+1}–${Math.min(w.length,E*W+W)} of ${w.length}`:`0 runs`}),T>1&&(0,V.jsxs)(`nav`,{"aria-label":`Pages of agent runs`,className:`flex items-center gap-1`,children:[(0,V.jsx)(_,{size:`sm`,variant:`ghost`,disabled:E===0,onClick:()=>x(E-1),"aria-label":`Newer runs`,"data-tip":`Newer runs`,children:(0,V.jsx)(re,{"aria-hidden":`true`})}),(0,V.jsxs)(`span`,{className:`px-1 tabular-nums`,children:[`Page `,E+1,` of `,T]}),(0,V.jsx)(_,{size:`sm`,variant:`ghost`,disabled:E>=T-1,onClick:()=>x(E+1),"aria-label":`Older runs`,"data-tip":`Older runs`,children:(0,V.jsx)(ae,{"aria-hidden":`true`})})]})]})]})]})]})}function Q({t:e,label:t}){let[n,r]=(0,B.useState)(!1);if(e.text===void 0)return(0,V.jsxs)(`span`,{className:`font-mono text-body-sm text-muted`,children:[t,`: fingerprint only, `,e.chars.toLocaleString(),` characters, sha256 `,e.sha256.slice(0,12),`…`]});let i=e.text.length>600;return(0,V.jsxs)(`span`,{className:`flex flex-col items-start gap-1`,children:[(0,V.jsx)(`span`,{className:`text-body-sm whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:H(i&&!n?`${e.text.slice(0,600)}…`:e.text)}),i&&(0,V.jsxs)(_,{variant:`link`,size:`inline`,onClick:()=>r(!n),"data-tip":n?void 0:`Show all ${e.text.length.toLocaleString()} characters`,className:`gap-1`,children:[n?(0,V.jsx)(me,{size:12,"aria-hidden":`true`}):(0,V.jsx)(E,{size:12,"aria-hidden":`true`}),n?`Less`:`More`]})]})}function Xe({d:e}){return(0,V.jsxs)(`div`,{className:`flex flex-col gap-1 border-l-2 border-accent-line pl-4`,children:[(0,V.jsxs)(`span`,{className:`text-body-sm font-medium text-muted`,children:[`Decided`,e.by?` · by ${H(e.by)}`:``]}),(0,V.jsxs)(`span`,{className:`text-body-sm text-ink [overflow-wrap:anywhere]`,children:[H(e.what),`: `,(0,V.jsx)(`b`,{className:`font-medium`,children:H(e.chose)})]}),e.options&&e.options.length>0&&(0,V.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[`Options: `,H(e.options.join(`, `))]}),e.reason?(0,V.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,V.jsx)(`span`,{className:`text-body-sm text-muted`,children:`The reason given (a claim, not checked yet):`}),(0,V.jsx)(Q,{t:e.reason,label:`reason`})]}):(0,V.jsx)(`span`,{className:`text-body-sm text-muted`,children:`No reason given.`})]})}function Ze({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,V.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 outline-none last:border-b-0 focus-visible:bg-accent-soft`,children:[(0,V.jsx)(`span`,{className:`pt-1 text-right text-body-sm text-muted tabular-nums`,children:e.seq}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,V.jsx)(x,{icon:Re[e.kind]||ce,size:14,className:`flex-none`}),(0,V.jsx)(`span`,{className:`text-body-sm font-medium [overflow-wrap:anywhere]`,children:H(e.name)}),(0,V.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.kind}),e.agent&&(0,V.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[`· by `,H(e.agent)]}),e.ok===!1&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-body-sm text-fail`,children:[(0,V.jsx)(Se,{size:13,"aria-hidden":`true`}),`failed`]}),e.ms!==void 0&&(0,V.jsxs)(`span`,{className:`text-body-sm text-muted tabular-nums`,children:[`· `,e.ms.toLocaleString(),` ms`]})]}),a.length>0&&(0,V.jsx)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:H(a.map(([e,t])=>`${e}: ${String(t)}`).join(` · `))}),e.detail&&(0,V.jsx)(Q,{t:e.detail,label:`details`}),e.instructions&&(0,V.jsxs)(`details`,{className:`border-l-2 border-line pl-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-body-sm font-medium text-muted`,children:(()=>{let n=t.steps.filter(t=>t.seq<e.seq&&t.instructions?.sha256===e.instructions.sha256);return n.length?`Instructions, the same as step ${n[n.length-1].seq}`:`Instructions given to the model`})()}),(0,V.jsx)(`div`,{className:`mt-1`,children:(0,V.jsx)(Q,{t:e.instructions,label:`instructions`})})]}),n.map(e=>(0,V.jsxs)(`div`,{className:`flex flex-col gap-1 border-l-2 border-line pl-4`,children:[(0,V.jsxs)(`span`,{className:`text-body-sm font-medium text-muted [overflow-wrap:anywhere]`,children:[`Took in `,Be[e.kind]||e.kind,` from `,H(e.source)]}),(0,V.jsx)(Q,{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,V.jsx)(Xe,{d:e},e.seq)),i.map(e=>(0,V.jsxs)(`div`,{className:`flex flex-col gap-1 border-l-2 border-line pl-4`,children:[(0,V.jsx)(`span`,{className:`text-body-sm font-medium text-muted`,children:`Said (a claim about its own work, not checked yet)`}),(0,V.jsx)(Q,{t:e.text,label:`statement`})]},e.seq))]})]})}function Qe({r:e,goTo:t}){let n=e.steps.filter(e=>e.kind===`model`),r=n.find(e=>e.instructions),i=new Set(n.filter(e=>e.instructions).map(e=>e.instructions.sha256)).size,a=e.outputs.filter(e=>e.kind===`text`),o=a[a.length-1],s=a.slice(0,-1),c=e.outputs.filter(e=>e.kind!==`text`),u=e=>n.reduce((t,n)=>t+(typeof n.facts?.[e]==`number`?n.facts[e]:0),0),d=u(`tokens_in`),f=u(`tokens_out`),p=[...new Set(n.map(e=>e.name))],m=({children:e})=>(0,V.jsx)(`span`,{className:`text-body-sm font-medium text-muted`,children:e}),h=({seq:e})=>(0,V.jsxs)(_,{variant:`link`,size:`inline`,onClick:()=>t(e),children:[`step `,e]});return(0,V.jsx)(R,{id:`evidence-io`,title:`Prompt and output`,icon:xe,children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(n.length>0||d+f>0)&&(0,V.jsxs)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:[n.length,` model `,n.length===1?`call`:`calls`,p.length?` (${H(p.join(`, `))})`:``,d+f>0?` · ${d.toLocaleString()} tokens in, ${f.toLocaleString()} out`:``]}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,V.jsxs)(m,{children:[`Instructions (system prompt)`,r?(0,V.jsxs)(V.Fragment,{children:[` · from `,(0,V.jsx)(h,{seq:r.seq})]}):null,i>1?` · ${i} different ones in this run`:``]}),(0,V.jsx)(`div`,{className:l,children:r?.instructions?(0,V.jsx)(Q,{t:r.instructions,label:`instructions`}):(0,V.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not in the record: its source did not hold the instructions the model was given.`})})]}),(0,V.jsxs)(`div`,{className:`grid gap-4 @3xl:grid-cols-2`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,V.jsxs)(m,{children:[`Request`,e.request?.by?` · from ${H(e.request.by)}`:``,e.request?.from?` · read from the ${H(e.request.from)}`:``]}),(0,V.jsx)(`div`,{className:l,children:e.request?.text?(0,V.jsx)(Q,{t:e.request.text,label:`request`}):(0,V.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not in the record: its source did not say what the agent was asked.`})})]}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,V.jsxs)(m,{children:[`Final answer`,o?(0,V.jsxs)(V.Fragment,{children:[` · `,(0,V.jsx)(h,{seq:o.step})]}):null]}),(0,V.jsx)(`div`,{className:l,children:o?.data?(0,V.jsx)(Q,{t:o.data,label:`answer`}):(0,V.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not in the record: its source did not say what the agent answered.`})})]})]}),c.length>0&&(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,V.jsxs)(m,{children:[`What it produced (`,c.length,`)`]}),(0,V.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:c.map(e=>(0,V.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-2 text-body-sm text-ink-2`,children:[ze[e.kind]||e.kind,e.target?(0,V.jsx)(`span`,{className:`font-mono text-body-sm [overflow-wrap:anywhere]`,children:H(e.target)}):null,`· `,(0,V.jsx)(h,{seq:e.step})]},e.id))})]}),s.length>0&&(0,V.jsxs)(`details`,{className:`group flex flex-col gap-2`,children:[(0,V.jsxs)(`summary`,{className:`cursor-pointer text-body-sm font-medium text-muted`,children:[`What it said on the way (`,s.length,`)`]}),(0,V.jsx)(`ol`,{className:`m-0 mt-2 flex list-none flex-col gap-2 p-0`,children:s.map(e=>(0,V.jsxs)(`li`,{className:`flex flex-col gap-1 border-l-2 border-line pl-4`,children:[(0,V.jsx)(h,{seq:e.step}),e.data?(0,V.jsx)(Q,{t:e.data,label:`said`}):null]},e.id))})]})]})})}function $e({id:e}){let[t,n]=(0,B.useState)(null),[i,a]=(0,B.useState)(``),[o,s]=(0,B.useState)(q);(0,B.useEffect)(()=>{h.run(e).then(n,e=>a(e.message))},[e]);let c=(0,V.jsx)(w,{to:{href:r(`evidence-runs`),label:`All agent runs`}});if(!t)return(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[c,i?(0,V.jsx)(z,{text:i}):(0,V.jsx)(Y,{shape:`detail`})]});let l=t.decisions.filter(e=>!e.step),u=t.steps.filter(e=>e.ok===!1).length,d=e=>{e>o&&s(Math.ceil(e/q)*q),requestAnimationFrame(()=>{let t=document.getElementById(`evidence-step-${e}`);t?.scrollIntoView({block:`start`}),t?.focus({preventScroll:!0})})},p=[...t.gaps,...t.truncated?[t.truncated]:[]];return(0,V.jsxs)(`section`,{"aria-labelledby":`evidence-run-h`,className:`flex flex-col gap-6`,children:[(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[c,(0,V.jsx)(Fe,{id:`evidence-run-h`,icon:k,title:H(t.request?.text?.text?t.request.text.text.slice(0,200):`${t.agent.name}: request not recorded`)}),(0,V.jsxs)(`p`,{className:`m-0 text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[H(`${t.agent.name}${t.agent.version?` ${t.agent.version}`:``}${t.agent.model?` · ${t.agent.model}`:``}${t.agent.provider?` (${t.agent.provider})`:``}`),` · from `,Le[t.source.kind],`, `,H(t.source.name),t.started?` · ${U(t.started)}`:``,t.ended&&t.ended!==t.started?` to ${U(t.ended)}`:``]}),(0,V.jsx)(`p`,{className:`m-0 font-mono text-body-sm text-muted`,children:t.id})]}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1 text-body-sm text-muted`,children:[(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`b`,{className:`text-ink tabular-nums`,children:t.steps.length}),` `,t.steps.length===1?`step`:`steps`]}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`b`,{className:f(`tabular-nums`,u?`text-fail`:`text-ink`),children:u}),` failed`]}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`b`,{className:`text-ink tabular-nums`,children:t.inputs.length}),` `,t.inputs.length===1?`input`:`inputs`]}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`b`,{className:`text-ink tabular-nums`,children:t.decisions.length}),` `,t.decisions.length===1?`decision`:`decisions`]}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`b`,{className:`text-ink tabular-nums`,children:t.statements.length}),` `,t.statements.length===1?`claim`:`claims`]}),(0,V.jsx)(`span`,{children:t.content?`Content kept, with secrets cut out`:`Inputs kept as fingerprints only`})]}),(0,V.jsx)(Qe,{r:t,goTo:d}),(0,V.jsx)(et,{id:t.id,goTo:d}),(0,V.jsx)(R,{id:`evidence-gaps`,title:`What the record cannot say`,icon:le,n:p.length,children:p.length?(0,V.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:p.map(e=>(0,V.jsx)(`li`,{className:`border-b border-line-soft py-2 text-body-sm text-ink-2 last:border-b-0 [overflow-wrap:anywhere]`,children:H(e)},e))}):(0,V.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Nothing: the source said everything the record holds.`})}),(0,V.jsxs)(R,{id:`evidence-timeline`,title:`Timeline`,icon:k,n:t.steps.length,children:[(0,V.jsx)(`ol`,{"aria-label":`Steps`,className:`m-0 flex list-none flex-col p-0`,children:t.steps.slice(0,o).map(e=>(0,V.jsx)(Ze,{s:e,r:t},e.seq))}),t.steps.length>o&&(0,V.jsxs)(_,{size:`sm`,variant:`ghost`,className:`self-start`,onClick:()=>s(o+q),"data-tip":`Show ${Math.min(q,t.steps.length-o)} more of ${t.steps.length-o}`,children:[(0,V.jsx)(E,{"aria-hidden":`true`}),`More (`,Math.min(q,t.steps.length-o),`)`]})]}),l.length>0&&(0,V.jsx)(R,{id:`evidence-loose`,title:`Decisions not tied to a step`,icon:M,n:l.length,children:(0,V.jsx)(`div`,{className:`flex flex-col gap-4`,children:l.map(e=>(0,V.jsx)(Xe,{d:e},e.seq))})}),(0,V.jsx)(R,{id:`evidence-inputs`,title:`Data it took in`,icon:be,n:t.inputs.length,children:t.inputs.length?(0,V.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.inputs.map(e=>(0,V.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-x-4 gap-y-1 border-b border-line-soft py-2 last:border-b-0`,children:[(0,V.jsxs)(`span`,{className:`min-w-0 flex-[1_1_320px] text-body-sm [overflow-wrap:anywhere]`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:Be[e.kind]||e.kind}),` `,(0,V.jsx)(`span`,{className:`text-muted`,children:`from`}),` `,H(e.source)]}),(0,V.jsxs)(`span`,{className:`text-body-sm text-muted tabular-nums`,children:[`step `,e.step]}),(0,V.jsx)(`span`,{className:`font-mono text-body-sm text-muted`,children:e.data.text===void 0?`${e.data.chars.toLocaleString()} chars · ${e.data.sha256.slice(0,12)}`:`kept`})]},e.id))}):(0,V.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`The record holds no input.`})})]})}function et({id:e,goTo:t}){let[n,i]=(0,B.useState)(null),[a,o]=(0,B.useState)(``),[s,l]=(0,B.useState)(0),u=()=>l(e=>e+1);if((0,B.useEffect)(()=>{h.verdict(e).then(i,e=>o(e.message))},[e,s]),a)return(0,V.jsx)(z,{text:a});if(!n)return(0,V.jsx)(Y,{shape:`lines`});let d=n.why||!n.verdicts.length?(0,V.jsx)(R,{id:`evidence-behaviour`,title:Ve.behaviour.title,icon:T,children:(0,V.jsxs)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:[`Not judged: `,H(n.why||`no contract judges this agent.`),` A contract says what was agreed for an agent; `,(0,V.jsx)(`a`,{href:r(`evidence-contracts`),children:`Contracts`}),` lists them.`]})}):null;return(0,V.jsxs)(V.Fragment,{children:[n.work&&(0,V.jsxs)(`p`,{className:f(`m-0`,y[n.work.personTakesOver?`warn`:`info`]),children:[n.work.attempt?`Fix attempt ${n.work.attempt} of 2 at `:`The first run of work tried again in `,n.work.attempt?(0,V.jsx)(`a`,{href:r(`evidence-runs`,encodeURIComponent(n.work.first)),children:n.work.first}):`${n.work.runs.length-1} ${n.work.runs.length===2?`fix attempt`:`fix attempts`}`,n.work.personTakesOver?`: findings are still open after the last attempt, so a person takes over.`:`.`]}),d,n.verdicts.map(e=>(0,V.jsx)(R,{id:`evidence-${e.lens}`,title:Ve[e.lens].title,icon:Ve[e.lens].icon,children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsx)(C,{tone:G[e.status].tone,children:G[e.status].label}),(0,V.jsx)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:e.contract?(0,V.jsxs)(V.Fragment,{children:[`By contract `,H(e.contract.name),`, version `,H(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,V.jsx)(`p`,{className:`m-0 text-body-sm text-muted [overflow-wrap:anywhere]`,children:H(e)},e)),(0,V.jsx)(`ul`,{"aria-label":`Checks`,className:f(c,`m-0 flex list-none flex-col`),children:e.checks.map(n=>(0,V.jsxs)(`li`,{className:`flex flex-col gap-2 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsx)(`span`,{className:`min-w-[152px] text-body-sm font-medium`,children:K[n.check]}),(0,V.jsx)(C,{tone:G[n.status].tone,children:G[n.status].label}),(0,V.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[H(n.checked),n.gating?` · can fail a run`:n.advisory&&e.contract?.approved?` · ${n.advisory}`:``]})]}),n.findings.map(n=>(0,V.jsx)(nt,{f:n,run:e.run,goTo:t,onOverruled:u},n.id))]},n.check))}),e.lens===`content`&&n.rubric&&(0,V.jsx)(tt,{run:e.run,rubric:n.rubric,onGraded:u})]})},e.lens))]})}function tt({run:e,rubric:t,onGraded:n}){let[r,i]=(0,B.useState)(null),[o,s]=(0,B.useState)(``),[l,u]=(0,B.useState)(!1),[d,p]=(0,B.useState)(``),m=o.trim().length>=10&&o.trim().length<=500,g=async()=>{if(r){u(!0),p(``);try{await h.grade(e,r.id,r.grade,o.trim()),i(null),s(``),n()}catch(e){p(e.message)}finally{u(!1)}}};return(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsx)(`h4`,{className:`m-0 text-body-sm font-medium`,children:`Grade the answer`}),(0,V.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[t.criteria.some(e=>e.id===`scenario`)?`Its scenario is graded by a person: the release gate counts it only once you have graded it. `:``,t.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.`]}),t.answer!==void 0&&(0,V.jsx)(`p`,{className:f(`rounded-base bg-surface-muted p-4`,`m-0 whitespace-pre-wrap text-body-sm text-ink [overflow-wrap:anywhere]`),children:H(t.answer)}),(0,V.jsx)(`ul`,{"aria-label":`Rubric criteria`,className:f(c,`m-0 flex list-none flex-col`),children:t.criteria.map(e=>(0,V.jsxs)(`li`,{className:`flex flex-col gap-2 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsxs)(`span`,{className:`text-body-sm text-ink [overflow-wrap:anywhere]`,children:[(0,V.jsx)(`span`,{className:`font-mono text-muted`,children:e.id}),` `,H(e.text)]}),e.grade&&(0,V.jsx)(C,{tone:e.grade.grade===`meets`?`pass`:`warn`,children:e.grade.grade===`meets`?`Meets`:`Misses`}),(0,V.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.grade?`Grade again:`:`Grade:`}),[`meets`,`misses`].map(t=>(0,V.jsx)(_,{variant:`link`,size:`inline`,"aria-label":`${e.id} ${t===`meets`?`meets`:`misses`}`,onClick:()=>i({id:e.id,grade:t}),className:`min-h-7 px-2`,children:t===`meets`?`Meets`:`Misses`},t))]}),e.grade&&(0,V.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`Graded by `,H(e.grade.by),` `,U(e.grade.at),`: `,H(e.grade.reason)]}),r?.id===e.id&&(0,V.jsxs)(`div`,{className:f(`panel rounded-md bg-(--page-surface-strong) p-6`,`flex max-w-[640px] flex-col gap-2`),children:[(0,V.jsxs)(`label`,{htmlFor:`grade-${e.id}`,className:`text-body-sm font-medium text-ink-2`,children:[`Why does the answer `,r.grade===`meets`?`meet`:`miss`,` it?`]}),(0,V.jsx)(a,{id:`grade-${e.id}`,value:o,onChange:e=>s(e.target.value),rows:2,maxLength:500,placeholder:`For example: it says the customer must send a photo by Friday.`}),d&&(0,V.jsx)(z,{text:d}),(0,V.jsxs)(`span`,{className:`flex gap-2`,children:[(0,V.jsxs)(_,{busy:l,size:`sm`,disabled:!m||l,onClick:g,"data-tip":r.grade===`meets`?`Keep the grade: meets`:`Keep the grade: misses`,children:[(0,V.jsx)(ve,{"aria-hidden":`true`}),l?`Keeping…`:`Keep`]}),(0,V.jsxs)(_,{size:`sm`,variant:`outline`,onClick:()=>i(null),children:[(0,V.jsx)(O,{"aria-hidden":`true`}),`Cancel`]})]})]})]},e.id))})]})}function nt({f:e,run:t,goTo:n,onOverruled:r}){let[i,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(!1),[d,p]=(0,B.useState)(``),m=s.trim().length>=10&&s.trim().length<=500,g=async()=>{u(!0),p(``);try{await h.overrule(t,e.id,s.trim()),o(!1),r()}catch(e){p(e.message)}finally{u(!1)}};return(0,V.jsxs)(`div`,{className:f(`flex flex-col gap-1 border-l-2 pl-4`,e.overruled?`border-line opacity-80`:e.status===`FAIL`?`border-fail`:e.status===`WARN`?`border-warn`:`border-line`),children:[(0,V.jsx)(`span`,{className:f(`text-body-sm [overflow-wrap:anywhere]`,e.overruled?`text-ink-2`:`text-ink`),children:H(e.what)}),e.fix&&!e.overruled&&(0,V.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`Fix: `,H(e.fix)]}),e.overruled&&(0,V.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`Overruled by `,H(e.overruled.by),` `,U(e.overruled.at),` (`,e.overruled.via===`web`?`on this page`:`at a terminal`,`): `,H(e.overruled.reason)]}),(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-body-sm text-muted`,children:[(0,V.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:H(e.source)}),e.location&&(0,V.jsx)(`span`,{className:`font-mono [overflow-wrap:anywhere]`,children:H(`${e.location.repo?`${e.location.repo}/`:``}${e.location.file}${e.location.line?`:${e.location.line}`:``}`)}),[...new Set(e.steps)].slice(0,12).map(e=>(0,V.jsxs)(_,{variant:`link`,size:`inline`,onClick:()=>n(e),className:`min-h-7 px-2 tabular-nums`,children:[`step `,e]},e)),!e.overruled&&e.status!==`UNKNOWN`&&!i&&(0,V.jsxs)(_,{variant:`link`,size:`inline`,onClick:()=>o(!0),className:`min-h-7 gap-1 px-2`,children:[(0,V.jsx)(j,{size:12,"aria-hidden":`true`}),`Overrule`]})]}),i&&(0,V.jsxs)(`div`,{className:f(`panel rounded-md bg-(--page-surface-strong) p-6`,`flex max-w-[640px] flex-col gap-2`),children:[(0,V.jsx)(`label`,{htmlFor:`overrule-${e.id}`,className:`text-body-sm 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,V.jsx)(a,{id:`overrule-${e.id}`,value:s,onChange:e=>c(e.target.value),rows:2,maxLength:500,placeholder:`For example: the owner agreed this removal in the change's review.`}),d&&(0,V.jsx)(z,{text:d}),(0,V.jsxs)(`span`,{className:`flex gap-2`,children:[(0,V.jsxs)(_,{busy:l,size:`sm`,disabled:!m||l,onClick:g,children:[(0,V.jsx)(j,{"aria-hidden":`true`}),l?`Overruling…`:`Overrule`]}),(0,V.jsxs)(_,{size:`sm`,variant:`outline`,onClick:()=>o(!1),children:[(0,V.jsx)(O,{"aria-hidden":`true`}),`Cancel`]})]})]})]})}function rt(){let[e,t]=(0,B.useState)(null),[n,i]=(0,B.useState)(``);return(0,B.useEffect)(()=>{h.review().then(t,e=>i(e.message))},[]),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(J,{id:`evidence-review`,children:`Review queue`}),(0,V.jsx)(L,{more:(0,V.jsx)(V.Fragment,{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.`}),children:`What waits for a person: open findings to read, answers to grade, and what was overruled.`}),n&&(0,V.jsx)(z,{text:n}),!e&&!n&&(0,V.jsx)(Y,{}),e?.problems.map(e=>(0,V.jsx)(z,{text:e},e)),e&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h2`,{className:`sr-only`,children:`What waits, what to grade, and what was overruled`}),(0,V.jsx)(R,{id:`waiting`,title:`Waiting for a person`,icon:T,n:e.waiting.length,children:e.waiting.length?(0,V.jsx)(`ul`,{"aria-label":`Waiting for a person`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 list-none`),children:e.waiting.map(e=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e.run)),className:f(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] gap-x-4`),children:[(0,V.jsx)(C,{tone:G[e.status].tone,children:G[e.status].label}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,V.jsx)(`span`,{className:`truncate text-body-sm font-medium`,children:H(e.request||`${e.agent}: request not recorded`)}),(0,V.jsx)(`span`,{className:`truncate text-body-sm text-muted`,children:[H(e.agent),d(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,V.jsx)(`span`,{className:`text-right text-body-sm text-muted tabular-nums`,"data-tip":U(e.started),children:e.started?P(e.started):``})]})},e.run))}):(0,V.jsx)(g,{className:`py-4`,children:`Nothing waits: no run has an open finding.`})}),e.grade.length>0&&(0,V.jsxs)(R,{id:`grade`,title:`Answers to grade`,icon:N,n:e.grade.length,children:[(0,V.jsx)(`p`,{className:`m-0 text-body-sm 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,V.jsx)(`ul`,{"aria-label":`Answers to grade`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 list-none`),children:e.grade.map(e=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e.run)),className:f(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`grid min-h-12 grid-cols-[minmax(0,1fr)_auto] gap-x-4`),children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,V.jsx)(`span`,{className:`truncate text-body-sm font-medium`,children:H(e.request||`${e.agent}: request not recorded`)}),(0,V.jsx)(`span`,{className:`truncate text-body-sm text-muted`,children:[H(e.agent),`${e.ungraded} of ${e.criteria} ${e.criteria===1?`criterion`:`criteria`} not graded`].join(` · `)})]}),(0,V.jsx)(`span`,{className:`text-right text-body-sm text-muted tabular-nums`,"data-tip":U(e.started),children:e.started?P(e.started):``})]})},e.run))})]}),(0,V.jsx)(R,{id:`overruled`,title:`Overruled by people`,icon:M,n:e.overruled.length,children:e.overruled.length?(0,V.jsx)(`ul`,{"aria-label":`Overruled findings`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 list-none`),children:e.overruled.map(e=>(0,V.jsxs)(`li`,{className:`flex flex-col gap-1 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,V.jsxs)(`span`,{className:`text-body-sm [overflow-wrap:anywhere]`,children:[(0,V.jsx)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e.run)),children:H(e.agent||e.run)}),` · `,H(`${e.check}/${e.rule}`),e.what?`: ${H(e.what)}`:``]}),(0,V.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[H(e.by),` `,U(e.at),` (`,e.via===`web`?`on the page`:`at a terminal`,`): `,H(e.reason)]})]},`${e.run}-${e.finding}-${e.at}`))}):(0,V.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`No finding has been overruled.`})})]})]})}var it={build:`Build and test`,behaviour:`Behaviour`,decisions:`Decisions and data`,content:`Content`,domain:`Domain`};function at({s:e}){let[t,n]=(0,B.useState)(e.versions[0]||``),[r,a]=(0,B.useState)(e.versions[1]||``),[o,s]=(0,B.useState)(null),[l,u]=(0,B.useState)(``);(0,B.useEffect)(()=>{e.agent&&t&&(u(``),h.release(e.agent,t,r===t?``:r).then(s,e=>u(e.message)))},[e.agent,t,r]);let p=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`},m=o?[...new Set([...Object.keys(o.candidate.lensPass),...Object.keys(o.live?.lensPass||{})])]:[];return(0,V.jsxs)(`li`,{className:f(c,`flex flex-col gap-4`),children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsx)(`span`,{className:`text-body-lg font-medium [overflow-wrap:anywhere]`,children:H(e.agent||e.name)}),(0,V.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[H(`${e.name}.yaml`),` · `,d(e.scenarios.length,`scenario`)]})]}),e.problem&&(0,V.jsx)(z,{text:e.problem}),e.agent&&!e.versions.length&&(0,V.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`No run of `,H(e.agent),` is recorded yet: run each scenario's request through a version and record it (forgeqe evidence scenarios lists them).`]}),e.versions.length>0&&(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-body-sm`,children:[(0,V.jsx)(`label`,{htmlFor:`cand-${e.name}`,children:`Candidate`}),(0,V.jsx)(i,{size:`sm`,id:`cand-${e.name}`,value:t,onChange:e=>n(e.target.value),className:`w-auto pr-8 pl-4`,children:e.versions.map(e=>(0,V.jsx)(`option`,{value:e,children:H(e)},e))}),(0,V.jsx)(`label`,{htmlFor:`live-${e.name}`,children:`against live`}),(0,V.jsxs)(i,{size:`sm`,id:`live-${e.name}`,value:r,onChange:e=>a(e.target.value),className:`w-auto pr-8 pl-4`,children:[(0,V.jsx)(`option`,{value:``,children:`No live version`}),e.versions.filter(e=>e!==t).map(e=>(0,V.jsx)(`option`,{value:e,children:H(e)},e))]})]}),l&&(0,V.jsx)(z,{text:l}),o&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsx)(C,{tone:o.status===`ready`?`pass`:`fail`,children:o.status===`ready`?`Ready`:`Held`}),(0,V.jsx)(`span`,{className:`text-body-sm text-ink-2`,children:o.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.`})]}),o.reasons.length>0&&(0,V.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-6 text-body-sm text-ink-2`,children:o.reasons.map(e=>(0,V.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:H(e)},e))}),(0,V.jsxs)(F,{label:`Scenarios of ${e.agent}`,search:!1,sortable:!1,minWidth:520,head:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Scenario`}),(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Kind`}),o.live&&(0,V.jsxs)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:[H(o.live.version),` (live)`]}),(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:H(o.candidate.version)})]}),children:[e.scenarios.map(e=>(0,V.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,V.jsx)(`th`,{scope:`row`,className:f(`px-4 py-2`,`text-left font-medium`),"data-tip":e.request,children:H(e.id)}),(0,V.jsx)(`td`,{className:`px-4 py-2`,children:e.kind}),o.live&&(0,V.jsx)(`td`,{className:f(`px-4 py-2`,o.live.cells[e.id]&&!o.live.cells[e.id].pass&&`text-fail`),children:p(o.live.cells[e.id])}),(0,V.jsx)(`td`,{className:f(`px-4 py-2`,(o.candidate.cells[e.id]===null||o.candidate.cells[e.id]&&!o.candidate.cells[e.id].pass)&&`text-fail`),children:p(o.candidate.cells[e.id])})]},e.id)),m.map(e=>(0,V.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,V.jsxs)(`th`,{scope:`row`,className:f(`px-4 py-2`,`text-left text-muted`),children:[it[e],`: scenarios passed`]}),(0,V.jsx)(`td`,{className:`px-4 py-2`}),o.live&&(0,V.jsx)(`td`,{className:f(`px-4 py-2`,`tabular-nums`),children:o.live.lensPass[e]??0}),(0,V.jsx)(`td`,{className:f(`px-4 py-2`,`tabular-nums`,o.live&&(o.candidate.lensPass[e]??0)<(o.live.lensPass[e]??0)&&`text-fail`),children:o.candidate.lensPass[e]??0})]},e)),(0,V.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,V.jsx)(`th`,{scope:`row`,className:f(`px-4 py-2`,`text-left text-muted`),children:`The owners' expectations met`}),(0,V.jsx)(`td`,{className:`px-4 py-2`}),o.live&&(0,V.jsx)(`td`,{className:f(`px-4 py-2`,`tabular-nums`),children:o.live.golden}),(0,V.jsx)(`td`,{className:f(`px-4 py-2`,`tabular-nums`,o.live&&o.candidate.golden<o.live.golden&&`text-fail`),children:o.candidate.golden})]})]}),(0,V.jsx)(ut,{g:o}),(0,V.jsx)(ot,{g:o}),(0,V.jsx)(dt,{g:o,ids:e.scenarios.map(e=>e.id)})]}),e.history.length>0&&(0,V.jsxs)(`details`,{className:`text-body-sm`,children:[(0,V.jsxs)(`summary`,{className:`cursor-pointer text-ink-2`,children:[`Gates kept (`,e.history.length,`)`]}),(0,V.jsx)(`ul`,{className:`m-0 mt-1 flex list-none flex-col gap-1 p-0`,children:e.history.map(e=>(0,V.jsxs)(`li`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[U(e.at),` · `,H(e.by),` · `,H(e.candidate),e.live?` against ${H(e.live)}`:``,`: `,e.status===`ready`?`ready`:`held`,e.reasons.length?` (${H(e.reasons[0])}${e.reasons.length>1?`, and ${e.reasons.length-1} more`:``})`:``]},e.at))})]})]})}function ot({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,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,V.jsxs)(`h4`,{className:`m-0 text-body-sm font-medium`,children:[`Answers waiting for your grade (`,t.length,`)`]}),(0,V.jsx)(`p`,{className:`m-0 text-body-sm 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,V.jsx)(`ul`,{"aria-label":`Answers waiting for a grade`,className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm`,children:t.map(e=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e.run)),className:`text-accent-fg hover:underline`,children:[H(e.sid),`: `,e.run]})},e.run))})]}):null}function st({f:e}){return(0,V.jsxs)(`li`,{className:f(c,`flex flex-col gap-2`),children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsx)(C,{tone:e.applied||e.proven?`pass`:`fail`,children:e.applied?`Applied`:e.proven?`Proven`:`Not proven`}),(0,V.jsx)(`span`,{className:`text-body-sm font-medium [overflow-wrap:anywhere]`,children:H(e.instruction)}),(0,V.jsx)(`span`,{className:`font-mono text-body-sm text-muted`,children:e.id})]}),(0,V.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`Adds it to `,H(e.file),`, for `,H(e.cause),` of `,(0,V.jsx)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e.run)),className:`font-mono`,children:e.run}),` (scenario `,H(e.scenario),`, `,H(e.version),`).`]}),(0,V.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`The cause: `,e.proof.replace(`-`,` `),` (`,H(e.why),`)`,e.replays.length?(0,V.jsxs)(V.Fragment,{children:[`; replays `,Tt(e.replays)]}):null,`.`]}),(0,V.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`The suite, run from the patched copy against `,H(e.version),`: `,e.gate.status===`ready`?`no worse`:`held: ${H(e.gate.reasons.join(` `))}`]}),e.applied&&(0,V.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`Applied by `,H(e.applied.by),` `,U(e.applied.at),`: `,H(e.applied.reason)]}),(0,V.jsxs)(`details`,{className:`text-body-sm`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-ink-2`,children:`The patch`}),(0,V.jsx)(`pre`,{className:f(S,`m-0 mt-1 overflow-x-auto`),children:H(e.patch)})]})]})}function ct({d:e,onDecided:t}){let n=e.scenario,r=n.expect||{},i=e.source.kind===`run`?`a run that failed`:e.source.kind===`story`?`an acceptance criterion`:e.source.kind===`rule`?`a business rule of the product, at`:`a defect`,a=e=>(e||[]).map(e=>H(e)).join(`, `);return(0,V.jsxs)(`li`,{className:`flex flex-col gap-2 border-b border-line-soft px-4 py-4 last:border-b-0`,children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsx)(`span`,{className:`font-mono text-body-sm text-muted`,children:e.id}),(0,V.jsxs)(`span`,{className:`text-body-sm font-medium [overflow-wrap:anywhere]`,children:[H(n.id),` for `,H(e.agent)]}),(0,V.jsx)(C,{tone:`neutral`,children:n.kind}),n.held_out&&(0,V.jsx)(C,{tone:`neutral`,children:`Held out`}),e.decided&&(0,V.jsx)(C,{tone:e.decided.decision===`accepted`?`pass`:`warn`,children:e.decided.decision===`accepted`?`Accepted`:`Rejected`})]}),(0,V.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`Drafted by `,e.by===`code`?`code`:`a model`,` from `,i,` `,e.source.url&&ne(e.source.url)===`web`?(0,V.jsx)(`a`,{href:e.source.url,target:`_blank`,rel:`noreferrer noopener`,className:`text-accent-fg hover:underline`,children:H(e.source.ref)}):H(e.source.ref),e.source.criterion?` ${H(e.source.criterion)}`:``,e.source.quote?(0,V.jsxs)(V.Fragment,{children:[`: “`,H(e.source.quote),`”`]}):e.source.why?(0,V.jsxs)(V.Fragment,{children:[`: `,H(e.source.why)]}):null]}),(0,V.jsx)(`p`,{className:f(l,`m-0 whitespace-pre-wrap text-body-sm text-ink [overflow-wrap:anywhere]`),children:H(n.request)}),(0,V.jsxs)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-6 text-body-sm text-ink-2`,children:[r.chose&&(0,V.jsxs)(`li`,{children:[`Expects it to choose `,a(r.chose)]}),r.not_chose&&(0,V.jsxs)(`li`,{children:[`Expects it never to choose `,a(r.not_chose)]}),r.says&&(0,V.jsxs)(`li`,{children:[`Expects it to say: `,a(r.says)]}),r.not_says&&(0,V.jsxs)(`li`,{children:[`Expects it never to say: `,a(r.not_says)]}),r.graded&&(0,V.jsx)(`li`,{children:`A person grades each answer`}),(0,V.jsx)(`li`,{children:r.clean?`Every lens must find nothing`:`The lenses are counted lens by lens`})]}),e.decided?(0,V.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[e.decided.decision===`accepted`?`Accepted`:`Rejected`,` by `,H(e.decided.by),` `,U(e.decided.at),e.decided.scenario?` as ${H(e.decided.scenario)}`:``,`: `,H(e.decided.reason)]}):(0,V.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[(0,V.jsx)(wt,{agent:e.id,uid:`${e.id}-accept`,label:`Add`,icon:se,tip:`Add to the suite`,action:(t,n)=>h.decideDraft(e.id,`accepted`,t,n),onDone:t}),(0,V.jsx)(wt,{agent:e.id,uid:`${e.id}-reject`,label:`Reject`,icon:j,action:(t,n)=>h.decideDraft(e.id,`rejected`,t,n),onDone:t})]})]})}function lt({onDecided:e}){let[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(``),a=()=>h.drafts().then(n,e=>i(e.message));(0,B.useEffect)(()=>{a()},[]);let o=t?.drafts.filter(e=>!e.decided).length??0;return(0,V.jsxs)(R,{id:`drafts`,title:`Drafted scenarios`,icon:N,n:o,children:[(0,V.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Drafted from work items' acceptance criteria and defects (`,(0,V.jsx)(`code`,{children:`forgeqe evidence draft <agent> --from ado:N`}),`) or the product graph's business rules (`,(0,V.jsx)(`code`,{children:`--from-product`}),`), each resting on a quote of its source, or from a run that failed (`,(0,V.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.`]}),r&&(0,V.jsx)(z,{text:r}),t?.problems.map(e=>(0,V.jsx)(z,{text:e},e)),t&&!t.drafts.length&&(0,V.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`No draft yet.`}),t&&t.drafts.length>0&&(0,V.jsx)(`ul`,{"aria-label":`Drafted scenarios`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 flex list-none flex-col`),children:t.drafts.map(t=>(0,V.jsx)(ct,{d:t,onDecided:()=>{a(),e()}},t.id))})]})}function ut({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=>[it[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)}% (${it[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,V.jsxs)(`details`,{className:`text-body-sm`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-ink-2`,children:`Scores: runs passed, lens by lens`}),(0,V.jsx)(`p`,{className:`m-0 mt-1 text-body-sm 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,V.jsx)(F,{label:`Scores`,search:!1,sortable:!1,minWidth:420,head:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`th`,{scope:`col`,className:Oe,children:`Score`}),t.map(t=>(0,V.jsxs)(`th`,{scope:`col`,className:Me,children:[H(t.version),e.live&&t===e.live?` (live)`:``]},t.version))]}),children:r.map(([e,n])=>(0,V.jsxs)(`tr`,{className:De,children:[(0,V.jsx)(`th`,{scope:`row`,className:f(ke,`text-left font-medium`),children:e}),t.map(e=>(0,V.jsx)(`td`,{className:Ee,children:n(e)},e.version))]},e))})]})}function dt({g:e,ids:t}){let n=e=>e?e.runs.find(e=>e.path?.unmet.length)??e.runs.find(e=>e.path):void 0,i=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(!i.length)return null;let a={same:``,missing:`expected, not done`,extra:`done, not expected`},o=(e,t)=>t?.path?(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,V.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[e,`: `,(0,V.jsx)(`a`,{href:r(`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,V.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-1 p-0 font-mono text-body-sm`,children:(t.path.alignment.length?t.path.alignment:t.path.actual.map(e=>({kind:`same`,step:e}))).map((e,t)=>(0,V.jsxs)(`li`,{className:f(`[overflow-wrap:anywhere]`,e.kind===`missing`&&`text-fail`,e.kind===`extra`&&`text-warn`),children:[e.kind===`missing`?`− `:e.kind===`extra`?`+ `:` `,H(e.step),e.kind!==`same`&&(0,V.jsxs)(`span`,{className:`font-sans text-body-sm text-muted`,children:[` (`,a[e.kind],`)`]})]},`${t}-${e.step}`))}),t.path.unmet.map(e=>(0,V.jsx)(`span`,{className:`text-body-sm text-fail [overflow-wrap:anywhere]`,children:H(e)},e))]}):(0,V.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[e,`: not run`]});return(0,V.jsxs)(`details`,{className:`text-body-sm`,children:[(0,V.jsxs)(`summary`,{className:`cursor-pointer text-ink-2`,children:[`Paths: expected against actual (`,i.length,`)`]}),(0,V.jsx)(`ul`,{className:`m-0 mt-2 flex list-none flex-col gap-4 p-0`,children:i.map(t=>(0,V.jsxs)(`li`,{className:f(c,`flex flex-col gap-2`),children:[(0,V.jsx)(`span`,{className:`text-body-sm font-medium`,children:H(t.id)}),(0,V.jsxs)(`div`,{className:`grid gap-4 @[640px]:grid-cols-2`,children:[e.live&&o(`${e.live.version} (live)`,t.live),o(e.candidate.version,t.cand)]})]},t.id))})]})}function ft(){let[e,t]=(0,B.useState)(null),[n,r]=(0,B.useState)(``),i=()=>h.releases().then(t,e=>r(e.message));return(0,B.useEffect)(()=>{i()},[]),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(J,{id:`evidence-releases`,children:`Releases`}),(0,V.jsx)(L,{more:(0,V.jsxs)(V.Fragment,{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,V.jsx)(`code`,{children:`forgeqe evidence release`}),` keeps each gate. A suite is written in `,(0,V.jsx)(`code`,{children:`.forgeqe/evidence/scenarios/<agent>.yaml`}),` (docs/EVIDENCE.md has its form).`]}),children:`Release an agent's new version only when it does at least as well as the live one on its scenarios.`}),n&&(0,V.jsx)(z,{text:n}),!e&&!n&&(0,V.jsx)(Y,{}),e&&!e.suites.length&&(0,V.jsx)(g,{className:`py-4`,children:`No scenario suite yet: add drafted scenarios below to start one. A suite can also be written by hand; How it works says where.`}),e&&e.suites.length>0&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h2`,{className:`sr-only`,children:`Each agent's scenario suite and release gate`}),(0,V.jsx)(R,{id:`suites`,title:`Scenario suites`,icon:N,n:e.suites.length,children:(0,V.jsx)(`ul`,{"aria-label":`Scenario suites`,className:`m-0 flex list-none flex-col gap-4 p-0`,children:e.suites.map(e=>(0,V.jsx)(at,{s:e},e.name))})})]}),e&&(0,V.jsx)(lt,{onDecided:i})]})}var pt={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 mt(){let[e,t]=(0,B.useState)(null),[n,r]=(0,B.useState)(``);(0,B.useEffect)(()=>{h.contracts().then(t,e=>r(e.message))},[]);let i=e=>e===null?`–`:`${Math.round(e*100)}%`;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(J,{id:`evidence-contracts`,children:`Contracts`}),(0,V.jsx)(L,{more:(0,V.jsxs)(V.Fragment,{children:[`A contract says the steps an agent 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,V.jsx)(`code`,{children:`forgeqe evidence contract new "<agent>"`}),`; a person approves it at a terminal with `,(0,V.jsx)(`code`,{children:`forgeqe evidence contract approve <name>`}),`.`]}),children:`What each agent's owner agreed it must and may do, and how well each check is measured.`}),n&&(0,V.jsx)(z,{text:n}),!e&&!n&&(0,V.jsx)(Y,{}),e&&!e.contracts.length&&(0,V.jsx)(g,{className:`py-4`,children:`No contract yet. Without one, a run's record is kept, but nothing checks it against what was agreed.`}),e&&(0,V.jsx)(`h2`,{className:`sr-only`,children:`The contracts and how each check is measured`}),e&&e.contracts.length>0&&(0,V.jsx)(R,{id:`contracts`,title:`Contracts`,icon:be,n:e.contracts.length,children:(0,V.jsx)(`ul`,{"aria-label":`Contracts`,className:`m-0 flex list-none flex-col gap-4 p-0`,children:e.contracts.map(e=>(0,V.jsxs)(`li`,{className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col gap-2`),children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsx)(`span`,{className:`text-body-lg font-medium [overflow-wrap:anywhere]`,children:H(e.agent||e.name)}),(0,V.jsx)(C,{tone:pt[e.state].tone,children:pt[e.state].label}),(0,V.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[H(`${e.name}.yaml`),e.version?` · version ${H(e.version)}`:``,e.approved?` · approved ${U(e.approved.at)} by ${H(e.approved.by)}`:``]})]}),e.problem&&(0,V.jsx)(z,{text:e.problem}),e.says.length>0&&(0,V.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:e.says.map(e=>(0,V.jsx)(`li`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:H(e)},e))}),(0,V.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.gates.length?`Can fail a run: ${e.gates.map(e=>K[e]).join(`, `)}.`:`No check can fail a run under it yet: what they find is a warning.`})]},e.name))})}),e&&(0,V.jsxs)(R,{id:`measured`,title:`How well each check is measured`,icon:ie,children:[(0,V.jsxs)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:[`On `,d(e.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 `,e.measured.min,` labelled findings.`]}),e.measured.problems.map(e=>(0,V.jsx)(z,{text:`Not measured: ${e}`},e)),(0,V.jsx)(`div`,{className:`@container`,children:(0,V.jsx)(F,{label:`How well each check is measured`,search:!1,head:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Check`}),[`Labelled`,`Found right`,`Found wrong`,`Missed`,`Precision`,`Recall`].map(e=>(0,V.jsx)(`th`,{scope:`col`,className:f(`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,`whitespace-normal`,ht.has(e)&&`hidden @lg:table-cell`),children:e},e))]}),children:Object.keys(K).filter(t=>e.measured.checks[t]).map(t=>{let n=e.measured.checks[t];return(0,V.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,V.jsx)(`th`,{scope:`row`,className:f(`px-4 py-2`,`text-left font-medium`),children:K[t]}),(0,V.jsx)(`td`,{className:f(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,n.labelled<e.measured.min&&`text-muted`),children:n.labelled}),(0,V.jsx)(`td`,{className:f(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden @lg:table-cell`),children:n.tp}),(0,V.jsx)(`td`,{className:f(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden @lg:table-cell`,n.fp>0&&`text-fail`),children:n.fp}),(0,V.jsx)(`td`,{className:f(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden @lg:table-cell`,n.fn>0&&`text-fail`),children:n.fn}),(0,V.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:i(n.precision)}),(0,V.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:i(n.recall)})]},t)})})})]})]})}var ht=new Set([`Found right`,`Found wrong`,`Missed`]),gt={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`}},_t={instruction:`Its instructions`,tool:`A tool`,data:`Its data`};function vt({p:e,onDecided:t}){let[n,i]=(0,B.useState)(null),[o,s]=(0,B.useState)(``),[c,l]=(0,B.useState)(!1),[u,p]=(0,B.useState)(``),m=o.trim().length>=10&&o.trim().length<=500,g=async()=>{if(n){l(!0),p(``);try{await h.decide(e.agent,e.id,n,o.trim()),i(null),t()}catch(e){p(e.message)}finally{l(!1)}}};return(0,V.jsxs)(`li`,{className:`flex flex-col gap-1 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsx)(C,{tone:e.state===`approved`?`pass`:e.state===`declined`?`neutral`:`warn`,children:e.state===`approved`?`Approved`:e.state===`declined`?`Declined`:`Open`}),(0,V.jsx)(`span`,{className:`text-body-sm font-medium text-ink-2`,children:e.kind===`fix`?`Fix, proven by replay`:`Guidance for its instructions`}),(0,V.jsx)(`span`,{className:`font-mono text-body-sm text-muted`,children:e.id})]}),(0,V.jsx)(`span`,{className:`text-body-sm text-ink [overflow-wrap:anywhere]`,children:H(e.text)}),(0,V.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[`Because `,H(e.because),`. `,d(e.runs.length,`run`),e.replays?`, ${d(e.replays.length,`replay`)}`:``,`:`,` `,[...e.runs,...e.replays??[]].slice(0,8).map((e,t)=>(0,V.jsxs)(`span`,{children:[t?`, `:``,(0,V.jsx)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e)),className:`font-mono`,children:e})]},e))]}),e.decision&&(0,V.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[e.state===`approved`?`Approved`:`Declined`,` by `,H(e.decision.by),` `,U(e.decision.at),` (`,e.decision.via===`web`?`on this page`:`at a terminal`,`): `,H(e.decision.reason)]}),e.state===`open`&&!n&&(0,V.jsxs)(`span`,{className:`flex gap-2`,children:[(0,V.jsxs)(_,{size:`sm`,onClick:()=>i(`approved`),children:[(0,V.jsx)(A,{"aria-hidden":`true`}),`Approve`]}),(0,V.jsxs)(_,{size:`sm`,variant:`ghost`,onClick:()=>i(`declined`),children:[(0,V.jsx)(j,{"aria-hidden":`true`}),`Decline`]})]}),n&&(0,V.jsxs)(`div`,{className:f(`panel rounded-md bg-(--page-surface-strong) p-6`,`flex max-w-[640px] flex-col gap-2`),children:[(0,V.jsx)(`label`,{htmlFor:`decide-${e.id}`,className:`text-body-sm font-medium text-ink-2`,children:n===`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,V.jsx)(a,{id:`decide-${e.id}`,value:o,onChange:e=>s(e.target.value),rows:2,maxLength:500,placeholder:`For example: the replays show the claim data is the cause.`}),u&&(0,V.jsx)(z,{text:u}),(0,V.jsxs)(`span`,{className:`flex gap-2`,children:[(0,V.jsxs)(_,{busy:c,size:`sm`,disabled:!m||c,onClick:g,children:[n===`approved`?(0,V.jsx)(A,{"aria-hidden":`true`}):(0,V.jsx)(j,{"aria-hidden":`true`}),c?`Keeping…`:n===`approved`?`Approve`:`Decline`]}),(0,V.jsxs)(_,{size:`sm`,variant:`outline`,onClick:()=>i(null),children:[(0,V.jsx)(O,{"aria-hidden":`true`}),`Cancel`]})]})]})]})}function yt({agent:e,run:t,c:n,candidates:i,onLinked:a}){let o=i,[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)([]),[d,p]=(0,B.useState)(!1),[m,g]=(0,B.useState)(``);return(0,V.jsxs)(`div`,{className:f(`flex flex-col gap-1 border-l-2 pl-4`,n.status===`proven`?`border-pass`:n.status===`refuted`?`border-fail`:n.status===`side-effects`?`border-warn`:`border-line`),children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsx)(C,{tone:gt[n.status].tone,children:gt[n.status].label}),(0,V.jsxs)(`span`,{className:`text-body-sm font-medium`,children:[n.id,` · `,_t[n.kind],`: `,H(n.where)]}),(0,V.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[`of `,K[n.finding.check],`: `,H(n.finding.rule)]})]}),(0,V.jsxs)(`span`,{className:`text-body-sm text-ink [overflow-wrap:anywhere]`,children:[`Change: `,H(n.change)]}),(0,V.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[H(n.why),`.`]}),n.replays.map(e=>(0,V.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`Replay `,(0,V.jsx)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e.run)),className:`font-mono`,children:e.run}),`: `,e.gone&&!e.broke.length&&e.changeSeen!==!1?`the finding is gone`:H(e.why.join(`; `))]},e.run)),!s&&o.length>0&&n.status!==`proven`&&(0,V.jsx)(`span`,{children:(0,V.jsxs)(_,{variant:`link`,size:`inline`,onClick:()=>c(!0),"data-tip":`Link replays`,className:`min-h-7 gap-1`,children:[(0,V.jsx)(he,{size:12,"aria-hidden":`true`}),`Link`]})}),s&&(0,V.jsxs)(`fieldset`,{className:f(`panel rounded-md bg-(--page-surface-strong) p-6`,`m-0 flex max-w-[640px] flex-col gap-2 border-0`),children:[(0,V.jsxs)(`legend`,{className:`sr-only`,children:[`Replays of `,n.id]}),(0,V.jsx)(`span`,{className:`text-body-sm 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.`}),o.map(e=>(0,V.jsxs)(`label`,{className:`flex min-h-8 items-center gap-2 text-body-sm`,children:[(0,V.jsx)(Ne,{checked:l.includes(e),onCheckedChange:t=>u(n=>t?[...n,e]:n.filter(t=>t!==e))}),(0,V.jsx)(`span`,{className:`font-mono`,children:e})]},e)),m&&(0,V.jsx)(z,{text:m}),(0,V.jsxs)(`span`,{className:`flex gap-2`,children:[(0,V.jsxs)(_,{busy:d,size:`sm`,disabled:!l.length||d,onClick:async()=>{p(!0),g(``);try{await h.replay(e,t,n.id,l),c(!1),u([]),a()}catch(e){g(e.message)}finally{p(!1)}},"data-tip":`Link the picked replays`,children:[(0,V.jsx)(he,{"aria-hidden":`true`}),d?`Linking…`:l.length?`Link (${l.length})`:`Link`]}),(0,V.jsxs)(_,{size:`sm`,variant:`outline`,onClick:()=>c(!1),children:[(0,V.jsx)(O,{"aria-hidden":`true`}),`Cancel`]})]})]})]})}function bt({sub:e}){let[t,a]=(0,B.useState)(null),[o,s]=(0,B.useState)(e?n(e):``),[c,l]=(0,B.useState)(null),[u,d]=(0,B.useState)(``),[p,m]=(0,B.useState)(0);(0,B.useEffect)(()=>{h.overview().then(e=>{let t=e.agents.map(e=>e.name);a(t),s(e=>e||t[0]||``)},e=>d(e.message))},[]),(0,B.useEffect)(()=>{o&&(l(null),h.learn(o).then(l,e=>d(e.message)))},[o,p]);let _=()=>m(e=>e+1);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(J,{id:`evidence-learn`,children:`Learn`}),(0,V.jsx)(L,{more:(0,V.jsx)(V.Fragment,{children:`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.`}),children:`What to change in an agent, from what its runs got wrong.`}),u&&(0,V.jsx)(z,{text:u}),t&&!t.length&&(0,V.jsx)(X,{}),t&&t.length>1&&(0,V.jsxs)(`label`,{className:`flex w-fit items-center gap-2 text-body-sm text-ink-2`,children:[`Agent`,(0,V.jsx)(i,{value:o,onChange:e=>s(e.target.value),children:t.map(e=>(0,V.jsx)(`option`,{value:e,children:H(e)},e))})]}),o&&!c&&!u&&(0,V.jsx)(Y,{}),c?.problems.map(e=>(0,V.jsx)(z,{text:e},e)),c&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`h2`,{className:`sr-only`,children:[`Proposals and causes of `,H(c.agent)]}),(0,V.jsxs)(R,{id:`proposals`,title:`Proposals`,icon:de,n:c.proposals.length,children:[c.proposals.length?(0,V.jsx)(`ul`,{"aria-label":`Proposals`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 list-none`),children:c.proposals.map(e=>(0,V.jsx)(vt,{p:e,onDecided:_},e.id))}):(0,V.jsx)(g,{className:`py-4`,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.`}),c.proposals.some(e=>e.state===`approved`)&&(0,V.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[(0,V.jsxs)(`code`,{children:[`forgeqe evidence guidance `,H(c.agent)]}),` writes what was approved as Markdown, to put into the agent.`]})]}),(0,V.jsxs)(R,{id:`fixes`,title:`Fixes proven by the harness`,icon:ce,n:c.fixes.length,children:[(0,V.jsxs)(`p`,{className:`m-0 text-body-sm 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,V.jsx)(`code`,{children:`forgeqe evidence fix apply <fix>`}),`), or puts its patch on a branch for a pull request.`]}),c.fixes.length?(0,V.jsx)(`ul`,{"aria-label":`Fixes`,className:`m-0 flex list-none flex-col gap-2 p-0`,children:c.fixes.map(e=>(0,V.jsx)(st,{f:e},`${e.id}-${e.at}`))}):(0,V.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`No fix proven yet: `,(0,V.jsx)(`code`,{children:`forgeqe evidence fix <run> H1`}),` proves one of a cause below.`]})]}),(0,V.jsx)(R,{id:`causes`,title:`Causes of its findings`,icon:k,n:c.runs.length,children:c.runs.length?(0,V.jsx)(`ul`,{"aria-label":`Runs and their causes`,className:`m-0 flex list-none flex-col gap-2 p-0`,children:c.runs.map(e=>(0,V.jsxs)(`li`,{className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col gap-2`),children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsx)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e.run)),className:`text-body-sm font-medium [overflow-wrap:anywhere]`,children:H(e.request||e.run)}),(0,V.jsxs)(`span`,{className:`font-mono text-body-sm text-muted`,children:[e.run,e.version?` · ${H(e.version)}`:``]})]}),e.causes.map(t=>(0,V.jsx)(yt,{agent:c.agent,run:e.run,c:t,candidates:e.candidates,onLinked:_},t.key)),!e.candidates.length&&(0,V.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[`No run of the same request is recorded after it yet: `,(0,V.jsxs)(`code`,{children:[`forgeqe evidence replay-kit `,e.run,` H1`]}),` says what to change for a replay.`]})]},e.run))}):(0,V.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`No run of this agent has an open finding.`})})]})]})}var $={observe:`Observe`,assist:`Assist`,act:`Act`,autonomous:`Autonomous`},xt={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`},St={model:`Model`,tool:`Tool`,knowledge:`Knowledge`,check:`Check`,judge:`Judge`,trust:`Trust`},Ct=[`observe`,`assist`,`act`,`autonomous`];function wt({agent:e,label:t,icon:n,tip:r,action:i,children:s,onDone:c,uid:l}){let[d,p]=(0,B.useState)(!1),[m,h]=(0,B.useState)(``),[g,v]=(0,B.useState)(``),[y,b]=(0,B.useState)(!1),[x,ee]=(0,B.useState)(``),S=m.trim().length>=10&&m.trim().length<=500&&g===e,te=async()=>{b(!0),ee(``);try{await i(g,m.trim()),p(!1),h(``),v(``),c()}catch(e){ee(e.message)}finally{b(!1)}};if(!d)return(0,V.jsx)(`span`,{children:(0,V.jsxs)(_,{size:`sm`,onClick:()=>p(!0),"data-tip":r,children:[(0,V.jsx)(n,{"aria-hidden":`true`}),t]})});let C=`${t}${l?`-${l}`:``}`.toLowerCase().replace(/[^a-z0-9]+/g,`-`);return(0,V.jsxs)(`div`,{className:f(u,`flex max-w-[640px] flex-col gap-2`),children:[s,(0,V.jsx)(`label`,{htmlFor:`${C}-reason`,className:`text-body-sm font-medium text-ink-2`,children:`Why? It is kept with your name and in the audit.`}),(0,V.jsx)(a,{id:`${C}-reason`,value:m,onChange:e=>h(e.target.value),rows:2,maxLength:500}),(0,V.jsxs)(`label`,{htmlFor:`${C}-confirm`,className:`text-body-sm font-medium text-ink-2`,children:[`Type `,H(e),` to confirm`]}),(0,V.jsx)(o,{id:`${C}-confirm`,value:g,onChange:e=>v(e.target.value),autoComplete:`off`}),x&&(0,V.jsx)(z,{text:x}),(0,V.jsxs)(`span`,{className:`flex gap-2`,children:[(0,V.jsxs)(_,{busy:y,size:`sm`,disabled:!S||y,onClick:te,"data-tip":r,children:[(0,V.jsx)(n,{"aria-hidden":`true`}),y?`Keeping…`:t]}),(0,V.jsxs)(_,{size:`sm`,variant:`outline`,onClick:()=>p(!1),children:[(0,V.jsx)(O,{"aria-hidden":`true`}),`Cancel`]})]})]})}function Tt(e){return(0,V.jsxs)(V.Fragment,{children:[e.slice(0,8).map((e,t)=>(0,V.jsxs)(`span`,{children:[t?`, `:``,(0,V.jsx)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e)),className:`font-mono`,children:e})]},e)),e.length>8?`, and ${e.length-8} more`:``]})}function Et({sub:e}){let t=e?n(e):``,[a,o]=(0,B.useState)(null),[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(0),[p,m]=(0,B.useState)(`observe`),v=()=>u(e=>e+1);(0,B.useEffect)(()=>{c(``),h.monitor(t||void 0).then(o,e=>c(e.message))},[t,l]);let y=async()=>{try{let e=await h.audit(t),n=URL.createObjectURL(new Blob([`${JSON.stringify(e,null,2)}\n`],{type:`application/json`})),r=document.createElement(`a`);r.href=n,r.download=`${t.replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^[-.]+/,``).slice(0,60)||`agent`}.audit.json`,r.click(),URL.revokeObjectURL(n)}catch(e){c(e.message)}},b=a?.agent;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(J,{id:`evidence-monitor`,children:`Monitor`}),(0,V.jsx)(L,{more:(0,V.jsxs)(V.Fragment,{children:[`For each agent evaluated: 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,V.jsx)(`code`,{children:`forgeqe evidence drift --all`}),`.`]}),children:`Watch what changes in each agent, and how much it can be trusted to do alone.`}),s&&(0,V.jsx)(z,{text:s}),!a&&!s&&(0,V.jsx)(Y,{}),a?.problems.map(e=>(0,V.jsx)(z,{text:e},e)),a&&!a.inventory.length&&(0,V.jsx)(X,{}),a&&a.inventory.length>0&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h2`,{className:`sr-only`,children:`Agents and their governance`}),(0,V.jsxs)(R,{id:`inventory`,title:`Inventory`,icon:ue,n:a.inventory.length,children:[(0,V.jsx)(F,{label:`Agents evaluated`,search:!1,minWidth:760,head:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Agent`}),(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Versions`}),(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Models`}),(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Tools`}),(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Contract`}),(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Trust`}),(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Alerts`})]}),children:a.inventory.map(e=>(0,V.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,V.jsx)(`th`,{scope:`row`,className:f(`px-4 py-2`,`text-left font-medium`),children:(0,V.jsx)(`a`,{href:r(`evidence-monitor`,encodeURIComponent(e.agent)),"aria-current":e.agent===t?`page`:void 0,children:H(e.agent)})}),(0,V.jsx)(`td`,{className:f(`px-4 py-2`,`text-muted`),children:e.versions.slice(0,3).map(H).join(`, `)||`none named`}),(0,V.jsx)(`td`,{className:f(`px-4 py-2`,`text-muted [overflow-wrap:anywhere]`),children:e.models.slice(0,3).map(H).join(`, `)||`none named`}),(0,V.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:e.tools.length}),(0,V.jsx)(`td`,{className:f(`px-4 py-2`,`text-muted`),children:e.contract?e.contract.approved?`Approved`:`Not approved`:`None`}),(0,V.jsx)(`td`,{className:`px-4 py-2`,children:e.granted?`${$[e.granted]} (supports ${$[e.supported].toLowerCase()})`:`Not granted (supports ${$[e.supported].toLowerCase()})`}),(0,V.jsx)(`td`,{className:f(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,e.alerts>0&&`text-fail`),"data-sort":e.baseline||e.alerts?e.alerts:-1,children:e.baseline||e.alerts?e.alerts:(0,V.jsx)(`span`,{className:`text-muted`,children:`no baseline`})})]},e.agent))}),!t&&(0,V.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Open an agent to see its drift, its trust and its audit.`})]}),b&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(R,{id:`drift`,title:`Drift of ${b.name}`,icon:ie,n:b.drift.alerts.length,children:[b.drift.baseline?(0,V.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Since its baseline (`,b.drift.baseline.version?H(b.drift.baseline.version):`no version`,`, `,d(b.drift.baseline.runs,`run`),`, set by `,H(b.drift.baseline.by),` `,U(b.drift.baseline.at),`): `,d(b.drift.since.length,`run`),`.`]}):(0,V.jsx)(`p`,{className:`m-0 text-body-sm 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,V.jsx)(`ul`,{"aria-label":`Drift alerts`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 list-none`),children:b.drift.alerts.map(e=>(0,V.jsxs)(`li`,{className:`flex flex-col gap-1 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsx)(C,{tone:`warn`,children:St[e.kind]}),(0,V.jsx)(`span`,{className:`text-body-sm [overflow-wrap:anywhere]`,children:H(e.what)})]}),e.runs.length>0&&(0,V.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[`In `,Tt(e.runs)]})]},`${e.kind}-${e.subject}`))}),b.drift.baseline&&!b.drift.alerts.length&&(0,V.jsx)(g,{className:`py-4`,children:`Nothing changed since the baseline.`}),(0,V.jsx)(wt,{agent:b.name,label:`Set baseline`,icon:ve,tip:b.drift.baseline?`Set a new baseline`:`Set the baseline`,action:(e,t)=>h.baseline(b.name,e,t),onDone:v,children:(0,V.jsx)(`span`,{className:`text-body-sm 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,V.jsxs)(R,{id:`trust`,title:`Trust in ${b.name}`,icon:fe,children:[(0,V.jsxs)(`p`,{className:`m-0 text-body-sm`,children:[`Its evidence supports `,(0,V.jsx)(`b`,{children:$[b.trust.supported]}),`: `,xt[b.trust.supported],`.`,` `,b.trust.granted?(0,V.jsxs)(V.Fragment,{children:[`Granted: `,(0,V.jsx)(`b`,{children:$[b.trust.granted.level]}),`, by `,H(b.trust.granted.by),` `,U(b.trust.granted.at),`: `,H(b.trust.granted.reason)]}):`No level is granted.`]}),(0,V.jsx)(`ul`,{"aria-label":`What each level needs`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 list-none`),children:b.trust.criteria.filter(e=>e.level!==`observe`).map(e=>(0,V.jsxs)(`li`,{className:`flex items-start gap-2 border-b border-line-soft px-4 py-2 text-body-sm last:border-b-0`,children:[(0,V.jsx)(x,{icon:e.met?A:Se,size:15,className:e.met?`mt-1 text-pass`:`mt-1 text-muted`}),(0,V.jsx)(`span`,{className:`w-[96px] shrink-0 font-medium`,children:$[e.level]}),(0,V.jsxs)(`span`,{className:`text-ink-2 [overflow-wrap:anywhere]`,children:[(0,V.jsx)(`span`,{className:`sr-only`,children:e.met?`Met: `:`Not met: `}),H(e.what)]})]},`${e.level}-${e.what}`))}),(0,V.jsx)(wt,{agent:b.name,label:`Grant`,icon:A,tip:`Grant a trust level`,action:(e,t)=>h.trust(b.name,p,e,t),onDone:v,children:(0,V.jsxs)(`label`,{className:`flex w-fit items-center gap-2 text-body-sm font-medium text-ink-2`,children:[`Level`,(0,V.jsx)(i,{value:p,onChange:e=>m(e.target.value),children:Ct.slice(0,Ct.indexOf(b.trust.supported)+1).map(e=>(0,V.jsxs)(`option`,{value:e,children:[$[e],`: `,xt[e]]},e))})]})})]}),(0,V.jsxs)(R,{id:`audit`,title:`Audit`,icon:be,children:[(0,V.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Every decision people made about `,H(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,V.jsx)(`span`,{children:(0,V.jsxs)(_,{size:`sm`,onClick:y,"data-tip":`Download the audit`,children:[(0,V.jsx)(pe,{"aria-hidden":`true`}),`Download`]})})]})]})]})]})}function Dt({page:e,sub:t}){let r=(t||``).split(`/`),i=r[0]===`agent`&&r[1]?n(r[1]):``,a=e===`evidence-runs`&&r[0]&&r[0]!==`agent`?n(r[0]):``;return(0,V.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,V.jsx)(Ae,{}),(0,V.jsx)(`main`,{className:f(je,`@container flex-auto gap-4`),children:e===`evidence`?t?(0,V.jsx)(Je,{agent:n(t)},t):(0,V.jsx)(Ge,{}):e===`evidence-contracts`?(0,V.jsx)(mt,{}):e===`evidence-review`?(0,V.jsx)(rt,{}):e===`evidence-releases`?(0,V.jsx)(ft,{}):e===`evidence-learn`?(0,V.jsx)(bt,{sub:t}):e===`evidence-monitor`?(0,V.jsx)(Et,{sub:t},t||``):a?(0,V.jsx)($e,{id:a},a):(0,V.jsx)(Ye,{agent:i})})]})}export{Dt as Evidence};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{n,r}from"./route-9BkoTWUE.js";import{I as i,L as a,P as o,V as s,c,i as l,s as u}from"./surface-c1kG1KPS.js";import{n as d,t as f}from"./utils-DJRAScIl.js";import{t as p}from"./jsx-runtime-LKYXHABd.js";import{I as m}from"./palette-dAh9kV3S.js";import{O as h}from"./api-D1PU4zye.js";import{A as g,F as _,I as v,L as y,O as b,P as x,T as ee,d as S,g as te,k as C,n as w,o as ne}from"./pageBack-DfGBh1Hs.js";import{B as T,D as re,E,Er as D,Gr as O,Jn as k,N as A,Nt as ie,O as ae,R as j,Tt as oe,Vn as se,Wr as ce,Yn as M,Zt as le,_ as ue,cn as N,cr as de,ir as fe,it as pe,k as me,on as he,pt as ge,vn as _e,w as ve,x as ye,xt as be,yn as xe,z as Se}from"./line-icons-Cwj9OmCz.js";import{At as Ce,K as we,Q as Te,Z as P,ct as Ee,dt as De,lt as Oe,ot as ke,rt as F,s as Ae,t as je,ut as Me}from"./frame-D0MS2ZMz.js";import{B as I,K as Ne,L as Pe,V as L,Y as Fe,z as Ie}from"./index-F8zkXd19.js";import{i as R,r as z}from"./productParts-CCceBbIo.js";var B=e(t(),1),V=p(),Le={"forgeqe-session":`ForgeQE session`,otlp:`OpenTelemetry trace`,jsonl:`the agent's own log`,langfuse:`Langfuse`,langsmith:`LangSmith`},Re={tool:ce,model:de,say:_e,plan:N,handoff:k,ask:_e,policy:fe,error:D},ze={text:`What it said`,file_change:`A file it changed`,report:`A report`,test_result:`A test result`,message:`A message it sent`},Be={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`},H=e=>e.replace(/[\u0000-\u0008\u000b-\u001f\u007f-\u009f\u2028\u2029]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`),U=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`})},W=25,G={PASS:{tone:`pass`,label:`Pass`},WARN:{tone:`warn`,label:`Warning`},FAIL:{tone:`fail`,label:`Fail`},UNKNOWN:{tone:`neutral`,label:`Not known`}},K={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`},Ve={build:{title:`Does the change work?`,icon:oe},behaviour:{title:`Did it work the agreed way?`,icon:T},decisions:{title:`Did it decide on the right grounds, with data it may use?`,icon:M},content:{title:`Was its answer right: on topic, grounded, complete?`,icon:ge},domain:{title:`Was its change right for the product?`,icon:ue}},q=200,He=`Agent governance`;function J({id:e,back:t=!0,children:n}){let r=Pe.some(t=>t.id===e);return(0,V.jsxs)(V.Fragment,{children:[t&&(0,V.jsx)(w,{}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,V.jsxs)(`span`,{className:`flex items-center gap-4`,children:[(0,V.jsx)(Ce,{pixel:m[r?Pe[0].id:e],size:`lg`,head:!0}),(0,V.jsx)(`h1`,{className:`m-0 text-headline-md`,children:r?He:n})]}),r&&(0,V.jsx)(we,{label:`Governance`,links:Pe,current:e})]})]})}function Y({shape:e=`rows`}){return(0,V.jsx)(te,{shape:e})}function X(){return(0,V.jsxs)(g,{page:!0,icon:oe,title:`No agent run recorded yet`,action:(0,V.jsx)(`a`,{href:`/help/guide`,target:`_blank`,rel:`noreferrer noopener`,className:v({size:`sm`}),children:`Read how to record a run`}),children:[`An agent's runs show here once they are recorded: while it runs, from its traces, or afterwards, from an export or its own log. At a terminal that is `,(0,V.jsx)(`code`,{children:`forgeqe evidence receive`}),` or `,(0,V.jsx)(`code`,{children:`forgeqe evidence record`}),`.`]})}var Ue=(0,V.jsxs)(V.Fragment,{children:[`Receive an agent's OpenTelemetry traces while it runs with `,(0,V.jsx)(`code`,{children:`forgeqe evidence receive`}),`; record a file with `,(0,V.jsx)(`code`,{children:`forgeqe evidence record`}),`: an OpenTelemetry export, a Langfuse or LangSmith export, an agent's own JSON log with `,(0,V.jsx)(`code`,{children:`--mapping mapping.yaml`}),`, or ForgeQE's own last session with `,(0,V.jsx)(`code`,{children:`--latest`}),`.`]});function We({refused:e}){return e.length?(0,V.jsxs)(`section`,{"aria-label":`Files that are not run records`,className:f(y.warn,`flex flex-col gap-1`),children:[(0,V.jsxs)(`span`,{className:`font-medium`,children:[d(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,V.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e},e))]}):null}function Ge(){let[e,t]=(0,B.useState)(null),[n,i]=(0,B.useState)(``);return(0,B.useEffect)(()=>{h.overview().then(t,e=>i(e.message))},[]),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(J,{id:`evidence`,children:`Evidence`}),(0,V.jsx)(L,{more:(0,V.jsxs)(V.Fragment,{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. `,Ue]}),children:`See what your AI agents did and decided, and whether it was what was agreed.`}),n&&(0,V.jsx)(z,{text:n}),!e&&!n&&(0,V.jsx)(Y,{shape:`detail`}),e&&(0,V.jsx)(We,{refused:e.refused}),e&&!e.runs&&(0,V.jsx)(X,{}),e&&e.runs>0&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(Ie,{label:`What is recorded`,children:[(0,V.jsx)(I,{dot:`neutral`,value:e.runs,label:e.runs===1?`run recorded`:`runs recorded`}),(0,V.jsx)(I,{dot:`neutral`,value:e.agents.length,label:e.agents.length===1?`agent`:`agents`})]}),(0,V.jsx)(`h2`,{className:`sr-only`,children:`What is recorded`}),(0,V.jsx)(R,{id:`agents`,title:`Agents`,icon:de,n:e.agents.length,children:(0,V.jsx)(`ul`,{"aria-label":`Agents`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 list-none`),children:e.agents.map(e=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(`a`,{href:r(`evidence`,encodeURIComponent(e.name)),className:f(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`min-h-12 flex-wrap gap-x-4 gap-y-1`),children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_320px] flex-col`,children:[(0,V.jsx)(`span`,{className:`truncate text-body-sm font-medium`,children:H(e.name)}),(0,V.jsxs)(`span`,{className:`truncate text-body-sm text-muted`,children:[e.versions.length?`versions ${e.versions.slice(0,4).join(`, `)}${e.versions.length>4?`, …`:``} · `:``,`from `,e.sources.map(e=>Le[e]||e).join(`, `)]})]}),(0,V.jsx)(`span`,{className:`text-body-sm text-ink-2 tabular-nums`,children:d(e.runs,`run`)}),(0,V.jsx)(`span`,{className:`text-body-sm text-ink-2 tabular-nums`,children:d(e.decisions,`decision`)}),(0,V.jsxs)(`span`,{className:`text-body-sm text-muted tabular-nums`,children:[d(e.gaps,`thing`,`things`),` not known`]}),(0,V.jsx)(`span`,{className:`text-body-sm 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=>d(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,V.jsx)(`span`,{className:`text-body-sm text-muted tabular-nums`,"data-tip":U(e.last),children:e.last?P(e.last):``})]})},e.name))})})]})]})}var Z={PASS:`Passed`,WARN:`Warned`,FAIL:`Failed`,UNKNOWN:`Not known`,NONE:`Not judged`};function Ke({t:e,label:t,on:n,onToggle:r,fail:i}){return e.n?(0,V.jsx)(_,{variant:`link`,size:`inline`,"aria-pressed":n,"aria-label":`${e.n}: ${t}. Show the runs`,onClick:r,className:f(`min-h-7 min-w-7 justify-end rounded-full px-2 tabular-nums aria-pressed:bg-accent-soft`,i&&!n&&`text-fail`),children:e.n}):(0,V.jsx)(`span`,{className:`inline-flex min-h-7 items-center justify-end px-2 text-muted tabular-nums`,children:`0`})}function qe({pick:e,d:t,onClose:n}){let[i,a]=(0,B.useState)(!1),o=i?e.runs:e.runs.slice(0,25);return(0,V.jsxs)(`div`,{className:f(u,`flex flex-col gap-2`),children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsxs)(`span`,{className:`text-body-sm font-medium text-ink [overflow-wrap:anywhere]`,children:[d(e.runs.length,`run`),` behind `,H(e.label)]}),(0,V.jsxs)(_,{size:`sm`,variant:`outline`,onClick:n,children:[(0,V.jsx)(O,{"aria-hidden":`true`}),`Close`]})]}),(0,V.jsx)(`ul`,{"aria-label":`Runs behind ${e.label}`,className:`m-0 list-none border-t border-line-soft py-1`,children:o.map(e=>{let n=t.brief[e];return(0,V.jsx)(`li`,{children:(0,V.jsxs)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e)),className:f(s,`grid min-h-10 grid-cols-[auto_minmax(0,1fr)_auto] gap-x-4`),children:[n&&n.status!==`NONE`?(0,V.jsx)(C,{tone:G[n.status].tone,children:G[n.status].label}):(0,V.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not judged`}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,V.jsx)(`span`,{className:`truncate text-body-sm`,children:H(n?.request||e)}),(0,V.jsxs)(`span`,{className:`truncate font-mono text-body-sm text-muted`,children:[e,n?.version?` · ${H(n.version)}`:``]})]}),(0,V.jsx)(`span`,{className:`text-right text-body-sm text-muted tabular-nums`,"data-tip":U(n?.started),children:n?.started?P(n.started):``})]})},e)})}),e.runs.length>o.length&&(0,V.jsxs)(_,{size:`sm`,variant:`ghost`,onClick:()=>a(!0),children:[(0,V.jsx)(E,{"aria-hidden":`true`}),`All (`,e.runs.length,`)`]})]})}function Je({agent:e}){let[t,n]=(0,B.useState)(null),[a,o]=(0,B.useState)(``),[s,c]=(0,B.useState)(null),[l,u]=(0,B.useState)(null);(0,B.useEffect)(()=>{h.dashboard(e).then(n,e=>o(e.message))},[e]);let d=e=>e?H(e):`no version`,p=t?t.versions.find(e=>e.version===s)||t.versions[0]:void 0,m=e=>l&&t&&l.key.startsWith(`${e}|`)?(0,V.jsx)(qe,{pick:l,d:t,onClose:()=>u(null)},l.key):null,g=(e,t,n,r)=>{let i=`${e}|${n}`;return(0,V.jsx)(Ke,{t,label:n,on:l?.key===i,onToggle:()=>u(l?.key===i?null:{key:i,label:n,runs:t.runs}),fail:r})};return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(w,{to:{href:r(`evidence`),label:`Evidence`}}),(0,V.jsx)(J,{id:`evidence`,back:!1,children:H(e)}),(0,V.jsx)(L,{more:(0,V.jsx)(V.Fragment,{children:`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.`}),children:`How this agent's runs were judged, version by version and week by week.`}),a&&(0,V.jsx)(z,{text:a}),!t&&!a&&(0,V.jsx)(Y,{shape:`detail`}),t?.problems.map(e=>(0,V.jsx)(z,{text:e},e)),t&&p&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-1 text-body-sm`,children:[(0,V.jsxs)(Ie,{label:`Its runs and versions`,children:[(0,V.jsx)(I,{dot:`neutral`,value:t.runs.n,label:t.runs.n===1?`run`:`runs`}),(0,V.jsx)(I,{dot:`neutral`,value:t.versions.length,label:t.versions.length===1?`version`:`versions`})]}),(0,V.jsx)(`a`,{href:r(`evidence-runs`,`agent`,encodeURIComponent(e)),children:`All its runs`}),(0,V.jsx)(`a`,{href:r(`evidence-learn`,encodeURIComponent(e)),children:`What to change`})]}),(0,V.jsx)(`h2`,{className:`sr-only`,children:`Its numbers`}),(0,V.jsxs)(R,{id:`versions`,title:`Versions`,icon:ie,n:t.versions.length,children:[(0,V.jsx)(F,{label:`Versions of ${e}`,search:!1,minWidth:640,head:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Version`}),[`Runs`,`Passed`,`Warned`,`Failed`,`Not known`,`Not judged`].map(e=>(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:e},e)),(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Last run`})]}),children:t.versions.map(e=>(0,V.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,V.jsx)(`th`,{scope:`row`,className:f(`px-4 py-2`,`text-left font-medium`),children:d(e.version)}),(0,V.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-sort":e.runs.n,children:g(`versions`,e.runs,`${d(e.version)}: runs`)}),[`PASS`,`WARN`,`FAIL`,`UNKNOWN`,`NONE`].map(t=>(0,V.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-sort":e.outcome[t].n,children:g(`versions`,e.outcome[t],`${d(e.version)}: ${Z[t].toLowerCase()}`,t===`FAIL`)},t)),(0,V.jsx)(`td`,{className:f(`px-4 py-2`,`text-muted`),"data-tip":U(e.last),"data-sort":e.last&&Date.parse(e.last)||0,children:e.last?P(e.last):``})]},e.version))}),m(`versions`)]}),t.versions.length>1&&t.benchmark.length>0&&(0,V.jsxs)(R,{id:`benchmark`,title:`Versions side by side`,icon:M,children:[(0,V.jsx)(`p`,{className:`m-0 text-body-sm 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,V.jsx)(F,{label:`Versions side by side`,search:!1,minWidth:480,head:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Check`}),t.versions.map(e=>(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:d(e.version)},e.version))]}),children:t.benchmark.map(e=>(0,V.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,V.jsx)(`th`,{scope:`row`,className:f(`px-4 py-2`,`text-left font-medium`),children:K[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,V.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-sort":t.rate??-1,children:t.rate===null?(0,V.jsx)(`span`,{className:`text-muted`,children:`not judged`}):(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,V.jsxs)(`span`,{className:f(t.rate<1&&`text-ink`),children:[Math.round(t.rate*100),`% of `,t.judged.n]}),n.n>0&&(0,V.jsx)(`span`,{className:`text-muted`,children:`·`}),n.n>0&&g(`benchmark`,n,`${K[e.check]} on ${d(t.version)}: not passed`,!0)]})},t.version)})]},`${e.lens}-${e.check}`))}),m(`benchmark`)]}),(0,V.jsxs)(R,{id:`checks`,title:`Checks`,icon:N,n:p.checks.length,children:[t.versions.length>1&&(0,V.jsxs)(`label`,{className:`flex w-fit items-center gap-2 text-body-sm text-ink-2`,children:[`Version`,(0,V.jsx)(i,{value:p.version,onChange:e=>{c(e.target.value),u(null)},children:t.versions.map(e=>(0,V.jsx)(`option`,{value:e.version,children:e.version||`no version`},e.version))})]}),p.checks.length?(0,V.jsx)(F,{label:`Checks of ${d(p.version)}`,search:!1,minWidth:600,head:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Check`}),(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Lens`}),[`Passed`,`Warned`,`Failed`,`Not known`,`Overruled`].map(e=>(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:e},e))]}),children:p.checks.map(e=>(0,V.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,V.jsx)(`th`,{scope:`row`,className:f(`px-4 py-2`,`text-left font-medium`),children:K[e.check]}),(0,V.jsx)(`td`,{className:f(`px-4 py-2`,`text-muted`),children:it[e.lens]}),[`PASS`,`WARN`,`FAIL`,`UNKNOWN`].map(t=>(0,V.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-sort":e.outcome[t].n,children:g(`checks`,e.outcome[t],`${K[e.check]}: ${Z[t].toLowerCase()}`,t===`FAIL`)},t)),(0,V.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-sort":e.overruled.n,children:g(`checks`,e.overruled,`${K[e.check]}: overruled`)})]},`${e.lens}-${e.check}`))}):(0,V.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`No contract judged these runs: `,(0,V.jsx)(`a`,{href:r(`evidence-contracts`),children:`Contracts`}),` says what one agrees.`]}),m(`checks`)]}),p.rules.length>0&&(0,V.jsxs)(R,{id:`recurring`,title:`What keeps going wrong`,icon:D,n:p.rules.length,children:[(0,V.jsx)(`ul`,{"aria-label":`What keeps going wrong`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 list-none`),children:p.rules.slice(0,20).map(e=>(0,V.jsxs)(`li`,{className:`flex flex-col gap-1 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsx)(C,{tone:G[e.status].tone,children:G[e.status].label}),(0,V.jsxs)(`span`,{className:`text-body-sm font-medium`,children:[K[e.check],`: `,H(e.rule)]}),(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-body-sm text-muted`,children:[`in `,g(`recurring`,e.runs,`${K[e.check]}: ${e.rule}`),` `,e.runs.n===1?`run`:`runs`]})]}),(0,V.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`For example: `,H(e.example)]})]},`${e.check}-${e.rule}`))}),m(`recurring`)]}),(0,V.jsxs)(R,{id:`weeks`,title:`Week by week`,icon:ye,n:t.weeks.length,children:[(0,V.jsx)(F,{label:`Week by week`,search:!1,minWidth:520,head:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Week`}),[`PASS`,`WARN`,`FAIL`,`UNKNOWN`,`NONE`].map(e=>(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:Z[e]},e))]}),children:t.weeks.toReversed().map(e=>(0,V.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,V.jsx)(`th`,{scope:`row`,className:f(`px-4 py-2`,`text-left font-medium tabular-nums`),children:e.week===`undated`?`No date`:e.week}),[`PASS`,`WARN`,`FAIL`,`UNKNOWN`,`NONE`].map(t=>(0,V.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,"data-sort":e.outcome[t].n,children:g(`weeks`,e.outcome[t],`${e.week}: ${Z[t].toLowerCase()}`,t===`FAIL`)},t))]},e.week))}),m(`weeks`)]})]})]})}function Ye({agent:e}){let[t,n]=(0,B.useState)(null),[a,o]=(0,B.useState)([]),[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(``),[p,m]=(0,B.useState)(e),[g,v]=(0,B.useState)(`all`),[y,x]=(0,B.useState)(0);(0,B.useEffect)(()=>{h.runs().then(e=>{n(e.runs),o(e.refused)},e=>c(e.message))},[]),(0,B.useEffect)(()=>m(e),[e]);let S=(0,B.useMemo)(()=>[...new Set((t||[]).map(e=>e.agent))].sort(),[t]),te=l.toLowerCase().split(/\s+/).filter(Boolean),C=(t||[]).filter(e=>(!p||e.agent===p)&&te.every(t=>`${e.agent} ${e.request||``} ${e.id} ${e.source.name}`.toLowerCase().includes(t))),w=g===`failed`?C.filter(e=>e.failed):C,ne={all:C.length,failed:C.filter(e=>e.failed).length},T=Math.max(1,Math.ceil(w.length/W)),E=Math.min(y,T-1),D=w.slice(E*W,E*W+W);(0,B.useEffect)(()=>x(0),[l,p,g]);let O=t||[],k=O.filter(e=>e.failed).length;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(J,{id:`evidence-runs`,children:`Agent runs`}),(0,V.jsx)(L,{more:(0,V.jsxs)(V.Fragment,{children:[`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. `,Ue]}),children:`Every agent run recorded here, newest first.`}),s&&(0,V.jsx)(z,{text:s}),!t&&!s&&(0,V.jsx)(Y,{}),(0,V.jsx)(We,{refused:a}),t&&!t.length&&(0,V.jsx)(X,{}),t&&t.length>0&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsxs)(Ie,{label:`Runs recorded`,children:[(0,V.jsx)(I,{dot:`neutral`,value:O.length,label:O.length===1?`run`:`runs`}),(0,V.jsx)(I,{dot:k?`fail`:`pass`,value:k,label:`with a failed step (${Math.round(k/O.length*100)}%)`}),(0,V.jsx)(I,{dot:`neutral`,value:O.reduce((e,t)=>e+t.decisions,0),label:O.reduce((e,t)=>e+t.decisions,0)===1?`decision`:`decisions`}),(0,V.jsx)(I,{dot:`neutral`,value:new Set(O.map(e=>e.agent)).size,label:new Set(O.map(e=>e.agent)).size===1?`agent`:`agents`})]}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(b,{id:`evidence-search`,label:`Find a run`,value:l,onChange:u,placeholder:`Find a run by what was asked`}),(0,V.jsx)(ee,{items:[{id:`all`,label:`All`,n:ne.all},{id:`failed`,label:`Failed`,n:ne.failed,alert:!0}],value:g,onChange:v}),S.length>1&&(0,V.jsxs)(i,{size:`sm`,"aria-label":`Agent`,value:p,onChange:e=>m(e.target.value),className:`w-auto pr-8 pl-4`,children:[(0,V.jsx)(`option`,{value:``,children:`Every agent`}),S.map(e=>(0,V.jsx)(`option`,{value:e,children:H(e)},e))]})]}),(0,V.jsxs)(`div`,{className:`surface rounded-lg bg-bg p-6 shadow-sm`,children:[(0,V.jsxs)(`ul`,{"aria-label":`Agent runs`,className:`m-0 list-none p-2`,children:[!D.length&&(0,V.jsx)(`li`,{className:`px-4 py-4 text-body-sm text-muted`,children:`Nothing matches.`}),D.map((e,t)=>(0,V.jsxs)(`li`,{className:`contents`,children:[(t===0||Te(D[t-1].started)!==Te(e.started))&&(0,V.jsx)(`span`,{className:`block px-4 pt-4 pb-1 text-body-sm font-medium text-muted`,children:Te(e.started)}),(0,V.jsxs)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e.id)),className:f(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] gap-x-4`),children:[e.failed?(0,V.jsx)(Se,{size:16,"aria-label":`${e.failed} failed ${e.failed===1?`step`:`steps`}`,className:`flex-none text-fail`}):(0,V.jsx)(A,{size:16,"aria-label":`No failed step`,className:`flex-none text-muted`}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,V.jsx)(`span`,{className:`truncate text-body-sm font-medium`,"data-tip":e.request||e.agent,children:H(e.request||`${e.agent}: request not recorded`)}),(0,V.jsx)(`span`,{className:`truncate text-body-sm text-muted`,children:[H(`${e.agent}${e.version?` ${e.version}`:``}`),d(e.steps,`step`),d(e.decisions,`decision`),`${d(e.gaps,`thing`,`things`)} not known`,Le[e.source.kind],e.content?`content kept`:`inputs as fingerprints`,e.verdict?`verdict: ${G[e.verdict].label.toLowerCase()}`:`no contract`].join(` · `)})]}),(0,V.jsx)(`span`,{className:`text-right text-body-sm text-muted tabular-nums`,"data-tip":U(e.started),children:e.started?P(e.started):``})]})]},e.id))]}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 border-t border-line-soft px-4 py-2 text-body-sm text-muted`,children:[(0,V.jsx)(`span`,{className:`flex-1`,children:w.length?`${E*W+1}–${Math.min(w.length,E*W+W)} of ${w.length}`:`0 runs`}),T>1&&(0,V.jsxs)(`nav`,{"aria-label":`Pages of agent runs`,className:`flex items-center gap-1`,children:[(0,V.jsx)(_,{size:`sm`,variant:`ghost`,disabled:E===0,onClick:()=>x(E-1),"aria-label":`Newer runs`,"data-tip":`Newer runs`,children:(0,V.jsx)(re,{"aria-hidden":`true`})}),(0,V.jsxs)(`span`,{className:`px-1 tabular-nums`,children:[`Page `,E+1,` of `,T]}),(0,V.jsx)(_,{size:`sm`,variant:`ghost`,disabled:E>=T-1,onClick:()=>x(E+1),"aria-label":`Older runs`,"data-tip":`Older runs`,children:(0,V.jsx)(ae,{"aria-hidden":`true`})})]})]})]})]})]})}function Q({t:e,label:t}){let[n,r]=(0,B.useState)(!1);if(e.text===void 0)return(0,V.jsxs)(`span`,{className:`font-mono text-body-sm text-muted`,children:[t,`: fingerprint only, `,e.chars.toLocaleString(),` characters, sha256 `,e.sha256.slice(0,12),`…`]});let i=e.text.length>600;return(0,V.jsxs)(`span`,{className:`flex flex-col items-start gap-1`,children:[(0,V.jsx)(`span`,{className:`text-body-sm whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:H(i&&!n?`${e.text.slice(0,600)}…`:e.text)}),i&&(0,V.jsxs)(_,{variant:`link`,size:`inline`,onClick:()=>r(!n),"data-tip":n?void 0:`Show all ${e.text.length.toLocaleString()} characters`,className:`gap-1`,children:[n?(0,V.jsx)(me,{size:12,"aria-hidden":`true`}):(0,V.jsx)(E,{size:12,"aria-hidden":`true`}),n?`Less`:`More`]})]})}function Xe({d:e}){return(0,V.jsxs)(`div`,{className:`flex flex-col gap-1 border-l-2 border-accent-line pl-4`,children:[(0,V.jsxs)(`span`,{className:`text-body-sm font-medium text-muted`,children:[`Decided`,e.by?` · by ${H(e.by)}`:``]}),(0,V.jsxs)(`span`,{className:`text-body-sm text-ink [overflow-wrap:anywhere]`,children:[H(e.what),`: `,(0,V.jsx)(`b`,{className:`font-medium`,children:H(e.chose)})]}),e.options&&e.options.length>0&&(0,V.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[`Options: `,H(e.options.join(`, `))]}),e.reason?(0,V.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,V.jsx)(`span`,{className:`text-body-sm text-muted`,children:`The reason given (a claim, not checked yet):`}),(0,V.jsx)(Q,{t:e.reason,label:`reason`})]}):(0,V.jsx)(`span`,{className:`text-body-sm text-muted`,children:`No reason given.`})]})}function Ze({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,V.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 outline-none last:border-b-0 focus-visible:bg-accent-soft`,children:[(0,V.jsx)(`span`,{className:`pt-1 text-right text-body-sm text-muted tabular-nums`,children:e.seq}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,V.jsx)(x,{icon:Re[e.kind]||ce,size:14,className:`flex-none`}),(0,V.jsx)(`span`,{className:`text-body-sm font-medium [overflow-wrap:anywhere]`,children:H(e.name)}),(0,V.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.kind}),e.agent&&(0,V.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[`· by `,H(e.agent)]}),e.ok===!1&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-body-sm text-fail`,children:[(0,V.jsx)(Se,{size:13,"aria-hidden":`true`}),`failed`]}),e.ms!==void 0&&(0,V.jsxs)(`span`,{className:`text-body-sm text-muted tabular-nums`,children:[`· `,e.ms.toLocaleString(),` ms`]})]}),a.length>0&&(0,V.jsx)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:H(a.map(([e,t])=>`${e}: ${String(t)}`).join(` · `))}),e.detail&&(0,V.jsx)(Q,{t:e.detail,label:`details`}),e.instructions&&(0,V.jsxs)(`details`,{className:`border-l-2 border-line pl-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-body-sm font-medium text-muted`,children:(()=>{let n=t.steps.filter(t=>t.seq<e.seq&&t.instructions?.sha256===e.instructions.sha256);return n.length?`Instructions, the same as step ${n[n.length-1].seq}`:`Instructions given to the model`})()}),(0,V.jsx)(`div`,{className:`mt-1`,children:(0,V.jsx)(Q,{t:e.instructions,label:`instructions`})})]}),n.map(e=>(0,V.jsxs)(`div`,{className:`flex flex-col gap-1 border-l-2 border-line pl-4`,children:[(0,V.jsxs)(`span`,{className:`text-body-sm font-medium text-muted [overflow-wrap:anywhere]`,children:[`Took in `,Be[e.kind]||e.kind,` from `,H(e.source)]}),(0,V.jsx)(Q,{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,V.jsx)(Xe,{d:e},e.seq)),i.map(e=>(0,V.jsxs)(`div`,{className:`flex flex-col gap-1 border-l-2 border-line pl-4`,children:[(0,V.jsx)(`span`,{className:`text-body-sm font-medium text-muted`,children:`Said (a claim about its own work, not checked yet)`}),(0,V.jsx)(Q,{t:e.text,label:`statement`})]},e.seq))]})]})}function Qe({r:e,goTo:t}){let n=e.steps.filter(e=>e.kind===`model`),r=n.find(e=>e.instructions),i=new Set(n.filter(e=>e.instructions).map(e=>e.instructions.sha256)).size,a=e.outputs.filter(e=>e.kind===`text`),o=a[a.length-1],s=a.slice(0,-1),c=e.outputs.filter(e=>e.kind!==`text`),u=e=>n.reduce((t,n)=>t+(typeof n.facts?.[e]==`number`?n.facts[e]:0),0),d=u(`tokens_in`),f=u(`tokens_out`),p=[...new Set(n.map(e=>e.name))],m=({children:e})=>(0,V.jsx)(`span`,{className:`text-body-sm font-medium text-muted`,children:e}),h=({seq:e})=>(0,V.jsxs)(_,{variant:`link`,size:`inline`,onClick:()=>t(e),children:[`step `,e]});return(0,V.jsx)(R,{id:`evidence-io`,title:`Prompt and output`,icon:xe,children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(n.length>0||d+f>0)&&(0,V.jsxs)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:[n.length,` model `,n.length===1?`call`:`calls`,p.length?` (${H(p.join(`, `))})`:``,d+f>0?` · ${d.toLocaleString()} tokens in, ${f.toLocaleString()} out`:``]}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,V.jsxs)(m,{children:[`Instructions (system prompt)`,r?(0,V.jsxs)(V.Fragment,{children:[` · from `,(0,V.jsx)(h,{seq:r.seq})]}):null,i>1?` · ${i} different ones in this run`:``]}),(0,V.jsx)(`div`,{className:l,children:r?.instructions?(0,V.jsx)(Q,{t:r.instructions,label:`instructions`}):(0,V.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not in the record: its source did not hold the instructions the model was given.`})})]}),(0,V.jsxs)(`div`,{className:`grid gap-4 @3xl:grid-cols-2`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,V.jsxs)(m,{children:[`Request`,e.request?.by?` · from ${H(e.request.by)}`:``,e.request?.from?` · read from the ${H(e.request.from)}`:``]}),(0,V.jsx)(`div`,{className:l,children:e.request?.text?(0,V.jsx)(Q,{t:e.request.text,label:`request`}):(0,V.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not in the record: its source did not say what the agent was asked.`})})]}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,V.jsxs)(m,{children:[`Final answer`,o?(0,V.jsxs)(V.Fragment,{children:[` · `,(0,V.jsx)(h,{seq:o.step})]}):null]}),(0,V.jsx)(`div`,{className:l,children:o?.data?(0,V.jsx)(Q,{t:o.data,label:`answer`}):(0,V.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not in the record: its source did not say what the agent answered.`})})]})]}),c.length>0&&(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,V.jsxs)(m,{children:[`What it produced (`,c.length,`)`]}),(0,V.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:c.map(e=>(0,V.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-2 text-body-sm text-ink-2`,children:[ze[e.kind]||e.kind,e.target?(0,V.jsx)(`span`,{className:`font-mono text-body-sm [overflow-wrap:anywhere]`,children:H(e.target)}):null,`· `,(0,V.jsx)(h,{seq:e.step})]},e.id))})]}),s.length>0&&(0,V.jsxs)(`details`,{className:`group flex flex-col gap-2`,children:[(0,V.jsxs)(`summary`,{className:`cursor-pointer text-body-sm font-medium text-muted`,children:[`What it said on the way (`,s.length,`)`]}),(0,V.jsx)(`ol`,{className:`m-0 mt-2 flex list-none flex-col gap-2 p-0`,children:s.map(e=>(0,V.jsxs)(`li`,{className:`flex flex-col gap-1 border-l-2 border-line pl-4`,children:[(0,V.jsx)(h,{seq:e.step}),e.data?(0,V.jsx)(Q,{t:e.data,label:`said`}):null]},e.id))})]})]})})}function $e({id:e}){let[t,n]=(0,B.useState)(null),[i,a]=(0,B.useState)(``),[o,s]=(0,B.useState)(q);(0,B.useEffect)(()=>{h.run(e).then(n,e=>a(e.message))},[e]);let c=(0,V.jsx)(w,{to:{href:r(`evidence-runs`),label:`All agent runs`}});if(!t)return(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[c,i?(0,V.jsx)(z,{text:i}):(0,V.jsx)(Y,{shape:`detail`})]});let l=t.decisions.filter(e=>!e.step),u=t.steps.filter(e=>e.ok===!1).length,d=e=>{e>o&&s(Math.ceil(e/q)*q),requestAnimationFrame(()=>{let t=document.getElementById(`evidence-step-${e}`);t?.scrollIntoView({block:`start`}),t?.focus({preventScroll:!0})})},p=[...t.gaps,...t.truncated?[t.truncated]:[]];return(0,V.jsxs)(`section`,{"aria-labelledby":`evidence-run-h`,className:`flex flex-col gap-6`,children:[(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[c,(0,V.jsx)(Fe,{id:`evidence-run-h`,icon:k,title:H(t.request?.text?.text?t.request.text.text.slice(0,200):`${t.agent.name}: request not recorded`)}),(0,V.jsxs)(`p`,{className:`m-0 text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[H(`${t.agent.name}${t.agent.version?` ${t.agent.version}`:``}${t.agent.model?` · ${t.agent.model}`:``}${t.agent.provider?` (${t.agent.provider})`:``}`),` · from `,Le[t.source.kind],`, `,H(t.source.name),t.started?` · ${U(t.started)}`:``,t.ended&&t.ended!==t.started?` to ${U(t.ended)}`:``]}),(0,V.jsx)(`p`,{className:`m-0 font-mono text-body-sm text-muted`,children:t.id})]}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1 text-body-sm text-muted`,children:[(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`b`,{className:`text-ink tabular-nums`,children:t.steps.length}),` `,t.steps.length===1?`step`:`steps`]}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`b`,{className:f(`tabular-nums`,u?`text-fail`:`text-ink`),children:u}),` failed`]}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`b`,{className:`text-ink tabular-nums`,children:t.inputs.length}),` `,t.inputs.length===1?`input`:`inputs`]}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`b`,{className:`text-ink tabular-nums`,children:t.decisions.length}),` `,t.decisions.length===1?`decision`:`decisions`]}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`b`,{className:`text-ink tabular-nums`,children:t.statements.length}),` `,t.statements.length===1?`claim`:`claims`]}),(0,V.jsx)(`span`,{children:t.content?`Content kept, with secrets cut out`:`Inputs kept as fingerprints only`})]}),(0,V.jsx)(Qe,{r:t,goTo:d}),(0,V.jsx)(et,{id:t.id,goTo:d}),(0,V.jsx)(R,{id:`evidence-gaps`,title:`What the record cannot say`,icon:le,n:p.length,children:p.length?(0,V.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:p.map(e=>(0,V.jsx)(`li`,{className:`border-b border-line-soft py-2 text-body-sm text-ink-2 last:border-b-0 [overflow-wrap:anywhere]`,children:H(e)},e))}):(0,V.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Nothing: the source said everything the record holds.`})}),(0,V.jsxs)(R,{id:`evidence-timeline`,title:`Timeline`,icon:k,n:t.steps.length,children:[(0,V.jsx)(`ol`,{"aria-label":`Steps`,className:`m-0 flex list-none flex-col p-0`,children:t.steps.slice(0,o).map(e=>(0,V.jsx)(Ze,{s:e,r:t},e.seq))}),t.steps.length>o&&(0,V.jsxs)(_,{size:`sm`,variant:`ghost`,className:`self-start`,onClick:()=>s(o+q),"data-tip":`Show ${Math.min(q,t.steps.length-o)} more of ${t.steps.length-o}`,children:[(0,V.jsx)(E,{"aria-hidden":`true`}),`More (`,Math.min(q,t.steps.length-o),`)`]})]}),l.length>0&&(0,V.jsx)(R,{id:`evidence-loose`,title:`Decisions not tied to a step`,icon:M,n:l.length,children:(0,V.jsx)(`div`,{className:`flex flex-col gap-4`,children:l.map(e=>(0,V.jsx)(Xe,{d:e},e.seq))})}),(0,V.jsx)(R,{id:`evidence-inputs`,title:`Data it took in`,icon:be,n:t.inputs.length,children:t.inputs.length?(0,V.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.inputs.map(e=>(0,V.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-x-4 gap-y-1 border-b border-line-soft py-2 last:border-b-0`,children:[(0,V.jsxs)(`span`,{className:`min-w-0 flex-[1_1_320px] text-body-sm [overflow-wrap:anywhere]`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:Be[e.kind]||e.kind}),` `,(0,V.jsx)(`span`,{className:`text-muted`,children:`from`}),` `,H(e.source)]}),(0,V.jsxs)(`span`,{className:`text-body-sm text-muted tabular-nums`,children:[`step `,e.step]}),(0,V.jsx)(`span`,{className:`font-mono text-body-sm text-muted`,children:e.data.text===void 0?`${e.data.chars.toLocaleString()} chars · ${e.data.sha256.slice(0,12)}`:`kept`})]},e.id))}):(0,V.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`The record holds no input.`})})]})}function et({id:e,goTo:t}){let[n,i]=(0,B.useState)(null),[a,o]=(0,B.useState)(``),[s,l]=(0,B.useState)(0),u=()=>l(e=>e+1);if((0,B.useEffect)(()=>{h.verdict(e).then(i,e=>o(e.message))},[e,s]),a)return(0,V.jsx)(z,{text:a});if(!n)return(0,V.jsx)(Y,{shape:`lines`});let d=n.why||!n.verdicts.length?(0,V.jsx)(R,{id:`evidence-behaviour`,title:Ve.behaviour.title,icon:T,children:(0,V.jsxs)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:[`Not judged: `,H(n.why||`no contract judges this agent.`),` A contract says what was agreed for an agent; `,(0,V.jsx)(`a`,{href:r(`evidence-contracts`),children:`Contracts`}),` lists them.`]})}):null;return(0,V.jsxs)(V.Fragment,{children:[n.work&&(0,V.jsxs)(`p`,{className:f(`m-0`,y[n.work.personTakesOver?`warn`:`info`]),children:[n.work.attempt?`Fix attempt ${n.work.attempt} of 2 at `:`The first run of work tried again in `,n.work.attempt?(0,V.jsx)(`a`,{href:r(`evidence-runs`,encodeURIComponent(n.work.first)),children:n.work.first}):`${n.work.runs.length-1} ${n.work.runs.length===2?`fix attempt`:`fix attempts`}`,n.work.personTakesOver?`: findings are still open after the last attempt, so a person takes over.`:`.`]}),d,n.verdicts.map(e=>(0,V.jsx)(R,{id:`evidence-${e.lens}`,title:Ve[e.lens].title,icon:Ve[e.lens].icon,children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsx)(C,{tone:G[e.status].tone,children:G[e.status].label}),(0,V.jsx)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:e.contract?(0,V.jsxs)(V.Fragment,{children:[`By contract `,H(e.contract.name),`, version `,H(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,V.jsx)(`p`,{className:`m-0 text-body-sm text-muted [overflow-wrap:anywhere]`,children:H(e)},e)),(0,V.jsx)(`ul`,{"aria-label":`Checks`,className:f(c,`m-0 flex list-none flex-col`),children:e.checks.map(n=>(0,V.jsxs)(`li`,{className:`flex flex-col gap-2 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsx)(`span`,{className:`min-w-[152px] text-body-sm font-medium`,children:K[n.check]}),(0,V.jsx)(C,{tone:G[n.status].tone,children:G[n.status].label}),(0,V.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[H(n.checked),n.gating?` · can fail a run`:n.advisory&&e.contract?.approved?` · ${n.advisory}`:``]})]}),n.findings.map(n=>(0,V.jsx)(nt,{f:n,run:e.run,goTo:t,onOverruled:u},n.id))]},n.check))}),e.lens===`content`&&n.rubric&&(0,V.jsx)(tt,{run:e.run,rubric:n.rubric,onGraded:u})]})},e.lens))]})}function tt({run:e,rubric:t,onGraded:n}){let[r,i]=(0,B.useState)(null),[o,s]=(0,B.useState)(``),[l,u]=(0,B.useState)(!1),[d,p]=(0,B.useState)(``),m=o.trim().length>=10&&o.trim().length<=500,g=async()=>{if(r){u(!0),p(``);try{await h.grade(e,r.id,r.grade,o.trim()),i(null),s(``),n()}catch(e){p(e.message)}finally{u(!1)}}};return(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsx)(`h4`,{className:`m-0 text-body-sm font-medium`,children:`Grade the answer`}),(0,V.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[t.criteria.some(e=>e.id===`scenario`)?`Its scenario is graded by a person: the release gate counts it only once you have graded it. `:``,t.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.`]}),t.answer!==void 0&&(0,V.jsx)(`p`,{className:f(`rounded-base bg-surface-muted p-4`,`m-0 whitespace-pre-wrap text-body-sm text-ink [overflow-wrap:anywhere]`),children:H(t.answer)}),(0,V.jsx)(`ul`,{"aria-label":`Rubric criteria`,className:f(c,`m-0 flex list-none flex-col`),children:t.criteria.map(e=>(0,V.jsxs)(`li`,{className:`flex flex-col gap-2 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsxs)(`span`,{className:`text-body-sm text-ink [overflow-wrap:anywhere]`,children:[(0,V.jsx)(`span`,{className:`font-mono text-muted`,children:e.id}),` `,H(e.text)]}),e.grade&&(0,V.jsx)(C,{tone:e.grade.grade===`meets`?`pass`:`warn`,children:e.grade.grade===`meets`?`Meets`:`Misses`}),(0,V.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.grade?`Grade again:`:`Grade:`}),[`meets`,`misses`].map(t=>(0,V.jsx)(_,{variant:`link`,size:`inline`,"aria-label":`${e.id} ${t===`meets`?`meets`:`misses`}`,onClick:()=>i({id:e.id,grade:t}),className:`min-h-7 px-2`,children:t===`meets`?`Meets`:`Misses`},t))]}),e.grade&&(0,V.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`Graded by `,H(e.grade.by),` `,U(e.grade.at),`: `,H(e.grade.reason)]}),r?.id===e.id&&(0,V.jsxs)(`div`,{className:f(`panel rounded-md bg-(--page-surface-strong) p-6`,`flex max-w-[640px] flex-col gap-2`),children:[(0,V.jsxs)(`label`,{htmlFor:`grade-${e.id}`,className:`text-body-sm font-medium text-ink-2`,children:[`Why does the answer `,r.grade===`meets`?`meet`:`miss`,` it?`]}),(0,V.jsx)(a,{id:`grade-${e.id}`,value:o,onChange:e=>s(e.target.value),rows:2,maxLength:500,placeholder:`For example: it says the customer must send a photo by Friday.`}),d&&(0,V.jsx)(z,{text:d}),(0,V.jsxs)(`span`,{className:`flex gap-2`,children:[(0,V.jsxs)(_,{busy:l,size:`sm`,disabled:!m||l,onClick:g,"data-tip":r.grade===`meets`?`Keep the grade: meets`:`Keep the grade: misses`,children:[(0,V.jsx)(ve,{"aria-hidden":`true`}),l?`Keeping…`:`Keep`]}),(0,V.jsxs)(_,{size:`sm`,variant:`outline`,onClick:()=>i(null),children:[(0,V.jsx)(O,{"aria-hidden":`true`}),`Cancel`]})]})]})]},e.id))})]})}function nt({f:e,run:t,goTo:n,onOverruled:r}){let[i,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(!1),[d,p]=(0,B.useState)(``),m=s.trim().length>=10&&s.trim().length<=500,g=async()=>{u(!0),p(``);try{await h.overrule(t,e.id,s.trim()),o(!1),r()}catch(e){p(e.message)}finally{u(!1)}};return(0,V.jsxs)(`div`,{className:f(`flex flex-col gap-1 border-l-2 pl-4`,e.overruled?`border-line opacity-80`:e.status===`FAIL`?`border-fail`:e.status===`WARN`?`border-warn`:`border-line`),children:[(0,V.jsx)(`span`,{className:f(`text-body-sm [overflow-wrap:anywhere]`,e.overruled?`text-ink-2`:`text-ink`),children:H(e.what)}),e.fix&&!e.overruled&&(0,V.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`Fix: `,H(e.fix)]}),e.overruled&&(0,V.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`Overruled by `,H(e.overruled.by),` `,U(e.overruled.at),` (`,e.overruled.via===`web`?`on this page`:`at a terminal`,`): `,H(e.overruled.reason)]}),(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-body-sm text-muted`,children:[(0,V.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:H(e.source)}),e.location&&(0,V.jsx)(`span`,{className:`font-mono [overflow-wrap:anywhere]`,children:H(`${e.location.repo?`${e.location.repo}/`:``}${e.location.file}${e.location.line?`:${e.location.line}`:``}`)}),[...new Set(e.steps)].slice(0,12).map(e=>(0,V.jsxs)(_,{variant:`link`,size:`inline`,onClick:()=>n(e),className:`min-h-7 px-2 tabular-nums`,children:[`step `,e]},e)),!e.overruled&&e.status!==`UNKNOWN`&&!i&&(0,V.jsxs)(_,{variant:`link`,size:`inline`,onClick:()=>o(!0),className:`min-h-7 gap-1 px-2`,children:[(0,V.jsx)(j,{size:12,"aria-hidden":`true`}),`Overrule`]})]}),i&&(0,V.jsxs)(`div`,{className:f(`panel rounded-md bg-(--page-surface-strong) p-6`,`flex max-w-[640px] flex-col gap-2`),children:[(0,V.jsx)(`label`,{htmlFor:`overrule-${e.id}`,className:`text-body-sm 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,V.jsx)(a,{id:`overrule-${e.id}`,value:s,onChange:e=>c(e.target.value),rows:2,maxLength:500,placeholder:`For example: the owner agreed this removal in the change's review.`}),d&&(0,V.jsx)(z,{text:d}),(0,V.jsxs)(`span`,{className:`flex gap-2`,children:[(0,V.jsxs)(_,{busy:l,size:`sm`,disabled:!m||l,onClick:g,children:[(0,V.jsx)(j,{"aria-hidden":`true`}),l?`Overruling…`:`Overrule`]}),(0,V.jsxs)(_,{size:`sm`,variant:`outline`,onClick:()=>o(!1),children:[(0,V.jsx)(O,{"aria-hidden":`true`}),`Cancel`]})]})]})]})}function rt(){let[e,t]=(0,B.useState)(null),[n,i]=(0,B.useState)(``);return(0,B.useEffect)(()=>{h.review().then(t,e=>i(e.message))},[]),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(J,{id:`evidence-review`,children:`Review queue`}),(0,V.jsx)(L,{more:(0,V.jsx)(V.Fragment,{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.`}),children:`What waits for a person: open findings to read, answers to grade, and what was overruled.`}),n&&(0,V.jsx)(z,{text:n}),!e&&!n&&(0,V.jsx)(Y,{}),e?.problems.map(e=>(0,V.jsx)(z,{text:e},e)),e&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h2`,{className:`sr-only`,children:`What waits, what to grade, and what was overruled`}),(0,V.jsx)(R,{id:`waiting`,title:`Waiting for a person`,icon:T,n:e.waiting.length,children:e.waiting.length?(0,V.jsx)(`ul`,{"aria-label":`Waiting for a person`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 list-none`),children:e.waiting.map(e=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e.run)),className:f(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] gap-x-4`),children:[(0,V.jsx)(C,{tone:G[e.status].tone,children:G[e.status].label}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,V.jsx)(`span`,{className:`truncate text-body-sm font-medium`,children:H(e.request||`${e.agent}: request not recorded`)}),(0,V.jsx)(`span`,{className:`truncate text-body-sm text-muted`,children:[H(e.agent),d(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,V.jsx)(`span`,{className:`text-right text-body-sm text-muted tabular-nums`,"data-tip":U(e.started),children:e.started?P(e.started):``})]})},e.run))}):(0,V.jsx)(g,{className:`py-4`,children:`Nothing waits: no run has an open finding.`})}),e.grade.length>0&&(0,V.jsxs)(R,{id:`grade`,title:`Answers to grade`,icon:N,n:e.grade.length,children:[(0,V.jsx)(`p`,{className:`m-0 text-body-sm 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,V.jsx)(`ul`,{"aria-label":`Answers to grade`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 list-none`),children:e.grade.map(e=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e.run)),className:f(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`grid min-h-12 grid-cols-[minmax(0,1fr)_auto] gap-x-4`),children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,V.jsx)(`span`,{className:`truncate text-body-sm font-medium`,children:H(e.request||`${e.agent}: request not recorded`)}),(0,V.jsx)(`span`,{className:`truncate text-body-sm text-muted`,children:[H(e.agent),`${e.ungraded} of ${e.criteria} ${e.criteria===1?`criterion`:`criteria`} not graded`].join(` · `)})]}),(0,V.jsx)(`span`,{className:`text-right text-body-sm text-muted tabular-nums`,"data-tip":U(e.started),children:e.started?P(e.started):``})]})},e.run))})]}),(0,V.jsx)(R,{id:`overruled`,title:`Overruled by people`,icon:M,n:e.overruled.length,children:e.overruled.length?(0,V.jsx)(`ul`,{"aria-label":`Overruled findings`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 list-none`),children:e.overruled.map(e=>(0,V.jsxs)(`li`,{className:`flex flex-col gap-1 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,V.jsxs)(`span`,{className:`text-body-sm [overflow-wrap:anywhere]`,children:[(0,V.jsx)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e.run)),children:H(e.agent||e.run)}),` · `,H(`${e.check}/${e.rule}`),e.what?`: ${H(e.what)}`:``]}),(0,V.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[H(e.by),` `,U(e.at),` (`,e.via===`web`?`on the page`:`at a terminal`,`): `,H(e.reason)]})]},`${e.run}-${e.finding}-${e.at}`))}):(0,V.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`No finding has been overruled.`})})]})]})}var it={build:`Build and test`,behaviour:`Behaviour`,decisions:`Decisions and data`,content:`Content`,domain:`Domain`};function at({s:e}){let[t,n]=(0,B.useState)(e.versions[0]||``),[r,a]=(0,B.useState)(e.versions[1]||``),[o,s]=(0,B.useState)(null),[l,u]=(0,B.useState)(``);(0,B.useEffect)(()=>{e.agent&&t&&(u(``),h.release(e.agent,t,r===t?``:r).then(s,e=>u(e.message)))},[e.agent,t,r]);let p=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`},m=o?[...new Set([...Object.keys(o.candidate.lensPass),...Object.keys(o.live?.lensPass||{})])]:[];return(0,V.jsxs)(`li`,{className:f(c,`flex flex-col gap-4`),children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsx)(`span`,{className:`text-body-lg font-medium [overflow-wrap:anywhere]`,children:H(e.agent||e.name)}),(0,V.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[H(`${e.name}.yaml`),` · `,d(e.scenarios.length,`scenario`)]})]}),e.problem&&(0,V.jsx)(z,{text:e.problem}),e.agent&&!e.versions.length&&(0,V.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`No run of `,H(e.agent),` is recorded yet: run each scenario's request through a version and record it (forgeqe evidence scenarios lists them).`]}),e.versions.length>0&&(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-body-sm`,children:[(0,V.jsx)(`label`,{htmlFor:`cand-${e.name}`,children:`Candidate`}),(0,V.jsx)(i,{size:`sm`,id:`cand-${e.name}`,value:t,onChange:e=>n(e.target.value),className:`w-auto pr-8 pl-4`,children:e.versions.map(e=>(0,V.jsx)(`option`,{value:e,children:H(e)},e))}),(0,V.jsx)(`label`,{htmlFor:`live-${e.name}`,children:`against live`}),(0,V.jsxs)(i,{size:`sm`,id:`live-${e.name}`,value:r,onChange:e=>a(e.target.value),className:`w-auto pr-8 pl-4`,children:[(0,V.jsx)(`option`,{value:``,children:`No live version`}),e.versions.filter(e=>e!==t).map(e=>(0,V.jsx)(`option`,{value:e,children:H(e)},e))]})]}),l&&(0,V.jsx)(z,{text:l}),o&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsx)(C,{tone:o.status===`ready`?`pass`:`fail`,children:o.status===`ready`?`Ready`:`Held`}),(0,V.jsx)(`span`,{className:`text-body-sm text-ink-2`,children:o.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.`})]}),o.reasons.length>0&&(0,V.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-6 text-body-sm text-ink-2`,children:o.reasons.map(e=>(0,V.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:H(e)},e))}),(0,V.jsxs)(F,{label:`Scenarios of ${e.agent}`,search:!1,sortable:!1,minWidth:520,head:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Scenario`}),(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Kind`}),o.live&&(0,V.jsxs)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:[H(o.live.version),` (live)`]}),(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:H(o.candidate.version)})]}),children:[e.scenarios.map(e=>(0,V.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,V.jsx)(`th`,{scope:`row`,className:f(`px-4 py-2`,`text-left font-medium`),"data-tip":e.request,children:H(e.id)}),(0,V.jsx)(`td`,{className:`px-4 py-2`,children:e.kind}),o.live&&(0,V.jsx)(`td`,{className:f(`px-4 py-2`,o.live.cells[e.id]&&!o.live.cells[e.id].pass&&`text-fail`),children:p(o.live.cells[e.id])}),(0,V.jsx)(`td`,{className:f(`px-4 py-2`,(o.candidate.cells[e.id]===null||o.candidate.cells[e.id]&&!o.candidate.cells[e.id].pass)&&`text-fail`),children:p(o.candidate.cells[e.id])})]},e.id)),m.map(e=>(0,V.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,V.jsxs)(`th`,{scope:`row`,className:f(`px-4 py-2`,`text-left text-muted`),children:[it[e],`: scenarios passed`]}),(0,V.jsx)(`td`,{className:`px-4 py-2`}),o.live&&(0,V.jsx)(`td`,{className:f(`px-4 py-2`,`tabular-nums`),children:o.live.lensPass[e]??0}),(0,V.jsx)(`td`,{className:f(`px-4 py-2`,`tabular-nums`,o.live&&(o.candidate.lensPass[e]??0)<(o.live.lensPass[e]??0)&&`text-fail`),children:o.candidate.lensPass[e]??0})]},e)),(0,V.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,V.jsx)(`th`,{scope:`row`,className:f(`px-4 py-2`,`text-left text-muted`),children:`The owners' expectations met`}),(0,V.jsx)(`td`,{className:`px-4 py-2`}),o.live&&(0,V.jsx)(`td`,{className:f(`px-4 py-2`,`tabular-nums`),children:o.live.golden}),(0,V.jsx)(`td`,{className:f(`px-4 py-2`,`tabular-nums`,o.live&&o.candidate.golden<o.live.golden&&`text-fail`),children:o.candidate.golden})]})]}),(0,V.jsx)(ut,{g:o}),(0,V.jsx)(ot,{g:o}),(0,V.jsx)(dt,{g:o,ids:e.scenarios.map(e=>e.id)})]}),e.history.length>0&&(0,V.jsxs)(`details`,{className:`text-body-sm`,children:[(0,V.jsxs)(`summary`,{className:`cursor-pointer text-ink-2`,children:[`Gates kept (`,e.history.length,`)`]}),(0,V.jsx)(`ul`,{className:`m-0 mt-1 flex list-none flex-col gap-1 p-0`,children:e.history.map(e=>(0,V.jsxs)(`li`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[U(e.at),` · `,H(e.by),` · `,H(e.candidate),e.live?` against ${H(e.live)}`:``,`: `,e.status===`ready`?`ready`:`held`,e.reasons.length?` (${H(e.reasons[0])}${e.reasons.length>1?`, and ${e.reasons.length-1} more`:``})`:``]},e.at))})]})]})}function ot({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,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,V.jsxs)(`h4`,{className:`m-0 text-body-sm font-medium`,children:[`Answers waiting for your grade (`,t.length,`)`]}),(0,V.jsx)(`p`,{className:`m-0 text-body-sm 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,V.jsx)(`ul`,{"aria-label":`Answers waiting for a grade`,className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm`,children:t.map(e=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e.run)),className:`text-accent-fg hover:underline`,children:[H(e.sid),`: `,e.run]})},e.run))})]}):null}function st({f:e}){return(0,V.jsxs)(`li`,{className:f(c,`flex flex-col gap-2`),children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsx)(C,{tone:e.applied||e.proven?`pass`:`fail`,children:e.applied?`Applied`:e.proven?`Proven`:`Not proven`}),(0,V.jsx)(`span`,{className:`text-body-sm font-medium [overflow-wrap:anywhere]`,children:H(e.instruction)}),(0,V.jsx)(`span`,{className:`font-mono text-body-sm text-muted`,children:e.id})]}),(0,V.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`Adds it to `,H(e.file),`, for `,H(e.cause),` of `,(0,V.jsx)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e.run)),className:`font-mono`,children:e.run}),` (scenario `,H(e.scenario),`, `,H(e.version),`).`]}),(0,V.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`The cause: `,e.proof.replace(`-`,` `),` (`,H(e.why),`)`,e.replays.length?(0,V.jsxs)(V.Fragment,{children:[`; replays `,Tt(e.replays)]}):null,`.`]}),(0,V.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`The suite, run from the patched copy against `,H(e.version),`: `,e.gate.status===`ready`?`no worse`:`held: ${H(e.gate.reasons.join(` `))}`]}),e.applied&&(0,V.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`Applied by `,H(e.applied.by),` `,U(e.applied.at),`: `,H(e.applied.reason)]}),(0,V.jsxs)(`details`,{className:`text-body-sm`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-ink-2`,children:`The patch`}),(0,V.jsx)(`pre`,{className:f(S,`m-0 mt-1 overflow-x-auto`),children:H(e.patch)})]})]})}function ct({d:e,onDecided:t}){let n=e.scenario,r=n.expect||{},i=e.source.kind===`run`?`a run that failed`:e.source.kind===`story`?`an acceptance criterion`:e.source.kind===`rule`?`a business rule of the product, at`:`a defect`,a=e=>(e||[]).map(e=>H(e)).join(`, `);return(0,V.jsxs)(`li`,{className:`flex flex-col gap-2 border-b border-line-soft px-4 py-4 last:border-b-0`,children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsx)(`span`,{className:`font-mono text-body-sm text-muted`,children:e.id}),(0,V.jsxs)(`span`,{className:`text-body-sm font-medium [overflow-wrap:anywhere]`,children:[H(n.id),` for `,H(e.agent)]}),(0,V.jsx)(C,{tone:`neutral`,children:n.kind}),n.held_out&&(0,V.jsx)(C,{tone:`neutral`,children:`Held out`}),e.decided&&(0,V.jsx)(C,{tone:e.decided.decision===`accepted`?`pass`:`warn`,children:e.decided.decision===`accepted`?`Accepted`:`Rejected`})]}),(0,V.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`Drafted by `,e.by===`code`?`code`:`a model`,` from `,i,` `,e.source.url&&ne(e.source.url)===`web`?(0,V.jsx)(`a`,{href:e.source.url,target:`_blank`,rel:`noreferrer noopener`,className:`text-accent-fg hover:underline`,children:H(e.source.ref)}):H(e.source.ref),e.source.criterion?` ${H(e.source.criterion)}`:``,e.source.quote?(0,V.jsxs)(V.Fragment,{children:[`: “`,H(e.source.quote),`”`]}):e.source.why?(0,V.jsxs)(V.Fragment,{children:[`: `,H(e.source.why)]}):null]}),(0,V.jsx)(`p`,{className:f(l,`m-0 whitespace-pre-wrap text-body-sm text-ink [overflow-wrap:anywhere]`),children:H(n.request)}),(0,V.jsxs)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-6 text-body-sm text-ink-2`,children:[r.chose&&(0,V.jsxs)(`li`,{children:[`Expects it to choose `,a(r.chose)]}),r.not_chose&&(0,V.jsxs)(`li`,{children:[`Expects it never to choose `,a(r.not_chose)]}),r.says&&(0,V.jsxs)(`li`,{children:[`Expects it to say: `,a(r.says)]}),r.not_says&&(0,V.jsxs)(`li`,{children:[`Expects it never to say: `,a(r.not_says)]}),r.graded&&(0,V.jsx)(`li`,{children:`A person grades each answer`}),(0,V.jsx)(`li`,{children:r.clean?`Every lens must find nothing`:`The lenses are counted lens by lens`})]}),e.decided?(0,V.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[e.decided.decision===`accepted`?`Accepted`:`Rejected`,` by `,H(e.decided.by),` `,U(e.decided.at),e.decided.scenario?` as ${H(e.decided.scenario)}`:``,`: `,H(e.decided.reason)]}):(0,V.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[(0,V.jsx)(wt,{agent:e.id,uid:`${e.id}-accept`,label:`Add`,icon:se,tip:`Add to the suite`,action:(t,n)=>h.decideDraft(e.id,`accepted`,t,n),onDone:t}),(0,V.jsx)(wt,{agent:e.id,uid:`${e.id}-reject`,label:`Reject`,icon:j,action:(t,n)=>h.decideDraft(e.id,`rejected`,t,n),onDone:t})]})]})}function lt({onDecided:e}){let[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(``),a=()=>h.drafts().then(n,e=>i(e.message));(0,B.useEffect)(()=>{a()},[]);let o=t?.drafts.filter(e=>!e.decided).length??0;return(0,V.jsxs)(R,{id:`drafts`,title:`Drafted scenarios`,icon:N,n:o,children:[(0,V.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Drafted from work items' acceptance criteria and defects (`,(0,V.jsx)(`code`,{children:`forgeqe evidence draft <agent> --from ado:N`}),`) or the product graph's business rules (`,(0,V.jsx)(`code`,{children:`--from-product`}),`), each resting on a quote of its source, or from a run that failed (`,(0,V.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.`]}),r&&(0,V.jsx)(z,{text:r}),t?.problems.map(e=>(0,V.jsx)(z,{text:e},e)),t&&!t.drafts.length&&(0,V.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`No draft yet.`}),t&&t.drafts.length>0&&(0,V.jsx)(`ul`,{"aria-label":`Drafted scenarios`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 flex list-none flex-col`),children:t.drafts.map(t=>(0,V.jsx)(ct,{d:t,onDecided:()=>{a(),e()}},t.id))})]})}function ut({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=>[it[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)}% (${it[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,V.jsxs)(`details`,{className:`text-body-sm`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-ink-2`,children:`Scores: runs passed, lens by lens`}),(0,V.jsx)(`p`,{className:`m-0 mt-1 text-body-sm 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,V.jsx)(F,{label:`Scores`,search:!1,sortable:!1,minWidth:420,head:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`th`,{scope:`col`,className:Oe,children:`Score`}),t.map(t=>(0,V.jsxs)(`th`,{scope:`col`,className:Me,children:[H(t.version),e.live&&t===e.live?` (live)`:``]},t.version))]}),children:r.map(([e,n])=>(0,V.jsxs)(`tr`,{className:De,children:[(0,V.jsx)(`th`,{scope:`row`,className:f(ke,`text-left font-medium`),children:e}),t.map(e=>(0,V.jsx)(`td`,{className:Ee,children:n(e)},e.version))]},e))})]})}function dt({g:e,ids:t}){let n=e=>e?e.runs.find(e=>e.path?.unmet.length)??e.runs.find(e=>e.path):void 0,i=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(!i.length)return null;let a={same:``,missing:`expected, not done`,extra:`done, not expected`},o=(e,t)=>t?.path?(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,V.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[e,`: `,(0,V.jsx)(`a`,{href:r(`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,V.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-1 p-0 font-mono text-body-sm`,children:(t.path.alignment.length?t.path.alignment:t.path.actual.map(e=>({kind:`same`,step:e}))).map((e,t)=>(0,V.jsxs)(`li`,{className:f(`[overflow-wrap:anywhere]`,e.kind===`missing`&&`text-fail`,e.kind===`extra`&&`text-warn`),children:[e.kind===`missing`?`− `:e.kind===`extra`?`+ `:` `,H(e.step),e.kind!==`same`&&(0,V.jsxs)(`span`,{className:`font-sans text-body-sm text-muted`,children:[` (`,a[e.kind],`)`]})]},`${t}-${e.step}`))}),t.path.unmet.map(e=>(0,V.jsx)(`span`,{className:`text-body-sm text-fail [overflow-wrap:anywhere]`,children:H(e)},e))]}):(0,V.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[e,`: not run`]});return(0,V.jsxs)(`details`,{className:`text-body-sm`,children:[(0,V.jsxs)(`summary`,{className:`cursor-pointer text-ink-2`,children:[`Paths: expected against actual (`,i.length,`)`]}),(0,V.jsx)(`ul`,{className:`m-0 mt-2 flex list-none flex-col gap-4 p-0`,children:i.map(t=>(0,V.jsxs)(`li`,{className:f(c,`flex flex-col gap-2`),children:[(0,V.jsx)(`span`,{className:`text-body-sm font-medium`,children:H(t.id)}),(0,V.jsxs)(`div`,{className:`grid gap-4 @[640px]:grid-cols-2`,children:[e.live&&o(`${e.live.version} (live)`,t.live),o(e.candidate.version,t.cand)]})]},t.id))})]})}function ft(){let[e,t]=(0,B.useState)(null),[n,r]=(0,B.useState)(``),i=()=>h.releases().then(t,e=>r(e.message));return(0,B.useEffect)(()=>{i()},[]),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(J,{id:`evidence-releases`,children:`Releases`}),(0,V.jsx)(L,{more:(0,V.jsxs)(V.Fragment,{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,V.jsx)(`code`,{children:`forgeqe evidence release`}),` keeps each gate. A suite is written in `,(0,V.jsx)(`code`,{children:`.forgeqe/evidence/scenarios/<agent>.yaml`}),` (docs/EVIDENCE.md has its form).`]}),children:`Release an agent's new version only when it does at least as well as the live one on its scenarios.`}),n&&(0,V.jsx)(z,{text:n}),!e&&!n&&(0,V.jsx)(Y,{}),e&&!e.suites.length&&(0,V.jsx)(g,{className:`py-4`,children:`No scenario suite yet: add drafted scenarios below to start one. A suite can also be written by hand; How it works says where.`}),e&&e.suites.length>0&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h2`,{className:`sr-only`,children:`Each agent's scenario suite and release gate`}),(0,V.jsx)(R,{id:`suites`,title:`Scenario suites`,icon:N,n:e.suites.length,children:(0,V.jsx)(`ul`,{"aria-label":`Scenario suites`,className:`m-0 flex list-none flex-col gap-4 p-0`,children:e.suites.map(e=>(0,V.jsx)(at,{s:e},e.name))})})]}),e&&(0,V.jsx)(lt,{onDecided:i})]})}var pt={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 mt(){let[e,t]=(0,B.useState)(null),[n,r]=(0,B.useState)(``);(0,B.useEffect)(()=>{h.contracts().then(t,e=>r(e.message))},[]);let i=e=>e===null?`–`:`${Math.round(e*100)}%`;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(J,{id:`evidence-contracts`,children:`Contracts`}),(0,V.jsx)(L,{more:(0,V.jsxs)(V.Fragment,{children:[`A contract says the steps an agent 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,V.jsx)(`code`,{children:`forgeqe evidence contract new "<agent>"`}),`; a person approves it at a terminal with `,(0,V.jsx)(`code`,{children:`forgeqe evidence contract approve <name>`}),`.`]}),children:`What each agent's owner agreed it must and may do, and how well each check is measured.`}),n&&(0,V.jsx)(z,{text:n}),!e&&!n&&(0,V.jsx)(Y,{}),e&&!e.contracts.length&&(0,V.jsx)(g,{className:`py-4`,children:`No contract yet. Without one, a run's record is kept, but nothing checks it against what was agreed.`}),e&&(0,V.jsx)(`h2`,{className:`sr-only`,children:`The contracts and how each check is measured`}),e&&e.contracts.length>0&&(0,V.jsx)(R,{id:`contracts`,title:`Contracts`,icon:be,n:e.contracts.length,children:(0,V.jsx)(`ul`,{"aria-label":`Contracts`,className:`m-0 flex list-none flex-col gap-4 p-0`,children:e.contracts.map(e=>(0,V.jsxs)(`li`,{className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col gap-2`),children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsx)(`span`,{className:`text-body-lg font-medium [overflow-wrap:anywhere]`,children:H(e.agent||e.name)}),(0,V.jsx)(C,{tone:pt[e.state].tone,children:pt[e.state].label}),(0,V.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[H(`${e.name}.yaml`),e.version?` · version ${H(e.version)}`:``,e.approved?` · approved ${U(e.approved.at)} by ${H(e.approved.by)}`:``]})]}),e.problem&&(0,V.jsx)(z,{text:e.problem}),e.says.length>0&&(0,V.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:e.says.map(e=>(0,V.jsx)(`li`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:H(e)},e))}),(0,V.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.gates.length?`Can fail a run: ${e.gates.map(e=>K[e]).join(`, `)}.`:`No check can fail a run under it yet: what they find is a warning.`})]},e.name))})}),e&&(0,V.jsxs)(R,{id:`measured`,title:`How well each check is measured`,icon:ie,children:[(0,V.jsxs)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:[`On `,d(e.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 `,e.measured.min,` labelled findings.`]}),e.measured.problems.map(e=>(0,V.jsx)(z,{text:`Not measured: ${e}`},e)),(0,V.jsx)(`div`,{className:`@container`,children:(0,V.jsx)(F,{label:`How well each check is measured`,search:!1,head:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Check`}),[`Labelled`,`Found right`,`Found wrong`,`Missed`,`Precision`,`Recall`].map(e=>(0,V.jsx)(`th`,{scope:`col`,className:f(`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,`whitespace-normal`,ht.has(e)&&`hidden @lg:table-cell`),children:e},e))]}),children:Object.keys(K).filter(t=>e.measured.checks[t]).map(t=>{let n=e.measured.checks[t];return(0,V.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,V.jsx)(`th`,{scope:`row`,className:f(`px-4 py-2`,`text-left font-medium`),children:K[t]}),(0,V.jsx)(`td`,{className:f(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,n.labelled<e.measured.min&&`text-muted`),children:n.labelled}),(0,V.jsx)(`td`,{className:f(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden @lg:table-cell`),children:n.tp}),(0,V.jsx)(`td`,{className:f(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden @lg:table-cell`,n.fp>0&&`text-fail`),children:n.fp}),(0,V.jsx)(`td`,{className:f(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden @lg:table-cell`,n.fn>0&&`text-fail`),children:n.fn}),(0,V.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:i(n.precision)}),(0,V.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:i(n.recall)})]},t)})})})]})]})}var ht=new Set([`Found right`,`Found wrong`,`Missed`]),gt={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`}},_t={instruction:`Its instructions`,tool:`A tool`,data:`Its data`};function vt({p:e,onDecided:t}){let[n,i]=(0,B.useState)(null),[o,s]=(0,B.useState)(``),[c,l]=(0,B.useState)(!1),[u,p]=(0,B.useState)(``),m=o.trim().length>=10&&o.trim().length<=500,g=async()=>{if(n){l(!0),p(``);try{await h.decide(e.agent,e.id,n,o.trim()),i(null),t()}catch(e){p(e.message)}finally{l(!1)}}};return(0,V.jsxs)(`li`,{className:`flex flex-col gap-1 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsx)(C,{tone:e.state===`approved`?`pass`:e.state===`declined`?`neutral`:`warn`,children:e.state===`approved`?`Approved`:e.state===`declined`?`Declined`:`Open`}),(0,V.jsx)(`span`,{className:`text-body-sm font-medium text-ink-2`,children:e.kind===`fix`?`Fix, proven by replay`:`Guidance for its instructions`}),(0,V.jsx)(`span`,{className:`font-mono text-body-sm text-muted`,children:e.id})]}),(0,V.jsx)(`span`,{className:`text-body-sm text-ink [overflow-wrap:anywhere]`,children:H(e.text)}),(0,V.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[`Because `,H(e.because),`. `,d(e.runs.length,`run`),e.replays?`, ${d(e.replays.length,`replay`)}`:``,`:`,` `,[...e.runs,...e.replays??[]].slice(0,8).map((e,t)=>(0,V.jsxs)(`span`,{children:[t?`, `:``,(0,V.jsx)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e)),className:`font-mono`,children:e})]},e))]}),e.decision&&(0,V.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[e.state===`approved`?`Approved`:`Declined`,` by `,H(e.decision.by),` `,U(e.decision.at),` (`,e.decision.via===`web`?`on this page`:`at a terminal`,`): `,H(e.decision.reason)]}),e.state===`open`&&!n&&(0,V.jsxs)(`span`,{className:`flex gap-2`,children:[(0,V.jsxs)(_,{size:`sm`,onClick:()=>i(`approved`),children:[(0,V.jsx)(A,{"aria-hidden":`true`}),`Approve`]}),(0,V.jsxs)(_,{size:`sm`,variant:`ghost`,onClick:()=>i(`declined`),children:[(0,V.jsx)(j,{"aria-hidden":`true`}),`Decline`]})]}),n&&(0,V.jsxs)(`div`,{className:f(`panel rounded-md bg-(--page-surface-strong) p-6`,`flex max-w-[640px] flex-col gap-2`),children:[(0,V.jsx)(`label`,{htmlFor:`decide-${e.id}`,className:`text-body-sm font-medium text-ink-2`,children:n===`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,V.jsx)(a,{id:`decide-${e.id}`,value:o,onChange:e=>s(e.target.value),rows:2,maxLength:500,placeholder:`For example: the replays show the claim data is the cause.`}),u&&(0,V.jsx)(z,{text:u}),(0,V.jsxs)(`span`,{className:`flex gap-2`,children:[(0,V.jsxs)(_,{busy:c,size:`sm`,disabled:!m||c,onClick:g,children:[n===`approved`?(0,V.jsx)(A,{"aria-hidden":`true`}):(0,V.jsx)(j,{"aria-hidden":`true`}),c?`Keeping…`:n===`approved`?`Approve`:`Decline`]}),(0,V.jsxs)(_,{size:`sm`,variant:`outline`,onClick:()=>i(null),children:[(0,V.jsx)(O,{"aria-hidden":`true`}),`Cancel`]})]})]})]})}function yt({agent:e,run:t,c:n,candidates:i,onLinked:a}){let o=i,[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)([]),[d,p]=(0,B.useState)(!1),[m,g]=(0,B.useState)(``);return(0,V.jsxs)(`div`,{className:f(`flex flex-col gap-1 border-l-2 pl-4`,n.status===`proven`?`border-pass`:n.status===`refuted`?`border-fail`:n.status===`side-effects`?`border-warn`:`border-line`),children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsx)(C,{tone:gt[n.status].tone,children:gt[n.status].label}),(0,V.jsxs)(`span`,{className:`text-body-sm font-medium`,children:[n.id,` · `,_t[n.kind],`: `,H(n.where)]}),(0,V.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[`of `,K[n.finding.check],`: `,H(n.finding.rule)]})]}),(0,V.jsxs)(`span`,{className:`text-body-sm text-ink [overflow-wrap:anywhere]`,children:[`Change: `,H(n.change)]}),(0,V.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[H(n.why),`.`]}),n.replays.map(e=>(0,V.jsxs)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:[`Replay `,(0,V.jsx)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e.run)),className:`font-mono`,children:e.run}),`: `,e.gone&&!e.broke.length&&e.changeSeen!==!1?`the finding is gone`:H(e.why.join(`; `))]},e.run)),!s&&o.length>0&&n.status!==`proven`&&(0,V.jsx)(`span`,{children:(0,V.jsxs)(_,{variant:`link`,size:`inline`,onClick:()=>c(!0),"data-tip":`Link replays`,className:`min-h-7 gap-1`,children:[(0,V.jsx)(he,{size:12,"aria-hidden":`true`}),`Link`]})}),s&&(0,V.jsxs)(`fieldset`,{className:f(`panel rounded-md bg-(--page-surface-strong) p-6`,`m-0 flex max-w-[640px] flex-col gap-2 border-0`),children:[(0,V.jsxs)(`legend`,{className:`sr-only`,children:[`Replays of `,n.id]}),(0,V.jsx)(`span`,{className:`text-body-sm 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.`}),o.map(e=>(0,V.jsxs)(`label`,{className:`flex min-h-8 items-center gap-2 text-body-sm`,children:[(0,V.jsx)(Ne,{checked:l.includes(e),onCheckedChange:t=>u(n=>t?[...n,e]:n.filter(t=>t!==e))}),(0,V.jsx)(`span`,{className:`font-mono`,children:e})]},e)),m&&(0,V.jsx)(z,{text:m}),(0,V.jsxs)(`span`,{className:`flex gap-2`,children:[(0,V.jsxs)(_,{busy:d,size:`sm`,disabled:!l.length||d,onClick:async()=>{p(!0),g(``);try{await h.replay(e,t,n.id,l),c(!1),u([]),a()}catch(e){g(e.message)}finally{p(!1)}},"data-tip":`Link the picked replays`,children:[(0,V.jsx)(he,{"aria-hidden":`true`}),d?`Linking…`:l.length?`Link (${l.length})`:`Link`]}),(0,V.jsxs)(_,{size:`sm`,variant:`outline`,onClick:()=>c(!1),children:[(0,V.jsx)(O,{"aria-hidden":`true`}),`Cancel`]})]})]})]})}function bt({sub:e}){let[t,a]=(0,B.useState)(null),[o,s]=(0,B.useState)(e?n(e):``),[c,l]=(0,B.useState)(null),[u,d]=(0,B.useState)(``),[p,m]=(0,B.useState)(0);(0,B.useEffect)(()=>{h.overview().then(e=>{let t=e.agents.map(e=>e.name);a(t),s(e=>e||t[0]||``)},e=>d(e.message))},[]),(0,B.useEffect)(()=>{o&&(l(null),h.learn(o).then(l,e=>d(e.message)))},[o,p]);let _=()=>m(e=>e+1);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(J,{id:`evidence-learn`,children:`Learn`}),(0,V.jsx)(L,{more:(0,V.jsx)(V.Fragment,{children:`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.`}),children:`What to change in an agent, from what its runs got wrong.`}),u&&(0,V.jsx)(z,{text:u}),t&&!t.length&&(0,V.jsx)(X,{}),t&&t.length>1&&(0,V.jsxs)(`label`,{className:`flex w-fit items-center gap-2 text-body-sm text-ink-2`,children:[`Agent`,(0,V.jsx)(i,{value:o,onChange:e=>s(e.target.value),children:t.map(e=>(0,V.jsx)(`option`,{value:e,children:H(e)},e))})]}),o&&!c&&!u&&(0,V.jsx)(Y,{}),c?.problems.map(e=>(0,V.jsx)(z,{text:e},e)),c&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`h2`,{className:`sr-only`,children:[`Proposals and causes of `,H(c.agent)]}),(0,V.jsxs)(R,{id:`proposals`,title:`Proposals`,icon:de,n:c.proposals.length,children:[c.proposals.length?(0,V.jsx)(`ul`,{"aria-label":`Proposals`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 list-none`),children:c.proposals.map(e=>(0,V.jsx)(vt,{p:e,onDecided:_},e.id))}):(0,V.jsx)(g,{className:`py-4`,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.`}),c.proposals.some(e=>e.state===`approved`)&&(0,V.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[(0,V.jsxs)(`code`,{children:[`forgeqe evidence guidance `,H(c.agent)]}),` writes what was approved as Markdown, to put into the agent.`]})]}),(0,V.jsxs)(R,{id:`fixes`,title:`Fixes proven by the harness`,icon:ce,n:c.fixes.length,children:[(0,V.jsxs)(`p`,{className:`m-0 text-body-sm 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,V.jsx)(`code`,{children:`forgeqe evidence fix apply <fix>`}),`), or puts its patch on a branch for a pull request.`]}),c.fixes.length?(0,V.jsx)(`ul`,{"aria-label":`Fixes`,className:`m-0 flex list-none flex-col gap-2 p-0`,children:c.fixes.map(e=>(0,V.jsx)(st,{f:e},`${e.id}-${e.at}`))}):(0,V.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`No fix proven yet: `,(0,V.jsx)(`code`,{children:`forgeqe evidence fix <run> H1`}),` proves one of a cause below.`]})]}),(0,V.jsx)(R,{id:`causes`,title:`Causes of its findings`,icon:k,n:c.runs.length,children:c.runs.length?(0,V.jsx)(`ul`,{"aria-label":`Runs and their causes`,className:`m-0 flex list-none flex-col gap-2 p-0`,children:c.runs.map(e=>(0,V.jsxs)(`li`,{className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col gap-2`),children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsx)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e.run)),className:`text-body-sm font-medium [overflow-wrap:anywhere]`,children:H(e.request||e.run)}),(0,V.jsxs)(`span`,{className:`font-mono text-body-sm text-muted`,children:[e.run,e.version?` · ${H(e.version)}`:``]})]}),e.causes.map(t=>(0,V.jsx)(yt,{agent:c.agent,run:e.run,c:t,candidates:e.candidates,onLinked:_},t.key)),!e.candidates.length&&(0,V.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[`No run of the same request is recorded after it yet: `,(0,V.jsxs)(`code`,{children:[`forgeqe evidence replay-kit `,e.run,` H1`]}),` says what to change for a replay.`]})]},e.run))}):(0,V.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`No run of this agent has an open finding.`})})]})]})}var $={observe:`Observe`,assist:`Assist`,act:`Act`,autonomous:`Autonomous`},xt={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`},St={model:`Model`,tool:`Tool`,knowledge:`Knowledge`,check:`Check`,judge:`Judge`,trust:`Trust`},Ct=[`observe`,`assist`,`act`,`autonomous`];function wt({agent:e,label:t,icon:n,tip:r,action:i,children:s,onDone:c,uid:l}){let[d,p]=(0,B.useState)(!1),[m,h]=(0,B.useState)(``),[g,v]=(0,B.useState)(``),[y,b]=(0,B.useState)(!1),[x,ee]=(0,B.useState)(``),S=m.trim().length>=10&&m.trim().length<=500&&g===e,te=async()=>{b(!0),ee(``);try{await i(g,m.trim()),p(!1),h(``),v(``),c()}catch(e){ee(e.message)}finally{b(!1)}};if(!d)return(0,V.jsx)(`span`,{children:(0,V.jsxs)(_,{size:`sm`,onClick:()=>p(!0),"data-tip":r,children:[(0,V.jsx)(n,{"aria-hidden":`true`}),t]})});let C=`${t}${l?`-${l}`:``}`.toLowerCase().replace(/[^a-z0-9]+/g,`-`);return(0,V.jsxs)(`div`,{className:f(u,`flex max-w-[640px] flex-col gap-2`),children:[s,(0,V.jsx)(`label`,{htmlFor:`${C}-reason`,className:`text-body-sm font-medium text-ink-2`,children:`Why? It is kept with your name and in the audit.`}),(0,V.jsx)(a,{id:`${C}-reason`,value:m,onChange:e=>h(e.target.value),rows:2,maxLength:500}),(0,V.jsxs)(`label`,{htmlFor:`${C}-confirm`,className:`text-body-sm font-medium text-ink-2`,children:[`Type `,H(e),` to confirm`]}),(0,V.jsx)(o,{id:`${C}-confirm`,value:g,onChange:e=>v(e.target.value),autoComplete:`off`}),x&&(0,V.jsx)(z,{text:x}),(0,V.jsxs)(`span`,{className:`flex gap-2`,children:[(0,V.jsxs)(_,{busy:y,size:`sm`,disabled:!S||y,onClick:te,"data-tip":r,children:[(0,V.jsx)(n,{"aria-hidden":`true`}),y?`Keeping…`:t]}),(0,V.jsxs)(_,{size:`sm`,variant:`outline`,onClick:()=>p(!1),children:[(0,V.jsx)(O,{"aria-hidden":`true`}),`Cancel`]})]})]})}function Tt(e){return(0,V.jsxs)(V.Fragment,{children:[e.slice(0,8).map((e,t)=>(0,V.jsxs)(`span`,{children:[t?`, `:``,(0,V.jsx)(`a`,{href:r(`evidence-runs`,encodeURIComponent(e)),className:`font-mono`,children:e})]},e)),e.length>8?`, and ${e.length-8} more`:``]})}function Et({sub:e}){let t=e?n(e):``,[a,o]=(0,B.useState)(null),[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(0),[p,m]=(0,B.useState)(`observe`),v=()=>u(e=>e+1);(0,B.useEffect)(()=>{c(``),h.monitor(t||void 0).then(o,e=>c(e.message))},[t,l]);let y=async()=>{try{let e=await h.audit(t),n=URL.createObjectURL(new Blob([`${JSON.stringify(e,null,2)}\n`],{type:`application/json`})),r=document.createElement(`a`);r.href=n,r.download=`${t.replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^[-.]+/,``).slice(0,60)||`agent`}.audit.json`,r.click(),URL.revokeObjectURL(n)}catch(e){c(e.message)}},b=a?.agent;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(J,{id:`evidence-monitor`,children:`Monitor`}),(0,V.jsx)(L,{more:(0,V.jsxs)(V.Fragment,{children:[`For each agent evaluated: 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,V.jsx)(`code`,{children:`forgeqe evidence drift --all`}),`.`]}),children:`Watch what changes in each agent, and how much it can be trusted to do alone.`}),s&&(0,V.jsx)(z,{text:s}),!a&&!s&&(0,V.jsx)(Y,{}),a?.problems.map(e=>(0,V.jsx)(z,{text:e},e)),a&&!a.inventory.length&&(0,V.jsx)(X,{}),a&&a.inventory.length>0&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`h2`,{className:`sr-only`,children:`Agents and their governance`}),(0,V.jsxs)(R,{id:`inventory`,title:`Inventory`,icon:ue,n:a.inventory.length,children:[(0,V.jsx)(F,{label:`Agents evaluated`,search:!1,minWidth:760,head:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Agent`}),(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Versions`}),(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Models`}),(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Tools`}),(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Contract`}),(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,children:`Trust`}),(0,V.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Alerts`})]}),children:a.inventory.map(e=>(0,V.jsxs)(`tr`,{className:`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,children:[(0,V.jsx)(`th`,{scope:`row`,className:f(`px-4 py-2`,`text-left font-medium`),children:(0,V.jsx)(`a`,{href:r(`evidence-monitor`,encodeURIComponent(e.agent)),"aria-current":e.agent===t?`page`:void 0,children:H(e.agent)})}),(0,V.jsx)(`td`,{className:f(`px-4 py-2`,`text-muted`),children:e.versions.slice(0,3).map(H).join(`, `)||`none named`}),(0,V.jsx)(`td`,{className:f(`px-4 py-2`,`text-muted [overflow-wrap:anywhere]`),children:e.models.slice(0,3).map(H).join(`, `)||`none named`}),(0,V.jsx)(`td`,{className:`px-4 py-2 text-right whitespace-nowrap tabular-nums`,children:e.tools.length}),(0,V.jsx)(`td`,{className:f(`px-4 py-2`,`text-muted`),children:e.contract?e.contract.approved?`Approved`:`Not approved`:`None`}),(0,V.jsx)(`td`,{className:`px-4 py-2`,children:e.granted?`${$[e.granted]} (supports ${$[e.supported].toLowerCase()})`:`Not granted (supports ${$[e.supported].toLowerCase()})`}),(0,V.jsx)(`td`,{className:f(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,e.alerts>0&&`text-fail`),"data-sort":e.baseline||e.alerts?e.alerts:-1,children:e.baseline||e.alerts?e.alerts:(0,V.jsx)(`span`,{className:`text-muted`,children:`no baseline`})})]},e.agent))}),!t&&(0,V.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Open an agent to see its drift, its trust and its audit.`})]}),b&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(R,{id:`drift`,title:`Drift of ${b.name}`,icon:ie,n:b.drift.alerts.length,children:[b.drift.baseline?(0,V.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Since its baseline (`,b.drift.baseline.version?H(b.drift.baseline.version):`no version`,`, `,d(b.drift.baseline.runs,`run`),`, set by `,H(b.drift.baseline.by),` `,U(b.drift.baseline.at),`): `,d(b.drift.since.length,`run`),`.`]}):(0,V.jsx)(`p`,{className:`m-0 text-body-sm 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,V.jsx)(`ul`,{"aria-label":`Drift alerts`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 list-none`),children:b.drift.alerts.map(e=>(0,V.jsxs)(`li`,{className:`flex flex-col gap-1 border-b border-line-soft px-4 py-2 last:border-b-0`,children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsx)(C,{tone:`warn`,children:St[e.kind]}),(0,V.jsx)(`span`,{className:`text-body-sm [overflow-wrap:anywhere]`,children:H(e.what)})]}),e.runs.length>0&&(0,V.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[`In `,Tt(e.runs)]})]},`${e.kind}-${e.subject}`))}),b.drift.baseline&&!b.drift.alerts.length&&(0,V.jsx)(g,{className:`py-4`,children:`Nothing changed since the baseline.`}),(0,V.jsx)(wt,{agent:b.name,label:`Set baseline`,icon:ve,tip:b.drift.baseline?`Set a new baseline`:`Set the baseline`,action:(e,t)=>h.baseline(b.name,e,t),onDone:v,children:(0,V.jsx)(`span`,{className:`text-body-sm 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,V.jsxs)(R,{id:`trust`,title:`Trust in ${b.name}`,icon:fe,children:[(0,V.jsxs)(`p`,{className:`m-0 text-body-sm`,children:[`Its evidence supports `,(0,V.jsx)(`b`,{children:$[b.trust.supported]}),`: `,xt[b.trust.supported],`.`,` `,b.trust.granted?(0,V.jsxs)(V.Fragment,{children:[`Granted: `,(0,V.jsx)(`b`,{children:$[b.trust.granted.level]}),`, by `,H(b.trust.granted.by),` `,U(b.trust.granted.at),`: `,H(b.trust.granted.reason)]}):`No level is granted.`]}),(0,V.jsx)(`ul`,{"aria-label":`What each level needs`,className:f(`surface rounded-lg bg-bg p-6 shadow-sm`,`m-0 list-none`),children:b.trust.criteria.filter(e=>e.level!==`observe`).map(e=>(0,V.jsxs)(`li`,{className:`flex items-start gap-2 border-b border-line-soft px-4 py-2 text-body-sm last:border-b-0`,children:[(0,V.jsx)(x,{icon:e.met?A:Se,size:15,className:e.met?`mt-1 text-pass`:`mt-1 text-muted`}),(0,V.jsx)(`span`,{className:`w-[96px] shrink-0 font-medium`,children:$[e.level]}),(0,V.jsxs)(`span`,{className:`text-ink-2 [overflow-wrap:anywhere]`,children:[(0,V.jsx)(`span`,{className:`sr-only`,children:e.met?`Met: `:`Not met: `}),H(e.what)]})]},`${e.level}-${e.what}`))}),(0,V.jsx)(wt,{agent:b.name,label:`Grant`,icon:A,tip:`Grant a trust level`,action:(e,t)=>h.trust(b.name,p,e,t),onDone:v,children:(0,V.jsxs)(`label`,{className:`flex w-fit items-center gap-2 text-body-sm font-medium text-ink-2`,children:[`Level`,(0,V.jsx)(i,{value:p,onChange:e=>m(e.target.value),children:Ct.slice(0,Ct.indexOf(b.trust.supported)+1).map(e=>(0,V.jsxs)(`option`,{value:e,children:[$[e],`: `,xt[e]]},e))})]})})]}),(0,V.jsxs)(R,{id:`audit`,title:`Audit`,icon:be,children:[(0,V.jsxs)(`p`,{className:`m-0 text-body-sm text-muted`,children:[`Every decision people made about `,H(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,V.jsx)(`span`,{children:(0,V.jsxs)(_,{size:`sm`,onClick:y,"data-tip":`Download the audit`,children:[(0,V.jsx)(pe,{"aria-hidden":`true`}),`Download`]})})]})]})]})]})}function Dt({page:e,sub:t}){let r=(t||``).split(`/`),i=r[0]===`agent`&&r[1]?n(r[1]):``,a=e===`evidence-runs`&&r[0]&&r[0]!==`agent`?n(r[0]):``;return(0,V.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,V.jsx)(Ae,{}),(0,V.jsx)(`main`,{className:f(je,`@container flex-auto gap-4`),children:e===`evidence`?t?(0,V.jsx)(Je,{agent:n(t)},t):(0,V.jsx)(Ge,{}):e===`evidence-contracts`?(0,V.jsx)(mt,{}):e===`evidence-review`?(0,V.jsx)(rt,{}):e===`evidence-releases`?(0,V.jsx)(ft,{}):e===`evidence-learn`?(0,V.jsx)(bt,{sub:t}):e===`evidence-monitor`?(0,V.jsx)(Et,{sub:t},t||``):a?(0,V.jsx)($e,{id:a},a):(0,V.jsx)(Ye,{agent:i})})]})}export{Dt as Evidence};
@@ -1,2 +1,2 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{n,r}from"./route-9BkoTWUE.js";import{I as i,P as a,c as o}from"./surface-c1kG1KPS.js";import{t as s}from"./utils-DJRAScIl.js";import{t as c}from"./jsx-runtime-LKYXHABd.js";import{d as l}from"./sectionList-B6NF3ZMb.js";import{b as u,v as d}from"./api-CorvgyDj.js";import{D as f,F as p,I as m,L as h,d as g,g as _,k as v,m as y}from"./pageBack-DDAAmq4R.js";import{B as b,E as x,Er as S,Gr as C,J as w,N as T,Rn as E,mr as D,ur as O,vn as k,z as A}from"./line-icons-Cwj9OmCz.js";import{Ht as j,Vt as M,Z as N,rt as P}from"./frame-BC1vOowF.js";import{u as F}from"./nav--1SY7-OO.js";import{B as I,J as L,V as R,Y as z,l as B,n as V,t as H,z as U}from"./index-BoFziUZw.js";import{d as W}from"./qualityParts-BF3Yb7Zl.js";var G=e(t(),1),K={view:()=>d(`GET`,`/api/explore`),start:e=>d(`POST`,`/api/explore/start`,{...e,confirmed:!0}),stop:()=>d(`POST`,`/api/explore/stop`,{}),answer:(e,t)=>d(`POST`,`/api/explore/answer`,{id:e,choice:t}),session:e=>d(`GET`,`/api/explore/sessions/${encodeURIComponent(e)}`)},q=c(),J=[2,3,4,6,8,12],Y=[10,15,30,45,60,90,120],X={passed:{label:`As expected`,icon:T,tone:`text-pass`},defect:{label:`Defect, confirmed`,icon:A,tone:`text-fail`},not_reproduced:{label:`Not reproduced`,icon:S,tone:`text-warn`},could_not_explore:{label:`Could not explore`,icon:S,tone:`text-muted`},stopped:{label:`Stopped`,icon:O,tone:`text-muted`}},Z=e=>{let t=Math.max(0,Math.round(e/1e3));return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`};function Q({job:e,onStop:t,onAnswer:n}){let r=(0,G.useRef)(null),[,i]=(0,G.useState)(0);(0,G.useEffect)(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},[e.lines.length]),(0,G.useEffect)(()=>{if(!e.running)return;let t=j(()=>i(e=>e+1),1e3);return()=>M(t)},[e.running]);let a=(e.endedAt?Date.parse(e.endedAt):Date.now())-Date.parse(e.startedAt),c=e.deadline?Date.parse(e.deadline)-Date.now():void 0,l=e.exitCode===0?`No defect confirmed`:e.exitCode===1?`Defects confirmed`:`Did not finish`;return(0,q.jsxs)(`section`,{"aria-label":`Session`,className:s(o,`flex flex-col gap-2`),children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,q.jsx)(`span`,{className:`min-w-0 flex-1 font-medium [overflow-wrap:anywhere]`,children:e.goal||`Exploratory session`}),(0,q.jsx)(v,{orb:`working`,tone:e.running?`running`:e.exitCode===0?`pass`:`fail`,children:e.running?e.question?`Waiting for you`:`Exploring`:l}),(0,q.jsxs)(`span`,{className:`text-body-sm text-muted tabular-nums`,"data-tip":e.minutes?`Time limit ${e.minutes} minutes`:void 0,children:[Z(a),e.running&&c!==void 0?` · ${Z(c)} left`:``]}),e.running&&(0,q.jsxs)(p,{variant:`danger`,onClick:t,children:[(0,q.jsx)(O,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]}),e.running&&e.question&&(0,q.jsxs)(`fieldset`,{className:s(`panel rounded-md bg-(--page-surface-strong) p-6`,`m-0 flex flex-col gap-2 border-0`),children:[(0,q.jsx)(`legend`,{className:`float-left mb-1 text-body-sm font-medium`,children:e.question.title}),e.question.detail&&(0,q.jsx)(`p`,{className:`clear-left m-0 text-body-sm text-ink-2`,children:e.question.detail}),(0,q.jsx)(`div`,{className:`clear-left flex flex-wrap gap-2`,children:e.question.options.map((t,r)=>(0,q.jsx)(p,{size:`sm`,variant:r===0&&t.id!==`cancel`?`primary`:`outline`,onClick:()=>n(e.question.id,t.id),children:t.label},t.id))})]}),!e.running&&e.reason&&(0,q.jsx)(`p`,{role:`alert`,className:s(h.fail,`m-0`),children:e.reason}),(0,q.jsxs)(`details`,{open:e.running||!!e.reason,children:[(0,q.jsxs)(`summary`,{className:`cursor-pointer text-body-sm text-muted`,children:[`Output (`,e.lines.length,` lines): the charters, each run, and what it found`]}),(0,q.jsx)(`pre`,{ref:r,className:s(g,`mt-2 max-h-[340px]`),children:(0,q.jsx)(y,{text:e.lines.join(`
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{n,r}from"./route-9BkoTWUE.js";import{I as i,P as a,c as o}from"./surface-c1kG1KPS.js";import{t as s}from"./utils-DJRAScIl.js";import{t as c}from"./jsx-runtime-LKYXHABd.js";import{d as l}from"./sectionList-B6NF3ZMb.js";import{b as u,v as d}from"./api-D1PU4zye.js";import{D as f,F as p,I as m,L as h,d as g,g as _,k as v,m as y}from"./pageBack-DfGBh1Hs.js";import{B as b,E as x,Er as S,Gr as C,J as w,N as T,Rn as E,mr as D,ur as O,vn as k,z as A}from"./line-icons-Cwj9OmCz.js";import{Ht as j,Vt as M,Z as N,rt as P}from"./frame-D0MS2ZMz.js";import{u as F}from"./nav-CkrE6JFU.js";import{B as I,J as L,V as R,Y as z,l as B,n as V,t as H,z as U}from"./index-F8zkXd19.js";import{d as W}from"./qualityParts-DcRvGy-_.js";var G=e(t(),1),K={view:()=>d(`GET`,`/api/explore`),start:e=>d(`POST`,`/api/explore/start`,{...e,confirmed:!0}),stop:()=>d(`POST`,`/api/explore/stop`,{}),answer:(e,t)=>d(`POST`,`/api/explore/answer`,{id:e,choice:t}),session:e=>d(`GET`,`/api/explore/sessions/${encodeURIComponent(e)}`)},q=c(),J=[2,3,4,6,8,12],Y=[10,15,30,45,60,90,120],X={passed:{label:`As expected`,icon:T,tone:`text-pass`},defect:{label:`Defect, confirmed`,icon:A,tone:`text-fail`},not_reproduced:{label:`Not reproduced`,icon:S,tone:`text-warn`},could_not_explore:{label:`Could not explore`,icon:S,tone:`text-muted`},stopped:{label:`Stopped`,icon:O,tone:`text-muted`}},Z=e=>{let t=Math.max(0,Math.round(e/1e3));return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`};function Q({job:e,onStop:t,onAnswer:n}){let r=(0,G.useRef)(null),[,i]=(0,G.useState)(0);(0,G.useEffect)(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},[e.lines.length]),(0,G.useEffect)(()=>{if(!e.running)return;let t=j(()=>i(e=>e+1),1e3);return()=>M(t)},[e.running]);let a=(e.endedAt?Date.parse(e.endedAt):Date.now())-Date.parse(e.startedAt),c=e.deadline?Date.parse(e.deadline)-Date.now():void 0,l=e.exitCode===0?`No defect confirmed`:e.exitCode===1?`Defects confirmed`:`Did not finish`;return(0,q.jsxs)(`section`,{"aria-label":`Session`,className:s(o,`flex flex-col gap-2`),children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,q.jsx)(`span`,{className:`min-w-0 flex-1 font-medium [overflow-wrap:anywhere]`,children:e.goal||`Exploratory session`}),(0,q.jsx)(v,{orb:`working`,tone:e.running?`running`:e.exitCode===0?`pass`:`fail`,children:e.running?e.question?`Waiting for you`:`Exploring`:l}),(0,q.jsxs)(`span`,{className:`text-body-sm text-muted tabular-nums`,"data-tip":e.minutes?`Time limit ${e.minutes} minutes`:void 0,children:[Z(a),e.running&&c!==void 0?` · ${Z(c)} left`:``]}),e.running&&(0,q.jsxs)(p,{variant:`danger`,onClick:t,children:[(0,q.jsx)(O,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]}),e.running&&e.question&&(0,q.jsxs)(`fieldset`,{className:s(`panel rounded-md bg-(--page-surface-strong) p-6`,`m-0 flex flex-col gap-2 border-0`),children:[(0,q.jsx)(`legend`,{className:`float-left mb-1 text-body-sm font-medium`,children:e.question.title}),e.question.detail&&(0,q.jsx)(`p`,{className:`clear-left m-0 text-body-sm text-ink-2`,children:e.question.detail}),(0,q.jsx)(`div`,{className:`clear-left flex flex-wrap gap-2`,children:e.question.options.map((t,r)=>(0,q.jsx)(p,{size:`sm`,variant:r===0&&t.id!==`cancel`?`primary`:`outline`,onClick:()=>n(e.question.id,t.id),children:t.label},t.id))})]}),!e.running&&e.reason&&(0,q.jsx)(`p`,{role:`alert`,className:s(h.fail,`m-0`),children:e.reason}),(0,q.jsxs)(`details`,{open:e.running||!!e.reason,children:[(0,q.jsxs)(`summary`,{className:`cursor-pointer text-body-sm text-muted`,children:[`Output (`,e.lines.length,` lines): the charters, each run, and what it found`]}),(0,q.jsx)(`pre`,{ref:r,className:s(g,`mt-2 max-h-[340px]`),children:(0,q.jsx)(y,{text:e.lines.join(`
2
2
  `)||`Planning the charters…`})})]})]})}function $({view:e,onStarted:t}){let[n,r]=(0,G.useState)(``),[c,l]=(0,G.useState)(e.production?``:e.apps[0]?.name??``),[u,d]=(0,G.useState)(``),[m,g]=(0,G.useState)(``),[_,v]=(0,G.useState)(4),[y,b]=(0,G.useState)(30),[x,S]=(0,G.useState)([]),[T,D]=(0,G.useState)(!1),[O,k]=(0,G.useState)(!1),[A,j]=(0,G.useState)(``),M=e.production?[]:e.apps,N=c||/^https?:\/\/\S+$/i.test(u.trim()),P=n.trim().length>=8&&N,F=async()=>{k(!0);try{t(await K.start({goal:n.trim(),...m.trim()?{story:m.trim()}:{},...c?{app:c}:{url:u.trim()},charters:_,minutes:y,...x.length?{roles:x}:{}})),D(!1),j(``)}catch(e){j(e.message)}finally{k(!1)}};return(0,q.jsxs)(`form`,{"aria-labelledby":`explore-new`,className:s(o,`flex flex-col gap-4`),onSubmit:e=>{e.preventDefault(),P&&D(!0)},children:[(0,q.jsx)(z,{id:`explore-new`,icon:w,title:`New session`}),(0,q.jsxs)(`label`,{className:`flex flex-col gap-1 text-body-sm font-medium`,children:[`Goal`,(0,q.jsx)(a,{value:n,onChange:e=>r(e.target.value),maxLength:300,placeholder:`Try to break checkout with odd addresses and postcodes`,"aria-describedby":`explore-goal-help`}),(0,q.jsx)(`span`,{id:`explore-goal-help`,className:`font-normal text-muted`,children:`What to try to break, or what to look for. The session plans its charters from it, and stops when they have run.`})]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_220px] flex-col gap-1 text-body-sm font-medium`,children:[`Start at`,(0,q.jsxs)(i,{size:`sm`,value:c,onChange:e=>l(e.target.value),children:[M.map(t=>(0,q.jsxs)(`option`,{value:t.name,children:[t.name,` (`,e.environment,`)`]},t.name)),(0,q.jsx)(`option`,{value:``,children:`Another address…`})]})]}),!c&&(0,q.jsxs)(`label`,{className:`flex min-w-0 flex-[2_1_280px] flex-col gap-1 text-body-sm font-medium`,children:[`Address`,(0,q.jsx)(a,{size:`sm`,value:u,onChange:e=>d(e.target.value),placeholder:`https://qa.shop.example.com/checkout`})]}),(0,q.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_160px] flex-col gap-1 text-body-sm font-medium`,children:[`Story (optional)`,(0,q.jsx)(a,{size:`sm`,value:m,onChange:e=>g(e.target.value),maxLength:40,placeholder:`ado:1234 or SHOP-12`})]}),(0,q.jsxs)(`label`,{className:`flex flex-[0_1_140px] flex-col gap-1 text-body-sm font-medium`,children:[`Charters, at most`,(0,q.jsx)(i,{size:`sm`,value:String(_),onChange:e=>v(Number(e.target.value)),children:J.map(e=>(0,q.jsx)(`option`,{value:e,children:e},e))})]}),(0,q.jsxs)(`label`,{className:`flex flex-[0_1_140px] flex-col gap-1 text-body-sm font-medium`,children:[`Time limit`,(0,q.jsx)(i,{size:`sm`,value:String(y),onChange:e=>b(Number(e.target.value)),children:Y.map(e=>(0,q.jsxs)(`option`,{value:e,children:[e,` minutes`]},e))})]})]}),e.roles.length>1&&(0,q.jsxs)(`div`,{className:`flex flex-col gap-1 text-body-sm`,children:[(0,q.jsx)(`span`,{className:`font-medium`,children:`Roles`}),(0,q.jsx)(f,{items:e.roles.map(e=>({id:e,label:e})),value:x,onChange:S}),(0,q.jsx)(`span`,{className:`text-muted`,children:`Saved logins to explore as. None picked: each of them.`})]}),e.production&&(0,q.jsxs)(`p`,{className:`m-0 text-body-sm text-warn`,children:[`The active environment, `,e.environment,`, is named like production: give the address of a test environment.`]}),A&&(0,q.jsx)(`p`,{role:`alert`,className:s(h.fail,`m-0`),children:A}),T?(0,q.jsxs)(`div`,{className:s(h.info,`flex flex-wrap items-center gap-2`),children:[(0,q.jsxs)(`span`,{className:`flex-[1_1_280px]`,children:[`Start a session of up to `,_,` charters, for at most `,y,` minutes? Each charter is a browser run (two when it finds a possible defect); you choose which charters run once they are planned.`]}),(0,q.jsxs)(p,{size:`sm`,variant:`primary`,disabled:O,onClick:()=>void F(),children:[(0,q.jsx)(E,{"aria-hidden":`true`}),`Start`]}),(0,q.jsxs)(p,{size:`sm`,variant:`outline`,disabled:O,onClick:()=>D(!1),children:[(0,q.jsx)(C,{"aria-hidden":`true`}),`Cancel`]})]}):(0,q.jsx)(`div`,{children:(0,q.jsxs)(p,{size:`sm`,variant:`primary`,type:`submit`,disabled:!P,"data-tip":`Plan charters, then explore`,children:[(0,q.jsx)(w,{"aria-hidden":`true`}),`Explore`]})})]})}function ee({id:e}){let[t,n]=(0,G.useState)(null),[i,a]=(0,G.useState)(``),[o,c]=(0,G.useState)(``);(0,G.useEffect)(()=>{let t=!1;return K.session(e).then(e=>!t&&n(e),e=>!t&&a(e.message)),()=>{t=!0}},[e]);let l=(0,q.jsxs)(`a`,{href:r(`explore`,`sessions`),className:s(m({variant:`link`,size:`inline`}),`gap-1 self-start`),children:[(0,q.jsx)(x,{size:14,"aria-hidden":`true`,className:`rotate-90`}),`All sessions`]});if(i||!t)return(0,q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[l,i?(0,q.jsx)(`p`,{role:`alert`,className:s(h.fail,`m-0`),children:i}):(0,q.jsx)(_,{shape:`detail`})]});let d=async()=>{try{let{id:e}=await u.start(`Go through the exploratory session ${t.id} (in the reports folder's explore folder: exploration.md and exploration.json). Summarize the confirmed defects and the observations, and offer to save the proposed test cases and to file bugs for the confirmed defects.`,{});location.hash=r(`chats`,e)}catch(e){c(e.message)}};return(0,q.jsxs)(`section`,{"aria-labelledby":`explore-s-h`,className:`flex min-w-0 flex-col gap-4`,children:[l,(0,q.jsx)(z,{id:`explore-s-h`,icon:w,title:(0,q.jsx)(`span`,{"data-tip":t.title,children:t.title}),description:(0,q.jsxs)(q.Fragment,{children:[W(t.at),` · `,t.story.id&&t.story.id!==`story`?`${t.story.id} · `:``,(0,q.jsx)(`span`,{className:`font-mono`,children:t.id})]}),actions:(0,q.jsxs)(p,{size:`sm`,variant:`ghost`,onClick:()=>void d(),"data-tip":`Ask about this session in a chat`,children:[(0,q.jsx)(k,{"aria-hidden":`true`}),`Chat`]})}),o&&(0,q.jsx)(`p`,{className:`m-0 text-body-sm text-fail`,children:o}),(0,q.jsxs)(U,{label:`Charters by result`,children:[(0,q.jsx)(I,{dot:`neutral`,value:t.charters,label:`charters run`}),(0,q.jsx)(I,{dot:`fail`,value:t.defects,label:`defects confirmed`}),(0,q.jsx)(I,{dot:`pass`,value:t.passed,label:`as expected`}),(0,q.jsx)(I,{dot:`warn`,value:t.notReproduced,label:`not reproduced`}),(0,q.jsx)(I,{dot:`neutral`,value:t.stopped+t.notExplored,label:`stopped or not explored`})]}),(0,q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.results.map(e=>{let t=X[e.status];return(0,q.jsxs)(`li`,{className:`flex items-start gap-2 border-t border-line-soft py-2 text-body-sm`,children:[(0,q.jsx)(t.icon,{size:15,"aria-label":t.label,className:s(`mt-1 flex-none`,t.tone)}),(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,q.jsxs)(`span`,{className:`font-medium`,children:[e.id?`${e.id} · `:``,e.title,` `,(0,q.jsxs)(`span`,{className:s(`font-normal`,t.tone),children:[`· `,t.label]}),e.role?(0,q.jsxs)(`span`,{className:`font-normal text-muted`,children:[` · as `,e.role]}):null,e.changesData?(0,q.jsx)(`span`,{className:`font-normal text-muted`,children:` · changes data`}):null]}),e.mission&&(0,q.jsx)(`span`,{className:`text-ink-2`,children:e.mission}),(e.reason||e.summary)&&(0,q.jsx)(`span`,{className:s(`[overflow-wrap:anywhere]`,e.status===`defect`?`text-fail`:`text-ink-2`),children:e.reason||e.summary}),e.observations.map((e,t)=>(0,q.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[`Noticed: `,e]},t)),e.runDir&&(0,q.jsxs)(`span`,{className:`truncate font-mono text-body-sm text-muted`,"data-tip":e.reproRunDir?`${e.runDir} · again: ${e.reproRunDir}`:e.runDir,children:[e.runDir,e.reproRunDir?` · ran again to confirm`:``]})]})]},e.id||e.title)})}),t.proposed.length>0&&(0,q.jsx)(L,{level:3,icon:b,title:`Proposed test cases`,className:`text-body-sm`,children:(0,q.jsx)(`ul`,{className:`m-0 flex list-disc flex-col gap-1 pl-6 text-ink-2`,children:t.proposed.map((e,t)=>(0,q.jsxs)(`li`,{children:[e.title,e.kind===`defect`?(0,q.jsx)(`span`,{className:`text-muted`,children:` · checks the defect is fixed`}):null]},t))})})]})}function te({sub:e}){let[t,i]=(0,G.useState)(null),[a,o]=(0,G.useState)(``),c=(0,G.useCallback)(()=>{K.view().then(e=>(i(e),o(``)),e=>o(e.message))},[]);(0,G.useEffect)(c,[c]);let u=!!t?.job?.running;(0,G.useEffect)(()=>{if(!u)return;let e=j(c,2e3);return()=>M(e)},[u,c]);let d=async e=>{try{i(await e())}catch(e){o(e.message)}},f=l(`exploration`),p=e&&e!==`agent`?`sessions`:H,m=e&&e!==`sessions`&&e!==`agent`?n(e):``,g=e=>location.hash=r(`explore`,encodeURIComponent(e));return(0,q.jsxs)(V,{title:F(`explore`),page:f,label:`Exploratory testing`,current:p,tabHref:e=>e===`agent`?r(`explore`,H):r(`explore`,e),onPick:e=>location.hash=e===`agent`?r(`explore`,H):r(`explore`,e),tabs:[{id:`sessions`,label:`Sessions`,icon:D,...t?{n:t.sessions.length}:{}}],below:(0,q.jsx)(B,{page:f}),children:[!m&&(0,q.jsx)(R,{more:(0,q.jsx)(q.Fragment,{children:`ForgeQE plans charters from your goal (other paths, edge cases, invalid input, boundaries, roles, refresh and back), you choose which run, each runs in a browser, and a possible defect runs again to be confirmed. A session stops when its charters have run or its time limit is reached, and keeps what it found.`}),children:`Explore beyond your scripted test cases: give a goal, and ForgeQE tries to break it in a browser.`}),a&&(0,q.jsx)(`p`,{role:`alert`,className:s(h.fail,`m-0`),children:a}),!t&&!a&&(0,q.jsx)(_,{shape:`rows`}),t&&m&&(0,q.jsx)(ee,{id:m}),t&&!m&&(0,q.jsxs)(q.Fragment,{children:[t.job&&(0,q.jsx)(Q,{job:t.job,onStop:()=>void d(K.stop),onAnswer:(e,t)=>void d(()=>K.answer(e,t))}),!u&&(0,q.jsx)($,{view:t,onStarted:i}),(0,q.jsx)(L,{icon:D,title:`Sessions`,children:(0,q.jsx)(P,{label:`Sessions`,placeholder:`Find a session`,empty:`No sessions yet. Give a goal above and start one: what it finds, the defects it confirmed and the test cases it proposes show here.`,head:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`th`,{scope:`col`,className:s(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`w-[50%]`),children:`Session`}),(0,q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,children:`Defects`}),(0,q.jsx)(`th`,{scope:`col`,className:s(`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`Charters`}),(0,q.jsx)(`th`,{scope:`col`,className:s(`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,`hidden @2xl:table-cell`),children:`As expected`}),(0,q.jsx)(`th`,{scope:`col`,className:s(`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,`hidden @xl:table-cell`),children:`When`})]}),children:t.sessions.map(e=>{let t=e.defects?A:e.notReproduced?S:T;return(0,q.jsxs)(`tr`,{onClick:()=>g(e.id),className:`h-12 cursor-pointer border-t border-line-soft align-middle transition-colors duration-150 hover:bg-tint data-[state=selected]:bg-tint-hover`,children:[(0,q.jsx)(`td`,{className:s(`px-4 py-2`,`max-w-0`),children:(0,q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(t,{size:15,"aria-label":e.defects?`Defects confirmed`:e.notReproduced?`Observations`:`Nothing confirmed`,className:s(`flex-none`,e.defects?`text-fail`:e.notReproduced?`text-warn`:`text-pass`)}),(0,q.jsx)(`a`,{href:r(`explore`,encodeURIComponent(e.id)),onClick:e=>e.stopPropagation(),"data-tip":e.title,className:`truncate text-ink no-underline hover:underline`,children:e.title})]})}),(0,q.jsx)(`td`,{className:s(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,e.defects?`text-fail`:`text-muted`),children:e.defects}),(0,q.jsx)(`td`,{className:s(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden text-muted @xl:table-cell`),children:e.charters}),(0,q.jsx)(`td`,{className:s(`px-4 py-2 text-right whitespace-nowrap tabular-nums`,`hidden text-muted @2xl:table-cell`),children:e.passed}),(0,q.jsx)(`td`,{className:s(`px-4 py-2`,`hidden whitespace-nowrap text-body-sm text-muted @xl:table-cell`),"data-tip":W(e.at),"data-sort":new Date(e.at).getTime()||0,children:N(e.at)})]},e.id)})})})]})]})}export{te as Explore};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{r as n}from"./route-9BkoTWUE.js";import{I as r,c as i}from"./surface-c1kG1KPS.js";import{n as a,t as o}from"./utils-DJRAScIl.js";import{t as s}from"./jsx-runtime-LKYXHABd.js";import{I as c}from"./palette-C8W4Fd5n.js";import{A as l,b as u}from"./api-CorvgyDj.js";import{F as d,L as f,O as p,a as m,g as h,k as g,n as _}from"./pageBack-DDAAmq4R.js";import{B as v,Cn as y,Ct as b,Dn as x,E as S,G as C,Gn as w,Gr as T,I as E,Lt as D,Nt as O,P as k,R as A,Rt as j,k as M,l as N,nr as P,or as F,tr as I,tt as L,vn as R,zn as z}from"./line-icons-Cwj9OmCz.js";import{At as B,Dn as V,G as H,J as U,W,Zt as G,s as K,t as q}from"./frame-BC1vOowF.js";import{J,Y}from"./index-BoFziUZw.js";var X=e(t(),1),Z=s(),ee={API:z,"Automated tests":C,Browser:j,Data:L,Desktop:y,Mobile:F,Operations:I,"Pull requests":D,Quality:O,Release:w,Setup:P,Systems:x,"Test cases":v},Q={ready:{label:`Ready`,tone:`pass`,icon:N,color:`text-pass`},partial:{label:`Partly set up`,tone:`warn`,icon:E,color:`text-warn`},needs_setup:{label:`Needs setup`,tone:`neutral`,icon:k,color:`text-muted`}},te={models:`Models`,integrations:`Integrations`,monitor:`Monitor`,notifications:`Notifications`,agents:`Agents`,environments:`Environments`,containers:`Containers`,databases:`Databases`},$=4;async function ne(e,t){try{let{id:t}=await u.start(e,{});location.hash=n(`chats`,t)}catch(e){t(e.message)}}function re({f:e,onScope:t,busy:s}){let[c,u]=(0,X.useState)(null),[f,p]=(0,X.useState)(``),[h,g]=(0,X.useState)(``);(0,X.useEffect)(()=>{l.detail(e.id).then(u,e=>p(e.message))},[e.id]);let _=e.gaps.filter(e=>!e.optional),v=e.gaps.filter(e=>e.optional);return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 py-4`,children:[(0,Z.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:e.summary}),[[_,`Needs`],[v,`Would do more with`]].map(([e,t])=>e.length?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-body-sm font-medium`,children:t}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:e.map((e,r)=>(0,Z.jsxs)(`li`,{className:o(i,`flex flex-col gap-1 text-body-sm`),children:[(0,Z.jsx)(`span`,{className:o(t===`Needs`?`text-ink`:`text-ink-2`),children:e.missing}),(0,Z.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.fix}),e.settings&&(0,Z.jsxs)(`a`,{href:n(`settings`,e.settings),className:`inline-flex items-center gap-1 self-start text-body-sm font-medium`,children:[(0,Z.jsx)(P,{size:13,"aria-hidden":`true`}),`Set it up in Settings, `,te[e.settings]||e.settings]})]},r))})]},t):null),e.inputs.length>0&&(0,Z.jsxs)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:[`From your request: `,e.inputs.join(`; `),`.`]}),f&&(0,Z.jsx)(`p`,{className:`m-0 text-body-sm text-fail`,children:f}),c&&(0,Z.jsxs)(Z.Fragment,{children:[c.examples.length>0&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-body-sm font-medium`,children:`Ask for it like this`}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:c.examples.slice(0,4).map(t=>(0,Z.jsxs)(d,{size:`sm`,disabled:e.state===`needs_setup`,"data-tip":e.state===`needs_setup`?`Set it up first`:`Start a chat with this request`,onClick:()=>void ne(t,g),className:`h-auto min-h-8 max-w-full py-2 text-left whitespace-normal`,children:[(0,Z.jsx)(R,{"aria-hidden":`true`}),t]},t))}),h&&(0,Z.jsx)(`span`,{className:`text-body-sm text-fail`,children:h})]}),c.limits.length>0&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-body-sm font-medium`,children:`What it does not do`}),(0,Z.jsx)(`ul`,{className:`m-0 list-disc pl-6 text-body-sm text-ink-2`,children:c.limits.map(e=>(0,Z.jsx)(`li`,{children:e},e))})]}),c.docs.length>0&&(0,Z.jsxs)(`details`,{children:[(0,Z.jsxs)(`summary`,{className:`cursor-pointer text-body-sm font-medium`,children:[`How it works (`,a(c.docs.length,`section`),`)`]}),(0,Z.jsx)(`div`,{className:`mt-2 flex flex-col gap-4`,children:c.docs.map(e=>(0,Z.jsxs)(`section`,{className:`surface rounded-lg bg-bg p-6 shadow-sm`,children:[(0,Z.jsx)(`h4`,{className:`m-0 mb-1 text-body-sm font-medium`,children:e.heading}),(0,Z.jsx)(m,{text:e.text,className:`text-body-sm`})]},e.heading))})]}),(0,Z.jsxs)(`span`,{className:`font-mono text-body-sm text-muted [overflow-wrap:anywhere]`,children:[`Tools: `,c.tools.join(`, `)]})]}),(0,Z.jsxs)(`label`,{className:`flex flex-wrap items-center gap-4 pt-4 text-body-sm`,children:[(0,Z.jsxs)(`span`,{className:`flex-[1_1_240px]`,children:[`The agent gets its tools`,(0,Z.jsx)(`span`,{className:`block text-body-sm text-muted`,children:`agent.capabilities in forgeqe.yaml`})]}),(0,Z.jsxs)(r,{value:e.scope,disabled:s,onChange:e=>t(e.target.value),className:`w-[240px]`,children:[(0,Z.jsx)(`option`,{value:`auto`,children:`When a request is about it`}),(0,Z.jsx)(`option`,{value:`always`,children:`Always`}),(0,Z.jsx)(`option`,{value:`off`,children:`Never, in this project`})]})]})]})}function ie({embedded:e=!1}={}){let[t,n]=(0,X.useState)(null),[r,i]=(0,X.useState)(``),[a,s]=(0,X.useState)(``),[u,m]=(0,X.useState)(`all`),[v,y]=(0,X.useState)(``),[x,C]=(0,X.useState)(!1),[w,E]=(0,X.useState)([]),[D,O]=(0,X.useState)(!1),k=(0,X.useCallback)(()=>l.view().then(n,e=>i(e.message)),[]);(0,X.useEffect)(()=>void k(),[k]);let j=(0,X.useMemo)(()=>{let e=v.toLowerCase().split(/\s+/).filter(Boolean);return(t?.areas||[]).map(t=>({...t,features:t.features.filter(n=>(u===`all`||(u===`ready`?n.state!==`needs_setup`:n.state!==`ready`))&&e.every(e=>`${n.title} ${n.summary} ${t.area}`.toLowerCase().includes(e)))})).filter(e=>e.features.length)},[t,u,v]),N=async(e,t)=>{C(!0);try{n(await l.scope(e,t)),i(``)}catch(e){i(e.message)}finally{C(!1)}},P=t?.counts,F=t?.areas.flatMap(e=>e.features).find(e=>e.id===a),I=(0,Z.jsxs)(Z.Fragment,{children:[r&&(0,Z.jsx)(`p`,{role:`alert`,className:o(f.fail,`m-0`),children:r}),!t&&!r&&(0,Z.jsx)(h,{shape:`cards`,count:6}),t&&P&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(H,{label:`Features`,children:[(0,Z.jsx)(W,{icon:Q.ready.icon,label:`Ready`,value:String(P.ready)}),(0,Z.jsx)(W,{icon:Q.partial.icon,label:`Partly set up`,value:String(P.partial)}),(0,Z.jsx)(W,{icon:Q.needs_setup.icon,label:`Need setup`,value:String(P.needs_setup)})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(U,{label:`Show`,value:u,onChange:m,options:[{id:`all`,label:`All`},{id:`needs`,label:`Needs setup`},{id:`ready`,label:`Ready`}]}),(0,Z.jsx)(p,{id:`find-a-feature`,label:`Find a feature`,value:v,onChange:y})]}),j.length===0&&(0,Z.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Nothing matches.`}),(0,Z.jsx)(`div`,{className:`@container`,children:(0,Z.jsx)(`div`,{className:`grid auto-rows-fr grid-cols-1 items-stretch gap-4 @2xl:grid-cols-2 @5xl:grid-cols-3`,children:j.map((e,t)=>{let n=u!==`all`||v.trim()!==``||w.includes(e.area),r=n?e.features:e.features.slice(0,$),i=e.features.length-$,a=`area-list-${t}`;return(0,Z.jsxs)(`section`,{"aria-labelledby":`area-${t}`,className:o(`surface rounded-lg bg-bg p-6 shadow-sm`,`@container/col flex min-w-0 flex-col`),children:[(0,Z.jsx)(Y,{id:`area-${t}`,icon:ee[e.area]||b,title:e.area,n:e.features.length,className:`px-2 pt-2 pb-4`}),(0,Z.jsx)(`ul`,{id:a,className:`m-0 flex list-none flex-col gap-1 p-0`,children:r.map(e=>{let t=Q[e.state];return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>s(e.id),className:o(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`gap-2`),children:[(0,Z.jsx)(t.icon,{size:16,"aria-hidden":`true`,className:o(`flex-none`,t.color)}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1`,children:e.title}),(0,Z.jsxs)(`span`,{className:`sr-only`,children:[`, `,t.label]}),e.scope!==`auto`&&(0,Z.jsx)(`span`,{className:`flex-none text-body-sm text-muted`,children:e.scope===`always`?`Always given`:`Off here`}),(0,Z.jsx)(`span`,{className:`flex-none text-body-sm font-medium text-accent`,children:`More`})]})},e.id)})}),i>0&&u===`all`&&!v.trim()&&(0,Z.jsxs)(d,{variant:`ghost`,size:`sm`,"aria-expanded":n,"aria-controls":a,onClick:()=>E(n?w.filter(t=>t!==e.area):[...w,e.area]),"data-tip":n?`Fewer features`:`More features (${i})`,className:`mt-auto w-full justify-center gap-2 text-muted`,children:[n?(0,Z.jsx)(M,{"aria-hidden":`true`}):(0,Z.jsx)(S,{"aria-hidden":`true`}),n?`Less`:`More (${i})`]})]},e.area)})})}),(0,Z.jsx)(G,{open:!!F,wide:!0,onClose:()=>s(``),title:F?.title||``,description:F&&(0,Z.jsx)(g,{tone:Q[F.state].tone,icon:F.state!==`needs_setup`,children:Q[F.state].label}),footer:(0,Z.jsxs)(d,{onClick:()=>s(``),children:[(0,Z.jsx)(T,{"aria-hidden":`true`}),`Close`]}),children:F&&(0,Z.jsx)(re,{f:F,busy:x,onScope:e=>void N(F.id,e)})}),t.outOfScope.length>0&&(0,Z.jsx)(J,{icon:A,title:`Not what ForgeQE does`,n:t.outOfScope.length,actions:(0,Z.jsxs)(d,{size:`sm`,variant:`ghost`,"aria-expanded":D,"aria-controls":`out-of-scope`,onClick:()=>O(!D),children:[D?(0,Z.jsx)(M,{"aria-hidden":`true`}):(0,Z.jsx)(S,{"aria-hidden":`true`}),D?`Hide`:`Show`]}),children:(0,Z.jsx)(V,{open:D,id:`out-of-scope`,children:(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm`,children:t.outOfScope.map(e=>(0,Z.jsxs)(`li`,{children:[e.what,e.instead?(0,Z.jsxs)(`span`,{className:`text-muted`,children:[`; instead: `,e.instead]}):null]},e.what))})})})]})]});return e?(0,Z.jsx)(`div`,{className:`flex flex-col gap-6`,children:I}):(0,Z.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,Z.jsx)(K,{}),(0,Z.jsxs)(`main`,{className:o(q,`flex-auto gap-6`),children:[(0,Z.jsx)(_,{}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,Z.jsx)(B,{pixel:c.features,size:`lg`,head:!0}),(0,Z.jsx)(`h1`,{className:`m-0 flex-1 text-headline-md`,children:`What's ready`})]}),(0,Z.jsx)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:`What ForgeQE can do here. Pick one to see what it needs.`}),I]})]})}export{ie as Features};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{r as n}from"./route-9BkoTWUE.js";import{I as r,c as i}from"./surface-c1kG1KPS.js";import{n as a,t as o}from"./utils-DJRAScIl.js";import{t as s}from"./jsx-runtime-LKYXHABd.js";import{I as c}from"./palette-dAh9kV3S.js";import{A as l,b as u}from"./api-D1PU4zye.js";import{F as d,L as f,O as p,a as m,g as h,k as g,n as _}from"./pageBack-DfGBh1Hs.js";import{B as v,Cn as y,Ct as b,Dn as x,E as S,G as C,Gn as w,Gr as T,I as E,Lt as D,Nt as O,P as k,R as A,Rt as j,k as M,l as N,nr as P,or as F,tr as I,tt as L,vn as R,zn as z}from"./line-icons-Cwj9OmCz.js";import{At as B,Dn as V,G as H,J as U,W,Zt as G,s as K,t as q}from"./frame-D0MS2ZMz.js";import{J,Y}from"./index-F8zkXd19.js";var X=e(t(),1),Z=s(),ee={API:z,"Automated tests":C,Browser:j,Data:L,Desktop:y,Mobile:F,Operations:I,"Pull requests":D,Quality:O,Release:w,Setup:P,Systems:x,"Test cases":v},Q={ready:{label:`Ready`,tone:`pass`,icon:N,color:`text-pass`},partial:{label:`Partly set up`,tone:`warn`,icon:E,color:`text-warn`},needs_setup:{label:`Needs setup`,tone:`neutral`,icon:k,color:`text-muted`}},te={models:`Models`,integrations:`Integrations`,monitor:`Monitor`,notifications:`Notifications`,agents:`Agents`,environments:`Environments`,containers:`Containers`,databases:`Databases`},$=4;async function ne(e,t){try{let{id:t}=await u.start(e,{});location.hash=n(`chats`,t)}catch(e){t(e.message)}}function re({f:e,onScope:t,busy:s}){let[c,u]=(0,X.useState)(null),[f,p]=(0,X.useState)(``),[h,g]=(0,X.useState)(``);(0,X.useEffect)(()=>{l.detail(e.id).then(u,e=>p(e.message))},[e.id]);let _=e.gaps.filter(e=>!e.optional),v=e.gaps.filter(e=>e.optional);return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 py-4`,children:[(0,Z.jsx)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:e.summary}),[[_,`Needs`],[v,`Would do more with`]].map(([e,t])=>e.length?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-body-sm font-medium`,children:t}),(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:e.map((e,r)=>(0,Z.jsxs)(`li`,{className:o(i,`flex flex-col gap-1 text-body-sm`),children:[(0,Z.jsx)(`span`,{className:o(t===`Needs`?`text-ink`:`text-ink-2`),children:e.missing}),(0,Z.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.fix}),e.settings&&(0,Z.jsxs)(`a`,{href:n(`settings`,e.settings),className:`inline-flex items-center gap-1 self-start text-body-sm font-medium`,children:[(0,Z.jsx)(P,{size:13,"aria-hidden":`true`}),`Set it up in Settings, `,te[e.settings]||e.settings]})]},r))})]},t):null),e.inputs.length>0&&(0,Z.jsxs)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:[`From your request: `,e.inputs.join(`; `),`.`]}),f&&(0,Z.jsx)(`p`,{className:`m-0 text-body-sm text-fail`,children:f}),c&&(0,Z.jsxs)(Z.Fragment,{children:[c.examples.length>0&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-body-sm font-medium`,children:`Ask for it like this`}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:c.examples.slice(0,4).map(t=>(0,Z.jsxs)(d,{size:`sm`,disabled:e.state===`needs_setup`,"data-tip":e.state===`needs_setup`?`Set it up first`:`Start a chat with this request`,onClick:()=>void ne(t,g),className:`h-auto min-h-8 max-w-full py-2 text-left whitespace-normal`,children:[(0,Z.jsx)(R,{"aria-hidden":`true`}),t]},t))}),h&&(0,Z.jsx)(`span`,{className:`text-body-sm text-fail`,children:h})]}),c.limits.length>0&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-body-sm font-medium`,children:`What it does not do`}),(0,Z.jsx)(`ul`,{className:`m-0 list-disc pl-6 text-body-sm text-ink-2`,children:c.limits.map(e=>(0,Z.jsx)(`li`,{children:e},e))})]}),c.docs.length>0&&(0,Z.jsxs)(`details`,{children:[(0,Z.jsxs)(`summary`,{className:`cursor-pointer text-body-sm font-medium`,children:[`How it works (`,a(c.docs.length,`section`),`)`]}),(0,Z.jsx)(`div`,{className:`mt-2 flex flex-col gap-4`,children:c.docs.map(e=>(0,Z.jsxs)(`section`,{className:`surface rounded-lg bg-bg p-6 shadow-sm`,children:[(0,Z.jsx)(`h4`,{className:`m-0 mb-1 text-body-sm font-medium`,children:e.heading}),(0,Z.jsx)(m,{text:e.text,className:`text-body-sm`})]},e.heading))})]}),(0,Z.jsxs)(`span`,{className:`font-mono text-body-sm text-muted [overflow-wrap:anywhere]`,children:[`Tools: `,c.tools.join(`, `)]})]}),(0,Z.jsxs)(`label`,{className:`flex flex-wrap items-center gap-4 pt-4 text-body-sm`,children:[(0,Z.jsxs)(`span`,{className:`flex-[1_1_240px]`,children:[`The agent gets its tools`,(0,Z.jsx)(`span`,{className:`block text-body-sm text-muted`,children:`agent.capabilities in forgeqe.yaml`})]}),(0,Z.jsxs)(r,{value:e.scope,disabled:s,onChange:e=>t(e.target.value),className:`w-[240px]`,children:[(0,Z.jsx)(`option`,{value:`auto`,children:`When a request is about it`}),(0,Z.jsx)(`option`,{value:`always`,children:`Always`}),(0,Z.jsx)(`option`,{value:`off`,children:`Never, in this project`})]})]})]})}function ie({embedded:e=!1}={}){let[t,n]=(0,X.useState)(null),[r,i]=(0,X.useState)(``),[a,s]=(0,X.useState)(``),[u,m]=(0,X.useState)(`all`),[v,y]=(0,X.useState)(``),[x,C]=(0,X.useState)(!1),[w,E]=(0,X.useState)([]),[D,O]=(0,X.useState)(!1),k=(0,X.useCallback)(()=>l.view().then(n,e=>i(e.message)),[]);(0,X.useEffect)(()=>void k(),[k]);let j=(0,X.useMemo)(()=>{let e=v.toLowerCase().split(/\s+/).filter(Boolean);return(t?.areas||[]).map(t=>({...t,features:t.features.filter(n=>(u===`all`||(u===`ready`?n.state!==`needs_setup`:n.state!==`ready`))&&e.every(e=>`${n.title} ${n.summary} ${t.area}`.toLowerCase().includes(e)))})).filter(e=>e.features.length)},[t,u,v]),N=async(e,t)=>{C(!0);try{n(await l.scope(e,t)),i(``)}catch(e){i(e.message)}finally{C(!1)}},P=t?.counts,F=t?.areas.flatMap(e=>e.features).find(e=>e.id===a),I=(0,Z.jsxs)(Z.Fragment,{children:[r&&(0,Z.jsx)(`p`,{role:`alert`,className:o(f.fail,`m-0`),children:r}),!t&&!r&&(0,Z.jsx)(h,{shape:`cards`,count:6}),t&&P&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(H,{label:`Features`,children:[(0,Z.jsx)(W,{icon:Q.ready.icon,label:`Ready`,value:String(P.ready)}),(0,Z.jsx)(W,{icon:Q.partial.icon,label:`Partly set up`,value:String(P.partial)}),(0,Z.jsx)(W,{icon:Q.needs_setup.icon,label:`Need setup`,value:String(P.needs_setup)})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(U,{label:`Show`,value:u,onChange:m,options:[{id:`all`,label:`All`},{id:`needs`,label:`Needs setup`},{id:`ready`,label:`Ready`}]}),(0,Z.jsx)(p,{id:`find-a-feature`,label:`Find a feature`,value:v,onChange:y})]}),j.length===0&&(0,Z.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Nothing matches.`}),(0,Z.jsx)(`div`,{className:`@container`,children:(0,Z.jsx)(`div`,{className:`grid auto-rows-fr grid-cols-1 items-stretch gap-4 @2xl:grid-cols-2 @5xl:grid-cols-3`,children:j.map((e,t)=>{let n=u!==`all`||v.trim()!==``||w.includes(e.area),r=n?e.features:e.features.slice(0,$),i=e.features.length-$,a=`area-list-${t}`;return(0,Z.jsxs)(`section`,{"aria-labelledby":`area-${t}`,className:o(`surface rounded-lg bg-bg p-6 shadow-sm`,`@container/col flex min-w-0 flex-col`),children:[(0,Z.jsx)(Y,{id:`area-${t}`,icon:ee[e.area]||b,title:e.area,n:e.features.length,className:`px-2 pt-2 pb-4`}),(0,Z.jsx)(`ul`,{id:a,className:`m-0 flex list-none flex-col gap-1 p-0`,children:r.map(e=>{let t=Q[e.state];return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>s(e.id),className:o(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`gap-2`),children:[(0,Z.jsx)(t.icon,{size:16,"aria-hidden":`true`,className:o(`flex-none`,t.color)}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1`,children:e.title}),(0,Z.jsxs)(`span`,{className:`sr-only`,children:[`, `,t.label]}),e.scope!==`auto`&&(0,Z.jsx)(`span`,{className:`flex-none text-body-sm text-muted`,children:e.scope===`always`?`Always given`:`Off here`}),(0,Z.jsx)(`span`,{className:`flex-none text-body-sm font-medium text-accent`,children:`More`})]})},e.id)})}),i>0&&u===`all`&&!v.trim()&&(0,Z.jsxs)(d,{variant:`ghost`,size:`sm`,"aria-expanded":n,"aria-controls":a,onClick:()=>E(n?w.filter(t=>t!==e.area):[...w,e.area]),"data-tip":n?`Fewer features`:`More features (${i})`,className:`mt-auto w-full justify-center gap-2 text-muted`,children:[n?(0,Z.jsx)(M,{"aria-hidden":`true`}):(0,Z.jsx)(S,{"aria-hidden":`true`}),n?`Less`:`More (${i})`]})]},e.area)})})}),(0,Z.jsx)(G,{open:!!F,wide:!0,onClose:()=>s(``),title:F?.title||``,description:F&&(0,Z.jsx)(g,{tone:Q[F.state].tone,icon:F.state!==`needs_setup`,children:Q[F.state].label}),footer:(0,Z.jsxs)(d,{onClick:()=>s(``),children:[(0,Z.jsx)(T,{"aria-hidden":`true`}),`Close`]}),children:F&&(0,Z.jsx)(re,{f:F,busy:x,onScope:e=>void N(F.id,e)})}),t.outOfScope.length>0&&(0,Z.jsx)(J,{icon:A,title:`Not what ForgeQE does`,n:t.outOfScope.length,actions:(0,Z.jsxs)(d,{size:`sm`,variant:`ghost`,"aria-expanded":D,"aria-controls":`out-of-scope`,onClick:()=>O(!D),children:[D?(0,Z.jsx)(M,{"aria-hidden":`true`}):(0,Z.jsx)(S,{"aria-hidden":`true`}),D?`Hide`:`Show`]}),children:(0,Z.jsx)(V,{open:D,id:`out-of-scope`,children:(0,Z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm`,children:t.outOfScope.map(e=>(0,Z.jsxs)(`li`,{children:[e.what,e.instead?(0,Z.jsxs)(`span`,{className:`text-muted`,children:[`; instead: `,e.instead]}):null]},e.what))})})})]})]});return e?(0,Z.jsx)(`div`,{className:`flex flex-col gap-6`,children:I}):(0,Z.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,Z.jsx)(K,{}),(0,Z.jsxs)(`main`,{className:o(q,`flex-auto gap-6`),children:[(0,Z.jsx)(_,{}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,Z.jsx)(B,{pixel:c.features,size:`lg`,head:!0}),(0,Z.jsx)(`h1`,{className:`m-0 flex-1 text-headline-md`,children:`What's ready`})]}),(0,Z.jsx)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:`What ForgeQE can do here. Pick one to see what it needs.`}),I]})]})}export{ie as Features};